Codebase list gtkwave / a3e73dc
Imported Upstream version 3.3.6 أحمد المحمودي (Ahmed El-Mahmoudy) 14 years ago
59 changed file(s) with 3209 addition(s) and 692 deletion(s). Raw diff Collapse all Expand all
211211 accel "/Markers/Delete Primary Marker" <Shift><Alt>M
212212 accel "/Markers/<separator>" (null)
213213 accel "/Markers/Wave Scrolling" F9
214 accel "/Markers/Locking/Lock to Lesser Named Marker" 1
215 accel "/Markers/Locking/Lock to Greater Named Marker" 2
216 accel "/Markers/Locking/Unlock from Named Marker" 0
214 accel "/Markers/Locking/Lock to Lesser Named Marker" Q
215 accel "/Markers/Locking/Lock to Greater Named Marker" W
216 accel "/Markers/Locking/Unlock from Named Marker" O
217217 accel "/View/Show Grid" <Alt>G
218218 accel "/View/<separator>" (null)
219219 accel "/View/Show Mouseover" (null)
801801 Removed resolve_lxt_alias_to field from struct fac.
802802 Removed lxt-only lastchange field from struct fac.
803803 Removed unused h field in struct symbol.
804 Removed nextinaet field if unused, recoded to symchain
805 when used.
804 Removed nextinaet field if unused, recoded to symchain when
805 used.
806806 Fixed && used in logical operation for generating ExtNode.
807807 Removed ExtNode, made inline with Node.
808808 Deallocate symbol hash table after no longer needed.
809809 Only allocate hash when necessary.
810810 Added marker vs maxtime marker conflict check in
811 kick_partial_vcd() to ensure signal window values reflect
812 data value rather than x when maxtime scrolls over the
813 marker time and makes the marker visible.
811 kick_partial_vcd() to ensure signal window values reflect data
812 value rather than x when maxtime scrolls over the marker time
813 and makes the marker visible.
814814 More Judy array adds for VCD.
815 Removed sym->selected member and replaced with 1-bit
816 Judy array if enabled.
815 Removed sym->selected member and replaced with 1-bit Judy array
816 if enabled.
817 3.3.6 01may10 Added RealToBits menu options for displaying real numbers as
818 binary values.
819 Added missing break statements to terminate cases in
820 bits2vector().
821 Fixed cut and paste error on FILE_FILTER_MAX versus
822 PROC_FILTER_MAX.
823 Reduced FILE_FILTER_MAX from 1024 down to 128.
824 Added preliminary transaction filter support.
825 Added transaction parser in examples/ directory.
826 Updated time warp handling.
827 Updated print routine to use populateBuffer().
828 Added raise to front when filename selected in filter dialogs
829 as this helps with some window managers.
830 Remove color for translated/transaction traces in black and
831 white mode.
832 Copy gc_grid_wavewindow_c_1 from gccache on reload as this was
833 accidentally overwritten with gc_grid2_wavewindow_c_1 without
834 adding back gc_grid_wavewindow_c_1.
835 Added fstWriterSetTimescaleFromString() to fstapi.c which
836 allows usage of strings such as "1ns" for the timescale.
837 Incorporated FST writer optimizations.
838 Incorporated some fixes suggested by cppcheck.
00 ##########################################################################
11
2 GTKWave 3.3.5 Wave Viewer is Copyright (C) 1999-2010 Tony Bybell.
2 GTKWave 3.3.6 Wave Viewer is Copyright (C) 1999-2010 Tony Bybell.
33 Portions of GTKWave are Copyright (C) 1999-2010 Udi Finkelstein.
44 Context support is Copyright (C) 2007-2010 Kermin Elliott Fleming.
55 Trace group support is Copyright (C) 2009-2010 Donald Baltus.
Binary diff not shown
00 ## -*- makefile -*-
11 ##
22
3 dist_examples_DATA= des.sav des.tcl des.v des.vzt
3 dist_examples_DATA= des.sav des.tcl des.v des.vzt transaction.fst transaction.sav transaction.c
44 examplesdir= $(pkgdatadir)/examples
55
172172 sharedstatedir = @sharedstatedir@
173173 sysconfdir = @sysconfdir@
174174 target_alias = @target_alias@
175 dist_examples_DATA = des.sav des.tcl des.v des.vzt
175 dist_examples_DATA = des.sav des.tcl des.v des.vzt transaction.fst transaction.sav transaction.c
176176 examplesdir = $(pkgdatadir)/examples
177177 all: all-am
178178
0 /*
1 * Copyright (c) 2010 Tony Bybell.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19 * DEALINGS IN THE SOFTWARE.
20 */
21
22 /*
23 * to compile: gcc -o transaction transaction.c
24 * then in this directory run: gtkwave transaction.fst transaction.sav
25 */
26
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #ifdef HAVE_INTTYPES_H
31 #include <inttypes.h>
32 #endif
33
34 #define OPTIONAL_DEBUG if(1)
35
36 /*
37 * some structs we'll be using for event harvesting from the VCD that
38 * gtkwave sends via stdin into this executable
39 */
40 struct tim_t
41 {
42 struct tim_t *next;
43
44 uint64_t tim;
45 int val;
46 int delta;
47 };
48
49 struct event_t
50 {
51 struct event_t *next;
52
53 uint64_t tim;
54 char *name;
55 };
56
57
58 int main(void)
59 {
60 uint64_t min_time = 0, max_time = 0;
61 uint64_t tim = 0;
62 int prevtim = 0;
63 int prevval = 255;
64 struct tim_t *t_head = NULL, *t_curr = NULL;
65 struct tim_t *t_tmp;
66 int hcnt;
67 uint64_t control_start = 0, control_end = 0;
68 int blks;
69
70 struct event_t *hdr_head = NULL, *hdr_curr = NULL;
71 struct event_t *data_head = NULL, *data_curr = NULL;
72
73 OPTIONAL_DEBUG { fprintf(stderr, "*** t_filter executable init ***\n"); }
74
75 top: /* main control loop */
76
77 hcnt = 0;
78 control_start = 0;
79 control_end = 0;
80 blks = 0;
81
82 while(1) /* reading input from stdin until data_end comment received */
83 {
84 char buf[1025];
85 char *pnt = NULL;
86
87 buf[0] = 0;
88 pnt = fgets(buf, 1024, stdin); /* CACHE (VIA puts()) THIS INPUT TO A FILE TO DEVELOP YOUR CLIENT OFFLINE FROM GTKWAVE! */
89
90 if(buf[0])
91 {
92 pnt = buf;
93 while(*pnt) /* strip off end of line character */
94 {
95 if(*pnt != '\n')
96 {
97 pnt++;
98 }
99 else
100 {
101 *pnt = 0;
102 break;
103 }
104 }
105
106 if(buf[0] == '#') /* look for and extract time value */
107 {
108 char *str = buf+1;
109 unsigned char ch;
110
111 tim=0;
112 while((ch=*(str++)))
113 {
114 if((ch>='0')&&(ch<='9'))
115 {
116 tim=(tim*10+(ch&15));
117 }
118 }
119 }
120 else
121 if(buf[0] == 'b') /* extract the binary value of the "val" symbol */
122 {
123 int collect = 0;
124 pnt = buf+1;
125
126 while(*pnt && (*pnt != ' '))
127 {
128 collect <<= 1;
129 collect |= ((*pnt) & 1);
130 pnt++;
131 }
132
133 if((prevval ^ collect) & 128)
134 {
135 t_tmp = calloc(1, sizeof(struct tim_t));
136 t_tmp->tim = tim;
137 t_tmp->val = collect;
138 t_tmp->delta = tim - prevtim;
139
140 prevtim = tim;
141
142 if(!t_curr)
143 {
144 t_head = t_curr = t_tmp;
145 }
146 else
147 {
148 t_curr = t_curr->next = t_tmp;
149 }
150 }
151 prevval = collect;
152 }
153 else
154 if(buf[0] == '$') /* directive processing */
155 {
156 if(strstr(buf, "$comment"))
157 {
158 if((pnt = strstr(buf, "min_time")))
159 {
160 sscanf(pnt + 9, "%"SCNu64, &min_time);
161 OPTIONAL_DEBUG { fprintf(stderr, "min: %d\n", (int)min_time); }
162 }
163 else
164 if((pnt = strstr(buf, "max_time")))
165 {
166 sscanf(pnt + 9, "%"SCNu64, &max_time);
167 OPTIONAL_DEBUG { fprintf(stderr, "max: %d\n", (int)max_time); }
168 }
169 else
170 if(strstr(buf, "data_end"))
171 {
172 break;
173 }
174 }
175 }
176 }
177
178 if(feof(stdin)) /* broken pipe coming up */
179 {
180 OPTIONAL_DEBUG { fprintf(stderr, "*** Terminated t_filter executable\n"); }
181 exit(0);
182 }
183 }
184
185 printf("$name Decoded FSK\n"); /* 1st trace name */
186 printf("#0\n");
187
188 {
189 uint64_t p_tim = 0;
190 int state = 0;
191 int byte_remain = 0;
192 int bcnt = 0;
193
194 t_tmp = t_head;
195 while(t_tmp)
196 {
197 if(t_tmp->delta == 16)
198 {
199 int sync_cnt = 0;
200 uint64_t t_start = p_tim;
201 int i;
202 for(i=0;i<16;i++)
203 {
204 if(t_tmp->delta == 16) { sync_cnt++; p_tim = t_tmp->tim; t_tmp = t_tmp->next; } else { break; }
205 }
206 if(sync_cnt==16)
207 {
208 printf("#%"PRIu64" ?darkblue?Sync\n", t_start); /* write out sync xact */
209 printf("#%"PRIu64"\n", p_tim - 4); /* 'z' midline is no value after time */
210 printf("MA%"PRIu64" Start\n", t_start); /* set position/name for marker A */
211 control_start = t_start;
212 goto found_sync;
213 }
214 continue;
215 }
216 p_tim = t_tmp->tim;
217 t_tmp = t_tmp->next;
218 }
219
220 found_sync:
221
222 state = 0; byte_remain = 11;
223 /* printf("MB%"PRIu64" Num Blocks\n", p_tim); */
224
225 while(t_tmp)
226 {
227 int i;
228 int collect = 0;
229 uint64_t t_start = p_tim;
230
231 if((state == 0) && (byte_remain == 10))
232 {
233 struct event_t *evt = calloc(1, sizeof(struct event_t));
234 char buf[32];
235
236 evt->tim = p_tim;
237 sprintf(buf, "H%d", hcnt/2);
238 evt->name = strdup(buf);
239
240 if(!control_end) { control_end = p_tim; }
241
242 if(!hdr_head) { hdr_head = hdr_curr = evt; }
243 else { hdr_curr = hdr_curr->next = evt; }
244
245 /**/
246 if(data_curr)
247 {
248 evt = calloc(1, sizeof(struct event_t));
249 evt->tim = p_tim;
250 evt->name = NULL;
251
252 data_curr = data_curr->next = evt;
253 }
254 }
255
256 if((state == 1) && (byte_remain == 64))
257 {
258 struct event_t *evt = calloc(1, sizeof(struct event_t));
259 char buf[32];
260
261 evt->tim = p_tim;
262 sprintf(buf, "D%d:", hcnt/2);
263 evt->name = calloc(1, 74);
264 strcpy(evt->name, buf);
265
266 if(!data_head) { data_head = data_curr = evt; }
267 else { data_curr = data_curr->next = evt; }
268
269 /**/
270 if(hdr_curr)
271 {
272 evt = calloc(1, sizeof(struct event_t));
273 evt->tim = p_tim;
274 evt->name = NULL;
275
276 hdr_curr = hdr_curr->next = evt;
277 }
278
279 hcnt++;
280 }
281
282
283 for(i=0;(t_tmp) && (i<8);i++)
284 {
285 collect <<= 1;
286 if(t_tmp->delta == 16)
287 {
288 collect |= 1;
289 t_tmp = t_tmp->next;
290 }
291 else
292 {
293 }
294
295 p_tim = t_tmp->tim; t_tmp = t_tmp->next;
296 }
297
298 if(!bcnt)
299 {
300 printf("#%"PRIu64" ?gray24?%02X\n", t_start, collect);
301 blks = collect;
302 bcnt++;
303 }
304 else
305 {
306 if(state == 1)
307 {
308 char conv = ((collect < ' ') || (collect >= 127)) ? '.' : collect;
309 int slen = strlen(data_curr->name);
310
311 data_curr->name[slen] = conv;
312
313 if((collect >= ' ') && (collect < 127))
314 {
315 printf("#%"PRIu64" ?darkgreen?%c\n", t_start, (unsigned char)collect);
316 }
317 else
318 {
319 printf("#%"PRIu64" ?darkred?%02X\n", t_start, collect);
320 }
321
322 }
323 else
324 {
325 printf("#%"PRIu64" ?purple3?%02X\n", t_start, collect);
326 }
327 }
328
329 printf("#%"PRIu64"\n", p_tim - 4);
330
331 byte_remain--;
332 if(!byte_remain)
333 {
334 if(state == 0)
335 {
336 state = 1; byte_remain = 64;
337 }
338 else
339 {
340 state = 0; byte_remain = 10;
341 }
342 }
343
344 }
345
346 }
347
348 t_tmp = t_head; /* free up memory allocated */
349 while(t_tmp)
350 {
351 t_curr = t_tmp->next;
352 free(t_tmp);
353 t_tmp = t_curr;
354 }
355 t_head = t_curr = NULL;
356
357 printf("$next\n"); /* indicate there is a next trace */
358 printf("$name Control\n"); /* next trace name */
359 printf("#0\n");
360 printf("#%"PRIu64" ?darkblue?%02X blks\n", control_start, blks);
361 printf("#%"PRIu64"\n", control_end);
362
363
364 printf("$next\n"); /* indicate there is a next trace */
365 printf("$name Headers\n"); /* next trace name */
366 printf("#0\n");
367 while(hdr_head)
368 {
369 if(hdr_head->name)
370 {
371 printf("#%"PRIu64" ?purple3?%s\n", hdr_head->tim, hdr_head->name);
372 free(hdr_head->name);
373 }
374 else
375 {
376 printf("#%"PRIu64"\n", hdr_head->tim);
377 }
378
379 hdr_curr = hdr_head->next;
380 free(hdr_head);
381 hdr_head = hdr_curr;
382 }
383
384
385 printf("$next\n"); /* indicate there is a next trace */
386 printf("$name Data Payload\n"); /* next trace name */
387 printf("#0\n");
388 while(data_head)
389 {
390 if(data_head->name)
391 {
392 printf("#%"PRIu64" ?darkgreen?%s\n", data_head->tim, data_head->name);
393 free(data_head->name);
394 }
395 else
396 {
397 printf("#%"PRIu64"\n", data_head->tim);
398 }
399
400 data_curr = data_head->next;
401 free(data_head);
402 data_head = data_curr;
403 }
404
405
406
407 printf("$finish\n"); /* directive to return control to gtkwave */
408 fflush(stdout); /* ensure nothing is stuck in output buffers which could hang gtkwave */
409
410 OPTIONAL_DEBUG { fprintf(stderr, "back to gtkwave...\n"); }
411
412 goto top; /* loop forever in order to process next xact query */
413
414 return(0);
415 }
Binary diff not shown
0 [timestart] 196429
1 [size] 1000 600
2 [pos] -1 -1
3 *-10.463677 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
4 @90022
5 top.val[7:0]
6 @20000
7 -
8 -
9 -
10 -
11 -
12 -
13 @10c00022
14 ^<1 ./transaction
15 #{top.val[7:0]} (0)top.val[7:0] (1)top.val[7:0] (2)top.val[7:0] (3)top.val[7:0] (4)top.val[7:0] (5)top.val[7:0] (6)top.val[7:0] (7)top.val[7:0]
16 @c00022
17 top.val[7:0]
18 @28
19 (0)top.val[7:0]
20 (1)top.val[7:0]
21 (2)top.val[7:0]
22 (3)top.val[7:0]
23 (4)top.val[7:0]
24 (5)top.val[7:0]
25 (6)top.val[7:0]
26 (7)top.val[7:0]
27 @1401200
28 -group_end
29 -group_end
30 @200
31 -
32 -
33 -
34 -
35 [pattern_trace] 1
36 [pattern_trace] 0
2828 regex.c regex_wave.h renderopt.c rgb.c search.c shiftbuttons.c showchange.c \
2929 signalwindow.c simplereq.c splash.c status.c strace.c strace.h symbol.c symbol.h \
3030 tcl_commands.c tcl_helper.c tcl_helper.h tcl_np.c tcl_np.h tcl_support_commands.c tcl_support_commands.h \
31 timeentry.c translate.c translate.h tree.c tree.h treesearch.c vcd.c vcd.h vcd_keywords.c \
31 timeentry.c translate.c translate.h tree.c tree.h treesearch.c \
32 ttranslate.c ttranslate.h vcd.c vcd.h vcd_keywords.c \
3233 vcd_partial.c vcd_recoder.c vcd_saver.c vcd_saver.h vlist.c vlist.h vzt.c vzt.h wavealloca.h \
3334 wavewindow.c zoombuttons.c ./liblzma/libgwlzma.a ./helpers/fst/libfst.a
3435
6969 tcl_commands.$(OBJEXT) tcl_helper.$(OBJEXT) tcl_np.$(OBJEXT) \
7070 tcl_support_commands.$(OBJEXT) timeentry.$(OBJEXT) \
7171 translate.$(OBJEXT) tree.$(OBJEXT) treesearch.$(OBJEXT) \
72 vcd.$(OBJEXT) vcd_keywords.$(OBJEXT) vcd_partial.$(OBJEXT) \
73 vcd_recoder.$(OBJEXT) vcd_saver.$(OBJEXT) vlist.$(OBJEXT) \
74 vzt.$(OBJEXT) wavewindow.$(OBJEXT) zoombuttons.$(OBJEXT)
72 ttranslate.$(OBJEXT) vcd.$(OBJEXT) vcd_keywords.$(OBJEXT) \
73 vcd_partial.$(OBJEXT) vcd_recoder.$(OBJEXT) \
74 vcd_saver.$(OBJEXT) vlist.$(OBJEXT) vzt.$(OBJEXT) \
75 wavewindow.$(OBJEXT) zoombuttons.$(OBJEXT)
7576 gtkwave_OBJECTS = $(am_gtkwave_OBJECTS)
7677 am__DEPENDENCIES_1 =
7778 am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
239240 regex.c regex_wave.h renderopt.c rgb.c search.c shiftbuttons.c showchange.c \
240241 signalwindow.c simplereq.c splash.c status.c strace.c strace.h symbol.c symbol.h \
241242 tcl_commands.c tcl_helper.c tcl_helper.h tcl_np.c tcl_np.h tcl_support_commands.c tcl_support_commands.h \
242 timeentry.c translate.c translate.h tree.c tree.h treesearch.c vcd.c vcd.h vcd_keywords.c \
243 timeentry.c translate.c translate.h tree.c tree.h treesearch.c \
244 ttranslate.c ttranslate.h vcd.c vcd.h vcd_keywords.c \
243245 vcd_partial.c vcd_recoder.c vcd_saver.c vcd_saver.h vlist.c vlist.h vzt.c vzt.h wavealloca.h \
244246 wavewindow.c zoombuttons.c ./liblzma/libgwlzma.a ./helpers/fst/libfst.a
245247
386388 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/translate.Po@am__quote@
387389 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tree.Po@am__quote@
388390 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/treesearch.Po@am__quote@
391 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttranslate.Po@am__quote@
389392 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/twinwave.Po@am__quote@
390393 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcd.Po@am__quote@
391394 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcd_keywords.Po@am__quote@
99 #ifndef WAVE_AE2RDR_H
1010 #define WAVE_AE2RDR_H
1111
12 #ifndef _MSC_VER
12 #ifdef HAVE_INTTYPES_H
1313 #include <inttypes.h>
1414 #endif
1515 #include "vcd.h"
8585 #endif
8686
8787 /*
88 * $Id: ae2.h,v 1.6 2008/09/27 19:08:39 gtkwave Exp $
88 * $Id: ae2.h,v 1.7 2010/04/27 23:10:56 gtkwave Exp $
8989 * $Log: ae2.h,v $
90 * Revision 1.7 2010/04/27 23:10:56 gtkwave
91 * made inttype.h inclusion conditional
92 *
9093 * Revision 1.6 2008/09/27 19:08:39 gtkwave
9194 * compiler warning fixes
9295 *
2323 #include "strace.h"
2424 #include "translate.h"
2525 #include "ptranslate.h"
26 #include "ttranslate.h"
2627 #include "hierpack.h"
2728 #include "analyzer.h"
2829
2930 #ifdef _MSC_VER
3031 #define strcasecmp _stricmp
3132 #endif
33
34 void UpdateTraceSelection(Trptr t);
3235
3336
3437 /*
229232 if(GLOBALS->default_flags & TR_PTRANSLATED)
230233 {
231234 t->p_filter = GLOBALS->current_translate_proc;
235 }
236
237 /* NOT an else! */
238 if(GLOBALS->default_flags & TR_TTRANSLATED)
239 {
240 t->t_filter = GLOBALS->current_translate_ttrans;
241 traverse_vector_nodes(t);
232242 }
233243
234244 if (IsGroupBegin(t)) {
548558 if( t == NULL )
549559 {
550560 fprintf( stderr, "Out of memory, can't add %s to analyzer\n",
551 vec->name );
561 vec->bvname );
552562 return( 0 );
553563 }
554564
559569 }
560570 else
561571 {
562 t->name = vec->name;
572 t->name = vec->bvname;
563573 }
564574
565575 if(GLOBALS->hier_max_level)
595605
596606 if(t->vector)
597607 {
598 bvptr bv;
608 bvptr bv, bv2;
599609 int i;
600610
601611 bv=t->n.vec;
612 /* back out allocation to revert (if any) */
613 if(bv->transaction_cache)
614 {
615 t->n.vec = bv->transaction_cache;
616
617 while(bv)
618 {
619 bv2 = bv->transaction_chain;
620 if(bv->bvname) { free_2(bv->bvname); }
621
622 for(i=0;i<bv->numregions;i++)
623 {
624 free_2(bv->vectors[i]);
625 }
626
627 free_2(bv);
628 bv = bv2;
629 }
630
631 bv=t->n.vec;
632 }
633
634 /* normal vector deallocation */
602635 for(i=0;i<bv->numregions;i++)
603636 {
604637 if(bv->vectors[i]) free_2(bv->vectors[i]);
615648 free_2(bv->bits);
616649 }
617650
618 if(bv->name) free_2(bv->name);
651 if(bv->bvname) free_2(bv->bvname);
619652 if(t->n.vec) free_2(t->n.vec);
620653 }
621654 else
12141247 return(1);
12151248 }
12161249
1217 /* propogate selection info down into groups */
1218 void UpdateTraceSelection(Trptr t)
1219 {
1220 if ((t->t_match) && (IsGroupBegin(t) || IsGroupEnd(t)) && (IsSelected(t) || IsSelected(t->t_match)))
1221 {
1222 t->flags |= TR_HIGHLIGHT;
1223 t->t_match->flags |= TR_HIGHLIGHT;
1224 }
1225 if ((t->t_grp) && IsSelected(t->t_grp))
1226 {
1227 t->flags |= TR_HIGHLIGHT;
1228 }
1229 }
12301250
12311251 Trptr GiveNextTrace(Trptr t)
12321252 {
1253 if(!t) return(t); /* should not happen */
1254
12331255 /* if(t->name) { printf("NEXT: %s %x\n", t->name, t->flags); } */
12341256 UpdateTraceSelection(t);
12351257 if (IsGroupBegin(t) && IsClosed(t))
12481270 }
12491271 }
12501272
1251 Trptr GivePrevTrace(Trptr t)
1252 {
1273 static Trptr GivePrevTraceSkipUpdate(Trptr t, int skip)
1274 {
1275 if(!t) return(t); /* should not happen */
1276
12531277 /* if(t->name) { printf("PREV: %s\n", t->name); } */
1254 UpdateTraceSelection(t);
1278 if(!skip) { UpdateTraceSelection(t); }
12551279 if (IsGroupEnd(t) && IsClosed(t))
12561280 {
12571281 Trptr prev = t->t_match;
12681292 }
12691293 }
12701294
1295 Trptr GivePrevTrace(Trptr t)
1296 {
1297 return(GivePrevTraceSkipUpdate(t, 0));
1298 }
1299
1300
1301 /* propogate selection info down into groups */
1302 void UpdateTraceSelection(Trptr t)
1303 {
1304 if ((t->t_match) && (IsGroupBegin(t) || IsGroupEnd(t)) && (IsSelected(t) || IsSelected(t->t_match)))
1305 {
1306 t->flags |= TR_HIGHLIGHT;
1307 t->t_match->flags |= TR_HIGHLIGHT;
1308 }
1309 else
1310 if ((t->t_grp) && IsSelected(t->t_grp))
1311 {
1312 t->flags |= TR_HIGHLIGHT;
1313 }
1314 else
1315 if(t->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)) /* seek to real xact trace if present... */
1316 {
1317 if(!(t->flags & TR_HIGHLIGHT))
1318 {
1319 Trptr tscan = t;
1320 int bcnt = 0;
1321 while((tscan) && (tscan = GivePrevTraceSkipUpdate(tscan, 1)))
1322 {
1323 if(!(tscan->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)))
1324 {
1325 if(tscan->flags & TR_TTRANSLATED)
1326 {
1327 break; /* found it */
1328 }
1329 else
1330 {
1331 tscan = NULL;
1332 }
1333 }
1334 else
1335 {
1336 bcnt++; /* bcnt is number of blank traces */
1337 }
1338 }
1339
1340 if((tscan)&&(tscan->vector)&&(IsSelected(tscan)))
1341 {
1342 bvptr bv = tscan->n.vec;
1343 do
1344 {
1345 bv = bv->transaction_chain; /* correlate to blank trace */
1346 } while(bv && (bcnt--));
1347 if(bv)
1348 {
1349 t->flags |= TR_HIGHLIGHT;
1350 }
1351 }
1352 }
1353 }
1354 }
12711355
12721356
12731357 int UpdateTracesVisible(void)
13321416 }
13331417 else if (t->vector)
13341418 {
1335 return (t->n.vec->name);
1419 return (t->n.vec->bvname);
13361420
13371421 }
13381422 else
14081492 }
14091493
14101494 /*
1411 * $Id: analyzer.c,v 1.18 2010/03/14 07:09:49 gtkwave Exp $
1495 * $Id: analyzer.c,v 1.26 2010/04/15 00:30:23 gtkwave Exp $
14121496 * $Log: analyzer.c,v $
1497 * Revision 1.26 2010/04/15 00:30:23 gtkwave
1498 * don't propagate ttranslate filter into groups
1499 *
1500 * Revision 1.25 2010/04/13 18:11:42 gtkwave
1501 * propagate trace highlighting into transactions
1502 *
1503 * Revision 1.24 2010/04/07 01:50:45 gtkwave
1504 * improved name handling for bvname, add $next transaction operation
1505 *
1506 * Revision 1.23 2010/04/06 06:19:06 gtkwave
1507 * deallocate transaction trace name
1508 *
1509 * Revision 1.22 2010/04/04 19:09:57 gtkwave
1510 * rename name->bvname in struct BitVector for easier grep tracking
1511 *
1512 * Revision 1.21 2010/04/04 07:12:40 gtkwave
1513 * deallocate transaction cache on FreeTrace
1514 *
1515 * Revision 1.20 2010/03/31 16:32:20 gtkwave
1516 * stale marker fix for ttranslate on save file loads before GUI initialized
1517 *
1518 * Revision 1.19 2010/03/31 15:42:47 gtkwave
1519 * added preliminary transaction filter support
1520 *
14131521 * Revision 1.18 2010/03/14 07:09:49 gtkwave
14141522 * removed ExtNode and merged with Node
14151523 *
2525 gfloat value, oldvalue;
2626 } SearchProgressData;
2727
28
29 #define BITATTRIBUTES_MAX 32768
2830
2931 typedef struct ExpandInfo *eptr;
3032 typedef struct ExpandReferences *exptr;
232234 typedef struct Bits
233235 {
234236 char *name; /* name of this vector of bits */
235 int nbits; /* number of bits in this vector */
237 int nnbits; /* number of bits in this vector */
236238 baptr attribs; /* for keeping track of combined timeshifts and inversions (and for savefile) */
237239
238240 nptr nodes[1]; /* pointers to the bits (nodes) */
240242
241243 typedef struct BitVector
242244 {
243 char *name; /* name of this vector of bits */
245 bvptr transaction_cache; /* for TR_TTRANSLATED traces */
246 bvptr transaction_chain; /* for TR_TTRANSLATED traces */
247
248 char *bvname; /* name of this vector of bits */
244249 int nbits; /* number of bits in this vector */
245250 int numregions; /* number of regions that follow */
246251 bptr bits; /* pointer to Bits structs for save file */
303308 TimeType shift; /* offset added to all entries in the trace */
304309 TimeType shift_drag; /* cached initial offset for CTRL+LMB drag on highlighted */
305310
311 double d_minval, d_maxval; /* cached value for when auto scaling is turned off */
312
313 union
314 {
315 nptr nd; /* what makes up this trace */
316 bvptr vec;
317 } n;
318
319 unsigned int flags; /* see def below in TraceEntFlagBits */
320 unsigned int cached_flags; /* used for tcl for saving flags during cut and paste */
321
306322 int f_filter; /* file filter */
307323 int p_filter; /* process filter */
308
309 double d_minval, d_maxval; /* cached value for when auto scaling is turned off */
324 int t_filter; /* transaction process filter */
310325
311326 unsigned is_alias : 1; /* set when it's an alias (safe to free t->name then) */
312327 unsigned is_depacked : 1; /* set when it's been depacked from a compressed entry (safe to free t->name then) */
315330 unsigned interactive_vector_needs_regeneration : 1; /* for interactive VCDs */
316331 unsigned minmax_valid : 1; /* for d_minval, d_maxval */
317332 unsigned is_sort_group : 1; /* only used for sorting purposes */
318
319 unsigned int flags; /* see def below in TraceEntFlagBits */
320 unsigned int cached_flags; /* used for tcl for saving flags during cut and paste */
321
322 union
323 {
324 nptr nd; /* what makes up this trace */
325 bvptr vec;
326 } n;
333 unsigned t_filter_converted : 1; /* used to mark that data conversion already occurred if t_filter != 0*/
327334 } TraceEnt;
328335
329336
335342 TR_ANALOG_INTERPOLATED_B, TR_ANALOG_BLANK_STRETCH_B, TR_REAL_B, TR_ANALOG_FULLSCALE_B,
336343 TR_ZEROFILL_B, TR_ONEFILL_B, TR_CLOSED_B, TR_GRP_BEGIN_B,
337344 TR_GRP_END_B,
338 TR_BINGRAY_B, TR_GRAYBIN_B
345 TR_BINGRAY_B, TR_GRAYBIN_B,
346 TR_REAL2BITS_B, TR_TTRANSLATED_B
339347 };
340348
341349 #define TR_HIGHLIGHT (1<<TR_HIGHLIGHT_B)
367375 #define TR_GRAYBIN (1<<TR_GRAYBIN_B)
368376 #define TR_GRAYMASK (TR_BINGRAY|TR_GRAYBIN)
369377
378 #define TR_REAL2BITS (1<<TR_REAL2BITS_B)
379
370380 #define TR_NUMMASK (TR_ASCII|TR_HEX|TR_DEC|TR_BIN|TR_OCT|TR_SIGNED|TR_REAL)
371381
372382 #define TR_COLLAPSED (1<<TR_COLLAPSED_B)
374384
375385 #define TR_FTRANSLATED (1<<TR_FTRANSLATED_B)
376386 #define TR_PTRANSLATED (1<<TR_PTRANSLATED_B)
387 #define TR_TTRANSLATED (1<<TR_TTRANSLATED_B)
377388
378389 #define TR_ANALOGMASK (TR_ANALOG_STEP|TR_ANALOG_INTERPOLATED)
379390
435446 #endif
436447
437448 /*
438 * $Id: analyzer.h,v 1.24 2010/03/14 07:09:49 gtkwave Exp $
449 * $Id: analyzer.h,v 1.28 2010/04/07 01:50:45 gtkwave Exp $
439450 * $Log: analyzer.h,v $
451 * Revision 1.28 2010/04/07 01:50:45 gtkwave
452 * improved name handling for bvname, add $next transaction operation
453 *
454 * Revision 1.27 2010/04/04 19:09:57 gtkwave
455 * rename name->bvname in struct BitVector for easier grep tracking
456 *
457 * Revision 1.26 2010/03/31 15:42:47 gtkwave
458 * added preliminary transaction filter support
459 *
460 * Revision 1.25 2010/03/24 23:05:09 gtkwave
461 * added RealToBits menu option
462 *
440463 * Revision 1.24 2010/03/14 07:09:49 gtkwave
441464 * removed ExtNode and merged with Node
442465 *
2020 #include "debug.h"
2121 #include "translate.h"
2222 #include "ptranslate.h"
23 #include "ttranslate.h"
2324 #include "pipeio.h"
2425
2526 #ifdef _MSC_VER
635636 /*
636637 * convert trptr+hptr vectorstring into an ascii string
637638 */
638 char *convert_ascii_real(double *d)
639 char *convert_ascii_real(Trptr t, double *d)
639640 {
640641 char *rv;
641642
642 rv=malloc_2(24); /* enough for .16e format */
643
644 if(d)
645 {
646 sprintf(rv,"%.16g",*d);
647 }
648 else
649 {
650 strcpy(rv,"UNDEF");
643 if(t && (t->flags & TR_REAL2BITS) && d) /* "real2bits" also allows other filters such as "bits2real" on top of it */
644 {
645 struct TraceEnt t2;
646 char vec[64];
647 int i;
648 guint64 swapmem;
649
650 memcpy(&swapmem, d, sizeof(guint64));
651 for(i=0;i<64;i++)
652 {
653 if(swapmem & (ULLDescriptor(1)<<(63-i)))
654 {
655 vec[i] = AN_1;
656 }
657 else
658 {
659 vec[i] = AN_0;
660 }
661 }
662
663 memcpy(&t2, t, sizeof(struct TraceEnt));
664
665 t2.n.nd->msi = 63;
666 t2.n.nd->lsi = 0;
667 t2.flags &= ~(TR_REAL2BITS); /* to avoid possible recursion in the future */
668
669 rv = convert_ascii_vec_2(&t2, vec);
670 }
671 else
672 {
673 rv=malloc_2(24); /* enough for .16e format */
674
675 if(d)
676 {
677 sprintf(rv,"%.16g",*d);
678 }
679 else
680 {
681 strcpy(rv,"UNDEF");
682 }
651683 }
652684
653685 return(rv);
701733 int i, nbits, res;
702734 char *vec=(char *)v->v;
703735
704 if (vec == NULL)
705 return(1);
736 if(!t->t_filter_converted)
737 {
738 if (vec == NULL)
739 return(AN_X);
740 }
741 else
742 {
743 return ( ((vec == NULL) || (vec[0] == 0)) ? AN_Z : AN_0 );
744 }
745
706746 nbits=t->n.vec->nbits;
707747 res = AN_1;
708748 for (i = 0; i < nbits; i++)
727767 /*
728768 * convert trptr+hptr vectorstring into an ascii string
729769 */
730 static char *convert_ascii_vec_2(Trptr t, char *vec)
770 char *convert_ascii_vec_2(Trptr t, char *vec)
731771 {
732772 Ulong flags;
733773 int nbits;
13481388
13491389 char *convert_ascii(Trptr t, vptr v)
13501390 {
1351 char *s = convert_ascii_2(t, v);
1391 char *s;
1392
1393 if(!t->t_filter_converted)
1394 {
1395 s = convert_ascii_2(t, v);
1396 }
1397 else
1398 {
1399 s = strdup_2(v->v);
1400
1401 if((*s == '?') && (!GLOBALS->color_active_in_filter))
1402 {
1403 char *s2a;
1404 char *s2 = strchr(s+1, '?');
1405 if(s2)
1406 {
1407 s2++;
1408 s2a = malloc_2(strlen(s2)+1);
1409 strcpy(s2a, s2);
1410 free_2(s);
1411 s = s2a;
1412 }
1413 }
1414 }
13521415
13531416 #if defined _MSC_VER || defined __MINGW32__
13541417
16541717 }
16551718
16561719 /*
1657 * $Id: baseconvert.c,v 1.13 2010/03/14 07:09:49 gtkwave Exp $
1720 * $Id: baseconvert.c,v 1.16 2010/03/31 16:32:20 gtkwave Exp $
16581721 * $Log: baseconvert.c,v $
1722 * Revision 1.16 2010/03/31 16:32:20 gtkwave
1723 * stale marker fix for ttranslate on save file loads before GUI initialized
1724 *
1725 * Revision 1.15 2010/03/31 15:42:47 gtkwave
1726 * added preliminary transaction filter support
1727 *
1728 * Revision 1.14 2010/03/24 23:05:09 gtkwave
1729 * added RealToBits menu option
1730 *
16591731 * Revision 1.13 2010/03/14 07:09:49 gtkwave
16601732 * removed ExtNode and merged with Node
16611733 *
2525 #include "strace.h"
2626 #include "translate.h"
2727 #include "ptranslate.h"
28 #include "ttranslate.h"
2829 #include "main.h"
2930 #include "menu.h"
3031 #include "busy.h"
243244
244245 if(!b) return(NULL);
245246
246 h=(hptr *)calloc_2(b->nbits, sizeof(hptr));
247
248 numextrabytes=(b->nbits)-1;
249
250 for(i=0;i<b->nbits;i++)
247 h=(hptr *)calloc_2(b->nnbits, sizeof(hptr));
248
249 numextrabytes=(b->nnbits)-1;
250
251 for(i=0;i<b->nnbits;i++)
251252 {
252253 n=b->nodes[i];
253254 h[i]=&(n->head);
259260
260261 vadd=(vptr)calloc_2(1,sizeof(struct VectorEnt)+numextrabytes);
261262
262 for(i=0;i<b->nbits;i++) /* was 1...big mistake */
263 for(i=0;i<b->nnbits;i++) /* was 1...big mistake */
263264 {
264265 tshift = (b->attribs) ? b->attribs[i].shift : 0;
265266
288289
289290 regions++;
290291
291 for(i=0;i<b->nbits;i++)
292 for(i=0;i<b->nnbits;i++)
292293 {
293294 unsigned char enc;
294295
315316 enc = AN_X; break;
316317
317318 case 'z': case 'Z':
318 enc = AN_Z;
319 enc = AN_Z; break;
319320
320321 case 'u': case 'U':
321 enc = AN_U;
322 enc = AN_U; break;
322323
323324 case 'w': case 'W':
324 enc = AN_W;
325 enc = AN_W; break;
325326
326327 default: enc = enc & AN_MSK; break;
327328 }
380381 bitvec=(bvptr)calloc_2(1,sizeof(struct BitVector)+
381382 (regions*sizeof(vptr)));
382383
383 strcpy(bitvec->name=(char *)malloc_2(strlen(b->name)+1),b->name);
384 bitvec->nbits=b->nbits;
384 strcpy(bitvec->bvname=(char *)malloc_2(strlen(b->name)+1),b->name);
385 bitvec->nbits=b->nnbits;
385386 bitvec->numregions=regions;
386387
387388 vcurr=vhead;
505506 char ch, ch2, wild_active;
506507 int len, nodepnt=0;
507508 int i;
508 struct Node *n[512];
509 struct Node *n[BITATTRIBUTES_MAX];
509510 struct Bits *b=NULL;
510511 unsigned int rows = 0;
511512
560561 if(nexp)
561562 {
562563 n[nodepnt++]=nexp;
563 if(nodepnt==512) { free_2(wild); goto ifnode; }
564 if(nodepnt==BITATTRIBUTES_MAX) { free_2(wild); goto ifnode; }
564565 }
565566 }
566567 break;
572573 if((s=symfind(wild, &rows)))
573574 {
574575 n[nodepnt++]=&s->n[rows];
575 if(nodepnt==512) { free_2(wild); goto ifnode; }
576 if(nodepnt==BITATTRIBUTES_MAX) { free_2(wild); goto ifnode; }
576577 }
577578 }
578579 }
584585 if(wave_regex_match(GLOBALS->facs[i]->name, WAVE_REGEX_WILD))
585586 {
586587 n[nodepnt++]=GLOBALS->facs[i]->n;
587 if(nodepnt==512) { free_2(wild); goto ifnode; }
588 if(nodepnt==BITATTRIBUTES_MAX) { free_2(wild); goto ifnode; }
588589 }
589590 }
590591 }
607608 if(n[i]->mv.mvlfac) import_trace(n[i]);
608609 }
609610
610 b->nbits=nodepnt;
611 b->nnbits=nodepnt;
611612 strcpy(b->name=(char *)malloc_2(strlen(vec)+1),vec);
612613 }
613614
623624 char ch;
624625 int len, nodepnt=0;
625626 int i;
626 struct Node *n[512];
627 struct BitAttributes ba[512];
627 struct Node *n[BITATTRIBUTES_MAX];
628 struct BitAttributes ba[BITATTRIBUTES_MAX];
628629 struct Bits *b=NULL;
629630 int state = 0;
630631 unsigned int rows = 0;
668669 {
669670 struct symbol *s;
670671
671 if(nodepnt==512) { free_2(wild); goto ifnode; }
672 if(nodepnt==BITATTRIBUTES_MAX) { free_2(wild); goto ifnode; }
672673
673674 if(wild[0]=='(')
674675 {
687688 if(nexp)
688689 {
689690 n[nodepnt++]=nexp;
690 if(nodepnt==512) { free_2(wild); goto ifnode; }
691 if(nodepnt==BITATTRIBUTES_MAX) { free_2(wild); goto ifnode; }
691692 }
692693 }
693694 break;
727728 b->attribs[i].flags = ba[i].flags;
728729 }
729730
730 b->nbits=nodepnt;
731 b->nnbits=nodepnt;
731732 strcpy(b->name=(char *)malloc_2(strlen(vec)+1),vec);
732733 }
733734
742743 {
743744 int nodepnt=0;
744745 int i;
745 struct Node *n[512];
746 struct Node *n[BITATTRIBUTES_MAX];
746747 struct Bits *b=NULL;
747748
748749 if(!direction)
751752 if(get_s_selected(GLOBALS->facs[i]))
752753 {
753754 n[nodepnt++]=GLOBALS->facs[i]->n;
754 if((nodepnt==512)||(numrows==nodepnt)) break;
755 if((nodepnt==BITATTRIBUTES_MAX)||(numrows==nodepnt)) break;
755756 }
756757 }
757758 else
760761 if(get_s_selected(GLOBALS->facs[i]))
761762 {
762763 n[nodepnt++]=GLOBALS->facs[i]->n;
763 if((nodepnt==512)||(numrows==nodepnt)) break;
764 if((nodepnt==BITATTRIBUTES_MAX)||(numrows==nodepnt)) break;
764765 }
765766 }
766767
775776 if(n[i]->mv.mvlfac) import_trace(n[i]);
776777 }
777778
778 b->nbits=nodepnt;
779 b->nnbits=nodepnt;
779780 strcpy(b->name=(char *)malloc_2(strlen(vec)+1),vec);
780781 }
781782
871872 if(n[i]->mv.mvlfac) import_trace(n[i]);
872873 }
873874
874 b->nbits=nodepnt;
875 b->nnbits=nodepnt;
875876
876877 if(vec)
877878 {
10421043 {
10431044 int nodepnt=0;
10441045 int i;
1045 struct Node *n[512];
1046 struct Node *n[BITATTRIBUTES_MAX];
10461047 struct Bits *b=NULL;
10471048
10481049 if(!direction)
10491050 for(i=hi;i>=lo;i--) /* to keep vectors in hi..lo order */
10501051 {
10511052 n[nodepnt++]=GLOBALS->facs[i]->n;
1052 if(nodepnt==512) break;
1053 if(nodepnt==BITATTRIBUTES_MAX) break;
10531054 }
10541055 else
10551056 for(i=lo;i<=hi;i++) /* to keep vectors in lo..hi order */
10561057 {
10571058 n[nodepnt++]=GLOBALS->facs[i]->n;
1058 if(nodepnt==512) break;
1059 if(nodepnt==BITATTRIBUTES_MAX) break;
10591060 }
10601061
10611062 if(nodepnt)
10691070 if(n[i]->mv.mvlfac) import_trace(n[i]);
10701071 }
10711072
1072 b->nbits=nodepnt;
1073 b->nnbits=nodepnt;
10731074
10741075 if(vec)
10751076 {
24752476 }
24762477 }
24772478 }
2479 else
2480 if(*(w2+1) == '<')
2481 {
2482 GLOBALS->current_translate_ttrans = 0; /* will overwrite if loadable/translatable */
2483
2484 if(*(w2+2) != '0')
2485 {
2486 /* char *fn = strstr(w2+3, " "); */
2487 char *fn = w2+3;
2488 if(fn)
2489 {
2490 while(*fn && isspace(*fn)) fn++;
2491 if(*fn && !isspace(*fn))
2492 {
2493 set_current_translate_ttrans(fn);
2494 }
2495 }
2496 }
2497 }
24782498 else
24792499 {
24802500 GLOBALS->current_translate_file = 0; /* will overwrite if loadable/translatable */
30543074 /****************/
30553075
30563076 /*
3057 * $Id: bitvec.c,v 1.22 2010/03/18 17:12:37 gtkwave Exp $
3077 * $Id: bitvec.c,v 1.25 2010/04/04 19:09:57 gtkwave Exp $
30583078 * $Log: bitvec.c,v $
3079 * Revision 1.25 2010/04/04 19:09:57 gtkwave
3080 * rename name->bvname in struct BitVector for easier grep tracking
3081 *
3082 * Revision 1.24 2010/03/31 15:42:47 gtkwave
3083 * added preliminary transaction filter support
3084 *
3085 * Revision 1.23 2010/03/26 16:11:48 gtkwave
3086 * added missing break statements in bits2vector switch cases
3087 *
30593088 * Revision 1.22 2010/03/18 17:12:37 gtkwave
30603089 * pedantic warning cleanups
30613090 *
4343 {
4444 void *bsearch_dummy_rv;
4545
46 GLOBALS->max_compare_time_tc_bsearch_c_1=-2+GLOBALS->shift_timebase; GLOBALS->max_compare_pos_tc_bsearch_c_1=NULL;
46 GLOBALS->max_compare_time_tc_bsearch_c_1=-2; GLOBALS->max_compare_pos_tc_bsearch_c_1=NULL;
4747
4848 if(!GLOBALS->strace_ctx->timearray) return(-1);
4949
8484 int rv;
8585
8686 key=*((TimeType *)s1);
87 obj=(cpos=(*((hptr *)s2)))->time+GLOBALS->shift_timebase;
87 obj=(cpos=(*((hptr *)s2)))->time;
8888
8989 if((obj<=key)&&(obj>GLOBALS->max_compare_time_bsearch_c_1))
9090 {
105105 {
106106 void *bsearch_dummy_rv;
107107
108 GLOBALS->max_compare_time_bsearch_c_1=-2+GLOBALS->shift_timebase; GLOBALS->max_compare_pos_bsearch_c_1=NULL; GLOBALS->max_compare_index=NULL;
108 GLOBALS->max_compare_time_bsearch_c_1=-2; GLOBALS->max_compare_pos_bsearch_c_1=NULL; GLOBALS->max_compare_index=NULL;
109109
110110 bsearch_dummy_rv = bsearch(&key, n->harray, n->numhist, sizeof(hptr), compar_histent);
111 if((!GLOBALS->max_compare_pos_bsearch_c_1)||(GLOBALS->max_compare_time_bsearch_c_1<GLOBALS->shift_timebase))
111 if((!GLOBALS->max_compare_pos_bsearch_c_1)||(GLOBALS->max_compare_time_bsearch_c_1<LLDescriptor(0)))
112112 {
113113 GLOBALS->max_compare_pos_bsearch_c_1=n->harray[1]; /* aix bsearch fix */
114114 GLOBALS->max_compare_index=&(n->harray[1]);
127127 int rv;
128128
129129 key=*((TimeType *)s1);
130 obj=(cpos=(*((vptr *)s2)))->time+GLOBALS->shift_timebase;
130 /* obj=(cpos=(*((vptr *)s2)))->time+GLOBALS->shift_timebase; */
131
132 obj=(cpos=(*((vptr *)s2)))->time;
131133
132134 if((obj<=key)&&(obj>GLOBALS->vmax_compare_time_bsearch_c_1))
133135 {
148150 {
149151 void *bsearch_dummy_rv;
150152
151 GLOBALS->vmax_compare_time_bsearch_c_1=-2+GLOBALS->shift_timebase; GLOBALS->vmax_compare_pos_bsearch_c_1=NULL; GLOBALS->vmax_compare_index=NULL;
153 GLOBALS->vmax_compare_time_bsearch_c_1=-2; GLOBALS->vmax_compare_pos_bsearch_c_1=NULL; GLOBALS->vmax_compare_index=NULL;
152154
153155 bsearch_dummy_rv = bsearch(&key, b->vectors, b->numregions, sizeof(vptr), compar_vectorent);
154 if((!GLOBALS->vmax_compare_pos_bsearch_c_1)||(GLOBALS->vmax_compare_time_bsearch_c_1<GLOBALS->shift_timebase))
156 if((!GLOBALS->vmax_compare_pos_bsearch_c_1)||(GLOBALS->vmax_compare_time_bsearch_c_1<LLDescriptor(0)))
155157 {
156158 GLOBALS->vmax_compare_pos_bsearch_c_1=b->vectors[1]; /* aix bsearch fix */
157159 GLOBALS->vmax_compare_index=&(b->vectors[1]);
270272 }
271273
272274 /*
273 * $Id: bsearch.c,v 1.7 2010/01/22 02:10:49 gtkwave Exp $
275 * $Id: bsearch.c,v 1.9 2010/04/01 19:52:20 gtkwave Exp $
274276 * $Log: bsearch.c,v $
277 * Revision 1.9 2010/04/01 19:52:20 gtkwave
278 * time warp fixes
279 *
280 * Revision 1.8 2010/04/01 03:10:58 gtkwave
281 * time warp fixes
282 *
275283 * Revision 1.7 2010/01/22 02:10:49 gtkwave
276284 * added second pattern search capability
277285 *
1919 #include "regex_wave.h"
2020 #include "translate.h"
2121
22 #define WAVE_VERSION_INFO "GTKWave Analyzer v3.3.5 (w)1999-2010 BSI"
22 #define WAVE_VERSION_INFO "GTKWave Analyzer v3.3.6 (w)1999-2010 BSI"
2323
2424 #define WAVE_INF_SCALING (0.5)
2525 #define WAVE_SI_UNITS " munpfaz"
4444 void fractional_timescale_fix(char *);
4545 char *convert_ascii(Trptr t, vptr v);
4646 char *convert_ascii_vec(Trptr t, char *vec);
47 char *convert_ascii_real(double *d);
47 char *convert_ascii_real(Trptr t, double *d);
4848 char *convert_ascii_string(char *s);
49 char *convert_ascii_vec_2(Trptr t, char *vec);
4950 double convert_real_vec(Trptr t, char *vec);
5051 double convert_real(Trptr t, vptr v);
5152
6465 void MaxSignalLength(void);
6566 void RenderSigs(int trtarget, int update_waves);
6667 int RenderSig(Trptr t, int i, int dobackground);
68 void populateBuffer(Trptr t, char *altname, char* buf);
6769 void calczoom(double z0);
6870 void fix_wavehadj(void);
6971 void service_zoom_in(GtkWidget *text, gpointer data);
173175 #endif
174176
175177 /*
176 * $Id: currenttime.h,v 1.72 2010/03/19 16:36:47 gtkwave Exp $
178 * $Id: currenttime.h,v 1.75 2010/05/03 21:42:16 gtkwave Exp $
177179 * $Log: currenttime.h,v $
180 * Revision 1.75 2010/05/03 21:42:16 gtkwave
181 * version bump
182 *
183 * Revision 1.74 2010/04/14 04:21:46 gtkwave
184 * update populateBuffer() usage
185 *
186 * Revision 1.73 2010/03/24 23:05:09 gtkwave
187 * added RealToBits menu option
188 *
178189 * Revision 1.72 2010/03/19 16:36:47 gtkwave
179190 * version bump
180191 *
2828 int rcValue;
2929 Word_t Index;
3030 JError_t JError;
31 #ifdef DEBUG_PRINTF
3132 int ctr = 0;
3233
33 #ifdef DEBUG_PRINTF
3434 printf("\n*** cleanup ***\n");
3535 printf("Freeing %d chunks\n", GLOBALS->outstanding);
3636 system("date");
4545 for (rcValue = Judy1First(PJArray, &Index, &JError); rcValue != 0; rcValue = Judy1Next(PJArray, &Index, &JError))
4646 {
4747 free((void *)Index);
48 #ifdef DEBUG_PRINTF
4849 ctr++;
50 #endif
4951 }
5052 Judy1FreeArray(&PJArray, &JError);
5153
485487 }
486488
487489 /*
488 * $Id: debug.c,v 1.13 2010/03/16 21:01:08 gtkwave Exp $
490 * $Id: debug.c,v 1.14 2010/05/01 19:20:56 gtkwave Exp $
489491 * $Log: debug.c,v $
492 * Revision 1.14 2010/05/01 19:20:56 gtkwave
493 * cppcheck warnings fixes
494 *
490495 * Revision 1.13 2010/03/16 21:01:08 gtkwave
491496 * remove selected member of struct symbol
492497 *
6666 struct strace *s_head, *s;
6767 TimeType basetime, maxbase, sttim, fintim;
6868 Trptr t = find_first_highlighted_trace();
69 int totaltraces, passcount;
69 int totaltraces;
70 #ifdef DEBUG_PRINTF
71 int passcount;
72 #endif
7073 int whichpass;
7174 TimeType middle=0, width;
7275
132135 UTimeType utt;
133136 TimeType tt;
134137
135 h=bsearch_node(t->n.nd, basetime);
138 h=bsearch_node(t->n.nd, basetime - t->shift);
136139 hp=GLOBALS->max_compare_index;
137140 if((hp==&(t->n.nd->harray[1]))||(hp==&(t->n.nd->harray[0]))) return;
138141 if(basetime == ((*hp)->time+GLOBALS->shift_timebase)) hp--;
148151 UTimeType utt;
149152 TimeType tt;
150153
151 v=bsearch_vector(t->n.vec, basetime);
154 v=bsearch_vector(t->n.vec, basetime - t->shift);
152155 vp=GLOBALS->vmax_compare_index;
153156 if((vp==&(t->n.vec->vectors[1]))||(vp==&(t->n.vec->vectors[0]))) return;
154157 if(basetime == ((*vp)->time+GLOBALS->shift_timebase)) vp--;
175178 UTimeType utt;
176179 TimeType tt;
177180
178 h=bsearch_node(t->n.nd, basetime);
181 h=bsearch_node(t->n.nd, basetime - t->shift);
179182 while(h->next && h->time==h->next->time) h=h->next;
180183 if((whichpass)||(GLOBALS->tims.marker>=0)) h=h->next;
181184 if(!h) return;
189192 UTimeType utt;
190193 TimeType tt;
191194
192 v=bsearch_vector(t->n.vec, basetime);
195 v=bsearch_vector(t->n.vec, basetime - t->shift);
193196 while(v->next && v->time==v->next->time) v=v->next;
194197 if((whichpass)||(GLOBALS->tims.marker>=0)) v=v->next;
195198 if(!v) return;
215218 {
216219 if(strace_adjust(s->his.h->time,GLOBALS->shift_timebase)!=maxbase)
217220 {
218 s->his.h=bsearch_node(t->n.nd, maxbase);
221 s->his.h=bsearch_node(t->n.nd, maxbase - t->shift);
219222 while(s->his.h->next && s->his.h->time==s->his.h->next->time) s->his.h=s->his.h->next;
220223 }
221224 if(t->flags&TR_INVERT)
295298 {
296299 if(strace_adjust(s->his.v->time,GLOBALS->shift_timebase)!=maxbase)
297300 {
298 s->his.v=bsearch_vector(t->n.vec, maxbase);
301 s->his.v=bsearch_vector(t->n.vec, maxbase - t->shift);
299302 while(s->his.v->next && s->his.v->time==s->his.v->next->time) s->his.v=s->his.v->next;
300303 }
301304 chval=convert_ascii(t,s->his.v);
304307 {
305308 if(strace_adjust(s->his.h->time,GLOBALS->shift_timebase)!=maxbase)
306309 {
307 s->his.h=bsearch_node(t->n.nd, maxbase);
310 s->his.h=bsearch_node(t->n.nd, maxbase - t->shift);
308311 while(s->his.h->next && s->his.h->time==s->his.h->next->time) s->his.h=s->his.h->next;
309312 }
310313 if(s->his.h->flags&HIST_REAL)
311314 {
312315 if(!(s->his.h->flags&HIST_STRING))
313316 {
314 chval=convert_ascii_real((double *)s->his.h->v.h_vector);
317 chval=convert_ascii_real(t, (double *)s->his.h->v.h_vector);
315318 }
316319 else
317320 {
428431
429432 if((maxbase<sttim)||(maxbase>fintim)) return;
430433
434 #ifdef DEBUG_PRINTF
431435 DEBUG(printf("Maxbase: "TTFormat", total traces: %d\n",maxbase, totaltraces));
432436 s=s_head;
433437 passcount=0;
437441 if(s->search_result) passcount++;
438442 s=s->next;
439443 }
444 #endif
440445
441446 if(totaltraces)
442447 {
572577 }
573578
574579 /*
575 * $Id: edgebuttons.c,v 1.8 2010/03/14 07:09:49 gtkwave Exp $
580 * $Id: edgebuttons.c,v 1.11 2010/05/01 19:46:28 gtkwave Exp $
576581 * $Log: edgebuttons.c,v $
582 * Revision 1.11 2010/05/01 19:46:28 gtkwave
583 * cppcheck warning fixes
584 *
585 * Revision 1.10 2010/04/01 03:10:58 gtkwave
586 * time warp fixes
587 *
588 * Revision 1.9 2010/03/24 23:05:09 gtkwave
589 * added RealToBits menu option
590 *
577591 * Revision 1.8 2010/03/14 07:09:49 gtkwave
578592 * removed ExtNode and merged with Node
579593 *
1111 #ifndef WAVE_EXTRDR_H
1212 #define WAVE_EXTRDR_H
1313
14 #ifndef _MSC_VER
14 #ifdef HAVE_INTTYPES_H
1515 #include <inttypes.h>
1616 #endif
1717
2525 #endif
2626
2727 /*
28 * $Id: extload.h,v 1.1 2009/01/27 07:04:28 gtkwave Exp $
28 * $Id: extload.h,v 1.2 2010/04/27 23:10:56 gtkwave Exp $
2929 * $Log: extload.h,v $
30 * Revision 1.2 2010/04/27 23:10:56 gtkwave
31 * made inttype.h inclusion conditional
32 *
3033 * Revision 1.1 2009/01/27 07:04:28 gtkwave
3134 * added extload external process loader capability
3235 *
1111 #ifndef WAVE_FSTRDR_H
1212 #define WAVE_FSTRDR_H
1313
14 #ifndef _MSC_VER
14 #ifdef HAVE_INTTYPES_H
1515 #include <inttypes.h>
1616 #endif
1717
2626 #endif
2727
2828 /*
29 * $Id: fst.h,v 1.1 2009/08/06 20:03:15 gtkwave Exp $
29 * $Id: fst.h,v 1.2 2010/04/27 23:10:56 gtkwave Exp $
3030 * $Log: fst.h,v $
31 * Revision 1.2 2010/04/27 23:10:56 gtkwave
32 * made inttype.h inclusion conditional
33 *
3134 * Revision 1.1 2009/08/06 20:03:15 gtkwave
3235 * creation
3336 *
2424 #include <stdlib.h>
2525
2626
27 #if HAVE_INTTYPES_H
27 #ifdef HAVE_INTTYPES_H
2828 #include <inttypes.h>
2929 #define GHWLLD "%"PRId64
3030 #define GHWLD "%"PRId32
3939 #define GHWLD "%d"
4040 #else
4141 #define GHWLLD "%lld"
42 #define GHWLLD "%ld"
42 #define GHWLD "%ld"
4343 #endif
4444 #endif
4545 #endif
421421 #endif /* _GHWLIB_H_ */
422422
423423 /*
424 * $Id: ghwlib.h,v 1.5 2009/12/29 07:07:49 gtkwave Exp $
424 * $Id: ghwlib.h,v 1.7 2010/04/27 23:10:56 gtkwave Exp $
425425 * $Log: ghwlib.h,v $
426 * Revision 1.7 2010/04/27 23:10:56 gtkwave
427 * made inttype.h inclusion conditional
428 *
429 * Revision 1.6 2010/04/25 01:04:21 gtkwave
430 * typo fix
431 *
426432 * Revision 1.5 2009/12/29 07:07:49 gtkwave
427433 * fixes for ghw files
428434 *
2828 #include "pixmaps.h"
2929 #include "print.h"
3030 #include "ptranslate.h"
31 #include "ttranslate.h"
3132 #include "rc.h"
3233 #include "regex_wave.h"
3334 #include "strace.h"
927928 0, /* dnd_tgt_on_wavearea_treesearch_gtk2_c_1 */
928929 NULL, /* dnd_sigview */
929930
931
932 /*
933 * ttranslate.c
934 */
935 0, /* current_translate_ttrans */
936 0, /* current_filter_ttranslate_c_1 */
937 0, /* num_ttrans_filters */
938 NULL, /* ttranssel_filter */
939 NULL, /* ttrans_filter */
940 0, /* is_active_ttranslate_c_2 */
941 NULL, /* fcurr_ttranslate_c_1 */
942 NULL, /* window_ttranslate_c_5 */
943 NULL, /* clist_ttranslate_c_2 */
944
945
930946 /*
931947 * vcd.c
932948 */
11071123 */
11081124 0, /* use_scrollwheel_as_y */
11091125 0, /* m1x_wavewindow_c_1 589 */
1110 0, /* m2x */
1126 0, /* m2x_wavewindow_c_1 */
1127 0, /* black_and_white */
11111128 1, /* signalwindow_width_dirty 590 */
11121129 1, /* enable_ghost_marker 591 */
11131130 1, /* enable_horiz_grid 592 */
13781395
13791396 /* Kill any open processes */
13801397 remove_all_proc_filters();
1398 remove_all_ttrans_filters();
13811399
13821400 /* Instantiate new global status */
13831401 new_globals = initialize_globals();
14321450 new_globals->signalpixmap = GLOBALS->signalpixmap;
14331451 new_globals->wave_splash_pixmap = GLOBALS->wave_splash_pixmap;
14341452 new_globals->wave_splash_mask = GLOBALS->wave_splash_mask;
1453
1454 new_globals->black_and_white = GLOBALS->black_and_white;
14351455
14361456 new_globals->gc_white = GLOBALS->gc_white;
14371457 new_globals->gc_black = GLOBALS->gc_black;
14821502 new_globals->gccache_gmstrd = GLOBALS->gccache_gmstrd;
14831503 new_globals->gccache_back_wavewindow_c_1 = GLOBALS->gccache_back_wavewindow_c_1;
14841504 new_globals->gccache_baseline_wavewindow_c_1 = GLOBALS->gccache_baseline_wavewindow_c_1;
1505 new_globals->gccache_grid_wavewindow_c_1 = GLOBALS->gccache_grid_wavewindow_c_1;
14851506 new_globals->gccache_grid2_wavewindow_c_1 = GLOBALS->gccache_grid2_wavewindow_c_1;
14861507 new_globals->gccache_time_wavewindow_c_1 = GLOBALS->gccache_time_wavewindow_c_1;
14871508 new_globals->gccache_timeb_wavewindow_c_1 = GLOBALS->gccache_timeb_wavewindow_c_1;
17151736 strcpy2_into_new_context(new_globals, &new_globals->stems_name, &GLOBALS->stems_name); /* remaining fileselbox() vars not handled elsewhere */
17161737 strcpy2_into_new_context(new_globals, &new_globals->filesel_logfile_menu_c_1, &GLOBALS->filesel_logfile_menu_c_1);
17171738 strcpy2_into_new_context(new_globals, &new_globals->filesel_scriptfile_menu, &GLOBALS->filesel_scriptfile_menu);
1739 strcpy2_into_new_context(new_globals, &new_globals->fcurr_ttranslate_c_1, &GLOBALS->fcurr_ttranslate_c_1);
17181740 strcpy2_into_new_context(new_globals, &new_globals->fcurr_ptranslate_c_1, &GLOBALS->fcurr_ptranslate_c_1);
17191741 strcpy2_into_new_context(new_globals, &new_globals->fcurr_translate_c_2, &GLOBALS->fcurr_translate_c_2);
17201742
19271949
19281950 init_filetrans_data();
19291951 init_proctrans_data();
1952 init_ttrans_data();
19301953 /* load_all_fonts(); */
19311954
19321955 /* attempt to reload file and recover on loader errors until successful */
20062029 Index = 0;
20072030 for (rcValue = Judy1First(PJArray, &Index, &JError); rcValue != 0; rcValue = Judy1Next(PJArray, &Index, &JError))
20082031 {
2009 JError_t JError;
20102032 Judy1Set ((Pvoid_t)&GLOBALS->alloc2_chain, Index, &JError);
20112033 }
20122034
4141 #include "pixmaps.h"
4242 #include "print.h"
4343 #include "ptranslate.h"
44 #include "ttranslate.h"
4445 #include "rc.h"
4546 #include "regex_wave.h"
4647 #include "strace.h"
910911 unsigned char dnd_tgt_on_wavearea_treesearch_gtk2_c_1; /* from treesearch_gtk2.c */
911912 GtkWidget *dnd_sigview; /* from treesearch_gtk2.c */
912913
914
915 /*
916 * ttranslate.c
917 */
918 int current_translate_ttrans;
919 int current_filter_ttranslate_c_1;
920 int num_ttrans_filters;
921 char **ttranssel_filter;
922 struct pipe_ctx **ttrans_filter;
923 int is_active_ttranslate_c_2;
924 char *fcurr_ttranslate_c_1;
925 GtkWidget *window_ttranslate_c_5;
926 GtkWidget *clist_ttranslate_c_2;
927
928
913929 /*
914930 * vcd.c
915931 */
10911107 char use_scrollwheel_as_y; /* fromwavewindow.c */
10921108 int m1x_wavewindow_c_1; /* from wavewindow.c 642 */
10931109 int m2x_wavewindow_c_1; /* from wavewindow.c 643 */
1110 char black_and_white; /* from wavewindow.c */
10941111 char signalwindow_width_dirty; /* from wavewindow.c 644 */
10951112 char enable_ghost_marker; /* from wavewindow.c 645 */
10961113 char enable_horiz_grid; /* from wavewindow.c 646 */
3131 #include <stdlib.h>
3232 #include <string.h>
3333 #include <ctype.h>
34 #ifdef HAVE_INTTYPES_H
3435 #include <inttypes.h>
36 #endif
3537 #include <unistd.h>
3638
3739 size_t getline_replace(char **buf, size_t *len, FILE *f)
498500 }
499501
500502 /*
501 * $Id: evcd2vcd.c,v 1.2 2009/08/06 20:03:31 gtkwave Exp $
503 * $Id: evcd2vcd.c,v 1.3 2010/04/27 23:10:56 gtkwave Exp $
502504 * $Log: evcd2vcd.c,v $
505 * Revision 1.3 2010/04/27 23:10:56 gtkwave
506 * made inttype.h inclusion conditional
507 *
503508 * Revision 1.2 2009/08/06 20:03:31 gtkwave
504509 * warnings fixes
505510 *
228228 }
229229
230230
231 static int fstCopyVarint32(unsigned char *pnt, uint32_t v)
232 {
233 unsigned char *spnt = pnt;
231 static unsigned char *fstCopyVarint32ToLeft(unsigned char *pnt, uint32_t v)
232 {
233 unsigned char buf[5];
234 unsigned char *spnt = buf;
234235 uint32_t nxt;
235236
236237 while((nxt = v>>7))
237238 {
238 *(pnt++) = (v&0x7f) | 0x80;
239 *(spnt++) = (v&0x7f) | 0x80;
239240 v = nxt;
240241 }
241 *(pnt++) = (v&0x7f);
242
243 return(pnt - spnt);
244 }
245
242 *(spnt++) = (v&0x7f);
243
244 do {
245 *(--pnt) = *(--spnt);
246 } while(spnt != buf);
247
248 return(pnt);
249 }
250
246251
247252 static uint64_t fstGetVarint64(unsigned char *mem, int *skiplen)
248253 {
410415 unsigned char *curval_mem;
411416
412417 char *filename;
413 time_t simdate;
414418
415419 fstHandle maxhandle;
416420 fstHandle numsigs;
442446 unsigned repack_on_close : 1;
443447 unsigned skip_writing_section_hdr : 1;
444448 unsigned size_limit_locked : 1;
449
450 /* should really be semaphores, but are bytes to cut down on read-modify-write window size */
451 unsigned char already_in_flush; /* in case control-c handlers interrupt */
452 unsigned char already_in_close; /* in case control-c handlers interrupt */
445453 };
446454
447455
614622 void fstWriterClose(void *ctx)
615623 {
616624 struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
617 if(xc)
625 if(xc && !xc->already_in_close && !xc->already_in_flush)
618626 {
619627 unsigned char *tmem;
620628 off_t fixup_offs, tlen, hlen;
629
630 xc->already_in_close = 1; /* never need to zero this out as it is freed at bottom */
621631
622632 xc->skip_writing_section_hdr = 1;
623633 if(!xc->size_limit_locked)
902912
903913 void fstWriterFlushContext(void *ctx)
904914 {
915 #ifdef FST_DEBUG
905916 int cnt = 0;
917 #endif
906918 int i;
907919 unsigned char *vchg_mem;
908920 FILE *f;
914926 unsigned char *tmem;
915927 off_t tlen;
916928 off_t unc_memreq = 0; /* for reader */
929 unsigned char *packmem;
930 unsigned int packmemlen;
931 uint32_t *vm4ip;
917932
918933 struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
919934
920 if((!xc)||(xc->vchn_siz <= 1)) return;
935 if((!xc)||(xc->vchn_siz <= 1)||(xc->already_in_flush)) return;
936 xc->already_in_flush = 1; /* should really do this with a semaphore */
921937
922938 scratchpad = malloc(xc->vchn_siz);
923939
929945 fputc(xc->fastpack ? 'F' : 'Z', f);
930946 fpos = 1;
931947
948 packmemlen = 1024; /* maintain a running "longest" allocation to */
949 packmem = malloc(packmemlen); /* prevent continual malloc...free every loop iter */
950
932951 for(i=0;i<xc->maxhandle;i++)
933952 {
934 if(xc->valpos_mem[4*i+2])
935 {
936 uint32_t offs = xc->valpos_mem[4*i+2];
937 uint32_t next_offs = 0;
953 vm4ip = &(xc->valpos_mem[4*i]);
954
955 if(vm4ip[2])
956 {
957 uint32_t offs = vm4ip[2];
958 uint32_t next_offs;
938959 int wrlen;
939 uint32_t offs2;
940
941 while(offs) /* go backwards and relink forwards */
942 {
943 offs2 = fstGetUint32(vchg_mem + offs);
944 fstWriterSetUint32(vchg_mem + offs, next_offs);
945 next_offs = offs;
946 offs = offs2;
947 }
948
949 xc->valpos_mem[4*i+2] = fpos;
950
951 offs = next_offs;
952 scratchpnt = scratchpad;
953 if(xc->valpos_mem[4*i+1] == 1)
960
961 vm4ip[2] = fpos;
962
963 scratchpnt = scratchpad + xc->vchn_siz; /* build this buffer backwards */
964 if(vm4ip[1] == 1)
954965 {
955966 while(offs)
956967 {
961972
962973 time_delta = fstGetVarint32(vchg_mem + offs, &wrlen);
963974 val = vchg_mem[offs+wrlen];
975 offs = next_offs;
964976
965977 switch(val)
966978 {
977989 default: rcv = FST_RCV_D | (time_delta<<4); break;
978990 }
979991
980 scratchpnt += fstCopyVarint32(scratchpnt, rcv);
981 offs = next_offs;
992 scratchpnt = fstCopyVarint32ToLeft(scratchpnt, rcv);
982993 }
983994 }
984995 else
9961007 time_delta = fstGetVarint32(vchg_mem + offs, &wrlen);
9971008
9981009 pnt = vchg_mem+offs+wrlen;
999 for(idx=0;idx<xc->valpos_mem[4*i+1];idx++)
1010 offs = next_offs;
1011
1012 for(idx=0;idx<vm4ip[1];idx++)
10001013 {
10011014 if((pnt[idx] == '0') || (pnt[idx] == '1'))
10021015 {
10121025 if(is_binary)
10131026 {
10141027 unsigned char acc = 0;
1015 int shift = 7;
1016 scratchpnt += fstCopyVarint32(scratchpnt, (time_delta << 1));
1017 for(idx=0;idx<xc->valpos_mem[4*i+1];idx++)
1028 int shift = 7 - ((vm4ip[1]-1) & 7);
1029 for(idx=vm4ip[1]-1;idx>=0;idx--)
10181030 {
10191031 acc |= (pnt[idx] & 1) << shift;
1020 shift--;
1021 if(shift < 0)
1032 shift++;
1033 if(shift == 8)
10221034 {
1023 *(scratchpnt++) = acc;
1024 shift = 7;
1035 *(--scratchpnt) = acc;
1036 shift = 0;
10251037 acc = 0;
10261038 }
10271039 }
1028 if(shift != 7)
1029 {
1030 *(scratchpnt++) = acc;
1031 }
1040
1041 scratchpnt = fstCopyVarint32ToLeft(scratchpnt, (time_delta << 1));
10321042 }
10331043 else
10341044 {
1035 scratchpnt += fstCopyVarint32(scratchpnt, (time_delta << 1) | 1);
1036 memcpy(scratchpnt, pnt, xc->valpos_mem[4*i+1]);
1037 scratchpnt += xc->valpos_mem[4*i+1];
1045 scratchpnt -= vm4ip[1];
1046 memcpy(scratchpnt, pnt, vm4ip[1]);
1047
1048 scratchpnt = fstCopyVarint32ToLeft(scratchpnt, (time_delta << 1) | 1);
10381049 }
1039
1040 offs = next_offs;
10411050 }
10421051 }
10431052
1044 wrlen = scratchpnt - scratchpad;
1053 wrlen = scratchpad + xc->vchn_siz - scratchpnt;
10451054 unc_memreq += wrlen;
10461055 if(wrlen > 32)
10471056 {
10511060
10521061 if(!xc->fastpack)
10531062 {
1054 dmem = malloc(wrlen);
1055 rc = compress2(dmem, &destlen, scratchpad, wrlen, 4);
1063 if(wrlen <= packmemlen)
1064 {
1065 dmem = packmem;
1066 }
1067 else
1068 {
1069 free(packmem);
1070 dmem = packmem = malloc(packmemlen = wrlen);
1071 }
1072
1073 rc = compress2(dmem, &destlen, scratchpnt, wrlen, 4);
10561074 if(rc == Z_OK)
10571075 {
10581076 fpos += fstWriterVarint(f, wrlen);
10631081 {
10641082 fpos += fstWriterVarint(f, 0);
10651083 fpos += wrlen;
1066 fstFwrite(scratchpad, wrlen, 1, f);
1084 fstFwrite(scratchpnt, wrlen, 1, f);
10671085 }
1068 free(dmem);
10691086 }
10701087 else
10711088 {
1072 dmem = malloc((wrlen * 2) + 2);
1073 rc = fastlz_compress(scratchpad, wrlen, dmem);
1089 if(((wrlen * 2) + 2) <= packmemlen)
1090 {
1091 dmem = packmem;
1092 }
1093 else
1094 {
1095 free(packmem);
1096 dmem = packmem = malloc(packmemlen = (wrlen * 2) + 2);
1097 }
1098
1099 rc = fastlz_compress(scratchpnt, wrlen, dmem);
10741100 if(rc < destlen)
10751101 {
10761102 fpos += fstWriterVarint(f, wrlen);
10811107 {
10821108 fpos += fstWriterVarint(f, 0);
10831109 fpos += wrlen;
1084 fstFwrite(scratchpad, wrlen, 1, f);
1110 fstFwrite(scratchpnt, wrlen, 1, f);
10851111 }
1086 free(dmem);
10871112 }
10881113 }
10891114 else
10901115 {
10911116 fpos += fstWriterVarint(f, 0);
10921117 fpos += wrlen;
1093 fstFwrite(scratchpad, wrlen, 1, f);
1094 }
1095
1096 xc->valpos_mem[4*i+3] = 0;
1118 fstFwrite(scratchpnt, wrlen, 1, f);
1119 }
1120
1121 vm4ip[3] = 0;
1122 #ifdef FST_DEBUG
10971123 cnt++;
1098 }
1099 }
1124 #endif
1125 }
1126 }
1127
1128 free(packmem); packmem = NULL; packmemlen = 0;
11001129
11011130 prevpos = 0; zerocnt = 0;
11021131 free(scratchpad); scratchpad = NULL;
11061135
11071136 for(i=0;i<xc->maxhandle;i++)
11081137 {
1109 if(xc->valpos_mem[4*i+2])
1138 vm4ip = &(xc->valpos_mem[4*i]);
1139
1140 if(vm4ip[2])
11101141 {
11111142 if(zerocnt)
11121143 {
11141145 zerocnt = 0;
11151146 }
11161147
1117 fpos += fstWriterVarint(f, ((xc->valpos_mem[4*i+2] - prevpos) << 1) | 1);
1118 prevpos = xc->valpos_mem[4*i+2];
1119 xc->valpos_mem[4*i+2] = 0;
1120 xc->valpos_mem[4*i+3] = 0; /* clear out tchn idx */
1148 fpos += fstWriterVarint(f, ((vm4ip[2] - prevpos) << 1) | 1);
1149 prevpos = vm4ip[2];
1150 vm4ip[2] = 0;
1151 vm4ip[3] = 0; /* clear out tchn idx */
11211152 }
11221153 else
11231154 {
12091240 fstWriterEmitSectionHeader(xc); /* emit next section header */
12101241 }
12111242 fflush(xc->handle);
1243
1244 xc->already_in_flush = 0;
12121245 }
12131246
12141247
12671300 }
12681301
12691302
1303 void fstWriterSetTimescaleFromString(void *ctx, const char *s)
1304 {
1305 struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
1306 if(xc && s)
1307 {
1308 int mat = 0;
1309 int exp = -9;
1310 int tv = atoi(s);
1311 const char *pnt = s;
1312
1313 while(*pnt)
1314 {
1315 switch(*pnt)
1316 {
1317 case 'm': exp = -3; mat = 1; break;
1318 case 'u': exp = -6; mat = 1; break;
1319 case 'n': exp = -9; mat = 1; break;
1320 case 'p': exp = -12; mat = 1; break;
1321 case 'f': exp = -15; mat = 1; break;
1322 case 'a': exp = -18; mat = 1; break;
1323 case 'z': exp = -21; mat = 1; break;
1324 case 's': exp = -0; mat = 1; break;
1325 default: break;
1326 }
1327
1328 if(mat) break;
1329 pnt++;
1330 }
1331
1332 if(tv == 10)
1333 {
1334 exp++;
1335 }
1336 else
1337 if(tv == 100)
1338 {
1339 exp+=2;
1340 }
1341
1342 fstWriterSetTimescale(ctx, exp);
1343 }
1344 }
1345
1346
12701347 void fstWriterSetPackType(void *ctx, int typ)
12711348 {
12721349 struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
14271504 {
14281505 uint32_t prev_chg;
14291506 uint32_t fpos;
1507 uint32_t *vm4ip;
14301508
14311509 if(!xc->valpos_mem)
14321510 {
1511 xc->vc_emitted = 1;
14331512 fstWriterCreateMmaps(xc);
14341513 }
14351514
1436 xc->vc_emitted = 1;
1437
14381515 handle--; /* move starting at 1 index to starting at 0 */
1439 offs = xc->valpos_mem[4*handle];
1440 len = xc->valpos_mem[4*handle+1];
1516 vm4ip = &(xc->valpos_mem[4*handle]);
1517 offs = vm4ip[0];
1518 len = vm4ip[1];
14411519 memcpy(xc->curval_mem + offs, buf, len);
14421520
14431521 if(!xc->is_initial_time)
14441522 {
1445 prev_chg = xc->valpos_mem[4*handle+2];
1523 prev_chg = vm4ip[2];
14461524 fpos = xc->vchn_siz;
14471525
14481526 fstFwrite(&prev_chg, 1, sizeof(uint32_t), xc->vchn_handle);
14491527 xc->vchn_siz += 4;
1450 xc->valpos_mem[4*handle+2] = fpos;
1451 xc->vchn_siz += fstWriterVarint(xc->vchn_handle, xc->tchn_idx - xc->valpos_mem[4*handle+3]);
1452 xc->valpos_mem[4*handle+3] = xc->tchn_idx;
1528 xc->vchn_siz += fstWriterVarint(xc->vchn_handle, xc->tchn_idx - vm4ip[3]);
14531529 fstFwrite(buf, len, 1, xc->vchn_handle);
14541530 xc->vchn_siz += len;
1531 vm4ip[3] = xc->tchn_idx;
1532 vm4ip[2] = fpos;
14551533 }
14561534 }
14571535 }
23402418 case FST_VT_VCD_ARRAY:
23412419 case FST_VT_VCD_REALTIME:
23422420 vartype = tag;
2343 vardir = fgetc(xc->fh);
2421 vardir = fgetc(xc->fh); /* unused in VCD reader */
23442422 pnt = str;
23452423 while((ch = fgetc(xc->fh)))
23462424 {
151151 void fstWriterSetDate(void *ctx, const char *dat);
152152 void fstWriterSetVersion(void *ctx, const char *vers);
153153 void fstWriterSetTimescale(void *ctx, int ts);
154 void fstWriterSetTimescaleFromString(void *ctx, const char *s);
154155 void fstWriterSetScope(void *ctx, enum fstScopeType scopetype,
155156 const char *scopename, const char *scopecomp);
156157 void fstWriterSetUpscope(void *ctx);
727727 lt->numfacs = facs_encountered; /* don't process alias value changes ever */
728728 }
729729
730 if(aliascache) free(aliascache);
730 free(aliascache);
731731 }
732732 }
733733
21492149
21502150 while(s)
21512151 {
2152 if(s->name) { free(s->name); }
2153 if(s->value) { free(s->value); }
2152 free(s->name);
2153 free(s->value);
21542154 s2=s->symchain;
21552155 free(s);
21562156 s=s2;
21802180 }
21812181
21822182 /*
2183 * $Id: lxt2_write.c,v 1.2 2008/12/20 05:08:26 gtkwave Exp $
2183 * $Id: lxt2_write.c,v 1.3 2010/05/03 20:11:03 gtkwave Exp $
21842184 * $Log: lxt2_write.c,v $
2185 * Revision 1.3 2010/05/03 20:11:03 gtkwave
2186 * cppcheck warning fixes
2187 *
21852188 * Revision 1.2 2008/12/20 05:08:26 gtkwave
21862189 * -Wshadow warning cleanups
21872190 *
3232 #include <ctype.h>
3333 #include <errno.h>
3434 #include <unistd.h>
35 #ifdef HAVE_INTTYPES_H
3536 #include <inttypes.h>
37 #endif
3638 #include <zlib.h>
3739
3840 #ifndef HAVE_FSEEKO
310312 #endif
311313
312314 /*
313 * $Id: lxt2_write.h,v 1.2 2010/02/18 17:27:07 gtkwave Exp $
315 * $Id: lxt2_write.h,v 1.3 2010/04/27 23:10:56 gtkwave Exp $
314316 * $Log: lxt2_write.h,v $
317 * Revision 1.3 2010/04/27 23:10:56 gtkwave
318 * made inttype.h inclusion conditional
319 *
315320 * Revision 1.2 2010/02/18 17:27:07 gtkwave
316321 * extern "C" headers / version bump
317322 *
11011101 lt_emitfacs(lt);
11021102 if(lt->dict) lt_finalize_dictionary(lt);
11031103
1104 if(lt->timebuff)
1105 {
1106 free(lt->timebuff);
1107 lt->timebuff=NULL;
1108 }
1104 free(lt->timebuff);
1105 lt->timebuff=NULL;
1106
11091107 if(lt->timehead)
11101108 {
11111109 struct lt_timetrail *t=lt->timehead;
14071405 lt->mintime = lt->maxtime = timeval;
14081406 }
14091407
1410 if(lt->timebuff)
1411 {
1412 free(lt->timebuff);
1413 }
1408 free(lt->timebuff);
14141409 lt->timebuff = trl;
14151410 lt->timeval = timeval;
14161411 rc=1;
28132808 }
28142809
28152810 /*
2816 * $Id: lxt_write.c,v 1.4 2009/03/29 00:50:00 gtkwave Exp $
2811 * $Id: lxt_write.c,v 1.5 2010/05/03 20:11:03 gtkwave Exp $
28172812 * $Log: lxt_write.c,v $
2813 * Revision 1.5 2010/05/03 20:11:03 gtkwave
2814 * cppcheck warning fixes
2815 *
28182816 * Revision 1.4 2009/03/29 00:50:00 gtkwave
28192817 * update lt_close() to zero out written section offset/size.
28202818 *
3434 #include <unistd.h>
3535 #include <zlib.h>
3636 #include <bzlib.h>
37 #ifdef HAVE_INTTYPES_H
3738 #include <inttypes.h>
39 #endif
3840
3941 #ifndef HAVE_FSEEKO
4042 #define fseeko fseek
263265 #endif
264266
265267 /*
266 * $Id: lxt_write.h,v 1.3 2010/03/18 17:12:37 gtkwave Exp $
268 * $Id: lxt_write.h,v 1.4 2010/04/27 23:10:56 gtkwave Exp $
267269 * $Log: lxt_write.h,v $
270 * Revision 1.4 2010/04/27 23:10:56 gtkwave
271 * made inttype.h inclusion conditional
272 *
268273 * Revision 1.3 2010/03/18 17:12:37 gtkwave
269274 * pedantic warning cleanups
270275 *
3434
3535 #ifndef _MSC_VER
3636 #include <unistd.h>
37 #ifdef HAVE_INTTYPES_H
3738 #include <inttypes.h>
39 #endif
3840 #else
3941 typedef long off_t;
4042 #include <windows.h>
289291 #endif
290292
291293 /*
292 * $Id: vzt_read.h,v 1.5 2010/02/18 17:27:07 gtkwave Exp $
294 * $Id: vzt_read.h,v 1.6 2010/04/27 23:10:56 gtkwave Exp $
293295 * $Log: vzt_read.h,v $
296 * Revision 1.6 2010/04/27 23:10:56 gtkwave
297 * made inttype.h inclusion conditional
298 *
294299 * Revision 1.5 2010/02/18 17:27:07 gtkwave
295300 * extern "C" headers / version bump
296301 *
3232 #include <ctype.h>
3333 #include <errno.h>
3434 #include <unistd.h>
35 #ifdef HAVE_INTTYPES_H
3536 #include <inttypes.h>
37 #endif
3638 #include <zlib.h>
3739 #include <bzlib.h>
3840 #include <LzmaLib.h>
294296 #endif
295297
296298 /*
297 * $Id: vzt_write.h,v 1.3 2010/02/18 17:27:07 gtkwave Exp $
299 * $Id: vzt_write.h,v 1.4 2010/04/27 23:10:56 gtkwave Exp $
298300 * $Log: vzt_write.h,v $
301 * Revision 1.4 2010/04/27 23:10:56 gtkwave
302 * made inttype.h inclusion conditional
303 *
299304 * Revision 1.3 2010/02/18 17:27:07 gtkwave
300305 * extern "C" headers / version bump
301306 *
1111 #ifndef WAVE_LX2RDR_H
1212 #define WAVE_LX2RDR_H
1313
14 #ifndef _MSC_VER
14 #ifdef HAVE_INTTYPES_H
1515 #include <inttypes.h>
1616 #endif
1717
3636 #endif
3737
3838 /*
39 * $Id: lx2.h,v 1.3 2009/06/07 08:40:44 gtkwave Exp $
39 * $Id: lx2.h,v 1.4 2010/04/27 23:10:56 gtkwave Exp $
4040 * $Log: lx2.h,v $
41 * Revision 1.4 2010/04/27 23:10:56 gtkwave
42 * made inttype.h inclusion conditional
43 *
4144 * Revision 1.3 2009/06/07 08:40:44 gtkwave
4245 * adding FST support
4346 *
6666 #include "rc.h"
6767 #include "translate.h"
6868 #include "ptranslate.h"
69 #include "ttranslate.h"
6970
7071 #include "tcl_helper.h"
7172 #if defined(HAVE_LIBTCL)
610611
611612 init_filetrans_data(); /* for file translation splay trees */
612613 init_proctrans_data(); /* for proc translation structs */
614 init_ttrans_data(); /* for transaction proc translation structs */
613615 if(!mainwindow_already_built)
614616 {
615617 atexit(remove_all_proc_filters);
618 atexit(remove_all_ttrans_filters);
616619 #if defined __MINGW32__
617620 atexit(close_all_fst_files);
618621 #endif
26502653 #endif
26512654
26522655 /*
2653 * $Id: main.c,v 1.97 2010/03/15 15:57:28 gtkwave Exp $
2656 * $Id: main.c,v 1.98 2010/03/31 15:42:47 gtkwave Exp $
26542657 * $Log: main.c,v $
2658 * Revision 1.98 2010/03/31 15:42:47 gtkwave
2659 * added preliminary transaction filter support
2660 *
26552661 * Revision 1.97 2010/03/15 15:57:28 gtkwave
26562662 * only allocate hash when necessary
26572663 *
2222 #include "vcd_saver.h"
2323 #include "translate.h"
2424 #include "ptranslate.h"
25 #include "ttranslate.h"
2526 #include "lx2.h"
2627 #include "hierpack.h"
2728 #include "tcl_helper.h"
305306 }
306307 }
307308
309
310 /********** transaction procsel filter install ********/
311
312 #if !defined __MINGW32__ && !defined _MSC_VER
313 void menu_dataformat_xlate_ttrans_1(GtkWidget *widget, gpointer data)
314 {
315 if(GLOBALS->helpbox_is_active)
316 {
317 help_text_bold("\n\nTransaction Filter Process");
318 help_text(
319 " will enable transaction filtering on marked traces using a filter process. A requester will appear to get the filter filename."
320 );
321 return;
322 }
323
324 ttrans_searchbox("Select Transaction Filter Process");
325 }
326
327 void menu_dataformat_xlate_ttrans_0(GtkWidget *widget, gpointer data)
328 {
329 if(GLOBALS->helpbox_is_active)
330 {
331 help_text_bold("\n\nTransaction Filter Process Disable");
332 help_text(
333 " will remove transaction filtering."
334 );
335 return;
336 }
337
338 install_ttrans_filter(0); /* disable, 0 is always NULL */
339 }
340 #endif
308341
309342 /********** procsel filter install ********/
310343
916949 }
917950 else if(t->vector==TRUE)
918951 {
919 t->name = t->n.vec->name;
952 t->name = t->n.vec->bvname;
920953 if(GLOBALS->hier_max_level)
921954 t->name = hier_extract(t->name, GLOBALS->hier_max_level);
922955 }
18511884 bits=t->n.vec->bits;
18521885 if(!(t->flags&TR_REVERSE))
18531886 {
1854 for(i=0;i<bits->nbits;i++)
1887 for(i=0;i<bits->nnbits;i++)
18551888 {
18561889 if(bits->nodes[i]->expansion) bits->nodes[i]->expansion->refcnt++;
18571890 AddNodeTraceReturn(bits->nodes[i],NULL, &tfix);
18631896 }
18641897 else
18651898 {
1866 for(i=(bits->nbits-1);i>-1;i--)
1899 for(i=(bits->nnbits-1);i>-1;i--)
18671900 {
18681901 if(bits->nodes[i]->expansion) bits->nodes[i]->expansion->refcnt++;
18691902 AddNodeTraceReturn(bits->nodes[i],NULL, &tfix);
21172150 free_2(t->name_full);
21182151 t->name_full = NULL;
21192152 }
2120 if (t->n.vec->name)
2153 if (t->n.vec->bvname)
21212154 {
2122 free_2(t->n.vec->name);
2155 free_2(t->n.vec->bvname);
21232156 }
21242157
2125 t->n.vec->name = (char *)malloc_2(1+strlen(GLOBALS->entrybox_text));
2126 strcpy(t->n.vec->name, GLOBALS->entrybox_text);
2127 t->name = t->n.vec->name;
2158 t->n.vec->bvname = (char *)malloc_2(1+strlen(GLOBALS->entrybox_text));
2159 strcpy(t->n.vec->bvname, GLOBALS->entrybox_text);
2160 t->name = t->n.vec->bvname;
21282161 if(GLOBALS->hier_max_level)
21292162 t->name = hier_extract(t->name, GLOBALS->hier_max_level);
21302163
21742207 }
21752208 }
21762209
2177 static bvptr combine_traces(int direction)
2210
2211 bvptr combine_traces(int direction, Trptr single_trace_only)
21782212 {
21792213 Trptr t, tmp;
21802214 int tmpi,dirty=0, attrib_reqd=0;
21832217
21842218 DEBUG(printf("Combine Traces\n"));
21852219
2186 t=GLOBALS->traces.first;
2220 t=single_trace_only ? single_trace_only : GLOBALS->traces.first;
21872221 while(t)
21882222 {
21892223 if((t->flags&TR_HIGHLIGHT)&&(!(t->flags&(TR_BLANK|TR_ANALOG_BLANK_STRETCH))))
22082242 }
22092243 }
22102244 }
2245 if(t == single_trace_only) break;
22112246 t=t->t_next;
22122247 }
22132248
22142249 if(!dirty)
22152250 {
2216 must_sel_nb();
2251 if(!single_trace_only) must_sel_nb();
22172252 return NULL;
22182253 }
2219 if(dirty>512)
2254 if(dirty>BITATTRIBUTES_MAX)
22202255 {
2221 char buf[512];
2222
2223 sprintf(buf,"%d bits selected, please use <= 512.\n",dirty);
2224 status_text(buf);
2256 char buf[128];
2257
2258 if(!single_trace_only)
2259 {
2260 sprintf(buf, "%d bits selected, please use <= %d.\n", dirty, BITATTRIBUTES_MAX);
2261 status_text(buf);
2262 }
22252263 return NULL;
22262264 }
22272265 else
22282266 {
22292267 int i,nodepnt=0;
2230 struct Node *n[512];
2231 struct BitAttributes ba[512];
2268 struct Node *n[BITATTRIBUTES_MAX];
2269 struct BitAttributes ba[BITATTRIBUTES_MAX];
22322270 struct Bits *b=NULL;
22332271 bvptr v=NULL;
22342272
2235 FreeCutBuffer();
2236 GLOBALS->traces.buffer=GLOBALS->traces.first;
2237 GLOBALS->traces.bufferlast=GLOBALS->traces.last;
2238 GLOBALS->traces.buffercount=GLOBALS->traces.total;
2239
2240 GLOBALS->traces.first=GLOBALS->traces.last=NULL; GLOBALS->traces.total=0;
2241
2242 t=GLOBALS->traces.buffer;
2273 if(!single_trace_only)
2274 {
2275 FreeCutBuffer();
2276 GLOBALS->traces.buffer=GLOBALS->traces.first;
2277 GLOBALS->traces.bufferlast=GLOBALS->traces.last;
2278 GLOBALS->traces.buffercount=GLOBALS->traces.total;
2279
2280 GLOBALS->traces.first=GLOBALS->traces.last=NULL; GLOBALS->traces.total=0;
2281
2282 t=GLOBALS->traces.buffer;
2283 }
2284 else
2285 {
2286 t = single_trace_only;
2287 }
22432288
22442289 while(t)
22452290 {
22612306
22622307 if(!(t->flags&TR_REVERSE))
22632308 {
2264 for(ix=0;ix<bits->nbits;ix++)
2309 for(ix=0;ix<bits->nnbits;ix++)
22652310 {
22662311 if(bits->nodes[ix]->expansion) bits->nodes[ix]->expansion->refcnt++;
22672312 ba[nodepnt].shift = t->shift + (oldba ? oldba[ix].shift : 0);
22712316 }
22722317 else
22732318 {
2274 for(ix=(bits->nbits-1);ix>-1;ix--)
2319 for(ix=(bits->nnbits-1);ix>-1;ix--)
22752320 {
22762321 if(bits->nodes[ix]->expansion) bits->nodes[ix]->expansion->refcnt++;
22772322 ba[nodepnt].shift = t->shift + (oldba ? oldba[ix].shift : 0);
23072352 }
23082353 }
23092354 if(nodepnt==dirty) break;
2355 if(t == single_trace_only) break;
23102356 t=t->t_next;
23112357 }
23122358
24112457 }
24122458 }
24132459
2414 b->nbits=nodepnt;
2460 b->nnbits=nodepnt;
24152461
24162462 if(!bitblast_parent)
24172463 {
25062552 return NULL;
25072553 }
25082554
2509 tmp=GLOBALS->traces.buffer; GLOBALS->traces.buffer=GLOBALS->traces.first; GLOBALS->traces.first=tmp;
2510 tmp=GLOBALS->traces.bufferlast; GLOBALS->traces.bufferlast=GLOBALS->traces.last; GLOBALS->traces.last=tmp;
2511 tmpi=GLOBALS->traces.buffercount; GLOBALS->traces.buffercount=GLOBALS->traces.total;
2512 GLOBALS->traces.total=tmpi;
2513 PasteBuffer();
2555 if(!single_trace_only)
2556 {
2557 tmp=GLOBALS->traces.buffer; GLOBALS->traces.buffer=GLOBALS->traces.first; GLOBALS->traces.first=tmp;
2558 tmp=GLOBALS->traces.bufferlast; GLOBALS->traces.bufferlast=GLOBALS->traces.last; GLOBALS->traces.last=tmp;
2559 tmpi=GLOBALS->traces.buffercount; GLOBALS->traces.buffercount=GLOBALS->traces.total;
2560 GLOBALS->traces.total=tmpi;
2561 PasteBuffer();
2562 }
25142563
25152564 return v;
2516
25172565 }
25182566 }
25192567
25372585 }
25382586
25392587 if(GLOBALS->dnd_state) { dnd_error(); return; } /* don't mess with sigs when dnd active */
2540 v = combine_traces(1); /* down */
2588 v = combine_traces(1, NULL); /* down */
25412589
25422590 if (v)
25432591 {
25872635 }
25882636
25892637 if(GLOBALS->dnd_state) { dnd_error(); return; } /* don't mess with sigs when dnd active */
2590 v = combine_traces(0); /* up */
2638 v = combine_traces(0, NULL); /* up */
25912639
25922640 if (v)
25932641 {
26182666 }
26192667
26202668 /**/
2621 #if 0
2622 /* this function should be obsolete with the new group handling, so commented out... */
2623
2624 void
2625 menu_reduce_singlebit_vex(GtkWidget *widget, gpointer data)
2626 {
2627 Trptr t, tmp;
2628 int tmpi,dirty=0;
2629
2630 if(GLOBALS->helpbox_is_active)
2631 {
2632 help_text_bold("\n\nReduce Single Bit Vectors");
2633 help_text(
2634 " decomposes the highlighted traces into their individual"
2635 " bits only if the highlighted traces are one bit wide vectors."
2636 " In effect, this function allows single-bit vectors"
2637 " to be viewed as signals."
2638 " The resulting bits are converted to traces and inserted after the"
2639 " last converted trace with the pre-conversion traces"
2640 " being placed in the cut buffer."
2641 );
2642 return;
2643 }
2644
2645
2646 if(GLOBALS->dnd_state) { dnd_error(); return; } /* don't mess with sigs when dnd active */
2647
2648 DEBUG(printf("Reduce Singlebit Vex\n"));
2649
2650 t=GLOBALS->traces.first;
2651 while(t)
2652 {
2653 if((t->flags&TR_HIGHLIGHT)&&(!(t->flags&(TR_BLANK|TR_ANALOG_BLANK_STRETCH))))
2654 {
2655 dirty=1;
2656 break;
2657 }
2658 t=t->t_next;
2659 }
2660
2661 if(dirty)
2662 {
2663 FreeCutBuffer();
2664 GLOBALS->traces.buffer=GLOBALS->traces.first;
2665 GLOBALS->traces.bufferlast=GLOBALS->traces.last;
2666 GLOBALS->traces.buffercount=GLOBALS->traces.total;
2667
2668 GLOBALS->traces.first=GLOBALS->traces.last=NULL; GLOBALS->traces.total=0;
2669
2670 t=GLOBALS->traces.buffer;
2671
2672 while(t)
2673 {
2674 if(t->flags&TR_HIGHLIGHT)
2675 {
2676 if(t->flags&(TR_BLANK|TR_ANALOG_BLANK_STRETCH))
2677 {
2678 AddBlankTrace(t->name);
2679 }
2680 else
2681 {
2682 if(t->vector)
2683 {
2684 bptr bits;
2685 bits=t->n.vec->bits;
2686 if(bits->nbits==1)
2687 {
2688 AddNode(bits->nodes[0],NULL);
2689 }
2690 else
2691 {
2692 /* reset the cut criteria */
2693 t->flags&=(~TR_HIGHLIGHT);
2694 }
2695 }
2696 else
2697 {
2698 AddNode(t->n.nd,NULL);
2699 }
2700 }
2701 }
2702 t=t->t_next;
2703 }
2704
2705 tmp=GLOBALS->traces.buffer; GLOBALS->traces.buffer=GLOBALS->traces.first; GLOBALS->traces.first=tmp;
2706 tmp=GLOBALS->traces.bufferlast; GLOBALS->traces.bufferlast=GLOBALS->traces.last; GLOBALS->traces.last=tmp;
2707 tmpi=GLOBALS->traces.buffercount; GLOBALS->traces.buffercount=GLOBALS->traces.total;
2708 GLOBALS->traces.total=tmpi;
2709 PasteBuffer();
2710 /* CutBuffer(); */
2711
2712 GLOBALS->signalwindow_width_dirty=1;
2713 MaxSignalLength();
2714 signalarea_configure_event(GLOBALS->signalarea, NULL);
2715 wavearea_configure_event(GLOBALS->wavearea, NULL);
2716 }
2717 else
2718 {
2719 must_sel_nb();
2720 }
2721 }
2722 #endif
2723
2724 /**/
2669
27252670 void menu_tracesearchbox_callback(GtkWidget *widget, gpointer data)
27262671 {
27272672 }
28592804 g_now->vcd_jmp_buf = NULL;
28602805
28612806 /* copy old file req strings into new context */
2807 strcpy2_into_new_context(GLOBALS, &GLOBALS->fcurr_ttranslate_c_1, &g_old->fcurr_ttranslate_c_1);
28622808 strcpy2_into_new_context(GLOBALS, &GLOBALS->fcurr_ptranslate_c_1, &g_old->fcurr_ptranslate_c_1);
28632809 strcpy2_into_new_context(GLOBALS, &GLOBALS->fcurr_translate_c_2, &g_old->fcurr_translate_c_2);
28642810
33143260 free_2(t->name_full);
33153261 t->name_full = NULL;
33163262
3317 name_full = (t->vector) ? t->n.vec->name : t->n.nd->nname;
3263 name_full = (t->vector) ? t->n.vec->bvname : t->n.nd->nname;
33183264 t->name = name_full;
33193265 if (GLOBALS->hier_max_level)
33203266 t->name = hier_extract(t->name, GLOBALS->hier_max_level);
36593605 {
36603606 if((t->flags & TR_PTRANSLATED) && (!t->p_filter)) t->flags &= (~TR_PTRANSLATED);
36613607 if((t->flags & TR_FTRANSLATED) && (!t->f_filter)) t->flags &= (~TR_FTRANSLATED);
3608 if((t->flags & TR_TTRANSLATED) && (!t->t_filter)) t->flags &= (~TR_TTRANSLATED);
36623609 fprintf(wave,"@%x\n",def=t->flags);
36633610 }
36643611
36943641 }
36953642 }
36963643
3644 /* NOT an else! */
3645 if(t->flags & TR_TTRANSLATED)
3646 {
3647 if(t->t_filter && GLOBALS->ttranssel_filter[t->t_filter])
3648 {
3649 fprintf(wave, "^<%d %s\n", t->t_filter, GLOBALS->ttranssel_filter[t->t_filter]);
3650 }
3651 else
3652 {
3653 fprintf(wave, "^<%d %s\n", 0, "disabled");
3654 }
3655 }
3656
36973657 if(t->vector)
36983658 {
36993659 int ix;
37053665 bits = t->n.vec->bits;
37063666 ba = bits ? bits->attribs : NULL;
37073667
3708 fprintf(wave,"%c{%s}", ba ? ':' : '#', t->n.vec->name);
3668 fprintf(wave,"%c{%s}", ba ? ':' : '#',
3669 t->n.vec->transaction_cache ? t->n.vec->transaction_cache->bvname : t->n.vec->bvname);
37093670
37103671 nodes=t->n.vec->bits->nodes;
3711 for(ix=0;ix<t->n.vec->nbits;ix++)
3672 for(ix=0;ix<t->n.vec->bits->nnbits;ix++)
37123673 {
37133674 if(nodes[ix]->expansion)
37143675 {
37933754 {
37943755 if((t->flags & TR_FTRANSLATED) && (!t->f_filter)) t->flags &= (~TR_FTRANSLATED);
37953756 if((t->flags & TR_PTRANSLATED) && (!t->p_filter)) t->flags &= (~TR_PTRANSLATED);
3757 if((t->flags & TR_TTRANSLATED) && (!t->t_filter)) t->flags &= (~TR_TTRANSLATED);
37963758 fprintf(wave,"@%x\n",def=t->flags);
37973759 }
37983760
38283790 }
38293791 }
38303792
3793 /* NOT an else! */
3794 if(t->flags & TR_TTRANSLATED)
3795 {
3796 if(t->t_filter && GLOBALS->ttranssel_filter[t->t_filter])
3797 {
3798 fprintf(wave, "^<%d %s\n", t->t_filter, GLOBALS->ttranssel_filter[t->t_filter]);
3799 }
3800 else
3801 {
3802 fprintf(wave, "^<%d %s\n", 0, "disabled");
3803 }
3804 }
3805
3806
38313807 if(t->vector)
38323808 {
38333809 int ix;
38403816 bits = t->n.vec->bits;
38413817 ba = bits ? bits->attribs : NULL;
38423818
3843 fprintf(wave,"%c{%s}", ba ? ':' : '#', t->n.vec->name);
3819 fprintf(wave,"%c{%s}", ba ? ':' : '#',
3820 t->n.vec->transaction_cache ? t->n.vec->transaction_cache->bvname : t->n.vec->bvname);
38443821
38453822 nodes=t->n.vec->bits->nodes;
3846 for(ix=0;ix<t->n.vec->nbits;ix++)
3823 for(ix=0;ix<t->n.vec->bits->nnbits;ix++)
38473824 {
38483825 if(nodes[ix]->expansion)
38493826 {
46394616 }
46404617
46414618 void
4619 menu_dataformat_real2bon(GtkWidget *widget, gpointer data)
4620 {
4621 if(GLOBALS->helpbox_is_active)
4622 {
4623 help_text_bold("\n\nData Format-RealToBits On");
4624 help_text(
4625 " will step through all highlighted traces and ensure that"
4626 " Real vectors with this qualifier will be displayed as Hex"
4627 " values. Note that this only works for Real quantities"
4628 " and other ones will remain to display as binary. This is a pre-filter"
4629 " so it is possible to invert, reverse, apply Decimal, etc. It will not be"
4630 " possible however to expand those values into their constituent bits."
4631 );
4632 return;
4633 }
4634
4635 dataformat( ~(TR_REAL2BITS|TR_NUMMASK), TR_REAL2BITS|TR_HEX );
4636 }
4637
4638 void
4639 menu_dataformat_real2boff(GtkWidget *widget, gpointer data)
4640 {
4641 if(GLOBALS->helpbox_is_active)
4642 {
4643 help_text_bold("\n\nData Format-RealToBits Off");
4644 help_text(
4645 " will step through all highlighted traces and ensure that"
4646 " the Real To Bits qualifier is removed from those traces."
4647 );
4648 return;
4649 }
4650
4651 dataformat( ~(TR_REAL2BITS), 0 );
4652 }
4653
4654 void
46424655 menu_dataformat_hex(GtkWidget *widget, gpointer data)
46434656 {
46444657 if(GLOBALS->helpbox_is_active)
54465459 " S = Analog Step\n"
54475460 " I = Analog Interpolated\n"
54485461 " R = Real\n"
5462 " r = Real To Bits\n"
54495463 " 0 = Range Fill with 0s\n"
54505464 " 1 = Range Fill with 1s\n"
54515465 " G = Binary to Gray\n"
55435557 WAVE_GTKIFE("/Edit/Data Format/Octal", "<Alt>O", menu_dataformat_oct, WV_MENU_EDFO, "<Item>"),
55445558 WAVE_GTKIFE("/Edit/Data Format/ASCII", NULL, menu_dataformat_ascii, WV_MENU_EDFA, "<Item>"),
55455559 WAVE_GTKIFE("/Edit/Data Format/BitsToReal", NULL, menu_dataformat_real, WV_MENU_EDRL, "<Item>"),
5560 WAVE_GTKIFE("/Edit/Data Format/RealToBits/On", NULL, menu_dataformat_real2bon, WV_MENU_EDR2BON, "<Item>"),
5561 WAVE_GTKIFE("/Edit/Data Format/RealToBits/Off", NULL, menu_dataformat_real2boff, WV_MENU_EDR2BOFF, "<Item>"),
55465562 WAVE_GTKIFE("/Edit/Data Format/Right Justify/On", "<Alt>J", menu_dataformat_rjustify_on, WV_MENU_EDFRJON, "<Item>"),
55475563 WAVE_GTKIFE("/Edit/Data Format/Right Justify/Off", "<Shift><Alt>J", menu_dataformat_rjustify_off, WV_MENU_EDFRJOFF, "<Item>"),
55485564 WAVE_GTKIFE("/Edit/Data Format/Invert/On", "<Alt>I", menu_dataformat_invert_on, WV_MENU_EDFION, "<Item>"),
55555571 #if !defined __MINGW32__ && !defined _MSC_VER
55565572 WAVE_GTKIFE("/Edit/Data Format/Translate Filter Process/Disable", NULL, menu_dataformat_xlate_proc_0, WV_MENU_XLP_0, "<Item>"),
55575573 WAVE_GTKIFE("/Edit/Data Format/Translate Filter Process/Enable and Select", NULL, menu_dataformat_xlate_proc_1, WV_MENU_XLP_1, "<Item>"),
5574 WAVE_GTKIFE("/Edit/Data Format/Transaction Filter Process/Disable", NULL, menu_dataformat_xlate_ttrans_0, WV_MENU_TTXLP_0, "<Item>"),
5575 WAVE_GTKIFE("/Edit/Data Format/Transaction Filter Process/Enable and Select", NULL, menu_dataformat_xlate_ttrans_1, WV_MENU_TTXLP_1, "<Item>"),
55585576 #endif
55595577 WAVE_GTKIFE("/Edit/Data Format/Analog/Off", NULL, menu_dataformat_analog_off, WV_MENU_EDFAOFF, "<Item>"),
55605578 WAVE_GTKIFE("/Edit/Data Format/Analog/Step", NULL, menu_dataformat_analog_step, WV_MENU_EDFASTEP, "<Item>"),
56405658 WAVE_GTKIFE("/Markers/<separator>", NULL, NULL, WV_MENU_SEP8, "<Separator>"),
56415659 WAVE_GTKIFE("/Markers/Wave Scrolling", "F9", wave_scrolling_on, WV_MENU_MWSON, "<ToggleItem>"),
56425660
5643 WAVE_GTKIFE("/Markers/Locking/Lock to Lesser Named Marker", "1", lock_marker_left, WV_MENU_MLKLT, "<Item>"),
5644 WAVE_GTKIFE("/Markers/Locking/Lock to Greater Named Marker", "2", lock_marker_right, WV_MENU_MLKRT, "<Item>"),
5645 WAVE_GTKIFE("/Markers/Locking/Unlock from Named Marker", "0", unlock_marker, WV_MENU_MLKOFF, "<Item>"),
5661 WAVE_GTKIFE("/Markers/Locking/Lock to Lesser Named Marker", "Q", lock_marker_left, WV_MENU_MLKLT, "<Item>"),
5662 WAVE_GTKIFE("/Markers/Locking/Lock to Greater Named Marker", "W", lock_marker_right, WV_MENU_MLKRT, "<Item>"),
5663 WAVE_GTKIFE("/Markers/Locking/Unlock from Named Marker", "O", unlock_marker, WV_MENU_MLKOFF, "<Item>"),
56465664
56475665 WAVE_GTKIFE("/View/Show Grid", "<Alt>G", menu_show_grid, WV_MENU_VSG, "<ToggleItem>"),
56485666 WAVE_GTKIFE("/View/<separator>", NULL, NULL, WV_MENU_SEP9, "<Separator>"),
60536071 WAVE_GTKIFE("/Data Format/Octal", NULL, menu_dataformat_oct, WV_MENU_EDFO, "<Item>"),
60546072 WAVE_GTKIFE("/Data Format/ASCII", NULL, menu_dataformat_ascii, WV_MENU_EDFA, "<Item>"),
60556073 WAVE_GTKIFE("/Data Format/BitsToReal", NULL, menu_dataformat_real, WV_MENU_EDRL, "<Item>"),
6074 WAVE_GTKIFE("/Data Format/RealToBits/On", NULL, menu_dataformat_real2bon, WV_MENU_EDR2BON, "<Item>"),
6075 WAVE_GTKIFE("/Data Format/RealToBits/Off", NULL, menu_dataformat_real2boff, WV_MENU_EDR2BOFF, "<Item>"),
60566076 WAVE_GTKIFE("/Data Format/Right Justify/On", NULL, menu_dataformat_rjustify_on, WV_MENU_EDFRJON, "<Item>"),
60576077 WAVE_GTKIFE("/Data Format/Right Justify/Off", NULL, menu_dataformat_rjustify_off, WV_MENU_EDFRJOFF, "<Item>"),
60586078 WAVE_GTKIFE("/Data Format/Invert/On", NULL, menu_dataformat_invert_on, WV_MENU_EDFION, "<Item>"),
60646084 #if !defined __MINGW32__ && !defined _MSC_VER
60656085 WAVE_GTKIFE("/Data Format/Translate Filter Process/Disable", NULL, menu_dataformat_xlate_proc_0, WV_MENU_XLP_0, "<Item>"),
60666086 WAVE_GTKIFE("/Data Format/Translate Filter Process/Enable and Select", NULL, menu_dataformat_xlate_proc_1, WV_MENU_XLP_1, "<Item>"),
6087 WAVE_GTKIFE("/Data Format/Transaction Filter Process/Disable", NULL, menu_dataformat_xlate_ttrans_0, WV_MENU_TTXLP_0, "<Item>"),
6088 WAVE_GTKIFE("/Data Format/Transaction Filter Process/Enable and Select", NULL, menu_dataformat_xlate_ttrans_1, WV_MENU_TTXLP_1, "<Item>"),
60676089 #endif
60686090 WAVE_GTKIFE("/Data Format/Analog/Off", NULL, menu_dataformat_analog_off, WV_MENU_EDFAOFF, "<Item>"),
60696091 WAVE_GTKIFE("/Data Format/Analog/Step", NULL, menu_dataformat_analog_step, WV_MENU_EDFASTEP, "<Item>"),
61656187 }
61666188
61676189 /*
6168 * $Id: menu.c,v 1.98 2010/03/18 17:12:37 gtkwave Exp $
6190 * $Id: menu.c,v 1.105 2010/04/14 07:45:12 gtkwave Exp $
61696191 * $Log: menu.c,v $
6192 * Revision 1.105 2010/04/14 07:45:12 gtkwave
6193 * P -> O to avoid accelerator conflict with psec
6194 *
6195 * Revision 1.104 2010/04/14 03:28:39 gtkwave
6196 * change lock/unlock from 1/2/0 to Q/W/P
6197 *
6198 * Revision 1.103 2010/04/12 23:07:12 gtkwave
6199 * add ability to make single signals transactions
6200 *
6201 * Revision 1.102 2010/04/07 01:50:45 gtkwave
6202 * improved name handling for bvname, add $next transaction operation
6203 *
6204 * Revision 1.101 2010/04/04 19:09:57 gtkwave
6205 * rename name->bvname in struct BitVector for easier grep tracking
6206 *
6207 * Revision 1.100 2010/03/31 15:42:47 gtkwave
6208 * added preliminary transaction filter support
6209 *
6210 * Revision 1.99 2010/03/24 23:05:09 gtkwave
6211 * added RealToBits menu option
6212 *
61706213 * Revision 1.98 2010/03/18 17:12:37 gtkwave
61716214 * pedantic warning cleanups
61726215 *
9595 WV_MENU_EDFO,
9696 WV_MENU_EDFA,
9797 WV_MENU_EDRL,
98 WV_MENU_EDR2BON,
99 WV_MENU_EDR2BOFF,
98100 WV_MENU_EDFRJON,
99101 WV_MENU_EDFRJOFF,
100102 WV_MENU_EDFION,
106108 #if !defined __MINGW32__ && !defined _MSC_VER
107109 WV_MENU_XLP_0,
108110 WV_MENU_XLP_1,
111 WV_MENU_TTXLP_0,
112 WV_MENU_TTXLP_1,
109113 #endif
110114 WV_MENU_EDFAOFF,
111115 WV_MENU_EDFASTEP,
339343
340344 void SetTraceScrollbarRowValue(int row, unsigned center);
341345
346 bvptr combine_traces(int direction, Trptr single_trace_only);
347
342348 #endif
343349
344350 /*
345 * $Id: menu.h,v 1.33 2010/02/24 18:06:14 gtkwave Exp $
351 * $Id: menu.h,v 1.36 2010/04/12 23:07:12 gtkwave Exp $
346352 * $Log: menu.h,v $
353 * Revision 1.36 2010/04/12 23:07:12 gtkwave
354 * add ability to make single signals transactions
355 *
356 * Revision 1.35 2010/03/31 15:42:47 gtkwave
357 * added preliminary transaction filter support
358 *
359 * Revision 1.34 2010/03/24 23:05:10 gtkwave
360 * added RealToBits menu option
361 *
347362 * Revision 1.33 2010/02/24 18:06:14 gtkwave
348363 * removed reduce single bit vectors
349364 *
5959 if((flags & TR_REAL) != 0) { ch[pos++] = 'R'; }
6060
6161 /* [7] */
62 if((flags & TR_REAL2BITS) != 0) { ch[pos++] = 'r'; }
63
64 /* [8] */
6265 if((flags & TR_ZEROFILL) != 0) { ch[pos++] = '0'; }
6366 else
6467 if((flags & TR_ONEFILL) != 0) { ch[pos++] = '1'; }
6568
66 /* [8] */
69 /* [9] */
6770 if((flags & TR_BINGRAY) != 0) { ch[pos++] = 'G'; }
68 /* [9] */
71
72 /* [10] (at worst case this needs 11 characters) */
6973 if((flags & TR_GRAYBIN) != 0) { ch[pos++] = 'g'; }
7074
71 /* [10] (at worst case this needs 11 characters) */
75 /* [11] (at worst case this needs 12 characters) */
7276 ch[pos] = 0;
7377
7478 return(pos);
9498 char *str;
9599 vptr v;
96100
97 v=bsearch_vector(t->n.vec,tim);
101 v=bsearch_vector(t->n.vec,tim - t->shift);
98102 str=convert_ascii(t,v);
99103 if(str)
100104 {
112116 {
113117 char *str;
114118 hptr h_ptr;
115 if((h_ptr=bsearch_node(t->n.nd,tim)))
119 if((h_ptr=bsearch_node(t->n.nd,tim - t->shift)))
116120 {
117121 if(!t->n.nd->extvals)
118122 {
140144 {
141145 if(!(h_ptr->flags&HIST_STRING))
142146 {
143 str=convert_ascii_real((double *)h_ptr->v.h_vector);
147 str=convert_ascii_real(t, (double *)h_ptr->v.h_vector);
144148 }
145149 else
146150 {
250254 char *flagged_name = NULL;
251255 char *alternate_name = NULL;
252256 int fh;
253 char flag_string[11];
257 char flag_string[65];
254258
255259 if(GLOBALS->disable_mouseover)
256260 {
395399 }
396400
397401 /*
398 * $Id: mouseover.c,v 1.13 2010/03/14 07:09:49 gtkwave Exp $
402 * $Id: mouseover.c,v 1.15 2010/04/01 03:10:58 gtkwave Exp $
399403 * $Log: mouseover.c,v $
404 * Revision 1.15 2010/04/01 03:10:58 gtkwave
405 * time warp fixes
406 *
407 * Revision 1.14 2010/03/24 23:05:10 gtkwave
408 * added RealToBits menu option
409 *
400410 * Revision 1.13 2010/03/14 07:09:49 gtkwave
401411 * removed ExtNode and merged with Node
402412 *
3434 {
3535 if(t->vector==TRUE)
3636 {
37 s = strdup_2(t->n.vec->name);
37 s = strdup_2(t->n.vec->bvname);
3838 }
3939 else
4040 {
8787 if((flags & TR_REAL) != 0) { ch[pos++] = 'R'; }
8888
8989 /* [7] */
90 if((flags & TR_REAL2BITS) != 0) { ch[pos++] = 'r'; }
91
92 /* [8] */
9093 if((flags & TR_ZEROFILL) != 0) { ch[pos++] = '0'; }
9194 else
9295 if((flags & TR_ONEFILL) != 0) { ch[pos++] = '1'; }
9396
94 /* [8] */
97 /* [9] */
9598 if((flags & TR_BINGRAY) != 0) { ch[pos++] = 'G'; }
96 /* [9] */
99 /* [10] */
97100 if((flags & TR_GRAYBIN) != 0) { ch[pos++] = 'g'; }
98101
99 /* [10] (at worst case this front part needs 11 characters) */
102 /* [11] (at worst case this front part needs 12 characters) */
100103 ch[pos] = 0;
101104
102105 if(!t->vector)
139142 char *str;
140143 vptr v;
141144
142 v=bsearch_vector(t->n.vec,tim);
145 v=bsearch_vector(t->n.vec,tim - t->shift);
143146 str=convert_ascii(t,v);
144147 if(str)
145148 {
157160 {
158161 char *str;
159162 hptr h_ptr;
160 if((h_ptr=bsearch_node(t->n.nd,tim)))
163 if((h_ptr=bsearch_node(t->n.nd,tim - t->shift)))
161164 {
162165 if(!t->n.nd->extvals)
163166 {
185188 {
186189 if(!(h_ptr->flags&HIST_STRING))
187190 {
188 str=convert_ascii_real((double *)h_ptr->v.h_vector);
191 str=convert_ascii_real(t, (double *)h_ptr->v.h_vector);
189192 }
190193 else
191194 {
442445 }
443446
444447 /*
445 * $Id: mouseover_sigs.c,v 1.7 2010/03/14 07:09:49 gtkwave Exp $
448 * $Id: mouseover_sigs.c,v 1.10 2010/04/04 19:09:57 gtkwave Exp $
446449 * $Log: mouseover_sigs.c,v $
450 * Revision 1.10 2010/04/04 19:09:57 gtkwave
451 * rename name->bvname in struct BitVector for easier grep tracking
452 *
453 * Revision 1.9 2010/04/01 03:10:58 gtkwave
454 * time warp fixes
455 *
456 * Revision 1.8 2010/03/24 23:05:10 gtkwave
457 * added RealToBits menu option
458 *
447459 * Revision 1.7 2010/03/14 07:09:49 gtkwave
448460 * removed ExtNode and merged with Node
449461 *
566566 int vlen = 0;
567567 int i, trwhich, trtarget, num_traces_displayable;
568568 GtkAdjustment *sadj;
569 char sbuf[128];
570 int bufxlen;
571 int bufclen;
569 char buf[2048];
570 bvptr bv;
571 Trptr tscan;
572
572573
573574 GLOBALS->ps_nummaxchars_print_c_1 = 7; /* allows a good spacing if 60 pixel default
574575 * is used */
596597
597598 for (i = 0; (i < num_traces_displayable) && (t); i++)
598599 {
599
600 sbuf[0] = 0;
601 bufxlen = bufclen = 0;
602 if ((GLOBALS->shift_timebase = t->shift))
603 {
604 sbuf[0] = '(';
605 reformat_time (sbuf + 1, t->shift, GLOBALS->time_dimension);
606 strcpy (sbuf + (bufclen = strlen (sbuf + 1) + 1), ")");
607 bufclen++;
608 bufxlen = font_engine_string_measure (GLOBALS->signalfont, sbuf);
609 }
610
611 if ((!t->vector) && (t->n.nd) && (t->n.nd->array_height))
612 {
613 bufclen +=
614 sprintf (sbuf + strlen (sbuf), "{%d}", t->n.nd->this_row);
615 bufxlen = font_engine_string_measure (GLOBALS->signalfont, sbuf);
616 }
617
618 if (t->flags & (TR_BLANK | TR_ANALOG_BLANK_STRETCH))
619 {
620 if (t->name)
600 char *subname = NULL;
601 bv = NULL;
602 tscan = NULL;
603
604 if(t->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)) /* seek to real xact trace if present... */
605 {
606 int bcnt = 0;
607 tscan = t;
608 while((tscan) && (tscan = GivePrevTrace(tscan)))
609 {
610 if(!(tscan->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)))
611 {
612 if(tscan->flags & TR_TTRANSLATED)
613 {
614 break; /* found it */
615 }
616 else
617 {
618 tscan = NULL;
619 }
620 }
621 else
622 {
623 bcnt++; /* bcnt is number of blank traces */
624 }
625 }
626
627 if((tscan)&&(tscan->vector))
628 {
629 bv = tscan->n.vec;
630 do
631 {
632 bv = bv->transaction_chain; /* correlate to blank trace */
633 } while(bv && (bcnt--));
634 if(bv)
635 {
636 subname = bv->bvname;
637 if(GLOBALS->hier_max_level)
638 subname = hier_extract(subname, GLOBALS->hier_max_level);
639 }
640 }
641 }
642
643 populateBuffer(t, subname, buf);
644
645 if (!bv && (t->flags & (TR_BLANK | TR_ANALOG_BLANK_STRETCH))) /* for "comment" style blank traces */
646 {
647 if (buf[0])
621648 {
622649 len =
623 font_engine_string_measure (GLOBALS->signalfont, t->name) + bufxlen;
624 numchars = strlen (t->name) + bufclen;
650 font_engine_string_measure (GLOBALS->signalfont, buf);
651 numchars = strlen (buf);
625652
626653 if (len > maxlen)
627654 maxlen = len;
628655 if (numchars > GLOBALS->ps_nummaxchars_print_c_1)
629656 GLOBALS->ps_nummaxchars_print_c_1 = numchars;
630 }
631 }
632 else if (t->name)
633 {
634 len = font_engine_string_measure (GLOBALS->signalfont, t->name) + bufxlen;
635 numchars = strlen (t->name) + bufclen;
657
658 if(t->asciivalue)
659 {
660 free_2(t->asciivalue); t->asciivalue = NULL;
661 }
662 }
663 }
664 else if (buf[0] || subname)
665 {
666 len = font_engine_string_measure (GLOBALS->signalfont, buf);
667 numchars = strlen (buf);
636668 if ((GLOBALS->tims.marker != -1) && (!(t->flags & TR_EXCLUDE)))
637669 {
638670 t->asciitime = GLOBALS->tims.marker;
639671 if (t->asciivalue)
640672 free_2 (t->asciivalue);
641673
642 if (t->vector)
674 if (bv || t->vector)
643675 {
644676 char *str, *str2;
645677 vptr v;
646
647 v = bsearch_vector (t->n.vec, GLOBALS->tims.marker);
648 str = convert_ascii (t, v);
678 Trptr ts;
679 TraceEnt t_temp;
680
681 if(bv)
682 {
683 ts = &t_temp;
684 memcpy(ts, tscan, sizeof(TraceEnt));
685 ts->vector = 1;
686 ts->n.vec = bv;
687 }
688 else
689 {
690 ts = t;
691 bv = t->n.vec;
692 }
693
694 v = bsearch_vector (bv, GLOBALS->tims.marker - ts->shift);
695 str = convert_ascii (ts, v);
649696 if (str)
650697 {
651698 int slen;
682729 char *str;
683730 hptr h_ptr;
684731
685 if ((h_ptr = bsearch_node (t->n.nd, GLOBALS->tims.marker)))
732 if ((h_ptr = bsearch_node (t->n.nd, GLOBALS->tims.marker - t->shift)))
686733 {
687734 if (!t->n.nd->extvals)
688735 {
716763 if (!(h_ptr->flags & HIST_STRING))
717764 {
718765 str =
719 convert_ascii_real ((double *) h_ptr->v.
766 convert_ascii_real (t, (double *) h_ptr->v.
720767 h_vector);
721768 }
722769 else
18391886 h = h->next;
18401887 lasttype = type;
18411888 }
1842
1843 GLOBALS->tims.start += GLOBALS->shift_timebase;
1844 GLOBALS->tims.end += GLOBALS->shift_timebase;
18451889 }
18461890
18471891 static void
19211965 }
19221966
19231967 pr_draw_hptr_trace_vector_analog (prc, t, h, which, ext);
1968 GLOBALS->tims.start -= GLOBALS->shift_timebase;
1969 GLOBALS->tims.end -= GLOBALS->shift_timebase;
19241970 return;
19251971 }
19261972
20342080
20352081 if (width > GLOBALS->vector_padding)
20362082 {
2083 char *t_ascii; /* to skip past color ? ? string */
2084
20372085 if (h->flags & HIST_REAL)
20382086 {
20392087 if (!(h->flags & HIST_STRING))
20402088 {
20412089 ascii =
2042 convert_ascii_real ((double *) h->v.h_vector);
2090 convert_ascii_real (t, (double *) h->v.h_vector);
20432091 }
20442092 else
20452093 {
20522100 ascii = convert_ascii_vec (t, h->v.h_vector);
20532101 }
20542102
2103 if((*ascii=='?')&&((t_ascii=strchr(ascii+1, '?')))) { t_ascii++; } else { t_ascii = ascii; }
20552104
20562105 if (((pixlen =
20572106 font_engine_string_measure (GLOBALS->wavefont,
2058 ascii)) +
2107 t_ascii)) +
20592108 GLOBALS->vector_padding <= width)
20602109 || ((_x1 >= GLOBALS->wavewidth)
20612110 && (prc->gpd == &ps_print_device)))
20622111 {
2063 pr_draw_string (prc, _x0 + 2, ytext, ascii, pixlen,
2112 pr_draw_string (prc, _x0 + 2, ytext, t_ascii, pixlen,
20642113 ysiz);
20652114 }
20662115 else
20682117 char *mod;
20692118
20702119 mod =
2071 bsearch_trunc (ascii,
2120 bsearch_trunc (t_ascii,
20722121 width - GLOBALS->vector_padding);
20732122 if (mod)
20742123 {
20752124 *mod = '+';
20762125 *(mod + 1) = 0;
2077 pr_draw_string (prc, _x0 + 2, ytext, ascii,
2126 pr_draw_string (prc, _x0 + 2, ytext, t_ascii,
20782127 GLOBALS->maxlen_trunc, ysiz);
20792128 }
20802129 }
24732522 GLOBALS->tims.start -= GLOBALS->shift_timebase;
24742523 GLOBALS->tims.end -= GLOBALS->shift_timebase;
24752524
2476 h = v;
24772525 liney = ((which + 2) * GLOBALS->fontheight) - 2;
24782526 _y1 = ((which + 1) * GLOBALS->fontheight) + 2;
24792527 _y0 = liney - 2;
25062554 }
25072555 }
25082556
2557 h = v;
2558
25092559 if (t->flags & TR_ANALOGMASK)
25102560 {
25112561 Trptr te = GiveNextTrace(t);
25252575 }
25262576
25272577 pr_draw_vptr_trace_analog (prc, t, v, which, ext);
2578
2579 GLOBALS->tims.start+=GLOBALS->shift_timebase;
2580 GLOBALS->tims.end+=GLOBALS->shift_timebase;
25282581 return;
25292582 }
25302583
26332686
26342687 if (width > GLOBALS->vector_padding)
26352688 {
2689 char *t_ascii;
26362690 ascii = convert_ascii (t, h);
2691
2692 if((*ascii=='?')&&((t_ascii=strchr(ascii+1, '?')))) { t_ascii++; } else { t_ascii = ascii; }
26372693
26382694 if (((pixlen =
26392695 font_engine_string_measure (GLOBALS->wavefont,
2640 ascii)) +
2696 t_ascii)) +
26412697 GLOBALS->vector_padding <= width)
26422698 || ((_x1 >= GLOBALS->wavewidth)
26432699 && (prc->gpd == &ps_print_device)))
26442700 {
2645 pr_draw_string (prc, _x0 + 2, ytext, ascii, pixlen,
2701 pr_draw_string (prc, _x0 + 2, ytext, t_ascii, pixlen,
26462702 ysiz);
26472703 }
26482704 else
26502706 char *mod;
26512707
26522708 mod =
2653 bsearch_trunc (ascii,
2709 bsearch_trunc (t_ascii,
26542710 width - GLOBALS->vector_padding);
26552711 if (mod)
26562712 {
26572713 *mod = '+';
26582714 *(mod + 1) = 0;
26592715
2660 pr_draw_string (prc, _x0 + 2, ytext, ascii,
2716 pr_draw_string (prc, _x0 + 2, ytext, t_ascii,
26612717 GLOBALS->maxlen_trunc, ysiz);
26622718 }
26632719 }
26982754 }
26992755 if (GLOBALS->topmost_trace)
27002756 {
2701 Trptr t;
2757 Trptr t = GLOBALS->topmost_trace;
2758 Trptr tback = t;
27022759 hptr h;
27032760 vptr v;
2704 int i, num_traces_displayable;
2761 int i = 0, num_traces_displayable;
2762 int iback = 0;
27052763
27062764 num_traces_displayable =
27072765 GLOBALS->wavearea->allocation.height / (GLOBALS->fontheight);
27082766 num_traces_displayable--; /* for the time trace that is
27092767 * always there */
27102768
2711 t = GLOBALS->topmost_trace;
2712 for (i = 0; ((i < num_traces_displayable) && (t)); i++)
2769 /* ensure that transaction traces are visible even if the topmost traces are blanks */
2770 while(tback)
2771 {
2772 if(tback->flags&(TR_BLANK|TR_ANALOG_BLANK_STRETCH))
2773 {
2774 tback = GivePrevTrace(tback);
2775 iback--;
2776 }
2777 else if(tback->flags & TR_TTRANSLATED)
2778 {
2779 if(tback != t)
2780 {
2781 t = tback;
2782 i = iback;
2783 }
2784 break;
2785 }
2786 else
2787 {
2788 break;
2789 }
2790 }
2791
2792 for (; ((i < num_traces_displayable) && (t)); i++)
27132793 {
27142794 if (!(t->flags & (TR_EXCLUDE | TR_BLANK | TR_ANALOG_BLANK_STRETCH)))
27152795 {
27162796 GLOBALS->shift_timebase = t->shift;
27172797 if (!t->vector)
27182798 {
2719 h = bsearch_node (t->n.nd, GLOBALS->tims.start);
2799 h = bsearch_node (t->n.nd, GLOBALS->tims.start - t->shift);
27202800 DEBUG (printf
27212801 ("Bit Trace: %s, %s\n", t->name, t->n.nd->nname));
27222802 DEBUG (printf
27252805
27262806 if (!t->n.nd->extvals)
27272807 {
2728 pr_draw_hptr_trace (prc, t, h, i, 1, 0);
2808 if(i>=0) pr_draw_hptr_trace (prc, t, h, i, 1, 0);
27292809 }
27302810 else
27312811 {
2732 pr_draw_hptr_trace_vector (prc, t, h, i);
2812 if(i>=0) pr_draw_hptr_trace_vector (prc, t, h, i);
27332813 }
27342814 }
27352815 else
27362816 {
2737 v = bsearch_vector (t->n.vec, GLOBALS->tims.start);
2738 DEBUG (printf
2817 Trptr t_orig, tn;
2818 bvptr bv = t->n.vec;
2819
2820 v = bsearch_vector (bv, GLOBALS->tims.start - t->shift);
2821 DEBUG (printf
27392822 ("Vector Trace: %s, %s\n", t->name, t->n.vec->name));
2740 DEBUG (printf
2823 DEBUG (printf
27412824 ("Start time: " TTFormat ", Vectorent time: "
27422825 TTFormat "\n", tims.start,
27432826 (v->time + shift_timebase)));
2744 pr_draw_vptr_trace (prc, t, v, i);
2827 if(i>=0) pr_draw_vptr_trace (prc, t, v, i);
2828
2829 if((bv->transaction_chain) && (t->flags & TR_TTRANSLATED))
2830 {
2831 t_orig = t;
2832 for(;;)
2833 {
2834 tn = GiveNextTrace(t);
2835 bv = bv->transaction_chain;
2836
2837 if(bv && tn && (tn->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)))
2838 {
2839 i++;
2840 if(i<num_traces_displayable)
2841 {
2842 v=bsearch_vector(bv, GLOBALS->tims.start - t->shift);
2843 if(i>=0) pr_draw_vptr_trace(prc, t_orig,v,i);
2844 t = tn;
2845 continue;
2846 }
2847 }
2848 break;
2849 }
2850 }
27452851 }
27462852 }
27472853 else
27612867 }
27622868 }
27632869
2764 pr_draw_hptr_trace (prc, NULL, NULL, i, 0, kill_dodraw_grid);
2870 if(i>=0) pr_draw_hptr_trace (prc, NULL, NULL, i, 0, kill_dodraw_grid);
27652871 }
27662872 t = GiveNextTrace (t);
27672873 }
27772883 {
27782884 int texty, liney;
27792885 int retval;
2780 char sbuf[128];
2781 int bufclen;
2886 char buf[2048];
2887 char *subname = NULL;
2888
2889 buf[0] = 0;
2890
2891 if(t->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)) /* seek to real xact trace if present... */
2892 {
2893 Trptr tscan = t;
2894 int bcnt = 0;
2895 while((tscan) && (tscan = GivePrevTrace(tscan)))
2896 {
2897 if(!(tscan->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)))
2898 {
2899 if(tscan->flags & TR_TTRANSLATED)
2900 {
2901 break; /* found it */
2902 }
2903 else
2904 {
2905 tscan = NULL;
2906 }
2907 }
2908 else
2909 {
2910 bcnt++; /* bcnt is number of blank traces */
2911 }
2912 }
2913
2914 if((tscan)&&(tscan->vector))
2915 {
2916 bvptr bv = tscan->n.vec;
2917 do
2918 {
2919 bv = bv->transaction_chain; /* correlate to blank trace */
2920 } while(bv && (bcnt--));
2921 if(bv)
2922 {
2923 subname = bv->bvname;
2924 if(GLOBALS->hier_max_level)
2925 subname = hier_extract(subname, GLOBALS->hier_max_level);
2926 }
2927 }
2928 }
2929
2930 populateBuffer(t, subname, buf);
27822931
27832932 UpdateSigValue (t); /* in case it's stale on nonprop */
2784
2785 bufclen = 0;
2786 sbuf[0] = 0;
2787
2788 if ((t->name) && (t->shift))
2789 {
2790 sbuf[0] = '(';
2791 reformat_time (sbuf + 1, t->shift, GLOBALS->time_dimension);
2792 strcpy (sbuf + (bufclen = strlen (sbuf + 1) + 1), ")");
2793 bufclen++;
2794 }
2795
2796 if ((!t->vector) && (t->n.nd) && (t->n.nd->array_height))
2797 {
2798 bufclen += sprintf (sbuf + strlen (sbuf), "{%d}", t->n.nd->this_row);
2799 }
2800
28012933
28022934 liney = ((i + 2) * GLOBALS->fontheight) - 2;
28032935
28222954 {
28232955 int maxwidth = 0;
28242956
2825 if (t->name)
2826 maxwidth = strlen (t->name) + bufclen;
2957 if (buf)
2958 maxwidth = strlen (buf);
28272959 if ((t->asciivalue) && (!(t->flags & TR_EXCLUDE)))
28282960 maxwidth += strlen (t->asciivalue);
28292961 if (maxwidth)
28302962 {
28312963 gdouble realwidth;
2832 char *buf;
2833 buf = wave_alloca (maxwidth + 1);
2834 buf[0] = 0;
2835 if (t->name)
2964 char *cbuf;
2965 cbuf = wave_alloca (maxwidth + 1);
2966 cbuf[0] = 0;
2967 if (buf[0])
28362968 {
2837 strcpy (buf, t->name);
2838 if (bufclen)
2839 strcat (buf, sbuf);
2969 strcpy (cbuf, buf);
28402970 }
28412971 if ((t->asciivalue) && (!(t->flags & TR_EXCLUDE)))
2842 strcat (buf, t->asciivalue);
2972 strcat (cbuf, t->asciivalue);
28432973
28442974 realwidth = maxwidth * GLOBALS->ps_chwidth_print_c_1;
28452975
28462976 if (maxwidth == 0)
28472977 return (retval);
28482978 pr_setgray (prc, 0.0);
2849 pr_draw_string (prc, 3, texty - 1, buf, realwidth,
2979 pr_draw_string (prc, 3, texty - 1, cbuf, realwidth,
28502980 GLOBALS->signalfont->ascent -
28512981 GLOBALS->signalfont->descent);
28522982 }
29783108 }
29793109
29803110 /*
2981 * $Id: print.c,v 1.29 2010/03/14 07:09:49 gtkwave Exp $
3111 * $Id: print.c,v 1.36 2010/04/14 18:45:37 gtkwave Exp $
29823112 * $Log: print.c,v $
3113 * Revision 1.36 2010/04/14 18:45:37 gtkwave
3114 * allow data values for secondary transaction traces
3115 *
3116 * Revision 1.35 2010/04/14 04:21:46 gtkwave
3117 * update populateBuffer() usage
3118 *
3119 * Revision 1.34 2010/04/10 03:32:00 gtkwave
3120 * allow transaction traces to scroll off top of screen yet still be visible
3121 *
3122 * Revision 1.33 2010/04/09 20:52:33 gtkwave
3123 * add extension traces for extension transactions
3124 *
3125 * Revision 1.32 2010/04/01 03:10:58 gtkwave
3126 * time warp fixes
3127 *
3128 * Revision 1.31 2010/03/31 15:42:47 gtkwave
3129 * added preliminary transaction filter support
3130 *
3131 * Revision 1.30 2010/03/24 23:05:10 gtkwave
3132 * added RealToBits menu option
3133 *
29833134 * Revision 1.29 2010/03/14 07:09:49 gtkwave
29843135 * removed ExtNode and merged with Node
29853136 *
2323 {
2424 int i;
2525
26 if(!GLOBALS->procsel_filter) { GLOBALS->procsel_filter = calloc_2(FILE_FILTER_MAX+1, sizeof(char *)); }
27 if(!GLOBALS->proc_filter) { GLOBALS->proc_filter = calloc_2(FILE_FILTER_MAX+1, sizeof(struct pipe_ctx *)); }
26 if(!GLOBALS->procsel_filter) { GLOBALS->procsel_filter = calloc_2(PROC_FILTER_MAX+1, sizeof(char *)); }
27 if(!GLOBALS->proc_filter) { GLOBALS->proc_filter = calloc_2(PROC_FILTER_MAX+1, sizeof(struct pipe_ctx *)); }
2828
2929 for(i=0;i<PROC_FILTER_MAX+1;i++)
3030 {
3535
3636 void remove_all_proc_filters(void)
3737 {
38 int i;
39
40 for(i=1;i<PROC_FILTER_MAX+1;i++)
41 {
42 if(GLOBALS->proc_filter[i])
38 struct Global *GLOBALS_cache = GLOBALS;
39 int i, j;
40
41 for(j=0;j<GLOBALS->num_notebook_pages;j++)
42 {
43 GLOBALS = (*GLOBALS->contexts)[j];
44
45 for(i=1;i<PROC_FILTER_MAX+1;i++)
4346 {
44 pipeio_destroy(GLOBALS->proc_filter[i]);
45 GLOBALS->proc_filter[i] = NULL;
47 if(GLOBALS->proc_filter[i])
48 {
49 pipeio_destroy(GLOBALS->proc_filter[i]);
50 GLOBALS->proc_filter[i] = NULL;
51 }
52
53 if(GLOBALS->procsel_filter[i])
54 {
55 free_2(GLOBALS->procsel_filter[i]);
56 GLOBALS->procsel_filter[i] = NULL;
57 }
4658 }
4759
48 if(GLOBALS->procsel_filter[i])
49 {
50 free_2(GLOBALS->procsel_filter[i]);
51 GLOBALS->procsel_filter[i] = NULL;
52 }
60 GLOBALS = GLOBALS_cache;
5361 }
5462 }
5563
7078 }
7179
7280
73 void remove_proc_filter(int which, int regen)
81 /*
82 * this is likely obsolete
83 */
84 static void remove_proc_filter(int which, int regen)
7485 {
7586 if(GLOBALS->proc_filter[which])
7687 {
8596 }
8697
8798
88 void load_proc_filter(int which, char *name)
99 static void load_proc_filter(int which, char *name)
89100 {
90101
91102 FILE *stream;
137148 pclose(stream);
138149 free_2(cmd);
139150
140 remove_proc_filter(which, 0); /* should never happen from GUI, but possible from save files or other weirdness */
141
142 GLOBALS->proc_filter[which] = pipeio_create(abs_path, arg);
151 /* remove_proc_filter(which, 0); ... should never happen from GUI, but perhaps possible from save files or other weirdness */
152 if(!GLOBALS->ttrans_filter[which])
153 {
154 GLOBALS->proc_filter[which] = pipeio_create(abs_path, arg);
155 }
143156 }
144157
145158 void install_proc_filter(int which)
224237 if(!strcmp(GLOBALS->procsel_filter[i], *GLOBALS->fileselbox_text))
225238 {
226239 status_text("Filter already imported.\n");
240 if(GLOBALS->is_active_ptranslate_c_2) gdk_window_raise(GLOBALS->window_ptranslate_c_5->window);
227241 return;
228242 }
229243 }
249263 {
250264 GLOBALS->num_proc_filters--;
251265 }
266
267 if(GLOBALS->is_active_ptranslate_c_2) gdk_window_raise(GLOBALS->window_ptranslate_c_5->window);
252268 }
253269
254270 static void add_filter_callback(GtkWidget *widget, GtkWidget *nothing)
430446 #endif
431447
432448 /*
433 * $Id: ptranslate.c,v 1.7 2009/12/24 20:55:27 gtkwave Exp $
449 * $Id: ptranslate.c,v 1.11 2010/04/15 18:39:34 gtkwave Exp $
434450 * $Log: ptranslate.c,v $
451 * Revision 1.11 2010/04/15 18:39:34 gtkwave
452 * remove invocations of pipeio_destroy where unnecessary
453 *
454 * Revision 1.10 2010/04/15 01:55:03 gtkwave
455 * raise to front on filename select
456 *
457 * Revision 1.9 2010/03/31 15:42:47 gtkwave
458 * added preliminary transaction filter support
459 *
460 * Revision 1.8 2010/03/30 18:33:27 gtkwave
461 * fixed cut and paste errors from file to proc
462 *
435463 * Revision 1.7 2009/12/24 20:55:27 gtkwave
436464 * warnings cleanups
437465 *
1717 #include "fgetdynamic.h"
1818 #include "debug.h"
1919
20 #define PROC_FILTER_MAX 20
20 #define PROC_FILTER_MAX (128)
2121
2222
2323 void ptrans_searchbox(char *title);
2929 #endif
3030
3131 /*
32 * $Id: ptranslate.h,v 1.2 2007/08/26 21:35:43 gtkwave Exp $
32 * $Id: ptranslate.h,v 1.3 2010/03/30 18:33:27 gtkwave Exp $
3333 * $Log: ptranslate.h,v $
34 * Revision 1.3 2010/03/30 18:33:27 gtkwave
35 * fixed cut and paste errors from file to proc
36 *
3437 * Revision 1.2 2007/08/26 21:35:43 gtkwave
3538 * integrated global context management from SystemOfCode2007 branch
3639 *
3434 * case insensitive string bsearch
3535 */
3636
37 static const struct wave_rgb_color colors[] = {
37 static struct wave_rgb_color colors[] = {
3838 WAVE_RGB_COLOR("alice blue", 240, 248, 255),
3939 WAVE_RGB_COLOR("AliceBlue", 240, 248, 255),
4040 WAVE_RGB_COLOR("antique white", 250, 235, 215),
795795 {
796796 const char *key = (const char *)v1;
797797 const struct wave_rgb_color *color = (const struct wave_rgb_color *)v2;
798
798799 return((int)strcasecmp(key, color->name));
799800 }
800801
804805
805806 if((match=(struct wave_rgb_color *)bsearch((void *)str, (void *)colors, C_ARRAY_SIZE, sizeof(struct wave_rgb_color), compar)))
806807 {
807
808808 if(!match->context) match->context = alloc_color(GLOBALS->wavearea, match->rgb, GLOBALS->wavearea->style->white_gc);
809
810809 return(match->context);
811810 }
812811
852851 }
853852
854853 /*
855 * $Id: rgb.c,v 1.5 2010/03/18 17:12:37 gtkwave Exp $
854 * $Id: rgb.c,v 1.6 2010/03/31 06:37:44 gtkwave Exp $
856855 * $Log: rgb.c,v $
856 * Revision 1.6 2010/03/31 06:37:44 gtkwave
857 * fix for colors struct marked as const
858 *
857859 * Revision 1.5 2010/03/18 17:12:37 gtkwave
858860 * pedantic warning cleanups
859861 *
609609 static gboolean run_once = FALSE;
610610 gdouble x,y;
611611 GdkModifierType state;
612 TraceEnt t_trans;
612613
613614 #ifdef WAVE_USE_GTK2
614615 gint xi, yi;
678679 }
679680
680681 if(!t) goto bot;
681 if((t->flags&(TR_BLANK|TR_EXCLUDE)))
682 if((t->flags&(/*TR_BLANK|*/TR_EXCLUDE))) /* TR_BLANK removed because of transaction handling below... */
682683 {
683684 t = NULL;
684685 goto bot;
685686 }
687
688 if(t->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)) /* seek to real xact trace if present... */
689 {
690 Trptr tscan = t;
691 int bcnt = 0;
692 while((tscan) && (tscan = GivePrevTrace(tscan)))
693 {
694 if(!(tscan->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)))
695 {
696 if(tscan->flags & TR_TTRANSLATED)
697 {
698 break; /* found it */
699 }
700 else
701 {
702 tscan = NULL;
703 }
704 }
705 else
706 {
707 bcnt++; /* bcnt is number of blank traces */
708 }
709 }
710
711 if((tscan)&&(tscan->vector))
712 {
713 bvptr bv = tscan->n.vec;
714 do
715 {
716 bv = bv->transaction_chain; /* correlate to blank trace */
717 } while(bv && (bcnt--));
718 if(bv)
719 {
720 memcpy(&t_trans, tscan, sizeof(TraceEnt)); /* substitute into a synthetic trace */
721 t_trans.n.vec = bv;
722 t_trans.vector = 1;
723
724 t_trans.name = bv->bvname;
725 if(GLOBALS->hier_max_level)
726 t_trans.name = hier_extract(t_trans.name, GLOBALS->hier_max_level);
727
728 t = &t_trans;
729 goto bot; /* is goto process_trace; in wavewindow.c */
730 }
731 }
732 }
733
734 if((t->flags&TR_BLANK))
735 {
736 t = NULL;
737 goto bot;
738 }
686739
687740 if(t->flags & TR_ANALOG_BLANK_STRETCH) /* seek to real analog trace is present... */
688741 {
13351388
13361389
13371390 /*
1338 * $Id: signalwindow.c,v 1.49 2010/02/28 19:05:15 gtkwave Exp $
1391 * $Id: signalwindow.c,v 1.50 2010/04/14 07:49:02 gtkwave Exp $
13391392 * $Log: signalwindow.c,v $
1393 * Revision 1.50 2010/04/14 07:49:02 gtkwave
1394 * updated mouseover handling
1395 *
13401396 * Revision 1.49 2010/02/28 19:05:15 gtkwave
13411397 * missing null pointer guard added
13421398 *
677677 UTimeType utt;
678678 TimeType tt;
679679
680 h=bsearch_node(t->n.nd, basetime);
680 h=bsearch_node(t->n.nd, basetime - t->shift);
681681 hp=GLOBALS->max_compare_index;
682682 if((hp==&(t->n.nd->harray[1]))||(hp==&(t->n.nd->harray[0]))) return;
683683 if(basetime == ((*hp)->time+GLOBALS->shift_timebase)) hp--;
693693 UTimeType utt;
694694 TimeType tt;
695695
696 v=bsearch_vector(t->n.vec, basetime);
696 v=bsearch_vector(t->n.vec, basetime - t->shift);
697697 vp=GLOBALS->vmax_compare_index;
698698 if((vp==&(t->n.vec->vectors[1]))||(vp==&(t->n.vec->vectors[0]))) return;
699699 if(basetime == ((*vp)->time+GLOBALS->shift_timebase)) vp--;
720720 UTimeType utt;
721721 TimeType tt;
722722
723 h=bsearch_node(t->n.nd, basetime);
723 h=bsearch_node(t->n.nd, basetime - t->shift);
724724 while(h->next && h->time==h->next->time) h=h->next;
725725 if((whichpass)||(GLOBALS->tims.marker>=0)) h=h->next;
726726 if(!h) return;
734734 UTimeType utt;
735735 TimeType tt;
736736
737 v=bsearch_vector(t->n.vec, basetime);
737 v=bsearch_vector(t->n.vec, basetime - t->shift);
738738 while(v->next && v->time==v->next->time) v=v->next;
739739 if((whichpass)||(GLOBALS->tims.marker>=0)) v=v->next;
740740 if(!v) return;
760760 {
761761 if(strace_adjust(s->his.h->time,GLOBALS->shift_timebase)!=maxbase)
762762 {
763 s->his.h=bsearch_node(t->n.nd, maxbase);
763 s->his.h=bsearch_node(t->n.nd, maxbase - t->shift);
764764 while(s->his.h->next && s->his.h->time==s->his.h->next->time) s->his.h=s->his.h->next;
765765 }
766766 if(t->flags&TR_INVERT)
836836 {
837837 if(strace_adjust(s->his.v->time,GLOBALS->shift_timebase)!=maxbase)
838838 {
839 s->his.v=bsearch_vector(t->n.vec, maxbase);
839 s->his.v=bsearch_vector(t->n.vec, maxbase - t->shift);
840840 while(s->his.v->next && s->his.v->time==s->his.v->next->time) s->his.v=s->his.v->next;
841841 }
842842 chval=convert_ascii(t,s->his.v);
845845 {
846846 if(strace_adjust(s->his.h->time,GLOBALS->shift_timebase)!=maxbase)
847847 {
848 s->his.h=bsearch_node(t->n.nd, maxbase);
848 s->his.h=bsearch_node(t->n.nd, maxbase - t->shift);
849849 while(s->his.h->next && s->his.h->time==s->his.h->next->time) s->his.h=s->his.h->next;
850850 }
851851 if(s->his.h->flags&HIST_REAL)
852852 {
853853 if(!(s->his.h->flags&HIST_STRING))
854854 {
855 chval=convert_ascii_real((double *)s->his.h->v.h_vector);
855 chval=convert_ascii_real(t, (double *)s->his.h->v.h_vector);
856856 }
857857 else
858858 {
10681068 UTimeType utt;
10691069 TimeType tt;
10701070
1071 h=bsearch_node(t->n.nd, basetime);
1071 h=bsearch_node(t->n.nd, basetime - t->shift);
10721072 s->his.h=h;
10731073 while(h->time==h->next->time) h=h->next;
10741074 if((whichpass)||(notfirst)) h=h->next;
10821082 UTimeType utt;
10831083 TimeType tt;
10841084
1085 v=bsearch_vector(t->n.vec, basetime);
1085 v=bsearch_vector(t->n.vec, basetime - t->shift);
10861086 if((whichpass)||(notfirst)) v=v->next;
10871087 if(!v) return(MAX_HISTENT_TIME);
10881088 s->his.v=v;
11061106 {
11071107 if(strace_adjust(s->his.h->time,GLOBALS->shift_timebase)!=maxbase)
11081108 {
1109 s->his.h=bsearch_node(t->n.nd, maxbase);
1109 s->his.h=bsearch_node(t->n.nd, maxbase - t->shift);
11101110 while(s->his.h->next && s->his.h->time==s->his.h->next->time) s->his.h=s->his.h->next;
11111111 }
11121112 if(t->flags&TR_INVERT)
11841184 {
11851185 if(strace_adjust(s->his.v->time,GLOBALS->shift_timebase)!=maxbase)
11861186 {
1187 s->his.v=bsearch_vector(t->n.vec, maxbase);
1187 s->his.v=bsearch_vector(t->n.vec, maxbase - t->shift);
11881188 while(s->his.v->next && s->his.v->time==s->his.v->next->time) s->his.v=s->his.v->next;
11891189 }
11901190 chval=convert_ascii(t,s->his.v);
11931193 {
11941194 if(strace_adjust(s->his.h->time,GLOBALS->shift_timebase)!=maxbase)
11951195 {
1196 s->his.h=bsearch_node(t->n.nd, maxbase);
1196 s->his.h=bsearch_node(t->n.nd, maxbase - t->shift);
11971197 while(s->his.h->next && s->his.h->time==s->his.h->next->time) s->his.h=s->his.h->next;
11981198 }
11991199 if(s->his.h->flags&HIST_REAL)
12001200 {
12011201 if(!(s->his.h->flags&HIST_STRING))
12021202 {
1203 chval=convert_ascii_real((double *)s->his.h->v.h_vector);
1203 chval=convert_ascii_real(t, (double *)s->his.h->v.h_vector);
12041204 }
12051205 else
12061206 {
16461646 mprintf("#{%s}",t->name);
16471647
16481648 nodes=t->n.vec->bits->nodes;
1649 for(i=0;i<t->n.vec->nbits;i++)
1649 for(i=0;i<t->n.vec->bits->nnbits;i++)
16501650 {
16511651 if(nodes[i]->expansion)
16521652 {
16941694 }
16951695
16961696 /*
1697 * $Id: strace.c,v 1.18 2010/03/14 07:09:49 gtkwave Exp $
1697 * $Id: strace.c,v 1.21 2010/04/01 03:10:58 gtkwave Exp $
16981698 * $Log: strace.c,v $
1699 * Revision 1.21 2010/04/01 03:10:58 gtkwave
1700 * time warp fixes
1701 *
1702 * Revision 1.20 2010/03/31 20:41:03 gtkwave
1703 * nbits versus nnbits fix
1704 *
1705 * Revision 1.19 2010/03/24 23:05:10 gtkwave
1706 * added RealToBits menu option
1707 *
16991708 * Revision 1.18 2010/03/14 07:09:49 gtkwave
17001709 * removed ExtNode and merged with Node
17011710 *
2626
2727 #ifndef _MSC_VER
2828 #include <unistd.h>
29 #ifdef HAVE_INTTYPES_H
2930 #include <inttypes.h>
31 #endif
3032 #else
3133 typedef long off_t;
3234 #include <windows.h>
122124 #endif
123125
124126 /*
125 * $Id: symbol.h,v 1.13 2010/03/16 21:01:10 gtkwave Exp $
127 * $Id: symbol.h,v 1.14 2010/04/27 23:10:56 gtkwave Exp $
126128 * $Log: symbol.h,v $
129 * Revision 1.14 2010/04/27 23:10:56 gtkwave
130 * made inttype.h inclusion conditional
131 *
127132 * Revision 1.13 2010/03/16 21:01:10 gtkwave
128133 * remove selected member of struct symbol
129134 *
131131 }
132132 else if (t->vector)
133133 {
134 name = strdup_2(t->n.vec->name);
134 name = strdup_2(t->n.vec->bvname);
135135 }
136136 else
137137 {
19291929
19301930
19311931 /*
1932 * $Id: tcl_commands.c,v 1.37 2010/03/18 17:12:37 gtkwave Exp $
1932 * $Id: tcl_commands.c,v 1.38 2010/04/04 19:09:57 gtkwave Exp $
19331933 * $Log: tcl_commands.c,v $
1934 * Revision 1.38 2010/04/04 19:09:57 gtkwave
1935 * rename name->bvname in struct BitVector for easier grep tracking
1936 *
19341937 * Revision 1.37 2010/03/18 17:12:37 gtkwave
19351938 * pedantic warning cleanups
19361939 *
14451445 if(t->vector)
14461446 {
14471447 /* this is currently unused as vectors are exploded into single bits */
1448 vptr v = bsearch_vector(t->n.vec, GLOBALS->tims.marker);
1448 vptr v = bsearch_vector(t->n.vec, GLOBALS->tims.marker - t->shift);
14491449 rc = convert_ascii(t, v);
14501450 }
14511451 else
14521452 {
1453 hptr h_ptr = bsearch_node(t->n.nd, GLOBALS->tims.marker);
1453 hptr h_ptr = bsearch_node(t->n.nd, GLOBALS->tims.marker - t->shift);
14541454 if(h_ptr)
14551455 {
14561456 if(!t->n.nd->extvals)
14641464 {
14651465 if(!(h_ptr->flags&HIST_STRING))
14661466 {
1467 rc = convert_ascii_real((double *)h_ptr->v.h_vector);
1467 rc = convert_ascii_real(t, (double *)h_ptr->v.h_vector);
14681468 }
14691469 else
14701470 {
16101610 {
16111611 int i;
16121612 nptr *nodes;
1613 vptr v = (GLOBALS->tims.marker != -1) ? bsearch_vector(t->n.vec, GLOBALS->tims.marker) : NULL;
1613 vptr v = (GLOBALS->tims.marker != -1) ? bsearch_vector(t->n.vec, GLOBALS->tims.marker - t->shift) : NULL;
16141614 unsigned char *bits = v ? (v->v) : NULL;
16151615 char *first_str = NULL;
16161616 int coalesce_pass = 1;
16171617
16181618 nodes=t->n.vec->bits->nodes;
16191619
1620 for(i=0;i<t->n.vec->nbits;i++)
1620 for(i=0;i<t->n.vec->bits->nnbits;i++)
16211621 {
16221622 if(!nodes[i]->expansion)
16231623 {
16431643
16441644 if(coalesce_pass)
16451645 {
1646 if(t->n.vec->nbits < 2)
1646 if(t->n.vec->bits->nnbits < 2)
16471647 {
16481648 coalesce_pass = 0;
16491649 }
16541654 char *pl = strrchr(strl, '[');
16551655 int lidx = atoi(pl+1);
16561656
1657 nptr nr = nodes[t->n.vec->nbits - 1];
1657 nptr nr = nodes[t->n.vec->bits->nnbits - 1];
16581658 char *strr = append_array_row(nr);
16591659 char *pr = strrchr(strr, '[');
16601660 int ridx = atoi(pr+1);
16861686 }
16871687
16881688 if(!coalesce_pass)
1689 for(i=0;i<t->n.vec->nbits;i++)
1689 for(i=0;i<t->n.vec->bits->nnbits;i++)
16901690 {
16911691 if(nodes[i]->expansion)
16921692 {
20482048 }
20492049 }
20502050
2051 /* NOT an else! */
2052 if(t->flags & TR_TTRANSLATED)
2053 {
2054 if(t->t_filter && GLOBALS->ttranssel_filter[t->t_filter])
2055 {
2056 one_entry = make_message("^<%d %s\n", t->t_filter, GLOBALS->ttranssel_filter[t->t_filter]);
2057 WAVE_OE_ME
2058 }
2059 else
2060 {
2061 one_entry = make_message("^<%d %s\n", 0, "disabled");
2062 WAVE_OE_ME
2063 }
2064 }
2065
20512066 if(t->vector)
20522067 {
20532068 int i;
20602075 bits = t->n.vec->bits;
20612076 ba = bits ? bits->attribs : NULL;
20622077
2063 one_entry = make_message("%c{%s}", ba ? ':' : '#', t->n.vec->name);
2078 one_entry = make_message("%c{%s}", ba ? ':' : '#',
2079 t->n.vec->transaction_cache ? t->n.vec->transaction_cache->bvname : t->n.vec->bvname);
20642080 WAVE_OE_ME
20652081
20662082 nodes=t->n.vec->bits->nodes;
2067 for(i=0;i<t->n.vec->nbits;i++)
2083 for(i=0;i<t->n.vec->bits->nnbits;i++)
20682084 {
20692085 if(nodes[i]->expansion)
20702086 {
27162732
27172733
27182734 /*
2719 * $Id: tcl_helper.c,v 1.73 2010/03/18 17:12:37 gtkwave Exp $
2735 * $Id: tcl_helper.c,v 1.78 2010/04/07 01:50:45 gtkwave Exp $
27202736 * $Log: tcl_helper.c,v $
2737 * Revision 1.78 2010/04/07 01:50:45 gtkwave
2738 * improved name handling for bvname, add $next transaction operation
2739 *
2740 * Revision 1.77 2010/04/04 19:09:57 gtkwave
2741 * rename name->bvname in struct BitVector for easier grep tracking
2742 *
2743 * Revision 1.76 2010/04/01 03:10:58 gtkwave
2744 * time warp fixes
2745 *
2746 * Revision 1.75 2010/03/31 20:41:03 gtkwave
2747 * nbits versus nnbits fix
2748 *
2749 * Revision 1.74 2010/03/24 23:05:10 gtkwave
2750 * added RealToBits menu option
2751 *
27212752 * Revision 1.73 2010/03/18 17:12:37 gtkwave
27222753 * pedantic warning cleanups
27232754 *
244244 t = (Trptr) calloc_2(1, sizeof( TraceEnt ) );
245245 if( t == NULL ) {
246246 fprintf( stderr, "Out of memory, can't add %s to analyzer\n",
247 vec->name );
247 vec->bvname );
248248 return( 0 );
249249 }
250250
251 t->name = vec->name;
251 t->name = vec->bvname;
252252
253253 if(GLOBALS->hier_max_level)
254254 t->name = hier_extract(t->name, GLOBALS->hier_max_level);
286286 *p = '\0' ;
287287 len = strlen(name) ;
288288 while(t) {
289 p = (!t->vector) ? t->n.nd->nname : t->n.vec->name ;
289 p = (!t->vector) ? t->n.nd->nname : t->n.vec->bvname ;
290290 p1 = strchr(p,'[') ;
291291 len1 = (p1) ? p1 - p : strlen(p) ;
292292 if((len == len1) && !strncmp(name, p, len))
520520 if(t->n.nd->extvals) {
521521 bw = abs(t->n.nd->msi - t->n.nd->lsi) + 1 ;
522522 }
523 h = bsearch_node(t->n.nd, tstart) ;
523 h = bsearch_node(t->n.nd, tstart - t->shift) ;
524524 for(h1 = h; h1; h1 = h1->next) {
525525 if (h1->time <= tend) {
526526 if (len++ < max_elements) {
546546 }
547547 } else {
548548 vptr v, v1;
549 v = bsearch_vector(t->n.vec, tstart) ;
549 v = bsearch_vector(t->n.vec, tstart - t->shift) ;
550550 for(v1 = v; v1; v1 = v1->next) {
551551 if (v1->time <= tend) {
552552 llist_u llp; llp.p = v1;
575575 h_ptr = (hptr)lp->u.p ;
576576 if(h_ptr->flags&HIST_REAL) {
577577 if(!(h_ptr->flags&HIST_STRING)) {
578 s=convert_ascii_real((double *)h_ptr->v.h_vector);
578 s=convert_ascii_real(t, (double *)h_ptr->v.h_vector);
579579 } else {
580580 s=convert_ascii_string((char *)h_ptr->v.h_vector);
581581 }
165165 free_2(t);
166166 }
167167
168 void remove_file_filter(int which, int regen)
168 static void remove_file_filter(int which, int regen)
169169 {
170170 if(GLOBALS->xl_file_filter[which])
171171 {
179179 }
180180 }
181181
182 void load_file_filter(int which, char *name)
182 static void load_file_filter(int which, char *name)
183183 {
184184 FILE *f = fopen(name, "rb");
185185 if(!f)
308308 if(!strcmp(GLOBALS->filesel_filter[i], *GLOBALS->fileselbox_text))
309309 {
310310 status_text("Filter already imported.\n");
311 if(GLOBALS->is_active_translate_c_5) gdk_window_raise(GLOBALS->window_translate_c_11->window);
311312 return;
312313 }
313314 }
333334 {
334335 GLOBALS->num_file_filters--;
335336 }
337
338 if(GLOBALS->is_active_translate_c_5) gdk_window_raise(GLOBALS->window_translate_c_11->window);
336339 }
337340
338341 static void add_filter_callback(GtkWidget *widget, GtkWidget *nothing)
512515 }
513516
514517 /*
515 * $Id: translate.c,v 1.4 2007/09/12 17:26:45 gtkwave Exp $
518 * $Id: translate.c,v 1.6 2010/04/15 01:55:03 gtkwave Exp $
516519 * $Log: translate.c,v $
520 * Revision 1.6 2010/04/15 01:55:03 gtkwave
521 * raise to front on filename select
522 *
523 * Revision 1.5 2010/03/31 15:42:47 gtkwave
524 * added preliminary transaction filter support
525 *
517526 * Revision 1.4 2007/09/12 17:26:45 gtkwave
518527 * experimental ctx_swap_watchdog added...still tracking down mouse thrash crashes
519528 *
2828 };
2929
3030
31 #define FILE_FILTER_MAX 1024
31 #define FILE_FILTER_MAX (128)
3232
3333
3434
4545 #endif
4646
4747 /*
48 * $Id: translate.h,v 1.2 2007/08/26 21:35:46 gtkwave Exp $
48 * $Id: translate.h,v 1.3 2010/03/30 18:33:27 gtkwave Exp $
4949 * $Log: translate.h,v $
50 * Revision 1.3 2010/03/30 18:33:27 gtkwave
51 * fixed cut and paste errors from file to proc
52 *
5053 * Revision 1.2 2007/08/26 21:35:46 gtkwave
5154 * integrated global context management from SystemOfCode2007 branch
5255 *
0 /*
1 * Copyright (c) Tony Bybell 2010.
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License
5 * as published by the Free Software Foundation; either version 2
6 * of the License, or (at your option) any later version.
7 */
8
9 #include "globals.h"
10 #include <config.h>
11 #include <gtk/gtk.h>
12 #include "gtk12compat.h"
13 #include "symbol.h"
14 #include "ttranslate.h"
15 #include "pipeio.h"
16 #include "debug.h"
17
18 #ifdef _MSC_VER
19 #define strcasecmp _stricmp
20 #endif
21
22 void init_ttrans_data(void)
23 {
24 int i;
25
26 if(!GLOBALS->ttranssel_filter) { GLOBALS->ttranssel_filter = calloc_2(TTRANS_FILTER_MAX+1, sizeof(char *)); }
27 if(!GLOBALS->ttrans_filter) { GLOBALS->ttrans_filter = calloc_2(TTRANS_FILTER_MAX+1, sizeof(struct pipe_ctx *)); }
28
29 for(i=0;i<TTRANS_FILTER_MAX+1;i++)
30 {
31 GLOBALS->ttranssel_filter[i] = NULL;
32 GLOBALS->ttrans_filter[i] = NULL;
33 }
34 }
35
36 void remove_all_ttrans_filters(void)
37 {
38 struct Global *GLOBALS_cache = GLOBALS;
39 int i, j;
40
41 for(j=0;j<GLOBALS->num_notebook_pages;j++)
42 {
43 GLOBALS = (*GLOBALS->contexts)[j];
44
45 for(i=1;i<TTRANS_FILTER_MAX+1;i++)
46 {
47 if(GLOBALS->ttrans_filter[i])
48 {
49 pipeio_destroy(GLOBALS->ttrans_filter[i]);
50 GLOBALS->ttrans_filter[i] = NULL;
51 }
52
53 if(GLOBALS->ttranssel_filter[i])
54 {
55 free_2(GLOBALS->ttranssel_filter[i]);
56 GLOBALS->ttranssel_filter[i] = NULL;
57 }
58 }
59
60 GLOBALS = GLOBALS_cache;
61 }
62 }
63
64 #if defined __MINGW32__ || defined _MSC_VER
65
66 void ttrans_searchbox(char *title) { }
67 void install_ttrans_filter(int which) { }
68 void set_current_translate_ttrans(char *name) { }
69 int traverse_vector_nodes(Trptr t) { if(t) { t->t_filter = 0; } return(0); }
70
71 #else
72
73 static void regen_display(void)
74 {
75 if(GLOBALS->signalarea && GLOBALS->wavearea)
76 {
77 GLOBALS->signalwindow_width_dirty=1;
78 MaxSignalLength();
79 signalarea_configure_event(GLOBALS->signalarea, NULL);
80 wavearea_configure_event(GLOBALS->wavearea, NULL);
81 }
82 }
83
84
85 /*
86 * this is likely obsolete
87 */
88 static void remove_ttrans_filter(int which, int regen)
89 {
90 if(GLOBALS->ttrans_filter[which])
91 {
92 pipeio_destroy(GLOBALS->ttrans_filter[which]);
93 GLOBALS->ttrans_filter[which] = NULL;
94
95 if(regen)
96 {
97 regen_display();
98 }
99 }
100 }
101
102
103 static void load_ttrans_filter(int which, char *name)
104 {
105
106 FILE *stream;
107
108 char *cmd;
109 char exec_name[1025];
110 char abs_path [1025];
111 char* arg, end;
112 int result;
113
114 exec_name[0] = 0;
115 abs_path[0] = 0;
116
117 /* if name has arguments grab only the first word (the name of the executable)*/
118 sscanf(name, "%s ", exec_name);
119
120 arg = name + strlen(exec_name);
121
122 /* remove leading spaces from argument */
123 while (isspace(arg[0])) {
124 arg++;
125 }
126
127 /* remove trailing spaces from argument */
128 if (strlen(arg) > 0) {
129
130 end = strlen(arg) - 1;
131
132 while (arg[(int)end] == ' ') {
133 arg[(int)end] = 0;
134 end--;
135 }
136 }
137
138 /* turn the exec_name into an absolute path */
139 cmd = (char *)malloc_2(strlen(exec_name)+6+1);
140 sprintf(cmd, "which %s", exec_name);
141 stream = popen(cmd, "r");
142
143 result = fscanf(stream, "%s", abs_path);
144
145 if(strlen(abs_path) == 0)
146 {
147 status_text("Could not find transaction filter process!\n");
148 return;
149
150 }
151
152 pclose(stream);
153 free_2(cmd);
154
155 /* remove_ttrans_filter(which, 0); ... should never happen from GUI, but perhaps possible from save files or other weirdness */
156 if(!GLOBALS->ttrans_filter[which])
157 {
158 GLOBALS->ttrans_filter[which] = pipeio_create(abs_path, arg);
159 }
160 }
161
162 void install_ttrans_filter(int which)
163 {
164 int found = 0;
165
166 if(GLOBALS->traces.first)
167 {
168 Trptr t = GLOBALS->traces.first;
169 while(t)
170 {
171 if(t->flags&TR_HIGHLIGHT)
172 {
173 if(!t->vector)
174 {
175 bvptr v = combine_traces(0, t); /* make single signal a vector */
176 if(v)
177 {
178 t->vector = 1;
179 t->n.vec = v; /* splice in */
180 }
181 }
182
183 if((t->vector) && (!(t->flags&(TR_BLANK|TR_ANALOG_BLANK_STRETCH))))
184 {
185 t->t_filter = which;
186
187 t->t_filter_converted = 0;
188
189 /* back out allocation to revert (if any) */
190 if(t->n.vec->transaction_cache)
191 {
192 int i;
193 bvptr bv = t->n.vec;
194 bvptr bv2;
195
196 t->n.vec = bv->transaction_cache;
197
198 while(bv)
199 {
200 bv2 = bv->transaction_chain;
201
202 if(bv->bvname)
203 {
204 free_2(bv->bvname);
205 }
206
207 for(i=0;i<bv->numregions;i++)
208 {
209 free_2(bv->vectors[i]);
210 }
211
212 free_2(bv);
213 bv = bv2;
214 }
215
216 t->name = t->n.vec->bvname;
217 if(GLOBALS->hier_max_level)
218 t->name = hier_extract(t->name, GLOBALS->hier_max_level);
219 }
220
221 if(!which)
222 {
223 t->flags &= (~TR_TTRANSLATED);
224 }
225 else
226 {
227 t->flags |= TR_TTRANSLATED;
228 traverse_vector_nodes(t);
229 }
230 found = 1;
231
232 if(t->t_match)
233 {
234 Trptr curr_trace = t;
235 t = t->t_next;
236 while(t && (t->t_match != curr_trace))
237 {
238 t = t->t_next;
239 }
240 }
241 }
242 }
243 t=GiveNextTrace(t);
244 }
245 }
246
247 if(found)
248 {
249 regen_display();
250 }
251 }
252
253 /************************************************************************/
254
255
256
257 static void destroy_callback(GtkWidget *widget, GtkWidget *nothing)
258 {
259 GLOBALS->is_active_ttranslate_c_2=0;
260 gtk_widget_destroy(GLOBALS->window_ttranslate_c_5);
261 GLOBALS->window_ttranslate_c_5 = NULL;
262 }
263
264 static void ok_callback(GtkWidget *widget, GtkWidget *nothing)
265 {
266 install_ttrans_filter(GLOBALS->current_filter_ttranslate_c_1);
267 destroy_callback(widget, nothing);
268 }
269
270 static void select_row_callback(GtkWidget *widget, gint row, gint column,
271 GdkEventButton *event, gpointer data)
272 {
273 GLOBALS->current_filter_ttranslate_c_1 = row + 1;
274 }
275
276 static void unselect_row_callback(GtkWidget *widget, gint row, gint column,
277 GdkEventButton *event, gpointer data)
278 {
279 GLOBALS->current_filter_ttranslate_c_1 = 0; /* none */
280 }
281
282
283 static void add_filter_callback_2(GtkWidget *widget, GtkWidget *nothing)
284 {
285 int i;
286 GtkCList *cl;
287
288 if(!GLOBALS->filesel_ok) { return; }
289
290 if(*GLOBALS->fileselbox_text)
291 {
292 for(i=0;i<GLOBALS->num_ttrans_filters;i++)
293 {
294 if(GLOBALS->ttranssel_filter[i])
295 {
296 if(!strcmp(GLOBALS->ttranssel_filter[i], *GLOBALS->fileselbox_text))
297 {
298 status_text("Filter already imported.\n");
299 if(GLOBALS->is_active_ttranslate_c_2) gdk_window_raise(GLOBALS->window_ttranslate_c_5->window);
300 return;
301 }
302 }
303 }
304 }
305
306 GLOBALS->num_ttrans_filters++;
307 load_ttrans_filter(GLOBALS->num_ttrans_filters, *GLOBALS->fileselbox_text);
308 if(GLOBALS->ttrans_filter[GLOBALS->num_ttrans_filters])
309 {
310 if(GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters]) free_2(GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters]);
311 GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters] = malloc_2(strlen(*GLOBALS->fileselbox_text) + 1);
312 strcpy(GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters], *GLOBALS->fileselbox_text);
313
314 cl=GTK_CLIST(GLOBALS->clist_ttranslate_c_2);
315 gtk_clist_freeze(cl);
316 gtk_clist_append(cl,(gchar **)&(GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters]));
317
318 gtk_clist_set_column_width(cl,0,gtk_clist_optimal_column_width(cl,0));
319 gtk_clist_thaw(cl);
320 }
321 else
322 {
323 GLOBALS->num_ttrans_filters--;
324 }
325
326 if(GLOBALS->is_active_ttranslate_c_2) gdk_window_raise(GLOBALS->window_ttranslate_c_5->window);
327 }
328
329 static void add_filter_callback(GtkWidget *widget, GtkWidget *nothing)
330 {
331 if(GLOBALS->num_ttrans_filters == TTRANS_FILTER_MAX)
332 {
333 status_text("Max number of transaction filters processes installed already.\n");
334 return;
335 }
336
337 fileselbox("Select Transaction Filter Process",&GLOBALS->fcurr_ttranslate_c_1,GTK_SIGNAL_FUNC(add_filter_callback_2), GTK_SIGNAL_FUNC(NULL),"*", 0);
338 }
339
340 /*
341 * mainline..
342 */
343 void ttrans_searchbox(char *title)
344 {
345 int i;
346
347 GtkWidget *scrolled_win;
348 GtkWidget *vbox1, *hbox, *hbox0;
349 GtkWidget *button1, *button5, *button6;
350 gchar *titles[]={"Transaction Process Filter Select"};
351 GtkWidget *frame2, *frameh, *frameh0;
352 GtkWidget *table;
353 GtkTooltips *tooltips;
354
355 if(GLOBALS->is_active_ttranslate_c_2)
356 {
357 gdk_window_raise(GLOBALS->window_ttranslate_c_5->window);
358 return;
359 }
360
361 GLOBALS->is_active_ttranslate_c_2=1;
362 GLOBALS->current_filter_ttranslate_c_1 = 0;
363
364 /* create a new modal window */
365 GLOBALS->window_ttranslate_c_5 = gtk_window_new(GLOBALS->disable_window_manager ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL);
366 install_focus_cb(GLOBALS->window_ttranslate_c_5, ((char *)&GLOBALS->window_ttranslate_c_5) - ((char *)GLOBALS));
367
368 gtk_window_set_title(GTK_WINDOW (GLOBALS->window_ttranslate_c_5), title);
369 gtkwave_signal_connect(GTK_OBJECT (GLOBALS->window_ttranslate_c_5), "delete_event",(GtkSignalFunc) destroy_callback, NULL);
370
371 tooltips=gtk_tooltips_new_2();
372
373 table = gtk_table_new (256, 1, FALSE);
374 gtk_widget_show (table);
375
376 vbox1 = gtk_vbox_new (FALSE, 0);
377 gtk_container_border_width (GTK_CONTAINER (vbox1), 3);
378 gtk_widget_show (vbox1);
379
380
381 frame2 = gtk_frame_new (NULL);
382 gtk_container_border_width (GTK_CONTAINER (frame2), 3);
383 gtk_widget_show(frame2);
384
385 gtk_table_attach (GTK_TABLE (table), frame2, 0, 1, 0, 254,
386 GTK_FILL | GTK_EXPAND,
387 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);
388
389 GLOBALS->clist_ttranslate_c_2=gtk_clist_new_with_titles(1,titles);
390 gtk_clist_column_titles_passive(GTK_CLIST(GLOBALS->clist_ttranslate_c_2));
391
392 gtk_clist_set_selection_mode(GTK_CLIST(GLOBALS->clist_ttranslate_c_2), GTK_SELECTION_EXTENDED);
393 gtkwave_signal_connect_object (GTK_OBJECT (GLOBALS->clist_ttranslate_c_2), "select_row",GTK_SIGNAL_FUNC(select_row_callback),NULL);
394 gtkwave_signal_connect_object (GTK_OBJECT (GLOBALS->clist_ttranslate_c_2), "unselect_row",GTK_SIGNAL_FUNC(unselect_row_callback),NULL);
395
396 for(i=0;i<GLOBALS->num_ttrans_filters;i++)
397 {
398 gtk_clist_append(GTK_CLIST(GLOBALS->clist_ttranslate_c_2),(gchar **)&(GLOBALS->ttranssel_filter[i+1]));
399 }
400 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));
401
402 gtk_widget_show (GLOBALS->clist_ttranslate_c_2);
403
404 scrolled_win = gtk_scrolled_window_new (NULL, NULL);
405 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
406 GTK_POLICY_AUTOMATIC,
407 GTK_POLICY_AUTOMATIC);
408 gtk_widget_set_usize( GTK_WIDGET (scrolled_win), -1, 300);
409 gtk_widget_show(scrolled_win);
410
411 /* gtk_scrolled_window_add_with_viewport doesn't seen to work right here.. */
412 gtk_container_add (GTK_CONTAINER (scrolled_win), GLOBALS->clist_ttranslate_c_2);
413
414 gtk_container_add (GTK_CONTAINER (frame2), scrolled_win);
415
416
417 frameh0 = gtk_frame_new (NULL);
418 gtk_container_border_width (GTK_CONTAINER (frameh0), 3);
419 gtk_widget_show(frameh0);
420 gtk_table_attach (GTK_TABLE (table), frameh0, 0, 1, 254, 255,
421 GTK_FILL | GTK_EXPAND,
422 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);
423
424
425 hbox0 = gtk_hbox_new (FALSE, 1);
426 gtk_widget_show (hbox0);
427
428 button6 = gtk_button_new_with_label (" Add Trans Filter to List ");
429 gtk_container_border_width (GTK_CONTAINER (button6), 3);
430 gtkwave_signal_connect_object (GTK_OBJECT (button6), "clicked",GTK_SIGNAL_FUNC(add_filter_callback),GTK_OBJECT (GLOBALS->window_ttranslate_c_5));
431 gtk_widget_show (button6);
432 gtk_tooltips_set_tip_2(tooltips, button6,
433 "Bring up a file requester to add a transaction process filter to the filter select window.",NULL);
434
435 gtk_box_pack_start (GTK_BOX (hbox0), button6, TRUE, FALSE, 0);
436 gtk_container_add (GTK_CONTAINER (frameh0), hbox0);
437
438 frameh = gtk_frame_new (NULL);
439 gtk_container_border_width (GTK_CONTAINER (frameh), 3);
440 gtk_widget_show(frameh);
441 gtk_table_attach (GTK_TABLE (table), frameh, 0, 1, 255, 256,
442 GTK_FILL | GTK_EXPAND,
443 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);
444
445
446 hbox = gtk_hbox_new (FALSE, 1);
447 gtk_widget_show (hbox);
448
449 button1 = gtk_button_new_with_label (" OK ");
450 gtk_container_border_width (GTK_CONTAINER (button1), 3);
451 gtkwave_signal_connect_object (GTK_OBJECT (button1), "clicked",GTK_SIGNAL_FUNC(ok_callback),GTK_OBJECT (GLOBALS->window_ttranslate_c_5));
452 gtk_widget_show (button1);
453 gtk_tooltips_set_tip_2(tooltips, button1,
454 "Add selected signals to end of the display on the main window.",NULL);
455
456 gtk_box_pack_start (GTK_BOX (hbox), button1, TRUE, FALSE, 0);
457
458 button5 = gtk_button_new_with_label (" Cancel ");
459 gtk_container_border_width (GTK_CONTAINER (button5), 3);
460 gtkwave_signal_connect_object (GTK_OBJECT (button5), "clicked",GTK_SIGNAL_FUNC(destroy_callback),GTK_OBJECT (GLOBALS->window_ttranslate_c_5));
461 gtk_tooltips_set_tip_2(tooltips, button5,
462 "Do nothing and return to the main window.",NULL);
463 gtk_widget_show (button5);
464 gtk_box_pack_start (GTK_BOX (hbox), button5, TRUE, FALSE, 0);
465
466 gtk_container_add (GTK_CONTAINER (frameh), hbox);
467 gtk_container_add (GTK_CONTAINER (GLOBALS->window_ttranslate_c_5), table);
468
469 gtk_widget_set_usize(GTK_WIDGET(GLOBALS->window_ttranslate_c_5), 400, 400);
470 gtk_widget_show(GLOBALS->window_ttranslate_c_5);
471 }
472
473
474 /*
475 * currently only called by parsewavline
476 */
477 void set_current_translate_ttrans(char *name)
478 {
479 int i;
480
481 for(i=1;i<GLOBALS->num_ttrans_filters+1;i++)
482 {
483 if(!strcmp(GLOBALS->ttranssel_filter[i], name)) { GLOBALS->current_translate_ttrans = i; return; }
484 }
485
486 if(GLOBALS->num_ttrans_filters < TTRANS_FILTER_MAX)
487 {
488 GLOBALS->num_ttrans_filters++;
489 load_ttrans_filter(GLOBALS->num_ttrans_filters, name);
490 if(!GLOBALS->ttrans_filter[GLOBALS->num_ttrans_filters])
491 {
492 GLOBALS->num_ttrans_filters--;
493 GLOBALS->current_translate_ttrans = 0;
494 }
495 else
496 {
497 if(GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters]) free_2(GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters]);
498 GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters] = malloc_2(strlen(name) + 1);
499 strcpy(GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters], name);
500 GLOBALS->current_translate_ttrans = GLOBALS->num_ttrans_filters;
501 }
502 }
503 }
504
505
506 int traverse_vector_nodes(Trptr t)
507 {
508 int i;
509 int cvt_ok = 0;
510
511 if((t->t_filter) && (t->flags & TR_TTRANSLATED) && (t->vector) && (!t->t_filter_converted))
512 {
513 int rc = save_nodes_to_trans(GLOBALS->ttrans_filter[t->t_filter]->sout, t);
514
515 if(rc == VCDSAV_OK)
516 {
517 int is_finish = 0;
518 bvptr prev_transaction_trace = NULL;
519
520 while(!is_finish)
521 {
522 struct VectorEnt *vt_head = NULL, *vt_curr = NULL;
523 struct VectorEnt *vt;
524 struct VectorEnt *vprev;
525 bvptr bv;
526 int regions = 2;
527 TimeType prev_tim = LLDescriptor(-1);
528 char *trace_name = NULL;
529 char *orig_name = t->n.vec->bvname;
530
531 cvt_ok = 1;
532
533 vt_head = vt_curr = vt = calloc_2(1, sizeof(struct VectorEnt));
534 vt->time = LLDescriptor(-2);
535 vprev = vt; /* for duplicate removal */
536
537 vt_curr = vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt));
538 vt->time = LLDescriptor(-1);
539
540 for(;;)
541 {
542 char buf[1025];
543 char *pnt, *rtn;
544
545 if(feof(GLOBALS->ttrans_filter[t->t_filter]->sin)) break; /* should never happen */
546
547 buf[0] = 0;
548 pnt = fgets(buf, 1024, GLOBALS->ttrans_filter[t->t_filter]->sin);
549 if(!pnt) break;
550 rtn = pnt;
551 while(*rtn)
552 {
553 if((*rtn == '\n') || (*rtn == '\r')) { *rtn = 0; break; }
554 rtn++;
555 }
556
557 while(*pnt) { if(isspace(*pnt)) pnt++; else break;}
558
559 if(*pnt=='#')
560 {
561 TimeType tim = atoi_64(pnt+1) * GLOBALS->time_scale;
562 int slen;
563 char *sp;
564
565 while(*pnt) { if(!isspace(*pnt)) pnt++; else break; }
566 while(*pnt) { if(isspace(*pnt)) pnt++; else break; }
567
568 sp = pnt;
569 slen = strlen(sp);
570
571 if(slen)
572 {
573 pnt = sp + slen - 1;
574 do
575 {
576 if(isspace(*pnt)) { *pnt = 0; pnt--; slen--; } else { break; }
577 } while(pnt != (sp-1));
578 }
579
580 vt = calloc_2(1, sizeof(struct VectorEnt) + slen);
581 if(sp) strcpy(vt->v, sp);
582
583 if(tim > prev_tim)
584 {
585 prev_tim = vt->time = tim;
586 vt_curr->next = vt;
587 vt_curr = vt;
588 vprev = vprev->next; /* bump forward the -2 node pointer */
589 regions++;
590 }
591 else if(tim == prev_tim)
592 {
593 vt->time = prev_tim;
594 free_2(vt_curr);
595 vt_curr = vprev->next = vt; /* splice new one in -1 node place */
596 }
597 else
598 {
599 free_2(vt); /* throw it away */
600 }
601
602 continue;
603 }
604 else
605 if((*pnt=='M')||(*pnt=='m'))
606 {
607 pnt++;
608 if(((*pnt>='A')&&(*pnt<='Z')) || ((*pnt>='a')&&(*pnt<='z')))
609 {
610 int which_marker = ((*pnt>='A')&&(*pnt<='Z')) ? (*pnt - 'A') : (*pnt - 'a');
611 TimeType tim = atoi_64(pnt+1) * GLOBALS->time_scale;
612 int slen;
613 char *sp;
614
615 if(tim < LLDescriptor(0)) tim = LLDescriptor(-1);
616 GLOBALS->named_markers[which_marker] = tim;
617
618 while(*pnt) { if(!isspace(*pnt)) pnt++; else break; }
619 while(*pnt) { if(isspace(*pnt)) pnt++; else break; }
620
621 sp = pnt;
622 slen = strlen(sp);
623
624 if(slen)
625 {
626 pnt = sp + slen - 1;
627 do
628 {
629 if(isspace(*pnt)) { *pnt = 0; pnt--; slen--; } else { break; }
630 } while(pnt != (sp-1));
631 }
632
633 if(GLOBALS->marker_names[which_marker]) free_2(GLOBALS->marker_names[which_marker]);
634 GLOBALS->marker_names[which_marker] = (sp && (*sp) && (tim >= LLDescriptor(0))) ? strdup_2(sp) : NULL;
635 }
636
637 continue;
638 }
639 else if(*pnt == '$')
640 {
641 if(!strncmp(pnt+1, "finish", 6))
642 {
643 is_finish = 1;
644 break;
645 }
646 else
647 if(!strncmp(pnt+1, "next", 4))
648 {
649 break;
650 }
651 else
652 if(!strncmp(pnt+1, "name", 4))
653 {
654 int slen;
655 char *sp;
656
657 pnt+=5;
658 while(*pnt) { if(isspace(*pnt)) pnt++; else break; }
659
660 sp = pnt;
661 slen = strlen(sp);
662
663 if(slen)
664 {
665 pnt = sp + slen - 1;
666 do
667 {
668 if(isspace(*pnt)) { *pnt = 0; pnt--; slen--; } else { break; }
669 } while(pnt != (sp-1));
670 }
671
672 if(sp && *sp)
673 {
674 if(trace_name) free_2(trace_name);
675 trace_name = strdup_2(sp);
676 }
677 }
678 }
679 }
680
681 vt_curr = vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt));
682 vt->time = MAX_HISTENT_TIME - 1;
683 regions++;
684
685 vt_curr = vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt));
686 vt->time = MAX_HISTENT_TIME;
687 regions++;
688
689 bv = calloc_2(1, sizeof(struct BitVector) + (sizeof(vptr) * (regions-1)));
690 bv->bvname = strdup_2(trace_name ? trace_name : orig_name);
691 bv->nbits = 1;
692 bv->numregions = regions;
693 bv->bits = t->n.vec->bits;
694
695 vt = vt_head;
696 for(i=0;i<regions;i++)
697 {
698 bv->vectors[i] = vt;
699 vt = vt->next;
700 }
701
702 if(!prev_transaction_trace)
703 {
704 prev_transaction_trace = bv;
705 bv->transaction_cache = t->n.vec; /* for possible restore later */
706 t->n.vec = bv;
707
708 t->t_filter_converted = 1;
709
710 if(trace_name) /* if NULL, no need to regen display as trace name didn't change */
711 {
712 t->name = t->n.vec->bvname;
713 if(GLOBALS->hier_max_level)
714 t->name = hier_extract(t->name, GLOBALS->hier_max_level);
715
716 regen_display();
717 }
718 }
719 else
720 {
721 prev_transaction_trace->transaction_chain = bv;
722 prev_transaction_trace = bv;
723 }
724 }
725 }
726 else
727 {
728 /* failed */
729 t->flags &= ~TR_TTRANSLATED;
730 }
731 }
732
733 return(cvt_ok);
734 }
735
736 #endif
737
738 /*
739 * $Id: ttranslate.c,v 1.17 2010/04/25 16:47:06 gtkwave Exp $
740 * $Log: ttranslate.c,v $
741 * Revision 1.17 2010/04/25 16:47:06 gtkwave
742 * typo fix for mingw
743 *
744 * Revision 1.16 2010/04/24 16:32:46 gtkwave
745 * compile fix for MinGW
746 *
747 * Revision 1.15 2010/04/15 18:39:35 gtkwave
748 * remove invocations of pipeio_destroy where unnecessary
749 *
750 * Revision 1.14 2010/04/15 01:55:03 gtkwave
751 * raise to front on filename select
752 *
753 * Revision 1.13 2010/04/15 00:30:23 gtkwave
754 * don't propagate ttranslate filter into groups
755 *
756 * Revision 1.12 2010/04/12 23:07:12 gtkwave
757 * add ability to make single signals transactions
758 *
759 * Revision 1.11 2010/04/08 22:23:53 gtkwave
760 * remove debug statement
761 *
762 * Revision 1.10 2010/04/07 01:50:45 gtkwave
763 * improved name handling for bvname, add $next transaction operation
764 *
765 * Revision 1.9 2010/04/06 06:17:21 gtkwave
766 * added N named trace flag
767 *
768 * Revision 1.8 2010/04/04 19:09:57 gtkwave
769 * rename name->bvname in struct BitVector for easier grep tracking
770 *
771 * Revision 1.7 2010/04/04 07:12:40 gtkwave
772 * deallocate transaction cache on FreeTrace
773 *
774 * Revision 1.6 2010/04/04 06:07:03 gtkwave
775 * add M named marker placement command
776 *
777 * Revision 1.5 2010/04/01 03:10:58 gtkwave
778 * time warp fixes
779 *
780 * Revision 1.4 2010/03/31 21:40:53 gtkwave
781 * duplicate removal of VectorEnt structs at same time
782 *
783 * Revision 1.3 2010/03/31 19:38:56 gtkwave
784 * added missing timescale multiplier
785 *
786 * Revision 1.2 2010/03/31 19:31:03 gtkwave
787 * hardening of times in ttranslate received from client
788 *
789 * Revision 1.1 2010/03/31 15:42:47 gtkwave
790 * added preliminary transaction filter support
791 *
792 */
0 /*
1 * Copyright (c) Tony Bybell 2010.
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License
5 * as published by the Free Software Foundation; either version 2
6 * of the License, or (at your option) any later version.
7 */
8
9 #include "globals.h"
10
11 #ifndef WAVE_TTRANSLATE_H
12 #define WAVE_TTRANSLATE_H
13
14 #include <stdio.h>
15 #include <string.h>
16 #include <ctype.h>
17 #include "fgetdynamic.h"
18 #include "debug.h"
19
20 #define TTRANS_FILTER_MAX (128)
21
22
23 void ttrans_searchbox(char *title);
24 void init_ttrans_data(void);
25 void install_ttrans_filter(int which);
26 void set_current_translate_ttrans(char *name);
27 void remove_all_ttrans_filters(void);
28
29 #endif
30
31 /*
32 * $Id: ttranslate.h,v 1.1 2010/03/31 15:42:47 gtkwave Exp $
33 * $Log: ttranslate.h,v $
34 * Revision 1.1 2010/03/31 15:42:47 gtkwave
35 * added preliminary transaction filter support
36 *
37 */
38
23502350 bptr bts = b->bits;
23512351 int i;
23522352
2353 for(i=0;i<bts->nbits;i++)
2353 for(i=0;i<bts->nnbits;i++)
23542354 {
23552355 if(!bts->nodes[i]->harray)
23562356 {
23792379 int i;
23802380 bvptr b2;
23812381
2382 for(i=0;i<bts->nbits;i++)
2382 for(i=0;i<bts->nnbits;i++)
23832383 {
23842384 if(!bts->nodes[i]->harray)
23852385 {
24022402 t->n.vec = b2;
24032403 b2->bits=bts;
24042404
2405 free_2(b2->name);
2406 b2->name = b->name;
2405 free_2(b2->bvname);
2406 b2->bvname = b->bvname;
24072407
24082408 for(i=0;i<b->numregions;i++)
24092409 {
25082508 }
25092509
25102510 /*
2511 * $Id: vcd_partial.c,v 1.32 2010/03/18 17:12:37 gtkwave Exp $
2511 * $Id: vcd_partial.c,v 1.34 2010/04/04 19:09:57 gtkwave Exp $
25122512 * $Log: vcd_partial.c,v $
2513 * Revision 1.34 2010/04/04 19:09:57 gtkwave
2514 * rename name->bvname in struct BitVector for easier grep tracking
2515 *
2516 * Revision 1.33 2010/03/31 15:42:47 gtkwave
2517 * added preliminary transaction filter support
2518 *
25132519 * Revision 1.32 2010/03/18 17:12:37 gtkwave
25142520 * pedantic warning cleanups
25152521 *
4848 /*
4949 * generate a vcd identifier for a given facindx
5050 */
51 static char *vcdid(int value)
51 static char *vcdid(int value, int export_typ)
5252 {
5353 char *pnt = GLOBALS->buf_vcd_saver_c_3;
5454 int i, vmod;
5555
56 value++;
57 for(i=0;;i++)
58 {
59 if((vmod = (value % 94)))
60 {
61 *(pnt++) = (char)(vmod + 32);
62 }
63 else
64 {
65 *(pnt++) = '~'; value -= 94;
66 }
67 value = value / 94;
68 if(!value) { break; }
69 }
70
71 *pnt = 0;
56 if(export_typ != WAVE_EXPORT_TRANS)
57 {
58 value++;
59 for(i=0;;i++)
60 {
61 if((vmod = (value % 94)))
62 {
63 *(pnt++) = (char)(vmod + 32);
64 }
65 else
66 {
67 *(pnt++) = '~'; value -= 94;
68 }
69 value = value / 94;
70 if(!value) { break; }
71 }
72
73 *pnt = 0;
74 }
75 else
76 {
77 sprintf(pnt, "%d", value);
78 }
79
7280 return(GLOBALS->buf_vcd_saver_c_3);
7381 }
7482
75 /*
76 static char *vcdid(int value)
77 {
78 int i;
79
80 for(i=0;i<15;i++)
81 {
82 GLOBALS->buf_vcd_saver_c_3[i]=(char)((value%94)+33);
83 value=value/94;
84 if(!value) {GLOBALS->buf_vcd_saver_c_3[i+1]=0; break;}
85 }
86
87 return(GLOBALS->buf_vcd_saver_c_3);
88 }
89 */
9083
9184 static char *vcd_truncate_bitvec(char *s)
9285 {
323316 /*
324317 * mainline
325318 */
326 int save_nodes_to_export(const char *fname, int export_typ)
327 {
328 Trptr t = GLOBALS->traces.first;
319 int save_nodes_to_export_generic(FILE *trans_file, Trptr trans_head, const char *fname, int export_typ)
320 {
321 Trptr t = trans_head ? trans_head : GLOBALS->traces.first;
329322 int nodecnt = 0;
330323 vcdsav_Tree *vt = NULL;
331324 vcdsav_Tree **hp_clone = GLOBALS->hp_vcd_saver_c_1;
341334 char *row_data = NULL;
342335 struct lt_trace *lt = NULL;
343336 int lxt = (export_typ == WAVE_EXPORT_LXT);
337 int seqn = 0;
344338
345339 if(export_typ == WAVE_EXPORT_TIM)
346340 {
358352 }
359353 else
360354 {
361 GLOBALS->f_vcd_saver_c_1 = fopen(fname, "wb");
355 if(export_typ != WAVE_EXPORT_TRANS)
356 {
357 GLOBALS->f_vcd_saver_c_1 = fopen(fname, "wb");
358 }
359 else
360 {
361 GLOBALS->f_vcd_saver_c_1 = trans_file;
362 }
363
362364 if(!GLOBALS->f_vcd_saver_c_1)
363365 {
364366 return(VCDSAV_FILE_ERROR);
396398 bptr bt = b->bits;
397399 if(bt)
398400 {
399 for(i=0;i<bt->nbits;i++)
401 for(i=0;i<bt->nnbits;i++)
400402 {
401403 if(bt->nodes[i])
402404 {
422424 }
423425 }
424426
427
428 if(export_typ == WAVE_EXPORT_TRANS)
429 {
430 break;
431 }
432
425433 if(!strace_append)
426434 {
427435 t=t->t_next;
485493 }
486494 else
487495 {
488 time(&walltime);
489 fprintf(GLOBALS->f_vcd_saver_c_1, "$date\n");
490 fprintf(GLOBALS->f_vcd_saver_c_1, "\t%s",asctime(localtime(&walltime)));
491 fprintf(GLOBALS->f_vcd_saver_c_1, "$end\n");
492 fprintf(GLOBALS->f_vcd_saver_c_1, "$version\n\t"WAVE_VERSION_INFO"\n$end\n");
493 fprintf(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");
494 }
496 if(export_typ != WAVE_EXPORT_TRANS)
497 {
498 time(&walltime);
499 fprintf(GLOBALS->f_vcd_saver_c_1, "$date\n");
500 fprintf(GLOBALS->f_vcd_saver_c_1, "\t%s",asctime(localtime(&walltime)));
501 fprintf(GLOBALS->f_vcd_saver_c_1, "$end\n");
502 fprintf(GLOBALS->f_vcd_saver_c_1, "$version\n\t"WAVE_VERSION_INFO"\n$end\n");
503 fprintf(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");
504 }
505 else
506 {
507 fprintf(GLOBALS->f_vcd_saver_c_1, "$comment data_start %p $end\n", trans_head); /* arbitrary hex identifier */
508 fprintf(GLOBALS->f_vcd_saver_c_1, "$comment name %s $end\n", trans_head->name ? trans_head->name : "UNKNOWN");
509 fprintf(GLOBALS->f_vcd_saver_c_1, "$timescale %d%c%s $end\n", (int)GLOBALS->time_scale, GLOBALS->time_dimension, (GLOBALS->time_dimension=='s') ? "" : "s");
510 fprintf(GLOBALS->f_vcd_saver_c_1, "$comment min_time "TTFormat" $end\n", GLOBALS->min_time / GLOBALS->time_scale);
511 fprintf(GLOBALS->f_vcd_saver_c_1, "$comment max_time "TTFormat" $end\n", GLOBALS->max_time / GLOBALS->time_scale);
512 }
513 }
514
515 if(export_typ == WAVE_EXPORT_TRANS)
516 {
517 fprintf(GLOBALS->f_vcd_saver_c_1, "$comment max_seqn %d $end\n", nodecnt);
518 }
495519
496520 /* write out netnames here ... */
497521 hp_clone = GLOBALS->hp_vcd_saver_c_1 = calloc_2(nodecnt, sizeof(vcdsav_Tree *));
503527 char *hname = hier_decompress_flagged(GLOBALS->hp_vcd_saver_c_1[i]->item->nname, &was_packed);
504528 char *netname = lxt ? hname : output_hier(hname);
505529
530 if(export_typ == WAVE_EXPORT_TRANS)
531 {
532 fprintf(GLOBALS->f_vcd_saver_c_1, "$comment seqn %d %s $end\n", GLOBALS->hp_vcd_saver_c_1[i]->val, hname);
533 }
534
506535 if(GLOBALS->hp_vcd_saver_c_1[i]->flags & (HIST_REAL|HIST_STRING))
507536 {
508537 if(lxt)
511540 }
512541 else
513542 {
514 fprintf(GLOBALS->f_vcd_saver_c_1, "$var real 1 %s %s $end\n", vcdid(GLOBALS->hp_vcd_saver_c_1[i]->val), netname);
543 fprintf(GLOBALS->f_vcd_saver_c_1, "$var real 1 %s %s $end\n", vcdid(GLOBALS->hp_vcd_saver_c_1[i]->val, export_typ), netname);
515544 }
516545 }
517546 else
537566 }
538567 else
539568 {
540 fprintf(GLOBALS->f_vcd_saver_c_1, "$var wire 1 %s %s $end\n", vcdid(GLOBALS->hp_vcd_saver_c_1[i]->val), netname);
569 fprintf(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);
541570 }
542571 }
543572 else
549578 }
550579 else
551580 {
552 fprintf(GLOBALS->f_vcd_saver_c_1, "$var wire %d %s %s $end\n", len, vcdid(GLOBALS->hp_vcd_saver_c_1[i]->val), netname);
581 fprintf(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);
553582 }
554583 GLOBALS->hp_vcd_saver_c_1[i]->len = len;
555584 if(len > max_len) max_len = len;
620649 }
621650 else
622651 {
623 fprintf(GLOBALS->f_vcd_saver_c_1, "s%s %s\n", vec, vcdid(GLOBALS->hp_vcd_saver_c_1[0]->val));
652 fprintf(GLOBALS->f_vcd_saver_c_1, "s%s %s\n", vec, vcdid(GLOBALS->hp_vcd_saver_c_1[0]->val, export_typ));
624653 }
625654 }
626655 else
643672 }
644673 else
645674 {
646 fprintf(GLOBALS->f_vcd_saver_c_1, "r%.16g %s\n", value, vcdid(GLOBALS->hp_vcd_saver_c_1[0]->val));
675 fprintf(GLOBALS->f_vcd_saver_c_1, "r%.16g %s\n", value, vcdid(GLOBALS->hp_vcd_saver_c_1[0]->val, export_typ));
647676 }
648677 }
649678 }
672701 }
673702 else
674703 {
675 fprintf(GLOBALS->f_vcd_saver_c_1, "b%s %s\n", vcd_truncate_bitvec(row_data), vcdid(GLOBALS->hp_vcd_saver_c_1[0]->val));
704 fprintf(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));
676705 }
677706 }
678707 else
686715 }
687716 else
688717 {
689 fprintf(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));
718 fprintf(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));
690719 }
691720 }
692721 }
721750 }
722751 else
723752 {
724 fclose(GLOBALS->f_vcd_saver_c_1); GLOBALS->f_vcd_saver_c_1 = NULL;
753 if(export_typ != WAVE_EXPORT_TRANS)
754 {
755 fclose(GLOBALS->f_vcd_saver_c_1);
756 }
757 else
758 {
759 fprintf(GLOBALS->f_vcd_saver_c_1, "$comment data_end %p $end\n", trans_head); /* arbitrary hex identifier */
760 fflush(GLOBALS->f_vcd_saver_c_1);
761 }
762
763 GLOBALS->f_vcd_saver_c_1 = NULL;
725764 }
726765
727766 return(VCDSAV_OK);
728767 }
768
769
770
771 int save_nodes_to_export(const char *fname, int export_typ)
772 {
773 return(save_nodes_to_export_generic(NULL, NULL, fname, export_typ));
774 }
775
776 int save_nodes_to_trans(FILE *trans, Trptr t)
777 {
778 return(save_nodes_to_export_generic(trans, t, NULL, WAVE_EXPORT_TRANS));
779 }
780
729781
730782 /************************ scopenav ************************/
731783
10571109 {
10581110 if(!(h->flags&HIST_STRING))
10591111 {
1060 ascii=convert_ascii_real((double *)h->v.h_vector);
1112 ascii=convert_ascii_real(t, (double *)h->v.h_vector);
10611113 }
10621114 else
10631115 {
14641516 }
14651517
14661518 /*
1467 * $Id: vcd_saver.c,v 1.13 2010/03/14 07:09:49 gtkwave Exp $
1519 * $Id: vcd_saver.c,v 1.16 2010/04/01 20:07:35 gtkwave Exp $
14681520 * $Log: vcd_saver.c,v $
1521 * Revision 1.16 2010/04/01 20:07:35 gtkwave
1522 * timescale multiplier fix for transactions
1523 *
1524 * Revision 1.15 2010/03/31 15:42:47 gtkwave
1525 * added preliminary transaction filter support
1526 *
1527 * Revision 1.14 2010/03/24 23:05:10 gtkwave
1528 * added RealToBits menu option
1529 *
14691530 * Revision 1.13 2010/03/14 07:09:49 gtkwave
14701531 * removed ExtNode and merged with Node
14711532 *
1414 #include "vcd.h"
1515 #include "strace.h"
1616
17 enum vcd_export_typ { WAVE_EXPORT_VCD, WAVE_EXPORT_LXT, WAVE_EXPORT_TIM };
17 enum vcd_export_typ { WAVE_EXPORT_VCD, WAVE_EXPORT_LXT, WAVE_EXPORT_TIM, WAVE_EXPORT_TRANS };
1818 enum vcd_saver_rc { VCDSAV_OK, VCDSAV_EMPTY, VCDSAV_FILE_ERROR };
1919 enum vcd_saver_tr_datatype { VCDSAV_IS_BIN, VCDSAV_IS_HEX, VCDSAV_IS_TEXT };
2020
2121 int save_nodes_to_export(const char *fname, int export_typ);
2222 int do_timfile_save(const char *fname);
23 int save_nodes_to_trans(FILE *trans, Trptr t);
2324
2425 /* from helpers/scopenav.c */
2526 extern void free_hier(void);
2829 #endif
2930
3031 /*
31 * $Id: vcd_saver.h,v 1.4 2008/12/06 19:55:53 gtkwave Exp $
32 * $Id: vcd_saver.h,v 1.5 2010/03/31 15:42:47 gtkwave Exp $
3233 * $Log: vcd_saver.h,v $
34 * Revision 1.5 2010/03/31 15:42:47 gtkwave
35 * added preliminary transaction filter support
36 *
3337 * Revision 1.4 2008/12/06 19:55:53 gtkwave
3438 * more adds to the timinganalyzer output writer
3539 *
1111 #ifndef WAVE_VZTRDR_H
1212 #define WAVE_VZTRDR_H
1313
14 #ifndef _MSC_VER
14 #ifdef HAVE_INTTYPES_H
1515 #include <inttypes.h>
1616 #endif
1717
2626 #endif
2727
2828 /*
29 * $Id: vzt.h,v 1.2 2007/08/26 21:35:50 gtkwave Exp $
29 * $Id: vzt.h,v 1.3 2010/04/27 23:10:56 gtkwave Exp $
3030 * $Log: vzt.h,v $
31 * Revision 1.3 2010/04/27 23:10:56 gtkwave
32 * made inttype.h inclusion conditional
33 *
3134 * Revision 1.2 2007/08/26 21:35:50 gtkwave
3235 * integrated global context management from SystemOfCode2007 branch
3336 *
181181 TimeType closest_named = MAX_HISTENT_TIME;
182182 int closest_which = -1;
183183 gint xold = x, yold = y;
184 TraceEnt t_trans;
184185
185186 if(!GLOBALS->cursor_snap) return(marker);
186187
227228 }
228229
229230 if(!t) goto bot;
230 if((t->flags&(TR_BLANK|TR_EXCLUDE)))
231 if((t->flags&(/*TR_BLANK|*/TR_EXCLUDE))) /* TR_BLANK removed because of transaction handling below... */
231232 {
232233 t = NULL;
233234 goto bot;
234235 }
235236
236 if(t->flags & TR_ANALOG_BLANK_STRETCH) /* seek to real analog trace is present... */
237 if(t->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)) /* seek to real xact trace if present... */
238 {
239 Trptr tscan = t;
240 int bcnt = 0;
241 while((tscan) && (tscan = GivePrevTrace(tscan)))
242 {
243 if(!(tscan->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)))
244 {
245 if(tscan->flags & TR_TTRANSLATED)
246 {
247 break; /* found it */
248 }
249 else
250 {
251 tscan = NULL;
252 }
253 }
254 else
255 {
256 bcnt++; /* bcnt is number of blank traces */
257 }
258 }
259
260 if((tscan)&&(tscan->vector))
261 {
262 bvptr bv = tscan->n.vec;
263 do
264 {
265 bv = bv->transaction_chain; /* correlate to blank trace */
266 } while(bv && (bcnt--));
267 if(bv)
268 {
269 memcpy(&t_trans, tscan, sizeof(TraceEnt)); /* substitute into a synthetic trace */
270 t_trans.n.vec = bv;
271 t_trans.vector = 1;
272
273 t_trans.name = bv->bvname;
274 if(GLOBALS->hier_max_level)
275 t_trans.name = hier_extract(t_trans.name, GLOBALS->hier_max_level);
276
277 t = &t_trans;
278 goto process_trace;
279 }
280 }
281 }
282
283 if((t->flags&TR_BLANK))
284 {
285 t = NULL;
286 goto bot;
287 }
288
289 if(t->flags & TR_ANALOG_BLANK_STRETCH) /* seek to real analog trace if present... */
237290 {
238291 while((t) && (t = GivePrevTrace(t)))
239292 {
252305 }
253306 if(!t) goto bot;
254307
308 process_trace:
255309 if(t->vector)
256310 {
257311 vptr v = bsearch_vector(t->n.vec, marker - t->shift);
13241378 */
13251379 void force_screengrab_gcs(void)
13261380 {
1381 GLOBALS->black_and_white = 1;
1382
13271383 GLOBALS->gc_ltgray= GLOBALS->gc_white ;
13281384 GLOBALS->gc_normal= GLOBALS->gc_white ;
13291385 GLOBALS->gc_mdgray= GLOBALS->gc_white ;
13611417
13621418 void force_normal_gcs(void)
13631419 {
1420 GLOBALS->black_and_white = 0;
1421
13641422 GLOBALS->gc_ltgray = GLOBALS->gccache_ltgray ;
13651423 GLOBALS->gc_normal = GLOBALS->gccache_normal ;
13661424 GLOBALS->gc_mdgray = GLOBALS->gccache_mdgray ;
15621620 }
15631621
15641622
1565 void populateBuffer (Trptr t, char* buf)
1623 void populateBuffer (Trptr t, char *altname, char* buf)
15661624 {
15671625 char* ptr = buf;
1626 char *tname = altname ? altname : t->name;
15681627
15691628 if (HasWave(t))
15701629 {
1571 if (t->name)
1572 {
1573 strcpy(ptr, t->name);
1630 if (tname)
1631 {
1632 strcpy(ptr, tname);
15741633 ptr = ptr + strlen(ptr);
15751634
1576 if((t->name)&&(t->shift))
1635 if((tname)&&(t->shift))
15771636 {
15781637 ptr[0]='`';
15791638 reformat_time(ptr+1, t->shift, GLOBALS->time_dimension);
16041663 }
16051664 else
16061665 {
1607 if (t->name)
1666 if (tname)
16081667 {
16091668
16101669 if (IsGroupEnd(t))
16131672 ptr = ptr + strlen(ptr);
16141673 }
16151674
1616 strcpy(ptr, t->name);
1675 strcpy(ptr, tname);
16171676 ptr = ptr + strlen(ptr);
16181677
16191678 if (IsGroupBegin(t))
16381697 {
16391698 int texty, liney;
16401699 int retval;
1641 char buf[256];
1700 char buf[2048];
16421701 GdkGC *clr_comment;
16431702 GdkGC *clr_group;
16441703 GdkGC *clr_shadowed;
16461705 GdkGC* bg_color;
16471706 GdkGC* text_color;
16481707 unsigned left_justify;
1649
1708 char *subname = NULL;
1709 bvptr bv = NULL;
1710
16501711 buf[0] = 0;
16511712
1652 populateBuffer(t, buf);
1713 if(t->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)) /* seek to real xact trace if present... */
1714 {
1715 Trptr tscan = t;
1716 int bcnt = 0;
1717 while((tscan) && (tscan = GivePrevTrace(tscan)))
1718 {
1719 if(!(tscan->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)))
1720 {
1721 if(tscan->flags & TR_TTRANSLATED)
1722 {
1723 break; /* found it */
1724 }
1725 else
1726 {
1727 tscan = NULL;
1728 }
1729 }
1730 else
1731 {
1732 bcnt++; /* bcnt is number of blank traces */
1733 }
1734 }
1735
1736 if((tscan)&&(tscan->vector))
1737 {
1738 bv = tscan->n.vec;
1739 do
1740 {
1741 bv = bv->transaction_chain; /* correlate to blank trace */
1742 } while(bv && (bcnt--));
1743 if(bv)
1744 {
1745 subname = bv->bvname;
1746 if(GLOBALS->hier_max_level)
1747 subname = hier_extract(subname, GLOBALS->hier_max_level);
1748 }
1749 }
1750 }
1751
1752 populateBuffer(t, subname, buf);
16531753
16541754 clr_comment = GLOBALS->gc_brkred;
16551755 clr_group = GLOBALS->gc_gmstrd;
16951795 0, liney,
16961796 GLOBALS->signal_fill_width-1, liney);
16971797
1698 if(t->name)
1798 if((t->name)||(subname))
16991799 {
17001800 font_engine_draw_string(GLOBALS->signalpixmap,
17011801 GLOBALS->signalfont,
17081808
17091809 }
17101810
1711 if (HasWave(t))
1811 if (HasWave(t) || bv)
17121812 {
17131813 if((t->asciivalue)&&(!(t->flags&TR_EXCLUDE)))
17141814 font_engine_draw_string(GLOBALS->signalpixmap,
17301830 Trptr t;
17311831 int len=0,maxlen=0;
17321832 int vlen=0, vmaxlen=0;
1733 char buf[256];
1833 char buf[2048];
17341834 char dirty_kick;
1835 bvptr bv;
1836 Trptr tscan;
17351837
17361838 DEBUG(printf("signalwindow_width_dirty: %d\n",signalwindow_width_dirty));
17371839
17451847
17461848 while(t)
17471849 {
1748
1749 populateBuffer(t, buf);
1750 if(t->flags&(TR_BLANK|TR_ANALOG_BLANK_STRETCH)) /* for "comment" style blank traces */
1850 char *subname = NULL;
1851 bv = NULL;
1852 tscan = NULL;
1853
1854 if(t->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)) /* seek to real xact trace if present... */
1855 {
1856 tscan = t;
1857 int bcnt = 0;
1858 while((tscan) && (tscan = GivePrevTrace(tscan)))
1859 {
1860 if(!(tscan->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)))
1861 {
1862 if(tscan->flags & TR_TTRANSLATED)
1863 {
1864 break; /* found it */
1865 }
1866 else
1867 {
1868 tscan = NULL;
1869 }
1870 }
1871 else
1872 {
1873 bcnt++; /* bcnt is number of blank traces */
1874 }
1875 }
1876
1877 if((tscan)&&(tscan->vector))
1878 {
1879 bv = tscan->n.vec;
1880 do
1881 {
1882 bv = bv->transaction_chain; /* correlate to blank trace */
1883 } while(bv && (bcnt--));
1884 if(bv)
1885 {
1886 subname = bv->bvname;
1887 if(GLOBALS->hier_max_level)
1888 subname = hier_extract(subname, GLOBALS->hier_max_level);
1889 }
1890 }
1891 }
1892
1893 populateBuffer(t, subname, buf);
1894
1895 if(!bv && (t->flags&(TR_BLANK|TR_ANALOG_BLANK_STRETCH))) /* for "comment" style blank traces */
17511896 {
1752 if(t->name)
1897 if(t->name || subname)
17531898 {
17541899 len=font_engine_string_measure(GLOBALS->signalfont, buf);
17551900 if(len>maxlen) maxlen=len;
17561901 }
1902
1903 if(t->asciivalue)
1904 {
1905 free_2(t->asciivalue); t->asciivalue = NULL;
1906 }
17571907 t=GiveNextTrace(t);
17581908 }
17591909 else
1760 if(t->name)
1761 {
1762
1910 if(t->name || subname)
1911 {
17631912 len=font_engine_string_measure(GLOBALS->signalfont, buf);
17641913 if(len>maxlen) maxlen=len;
17651914
17661915 if((GLOBALS->tims.marker!=-1)&&(!(t->flags&TR_EXCLUDE)))
17671916 {
17681917 t->asciitime=GLOBALS->tims.marker;
1769 if(t->asciivalue) free_2(t->asciivalue);
1770
1771 if(t->vector)
1918 if(t->asciivalue) { free_2(t->asciivalue); } t->asciivalue = NULL;
1919
1920 if(bv || t->vector)
17721921 {
17731922 char *str, *str2;
17741923 vptr v;
1775
1776 v=bsearch_vector(t->n.vec,GLOBALS->tims.marker);
1777 str=convert_ascii(t,v);
1924 Trptr ts;
1925 TraceEnt t_temp;
1926
1927 if(bv)
1928 {
1929 ts = &t_temp;
1930 memcpy(ts, tscan, sizeof(TraceEnt));
1931 ts->vector = 1;
1932 ts->n.vec = bv;
1933 }
1934 else
1935 {
1936 ts = t;
1937 bv = t->n.vec;
1938 }
1939
1940
1941 v=bsearch_vector(bv, GLOBALS->tims.marker - ts->shift);
1942 str=convert_ascii(ts,v);
17781943 if(str)
17791944 {
17801945 str2=(char *)malloc_2(strlen(str)+2);
17901955 vlen=0;
17911956 t->asciivalue=NULL;
17921957 }
1793
17941958 }
17951959 else
17961960 {
17971961 char *str;
17981962 hptr h_ptr;
1799 if((h_ptr=bsearch_node(t->n.nd,GLOBALS->tims.marker)))
1963 if((h_ptr=bsearch_node(t->n.nd,GLOBALS->tims.marker - t->shift)))
18001964 {
18011965 if(!t->n.nd->extvals)
18021966 {
18281992 {
18291993 if(!(h_ptr->flags&HIST_STRING))
18301994 {
1831 str=convert_ascii_real((double *)h_ptr->v.h_vector);
1995 str=convert_ascii_real(t, (double *)h_ptr->v.h_vector);
18321996 }
18331997 else
18341998 {
19382102
19392103 void UpdateSigValue(Trptr t)
19402104 {
2105 bvptr bv = NULL;
2106 Trptr tscan = NULL;
2107
19412108 if(!t) return;
19422109 if((t->asciivalue)&&(t->asciitime==GLOBALS->tims.marker))return;
19432110
1944 if((t->name)&&(!(t->flags&(TR_BLANK|TR_ANALOG_BLANK_STRETCH))))
2111 if(t->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)) /* seek to real xact trace if present... */
2112 {
2113 tscan = t;
2114 int bcnt = 0;
2115 while((tscan) && (tscan = GivePrevTrace(tscan)))
2116 {
2117 if(!(tscan->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)))
2118 {
2119 if(tscan->flags & TR_TTRANSLATED)
2120 {
2121 break; /* found it */
2122 }
2123 else
2124 {
2125 tscan = NULL;
2126 }
2127 }
2128 else
2129 {
2130 bcnt++; /* bcnt is number of blank traces */
2131 }
2132 }
2133
2134 if((tscan)&&(tscan->vector))
2135 {
2136 bv = tscan->n.vec;
2137 do
2138 {
2139 bv = bv->transaction_chain; /* correlate to blank trace */
2140 } while(bv && (bcnt--));
2141 if(bv)
2142 {
2143 /* nothing, we just want to set bv */
2144 }
2145 }
2146 }
2147
2148
2149 if((t->name || bv)&&(bv || !(t->flags&(TR_BLANK|TR_ANALOG_BLANK_STRETCH))))
19452150 {
19462151 GLOBALS->shift_timebase=t->shift;
19472152 DEBUG(printf("UpdateSigValue: %s\n",t->name));
19512156 t->asciitime=GLOBALS->tims.marker;
19522157 if(t->asciivalue) free_2(t->asciivalue);
19532158
1954 if(t->vector)
2159 if(bv || t->vector)
19552160 {
19562161 char *str, *str2;
19572162 vptr v;
1958
1959 v=bsearch_vector(t->n.vec,GLOBALS->tims.marker);
1960 str=convert_ascii(t,v);
2163 Trptr ts;
2164 TraceEnt t_temp;
2165
2166 if(bv)
2167 {
2168 ts = &t_temp;
2169 memcpy(ts, tscan, sizeof(TraceEnt));
2170 ts->vector = 1;
2171 ts->n.vec = bv;
2172 }
2173 else
2174 {
2175 ts = t;
2176 bv = t->n.vec;
2177 }
2178
2179 v=bsearch_vector(bv,GLOBALS->tims.marker - ts->shift);
2180 str=convert_ascii(ts,v);
19612181 if(str)
19622182 {
19632183 str2=(char *)malloc_2(strlen(str)+2);
19712191 {
19722192 t->asciivalue=NULL;
19732193 }
1974
19752194 }
19762195 else
19772196 {
19782197 char *str;
19792198 hptr h_ptr;
1980 if((h_ptr=bsearch_node(t->n.nd,GLOBALS->tims.marker)))
2199 if((h_ptr=bsearch_node(t->n.nd,GLOBALS->tims.marker - t->shift)))
19812200 {
19822201 if(!t->n.nd->extvals)
19832202 {
20072226 {
20082227 if(!(h_ptr->flags&HIST_STRING))
20092228 {
2010 str=convert_ascii_real((double *)h_ptr->v.h_vector);
2229 str=convert_ascii_real(t, (double *)h_ptr->v.h_vector);
20112230 }
20122231 else
20132232 {
22922511
22932512 if(GLOBALS->topmost_trace)
22942513 {
2295 Trptr t;
2514 Trptr t = GLOBALS->topmost_trace;
2515 Trptr tback = t;
22962516 hptr h;
22972517 vptr v;
2298 int i, num_traces_displayable;
2518 int i = 0, num_traces_displayable;
2519 int iback = 0;
22992520
23002521 num_traces_displayable=GLOBALS->wavearea->allocation.height/(GLOBALS->fontheight);
23012522 num_traces_displayable--; /* for the time trace that is always there */
23022523
2303 t=GLOBALS->topmost_trace;
2304 for(i=0;((i<num_traces_displayable)&&(t));i++)
2524 /* ensure that transaction traces are visible even if the topmost traces are blanks */
2525 while(tback)
2526 {
2527 if(tback->flags&(TR_BLANK|TR_ANALOG_BLANK_STRETCH))
2528 {
2529 tback = GivePrevTrace(tback);
2530 iback--;
2531 }
2532 else if(tback->flags & TR_TTRANSLATED)
2533 {
2534 if(tback != t)
2535 {
2536 t = tback;
2537 i = iback;
2538 }
2539 break;
2540 }
2541 else
2542 {
2543 break;
2544 }
2545 }
2546
2547 for(;((i<num_traces_displayable)&&(t));i++)
23052548 {
23062549 if(!(t->flags&(TR_EXCLUDE|TR_BLANK|TR_ANALOG_BLANK_STRETCH)))
23072550 {
23082551 GLOBALS->shift_timebase=t->shift;
23092552 if(!t->vector)
23102553 {
2311 h=bsearch_node(t->n.nd, GLOBALS->tims.start);
2554 h=bsearch_node(t->n.nd, GLOBALS->tims.start - t->shift);
23122555 DEBUG(printf("Bit Trace: %s, %s\n", t->name, t->n.nd->nname));
23132556 DEBUG(printf("Start time: "TTFormat", Histent time: "TTFormat"\n", tims.start,(h->time+shift_timebase)));
23142557
23152558 if(!t->n.nd->extvals)
23162559 {
2317 draw_hptr_trace(t,h,i,1,0);
2560 if(i>=0) draw_hptr_trace(t,h,i,1,0);
23182561 }
23192562 else
23202563 {
2321 draw_hptr_trace_vector(t,h,i);
2564 if(i>=0) draw_hptr_trace_vector(t,h,i);
23222565 }
23232566 }
23242567 else
23252568 {
2326 v=bsearch_vector(t->n.vec, GLOBALS->tims.start);
2327 DEBUG(printf("Vector Trace: %s, %s\n", t->name, t->n.vec->name));
2569 Trptr t_orig, tn;
2570 bvptr bv = t->n.vec;
2571
2572 v=bsearch_vector(bv, GLOBALS->tims.start - t->shift);
2573 DEBUG(printf("Vector Trace: %s, %s\n", t->name, bv->name));
23282574 DEBUG(printf("Start time: "TTFormat", Vectorent time: "TTFormat"\n", tims.start,(v->time+shift_timebase)));
2329 draw_vptr_trace(t,v,i);
2575 if(i>=0) draw_vptr_trace(t,v,i);
2576
2577 if((bv->transaction_chain) && (t->flags & TR_TTRANSLATED))
2578 {
2579 t_orig = t;
2580 for(;;)
2581 {
2582 tn = GiveNextTrace(t);
2583 bv = bv->transaction_chain;
2584
2585 if(bv && tn && (tn->flags & (TR_BLANK|TR_ANALOG_BLANK_STRETCH)))
2586 {
2587 i++;
2588 if(i<num_traces_displayable)
2589 {
2590 v=bsearch_vector(bv, GLOBALS->tims.start - t->shift);
2591 if(i>=0) draw_vptr_trace(t_orig,v,i);
2592 t = tn;
2593 continue;
2594 }
2595 }
2596 break;
2597 }
2598 }
23302599 }
23312600 }
23322601 else
23472616 }
23482617 }
23492618
2350 draw_hptr_trace(NULL,NULL,i,0,kill_dodraw_grid);
2619 if(i>=0) draw_hptr_trace(NULL,NULL,i,0,kill_dodraw_grid);
23512620 }
23522621 t=GiveNextTrace(t);
2622 bot: 1;
23532623 }
23542624 }
23552625
30523322 }
30533323
30543324 wave_gdk_draw_line_flush(GLOBALS->wavepixmap_wavewindow_c_1);
3055
3056 GLOBALS->tims.start+=GLOBALS->shift_timebase;
3057 GLOBALS->tims.end+=GLOBALS->shift_timebase;
30583325 }
30593326
30603327 /*
31113378 }
31123379
31133380 draw_hptr_trace_vector_analog(t, h, which, ext);
3381 GLOBALS->tims.start+=GLOBALS->shift_timebase;
3382 GLOBALS->tims.end+=GLOBALS->shift_timebase;
31143383 return;
31153384 }
31163385
32263495 {
32273496 if(!(h->flags&HIST_STRING))
32283497 {
3229 ascii=convert_ascii_real((double *)h->v.h_vector);
3498 ascii=convert_ascii_real(t, (double *)h->v.h_vector);
32303499 }
32313500 else
32323501 {
32523521 ascii2 = srch_for_color + 1;
32533522 if(GLOBALS->gc_back_wavewindow_c_1 != GLOBALS->gc_white)
32543523 {
3255 gdk_draw_rectangle(GLOBALS->wavepixmap_wavewindow_c_1, cb, TRUE, _x0+1, _y1+1, width-1, (_y0-1) - (_y1+1) + 1);
3524 if(!GLOBALS->black_and_white) gdk_draw_rectangle(GLOBALS->wavepixmap_wavewindow_c_1, cb, TRUE, _x0+1, _y1+1, width-1, (_y0-1) - (_y1+1) + 1);
32563525 }
32573526 GLOBALS->fill_in_smaller_rgb_areas_wavewindow_c_1 = 1;
32583527 }
32893558 {
32903559 if(!(h->flags&HIST_STRING))
32913560 {
3292 ascii=convert_ascii_real((double *)h->v.h_vector);
3561 ascii=convert_ascii_real(t, (double *)h->v.h_vector);
32933562 }
32943563 else
32953564 {
33153584 ascii2 = srch_for_color + 1;
33163585 if(GLOBALS->gc_back_wavewindow_c_1 != GLOBALS->gc_white)
33173586 {
3318 gdk_draw_rectangle(GLOBALS->wavepixmap_wavewindow_c_1, cb, TRUE, _x0, _y1+1, width, (_y0-1) - (_y1+1) + 1);
3587 if(!GLOBALS->black_and_white) gdk_draw_rectangle(GLOBALS->wavepixmap_wavewindow_c_1, cb, TRUE, _x0, _y1+1, width, (_y0-1) - (_y1+1) + 1);
33193588 }
33203589 }
33213590 else
37464015 GLOBALS->tims.start-=GLOBALS->shift_timebase;
37474016 GLOBALS->tims.end-=GLOBALS->shift_timebase;
37484017
3749 h=v;
37504018 liney=((which+2)*GLOBALS->fontheight)-2;
37514019 _y1=((which+1)*GLOBALS->fontheight)+2;
37524020 _y0=liney-2;
37644032 gdk_draw_line(GLOBALS->wavepixmap_wavewindow_c_1, GLOBALS->gc_grid_wavewindow_c_1,(GLOBALS->tims.start<GLOBALS->tims.first)?(GLOBALS->tims.first-GLOBALS->tims.start)*GLOBALS->pxns:0, liney,(GLOBALS->tims.last<=GLOBALS->tims.end)?(GLOBALS->tims.last-GLOBALS->tims.start)*GLOBALS->pxns:GLOBALS->wavewidth-1, liney);
37654033 }
37664034 }
4035
4036 h = v;
4037 /*
4038 if(t->flags & TR_TTRANSLATED)
4039 {
4040 traverse_vector_nodes(t);
4041 h=v=bsearch_vector(t->n.vec, GLOBALS->tims.start);
4042 }
4043 else
4044 {
4045 h=v;
4046 }
4047 */
37674048
37684049 if(t->flags & TR_ANALOGMASK)
37694050 {
37844065 }
37854066
37864067 draw_vptr_trace_analog(t, v, which, ext);
4068
4069 GLOBALS->tims.start+=GLOBALS->shift_timebase;
4070 GLOBALS->tims.end+=GLOBALS->shift_timebase;
37874071 return;
37884072 }
37894073
39204204 if(cb)
39214205 {
39224206 ascii2 = srch_for_color + 1;
3923 gdk_draw_rectangle(GLOBALS->wavepixmap_wavewindow_c_1, cb, TRUE, _x0+1, _y1+1, width-1, (_y0-1) - (_y1+1) + 1);
4207 if(!GLOBALS->black_and_white) gdk_draw_rectangle(GLOBALS->wavepixmap_wavewindow_c_1, cb, TRUE, _x0+1, _y1+1, width-1, (_y0-1) - (_y1+1) + 1);
39244208 GLOBALS->fill_in_smaller_rgb_areas_wavewindow_c_1 = 1;
39254209 }
39264210 else
39694253 ascii2 = srch_for_color + 1;
39704254 if(GLOBALS->gc_back_wavewindow_c_1 != GLOBALS->gc_white)
39714255 {
3972 gdk_draw_rectangle(GLOBALS->wavepixmap_wavewindow_c_1, cb, TRUE, _x0, _y1+1, width, (_y0-1) - (_y1+1) + 1);
4256 if(!GLOBALS->black_and_white) gdk_draw_rectangle(GLOBALS->wavepixmap_wavewindow_c_1, cb, TRUE, _x0, _y1+1, width, (_y0-1) - (_y1+1) + 1);
39734257 }
39744258 }
39754259 else
40074291 }
40084292
40094293 /*
4010 * $Id: wavewindow.c,v 1.61 2010/03/14 07:09:49 gtkwave Exp $
4294 * $Id: wavewindow.c,v 1.71 2010/04/15 20:38:51 gtkwave Exp $
40114295 * $Log: wavewindow.c,v $
4296 * Revision 1.71 2010/04/15 20:38:51 gtkwave
4297 * color usage fixes for black and white mode
4298 *
4299 * Revision 1.70 2010/04/14 18:45:38 gtkwave
4300 * allow data values for secondary transaction traces
4301 *
4302 * Revision 1.69 2010/04/14 07:49:02 gtkwave
4303 * updated mouseover handling
4304 *
4305 * Revision 1.68 2010/04/14 04:21:46 gtkwave
4306 * update populateBuffer() usage
4307 *
4308 * Revision 1.67 2010/04/10 19:07:38 gtkwave
4309 * support for mouseover with extension traces
4310 *
4311 * Revision 1.66 2010/04/10 03:32:00 gtkwave
4312 * allow transaction traces to scroll off top of screen yet still be visible
4313 *
4314 * Revision 1.65 2010/04/09 20:52:33 gtkwave
4315 * add extension traces for extension transactions
4316 *
4317 * Revision 1.64 2010/04/01 03:10:58 gtkwave
4318 * time warp fixes
4319 *
4320 * Revision 1.63 2010/03/31 15:42:48 gtkwave
4321 * added preliminary transaction filter support
4322 *
4323 * Revision 1.62 2010/03/24 23:05:10 gtkwave
4324 * added RealToBits menu option
4325 *
40124326 * Revision 1.61 2010/03/14 07:09:49 gtkwave
40134327 * removed ExtNode and merged with Node
40144328 *