예제 #1
0
파일: utils_c_file.c 프로젝트: juddy/edcde
static int
write_lib_func(GenCodeInfo genCodeInfo, LibFunc libFunc)
{
    abio_puts(genCodeInfo->code_file, libFunc->def);
    abio_puts(genCodeInfo->code_file, "\n\n\n");
    return 0;
}
예제 #2
0
static int
write_main_xt_i18n(
    GenCodeInfo genCodeInfo,
    ABObj project
    )
{
    File	codeFile;
    int		ret_val = 0;
    
    if (!genCodeInfo || !project)
	goto cret;

    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile, nlstr);
    abmfP_write_c_comment(genCodeInfo, TRUE,
        "NULL language_proc installs the default Xt language procedure");
    abio_puts(codeFile, "XtSetLanguageProc((XtAppContext)NULL,\n");
    abio_indent(codeFile);
    abio_puts(codeFile, "language_proc, language_proc_client_data);\n");
    abio_outdent(codeFile);
    abio_puts(codeFile, "\n");

cret:
    return(ret_val);
}
예제 #3
0
파일: write_c.c 프로젝트: juddy/edcde
/*
 * writes #include "blah.h"
 */
int
abmfP_write_c_local_include(GenCodeInfo genCodeInfo, STRING fileName)
{
    File	codeFile = genCodeInfo->code_file;
    abio_puts(codeFile, "#include ");
    abio_put_string(codeFile, fileName);
    abio_puts(codeFile, "\n");
    return 0;
}
예제 #4
0
파일: stubs_c_file.c 프로젝트: juddy/edcde
static int
write_tooltalk_msg_reply(
    File	codeFile
)
{
    abio_puts(codeFile, "tt_message_reply(msg);\n");
    abio_puts(codeFile, "tttk_message_destroy(msg);\n");

    return 0;
}
예제 #5
0
static int
write_app_resources(GenCodeInfo genCodeInfo, ABObj project)
{
    File	codeFile;

    if (!genCodeInfo || !project)
	return (0);
    
    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile, "\n");
    abio_puts(codeFile, "/*\n");
    abio_puts(codeFile, " * Application Resources\n");
    abio_puts(codeFile, " */\n");
    abio_puts(codeFile, "static XtResource resources[] = {\n");
    abio_indent(codeFile);
    abio_puts(codeFile,     "{\"session\", \"Session\", XtRString, sizeof(String),\n");
    abio_indent(codeFile);
    abio_puts(codeFile,         "XtOffsetOf(DtbAppResourceRec, session_file), XtRImmediate, (XtPointer)NULL}\n");
    abio_outdent(codeFile);
    abio_puts(codeFile, "\n");

    abmfP_write_user_struct_fields_seg(genCodeInfo);
    abio_outdent(codeFile);
    abio_puts(codeFile, "};\n");

    return (0);
}
예제 #6
0
파일: utils_c_file.c 프로젝트: juddy/edcde
static int
write_session_CB_vars(GenCodeInfo genCodeInfo, ABObj project)
{
    File	codeFile;

    if (!genCodeInfo || !project)
	return (0);
    
    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile, "\n");

    abio_puts(codeFile, "/*\n");
    abio_puts(codeFile, " * Variable for storing client session save callback\n");
    abio_puts(codeFile, " */\n");
    abio_puts(codeFile, 
        "static DtbClientSessionSaveCB\t\tdtb_client_session_saveCB = NULL;\n");

    if (abmfP_proj_needs_session_restore(project))
    {
        abio_puts(codeFile, "/*\n");
        abio_puts(codeFile, " * Variable for storing client session restore callback\n");
        abio_puts(codeFile, " */\n");
        abio_puts(codeFile, 
	    "static DtbClientSessionRestoreCB\tdtb_client_session_restoreCB = NULL;\n");
    }

    return (0);
}
예제 #7
0
파일: utils_c_file.c 프로젝트: juddy/edcde
static int
write_popup_menu_vars(GenCodeInfo genCodeInfo, ABObj project)
{
    abio_puts(genCodeInfo->code_file, nlstr);
    abmfP_write_c_comment(genCodeInfo, FALSE, 
	"Variables that keep track of which menus go with which widgets");
    abio_puts(genCodeInfo->code_file, 
	"static DtbMenuRef\tpopupMenus = NULL;\n"
	"static int\tnumPopupMenus = 0;\n");
    return 0;
}
예제 #8
0
파일: stubs_c_file.c 프로젝트: juddy/edcde
static int
write_action_functions(GenCodeInfo genCodeInfo, ABObj obj)
{
    File                codeFile = genCodeInfo->code_file;
    static char         msg[256],
           *s;
    AB_TRAVERSAL        trav;
    ABObj               action = NULL;
    ABObj               fromObj = NULL;	/* for error reports */
    int                 i = 0;

    /*
     * Auto-named functions
     */
    for (trav_open(&trav, obj, AB_TRAV_ACTIONS_FOR_OBJ | AB_TRAV_MOD_SAFE), i = 0;
            (action = trav_next(&trav)) != NULL; ++i)
    {
        if (   mfobj_has_flags(action, CGenFlagIsDuplicateDef)
                || mfobj_has_flags(action, CGenFlagWriteDefToProjFile))
        {
            continue;
        }

        if (action->info.action.auto_named)
        {
            abmfP_write_action_function(genCodeInfo, action);
            abio_puts(genCodeInfo->code_file, "\n");
        }
    }
    /* don't close traversal, yet */

    /*
     * User-named functions
     */
    for (trav_reset(&trav);
            (action = trav_next(&trav)) != NULL; ++i)
    {
        if (   mfobj_has_flags(action, CGenFlagIsDuplicateDef)
                || mfobj_has_flags(action, CGenFlagWriteDefToProjFile))
        {
            continue;
        }

        if (!(action->info.action.auto_named))
        {
            abmfP_write_action_function(genCodeInfo, action);
            abio_puts(genCodeInfo->code_file, "\n");
        }
    }
    trav_close(&trav);

    return OK;
}
예제 #9
0
static int
write_i18n_var_declrs(
    GenCodeInfo genCodeInfo,
    ABObj project
    )
{
    File	codeFile;
    int		ret_val = 0;
    

    if (!genCodeInfo || !project)
	goto cret;

    codeFile = genCodeInfo->code_file;

    /*
     * Write out the NL_CAT_LOCALE workaround
     */
    abio_puts(codeFile, "\n");
    abio_puts(codeFile, "/* Workaround for XPG4 API compatibility */\n");
    abio_puts(codeFile, "#if !defined(NL_CAT_LOCALE)\n");
    abio_puts(codeFile, "#define NL_CAT_LOCALE 0\n");
    abio_puts(codeFile, "#endif\n");
    abio_puts(codeFile, "\n");

    abio_puts(codeFile,
              "/* Handle for standard message catalog for the project */\n");
    
    abio_puts(codeFile, "nl_catd\tDtb_project_catd;\n");

cret:
    return(ret_val);
}
예제 #10
0
파일: utils_c_file.c 프로젝트: juddy/edcde
static int
write_all_types(GenCodeInfo genCodeInfo, ABObj project)
{
    File	codeFile = genCodeInfo->code_file;
    project = project;	/* avoid warning */
    abio_puts(codeFile,
        "typedef struct\n"
        "{\n"
        "    Widget              widget;\n"
        "    DtDndProtocol       protocol;\n"
        "    unsigned char       operations;\n"
        "    Boolean             bufferIsText;\n"
        "    Boolean             allowDropOnRootWindow;\n"
        "    Widget              sourceIcon;\n"
        "    DtbDndDragCallback  callback;\n"
        "    XtCallbackRec       convertCBRec[2];\n"
        "    XtCallbackRec       dragToRootCBRec[2];\n"
        "    XtCallbackRec       dragFinishCBRec[2];\n"
	"} DtbDragSiteRec, *DtbDragSite;\n"
	"\n");

    abio_puts(codeFile,
	"typedef struct\n"
	"{\n"
        "    Widget              widget;\n"
        "    DtDndProtocol       protocols;\n"
        "    unsigned char       operations;\n"
        "    Boolean             textIsBuffer;\n"
        "    Boolean             dropsOnChildren;\n"
        "    Boolean             preservePreviousRegistration;\n"
        "    DtbDndDropCallback  callback;\n"
        "    XtCallbackRec       animateCBRec[2];\n"
        "    XtCallbackRec       transferCBRec[2];\n"
        "} DtbDropSiteRec, *DtbDropSite;\n"
	"\n");

    abio_puts(codeFile,
	"/*\n"
	" * This structure keeps track of widget/menu pairs\n"
	" */\n"
	"typedef struct\n"
	"{\n"
        "    Widget              widget;\n"
        "    Widget              menu;\n"
        "} DtbMenuRefRec, *DtbMenuRef;\n"
	"\n");

    return 0;
}
예제 #11
0
파일: stubs_c_file.c 프로젝트: juddy/edcde
static int
write_instance_ptr_var(
    GenCodeInfo	genCodeInfo,
    ABObj		ipObj,
    STRING		instanceVarName,
    STRING		paramName,
    BOOL		castValue,
    STRING		comment
)
{
    FILE	*codeFile = genCodeInfo->code_file;

    if (ipObj == NULL)
    {
        return 0;
    }
    abio_printf(genCodeInfo->code_file, "%s\t%s = ",
                abmfP_get_c_struct_ptr_type_name(ipObj),
                instanceVarName);
    if (castValue)
    {
        abio_printf(codeFile, "(%s)", abmfP_get_c_struct_ptr_type_name(ipObj));
    }

    abio_printf(codeFile, "%s;", paramName);

    if (comment != NULL)
    {
        abio_printf(genCodeInfo->code_file, "\t%s", comment);
    }
    abio_puts(genCodeInfo->code_file, nlstr);
    return 0;
}
예제 #12
0
파일: write_c.c 프로젝트: juddy/edcde
int 
abmfP_write_c_block_begin(GenCodeInfo genCodeInfo)
{
    abio_puts(genCodeInfo->code_file, "{\n");
    abio_indent(genCodeInfo->code_file);
    return 0;
}
예제 #13
0
/*
 * writes local vars for i18n, as needed
 */
