void wave_gconf_restore(char **dumpfile, char **savefile, char **rcfile, char **wave_pwd, int *opt_vcd) { char *s; if(dumpfile && savefile && rcfile && wave_pwd && opt_vcd) { if(*dumpfile) { free_2(*dumpfile); *dumpfile = NULL; } s = wave_gconf_client_get_string("/current/dumpfile"); if(s) { if(s[0]) *dumpfile = strdup_2(s); g_free(s); } if(*savefile) { free_2(*savefile); *savefile = NULL; } s = wave_gconf_client_get_string("/current/savefile"); if(s) { if(s[0]) *savefile = strdup_2(s); g_free(s); } if(*rcfile) { free_2(*rcfile); *rcfile = NULL; } s = wave_gconf_client_get_string("/current/rcfile"); if(s) { if(s[0]) *rcfile = strdup_2(s); g_free(s); } if(*wave_pwd) { free_2(*wave_pwd); *wave_pwd = NULL; } s = wave_gconf_client_get_string("/current/pwd"); if(s) { if(s[0]) *wave_pwd = strdup_2(s); g_free(s); } s = wave_gconf_client_get_string("/current/optimized_vcd"); if(s) { if(s[0]) *opt_vcd = atoi(s); g_free(s); } } }
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 str_change_callback(GtkWidget *entry, gpointer which) { G_CONST_RETURN gchar *entry_text; int i; uint32_t hashmask = WAVE_NUM_NAMED_MARKERS; hashmask |= hashmask >> 1; hashmask |= hashmask >> 2; hashmask |= hashmask >> 4; hashmask |= hashmask >> 8; hashmask |= hashmask >> 16; i = ((int) (((intptr_t) which) & hashmask)) % WAVE_NUM_NAMED_MARKERS; GLOBALS->dirty_markerbox_c_1 = 1; entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); if(entry_text && strlen(entry_text)) { if(GLOBALS->shadow_marker_names[i]) { free_2(GLOBALS->shadow_marker_names[i]); } GLOBALS->shadow_marker_names[i] = strdup_2(entry_text); } else { if(GLOBALS->shadow_marker_names[i]) { free_2(GLOBALS->shadow_marker_names[i]); GLOBALS->shadow_marker_names[i] = NULL; } } }
static void set_fac_name_1 (struct tree *t) { for (; t != NULL; t = t->next) { int prev_len = GLOBALS->fac_name_len_ghw_c_1; /* Complete the name. */ if(t->name[0]) /* originally (t->name != NULL) when using pointers */ { int len; len = strlen (t->name) + 1; if (len + GLOBALS->fac_name_len_ghw_c_1 >= GLOBALS->fac_name_max_ghw_c_1) { GLOBALS->fac_name_max_ghw_c_1 *= 2; if (GLOBALS->fac_name_max_ghw_c_1 <= len + GLOBALS->fac_name_len_ghw_c_1) GLOBALS->fac_name_max_ghw_c_1 = len + GLOBALS->fac_name_len_ghw_c_1 + 1; GLOBALS->fac_name_ghw_c_1 = realloc_2(GLOBALS->fac_name_ghw_c_1, GLOBALS->fac_name_max_ghw_c_1); } if(t->name[0] != '[') { GLOBALS->fac_name_ghw_c_1[GLOBALS->fac_name_len_ghw_c_1] = '.'; /* The NUL is copied, since LEN is 1 + strlen. */ memcpy (GLOBALS->fac_name_ghw_c_1 + GLOBALS->fac_name_len_ghw_c_1 + 1, t->name, len); GLOBALS->fac_name_len_ghw_c_1 += len; } else { memcpy (GLOBALS->fac_name_ghw_c_1 + GLOBALS->fac_name_len_ghw_c_1, t->name, len); GLOBALS->fac_name_len_ghw_c_1 += (len - 1); } } if (t->t_which >= 0) { struct symchain *sc = GLOBALS->firstnode; struct symbol *s = sc->symbol; s->name = strdup_2(GLOBALS->fac_name_ghw_c_1); s->n = GLOBALS->nxp_ghw_c_1[t->t_which]; if(!s->n->nname) s->n->nname = s->name; t->t_which = GLOBALS->sym_which_ghw_c_1++; /* patch in gtkwave "which" as node is correct */ GLOBALS->curnode = GLOBALS->firstnode->next; free_2(GLOBALS->firstnode); GLOBALS->firstnode = GLOBALS->curnode; } if (t->child) set_fac_name_1 (t->child); /* Revert name. */ GLOBALS->fac_name_len_ghw_c_1 = prev_len; GLOBALS->fac_name_ghw_c_1[GLOBALS->fac_name_len_ghw_c_1] = 0; } }
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); }
static void writesave_callback(GConfClient* gclient, guint cnxn_id, GConfEntry *entry, gpointer user_data) { if (gconf_entry_get_value (entry) == NULL) { /* value is unset */ } else { if (gconf_entry_get_value (entry)->type == GCONF_VALUE_STRING) { const char *fni = gconf_value_get_string (gconf_entry_get_value (entry)); if(fni && !in_main_iteration()) { int use_arg = strcmp(fni, "+"); /* plus filename uses default */ const char *fn = use_arg ? fni : GLOBALS->filesel_writesave; if(fn) { FILE *wave; if(!(wave=fopen(fn, "wb"))) { fprintf(stderr, "GTKWAVE | RPC Writesave: error opening save file '%s' for writing.\n", fn); perror("Why"); errno=0; } else { write_save_helper(fn, wave); if(use_arg) { if(GLOBALS->filesel_writesave) { free_2(GLOBALS->filesel_writesave); } GLOBALS->filesel_writesave = strdup_2(fn); } wave_gconf_client_set_string("/current/savefile", fn); fclose(wave); fprintf(stderr, "GTKWAVE | RPC Writesave: wrote save file '%s'.\n", GLOBALS->filesel_writesave); } } } gconf_entry_set_value(entry, NULL); } else { /* value is of wrong type */ } } }
static void args_entry_callback(GtkWidget *widget, GtkWidget *entry) { G_CONST_RETURN gchar *entry_text; entry_text=gtk_entry_get_text(GTK_ENTRY(entry)); entry_text = entry_text ? entry_text : ""; if(GLOBALS->ttranslate_args) { free_2(GLOBALS->ttranslate_args); } GLOBALS->ttranslate_args = strdup_2(entry_text); DEBUG(printf("Args Entry contents: %s\n",entry_text)); }
int f_editor(char *str) { char *path, *pathend; DEBUG(printf("f_editor(\"%s\")\n",str)); path = strchr(str, '\"'); if(path) { path++; if(*path) { pathend = strchr(path, '\"'); if(pathend) { *pathend = 0; if(GLOBALS->editor_name) free_2(GLOBALS->editor_name); GLOBALS->editor_name=(char *)strdup_2(path); } } } return(0); }
static void add_history (struct ghw_handler *h, struct Node *n, int sig_num) { struct HistEnt *he; struct ghw_sig *sig = &h->sigs[sig_num]; union ghw_type *sig_type = sig->type; int flags; int is_vector = 0; #ifdef WAVE_HAS_H_DOUBLE int is_double = 0; #endif if (sig_type == NULL) return; GLOBALS->regions++; switch (sig_type->kind) { case ghdl_rtik_type_b2: if (sig_type->en.wkt == ghw_wkt_bit) { flags = 0; break; } /* FALLTHROUGH */ case ghdl_rtik_type_e8: if (GLOBALS->xlat_1164_ghw_c_1 && sig_type->en.wkt == ghw_wkt_std_ulogic) { flags = 0; break; } /* FALLTHROUGH */ case ghdl_rtik_type_e32: case ghdl_rtik_type_i32: case ghdl_rtik_type_i64: case ghdl_rtik_type_p32: case ghdl_rtik_type_p64: flags = HIST_STRING|HIST_REAL; if (HIST_STRING == 0) { if (!GLOBALS->warned_ghw_c_1) fprintf (stderr, "warning: do not compile with STRICT_VCD\n"); GLOBALS->warned_ghw_c_1 = 1; return; } break; case ghdl_rtik_type_f64: flags = HIST_REAL; break; default: fprintf (stderr, "ghw:add_history: unhandled kind %d\n", sig->type->kind); return; } if(!n->curr) { he=histent_calloc(); he->flags = flags; he->time=-1; he->v.h_vector=NULL; n->head.next=he; n->curr=he; n->head.time = -2; } he=histent_calloc(); he->flags = flags; he->time=h->snap_time; switch (sig_type->kind) { case ghdl_rtik_type_b2: if (sig_type->en.wkt == ghw_wkt_bit) he->v.h_val = sig->val->b2 == 0 ? AN_0 : AN_1; else { he->v.h_vector = (char *)sig->type->en.lits[sig->val->b2]; is_vector = 1; } break; case ghdl_rtik_type_e8: if (GLOBALS->xlat_1164_ghw_c_1 && sig_type->en.wkt == ghw_wkt_std_ulogic) { /* Res: 0->0, 1->X, 2->Z, 3->1 */ static const char map_su2vlg[9] = { /* U */ AN_U, /* X */ AN_X, /* 0 */ AN_0, /* 1 */ AN_1, /* Z */ AN_Z, /* W */ AN_W, /* L */ AN_L, /* H */ AN_H, /* - */ AN_DASH }; he->v.h_val = map_su2vlg[sig->val->e8]; } else { he->v.h_vector = (char *)sig_type->en.lits[sig->val->e8]; is_vector = 1; } break; case ghdl_rtik_type_f64: { #ifdef WAVE_HAS_H_DOUBLE he->v.h_double = sig->val->f64; is_double = 1; #else double *d = malloc_2(sizeof (double)); *d = sig->val->f64; he->v.h_vector = (char *)d; is_vector = 1; #endif } break; case ghdl_rtik_type_i32: case ghdl_rtik_type_p32: sprintf (GLOBALS->asbuf, GHWLD, sig->val->i32); he->v.h_vector = strdup_2(GLOBALS->asbuf); is_vector = 1; break; case ghdl_rtik_type_i64: case ghdl_rtik_type_p64: sprintf (GLOBALS->asbuf, GHWLLD, sig->val->i64); he->v.h_vector = strdup_2(GLOBALS->asbuf); is_vector = 1; break; default: abort (); } /* deglitch */ if(n->curr->time == he->time) { int gl_add = 0; if(n->curr->time) /* filter out time zero glitches */ { gl_add = 1; } GLOBALS->num_glitches_ghw_c_1 += gl_add; if(!(n->curr->flags&HIST_GLITCH)) { if(gl_add) { n->curr->flags|=HIST_GLITCH; /* set the glitch flag */ GLOBALS->num_glitch_regions_ghw_c_1++; } } #ifdef WAVE_HAS_H_DOUBLE if(is_double) { n->curr->v.h_double = he->v.h_double; } else #endif if(is_vector) { if(n->curr->v.h_vector && sig_type->kind != ghdl_rtik_type_b2 && sig_type->kind != ghdl_rtik_type_e8) free_2(n->curr->v.h_vector); n->curr->v.h_vector = he->v.h_vector; /* can't free up this "he" because of block allocation so assume it's dead */ } else { n->curr->v.h_val = he->v.h_val; } return; } else /* look for duplicate dumps of same value at adjacent times */ { if(!is_vector #ifdef WAVE_HAS_H_DOUBLE & !is_double #endif ) { if(n->curr->v.h_val == he->v.h_val) { return; /* can't free up this "he" because of block allocation so assume it's dead */ } } } n->curr->next=he; n->curr=he; }
static void build_hierarchy_array (struct ghw_handler *h, union ghw_type *arr, int dim, const char *pfx, struct tree **res, unsigned int **sig) { union ghw_type *idx; struct ghw_type_array *base = arr->sa.base; char *name = NULL; if (dim == base->nbr_dim) { struct tree *t; sprintf (GLOBALS->asbuf, "%s]", pfx); name = strdup_2(GLOBALS->asbuf); t = build_hierarchy_type (h, base->el, name, sig); if (*res != NULL) (*res)->next = t; *res = t; return; } idx = ghw_get_base_type (base->dims[dim]); switch (idx->kind) { case ghdl_rtik_type_i32: { int32_t v; char *nam; struct ghw_range_i32 *r; /* struct tree *last; */ int len; /* last = NULL; */ r = &arr->sa.rngs[dim]->i32; len = ghw_get_range_length ((union ghw_range *)r); if (len <= 0) break; v = r->left; while (1) { sprintf(GLOBALS->asbuf, "%s%c"GHWLD, pfx, dim == 0 ? '[' : ',', v); nam = strdup_2(GLOBALS->asbuf); build_hierarchy_array (h, arr, dim + 1, nam, res, sig); free_2(nam); if (v == r->right) break; if (r->dir == 0) v++; else v--; } } return; case ghdl_rtik_type_e8: { int32_t v; char *nam; struct ghw_range_e8 *r; /* struct tree *last; */ int len; /* last = NULL; */ r = &arr->sa.rngs[dim]->e8; len = ghw_get_range_length ((union ghw_range *)r); if (len <= 0) break; v = r->left; while (1) { sprintf(GLOBALS->asbuf, "%s%c"GHWLD, pfx, dim == 0 ? '[' : ',', v); nam = strdup_2(GLOBALS->asbuf); build_hierarchy_array (h, arr, dim + 1, nam, res, sig); free_2(nam); if (v == r->right) break; if (r->dir == 0) v++; else v--; } } return; default: fprintf (stderr, "build_hierarchy_array: unhandled type %d\n", idx->kind); abort (); } }
void markerbox(char *title, GtkSignalFunc func) { GtkWidget *entry; GtkWidget *vbox, *hbox, *vbox_g, *label; GtkWidget *button1, *button2, *scrolled_win, *frame, *separator; GtkWidget *table; char labtitle[16]; int i; GLOBALS->cleanup_markerbox_c_4=func; GLOBALS->dirty_markerbox_c_1=0; for(i=0;i<WAVE_NUM_NAMED_MARKERS;i++) { GLOBALS->shadow_markers_markerbox_c_1[i] = GLOBALS->named_markers[i]; GLOBALS->shadow_marker_names[i] = strdup_2(GLOBALS->marker_names[i]); } /* fix problem where ungrab doesn't occur if button pressed + simultaneous accelerator key occurs */ if(GLOBALS->in_button_press_wavewindow_c_1) { gdk_pointer_ungrab(GDK_CURRENT_TIME); } /* create a new modal window */ GLOBALS->window_markerbox_c_4 = gtk_window_new(GLOBALS->disable_window_manager ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL); install_focus_cb(GLOBALS->window_markerbox_c_4, ((char *)&GLOBALS->window_markerbox_c_4) - ((char *)GLOBALS)); gtk_window_set_title(GTK_WINDOW (GLOBALS->window_markerbox_c_4), title); gtkwave_signal_connect(GTK_OBJECT (GLOBALS->window_markerbox_c_4), "delete_event",(GtkSignalFunc) destroy_callback, NULL); vbox = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox); vbox_g = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox_g); table = gtk_table_new (256, 1, FALSE); gtk_widget_show (table); gtk_table_attach (GTK_TABLE (table), vbox, 0, 1, 0, 255, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1); frame = gtk_frame_new (NULL); gtk_container_border_width (GTK_CONTAINER (frame), 3); gtk_widget_show(frame); scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_usize( GTK_WIDGET (scrolled_win), 400, 300); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_show(scrolled_win); gtk_container_add (GTK_CONTAINER (frame), scrolled_win); gtk_container_add (GTK_CONTAINER (vbox), frame); for(i=0;i<WAVE_NUM_NAMED_MARKERS;i++) { char buf[49]; if(i) { separator = gtk_hseparator_new (); gtk_widget_show (separator); gtk_box_pack_start (GTK_BOX (vbox_g), separator, TRUE, TRUE, 0); } make_bijective_marker_id_string(labtitle, i); label=gtk_label_new(labtitle); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (vbox_g), label, TRUE, TRUE, 0); hbox = gtk_hbox_new(FALSE, 0); gtk_widget_show (hbox); GLOBALS->entries_markerbox_c_1[i]=entry = gtk_entry_new_with_max_length (48); gtkwave_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(enter_callback), (void *)((intptr_t) i)); gtkwave_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(change_callback), (void *)((intptr_t) i)); if(GLOBALS->shadow_markers_markerbox_c_1[i]==-1) { sprintf(buf,"<None>"); } else { reformat_time_simple(buf, GLOBALS->shadow_markers_markerbox_c_1[i] + GLOBALS->global_time_offset, GLOBALS->time_dimension); } gtk_entry_set_text (GTK_ENTRY (entry), buf); gtk_widget_show (entry); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); /* string part */ entry = gtk_entry_new_with_max_length (48); if(GLOBALS->shadow_marker_names[i]) gtk_entry_set_text (GTK_ENTRY (entry), GLOBALS->shadow_marker_names[i]); gtk_widget_show (entry); gtkwave_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(str_enter_callback), (void *)((intptr_t) i)); gtkwave_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(str_change_callback), (void *)((intptr_t) i)); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox_g), hbox, TRUE, TRUE, 0); } gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_win), vbox_g); hbox = gtk_hbox_new (FALSE, 1); gtk_widget_show (hbox); gtk_table_attach (GTK_TABLE (table), hbox, 0, 1, 255, 256, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1); button1 = gtk_button_new_with_label ("OK"); gtk_widget_set_usize(button1, 100, -1); gtkwave_signal_connect(GTK_OBJECT (button1), "clicked", GTK_SIGNAL_FUNC(ok_callback), NULL); gtk_widget_show (button1); gtk_container_add (GTK_CONTAINER (hbox), button1); GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT); gtkwave_signal_connect_object (GTK_OBJECT (button1), "realize", (GtkSignalFunc) gtk_widget_grab_default, GTK_OBJECT (button1)); button2 = gtk_button_new_with_label ("Cancel"); gtk_widget_set_usize(button2, 100, -1); gtkwave_signal_connect(GTK_OBJECT (button2), "clicked", GTK_SIGNAL_FUNC(destroy_callback), NULL); GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT); gtk_widget_show (button2); gtk_container_add (GTK_CONTAINER (hbox), button2); gtk_container_add (GTK_CONTAINER (GLOBALS->window_markerbox_c_4), table); /* need this table to keep ok/cancel buttons from stretching! */ gtk_widget_show(GLOBALS->window_markerbox_c_4); wave_gtk_grab_add(GLOBALS->window_markerbox_c_4); }
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.. */ void ttrans_searchbox(char *title) { int i; GtkWidget *scrolled_win; GtkWidget *vbox1, *hbox, *hbox0; GtkWidget *button1, *button5, *button6; gchar *titles[]={"Transaction Process Filter Select"}; GtkWidget *frame2, *frameh, *frameh0; GtkWidget *table; GtkTooltips *tooltips; GtkWidget *label; GtkWidget *entry; if(GLOBALS->is_active_ttranslate_c_2) { gdk_window_raise(GLOBALS->window_ttranslate_c_5->window); return; } GLOBALS->is_active_ttranslate_c_2=1; GLOBALS->current_filter_ttranslate_c_1 = 0; /* create a new modal window */ GLOBALS->window_ttranslate_c_5 = gtk_window_new(GLOBALS->disable_window_manager ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL); install_focus_cb(GLOBALS->window_ttranslate_c_5, ((char *)&GLOBALS->window_ttranslate_c_5) - ((char *)GLOBALS)); gtk_window_set_title(GTK_WINDOW (GLOBALS->window_ttranslate_c_5), title); gtkwave_signal_connect(GTK_OBJECT (GLOBALS->window_ttranslate_c_5), "delete_event",(GtkSignalFunc) destroy_callback, NULL); tooltips=gtk_tooltips_new_2(); table = gtk_table_new (256, 1, FALSE); gtk_widget_show (table); vbox1 = gtk_vbox_new (FALSE, 0); gtk_container_border_width (GTK_CONTAINER (vbox1), 3); gtk_widget_show (vbox1); frame2 = gtk_frame_new (NULL); gtk_container_border_width (GTK_CONTAINER (frame2), 3); gtk_widget_show(frame2); gtk_table_attach (GTK_TABLE (table), frame2, 0, 1, 0, 253, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1); GLOBALS->clist_ttranslate_c_2=gtk_clist_new_with_titles(1,titles); gtk_clist_column_titles_passive(GTK_CLIST(GLOBALS->clist_ttranslate_c_2)); gtk_clist_set_selection_mode(GTK_CLIST(GLOBALS->clist_ttranslate_c_2), GTK_SELECTION_EXTENDED); gtkwave_signal_connect_object (GTK_OBJECT (GLOBALS->clist_ttranslate_c_2), "select_row",GTK_SIGNAL_FUNC(select_row_callback),NULL); gtkwave_signal_connect_object (GTK_OBJECT (GLOBALS->clist_ttranslate_c_2), "unselect_row",GTK_SIGNAL_FUNC(unselect_row_callback),NULL); for(i=0;i<GLOBALS->num_ttrans_filters;i++) { gtk_clist_append(GTK_CLIST(GLOBALS->clist_ttranslate_c_2),(gchar **)&(GLOBALS->ttranssel_filter[i+1])); } gtk_clist_set_column_width(GTK_CLIST(GLOBALS->clist_ttranslate_c_2),0,gtk_clist_optimal_column_width(GTK_CLIST(GLOBALS->clist_ttranslate_c_2),0)); gtk_widget_show (GLOBALS->clist_ttranslate_c_2); scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_set_usize( GTK_WIDGET (scrolled_win), -1, 300); gtk_widget_show(scrolled_win); /* gtk_scrolled_window_add_with_viewport doesn't seen to work right here.. */ gtk_container_add (GTK_CONTAINER (scrolled_win), GLOBALS->clist_ttranslate_c_2); gtk_container_add (GTK_CONTAINER (frame2), scrolled_win); frameh0 = gtk_frame_new (NULL); gtk_container_border_width (GTK_CONTAINER (frameh0), 3); gtk_widget_show(frameh0); gtk_table_attach (GTK_TABLE (table), frameh0, 0, 1, 253, 254, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1); hbox0 = gtk_hbox_new (FALSE, 1); gtk_widget_show (hbox0); button6 = gtk_button_new_with_label (" Add Trans Filter to List "); gtk_container_border_width (GTK_CONTAINER (button6), 3); gtkwave_signal_connect_object (GTK_OBJECT (button6), "clicked",GTK_SIGNAL_FUNC(add_filter_callback),GTK_OBJECT (GLOBALS->window_ttranslate_c_5)); gtk_widget_show (button6); gtk_tooltips_set_tip_2(tooltips, button6, "Bring up a file requester to add a transaction process filter to the filter select window.",NULL); gtk_box_pack_start (GTK_BOX (hbox0), button6, TRUE, FALSE, 0); gtk_container_add (GTK_CONTAINER (frameh0), hbox0); /* args entry box */ { Trptr t=GLOBALS->traces.first; while(t) { if(t->flags&TR_HIGHLIGHT) { if(t->transaction_args) { if(GLOBALS->ttranslate_args) free_2(GLOBALS->ttranslate_args); GLOBALS->ttranslate_args = strdup_2(t->transaction_args); break; } } t=t->t_next; } frameh0 = gtk_frame_new (NULL); gtk_container_border_width (GTK_CONTAINER (frameh0), 3); gtk_widget_show(frameh0); gtk_table_attach (GTK_TABLE (table), frameh0, 0, 1, 254, 255, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1); label=gtk_label_new("Args:"); entry=gtk_entry_new_with_max_length(1025); gtk_entry_set_text(GTK_ENTRY(entry), GLOBALS->ttranslate_args ? GLOBALS->ttranslate_args : ""); gtk_signal_connect (GTK_OBJECT (entry), "activate",GTK_SIGNAL_FUNC (args_entry_callback), entry); gtk_signal_connect (GTK_OBJECT (entry), "changed",GTK_SIGNAL_FUNC (args_entry_callback), entry); hbox0=gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox0), label, FALSE, FALSE, 0); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox0), entry, TRUE, TRUE, 0); gtk_widget_show(entry); gtk_widget_show(hbox0); gtk_container_add (GTK_CONTAINER (frameh0), hbox0); } /* bottom OK/Cancel part */ frameh = gtk_frame_new (NULL); gtk_container_border_width (GTK_CONTAINER (frameh), 3); gtk_widget_show(frameh); gtk_table_attach (GTK_TABLE (table), frameh, 0, 1, 255, 256, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1); hbox = gtk_hbox_new (FALSE, 1); gtk_widget_show (hbox); button1 = gtk_button_new_with_label (" OK "); gtk_container_border_width (GTK_CONTAINER (button1), 3); gtkwave_signal_connect_object (GTK_OBJECT (button1), "clicked",GTK_SIGNAL_FUNC(ok_callback),GTK_OBJECT (GLOBALS->window_ttranslate_c_5)); gtk_widget_show (button1); gtk_tooltips_set_tip_2(tooltips, button1, "Add selected signals to end of the display on the main window.",NULL); gtk_box_pack_start (GTK_BOX (hbox), button1, TRUE, FALSE, 0); button5 = gtk_button_new_with_label (" Cancel "); gtk_container_border_width (GTK_CONTAINER (button5), 3); gtkwave_signal_connect_object (GTK_OBJECT (button5), "clicked",GTK_SIGNAL_FUNC(destroy_callback),GTK_OBJECT (GLOBALS->window_ttranslate_c_5)); gtk_tooltips_set_tip_2(tooltips, button5, "Do nothing and return to the main window.",NULL); gtk_widget_show (button5); gtk_box_pack_start (GTK_BOX (hbox), button5, TRUE, FALSE, 0); gtk_container_add (GTK_CONTAINER (frameh), hbox); gtk_container_add (GTK_CONTAINER (GLOBALS->window_ttranslate_c_5), table); gtk_widget_set_usize(GTK_WIDGET(GLOBALS->window_ttranslate_c_5), 400, 400); gtk_widget_show(GLOBALS->window_ttranslate_c_5); }
int install_ttrans_filter(int which) { int found = 0; if((which<0)||(which>=(PROC_FILTER_MAX+1))) { which = 0; } if(GLOBALS->traces.first) { Trptr t = GLOBALS->traces.first; while(t) { if(t->flags&TR_HIGHLIGHT) { if((!t->vector) && (which)) { bvptr v = combine_traces(1, t); /* down: make single signal a vector */ if(v) { v->transaction_nd = t->n.nd; /* cache for savefile, disable */ t->vector = 1; t->n.vec = v; /* splice in */ } } if((t->vector) && (!(t->flags&(TR_BLANK|TR_ANALOG_BLANK_STRETCH)))) { t->t_filter = which; t->t_filter_converted = 0; /* back out allocation to revert (if any) */ if(t->n.vec->transaction_cache) { int i; bvptr bv = t->n.vec; bvptr bv2; nptr ndcache = NULL; t->n.vec = bv->transaction_cache; if((t->n.vec->transaction_nd) && (!which)) { ndcache = t->n.vec->transaction_nd; } while(bv) { bv2 = bv->transaction_chain; if(bv->bvname) { free_2(bv->bvname); } for(i=0;i<bv->numregions;i++) { free_2(bv->vectors[i]); } free_2(bv); bv = bv2; } t->name = t->n.vec->bvname; if(GLOBALS->hier_max_level) t->name = hier_extract(t->name, GLOBALS->hier_max_level); if(ndcache) { t->n.nd = ndcache; t->vector = 0; /* still need to deallocate old t->n.vec! */ } } if(!which) { t->flags &= (~(TR_TTRANSLATED|TR_ANALOGMASK)); } else { t->flags &= (~(TR_ANALOGMASK)); t->flags |= TR_TTRANSLATED; if(t->transaction_args) free_2(t->transaction_args); if(GLOBALS->ttranslate_args) { t->transaction_args = strdup_2(GLOBALS->ttranslate_args); } else { t->transaction_args = NULL; } traverse_vector_nodes(t); } found++; if(t->t_match) { Trptr curr_trace = t; t = t->t_next; while(t && (t->t_match != curr_trace)) { t = t->t_next; } } } } t=GiveNextTrace(t); } } if(found) { regen_display(); } return(found); }