void printMsgInfo ( mh_sMsgInfo *mp, FILE *outFile ) { char time_str[40]; pwr_tTime event_time; col_print(outFile, "%d", mp->Id.Nix); event_time = net_NetTimeToTime(&(mp->Id.BirthTime)); time_AtoAscii(&event_time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str)); col_print(outFile, "%s", time_str); col_print(outFile, "%d",mp->Id.Idx); /* sp->Object sp->SupObject */ printEventFlags(outFile, mp->EventFlags); event_time = net_NetTimeToTime(&(mp->EventTime)); time_AtoAscii( &event_time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str)); col_print(outFile, "%s", time_str); // col_print(outFile, "%s",mp->EventName_V3); convertEventType(mp->EventType, time_str); col_print(outFile, "%s", time_str); convertEventPrio(mp->EventPrio, time_str); col_print(outFile, "%s",time_str); }
void XttSevHist::sevhist_lower_res_cb( void *ctx) { XttSevHist *sevhist = (XttSevHist *) ctx; double ll_x, ll_y, ur_x, ur_y; pwr_tTime t_low, t_high; pwr_tStatus sts; sevhist->curve->measure_window( &ll_x, &ll_y, &ur_x, &ur_y); t_low.tv_sec = int( sevhist->gcd->min_value_axis[0] - 5 * (sevhist->gcd->max_value_axis[0] - sevhist->gcd->min_value_axis[0])); t_low.tv_nsec = 0; t_high.tv_sec = int( sevhist->gcd->max_value_axis[0] + 5 * (sevhist->gcd->max_value_axis[0] - sevhist->gcd->min_value_axis[0])); t_high.tv_nsec = 0; if ( t_low.tv_sec == sevhist->time_low_old && t_high.tv_sec == sevhist->time_high_old) { t_low.tv_sec = int( sevhist->gcd->min_value_axis[0] - 25 * (sevhist->gcd->max_value_axis[0] - sevhist->gcd->min_value_axis[0])); t_high.tv_sec = int( sevhist->gcd->max_value_axis[0] + 25 * (sevhist->gcd->max_value_axis[0] - sevhist->gcd->min_value_axis[0])); } { char s1[40], s2[40]; time_AtoAscii( &t_low, time_eFormat_NumDateAndTime, s1, sizeof(s1)); time_AtoAscii( &t_high, time_eFormat_NumDateAndTime, s2, sizeof(s2)); printf( "Low: %s, High: %s\n", s1, s2); } sevhist->get_data( &sts, t_low, t_high); sevhist->time_low_old = t_low.tv_sec; sevhist->time_high_old = t_high.tv_sec; }
void GeCurveGtk::open_export( pwr_tTime *from, pwr_tTime *to, int rows, char *filename) { char fromtime_str[40]; char totime_str[40]; char rows_str[40]; gint pos = 0; create_export_dialog(); if ( layout_mask & curve_mEnable_ExportTime) { time_AtoAscii( from, time_eFormat_DateAndTime, fromtime_str, sizeof(fromtime_str)); time_AtoAscii( to, time_eFormat_DateAndTime, totime_str, sizeof(totime_str)); sprintf( rows_str, "%d", rows); gtk_editable_delete_text( GTK_EDITABLE(export_fromtime_widget), 0, -1); gtk_editable_insert_text( GTK_EDITABLE(export_fromtime_widget), fromtime_str, strlen(fromtime_str), &pos); gtk_editable_delete_text( GTK_EDITABLE(export_totime_widget), 0, -1); gtk_editable_insert_text( GTK_EDITABLE(export_totime_widget), totime_str, strlen(totime_str), &pos); gtk_editable_delete_text( GTK_EDITABLE(export_rows_widget), 0, -1); gtk_editable_insert_text( GTK_EDITABLE(export_rows_widget), rows_str, strlen(rows_str), &pos); } gtk_editable_delete_text( GTK_EDITABLE(export_filename_widget), 0, -1); gtk_editable_insert_text( GTK_EDITABLE(export_filename_widget), filename, strlen(filename), &pos); }
static pwr_tStatus tlog_qual_to_time( char *in_str, pwr_tTime *time) { pwr_tStatus sts; char *s; pwr_tDeltaTime one_day_time; pwr_tTime current_time; char str[64]; char timstr[64]; if ( !strcmp( in_str, "") || !strncmp( in_str, "TODAY", strlen(in_str))) { time_GetTime( ¤t_time); time_AtoAscii( ¤t_time, time_eFormat_DateAndTime, timstr, sizeof(timstr)); timstr[12] = 0; strcat( timstr, " 00:00:00.00"); sts = time_AsciiToA( timstr, time); } else if ( !strncmp( in_str, "YESTERDAY", strlen(in_str))) { time_GetTime( ¤t_time); time_AtoAscii( ¤t_time, time_eFormat_DateAndTime, timstr, sizeof(timstr)); timstr[12] = 0; strcat( timstr, " 00:00:00.00"); sts = time_AsciiToA( timstr, ¤t_time); strcpy( timstr, "1 00:00:00"); sts = time_AsciiToD( timstr, &one_day_time); time_Dneg( &one_day_time, &one_day_time); time_Aadd( time, ¤t_time, &one_day_time); } else { strcpy( str, in_str); if ( s = strchr( str, '-')) { /* Date is supplied, replace ':' to space */ if ( s = strchr( str, ':')) *s = ' '; strcpy( timstr, str); } else { /* No date is supplied, add current date as default */ time_GetTime( ¤t_time); time_AtoAscii( ¤t_time, time_eFormat_DateAndTime, timstr, sizeof(timstr)); timstr[12] = 0; strcat( timstr, " "); strcat( timstr, str); } sts = time_AsciiToA( timstr, time); if (EVEN(sts)) return sts; } return TLOG__SUCCESS; }
void GrowAxis::format_text( char *text, char *fmt, double value) { if ( strcmp( fmt, "%1t") == 0) { // Hours, minutes and seconds, value in seconds int val = (int) nearbyint(value); int hours = val / 3600; int minutes = (val - hours * 3600) / 60; int seconds = (val - hours * 3600 - minutes * 60); sprintf( text, "%d:%02d:%02d", hours, minutes, seconds); } else if ( strcmp( fmt, "%2t") == 0) { // Hours and minutes, value in seconds int val = (int) nearbyint(value); int hours = val / 3600; int minutes = (val - hours * 3600) / 60; sprintf( text, "%d:%02d", hours, minutes); } else if ( strcmp( fmt, "%3t") == 0) { // Days, hours and minues, value in seconds int val = (int) nearbyint(value); int days = val / (24 * 3600); int hours = (val - days * 24 * 3600) / 3600; int minutes = (val - days * 24 * 3600 - hours * 3600) / 60; sprintf( text, "%d %02d:%02d", days, hours, minutes); } else if ( strcmp( fmt, "%10t") == 0) { // Date char timstr[40]; pwr_tTime t; t.tv_sec = (int) nearbyint(value); t.tv_nsec = 0; time_AtoAscii( &t, time_eFormat_NumDateAndTime, timstr, sizeof(timstr)); timstr[19] = 0; strcpy( text, timstr); } else if ( strcmp( fmt, "%11t") == 0) { // Date, no seconds char timstr[40]; pwr_tTime t; t.tv_sec = (int) nearbyint(value); t.tv_nsec = 0; time_AtoAscii( &t, time_eFormat_NumDateAndTime, timstr, sizeof(timstr)); timstr[16] = 0; strcpy( text, timstr); } else { if ( fabs(value) < FLT_EPSILON) value = 0; sprintf( text, fmt, value); } }
void rt_post::format_email_text( mh_sMessage *MsgP, char *text, unsigned int size) { ala_uEvent *event = (ala_uEvent *) MsgP; char prio[2]; pwr_tTime etime; char timstr[40]; switch ( event->Info.EventPrio) { case mh_eEventPrio_A: strcpy( prio, "A"); break; case mh_eEventPrio_B: strcpy( prio, "B"); break; case mh_eEventPrio_C: strcpy( prio, "C"); break; case mh_eEventPrio_D: strcpy( prio, "D"); break; default: strcpy( prio, "?"); } etime = net_NetTimeToTime( &event->Info.EventTime); time_AtoAscii( &etime, time_eFormat_DateAndTime, timstr, sizeof(timstr)); snprintf( text, size, "Proview alarm from node %s\nPriority %s\nEvent time %s\n\nEvent text: %s\nEvent name: %s", nodename, prio, timstr, event->Msg.EventText, event->Msg.EventName); }
void CLogMotif::activate_select_file( Widget w, CLog *clog, XmAnyCallbackStruct *data) { XmString cstr; char str[200]; char *s; if ( !clog->filesel_loaded) { for ( int i = 0; i < (int) clog->clognav->file_list.size(); i++) { time_AtoAscii( &clog->clognav->file_list[i].time, time_eFormat_ComprDateAndTime, str, sizeof(str)); str[17] = 0; strcat( str, " "); s = strrchr( clog->clognav->file_list[i].name, '/'); if ( s) strcat( str, s+1); else strcat( str, clog->clognav->file_list[i].name); cstr = XmStringCreateSimple( str); XmListAddItemUnselected( ((CLogMotif *)clog)->filesel_list_w, cstr, 0); XmStringFree(cstr); } clog->filesel_loaded = true; } XtManageChild( ((CLogMotif *)clog)->filesel_form); }
static void logg( const char *logger, pwr_tOix oix, const char *text) { char nowstr[40]; time_AtoAscii( 0, time_eFormat_Time, nowstr, sizeof(nowstr)); printf( "%15s %30s %10d %s\n", nowstr, logger, oix, text); }
ItemMsg::ItemMsg( MsgList *item_msglist, const char *item_name, char *item_text, int item_severity, brow_tNode dest, flow_eDest dest_code): msglist(item_msglist), severity(item_severity) { char type_str[8]; char time_str[40]; type = msglist_eItemType_Msg; strncpy( text, item_text, sizeof(text)); text[sizeof(text)-1] = 0; // Remove newline at end if ( text[strlen(text)-1] == '\n') text[strlen(text)-1] = 0; switch ( severity) { case 'S': brow_CreateNode( msglist->brow->ctx, (char *)"Success", msglist->brow->nc_success, dest, dest_code, (void *) this, 1, &node); strcpy( type_str, "S"); break; case 'I': brow_CreateNode( msglist->brow->ctx, (char *)"Info", msglist->brow->nc_info, dest, dest_code, (void *) this, 1, &node); strcpy( type_str, "I"); break; case 'E': brow_CreateNode( msglist->brow->ctx, (char *)"Error", msglist->brow->nc_error, dest, dest_code, (void *) this, 1, &node); strcpy( type_str, "E"); break; case 'W': brow_CreateNode( msglist->brow->ctx, (char *)"Warning", msglist->brow->nc_warning, dest, dest_code, (void *) this, 1, &node); strcpy( type_str, "W"); break; case 'F': brow_CreateNode( msglist->brow->ctx, (char *)"Fatal", msglist->brow->nc_fatal, dest, dest_code, (void *) this, 1, &node); strcpy( type_str, "F"); break; default: brow_CreateNode( msglist->brow->ctx, (char *)"Default", msglist->brow->nc_default, dest, dest_code, (void *) this, 1, &node); strcpy( type_str, ""); } brow_SetAnnotation( node, 0, type_str, strlen(type_str)); time_GetTime( &time); time_AtoAscii( &time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str)); time_str[17] = 0; brow_SetAnnotation( node, 1, time_str, strlen(time_str)); brow_SetAnnotation( node, 2, text, strlen(text)); // brow_SetAnnotPixmap( node, 0, msglist->brow->pixmap_leaf); }
ItemMsg::ItemMsg( CLogNav *item_clognav, const char *item_name, errh_eSeverity item_severity, char *item_logger, int item_pid, pwr_tTime item_time, char *item_text, brow_tNode dest, flow_eDest dest_code): ItemMsgBase(item_clognav, item_name, dest), severity(item_severity), pid(item_pid), time(item_time) { char type_str[2]; char time_str[40]; char pid_str[40]; strcpy( logger, item_logger); strncpy( text, item_text, sizeof(text)); text[sizeof(text)-1] = 0; switch ( severity) { case errh_eSeverity_Success: brow_CreateNode( clognav->brow->ctx, item_name, clognav->brow->nc_msg_info, dest, dest_code, (void *) this, 1, &node); strcpy( type_str, "S"); break; case errh_eSeverity_Info: brow_CreateNode( clognav->brow->ctx, item_name, clognav->brow->nc_msg_info, dest, dest_code, (void *) this, 1, &node); strcpy( type_str, "I"); break; case errh_eSeverity_Warning: brow_CreateNode( clognav->brow->ctx, item_name, clognav->brow->nc_msg_warning, dest, dest_code, (void *) this, 1, &node); strcpy( type_str, "W"); break; case errh_eSeverity_Error: brow_CreateNode( clognav->brow->ctx, item_name, clognav->brow->nc_msg_error, dest, dest_code, (void *) this, 1, &node); strcpy( type_str, "E"); break; case errh_eSeverity_Fatal: brow_CreateNode( clognav->brow->ctx, item_name, clognav->brow->nc_msg_fatal, dest, dest_code, (void *) this, 1, &node); strcpy( type_str, "F"); break; default: brow_CreateNode( clognav->brow->ctx, item_name, clognav->brow->nc_text, dest, dest_code, (void *) this, 1, &node); brow_SetAnnotation( node, 0, text, strlen(text)); return; } sprintf( pid_str, "%5d", pid); brow_SetAnnotation( node, 0, type_str, strlen(type_str)); time_AtoAscii( &time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str)); brow_SetAnnotation( node, 1, logger, strlen(logger)); brow_SetAnnotation( node, 2, pid_str, strlen(pid_str)); brow_SetAnnotation( node, 3, time_str, strlen(time_str)); brow_SetAnnotation( node, 4, text, strlen(text)); // brow_SetAnnotPixmap( node, 0, clognav->brow->pixmap_leaf); }
static void rlog( const char *text, int val) { if ( log_on) { char timstr[20]; time_AtoAscii( 0, time_eFormat_Time, timstr, sizeof(timstr)); printf( "%s %4d %s\n", timstr, val, text); } }
void printRet ( sEvent *sp, FILE *outFile ) { char time_str[40]; new_row( outFile); printMsgInfo(&(sp->Mess.ret.Info), outFile); pwr_tTime event_time; //EventText //Status //TargetIdx //DetectTime //AValue //CtrlLimit //Hysteres //Unit //DValue //High col_print(outFile, "\"%s\"", sp->Mess.ret.EventText); col_print(outFile, "%s", sp->Mess.ret.EventName); col_print(outFile, "%u", sp->Mess.ret.TargetId.Idx); event_time = net_NetTimeToTime(&(sp->Mess.ret.DetectTime)); time_AtoAscii( &event_time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str)); col_print(outFile, "%s", time_str); switch (sp->Mess.ret.SupInfo.SupType) { case mh_eSupType_Analog: col_print(outFile, "%.2f", sp->Mess.ret.SupInfo.mh_uSupInfo_u.A.ActualValue); col_print(outFile, "%.2f", sp->Mess.ret.SupInfo.mh_uSupInfo_u.A.CtrlLimit); col_print(outFile, "%.2f", sp->Mess.ret.SupInfo.mh_uSupInfo_u.A.Hysteres); col_print(outFile, "%s", sp->Mess.ret.SupInfo.mh_uSupInfo_u.A.Unit); col_print(outFile,""); col_print(outFile, "%u", sp->Mess.ret.SupInfo.mh_uSupInfo_u.A.High); break; case mh_eSupType_Digital: col_print(outFile,""); col_print(outFile,""); col_print(outFile,""); col_print(outFile,""); col_print(outFile, "%u", sp->Mess.ret.SupInfo.mh_uSupInfo_u.D.ActualValue); col_print(outFile, "%u", sp->Mess.ret.SupInfo.mh_uSupInfo_u.D.High); break; case mh_eSupType__: case mh_eSupType_None: case mh_eSupType_Link: case mh_eSupType_: break; } }
char *dir_TimeString( pwr_tTime *time, char *timestr) { static char timstr[32]; time_AtoAscii(time, time_eFormat_DateAndTime, timstr, sizeof(timstr)); if ( timestr != NULL) strcpy( timestr, &timstr[5]); return timstr; }
static void logg( const char *str) { pwr_tTime t; char timstr[40]; time_GetTime( &t); time_AtoAscii( 0, time_eFormat_Time, timstr, sizeof(timstr)); timstr[9] = 0; fprintf( fp, "%s%04lld %s\n", timstr, t.tv_nsec/100000, str); }
/************************************************************************* * * Name: logg_get_filename * * Typ int * * Typ Parameter IOGF Beskrivning * * Beskrivning: * Adderar extention till filname om det saknas. * **************************************************************************/ static int logg_get_filename( char *inname, char *outname, char *ext) { char *s; char *s2; pwr_tFileName timestr; char comp_timestr[80]; pwr_tTime time; dcli_translate_filename( outname, inname); /* Look for extension in filename */ if ( ext != NULL) { s = strrchr( outname, ':'); if ( s == 0) s = outname; s2 = strrchr( s, '>'); if ( s2 == 0) { s2 = strrchr( s, ']'); if ( s2 == 0) s2 = s; } s = strrchr( s2, '.'); if ( s != 0) *s = 0; strcat( outname, ext); } #if defined OS_LYNX || defined OS_LINUX /* Get current time to use as "version number" */ time_GetTime( &time); time_AtoAscii( &time, time_eFormat_ComprDateAndTime, timestr, sizeof(timestr)); comp_timestr[0] = '.'; memcpy(&comp_timestr[1], ×tr[0], 2); memcpy(&comp_timestr[3], ×tr[3], 2); memcpy(&comp_timestr[5], ×tr[6], 2); memcpy(&comp_timestr[7], ×tr[9], 2); memcpy(&comp_timestr[9], ×tr[12], 2); memcpy(&comp_timestr[11], ×tr[15], 2); comp_timestr[13] = 0; // strcat(outname, comp_timestr); #endif return REM__SUCCESS; }
static pwr_tStatus iterFunc( void *udata, pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid fwsoid, pwr_tOid bswoid, pwr_tOid fchoid, pwr_tOid lchoid, char *name, pwr_tTime time, int rsize, int dsize) { char timstr[40]; time_AtoAscii( &time, time_eFormat_DateAndTime, timstr, sizeof(timstr)); if ( cid == pwr_eClass_ClassDef) { // cout << "iterFunc : " << oid.oix << " " << name << " " << timstr << endl; } return 1; }
void tm_log(unsigned int level, const char* func, const char* str) { char logstr[200]; int i; time_AtoAscii(NULL, time_eFormat_DateAndTime, logstr, sizeof(logstr)); strcat(logstr, " "); strcat(logstr, func); for (i = strlen(func); i < 25; i++) strcat(logstr, " "); strcat(logstr, str); printf("%s\n", logstr); }
static pwr_tStatus logg_open_file( logg_t_loggconf_list *conflist_ptr, int first_time) { int csts; char filename[80]; pwr_tTime time; char timestr[80]; if ( !first_time) { /* Check if it's time for a new try to open the file */ conflist_ptr->wait_count++; if (conflist_ptr->wait_count < 10) return REM__SUCCESS; conflist_ptr->wait_count = 0; } /* Open file */ logg_get_filename( conflist_ptr->loggconf->LoggFile, filename, LOGG_FILE_EXT); #if defined OS_LYNX || defined OS_LINUX conflist_ptr->outfile = fopen( filename, "a+"); #else conflist_ptr->outfile = fopen( filename, "w+", "shr=get"); #endif if (conflist_ptr->outfile != NULL) { /* Write a file header */ time_GetTime( &time); time_AtoAscii( &time, time_eFormat_DateAndTime, timestr, sizeof(timestr)); csts = fprintf( conflist_ptr->outfile, "RemLogg file opened at %s\n\n", timestr); if (csts >= 0) { conflist_ptr->loggconf->FileOpenCount++; #if defined OS_ELN || defined OS_VMS fgetname( conflist_ptr->outfile, filename); #endif errh_CErrLog( REM__LOGGFILEOPEN, errh_ErrArgAF(filename), NULL); conflist_ptr->file_open = 1; return REM__SUCCESS; } else { fclose( conflist_ptr->outfile); } } errh_CErrLog( REM__LOGGFILE, errh_ErrArgAF(filename), NULL); return REM__LOGGFILE; }
ItemMsgRestart::ItemMsgRestart(CLogNav* item_clognav, const char* item_name, pwr_tTime item_time, brow_tNode dest, flow_eDest dest_code) : ItemMsgBase(item_clognav, item_name, dest), time(item_time) { char time_str[40]; brow_CreateNode(clognav->brow->ctx, item_name, clognav->brow->nc_restart, dest, dest_code, (void*)this, 1, &node); time_AtoAscii( &time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str)); brow_SetAnnotation(node, 0, time_str, strlen(time_str)); brow_SetAnnotation(node, 1, "Proview startup", strlen("Proview startup")); }
void XttLog::log(const char* category, const char* str, const char* value, unsigned int opt, unsigned int size) { std::ofstream fp; pwr_tStatus sts; char timstr[40]; char username[80]; time_AtoAscii(0, time_eFormat_DateAndTime, timstr, sizeof(timstr)); sts = syi_UserName(username, sizeof(username)); if (EVEN(sts)) strcpy(username, "Unknown"); fp.open(m_filename, std::ios::out | std::ios::app); if (!fp) return; if (m_level == 1) fp << "1 "; else fp << " " << m_level << " "; fp << timstr << " " << m_pid; for (int i = strlen(m_pid); i < 7; i++) fp << " "; fp << " " << category; for (int i = strlen(category); i < 11; i++) fp << " "; fp << " "; fp << " " << username; for (int i = strlen(username); i < 11; i++) fp << " "; fp << " "; if (str) fp << str; if (value) { if (opt & xttlog_mOption_Binary) { char str[1000]; value_to_octstring(value, size, str, sizeof(str)); fp << " \"" << str << "\""; } else fp << " \"" << value << "\""; } fp << '\n'; fp.close(); }
ItemLog::ItemLog( CoLogWNav *item_logwnav, const char *item_name, pwr_tTime item_time, char *item_category, char *item_user, char *item_comment, brow_tNode dest, flow_eDest dest_code): logwnav(item_logwnav), time(item_time) { char time_str[40]; char *s; type = logwitem_eItemType_Log; strncpy( category, item_category, sizeof(category)); strncpy( user, item_user, sizeof(user)); if ( item_comment) strncpy( comment, item_comment, sizeof(comment)); else strcpy( comment, ""); brow_CreateNode( logwnav->brow->ctx, (char *)"Log", logwnav->brow->nc_log, dest, dest_code, (void *) this, 1, &node); time_AtoAscii( &time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str)); time_str[17] = 0; int annot = 0; brow_SetAnnotation( node, annot++, time_str, strlen(time_str)); brow_SetAnnotation( node, annot++, category, strlen(category)); brow_SetAnnotation( node, annot++, user, strlen(user)); if ( logwnav->show_item) brow_SetAnnotation( node, annot++, item_name, strlen(item_name)); if ( item_comment) brow_SetAnnotation( node, annot++, item_comment, strlen(item_comment)); if ( (s = strstr( category, "Save"))) brow_SetAnnotPixmap( node, 0, logwnav->brow->pixmap_save); else if ( (s = strstr( category, "Build"))) brow_SetAnnotPixmap( node, 0, logwnav->brow->pixmap_build); else if ( (s = strstr( category, "Copy"))) brow_SetAnnotPixmap( node, 0, logwnav->brow->pixmap_copy); else if ( (s = strstr( category, "Package"))) brow_SetAnnotPixmap( node, 0, logwnav->brow->pixmap_package); else if ( (s = strstr( category, "Export"))) brow_SetAnnotPixmap( node, 0, logwnav->brow->pixmap_export); else if ( (s = strstr( category, "Clone"))) brow_SetAnnotPixmap( node, 0, logwnav->brow->pixmap_clone); }
int writeInfo(int nrOfEvents, int firstTimeEver, pwr_tTime *oldestEventTime) { FILE *info_file = NULL; char time_str[40]; time_str[0] = 0; if(oldestEventTime != NULL) { time_AtoAscii(oldestEventTime, time_eFormat_DateAndTime, time_str, sizeof(time_str)); } //open a file to print info about the database to info_file = fopen( info_fname, "w" ); if(info_file == NULL) return 2; fprintf(info_file, "NrOfEvents:%d OldestEventTime:%s\n", nrOfEvents, time_str); fclose(info_file); return 1; }
void CLogGtk::activate_select_file( GtkWidget *w, gpointer data) { CLog *clog = (CLog *)data; char *s; pwr_tString80 *str; str = (pwr_tString80 *) calloc( clog->clognav->file_list.size() + 1, sizeof( *str)); for ( int i = 0; i < (int)clog->clognav->file_list.size(); i++) { time_AtoAscii( &clog->clognav->file_list[i].time, time_eFormat_ComprDateAndTime, str[i], sizeof(str[i])); str[i][17] = 0; strcat( str[i], " "); s = strrchr( clog->clognav->file_list[i].name, '/'); if ( s) strcat( str[i], s+1); else strcat( str[i], clog->clognav->file_list[i].name); } clog->wow->CreateList( "Select File", (char *)str, 80, file_selected_cb, 0, clog); free( str); }
void printBlock ( sEvent *sp, FILE *outFile ) { char time_str[40]; pwr_tTime event_time; new_row( outFile); printMsgInfo(&(sp->Mess.block.Info), outFile); //EventText //Status //TargetIdx //DetectTime //AValue //CtrlLimit //Hysteres //Unit //DValue //High col_print(outFile, "\"\""); col_print(outFile, "%s", sp->Mess.block.EventName); col_print(outFile, "%u", sp->Mess.block.TargetId.Idx); event_time = net_NetTimeToTime( &(sp->Mess.block.DetectTime)); time_AtoAscii(&event_time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str)); col_print(outFile, "%s", time_str); col_print(outFile,""); col_print(outFile,""); col_print(outFile,""); col_print(outFile,""); col_print(outFile,""); col_print(outFile,""); }
int main (int argc, char **argv) { char filename [512]; FILE *f; BCK_FILEHEAD_STRUCT fh; BCK_CYCLEHEAD_STRUCT ch; BCK_DATAHEAD_STRUCT dh; char timstr [24]; int c, d; unsigned char *datap, *p; int i; /* * Open file */ if (argc == 1) { printf ("Name of backup file: "); scanf ("%s", (char *)&filename); } else strcpy(filename, argv[1]); #if defined OS_VMS || defined OS_ELN f = fopen (filename, "rb", "shr=upd"); #else f = fopen (filename, "rb"); #endif if (f == NULL) { perror ("fopen"); return 1; } /* * Read header and print it */ fseek (f, 0, 0); fread (&fh, sizeof fh, 1, f); printf ("Layout version: %d\n", fh.version); if (fh.version != BCK_FILE_VERSION) { printf ("This program is built with header version %d\n", BCK_FILE_VERSION); return 1; } time_AtoAscii(&fh.creationtime, time_eFormat_DateAndTime, timstr, sizeof(timstr)); printf ("Created: %s\n", timstr); for (c=0; c<2; c++) { printf ("%s cycle:\n", c == 0 ? "Fast" : "Slow"); time_AtoAscii(&fh.updatetime[c], time_eFormat_DateAndTime, timstr, sizeof(timstr)); printf (" Updated: %s\n", timstr); printf (" Curdata pointer: %x\n", fh.curdata [c]); printf (" Cursize: %x\n", fh.cursize [c]); } /* * Dump cycle header and data headers for each cycle */ printf ("\n"); for (c=0; c<2; c++) { if ((fh.curdata [c] == 0) || (fh.cursize [c] == 0)) continue; fseek (f, fh.curdata [c], 0); fread (&ch, sizeof ch, 1, f); printf ("\n%s cycleheader:\n", c == 0 ? "Fast" : "Slow"); time_AtoAscii(&ch.objtime, time_eFormat_DateAndTime, timstr, sizeof(timstr)); printf (" Objtime: %s\n", timstr); printf (" Length: %x\n", ch.length); printf (" Cycle: %x\n", ch.cycle); printf (" Segments: %x\n", ch.segments); for (d=0; d<ch.segments; d++) { printf ("\n Data header %d:\n", d+1); fread (&dh, sizeof dh, 1, f); printf (" Valid: %x\n", dh.valid); printf (" Dynamic: %x\n", dh.dynamic); printf (" Class: %x\n", dh.cid); printf (" Attrref.Vid: %x\n", dh.attrref.Objid.vid); printf (" Attrref.Oix: %x\n", dh.attrref.Objid.oix); printf (" Attrref.Offset: %x\n", dh.attrref.Offset); printf (" Attrref.Body: %x\n", dh.attrref.Body); printf (" Attrref.Size: %x\n", dh.attrref.Size); printf (" Attrref.Indirect: %x\n", dh.attrref.Flags.b.Indirect); printf (" Dataname: %s\n", dh.dataname); #ifdef NODATA fseek (f, dh.attrref.Size, 1); #else datap = malloc (dh.attrref.Size); fread (datap, dh.attrref.Size, 1, f); p = datap; for (i=0; i<dh.attrref.Size; i++, p++) { if ((i % 16) == 0) printf ("\n "); printf ("%02x ", *p); } free (datap); printf ("\n"); #endif } printf ("\n"); } fclose (f); return 0; }
pwr_tStatus ev_mh_info_bc( mh_sMessage *MsgP) { JNIEnv *env; jclass PwrtObjid_id; jmethodID PwrtObjid_cid; jobject objid_obj = NULL; jstring jevText; jstring jevName; jstring jevTime; jstring jevBirthTime; jint jevFlags; jint jevPrio; jint jevStatus; jint jevNix; jint jevIdx; jint jevType; jint oix, vid; jstring jevTargetBirthTime; jint jevTargetNix = (jint) 0; jint jevTargetIdx = (jint) 0; char time_str[40]; char birthTime_str[40]; pwr_tObjid objid = MsgP->Object.Objid; pwr_tTime time = net_NetTimeToTime( &MsgP->Info.EventTime); pwr_tTime birthTime = net_NetTimeToTime( &MsgP->Info.Id.BirthTime); //hämta enviormentpekaren (*jvm)->AttachCurrentThread(jvm,(void **)&env,NULL); if(env == NULL) printf("env är null"); PwrtObjid_id = (*env)->FindClass( env, "jpwr/rt/PwrtObjid"); PwrtObjid_cid = (*env)->GetMethodID( env, PwrtObjid_id, "<init>", "(II)V"); oix = (jint) objid.oix; vid = (jint) objid.vid; objid_obj = (*env)->NewObject( env, PwrtObjid_id, PwrtObjid_cid, oix, vid); time_AtoAscii( &time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str)); time_AtoAscii( &birthTime, time_eFormat_ComprDateAndTime, birthTime_str, sizeof(birthTime_str)); //gör om till Java-strängar jevText = (*env)->NewStringUTF( env, MsgP->EventText); jevName = (*env)->NewStringUTF( env, MsgP->EventName); jevTime = (*env)->NewStringUTF( env, time_str); jevBirthTime = (*env)->NewStringUTF( env, birthTime_str); jevTargetBirthTime = (*env)->NewStringUTF( env, " "); //gör om till Java-int jevFlags = (jint)MsgP->Info.EventFlags; jevPrio = (jint)MsgP->Info.EventPrio; jevStatus = (jint)MsgP->Status; jevNix = (jint)MsgP->Info.Id.Nix; jevIdx = (jint)MsgP->Info.Id.Idx; jevType = (jint)MsgP->Info.EventType; //anropa callback metoden i Mh-klassen (*env)->CallStaticVoidMethod( env, Mh_id, Mh_messReceived_id, jevText, jevName, jevTime, jevFlags, jevPrio, jevStatus, jevNix, jevBirthTime, jevIdx, jevTargetNix, jevTargetBirthTime, jevTargetIdx, jevType, objid_obj); //important:check if an exception was raised if ((*env)->ExceptionCheck(env)) { printf("exception i info\n"); return 1; } return 1; }
static void attrvalue_to_string( int type_id, void *value_ptr, char *str, int size, int *len, char *format) { pwr_tObjid objid; pwr_sAttrRef *attrref; int sts; char timstr[64]; if ( value_ptr == 0) { strcpy( str, "UNDEFINED"); return; } switch ( type_id ) { case pwr_eType_Boolean: { if ( !format) *len = sprintf( str, "%d", *(pwr_tBoolean *)value_ptr); else *len = sprintf( str, format, *(pwr_tBoolean *)value_ptr); break; } case pwr_eType_Float32: { if ( !format) *len = sprintf( str, "%f", *(float *)value_ptr); else *len = sprintf( str, format, *(float *)value_ptr); break; } case pwr_eType_Float64: { if ( !format) *len = sprintf( str, "%f", *(double *)value_ptr); else *len = sprintf( str, format, *(double *)value_ptr); break; } case pwr_eType_Char: { if ( !format) *len = sprintf( str, "%c", *(char *)value_ptr); else *len = sprintf( str, format, *(char *)value_ptr); break; } case pwr_eType_Int8: { if ( !format) *len = sprintf( str, "%d", *(char *)value_ptr); else *len = sprintf( str, format, *(char *)value_ptr); break; } case pwr_eType_Int16: { if ( !format) *len = sprintf( str, "%hd", *(short *)value_ptr); else *len = sprintf( str, format, *(short *)value_ptr); break; } case pwr_eType_Int32: { if ( !format) *len = sprintf( str, "%d", *(int *)value_ptr); else *len = sprintf( str, format, *(int *)value_ptr); break; } case pwr_eType_Int64: { if ( !format) *len = sprintf( str, pwr_dFormatInt64, *(pwr_tInt64 *)value_ptr); else *len = sprintf( str, format, *(pwr_tInt64 *)value_ptr); break; } case pwr_eType_UInt8: { if ( !format) *len = sprintf( str, "%d", *(unsigned char *)value_ptr); else *len = sprintf( str, format, *(unsigned char *)value_ptr); break; } case pwr_eType_UInt16: { if ( !format) *len = sprintf( str, "%hd", *(unsigned short *)value_ptr); else *len = sprintf( str, format, *(unsigned short *)value_ptr); break; } case pwr_eType_UInt32: case pwr_eType_Mask: case pwr_eType_Enum: { if ( !format) *len = sprintf( str, "%d", *(unsigned int *)value_ptr); else *len = sprintf( str, format, *(unsigned int *)value_ptr); break; } case pwr_eType_UInt64: { if ( !format) *len = sprintf( str, pwr_dFormatUInt64, *(pwr_tUInt64 *)value_ptr); else *len = sprintf( str, format, *(pwr_tUInt64 *)value_ptr); break; } case pwr_eType_String: { strncpy( str, (char *)value_ptr, size); str[size-1] = 0; *len = strlen(str); break; } case pwr_eType_Objid: { pwr_tOName hiername; objid = *(pwr_tObjid *)value_ptr; if ( !objid.oix) sts = gdh_ObjidToName ( objid, hiername, sizeof(hiername), cdh_mName_volumeStrict); else sts = gdh_ObjidToName ( objid, hiername, sizeof(hiername), cdh_mNName); if (EVEN(sts)) { strcpy( str, ""); *len = 0; break; } *len = sprintf( str, "%s", hiername); break; } case pwr_eType_AttrRef: { pwr_tAName hiername; attrref = (pwr_sAttrRef *) value_ptr; sts = gdh_AttrrefToName ( attrref, hiername, sizeof(hiername), cdh_mNName); if (EVEN(sts)) { strcpy( str, ""); *len = 0; break; } *len = sprintf( str, "%s", hiername); break; } case pwr_eType_Time: { sts = time_AtoAscii( (pwr_tTime *) value_ptr, time_eFormat_DateAndTime, timstr, sizeof(timstr)); if ( EVEN(sts)) strcpy( timstr, "-"); *len = sprintf( str, "%s", timstr); break; } case pwr_eType_DeltaTime: { sts = time_DtoAscii( (pwr_tDeltaTime *) value_ptr, 1, timstr, sizeof(timstr)); if ( EVEN(sts)) strcpy( timstr, "Undefined time"); *len = sprintf( str, "%s", timstr); break; } case pwr_eType_ObjectIx: { *len = sprintf( str, "%s", cdh_ObjectIxToString( NULL, *(pwr_tObjectIx *) value_ptr, 1)); break; } case pwr_eType_ClassId: { pwr_tOName hiername; objid = cdh_ClassIdToObjid( *(pwr_tClassId *) value_ptr); sts = gdh_ObjidToName ( objid, hiername, sizeof(hiername), cdh_mNName); if (EVEN(sts)) { strcpy( str, ""); *len = 0; break; } *len = sprintf( str, "%s", hiername); break; } case pwr_eType_TypeId: { pwr_tOName hiername; objid = cdh_TypeIdToObjid( *(pwr_tTypeId *) value_ptr); sts = gdh_ObjidToName ( objid, hiername, sizeof(hiername), cdh_mNName); if (EVEN(sts)) { strcpy( str, ""); *len = 0; break; } *len = sprintf( str, "%s", hiername); break; } case pwr_eType_VolumeId: { *len = sprintf( str, "%s", cdh_VolumeIdToString( NULL, *(pwr_tVolumeId *) value_ptr, 1, 0)); break; } case pwr_eType_RefId: { *len = sprintf( str, "%s", cdh_SubidToString( NULL, *(pwr_tSubid *) value_ptr, 1)); break; } } }
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; }
int CnvWblToHtml::init( char *first) { pwr_tFileName fname; pwr_tFileName gname; char allclasses_name[80]; char timestr[80]; time_AtoAscii( 0, time_eFormat_DateAndTime, timestr, sizeof(timestr)); strcpy( html_first, ctx->rw->volume_name); strcat( html_first, "_"); strcat( html_first, first); cdh_ToLower( html_first, html_first); strcpy( allclasses_name, ctx->rw->volume_name); strcat( allclasses_name, "_allclasses.html"); cdh_ToLower( allclasses_name, allclasses_name); // Create index file { strcpy( fname, ctx->dir); strcat( fname, ctx->rw->volume_name); strcat( fname, "_index.html"); cdh_ToLower( fname, fname); ofstream fp( fname); // Get group menu name if ( ctx->setup->group_cnt) { strcpy( gname, CnvCtx::low(ctx->rw->volume_name)); strcat( gname, "_menu_group.html"); cdh_ToLower( fname, fname); } fp << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\"http://www.w3.org/TR/REC-html40/loose.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 Menu" << endl << "</TITLE>" << endl << "<link rel=\"stylesheet\" type=\"text/css\" href=\"orm.css\">" << endl << "</HEAD>" << endl << "<FRAMESET cols=\"20%,80%\">" << endl; if ( ctx->setup->group_cnt) fp << "<FRAMESET rows=\"20%,80%\">" << endl << "<FRAME src=\"" << gname << "\" name=\"groupFrame\">" << endl << "<FRAME src=\"" << allclasses_name << "\" name=\"menuFrame\">" << endl << "</FRAMESET>" << endl; else fp << "<FRAME src=\"" << allclasses_name << "\" name=\"menuFrame\">" << endl; fp << "<FRAME src=\"" << html_first << ".html\" name=\"classFrame\">" << endl << "</FRAMESET>" << endl << "<NOFRAMES>" << endl << "<H2>" << endl << "Frame Alert</H2>" << endl << "<P>" << endl << "This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client." << endl << "<BR>" << endl << "Link to <A HREF=\"" << html_first << ".html\">Non-frame version.</A></NOFRAMES>" << endl << "</HTML>" << endl; } // Create js index file strcpy( fname, ctx->dir); strcat( fname, ctx->rw->volume_name); strcat( fname, "_allclasses.jsf"); cdh_ToLower( fname, fname); fp_js_all.open( fname); js_all_first = true; fp_js_all << "function " << ctx->rw->volume_name << "_AllClasses( parent)" << endl << "{" << endl << "parent.addChildren([" << endl; // Create group menu file if ( ctx->setup->group_cnt) { strcpy( fname, ctx->dir); strcat( fname, gname); cdh_ToLower( fname, fname); ofstream fp( fname); fp << "<!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 << "Groups" << endl << "</TITLE>" << endl << "<link rel=\"stylesheet\" type=\"text/css\" href=\"orm.css\">" << endl << "</HEAD>" << endl << "<BODY BGCOLOR=\"white\">" << endl << "<FONT size=\"+1\" CLASS=\"FrameHeadingFont\">" << endl << "<B>Groups</B></FONT>" << endl << "<BR>" << endl << "" << endl << "<TABLE BORDER=\"0\" WIDTH=\"100%\">" << endl << "<TR>" << endl << "<TD NOWRAP><FONT CLASS=\"FrameItemFont\"> " << endl; // Put index filename in fname strcpy( fname, ctx->rw->volume_name); strcat( fname, "_index.html"); cdh_ToLower( fname, fname); fp << "<A HREF=\"" << fname << "\" TARGET=\"_parent\">AllClasses</A>" << endl << "<BR>" << endl; for ( int i = 0; i < ctx->setup->group_cnt; i++) { // Put group index filename in fname strcpy( fname, ctx->rw->volume_name); strcat( fname, "_group_"); strcat( fname, ctx->setup->groups[i]); strcat( fname, "_index.html"); cdh_ToLower( fname, fname); fp << "<A HREF=\"" << fname << "\" TARGET=\"_parent\">" << ctx->setup->groups[i] << "</A>" << endl << "<BR>" << endl; } fp << "</FONT></TD>" << endl << "</TR>" << endl << "</TABLE>" << endl << "" << endl << "</BODY>" << endl << "</HTML>" << endl; } // Open allclasses file strcpy( fname, ctx->dir); strcat( fname, allclasses_name); cdh_ToLower( fname, fname); fp_html_index.open( fname); html_index_open = 1; fp_html_index << "<!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 << "All Classes" << endl << "</TITLE>" << endl << "<link rel=\"stylesheet\" type=\"text/css\" href=\"orm.css\">" << endl << "</HEAD>" << endl << "<BODY BGCOLOR=\"white\">" << endl << "<FONT size=\"+1\" CLASS=\"FrameHeadingFont\">" << endl << "<B>All Classes</B></FONT>" << endl << "<BR>" << endl << "" << endl << "<TABLE BORDER=\"0\" WIDTH=\"100%\">" << endl << "<TR>" << endl << "<TD NOWRAP><FONT CLASS=\"FrameItemFont\"> " << endl; // Open one index file for each configured group for ( int i = 0; i < ctx->setup->group_cnt; i++) { // Create index page for each group strcpy( fname, ctx->dir); strcat( fname, ctx->rw->volume_name); strcat( fname, "_group_"); strcat( fname, ctx->setup->groups[i]); strcat( fname, "_index.html"); cdh_ToLower( fname, fname); { ofstream fp( fname); // Put menu filename in fname strcpy( fname, ctx->rw->volume_name); strcat( fname, "_group_"); strcat( fname, ctx->setup->groups[i]); strcat( fname, ".html"); cdh_ToLower( fname, fname); fp << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\"http://www.w3.org/TR/REC-html40/loose.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 << "Group Menu" << endl << "</TITLE>" << endl << "<link rel=\"stylesheet\" type=\"text/css\" href=\"orm.css\">" << endl << "</HEAD>" << endl << "<FRAMESET cols=\"20%,80%\">" << endl << "<FRAMESET rows=\"20%,80%\">" << endl << "<FRAME src=\"" << gname << "\" name=\"groupFrame\">" << endl << "<FRAME src=\"" << fname << "\" name=\"menuFrame\">" << endl << "</FRAMESET>" << endl; if ( strcmp( ctx->setup->groups_startpage[i], "") == 0) fp << "<FRAME name=\"classFrame\">" << endl; else fp << "<FRAME src=\"" << ctx->setup->groups_startpage[i] << "\" name=\"classFrame\">" << endl; fp << "</FRAMESET>" << endl << "<NOFRAMES>" << endl << "<H2>" << endl << "Frame Alert</H2>" << endl << "<P>" << endl << "This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client." << endl << "<BR>" << endl << "Link to <A HREF=\"" << html_first << ".html\">Non-frame version.</A></NOFRAMES>" << endl << "</HTML>" << endl; } // Create menu page strcpy( fname, ctx->dir); strcat( fname, ctx->rw->volume_name); strcat( fname, "_group_"); strcat( fname, ctx->setup->groups[i]); strcat( fname, ".html"); cdh_ToLower( fname, fname); fp_html_group[i].open( fname); strcpy( fname, ctx->dir); strcat( fname, ctx->rw->volume_name); strcat( fname, "_group_"); strcat( fname, ctx->setup->groups[i]); strcat( fname, ".jsf"); cdh_ToLower( fname, fname); fp_js_group[i].open( fname); fp_html_group[i] << "<!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 << ctx->setup->groups[i] << endl << "</TITLE>" << endl << "<link rel=\"stylesheet\" type=\"text/css\" href=\"orm.css\">" << endl << "</HEAD>" << endl << "<BODY BGCOLOR=\"white\">" << endl << "<FONT size=\"+1\" CLASS=\"FrameHeadingFont\">" << endl << "<B>" << ctx->setup->groups[i] << "</B></FONT>" << endl << "<BR>" << endl << "" << endl << "<TABLE BORDER=\"0\" WIDTH=\"100%\">" << endl << "<TR>" << endl << "<TD NOWRAP><FONT CLASS=\"FrameItemFont\"> " << endl; js_group_first[i] = true; fp_js_group[i] << "function " << ctx->rw->volume_name << "_" << ctx->setup->groups[i] << "(parent)" << endl << "{" << endl << "parent.addChildren([" << endl; } // Create js map for volume { strcpy( fname, ctx->dir); strcat( fname, ctx->rw->volume_name); strcat( fname, "_groups.jsf"); cdh_ToLower( fname, fname); ofstream fp( fname); fp << "function " << ctx->rw->volume_name << "(parent)" << endl << "{" << endl << " aux = insFld(parent, gFld(\"AllClasses\",\"" << ctx->rw->volume_name << "_index.html\"))" << endl << " " << ctx->rw->volume_name << "_AllClasses(aux)" << endl; for ( int i = 0; i < ctx->setup->group_cnt; i++) { strcpy( fname, ctx->rw->volume_name); strcat( fname, "_group_"); strcat( fname, ctx->setup->groups[i]); strcat( fname, "_index.html"); cdh_ToLower( fname, fname); fp << " aux = insFld(parent, gFld(\"" << ctx->setup->groups[i] << "\",\"" << fname << "\"))" << endl << " " << ctx->rw->volume_name << "_" << ctx->setup->groups[i] << "(aux)" << endl; } fp << "}" << endl; } return 1; }
// // printObject // void wb_print_wbl::printObject(wb_volume& v, wb_object& o, bool recursive) { wb_object to = o; wb_object templ; cdh_uObjid uid; unsigned int idx; wb_cdef cdef = v.cdef(o); if ( !cdef) { m_os << "! %WBDUMP-E-Error Failed to get object class" << endl; m_errCnt++; // return; cdef = v.cdef( pwr_eClass_ClassLost); } const char* cname = cdef.name(); char *block; int size; if ( o.docBlock( &block, &size) && strcmp( block, "") != 0) { indent(0) << "!/**" << endl; indent(0) << "! "; for ( char *s = block; *s; s++) { if ( *s == '\n') { m_os << *s; indent(0) << "! "; continue; } m_os << *s; } m_os << endl; indent(0) << "!*/" << endl; } indent(1) << "Object " << o.name() << " " << cname; if (m_idxFlag) { switch (cdef.cid()) { case pwr_eClass_ClassDef: uid.pwr = o.oid(); idx = uid.c.cix; break; case pwr_eClass_TypeDef: uid.pwr = o.oid(); idx = uid.t.tix; break; case pwr_eClass_ObjBodyDef: uid.pwr = o.oid(); idx = uid.c.bix; break; case pwr_eClass_Param: case pwr_eClass_Input: case pwr_eClass_Output: case pwr_eClass_Intern: case pwr_eClass_Buffer: case pwr_eClass_ObjXRef: uid.pwr = o.oid(); idx = uid.c.aix; break; default: idx = (unsigned long) o.oix(); } m_os << " " << idx; } if ( m_timeFlag) { // Get oh time char timestr[40]; pwr_tTime ohtime = o.ohTime(); time_AtoAscii( &ohtime, time_eFormat_DateAndTime, timestr, sizeof(timestr)); m_os << " " << timestr; } m_os << endl; wb_object co = v.object(cdh_ClassIdToObjid(cdef.cid())); wb_name t("Template"); templ = co.child(t); if (!templ) { m_errCnt++; m_os << "Template not found for class " << cdef.name() << endl; return; } if ( v.cid() == pwr_eClass_ClassVolume && strcmp( o.name(), "Template") == 0) m_isTemplateObject = true; else m_isTemplateObject = false; printBody(v, o, templ, cdef, pwr_eBix_rt); printBody(v, o, templ, cdef, pwr_eBix_dev); if (recursive) { if ( !(m_noFoCodeFlag && isFoCodeObject( v, o))) { for (to = o.first(); to; to = to.after()) printObject(v, to); } } indent(-1) << "EndObject" << endl; }