static char *get_hptr_vector_val(Trptr t, hptr h) { char *ascii = NULL; if(h->time < LLDescriptor(0)) { ascii=strdup_2("X"); } else if(h->flags&HIST_REAL) { if(!(h->flags&HIST_STRING)) { #ifdef WAVE_HAS_H_DOUBLE ascii=convert_ascii_real(t, &h->v.h_double); #else ascii=convert_ascii_real(t, (double *)h->v.h_vector); #endif } else { ascii=convert_ascii_string((char *)h->v.h_vector); } } else { ascii=convert_ascii_vec(t,h->v.h_vector); } format_value_string(ascii); return(ascii); }
static void read_traces (struct ghw_handler *h) { int *list; int i; enum ghw_res res; list = malloc_2((GLOBALS->numfacs + 1) * sizeof (int)); while (1) { res = ghw_read_sm_hdr (h, list); switch (res) { case ghw_res_error: case ghw_res_eof: free_2(list); return; case ghw_res_ok: case ghw_res_other: break; case ghw_res_snapshot: if (h->snap_time > GLOBALS->max_time) GLOBALS->max_time = h->snap_time; /* printf ("Time is "GHWLLD"\n", h->snap_time); */ for (i = 0; i < h->nbr_sigs; i++) add_history (h, GLOBALS->nxp_ghw_c_1[i], i); break; case ghw_res_cycle: while (1) { int sig; /* printf ("Time is "GHWLLD"\n", h->snap_time); */ if (h->snap_time < LLDescriptor(9223372036854775807)) { if (h->snap_time > GLOBALS->max_time) GLOBALS->max_time = h->snap_time; for (i = 0; (sig = list[i]) != 0; i++) add_history (h, GLOBALS->nxp_ghw_c_1[sig], sig); } res = ghw_read_cycle_next (h); if (res != 1) break; res = ghw_read_cycle_cont (h, list); if (res < 0) break; } if (res < 0) break; res = ghw_read_cycle_end (h); if (res < 0) break; break; } } }
static char *get_vptr_vector_val(Trptr t, vptr v) { char *ascii = NULL; if(v->time < LLDescriptor(0)) { ascii=strdup_2("X"); } else { ascii=convert_ascii(t,v); } if(!ascii) { ascii=strdup_2("X"); } format_value_string(ascii); return(ascii); }
TimeType ghw_main(char *fname) { struct ghw_handler handle; int i; int rc; if(!GLOBALS->hier_was_explicitly_set) /* set default hierarchy split char */ { GLOBALS->hier_delimeter='.'; } handle.flag_verbose = 0; if ((rc=ghw_open (&handle, fname)) < 0) { fprintf (stderr, "Error opening ghw file '%s', rc=%d.\n", fname, rc); return(LLDescriptor(0)); /* look at return code in caller for success status... */ } GLOBALS->time_scale = 1; GLOBALS->time_dimension = 'f'; GLOBALS->asbuf = malloc_2(4097); if (ghw_read_base (&handle) < 0) { free_2(GLOBALS->asbuf); GLOBALS->asbuf = NULL; fprintf (stderr, "Error in ghw file '%s'.\n", fname); return(LLDescriptor(0)); /* look at return code in caller for success status... */ } GLOBALS->min_time = 0; GLOBALS->max_time = 0; GLOBALS->nbr_sig_ref_ghw_c_1 = 0; GLOBALS->nxp_ghw_c_1 =(struct Node **)calloc_2(handle.nbr_sigs, sizeof(struct Node *)); for(i=0;i<handle.nbr_sigs;i++) { GLOBALS->nxp_ghw_c_1[i] = (struct Node *)calloc_2(1,sizeof(struct Node)); } GLOBALS->treeroot = build_hierarchy (&handle, handle.hie); /* GHW does not contains a 'top' name. FIXME: should use basename of the file. */ create_facs (&handle); read_traces (&handle); add_tail (&handle); set_fac_name (&handle); free_2(GLOBALS->nxp_ghw_c_1); GLOBALS->nxp_ghw_c_1 = NULL; /* fix up names on aliased nodes via cloning... */ for(i=0;i<GLOBALS->numfacs;i++) { if(strcmp(GLOBALS->facs[i]->name, GLOBALS->facs[i]->n->nname)) { struct Node *n = malloc_2(sizeof(struct Node)); memcpy(n, GLOBALS->facs[i]->n, sizeof(struct Node)); GLOBALS->facs[i]->n = n; n->nname = GLOBALS->facs[i]->name; } } /* treeroot->name = "top"; */ { const char *base_hier = "top"; struct tree *t = calloc_2(1, sizeof(struct tree) + strlen(base_hier) + 1); memcpy(t, GLOBALS->treeroot, sizeof(struct tree)); strcpy(t->name, base_hier); /* scan-build false warning here, thinks name[1] is total length */ #ifndef WAVE_TALLOC_POOL_SIZE free_2(GLOBALS->treeroot); /* if using tree alloc pool, can't deallocate this */ #endif GLOBALS->treeroot = t; } ghw_close (&handle); rechain_facs(); /* vectorize bitblasted nets */ ghw_sortfacs(); /* sort nets as ghw is unsorted ... also fix hier tree (it should really be built *after* facs are sorted!) */ #if 0 treedebug(GLOBALS->treeroot,""); facs_debug(); #endif GLOBALS->is_ghw = 1; fprintf(stderr, "["TTFormat"] start time.\n["TTFormat"] end time.\n", GLOBALS->min_time*GLOBALS->time_scale, GLOBALS->max_time*GLOBALS->time_scale); if(GLOBALS->num_glitches_ghw_c_1) fprintf(stderr, "Warning: encountered %d glitch%s across %d glitch region%s.\n", GLOBALS->num_glitches_ghw_c_1, (GLOBALS->num_glitches_ghw_c_1!=1)?"es":"", GLOBALS->num_glitch_regions_ghw_c_1, (GLOBALS->num_glitch_regions_ghw_c_1!=1)?"s":""); return GLOBALS->max_time; }
/* * mainline */ int save_nodes_to_export_generic(FILE *trans_file, Trptr trans_head, const char *fname, int export_typ) { Trptr t = trans_head ? trans_head : GLOBALS->traces.first; int nodecnt = 0; vcdsav_Tree *vt = NULL; vcdsav_Tree **hp_clone = GLOBALS->hp_vcd_saver_c_1; nptr n; /* ExtNode *e; */ /* int msi, lsi; */ int i; TimeType prevtime = LLDescriptor(-1); time_t walltime; struct strace *st = NULL; int strace_append = 0; int max_len = 1; char *row_data = NULL; struct lt_trace *lt = NULL; int lxt = (export_typ == WAVE_EXPORT_LXT); int is_trans = (export_typ == WAVE_EXPORT_TRANS); if(export_typ == WAVE_EXPORT_TIM) { return(do_timfile_save(fname)); } errno = 0; if(lxt) { lt = lt_init(fname); if(!lt) { return(VCDSAV_FILE_ERROR); } } else { if(export_typ != WAVE_EXPORT_TRANS) { GLOBALS->f_vcd_saver_c_1 = fopen(fname, "wb"); } else { if(!trans_head) /* scan-build : is programming error to get here */ { return(VCDSAV_FILE_ERROR); } GLOBALS->f_vcd_saver_c_1 = trans_file; } if(!GLOBALS->f_vcd_saver_c_1) { return(VCDSAV_FILE_ERROR); } } while(t) { if(!t->vector) { if(t->n.nd) { n = t->n.nd; if(n->expansion) n = n->expansion->parent; vt = vcdsav_splay(n, vt); if(!vt || vt->item != n) { unsigned char flags = 0; if(n->head.next) if(n->head.next->next) { flags = n->head.next->next->flags; } vt = vcdsav_insert(n, vt, ++nodecnt, flags, &n->head); } } } else { bvptr b = t->n.vec; if(b) { bptr bt = b->bits; if(bt) { for(i=0;i<bt->nnbits;i++) { if(bt->nodes[i]) { n = bt->nodes[i]; if(n->expansion) n = n->expansion->parent; vt = vcdsav_splay(n, vt); if(!vt || vt->item != n) { unsigned char flags = 0; if(n->head.next) if(n->head.next->next) { flags = n->head.next->next->flags; } vt = vcdsav_insert(n, vt, ++nodecnt, flags, &n->head); } } } } } } if(export_typ == WAVE_EXPORT_TRANS) { break; } if(!strace_append) { t=t->t_next; if(t) continue; } else { st = st->next; t = st ? st->trace : NULL; if(t) { continue; } else { swap_strace_contexts(); } } strace_concat: GLOBALS->strace_ctx = &GLOBALS->strace_windows[GLOBALS->strace_current_window = strace_append]; strace_append++; if(strace_append == WAVE_NUM_STRACE_WINDOWS) break; if(!GLOBALS->strace_ctx->shadow_straces) { goto strace_concat; } swap_strace_contexts(); st = GLOBALS->strace_ctx->straces; t = st ? st->trace : NULL; if(!t) {swap_strace_contexts(); goto strace_concat; } } if(!nodecnt) return(VCDSAV_EMPTY); /* header */ if(lxt) { int dim; lt_set_chg_compress(lt); lt_set_clock_compress(lt); lt_set_initial_value(lt, 'x'); lt_set_time64(lt, 0); lt_symbol_bracket_stripping(lt, 1); switch(GLOBALS->time_dimension) { case 'm': dim = -3; break; case 'u': dim = -6; break; case 'n': dim = -9; break; case 'p': dim = -12; break; case 'f': dim = -15; break; default: dim = 0; break; } lt_set_timescale(lt, dim); } else { if(export_typ != WAVE_EXPORT_TRANS) { time(&walltime); w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$date\n"); w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "\t%s",asctime(localtime(&walltime))); w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$end\n"); w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$version\n\t"WAVE_VERSION_INFO"\n$end\n"); w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$timescale\n\t%d%c%s\n$end\n", (int)GLOBALS->time_scale, GLOBALS->time_dimension, (GLOBALS->time_dimension=='s') ? "" : "s"); if(GLOBALS->global_time_offset) { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$timezero\n\t"TTFormat"\n$end\n",GLOBALS->global_time_offset); } } else { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$comment data_start %p $end\n", (void *)trans_head); /* arbitrary hex identifier */ w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$comment name %s $end\n", trans_head->name ? trans_head->name : "UNKNOWN"); w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$timescale %d%c%s $end\n", (int)GLOBALS->time_scale, GLOBALS->time_dimension, (GLOBALS->time_dimension=='s') ? "" : "s"); if(GLOBALS->global_time_offset) { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$timezero "TTFormat" $end\n",GLOBALS->global_time_offset); } w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$comment min_time "TTFormat" $end\n", GLOBALS->min_time / GLOBALS->time_scale); w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$comment max_time "TTFormat" $end\n", GLOBALS->max_time / GLOBALS->time_scale); } } if(export_typ == WAVE_EXPORT_TRANS) { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$comment max_seqn %d $end\n", nodecnt); if(t && t->transaction_args) { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$comment args \"%s\" $end\n", t->transaction_args); } } /* write out netnames here ... */ hp_clone = GLOBALS->hp_vcd_saver_c_1 = calloc_2(nodecnt, sizeof(vcdsav_Tree *)); recurse_build(vt, &hp_clone); for(i=0;i<nodecnt;i++) { int was_packed = HIER_DEPACK_STATIC; char *hname = hier_decompress_flagged(GLOBALS->hp_vcd_saver_c_1[i]->item->nname, &was_packed); char *netname = lxt ? hname : output_hier(is_trans, hname); if(export_typ == WAVE_EXPORT_TRANS) { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$comment seqn %d %s $end\n", GLOBALS->hp_vcd_saver_c_1[i]->val, hname); } if(GLOBALS->hp_vcd_saver_c_1[i]->flags & (HIST_REAL|HIST_STRING)) { if(lxt) { GLOBALS->hp_vcd_saver_c_1[i]->handle.p = lt_symbol_add(lt, netname, 0, 0, 0, GLOBALS->hp_vcd_saver_c_1[i]->flags & HIST_STRING ? LT_SYM_F_STRING : LT_SYM_F_DOUBLE); } else { const char *typ = (GLOBALS->hp_vcd_saver_c_1[i]->flags & HIST_STRING) ? "string" : "real"; int tlen = (GLOBALS->hp_vcd_saver_c_1[i]->flags & HIST_STRING) ? 0 : 1; w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$var %s %d %s %s $end\n", typ, tlen, vcdid(GLOBALS->hp_vcd_saver_c_1[i]->val, export_typ), netname); } } else { int msi = -1, lsi = -1; if(GLOBALS->hp_vcd_saver_c_1[i]->item->extvals) { msi = GLOBALS->hp_vcd_saver_c_1[i]->item->msi; lsi = GLOBALS->hp_vcd_saver_c_1[i]->item->lsi; } if(msi==lsi) { if(lxt) { int strand_idx = strand_pnt(netname); if(strand_idx >= 0) { msi = lsi = atoi(netname + strand_idx + 1); } GLOBALS->hp_vcd_saver_c_1[i]->handle.p = lt_symbol_add(lt, netname, 0, msi, lsi, LT_SYM_F_BITS); } else { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$var wire 1 %s %s $end\n", vcdid(GLOBALS->hp_vcd_saver_c_1[i]->val, export_typ), netname); } } else { int len = (msi < lsi) ? (lsi - msi + 1) : (msi - lsi + 1); if(lxt) { GLOBALS->hp_vcd_saver_c_1[i]->handle.p = lt_symbol_add(lt, netname, 0, msi, lsi, LT_SYM_F_BITS); } else { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$var wire %d %s %s $end\n", len, vcdid(GLOBALS->hp_vcd_saver_c_1[i]->val, export_typ), netname); } GLOBALS->hp_vcd_saver_c_1[i]->len = len; if(len > max_len) max_len = len; } } /* if(was_packed) { free_2(hname); } ...not needed for HIER_DEPACK_STATIC */ } row_data = malloc_2(max_len + 1); if(!lxt) { output_hier(is_trans, ""); free_hier(); w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$enddefinitions $end\n"); w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$dumpvars\n"); } /* value changes */ for(i=(nodecnt/2-1);i>0;i--) /* build nodes into having heap property */ { heapify(i,nodecnt); } for(;;) { heapify(0, nodecnt); if(!GLOBALS->hp_vcd_saver_c_1[0]->hist) break; if(GLOBALS->hp_vcd_saver_c_1[0]->hist->time > GLOBALS->max_time) break; if((GLOBALS->hp_vcd_saver_c_1[0]->hist->time != prevtime) && (GLOBALS->hp_vcd_saver_c_1[0]->hist->time >= LLDescriptor(0))) { TimeType tnorm = GLOBALS->hp_vcd_saver_c_1[0]->hist->time; if(GLOBALS->time_scale != 1) { tnorm /= GLOBALS->time_scale; } if(lxt) { lt_set_time64(lt, tnorm); } else { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "#"TTFormat"\n", tnorm); } prevtime = GLOBALS->hp_vcd_saver_c_1[0]->hist->time; } if(GLOBALS->hp_vcd_saver_c_1[0]->hist->time >= LLDescriptor(0)) { if(GLOBALS->hp_vcd_saver_c_1[0]->flags & (HIST_REAL|HIST_STRING)) { if(GLOBALS->hp_vcd_saver_c_1[0]->flags & HIST_STRING) { char *vec = GLOBALS->hp_vcd_saver_c_1[0]->hist->v.h_vector ? GLOBALS->hp_vcd_saver_c_1[0]->hist->v.h_vector : "UNDEF"; if(lxt) { lt_emit_value_string(lt, GLOBALS->hp_vcd_saver_c_1[0]->handle.p, 0, vec); } else { int vec_slen = strlen(vec); char *vec_escaped = malloc_2(vec_slen*4 + 1); /* worst case */ int vlen = fstUtilityBinToEsc((unsigned char *)vec_escaped, (unsigned char *)vec, vec_slen); vec_escaped[vlen] = 0; if(vlen) { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "s%s %s\n", vec_escaped, vcdid(GLOBALS->hp_vcd_saver_c_1[0]->val, export_typ)); } else { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "s\\000 %s\n", vcdid(GLOBALS->hp_vcd_saver_c_1[0]->val, export_typ)); } free_2(vec_escaped); } } else { #ifdef WAVE_HAS_H_DOUBLE double *d = &GLOBALS->hp_vcd_saver_c_1[0]->hist->v.h_double; #else double *d = (double *)GLOBALS->hp_vcd_saver_c_1[0]->hist->v.h_vector; #endif double value; if(!d) { sscanf("NaN", "%lg", &value); } else { value = *d; } if(lxt) { lt_emit_value_double(lt, GLOBALS->hp_vcd_saver_c_1[0]->handle.p, 0, value); } else { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "r%.16g %s\n", value, vcdid(GLOBALS->hp_vcd_saver_c_1[0]->val, export_typ)); } } } else if(GLOBALS->hp_vcd_saver_c_1[0]->len) { if(GLOBALS->hp_vcd_saver_c_1[0]->hist->v.h_vector) { for(i=0;i<GLOBALS->hp_vcd_saver_c_1[0]->len;i++) { row_data[i] = analyzer_demang(lxt, GLOBALS->hp_vcd_saver_c_1[0]->hist->v.h_vector[i]); } } else { for(i=0;i<GLOBALS->hp_vcd_saver_c_1[0]->len;i++) { row_data[i] = 'x'; } } row_data[i] = 0; if(lxt) { lt_emit_value_bit_string(lt, GLOBALS->hp_vcd_saver_c_1[0]->handle.p, 0, row_data); } else { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "b%s %s\n", vcd_truncate_bitvec(row_data), vcdid(GLOBALS->hp_vcd_saver_c_1[0]->val, export_typ)); } } else { if(lxt) { row_data[0] = analyzer_demang(lxt, GLOBALS->hp_vcd_saver_c_1[0]->hist->v.h_val); row_data[1] = 0; lt_emit_value_bit_string(lt, GLOBALS->hp_vcd_saver_c_1[0]->handle.p, 0, row_data); } else { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "%c%s\n", analyzer_demang(lxt, GLOBALS->hp_vcd_saver_c_1[0]->hist->v.h_val), vcdid(GLOBALS->hp_vcd_saver_c_1[0]->val, export_typ)); } } } GLOBALS->hp_vcd_saver_c_1[0]->hist = GLOBALS->hp_vcd_saver_c_1[0]->hist->next; } if(prevtime < GLOBALS->max_time) { if(lxt) { lt_set_time64(lt, GLOBALS->max_time / GLOBALS->time_scale); } else { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "#"TTFormat"\n", GLOBALS->max_time / GLOBALS->time_scale); } } for(i=0;i<nodecnt;i++) { free_2(GLOBALS->hp_vcd_saver_c_1[i]); } free_2(GLOBALS->hp_vcd_saver_c_1); GLOBALS->hp_vcd_saver_c_1 = NULL; free_2(row_data); row_data = NULL; if(lxt) { lt_close(lt); lt = NULL; } else { if(export_typ != WAVE_EXPORT_TRANS) { fclose(GLOBALS->f_vcd_saver_c_1); } else { w32redirect_fprintf(is_trans, GLOBALS->f_vcd_saver_c_1, "$comment data_end %p $end\n", (void *)trans_head); /* arbitrary hex identifier */ #if !defined _MSC_VER && !defined __MINGW32__ fflush(GLOBALS->f_vcd_saver_c_1); #endif } GLOBALS->f_vcd_saver_c_1 = NULL; } return(VCDSAV_OK); }
int do_timfile_save(const char *fname) { const char *time_prefix=WAVE_SI_UNITS; const double negpow[] = { 1.0, 1.0e-3, 1.0e-6, 1.0e-9, 1.0e-12, 1.0e-15, 1.0e-18, 1.0e-21 }; char *pnt; int offset; Trptr t = GLOBALS->traces.first; int i = 1; /* trace index in the .tim file */ TimeType tmin, tmax; errno = 0; if((GLOBALS->tims.marker > LLDescriptor(0)) && (GLOBALS->tims.baseline > LLDescriptor(0))) { if(GLOBALS->tims.marker < GLOBALS->tims.baseline) { tmin = GLOBALS->tims.marker; tmax = GLOBALS->tims.baseline; } else { tmax = GLOBALS->tims.marker; tmin = GLOBALS->tims.baseline; } } else { tmin = GLOBALS->min_time; tmax = GLOBALS->max_time; } GLOBALS->f_vcd_saver_c_1 = fopen(fname, "wb"); if(!GLOBALS->f_vcd_saver_c_1) { return(VCDSAV_FILE_ERROR); } pnt=strchr(time_prefix, (int)GLOBALS->time_dimension); if(pnt) { offset=pnt-time_prefix; } else offset=0; w32redirect_fprintf(0, GLOBALS->f_vcd_saver_c_1, "Timing Analyzer Settings\n" " Time_Scale: %E\n" " Time_Per_Division: %E\n" " NumberDivisions: 10\n" " Start_Time: "TTFormat".0\n" " End_Time: "TTFormat".0\n", negpow[offset], (tmax-tmin) / 10.0, tmin, tmax ); while(t) { write_tim_tracedata(t, &i, tmin, tmax); t = GiveNextTrace(t); } fclose(GLOBALS->f_vcd_saver_c_1); GLOBALS->f_vcd_saver_c_1 = NULL; return(errno ? VCDSAV_FILE_ERROR : VCDSAV_OK); }
/* * mainline */ TimeType ae2_main(char *fname, char *skip_start, char *skip_end) { int i; int match_idx; struct Node *n; struct symbol *s; TimeType first_cycle, last_cycle /* , total_cycles */; /* scan-build */ int total_rows = 0; int mono_row_offset = 0; struct Node *monolithic_node = NULL; struct symbol *monolithic_sym = NULL; #ifdef AET2_ALIASDB_IS_PRESENT unsigned long kw = 0; unsigned char *missing = NULL; #endif char buf[AE2_MAX_NAME_LENGTH+1]; ae2_read_set_max_section_cycle(65536); ae2_initialize(error_fn, msg_fn, alloc_fn, free_fn); if ( (!(GLOBALS->ae2_f=fopen(fname, "rb"))) || (!(GLOBALS->ae2 = ae2_read_initialize(GLOBALS->ae2_f))) ) { if(GLOBALS->ae2_f) { fclose(GLOBALS->ae2_f); GLOBALS->ae2_f = NULL; } return(LLDescriptor(0)); /* look at GLOBALS->ae2 in caller for success status... */ } GLOBALS->time_dimension = 'n'; if(!GLOBALS->fast_tree_sort) { GLOBALS->do_hier_compress = 0; } init_facility_pack(); /* SPLASH */ splash_create(); sym_hash_initialize(GLOBALS); #ifdef AET2_ALIASDB_IS_PRESENT if(!GLOBALS->disable_ae2_alias) { kw = ae2_read_locate_keyword(GLOBALS->ae2, "aliasdb"); } if(kw) { GLOBALS->adb_alias_stream_file = ae2_read_keyword_stream(GLOBALS->ae2, kw); GLOBALS->adb = adb_open_embed(GLOBALS->adb_alias_stream_file, NULL, alloc_fn, free_fn, adb_msg_fn, error_fn); if(GLOBALS->adb) { unsigned long fn; GLOBALS->ae2_num_aliases = adb_num_aliases(GLOBALS->adb); GLOBALS->adb_max_terms = adb_max_alias_terms(GLOBALS->adb); GLOBALS->adb_terms = calloc_2(GLOBALS->adb_max_terms + 1, sizeof(ADB_TERM)); GLOBALS->adb_aliases = calloc_2(GLOBALS->ae2_num_aliases, sizeof(ADB_TERM *)); GLOBALS->adb_num_terms = calloc_2(GLOBALS->ae2_num_aliases, sizeof(unsigned short)); GLOBALS->adb_idx_first = calloc_2(GLOBALS->ae2_num_aliases, sizeof(unsigned short)); GLOBALS->adb_idx_last = calloc_2(GLOBALS->ae2_num_aliases, sizeof(unsigned short)); fn = adb_map_ids (GLOBALS->adb, symbol_fn, GLOBALS->ae2); /* iteratively replaces all .id with FACIDX */ fprintf(stderr, AET2_RDLOAD"Encountered %lu aliases referencing %lu facs.\n", GLOBALS->ae2_num_aliases, fn); } } #endif GLOBALS->ae2_num_sections=ae2_read_num_sections(GLOBALS->ae2); GLOBALS->ae2_num_facs = ae2_read_num_symbols(GLOBALS->ae2); GLOBALS->numfacs = GLOBALS->ae2_num_facs + GLOBALS->ae2_num_aliases; GLOBALS->ae2_process_mask = calloc_2(1, GLOBALS->numfacs/8+1); GLOBALS->ae2_fr=calloc_2(GLOBALS->numfacs, sizeof(AE2_FACREF)); GLOBALS->ae2_lx2_table=(struct lx2_entry **)calloc_2(GLOBALS->numfacs, sizeof(struct lx2_entry *)); match_idx = 0; for(i=0;i<GLOBALS->ae2_num_facs;i++) { int idx = i+1; GLOBALS->ae2_fr[match_idx].facname = NULL; GLOBALS->ae2_fr[match_idx].s = idx; GLOBALS->ae2_fr[match_idx].row = ae2_read_symbol_rows(GLOBALS->ae2, idx); if(GLOBALS->ae2_fr[match_idx].row > AE2_MAX_ROWS) { GLOBALS->ae2_fr[match_idx].row = AE2_MAX_ROWS; ae2_read_find_symbol(GLOBALS->ae2, buf, &GLOBALS->ae2_fr[match_idx]); fprintf(stderr, AET2_RDLOAD"Warning: Reduced array %s to %d rows.\n", buf, AE2_MAX_ROWS); } total_rows += (GLOBALS->ae2_fr[match_idx].row > 0) ? GLOBALS->ae2_fr[match_idx].row : 1; if(GLOBALS->ae2_fr[match_idx].row == 1) GLOBALS->ae2_fr[match_idx].row = 0; GLOBALS->ae2_fr[match_idx].length = ae2_read_symbol_length(GLOBALS->ae2, idx); GLOBALS->ae2_fr[match_idx].row_high = 0; GLOBALS->ae2_fr[match_idx].offset = 0; match_idx++; } #ifdef AET2_ALIASDB_IS_PRESENT missing = calloc_2(1, (GLOBALS->ae2_num_aliases + 7 + 1) / 8); /* + 1 to mirror idx value */ for(i=0;i<GLOBALS->ae2_num_aliases;i++) { unsigned long numTerms; int idx = i+1; int ii; int midx, mbit; int mcnt; total_rows++; if((numTerms = adb_load_alias_def(GLOBALS->adb, idx, GLOBALS->adb_terms))) { if(GLOBALS->adb_terms[0].first > GLOBALS->adb_terms[0].last) { GLOBALS->ae2_fr[match_idx].length = GLOBALS->adb_terms[0].first - GLOBALS->adb_terms[0].last + 1; } else { GLOBALS->ae2_fr[match_idx].length = GLOBALS->adb_terms[0].last - GLOBALS->adb_terms[0].first + 1; } GLOBALS->adb_idx_first[i] = GLOBALS->adb_terms[0].first; GLOBALS->adb_idx_last[i] = GLOBALS->adb_terms[0].last; GLOBALS->ae2_fr[match_idx].s = idx + GLOBALS->ae2_num_facs; /* bias aliases after regular facs */ GLOBALS->ae2_fr[match_idx].facname = NULL; GLOBALS->ae2_fr[match_idx].row = 0; GLOBALS->ae2_fr[match_idx].row_high = 0; GLOBALS->ae2_fr[match_idx].offset = 0; GLOBALS->adb_num_terms[i] = numTerms; GLOBALS->adb_aliases[i] = adb_alloc_2(numTerms * sizeof(ADB_TERM)); mcnt = 0; for(ii=0;ii<(numTerms);ii++) { GLOBALS->adb_aliases[i][ii].id = GLOBALS->adb_terms[ii+1].id; if(!GLOBALS->adb_aliases[i][ii].id) { mcnt++; } GLOBALS->adb_aliases[i][ii].first = GLOBALS->adb_terms[ii+1].first; GLOBALS->adb_aliases[i][ii].last = GLOBALS->adb_terms[ii+1].last; } if(mcnt) { midx = idx / 8; mbit = idx & 7; missing[midx] |= (1 << mbit); } } else { unsigned long id = GLOBALS->adb_terms[0].id; if(id) { memcpy(&GLOBALS->ae2_fr[match_idx], &GLOBALS->ae2_fr[id-1], sizeof(AE2_FACREF)); GLOBALS->adb_idx_first[i] = 0; GLOBALS->adb_idx_last[i] = GLOBALS->ae2_fr[match_idx].length - 1; } else /* not in model */ { midx = idx / 8; mbit = idx & 7; missing[midx] |= (1 << mbit); GLOBALS->ae2_fr[match_idx].length = 1; GLOBALS->adb_idx_first[i] = 0; GLOBALS->adb_idx_last[i] = 0; GLOBALS->ae2_fr[match_idx].s = idx + GLOBALS->ae2_num_facs; /* bias aliases after regular facs */ GLOBALS->ae2_fr[match_idx].facname = NULL; GLOBALS->ae2_fr[match_idx].row = 0; GLOBALS->ae2_fr[match_idx].row_high = 0; GLOBALS->ae2_fr[match_idx].offset = 0; GLOBALS->adb_num_terms[i] = 0; } } match_idx++; } #endif monolithic_node = calloc_2(total_rows, sizeof(struct Node)); monolithic_sym = calloc_2(match_idx, sizeof(struct symbol)); fprintf(stderr, AET2_RDLOAD"Finished building %d facs.\n", match_idx); /* SPLASH */ splash_sync(1, 5); first_cycle = (TimeType) ae2_read_start_cycle(GLOBALS->ae2); last_cycle = (TimeType) ae2_read_end_cycle(GLOBALS->ae2); /* total_cycles = last_cycle - first_cycle + 1; */ /* scan-build */ /* do your stuff here..all useful info has been initialized by now */ if(!GLOBALS->hier_was_explicitly_set) /* set default hierarchy split char */ { GLOBALS->hier_delimeter='.'; } match_idx = 0; for(i=0;i<GLOBALS->numfacs;i++) { char *str; int idx; int typ; unsigned long len, clen; int row_iter, mx_row, mx_row_adjusted; #ifdef AET2_ALIASDB_IS_PRESENT if(i < GLOBALS->ae2_num_facs) #endif { idx = i+1; len = ae2_read_symbol_name(GLOBALS->ae2, idx, buf); typ = (GLOBALS->ae2_fr[match_idx].row <= 1) ? ND_GEN_NET : ND_VCD_ARRAY; } #ifdef AET2_ALIASDB_IS_PRESENT else { idx = i - GLOBALS->ae2_num_facs + 1; typ = (missing[idx/8] & (1 << (idx & 7))) ? ND_GEN_MISSING : ND_GEN_ALIAS; len = adb_alias_name(GLOBALS->adb, idx, buf) - 1; /* it counts the null character */ } #endif if(GLOBALS->ae2_fr[match_idx].length>1) { int len2; #ifdef AET2_ALIASDB_IS_PRESENT if(i < GLOBALS->ae2_num_facs) #endif { len2 = sprintf_2_1d(buf+len, GLOBALS->ae2_fr[match_idx].length-1); } #ifdef AET2_ALIASDB_IS_PRESENT else { len2 = sprintf_2_2d(buf+len, GLOBALS->adb_idx_first[i - GLOBALS->ae2_num_facs], GLOBALS->adb_idx_last[i - GLOBALS->ae2_num_facs]); } #endif clen = (len + len2 + 1); if(!GLOBALS->do_hier_compress) { str=malloc_2(clen); } else { str = buf; } if(clen > GLOBALS->longestname) GLOBALS->longestname = clen; if(!GLOBALS->alt_hier_delimeter) { if(!GLOBALS->do_hier_compress) strcpy(str, buf); } else { strcpy_vcdalt(str, buf, GLOBALS->alt_hier_delimeter); } s = &monolithic_sym[match_idx]; symadd_name_exists_sym_exists(s, str,0); } else { clen = (len+1); if(!GLOBALS->do_hier_compress) { str=malloc_2(clen); } else { str = buf; } if(clen > GLOBALS->longestname) GLOBALS->longestname = clen; if(!GLOBALS->alt_hier_delimeter) { if(!GLOBALS->do_hier_compress) strcpy(str, buf); } else { strcpy_vcdalt(str, buf, GLOBALS->alt_hier_delimeter); } s = &monolithic_sym[match_idx]; symadd_name_exists_sym_exists(s, str,0); } mx_row = (GLOBALS->ae2_fr[match_idx].row < 1) ? 1 : GLOBALS->ae2_fr[match_idx].row; mx_row_adjusted = (mx_row < 2) ? 0 : mx_row; n=&monolithic_node[mono_row_offset]; s->n = n; mono_row_offset += mx_row; if(GLOBALS->do_hier_compress) { s->name = compress_facility((unsigned char *)str, clen - 1); } for(row_iter = 0; row_iter < mx_row; row_iter++) { n[row_iter].vartype = typ; n[row_iter].nname=s->name; n[row_iter].mv.mvlfac = (struct fac *)(GLOBALS->ae2_fr+match_idx); /* to keep from having to allocate duplicate mvlfac struct */ /* use the info in the AE2_FACREF array instead */ n[row_iter].array_height = mx_row_adjusted; n[row_iter].this_row = row_iter; if(GLOBALS->ae2_fr[match_idx].length>1) { #ifdef AET2_ALIASDB_IS_PRESENT if(i < GLOBALS->ae2_num_facs) #endif { n[row_iter].msi = 0; n[row_iter].lsi = GLOBALS->ae2_fr[match_idx].length-1; } #ifdef AET2_ALIASDB_IS_PRESENT else { n[row_iter].msi = GLOBALS->adb_idx_first[i - GLOBALS->ae2_num_facs]; n[row_iter].lsi = GLOBALS->adb_idx_last[i - GLOBALS->ae2_num_facs]; } #endif n[row_iter].extvals = 1; } n[row_iter].head.time=-1; /* mark 1st node as negative time */ n[row_iter].head.v.h_val=AN_X; } match_idx++; } #ifdef AET2_ALIASDB_IS_PRESENT if(GLOBALS->adb_idx_last) { free_2(GLOBALS->adb_idx_last); GLOBALS->adb_idx_last = NULL; } if(GLOBALS->adb_idx_first) { free_2(GLOBALS->adb_idx_first); GLOBALS->adb_idx_first = NULL; } if(missing) { free_2(missing); missing = NULL; } #endif freeze_facility_pack(); /* SPLASH */ splash_sync(2, 5); GLOBALS->facs=(struct symbol **)malloc_2(GLOBALS->numfacs*sizeof(struct symbol *)); if(GLOBALS->fast_tree_sort) { for(i=0;i<GLOBALS->numfacs;i++) { GLOBALS->facs[i]=&monolithic_sym[i]; } /* SPLASH */ splash_sync(3, 5); fprintf(stderr, AET2_RDLOAD"Building facility hierarchy tree.\n"); init_tree(); for(i=0;i<GLOBALS->numfacs;i++) { int was_packed = HIER_DEPACK_STATIC; /* no need to free_2() afterward then */ char *sb = hier_decompress_flagged(GLOBALS->facs[i]->name, &was_packed); build_tree_from_name(sb, i); } /* SPLASH */ splash_sync(4, 5); treegraft(&GLOBALS->treeroot); fprintf(stderr, AET2_RDLOAD"Sorting facility hierarchy tree.\n"); treesort(GLOBALS->treeroot, NULL); /* SPLASH */ splash_sync(5, 5); order_facs_from_treesort(GLOBALS->treeroot, &GLOBALS->facs); GLOBALS->facs_are_sorted=1; } else { for(i=0;i<GLOBALS->numfacs;i++) { #ifdef WAVE_HIERFIX char *subst; char ch; #endif GLOBALS->facs[i]=&monolithic_sym[i]; #ifdef WAVE_HIERFIX while((ch=(*subst))) { if(ch==GLOBALS->hier_delimeter) { *subst=VCDNAM_HIERSORT; } /* forces sort at hier boundaries */ subst++; } #endif } /* SPLASH */ splash_sync(3, 5); fprintf(stderr, AET2_RDLOAD"Sorting facilities at hierarchy boundaries.\n"); wave_heapsort(GLOBALS->facs,GLOBALS->numfacs); #ifdef WAVE_HIERFIX for(i=0;i<GLOBALS->numfacs;i++) { char *subst, ch; subst=GLOBALS->facs[i]->name; while((ch=(*subst))) { if(ch==VCDNAM_HIERSORT) { *subst=GLOBALS->hier_delimeter; } /* restore back to normal */ subst++; } } #endif GLOBALS->facs_are_sorted=1; /* SPLASH */ splash_sync(4, 5); fprintf(stderr, AET2_RDLOAD"Building facility hierarchy tree.\n"); init_tree(); for(i=0;i<GLOBALS->numfacs;i++) { build_tree_from_name(GLOBALS->facs[i]->name, i); } /* SPLASH */ splash_sync(5, 5); treegraft(&GLOBALS->treeroot); treesort(GLOBALS->treeroot, NULL); } if(GLOBALS->ae2_time_xlate) /* GLOBALS->ae2_time_xlate is currently unused, but could be again in the future */ { GLOBALS->min_time = GLOBALS->ae2_time_xlate[0]; GLOBALS->max_time = GLOBALS->ae2_time_xlate[last_cycle - first_cycle]; } else { GLOBALS->min_time = first_cycle; GLOBALS->max_time=last_cycle; } GLOBALS->ae2_start_cyc = GLOBALS->ae2_start_limit_cyc = first_cycle; GLOBALS->ae2_end_cyc = GLOBALS->ae2_end_limit_cyc = last_cycle; GLOBALS->is_lx2 = LXT2_IS_AET2; if(skip_start || skip_end) { TimeType b_start, b_end; TimeType lim_idx; if(!skip_start) b_start = GLOBALS->min_time; else b_start = unformat_time(skip_start, GLOBALS->time_dimension); if(!skip_end) b_end = GLOBALS->max_time; else b_end = unformat_time(skip_end, GLOBALS->time_dimension); if(b_start<GLOBALS->min_time) b_start = GLOBALS->min_time; else if(b_start>GLOBALS->max_time) b_start = GLOBALS->max_time; if(b_end<GLOBALS->min_time) b_end = GLOBALS->min_time; else if(b_end>GLOBALS->max_time) b_end = GLOBALS->max_time; if(b_start > b_end) { TimeType tmp_time = b_start; b_start = b_end; b_end = tmp_time; } GLOBALS->min_time = b_start; GLOBALS->max_time = b_end; if(GLOBALS->ae2_time_xlate) /* GLOBALS->ae2_time_xlate is currently unused, but could be again in the future */ { for(lim_idx = first_cycle; lim_idx <= last_cycle; lim_idx++) { if(GLOBALS->ae2_time_xlate[lim_idx - first_cycle] <= GLOBALS->min_time) { GLOBALS->ae2_start_limit_cyc = lim_idx; } if(GLOBALS->ae2_time_xlate[lim_idx - first_cycle] >= GLOBALS->min_time) { break; } } for(; lim_idx <= last_cycle; lim_idx++) { if(GLOBALS->ae2_time_xlate[lim_idx - first_cycle] >= GLOBALS->max_time) { GLOBALS->ae2_end_limit_cyc = lim_idx; break; } } } } fprintf(stderr, AET2_RDLOAD"["TTFormat"] start time.\n"AET2_RDLOAD"["TTFormat"] end time.\n", GLOBALS->min_time, GLOBALS->max_time); /* SPLASH */ splash_finalize(); return(GLOBALS->max_time); }
int traverse_vector_nodes(Trptr t) { int i; int cvt_ok = 0; if((t->t_filter) && (t->flags & TR_TTRANSLATED) && (t->vector) && (!t->t_filter_converted)) { #if !defined _MSC_VER && !defined __MINGW32__ int rc = save_nodes_to_trans(GLOBALS->ttrans_filter[t->t_filter]->sout, t); #else int rc = save_nodes_to_trans((FILE *)(GLOBALS->ttrans_filter[t->t_filter]->g_hChildStd_IN_Wr), t); #endif if(rc == VCDSAV_OK) { int is_finish = 0; bvptr prev_transaction_trace = NULL; while(!is_finish) { struct VectorEnt *vt_head = NULL, *vt_curr = NULL; struct VectorEnt *vt; struct VectorEnt *vprev; bvptr bv; int regions = 2; TimeType prev_tim = LLDescriptor(-1); char *trace_name = NULL; char *orig_name = t->n.vec->bvname; cvt_ok = 1; vt_head = vt_curr = vt = calloc_2(1, sizeof(struct VectorEnt)); vt->time = LLDescriptor(-2); vprev = vt; /* for duplicate removal */ vt_curr = vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt)); vt->time = LLDescriptor(-1); for(;;) { char buf[1025]; char *pnt, *rtn; #if !defined _MSC_VER && !defined __MINGW32__ if(feof(GLOBALS->ttrans_filter[t->t_filter]->sin)) break; /* should never happen */ buf[0] = 0; pnt = fgets(buf, 1024, GLOBALS->ttrans_filter[t->t_filter]->sin); if(!pnt) break; rtn = pnt; while(*rtn) { if((*rtn == '\n') || (*rtn == '\r')) { *rtn = 0; break; } rtn++; } #else { BOOL bSuccess; DWORD dwRead; int n; for(n=0;n<1024;n++) { do { bSuccess = ReadFile(GLOBALS->ttrans_filter[t->t_filter]->g_hChildStd_OUT_Rd, buf+n, 1, &dwRead, NULL); if((!bSuccess)||(buf[n]=='\n')) { goto ex; } } while(buf[n]=='\r'); } ex: buf[n] = 0; pnt = buf; } #endif while(*pnt) { if(isspace((int)(unsigned char)*pnt)) pnt++; else break;} if(*pnt=='#') { TimeType tim = atoi_64(pnt+1) * GLOBALS->time_scale; int slen; char *sp; while(*pnt) { if(!isspace((int)(unsigned char)*pnt)) pnt++; else break; } while(*pnt) { if(isspace((int)(unsigned char)*pnt)) pnt++; else break; } sp = pnt; slen = strlen(sp); if(slen) { pnt = sp + slen - 1; do { if(isspace((int)(unsigned char)*pnt)) { *pnt = 0; pnt--; slen--; } else { break; } } while(pnt != (sp-1)); } vt = calloc_2(1, sizeof(struct VectorEnt) + slen); if(sp) strcpy((char *)vt->v, sp); if(tim > prev_tim) { prev_tim = vt->time = tim; vt_curr->next = vt; vt_curr = vt; vprev = vprev->next; /* bump forward the -2 node pointer */ regions++; } else if(tim == prev_tim) { vt->time = prev_tim; free_2(vt_curr); vt_curr = vprev->next = vt; /* splice new one in -1 node place */ } else { free_2(vt); /* throw it away */ } continue; } else if((*pnt=='M')||(*pnt=='m')) { pnt++; if(((*pnt>='A')&&(*pnt<='Z')) || ((*pnt>='a')&&(*pnt<='z'))) { int which_marker = ((*pnt>='A')&&(*pnt<='Z')) ? (*pnt - 'A') : (*pnt - 'a'); TimeType tim = atoi_64(pnt+1) * GLOBALS->time_scale; int slen; char *sp; if(tim < LLDescriptor(0)) tim = LLDescriptor(-1); GLOBALS->named_markers[which_marker] = tim; while(*pnt) { if(!isspace((int)(unsigned char)*pnt)) pnt++; else break; } while(*pnt) { if(isspace((int)(unsigned char)*pnt)) pnt++; else break; } sp = pnt; slen = strlen(sp); if(slen) { pnt = sp + slen - 1; do { if(isspace((int)(unsigned char)*pnt)) { *pnt = 0; pnt--; slen--; } else { break; } } while(pnt != (sp-1)); } if(GLOBALS->marker_names[which_marker]) free_2(GLOBALS->marker_names[which_marker]); GLOBALS->marker_names[which_marker] = (sp && (*sp) && (tim >= LLDescriptor(0))) ? strdup_2(sp) : NULL; } continue; } else if(*pnt == '$') { if(!strncmp(pnt+1, "finish", 6)) { is_finish = 1; break; } else if(!strncmp(pnt+1, "next", 4)) { break; } else if(!strncmp(pnt+1, "name", 4)) { int slen; char *sp; pnt+=5; while(*pnt) { if(isspace((int)(unsigned char)*pnt)) pnt++; else break; } sp = pnt; slen = strlen(sp); if(slen) { pnt = sp + slen - 1; do { if(isspace((int)(unsigned char)*pnt)) { *pnt = 0; pnt--; slen--; } else { break; } } while(pnt != (sp-1)); } if(sp && *sp) { if(trace_name) free_2(trace_name); trace_name = strdup_2(sp); } } } } vt_curr = vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt)); vt->time = MAX_HISTENT_TIME - 1; regions++; /* vt_curr = */ vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt)); /* scan-build */ vt->time = MAX_HISTENT_TIME; regions++; bv = calloc_2(1, sizeof(struct BitVector) + (sizeof(vptr) * (regions-1))); bv->bvname = strdup_2(trace_name ? trace_name : orig_name); bv->nbits = 1; bv->numregions = regions; bv->bits = t->n.vec->bits; vt = vt_head; for(i=0;i<regions;i++) { bv->vectors[i] = vt; vt = vt->next; } if(!prev_transaction_trace) { prev_transaction_trace = bv; bv->transaction_cache = t->n.vec; /* for possible restore later */ t->n.vec = bv; t->t_filter_converted = 1; if(trace_name) /* if NULL, no need to regen display as trace name didn't change */ { t->name = t->n.vec->bvname; if(GLOBALS->hier_max_level) t->name = hier_extract(t->name, GLOBALS->hier_max_level); regen_display(); } } else { prev_transaction_trace->transaction_chain = bv; prev_transaction_trace = bv; } } } else { /* failed */ t->flags &= ~(TR_TTRANSLATED|TR_ANALOGMASK); } } return(cvt_ok); }
/* * mainline */ TimeType vzt_main(char *fname, char *skip_start, char *skip_end) { int i; struct Node *n; struct symbol *s, *prevsymroot=NULL, *prevsym=NULL; signed char scale; unsigned int numalias = 0; struct symbol *sym_block = NULL; struct Node *node_block = NULL; char **f_name = NULL; GLOBALS->vzt_vzt_c_1 = vzt_rd_init_smp(fname, GLOBALS->num_cpus); if(!GLOBALS->vzt_vzt_c_1) { return(LLDescriptor(0)); /* look at GLOBALS->vzt_vzt_c_1 in caller for success status... */ } /* SPLASH */ splash_create(); vzt_rd_process_blocks_linearly(GLOBALS->vzt_vzt_c_1, 1); /* vzt_rd_set_max_block_mem_usage(vzt, 0); */ scale=(signed char)vzt_rd_get_timescale(GLOBALS->vzt_vzt_c_1); exponent_to_time_scale(scale); GLOBALS->global_time_offset = vzt_rd_get_timezero(GLOBALS->vzt_vzt_c_1); GLOBALS->numfacs=vzt_rd_get_num_facs(GLOBALS->vzt_vzt_c_1); GLOBALS->mvlfacs_vzt_c_3=(struct fac *)calloc_2(GLOBALS->numfacs,sizeof(struct fac)); f_name = calloc_2(F_NAME_MODULUS+1,sizeof(char *)); GLOBALS->vzt_table_vzt_c_1=(struct lx2_entry *)calloc_2(GLOBALS->numfacs, sizeof(struct lx2_entry)); sym_block = (struct symbol *)calloc_2(GLOBALS->numfacs, sizeof(struct symbol)); node_block=(struct Node *)calloc_2(GLOBALS->numfacs,sizeof(struct Node)); for(i=0;i<GLOBALS->numfacs;i++) { GLOBALS->mvlfacs_vzt_c_3[i].node_alias=vzt_rd_get_fac_rows(GLOBALS->vzt_vzt_c_1, i); node_block[i].msi=vzt_rd_get_fac_msb(GLOBALS->vzt_vzt_c_1, i); node_block[i].lsi=vzt_rd_get_fac_lsb(GLOBALS->vzt_vzt_c_1, i); GLOBALS->mvlfacs_vzt_c_3[i].flags=vzt_rd_get_fac_flags(GLOBALS->vzt_vzt_c_1, i); GLOBALS->mvlfacs_vzt_c_3[i].len=vzt_rd_get_fac_len(GLOBALS->vzt_vzt_c_1, i); } fprintf(stderr, VZT_RDLOAD"Finished building %d facs.\n", GLOBALS->numfacs); /* SPLASH */ splash_sync(1, 5); GLOBALS->first_cycle_vzt_c_3 = (TimeType) vzt_rd_get_start_time(GLOBALS->vzt_vzt_c_1) * GLOBALS->time_scale; GLOBALS->last_cycle_vzt_c_3 = (TimeType) vzt_rd_get_end_time(GLOBALS->vzt_vzt_c_1) * GLOBALS->time_scale; GLOBALS->total_cycles_vzt_c_3 = GLOBALS->last_cycle_vzt_c_3 - GLOBALS->first_cycle_vzt_c_3 + 1; /* do your stuff here..all useful info has been initialized by now */ if(!GLOBALS->hier_was_explicitly_set) /* set default hierarchy split char */ { GLOBALS->hier_delimeter='.'; } if(GLOBALS->numfacs) { char *fnam = vzt_rd_get_facname(GLOBALS->vzt_vzt_c_1, 0); int flen = strlen(fnam); f_name[0]=malloc_2(flen+1); strcpy(f_name[0], fnam); } for(i=0;i<GLOBALS->numfacs;i++) { char buf[65537]; char *str; struct fac *f; if(i!=(GLOBALS->numfacs-1)) { char *fnam = vzt_rd_get_facname(GLOBALS->vzt_vzt_c_1, i+1); int flen = strlen(fnam); f_name[(i+1)&F_NAME_MODULUS]=malloc_2(flen+1); strcpy(f_name[(i+1)&F_NAME_MODULUS], fnam); } if(i>1) { free_2(f_name[(i-2)&F_NAME_MODULUS]); f_name[(i-2)&F_NAME_MODULUS] = NULL; } if(GLOBALS->mvlfacs_vzt_c_3[i].flags&VZT_RD_SYM_F_ALIAS) { int alias = GLOBALS->mvlfacs_vzt_c_3[i].node_alias; f=GLOBALS->mvlfacs_vzt_c_3+alias; while(f->flags&VZT_RD_SYM_F_ALIAS) { f=GLOBALS->mvlfacs_vzt_c_3+f->node_alias; } numalias++; } else { f=GLOBALS->mvlfacs_vzt_c_3+i; } if((f->len>1)&& (!(f->flags&(VZT_RD_SYM_F_INTEGER|VZT_RD_SYM_F_DOUBLE|VZT_RD_SYM_F_STRING))) ) { int len=sprintf(buf, "%s[%d:%d]", f_name[(i)&F_NAME_MODULUS],node_block[i].msi, node_block[i].lsi); str=malloc_2(len+1); if(!GLOBALS->alt_hier_delimeter) { strcpy(str, buf); } else { strcpy_vcdalt(str, buf, GLOBALS->alt_hier_delimeter); } s=&sym_block[i]; symadd_name_exists_sym_exists(s,str,0); prevsymroot = prevsym = NULL; } else { int gatecmp = (f->len==1) && (!(f->flags&(VZT_RD_SYM_F_INTEGER|VZT_RD_SYM_F_DOUBLE|VZT_RD_SYM_F_STRING))) && (node_block[i].msi!=-1) && (node_block[i].lsi!=-1); int revcmp = gatecmp && (i) && (!strcmp(f_name[(i)&F_NAME_MODULUS], f_name[(i-1)&F_NAME_MODULUS])); if(gatecmp) { int len = sprintf(buf, "%s[%d]", f_name[(i)&F_NAME_MODULUS],node_block[i].msi); str=malloc_2(len+1); if(!GLOBALS->alt_hier_delimeter) { strcpy(str, buf); } else { strcpy_vcdalt(str, buf, GLOBALS->alt_hier_delimeter); } s=&sym_block[i]; symadd_name_exists_sym_exists(s,str,0); if((prevsym)&&(revcmp)&&(!strchr(f_name[(i)&F_NAME_MODULUS], '\\'))) /* allow chaining for search functions.. */ { prevsym->vec_root = prevsymroot; prevsym->vec_chain = s; s->vec_root = prevsymroot; prevsym = s; } else { prevsymroot = prevsym = s; } } else { str=malloc_2(strlen(f_name[(i)&F_NAME_MODULUS])+1); if(!GLOBALS->alt_hier_delimeter) { strcpy(str, f_name[(i)&F_NAME_MODULUS]); } else { strcpy_vcdalt(str, f_name[(i)&F_NAME_MODULUS], GLOBALS->alt_hier_delimeter); } s=&sym_block[i]; symadd_name_exists_sym_exists(s,str,0); prevsymroot = prevsym = NULL; if(f->flags&VZT_RD_SYM_F_INTEGER) { node_block[i].msi=31; node_block[i].lsi=0; GLOBALS->mvlfacs_vzt_c_3[i].len=32; } } } n=&node_block[i]; n->nname=s->name; n->mv.mvlfac = GLOBALS->mvlfacs_vzt_c_3+i; GLOBALS->mvlfacs_vzt_c_3[i].working_node = n; if((f->len>1)||(f->flags&(VZT_RD_SYM_F_DOUBLE|VZT_RD_SYM_F_STRING))) { n->extvals = 1; } n->head.time=-1; /* mark 1st node as negative time */ n->head.v.h_val=AN_X; s->n=n; } for(i=0;i<=F_NAME_MODULUS;i++) { if(f_name[(i)&F_NAME_MODULUS]) { free_2(f_name[(i)&F_NAME_MODULUS]); f_name[(i)&F_NAME_MODULUS] = NULL; } } free_2(f_name); f_name = NULL; /* SPLASH */ splash_sync(2, 5); GLOBALS->facs=(struct symbol **)malloc_2(GLOBALS->numfacs*sizeof(struct symbol *)); if(GLOBALS->fast_tree_sort) { for(i=0;i<GLOBALS->numfacs;i++) { int len; GLOBALS->facs[i]=&sym_block[i]; if((len=strlen(GLOBALS->facs[i]->name))>GLOBALS->longestname) GLOBALS->longestname=len; } if(numalias) { unsigned int idx_lft = 0; unsigned int idx_lftmax = GLOBALS->numfacs - numalias; unsigned int idx_rgh = GLOBALS->numfacs - numalias; struct symbol **facs_merge=(struct symbol **)malloc_2(GLOBALS->numfacs*sizeof(struct symbol *)); fprintf(stderr, VZT_RDLOAD"Merging in %d aliases.\n", numalias); for(i=0;i<GLOBALS->numfacs;i++) /* fix possible tail appended aliases by remerging in partial one pass merge sort */ { if(strcmp(GLOBALS->facs[idx_lft]->name, GLOBALS->facs[idx_rgh]->name) <= 0) { facs_merge[i] = GLOBALS->facs[idx_lft++]; if(idx_lft == idx_lftmax) { for(i++;i<GLOBALS->numfacs;i++) { facs_merge[i] = GLOBALS->facs[idx_rgh++]; } } } else { facs_merge[i] = GLOBALS->facs[idx_rgh++]; if(idx_rgh == GLOBALS->numfacs) { for(i++;i<GLOBALS->numfacs;i++) { facs_merge[i] = GLOBALS->facs[idx_lft++]; } } } } free_2(GLOBALS->facs); GLOBALS->facs = facs_merge; } /* SPLASH */ splash_sync(3, 5); fprintf(stderr, VZT_RDLOAD"Building facility hierarchy tree.\n"); init_tree(); for(i=0;i<GLOBALS->numfacs;i++) { int esc = 0; char *subst = GLOBALS->facs[i]->name; char ch; while((ch=(*subst))) { if(ch==GLOBALS->hier_delimeter) { if(esc) *subst = VCDNAM_ESCAPE; } else if(ch=='\\') { esc = 1; GLOBALS->escaped_names_found_vcd_c_1 = 1; } subst++; } build_tree_from_name(GLOBALS->facs[i]->name, i); } /* SPLASH */ splash_sync(4, 5); if(GLOBALS->escaped_names_found_vcd_c_1) { for(i=0;i<GLOBALS->numfacs;i++) { char *subst, ch; subst=GLOBALS->facs[i]->name; while((ch=(*subst))) { if(ch==VCDNAM_ESCAPE) { *subst=GLOBALS->hier_delimeter; } /* restore back to normal */ subst++; } } } treegraft(&GLOBALS->treeroot); fprintf(stderr, VZT_RDLOAD"Sorting facility hierarchy tree.\n"); treesort(GLOBALS->treeroot, NULL); /* SPLASH */ splash_sync(5, 5); order_facs_from_treesort(GLOBALS->treeroot, &GLOBALS->facs); if(GLOBALS->escaped_names_found_vcd_c_1) { treenamefix(GLOBALS->treeroot); } GLOBALS->facs_are_sorted=1; } else { for(i=0;i<GLOBALS->numfacs;i++) { char *subst, ch; int len; int esc = 0; GLOBALS->facs[i]=&sym_block[i]; if((len=strlen(subst=GLOBALS->facs[i]->name))>GLOBALS->longestname) GLOBALS->longestname=len; while((ch=(*subst))) { #ifdef WAVE_HIERFIX if(ch==GLOBALS->hier_delimeter) { *subst=(!esc) ? VCDNAM_HIERSORT : VCDNAM_ESCAPE; } /* forces sort at hier boundaries */ #else if((ch==GLOBALS->hier_delimeter)&&(esc)) { *subst = VCDNAM_ESCAPE; } /* forces sort at hier boundaries */ #endif else if(ch=='\\') { esc = 1; GLOBALS->escaped_names_found_vcd_c_1 = 1; } subst++; } } /* SPLASH */ splash_sync(3, 5); fprintf(stderr, VZT_RDLOAD"Sorting facilities at hierarchy boundaries.\n"); wave_heapsort(GLOBALS->facs,GLOBALS->numfacs); #ifdef WAVE_HIERFIX for(i=0;i<GLOBALS->numfacs;i++) { char *subst, ch; subst=GLOBALS->facs[i]->name; while((ch=(*subst))) { if(ch==VCDNAM_HIERSORT) { *subst=GLOBALS->hier_delimeter; } /* restore back to normal */ subst++; } } #endif GLOBALS->facs_are_sorted=1; /* SPLASH */ splash_sync(4, 5); fprintf(stderr, VZT_RDLOAD"Building facility hierarchy tree.\n"); init_tree(); for(i=0;i<GLOBALS->numfacs;i++) { char *nf = GLOBALS->facs[i]->name; build_tree_from_name(nf, i); } /* SPLASH */ splash_sync(5, 5); if(GLOBALS->escaped_names_found_vcd_c_1) { for(i=0;i<GLOBALS->numfacs;i++) { char *subst, ch; subst=GLOBALS->facs[i]->name; while((ch=(*subst))) { if(ch==VCDNAM_ESCAPE) { *subst=GLOBALS->hier_delimeter; } /* restore back to normal */ subst++; } } } treegraft(&GLOBALS->treeroot); treesort(GLOBALS->treeroot, NULL); if(GLOBALS->escaped_names_found_vcd_c_1) { treenamefix(GLOBALS->treeroot); } } GLOBALS->min_time = GLOBALS->first_cycle_vzt_c_3; GLOBALS->max_time=GLOBALS->last_cycle_vzt_c_3; GLOBALS->is_lx2 = LXT2_IS_VZT; if(skip_start || skip_end) { TimeType b_start, b_end; if(!skip_start) b_start = GLOBALS->min_time; else b_start = unformat_time(skip_start, GLOBALS->time_dimension); if(!skip_end) b_end = GLOBALS->max_time; else b_end = unformat_time(skip_end, GLOBALS->time_dimension); if(b_start<GLOBALS->min_time) b_start = GLOBALS->min_time; else if(b_start>GLOBALS->max_time) b_start = GLOBALS->max_time; if(b_end<GLOBALS->min_time) b_end = GLOBALS->min_time; else if(b_end>GLOBALS->max_time) b_end = GLOBALS->max_time; if(b_start > b_end) { TimeType tmp_time = b_start; b_start = b_end; b_end = tmp_time; } if(!vzt_rd_limit_time_range(GLOBALS->vzt_vzt_c_1, b_start, b_end)) { fprintf(stderr, VZT_RDLOAD"--begin/--end options yield zero blocks, ignoring.\n"); vzt_rd_unlimit_time_range(GLOBALS->vzt_vzt_c_1); } else { GLOBALS->min_time = b_start; GLOBALS->max_time = b_end; } } /* SPLASH */ splash_finalize(); return(GLOBALS->max_time); }
/* * mainline */ static TimeType extload_main_2(char *fname, char *skip_start, char *skip_end) { int max_idcode; #ifndef WAVE_FSDB_READER_IS_PRESENT char sbuff[65537]; unsigned int msk = 0; #endif int i; if(!(GLOBALS->extload=fopen(fname, "rb"))) { GLOBALS->extload_already_errored = 1; return(LLDescriptor(0)); /* look at GLOBALS->vzt_vzt_c_1 in caller for success status... */ } fclose(GLOBALS->extload); /* SPLASH */ splash_create(); #ifdef WAVE_FSDB_READER_IS_PRESENT GLOBALS->extload_ffr_ctx = fsdbReaderOpenFile(GLOBALS->loaded_file_name); GLOBALS->is_lx2 = LXT2_IS_FSDB; if(GLOBALS->extload_ffr_ctx) { int rv; int mult; char scale; uint64_t tim; struct fsdbReaderGetStatistics_t *gs; int success_count = 0; int attempt_count = 0; attempt_count++; rv = fsdbReaderExtractScaleUnit(GLOBALS->extload_ffr_ctx, &mult, &scale); if(rv) { GLOBALS->time_scale = mult; GLOBALS->time_dimension = tolower(scale); success_count++; } attempt_count++; rv = fsdbReaderGetMinFsdbTag64(GLOBALS->extload_ffr_ctx, &tim); if(rv) { GLOBALS->min_time = tim; success_count++; } attempt_count++; rv = fsdbReaderGetMaxFsdbTag64(GLOBALS->extload_ffr_ctx, &tim); if(rv) { GLOBALS->max_time = tim; if(GLOBALS->max_time == LLDescriptor(0)) { GLOBALS->max_time = LLDescriptor(1); } success_count++; } attempt_count++; gs = fsdbReaderGetStatistics(GLOBALS->extload_ffr_ctx); if(gs) { GLOBALS->numfacs = gs->varCount; free(gs); success_count++; } attempt_count++; max_idcode = fsdbReaderGetMaxVarIdcode(GLOBALS->extload_ffr_ctx); if(max_idcode) { success_count++; } else { max_idcode = GLOBALS->numfacs; /* for 1.x format files */ success_count++; } if(attempt_count != success_count) { fprintf(stderr, EXTLOAD"Could not initialize '%s' properly.\n", fname); GLOBALS->extload_already_errored = 1; return(LLDescriptor(0)); } } else { fprintf(stderr, EXTLOAD"Could not initialize '%s' properly.\n", fname); GLOBALS->extload_already_errored = 1; return(LLDescriptor(0)); } #else last_modification_check(); sprintf(sbuff, "%s -info %s 2>&1", EXTLOAD_PATH, fname); GLOBALS->extload = popen(sbuff, "r"); for(;;) { char * rc = fgets(sbuff, 65536, GLOBALS->extload); if(!rc) break; switch(rc[0]) { case 's': if(!strncmp("scale unit", rc, 10)) { char *pnt = strchr(rc+10, ':'); if(pnt) { pnt++; GLOBALS->time_scale = atoi(pnt); GLOBALS->time_dimension = 'n'; while(*pnt) { if(isalpha(*pnt)) { GLOBALS->time_dimension = tolower(*pnt); break; } pnt++; } msk |= 1; } } break; case 'm': if(!strncmp("minimum xtag", rc, 12)) { char *pnt = strchr(rc+12, '('); if(pnt) { unsigned int lo = 0, hi = 0; pnt++; sscanf(pnt, "%u %u", &hi, &lo); GLOBALS->min_time = (TimeType)((((UTimeType)hi)<<32) + ((UTimeType)lo)); msk |= 2; } } else if(!strncmp("maximum xtag", rc, 12)) { char *pnt = strchr(rc+12, '('); if(pnt) { unsigned int lo = 0, hi = 0; pnt++; sscanf(pnt, "%u %u", &hi, &lo); GLOBALS->max_time = (TimeType)((((UTimeType)hi)<<32) + ((UTimeType)lo)); if(GLOBALS->max_time == LLDescriptor(0)) { GLOBALS->max_time = LLDescriptor(1); } msk |= 4; } } else if(!strncmp("max var idcode", rc, 14)) { char *pnt = strchr(rc+14, ':'); if(pnt) { pnt++; sscanf(pnt, "%d", &max_idcode); msk |= 8; } } break; case 'v': if(!strncmp("var creation cnt", rc, 16)) { char *pnt = strchr(rc+16, ':'); if(pnt) { pnt++; sscanf(pnt, "%d", &GLOBALS->numfacs); msk |= 16; } } case 'f': if(!strncmp("file status", rc, 11)) { char *pnt = strchr(rc+11, ':'); if(pnt) { pnt++; if(strstr(pnt, "finished")) { msk |= 32; } } } break; default: break; } } pclose(GLOBALS->extload); if(msk != (1+2+4+8+16+32)) { fprintf(stderr, EXTLOAD"Could not initialize '%s' properly.\n", fname); if((msk & (1+2+4+8+16+32)) == (1+2+4+8+16)) { fprintf(stderr, EXTLOAD"File is not finished dumping.\n"); } GLOBALS->extload_already_errored = 1; return(LLDescriptor(0)); } #endif GLOBALS->min_time *= GLOBALS->time_scale; GLOBALS->max_time *= GLOBALS->time_scale; GLOBALS->mvlfacs_vzt_c_3=(struct fac *)calloc_2(GLOBALS->numfacs,sizeof(struct fac)); GLOBALS->vzt_table_vzt_c_1=(struct lx2_entry *)calloc_2(GLOBALS->numfacs, sizeof(struct lx2_entry)); GLOBALS->extload_namecache=(char **)calloc_2(GLOBALS->numfacs, sizeof(char *)); GLOBALS->extload_sym_block = (struct symbol *)calloc_2(GLOBALS->numfacs, sizeof(struct symbol)); GLOBALS->extload_node_block=(struct Node *)calloc_2(GLOBALS->numfacs,sizeof(struct Node)); GLOBALS->extload_idcodes=(unsigned int *)calloc_2(GLOBALS->numfacs, sizeof(unsigned int)); GLOBALS->extload_inv_idcodes=(int *)calloc_2(max_idcode+1, sizeof(int)); /* SPLASH */ splash_sync(1, 5); #ifdef WAVE_FSDB_READER_IS_PRESENT if(!GLOBALS->hier_was_explicitly_set) /* set default hierarchy split char */ { GLOBALS->hier_delimeter='.'; } GLOBALS->extload_xc = fstReaderOpenForUtilitiesOnly(); GLOBALS->extload_i=-1; fsdbReaderReadScopeVarTree(GLOBALS->extload_ffr_ctx, extload_hiertree_callback); process_extload_variable(NULL); /* flush out final cached variable */ decorated_module_cleanup(); /* ...also now in gtk2_treesearch.c */ iter_through_comp_name_table(); for(i=0; ((i<2)&&(i<GLOBALS->numfacs)); i++) { if(GLOBALS->extload_namecache[i]) { free_2(GLOBALS->extload_namecache[i]); GLOBALS->extload_namecache[i] = NULL; } } free_2(GLOBALS->extload_namecache); GLOBALS->extload_namecache = NULL; fstReaderClose(GLOBALS->extload_xc); /* corresponds to fstReaderOpenForUtilitiesOnly() */ #else if(!last_modification_check()) { GLOBALS->extload_already_errored = 1; return(LLDescriptor(0)); } sprintf(sbuff, "%s -hier_tree %s 2>&1", EXTLOAD_PATH, fname); GLOBALS->extload = popen(sbuff, "r"); /* do your stuff here..all useful info has been initialized by now */ if(!GLOBALS->hier_was_explicitly_set) /* set default hierarchy split char */ { GLOBALS->hier_delimeter='.'; } GLOBALS->extload_xc = fstReaderOpenForUtilitiesOnly(); for(GLOBALS->extload_i=-1; (GLOBALS->numfacs) && (GLOBALS->extload_i<GLOBALS->numfacs);) { process_extload_variable(); } while(get_varname(&GLOBALS->extload_vt_prev, NULL, -1)); /* read through end to process all upscopes */ decorated_module_cleanup(); /* ...also now in gtk2_treesearch.c */ iter_through_comp_name_table(); for(i=0; ((i<2)&&(i<GLOBALS->numfacs)); i++) { if(GLOBALS->extload_namecache[i]) { free_2(GLOBALS->extload_namecache[i]); GLOBALS->extload_namecache[i] = NULL; } } free_2(GLOBALS->extload_namecache); GLOBALS->extload_namecache = NULL; pclose(GLOBALS->extload); fstReaderClose(GLOBALS->extload_xc); /* corresponds to fstReaderOpenForUtilitiesOnly() */ #endif /* SPLASH */ splash_sync(2, 5); GLOBALS->facs=(struct symbol **)malloc_2(GLOBALS->numfacs*sizeof(struct symbol *)); if(GLOBALS->fast_tree_sort) { for(i=0; i<GLOBALS->numfacs; i++) { int len; GLOBALS->facs[i]=&GLOBALS->extload_sym_block[i]; if((len=strlen(GLOBALS->facs[i]->name))>GLOBALS->longestname) GLOBALS->longestname=len; } /* SPLASH */ splash_sync(3, 5); fprintf(stderr, EXTLOAD"Building facility hierarchy tree.\n"); init_tree(); for(i=0; i<GLOBALS->numfacs; i++) { build_tree_from_name(GLOBALS->facs[i]->name, i); } /* SPLASH */ splash_sync(4, 5); treegraft(&GLOBALS->treeroot); fprintf(stderr, EXTLOAD"Sorting facility hierarchy tree.\n"); treesort(GLOBALS->treeroot, NULL); /* SPLASH */ splash_sync(5, 5); order_facs_from_treesort(GLOBALS->treeroot, &GLOBALS->facs); GLOBALS->facs_are_sorted=1; } else { for(i=0; i<GLOBALS->numfacs; i++) { char *subst; #ifdef WAVE_HIERFIX char ch; #endif int len; GLOBALS->facs[i]=&GLOBALS->extload_sym_block[i]; subst=GLOBALS->facs[i]->name; if((len=strlen(subst))>GLOBALS->longestname) GLOBALS->longestname=len; #ifdef WAVE_HIERFIX while((ch=(*subst))) { if(ch==GLOBALS->hier_delimeter) { *subst=VCDNAM_HIERSORT; /* forces sort at hier boundaries */ } subst++; } #endif } /* SPLASH */ splash_sync(3, 5); fprintf(stderr, EXTLOAD"Sorting facilities at hierarchy boundaries.\n"); wave_heapsort(GLOBALS->facs,GLOBALS->numfacs); #ifdef WAVE_HIERFIX for(i=0; i<GLOBALS->numfacs; i++) { char *subst, ch; subst=GLOBALS->facs[i]->name; while((ch=(*subst))) { if(ch==VCDNAM_HIERSORT) { *subst=GLOBALS->hier_delimeter; /* restore back to normal */ } subst++; } } #endif GLOBALS->facs_are_sorted=1; /* SPLASH */ splash_sync(4, 5); fprintf(stderr, EXTLOAD"Building facility hierarchy tree.\n"); init_tree(); for(i=0; i<GLOBALS->numfacs; i++) { char *nf = GLOBALS->facs[i]->name; build_tree_from_name(nf, i); } /* SPLASH */ splash_sync(5, 5); treegraft(&GLOBALS->treeroot); treesort(GLOBALS->treeroot, NULL); } if(skip_start || skip_end) { TimeType b_start, b_end; if(!skip_start) b_start = GLOBALS->min_time; else b_start = unformat_time(skip_start, GLOBALS->time_dimension); if(!skip_end) b_end = GLOBALS->max_time; else b_end = unformat_time(skip_end, GLOBALS->time_dimension); if(b_start<GLOBALS->min_time) b_start = GLOBALS->min_time; else if(b_start>GLOBALS->max_time) b_start = GLOBALS->max_time; if(b_end<GLOBALS->min_time) b_end = GLOBALS->min_time; else if(b_end>GLOBALS->max_time) b_end = GLOBALS->max_time; if(b_start > b_end) { TimeType tmp_time = b_start; b_start = b_end; b_end = tmp_time; } GLOBALS->min_time = b_start; GLOBALS->max_time = b_end; } /* SPLASH */ splash_finalize(); return(GLOBALS->max_time); }