wb_vrepext::wb_vrepext( wb_erep *erep, pwr_tVid vid, const char *name, const char *provider) : wb_vrep(vid), m_erep(erep), m_merep(erep->merep()), m_nRef(0), m_connected(0), m_procom(0), m_ptype( procom_eType_Ipc) { strcpy( m_providerstr, provider); m_vid = vid; m_cid = pwr_eClass_ExternVolume; createVolumeObject( name); strcpy( m_name, name); if ( cdh_NoCaseStrcmp( provider, "ProjectList") == 0) { m_ptype = procom_eType_Local; m_provider = new wb_pvd_pl(); m_procom = new wb_procom( provider, m_provider, procom_eType_Local); } else if ( cdh_NoCaseStrcmp( provider, "GlobalVolumeList") == 0) { m_ptype = procom_eType_Local; m_provider = new wb_pvd_gvl(); m_procom = new wb_procom( provider, m_provider, procom_eType_Local); } else if ( cdh_NoCaseStrcmp( provider, "UserDatabase") == 0) { m_ptype = procom_eType_Local; m_provider = new rt_pvd_udb(); m_procom = new wb_procom( provider, m_provider, procom_eType_Local); } }
static void get_config( char *name, unsigned int *lk_max_locks, unsigned int *lk_max_objects) { pwr_tFileName fname; FILE *fp; char line[200]; char line_elem[2][100]; unsigned int max_locks; unsigned int max_objects; int nr; *lk_max_locks = 50000; *lk_max_objects = 20000; strcpy( fname, name); strcat( fname, ".cnf"); dcli_translate_filename( fname, fname); fp = fopen( fname, "r"); if ( !fp) return; while ( dcli_read_line( line, sizeof(line), fp)) { dcli_trim( line, line); if ( line[0] == '#') continue; if ( strcmp( line, "") == 0) continue; nr = dcli_parse( line, " ", "", (char *) line_elem, sizeof( line_elem)/sizeof( line_elem[0]), sizeof( line_elem[0]), 1); if ( nr != 2) continue; if ( cdh_NoCaseStrcmp( line_elem[0], "lk_max_locks") == 0) { nr = sscanf( line_elem[1], "%d", &max_locks); if ( nr == 1) { *lk_max_locks = max_locks; printf( "lk_max_locks.........%d\n", max_locks); } } else if ( cdh_NoCaseStrcmp( line_elem[0], "lk_max_objects") == 0) { nr = sscanf( line_elem[1], "%d", &max_objects); if ( nr == 1) { *lk_max_objects = max_objects; printf( "lk_max_objects.......%d\n", max_objects); } } } fclose( fp); }
int NavHelp::help_index( navh_eHelpFile file_type, const char *file_name) { FILE *file; char line[200]; char include_file[80]; char subject[80]; int sts; char *s; lng_eCoding coding = lng_eCoding_ISO8859_1; // Open file file = navhelp_open_file( this, file_type, file_name); if ( !file) return NAV__NOFILE; sts = dcli_read_line( line, sizeof( line), file); while ( ODD(sts)) { if ( cdh_NoCaseStrncmp( line, "<coding>", 8) == 0) { char codingstr[40]; help_remove_spaces( &line[8], codingstr); if ( cdh_NoCaseStrcmp( codingstr, "ISO8859-1") == 0) { coding = lng_eCoding_ISO8859_1; } else if ( cdh_NoCaseStrcmp( codingstr, "UTF-8") == 0) { coding = lng_eCoding_UTF_8; } } else if ( cdh_NoCaseStrncmp( line, "<include>", 9) == 0) { help_remove_spaces( &line[9], include_file); sts = help_index( navh_eHelpFile_Other, include_file); } else if ( cdh_NoCaseStrncmp( line, "<topic>", 7) == 0) { if ( (s = strstr( line, "<style>")) || (s = strstr( line, "<STYLE>"))) *s = 0; help_remove_spaces( &line[7], subject); (insert_cb)( parent_ctx, navh_eItemType_HelpBold, subject, "", "", subject, "", file_name, file_type, 0, NULL, coding); } sts = dcli_read_line( line, sizeof( line), file); } fclose( file); return NAV__SUCCESS; }
int sev_repair::optimize( char *table) { pwr_tStatus sts; int fail_cnt = 0; int found = 0; for ( unsigned int i = 0; i < m_db->m_items.size(); i++) { if ( cdh_NoCaseStrcmp( table, m_db->m_items[i].tablename) == 0) { printf( "-- Processing %s\n", m_db->m_items[i].tablename); m_db->optimize( &sts, m_db->m_items[i].tablename); if ( EVEN(sts)) fail_cnt++; found = 1; break; } } if ( !found) printf( "** No such table\n"); else if ( fail_cnt) printf( "** Optimize on table\n"); else printf( "-- Table successfully optimized\n"); return 1; }
int PalFile::check_volume( ldh_tSession ldhses, char *name) { pwr_tClassId classid; pwr_tVolumeId volume; int sts; int size; char volume_name[80]; // Find a class volume with this name sts = ldh_GetVolumeList( ldh_SessionToWB(ldhses), &volume); while ( ODD(sts)) { sts = ldh_GetVolumeClass( ldh_SessionToWB(ldhses), volume, &classid); if ( EVEN(sts)) return 0; if ( cdh_isClassVolumeClass( classid)) { sts = ldh_VolumeIdToName( ldh_SessionToWB(ldhses), volume, volume_name, sizeof(volume_name), &size); if ( EVEN(sts)) return 0; if ( !cdh_NoCaseStrcmp( volume_name, name)) return 1; } sts = ldh_GetNextVolume( ldh_SessionToWB(ldhses), volume, &volume); } return 0; }
lng_eLanguage Lng::str_to_lang( char *str) { for ( int i = 1; i < lng_eLanguage__; i++) { if ( cdh_NoCaseStrcmp( lng_cLanguageStr[i], str) == 0) return (lng_eLanguage) i; } // Not found return lng_eLanguage_; }
static int find_symbol( char *name, char *value) { static int loaded = 0; static char sym_vect[MAXSYMBOLS][80]; static char value_vect[MAXSYMBOLS][80]; static int vect_cnt; int nr; char elemv[3][80]; int j; int found; // Read the file if ( !loaded) { FILE *fp; char line[200]; pwr_tFileName fname; vect_cnt = 0; sprintf( fname, "$pwrp_db/pwrp_cnf_websymbols.dat"); dcli_translate_filename( fname, fname); fp = fopen( fname, "r"); if ( !fp) return 0; while ( dcli_read_line( line, sizeof( line), fp)) { nr = dcli_parse( line, " ", "", (char *)elemv, sizeof( elemv) / sizeof( elemv[0]), sizeof( elemv[0]), 0); if ( nr != 3) continue; strcpy( sym_vect[vect_cnt], elemv[1]); strcpy( value_vect[vect_cnt], elemv[2]); vect_cnt++; } fclose( fp); loaded = 1; } if ( !vect_cnt) return 0; for ( j = 0; j < vect_cnt; j++) { if ( cdh_NoCaseStrcmp( name, sym_vect[j]) == 0) { strcpy( value, value_vect[j]); found = 1; break; } } if ( !found) return 0; return 1; }
int XNav::check_object_methodfilter( pwr_sAttrRef attrref, xmenu_eItemType item_type, xmenu_mUtility caller, unsigned int priv, char *method_name) { pwr_tStatus sts; int i; int sel_cnt; int idx; if (mcp == NULL) mcp = (xmenu_sMenuCall *)calloc(1, sizeof(xmenu_sMenuCall)); mcp->ItemList = xmenu_lMenuItem; mcp->EditorContext = (void *)this; mcp->PointedSet = xmenu_eMenuSet_Object; mcp->Pointed = attrref; mcp->Caller = caller; mcp->ItemType = item_type; mcp->Priv = priv; mcp->SelectedSet = xmenu_eMenuSet_None; mcp->SelectedSet = xmenu_eMenuSet_Object; sel_cnt = 1; if ( mcp->Selected) free( mcp->Selected); mcp->Selected = (pwr_sAttrRef *) calloc( sel_cnt + 1, sizeof (pwr_sAttrRef)); mcp->Selected[0] = attrref; mcp->Selected[sel_cnt].Objid = pwr_cNObjid; mcp->SelectCount = sel_cnt; sts = GetMenu( mcp); if (EVEN(sts) || mcp->ItemList[0].Level == 0) { return 0; } // Find index of method idx = -1; for ( i = 0; i <= (int) mcp->ItemCount; i++) { if ( cdh_ObjidIsNull( mcp->ItemList[i].CurrentObject.Objid) && mcp->ItemList[i].Flags.f.Sensitive && cdh_NoCaseStrcmp( mcp->ItemList[i].Name, method_name) == 0) { idx = i; break; } } if ( idx == -1) return 0; mcp->ChosenItem = idx; sts = CheckMenuMethodFilter( mcp, mcp->ChosenItem); return sts; }
void *SystemList::find_user( char *name) { UserList *ul; for ( ul = (UserList *) userlist; ul != NULL; ul = ul->next) { if ( cdh_NoCaseStrcmp( ul->name, name) == 0) return ul; } return NULL; }
char *wb_dbms_env::host(void) { char nodename[80]; pwr_tStatus sts; static char host[80]; syi_NodeName( &sts, nodename, sizeof(nodename)); if ( ODD(sts) && cdh_NoCaseStrcmp( nodename, m_host) == 0) strcpy( host, "localhost"); else strcpy( host, m_host); return host; }
SystemList *SystemList::find_system( SystemName *name) { SystemList *sl; for ( sl = childlist; sl; sl = sl->next) { if ( cdh_NoCaseStrcmp( sl->name, name->segment( sl->level)) == 0) { if ( name->segments == sl->level + 1) return sl; return sl->find_system( name); } } return NULL; }
void sev_repair::clean( char *table) { int found = 0; for ( unsigned int i = 0; i < m_db->m_items.size(); i++) { if ( cdh_NoCaseStrcmp( table, m_db->m_items[i].tablename) == 0) { clean_item(i, 0); found = 1; break; } } if ( !found) printf( "** No such table\n"); else printf( "-- Table successfully cleaned\n"); }
int XttMultiView::name_to_idx( const char *name) { pwr_sClass_XttMultiView mv; pwr_tStatus sts; sts = gdh_GetObjectInfoAttrref( &aref, &mv, sizeof(mv)); if ( EVEN(sts)) return sts; for ( int i = 0; i < cols; i++) { for ( int j = 0; j < rows; j++) { if ( cdh_NoCaseStrcmp( name, mv.Action[i*rows+j].Name) == 0) return i*rows+j; } } return -1; }
char *cnf_get_value( const char *name, char *value, int size) { FILE *fp; char line[400]; char item_str[2][200]; static char ret_value[200]; int nr; int i; fp = fopen( cnf_cFile, "r"); if ( fp) { while ( dcli_read_line( line, sizeof( line), fp)) { if ( line[0] == '#') continue; nr = dcli_parse( line, " ", "", (char *)item_str, sizeof( item_str) / sizeof( item_str[0]), sizeof( item_str[0]), 0); if ( nr < 2) continue; if ( cdh_NoCaseStrcmp( name, item_str[0]) == 0) { strcpy( ret_value, item_str[1]); if ( value) strncpy( value, ret_value, size); fclose( fp); return ret_value; } } fclose( fp); } /* Find default value */ for ( i = 0; i < sizeof(default_values)/sizeof(default_values[0]); i++) { if ( strcmp( name, default_values[i][0]) == 0) { strcpy( ret_value, default_values[i][1]); if ( value) strncpy( value, ret_value, size); return ret_value; } } return NULL; }
static int check_os( char *str, char *os) { char os_vect[10][20]; int nr; int i; char os_element[20]; nr = dcli_parse( str, "||", "", (char *)os_vect, sizeof( os_vect) / sizeof( os_vect[0]), sizeof( os_vect[0]), 0); for ( i = 0; i < nr; i++) { dcli_trim( os_element, os_vect[i]); if ( cdh_NoCaseStrcmp( os, os_element) == 0) return 1; } return 0; }
wb_adrep *wb_bdrep::super( pwr_tStatus *sts) { if ( bix() != pwr_eBix_rt) { *sts = LDH__NOSUCHATTR; return 0; } wb_orep *orep = m_orep->vrep()->first( sts, m_orep); if ( EVEN(*sts)) return 0; if ( cdh_NoCaseStrcmp( orep->name(), "Super") != 0) { *sts = LDH__NOSUCHATTR; orep->ref(); orep->unref(); return 0; } wb_adrep *adrep = new wb_adrep( *orep); return adrep; }
void SubPalette::select_by_name( char *name) { // Refresh brow_SetNodraw( brow->ctx); brow_DeleteAll( brow->ctx); ((ItemMenu *)root_item)->open_children( this, 0, 0); char *s = name; char *t = name; char itemname[200]; int level = 0; brow_tObject *nodelist; brow_tObject current; brow_tObject child; int nodecnt; Item *item; int sts; for (;;) { if ( !t) break; level ++; strcpy( itemname, t); if ( (s = strchr( itemname, '-'))) { *s = 0; t += (s - itemname + 1); } else t = 0; if ( level == 1) { brow_GetObjectList( brow->ctx, &nodelist, &nodecnt); for ( int i = 0; i < nodecnt; i++) { brow_GetUserData( nodelist[i], (void **)&item); if ( strcmp( itemname, item->name) == 0) { current = nodelist[i]; } } } else { current = 0; item->open_children( this, 0, 0); for ( sts = brow_GetChild( brow->ctx, item->node, &child); ODD( sts); sts = brow_GetNextSibling( brow->ctx, child, &child)) { brow_GetUserData( child, (void **)&item); if ( cdh_NoCaseStrcmp( itemname, item->name) == 0) { current = child; break; } } if ( !current) break; } } brow_ResetNodraw( brow->ctx); brow_Redraw( brow->ctx, 0); if ( current) { brow_SetInverse( current, 1); brow_SelectInsert( brow->ctx, current); if ( !brow_IsVisible( brow->ctx, current, flow_eVisible_Full)) brow_CenterObject( brow->ctx, current, 0.25); } }
void wb_build::webbrowserconfig( pwr_tOid oid) { pwr_tTime modtime; pwr_tFileName fname; pwr_tTime ftime; pwr_tStatus fsts; FILE *fp; int i, j; int found; char line[200]; pwr_tObjName vname; strncpy( vname, m_session.name(), sizeof(vname)); wb_object o = m_session.object(oid); if ( !o) { m_sts = o.sts(); return; } modtime = o.modTime(); sprintf( fname, "$pwrp_db/pwrp_cnf_websymbols.dat"); dcli_translate_filename( fname, fname); fsts = dcli_file_time( fname, &ftime); m_sts = PWRB__NOBUILT; if ( opt.force || EVEN(fsts) || time_Acomp( &modtime, &ftime) == 1) { pwr_sClass_WebBrowserConfig body; int url_symbols_size = sizeof(body.URL_Symbols)/sizeof(body.URL_Symbols[0]); char sym_vect[MAXSYMBOLS][80]; char value_vect[MAXSYMBOLS][80]; char volume_vect[MAXSYMBOLS][80]; int vect_cnt; int nr; char elemv[3][80]; wb_attribute a = m_session.attribute( oid, "RtBody", "URL_Symbols"); if ( !a) { m_sts = a.sts(); return; } a.value( body.URL_Symbols); if ( !a) { m_sts = a.sts(); return; } // Read the file and merge the symbols of this volume with other symbols in the project vect_cnt = 0; fp = fopen( fname, "r"); if ( fp) { while ( dcli_read_line( line, sizeof( line), fp)) { nr = dcli_parse( line, " ", "", (char *)elemv, sizeof( elemv) / sizeof( elemv[0]), sizeof( elemv[0]), 0); if ( nr != 3) continue; // Skip old symbols from this volume if ( cdh_NoCaseStrcmp( vname, elemv[0]) == 0) continue; strcpy( volume_vect[vect_cnt], elemv[0]); strcpy( sym_vect[vect_cnt], elemv[1]); strcpy( value_vect[vect_cnt], elemv[2]); vect_cnt++; } fclose( fp); } for ( i = 0; i < url_symbols_size; i++) { nr = dcli_parse( body.URL_Symbols[i], " ", "", (char *)elemv, sizeof( elemv) / sizeof( elemv[0]), sizeof( elemv[0]), 0); if ( nr != 2) continue; found = 0; for ( j = 0; j < vect_cnt; j++) { if ( cdh_NoCaseStrcmp( elemv[0], sym_vect[j]) == 0) { strcpy( value_vect[j], elemv[1]); found = 1; break; } } if ( !found) { // Insert first for ( j = MIN(vect_cnt,MAXSYMBOLS-1); j > 0; j--) { strcpy( volume_vect[j], volume_vect[j-1]); strcpy( sym_vect[j], sym_vect[j-1]); strcpy( value_vect[j], value_vect[j-1]); } strcpy( volume_vect[0], vname); strcpy( sym_vect[0], elemv[0]); strcpy( value_vect[0], elemv[1]); vect_cnt++; if ( vect_cnt > MAXSYMBOLS) vect_cnt = MAXSYMBOLS; } } // Write the file fp = fopen( fname, "w"); if ( !fp) { char msg[200]; sprintf( msg, "Build: Unable to open file %s", fname); MsgWindow::message( 'E', msg, msgw_ePop_No, oid); return; } for ( i = 0; i < vect_cnt; i++) fprintf( fp, "%s %s %s\n", volume_vect[i], sym_vect[i], value_vect[i]); fclose( fp); } }
void wb_build::node( char *nodename, void *volumelist, int volumecnt) { lfu_t_volumelist *vlist = (lfu_t_volumelist *)volumelist; pwr_tTime vtime; pwr_tTime btime; pwr_tFileName fname; pwr_tObjName vname; int bussid = -1; int rebuild = 1; pwr_tStatus status; char currentnode[80]; char node[80]; pwr_tStatus sumsts; printf( "-- Build node %s\n", nodename); wb_log::push(); if ( !opt.manual) { // Check if there is any new dbsfile rebuild = 0; for ( int i = 0; i < volumecnt; i++) { if ( cdh_NoCaseStrcmp( nodename, vlist[i].p1) == 0) { if ( bussid == -1) { char systemname[80], systemgroup[80]; pwr_tVid *vl; pwr_tString40 *vnl; int vcnt; // Get time for current bootfile status = sscanf( vlist[i].p3, "%d", &bussid); if ( status != 1) { // Bussid error } sprintf( fname, load_cNameBoot, load_cDirectory, vlist[i].p2, bussid); cdh_ToLower( fname, fname); dcli_translate_filename( fname, fname); status = lfu_ReadBootFile( fname, &btime, systemname, systemgroup, &vl, &vnl, &vcnt, 0, 0); if ( EVEN(status)) { rebuild = 1; } strcpy( node, vlist[i].p2); } if ( vlist[i].volume_id == m_session.vid()) { // Build current volume volume(); if ( evenSts()) return; } cdh_ToLower( vname, vlist[i].volume_name); if ( vlist[i].volume_id >= cdh_cUserVolMin && vlist[i].volume_id <= cdh_cUserVolMax) { sprintf( fname, "$pwrp_load/%s.dbs", vname); dcli_translate_filename( fname, fname); m_sts = dcli_file_time( fname, &vtime); if ( evenSts()) { // Dbs file is missing char msg[200]; sprintf( msg, "Loadfile for volume %s not created", vname); MsgWindow::message('E', msg, msgw_ePop_Yes); return; } if ( vtime.tv_sec > btime.tv_sec) rebuild = 1; } } } } wb_log::pull(); if ( m_wnav && m_wnav->ldhses) { wb_erep *erep = *(wb_env *)ldh_SessionToWB( m_wnav->ldhses); erep->checkVolumes( &m_sts, nodename); if ( evenSts()) return; } if ( opt.force || opt.manual || rebuild) { m_sts = lfu_create_bootfile( nodename, (lfu_t_volumelist *)volumelist, volumecnt, opt.debug); if ( ODD(m_sts)) wb_log::log( wlog_eCategory_NodeBuild, nodename, 0); } else m_sts = PWRB__NOBUILT; sumsts = m_sts; syi_NodeName( &m_sts, currentnode, sizeof(currentnode)); // if ( cdh_NoCaseStrcmp( node, currentnode) == 0) { pwr_tFileName src_fname, dest_fname; pwr_tCmd cmd; pwr_tTime dest_time, src_time; // Copy xtt_help.dat from $pwrp_cnf to $pwrp_exe sprintf( src_fname, "$pwrp_cnf/%s/xtt_help.dat", node); dcli_translate_filename( src_fname, src_fname); m_sts = dcli_file_time( src_fname, &src_time); if ( evenSts()) { strcpy( src_fname, "$pwrp_cnf/xtt_help.dat"); dcli_translate_filename( src_fname, src_fname); m_sts = dcli_file_time( src_fname, &src_time); if ( evenSts()) { char msg[200]; sprintf( msg, "File is missing $pwrp_cnf/xtt_help.dat"); MsgWindow::message('E', msg, msgw_ePop_Yes); } } if ( oddSts()) { strcpy( dest_fname, "$pwrp_exe/xtt_help.dat"); dcli_translate_filename( dest_fname, dest_fname); m_sts = dcli_file_time( dest_fname, &dest_time); if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) { sprintf( cmd, "cp %s %s", src_fname, dest_fname); system( cmd); sprintf( cmd, "Build: Copy %s -> $pwrp_exe", src_fname); MsgWindow::message( 'I', cmd, msgw_ePop_No); m_sts = PWRB__SUCCESS; } else m_sts = PWRB__NOBUILT; } if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT) sumsts = m_sts; // Copy pwrp_alias.dat from $pwrp_cnf to $pwrp_load sprintf( src_fname, "$pwrp_cnf/%s/pwrp_alias.dat", node); dcli_translate_filename( src_fname, src_fname); m_sts = dcli_file_time( src_fname, &src_time); if ( evenSts()) { strcpy( src_fname, "$pwrp_cnf/pwrp_alias.dat"); dcli_translate_filename( src_fname, src_fname); m_sts = dcli_file_time( src_fname, &src_time); } if ( oddSts()) { strcpy( dest_fname, "$pwrp_load/pwrp_alias.dat"); dcli_translate_filename( dest_fname, dest_fname); m_sts = dcli_file_time( dest_fname, &dest_time); if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) { sprintf( cmd, "cp %s %s", src_fname, dest_fname); system( cmd); sprintf( cmd, "Build: Copy %s -> $pwrp_load", src_fname); MsgWindow::message( 'I', cmd, msgw_ePop_No); m_sts = PWRB__SUCCESS; } else m_sts = PWRB__NOBUILT; } else m_sts = PWRB__NOBUILT; if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT) sumsts = m_sts; // Copy ld_appl_...txt from $pwrp_cnf to $pwrp_load sprintf( src_fname, load_cNameAppl, "$pwrp_cnf", cdh_Low(node), bussid); dcli_translate_filename( src_fname, src_fname); m_sts = dcli_file_time( src_fname, &src_time); if ( evenSts()) { char dir[80]; strcpy( dir, "$pwrp_cnf/"); sprintf( src_fname, load_cNameAppl, dir, cdh_Low(node), bussid); dcli_translate_filename( src_fname, src_fname); m_sts = dcli_file_time( src_fname, &src_time); } if ( oddSts()) { sprintf( dest_fname, load_cNameAppl, "$pwrp_load/", cdh_Low(node), bussid); dcli_translate_filename( dest_fname, dest_fname); m_sts = dcli_file_time( dest_fname, &dest_time); if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) { sprintf( cmd, "cp %s %s", src_fname, dest_fname); system( cmd); sprintf( cmd, "Build: %s -> $pwrp_load", src_fname); MsgWindow::message( 'I', cmd, msgw_ePop_No); m_sts = PWRB__SUCCESS; } else m_sts = PWRB__NOBUILT; } else m_sts = PWRB__NOBUILT; if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT) sumsts = m_sts; } if ( sumsts != PWRB__NOBUILT) { char msg[200]; sprintf( msg, "Build: Node %s", nodename); MsgWindow::message('I', msg, msgw_ePop_No); } m_sts = sumsts; }
wb_adrep *wb_bdrep::adrep( pwr_tStatus *sts, const char *aname) { #if 0 wb_attrname n(aname); if ( n.evenSts()) { *sts = n.sts(); return 0; } char fullname[120]; wb_bdrep *bd = this; wb_adrep *adrep = 0; int offset; for ( int i = 0; i < n.attributes(); i++) { wb_name an(n.attribute(i)); wb_orep *orep = bd->m_orep->vrep()->child( sts, bd->m_orep, an); if ( EVEN(*sts)) return 0; if ( adrep) delete adrep; adrep = new wb_adrep( *orep); if ( i == 0) { offset = adrep->offset(); strcpy( fullname, adrep->name()); } else { offset += adrep->offset(); strcat( fullname, "."); strcat( fullname, adrep->name()); } if ( n.hasAttrIndex(i)) { sprintf( &fullname[strlen(fullname)], "[%d]", n.attrIndex(i)); if ( n.attrIndex(i) >= adrep->nElement() || n.attrIndex(i) < 0) { *sts = LDH__ATTRINDEX; return 0; } offset += n.attrIndex(i) * adrep->size() / adrep->nElement(); } if ( (i != n.attributes() - 1) && adrep->isClass()) { wb_cdrep *cd = m_orep->vrep()->merep()->cdrep( sts, adrep->subClass()); if ( EVEN(*sts)) return 0; if ( bd != this) delete bd; bd = cd->bdrep( sts, pwr_eBix_rt); if ( EVEN(*sts)) { delete cd; return 0;} delete cd; } } adrep->setSubattr( offset, fullname); #endif wb_attrname n(aname); if ( n.evenSts()) { *sts = n.sts(); return 0; } wb_bdrep *bd = this; wb_adrep *adrep = 0; wb_adrep *old = 0; for ( int i = 0; i < n.attributes(); i++) { bool next_attr = false; wb_name an(n.attribute(i)); wb_orep *orep = bd->m_orep->vrep()->child( sts, bd->m_orep, an); while ( EVEN(*sts)) { // Try Super attribute orep = bd->m_orep->vrep()->first( sts, bd->m_orep); if ( EVEN(*sts)) { if ( bd != this) delete bd; if ( adrep) delete adrep; return 0; } if ( cdh_NoCaseStrcmp( orep->name(), "Super") == 0) { if ( adrep) old = adrep; adrep = new wb_adrep( *orep); if ( old) adrep->add( old); delete old; wb_cdrep *cd = m_orep->vrep()->merep()->cdrep( sts, adrep->subClass()); if ( EVEN(*sts)) return 0; if ( bd != this) delete bd; bd = cd->bdrep( sts, pwr_eBix_rt); if ( EVEN(*sts)) { delete cd; return 0;} delete cd; orep = bd->m_orep->vrep()->child( sts, bd->m_orep, an); } else { if ( adrep && adrep->flags() & PWR_MASK_CASTATTR && n.hasSuper()) { // Allow additional super attributesegement for casted attributes next_attr = true; break; } orep->ref(); orep->unref(); *sts = LDH__NOSUCHATTR; return 0; } } if ( next_attr) continue; if ( adrep) old = adrep; adrep = new wb_adrep( *orep); if ( i != 0) { if ( n.hasAttrIndex( i - 1)) adrep->add( old, n.attrIndex( i - 1)); else adrep->add( old); delete old; } if ( n.hasAttrIndex(i) && (n.attrIndex(i) >= adrep->nElement() || n.attrIndex(i) < 0)) { *sts = LDH__ATTRINDEX; return 0; } if ( (i != n.attributes() - 1) && adrep->isClass()) { wb_cdrep *cd; if ( m_merep) cd = m_merep->cdrep( sts, adrep->subClass()); else cd = m_orep->vrep()->merep()->cdrep( sts, adrep->subClass()); if ( EVEN(*sts)) return 0; if ( bd != this) delete bd; bd = cd->bdrep( sts, pwr_eBix_rt); if ( EVEN(*sts)) { delete cd; return 0;} delete cd; } else if ( (i != n.attributes() - 1) && !adrep->isClass()) { // To many attribute delete adrep; *sts = LDH__NOSUCHATTR; return 0; } } return adrep; }
static pwr_tStatus configure_object_reset( ldh_sMenuCall *ip, pwr_sAttrRef *aref, pwr_sMenuButton *mb) { pwr_tStatus sts; pwr_tCid cid; ldh_sParDef *bodydef; int rows; int i, j; pwr_sAttrRef aaref, daref; pwr_tDisableAttr disable = 0; char vect[10][80]; int vect_cnt; int skip; char *s; // Attribute objects in argument 2 are not controlled by the configure method if ( mb) { vect_cnt = dcli_parse( mb->MethodArguments[2], ",", "", (char *)vect, sizeof( vect) / sizeof( vect[0]), sizeof( vect[0]), 0); for ( j = 0; j < vect_cnt; j++) dcli_trim( vect[j], vect[j]); } else vect_cnt = 0; sts = ldh_GetAttrRefTid( ip->PointedSession, aref, &cid); if ( EVEN(sts)) return sts; sts = ldh_GetObjectBodyDef( ip->PointedSession, cid, "RtBody", 1, &bodydef, &rows); if (EVEN(sts)) return sts; for ( i = 0; i < rows; i++) { // Check if attribute is controlled by this method skip = 0; if ( mb) { // Remove leading Super. s = bodydef[i].ParName; while ( strncmp( s, "Super.", 6) == 0) s += 6; for ( j = 0; j < vect_cnt; j++) { if ( cdh_NoCaseStrcmp( vect[j], s) == 0) { // This object should not be reset skip = 1; break; } } if ( skip) continue; } if ( bodydef[i].Par->Param.Info.Flags & PWR_MASK_DISABLEATTR) { // Enable all attributes sts = ldh_ArefANameToAref( ip->PointedSession, aref, bodydef[i].ParName, &aaref); if ( EVEN(sts)) return sts; daref = cdh_ArefToDisableAref( &aaref); sts = ldh_WriteAttribute( ip->PointedSession, &daref, (void *)&disable, sizeof(disable)); if ( EVEN(sts)) return sts; } if ( bodydef[i].Par->Param.Info.Flags & PWR_MASK_CLASS) { // Reset object attribute sts = ldh_ArefANameToAref( ip->PointedSession, aref, bodydef[i].ParName, &aaref); if ( EVEN(sts)) return sts; sts = configure_object_reset( ip, &aaref, 0); if ( EVEN(sts)) return sts; } } free( (char *)bodydef); return LDH__SUCCESS; }
int sev_repair::list( char *table) { int found = 0; char timstr[40]; for ( unsigned int i = 0; i < m_db->m_items.size(); i++) { if ( cdh_NoCaseStrcmp( table, m_db->m_items[i].tablename) == 0) { printf( "-- %s\n", m_db->m_items[i].tablename); printf( " Object: %s\n", m_db->m_items[i].oname); for ( int j = 0; j < (int)m_db->m_items[i].attr.size(); j++) { printf( " Attribute: %s ", m_db->m_items[i].attr[j].aname); for ( int k = 0; k < 19 - (int)strlen( m_db->m_items[i].attr[j].aname); k++) printf( " "); switch ( m_db->m_items[i].attr[j].type) { case pwr_eType_Boolean: printf( "Boolean\n"); break; case pwr_eType_Float32: printf( "Float32\n"); break; case pwr_eType_Float64: printf( "Float64\n"); break; case pwr_eType_Int64: printf( "Int64\n"); break; case pwr_eType_Int32: printf( "Int32\n"); break; case pwr_eType_Int16: printf( "Int16\n"); break; case pwr_eType_Int8: printf( "Int8\n"); break; case pwr_eType_UInt64: printf( "UInt64\n"); break; case pwr_eType_UInt32: printf( "UInt32\n"); break; case pwr_eType_UInt16: printf( "UInt16\n"); break; case pwr_eType_UInt8: printf( "UInt8\n"); break; case pwr_eType_String: printf( "String\n"); break; default: printf( "Unknown\n"); } } time_AtoAscii( &m_db->m_items[i].creatime, time_eFormat_DateAndTime, timstr, sizeof(timstr)); printf( " Creation time: %s\n", timstr); time_AtoAscii( &m_db->m_items[i].modtime, time_eFormat_DateAndTime, timstr, sizeof(timstr)); printf( " Modification time: %s\n", timstr); time_DtoAscii( &m_db->m_items[i].storagetime, time_eFormat_DateAndTime, timstr, sizeof(timstr)); printf( " Storage time: %s\n", timstr); printf( " Scantime: %f\n", m_db->m_items[i].scantime); printf( " Deadband: %f\n", m_db->m_items[i].deadband); printf( " Options: "); if ( m_db->m_items[i].options & pwr_mSevOptionsMask_PosixTime) printf( "PosixTime "); if ( m_db->m_items[i].options & pwr_mSevOptionsMask_HighTimeResolution) printf( "HighTimeResoltion "); if ( m_db->m_items[i].options & pwr_mSevOptionsMask_ReadOptimized) printf( "ReadOptimized "); if ( m_db->m_items[i].options & pwr_mSevOptionsMask_UseDeadBand) printf( "UseDeadBand "); if ( m_db->m_items[i].options & pwr_mSevOptionsMask_Parameter) printf( "Parameter "); if ( m_db->m_items[i].options & pwr_mSevOptionsMask_Event) printf( "Event "); printf( "\n"); found = 1; break; } } if ( !found) printf( "** No such table\n"); return 1; }
PalFileMenu *PalFile::config_tree_build_children( ldh_tSession ldhses, ifstream *fp, int *line_cnt, const char *filename, PalFileMenu *parent) { PalFileMenu *menu_p, *prev, *mp; PalFileMenu *return_menu = NULL; int first = 1; int nr; char line[140]; char type[120]; char name[120]; char p1[120]; char p2[120]; int found; int hide_children = 0; // Children might already exist if ( parent) { for ( menu_p = parent->child_list; menu_p; menu_p = menu_p->next) { prev = menu_p; first = 0; } } menu_p = 0; while ( 1) { if ( !fp->getline( line, sizeof( line))) break; dcli_remove_blank( line, line); (*line_cnt)++; if ( line[0] == 0) continue; if ( line[0] == '!' || line[0] == '#') continue; nr = sscanf( line, "%s %s %s %s", type, name, p1, p2); if ( nr < 1 ) printf( "** Syntax error in file %s, line %d\n", filename, *line_cnt); if ( strcmp( type, "{") == 0) { if ( !hide_children) { if ( nr != 1 || !menu_p) printf( "** Syntax error in file %s, line %d\n", filename, *line_cnt); else mp = config_tree_build_children( ldhses, fp, line_cnt, filename, menu_p); if ( !menu_p->child_list) menu_p->child_list = mp; } else hide_children = 0; } else if ( strcmp( type, "}") == 0) { if ( nr != 1 ) printf( "** Syntax error in file %s, line %d\n", filename, *line_cnt); return return_menu; } else if ( cdh_NoCaseStrcmp( type, "menu") == 0) { if ( !(nr == 2 || nr == 3)) printf( "** Syntax error in file %s, line %d\n", filename, *line_cnt); if ( nr == 3 && ( ldhses && !check_volume( ldhses, p1))) { hide_children = 1; break; } // Check if it already exist found = 0; for ( menu_p = parent->child_list; menu_p; menu_p = menu_p->next) { if ( strcmp( menu_p->title, name) == 0) { found = 1; break; } } if ( !found) { menu_p = new PalFileMenu( name, pal_eMenuType_Menu, parent); if ( first) { return_menu = menu_p; first = 0; } else prev->next = menu_p; prev = menu_p; } } else if ( cdh_NoCaseStrcmp( type, "class") == 0) { if ( !( nr == 2 || nr == 3)) printf( "** Syntax error in file %s, line %d\n", filename, *line_cnt); if ( nr == 2 || ( nr == 3 && (!ldhses || check_volume( ldhses, p1)))) { menu_p = new PalFileMenu( name, pal_eMenuType_Class, parent); if ( first) { return_menu = menu_p; first = 0; } else prev->next = menu_p; prev = menu_p; } } else if ( cdh_NoCaseStrcmp( type, "classvolume") == 0) { if ( !(nr == 2 || nr == 3)) printf( "** Syntax error in file %s, line %d\n", filename, *line_cnt); if ( nr == 2 || ( nr == 3 && (!ldhses || check_volume( ldhses, p1)))) { menu_p = new PalFileMenu( name, pal_eMenuType_ClassVolume, parent); if ( first) { return_menu = menu_p; first = 0; } else prev->next = menu_p; prev = menu_p; } } } return return_menu; }
void wb_crrgen::load( pwr_tStatus *rsts, int sim) { pwr_tStatus sts; for ( int i = 0; i < int(sizeof(reflist)/sizeof(reflist[0])); i++) { if ( !sim && reflist[i].table == crrgen_eTable_SimSignal) continue; for ( wb_object o = m_sp->object( reflist[i].cid); o; o = o.next()) { pwr_tAttrRef aref; // Skip if in LibHier bool in_libhier = false; for ( wb_object p = o.parent(); p; p = p.parent()) { if ( p.cid() == pwr_eClass_LibHier) { in_libhier = true; break; } } if ( in_libhier) continue; wb_attribute a = m_sp->attribute( o.oid(), reflist[i].body, reflist[i].attr); if ( reflist[i].is_oid) { // Objid reference pwr_tOid oid; a.value( &oid); aref = cdh_ObjidToAref( oid); } else // AttrRef reference a.value( &aref); if ( cdh_ObjidIsNotNull( aref.Objid)) { sCrrKey key; wb_utl::utl_replace_symbol( (ldh_tSesContext)m_sp, o.oid(), &aref); key.target = aref; key.reference = cdh_ObjidToAref( o.oid()); key.type = reflist[i].type; switch ( reflist[i].table) { case crrgen_eTable_Signal: case crrgen_eTable_SimSignal: tree_Insert(&sts, m_signal_th, &key); break; case crrgen_eTable_Object: tree_Insert(&sts, m_object_th, &key); break; default: ; } } } } // Ge references for ( wb_object o = m_sp->object( pwr_cClass_XttGraph); o; o = o.next()) { pwr_tString80 action; pwr_tFileName fname; char line[512]; char linep[2][512]; int tag; int nr; char *s; wb_attribute a = m_sp->attribute( o.oid(), "RtBody", "Action"); a.value( action); if ( strstr( action, ".pwg")) { sprintf( fname, "$pwrp_exe/%s", cdh_Low(action)); dcli_translate_filename( fname, fname); ifstream fpg( fname); if ( !fpg) continue; while ( fpg.getline( line, sizeof(line))) { nr = dcli_parse( line , " ", "", (char *)linep, sizeof( linep) / sizeof( linep[0]), sizeof( linep[0]), 0); if ( nr != 2) continue; nr = sscanf( linep[0], "%d", &tag); if ( nr != 1) continue; switch ( tag) { case ge_eSave_DigLowColor_attribute: case ge_eSave_DigColor_attribute: case ge_eSave_DigError_attribute: case ge_eSave_DigWarning_attribute: case ge_eSave_Invisible_attribute: case ge_eSave_DigBorder_attribute: case ge_eSave_DigText_attribute: case ge_eSave_ValueInput_minvalue_attr: case ge_eSave_ValueInput_maxvalue_attr: case ge_eSave_Rotate_attribute: case ge_eSave_Move_move_x_attribute: case ge_eSave_Move_move_y_attribute: case ge_eSave_Move_scale_x_attribute: case ge_eSave_Move_scale_y_attribute: case ge_eSave_AnalogShift_attribute: case ge_eSave_DigShift_attribute: case ge_eSave_Animation_attribute: case ge_eSave_Bar_attribute: case ge_eSave_Bar_minvalue_attr: case ge_eSave_Bar_maxvalue_attr: case ge_eSave_Trend_attribute1: case ge_eSave_Trend_attribute2: case ge_eSave_Trend_minvalue_attr1: case ge_eSave_Trend_maxvalue_attr1: case ge_eSave_Trend_minvalue_attr2: case ge_eSave_Trend_maxvalue_attr2: case ge_eSave_DigFlash_attribute: case ge_eSave_FillLevel_attribute: case ge_eSave_FillLevel_minvalue_attr: case ge_eSave_FillLevel_maxvalue_attr: case ge_eSave_Table_attribute1: case ge_eSave_Table_sel_attribute1: case ge_eSave_StatusColor_attribute: case ge_eSave_DigSound_attribute: case ge_eSave_XY_Curve_x_attr: case ge_eSave_XY_Curve_y_attr: case ge_eSave_XY_Curve_y_minvalue_attr: case ge_eSave_XY_Curve_y_maxvalue_attr: case ge_eSave_XY_Curve_x_minvalue_attr: case ge_eSave_XY_Curve_x_maxvalue_attr: case ge_eSave_DigCommand_attribute: case ge_eSave_Slider_minvalue_attr: case ge_eSave_Slider_maxvalue_attr: case ge_eSave_Slider_insensitive_attr: case ge_eSave_AnalogColor_attribute: case ge_eSave_DigSound_soundobject: case ge_eSave_PopupMenu_ref_object: { if ( ( s = strchr( linep[1], '#'))) *s = 0; if ( linep[1][0] == '!') strcpy( &linep[1][0], &linep[1][1]); wb_attribute al = m_sp->attribute(linep[1]); if (!al) break; int len = strlen(linep[1]); if ( len > 12 && cdh_NoCaseStrcmp( &linep[1][len - 12], ".ActualValue") == 0) { linep[1][len - 12] = 0; al = m_sp->attribute(linep[1]); if ( !al) break; } switch ( al.tid()) { case pwr_cClass_Di: case pwr_cClass_Do: case pwr_cClass_Dv: case pwr_cClass_Ai: case pwr_cClass_Ao: case pwr_cClass_Av: case pwr_cClass_Co: case pwr_cClass_Ii: case pwr_cClass_Io: case pwr_cClass_Iv: case pwr_cClass_Sv: case pwr_cClass_ATv: case pwr_cClass_DTv: { sCrrKey key; key.target = al.aref(); key.reference = cdh_ObjidToAref( o.oid()); key.type = crrgen_eType_Read; tree_Insert(&sts, m_signal_th, &key); break; } default: { sCrrKey key; key.target = al.aref(); key.reference = cdh_ObjidToAref( o.oid()); key.type = crrgen_eType_Read; tree_Insert(&sts, m_object_th, &key); } } break; } case ge_eSave_Value_attribute: case ge_eSave_SetDig_attribute: case ge_eSave_ResetDig_attribute: case ge_eSave_ToggleDig_attribute: case ge_eSave_StoDig_attribute: case ge_eSave_IncrAnalog_attribute: case ge_eSave_RadioButton_attribute: case ge_eSave_Slider_attribute: case ge_eSave_OptionMenu_attribute: { if ( ( s = strchr( linep[1], '#'))) *s = 0; if ( linep[1][0] == '!') strcpy( &linep[1][0], &linep[1][1]); wb_attribute al = m_sp->attribute(linep[1]); if (!al) break; int len = strlen(linep[1]); if ( len > 12 && cdh_NoCaseStrcmp( &linep[1][len - 12], ".ActualValue") == 0) { linep[1][len - 12] = 0; al = m_sp->attribute(linep[1]); if ( !al) break; } switch ( al.tid()) { case pwr_cClass_Di: case pwr_cClass_Do: case pwr_cClass_Dv: case pwr_cClass_Ai: case pwr_cClass_Ao: case pwr_cClass_Av: case pwr_cClass_Co: case pwr_cClass_Ii: case pwr_cClass_Io: case pwr_cClass_Iv: case pwr_cClass_Sv: case pwr_cClass_ATv: case pwr_cClass_DTv: { sCrrKey key; key.target = al.aref(); key.reference = cdh_ObjidToAref( o.oid()); key.type = crrgen_eType_Write; tree_Insert(&sts, m_signal_th, &key); break; } default: { sCrrKey key; key.target = al.aref(); key.reference = cdh_ObjidToAref( o.oid()); key.type = crrgen_eType_Write; tree_Insert(&sts, m_object_th, &key); } } break; } default: ; } } fpg.close(); } } *rsts = 1; }
static pwr_tStatus IoCardInit( io_tCtx ctx, io_sAgent *ap, io_sRack *rp, io_sCard *cp) { io_sLocalUSB_Joystick *local; pwr_sClass_USB_Joystick *op = (pwr_sClass_USB_Joystick *)cp->op; int i, j, k; int fd; unsigned char axes = 2; unsigned char buttons = 2; uint8_t axmap[ABS_MAX + 1]; uint16_t btnmap[KEY_MAX - BTN_MISC + 1]; fd = open( op->Device, O_RDONLY); if ( fd == -1) { errh_Error( "USB_Joystick, unable to attach device, sts %d, '%s'", errno, cp->Name); op->Status = IO__INITFAIL; return IO__INITFAIL; } local = (io_sLocalUSB_Joystick *) calloc( 1, sizeof(io_sLocalUSB_Joystick)); cp->Local = local; local->fd = fd; ioctl( local->fd, JSIOCGAXES, &axes); ioctl( local->fd, JSIOCGBUTTONS, &buttons); ioctl( local->fd, JSIOCGAXMAP, axmap); ioctl( local->fd, JSIOCGBTNMAP, btnmap); fcntl( local->fd, F_SETFL, O_NONBLOCK); int map_found = 0; int name_found = 0; for ( i = 0; i < cp->ChanListSize; i++) { if ( cp->chanlist[i].sop) { switch ( cp->chanlist[i].ChanClass) { case pwr_cClass_ChanAi: { pwr_sClass_ChanAi *cop = (pwr_sClass_ChanAi *)cp->chanlist[i].cop; /* Map channel */ for ( j = 0; j < ABS_MAX; j++) { if ( axis_names[j] == 0) break; if ( cdh_NoCaseStrcmp( axis_names[j], cop->Identity) == 0) { for ( k = 0; k < axes; k++) { if ( axmap[k] == j) { local->axis_map[k] = i; map_found = 1; break; } } if ( !map_found) { errh_Error( "USB_Joystick, on such axis on this device '%s', '%s'", cop->Identity, cp->Name); op->Status = IO__INITFAIL; return IO__INITFAIL; } name_found = 1; break; } } if ( !name_found) { errh_Error( "USB_Joystick, axis name doesn't exist '%s', '%s'", cop->Identity, cp->Name); op->Status = IO__INITFAIL; return IO__INITFAIL; } io_AiRangeToCoef( &cp->chanlist[i]); break; } case pwr_cClass_ChanIi: { pwr_sClass_ChanIi *cop = (pwr_sClass_ChanIi *)cp->chanlist[i].cop; /* Map channel */ for ( j = 0; j < ABS_MAX; j++) { if ( cdh_NoCaseStrcmp( axis_names[j], cop->Identity) == 0) { for ( k = 0; k < axes; k++) { if ( axmap[k] == j) { local->axis_map[k] = i; map_found = 1; break; } } if ( !map_found) { errh_Error( "USB_Joystick, on such axis on this device '%s', '%s'", cop->Identity, cp->Name); op->Status = IO__INITFAIL; return IO__INITFAIL; } name_found = 1; break; } } if ( !name_found) { errh_Error( "USB_Joystick, axis name doesn't exist '%s', '%s'", cop->Identity, cp->Name); op->Status = IO__INITFAIL; return IO__INITFAIL; } break; } case pwr_cClass_ChanDi: { pwr_sClass_ChanDi *cop = (pwr_sClass_ChanDi *)cp->chanlist[i].cop; /* Map channel */ for ( j = 0; j < KEY_MAX - BTN_MISC; j++) { if ( button_names[j] == 0) break; if ( cdh_NoCaseStrcmp( button_names[j], cop->Identity) == 0) { for ( k = 0; k < buttons; k++) { if ( btnmap[k] - BTN_MISC == j) { local->button_map[k] = i; map_found = 1; break; } } if ( !map_found) { errh_Error( "USB_Joystick, on such button on this device '%s', '%s'", cop->Identity, cp->Name); op->Status = IO__INITFAIL; return IO__INITFAIL; } name_found = 1; break; } } if ( !name_found) { errh_Error( "USB_Joystick, button name doesn't exist '%s', '%s'", cop->Identity, cp->Name); op->Status = IO__INITFAIL; return IO__INITFAIL; } break; } default: errh_Error( "USB_Joystick, channel type error, '%s'", cp->Name); op->Status = IO__INITFAIL; return IO__INITFAIL; } } } errh_Info( "Init of USB_Joystick '%s'", cp->Name); op->Status = IO__SUCCESS; return IO__SUCCESS; }
int NavHelp::help( const char *help_key, const char *help_bookmark, navh_eHelpFile file_type, const char *file_name, void **book_mark, bool strict) { FILE *file; char line[200]; char text1[200]; char text2[200]; char text3[200]; char key[80]; char key_part[4][40]; char include_file[80]; char subject[80]; char subject_part[4][40]; int key_nr; int subject_nr; int hit = 0; int sts; int i; char link[200]; char link_bookmark[80]; char link_filename[80]; char *link_filename_p; int link_nr; char link_part[4][200]; char bookmark[80]; char search_bookmark[80]; char *s; int header1; int header2; int bold; int code; int horizontal_line; int style = 0; char style_str[80]; int image; char imagefile[80]; int register_bookmark = 0; int bookmark_found = 0; void *bookmark_node = 0; int index_link; void *node; int print_all; char *bookmark_p; lng_eCoding coding = lng_eCoding_ISO8859_1; print_all = (help_key == NULL); if ( help_key) { cdh_ToLower( key, help_key); cdh_ToLower( search_bookmark, help_bookmark); } // Open file file = navhelp_open_file( this, file_type, file_name); if ( !file) return NAV__NOFILE; if ( !print_all) key_nr = dcli_parse( key, " ", "", (char *)key_part, sizeof( key_part) / sizeof( key_part[0]), sizeof( key_part[0]), 0); sts = dcli_read_line( line, sizeof( line), file); while ( ODD(sts)) { if ( cdh_NoCaseStrncmp( line, "<coding>", 8) == 0) { char codingstr[40]; help_remove_spaces( &line[8], codingstr); if ( cdh_NoCaseStrcmp( codingstr, "ISO8859-1") == 0) { coding = lng_eCoding_ISO8859_1; } else if ( cdh_NoCaseStrcmp( codingstr, "UTF-8") == 0) { coding = lng_eCoding_UTF_8; } } else if ( cdh_NoCaseStrncmp( line, "<include>", 9) == 0) { help_remove_spaces( &line[9], include_file); if ( !noprop || strstr( include_file, "$pwr_lang") == 0) { sts = help( help_key, help_bookmark, navh_eHelpFile_Other, include_file, book_mark, strict); if ( ODD(sts) && !print_all) { fclose( file); return sts; } } hit = 0; } else if ( cdh_NoCaseStrncmp( line, "<chapter>", 9) == 0) { (insert_cb)( parent_ctx, navh_eItemType_Chapter, "", NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); } else if ( cdh_NoCaseStrncmp( line, "</chapter>", 10) == 0) { (insert_cb)( parent_ctx, navh_eItemType_EndChapter, "", NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); } else if ( cdh_NoCaseStrncmp( line, "<headerlevel>", 13) == 0) { (insert_cb)( parent_ctx, navh_eItemType_HeaderLevel, "", NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); } else if ( cdh_NoCaseStrncmp( line, "</headerlevel>", 14) == 0) { (insert_cb)( parent_ctx, navh_eItemType_EndHeaderLevel, "", NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); } else if ( cdh_NoCaseStrncmp( line, "<pagebreak>", 11) == 0) { (insert_cb)( parent_ctx, navh_eItemType_PageBreak, "", NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); } else if ( cdh_NoCaseStrncmp( line, "<option>", 8) == 0) { char option[80]; help_remove_spaces( &line[8], option); cdh_ToLower( option, option); (insert_cb)( parent_ctx, navh_eItemType_Option, option, NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); } else if ( cdh_NoCaseStrncmp( line, "<topic>", 7) == 0) { if ( (s = strstr( line, "<style>")) || (s = strstr( line, "<STYLE>"))) { style = 1; help_remove_spaces( s + 7, style_str); *s = 0; } help_remove_spaces( &line[7], subject); cdh_ToLower( subject, subject); subject_nr = dcli_parse( subject, " ", "", (char *)subject_part, sizeof( subject_part) / sizeof( subject_part[0]), sizeof( subject_part[0]), 0); hit = 0; if ( !print_all) { if ( key_nr == subject_nr ) { for ( i = 0; i < key_nr; i++) { if ( (!strict && strncmp( subject_part[i], key_part[i], strlen(key_part[i])) == 0) || (strict && strcmp( subject_part[i], key_part[i]) == 0)) { if ( i == key_nr - 1) hit = 1; } else break; } } } else { if ( cdh_NoCaseStrcmp( subject_part[0], "__documenttitlepage") == 0) (insert_cb)( parent_ctx, navh_eItemType_DocTitlePage, subject, NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); else if ( cdh_NoCaseStrcmp( subject_part[0], "__documentinfopage") == 0) (insert_cb)( parent_ctx, navh_eItemType_DocInfoPage, subject, NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); else (insert_cb)( parent_ctx, navh_eItemType_Topic, subject, NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); if ( style) node = (insert_cb)( parent_ctx, navh_eItemType_Style, style_str, NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); hit = 1; } } if ( hit) { sts = dcli_read_line( line, sizeof( line), file); (insert_cb)( parent_ctx, navh_eItemType_HelpHeader, line, NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); sts = dcli_read_line( line, sizeof( line), file); while( ODD(sts)) { bookmark_p = 0; if ( strncmp( line, "</topic>", 8) == 0 || strncmp( line, "</TOPIC>", 8) == 0) { if ( print_all) (insert_cb)( parent_ctx, navh_eItemType_EndTopic, subject, NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); break; } // Ignore all other tags if ( (s = strstr( line, "<ib>")) || (s = strstr( line, "<IB>"))) { strcpy( text1, s + 4); (insert_cb)( parent_ctx, navh_eItemType_HelpBold, text1, "", "", "", "", NULL, file_type, 0, NULL, coding); sts = dcli_read_line( line, sizeof( line), file); continue; } if ( (s = strstr( line, "<i>")) || (s = strstr( line, "<I>"))) { strcpy( text1, s + 3); (insert_cb)( parent_ctx, navh_eItemType_Help, text1, "", "", "", "", NULL, file_type, 0, bookmark_p, coding); sts = dcli_read_line( line, sizeof( line), file); continue; } if ( cdh_NoCaseStrncmp( line, "<option>", 8) == 0) { char option[80]; help_remove_spaces( &line[8], option); cdh_ToLower( option, option); (insert_cb)( parent_ctx, navh_eItemType_Option, option, NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); sts = dcli_read_line( line, sizeof( line), file); continue; } if ( (s = strstr( line, "<link>")) || (s = strstr( line, "<LINK>"))) { help_remove_spaces( s + 6, link); *s = 0; link_nr = dcli_parse( link, ",", "", (char *)link_part, sizeof( link_part) / sizeof( link_part[0]), sizeof( link_part[0]), 0); if ( link_nr == 1) { help_remove_spaces( link_part[0], link); strcpy( link_bookmark, ""); link_filename_p = (char *)file_name; } else if ( link_nr == 2) { help_remove_spaces( link_part[0], link); help_remove_spaces( link_part[1], link_bookmark); link_filename_p = (char *)file_name; } else if ( link_nr > 2) { help_remove_spaces( link_part[0], link); help_remove_spaces( link_part[1], link_bookmark); help_remove_spaces( link_part[2], link_filename); link_filename_p = link_filename; } } else if ( (s = strstr( line, "<weblink>")) || (s = strstr( line, "<WEBLINK>"))) { help_remove_spaces( s + 9, link); *s = 0; link_nr = dcli_parse( link, ",", "", (char *)link_part, sizeof( link_part) / sizeof( link_part[0]), sizeof( link_part[0]), 0); if ( link_nr == 1) { strcpy( link, "$web:"); help_remove_spaces( link_part[0], &link[5]); strcpy( link_bookmark, ""); link_filename_p = (char *)file_name; } else if ( link_nr == 2) { strcpy( link, "$web:"); help_remove_spaces( link_part[0], &link[5]); help_remove_spaces( link_part[1], link_bookmark); link_filename_p = (char *)file_name; } else if ( link_nr > 2) { strcpy( link, "$web:"); help_remove_spaces( link_part[0], &link[5]); help_remove_spaces( link_part[1], link_bookmark); help_remove_spaces( link_part[2], link_filename); link_filename_p = link_filename; } } else if ( (s = strstr( line, "<classlink>")) || (s = strstr( line, "<CLASSLINK>"))) { help_remove_spaces( s + 11, link); *s = 0; link_nr = dcli_parse( link, ",", "", (char *)link_part, sizeof( link_part) / sizeof( link_part[0]), sizeof( link_part[0]), 0); if ( link_nr == 1) { strcpy( link, "$class:"); help_remove_spaces( link_part[0], &link[7]); strcpy( link_bookmark, ""); link_filename_p = (char *)file_name; } else if ( link_nr == 2) { strcpy( link, "$class:"); help_remove_spaces( link_part[0], &link[7]); help_remove_spaces( link_part[1], link_bookmark); link_filename_p = (char *)file_name; } else if ( link_nr > 2) { strcpy( link, "$class:"); help_remove_spaces( link_part[0], &link[7]); help_remove_spaces( link_part[1], link_bookmark); help_remove_spaces( link_part[2], link_filename); link_filename_p = link_filename; } } else { strcpy( link, ""); strcpy( link_bookmark, ""); link_filename_p = link_filename; } if ( (s = strstr( line, "<bookmark>")) || (s = strstr( line, "<BOOKMARK>"))) { help_remove_spaces( s + 10, bookmark); *s = 0; cdh_ToLower( bookmark, bookmark); if ( !bookmark_found && !print_all && strcmp( search_bookmark, bookmark) == 0) { bookmark_found = 1; register_bookmark = 1; } if ( print_all) bookmark_p = bookmark; } if ( (s = strstr( line, "<index>")) || (s = strstr( line, "<INDEX>"))) { index_link = 1; *s = 0; } else index_link = 0; image = 0; header1 = 0; header2 = 0; bold = 0; code = 0; horizontal_line = 0; style = 0; if ( (s = strstr( line, "<h1>")) || (s = strstr( line, "<H1>"))) { header1 = 1; strcpy( text1, s + 4); } else if ( (s = strstr( line, "<h2>")) || (s = strstr( line, "<H2>"))) { header2 = 1; strcpy( text1, s + 4); } else if ( (s = strstr( line, "<b>")) || (s = strstr( line, "<B>"))) { bold = 1; strcpy( text1, s + 3); } else if ( (s = strstr( line, "<c>")) || (s = strstr( line, "<C>"))) { code = 1; strcpy( text1, s + 3); } else if ( (s = strstr( line, "<hr>")) || (s = strstr( line, "<HR>"))) { horizontal_line = 1; } else if ( (s = strstr( line, "<image>")) || (s = strstr( line, "<IMAGE>"))) { help_remove_spaces( s + 7, imagefile); image = 1; } else { strcpy( text1, line); } if ( (s = strstr( text1, "<t>")) || (s = strstr( text1, "<T>")) ) { strcpy( text2, s + 3); *s = 0; if ( (s = strstr( text2, "<t>")) || (s = strstr( text2, "<T>")) ) { strcpy( text3, s + 3); *s = 0; } else strcpy( text3, ""); } else { strcpy( text2, ""); strcpy( text3, ""); } if ( header1) { node = (insert_cb)( parent_ctx, navh_eItemType_HeaderLarge, text1, NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, bookmark_p, coding); if ( register_bookmark) { bookmark_node = node; register_bookmark = 0; } } else if ( header2) { node = (insert_cb)( parent_ctx, navh_eItemType_Header, text1, NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, bookmark_p, coding); if ( register_bookmark) { bookmark_node = node; register_bookmark = 0; } } else if ( bold) { node = (insert_cb)( parent_ctx, navh_eItemType_HelpBold, text1, text2, text3, link, link_bookmark, link_filename_p, file_type, index_link, bookmark_p, coding); if ( register_bookmark) { bookmark_node = node; register_bookmark = 0; } } else if ( code) { node = (insert_cb)( parent_ctx, navh_eItemType_HelpCode, text1, text2, text3, link, link_bookmark, link_filename_p, file_type, index_link, bookmark_p, coding); if ( register_bookmark) { bookmark_node = node; register_bookmark = 0; } } else if ( horizontal_line) { node = (insert_cb)( parent_ctx, navh_eItemType_HorizontalLine, NULL, NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL, coding); } else if ( image) { node = (insert_cb)( parent_ctx, navh_eItemType_Image, imagefile, NULL, NULL, link, link_bookmark, link_filename_p, file_type, index_link, bookmark_p, coding); if ( register_bookmark) { bookmark_node = node; register_bookmark = 0; } } else { node = (insert_cb)( parent_ctx, navh_eItemType_Help, text1, text2, text3, link, link_bookmark, link_filename_p, file_type, index_link, bookmark_p, coding); if ( register_bookmark) { bookmark_node = node; register_bookmark = 0; } } sts = dcli_read_line( line, sizeof( line), file); } if ( bookmark_found) *book_mark = bookmark_node; else *book_mark = 0; if ( !print_all) break; else hit = 0; } sts = dcli_read_line( line, sizeof( line), file); } fclose( file); if ( !print_all && !hit) return NAV__TOPICNOTFOUND; return NAV__SUCCESS; }
int XttHotkey::read_file() { FILE *fp; char line[200]; int row = 0; char p1[2][200]; char p2[10][200]; int i, n; char *s; dcli_translate_filename( m_filename, m_filename); fp = fopen( m_filename, "r"); if ( !fp) return 0; while ( dcli_read_line( line, sizeof(line), fp)) { int mod = 0; int keysym; char keystr[20] = ""; char action_arg[200]; char action_name[200]; row++; dcli_trim( line, line); if ( line[0] == 0 || line[0] == '#') continue; n = dcli_parse( line, ":", "", (char *)p1, sizeof( p1) / sizeof( p1[0]), sizeof( p1[0]), 0); if ( n != 2) { printf( "Syntax error, %s, row %d\n", m_filename, row); continue; } dcli_trim( p1[0], p1[0]); dcli_trim( p1[1], p1[1]); n = dcli_parse( p1[0], " ", "", (char *)p2, sizeof( p2) / sizeof( p2[0]), sizeof( p2[0]), 0); if ( n < 1) { printf( "Syntax error, %s, row %d\n", m_filename, row); continue; } for ( i = 0; i < n; i++) { if ( cdh_NoCaseStrcmp( p2[i], "Control") == 0) mod |= ControlMask; else if ( cdh_NoCaseStrcmp( p2[i], "Shift") == 0) mod |= ShiftMask; else if ( cdh_NoCaseStrcmp( p2[i], "Alt") == 0) mod |= Mod1Mask; else if ( cdh_NoCaseStrncmp( p2[i], "<key>", 5) == 0) { strcpy( keystr, &p2[i][5]); dcli_trim( keystr, keystr); } else { printf( "Syntax error, %s, row %d\n", m_filename, row); break; } } n = dcli_parse( p1[1], "(", "", (char *)p2, sizeof( p2) / sizeof( p2[0]), sizeof( p2[0]), 0); if ( n < 2) { printf( "Syntax error, %s, row %d\n", m_filename, row); continue; } strcpy( action_name, p2[0]); dcli_trim( action_name, action_name); strcpy( action_arg, p2[1]); if ( (s = strrchr( action_arg, ')'))) *s = 0; else { printf( "Syntax error, %s, row %d\n", m_filename, row); continue; } keysym = XStringToKeysym( keystr); if ( !keysym) { printf( "Syntax error, %s, row %d\n", m_filename, row); continue; } HotkeyKey key( mod, keysym, action_name, action_arg); m_keys.push_back( key); } fclose( fp); for ( i = 0; i < (int)m_keys.size(); i++) { grab_key( m_keys[i].m_keysym, m_keys[i].m_mod); } return 1; }
int CnvWblToHtml::typedef_exec() { pwr_tFileName fname; int i; pwr_tFileName html_file_name; char full_class_name[80]; char ref_name[200]; pwr_tFileName struct_file; char low_volume_name[80]; char low_class_name[80]; char txt[200]; char code_aref[200]; int lng_sts = 1; if ( Lng::current() != lng_eLanguage_en_US) lng_sts = ctx->rw->read_lng( ctx->rw->typedef_name, 0); strcpy( ctx->rw->class_name, ctx->rw->typedef_name); cdh_ToLower( low_volume_name, ctx->rw->volume_name); cdh_ToLower( low_class_name, ctx->rw->class_name); CnvWblToH::get_filename( ctx->rw, fname, 0); CnvReadSrc::filename_to_html( struct_file, fname); strcpy( full_class_name, ctx->rw->volume_name); strcat( full_class_name, ":"); strcat( full_class_name, ctx->rw->class_name); strcpy( html_file_name, low_volume_name); strcat( html_file_name, "_"); strcat( html_file_name, low_class_name); // Add into index file fp_html_index << "<A HREF=\"" << html_file_name << ".html\" TARGET=\"classFrame\">" << ctx->rw->class_name << "</A>" << endl << "<BR>" << endl; // Add into AllClasses js file cnv_mentry mentry; strcpy( mentry.name, ctx->rw->class_name); strcpy( mentry.file, html_file_name); strcat( mentry.file, ".html"); all_types.push_back( mentry); // Add into group file for ( int i = 0; i < ctx->rw->doc_group_cnt; i++) { for ( int j = 0; j < ctx->setup->group_cnt; j++) { if ( cdh_NoCaseStrcmp( ctx->rw->doc_groups[i], ctx->setup->groups[j]) == 0) { fp_html_group[j] << "<A HREF=\"" << html_file_name << ".html\" TARGET=\"classFrame\">" << ctx->rw->class_name << "</A>" << endl << "<BR>" << endl; if ( !js_group_first[j]) fp_js_group[j] << ","; else js_group_first[j] = false; fp_js_group[j] << "[\"" << ctx->rw->class_name << "\",\"" << html_file_name << ".html\"]" << endl; } } } // Create class html file strcpy( fname, ctx->dir); strcat( fname, html_file_name); strcat( fname, ".html"); cdh_ToLower( fname, fname); html_clf = new CnvFile(); html_clf->f.open( fname); fp_tmp.open( cread_cTmpFile1); html_class_open = 1; html_clf->f << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Frameset//EN\"\"http://www.w3.org/TR/REC-html40/frameset.dtd\">" << endl << "<!-- Generated by pwr_cnv-->" << endl << "<HTML>" << endl << "<HEAD>" << endl << "<META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">" << endl << "<TITLE>" << endl << ": Type " << full_class_name << endl << "</TITLE>" << endl << "<link rel=\"stylesheet\" type=\"text/css\" href=\"orm.css\">" << endl << "</HEAD>" << endl << "<BODY BGCOLOR=\"white\">" << endl << "" << endl << "<!-- ========== START OF NAVBAR ========== -->" << endl << "<A NAME=\"navbar_top\"><!-- --></A>" << endl << "<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"1\" CELLSPACING=\"0\">" << endl << "<TR>" << endl << "<TD COLSPAN=2 BGCOLOR=\"#EEEEFF\" CLASS=\"NavBarCell1\">" << endl << "<A NAME=\"navbar_top_firstrow\"><FONT CLASS=\"NavBarFont1Rev\"><B>Volume " << ctx->rw->volume_name << "</B></FONT></A>" << endl << "</TD>" << endl << "</TR>" << endl << endl << "<TR>" << endl << "<TD BGCOLOR=\"white\" CLASS=\"NavBarCell2\"><FONT SIZE=\"-2\">" << endl; if ( (strcmp( ctx->rw->typedef_typeref, "Mask") == 0 || strcmp( ctx->rw->typedef_typeref, "Enum") == 0) && strcmp( low_volume_name, "pwrs") != 0) { sprintf( code_aref, "%s#%s", struct_file, ctx->rw->typedef_name); html_clf->f << " C Binding: <A HREF=\"" << code_aref << "\">Typedef</A>" << endl; } else if ( ctx->rw->doc_fresh && strcmp( ctx->rw->doc_code, "") != 0) { CnvReadSrc::filename_to_html( ref_name, ctx->rw->doc_code); sprintf( code_aref, "%s#%s", ref_name, low_class_name); html_clf->f << " C Binding: <A HREF=\"" << code_aref << "\">Typedef</A>" << endl; } for ( i = 0; i < 50; i++) html_clf->f << " "; html_clf->f << "</FONT></TD>" << endl << "<TD BGCOLOR=\"white\" CLASS=\"NavBarCell2\"><FONT SIZE=\"-2\">" << endl << " <A HREF=\"" << low_volume_name << "_index.html\" TARGET=\"_top\"><B>INDEX</B></A> " << endl << " <A HREF=\"" << html_file_name << ".html\" TARGET=\"_top\"><B>NO INDEX</B></A></FONT></TD>" << endl << "</TR>" << endl << "</TABLE>" << endl << "<!-- =========== END OF NAVBAR =========== -->" << endl << endl << "<HR>" << endl << "<!-- ======== START OF CLASS DATA ======== -->" << endl << "<H2>" << endl << "Type " << ctx->rw->class_name << "</H2>" << endl << "<HR>" << endl << "<DL>" << endl; if ( ctx->rw->doc_fresh && strcmp( ctx->rw->doc_author, "") != 0) { html_clf->f << "<DT><B>Author</B> " << ctx->rw->doc_author << "<DT>" << endl; } if ( ctx->rw->doc_fresh && strcmp( ctx->rw->doc_version, "") != 0) { html_clf->f << "<DT><B>Version</B> " << ctx->rw->doc_version << "<DT>" << endl; } if ( ctx->rw->doc_fresh && strcmp( ctx->rw->doc_code, "") != 0) { html_clf->f << "<DT><B>Code</B> " << ctx->rw->doc_code << "<DT>" << endl; } html_clf->f << "<BR><DT><B>Description</B><DT><BR>" << endl << "</DL><DIV ID=\"description\"><XMP>" << endl; if ( ctx->rw->doc_fresh) { for ( i = 0; i < ctx->rw->doc_cnt; i++) { ctx->remove_spaces( ctx->rw->doc_text[i], txt); if ( strncmp( CnvCtx::low(txt), "@image", 6) == 0) { char imagefile[80]; ctx->remove_spaces( txt + 6, imagefile); html_clf->f << "</XMP><IMG SRC=\"" << imagefile << "\"><XMP>" << endl; } else if ( strncmp( CnvCtx::low(txt), "@b", 2) == 0) { html_clf->f << "</XMP><B><FONT SIZE=\"3\">" << txt + 2 << "</FONT></B><BR><XMP>" << endl; } else if ( strncmp( CnvCtx::low(txt), "@h1", 3) == 0) { html_clf->f << "</XMP><H3>" << txt + 3 << "</H3><BR><XMP>" << endl; } else if ( strncmp( CnvCtx::low(txt), "@h2", 3) == 0) { html_clf->f << "</XMP><H4>" << txt + 3 << "</H4><BR><XMP>" << endl; } else html_clf->f << ctx->rw->doc_text[i] << endl; } } html_clf->f << "</XMP></DIV>" << endl; for ( i = 0; i < ctx->rw->doc_link_cnt; i++) { html_clf->f << " <A HREF=\"" << ctx->rw->doc_link_ref[i] << "\" TARGET=\"_self\"><FONT size=\"-1\"> " << ctx->rw->doc_link_text[i] <<"</FONT></A><BR>" << endl; } for ( i = 0; i < ctx->rw->doc_clink_cnt; i++) { html_clf->f << " <A HREF=\"" << ctx->rw->doc_clink_ref[i] << "\" TARGET=\"_self\"><FONT size=\"-1\"> " << ctx->rw->doc_clink_text[i] <<"</FONT></A><BR>" << endl; } html_clf->f << "</FONT>" << endl; if ( strcmp( ctx->rw->typedef_typeref, "Mask") == 0 || strcmp( ctx->rw->typedef_typeref, "Enum") == 0) { char bitchar = _tolower(ctx->rw->typedef_typeref[0]); html_clf->f << "<HR><BR>" << endl << "<A NAME=\"" << ctx->rw->typedef_name << "\"><!-- --></A>" << endl << "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\" WIDTH=\"100%\">" << endl << "<TR BGCOLOR=\"#CCCCFF\" CLASS=\"TableHeadingColor\">" << endl << "<TD COLSPAN=3><FONT SIZE=\"+2\">" << endl << "<B>" << ctx->rw->typedef_name << " elements</B></FONT>" << "<FONT SIZE=\"+1\"<B> <A HREF=\"" << code_aref << "\">pwr_" << bitchar << ctx->rw->typedef_name << "</A></B></FONT></TD>" << endl << "</TR>" << endl; } return 1; }
int CnvWblToHtml::class_exec() { pwr_tFileName fname; int i; pwr_tFileName html_file_name; pwr_tFileName ctree_file; char full_class_name[80]; char ref_name[200]; pwr_tFileName struct_file; pwr_tFileName hpp_file; char low_volume_name[80]; char low_class_name[80]; char txt[200]; char timestr[80]; int lng_sts = 1; cdp_created = false; if ( Lng::current() != lng_eLanguage_en_US) lng_sts = ctx->rw->read_lng( ctx->rw->class_name, 0); time_AtoAscii( 0, time_eFormat_DateAndTime, timestr, sizeof(timestr)); cdh_ToLower( low_volume_name, ctx->rw->volume_name); cdh_ToLower( low_class_name, ctx->rw->class_name); CnvWblToH::get_filename( ctx->rw, fname, 0); CnvReadSrc::filename_to_html( struct_file, fname); ctx->hpp = 1; CnvWblToH::get_filename( ctx->rw, fname, 1); CnvReadSrc::filename_to_html( hpp_file, fname); ctx->hpp = 0; strcpy( full_class_name, ctx->rw->volume_name); strcat( full_class_name, ":"); strcat( full_class_name, ctx->rw->class_name); strcpy( html_file_name, low_volume_name); strcat( html_file_name, "_"); strcat( html_file_name, low_class_name); strcpy( ctree_file, low_volume_name); strcat( ctree_file, "_"); strcat( ctree_file, low_class_name); strcat( ctree_file, "_ctree.html"); // Add into index file fp_html_index << "<A HREF=\"" << html_file_name << ".html\" TARGET=\"classFrame\">" << ctx->rw->class_name << "</A>" << endl << "<BR>" << endl; cnv_mentry mentry; strcpy( mentry.name, ctx->rw->class_name); strcpy( mentry.file, html_file_name); strcat( mentry.file, ".html"); all_classes.push_back( mentry); // Add into group file for ( int i = 0; i < ctx->rw->doc_group_cnt; i++) { for ( int j = 0; j < ctx->setup->group_cnt; j++) { if ( cdh_NoCaseStrcmp( ctx->rw->doc_groups[i], ctx->setup->groups[j]) == 0) { fp_html_group[j] << "<A HREF=\"" << html_file_name << ".html\" TARGET=\"classFrame\">" << ctx->rw->class_name << "</A>" << endl << "<BR>" << endl; if ( !js_group_first[j]) fp_js_group[j] << ","; else js_group_first[j] = false; fp_js_group[j] << "[\"" << ctx->rw->class_name << "\",\"" << html_file_name << ".html\"]" << endl; } } } // Create class html file strcpy( fname, ctx->dir); strcat( fname, html_file_name); strcat( fname, ".html"); cdh_ToLower( fname, fname); html_clf = new CnvFile(); html_clf->f.open( fname); fp_tmp.open( cread_cTmpFile1); fp_tmp << "<HR><BR>" << endl << "<A NAME=\"detail\"><H1>Attributes detail</H1></A>" << endl; html_class_open = 1; html_clf->f << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Frameset//EN\"\"http://www.w3.org/TR/REC-html40/frameset.dtd\">" << endl << "<!-- Generated by co_convert " << timestr << " -->" << endl << "<HTML>" << endl << "<HEAD>" << endl << "<META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">" << endl << "<TITLE>" << endl << " Class " << full_class_name << endl << "</TITLE>" << endl << "<link rel=\"stylesheet\" type=\"text/css\" href=\"orm.css\">" << endl << "</HEAD>" << endl << "<BODY BGCOLOR=\"white\">" << endl << "" << endl << "<!-- ========== START OF NAVBAR ========== -->" << endl << "<A NAME=\"navbar_top\"><!-- --></A>" << endl << "<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"1\" CELLSPACING=\"0\">" << endl << "<TR>" << endl << "<TD COLSPAN=2 BGCOLOR=\"#EEEEFF\" CLASS=\"NavBarCell1\">" << endl << "<A NAME=\"navbar_top_firstrow\"><FONT CLASS=\"NavBarFont1Rev\"><B>Volume " << ctx->rw->volume_name << "</B></FONT></A>" << endl << "</TD>" << endl << "</TR>" << endl << endl << "<TR>" << endl << "<TD BGCOLOR=\"white\" CLASS=\"NavBarCell2\"><FONT SIZE=\"-2\">" << endl << " Attributes: <A HREF=\"#RtBody\">Runtime</A>" << endl << " | <A HREF=\"#DevBody\">Development</A>" << endl << " | <A HREF=\"#SysBody\">System</A>" << endl << " | <A HREF=\"#template\">Template</A>" << endl << " | <A HREF=\"#detail\">Detail</A>" << endl << " C Binding: " << endl << " <A HREF=\"" << struct_file << "#" << ctx->rw->class_name << "\">Struct</A>" << endl << " | <A HREF=\"" << hpp_file << "#" << ctx->rw->class_name << "\">Class</A>" << endl; if ( ctx->rw->doc_fresh && strcmp( ctx->rw->doc_code, "") != 0) { if ( strstr( ctx->rw->doc_code, ".pdf") != 0) { strcpy( ref_name, ctx->rw->doc_code); html_clf->f << " | <A HREF=\"" << ref_name << "\">Code</A>" << endl; } else { CnvReadSrc::filename_to_html( ref_name, ctx->rw->doc_code); html_clf->f << " | <A HREF=\"" << ref_name << "#" << low_class_name << "\">Code</A>" << endl; } } html_clf->f << "  <A HREF=\"" << ctree_file << "\">ClassTree</A>" << endl; html_clf->f << "</FONT></TD>" << endl << "<TD BGCOLOR=\"white\" CLASS=\"NavBarCell2\"><FONT SIZE=\"-2\">" << endl << " <A HREF=\"" << low_volume_name << "_index.html\" TARGET=\"_top\"><B>INDEX</B></A> " << endl << " <A HREF=\"" << html_file_name << ".html\" TARGET=\"_top\"><B>NO INDEX</B></A></FONT></TD>" << endl << "</TR>" << endl << "</TABLE>" << endl << "<!-- =========== END OF NAVBAR =========== -->" << endl << endl << "<HR>" << endl << "<!-- ======== START OF CLASS DATA ======== -->" << endl << "<H2>" << endl << "Class " << ctx->rw->class_name << "</H2>" << endl << "<HR>" << endl << "<DL>" << endl; if ( ctx->rw->doc_fresh && strcmp( ctx->rw->doc_author, "") != 0) { html_clf->f << "<DT><B>" << Lng::translate("Author") << "</B> " << ctx->rw->doc_author << "<DT>" << endl; } if ( ctx->rw->doc_fresh && strcmp( ctx->rw->doc_creator, "") != 0) { html_clf->f << "<DT><B>" << Lng::translate("Creator") << "</B> " << ctx->rw->doc_creator << "<DT>" << endl; } if ( ctx->rw->doc_fresh && (strcmp( ctx->rw->doc_version, "") != 0 || strcmp( ctx->rw->class_version, "") != 0)) { html_clf->f << "<DT><B>" << Lng::translate("Version") << "</B> "; if ( strcmp( ctx->rw->doc_version, "") != 0) html_clf->f << ctx->rw->doc_version << " "; if (strcmp( ctx->rw->class_version, "") != 0) html_clf->f << ctx->rw->class_version; html_clf->f << "<DT>" << endl; } if ( ctx->rw->doc_fresh && strcmp( ctx->rw->doc_code, "") != 0) { if ( strstr( ctx->rw->doc_code, ".pdf") != 0) { html_clf->f << "<DT><B>" << Lng::translate("Code") << "</B> <A HREF=\"" << ref_name << "\"><FONT size=\"-1\">PlcTemplate</FONT></A><DT>" << endl; } else { html_clf->f << "<DT><B>" << Lng::translate("Code") << "</B> <A HREF=\"" << ref_name << "#" << low_class_name << "\"><FONT size=\"-1\">" << ctx->rw->doc_code << "</FONT></A><DT>" << endl; } } html_clf->f << "<BR><DT><B>" << Lng::translate("Description") << "</B><DT><BR>" << endl << "</DL><DIV ID=\"description\"><XMP>" << endl; if ( ctx->rw->doc_fresh) { for ( i = 0; i < ctx->rw->doc_cnt; i++) { ctx->remove_spaces( ctx->rw->doc_text[i], txt); if ( strncmp( CnvCtx::low(txt), "@image", 6) == 0) { char imagefile[80]; ctx->remove_spaces( txt + 6, imagefile); html_clf->f << "</XMP><IMG SRC=\"" << imagefile << "\"><XMP>" << endl; } else if ( strncmp( CnvCtx::low(txt), "@b", 2) == 0) { html_clf->f << "</XMP><B><FONT SIZE=\"3\">" << txt + 2 << "</FONT></B><BR><XMP>" << endl; } else if ( strncmp( CnvCtx::low(txt), "@h1", 3) == 0) { html_clf->f << "</XMP><H3>" << txt + 3 << "</H3><BR><XMP>" << endl; } else if ( strncmp( CnvCtx::low(txt), "@h2", 3) == 0) { html_clf->f << "</XMP><H4>" << txt + 3 << "</H4><BR><XMP>" << endl; } else html_clf->f << ctx->rw->doc_text[i] << endl; } } html_clf->f << "</XMP>" << endl; for ( i = 0; i < ctx->rw->doc_xlink_cnt; i++) { html_clf->f << " <A HREF=\"" << ctx->rw->doc_xlink_ref[i] << "\" TARGET=\"_self\"><FONT size=\"-1\"> " << ctx->rw->doc_xlink_text[i] <<"</FONT></A><BR>" << endl; } for ( i = 0; i < ctx->rw->doc_clink_cnt; i++) { html_clf->f << " <A HREF=\"" << ctx->rw->doc_clink_ref[i] << "\" TARGET=\"_self\"><FONT size=\"-1\"> " << ctx->rw->doc_clink_text[i] <<"</FONT></A><BR>" << endl; } for ( i = 0; i < ctx->rw->doc_link_cnt; i++) { html_clf->f << " <A HREF=\"" << ctx->rw->doc_link_ref[i] << "\" TARGET=\"_self\"><FONT size=\"-1\"> " << ctx->rw->doc_link_text[i] <<"</FONT></A><BR>" << endl; } html_clf->f << "</DIV>" << endl; return 1; }
PalFileMenu *PalFile::config_tree_build( ldh_tSession ldhses, const char *filename, pal_eNameType keytype, const char *keyname, PalFileMenu *menu) { ifstream fp; int line_cnt = 0; char line[140]; char type[120]; char name[120]; int nr; PalFileMenu *menu_tree = NULL; PalFileMenu *menu_p, *mp; char fname[120]; dcli_translate_filename( fname, filename); fp.open( fname); #ifndef OS_VMS if ( !fp) return menu_tree; #endif line_cnt = 0; while ( 1) { if ( !fp.getline( line, sizeof( line))) break; dcli_remove_blank( line, line); line_cnt++; if ( line[0] == 0) continue; if ( line[0] == '!' || line[0] == '#') continue; nr = sscanf( line, "%s %s", type, name); if ( nr < 1 ) printf( "** Syntax error in file %s, line %d\n", filename, line_cnt); if ( keytype != pal_eNameType_All) { if ( (keytype == pal_eNameType_TopObjects && cdh_NoCaseStrcmp( type, "topobjects") == 0 && cdh_NoCaseStrcmp( name, keyname) == 0) || (keytype == pal_eNameType_Palette && cdh_NoCaseStrcmp( type, "palette") == 0 && cdh_NoCaseStrcmp( name, keyname) == 0)) { if ( nr != 2) printf( "** Syntax error in file %s, line %d\n", filename, line_cnt); if ( !menu) menu_tree = new PalFileMenu( name, pal_eMenuType_Menu, NULL); else menu_tree = menu; if ( !fp.getline( line, sizeof( line))) break; line_cnt++; if ( strcmp( line, "{") != 0) printf( "** Syntax error in file %s, line %d\n", filename, line_cnt); menu_p = config_tree_build_children( ldhses, &fp, &line_cnt, filename, menu_tree); if ( !menu_tree->child_list) menu_tree->child_list = menu_p; break; } } else { if ( nr != 2) printf( "** Syntax error in file %s, line %d\n", filename, line_cnt); if ( cdh_NoCaseStrcmp( type, "topobjects") == 0) menu_p = new PalFileMenu( name, pal_eMenuType_TopObjects, NULL); else if ( cdh_NoCaseStrcmp( type, "palette") == 0) menu_p = new PalFileMenu( name, pal_eMenuType_Palette, NULL); if ( !menu_tree) menu_tree = menu_p; else { for ( mp = menu_tree; mp->next; mp = mp->next) ; mp->next = menu_p; } if ( !fp.getline( line, sizeof( line))) break; line_cnt++; if ( strcmp( line, "{") != 0) printf( "** Syntax error in file %s, line %d\n", filename, line_cnt); menu_p->child_list = config_tree_build_children( ldhses, &fp, &line_cnt, filename, menu_p); } } fp.close(); return menu_tree; }