static int
write_main_i18n_local_vars(
			GenCodeInfo	genCodeInfo,
			ABObj		project
)
{
    File	codeFile = genCodeInfo->code_file;
    if (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API)
    {
        abio_puts(codeFile, 
	    "XtLanguageProc\tlanguage_proc = (XtLanguageProc)NULL;\n");
        abio_puts(codeFile, 
	    "XtPointer\t\tlanguage_proc_client_data = (XtPointer)NULL;\n");
    }
    return 0;
}
예제 #14
0
파일: write_c.c 프로젝트: juddy/edcde
int 
abmfP_write_c_block_end(GenCodeInfo genCodeInfo)
{
    abio_outdent(genCodeInfo->code_file);
    abio_puts(genCodeInfo->code_file, "}\n");
    return 0;
}
예제 #15
0
파일: stubs_c_file.c 프로젝트: juddy/edcde
static void
set_up_user_type_variables(GenCodeInfo genCodeInfo, ABObj toObj)
{
    File                codeFile = genCodeInfo->code_file;
    ABObj               structObj = abmfP_obj_get_struct_obj(toObj);
    ABObj		winParent = NULL;
    char		winParentName[1024];
    *winParentName = 0;

    /*
     * Determine window parent of this popup
     */
    winParent = obj_get_win_parent(structObj);
    if (winParent == NULL)
    {
        sprintf(winParentName, "%s()", abmfP_lib_get_toplevel_widget->name);
    }
    else
    {
        strcpy(winParentName, abmfP_get_c_name(genCodeInfo, winParent));
    }

    /*
     * REMIND: This is obsolete and should be removed!
     */
    if (cwd_is_dtbuilder_src_dir())
    {
        write_instance_ptr_var(genCodeInfo, toObj,
                               instanceVarName, abmfP_client_data_var_name, TRUE, NULL);
        abio_puts(genCodeInfo->code_file, nlstr);
    }
    else
    {
        write_instance_ptr_var(genCodeInfo, toObj,
                               toVarName, abmfP_client_data_var_name, TRUE, NULL);
        write_instance_ptr_var(genCodeInfo, toObj,
                               instanceVarName, toVarName, FALSE, "/* obsolete */");
        abio_puts(genCodeInfo->code_file, nlstr);
    }
    abio_printf(codeFile, "if (!(%s->initialized))\n", get_to_var_name());
    abmfP_write_c_block_begin(genCodeInfo);
    abio_printf(codeFile, "%s(%s, %s);\n",
                abmfP_get_init_proc_name(structObj),
                get_to_var_name(),
                winParentName);
    abmfP_write_c_block_end(genCodeInfo);
}
예제 #16
0
파일: stubs_c_file.c 프로젝트: juddy/edcde
static int
write_ss_cb_body2(
    GenCodeInfo genCodeInfo,
    ABObj action
)
{
    File                codeFile;

    if (!genCodeInfo || !action)
        return 0;

    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile, "\n");
    abio_puts(codeFile, "return ret_value;\n");
    return 0;
}
예제 #17
0
파일: utils_c_file.c 프로젝트: juddy/edcde
static int
write_save_command_var(GenCodeInfo genCodeInfo, ABObj project)
{
    File	codeFile;

    if (!genCodeInfo || !project)
	return (0);
    
    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile, nlstr);
    abmfP_write_c_comment(genCodeInfo, FALSE,
        "Variable for storing command used to invoke application");
    abio_puts(codeFile, 
        "static char\t\t\t\t*dtb_save_command_str = (char *)NULL;\n");

    return (0);
}
예제 #18
0
static int
write_app_resource_var(
    GenCodeInfo	genCodeInfo, 
    ABObj	project
)
{
    File	codeFile;

    if (!genCodeInfo || !project)
	return (0);

    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile,"\n");
    abio_puts(codeFile,"DtbAppResourceRec\tdtb_app_resource_rec;\n");

    return (0);
}
예제 #19
0
파일: utils_c_file.c 프로젝트: juddy/edcde
static int
write_centering_static_func_decls(GenCodeInfo genCodeInfo, ABObj project)
{
    File	codeFile;

    if (!genCodeInfo || !project)
	return (0);
    
    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile, "/*\n");
    abio_puts(codeFile, " * Private functions used for dynamic centering of objects\n");
    abio_puts(codeFile, " */\n");
    abio_printf(codeFile, "%s\n", abmfP_lib_center_widget->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_uncenter_widget->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_centering_handler->proto);

    return (0);
}
예제 #20
0
파일: utils_c_file.c 프로젝트: juddy/edcde
static int
write_save_toplevel_widget_var(GenCodeInfo genCodeInfo, ABObj project)
{
    File	codeFile;

    if (!genCodeInfo || !project)
	return (0);
    
    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile, "\n");

    abio_puts(codeFile, "/*\n");
    abio_puts(codeFile, " * Variable for storing top level widget\n");
    abio_puts(codeFile, " */\n");
    abio_puts(codeFile, 
        "static Widget\t\tdtb_project_toplevel_widget = (Widget)NULL;\n");

    return (0);
}
예제 #21
0
파일: utils_c_file.c 프로젝트: juddy/edcde
static int
write_msg_static_func_decls(
    GenCodeInfo genCodeInfo,
    ABObj project
)
{
    File        codeFile;

    if (!genCodeInfo || !project)
        return (0);

    codeFile = genCodeInfo->code_file;
 
    abio_puts(codeFile, "/*\n");
    abio_puts(codeFile, " * Static functions used for messages.\n");
    abio_puts(codeFile, " */\n");
    abio_printf(codeFile, "%s\n", abmfP_lib_destroyCB->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_modal_dlgCB->proto);
 
    return (0);
}
예제 #22
0
static int	
write_func_as_strings(FILE *file, FileFuncInfo funcInfo)
{
    char	recVarName[256];
    char	ptrVarName[256];
    char	*funcNamePtr = NULL;

    funcNamePtr = funcInfo->funcName;
    if (strncmp(funcNamePtr, "dtb_", 4) == 0)
    {
	funcNamePtr += 4;
    }
    sprintf(recVarName, "%%abmfP_lrc_%s", funcNamePtr);
    sprintf(ptrVarName, "%%abmfP_lib_%s", funcNamePtr);

    abio_puts(file, "\n");
    abio_puts(file,   "/*\n");
    abio_printf(file, " * %s\n", ptrVarName);
    abio_puts(file,   " */\n");

    abio_printf(file, "static LibFuncRec %s = \n", recVarName);
    abio_printf(file, "{\n");
    abio_indent(file);

    abio_puts(file, "/* name */\n");
    write_c_string(file, funcInfo->funcName);
    abio_puts(file, ",\n");
    abio_puts(file, "\n");

    abio_printf(file, "/* proto */\n");
    write_c_string(file, funcInfo->funcProto);
    abio_puts(file, ",\n");
    abio_puts(file, "\n");

    abio_printf(file, "/* def */\n");
    write_c_string(file, funcInfo->funcCode);

    abio_puts(file, "\n");
    abio_outdent(file);
    abio_printf(file, "}; /* %s */\n", recVarName);

    abio_printf(file, "LibFunc %s = &(%s);\n", 
	ptrVarName, recVarName);
    return 0;
}
예제 #23
0
static int
write_app_resource_struct(
    GenCodeInfo	genCodeInfo, 
    ABObj	project
)
{
    File	codeFile;

    if (!genCodeInfo || !project)
	return (0);

    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile,"\n");
    abmfP_write_c_comment(genCodeInfo, 
	FALSE, "Structure to store values for Application Resources");

    abio_puts(codeFile,"typedef struct {\n");
    abio_indent(codeFile);
    abio_puts(codeFile,"char	*session_file;\n");
    abio_puts(codeFile,"\n");
    abmfP_write_user_struct_fields_seg(genCodeInfo);
    abio_outdent(codeFile);
    abio_puts(codeFile, "} DtbAppResourceRec;\n");

    abio_puts(codeFile,"\n");

    return (0);
}
예제 #24
0
static int
write_main_session_restore(
    GenCodeInfo	genCodeInfo, 
    ABObj	project
)
{
    File	codeFile;

    if (!genCodeInfo || !project)
	return (0);

    codeFile = genCodeInfo->code_file;

    if (abmfP_proj_needs_session_restore(project))
    {
        AB_TRAVERSAL	trav;
	ABObj		action;
	char		*ss_restore_CB_name = NULL;

        abio_puts(codeFile,"\n");
        abio_puts(codeFile,"if (dtb_app_resource_rec.session_file)\n");
        abio_puts(codeFile,"{\n");

	if (!obj_is_project(project))
	    project = obj_get_project(project);

	/*
	 * Search for session restore callback in project
	 * action list
	 */
    	for (trav_open(&trav, project, AB_TRAV_ACTIONS);
             (action = trav_next(&trav)) != NULL;)
    	{
	    switch(obj_get_when(action))
	    {
		case AB_WHEN_SESSION_RESTORE:
		    /*
		     * Remember session restore callback if found
		     */
		    ss_restore_CB_name = obj_get_func_name(action);
		    break;
		default:
		    break;
	    }
	}
	trav_close(&trav);

	abio_printf(codeFile, 
	"    dtb_set_client_session_restoreCB((DtbClientSessionRestoreCB)%s);\n",
		ss_restore_CB_name ? ss_restore_CB_name : "NULL");

        abio_puts(codeFile,
	"    (void)dtb_session_restore(toplevel, dtb_app_resource_rec.session_file);\n");
        abio_puts(codeFile,"}\n");

        abio_puts(codeFile,"\n");
    }

    return (0);
}
예제 #25
0
파일: utils_c_file.c 프로젝트: juddy/edcde
static int
write_align_static_func_decls(GenCodeInfo genCodeInfo, ABObj project)
{
    File	codeFile;

    if (!genCodeInfo || !project)
	return (0);
    
    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile, "/*\n");
    abio_puts(codeFile, " * Static functions used for dynamic aligning of group objects\n");
    abio_puts(codeFile, " */\n");
    abio_printf(codeFile, "%s\n", abmfP_lib_get_label_widget->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_get_offset_from_ancestor->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_get_label_width->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_get_widest_label->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_get_widest_value->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_get_widget_rect->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_get_greatest_size->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_get_group_cell_size->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_get_group_row_col->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_get_group_child->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_align_children->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_align_handler->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_expose_handler->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_free_group_info->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_align_rows->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_align_cols->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_align_left->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_align_right->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_align_labels->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_align_vcenter->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_align_top->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_align_bottom->proto);
    abio_printf(codeFile, "%s\n", abmfP_lib_align_hcenter->proto);

    return (0);
}
예제 #26
0
파일: utils_c_file.c 프로젝트: juddy/edcde
static int
write_all_vars(GenCodeInfo genCodeInfo, ABObj project)
{
    File	codeFile = genCodeInfo->code_file;

    write_session_CB_vars(genCodeInfo, project);
    write_tooltalk_CB_vars(genCodeInfo, project);
    write_save_toplevel_widget_var(genCodeInfo, project);
    write_save_command_var(genCodeInfo, project);
    write_popup_menu_vars(genCodeInfo, project);
    write_dnd_vars(genCodeInfo, project);

    /*
     * write path-to-executable var
     */
    abio_puts(codeFile, nlstr);
    abmfP_write_c_comment(genCodeInfo, FALSE,
        "Directory where the binary for this process whate loaded from");
    abio_puts(codeFile, 
        "static char\t\t\t\t*dtb_exe_dir = (char *)NULL;\n");

    return 0;
}
예제 #27
0
파일: utils_c_file.c 프로젝트: juddy/edcde
static int
write_all_macros(GenCodeInfo genCodeInfo, ABObj project)
{
    project = project;	/* avoid warning */

    abio_puts(genCodeInfo->code_file, nlstr);
    abio_puts(genCodeInfo->code_file,
	"#ifndef min\n"
	"#define min(a,b) ((a) < (b)? (a):(b))\n"
	"#endif\n\n");

    abio_puts(genCodeInfo->code_file,
	"#ifndef max\n"
	"#define max(a,b) ((a) > (b)? (a):(b))\n"
	"#endif\n\n");

    abio_puts(genCodeInfo->code_file,
        "#ifndef ABS\n"
        "#define ABS(x) ((x) >= 0? (x):(-(x)))\n"
        "#endif\n\n");

    return 0;
}
예제 #28
0
파일: write_c.c 프로젝트: juddy/edcde
int 
abmfP_write_c_comment(
		GenCodeInfo	genCodeInfo,
		BOOL		oneLiner,
		STRING		comment
)
{
    File	file= genCodeInfo->code_file;
    
    if (oneLiner)
    {
	abio_printf(file, "/* %s */\n", comment);
    }
    else
    {
        abio_puts(file, abmfP_comment_begin);
        abio_puts(file, abmfP_comment_continue);
        abio_puts(file, comment);
        abio_puts(file, "\n");
        abio_puts(file, abmfP_comment_end);
    }
    return 0;
}
예제 #29
0
static int
write_i18n_declarations(
    GenCodeInfo	genCodeInfo,
    ABObj	project
    )
{
    File	codeFile;
    STRING      *p = NULL;
    int		ret_val = 0;

    if (genCodeInfo == NULL)
        goto cret;

    codeFile = genCodeInfo->code_file;

    /*
     * Write out the include directives
     */
    for (p = I18n_Includes; *p; p++)
    {
	abio_printf(codeFile, "#include %s\n", *p);
    }

    /*
     * Write out the macro for the name of the catalog
     */
    abio_printf(codeFile, "#define DTB_PROJECT_CATALOG\t\"%s\"\n",
                obj_get_name(project));

    abio_puts(codeFile,
              "/* Handle for standard message catalog for the project */\n");
    
    abio_puts(codeFile, "extern nl_catd\tDtb_project_catd;\n");
    
cret:
    return(ret_val);
}
예제 #30
0
static int
write_main_msg_i18n(
    GenCodeInfo genCodeInfo,
    ABObj project
    )
{
    File	codeFile;
    int		ret_val = 0;
    
    if (!genCodeInfo || !project)
	goto cret;

    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile, "\n");
    abio_puts(codeFile, abmfP_comment_begin);
    abio_puts(codeFile, abmfP_comment_continue);
    abio_puts(codeFile,
              "Open the standard message catalog for the project.\n");
    abio_puts(codeFile, abmfP_comment_end);
    
    abio_puts(codeFile,
       "Dtb_project_catd = catopen(DTB_PROJECT_CATALOG, NL_CAT_LOCALE);\n");
    abio_puts(codeFile, "if (Dtb_project_catd == (nl_catd)-1)\n");
    abmfP_write_c_block_begin(genCodeInfo);
    abio_puts(codeFile,
              "fprintf(stderr, \"WARNING: Could not open message catalog: %s. Messages will be defaults.\\n\",\n");
    abio_indent(codeFile);
    abio_puts(codeFile, "DTB_PROJECT_CATALOG);\n");
    abio_outdent(codeFile);
    abmfP_write_c_block_end(genCodeInfo);

    abio_puts(codeFile, "\n");

cret:
    return(ret_val);
}