static int xtttbl_ccm_deffilename_func( char *outfile, char *infile, void *client_data) { pwr_tFileName fname; dcli_translate_filename( fname, infile); dcli_get_defaultfilename( fname, outfile, ".rtt_com"); return 1; }
static FILE *navhelp_open_file( NavHelp *navhelp, navh_eHelpFile file_type, const char *file_name) { pwr_tFileName filestr; FILE *file; if ( file_type == navh_eHelpFile_Base) dcli_get_defaultfilename( navhelp->base_file, filestr, NULL); else if ( file_type == navh_eHelpFile_Project) dcli_get_defaultfilename( navhelp->project_file, filestr, NULL); else if ( file_name) dcli_get_defaultfilename( file_name, filestr, NULL); else dcli_get_defaultfilename( navhelp->base_file, filestr, NULL); // Replace symbol for language if ( strncmp( filestr, "$pwr_lang/", 10) == 0) { pwr_tFileName lng_filestr; sprintf( lng_filestr, "$pwr_exe/%s/%s", Lng::get_language_str(), &filestr[10]); dcli_translate_filename( lng_filestr, lng_filestr); file = fopen( lng_filestr, "r"); if ( file == 0) { // Default to English version sprintf( lng_filestr, "$pwr_exe/en_us/%s", &filestr[10]); dcli_translate_filename( lng_filestr, lng_filestr); file = fopen( lng_filestr, "r"); if ( file == 0) return 0; } } else { dcli_translate_filename( filestr, filestr); file = fopen( filestr, "r"); if ( file == 0) return 0; } return file; }
void rt_pvd_udb::load( pwr_tStatus *rsts) { char filename[256]; int sts; if ( gu) gu->clear(); else gu = new GeUser(); sts = dcli_get_defaultfilename( user_cFilename, filename, ""); gu->load( filename); // Create Root object procom_obj rootitem; if ( m_env == pvd_eEnv_Wb) { strcpy( rootitem.name, "UserDatabase"); rootitem.cid = pwr_eClass_PlantHier; rootitem.oix = 0; } else { strcpy( rootitem.name, "VolUserDatabase"); rootitem.cid = pwr_eClass_ExternVolume; rootitem.oix = 0; rootitem.body_size = sizeof(pwr_sExternVolume); rootitem.body = calloc( 1, rootitem.body_size); } m_list.push_back(rootitem); menu_stack[menu_cnt] = rootitem.oix; menu_cnt++; SystemList *systemgroup = gu->root_system(); while ( systemgroup) { load_systemgroup( systemgroup); systemgroup = systemgroup->next_system(); } if ( m_env == pvd_eEnv_Rt) { // Convert to Rt style for ( int i = 1; i < (int)m_list.size(); i++) { if ( m_list[i].bwsoix == 0) m_list[i].bwsoix = m_list[m_list[i].fthoix].lchoix; if ( m_list[i].fwsoix == 0) m_list[i].fwsoix = m_list[m_list[i].fthoix].fchoix; } } }
subpalette_sMenu *SubPalette::menu_tree_build_children( ifstream *fp, int *line_cnt, char *filename, subpalette_sMenu *parent) { subpalette_sMenu *menu_p, *prev; subpalette_sMenu *return_menu = NULL; int first = 1; int nr; char line[140]; char file[120]; char type[120]; int pixmap; while ( 1) { fp->getline( line, sizeof( line)); if ( line[0] == 0) break; (*line_cnt)++; if ( line[0] == '!' || line[0] == '#') continue; nr = sscanf( line, "%s %s %s %d", type, name, file, &pixmap); if ( nr < 1 ) printf( "** Syntax error in file %s, line %d", filename, *line_cnt); if ( strcmp( type, "{") == 0) { if ( nr != 1 || !menu_p) printf( "** Syntax error in file %s, line %d", filename, *line_cnt); menu_p->child_list = menu_tree_build_children( fp, line_cnt, filename, menu_p); } else if ( strcmp( type, "}") == 0) { if ( nr != 1 ) printf( "** Syntax error in file %s, line %d", filename, *line_cnt); return return_menu; } else if ( strcmp( type, "menu") == 0) { if ( nr != 2 ) printf( "** Syntax error in file %s, line %d", filename, *line_cnt); menu_p = (subpalette_sMenu *) calloc( 1, sizeof(subpalette_sMenu)); menu_p->parent = parent; menu_p->item_type = subpalette_eItemType_Menu; strcpy( menu_p->title, name); if ( first) { return_menu = menu_p; first = 0; } else prev->next = menu_p; prev = menu_p; } else if ( strcmp( type, "localsubgraphs") == 0) { if ( nr != 3 ) printf( "** Syntax error in file %s, line %d", filename, *line_cnt); menu_p = (subpalette_sMenu *) calloc( 1, sizeof(subpalette_sMenu)); menu_p->parent = parent; menu_p->item_type = subpalette_eItemType_LocalSubGraphs; strcpy( menu_p->title, name); strcpy( menu_p->file, file); if ( first) { return_menu = menu_p; first = 0; } else prev->next = menu_p; prev = menu_p; } else if ( strcmp( type, "subgraph") == 0) { if ( nr != 4 ) printf( "** Syntax error in file %s, line %d", filename, *line_cnt); menu_p = (subpalette_sMenu *) calloc( 1, sizeof(subpalette_sMenu)); menu_p->parent = parent; menu_p->item_type = subpalette_eItemType_File; strcpy( menu_p->title, name); dcli_get_defaultfilename( file, menu_p->file, ".pwsg"); menu_p->pixmap = pixmap; if ( first) { return_menu = menu_p; first = 0; } else prev->next = menu_p; prev = menu_p; } else if ( strcmp( type, "path") == 0) { if ( nr != 1 ) printf( "** Syntax error in file %s, line %d", filename, *line_cnt); fp->getline( line, sizeof( line)); if ( line[0] == 0) break; (*line_cnt)++; if ( line[0] == '!' || line[0] == '#') continue; nr = sscanf( line, "%s %s %s %d", type, name, file, &pixmap); if ( nr < 1 ) printf( "** Syntax error in file %s, line %d", filename, *line_cnt); if ( strcmp( type, "{") != 0) printf( "** Syntax error in file %s, line %d", filename, *line_cnt); path_cnt = 0; while( 1) { fp->getline( line, sizeof( line)); if ( line[0] == 0) break; (*line_cnt)++; if ( line[0] == '!' || line[0] == '#') continue; nr = sscanf( line, "%s %s %s %d", type, name, file, &pixmap); if ( nr < 1 ) printf( "** Syntax error in file %s, line %d", filename, *line_cnt); if ( strcmp( type, "}") == 0) { if ( nr != 1 ) printf( "** Syntax error in file %s, line %d", filename, *line_cnt); break; } else { if ( path_cnt > 10) break; strcpy( path[path_cnt], type); path_cnt++; } } } } return return_menu; }
void rt_post::open() { pwr_tStatus sts; pwr_tObjid oid; pwr_tFileName filename; // Open server configuration object PostConfig sts = gdh_GetClassList( pwr_cClass_PostConfig, &oid); if ( ODD(sts)) { sts = gdh_ObjidToPointer( oid, (void **)&conf); if ( EVEN(sts)) throw co_error( sts); aproc_RegisterObject( oid); } else { errh_Info( "No Post configuration"); errh_SetStatus( 0); exit(0); } conf->Status = PWR__SRVSTARTUP; // Connect to mh mh_UtilWaitForMh(); sts = mh_OutunitConnect( oid, mh_eOutunitType_Post, 0, mh_ack_bc, mh_alarm_bc, mh_block_bc, mh_cancel_bc, mh_clear_alarmlist_bc, mh_clear_blocklist_bc, mh_info_bc, mh_return_bc, NULL ); if ( EVEN(sts)) { errh_Error( "Post terminated: %m", sts); conf->Status = sts; exit(0); } // Load user database sts = gdh_GetObjectInfo( "pwrNode-System.SystemGroup", &systemgroup, sizeof(systemgroup)); if ( EVEN(sts)) { errh_Error( "Post terminated: %m", sts); conf->Status = sts; exit(0); } udb = new GeUser(); sts = dcli_get_defaultfilename( user_cFilename, filename, ""); udb->load( filename); conf->Status = PWR__SRUN; }