2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
25 * $XConsortium: ui_c_file.c /main/3 1995/11/06 18:15:01 rswiston $
27 * @(#)ui_c_file.c 3.115 21 Mar 1995
29 * RESTRICTED CONFIDENTIAL INFORMATION:
31 * The information in this document is subject to special restrictions in a
32 * confidential disclosure agreement between HP, IBM, Sun, USL, SCO and
33 * Univel. Do not distribute this document outside HP, IBM, Sun, USL, SCO,
34 * or Univel without Sun's specific written approval. This document and all
35 * copies and derivative works thereof must be returned or destroyed at Sun's
38 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
44 * Write a file containing object initialization functions (module_ui.c).
45 * These functions will be compiled and linked with the application.
52 #include <ab_private/AB.h>
53 #include <ab/util_types.h>
54 #include <ab_private/abio.h>
55 #include <ab_private/objxm.h>
56 #include <ab_private/strlist.h>
60 #include "instancesP.h"
62 #include "create_declsP.h"
64 #include "obj_namesP.h"
65 #include "ui_header_fileP.h" /* write_widget_specific_includes */
66 #include "ui_c_fileP.h"
67 #include "lib_func_stringsP.h"
70 static int write_all_obj_clear_procs(
71 GenCodeInfo genCodeInfo, ABObj rootObj);
72 static int write_all_obj_create_procs(GenCodeInfo genCodeInfo, ABObj rootObj);
73 static int write_call_create_proc(
74 GenCodeInfo genCodeInfo,
76 static int write_manage_widgets(
77 GenCodeInfo genCodeInfo,
80 static int write_manage_one_tree(
81 GenCodeInfo genCodeInfo,
84 static int write_manage_descendants(
85 GenCodeInfo genCodeInfo,
88 static int write_out_mainwin_set_areas(GenCodeInfo genCodeInfo, ABObj obj);
89 static int write_out_dialog_set_pane_height(GenCodeInfo genCodeInfo, ABObj obj);
90 static int write_add_widget_ref_resources(GenCodeInfo genCodeInfo, ABObj root);
91 static BOOL obj_should_be_managed_when_initialized(ABObj obj);
92 static BOOL abmfP_obj_has_unmanaged_child(ABObj obj);
93 static int write_action_target_includes(
94 GenCodeInfo genCodeInfo,
98 static int write_call_all_user_post_create_procs(
99 GenCodeInfo genCodeInfo,
102 static int write_call_user_post_create_procs(
103 GenCodeInfo genCodeInfo,
106 static int write_msg_init_proc(
107 GenCodeInfo genCodeInfo,
110 static int write_msg_clear_proc(
111 GenCodeInfo genCodeInfo,
115 static int abmfP_obj_get_num_conns_by_when(
120 static ABObj abmfP_obj_get_conn_by_when(
126 static StringList abmfP_get_msg_action_list(
132 strip_spaces_and_dots(char *mname)
134 static char new_name[MAXPATHLEN];
137 strcpy(new_name, mname);
138 p = (char *) strrchr(new_name, '.');
140 p = (char *) strrchr(p, '.');
142 p = (char *) strrchr(p, '.');
144 p = (char *) strrchr(p, ' ');
150 * Traverse object list and write out Widget decls.
153 write_all_shared_var_decls(GenCodeInfo genCodeInfo, ABObj module)
155 File codeFile = genCodeInfo->code_file;
160 * Define the widgets in this module
162 for (trav_open(&trav, module, AB_TRAV_UI);
163 (ui_obj = trav_next(&trav)) != NULL;)
165 if (obj_is_window(ui_obj))
167 abio_printf(codeFile, "\n%s\t%s = \n",
168 abmfP_get_c_struct_type_name(ui_obj),
169 abmfP_get_c_struct_global_name(ui_obj));
170 abio_printf(codeFile, "{\n False\t /* initialized */\n};\n");
172 else if (obj_is_message(ui_obj))
174 abio_printf(codeFile, "%s\t%s;\n",
176 abmfP_get_c_struct_global_name(ui_obj));
186 write_call_create_proc(GenCodeInfo genCodeInfo, ABObj obj)
188 File codeFile= genCodeInfo->code_file;
189 char createProc[1024];
190 ABObj structObj = NULL;
193 strcpy(createProc, abmfP_get_create_proc_name(obj));
195 abio_printf(codeFile, "%s(", createProc);
196 structObj = abmfP_obj_get_struct_obj(obj);
197 if ((structObj != NULL) && (structObj == abmfP_ip_obj(genCodeInfo)))
199 abio_printf(codeFile, "instance");
203 abio_printf(codeFile, "&(%s)", abmfP_get_c_name(genCodeInfo, obj));
206 abio_indent(codeFile);
208 if (abmfP_obj_create_proc_has_parent_param(obj))
210 STRING parentName = NULL;
213 if ( (obj == abmfP_ip_obj(genCodeInfo))
214 && (abmfP_parent_param(genCodeInfo) != NULL))
216 parentName = istr_string(abmfP_parent_param(genCodeInfo));
221 parentName = abmfP_get_widget_parent_name(genCodeInfo, obj);
223 abio_puts(codeFile, ",\n");
224 abio_printf(codeFile, "%s", parentName);
228 * Write out submenu parameters
231 int num_submenus = abmfP_get_num_cp_submenu_params(obj);
233 ABObj submenuObj = NULL;
235 for (submenu_num = 0; submenu_num < num_submenus; ++submenu_num)
237 submenuObj = abmfP_get_cp_submenu_param_obj(obj, submenu_num);
238 if (submenuObj == NULL)
242 abio_puts(codeFile, ",\n");
243 abio_printf(codeFile, "%s",
244 abmfP_get_c_name(genCodeInfo, submenuObj));
248 abio_puts(codeFile, ");\n");
249 abio_outdent(codeFile);
251 obj_set_was_written(obj, TRUE);
258 write_all_call_create_procs(GenCodeInfo genCodeInfo, ABObj root)
264 for (trav_open(&trav, root, AB_TRAV_UI | AB_TRAV_MOD_PARENTS_FIRST);
265 (obj= trav_next(&trav)) != NULL; )
267 if (abmfP_obj_has_create_proc(obj))
269 write_call_create_proc(genCodeInfo, obj);
272 else if (obj_is_menu_ref(obj))
274 write_call_create_proc(genCodeInfo, obj);
284 write_add_widget_ref_resources(GenCodeInfo genCodeInfo, ABObj root)
286 File codeFile= genCodeInfo->code_file;
292 abio_printf(codeFile, "\n");
293 abmfP_write_c_comment(genCodeInfo, FALSE,
294 "Add widget-reference resources.");
295 for (trav_open(&trav, root, AB_TRAV_UI | AB_TRAV_MOD_PARENTS_FIRST);
296 (obj= trav_next(&trav)) != NULL; )
298 menu = obj_get_menu(obj);
299 if (obj_is_item(obj) && (menu != NULL))
301 c_name= abmfP_get_c_name(genCodeInfo, obj);
302 abio_printf(codeFile, "XtVaSetValues(%s,\n", c_name);
303 abio_indent(codeFile);
304 abio_printf(codeFile, "XmNsubMenuId, %s,\n",
305 abmfP_get_c_name(genCodeInfo, menu));
306 abio_puts(codeFile, "NULL);\n");
307 abio_outdent(codeFile);
311 * Register popup menus
313 if ((menu != NULL) && (obj_is_root(obj)) && (obj_is_popup(menu)))
316 objxm_comp_get_subobj(obj, AB_CFG_MENU_PARENT_OBJ);
317 abio_printf(codeFile, "%s(%s,\n",
318 abmfP_lib_popup_menu_register->name,
319 abmfP_get_c_name(genCodeInfo, menu));
321 abio_indent(codeFile);
322 abio_printf(codeFile, "%s);\n",
323 abmfP_get_c_name(genCodeInfo, menuParent));
324 abio_outdent(codeFile);
327 if (abmfP_get_num_args_of_classes(obj, ABMF_ARGCLASS_WIDGET_REF) < 1)
332 c_name= abmfP_get_c_name(genCodeInfo, obj);
333 abio_printf(codeFile, "\n");
334 abmfP_xt_va_list_open_setvalues(genCodeInfo, obj);
335 abmfP_obj_spew_args(genCodeInfo,
336 obj, ABMF_ARGCLASS_WIDGET_REF, ABMF_ARGFMT_VA_LIST);
337 abmfP_xt_va_list_close(genCodeInfo);
346 write_manage_widgets(
347 GenCodeInfo genCodeInfo,
357 for (trav_open(&trav, tree, AB_TRAV_WINDOWS);
358 (obj = trav_next(&trav)) != NULL; )
360 write_manage_one_tree(genCodeInfo, obj);
369 write_manage_one_tree(
370 GenCodeInfo genCodeInfo,
374 write_manage_descendants(genCodeInfo, tree);
375 if (obj_should_be_managed_when_initialized(tree))
377 abio_printf(genCodeInfo->code_file, "XtManageChild(%s);\n",
378 abmfP_get_c_name(genCodeInfo, tree));
389 write_manage_descendants(
390 GenCodeInfo genCodeInfo,
394 AB_TRAVERSAL childTrav;
397 for (trav_open(&childTrav, obj, AB_TRAV_CHILDREN);
398 (child = trav_next(&childTrav)) != NULL; )
400 if (obj_is_ui(child))
402 write_manage_descendants(genCodeInfo, child);
405 trav_close(&childTrav);
407 /* Manage the children
408 * Manage them, if it is a composite and has children.
409 * Managing the child of a dialog shell will cause the shell to become
410 * visible, so don't manage the children of shells that aren't visible
412 if ( (!( ObjWClassIsDialogShell(obj)
413 && (!obj_is_initially_visible(obj))))
414 && (ObjWClassIsCompositeSubclass(obj))
415 && (abmfP_obj_has_field(obj))
416 && (obj_has_child(obj))
419 if ( abmfP_obj_has_unmanaged_child(obj)
420 || ObjWClassIsCommand(obj)
421 || ObjWClassIsFileSelectionBox(obj)
422 || ObjWClassIsMainWindow(obj)
423 || ObjWClassIsPanedWindow(obj)
424 || ObjWClassIsScrolledWindow(obj)
427 /* This object has one or more unmanaged children.
428 * Manage each child individually.
430 * Or, the widget class has a complex private structure (e.g.,
431 * ScrolledWindow), and we can't rely on XmNchildren.
433 AB_TRAVERSAL unmanagedTrav;
435 for (trav_open(&unmanagedTrav, obj, AB_TRAV_CHILDREN);
436 (child = trav_next(&unmanagedTrav)) != NULL; )
438 if (obj_should_be_managed_when_initialized(child))
440 abio_printf(genCodeInfo->code_file,
441 "XtManageChild(%s);\n",
442 abmfP_get_c_name(genCodeInfo, child));
445 trav_close(&unmanagedTrav);
449 /* All children managed - just manage 'em all
451 abio_printf(genCodeInfo->code_file, "XtVaGetValues(%s,\n",
452 abmfP_get_c_name(genCodeInfo, obj));
453 abio_indent(genCodeInfo->code_file);
454 abio_puts(genCodeInfo->code_file,
455 "XmNchildren, &children, XmNnumChildren, &numChildren, NULL);\n");
456 abio_outdent(genCodeInfo->code_file);
457 abio_printf(genCodeInfo->code_file,
458 "XtManageChildren(children, numChildren);\n");
465 write_out_mainwin_set_areas(GenCodeInfo genCodeInfo, ABObj obj)
467 ABObj mainwin, menubar, toolbar, workarea, footer;
469 if (!obj_is_base_win(obj))
472 mainwin = objxm_comp_get_subobj(obj, AB_CFG_WINDOW_MW_OBJ);
473 menubar = objxm_comp_mainwin_get_area(obj, AB_CONT_MENU_BAR);
474 toolbar = objxm_comp_mainwin_get_area(obj, AB_CONT_TOOL_BAR);
475 footer = objxm_comp_mainwin_get_area(obj, AB_CONT_FOOTER);
476 workarea = objxm_comp_get_subobj(obj, AB_CFG_PARENT_OBJ);
478 if (menubar || toolbar)
480 abio_printf(genCodeInfo->code_file,
481 "XmMainWindowSetAreas(%s,\n", abmfP_get_c_name(genCodeInfo,mainwin));
483 abio_indent(genCodeInfo->code_file);
485 abio_printf(genCodeInfo->code_file, "%s,\n",
486 menubar? abmfP_get_c_name(genCodeInfo, menubar) : "NULL");
488 abio_printf(genCodeInfo->code_file, "%s,\n",
489 toolbar? abmfP_get_c_name(genCodeInfo, toolbar) : "NULL");
491 abio_printf(genCodeInfo->code_file, "NULL,\n");
492 abio_printf(genCodeInfo->code_file, "NULL,\n");
494 abio_printf(genCodeInfo->code_file, "%s);\n",
495 workarea? abmfP_get_c_name(genCodeInfo, workarea) : "NULL");
497 abio_outdent(genCodeInfo->code_file);
501 abio_printf(genCodeInfo->code_file,
502 "XtVaSetValues(%s,\n", abmfP_get_c_name(genCodeInfo, mainwin));
504 abio_indent(genCodeInfo->code_file);
506 abio_printf(genCodeInfo->code_file,
507 "XmNmessageWindow, %s,\n",
508 abmfP_get_c_name(genCodeInfo, footer));
509 abio_printf(genCodeInfo->code_file, "NULL);\n");
511 abio_outdent(genCodeInfo->code_file);
517 write_set_fixed_pane(GenCodeInfo genCodeInfo, ABObj pane)
520 abio_printf(genCodeInfo->code_file,
521 "XtVaGetValues(%s,\n",
522 abmfP_get_c_name(genCodeInfo, pane));
523 abio_indent(genCodeInfo->code_file);
524 abio_printf(genCodeInfo->code_file, "XmNheight, &pane_height,\n");
525 abio_printf(genCodeInfo->code_file, "NULL);\n");
526 abio_outdent(genCodeInfo->code_file);
528 abio_printf(genCodeInfo->code_file,
529 "XtVaSetValues(%s,\n",
530 abmfP_get_c_name(genCodeInfo, pane));
532 abio_indent(genCodeInfo->code_file);
534 abio_printf(genCodeInfo->code_file,
535 "XmNpaneMinimum, pane_height,\n");
536 abio_printf(genCodeInfo->code_file,
537 "XmNpaneMaximum, pane_height,\n");
538 abio_printf(genCodeInfo->code_file, "NULL);\n\n");
540 abio_outdent(genCodeInfo->code_file);
546 write_out_dialog_set_pane_height(GenCodeInfo genCodeInfo, ABObj obj)
548 ABObj dialog, panedwin, button_panel, footer;
550 if (!obj_is_popup_win(obj))
553 panedwin = objxm_comp_get_subobj(obj, AB_CFG_WINDOW_PW_OBJ);
554 button_panel = objxm_comp_custdlg_get_area(obj, AB_CONT_BUTTON_PANEL);
555 footer = objxm_comp_custdlg_get_area(obj, AB_CONT_FOOTER);
557 if (button_panel || footer)
559 abmfP_write_c_comment(genCodeInfo, FALSE,
560 "Make Dialog Button-Panel & Footer a fixed height");
562 abio_printf(genCodeInfo->code_file, "{\n");
563 abio_indent(genCodeInfo->code_file);
565 abio_printf(genCodeInfo->code_file,"Dimension pane_height;\n\n");
568 write_set_fixed_pane(genCodeInfo, button_panel);
571 write_set_fixed_pane(genCodeInfo, footer);
573 abio_outdent(genCodeInfo->code_file);
574 abio_printf(genCodeInfo->code_file, "}\n");
581 * Don't manage popup windows or menus
583 * Where all the children of a widget are to be managed, use
584 * XtManageChildren(). That's supposed to be more efficient than
585 * managing each child, individually.
588 obj_should_be_managed_when_initialized(ABObj obj)
590 ABObj wholeObj = obj_get_root(obj);
591 ABObj itemParentObj = NULL;
593 if (!abmfP_obj_has_field(obj))
599 * Menus are not managed until needed
601 if (obj_is_menu(obj))
607 * Shells are not managed (Xt error!)
608 * The top composite in a dialog is not managed, so that the dialog
609 * will not become visible until needed.
611 if ( ObjWClassIsShellSubclass(obj)
612 || ( (abmfP_parent(obj) != NULL)
613 && (((abmfP_parent(obj))->type == AB_TYPE_DIALOG)
614 || ((abmfP_parent(obj))->type == AB_TYPE_FILE_CHOOSER))
615 && (ObjWClassIsDialogShell(abmfP_parent(obj)))) )
621 * The item parent for an option menu is really a menu pane
623 if (wholeObj != NULL)
625 itemParentObj = objxm_comp_get_subobj(wholeObj, AB_CFG_PARENT_OBJ);
627 if ( obj_is_menu(obj)
628 || (obj_is_option_menu(wholeObj) && (obj == itemParentObj)) )
633 if (!obj_is_initially_visible(obj))
641 abmfP_obj_has_unmanaged_child(ABObj obj)
647 for (trav_open(&trav, obj, AB_TRAV_CHILDREN);
648 (child = trav_next(&trav)) != NULL; )
650 /* menus don't show up in XmNchildren list, so we need to ignore them
652 if ( abmfP_obj_has_field(child)
653 && (!obj_is_menu(child))
654 && (!ObjWClassIsMenuShell(child))
655 && (!ObjWClassIsPulldownMenu(child))
656 && (!ObjWClassIsPopupMenu(child))
657 && (!obj_should_be_managed_when_initialized(child)) )
659 /* this is an unmanaged child */
671 * Write out one object clear proc
674 write_obj_clear_proc(GenCodeInfo genCodeInfo, ABObj obj)
676 File file= genCodeInfo->code_file;
677 abmfP_write_clear_proc_begin(genCodeInfo, obj);
679 "memset((void *)(%s), 0, sizeof(*%s));\n",
680 abmfP_instance_ptr_var_name,
681 abmfP_instance_ptr_var_name
683 abmfP_write_c_func_end(genCodeInfo, "0");
689 * Write out one object initialization proc
692 write_obj_init_proc(GenCodeInfo genCodeInfo, ABObj parent)
695 File codeFile = genCodeInfo->code_file;
697 ABObj whole_obj = NULL;
701 abmfP_gencode_enter_func(genCodeInfo);
702 genCodeInfo->cur_func.ip_obj= abmfP_obj_get_struct_obj(parent);
703 genCodeInfo->cur_func.create_obj= abmfP_obj_get_struct_obj(parent);
704 abmfP_parent_param(genCodeInfo) = istr_const(abmfP_parent_param_name);
705 abmfP_parent_param_has_value(genCodeInfo) = TRUE;
707 abmfP_write_init_proc_begin(genCodeInfo, parent);
709 abio_printf(codeFile, "WidgetList\tchildren = NULL;\n");
710 abio_printf(codeFile, "int\t\tnumChildren = 0;\n");
711 abio_printf(codeFile, "if (%s->initialized)\n",
712 abmfP_instance_ptr_var_name);
713 abmfP_write_c_block_begin(genCodeInfo);
714 abio_puts(codeFile, "return 0;\n");
715 abmfP_write_c_block_end(genCodeInfo);
716 abio_printf(codeFile, "%s->initialized = True;\n\n",
717 abmfP_instance_ptr_var_name);
719 inst= write_all_call_create_procs(genCodeInfo, parent);
720 write_add_widget_ref_resources(genCodeInfo, parent);
723 * Write out code to layout groups
725 abio_printf(codeFile, "\n");
726 abmfP_write_c_comment(genCodeInfo, FALSE,
727 "Call utility functions to do group layout");
728 for (trav_open(&trav, parent, AB_TRAV_GROUPS);
729 (obj = trav_next(&trav)) != NULL;)
731 if (abmfP_obj_needs_align_handler(obj))
733 ABObj oobj = objxm_comp_get_subobj(obj, AB_CFG_OBJECT_OBJ);
735 abio_printf(codeFile, "\n");
737 abio_printf(genCodeInfo->code_file,
738 "%s(%s,\n\t\t%s,\n\t\t%s,\n\t\t%s,\n\t\t%d, %d, %d, %d, %d);\n",
739 abmfP_lib_children_align->name,
740 abmfP_get_c_name(genCodeInfo, oobj),
741 abmfP_obj_get_group_type(obj),
742 abmfP_obj_get_row_align_type(obj),
743 abmfP_obj_get_col_align_type(obj),
745 obj_get_num_rows(obj),
746 obj_get_num_columns(obj),
747 obj_get_hoffset(obj),
748 obj_get_voffset(obj));
753 abio_printf(codeFile, "\n");
754 if (obj_is_base_win(parent))
755 write_out_mainwin_set_areas(genCodeInfo, parent);
756 else if (obj_is_popup_win(parent))
757 write_out_dialog_set_pane_height(genCodeInfo, parent);
759 abio_puts(codeFile, nlstr);
760 abmfP_write_c_comment(genCodeInfo, FALSE,
761 "Manage the tree, from the bottom up.");
762 write_manage_widgets(genCodeInfo, parent);
763 if (obj_is_popup_win(parent))
765 ABObj pwObj = objxm_comp_get_subobj(parent, AB_CFG_WINDOW_PW_OBJ);
769 abmfP_write_c_comment(genCodeInfo, FALSE,
770 "Turn off traversal for invisible sash in dialog's PanedWindow");
771 abio_printf(codeFile, "%s(%s);\n",
772 abmfP_lib_remove_sash_focus->name,
773 abmfP_get_c_name(genCodeInfo, pwObj));
780 abio_printf(codeFile, "\n");
781 abmfP_write_c_comment(genCodeInfo, FALSE,
782 "Add User and Connection callbacks");
783 for (trav_open(&trav, parent, AB_TRAV_UI);
784 (obj = trav_next(&trav)) != NULL;)
786 if ( ((abmfP_get_window_parent(obj) == parent) || (obj == parent))
787 && (abmfP_write_add_callbacks_and_actions(genCodeInfo, obj) < 0)
795 abmfP_write_c_func_end(genCodeInfo, "0");
798 abmfP_gencode_exit_func(genCodeInfo);
804 write_all_obj_init_procs(GenCodeInfo genCodeInfo, ABObj module)
808 BOOL MsgClearWritten = FALSE;
810 abmfP_tree_set_written(module, FALSE);
811 for (trav_open(&trav, module, AB_TRAV_SALIENT_UI);
812 (obj = trav_next(&trav)) != NULL;)
815 if (obj_is_message(obj) && !MsgClearWritten)
817 write_msg_clear_proc(genCodeInfo, module);
818 MsgClearWritten = TRUE;
820 else if (obj_is_window(obj))
822 write_obj_clear_proc(genCodeInfo, obj);
826 if (obj_is_window(obj))
828 write_obj_clear_proc(genCodeInfo, obj);
829 write_obj_init_proc(genCodeInfo, obj);
831 else if (obj_is_message(obj))
833 write_msg_init_proc(genCodeInfo, obj);
837 abmfP_tree_set_written(module, FALSE);
842 write_create_proc_decls(GenCodeInfo genCodeInfo, ABObj module)
844 File codeFile = genCodeInfo->code_file;
849 abmfP_tree_set_written(module, FALSE);
850 abio_puts(codeFile, "\n");
851 abmfP_write_c_comment(genCodeInfo, FALSE,
852 "Widget create procedure decls");
854 for (trav_open(&trav, module, AB_TRAV_UI);
855 (obj = trav_next(&trav)) != NULL;)
857 if (!abmfP_obj_has_create_proc(obj))
861 abmfP_write_create_proc_decl(genCodeInfo, obj);
864 abio_puts(codeFile, "\n");
870 set_parent_for_submenu(ABObj obj)
874 if (obj_has_child(obj))
876 child = obj_get_child(obj, 0);
877 if (!obj_has_parent(child))
879 obj_append_child(obj, child);
886 item_has_children(ABObj obj)
888 return (obj_is_menu_item(obj) && obj_has_child(obj));
893 check_for_submenus(ABObj obj)
898 for (trav_open(&trav, obj, AB_TRAV_CHILDREN);
899 (child = trav_next(&trav)) != NULL;)
901 if (item_has_children(child))
903 set_parent_for_submenu(child);
904 check_for_submenus(child);
912 assign_parent_to_submenus(ABObj project)
917 for (trav_open(&trav, project, AB_TRAV_UI);
918 (obj = trav_next(&trav)) != NULL;)
920 if (obj_is_menu(obj))
921 check_for_submenus(obj);
927 write_obj_create_proc(GenCodeInfo genCodeInfo, ABObj obj)
929 File codeFile = genCodeInfo->code_file;
930 ABObj top_obj = NULL;
931 ABObj ip_obj = abmfP_obj_get_struct_obj(obj);
932 ABObj help_obj = NULL;
933 int num_post_create_procs = 0;
934 STRING help_volume, help_location, help_text;
936 abmfP_gencode_enter_func(genCodeInfo);
937 abmfP_create_obj(genCodeInfo) = obj;
938 abmfP_ip_obj(genCodeInfo) = ip_obj;
940 if (abmfP_obj_create_proc_has_parent_param(obj))
942 abmfP_parent_param(genCodeInfo) = istr_const(abmfP_parent_param_name);
943 abmfP_parent_param_has_value(genCodeInfo) = TRUE;
946 abmfP_write_create_proc_begin(genCodeInfo, obj);
947 abmfP_write_create_proc_decls(genCodeInfo);
948 abmfP_write_create_widgets_for_comp_obj(genCodeInfo, obj);
949 write_call_all_user_post_create_procs(genCodeInfo, obj);
951 if (abmfP_obj_needs_centering_handler(obj))
953 abio_printf(genCodeInfo->code_file, "\t%s(%s, %s);\n",
954 abmfP_lib_center->name,
955 abmfP_get_c_name(genCodeInfo, obj),
956 abmfP_obj_get_centering_type(obj));
959 abmfP_write_c_func_end(genCodeInfo, "0");
961 obj_set_was_written(obj, TRUE);
962 abmfP_obj_set_subobjs_written(obj, TRUE);
963 abmfP_obj_set_items_written(obj, TRUE);
966 abmfP_gencode_exit_func(genCodeInfo);
972 write_call_all_user_post_create_procs(
973 GenCodeInfo genCodeInfo,
977 int return_value = 0;
978 int total_post_create_procs = 0;
980 AB_TRAVERSAL itemTrav;
982 total_post_create_procs +=
983 abmfP_obj_get_num_conns_by_when(obj, AB_WHEN_AFTER_CREATED);
984 for (trav_open(&itemTrav, obj, AB_TRAV_ITEMS_FOR_OBJ);
985 (item = trav_next(&itemTrav)) != NULL; )
987 total_post_create_procs +=
988 abmfP_obj_get_num_conns_by_when(item, AB_WHEN_AFTER_CREATED);
990 /* don't close trav, yet */
992 if (total_post_create_procs > 0)
994 abio_puts(genCodeInfo->code_file, "\n");
995 abmfP_write_c_comment(genCodeInfo, FALSE,
996 "Call user (Post-)Create procs");
997 for (trav_reset(&itemTrav);
998 (item = trav_next(&itemTrav)) != NULL; )
1000 write_call_user_post_create_procs(genCodeInfo, item);
1004 * Call object's last, after all the subobjecs completely inited
1006 write_call_user_post_create_procs(genCodeInfo, obj);
1008 trav_close(&itemTrav); /* close it, now */
1010 return return_value;
1015 write_call_user_post_create_procs(GenCodeInfo genCodeInfo, ABObj subObj)
1017 int return_value = 0;
1018 int num_post_create_procs = 0;
1019 ABObj action = NULL;
1020 ABObj compObj = obj_get_root(subObj);
1021 ABObj sourceObj = objxm_comp_get_source_for_when(
1022 compObj, AB_WHEN_AFTER_CREATED);
1023 ABObj targetObj = NULL;
1024 char targetStructPtrName[MAX_NAME_SIZE];
1025 char sourceName[MAX_NAME_SIZE];
1026 *targetStructPtrName = 0;
1029 num_post_create_procs =
1030 abmfP_obj_get_num_conns_by_when(compObj, AB_WHEN_AFTER_CREATED);
1031 if (num_post_create_procs > 0)
1035 for (i = 0; i < num_post_create_procs; ++i)
1037 action = abmfP_obj_get_conn_by_when(
1038 compObj, AB_WHEN_AFTER_CREATED, i);
1039 targetObj = obj_get_to(action);
1044 util_strncpy(sourceName, abmfP_get_c_name(
1045 genCodeInfo, sourceObj), MAX_NAME_SIZE);
1047 if (targetObj == NULL)
1049 strcpy(targetStructPtrName, abmfP_str_null);
1053 util_strncpy(targetStructPtrName,
1054 abmfP_get_c_struct_ptr_name(genCodeInfo, targetObj),
1058 abio_printf(genCodeInfo->code_file,
1059 "%s(%s, (XtPointer)%s, (XtPointer)%s);\n",
1060 abmfP_get_action_name(action),
1062 targetStructPtrName,
1063 abmfP_get_c_struct_ptr_name(genCodeInfo, sourceObj));
1066 return return_value;
1071 * Writes out parents before children
1074 write_all_obj_create_procs(GenCodeInfo genCodeInfo, ABObj rootObj)
1076 int return_value = 0;
1077 int rc = 0; /* return code */
1081 for (trav_open(&trav, rootObj, AB_TRAV_UI | AB_TRAV_MOD_PARENTS_FIRST);
1082 (obj = trav_next(&trav)) != NULL;)
1084 if (!abmfP_obj_has_create_proc(obj))
1088 abio_printf(genCodeInfo->code_file, "\n\n");
1089 if ((rc = write_obj_create_proc(genCodeInfo, obj)) < 0)
1097 return return_value;
1105 write_includes(GenCodeInfo genCodeInfo, ABObj module)
1107 File codeFile = genCodeInfo->code_file;
1108 int num_written = 0;
1111 BOOL includeGlyphFiles = FALSE;
1112 STRING glyphFile = NULL;
1113 StringListRec glyphIncludesRec;
1114 StringList glyphIncludes= &(glyphIncludesRec);
1115 strlist_construct(glyphIncludes);
1117 strlist_set_is_unique(glyphIncludes, TRUE);
1119 abmfP_tree_write_widget_specific_includes(codeFile, module);
1120 abmfP_write_c_local_include(genCodeInfo,
1121 abmfP_get_utils_header_file_name(module));
1122 abmfP_write_c_local_include(genCodeInfo,
1123 abmfP_get_project_header_file_name(module));
1125 write_action_target_includes(genCodeInfo, module);
1127 abmfP_write_c_local_include(genCodeInfo,
1128 abmfP_get_ui_header_file_name(module));
1130 if (includeGlyphFiles)
1132 for (trav_open(&trav, module, AB_TRAV_SALIENT_UI);
1133 (obj = trav_next(&trav)) != NULL; )
1136 if (abmfP_obj_has_glyph_label(obj))
1138 glyphFile = obj_get_label(obj);
1139 if (!strlist_str_exists(glyphIncludes, glyphFile))
1141 strlist_add_str(glyphIncludes, glyphFile, NULL);
1142 abmfP_write_c_local_include(genCodeInfo, glyphFile);
1146 trav_close(&trav); /* finally close it */
1149 strlist_destruct(glyphIncludes);
1155 write_action_target_includes(GenCodeInfo genCodeInfo, ABObj module)
1157 int numIncludes = 0;
1158 ABObj project = obj_get_project(module);
1159 ABObj action = NULL;
1161 ABObj fromObj = NULL;
1162 ABObj fromModule = NULL;
1164 ABObj toModule = NULL;
1165 STRING headerFile = NULL;
1166 StringListRec targetIncludes;
1167 strlist_construct(&targetIncludes);
1170 * REMIND: this should be AB_TRAV_ACTIONS_FOR_OBJ.
1171 * Currently, there's a bug that puts cross-module
1172 * connection under the module, rather than the project
1174 for (trav_open(&trav, project, AB_TRAV_ACTIONS);
1175 (action = trav_next(&trav)) != NULL; )
1177 fromObj = obj_get_from(action);
1179 if (fromObj != NULL)
1181 fromModule = obj_get_module(fromObj);
1183 toObj = obj_get_to(action);
1187 toModule= obj_get_module(toObj);
1190 if ((fromModule != NULL) && (fromModule == module)
1191 && (toModule != NULL) && (toModule != module))
1193 /* cross-module connection from this module */
1194 headerFile = abmfP_get_ui_header_file_name(toModule);
1195 if (!strlist_str_exists(&targetIncludes, headerFile))
1197 strlist_add_str(&targetIncludes, headerFile, NULL);
1198 abmfP_write_c_local_include(genCodeInfo, headerFile);
1205 strlist_destruct(&targetIncludes);
1212 * Write the object initialization function file.
1215 abmfP_write_ui_c_file(
1216 GenCodeInfo genCodeInfo,
1217 STRING codeFileName,
1221 File codeFile = genCodeInfo->code_file;
1222 char moduleName[1024];
1224 char *errmsg = NULL;
1228 * Write file header.
1230 sprintf(moduleName, "module %s", util_strsafe(obj_get_name(module)));
1231 abmfP_write_file_header(
1236 util_get_program_name(),
1238 " * Contains: user module object initialize and create functions"
1245 write_includes(genCodeInfo, module);
1248 * REMIND: include header files from other modules
1250 abio_puts(codeFile, "\n");
1252 assign_parent_to_submenus(module);
1257 write_all_shared_var_decls(genCodeInfo, module);
1258 write_create_proc_decls(genCodeInfo, module);
1259 write_all_obj_init_procs(genCodeInfo, module);
1260 write_all_obj_create_procs(genCodeInfo, module);
1266 static ABObj connFromObj = NULL;
1267 static AB_WHEN connWhen = AB_WHEN_UNDEF;
1270 action_from_pred(ABObj obj)
1272 return ( (obj_get_from(obj) == connFromObj)
1273 && (obj_get_when(obj) == connWhen) );
1278 abmfP_obj_get_num_conns_by_when(
1283 ABObj project = obj_get_project(obj);
1285 if (project == NULL)
1290 connFromObj = obj_get_actual_obj(obj); connWhen = when;
1291 numConns = trav_count_cond(project, AB_TRAV_ACTIONS, action_from_pred);
1292 connFromObj = NULL; connWhen = AB_WHEN_UNDEF;
1298 abmfP_obj_get_conn_by_when(
1304 ABObj project = obj_get_project(obj);
1306 ABObj action = NULL;
1307 if (project == NULL)
1312 connFromObj = obj_get_actual_obj(obj); connWhen = when;
1313 trav_open_cond(&trav, project, AB_TRAV_ACTIONS, action_from_pred);
1314 trav_goto(&trav, which_conn);
1315 action = trav_obj(&trav);
1317 connFromObj = NULL; connWhen = AB_WHEN_UNDEF;
1323 abmfP_get_msg_action_list(
1327 ABObj module = NULL;
1328 ABObj action = NULL;
1329 ABObj fromObj = NULL;
1331 StringList callback_funcs = strlist_create();
1333 if (!obj_is_message(msg_obj))
1336 module = obj_get_module(msg_obj);
1337 for (trav_open(&trav, module, AB_TRAV_ACTIONS);
1338 (action = trav_next(&trav)) != NULL; )
1340 fromObj = obj_get_from(action);
1341 if (fromObj == msg_obj)
1343 strlist_add_str(callback_funcs,
1344 abmfP_get_action_name(action),
1345 (void *) obj_get_when(action));
1349 if (strlist_get_num_strs(callback_funcs) == 0)
1351 strlist_destroy(callback_funcs);
1352 callback_funcs = NULL;
1355 return (callback_funcs);
1359 * Write out one message object initialization proc
1362 write_msg_init_proc(GenCodeInfo genCodeInfo, ABObj parent)
1364 int return_value = 0;
1365 File codeFile = genCodeInfo->code_file;
1366 STRING i18n_str = (STRING) NULL;
1367 STRING dialogType = (STRING) NULL;
1368 STRING default_btn = (STRING) NULL;
1369 STRING str = (STRING) NULL;
1370 StringList callback_funcs = (StringList) NULL;
1371 STRING callback_func = (STRING) NULL;
1372 STRING okCB = (STRING) NULL,
1373 action2CB = (STRING) NULL,
1374 action3CB = (STRING) NULL,
1375 cancelCB = (STRING) NULL;
1376 AB_WHEN when = AB_WHEN_UNDEF;
1378 STRING help_text = (STRING) NULL,
1379 help_volume = (STRING) NULL,
1380 help_location = (STRING) NULL;
1382 abmfP_gencode_enter_func(genCodeInfo);
1383 genCodeInfo->cur_func.ip_obj = abmfP_obj_get_struct_obj(parent);
1384 genCodeInfo->cur_func.create_obj = abmfP_obj_get_struct_obj(parent);
1385 abmfP_parent_param(genCodeInfo) = (ISTRING) NULL;
1386 abmfP_parent_param_has_value(genCodeInfo) = FALSE;
1388 abmfP_write_init_proc_begin(genCodeInfo, parent);
1390 /* Write out one local variable for help I18N */
1391 if ( obj_has_help_data(parent) &&
1392 (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API))
1394 abio_puts(codeFile, "char *tmp_txt;\n");
1397 abio_printf(codeFile, "if (%s->initialized)\n",
1398 abmfP_instance_ptr_var_name);
1399 abmfP_write_c_block_begin(genCodeInfo);
1400 abio_puts(codeFile, "return 0;\n");
1401 abmfP_write_c_block_end(genCodeInfo);
1402 abio_printf(codeFile, "%s->initialized = True;\n\n",
1403 abmfP_instance_ptr_var_name);
1405 /* Set the Message Dialog Type */
1406 switch (obj_get_msg_type(parent))
1409 dialogType = "XmDIALOG_ERROR";
1411 case AB_MSG_INFORMATION:
1412 dialogType = "XmDIALOG_INFORMATION";
1414 case AB_MSG_QUESTION:
1415 dialogType = "XmDIALOG_QUESTION";
1417 case AB_MSG_WARNING:
1418 dialogType = "XmDIALOG_WARNING";
1420 case AB_MSG_WORKING:
1421 dialogType = "XmDIALOG_WORKING";
1426 abio_printf(codeFile, "%s->type = ", abmfP_instance_ptr_var_name);
1427 abio_printf(codeFile, "%s;\n", dialogType);
1429 /* Set Message Dialog Title */
1430 abio_printf(codeFile, "%s->title = ", abmfP_instance_ptr_var_name);
1431 str = obj_get_label(parent);
1432 if (!util_strempty(str))
1434 if (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API)
1436 i18n_str = abmfP_catgets_prefix_str(genCodeInfo, parent, str);
1437 abio_printf(codeFile, "XmStringCreateLocalized(%s", i18n_str);
1438 abio_put_string(codeFile, str);
1439 abio_puts(codeFile, "));\n");
1443 abio_puts(codeFile, "XmStringCreateLocalized(");
1444 abio_put_string(codeFile, str);
1445 abio_puts(codeFile, ");\n");
1450 abio_puts(codeFile, "(XmString) NULL;\n");
1453 /* Set Message Dialog message string */
1454 abio_printf(codeFile, "%s->message = ", abmfP_instance_ptr_var_name);
1455 str = obj_get_msg_string(parent);
1456 if (!util_strempty(str))
1458 if (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API)
1460 i18n_str = abmfP_catgets_prefix_str(genCodeInfo, parent, str);
1461 abio_printf(codeFile, "XmStringCreateLocalized(%s", i18n_str);
1462 abio_put_string(codeFile, str);
1463 abio_puts(codeFile, "));\n");
1467 abio_puts(codeFile, "XmStringCreateLocalized(");
1468 abio_put_string(codeFile, str);
1469 abio_puts(codeFile, ");\n");
1474 abio_puts(codeFile, "(XmString) NULL;\n");
1477 /* Get callback function names */
1478 callback_funcs = abmfP_get_msg_action_list(parent);
1479 if (callback_funcs != NULL)
1481 for (i = 0; i < strlist_get_num_strs(callback_funcs); i++)
1483 callback_func = strlist_get_str(callback_funcs, i, (void**)&when);
1486 case AB_WHEN_ACTION1:
1487 okCB = callback_func;
1489 case AB_WHEN_ACTION2:
1490 action2CB = callback_func;
1492 case AB_WHEN_ACTION3:
1493 action3CB = callback_func;
1495 case AB_WHEN_CANCEL:
1496 cancelCB = callback_func;
1503 /* Set the Action1 button (Ok button) label */
1504 abio_printf(codeFile, "%s->action1_label = ", abmfP_instance_ptr_var_name);
1505 str = obj_get_action1_label(parent);
1506 if (!util_strempty(str))
1508 if (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API)
1510 i18n_str = abmfP_catgets_prefix_str(genCodeInfo, parent, str);
1511 abio_printf(codeFile, "XmStringCreateLocalized(%s", i18n_str);
1512 abio_put_string(codeFile, str);
1513 abio_puts(codeFile, "));\n");
1517 abio_puts(codeFile, "XmStringCreateLocalized(");
1518 abio_put_string(codeFile, str);
1519 abio_puts(codeFile, ");\n");
1524 abio_puts(codeFile, "(XmString) NULL;\n");
1527 /* Set the Action1 button callback (Ok callback) */
1528 abio_printf(codeFile, "%s->action1_callback = ", abmfP_instance_ptr_var_name);
1529 abio_printf(codeFile, "%s;\n", okCB? okCB : "(XtCallbackProc) NULL");
1531 /* Set the Action2 button label (Extra button) */
1532 abio_printf(codeFile, "%s->action2_label = ", abmfP_instance_ptr_var_name);
1533 str = obj_get_action2_label(parent);
1534 if (!util_strempty(str))
1536 if (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API)
1538 i18n_str = abmfP_catgets_prefix_str(genCodeInfo, parent, str);
1539 abio_printf(codeFile, "XmStringCreateLocalized(%s", i18n_str);
1540 abio_put_string(codeFile, str);
1541 abio_puts(codeFile, "));\n");
1545 abio_puts(codeFile, "XmStringCreateLocalized(");
1546 abio_put_string(codeFile, str);
1547 abio_puts(codeFile, ");\n");
1552 abio_puts(codeFile, "(XmString) NULL;\n");
1555 /* Set the Action2 button callback (Extra button) */
1556 abio_printf(codeFile,"%s->action2_callback = ",abmfP_instance_ptr_var_name);
1557 abio_printf(codeFile, "%s;\n",
1558 action2CB? action2CB : "(XtCallbackProc) NULL");
1560 /* Set the Action3 button label (Extra button) */
1561 abio_printf(codeFile, "%s->action3_label = ", abmfP_instance_ptr_var_name);
1562 str = obj_get_action3_label(parent);
1563 if (!util_strempty(str))
1565 if (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API)
1567 i18n_str = abmfP_catgets_prefix_str(genCodeInfo, parent, str);
1568 abio_printf(codeFile, "XmStringCreateLocalized(%s", i18n_str);
1569 abio_put_string(codeFile, str);
1570 abio_puts(codeFile, "));\n");
1574 abio_puts(codeFile, "XmStringCreateLocalized(");
1575 abio_put_string(codeFile, str);
1576 abio_puts(codeFile, ");\n");
1581 abio_puts(codeFile, "(XmString) NULL;\n");
1584 /* Set the Action3 button callback (Extra button) */
1585 abio_printf(codeFile,"%s->action3_callback = ",abmfP_instance_ptr_var_name);
1586 abio_printf(codeFile, "%s;\n",
1587 action3CB? action3CB : "(XtCallbackProc) NULL");
1589 /* Set the Cancel button boolean */
1590 abio_printf(codeFile, "%s->cancel_button = ", abmfP_instance_ptr_var_name);
1591 abio_printf(codeFile, "%s;\n",
1592 obj_has_cancel_button(parent)? "True":"False");
1594 /* Set the Cancel button callback */
1595 abio_printf(codeFile, "%s->cancel_callback = ", abmfP_instance_ptr_var_name);
1596 abio_printf(codeFile, "%s;\n", cancelCB? cancelCB:"(XtCallbackProc) NULL");
1598 /* Set the Help button boolean */
1599 abio_printf(codeFile, "%s->help_button = ", abmfP_instance_ptr_var_name);
1600 abio_printf(codeFile, "%s;\n",
1601 obj_has_help_button(parent)? "True":"False");
1603 /* Set Object Help Data */
1604 if (obj_has_help_data(parent))
1606 obj_get_help_data(parent, &help_volume, &help_location, &help_text);
1608 /* Set the help text field */
1609 if (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API)
1611 i18n_str = abmfP_catgets_prefix_str(genCodeInfo,parent,help_text);
1612 abio_printf(codeFile,"tmp_txt = %s", i18n_str);
1613 abio_put_string(codeFile, help_text);
1614 abio_puts(codeFile, ");\n");
1615 abio_printf(codeFile,
1616 "%s->help_data.help_text = XtMalloc(strlen(tmp_txt)+1);\n",
1617 abmfP_instance_ptr_var_name);
1618 abio_printf(codeFile,
1619 "strcpy(%s->help_data.help_text, tmp_txt);\n",
1620 abmfP_instance_ptr_var_name);
1621 abio_puts(codeFile,"\n");
1625 abio_printf(codeFile, "%s->help_data.help_text = ",
1626 abmfP_instance_ptr_var_name);
1627 abio_put_string(codeFile, help_text);
1628 abio_puts(codeFile, ";\n");
1631 /* Set the help volume field */
1632 if (!util_strempty(obj_get_help_volume(parent)))
1634 abio_printf(codeFile, "%s->help_data.help_volume = ",
1635 abmfP_instance_ptr_var_name);
1636 abio_put_string(codeFile, help_volume);
1637 abio_puts(codeFile, ";\n");
1641 abio_printf(codeFile,
1642 "%s->help_data.help_volume = \"\";\n",
1643 abmfP_instance_ptr_var_name);
1646 /* Set the help location field */
1647 if (!util_strempty(obj_get_help_location(parent)))
1649 abio_printf(codeFile, "%s->help_data.help_locationID = ",
1650 abmfP_instance_ptr_var_name);
1651 abio_put_string(codeFile, help_location);
1652 abio_puts(codeFile, ";\n");
1656 abio_printf(codeFile,
1657 "%s->help_data.help_locationID = \"\";\n",
1658 abmfP_instance_ptr_var_name);
1663 abio_printf(codeFile,
1664 "%s->help_data.help_text = (char *) NULL;\n",
1665 abmfP_instance_ptr_var_name);
1666 abio_printf(codeFile,
1667 "%s->help_data.help_volume = \"\";\n",
1668 abmfP_instance_ptr_var_name);
1669 abio_printf(codeFile,
1670 "%s->help_data.help_locationID = \"\";\n",
1671 abmfP_instance_ptr_var_name);
1674 /* Set the default button */
1675 switch(obj_get_default_btn(parent))
1677 case AB_DEFAULT_BTN_ACTION1:
1678 default_btn = "DTB_ACTION1_BUTTON";
1680 case AB_DEFAULT_BTN_ACTION2:
1681 default_btn = "DTB_ACTION2_BUTTON";
1683 case AB_DEFAULT_BTN_ACTION3:
1684 default_btn = "DTB_ACTION3_BUTTON";
1686 case AB_DEFAULT_BTN_CANCEL:
1687 default_btn = "DTB_CANCEL_BUTTON";
1689 case AB_DEFAULT_BTN_NONE:
1690 default_btn = "DTB_NONE";
1695 abio_printf(codeFile, "%s->default_button = ", abmfP_instance_ptr_var_name);
1696 abio_printf(codeFile, "%s;\n", default_btn);
1698 abmfP_write_c_func_end(genCodeInfo, "0");
1701 abmfP_gencode_exit_func(genCodeInfo);
1702 return return_value;
1706 * Write out the generic message clear proc
1709 write_msg_clear_proc(
1710 GenCodeInfo genCodeInfo,
1714 File file = genCodeInfo->code_file;
1717 iRet = abmfP_write_c_func_begin(
1719 FALSE, /* Is static */
1720 abmfP_str_int, /* return type */
1721 abmfP_get_msg_clear_proc_name(module), /* function name */
1722 "DtbMessageData", /* Argument type */
1723 abmfP_instance_ptr_var_name, /* Argument name */
1727 "memset((void *)(%s), 0, sizeof(*%s));\n",
1728 abmfP_instance_ptr_var_name,
1729 abmfP_instance_ptr_var_name);
1731 abmfP_write_c_func_end(genCodeInfo, "0");