Example #1
0
STRPAIR_INFO *strpair_str_mix(STRPAIR_INFO *p_info,
                              UCHAR *str,
                              STRPAIR_CONCAT_MODE mode)
{
     STRLIST tmpstrlist;
     STATUS status;

     switch(mode)
     {
     case AA_S:
       status = strlist_concat(p_info->lstr, p_info->rstr);
       p_info->rstr = strlist_create(str, RO_STR, &status);
       break;
  
     case A_SA:
       tmpstrlist = strlist_create(str, RO_STR, &status);
       status = strlist_concat(tmpstrlist, p_info->rstr);
       p_info->rstr = tmpstrlist;
       break;

     case A_AS:
       tmpstrlist = strlist_create(str, RO_STR, &status);
       status = strlist_concat(p_info->rstr, tmpstrlist);
       break;

     default:
       status = ST_INVALID_FLAG;
     }

     return p_info;
}
Example #2
0
STRPAIR strpair_create(UCHAR *p_left, UCHAR *p_right)
{
     STRPAIR_INFO *p_strpair_info;
     STATUS status;

     /* Following are allocated here.
      * 1. info_header for this datastructure.
      * 2. lists to keep left and right strings.
      */

     if ((p_strpair_info = (STRPAIR_INFO *)malloc(sizeof(STRPAIR_INFO))) == NULL)
     {
          status = ST_MEM_ALLOC_FAIL;
          return NULL;
     }
     
     if ((p_strpair_info->lstr = strlist_create(p_left, RO_STR, &status)) == NULL)
     {
          free(p_strpair_info);
          return NULL;
     }

     if ((p_strpair_info->rstr = strlist_create(p_right, RO_STR, &status)) == NULL)
     {
          strlist_free(p_strpair_info->lstr);
          free(p_strpair_info);
          return NULL;
     }

     status = ST_SUCCESS;
     return p_strpair_info;
}
Example #3
0
void 
cgenP_init_env_list(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    DtbCgenEnvDialogInfo	dtbSource = (DtbCgenEnvDialogInfo)callData;
    
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/

    if (user_env_vars == NULL)
    {
        user_env_vars = strlist_create();
    }

    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}
Example #4
0
static int
write_includes(GenCodeInfo genCodeInfo, ABObj project)
{
    File	 codeFile = genCodeInfo->code_file;
    STRING	 *p       = NULL;
    AB_TRAVERSAL trav;
    ABObj	 module   = NULL;
    StringList   includes = strlist_create();
    char         buf[MAXPATHLEN+1];
    int          i;
    
    strlist_set_is_unique(includes, TRUE);
    *buf = 0;

    /* standard system includes */
    for (p = Includes; *p; p++)
    {
	strlist_add_str(includes, *p, NULL);
    }

    /*
     * Includes for sessioning.
     * These include files are needed only if sessioning
     * is used.
     */
    if (abmfP_proj_needs_session_save(project) || 
	abmfP_proj_needs_session_restore(project))
    {
        for (p = Session_Includes; *p; p++)
        {
	    strlist_add_str(includes, *p, NULL);
        }
    }

    /*
     * Includes for i18n.
     * These include files are needed only if i18n
     * is enabled.
     */
    if (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API)
    {
        for (p = I18n_Includes; *p; p++)
        {
	    strlist_add_str(includes, *p, NULL);
        }
    }

    /* module includes */
    for (trav_open(&trav, project, AB_TRAV_MODULES);
	(module = trav_next(&trav)) != NULL; )
    {
	if (!obj_is_defined(module))
	{
	    continue;
	}
	sprintf(buf, "\"%s\"", abmfP_get_ui_header_file_name(module));
	strlist_add_str(includes, buf, NULL);
    }
    trav_close(&trav);

    /* project include */
    sprintf(buf, "\"%s\"", abmfP_get_project_header_file_name(project));
    strlist_add_str(includes, buf, NULL);

    sprintf(buf, "\"%s\"", abmfP_get_utils_header_file_name(project));
    strlist_add_str(includes, buf, NULL);

    abmfP_get_connect_includes(includes, project);

    /* Write the includes */
    for (i = 0; i < strlist_get_num_strs(includes); ++i)
    {
	abio_printf(codeFile, "#include %s\n",
	    strlist_get_str(includes, i, NULL));
    }
    
    abio_puts(codeFile, nlstr);

    strlist_destroy(includes);
    return 0;
}