Merge branch 'upstream'
أحمد المحمودي (Ahmed El-Mahmoudy)
14 years ago
437 | 437 | combined vector. (Cut and paste typo from strace.c.) |
438 | 438 | Added support for DND from regex search window to the |
439 | 439 | signal/waveareas. |
440 | 3.1.11 18jun08 Compile fix for tla2vcd in MinGW. | |
441 | Added #ifdef for HAVE_BZERO for MinGW. | |
442 | Compiler warning fixes. | |
443 | Added time = -1 endcaps in LXT2+VZT+AET loaders. | |
444 | 3.1.12 14jul08 Compiler warning fixes. | |
445 | Fixed crash in vcd recoder for b vs 01xz mixups in | |
446 | malformed VCD files. | |
447 | Fixed abort on VCD load for malformed size vs | |
448 | [msi:lsi] syntax. NC does this on arrays of wires. | |
449 | Fix to vlist reader with --giga enabled in order to | |
450 | handle reads which go off the end of the file. | |
451 | (Possible due to how only the amount used in a block | |
452 | is actually written to the file in order to save | |
453 | space, so the vlist blocks can be overlapping yet | |
454 | usable.) | |
455 | 3.1.13 20aug08 Adding compressed hierarchy handling in order to | |
456 | reduce memory usage on large bitblasted models. | |
457 | This is currently only enabled for the VCD recoder, | |
458 | LXT, LXT2, and VZT loaders. | |
459 | Fixed some buffer overflows in vectorization code | |
460 | (and when vectorization is enabled) in vzt_read.c. | |
461 | Modification to autoconf handling for rpc.h. | |
462 | Fix for DnD to directly under an expanded comment | |
463 | trace. | |
464 | Make step_increment equal to 1/10 page_increment | |
465 | for the horizontal scroller in the wavewindow. | |
466 | Added sticky click semantics for clicks in signal | |
467 | window. To do this in the treesearch_gtk2 file | |
468 | will require some additional future work with | |
469 | view_selection_func() and/or signal handling and | |
470 | trapping. |
0 | 0 | ########################################################################## |
1 | 1 | |
2 | GTKWave 3.1.8 Wave Viewer is Copyright (C) 1999-2008 Tony Bybell. | |
2 | GTKWave 3.1.13 Wave Viewer is Copyright (C) 1999-2008 Tony Bybell. | |
3 | 3 | Portions of GTKWave are Copyright (C) 1999-2008 Udi Finkelstein. |
4 | 4 | Context support is Copyright (C) 2007-2008 Kermin Elliott Fleming. |
5 | 5 | GHW and additional GUI support is Copyright (C) 2005-2008 Tristan Gingold. |
118 | 118 | |
119 | 119 | /* Define to 1 if you have the `re_comp' function. */ |
120 | 120 | #undef HAVE_RE_COMP |
121 | ||
122 | /* Define to 1 if you have the <rpc/types.h> header file. */ | |
123 | #undef HAVE_RPC_TYPES_H | |
121 | 124 | |
122 | 125 | /* Define to 1 if you have the <rpc/xdr.h> header file. */ |
123 | 126 | #undef HAVE_RPC_XDR_H |
5559 | 5559 | |
5560 | 5560 | |
5561 | 5561 | |
5562 | ||
5563 | for ac_header in fcntl.h inttypes.h libintl.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h strings.h sys/time.h unistd.h wchar.h wctype.h rpc/xdr.h getopt.h | |
5562 | for ac_header in fcntl.h inttypes.h libintl.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h strings.h sys/time.h unistd.h wchar.h wctype.h getopt.h | |
5564 | 5563 | do |
5565 | 5564 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` |
5566 | 5565 | if eval "test \"\${$as_ac_Header+set}\" = set"; then |
5708 | 5707 | fi |
5709 | 5708 | |
5710 | 5709 | done |
5710 | ||
5711 | ||
5712 | # rpc workaround for cygwin | |
5713 | ||
5714 | ||
5715 | for ac_header in rpc/types.h rpc/xdr.h | |
5716 | do | |
5717 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` | |
5718 | echo "$as_me:$LINENO: checking for $ac_header" >&5 | |
5719 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 | |
5720 | if eval "test \"\${$as_ac_Header+set}\" = set"; then | |
5721 | echo $ECHO_N "(cached) $ECHO_C" >&6 | |
5722 | else | |
5723 | cat >conftest.$ac_ext <<_ACEOF | |
5724 | /* confdefs.h. */ | |
5725 | _ACEOF | |
5726 | cat confdefs.h >>conftest.$ac_ext | |
5727 | cat >>conftest.$ac_ext <<_ACEOF | |
5728 | /* end confdefs.h. */ | |
5729 | #ifdef HAVE_RPC_TYPES_H | |
5730 | # include <rpc/types.h> | |
5731 | #endif | |
5732 | ||
5733 | ||
5734 | #include <$ac_header> | |
5735 | _ACEOF | |
5736 | rm -f conftest.$ac_objext | |
5737 | if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 | |
5738 | (eval $ac_compile) 2>conftest.er1 | |
5739 | ac_status=$? | |
5740 | grep -v '^ *+' conftest.er1 >conftest.err | |
5741 | rm -f conftest.er1 | |
5742 | cat conftest.err >&5 | |
5743 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
5744 | (exit $ac_status); } && | |
5745 | { ac_try='test -z "$ac_c_werror_flag" | |
5746 | || test ! -s conftest.err' | |
5747 | { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 | |
5748 | (eval $ac_try) 2>&5 | |
5749 | ac_status=$? | |
5750 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
5751 | (exit $ac_status); }; } && | |
5752 | { ac_try='test -s conftest.$ac_objext' | |
5753 | { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 | |
5754 | (eval $ac_try) 2>&5 | |
5755 | ac_status=$? | |
5756 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
5757 | (exit $ac_status); }; }; then | |
5758 | eval "$as_ac_Header=yes" | |
5759 | else | |
5760 | echo "$as_me: failed program was:" >&5 | |
5761 | sed 's/^/| /' conftest.$ac_ext >&5 | |
5762 | ||
5763 | eval "$as_ac_Header=no" | |
5764 | fi | |
5765 | rm -f conftest.err conftest.$ac_objext conftest.$ac_ext | |
5766 | fi | |
5767 | echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 | |
5768 | echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 | |
5769 | if test `eval echo '${'$as_ac_Header'}'` = yes; then | |
5770 | cat >>confdefs.h <<_ACEOF | |
5771 | #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 | |
5772 | _ACEOF | |
5773 | ||
5774 | fi | |
5775 | ||
5776 | done | |
5777 | ||
5711 | 5778 | |
5712 | 5779 | |
5713 | 5780 | # Checks for typedefs, structures, and compiler characteristics. |
234 | 234 | AC_HEADER_DIRENT |
235 | 235 | AC_HEADER_STDC |
236 | 236 | AC_HEADER_SYS_WAIT |
237 | AC_CHECK_HEADERS([fcntl.h inttypes.h libintl.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h strings.h sys/time.h unistd.h wchar.h wctype.h rpc/xdr.h getopt.h]) | |
237 | AC_CHECK_HEADERS([fcntl.h inttypes.h libintl.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h strings.h sys/time.h unistd.h wchar.h wctype.h getopt.h]) | |
238 | ||
239 | # rpc workaround for cygwin | |
240 | AC_CHECK_HEADERS([rpc/types.h rpc/xdr.h], [], [], | |
241 | [[#ifdef HAVE_RPC_TYPES_H | |
242 | # include <rpc/types.h> | |
243 | #endif | |
244 | ]]) | |
245 | ||
238 | 246 | |
239 | 247 | # Checks for typedefs, structures, and compiler characteristics. |
240 | 248 | AC_C_CONST |
641 | 641 | GtkWidget *ctext; |
642 | 642 | GtkWidget *text; |
643 | 643 | FILE *handle; |
644 | int lx; | |
645 | int lx_module_line = 0; | |
646 | int lx_module_line_locked = 0; | |
647 | int lx_endmodule_line_locked = 0; | |
648 | ||
649 | struct wave_logfile_lines_t *wlog_head=NULL, *wlog_curr=NULL; | |
650 | int wlog_size = 0; | |
651 | int line_no; | |
652 | int s_line_find = -1, e_line_find = -1; | |
653 | 644 | struct logfile_context_t *ctx; |
654 | struct text_find_t *text_curr; | |
655 | ||
656 | 645 | char *default_text = t->filename; |
657 | char *design_unit = t->item; | |
658 | int s_line = t->s_line; | |
659 | int e_line = t->e_line; | |
660 | 646 | |
661 | 647 | handle = fopen(default_text, "rb"); |
662 | 648 | if(!handle) |
1467 | 1453 | } |
1468 | 1454 | |
1469 | 1455 | /* |
1470 | * $Id: logfile.c,v 1.4 2008/02/05 07:20:24 gtkwave Exp $ | |
1456 | * $Id: logfile.c,v 1.5 2008/06/11 08:01:40 gtkwave Exp $ | |
1471 | 1457 | * $Log: logfile.c,v $ |
1458 | * Revision 1.5 2008/06/11 08:01:40 gtkwave | |
1459 | * gcc 4.3.x compiler warning fixes | |
1460 | * | |
1472 | 1461 | * Revision 1.4 2008/02/05 07:20:24 gtkwave |
1473 | 1462 | * added realtime rtlbrowse updates (follows marker at 100ms intervals) |
1474 | 1463 | * |
0 | .TH "GTKWAVE" "1" "3.1.5" "Anthony Bybell" "Simulation Wave Viewer" | |
0 | .TH "GTKWAVE" "1" "3.1.13" "Anthony Bybell" "Simulation Wave Viewer" | |
1 | 1 | .SH "NAME" |
2 | 2 | .LP |
3 | 3 | gtkwave \- Visualization tool for VCD, LXT, and VZT files |
96 | 96 | specifies that the viewer should use gigabyte mempacking when recoding (possibly slower). This is equivalent to setting |
97 | 97 | the vlist_spill and vlist_prepack flags in the rc file. |
98 | 98 | .TP |
99 | \fB\-C\fR,\fB\-\-comphier\fR | |
100 | specifies that the viewer should use compressed hierarchy names when loading the dumpfile (available for VCD recoder, LXT, LXT2, and VZT). | |
101 | This will use less memory at the expense of compression/decompression delay. | |
102 | .TP | |
99 | 103 | \fB\-v\fR,\fB\-\-vcd\fR |
100 | 104 | Use stdin as a VCD dumpfile. |
101 | 105 | .TP |
20 | 20 | debug.c debug.h discardbuttons.c edgebuttons.c \ |
21 | 21 | entry.c fetchbuttons.c fgetdynamic.c fgetdynamic.h file.c fonts.c fonts.h getopt.c \ |
22 | 22 | getopt1.c ghw.c ghw.h ghwlib.c ghwlib.h gnu-getopt.h gnu_regex.h gtk12compat.h \ |
23 | help.c helpers/lxt2_read.c \ | |
23 | hierpack.c hierpack.h jrb.c jrb.h help.c helpers/lxt2_read.c \ | |
24 | 24 | helpers/lxt_write.c helpers/vzt_read.c hiersearch.c interp.c \ |
25 | 25 | logfile.c lx2.c lx2.h lxt.c lxt.h main.c main.h markerbox.c menu.c menu.h mouseover.c \ |
26 | 26 | pagebuttons.c pipeio.c pipeio.h pixmaps.c pixmaps.h print.c print.h \ |
53 | 53 | discardbuttons.$(OBJEXT) edgebuttons.$(OBJEXT) entry.$(OBJEXT) \ |
54 | 54 | fetchbuttons.$(OBJEXT) fgetdynamic.$(OBJEXT) file.$(OBJEXT) \ |
55 | 55 | fonts.$(OBJEXT) getopt.$(OBJEXT) getopt1.$(OBJEXT) \ |
56 | ghw.$(OBJEXT) ghwlib.$(OBJEXT) help.$(OBJEXT) \ | |
57 | lxt2_read.$(OBJEXT) lxt_write.$(OBJEXT) vzt_read.$(OBJEXT) \ | |
58 | hiersearch.$(OBJEXT) interp.$(OBJEXT) logfile.$(OBJEXT) \ | |
59 | lx2.$(OBJEXT) lxt.$(OBJEXT) main.$(OBJEXT) markerbox.$(OBJEXT) \ | |
60 | menu.$(OBJEXT) mouseover.$(OBJEXT) pagebuttons.$(OBJEXT) \ | |
61 | pipeio.$(OBJEXT) pixmaps.$(OBJEXT) print.$(OBJEXT) \ | |
62 | ptranslate.$(OBJEXT) rc.$(OBJEXT) regex.$(OBJEXT) \ | |
63 | renderopt.$(OBJEXT) rgb.$(OBJEXT) search.$(OBJEXT) \ | |
64 | shiftbuttons.$(OBJEXT) showchange.$(OBJEXT) \ | |
56 | ghw.$(OBJEXT) ghwlib.$(OBJEXT) hierpack.$(OBJEXT) \ | |
57 | jrb.$(OBJEXT) help.$(OBJEXT) lxt2_read.$(OBJEXT) \ | |
58 | lxt_write.$(OBJEXT) vzt_read.$(OBJEXT) hiersearch.$(OBJEXT) \ | |
59 | interp.$(OBJEXT) logfile.$(OBJEXT) lx2.$(OBJEXT) lxt.$(OBJEXT) \ | |
60 | main.$(OBJEXT) markerbox.$(OBJEXT) menu.$(OBJEXT) \ | |
61 | mouseover.$(OBJEXT) pagebuttons.$(OBJEXT) pipeio.$(OBJEXT) \ | |
62 | pixmaps.$(OBJEXT) print.$(OBJEXT) ptranslate.$(OBJEXT) \ | |
63 | rc.$(OBJEXT) regex.$(OBJEXT) renderopt.$(OBJEXT) rgb.$(OBJEXT) \ | |
64 | search.$(OBJEXT) shiftbuttons.$(OBJEXT) showchange.$(OBJEXT) \ | |
65 | 65 | signalwindow.$(OBJEXT) simplereq.$(OBJEXT) splash.$(OBJEXT) \ |
66 | 66 | status.$(OBJEXT) strace.$(OBJEXT) symbol.$(OBJEXT) \ |
67 | 67 | timeentry.$(OBJEXT) translate.$(OBJEXT) tree.$(OBJEXT) \ |
201 | 201 | debug.c debug.h discardbuttons.c edgebuttons.c \ |
202 | 202 | entry.c fetchbuttons.c fgetdynamic.c fgetdynamic.h file.c fonts.c fonts.h getopt.c \ |
203 | 203 | getopt1.c ghw.c ghw.h ghwlib.c ghwlib.h gnu-getopt.h gnu_regex.h gtk12compat.h \ |
204 | help.c helpers/lxt2_read.c \ | |
204 | hierpack.c hierpack.h jrb.c jrb.h help.c helpers/lxt2_read.c \ | |
205 | 205 | helpers/lxt_write.c helpers/vzt_read.c hiersearch.c interp.c \ |
206 | 206 | logfile.c lx2.c lx2.h lxt.c lxt.h main.c main.h markerbox.c menu.c menu.h mouseover.c \ |
207 | 207 | pagebuttons.c pipeio.c pipeio.h pixmaps.c pixmaps.h print.c print.h \ |
313 | 313 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ghwlib.Po@am__quote@ |
314 | 314 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globals.Po@am__quote@ |
315 | 315 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@ |
316 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hierpack.Po@am__quote@ | |
316 | 317 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hiersearch.Po@am__quote@ |
317 | 318 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interp.Po@am__quote@ |
319 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jrb.Po@am__quote@ | |
318 | 320 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logfile.Po@am__quote@ |
319 | 321 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lx2.Po@am__quote@ |
320 | 322 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxt.Po@am__quote@ |
1030 | 1030 | if((1)||(f->row <= 1)) /* sorry, arrays not supported yet in the viewer */ |
1031 | 1031 | { |
1032 | 1032 | fprintf(stderr, "Import: %s\n", np->nname); |
1033 | if(nr<1) nr=1; | |
1034 | if(!GLOBALS->ae2_lx2_table[txidx]) | |
1035 | { | |
1036 | GLOBALS->ae2_lx2_table[txidx] = calloc_2(nr, sizeof(struct lx2_entry)); | |
1037 | for(r=0;r<nr;r++) | |
1038 | { | |
1039 | GLOBALS->ae2_lx2_table[txidx][r].np = &np[r]; | |
1040 | } | |
1041 | } | |
1033 | 1042 | |
1034 | 1043 | aet2_rd_set_fac_process_mask(txidx); |
1035 | 1044 | ae2_iterator(GLOBALS->ae2_start_limit_cyc, GLOBALS->ae2_end_limit_cyc); |
1041 | 1050 | } |
1042 | 1051 | |
1043 | 1052 | |
1044 | if(nr<1) nr=1; | |
1045 | 1053 | for(r = 0; r < nr; r++) |
1046 | 1054 | { |
1055 | ||
1047 | 1056 | histent_tail = htemp = histent_calloc(); |
1048 | 1057 | if(len>1) |
1049 | 1058 | { |
1084 | 1093 | { |
1085 | 1094 | np[r].head.v.h_val = AN_X; /* x */ |
1086 | 1095 | } |
1096 | ||
1097 | ||
1098 | { | |
1099 | struct HistEnt *htemp2 = calloc_2(1, sizeof(struct HistEnt)); | |
1100 | htemp2->time = -1; | |
1101 | if(len>1) | |
1102 | { | |
1103 | htemp2->v.h_vector = htemp->v.h_vector; | |
1104 | } | |
1105 | else | |
1106 | { | |
1107 | htemp2->v.h_val = htemp->v.h_val; | |
1108 | } | |
1109 | htemp2->next = htemp; | |
1110 | htemp = htemp2; | |
1111 | GLOBALS->ae2_lx2_table[txidx][r].numtrans++; | |
1112 | } | |
1087 | 1113 | |
1088 | 1114 | np[r].head.time = -2; |
1089 | 1115 | np[r].head.next = htemp; |
1193 | 1219 | htemp = GLOBALS->ae2_lx2_table[txidx][r].histent_head; |
1194 | 1220 | } |
1195 | 1221 | |
1222 | ||
1223 | { | |
1224 | struct HistEnt *htemp2 = calloc_2(1, sizeof(struct HistEnt)); | |
1225 | htemp2->time = -1; | |
1226 | if(len>1) | |
1227 | { | |
1228 | htemp2->v.h_vector = htemp->v.h_vector; | |
1229 | } | |
1230 | else | |
1231 | { | |
1232 | htemp2->v.h_val = htemp->v.h_val; | |
1233 | } | |
1234 | htemp2->next = htemp; | |
1235 | htemp = htemp2; | |
1236 | GLOBALS->ae2_lx2_table[txidx][r].numtrans++; | |
1237 | } | |
1238 | ||
1196 | 1239 | if(len>1) |
1197 | 1240 | { |
1198 | 1241 | np->head.v.h_vector = (char *)malloc_2(len); |
1221 | 1264 | /* ...of AET2_IS_PRESENT */ |
1222 | 1265 | |
1223 | 1266 | /* |
1224 | * $Id: ae2.c,v 1.6 2008/02/19 22:00:28 gtkwave Exp $ | |
1267 | * $Id: ae2.c,v 1.7 2008/06/17 18:03:45 gtkwave Exp $ | |
1225 | 1268 | * $Log: ae2.c,v $ |
1269 | * Revision 1.7 2008/06/17 18:03:45 gtkwave | |
1270 | * added time = -1 endcaps | |
1271 | * | |
1226 | 1272 | * Revision 1.6 2008/02/19 22:00:28 gtkwave |
1227 | 1273 | * added aetinfo support |
1228 | 1274 | * |
23 | 23 | #include "strace.h" |
24 | 24 | #include "translate.h" |
25 | 25 | #include "ptranslate.h" |
26 | #include "hierpack.h" | |
26 | 27 | |
27 | 28 | #ifdef _MSC_VER |
28 | 29 | #define strcasecmp _stricmp |
305 | 306 | { |
306 | 307 | if(!GLOBALS->hier_max_level) |
307 | 308 | { |
308 | t->name = nd->nname; | |
309 | int flagged; | |
310 | ||
311 | t->name = hier_decompress_flagged(nd->nname, &flagged); | |
312 | t->is_depacked = (flagged != 0); | |
309 | 313 | } |
310 | 314 | else |
311 | 315 | { |
312 | t->name = hier_extract(nd->nname, GLOBALS->hier_max_level); | |
316 | int flagged; | |
317 | char *tbuff = hier_decompress_flagged(nd->nname, &flagged); | |
318 | if(!flagged) | |
319 | { | |
320 | t->name = hier_extract(nd->nname, GLOBALS->hier_max_level); | |
321 | } | |
322 | else | |
323 | { | |
324 | t->name = strdup_2(hier_extract(tbuff, GLOBALS->hier_max_level)); | |
325 | free_2(tbuff); | |
326 | t->is_depacked = 1; | |
327 | } | |
313 | 328 | } |
314 | 329 | } |
315 | 330 | |
454 | 469 | } |
455 | 470 | |
456 | 471 | if(t->asciivalue) free_2(t->asciivalue); |
457 | if((t->is_alias)&&(t->name)) free_2(t->name); | |
472 | if(((t->is_alias)||(t->is_depacked))&&(t->name)) free_2(t->name); | |
458 | 473 | |
459 | 474 | free_2( t ); |
460 | 475 | } |
636 | 651 | { |
637 | 652 | if(t->flags&TR_HIGHLIGHT) |
638 | 653 | { |
639 | if((t->flags & (TR_BLANK|TR_COLLAPSED)) && (t->name)) | |
654 | if(((t->flags & TR_ISCOLLAPSED)==(TR_ISCOLLAPSED)) && (t->name)) | |
640 | 655 | { |
641 | 656 | tinsert=t; |
642 | 657 | t=t->t_next; |
687 | 702 | */ |
688 | 703 | Trptr PrependBuffer(void) |
689 | 704 | { |
690 | Trptr t, prev; | |
705 | Trptr t, prev = NULL; | |
691 | 706 | |
692 | 707 | if(!GLOBALS->traces.buffer) return(NULL); |
693 | 708 | |
1087 | 1102 | } |
1088 | 1103 | |
1089 | 1104 | /* |
1090 | * $Id: analyzer.c,v 1.3 2008/01/02 18:17:26 gtkwave Exp $ | |
1105 | * $Id: analyzer.c,v 1.6 2008/08/05 17:49:39 gtkwave Exp $ | |
1091 | 1106 | * $Log: analyzer.c,v $ |
1107 | * Revision 1.6 2008/08/05 17:49:39 gtkwave | |
1108 | * comment trace dnd fix | |
1109 | * | |
1110 | * Revision 1.5 2008/07/18 17:27:00 gtkwave | |
1111 | * adding hierpack code | |
1112 | * | |
1113 | * Revision 1.4 2008/06/11 08:01:40 gtkwave | |
1114 | * gcc 4.3.x compiler warning fixes | |
1115 | * | |
1092 | 1116 | * Revision 1.3 2008/01/02 18:17:26 gtkwave |
1093 | 1117 | * added standard click semantics with user_standard_clicking rc variable |
1094 | 1118 | * |
232 | 232 | double d_minval, d_maxval; /* cached value for when auto scaling is turned off */ |
233 | 233 | |
234 | 234 | unsigned is_alias : 1; /* set when it's an alias (safe to free t->name then) */ |
235 | unsigned is_depacked : 1; /* set when it's been depacked from a compressed entry (safe to free t->name then) */ | |
235 | 236 | unsigned vector : 1; /* 1 if bit vector, 0 if node */ |
236 | 237 | unsigned shift_drag_valid : 1; /* qualifies shift_drag above */ |
237 | 238 | unsigned interactive_vector_needs_regeneration : 1; /* for interactive VCDs */ |
327 | 328 | #endif |
328 | 329 | |
329 | 330 | /* |
330 | * $Id: analyzer.h,v 1.7 2008/03/25 03:22:05 gtkwave Exp $ | |
331 | * $Id: analyzer.h,v 1.8 2008/07/18 17:27:00 gtkwave Exp $ | |
331 | 332 | * $Log: analyzer.h,v $ |
333 | * Revision 1.8 2008/07/18 17:27:00 gtkwave | |
334 | * adding hierpack code | |
335 | * | |
332 | 336 | * Revision 1.7 2008/03/25 03:22:05 gtkwave |
333 | 337 | * expanded zero fill to include also a one fill (for pre-inverted nets) |
334 | 338 | * |
90 | 90 | pnt[i]=whichfill; |
91 | 91 | } |
92 | 92 | |
93 | bits = pnt; | |
93 | bits = (unsigned char *)pnt; | |
94 | 94 | nbits = msi + 1; |
95 | 95 | } |
96 | 96 | } |
107 | 107 | |
108 | 108 | memcpy(pnt+i, bits, nbits); |
109 | 109 | |
110 | bits = pnt; | |
110 | bits = (unsigned char *)pnt; | |
111 | 111 | nbits = lsi + 1; |
112 | 112 | } |
113 | 113 | } |
1525 | 1525 | } |
1526 | 1526 | |
1527 | 1527 | /* |
1528 | * $Id: baseconvert.c,v 1.7 2008/03/25 03:22:06 gtkwave Exp $ | |
1528 | * $Id: baseconvert.c,v 1.8 2008/06/11 08:01:42 gtkwave Exp $ | |
1529 | 1529 | * $Log: baseconvert.c,v $ |
1530 | * Revision 1.8 2008/06/11 08:01:42 gtkwave | |
1531 | * gcc 4.3.x compiler warning fixes | |
1532 | * | |
1530 | 1533 | * Revision 1.7 2008/03/25 03:22:06 gtkwave |
1531 | 1534 | * expanded zero fill to include also a one fill (for pre-inverted nets) |
1532 | 1535 | * |
27 | 27 | #include "main.h" |
28 | 28 | #include "menu.h" |
29 | 29 | #include "busy.h" |
30 | #include "hierpack.h" | |
30 | 31 | #include <stdlib.h> |
31 | 32 | |
32 | 33 | /* |
33 | 34 | * attempt to match top vs bottom rather than emit <Vector> |
34 | 35 | */ |
35 | char *attempt_vecmatch(char *s1, char *s2) | |
36 | char *attempt_vecmatch_2(char *s1, char *s2) | |
36 | 37 | { |
37 | 38 | char *s; |
38 | 39 | char *p1, *p2; |
46 | 47 | int totlen; |
47 | 48 | int idx; |
48 | 49 | |
49 | if((!s1)||(!*s1)||(!s2)||(!*s2)) return(NULL); | |
50 | ||
51 | 50 | if(!strcmp(s1, s2)) { s = malloc_2(strlen(s1)+1); strcpy(s, s1); return(s); } |
52 | 51 | |
53 | 52 | p1 = s1; p2 = s2; |
146 | 145 | s = malloc_2(totlen); |
147 | 146 | memcpy(s, s1, pfxlen); |
148 | 147 | idx = pfxlen; |
149 | s[idx] = '['; | |
150 | idx++; | |
148 | if(!(pfxlen && (s1[pfxlen-1]=='['))) | |
149 | { | |
150 | s[idx] = '['; | |
151 | idx++; | |
152 | } | |
151 | 153 | memcpy(s+idx, n1, n1len); |
152 | 154 | idx += n1len; |
153 | 155 | s[idx] = ':'; |
154 | 156 | idx++; |
155 | 157 | memcpy(s+idx, n2, n2len); |
156 | 158 | idx += n2len; |
157 | s[idx] = ']'; | |
158 | idx++; | |
159 | if(*sfx != ']') | |
160 | { | |
161 | s[idx] = ']'; | |
162 | idx++; | |
163 | } | |
159 | 164 | if(sfxlen) { memcpy(s+idx, sfx, sfxlen); idx+=sfxlen; } |
160 | 165 | s[idx] = 0; |
161 | 166 | |
162 | 167 | return(s); |
168 | } | |
169 | ||
170 | ||
171 | char *attempt_vecmatch(char *s1, char *s2) | |
172 | { | |
173 | char *pnt; | |
174 | ||
175 | if((!s1)||(!*s1)||(!s2)||(!*s2)) | |
176 | { | |
177 | return(NULL); | |
178 | } | |
179 | else | |
180 | { | |
181 | int ns1_was_decompressed; | |
182 | char *ns1 = hier_decompress_flagged(s1, &ns1_was_decompressed); | |
183 | int ns2_was_decompressed; | |
184 | char *ns2 = hier_decompress_flagged(s2, &ns2_was_decompressed); | |
185 | ||
186 | pnt = attempt_vecmatch_2(ns1, ns2); | |
187 | ||
188 | if(ns1_was_decompressed) free_2(ns1); | |
189 | if(ns2_was_decompressed) free_2(ns2); | |
190 | ||
191 | return(pnt); | |
192 | } | |
163 | 193 | } |
164 | 194 | |
165 | 195 | |
1437 | 1467 | char hier_delimeter2; |
1438 | 1468 | char *name=NULL; |
1439 | 1469 | char *s1, *s2; |
1470 | int s1_was_packed, s2_was_packed; | |
1440 | 1471 | int root1len=0, root2len=0; |
1441 | 1472 | int l1, l2; |
1442 | 1473 | |
1469 | 1500 | } |
1470 | 1501 | |
1471 | 1502 | |
1472 | s1=symhi->n->nname; | |
1473 | s2=symlo->n->nname; | |
1503 | s1=hier_decompress_flagged(symhi->n->nname, &s1_was_packed); | |
1504 | s2=hier_decompress_flagged(symlo->n->nname, &s2_was_packed); | |
1474 | 1505 | |
1475 | 1506 | l1=strlen(s1); |
1476 | 1507 | |
1568 | 1599 | } |
1569 | 1600 | } |
1570 | 1601 | } |
1602 | ||
1603 | if(s1_was_packed) { free_2(s1); } | |
1604 | if(s2_was_packed) { free_2(s2); } | |
1571 | 1605 | |
1572 | 1606 | return(name); |
1573 | 1607 | } |
2824 | 2858 | /****************/ |
2825 | 2859 | |
2826 | 2860 | /* |
2827 | * $Id: bitvec.c,v 1.4 2007/09/23 18:33:53 gtkwave Exp $ | |
2861 | * $Id: bitvec.c,v 1.6 2008/07/18 19:54:56 gtkwave Exp $ | |
2828 | 2862 | * $Log: bitvec.c,v $ |
2863 | * Revision 1.6 2008/07/18 19:54:56 gtkwave | |
2864 | * hierpack and vecmatch fixes with removal of extra brackets | |
2865 | * | |
2866 | * Revision 1.5 2008/07/18 19:37:00 gtkwave | |
2867 | * hierpack fix for makename | |
2868 | * | |
2829 | 2869 | * Revision 1.4 2007/09/23 18:33:53 gtkwave |
2830 | 2870 | * warnings cleanups from sun compile |
2831 | 2871 | * |
13 | 13 | #include "symbol.h" |
14 | 14 | #include "bsearch.h" |
15 | 15 | #include "strace.h" |
16 | #include "hierpack.h" | |
16 | 17 | #include <ctype.h> |
17 | ||
18 | 18 | |
19 | 19 | static int compar_timechain(const void *s1, const void *s2) |
20 | 20 | { |
212 | 212 | |
213 | 213 | s2=*((struct symbol **)v2); |
214 | 214 | rc=sigcmp((char *)key,s2->name); |
215 | ||
215 | 216 | return(rc); |
216 | 217 | } |
217 | 218 | |
219 | 220 | { |
220 | 221 | struct symbol **rc; |
221 | 222 | int len; |
223 | int was_packed = 0; | |
222 | 224 | |
223 | 225 | if ((!ascii)||(!(len=strlen(ascii)))) return(NULL); |
224 | 226 | if(rows_return) |
225 | 227 | { |
226 | 228 | *rows_return = 0; |
229 | } | |
230 | ||
231 | if(GLOBALS->hier_pfx) | |
232 | { | |
233 | ascii = hier_compress(ascii, HIERPACK_DO_NOT_ADD, &was_packed); | |
234 | len = strlen(ascii); | |
227 | 235 | } |
228 | 236 | |
229 | 237 | if(ascii[len-1]=='}') |
246 | 254 | |
247 | 255 | if(whichrow <= (*rc)->n->array_height) |
248 | 256 | { |
257 | if(was_packed) { free_2(ascii); } | |
249 | 258 | return(*rc); |
250 | 259 | } |
251 | 260 | } |
256 | 265 | } |
257 | 266 | |
258 | 267 | rc=(struct symbol **)bsearch(ascii, GLOBALS->facs, GLOBALS->numfacs, sizeof(struct symbol *), compar_facs); |
268 | if(was_packed) { free_2(ascii); } | |
259 | 269 | if(rc) return(*rc); else return(NULL); |
260 | 270 | } |
261 | 271 | |
262 | 272 | /* |
263 | * $Id: bsearch.c,v 1.5 2008/02/19 22:56:11 gtkwave Exp $ | |
273 | * $Id: bsearch.c,v 1.6 2008/07/18 17:27:00 gtkwave Exp $ | |
264 | 274 | * $Log: bsearch.c,v $ |
275 | * Revision 1.6 2008/07/18 17:27:00 gtkwave | |
276 | * adding hierpack code | |
277 | * | |
265 | 278 | * Revision 1.5 2008/02/19 22:56:11 gtkwave |
266 | 279 | * rtlbrowse update to handle aet time substitutions |
267 | 280 | * |
19 | 19 | #include "regex_wave.h" |
20 | 20 | #include "translate.h" |
21 | 21 | |
22 | #define WAVE_VERSION_INFO "GTKWave Analyzer v3.1.10 (w)1999-2008 BSI" | |
22 | #define WAVE_VERSION_INFO "GTKWave Analyzer v3.1.13 (w)1999-2008 BSI" | |
23 | 23 | |
24 | 24 | #define WAVE_INF_SCALING (0.5) |
25 | 25 | |
167 | 167 | #endif |
168 | 168 | |
169 | 169 | /* |
170 | * $Id: currenttime.h,v 1.38 2008/05/14 21:08:19 gtkwave Exp $ | |
170 | * $Id: currenttime.h,v 1.45 2008/08/21 03:48:45 gtkwave Exp $ | |
171 | 171 | * $Log: currenttime.h,v $ |
172 | * Revision 1.45 2008/08/21 03:48:45 gtkwave | |
173 | * promote to 3.1.13 | |
174 | * | |
175 | * Revision 1.44 2008/07/20 01:29:36 gtkwave | |
176 | * added command line option --comphier | |
177 | * | |
178 | * Revision 1.43 2008/07/14 22:39:22 gtkwave | |
179 | * promote to 3.1.12 | |
180 | * | |
181 | * Revision 1.42 2008/07/12 22:54:12 gtkwave | |
182 | * array of wires malformed vcd dump load abort fixed | |
183 | * | |
184 | * Revision 1.41 2008/07/01 18:51:06 gtkwave | |
185 | * compiler warning fixes for amd64 | |
186 | * | |
187 | * Revision 1.40 2008/06/18 19:56:07 gtkwave | |
188 | * 3.0.11 release building | |
189 | * | |
190 | * Revision 1.39 2008/06/11 08:01:47 gtkwave | |
191 | * gcc 4.3.x compiler warning fixes | |
192 | * | |
172 | 193 | * Revision 1.38 2008/05/14 21:08:19 gtkwave |
173 | 194 | * revision bump to 3.1.10 |
174 | 195 | * |
13 | 13 | #include <stdlib.h> |
14 | 14 | #include <stdio.h> |
15 | 15 | #include <string.h> |
16 | ||
17 | #ifndef _MSC_VER | |
18 | #ifndef __MINGW32__ | |
19 | #include <stdint.h> | |
20 | #endif | |
21 | #endif | |
16 | 22 | |
17 | 23 | #define WAVE_MAX_CLIST_LENGTH 15000 |
18 | 24 | |
30 | 36 | * types... |
31 | 37 | */ |
32 | 38 | #ifdef G_HAVE_GINT64 |
33 | typedef long long int TimeType; | |
34 | typedef unsigned long long int UTimeType; | |
35 | ||
36 | /* typedef gint64 TimeType; */ | |
37 | /* typedef guint64 UTimeType; */ | |
39 | /* typedef long long int TimeType; */ | |
40 | /* typedef unsigned long long int UTimeType; */ | |
41 | ||
42 | typedef gint64 TimeType; | |
43 | typedef guint64 UTimeType; | |
38 | 44 | |
39 | 45 | #ifndef _MSC_VER |
40 | 46 | #define LLDescriptor(x) x##LL |
43 | 49 | #define TTFormat "%I64d" |
44 | 50 | #define UTTFormat "%I64u" |
45 | 51 | #else |
46 | #define TTFormat "%lld" | |
47 | #define UTTFormat "%llu" | |
52 | #if __WORDSIZE == 64 | |
53 | #define TTFormat "%ld" | |
54 | #define UTTFormat "%lu" | |
55 | #else | |
56 | #define TTFormat "%lld" | |
57 | #define UTTFormat "%llu" | |
58 | #endif | |
48 | 59 | #endif |
49 | 60 | #else |
50 | 61 | #define LLDescriptor(x) x##i64 |
179 | 190 | #endif |
180 | 191 | |
181 | 192 | /* |
182 | * $Id: debug.h,v 1.3 2007/08/26 21:35:40 gtkwave Exp $ | |
193 | * $Id: debug.h,v 1.4 2008/07/01 18:51:06 gtkwave Exp $ | |
183 | 194 | * $Log: debug.h,v $ |
195 | * Revision 1.4 2008/07/01 18:51:06 gtkwave | |
196 | * compiler warning fixes for amd64 | |
197 | * | |
184 | 198 | * Revision 1.3 2007/08/26 21:35:40 gtkwave |
185 | 199 | * integrated global context management from SystemOfCode2007 branch |
186 | 200 | * |
478 | 478 | void |
479 | 479 | service_left_edge(GtkWidget *text, gpointer data) |
480 | 480 | { |
481 | GtkAdjustment *hadj; | |
482 | gfloat inc; | |
483 | TimeType ntinc; | |
484 | ||
485 | 481 | if(GLOBALS->helpbox_is_active) |
486 | 482 | { |
487 | 483 | help_text_bold("\n\nFind Next Edge Left"); |
500 | 496 | void |
501 | 497 | service_right_edge(GtkWidget *text, gpointer data) |
502 | 498 | { |
503 | GtkAdjustment *hadj; | |
504 | gfloat inc; | |
505 | TimeType ntinc, pageinc; | |
506 | ||
507 | 499 | if(GLOBALS->helpbox_is_active) |
508 | 500 | { |
509 | 501 | help_text_bold("\n\nFind Next Edge Right"); |
580 | 572 | } |
581 | 573 | |
582 | 574 | /* |
583 | * $Id: edgebuttons.c,v 1.5 2008/05/01 02:53:37 gtkwave Exp $ | |
575 | * $Id: edgebuttons.c,v 1.6 2008/06/11 08:01:48 gtkwave Exp $ | |
584 | 576 | * $Log: edgebuttons.c,v $ |
577 | * Revision 1.6 2008/06/11 08:01:48 gtkwave | |
578 | * gcc 4.3.x compiler warning fixes | |
579 | * | |
585 | 580 | * Revision 1.5 2008/05/01 02:53:37 gtkwave |
586 | 581 | * edgebutton fix (went back two edges on a concat vector instead of one) |
587 | 582 | * |
167 | 167 | (struct font_engine_font_t *font, |
168 | 168 | const gchar *string) |
169 | 169 | { |
170 | gint rc; | |
170 | gint rc = 1; /* dummy value */ | |
171 | 171 | |
172 | 172 | if(!font->is_pango) |
173 | 173 | { |
335 | 335 | |
336 | 336 | |
337 | 337 | /* |
338 | * $Id: fonts.c,v 1.9 2008/02/20 18:55:14 gtkwave Exp $ | |
338 | * $Id: fonts.c,v 1.10 2008/07/01 18:51:06 gtkwave Exp $ | |
339 | 339 | * $Log: fonts.c,v $ |
340 | * Revision 1.10 2008/07/01 18:51:06 gtkwave | |
341 | * compiler warning fixes for amd64 | |
342 | * | |
340 | 343 | * Revision 1.9 2008/02/20 18:55:14 gtkwave |
341 | 344 | * strncmp length fix from previous update |
342 | 345 | * |
1160 | 1160 | return -1; |
1161 | 1161 | h->snap_time = ghw_get_i64 (h, (unsigned char *)&hdr[4]); |
1162 | 1162 | if (h->flag_verbose > 1) |
1163 | printf ("Time is %lld fs\n", h->snap_time); | |
1163 | printf ("Time is "GHWLLD" fs\n", h->snap_time); | |
1164 | 1164 | |
1165 | 1165 | for (i = 0; i < h->nbr_sigs; i++) |
1166 | 1166 | { |
1293 | 1293 | printf ("%d", val->i32); |
1294 | 1294 | break; |
1295 | 1295 | case ghdl_rtik_type_p64: |
1296 | printf ("%lld", val->i64); | |
1296 | printf (GHWLLD, val->i64); | |
1297 | 1297 | break; |
1298 | 1298 | case ghdl_rtik_type_f64: |
1299 | 1299 | printf ("%g", val->f64); |
1347 | 1347 | snprintf (buf, len, "%d", val->i32); |
1348 | 1348 | break; |
1349 | 1349 | case ghdl_rtik_type_p64: |
1350 | snprintf (buf, len, "%lld", val->i64); | |
1350 | snprintf (buf, len, GHWLLD, val->i64); | |
1351 | 1351 | break; |
1352 | 1352 | case ghdl_rtik_type_f64: |
1353 | 1353 | snprintf (buf, len, "%g", val->f64); |
1504 | 1504 | break; |
1505 | 1505 | case ghw_sm_cycle: |
1506 | 1506 | if (0) |
1507 | printf ("Time is %lld fs\n", h->snap_time); | |
1507 | printf ("Time is "GHWLLD" fs\n", h->snap_time); | |
1508 | 1508 | if (0) |
1509 | 1509 | ghw_disp_values (h); |
1510 | 1510 | |
1542 | 1542 | return res; |
1543 | 1543 | |
1544 | 1544 | if (0) |
1545 | printf ("Time is %lld fs\n", h->snap_time); | |
1545 | printf ("Time is "GHWLLD" fs\n", h->snap_time); | |
1546 | 1546 | if (0) |
1547 | 1547 | ghw_disp_values (h); |
1548 | 1548 | |
1669 | 1669 | break; |
1670 | 1670 | case ghdl_rtik_type_i64: |
1671 | 1671 | case ghdl_rtik_type_p64: |
1672 | printf ("%lld %s %lld", | |
1672 | printf (GHWLLD" %s "GHWLLD, | |
1673 | 1673 | rng->i64.left, ghw_get_dir (rng->i64.dir), rng->i64.right); |
1674 | 1674 | break; |
1675 | 1675 | case ghdl_rtik_type_f64: |
1722 | 1722 | for (i = 0; i < p->nbr_units; i++) |
1723 | 1723 | { |
1724 | 1724 | struct ghw_unit *u = &p->units[i]; |
1725 | printf (" %s = %lld %s;\n", u->name, u->val, p->units[0].name); | |
1725 | printf (" %s = "GHWLLD" %s;\n", u->name, u->val, p->units[0].name); | |
1726 | 1726 | } |
1727 | 1727 | printf ("end units\n"); |
1728 | 1728 | } |
1803 | 1803 | } |
1804 | 1804 | |
1805 | 1805 | /* |
1806 | * $Id: ghwlib.c,v 1.2 2007/08/26 21:35:40 gtkwave Exp $ | |
1806 | * $Id: ghwlib.c,v 1.3 2008/07/01 18:51:06 gtkwave Exp $ | |
1807 | 1807 | * $Log: ghwlib.c,v $ |
1808 | * Revision 1.3 2008/07/01 18:51:06 gtkwave | |
1809 | * compiler warning fixes for amd64 | |
1810 | * | |
1808 | 1811 | * Revision 1.2 2007/08/26 21:35:40 gtkwave |
1809 | 1812 | * integrated global context management from SystemOfCode2007 branch |
1810 | 1813 | * |
25 | 25 | |
26 | 26 | #if HAVE_STDINT_H |
27 | 27 | #include <stdint.h> |
28 | #if __WORDSIZE == 64 | |
29 | #define GHWLLD "%ld" | |
30 | #else | |
31 | #define GHWLLD "%lld" | |
32 | #endif | |
28 | 33 | #endif |
29 | 34 | #if HAVE_INTTYPES_H |
30 | 35 | #include <inttypes.h> |
36 | #ifndef GHWLLD | |
37 | #if __WORDSIZE == 64 | |
38 | #define GHWLLD "%ld" | |
39 | #else | |
40 | #define GHWLLD "%lld" | |
41 | #endif | |
42 | #endif | |
31 | 43 | #endif |
32 | 44 | |
33 | 45 | enum ghdl_rtik { |
404 | 416 | #endif /* _GHWLIB_H_ */ |
405 | 417 | |
406 | 418 | /* |
407 | * $Id: ghwlib.h,v 1.2 2007/08/26 21:35:41 gtkwave Exp $ | |
419 | * $Id: ghwlib.h,v 1.3 2008/07/01 18:51:06 gtkwave Exp $ | |
408 | 420 | * $Log: ghwlib.h,v $ |
421 | * Revision 1.3 2008/07/01 18:51:06 gtkwave | |
422 | * compiler warning fixes for amd64 | |
423 | * | |
409 | 424 | * Revision 1.2 2007/08/26 21:35:41 gtkwave |
410 | 425 | * integrated global context management from SystemOfCode2007 branch |
411 | 426 | * |
826 | 826 | /* |
827 | 827 | * vcd.c |
828 | 828 | */ |
829 | 0, /* do_hier_compress */ | |
830 | NULL, /* hier_pfx */ | |
831 | 0, /* hier_pfx_cnt */ | |
832 | NULL, /* prev_hier_pfx */ | |
833 | 0, /* prev_hier_pfx_len */ | |
834 | 0, /* prev_hier_pfx_cnt */ | |
835 | NULL, /* pfx_hier_array */ | |
836 | NULL, /* prev_hier_uncompressed_name */ | |
829 | 837 | NULL, /* vcd_jmp_buf */ |
830 | 838 | -1, /* vcd_warning_filesize 472 */ |
831 | 839 | 1, /* autocoalesce 473 */ |
1176 | 1184 | { |
1177 | 1185 | FILE *statefile; |
1178 | 1186 | struct Global *new_globals, *setjmp_globals; |
1179 | int i; | |
1180 | 1187 | gint tree_frame_x = -1, tree_frame_y = -1; |
1181 | 1188 | gdouble tree_vadj_value = 0.0; |
1182 | 1189 | gdouble tree_hadj_value = 0.0; |
1183 | 1190 | int fix_from_time = 0, fix_to_time = 0; |
1184 | TimeType from_time, to_time; | |
1191 | TimeType from_time = LLDescriptor(0), to_time = LLDescriptor(0); | |
1185 | 1192 | char timestr[32]; |
1186 | 1193 | struct stringchain_t *hier_head = NULL, *hier_curr = NULL; |
1187 | 1194 | int load_was_success = 0; |
1445 | 1452 | new_globals->convert_to_reals = GLOBALS->convert_to_reals; |
1446 | 1453 | new_globals->disable_mouseover = GLOBALS->disable_mouseover; |
1447 | 1454 | new_globals->disable_tooltips = GLOBALS->disable_tooltips; |
1455 | new_globals->do_hier_compress = GLOBALS->do_hier_compress; | |
1448 | 1456 | new_globals->do_initial_zoom_fit = GLOBALS->do_initial_zoom_fit; |
1449 | 1457 | new_globals->do_resize_signals = GLOBALS->do_resize_signals; |
1450 | 1458 | new_globals->enable_fast_exit = GLOBALS->enable_fast_exit; |
1496 | 1504 | strcpy2_into_new_context(new_globals, &new_globals->fontname_signals, &GLOBALS->fontname_signals); |
1497 | 1505 | strcpy2_into_new_context(new_globals, &new_globals->fontname_waves, &GLOBALS->fontname_waves); |
1498 | 1506 | |
1507 | /* hierarchy handling from vcd.c */ | |
1508 | if(GLOBALS->hier_pfx) { jrb_free_tree(GLOBALS->hier_pfx); GLOBALS->hier_pfx = NULL; } | |
1509 | ||
1510 | ||
1499 | 1511 | /* vlist.c */ |
1500 | 1512 | if(GLOBALS->vlist_handle) |
1501 | 1513 | { |
1590 | 1602 | #endif |
1591 | 1603 | break; |
1592 | 1604 | |
1605 | case NO_FILE: | |
1593 | 1606 | case GHW_FILE: |
1594 | 1607 | case VCD_FILE: |
1595 | 1608 | case VCD_RECODER_FILE: /* do nothing */ break; |
1772 | 1785 | case LXT_FILE: lxt_main(GLOBALS->loaded_file_name); break; |
1773 | 1786 | case VCD_FILE: vcd_main(GLOBALS->loaded_file_name); break; |
1774 | 1787 | case VCD_RECODER_FILE: vcd_recoder_main(GLOBALS->loaded_file_name); break; |
1788 | default: break; | |
1775 | 1789 | } |
1776 | 1790 | |
1777 | 1791 | t = (void **)setjmp_globals->alloc2_chain; |
1818 | 1832 | /* now try again, jump through recovery sequence below */ |
1819 | 1833 | } |
1820 | 1834 | break; |
1835 | default: | |
1836 | break; | |
1821 | 1837 | } |
1822 | 1838 | |
1823 | 1839 | set_window_idle(NULL); |
2085 | 2101 | #endif |
2086 | 2102 | break; |
2087 | 2103 | |
2104 | case NO_FILE: | |
2088 | 2105 | case GHW_FILE: |
2089 | 2106 | case VCD_FILE: |
2090 | 2107 | case VCD_RECODER_FILE: /* do nothing */ break; |
51 | 51 | #include"vlist.h" |
52 | 52 | #include"vzt.h" |
53 | 53 | #include"wavealloca.h" |
54 | ||
54 | #include"jrb.h" | |
55 | 55 | |
56 | 56 | struct Global{ |
57 | 57 | |
821 | 821 | /* |
822 | 822 | * vcd.c |
823 | 823 | */ |
824 | unsigned char do_hier_compress; /* from vcd.c */ | |
825 | JRB hier_pfx; /* from vcd.c */ | |
826 | unsigned int hier_pfx_cnt; /* from vcd.c */ | |
827 | char *prev_hier_pfx; /* from vcd.c */ | |
828 | int prev_hier_pfx_len; /* from vcd.c */ | |
829 | unsigned int prev_hier_pfx_cnt; /* from vcd.c */ | |
830 | char **pfx_hier_array; /* from vcd.c */ | |
831 | char *prev_hier_uncompressed_name; /* from vcd.c */ | |
824 | 832 | jmp_buf *vcd_jmp_buf; /* from vcd.c */ |
825 | 833 | int vcd_warning_filesize; /* from vcd.c 502 */ |
826 | 834 | char autocoalesce; /* from vcd.c 503 */ |
175 | 175 | case ghw_res_snapshot: |
176 | 176 | case ghw_res_cycle: |
177 | 177 | if (flag_disp_time) |
178 | printf ("Time is %lld fs\n", hp->snap_time); | |
178 | printf ("Time is "GHWLLD" fs\n", hp->snap_time); | |
179 | 179 | if (flag_disp_signals) |
180 | 180 | ghw_disp_values (hp); |
181 | 181 | break; |
201 | 201 | } |
202 | 202 | |
203 | 203 | /* |
204 | * $Id: ghwdump.c,v 1.1.1.1 2007/05/30 04:28:15 gtkwave Exp $ | |
204 | * $Id: ghwdump.c,v 1.2 2008/07/01 18:51:07 gtkwave Exp $ | |
205 | 205 | * $Log: ghwdump.c,v $ |
206 | * Revision 1.2 2008/07/01 18:51:07 gtkwave | |
207 | * compiler warning fixes for amd64 | |
208 | * | |
206 | 209 | * Revision 1.1.1.1 2007/05/30 04:28:15 gtkwave |
207 | 210 | * Imported sources |
208 | 211 | * |
72 | 72 | typedef uint32_t lxtint32_t; |
73 | 73 | typedef uint64_t lxtint64_t; |
74 | 74 | #ifndef __MINGW32__ |
75 | #define LXT2_RD_LLD "%lld" | |
75 | #if __WORDSIZE == 64 | |
76 | #define LXT2_RD_LLD "%ld" | |
77 | #else | |
78 | #define LXT2_RD_LLD "%lld" | |
79 | #endif | |
76 | 80 | #else |
77 | 81 | #define LXT2_RD_LLD "%I64d" |
78 | 82 | #endif |
282 | 286 | #endif |
283 | 287 | |
284 | 288 | /* |
285 | * $Id: lxt2_read.h,v 1.1.1.1 2007/05/30 04:28:18 gtkwave Exp $ | |
289 | * $Id: lxt2_read.h,v 1.2 2008/07/01 18:51:07 gtkwave Exp $ | |
286 | 290 | * $Log: lxt2_read.h,v $ |
291 | * Revision 1.2 2008/07/01 18:51:07 gtkwave | |
292 | * compiler warning fixes for amd64 | |
293 | * | |
287 | 294 | * Revision 1.1.1.1 2007/05/30 04:28:18 gtkwave |
288 | 295 | * Imported sources |
289 | 296 | * |
42 | 42 | { |
43 | 43 | struct lxt2_rd_geometry *g = lxt2_rd_get_fac_geometry(*lt, *pnt_facidx); |
44 | 44 | |
45 | /* fprintf(stderr, "%lld %d %s\n", *pnt_time, *pnt_facidx, *pnt_value); */ | |
45 | /* fprintf(stderr, LXT2_RD_LLD" %d %s\n", *pnt_time, *pnt_facidx, *pnt_value); */ | |
46 | 46 | |
47 | 47 | if(!(*pnt_value)[0]) |
48 | 48 | { |
73 | 73 | { |
74 | 74 | if(!names_only) |
75 | 75 | { |
76 | printf("#%lld %s[%d:%d] %s\n", *pnt_time, lxt2_rd_get_facname(*lt, *pnt_facidx), g->msb, g->lsb, *pnt_value); | |
76 | printf("#"LXT2_RD_LLD" %s[%d:%d] %s\n", *pnt_time, lxt2_rd_get_facname(*lt, *pnt_facidx), g->msb, g->lsb, *pnt_value); | |
77 | 77 | } |
78 | 78 | else |
79 | 79 | { |
86 | 86 | { |
87 | 87 | if(!names_only) |
88 | 88 | { |
89 | printf("#%lld %s %s\n", *pnt_time, lxt2_rd_get_facname(*lt, *pnt_facidx), *pnt_value); | |
89 | printf("#"LXT2_RD_LLD" %s %s\n", *pnt_time, lxt2_rd_get_facname(*lt, *pnt_facidx), *pnt_value); | |
90 | 90 | } |
91 | 91 | else |
92 | 92 | { |
97 | 97 | { |
98 | 98 | if(!names_only) |
99 | 99 | { |
100 | printf("#%lld %s[%d] %s\n", *pnt_time, lxt2_rd_get_facname(*lt, *pnt_facidx), g->msb, *pnt_value); | |
100 | printf("#"LXT2_RD_LLD" %s[%d] %s\n", *pnt_time, lxt2_rd_get_facname(*lt, *pnt_facidx), g->msb, *pnt_value); | |
101 | 101 | } |
102 | 102 | else |
103 | 103 | { |
305 | 305 | } |
306 | 306 | |
307 | 307 | /* |
308 | * $Id: lxt2miner.c,v 1.1.1.1 2007/05/30 04:28:25 gtkwave Exp $ | |
308 | * $Id: lxt2miner.c,v 1.2 2008/07/01 18:51:07 gtkwave Exp $ | |
309 | 309 | * $Log: lxt2miner.c,v $ |
310 | * Revision 1.2 2008/07/01 18:51:07 gtkwave | |
311 | * compiler warning fixes for amd64 | |
312 | * | |
310 | 313 | * Revision 1.1.1.1 2007/05/30 04:28:25 gtkwave |
311 | 314 | * Imported sources |
312 | 315 | * |
87 | 87 | { |
88 | 88 | struct lxt2_rd_geometry *g = lxt2_rd_get_fac_geometry(*lt, *pnt_facidx); |
89 | 89 | |
90 | /* fprintf(stderr, "%lld %d %s\n", *pnt_time, *pnt_facidx, *pnt_value); */ | |
90 | /* fprintf(stderr, LXT2_RD_LLD" %d %s\n", *pnt_time, *pnt_facidx, *pnt_value); */ | |
91 | 91 | |
92 | 92 | if(vcd_prevtime != *pnt_time) |
93 | 93 | { |
94 | 94 | vcd_prevtime = *pnt_time; |
95 | printf("#%lld\n", *pnt_time); | |
95 | printf("#"LXT2_RD_LLD"\n", *pnt_time); | |
96 | 96 | } |
97 | 97 | |
98 | 98 | if(!(*pnt_value)[0]) |
256 | 256 | |
257 | 257 | if(vcd_prevtime!=lxt2_rd_get_end_time(lt)) |
258 | 258 | { |
259 | printf("#%lld\n", lxt2_rd_get_end_time(lt)); | |
259 | printf("#"LXT2_RD_LLD"\n", lxt2_rd_get_end_time(lt)); | |
260 | 260 | } |
261 | 261 | |
262 | 262 | lxt2_rd_close(lt); |
380 | 380 | } |
381 | 381 | |
382 | 382 | /* |
383 | * $Id: lxt2vcd.c,v 1.1.1.1 2007/05/30 04:28:25 gtkwave Exp $ | |
383 | * $Id: lxt2vcd.c,v 1.2 2008/07/01 18:51:07 gtkwave Exp $ | |
384 | 384 | * $Log: lxt2vcd.c,v $ |
385 | * Revision 1.2 2008/07/01 18:51:07 gtkwave | |
386 | * compiler warning fixes for amd64 | |
387 | * | |
385 | 388 | * Revision 1.1.1.1 2007/05/30 04:28:25 gtkwave |
386 | 389 | * Imported sources |
387 | 390 | * |
22 | 22 | #include <string.h> |
23 | 23 | #include <time.h> |
24 | 24 | #include <sys/types.h> |
25 | ||
26 | #ifdef __MINGW32__ | |
27 | #ifndef REGEX_MAY_COMPILE | |
28 | #define REGEX_MAY_COMPILE | |
29 | #include "../gnu_regex.c" | |
30 | #endif | |
31 | #endif | |
25 | 32 | |
26 | 33 | #include "../gnu_regex.h" |
27 | 34 | |
552 | 559 | } |
553 | 560 | |
554 | 561 | /* |
555 | * $Id: tla2vcd.c,v 1.2 2007/08/31 22:42:44 gtkwave Exp $ | |
562 | * $Id: tla2vcd.c,v 1.4 2008/05/23 07:02:44 gtkwave Exp $ | |
556 | 563 | * $Log: tla2vcd.c,v $ |
564 | * Revision 1.4 2008/05/23 07:02:44 gtkwave | |
565 | * path fix on gnu_regex.c | |
566 | * | |
567 | * Revision 1.3 2008/05/23 04:50:28 gtkwave | |
568 | * mingw compile fix | |
569 | * | |
557 | 570 | * Revision 1.2 2007/08/31 22:42:44 gtkwave |
558 | 571 | * 3.1.0 RC3 updates |
559 | 572 | * |
89 | 89 | { |
90 | 90 | struct vzt_rd_geometry *g = vzt_rd_get_fac_geometry(*lt, *pnt_facidx); |
91 | 91 | |
92 | /* fprintf(stderr, "%lld %d %s\n", *pnt_time, *pnt_facidx, *pnt_value); */ | |
92 | /* fprintf(stderr, VZT_RD_LLD" %d %s\n", *pnt_time, *pnt_facidx, *pnt_value); */ | |
93 | 93 | |
94 | 94 | if(vcd_prevtime != *pnt_time) |
95 | 95 | { |
96 | 96 | vcd_prevtime = *pnt_time; |
97 | printf("#%lld\n", *pnt_time); | |
97 | printf("#"VZT_RD_LLD"\n", *pnt_time); | |
98 | 98 | } |
99 | 99 | |
100 | 100 | if(!(*pnt_value)[0]) |
240 | 240 | { |
241 | 241 | if(!(g->flags & VZT_RD_SYM_F_INTEGER)) |
242 | 242 | { |
243 | printf("$var wire %d %s %s[%d:%d] $end\n", g->len, vcdid(newindx), netname, g->msb, g->lsb); | |
243 | if(g->len) printf("$var wire %d %s %s[%d:%d] $end\n", g->len, vcdid(newindx), netname, g->msb, g->lsb); | |
244 | 244 | } |
245 | 245 | else |
246 | 246 | { |
265 | 265 | |
266 | 266 | if(vcd_prevtime!=vzt_rd_get_end_time(lt)) |
267 | 267 | { |
268 | printf("#%lld\n", vzt_rd_get_end_time(lt)); | |
268 | printf("#"VZT_RD_LLD"\n", vzt_rd_get_end_time(lt)); | |
269 | 269 | } |
270 | 270 | |
271 | 271 | vzt_rd_close(lt); |
395 | 395 | } |
396 | 396 | |
397 | 397 | /* |
398 | * $Id: vzt2vcd.c,v 1.1.1.1 2007/05/30 04:28:25 gtkwave Exp $ | |
398 | * $Id: vzt2vcd.c,v 1.3 2008/07/19 23:26:49 gtkwave Exp $ | |
399 | 399 | * $Log: vzt2vcd.c,v $ |
400 | * Revision 1.3 2008/07/19 23:26:49 gtkwave | |
401 | * fixed buffer overflow in vectorization code | |
402 | * | |
403 | * Revision 1.2 2008/07/01 18:51:07 gtkwave | |
404 | * compiler warning fixes for amd64 | |
405 | * | |
400 | 406 | * Revision 1.1.1.1 2007/05/30 04:28:25 gtkwave |
401 | 407 | * Imported sources |
402 | 408 | * |
577 | 577 | { |
578 | 578 | for(i=0;i<len;i++) |
579 | 579 | { |
580 | if((facidx+i)>=lt->numfacs) break; | |
581 | ||
580 | 582 | vindex_offset = lt->vindex_offset[facidx+i]; |
581 | 583 | vindex_offset_x = vindex_offset + lt->total_values; |
582 | 584 | |
590 | 592 | { |
591 | 593 | for(i=0;i<len;i++) |
592 | 594 | { |
595 | if((facidx+i)>=lt->numfacs) break; | |
596 | ||
593 | 597 | vindex_offset = lt->vindex_offset[facidx+i]; |
594 | 598 | |
595 | 599 | valpnt = b->change_dict + (b->vindex[vindex_offset] * row_size + word); |
664 | 668 | vztint32_t *valpnt_x; |
665 | 669 | int which; |
666 | 670 | |
667 | for(i=0;i<len;i++) | |
668 | { | |
671 | for(i=0;i<len;i++) | |
672 | { | |
673 | if((facidx+i)>=lt->numfacs) break; | |
674 | ||
669 | 675 | vindex_offset = lt->vindex_offset[facidx+i]; |
670 | 676 | vindex_offset_x = vindex_offset + lt->total_values; |
671 | 677 | |
680 | 686 | { |
681 | 687 | for(i=0;i<len;i++) |
682 | 688 | { |
689 | if((facidx+i)>=lt->numfacs) break; | |
690 | ||
683 | 691 | vindex_offset = lt->vindex_offset[facidx+i]; |
684 | 692 | |
685 | 693 | valpnt = val_base + (b->vindex[vindex_offset] * row_size); |
2044 | 2052 | lt->vindex_offset[i] = lt->vindex_offset[j]; |
2045 | 2053 | for(k=1;k<lt->len[i];k++) |
2046 | 2054 | { |
2047 | lt->vindex_offset[k+i] = lt->vindex_offset[vzt_rd_get_alias_root(lt, k+i)]; | |
2055 | if((k+i) <= (lt->numfacs-1)) | |
2056 | { | |
2057 | lt->vindex_offset[k+i] = lt->vindex_offset[vzt_rd_get_alias_root(lt, k+i)]; | |
2058 | } | |
2048 | 2059 | } |
2049 | 2060 | |
2050 | 2061 | if(synvec_chain[j]) |
2059 | 2070 | { |
2060 | 2071 | for(l=0;l<lt->len[i];l++) |
2061 | 2072 | { |
2062 | if(lt->vindex_offset[idx+l] != lt->vindex_offset[i+l]) break; | |
2073 | if((idx+l)<=(lt->numfacs-1)) | |
2074 | { | |
2075 | if(lt->vindex_offset[idx+l] != lt->vindex_offset[i+l]) break; | |
2076 | } | |
2063 | 2077 | } |
2064 | 2078 | |
2065 | 2079 | if(l == (lt->len[i])) |
2331 | 2345 | } |
2332 | 2346 | |
2333 | 2347 | /* |
2334 | * $Id: vzt_read.c,v 1.1.1.1 2007/05/30 04:28:22 gtkwave Exp $ | |
2348 | * $Id: vzt_read.c,v 1.2 2008/07/19 23:26:49 gtkwave Exp $ | |
2335 | 2349 | * $Log: vzt_read.c,v $ |
2350 | * Revision 1.2 2008/07/19 23:26:49 gtkwave | |
2351 | * fixed buffer overflow in vectorization code | |
2352 | * | |
2336 | 2353 | * Revision 1.1.1.1 2007/05/30 04:28:22 gtkwave |
2337 | 2354 | * Imported sources |
2338 | 2355 | * |
73 | 73 | typedef uint32_t vztint32_t; |
74 | 74 | typedef uint64_t vztint64_t; |
75 | 75 | #ifndef __MINGW32__ |
76 | #define VZT_RD_LLD "%lld" | |
76 | #if __WORDSIZE == 64 | |
77 | #define VZT_RD_LLD "%ld" | |
78 | #else | |
79 | #define VZT_RD_LLD "%lld" | |
80 | #endif | |
77 | 81 | #else |
78 | 82 | #define VZT_RD_LLD "%I64d" |
79 | 83 | #endif |
268 | 272 | #endif |
269 | 273 | |
270 | 274 | /* |
271 | * $Id: vzt_read.h,v 1.1.1.1 2007/05/30 04:28:18 gtkwave Exp $ | |
275 | * $Id: vzt_read.h,v 1.2 2008/07/01 18:51:07 gtkwave Exp $ | |
272 | 276 | * $Log: vzt_read.h,v $ |
277 | * Revision 1.2 2008/07/01 18:51:07 gtkwave | |
278 | * compiler warning fixes for amd64 | |
279 | * | |
273 | 280 | * Revision 1.1.1.1 2007/05/30 04:28:18 gtkwave |
274 | 281 | * Imported sources |
275 | 282 | * |
43 | 43 | { |
44 | 44 | struct vzt_rd_geometry *g = vzt_rd_get_fac_geometry(*lt, *pnt_facidx); |
45 | 45 | |
46 | /* fprintf(stderr, "%lld %d %s\n", *pnt_time, *pnt_facidx, *pnt_value); */ | |
46 | /* fprintf(stderr, VZT_RD_LLD" %d %s\n", *pnt_time, *pnt_facidx, *pnt_value); */ | |
47 | 47 | |
48 | 48 | if(!(*pnt_value)[0]) |
49 | 49 | { |
74 | 74 | { |
75 | 75 | if(!names_only) |
76 | 76 | { |
77 | printf("#%lld %s[%d:%d] %s\n", *pnt_time, vzt_rd_get_facname(*lt, *pnt_facidx), g->msb, g->lsb, *pnt_value); | |
77 | printf("#"VZT_RD_LLD" %s[%d:%d] %s\n", *pnt_time, vzt_rd_get_facname(*lt, *pnt_facidx), g->msb, g->lsb, *pnt_value); | |
78 | 78 | } |
79 | 79 | else |
80 | 80 | { |
87 | 87 | { |
88 | 88 | if(!names_only) |
89 | 89 | { |
90 | printf("#%lld %s %s\n", *pnt_time, vzt_rd_get_facname(*lt, *pnt_facidx), *pnt_value); | |
90 | printf("#"VZT_RD_LLD" %s %s\n", *pnt_time, vzt_rd_get_facname(*lt, *pnt_facidx), *pnt_value); | |
91 | 91 | } |
92 | 92 | else |
93 | 93 | { |
98 | 98 | { |
99 | 99 | if(!names_only) |
100 | 100 | { |
101 | printf("#%lld %s[%d] %s\n", *pnt_time, vzt_rd_get_facname(*lt, *pnt_facidx), g->msb, *pnt_value); | |
101 | printf("#"VZT_RD_LLD" %s[%d] %s\n", *pnt_time, vzt_rd_get_facname(*lt, *pnt_facidx), g->msb, *pnt_value); | |
102 | 102 | } |
103 | 103 | else |
104 | 104 | { |
307 | 307 | } |
308 | 308 | |
309 | 309 | /* |
310 | * $Id: vztminer.c,v 1.1.1.1 2007/05/30 04:28:22 gtkwave Exp $ | |
310 | * $Id: vztminer.c,v 1.2 2008/07/01 18:51:07 gtkwave Exp $ | |
311 | 311 | * $Log: vztminer.c,v $ |
312 | * Revision 1.2 2008/07/01 18:51:07 gtkwave | |
313 | * compiler warning fixes for amd64 | |
314 | * | |
312 | 315 | * Revision 1.1.1.1 2007/05/30 04:28:22 gtkwave |
313 | 316 | * Imported sources |
314 | 317 | * |
0 | /* | |
1 | * Copyright (c) Tony Bybell 2008. | |
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 "hierpack.h" | |
10 | ||
11 | char *hier_decompress(char *n) | |
12 | { | |
13 | char *recon; | |
14 | ||
15 | if(*n & 0x80) | |
16 | { | |
17 | unsigned char varbuff[5]; | |
18 | int idx = 0; | |
19 | int lhs, rhs, tot; | |
20 | unsigned int idxval = 0; | |
21 | while(*n & 0x80) | |
22 | { | |
23 | varbuff[idx] = *n & 0x7f; | |
24 | n++; | |
25 | idx++; | |
26 | } | |
27 | while(--idx >= 0) | |
28 | { | |
29 | idxval <<= 7; | |
30 | idxval |= (unsigned int)varbuff[idx]; | |
31 | } | |
32 | ||
33 | lhs = strlen(GLOBALS->pfx_hier_array[idxval]); | |
34 | rhs = strlen(n); | |
35 | tot = lhs + rhs + 1; | |
36 | recon = malloc_2(tot); | |
37 | strcpy(recon, GLOBALS->pfx_hier_array[idxval]); | |
38 | strcpy(recon + lhs, n); | |
39 | } | |
40 | else | |
41 | { | |
42 | recon = n; | |
43 | } | |
44 | ||
45 | return(recon); | |
46 | } | |
47 | ||
48 | ||
49 | char *hier_decompress_flagged(char *n, int *was_packed) | |
50 | { | |
51 | if(n) | |
52 | { | |
53 | *was_packed = ((*n & 0x80) != 0); | |
54 | return(hier_decompress(n)); | |
55 | } | |
56 | else | |
57 | { | |
58 | return(n); | |
59 | } | |
60 | } | |
61 | ||
62 | ||
63 | char *hier_compress(char *name, int add_missing_pfx_to_tree, int *was_packed) | |
64 | { | |
65 | char *pnt = name; | |
66 | char *last_h = NULL; | |
67 | int curr_pfx_len; | |
68 | JRB node; | |
69 | ||
70 | *was_packed = 0; | |
71 | ||
72 | while(*pnt) | |
73 | { | |
74 | if(*pnt == GLOBALS->hier_delimeter) last_h = pnt; | |
75 | pnt++; | |
76 | } | |
77 | pnt = name; | |
78 | ||
79 | if(last_h) | |
80 | { | |
81 | unsigned char varidx[5]; | |
82 | unsigned int shiftval; | |
83 | unsigned int shiftidx; | |
84 | unsigned int shiftmasked; | |
85 | unsigned int pfxlen, sfxlen; | |
86 | ||
87 | if(!GLOBALS->hier_pfx) | |
88 | { | |
89 | GLOBALS->hier_pfx = make_jrb(); | |
90 | GLOBALS->prev_hier_pfx = strdup_2(""); | |
91 | GLOBALS->prev_hier_pfx_len = 0; | |
92 | ||
93 | fprintf(stderr, "MEMPACK | Using compressed hierarchy names\n"); | |
94 | } | |
95 | curr_pfx_len = last_h - pnt + 1; | |
96 | *last_h = 0; | |
97 | if(GLOBALS->prev_hier_pfx_len && (GLOBALS->prev_hier_pfx_len == curr_pfx_len) && !strcmp(GLOBALS->prev_hier_pfx, pnt)) | |
98 | { | |
99 | /* pfx matches so reuse */ | |
100 | } | |
101 | else | |
102 | { | |
103 | node = jrb_find_str(GLOBALS->hier_pfx, pnt); | |
104 | if(!node) | |
105 | { | |
106 | Jval val; | |
107 | val.ui = GLOBALS->prev_hier_pfx_cnt = GLOBALS->hier_pfx_cnt; | |
108 | if(add_missing_pfx_to_tree) | |
109 | { | |
110 | node = jrb_insert_str(GLOBALS->hier_pfx, strdup_2(pnt), val); | |
111 | GLOBALS->hier_pfx_cnt++; | |
112 | /* printf("Add %d: '%s' %d\n", node->val.ui, node->key.s, GLOBALS->hier_pfx_cnt); */ | |
113 | } | |
114 | } | |
115 | else | |
116 | { | |
117 | GLOBALS->prev_hier_pfx_cnt = node->val.ui; | |
118 | } | |
119 | } | |
120 | ||
121 | shiftval = GLOBALS->prev_hier_pfx_cnt; | |
122 | shiftidx = 0; | |
123 | ||
124 | for(shiftidx=0;;shiftidx++) | |
125 | { | |
126 | shiftmasked = (shiftval & 0x7f) | 0x80; /* 0x80 = hier idx marker */ | |
127 | shiftval >>= 7; | |
128 | if(!shiftval) | |
129 | { | |
130 | varidx[shiftidx] = shiftmasked; | |
131 | shiftidx++; | |
132 | break; | |
133 | } | |
134 | varidx[shiftidx] = shiftmasked; | |
135 | } | |
136 | ||
137 | pfxlen = shiftidx; | |
138 | sfxlen = strlen(last_h+1); | |
139 | if(curr_pfx_len > pfxlen) | |
140 | { | |
141 | static int savecnt = 0; | |
142 | char *namereplace = malloc_2(pfxlen + 1 + sfxlen + 1); | |
143 | memcpy(namereplace, varidx, pfxlen); | |
144 | namereplace[pfxlen] = GLOBALS->hier_delimeter; | |
145 | strcpy(namereplace+pfxlen+1, last_h+1); | |
146 | *was_packed = 1; | |
147 | name = namereplace; | |
148 | savecnt += curr_pfx_len+1-pfxlen; | |
149 | } | |
150 | ||
151 | *last_h = GLOBALS->hier_delimeter; | |
152 | } | |
153 | else | |
154 | { | |
155 | /* no leading hier */ | |
156 | } | |
157 | ||
158 | return(name); | |
159 | } | |
160 | ||
161 | /* | |
162 | * $Id: hierpack.c,v 1.4 2008/07/20 20:48:08 gtkwave Exp $ | |
163 | * $Log: hierpack.c,v $ | |
164 | * Revision 1.4 2008/07/20 20:48:08 gtkwave | |
165 | * compressed hierarchy support | |
166 | * | |
167 | * Revision 1.3 2008/07/20 01:29:36 gtkwave | |
168 | * added command line option --comphier | |
169 | * | |
170 | * Revision 1.2 2008/07/18 17:29:50 gtkwave | |
171 | * adding cvs headers | |
172 | * | |
173 | * Revision 1.1 2008/07/18 17:27:01 gtkwave | |
174 | * adding hierpack code | |
175 | * | |
176 | */ | |
177 |
0 | /* | |
1 | * Copyright (c) Tony Bybell 2008. | |
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 | #ifndef WAVE_HIERPACK_H | |
10 | #define WAVE_HIERPACK_H | |
11 | ||
12 | #include "globals.h" | |
13 | ||
14 | char *hier_decompress(char *n); | |
15 | char *hier_decompress_flagged(char *n, int *was_packed); | |
16 | ||
17 | char *hier_compress(char *name, int add_missing_pfx_to_tree, int *was_packed); | |
18 | ||
19 | enum { HIERPACK_DO_NOT_ADD = 0, HIERPACK_ADD }; | |
20 | ||
21 | #endif | |
22 | ||
23 | /* | |
24 | * $Id: hierpack.h,v 1.2 2008/07/18 17:29:50 gtkwave Exp $ | |
25 | * $Log: hierpack.h,v $ | |
26 | * Revision 1.2 2008/07/18 17:29:50 gtkwave | |
27 | * adding cvs headers | |
28 | * | |
29 | * Revision 1.1 2008/07/18 17:27:01 gtkwave | |
30 | * adding hierpack code | |
31 | * | |
32 | */ | |
33 |
33 | 33 | #include <strings.h> |
34 | 34 | #include <math.h> |
35 | 35 | |
36 | #ifdef __MINGW32__ | |
36 | #ifndef HAVE_BZERO | |
37 | 37 | #define bcopy(a,b,c) memcpy((b),(a),(c)) |
38 | 38 | #define bzero(a,b) memset((a),0,(b)) |
39 | 39 | #define bcmp(a,b,c) memcmp((a),(b),(c)) |
354 | 354 | } |
355 | 355 | |
356 | 356 | /* |
357 | * $Id: interp.c,v 1.1 2008/02/15 16:30:58 gtkwave Exp $ | |
357 | * $Id: interp.c,v 1.2 2008/05/29 15:54:16 gtkwave Exp $ | |
358 | 358 | * $Log: interp.c,v $ |
359 | * Revision 1.2 2008/05/29 15:54:16 gtkwave | |
360 | * added HAVE_BZERO patches for MinGW | |
361 | * | |
359 | 362 | * Revision 1.1 2008/02/15 16:30:58 gtkwave |
360 | 363 | * re-added after permission fix |
361 | 364 | * |
0 | /* | |
1 | * Libraries for fields, doubly-linked lists and red-black trees. | |
2 | * Copyright (C) 2001 James S. Plank | |
3 | * | |
4 | * This library is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU Lesser General Public | |
6 | * License as published by the Free Software Foundation; either | |
7 | * version 2.1 of the License, or (at your option) any later version. | |
8 | */ | |
9 | ||
10 | /* Revision 1.2. Jim Plank */ | |
11 | ||
12 | /* Original code by Jim Plank (plank@cs.utk.edu) */ | |
13 | /* modified for THINK C 6.0 for Macintosh by Chris Bartley */ | |
14 | ||
15 | #include <string.h> | |
16 | #include <stdio.h> | |
17 | #include <stdlib.h> | |
18 | #include <ctype.h> | |
19 | #include "jrb.h" | |
20 | ||
21 | static void mk_new_int(JRB l, JRB r, JRB p, int il); | |
22 | static JRB lprev(JRB n); | |
23 | static JRB rprev(JRB n); | |
24 | static void recolor(JRB n); | |
25 | static void single_rotate(JRB y, int l); | |
26 | ||
27 | #define isred(n) (n->red) | |
28 | #define isblack(n) (!isred(n)) | |
29 | #define isleft(n) (n->left) | |
30 | #define isright(n) (!isleft(n)) | |
31 | #define isint(n) (n->internal) | |
32 | #define isext(n) (!isint(n)) | |
33 | #define ishead(n) (n->roothead & 2) | |
34 | #define isroot(n) (n->roothead & 1) | |
35 | #define getlext(n) ((struct jrb_node *)(n->key.v)) | |
36 | #define setlext(node, val) node->key.v = (void *) (val) | |
37 | #define getrext(n) ((struct jrb_node *)(n->val.v)) | |
38 | #define setrext(node, value) node->val.v = (void *) (value) | |
39 | #define setred(n) n->red = 1 | |
40 | #define setblack(n) n->red = 0 | |
41 | #define setleft(n) n->left = 1 | |
42 | #define setright(n) n->left = 0 | |
43 | #define sethead(n) (n->roothead |= 2) | |
44 | #define setroot(n) (n->roothead |= 1) | |
45 | #define setint(n) n->internal = 1 | |
46 | #define setext(n) n->internal = 0 | |
47 | #define setnormal(n) n->roothead = 0 | |
48 | #define sibling(n) ((isleft(n)) ? n->parent->blink : n->parent->flink) | |
49 | ||
50 | static void insert(JRB item, JRB list) /* Inserts to the end of a list */ | |
51 | { | |
52 | JRB last_node; | |
53 | ||
54 | last_node = list->blink; | |
55 | ||
56 | list->blink = item; | |
57 | last_node->flink = item; | |
58 | item->blink = last_node; | |
59 | item->flink = list; | |
60 | } | |
61 | ||
62 | static void delete_item(JRB item) /* Deletes an arbitrary iterm */ | |
63 | { | |
64 | item->flink->blink = item->blink; | |
65 | item->blink->flink = item->flink; | |
66 | } | |
67 | ||
68 | #define mk_new_ext(new, kkkey, vvval) {\ | |
69 | new = (JRB) calloc(1, sizeof(struct jrb_node));\ | |
70 | new->val = vvval;\ | |
71 | new->key = kkkey;\ | |
72 | setext(new);\ | |
73 | setblack(new);\ | |
74 | setnormal(new);\ | |
75 | } | |
76 | ||
77 | static void mk_new_int(JRB l, JRB r, JRB p, int il) | |
78 | { | |
79 | JRB newnode; | |
80 | ||
81 | newnode = (JRB) calloc(1, sizeof(struct jrb_node)); | |
82 | setint(newnode); | |
83 | setred(newnode); | |
84 | setnormal(newnode); | |
85 | newnode->flink = l; | |
86 | newnode->blink = r; | |
87 | newnode->parent = p; | |
88 | setlext(newnode, l); | |
89 | setrext(newnode, r); | |
90 | l->parent = newnode; | |
91 | r->parent = newnode; | |
92 | setleft(l); | |
93 | setright(r); | |
94 | if (ishead(p)) { | |
95 | p->parent = newnode; | |
96 | setroot(newnode); | |
97 | } else if (il) { | |
98 | setleft(newnode); | |
99 | p->flink = newnode; | |
100 | } else { | |
101 | setright(newnode); | |
102 | p->blink = newnode; | |
103 | } | |
104 | recolor(newnode); | |
105 | } | |
106 | ||
107 | ||
108 | JRB lprev(JRB n) | |
109 | { | |
110 | if (ishead(n)) return n; | |
111 | while (!isroot(n)) { | |
112 | if (isright(n)) return n->parent; | |
113 | n = n->parent; | |
114 | } | |
115 | return n->parent; | |
116 | } | |
117 | ||
118 | JRB rprev(JRB n) | |
119 | { | |
120 | if (ishead(n)) return n; | |
121 | while (!isroot(n)) { | |
122 | if (isleft(n)) return n->parent; | |
123 | n = n->parent; | |
124 | } | |
125 | return n->parent; | |
126 | } | |
127 | ||
128 | JRB make_jrb() | |
129 | { | |
130 | JRB head; | |
131 | ||
132 | head = (JRB) calloc (1, sizeof(struct jrb_node)); | |
133 | head->flink = head; | |
134 | head->blink = head; | |
135 | head->parent = head; | |
136 | head->key.s = ""; | |
137 | sethead(head); | |
138 | return head; | |
139 | } | |
140 | ||
141 | JRB jrb_find_gte_str(JRB n, char *key, int *fnd) | |
142 | { | |
143 | int cmp; | |
144 | ||
145 | *fnd = 0; | |
146 | if (!ishead(n)) { | |
147 | fprintf(stderr, "jrb_find_gte_str called on non-head 0x%p\n", n); | |
148 | exit(1); | |
149 | } | |
150 | if (n->parent == n) return n; | |
151 | cmp = strcmp(key, n->blink->key.s); | |
152 | if (cmp == 0) { | |
153 | *fnd = 1; | |
154 | return n->blink; | |
155 | } | |
156 | if (cmp > 0) return n; | |
157 | else n = n->parent; | |
158 | while (1) { | |
159 | if (isext(n)) return n; | |
160 | cmp = strcmp(key, getlext(n)->key.s); | |
161 | if (cmp == 0) { | |
162 | *fnd = 1; | |
163 | return getlext(n); | |
164 | } | |
165 | if (cmp < 0) n = n->flink ; else n = n->blink; | |
166 | } | |
167 | } | |
168 | ||
169 | JRB jrb_find_str(JRB n, char *key) | |
170 | { | |
171 | int fnd; | |
172 | JRB j; | |
173 | j = jrb_find_gte_str(n, key, &fnd); | |
174 | if (fnd) return j; else return NULL; | |
175 | } | |
176 | ||
177 | JRB jrb_find_gte_int(JRB n, int ikey, int *fnd) | |
178 | { | |
179 | *fnd = 0; | |
180 | if (!ishead(n)) { | |
181 | fprintf(stderr, "jrb_find_gte_int called on non-head 0x%p\n", n); | |
182 | exit(1); | |
183 | } | |
184 | if (n->parent == n) return n; | |
185 | if (ikey == n->blink->key.i) { | |
186 | *fnd = 1; | |
187 | return n->blink; | |
188 | } | |
189 | if (ikey > n->blink->key.i) return n; | |
190 | else n = n->parent; | |
191 | while (1) { | |
192 | if (isext(n)) return n; | |
193 | if (ikey == getlext(n)->key.i) { | |
194 | *fnd = 1; | |
195 | return getlext(n); | |
196 | } | |
197 | n = (ikey < getlext(n)->key.i) ? n->flink : n->blink; | |
198 | } | |
199 | } | |
200 | ||
201 | JRB jrb_find_int(JRB n, int ikey) | |
202 | { | |
203 | int fnd; | |
204 | JRB j; | |
205 | ||
206 | j = jrb_find_gte_int(n, ikey, &fnd); | |
207 | if (fnd) return j; else return NULL; | |
208 | } | |
209 | ||
210 | JRB jrb_find_gte_vptr(JRB n, void *vkey, int *fnd) | |
211 | { | |
212 | *fnd = 0; | |
213 | if (!ishead(n)) { | |
214 | fprintf(stderr, "jrb_find_gte_int called on non-head 0x%p\n", n); | |
215 | exit(1); | |
216 | } | |
217 | if (n->parent == n) return n; | |
218 | if ((char *)vkey == (char *)n->blink->key.v) { | |
219 | *fnd = 1; | |
220 | return n->blink; | |
221 | } | |
222 | if ((char *)vkey > (char *)n->blink->key.v) return n; | |
223 | else n = n->parent; | |
224 | while (1) { | |
225 | if (isext(n)) return n; | |
226 | if ((char *)vkey == (char *)getlext(n)->key.v) { | |
227 | *fnd = 1; | |
228 | return getlext(n); | |
229 | } | |
230 | n = ((char *)vkey < (char *)getlext(n)->key.v) ? n->flink : n->blink; | |
231 | } | |
232 | } | |
233 | ||
234 | JRB jrb_find_vptr(JRB n, void *vkey) | |
235 | { | |
236 | int fnd; | |
237 | JRB j; | |
238 | ||
239 | j = jrb_find_gte_vptr(n, vkey, &fnd); | |
240 | if (fnd) return j; else return NULL; | |
241 | } | |
242 | ||
243 | JRB jrb_find_gte_gen(JRB n, Jval key,int (*fxn)(Jval, Jval), int *fnd) | |
244 | { | |
245 | int cmp; | |
246 | ||
247 | *fnd = 0; | |
248 | if (!ishead(n)) { | |
249 | fprintf(stderr, "jrb_find_gte_str called on non-head 0x%p\n", n); | |
250 | exit(1); | |
251 | } | |
252 | if (n->parent == n) return n; | |
253 | cmp = (*fxn)(key, n->blink->key); | |
254 | if (cmp == 0) { | |
255 | *fnd = 1; | |
256 | return n->blink; | |
257 | } | |
258 | if (cmp > 0) return n; | |
259 | else n = n->parent; | |
260 | while (1) { | |
261 | if (isext(n)) return n; | |
262 | cmp = (*fxn)(key, getlext(n)->key); | |
263 | if (cmp == 0) { | |
264 | *fnd = 1; | |
265 | return getlext(n); | |
266 | } | |
267 | if (cmp < 0) n = n->flink ; else n = n->blink; | |
268 | } | |
269 | } | |
270 | ||
271 | JRB jrb_find_gen(JRB n, Jval key, int (*fxn)(Jval, Jval)) | |
272 | { | |
273 | int fnd; | |
274 | JRB j; | |
275 | ||
276 | j = jrb_find_gte_gen(n, key, fxn, &fnd); | |
277 | if (fnd) return j; else return NULL; | |
278 | } | |
279 | ||
280 | static JRB jrb_insert_b(JRB n, Jval key, Jval val) | |
281 | { | |
282 | JRB newleft, newright, newnode, p; | |
283 | ||
284 | if (ishead(n)) { | |
285 | if (n->parent == n) { /* Tree is empty */ | |
286 | mk_new_ext(newnode, key, val); | |
287 | insert(newnode, n); | |
288 | n->parent = newnode; | |
289 | newnode->parent = n; | |
290 | setroot(newnode); | |
291 | return newnode; | |
292 | } else { | |
293 | mk_new_ext(newright, key, val); | |
294 | insert(newright, n); | |
295 | newleft = newright->blink; | |
296 | setnormal(newleft); | |
297 | mk_new_int(newleft, newright, newleft->parent, isleft(newleft)); | |
298 | p = rprev(newright); | |
299 | if (!ishead(p)) setlext(p, newright); | |
300 | return newright; | |
301 | } | |
302 | } else { | |
303 | mk_new_ext(newleft, key, val); | |
304 | insert(newleft, n); | |
305 | setnormal(n); | |
306 | mk_new_int(newleft, n, n->parent, isleft(n)); | |
307 | p = lprev(newleft); | |
308 | if (!ishead(p)) setrext(p, newleft); | |
309 | return newleft; | |
310 | } | |
311 | } | |
312 | ||
313 | static void recolor(JRB n) | |
314 | { | |
315 | JRB p, gp, s; | |
316 | int done = 0; | |
317 | ||
318 | while(!done) { | |
319 | if (isroot(n)) { | |
320 | setblack(n); | |
321 | return; | |
322 | } | |
323 | ||
324 | p = n->parent; | |
325 | ||
326 | if (isblack(p)) return; | |
327 | ||
328 | if (isroot(p)) { | |
329 | setblack(p); | |
330 | return; | |
331 | } | |
332 | ||
333 | gp = p->parent; | |
334 | s = sibling(p); | |
335 | if (isred(s)) { | |
336 | setblack(p); | |
337 | setred(gp); | |
338 | setblack(s); | |
339 | n = gp; | |
340 | } else { | |
341 | done = 1; | |
342 | } | |
343 | } | |
344 | /* p's sibling is black, p is red, gp is black */ | |
345 | ||
346 | if ((isleft(n) == 0) == (isleft(p) == 0)) { | |
347 | single_rotate(gp, isleft(n)); | |
348 | setblack(p); | |
349 | setred(gp); | |
350 | } else { | |
351 | single_rotate(p, isleft(n)); | |
352 | single_rotate(gp, isleft(n)); | |
353 | setblack(n); | |
354 | setred(gp); | |
355 | } | |
356 | } | |
357 | ||
358 | static void single_rotate(JRB y, int l) | |
359 | { | |
360 | int rl = 0, ir; | |
361 | JRB x, yp; | |
362 | ||
363 | ir = isroot(y); | |
364 | yp = y->parent; | |
365 | if (!ir) { | |
366 | rl = isleft(y); | |
367 | } | |
368 | ||
369 | if (l) { | |
370 | x = y->flink; | |
371 | y->flink = x->blink; | |
372 | setleft(y->flink); | |
373 | y->flink->parent = y; | |
374 | x->blink = y; | |
375 | setright(y); | |
376 | } else { | |
377 | x = y->blink; | |
378 | y->blink = x->flink; | |
379 | setright(y->blink); | |
380 | y->blink->parent = y; | |
381 | x->flink = y; | |
382 | setleft(y); | |
383 | } | |
384 | ||
385 | x->parent = yp; | |
386 | y->parent = x; | |
387 | if (ir) { | |
388 | yp->parent = x; | |
389 | setnormal(y); | |
390 | setroot(x); | |
391 | } else { | |
392 | if (rl) { | |
393 | yp->flink = x; | |
394 | setleft(x); | |
395 | } else { | |
396 | yp->blink = x; | |
397 | setright(x); | |
398 | } | |
399 | } | |
400 | } | |
401 | ||
402 | void jrb_delete_node(JRB n) | |
403 | { | |
404 | JRB s, p, gp; | |
405 | char ir; | |
406 | ||
407 | if (isint(n)) { | |
408 | fprintf(stderr, "Cannot delete an internal node: 0x%p\n", n); | |
409 | exit(1); | |
410 | } | |
411 | if (ishead(n)) { | |
412 | fprintf(stderr, "Cannot delete the head of an jrb_tree: 0x%p\n", n); | |
413 | exit(1); | |
414 | } | |
415 | delete_item(n); /* Delete it from the list */ | |
416 | p = n->parent; /* The only node */ | |
417 | if (isroot(n)) { | |
418 | p->parent = p; | |
419 | free(n); | |
420 | return; | |
421 | } | |
422 | s = sibling(n); /* The only node after deletion */ | |
423 | if (isroot(p)) { | |
424 | s->parent = p->parent; | |
425 | s->parent->parent = s; | |
426 | setroot(s); | |
427 | free(p); | |
428 | free(n); | |
429 | return; | |
430 | } | |
431 | gp = p->parent; /* Set parent to sibling */ | |
432 | s->parent = gp; | |
433 | if (isleft(p)) { | |
434 | gp->flink = s; | |
435 | setleft(s); | |
436 | } else { | |
437 | gp->blink = s; | |
438 | setright(s); | |
439 | } | |
440 | ir = isred(p); | |
441 | free(p); | |
442 | free(n); | |
443 | ||
444 | if (isext(s)) { /* Update proper rext and lext values */ | |
445 | p = lprev(s); | |
446 | if (!ishead(p)) setrext(p, s); | |
447 | p = rprev(s); | |
448 | if (!ishead(p)) setlext(p, s); | |
449 | } else if (isblack(s)) { | |
450 | fprintf(stderr, "DELETION PROB -- sib is black, internal\n"); | |
451 | exit(1); | |
452 | } else { | |
453 | p = lprev(s); | |
454 | if (!ishead(p)) setrext(p, s->flink); | |
455 | p = rprev(s); | |
456 | if (!ishead(p)) setlext(p, s->blink); | |
457 | setblack(s); | |
458 | return; | |
459 | } | |
460 | ||
461 | if (ir) return; | |
462 | ||
463 | /* Recolor */ | |
464 | ||
465 | n = s; | |
466 | p = n->parent; | |
467 | s = sibling(n); | |
468 | while(isblack(p) && isblack(s) && isint(s) && | |
469 | isblack(s->flink) && isblack(s->blink)) { | |
470 | setred(s); | |
471 | n = p; | |
472 | if (isroot(n)) return; | |
473 | p = n->parent; | |
474 | s = sibling(n); | |
475 | } | |
476 | ||
477 | if (isblack(p) && isred(s)) { /* Rotation 2.3b */ | |
478 | single_rotate(p, isright(n)); | |
479 | setred(p); | |
480 | setblack(s); | |
481 | s = sibling(n); | |
482 | } | |
483 | ||
484 | { JRB x, z; char il; | |
485 | ||
486 | if (isext(s)) { | |
487 | fprintf(stderr, "DELETION ERROR: sibling not internal\n"); | |
488 | exit(1); | |
489 | } | |
490 | ||
491 | il = isleft(n); | |
492 | x = il ? s->flink : s->blink ; | |
493 | z = sibling(x); | |
494 | ||
495 | if (isred(z)) { /* Rotation 2.3f */ | |
496 | single_rotate(p, !il); | |
497 | setblack(z); | |
498 | if (isred(p)) setred(s); else setblack(s); | |
499 | setblack(p); | |
500 | } else if (isblack(x)) { /* Recoloring only (2.3c) */ | |
501 | if (isred(s) || isblack(p)) { | |
502 | fprintf(stderr, "DELETION ERROR: 2.3c not quite right\n"); | |
503 | exit(1); | |
504 | } | |
505 | setblack(p); | |
506 | setred(s); | |
507 | return; | |
508 | } else if (isred(p)) { /* 2.3d */ | |
509 | single_rotate(s, il); | |
510 | single_rotate(p, !il); | |
511 | setblack(x); | |
512 | setred(s); | |
513 | return; | |
514 | } else { /* 2.3e */ | |
515 | single_rotate(s, il); | |
516 | single_rotate(p, !il); | |
517 | setblack(x); | |
518 | return; | |
519 | } | |
520 | } | |
521 | } | |
522 | ||
523 | int jrb_nblack(JRB n) | |
524 | { | |
525 | int nb; | |
526 | if (ishead(n) || isint(n)) { | |
527 | fprintf(stderr, "ERROR: jrb_nblack called on a non-external node 0x%p\n", | |
528 | n); | |
529 | exit(1); | |
530 | } | |
531 | nb = 0; | |
532 | while(!ishead(n)) { | |
533 | if (isblack(n)) nb++; | |
534 | n = n->parent; | |
535 | } | |
536 | return nb; | |
537 | } | |
538 | ||
539 | int jrb_plength(JRB n) | |
540 | { | |
541 | int pl; | |
542 | if (ishead(n) || isint(n)) { | |
543 | fprintf(stderr, "ERROR: jrb_plength called on a non-external node 0x%p\n", | |
544 | n); | |
545 | exit(1); | |
546 | } | |
547 | pl = 0; | |
548 | while(!ishead(n)) { | |
549 | pl++; | |
550 | n = n->parent; | |
551 | } | |
552 | return pl; | |
553 | } | |
554 | ||
555 | void jrb_free_tree(JRB n) | |
556 | { | |
557 | if (!ishead(n)) { | |
558 | fprintf(stderr, "ERROR: Rb_free_tree called on a non-head node\n"); | |
559 | exit(1); | |
560 | } | |
561 | ||
562 | while(jrb_first(n) != jrb_nil(n)) { | |
563 | jrb_delete_node(jrb_first(n)); | |
564 | } | |
565 | free(n); | |
566 | } | |
567 | ||
568 | Jval jrb_val(JRB n) | |
569 | { | |
570 | return n->val; | |
571 | } | |
572 | ||
573 | JRB jrb_insert_str(JRB tree, char *key, Jval val) | |
574 | { | |
575 | Jval k; | |
576 | int fnd; | |
577 | ||
578 | k.s = key; | |
579 | return jrb_insert_b(jrb_find_gte_str(tree, key, &fnd), k, val); | |
580 | } | |
581 | ||
582 | JRB jrb_insert_int(JRB tree, int ikey, Jval val) | |
583 | { | |
584 | Jval k; | |
585 | int fnd; | |
586 | ||
587 | k.i = ikey; | |
588 | return jrb_insert_b(jrb_find_gte_int(tree, ikey, &fnd), k, val); | |
589 | } | |
590 | ||
591 | JRB jrb_insert_vptr(JRB tree, void *vkey, Jval val) | |
592 | { | |
593 | Jval k; | |
594 | int fnd; | |
595 | ||
596 | k.v = vkey; | |
597 | return jrb_insert_b(jrb_find_gte_vptr(tree, vkey, &fnd), k, val); | |
598 | } | |
599 | ||
600 | JRB jrb_insert_gen(JRB tree, Jval key, Jval val, | |
601 | int (*func)(Jval, Jval)) | |
602 | { | |
603 | int fnd; | |
604 | ||
605 | return jrb_insert_b(jrb_find_gte_gen(tree, key, func, &fnd), key, val); | |
606 | } | |
607 | ||
608 | /* | |
609 | * $Id: jrb.c,v 1.2 2008/07/18 17:30:58 gtkwave Exp $ | |
610 | * $Log: jrb.c,v $ | |
611 | * Revision 1.2 2008/07/18 17:30:58 gtkwave | |
612 | * adding cvs headers | |
613 | * | |
614 | * Revision 1.1 2008/07/18 17:27:01 gtkwave | |
615 | * adding hierpack code | |
616 | * | |
617 | */ | |
618 |
0 | #ifndef _JRB_H_ | |
1 | #define _JRB_H_ | |
2 | ||
3 | /* The Jval -- a type that can hold any 8-byte type */ | |
4 | ||
5 | typedef union { | |
6 | int i; | |
7 | long l; | |
8 | float f; | |
9 | double d; | |
10 | void *v; | |
11 | char *s; | |
12 | char c; | |
13 | unsigned char uc; | |
14 | short sh; | |
15 | unsigned short ush; | |
16 | unsigned int ui; | |
17 | int iarray[2]; | |
18 | float farray[2]; | |
19 | char carray[8]; | |
20 | unsigned char ucarray[8]; | |
21 | } Jval; | |
22 | ||
23 | struct jrb_chain { /* added for rtlbrowse */ | |
24 | struct jrb_chain *next; | |
25 | Jval val; | |
26 | }; | |
27 | ||
28 | /* Main jrb_node. You only ever use the fields | |
29 | flink | |
30 | blink | |
31 | k.key or k.ikey | |
32 | v.val | |
33 | */ | |
34 | typedef struct jrb_node { | |
35 | unsigned char red; | |
36 | unsigned char internal; | |
37 | unsigned char left; | |
38 | unsigned char roothead; /* (bit 1 is root, bit 2 is head) */ | |
39 | struct jrb_node *flink; | |
40 | struct jrb_node *blink; | |
41 | struct jrb_node *parent; | |
42 | Jval key; | |
43 | Jval val; | |
44 | } *JRB; | |
45 | ||
46 | ||
47 | extern JRB make_jrb(); /* Creates a new rb-tree */ | |
48 | ||
49 | ||
50 | /* Creates a node with key key and val val and inserts it into the tree. | |
51 | jrb_insert uses strcmp() as comparison funcion. jrb_inserti uses <>=, | |
52 | jrb_insertg uses func() */ | |
53 | ||
54 | extern JRB jrb_insert_str(JRB tree, char *key, Jval val); | |
55 | extern JRB jrb_insert_int(JRB tree, int ikey, Jval val); | |
56 | extern JRB jrb_insert_vptr(JRB tree, void *vkey, Jval val); | |
57 | extern JRB jrb_insert_gen(JRB tree, Jval key, Jval val, int (*func)(Jval,Jval)); | |
58 | ||
59 | /* returns an external node in t whose value is equal k. Returns NULL if | |
60 | there is no such node in the tree */ | |
61 | ||
62 | extern JRB jrb_find_str(JRB root, char *key); | |
63 | extern JRB jrb_find_int(JRB root, int ikey); | |
64 | extern JRB jrb_find_vptr(JRB root, void *vkey); | |
65 | extern JRB jrb_find_gen(JRB root, Jval, int (*func)(Jval, Jval)); | |
66 | ||
67 | ||
68 | /* returns an external node in t whose value is equal | |
69 | k or whose value is the smallest value greater than k. Sets found to | |
70 | 1 if the key was found, and 0 otherwise. */ | |
71 | ||
72 | extern JRB jrb_find_gte_str(JRB root, char *key, int *found); | |
73 | extern JRB jrb_find_gte_int(JRB root, int ikey, int *found); | |
74 | extern JRB jrb_find_gte_vptr(JRB root, void *vkey, int *found); | |
75 | extern JRB jrb_find_gte_gen(JRB root, Jval key, | |
76 | int (*func)(Jval, Jval), int *found); | |
77 | ||
78 | ||
79 | /* Creates a node with key key and val val and inserts it into the | |
80 | tree before/after node nd. Does not check to ensure that you are | |
81 | keeping the correct order */ | |
82 | ||
83 | extern void jrb_delete_node(JRB node); /* Deletes and frees a node (but | |
84 | not the key or val) */ | |
85 | extern void jrb_free_tree(JRB root); /* Deletes and frees an entire tree */ | |
86 | ||
87 | extern Jval jrb_val(JRB node); /* Returns node->v.val -- this is to shut | |
88 | lint up */ | |
89 | ||
90 | extern int jrb_nblack(JRB n); /* returns # of black nodes in path from | |
91 | n to the root */ | |
92 | int jrb_plength(JRB n); /* returns the # of nodes in path from | |
93 | n to the root */ | |
94 | ||
95 | #define jrb_first(n) (n->flink) | |
96 | #define jrb_last(n) (n->blink) | |
97 | #define jrb_next(n) (n->flink) | |
98 | #define jrb_prev(n) (n->blink) | |
99 | #define jrb_empty(t) (t->flink == t) | |
100 | #ifndef jrb_nil | |
101 | #define jrb_nil(t) (t) | |
102 | #endif | |
103 | ||
104 | #define jrb_traverse(ptr, lst) \ | |
105 | for(ptr = jrb_first(lst); ptr != jrb_nil(lst); ptr = jrb_next(ptr)) | |
106 | ||
107 | #define jrb_rtraverse(ptr, lst) \ | |
108 | for(ptr = jrb_last(lst); ptr != jrb_nil(lst); ptr = jrb_prev(ptr)) | |
109 | ||
110 | #endif | |
111 | ||
112 | /* | |
113 | * $Id: jrb.h,v 1.2 2008/07/18 17:30:58 gtkwave Exp $ | |
114 | * $Log: jrb.h,v $ | |
115 | * Revision 1.2 2008/07/18 17:30:58 gtkwave | |
116 | * adding cvs headers | |
117 | * | |
118 | * Revision 1.1 2008/07/18 17:27:01 gtkwave | |
119 | * adding hierpack code | |
120 | * | |
121 | */ | |
122 |
0 | 0 | /* |
1 | * Copyright (c) Tony Bybell 2003-2006. | |
1 | * Copyright (c) Tony Bybell 2003-2008. | |
2 | 2 | * |
3 | 3 | * This program is free software; you can redistribute it and/or |
4 | 4 | * modify it under the terms of the GNU General Public License |
25 | 25 | #include "lxt2_read.h" |
26 | 26 | #include "debug.h" |
27 | 27 | #include "busy.h" |
28 | #include "hierpack.h" | |
28 | 29 | |
29 | 30 | |
30 | 31 | /* |
39 | 40 | unsigned int numalias = 0; |
40 | 41 | struct symbol *sym_block = NULL; |
41 | 42 | struct Node *node_block = NULL; |
43 | JRB ptr, lst; | |
42 | 44 | |
43 | 45 | GLOBALS->lx2_lx2_c_1 = lxt2_rd_init(fname); |
44 | 46 | if(!GLOBALS->lx2_lx2_c_1) |
85 | 87 | if(GLOBALS->numfacs) |
86 | 88 | { |
87 | 89 | char *fnam = lxt2_rd_get_facname(GLOBALS->lx2_lx2_c_1, 0); |
88 | int flen = strlen(fnam); | |
89 | ||
90 | GLOBALS->mvlfacs_lx2_c_1[0].name=malloc_2(flen+1); | |
91 | strcpy(GLOBALS->mvlfacs_lx2_c_1[0].name, fnam); | |
90 | char *pnt; | |
91 | int was_packed = 0; | |
92 | ||
93 | if(GLOBALS->do_hier_compress) | |
94 | { | |
95 | pnt = hier_compress(fnam, HIERPACK_ADD, &was_packed); | |
96 | } | |
97 | ||
98 | if(was_packed) | |
99 | { | |
100 | GLOBALS->mvlfacs_lx2_c_1[0].name = pnt; | |
101 | } | |
102 | else | |
103 | { | |
104 | int flen = strlen(fnam); | |
105 | GLOBALS->mvlfacs_lx2_c_1[0].name=malloc_2(flen+1); | |
106 | strcpy(GLOBALS->mvlfacs_lx2_c_1[0].name, fnam); | |
107 | } | |
92 | 108 | } |
93 | 109 | |
94 | 110 | for(i=0;i<GLOBALS->numfacs;i++) |
100 | 116 | if(i!=(GLOBALS->numfacs-1)) |
101 | 117 | { |
102 | 118 | char *fnam = lxt2_rd_get_facname(GLOBALS->lx2_lx2_c_1, i+1); |
103 | int flen = strlen(fnam); | |
104 | ||
105 | GLOBALS->mvlfacs_lx2_c_1[i+1].name=malloc_2(flen+1); | |
106 | strcpy(GLOBALS->mvlfacs_lx2_c_1[i+1].name, fnam); | |
119 | char *pnt; | |
120 | int was_packed = 0; | |
121 | ||
122 | if(GLOBALS->do_hier_compress) | |
123 | { | |
124 | pnt = hier_compress(fnam, HIERPACK_ADD, &was_packed); | |
125 | } | |
126 | ||
127 | if(was_packed) | |
128 | { | |
129 | GLOBALS->mvlfacs_lx2_c_1[i+1].name = pnt; | |
130 | } | |
131 | else | |
132 | { | |
133 | int flen = strlen(fnam); | |
134 | GLOBALS->mvlfacs_lx2_c_1[i+1].name=malloc_2(flen+1); | |
135 | strcpy(GLOBALS->mvlfacs_lx2_c_1[i+1].name, fnam); | |
136 | } | |
107 | 137 | } |
108 | 138 | |
109 | 139 | if(i>1) |
237 | 267 | } |
238 | 268 | } |
239 | 269 | |
270 | GLOBALS->pfx_hier_array = calloc_2(GLOBALS->hier_pfx_cnt ? GLOBALS->hier_pfx_cnt : 1, sizeof(char *)); | |
271 | ||
272 | lst = GLOBALS->hier_pfx; | |
273 | if(lst) | |
274 | { | |
275 | jrb_traverse(ptr, lst) | |
276 | { | |
277 | GLOBALS->pfx_hier_array[ptr->val.ui] = ptr->key.s; | |
278 | } | |
279 | } | |
240 | 280 | |
241 | 281 | /* SPLASH */ splash_sync(2, 5); |
242 | 282 | GLOBALS->facs=(struct symbol **)malloc_2(GLOBALS->numfacs*sizeof(struct symbol *)); |
243 | 283 | |
244 | if(GLOBALS->fast_tree_sort) | |
284 | if((GLOBALS->fast_tree_sort) && (!GLOBALS->do_hier_compress)) | |
245 | 285 | { |
246 | 286 | GLOBALS->curnode=GLOBALS->firstnode; |
247 | 287 | for(i=0;i<GLOBALS->numfacs;i++) |
352 | 392 | init_tree(); |
353 | 393 | for(i=0;i<GLOBALS->numfacs;i++) |
354 | 394 | { |
355 | build_tree_from_name(GLOBALS->facs[i]->name, i); | |
395 | char *n = GLOBALS->facs[i]->name; | |
396 | int was_packed; | |
397 | char *recon = hier_decompress_flagged(n, &was_packed); | |
398 | ||
399 | if(was_packed) | |
400 | { | |
401 | build_tree_from_name(recon, i); | |
402 | free_2(recon); | |
403 | } | |
404 | else | |
405 | { | |
406 | build_tree_from_name(n, i); | |
407 | } | |
356 | 408 | } |
357 | 409 | /* SPLASH */ splash_sync(5, 5); |
358 | 410 | treegraft(GLOBALS->treeroot); |
359 | 411 | treesort(GLOBALS->treeroot, NULL); |
412 | } | |
413 | ||
414 | if(GLOBALS->prev_hier_uncompressed_name) | |
415 | { | |
416 | free_2(GLOBALS->prev_hier_uncompressed_name); | |
417 | GLOBALS->prev_hier_uncompressed_name = NULL; | |
360 | 418 | } |
361 | 419 | |
362 | 420 | GLOBALS->min_time = GLOBALS->first_cycle_lx2_c_1; GLOBALS->max_time=GLOBALS->last_cycle_lx2_c_1; |
580 | 638 | if(f->flags&LXT2_RD_SYM_F_STRING) np->head.flags |= HIST_STRING; |
581 | 639 | } |
582 | 640 | |
641 | { | |
642 | struct HistEnt *htemp2 = calloc_2(1, sizeof(struct HistEnt)); | |
643 | htemp2->time = -1; | |
644 | if(len>1) | |
645 | { | |
646 | htemp2->v.h_vector = htemp->v.h_vector; | |
647 | } | |
648 | else | |
649 | { | |
650 | htemp2->v.h_val = htemp->v.h_val; | |
651 | } | |
652 | htemp2->next = htemp; | |
653 | htemp = htemp2; | |
654 | GLOBALS->lx2_table_lx2_c_1[txidx].numtrans++; | |
655 | } | |
656 | ||
583 | 657 | np->head.time = -2; |
584 | 658 | np->head.next = htemp; |
585 | 659 | np->numhist=GLOBALS->lx2_table_lx2_c_1[txidx].numtrans +2 /*endcap*/ +1 /*frontcap*/; |
727 | 801 | if(f->flags&LXT2_RD_SYM_F_STRING) np->head.flags |= HIST_STRING; |
728 | 802 | } |
729 | 803 | |
804 | { | |
805 | struct HistEnt *htemp2 = calloc_2(1, sizeof(struct HistEnt)); | |
806 | htemp2->time = -1; | |
807 | if(len>1) | |
808 | { | |
809 | htemp2->v.h_vector = htemp->v.h_vector; | |
810 | } | |
811 | else | |
812 | { | |
813 | htemp2->v.h_val = htemp->v.h_val; | |
814 | } | |
815 | htemp2->next = htemp; | |
816 | htemp = htemp2; | |
817 | GLOBALS->lx2_table_lx2_c_1[txidx].numtrans++; | |
818 | } | |
819 | ||
730 | 820 | np->head.time = -2; |
731 | 821 | np->head.next = htemp; |
732 | 822 | np->numhist=GLOBALS->lx2_table_lx2_c_1[txidx].numtrans +2 /*endcap*/ +1 /*frontcap*/; |
741 | 831 | } |
742 | 832 | |
743 | 833 | /* |
744 | * $Id: lx2.c,v 1.2 2007/08/26 21:35:41 gtkwave Exp $ | |
834 | * $Id: lx2.c,v 1.4 2008/07/20 20:48:08 gtkwave Exp $ | |
745 | 835 | * $Log: lx2.c,v $ |
836 | * Revision 1.4 2008/07/20 20:48:08 gtkwave | |
837 | * compressed hierarchy support | |
838 | * | |
839 | * Revision 1.3 2008/06/15 21:26:45 gtkwave | |
840 | * time -1 endcap add for LXT2 + VZT loaders | |
841 | * | |
746 | 842 | * Revision 1.2 2007/08/26 21:35:41 gtkwave |
747 | 843 | * integrated global context management from SystemOfCode2007 branch |
748 | 844 | * |
30 | 30 | #include "lxt.h" |
31 | 31 | #include "bsearch.h" |
32 | 32 | #include "debug.h" |
33 | #include "hierpack.h" | |
33 | 34 | |
34 | 35 | /****************************************************************************/ |
35 | 36 | |
145 | 146 | */ |
146 | 147 | |
147 | 148 | inline static unsigned int get_byte(offset) { |
148 | return ((unsigned int)(*((unsigned char *)mm+(offset)))); | |
149 | } | |
150 | ||
151 | inline static unsigned int define get_16(offset) { | |
152 | return ((unsigned int)(*((unsigned short *)(((unsigned char *)mm)+(offset)))) | |
153 | } | |
154 | ||
155 | inline static usigned int get_32(offset) { | |
156 | return (*(unsigned int *)(((unsigned char *)mm)+(offset))); | |
149 | return ((unsigned int)(*((unsigned char *)(GLOBALS->mm_lxt_c_1)+(offset)))); | |
150 | } | |
151 | ||
152 | inline static unsigned int get_16(offset) { | |
153 | return ((unsigned int)(*((unsigned short *)(((unsigned char *)(GLOBALS->mm_lxt_c_1)) | |
154 | +(offset))))); | |
155 | } | |
156 | ||
157 | inline static unsigned int get_32(offset) { | |
158 | return (*(unsigned int *)(((unsigned char *)(GLOBALS->mm_lxt_c_1))+(offset))); | |
157 | 159 | } |
158 | 160 | |
159 | 161 | inline static unsigned int get_24(offset) { |
160 | 162 | return ((get_32((offset)-1)<<8)>>8); |
161 | 163 | } |
162 | 164 | |
163 | inline static usigned int get_64(offset) { | |
164 | return ((((UTimeType)get_32(offset))<<32)|((UTimeType)get_32((offset)+4))) | |
165 | } | |
166 | ||
165 | inline static unsigned int get_64(offset) { | |
166 | return ((((UTimeType)get_32(offset))<<32)|((UTimeType)get_32((offset)+4))); | |
167 | } | |
168 | ||
167 | 169 | #else |
168 | 170 | |
169 | 171 | /* |
431 | 433 | int total_mem = get_32(GLOBALS->facname_offset_lxt_c_1+4); |
432 | 434 | gzFile zhandle = NULL; |
433 | 435 | char *decmem=NULL; |
436 | JRB ptr, lst; | |
437 | ||
434 | 438 | |
435 | 439 | #if defined __MINGW32__ || defined _MSC_VER |
436 | 440 | FILE *tmp; |
437 | 441 | #endif |
438 | 442 | |
439 | buf=malloc_2(total_mem); | |
440 | pnt=bufprev=buf; | |
443 | if(!GLOBALS->do_hier_compress) | |
444 | { | |
445 | buf=malloc_2(total_mem); | |
446 | pnt=bufprev=buf; | |
447 | } | |
441 | 448 | |
442 | 449 | if(GLOBALS->zfacname_size_lxt_c_1) |
443 | 450 | { |
463 | 470 | offs=0; /* we're in our new memory region now.. */ |
464 | 471 | } |
465 | 472 | |
466 | fprintf(stderr, LXTHDR"Building %d facilities.\n", GLOBALS->numfacs); | |
467 | for(i=0;i<GLOBALS->numfacs;i++) | |
468 | { | |
469 | clone=get_16(offs); offs+=2; | |
470 | bufcurr=pnt; | |
471 | for(j=0;j<clone;j++) | |
472 | { | |
473 | *(pnt++) = *(bufprev++); | |
474 | } | |
475 | while((*(pnt++)=get_byte(offs++))); | |
476 | GLOBALS->mvlfacs_lxt_c_2[i].name=bufcurr; | |
477 | DEBUG(printf(LXTHDR"Encountered facility %d: '%s'\n", i, bufcurr)); | |
478 | bufprev=bufcurr; | |
473 | if(GLOBALS->do_hier_compress) | |
474 | { | |
475 | char workspace[4097]; | |
476 | int was_packed; | |
477 | char *string_ret; | |
478 | ||
479 | workspace[0] = 0; | |
480 | ||
481 | fprintf(stderr, LXTHDR"Building %d compressed facilities.\n", GLOBALS->numfacs); | |
482 | for(i=0;i<GLOBALS->numfacs;i++) | |
483 | { | |
484 | clone=get_16(offs); offs+=2; | |
485 | pnt=workspace+clone; | |
486 | while((*(pnt++)=get_byte(offs++))); | |
487 | string_ret = hier_compress(workspace, HIERPACK_ADD, &was_packed); | |
488 | if(was_packed) | |
489 | { | |
490 | GLOBALS->mvlfacs_lxt_c_2[i].name=string_ret; | |
491 | } | |
492 | else | |
493 | { | |
494 | GLOBALS->mvlfacs_lxt_c_2[i].name=strdup_2(workspace); | |
495 | } | |
496 | } | |
497 | } | |
498 | else | |
499 | { | |
500 | fprintf(stderr, LXTHDR"Building %d facilities.\n", GLOBALS->numfacs); | |
501 | for(i=0;i<GLOBALS->numfacs;i++) | |
502 | { | |
503 | clone=get_16(offs); offs+=2; | |
504 | bufcurr=pnt; | |
505 | for(j=0;j<clone;j++) | |
506 | { | |
507 | *(pnt++) = *(bufprev++); | |
508 | } | |
509 | while((*(pnt++)=get_byte(offs++))); | |
510 | GLOBALS->mvlfacs_lxt_c_2[i].name=bufcurr; | |
511 | DEBUG(printf(LXTHDR"Encountered facility %d: '%s'\n", i, bufcurr)); | |
512 | bufprev=bufcurr; | |
513 | } | |
514 | } | |
515 | ||
516 | GLOBALS->pfx_hier_array = calloc_2(GLOBALS->hier_pfx_cnt ? GLOBALS->hier_pfx_cnt : 1, sizeof(char *)); | |
517 | lst = GLOBALS->hier_pfx; | |
518 | if(lst) | |
519 | { | |
520 | jrb_traverse(ptr, lst) | |
521 | { | |
522 | GLOBALS->pfx_hier_array[ptr->val.ui] = ptr->key.s; | |
523 | } | |
479 | 524 | } |
525 | ||
526 | if(GLOBALS->prev_hier_uncompressed_name) { free_2(GLOBALS->prev_hier_uncompressed_name); GLOBALS->prev_hier_uncompressed_name = NULL; } | |
480 | 527 | |
481 | 528 | if(GLOBALS->zfacname_size_lxt_c_1) |
482 | 529 | { |
1740 | 1787 | init_tree(); |
1741 | 1788 | for(i=0;i<GLOBALS->numfacs;i++) |
1742 | 1789 | { |
1743 | build_tree_from_name(GLOBALS->facs[i]->name, i); | |
1790 | char *n = GLOBALS->facs[i]->name; | |
1791 | int was_packed; | |
1792 | char *recon = hier_decompress_flagged(n, &was_packed); | |
1793 | ||
1794 | if(was_packed) | |
1795 | { | |
1796 | build_tree_from_name(recon, i); | |
1797 | free_2(recon); | |
1798 | } | |
1799 | else | |
1800 | { | |
1801 | build_tree_from_name(n, i); | |
1802 | } | |
1744 | 1803 | } |
1745 | 1804 | /* SPLASH */ splash_sync(5, 5); |
1746 | 1805 | treegraft(GLOBALS->treeroot); |
2316 | 2375 | } |
2317 | 2376 | |
2318 | 2377 | /* |
2319 | * $Id: lxt.c,v 1.3 2008/02/22 22:08:06 gtkwave Exp $ | |
2378 | * $Id: lxt.c,v 1.5 2008/07/22 18:46:16 gtkwave Exp $ | |
2320 | 2379 | * $Log: lxt.c,v $ |
2380 | * Revision 1.5 2008/07/22 18:46:16 gtkwave | |
2381 | * add compressed hierarchy handling to lxt reader | |
2382 | * | |
2383 | * Revision 1.4 2008/07/18 18:22:58 gtkwave | |
2384 | * fixes for aix | |
2385 | * | |
2321 | 2386 | * Revision 1.3 2008/02/22 22:08:06 gtkwave |
2322 | 2387 | * fix of previously undetected linear lxt reader bug involving integers |
2323 | 2388 | * |
69 | 69 | guint page_num, |
70 | 70 | gpointer user_data) |
71 | 71 | { |
72 | int i; | |
73 | 72 | char timestr[32]; |
74 | 73 | struct Global *g_old = GLOBALS; |
75 | 74 | |
198 | 197 | " -S, --script=FILE specify GUI command script file for execution\n" |
199 | 198 | XID_GETOPT |
200 | 199 | INTR_GETOPT |
200 | " -C, --comphier use compressed hierarchy names (slower)\n" | |
201 | 201 | " -g, --giga use gigabyte mempacking when recoding (slower)\n" |
202 | 202 | " -L, --legacy use legacy VCD mode rather than the VCD recoder\n" |
203 | 203 | " -v, --vcd use stdin as a VCD dumpfile\n" |
250 | 250 | |
251 | 251 | |
252 | 252 | int main(int argc, char *argv[]) |
253 | { | |
254 | return(main_2(argc, argv)); | |
255 | } | |
256 | ||
257 | int main_2(int argc, char *argv[]) | |
253 | 258 | { |
254 | 259 | static char *winprefix="GTKWave - "; |
255 | 260 | static char *winstd="GTKWave (stdio) "; |
271 | 276 | FILE *wave = NULL; |
272 | 277 | FILE *vcd_save_handle_cached = NULL; |
273 | 278 | |
274 | GtkWidget *main_vbox, *top_table, *whole_table; | |
279 | GtkWidget *main_vbox = NULL, *top_table = NULL, *whole_table = NULL; | |
275 | 280 | GtkWidget *menubar; |
276 | 281 | GtkWidget *text1; |
277 | 282 | GtkWidget *zoombuttons; |
498 | 503 | {"dualid", 1, 0, 'D'}, |
499 | 504 | {"interactive", 0, 0, 'I'}, |
500 | 505 | {"giga", 0, 0, 'g'}, |
506 | {"comphier", 0, 0, 'C'}, | |
501 | 507 | {"legacy", 0, 0, 'L'}, |
502 | 508 | {0, 0, 0, 0} |
503 | 509 | }; |
504 | 510 | |
505 | c = getopt_long (argc, argv, "f:on:a:Ar:di:l:s:e:c:t:NS:vVhxX:MD:IgL", long_options, &option_index); | |
511 | c = getopt_long (argc, argv, "f:on:a:Ar:di:l:s:e:c:t:NS:vVhxX:MD:IgCL", long_options, &option_index); | |
506 | 512 | |
507 | 513 | if (c == -1) break; /* no more args */ |
508 | 514 | |
699 | 705 | |
700 | 706 | case 'g': |
701 | 707 | is_giga = 1; |
708 | break; | |
709 | ||
710 | case 'C': | |
711 | GLOBALS->do_hier_compress = 1; | |
702 | 712 | break; |
703 | 713 | |
704 | 714 | case '?': |
1159 | 1169 | } |
1160 | 1170 | } |
1161 | 1171 | |
1162 | if(GLOBALS->force_toolbars) | |
1163 | { | |
1164 | toolhandle=gtk_handle_box_new(); | |
1165 | gtk_widget_show(toolhandle); | |
1166 | gtk_container_add(GTK_CONTAINER(toolhandle), top_table); | |
1167 | } | |
1168 | ||
1169 | 1172 | whole_table = gtk_table_new (256, 16, FALSE); |
1170 | 1173 | |
1171 | 1174 | tb = gtk_toolbar_new(); |
1173 | 1176 | |
1174 | 1177 | gtk_toolbar_set_style(GTK_TOOLBAR(tb), GTK_TOOLBAR_ICONS); |
1175 | 1178 | tb_pos = 0; |
1179 | ||
1180 | if(GLOBALS->force_toolbars) | |
1181 | { | |
1182 | toolhandle=gtk_handle_box_new(); | |
1183 | gtk_widget_show(toolhandle); | |
1184 | gtk_container_add(GTK_CONTAINER(toolhandle), top_table); | |
1185 | } | |
1176 | 1186 | |
1177 | 1187 | stock = gtk_toolbar_insert_stock(GTK_TOOLBAR(tb), |
1178 | 1188 | GTK_STOCK_CUT, |
2037 | 2047 | #endif |
2038 | 2048 | |
2039 | 2049 | /* |
2040 | * $Id: main.c,v 1.28 2008/04/03 16:45:06 gtkwave Exp $ | |
2050 | * $Id: main.c,v 1.31 2008/07/20 01:29:36 gtkwave Exp $ | |
2041 | 2051 | * $Log: main.c,v $ |
2052 | * Revision 1.31 2008/07/20 01:29:36 gtkwave | |
2053 | * added command line option --comphier | |
2054 | * | |
2055 | * Revision 1.30 2008/07/01 18:51:06 gtkwave | |
2056 | * compiler warning fixes for amd64 | |
2057 | * | |
2058 | * Revision 1.29 2008/06/11 08:01:50 gtkwave | |
2059 | * gcc 4.3.x compiler warning fixes | |
2060 | * | |
2042 | 2061 | * Revision 1.28 2008/04/03 16:45:06 gtkwave |
2043 | 2062 | * removed call to time_trunc with marker setting on initialization |
2044 | 2063 | * |
21 | 21 | char *name; |
22 | 22 | }; |
23 | 23 | |
24 | int main_2(int argc, char *argv[]); | |
24 | 25 | |
25 | 26 | GtkWidget *create_text(void); |
26 | 27 | GtkWidget *create_zoom_buttons(void); |
72 | 73 | #endif |
73 | 74 | |
74 | 75 | /* |
75 | * $Id: main.h,v 1.3 2007/12/30 04:27:39 gtkwave Exp $ | |
76 | * $Id: main.h,v 1.4 2008/07/01 18:51:07 gtkwave Exp $ | |
76 | 77 | * $Log: main.h,v $ |
78 | * Revision 1.4 2008/07/01 18:51:07 gtkwave | |
79 | * compiler warning fixes for amd64 | |
80 | * | |
77 | 81 | * Revision 1.3 2007/12/30 04:27:39 gtkwave |
78 | 82 | * added edge buttons to main window |
79 | 83 | * |
23 | 23 | #include "translate.h" |
24 | 24 | #include "ptranslate.h" |
25 | 25 | #include "lx2.h" |
26 | #include "hierpack.h" | |
26 | 27 | |
27 | 28 | #if !defined __MINGW32__ && !defined _MSC_VER |
28 | 29 | #include <unistd.h> |
597 | 598 | { |
598 | 599 | if(!GLOBALS->hier_max_level) |
599 | 600 | { |
600 | t->name = t->n.nd->nname; | |
601 | int flagged; | |
602 | ||
603 | if(t->is_depacked) { free_2(t->name); } | |
604 | t->name = hier_decompress_flagged(t->n.nd->nname, &flagged); | |
605 | t->is_depacked = (flagged != 0); | |
601 | 606 | } |
602 | 607 | else |
603 | 608 | { |
604 | t->name = hier_extract(t->n.nd->nname, GLOBALS->hier_max_level); | |
609 | int flagged; | |
610 | char *tbuff = hier_decompress_flagged(t->n.nd->nname, &flagged); | |
611 | ||
612 | if(t->is_depacked) { free_2(t->name); } | |
613 | t->is_depacked = (flagged != 0); | |
614 | if(!flagged) | |
615 | { | |
616 | t->name = hier_extract(t->n.nd->nname, GLOBALS->hier_max_level); | |
617 | } | |
618 | else | |
619 | { | |
620 | t->name = strdup_2(hier_extract(tbuff, GLOBALS->hier_max_level)); | |
621 | free_2(tbuff); | |
622 | } | |
605 | 623 | } |
606 | 624 | } |
607 | 625 | } |
1051 | 1069 | unsigned np = GLOBALS->num_notebook_pages; |
1052 | 1070 | unsigned int new_page = (this_page != np-1) ? this_page : (this_page-1); |
1053 | 1071 | GtkWidget *n = GLOBALS->notebook; |
1054 | struct Global *old_g, *saved_g; | |
1072 | struct Global *old_g = NULL, *saved_g; | |
1055 | 1073 | |
1056 | 1074 | dead_context_sweep(); |
1057 | 1075 | |
1858 | 1876 | void |
1859 | 1877 | menu_new_viewer_tab_cleanup(GtkWidget *widget, gpointer data) |
1860 | 1878 | { |
1861 | pid_t pid; | |
1862 | ||
1863 | 1879 | if(GLOBALS->filesel_ok) |
1864 | 1880 | { |
1865 | 1881 | char *argv[2]; |
1876 | 1892 | |
1877 | 1893 | if(!setjmp(*(GLOBALS->vcd_jmp_buf))) |
1878 | 1894 | { |
1879 | main(2, argv); | |
1895 | main_2(2, argv); | |
1880 | 1896 | |
1881 | 1897 | g_now = GLOBALS; |
1882 | 1898 | set_GLOBALS(g_old); |
2560 | 2576 | |
2561 | 2577 | static char *append_array_row(nptr n) |
2562 | 2578 | { |
2579 | int was_packed; | |
2580 | char *hname = hier_decompress_flagged(n->nname, &was_packed); | |
2581 | ||
2582 | ||
2563 | 2583 | if(!n->array_height) |
2564 | 2584 | { |
2565 | return(n->nname); | |
2585 | strcpy(GLOBALS->buf_menu_c_1, hname); | |
2566 | 2586 | } |
2567 | 2587 | else |
2568 | 2588 | { |
2569 | sprintf(GLOBALS->buf_menu_c_1, "%s{%d}", n->nname, n->this_row); | |
2570 | return(GLOBALS->buf_menu_c_1); | |
2571 | } | |
2589 | sprintf(GLOBALS->buf_menu_c_1, "%s{%d}", hname, n->this_row); | |
2590 | } | |
2591 | ||
2592 | if(was_packed) free_2(hname); | |
2593 | ||
2594 | return(GLOBALS->buf_menu_c_1); | |
2572 | 2595 | } |
2573 | 2596 | |
2574 | 2597 | |
4753 | 4776 | |
4754 | 4777 | |
4755 | 4778 | /* |
4756 | * $Id: menu.c,v 1.32 2008/04/03 16:56:10 gtkwave Exp $ | |
4779 | * $Id: menu.c,v 1.35 2008/07/18 17:27:01 gtkwave Exp $ | |
4757 | 4780 | * $Log: menu.c,v $ |
4781 | * Revision 1.35 2008/07/18 17:27:01 gtkwave | |
4782 | * adding hierpack code | |
4783 | * | |
4784 | * Revision 1.34 2008/07/01 18:51:07 gtkwave | |
4785 | * compiler warning fixes for amd64 | |
4786 | * | |
4787 | * Revision 1.33 2008/06/11 08:01:51 gtkwave | |
4788 | * gcc 4.3.x compiler warning fixes | |
4789 | * | |
4758 | 4790 | * Revision 1.32 2008/04/03 16:56:10 gtkwave |
4759 | 4791 | * more time_trunc() removals |
4760 | 4792 | * |
233 | 233 | gint xd = 0, yd = 0; |
234 | 234 | char *asciivalue = NULL; |
235 | 235 | int nmaxlen = 0, vmaxlen = 0; |
236 | int totalmax; | |
236 | int totalmax = 0; | |
237 | 237 | int name_charlen = 0, value_charlen = 0; |
238 | 238 | int num_info_rows = 2; |
239 | 239 | char *flagged_name = NULL; |
384 | 384 | } |
385 | 385 | |
386 | 386 | /* |
387 | * $Id: mouseover.c,v 1.8 2008/04/25 21:31:10 gtkwave Exp $ | |
387 | * $Id: mouseover.c,v 1.9 2008/07/01 18:51:07 gtkwave Exp $ | |
388 | 388 | * $Log: mouseover.c,v $ |
389 | * Revision 1.9 2008/07/01 18:51:07 gtkwave | |
390 | * compiler warning fixes for amd64 | |
391 | * | |
389 | 392 | * Revision 1.8 2008/04/25 21:31:10 gtkwave |
390 | 393 | * added missing t->shift in mouseover time calculation |
391 | 394 | * |
20 | 20 | #endif |
21 | 21 | #endif |
22 | 22 | |
23 | #ifdef __CYGWIN__ | |
24 | #include <sys/types.h> | |
25 | #include <stdlib.h> | |
26 | #define REGEX_MAY_COMPILE | |
27 | #include "gnu_regex.c" | |
28 | #else | |
29 | #if defined __linux__ | |
23 | #ifdef __linux__ | |
30 | 24 | #include <sys/types.h> |
31 | 25 | #include <stdlib.h> |
32 | 26 | #include <regex.h> |
33 | #else /* or for any other compiler that doesn't support POSIX.2 regexs properly like xlc or vc++ */ | |
34 | #ifdef __MINGW32__ | |
27 | #else | |
28 | #if defined __CYGWIN__ || defined __MINGW32__ | |
29 | #include <sys/types.h> | |
30 | #include <stdlib.h> | |
31 | #ifndef HAVE_BZERO | |
35 | 32 | #define bcopy(a,b,c) memcpy((b),(a),(c)) |
36 | 33 | #define bzero(a,b) memset((a),0,(b)) |
37 | 34 | #define bcmp(a,b,c) memcmp((a),(b),(c)) |
38 | 35 | #endif |
36 | #define REGEX_MAY_COMPILE | |
37 | #include "gnu_regex.c" | |
38 | #else /* or for any other compiler that doesn't support POSIX.2 regexs properly like xlc or vc++ */ | |
39 | 39 | #ifdef _MSC_VER |
40 | 40 | #include <malloc.h> |
41 | 41 | #define STDC_HEADERS |
131 | 131 | } |
132 | 132 | |
133 | 133 | /* |
134 | * $Id: regex.c,v 1.2 2007/08/26 21:35:44 gtkwave Exp $ | |
134 | * $Id: regex.c,v 1.3 2008/05/29 15:54:16 gtkwave Exp $ | |
135 | 135 | * $Log: regex.c,v $ |
136 | * Revision 1.3 2008/05/29 15:54:16 gtkwave | |
137 | * added HAVE_BZERO patches for MinGW | |
138 | * | |
136 | 139 | * Revision 1.2 2007/08/26 21:35:44 gtkwave |
137 | 140 | * integrated global context management from SystemOfCode2007 branch |
138 | 141 | * |
44 | 44 | static void pagesize_clicked(GtkWidget *widget, gpointer which) |
45 | 45 | { |
46 | 46 | int i; |
47 | char *which_char; | |
48 | 47 | |
49 | 48 | for(i=0;i<5;i++) GLOBALS->page_mutex_renderopt_c_1[i]=0; |
50 | 49 | |
57 | 56 | static void rendertype_clicked(GtkWidget *widget, gpointer which) |
58 | 57 | { |
59 | 58 | int i; |
60 | char *which_char; | |
61 | 59 | |
62 | 60 | for(i=0;i<2;i++) GLOBALS->render_mutex_renderopt_c_1[i]=0; |
63 | 61 | |
314 | 312 | } |
315 | 313 | |
316 | 314 | /* |
317 | * $Id: renderopt.c,v 1.5 2007/09/12 17:26:45 gtkwave Exp $ | |
315 | * $Id: renderopt.c,v 1.6 2008/06/11 08:01:53 gtkwave Exp $ | |
318 | 316 | * $Log: renderopt.c,v $ |
317 | * Revision 1.6 2008/06/11 08:01:53 gtkwave | |
318 | * gcc 4.3.x compiler warning fixes | |
319 | * | |
319 | 320 | * Revision 1.5 2007/09/12 17:26:45 gtkwave |
320 | 321 | * experimental ctx_swap_watchdog added...still tracking down mouse thrash crashes |
321 | 322 | * |
23 | 23 | #include "ghw.h" |
24 | 24 | #include "debug.h" |
25 | 25 | #include "busy.h" |
26 | #include "hierpack.h" | |
27 | ||
28 | static gint | |
29 | clist_sigcmp (GtkCList *clist, | |
30 | gconstpointer ptr1, | |
31 | gconstpointer ptr2) | |
32 | { | |
33 | char *text1 = NULL; | |
34 | char *text2 = NULL; | |
35 | ||
36 | GtkCListRow *row1 = (GtkCListRow *) ptr1; | |
37 | GtkCListRow *row2 = (GtkCListRow *) ptr2; | |
38 | ||
39 | char *nd1, *nd2; | |
40 | int was_packed1=0, was_packed2=0; | |
41 | int rc; | |
42 | ||
43 | switch (row1->cell[clist->sort_column].type) | |
44 | { | |
45 | case GTK_CELL_TEXT: | |
46 | text1 = GTK_CELL_TEXT (row1->cell[clist->sort_column])->text; | |
47 | break; | |
48 | case GTK_CELL_PIXTEXT: | |
49 | text1 = GTK_CELL_PIXTEXT (row1->cell[clist->sort_column])->text; | |
50 | break; | |
51 | default: | |
52 | break; | |
53 | } | |
54 | ||
55 | switch (row2->cell[clist->sort_column].type) | |
56 | { | |
57 | case GTK_CELL_TEXT: | |
58 | text2 = GTK_CELL_TEXT (row2->cell[clist->sort_column])->text; | |
59 | break; | |
60 | case GTK_CELL_PIXTEXT: | |
61 | text2 = GTK_CELL_PIXTEXT (row2->cell[clist->sort_column])->text; | |
62 | break; | |
63 | default: | |
64 | break; | |
65 | } | |
66 | ||
67 | if (!text2) | |
68 | return (text1 != NULL); | |
69 | ||
70 | if (!text1) | |
71 | return -1; | |
72 | ||
73 | nd1 = hier_decompress_flagged(text1, &was_packed1); | |
74 | nd2 = hier_decompress_flagged(text2, &was_packed2); | |
75 | rc = sigcmp(nd1, nd2); | |
76 | ||
77 | if(was_packed1) free_2(nd1); | |
78 | if(was_packed2) free_2(nd2); | |
79 | ||
80 | return (rc); | |
81 | } | |
82 | ||
26 | 83 | |
27 | 84 | |
28 | 85 | int searchbox_is_active(void) |
635 | 692 | GtkCList *cl; |
636 | 693 | G_CONST_RETURN gchar *entry_text; |
637 | 694 | char *entry_suffixed; |
638 | int len; | |
639 | 695 | int i, row; |
640 | 696 | char *s, *tmp2; |
641 | 697 | gfloat interval; |
698 | int depack_cnt = 0; | |
642 | 699 | |
643 | 700 | if(GLOBALS->is_searching_running_search_c_1) return; |
644 | 701 | GLOBALS->is_searching_running_search_c_1 = ~0; |
679 | 736 | |
680 | 737 | for(i=0;i<GLOBALS->numfacs;i++) |
681 | 738 | { |
739 | int was_packed; | |
740 | char *hfacname = NULL; | |
741 | ||
682 | 742 | GLOBALS->pdata->value = i; |
683 | 743 | if(((int)(GLOBALS->pdata->value/interval))!=((int)(GLOBALS->pdata->oldvalue/interval))) |
684 | 744 | { |
687 | 747 | } |
688 | 748 | GLOBALS->pdata->oldvalue = i; |
689 | 749 | |
690 | if(wave_regex_match(GLOBALS->facs[i]->name, WAVE_REGEX_SEARCH)) | |
691 | if((!GLOBALS->is_ghw)||(strcmp(WAVE_GHW_DUMMYFACNAME, GLOBALS->facs[i]->name))) | |
750 | hfacname = hier_decompress_flagged(GLOBALS->facs[i]->name, &was_packed); | |
751 | depack_cnt += was_packed; | |
752 | ||
753 | if(wave_regex_match(hfacname, WAVE_REGEX_SEARCH)) | |
754 | if((!GLOBALS->is_ghw)||(strcmp(WAVE_GHW_DUMMYFACNAME, hfacname))) | |
692 | 755 | { |
693 | 756 | if(!GLOBALS->facs[i]->vec_root) |
694 | 757 | { |
695 | row=gtk_clist_append(cl,(gchar **)&(GLOBALS->facs[i]->name)); | |
758 | row=gtk_clist_append(cl,(gchar **)&(hfacname)); | |
696 | 759 | } |
697 | 760 | else |
698 | 761 | { |
708 | 771 | } |
709 | 772 | else |
710 | 773 | { |
711 | s=(char *)malloc_2(strlen(GLOBALS->facs[i]->name)+4); | |
774 | s=(char *)malloc_2(strlen(hfacname)+4); | |
712 | 775 | strcpy(s,"[] "); |
713 | strcpy(s+3, GLOBALS->facs[i]->name); | |
776 | strcpy(s+3, hfacname); | |
714 | 777 | } |
715 | 778 | |
716 | 779 | row=gtk_clist_append(cl,(gchar **)&s); |
719 | 782 | |
720 | 783 | gtk_clist_set_row_data(cl, row,GLOBALS->facs[i]); |
721 | 784 | GLOBALS->num_rows_search_c_2++; |
722 | if(GLOBALS->num_rows_search_c_2==WAVE_MAX_CLIST_LENGTH) break; | |
785 | if(GLOBALS->num_rows_search_c_2==WAVE_MAX_CLIST_LENGTH) | |
786 | { | |
787 | if(was_packed) { free_2(hfacname); } | |
788 | break; | |
789 | } | |
723 | 790 | } |
791 | ||
792 | if(was_packed) { free_2(hfacname); } | |
793 | } | |
794 | ||
795 | if(depack_cnt) | |
796 | { | |
797 | gtk_clist_set_compare_func(cl, clist_sigcmp); | |
798 | gtk_clist_sort (cl); | |
724 | 799 | } |
725 | 800 | |
726 | 801 | gtk_clist_set_column_width(GTK_CLIST(GLOBALS->clist_search_c_3),0,gtk_clist_optimal_column_width(GTK_CLIST(GLOBALS->clist_search_c_3),0)); |
1030 | 1105 | } |
1031 | 1106 | |
1032 | 1107 | /* |
1033 | * $Id: search.c,v 1.7 2008/05/08 20:10:04 gtkwave Exp $ | |
1108 | * $Id: search.c,v 1.9 2008/07/18 17:27:01 gtkwave Exp $ | |
1034 | 1109 | * $Log: search.c,v $ |
1110 | * Revision 1.9 2008/07/18 17:27:01 gtkwave | |
1111 | * adding hierpack code | |
1112 | * | |
1113 | * Revision 1.8 2008/06/11 08:01:54 gtkwave | |
1114 | * gcc 4.3.x compiler warning fixes | |
1115 | * | |
1035 | 1116 | * Revision 1.7 2008/05/08 20:10:04 gtkwave |
1036 | 1117 | * 2.4 not required for dnd so requirement relaxed |
1037 | 1118 | * |
1096 | 1177 | * initial release |
1097 | 1178 | * |
1098 | 1179 | */ |
1099 |
369 | 369 | |
370 | 370 | /* printf("drop to %d of %d: '%s'\n", which, GLOBALS->traces.total, t ? t->name : "undef"); */ |
371 | 371 | } |
372 | bot: 1; | |
372 | bot: return(FALSE); | |
373 | 373 | } |
374 | 374 | |
375 | 375 | return(FALSE); |
751 | 751 | t->flags |= TR_HIGHLIGHT; |
752 | 752 | } |
753 | 753 | } |
754 | else | |
754 | else if(!(t->flags & TR_HIGHLIGHT)) /* Ben Sferrazza suggested fix rather than a regular "else" */ | |
755 | 755 | { |
756 | 756 | GLOBALS->starting_unshifted_trace = t; |
757 | 757 | |
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | |
1179 | /* | |
1179 | 1180 | static gint popup_event (GtkWidget *widget) |
1180 | 1181 | { |
1181 | 1182 | do_popup_menu(widget, NULL); |
1182 | 1183 | return(TRUE); |
1183 | 1184 | } |
1185 | */ | |
1184 | 1186 | |
1185 | 1187 | /*** gtkwave click routines turned on with "use_standard_clicking"=0 ***/ |
1186 | 1188 | /**************************************************************************/ |
1302 | 1304 | { |
1303 | 1305 | gint rc; |
1304 | 1306 | gint page_num = gtk_notebook_get_current_page(GTK_NOTEBOOK(GLOBALS->notebook)); |
1305 | struct Global *g_old = GLOBALS; | |
1307 | /* struct Global *g_old = GLOBALS; */ | |
1306 | 1308 | |
1307 | 1309 | set_GLOBALS((*GLOBALS->contexts)[page_num]); |
1308 | 1310 | |
1491 | 1493 | |
1492 | 1494 | |
1493 | 1495 | /* |
1494 | * $Id: signalwindow.c,v 1.30 2008/03/26 01:23:52 gtkwave Exp $ | |
1496 | * $Id: signalwindow.c,v 1.33 2008/08/18 16:10:54 gtkwave Exp $ | |
1495 | 1497 | * $Log: signalwindow.c,v $ |
1498 | * Revision 1.33 2008/08/18 16:10:54 gtkwave | |
1499 | * adding sticky click semantics on already selected entries | |
1500 | * | |
1501 | * Revision 1.32 2008/07/01 18:51:07 gtkwave | |
1502 | * compiler warning fixes for amd64 | |
1503 | * | |
1504 | * Revision 1.31 2008/06/11 08:01:55 gtkwave | |
1505 | * gcc 4.3.x compiler warning fixes | |
1506 | * | |
1496 | 1507 | * Revision 1.30 2008/03/26 01:23:52 gtkwave |
1497 | 1508 | * reduce drag and drop visual noise |
1498 | 1509 | * |
1342 | 1342 | basetime=GLOBALS->named_markers[GLOBALS->mark_idx_start-1]; |
1343 | 1343 | else |
1344 | 1344 | { |
1345 | status_text(item_mark_start_strings[GLOBALS->mark_idx_start].str); | |
1345 | status_text(item_mark_start_strings[(unsigned int)GLOBALS->mark_idx_start].str); | |
1346 | 1346 | status_text(" not in use.\n"); |
1347 | 1347 | } |
1348 | 1348 | } |
1353 | 1353 | endtime=GLOBALS->named_markers[GLOBALS->mark_idx_end-1]; |
1354 | 1354 | else |
1355 | 1355 | { |
1356 | status_text(item_mark_end_strings[GLOBALS->mark_idx_end].str); | |
1356 | status_text(item_mark_end_strings[(unsigned int)GLOBALS->mark_idx_end].str); | |
1357 | 1357 | status_text(" not in use.\n"); |
1358 | 1358 | } |
1359 | 1359 | } |
1638 | 1638 | } |
1639 | 1639 | |
1640 | 1640 | /* |
1641 | * $Id: strace.c,v 1.7 2007/12/31 17:11:58 gtkwave Exp $ | |
1641 | * $Id: strace.c,v 1.8 2008/07/01 18:51:07 gtkwave Exp $ | |
1642 | 1642 | * $Log: strace.c,v $ |
1643 | * Revision 1.8 2008/07/01 18:51:07 gtkwave | |
1644 | * compiler warning fixes for amd64 | |
1645 | * | |
1643 | 1646 | * Revision 1.7 2007/12/31 17:11:58 gtkwave |
1644 | 1647 | * fixed backward seek bug in pattern/edge search |
1645 | 1648 | * |
18 | 18 | #include "lx2.h" |
19 | 19 | #include "busy.h" |
20 | 20 | #include "debug.h" |
21 | ||
21 | 22 | |
22 | 23 | enum { VIEW_DRAG_INACTIVE, TREE_TO_VIEW_DRAG_ACTIVE, SEARCH_TO_VIEW_DRAG_ACTIVE }; |
23 | 24 | |
1003 | 1004 | } |
1004 | 1005 | } |
1005 | 1006 | |
1006 | ||
1007 | /**********************************************************************/ | |
1008 | ||
1009 | /* view_selection_func is commented out for now... */ | |
1010 | ||
1011 | static gboolean | |
1012 | view_selection_func (GtkTreeSelection *selection, | |
1013 | GtkTreeModel *model, | |
1014 | GtkTreePath *path, | |
1015 | gboolean path_currently_selected, | |
1016 | gpointer userdata) | |
1017 | { | |
1018 | /* | |
1019 | GtkTreeIter iter; | |
1020 | ||
1021 | if (gtk_tree_model_get_iter(model, &iter, path)) | |
1022 | { | |
1023 | gchar *name; | |
1024 | ||
1025 | gtk_tree_model_get(model, &iter, 0, &name, -1); | |
1026 | ||
1027 | if (!path_currently_selected) | |
1028 | { | |
1029 | g_print ("%s is going to be selected.\n", name); | |
1030 | } | |
1031 | else | |
1032 | { | |
1033 | g_print ("%s is going to be unselected.\n", name); | |
1034 | } | |
1035 | ||
1036 | g_free(name); | |
1037 | } | |
1038 | */ | |
1039 | return TRUE; /* allow selection state to change */ | |
1040 | } | |
1041 | ||
1042 | /**********************************************************************/ | |
1007 | 1043 | |
1008 | 1044 | /* |
1009 | 1045 | * mainline.. |
1128 | 1164 | /* Setup the selection handler */ |
1129 | 1165 | GLOBALS->sig_selection_treesearch_gtk2_c_1 = gtk_tree_view_get_selection (GTK_TREE_VIEW (sig_view)); |
1130 | 1166 | gtk_tree_selection_set_mode (GLOBALS->sig_selection_treesearch_gtk2_c_1, GTK_SELECTION_MULTIPLE); |
1167 | /* gtk_tree_selection_set_select_function (GLOBALS->sig_selection_treesearch_gtk2_c_1, | |
1168 | view_selection_func, NULL, NULL); */ | |
1131 | 1169 | } |
1132 | 1170 | |
1133 | 1171 | GLOBALS->dnd_sigview = sig_view; |
1361 | 1399 | /* Setup the selection handler */ |
1362 | 1400 | GLOBALS->sig_selection_treesearch_gtk2_c_1 = gtk_tree_view_get_selection (GTK_TREE_VIEW (sig_view)); |
1363 | 1401 | gtk_tree_selection_set_mode (GLOBALS->sig_selection_treesearch_gtk2_c_1, GTK_SELECTION_MULTIPLE); |
1402 | /* gtk_tree_selection_set_select_function (GLOBALS->sig_selection_treesearch_gtk2_c_1, | |
1403 | view_selection_func, NULL, NULL); */ | |
1364 | 1404 | } |
1365 | 1405 | |
1366 | 1406 | GLOBALS->dnd_sigview = sig_view; |
1851 | 1891 | } |
1852 | 1892 | |
1853 | 1893 | /* |
1854 | * $Id: treesearch_gtk2.c,v 1.15 2008/05/11 03:05:25 gtkwave Exp $ | |
1894 | * $Id: treesearch_gtk2.c,v 1.16 2008/08/18 16:10:54 gtkwave Exp $ | |
1855 | 1895 | * $Log: treesearch_gtk2.c,v $ |
1896 | * Revision 1.16 2008/08/18 16:10:54 gtkwave | |
1897 | * adding sticky click semantics on already selected entries | |
1898 | * | |
1856 | 1899 | * Revision 1.15 2008/05/11 03:05:25 gtkwave |
1857 | 1900 | * add gating flag on dnd data request so moving in/out of search window |
1858 | 1901 | * doesn't cause spurious insert ops into the signal/wavewindow |
37 | 37 | #include <config.h> |
38 | 38 | #include "globals.h" |
39 | 39 | #include "vcd.h" |
40 | #include "hierpack.h" | |
40 | 41 | |
41 | 42 | #undef VCD_BSEARCH_IS_PERFECT /* bsearch is imperfect under linux, but OK under AIX */ |
42 | 43 | |
335 | 336 | return((int)(*(GLOBALS->vst_vcd_c_1++))); |
336 | 337 | } |
337 | 338 | |
338 | static char getch() { | |
339 | static signed char getch() { | |
339 | 340 | return ((GLOBALS->vst_vcd_c_1!=GLOBALS->vend_vcd_c_1)?((int)(*(GLOBALS->vst_vcd_c_1++))):(getch_fetch())); |
340 | 341 | } |
341 | 342 | |
1386 | 1387 | else |
1387 | 1388 | if((v->msi>v->lsi)&&((v->msi-v->lsi+1)!=v->size)) |
1388 | 1389 | { |
1389 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) goto err; | |
1390 | v->size=v->msi-v->lsi+1; | |
1390 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) | |
1391 | { | |
1392 | v->msi = v->size-1; v->lsi = 0; | |
1393 | /* all this formerly was goto err; */ | |
1394 | } | |
1395 | else | |
1396 | { | |
1397 | v->size=v->msi-v->lsi+1; | |
1398 | } | |
1391 | 1399 | } |
1392 | 1400 | else |
1393 | 1401 | if((v->lsi>=v->msi)&&((v->lsi-v->msi+1)!=v->size)) |
1394 | 1402 | { |
1395 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) goto err; | |
1396 | v->size=v->msi-v->lsi+1; | |
1403 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) | |
1404 | { | |
1405 | v->lsi = v->size-1; v->msi = 0; | |
1406 | /* all this formerly was goto err; */ | |
1407 | } | |
1408 | else | |
1409 | { | |
1410 | v->size=v->lsi-v->msi+1; | |
1411 | } | |
1397 | 1412 | } |
1398 | 1413 | |
1399 | 1414 | /* initial conditions */ |
2164 | 2179 | void vcd_sortfacs(void) |
2165 | 2180 | { |
2166 | 2181 | int i; |
2182 | JRB ptr, lst; | |
2183 | ||
2184 | GLOBALS->pfx_hier_array = calloc_2(GLOBALS->hier_pfx_cnt ? GLOBALS->hier_pfx_cnt : 1, sizeof(char *)); | |
2185 | lst = GLOBALS->hier_pfx; | |
2186 | if(lst) | |
2187 | { | |
2188 | jrb_traverse(ptr, lst) | |
2189 | { | |
2190 | GLOBALS->pfx_hier_array[ptr->val.ui] = ptr->key.s; | |
2191 | } | |
2192 | } | |
2167 | 2193 | |
2168 | 2194 | GLOBALS->facs=(struct symbol **)malloc_2(GLOBALS->numfacs*sizeof(struct symbol *)); |
2169 | 2195 | GLOBALS->curnode=GLOBALS->firstnode; |
2206 | 2232 | init_tree(); |
2207 | 2233 | for(i=0;i<GLOBALS->numfacs;i++) |
2208 | 2234 | { |
2209 | build_tree_from_name(GLOBALS->facs[i]->name, i); | |
2235 | char *n = GLOBALS->facs[i]->name; | |
2236 | int was_packed; | |
2237 | char *recon = hier_decompress_flagged(n, &was_packed); | |
2238 | ||
2239 | if(was_packed) | |
2240 | { | |
2241 | build_tree_from_name(recon, i); | |
2242 | free_2(recon); | |
2243 | } | |
2244 | else | |
2245 | { | |
2246 | build_tree_from_name(n, i); | |
2247 | } | |
2210 | 2248 | |
2211 | 2249 | if(GLOBALS->escaped_names_found_vcd_c_1) |
2212 | 2250 | { |
2422 | 2460 | /*******************************************************************************/ |
2423 | 2461 | |
2424 | 2462 | /* |
2425 | * $Id: vcd.c,v 1.4 2008/01/22 20:11:47 gtkwave Exp $ | |
2463 | * $Id: vcd.c,v 1.9 2008/07/20 01:29:36 gtkwave Exp $ | |
2426 | 2464 | * $Log: vcd.c,v $ |
2465 | * Revision 1.9 2008/07/20 01:29:36 gtkwave | |
2466 | * added command line option --comphier | |
2467 | * | |
2468 | * Revision 1.8 2008/07/18 18:46:11 gtkwave | |
2469 | * bitblasted vector relinking fix, disable hier pack in legacy+partial vcdload | |
2470 | * | |
2471 | * Revision 1.7 2008/07/18 18:22:58 gtkwave | |
2472 | * fixes for aix | |
2473 | * | |
2474 | * Revision 1.6 2008/07/18 17:27:01 gtkwave | |
2475 | * adding hierpack code | |
2476 | * | |
2477 | * Revision 1.5 2008/07/12 22:54:12 gtkwave | |
2478 | * array of wires malformed vcd dump load abort fixed | |
2479 | * | |
2427 | 2480 | * Revision 1.4 2008/01/22 20:11:47 gtkwave |
2428 | 2481 | * track and hold experimentation |
2429 | 2482 | * |
32 | 32 | #include "wavealloca.h" |
33 | 33 | #include "debug.h" |
34 | 34 | #include "tree.h" |
35 | #include "jrb.h" | |
35 | 36 | |
36 | 37 | #define VCD_SIZE_WARN (256) /* number of MB size where converter warning message appears */ |
37 | 38 | #define VCD_BSIZ 32768 /* size of getch() emulation buffer--this val should be ok */ |
127 | 128 | #endif |
128 | 129 | |
129 | 130 | /* |
130 | * $Id: vcd.h,v 1.2 2007/08/26 21:35:46 gtkwave Exp $ | |
131 | * $Id: vcd.h,v 1.3 2008/07/18 17:27:01 gtkwave Exp $ | |
131 | 132 | * $Log: vcd.h,v $ |
133 | * Revision 1.3 2008/07/18 17:27:01 gtkwave | |
134 | * adding hierpack code | |
135 | * | |
132 | 136 | * Revision 1.2 2007/08/26 21:35:46 gtkwave |
133 | 137 | * integrated global context management from SystemOfCode2007 branch |
134 | 138 | * |
32 | 32 | #include <config.h> |
33 | 33 | #include "globals.h" |
34 | 34 | #include "vcd.h" |
35 | #include "hierpack.h" | |
35 | 36 | |
36 | 37 | #if !defined _MSC_VER && !defined __MINGW32__ |
37 | 38 | #include <sys/time.h> |
339 | 340 | return((int)(*(GLOBALS->vst_vcd_partial_c_2++))); |
340 | 341 | } |
341 | 342 | |
342 | static char getch() { | |
343 | static signed char getch() { | |
343 | 344 | return ((GLOBALS->vst_vcd_partial_c_2!=GLOBALS->vend_vcd_partial_c_2)?((int)(*(GLOBALS->vst_vcd_partial_c_2++))):(getch_fetch())); |
344 | 345 | } |
345 | 346 | |
1380 | 1381 | else |
1381 | 1382 | if((v->msi>v->lsi)&&((v->msi-v->lsi+1)!=v->size)) |
1382 | 1383 | { |
1383 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) goto err; | |
1384 | v->size=v->msi-v->lsi+1; | |
1384 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) | |
1385 | { | |
1386 | v->msi = v->size-1; v->lsi = 0; | |
1387 | /* all this formerly was goto err; */ | |
1388 | } | |
1389 | else | |
1390 | { | |
1391 | v->size=v->msi-v->lsi+1; | |
1392 | } | |
1385 | 1393 | } |
1386 | 1394 | else |
1387 | 1395 | if((v->lsi>=v->msi)&&((v->lsi-v->msi+1)!=v->size)) |
1388 | 1396 | { |
1389 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) goto err; | |
1390 | v->size=v->msi-v->lsi+1; | |
1397 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) | |
1398 | { | |
1399 | v->lsi = v->size-1; v->msi = 0; | |
1400 | /* all this formerly was goto err; */ | |
1401 | } | |
1402 | else | |
1403 | { | |
1404 | v->size=v->lsi-v->msi+1; | |
1405 | } | |
1391 | 1406 | } |
1392 | 1407 | |
1393 | 1408 | /* initial conditions */ |
2364 | 2379 | } |
2365 | 2380 | |
2366 | 2381 | /* |
2367 | * $Id: vcd_partial.c,v 1.3 2007/09/11 02:12:50 gtkwave Exp $ | |
2382 | * $Id: vcd_partial.c,v 1.7 2008/07/18 18:46:11 gtkwave Exp $ | |
2368 | 2383 | * $Log: vcd_partial.c,v $ |
2384 | * Revision 1.7 2008/07/18 18:46:11 gtkwave | |
2385 | * bitblasted vector relinking fix, disable hier pack in legacy+partial vcdload | |
2386 | * | |
2387 | * Revision 1.6 2008/07/18 18:23:06 gtkwave | |
2388 | * fixes for aix | |
2389 | * | |
2390 | * Revision 1.5 2008/07/18 17:27:01 gtkwave | |
2391 | * adding hierpack code | |
2392 | * | |
2393 | * Revision 1.4 2008/07/12 22:54:12 gtkwave | |
2394 | * array of wires malformed vcd dump load abort fixed | |
2395 | * | |
2369 | 2396 | * Revision 1.3 2007/09/11 02:12:50 gtkwave |
2370 | 2397 | * context locking in busy spinloops (gtk_main_iteration() calls) |
2371 | 2398 | * |
35 | 35 | #include "vcd.h" |
36 | 36 | #include "vlist.h" |
37 | 37 | #include "lx2.h" |
38 | #include "hierpack.h" | |
38 | 39 | |
39 | 40 | /**/ |
40 | 41 | |
518 | 519 | return((int)(*(GLOBALS->vst_vcd_recoder_c_3++))); |
519 | 520 | } |
520 | 521 | |
521 | static char getch() { | |
522 | static signed char getch() { | |
522 | 523 | return ((GLOBALS->vst_vcd_recoder_c_3!=GLOBALS->vend_vcd_recoder_c_3)?((int)(*(GLOBALS->vst_vcd_recoder_c_3++))):(getch_fetch())); |
523 | 524 | } |
524 | 525 | |
1247 | 1248 | |
1248 | 1249 | if(GLOBALS->pv_vcd_recoder_c_3) |
1249 | 1250 | { |
1250 | if(!strcmp(GLOBALS->pv_vcd_recoder_c_3->name,v->name)) | |
1251 | if(!strcmp(GLOBALS->prev_hier_uncompressed_name,v->name)) | |
1251 | 1252 | { |
1252 | 1253 | GLOBALS->pv_vcd_recoder_c_3->chain=v; |
1253 | 1254 | v->root=GLOBALS->rootv_vcd_recoder_c_3; |
1257 | 1258 | { |
1258 | 1259 | GLOBALS->rootv_vcd_recoder_c_3=v; |
1259 | 1260 | } |
1261 | ||
1262 | free_2(GLOBALS->prev_hier_uncompressed_name); | |
1260 | 1263 | } |
1261 | 1264 | else |
1262 | 1265 | { |
1263 | 1266 | GLOBALS->rootv_vcd_recoder_c_3=v; |
1264 | 1267 | } |
1268 | ||
1265 | 1269 | GLOBALS->pv_vcd_recoder_c_3=v; |
1270 | GLOBALS->prev_hier_uncompressed_name; | |
1266 | 1271 | } |
1267 | 1272 | else /* regular vcd var, not an evcd port var */ |
1268 | 1273 | { |
1326 | 1331 | |
1327 | 1332 | if(GLOBALS->pv_vcd_recoder_c_3) |
1328 | 1333 | { |
1329 | if(!strcmp(GLOBALS->pv_vcd_recoder_c_3->name,v->name)) | |
1334 | if(!strcmp(GLOBALS->prev_hier_uncompressed_name,v->name)) | |
1330 | 1335 | { |
1331 | 1336 | GLOBALS->pv_vcd_recoder_c_3->chain=v; |
1332 | 1337 | v->root=GLOBALS->rootv_vcd_recoder_c_3; |
1336 | 1341 | { |
1337 | 1342 | GLOBALS->rootv_vcd_recoder_c_3=v; |
1338 | 1343 | } |
1344 | ||
1345 | free_2(GLOBALS->prev_hier_uncompressed_name); | |
1339 | 1346 | } |
1340 | 1347 | else |
1341 | 1348 | { |
1342 | 1349 | GLOBALS->rootv_vcd_recoder_c_3=v; |
1343 | 1350 | } |
1344 | 1351 | GLOBALS->pv_vcd_recoder_c_3=v; |
1345 | ||
1352 | GLOBALS->prev_hier_uncompressed_name = strdup_2(v->name); | |
1353 | ||
1346 | 1354 | vtok=get_vartoken(1); |
1347 | 1355 | if(vtok==V_END) goto dumpv; |
1348 | 1356 | if(vtok!=V_LB) goto err; |
1389 | 1397 | else |
1390 | 1398 | if((v->msi>v->lsi)&&((v->msi-v->lsi+1)!=v->size)) |
1391 | 1399 | { |
1392 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) goto err; | |
1393 | v->size=v->msi-v->lsi+1; | |
1400 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) | |
1401 | { | |
1402 | v->msi = v->size-1; v->lsi = 0; | |
1403 | /* all this formerly was goto err; */ | |
1404 | } | |
1405 | else | |
1406 | { | |
1407 | v->size=v->msi-v->lsi+1; | |
1408 | } | |
1394 | 1409 | } |
1395 | 1410 | else |
1396 | 1411 | if((v->lsi>=v->msi)&&((v->lsi-v->msi+1)!=v->size)) |
1397 | 1412 | { |
1398 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) goto err; | |
1399 | v->size=v->msi-v->lsi+1; | |
1413 | if((v->vartype!=V_EVENT)&&(v->vartype!=V_PARAMETER)) | |
1414 | { | |
1415 | v->lsi = v->size-1; v->msi = 0; | |
1416 | /* all this formerly was goto err; */ | |
1417 | } | |
1418 | else | |
1419 | { | |
1420 | v->size=v->lsi-v->msi+1; | |
1421 | } | |
1400 | 1422 | } |
1401 | 1423 | |
1402 | 1424 | /* initial conditions */ |
1463 | 1485 | fprintf(stderr, "Near byte %d, $VAR parse error encountered\n", (int)(GLOBALS->vcdbyteno_vcd_recoder_c_3+(GLOBALS->vst_vcd_recoder_c_3-GLOBALS->vcdbuf_vcd_recoder_c_3))); |
1464 | 1486 | } |
1465 | 1487 | if(v->id) free_2(v->id); |
1466 | free_2(v); | |
1488 | free_2(v); v=NULL; | |
1467 | 1489 | GLOBALS->pv_vcd_recoder_c_3 = NULL; |
1468 | 1490 | } |
1469 | 1491 | |
1470 | 1492 | bail: |
1493 | if((v) && (GLOBALS->do_hier_compress)) | |
1494 | { | |
1495 | char *old_name = v->name; | |
1496 | int was_packed; | |
1497 | v->name = hier_compress(v->name, HIERPACK_ADD, &was_packed); | |
1498 | if(was_packed) free_2(old_name); | |
1499 | } | |
1500 | ||
1471 | 1501 | if(vtok!=V_END) sync_end(NULL); |
1472 | 1502 | break; |
1473 | 1503 | } |
1575 | 1605 | { |
1576 | 1606 | GLOBALS->blackout_regions->bend = GLOBALS->current_time_vcd_recoder_c_3; |
1577 | 1607 | } |
1608 | ||
1609 | GLOBALS->pv_vcd_recoder_c_3 = NULL; | |
1610 | if(GLOBALS->prev_hier_uncompressed_name) { free_2(GLOBALS->prev_hier_uncompressed_name); GLOBALS->prev_hier_uncompressed_name = NULL; } | |
1611 | ||
1578 | 1612 | return; |
1579 | 1613 | default: |
1580 | 1614 | DEBUG(fprintf(stderr,"UNKNOWN TOKEN\n")); |
2294 | 2328 | unsigned int accum; |
2295 | 2329 | unsigned char ch; |
2296 | 2330 | double *d; |
2297 | unsigned char *depacked; | |
2331 | unsigned char *depacked = NULL; | |
2298 | 2332 | |
2299 | 2333 | if(!v) return; |
2300 | 2334 | vlist_uncompress(&v); |
2301 | 2335 | |
2302 | 2336 | if(GLOBALS->vlist_prepack) |
2303 | 2337 | { |
2304 | depacked = vlist_packer_decompress(v, &list_size); | |
2338 | depacked = vlist_packer_decompress(v, (unsigned int *)&list_size); | |
2305 | 2339 | vlist_destroy(v); |
2306 | 2340 | } |
2307 | 2341 | else |
2406 | 2440 | time_idx += delta; |
2407 | 2441 | |
2408 | 2442 | curtime_pnt = vlist_locate(GLOBALS->time_vlist_vcd_recoder_c_1, time_idx ? time_idx-1 : 0); |
2443 | if(!curtime_pnt) | |
2444 | { | |
2445 | fprintf(stderr, "GTKWAVE | malformed bitwise signal data for '%s' after time_idx = %d\n", | |
2446 | np->nname, time_idx - delta); | |
2447 | exit(255); | |
2448 | } | |
2409 | 2449 | |
2410 | 2450 | if(vartype != V_EVENT) |
2411 | 2451 | { |
2459 | 2499 | time_idx += delta; |
2460 | 2500 | |
2461 | 2501 | curtime_pnt = vlist_locate(GLOBALS->time_vlist_vcd_recoder_c_1, time_idx ? time_idx-1 : 0); |
2502 | if(!curtime_pnt) | |
2503 | { | |
2504 | fprintf(stderr, "GTKWAVE | malformed 'b' signal data for '%s' after time_idx = %d\n", | |
2505 | np->nname, time_idx - delta); | |
2506 | exit(255); | |
2507 | } | |
2462 | 2508 | |
2463 | 2509 | dst_len = 0; |
2464 | 2510 | for(;;) |
2540 | 2586 | time_idx += delta; |
2541 | 2587 | |
2542 | 2588 | curtime_pnt = vlist_locate(GLOBALS->time_vlist_vcd_recoder_c_1, time_idx ? time_idx-1 : 0); |
2589 | if(!curtime_pnt) | |
2590 | { | |
2591 | fprintf(stderr, "GTKWAVE | malformed 'r' signal data for '%s' after time_idx = %d\n", | |
2592 | np->nname, time_idx - delta); | |
2593 | exit(255); | |
2594 | } | |
2543 | 2595 | |
2544 | 2596 | dst_len = 0; |
2545 | 2597 | do |
2595 | 2647 | time_idx += delta; |
2596 | 2648 | |
2597 | 2649 | curtime_pnt = vlist_locate(GLOBALS->time_vlist_vcd_recoder_c_1, time_idx ? time_idx-1 : 0); |
2650 | if(!curtime_pnt) | |
2651 | { | |
2652 | fprintf(stderr, "GTKWAVE | malformed 's' signal data for '%s' after time_idx = %d\n", | |
2653 | np->nname, time_idx - delta); | |
2654 | exit(255); | |
2655 | } | |
2598 | 2656 | |
2599 | 2657 | dst_len = 0; |
2600 | 2658 | do |
2630 | 2688 | |
2631 | 2689 | if(GLOBALS->vlist_prepack) |
2632 | 2690 | { |
2633 | vlist_packer_decompress_destroy(depacked); | |
2691 | vlist_packer_decompress_destroy((char *)depacked); | |
2634 | 2692 | } |
2635 | 2693 | else |
2636 | 2694 | { |
2649 | 2707 | |
2650 | 2708 | if(GLOBALS->vlist_prepack) |
2651 | 2709 | { |
2652 | vlist_packer_decompress_destroy(depacked); | |
2710 | vlist_packer_decompress_destroy((char *)depacked); | |
2653 | 2711 | } |
2654 | 2712 | else |
2655 | 2713 | { |
2659 | 2717 | } |
2660 | 2718 | |
2661 | 2719 | /* |
2662 | * $Id: vcd_recoder.c,v 1.8 2007/12/24 19:56:03 gtkwave Exp $ | |
2720 | * $Id: vcd_recoder.c,v 1.14 2008/07/18 18:46:11 gtkwave Exp $ | |
2663 | 2721 | * $Log: vcd_recoder.c,v $ |
2722 | * Revision 1.14 2008/07/18 18:46:11 gtkwave | |
2723 | * bitblasted vector relinking fix, disable hier pack in legacy+partial vcdload | |
2724 | * | |
2725 | * Revision 1.13 2008/07/18 18:23:07 gtkwave | |
2726 | * fixes for aix | |
2727 | * | |
2728 | * Revision 1.12 2008/07/18 17:27:01 gtkwave | |
2729 | * adding hierpack code | |
2730 | * | |
2731 | * Revision 1.11 2008/07/12 22:54:12 gtkwave | |
2732 | * array of wires malformed vcd dump load abort fixed | |
2733 | * | |
2734 | * Revision 1.10 2008/07/11 07:02:54 gtkwave | |
2735 | * recoder fix for malformed files | |
2736 | * | |
2737 | * Revision 1.9 2008/06/11 08:01:55 gtkwave | |
2738 | * gcc 4.3.x compiler warning fixes | |
2739 | * | |
2664 | 2740 | * Revision 1.8 2007/12/24 19:56:03 gtkwave |
2665 | 2741 | * preparing for 3.1.2 version bump |
2666 | 2742 | * |
11 | 11 | #include "vcd_saver.h" |
12 | 12 | #include "helpers/lxt_write.h" |
13 | 13 | #include "ghw.h" |
14 | #include "hierpack.h" | |
14 | 15 | #include <time.h> |
15 | 16 | |
16 | 17 | |
459 | 460 | |
460 | 461 | for(i=0;i<nodecnt;i++) |
461 | 462 | { |
462 | char *netname = lxt ? GLOBALS->hp_vcd_saver_c_1[i]->item->nname : output_hier(GLOBALS->hp_vcd_saver_c_1[i]->item->nname); | |
463 | int was_packed = 0; | |
464 | char *hname = hier_decompress_flagged(GLOBALS->hp_vcd_saver_c_1[i]->item->nname, &was_packed); | |
465 | char *netname = lxt ? hname : output_hier(hname); | |
463 | 466 | |
464 | 467 | if(GLOBALS->hp_vcd_saver_c_1[i]->flags & (HIST_REAL|HIST_STRING)) |
465 | 468 | { |
514 | 517 | } |
515 | 518 | } |
516 | 519 | |
520 | if(was_packed) | |
521 | { | |
522 | free_2(hname); | |
523 | } | |
517 | 524 | } |
518 | 525 | |
519 | 526 | row_data = malloc_2(max_len + 1); |
847 | 854 | } |
848 | 855 | |
849 | 856 | /* |
850 | * $Id: vcd_saver.c,v 1.2 2007/08/26 21:35:46 gtkwave Exp $ | |
857 | * $Id: vcd_saver.c,v 1.3 2008/07/18 17:27:01 gtkwave Exp $ | |
851 | 858 | * $Log: vcd_saver.c,v $ |
859 | * Revision 1.3 2008/07/18 17:27:01 gtkwave | |
860 | * adding hierpack code | |
861 | * | |
852 | 862 | * Revision 1.2 2007/08/26 21:35:46 gtkwave |
853 | 863 | * integrated global context management from SystemOfCode2007 branch |
854 | 864 | * |
143 | 143 | exit(255); |
144 | 144 | } |
145 | 145 | |
146 | /* args are reversed to fread (compared to above) to handle short read at end of file! */ | |
147 | /* (this can happen because of how we write out only the used size of a block) */ | |
146 | 148 | vrebuild = malloc_2(sizeof(struct vlist_t) + vhdr.siz); |
147 | 149 | memcpy(vrebuild, &vhdr, sizeof(struct vlist_t)); |
148 | fread(vrebuild+1, vrebuild->siz, 1, GLOBALS->vlist_handle); | |
150 | rc = fread(vrebuild+1, 1, vrebuild->siz, GLOBALS->vlist_handle); | |
151 | if(!rc) | |
152 | { | |
153 | printf("Error in reading from VList spill file!\n"); | |
154 | exit(255); | |
155 | } | |
149 | 156 | |
150 | 157 | if(vprev) |
151 | 158 | { |
766 | 773 | |
767 | 774 | |
768 | 775 | /* |
769 | * $Id: vlist.c,v 1.10 2007/12/24 19:56:03 gtkwave Exp $ | |
776 | * $Id: vlist.c,v 1.12 2008/07/13 00:15:41 gtkwave Exp $ | |
770 | 777 | * $Log: vlist.c,v $ |
778 | * Revision 1.12 2008/07/13 00:15:41 gtkwave | |
779 | * fix for short reads when --giga option is enabled | |
780 | * | |
781 | * Revision 1.11 2008/06/11 08:01:57 gtkwave | |
782 | * gcc 4.3.x compiler warning fixes | |
783 | * | |
771 | 784 | * Revision 1.10 2007/12/24 19:56:03 gtkwave |
772 | 785 | * preparing for 3.1.2 version bump |
773 | 786 | * |
0 | 0 | /* |
1 | * Copyright (c) Tony Bybell 2003-2006. | |
1 | * Copyright (c) Tony Bybell 2003-2008. | |
2 | 2 | * |
3 | 3 | * This program is free software; you can redistribute it and/or |
4 | 4 | * modify it under the terms of the GNU General Public License |
26 | 26 | #include "vzt_read.h" |
27 | 27 | #include "debug.h" |
28 | 28 | #include "busy.h" |
29 | ||
29 | #include "hierpack.h" | |
30 | 30 | |
31 | 31 | /* |
32 | 32 | * mainline |
40 | 40 | unsigned int numalias = 0; |
41 | 41 | struct symbol *sym_block = NULL; |
42 | 42 | struct Node *node_block = NULL; |
43 | JRB ptr, lst; | |
43 | 44 | |
44 | 45 | GLOBALS->vzt_vzt_c_1 = vzt_rd_init_smp(fname, GLOBALS->num_cpus); |
45 | 46 | if(!GLOBALS->vzt_vzt_c_1) |
86 | 87 | if(GLOBALS->numfacs) |
87 | 88 | { |
88 | 89 | char *fnam = vzt_rd_get_facname(GLOBALS->vzt_vzt_c_1, 0); |
89 | int flen = strlen(fnam); | |
90 | ||
91 | GLOBALS->mvlfacs_vzt_c_3[0].name=malloc_2(flen+1); | |
92 | strcpy(GLOBALS->mvlfacs_vzt_c_3[0].name, fnam); | |
90 | char *pnt; | |
91 | int was_packed = 0; | |
92 | ||
93 | if(GLOBALS->do_hier_compress) | |
94 | { | |
95 | pnt = hier_compress(fnam, HIERPACK_ADD, &was_packed); | |
96 | } | |
97 | ||
98 | if(was_packed) | |
99 | { | |
100 | GLOBALS->mvlfacs_vzt_c_3[0].name = pnt; | |
101 | } | |
102 | else | |
103 | { | |
104 | int flen = strlen(fnam); | |
105 | GLOBALS->mvlfacs_vzt_c_3[0].name=malloc_2(flen+1); | |
106 | strcpy(GLOBALS->mvlfacs_vzt_c_3[0].name, fnam); | |
107 | } | |
93 | 108 | } |
94 | 109 | |
95 | 110 | for(i=0;i<GLOBALS->numfacs;i++) |
101 | 116 | if(i!=(GLOBALS->numfacs-1)) |
102 | 117 | { |
103 | 118 | char *fnam = vzt_rd_get_facname(GLOBALS->vzt_vzt_c_1, i+1); |
104 | int flen = strlen(fnam); | |
105 | ||
106 | GLOBALS->mvlfacs_vzt_c_3[i+1].name=malloc_2(flen+1); | |
107 | strcpy(GLOBALS->mvlfacs_vzt_c_3[i+1].name, fnam); | |
119 | char *pnt; | |
120 | int was_packed = 0; | |
121 | ||
122 | if(GLOBALS->do_hier_compress) | |
123 | { | |
124 | pnt = hier_compress(fnam, HIERPACK_ADD, &was_packed); | |
125 | } | |
126 | ||
127 | if(was_packed) | |
128 | { | |
129 | GLOBALS->mvlfacs_vzt_c_3[i+1].name = pnt; | |
130 | } | |
131 | else | |
132 | { | |
133 | int flen = strlen(fnam); | |
134 | GLOBALS->mvlfacs_vzt_c_3[i+1].name=malloc_2(flen+1); | |
135 | strcpy(GLOBALS->mvlfacs_vzt_c_3[i+1].name, fnam); | |
136 | } | |
108 | 137 | } |
109 | 138 | |
110 | 139 | if(i>1) |
243 | 272 | /* SPLASH */ splash_sync(2, 5); |
244 | 273 | GLOBALS->facs=(struct symbol **)malloc_2(GLOBALS->numfacs*sizeof(struct symbol *)); |
245 | 274 | |
246 | if(GLOBALS->fast_tree_sort) | |
275 | GLOBALS->pfx_hier_array = calloc_2(GLOBALS->hier_pfx_cnt ? GLOBALS->hier_pfx_cnt : 1, sizeof(char *)); | |
276 | ||
277 | lst = GLOBALS->hier_pfx; | |
278 | if(lst) | |
279 | { | |
280 | jrb_traverse(ptr, lst) | |
281 | { | |
282 | GLOBALS->pfx_hier_array[ptr->val.ui] = ptr->key.s; | |
283 | } | |
284 | } | |
285 | ||
286 | if((GLOBALS->fast_tree_sort) && (!GLOBALS->do_hier_compress)) | |
247 | 287 | { |
248 | 288 | GLOBALS->curnode=GLOBALS->firstnode; |
249 | 289 | for(i=0;i<GLOBALS->numfacs;i++) |
300 | 340 | init_tree(); |
301 | 341 | for(i=0;i<GLOBALS->numfacs;i++) |
302 | 342 | { |
303 | build_tree_from_name(GLOBALS->facs[i]->name, i); | |
343 | build_tree_from_name(GLOBALS->facs[i]->name, i); | |
304 | 344 | } |
305 | 345 | /* SPLASH */ splash_sync(4, 5); |
306 | 346 | treegraft(GLOBALS->treeroot); |
354 | 394 | init_tree(); |
355 | 395 | for(i=0;i<GLOBALS->numfacs;i++) |
356 | 396 | { |
357 | build_tree_from_name(GLOBALS->facs[i]->name, i); | |
397 | char *n = GLOBALS->facs[i]->name; | |
398 | int was_packed; | |
399 | char *recon = hier_decompress_flagged(n, &was_packed); | |
400 | ||
401 | if(was_packed) | |
402 | { | |
403 | build_tree_from_name(recon, i); | |
404 | free_2(recon); | |
405 | } | |
406 | else | |
407 | { | |
408 | build_tree_from_name(n, i); | |
409 | } | |
358 | 410 | } |
359 | 411 | /* SPLASH */ splash_sync(5, 5); |
360 | 412 | treegraft(GLOBALS->treeroot); |
361 | 413 | treesort(GLOBALS->treeroot, NULL); |
414 | } | |
415 | ||
416 | if(GLOBALS->prev_hier_uncompressed_name) | |
417 | { | |
418 | free_2(GLOBALS->prev_hier_uncompressed_name); | |
419 | GLOBALS->prev_hier_uncompressed_name = NULL; | |
362 | 420 | } |
363 | 421 | |
364 | 422 | GLOBALS->min_time = GLOBALS->first_cycle_vzt_c_3; GLOBALS->max_time=GLOBALS->last_cycle_vzt_c_3; |
572 | 630 | if(f->flags&VZT_RD_SYM_F_STRING) np->head.flags |= HIST_STRING; |
573 | 631 | } |
574 | 632 | |
633 | { | |
634 | struct HistEnt *htemp2 = calloc_2(1, sizeof(struct HistEnt)); | |
635 | htemp2->time = -1; | |
636 | if(len>1) | |
637 | { | |
638 | htemp2->v.h_vector = htemp->v.h_vector; | |
639 | } | |
640 | else | |
641 | { | |
642 | htemp2->v.h_val = htemp->v.h_val; | |
643 | } | |
644 | htemp2->next = htemp; | |
645 | htemp = htemp2; | |
646 | GLOBALS->vzt_table_vzt_c_1[txidx].numtrans++; | |
647 | } | |
648 | ||
575 | 649 | np->head.time = -2; |
576 | 650 | np->head.next = htemp; |
577 | 651 | np->numhist=GLOBALS->vzt_table_vzt_c_1[txidx].numtrans +2 /*endcap*/ +1 /*frontcap*/; |
698 | 772 | if(f->flags&VZT_RD_SYM_F_STRING) np->head.flags |= HIST_STRING; |
699 | 773 | } |
700 | 774 | |
775 | { | |
776 | struct HistEnt *htemp2 = calloc_2(1, sizeof(struct HistEnt)); | |
777 | htemp2->time = -1; | |
778 | if(len>1) | |
779 | { | |
780 | htemp2->v.h_vector = htemp->v.h_vector; | |
781 | } | |
782 | else | |
783 | { | |
784 | htemp2->v.h_val = htemp->v.h_val; | |
785 | } | |
786 | htemp2->next = htemp; | |
787 | htemp = htemp2; | |
788 | GLOBALS->vzt_table_vzt_c_1[txidx].numtrans++; | |
789 | } | |
790 | ||
701 | 791 | np->head.time = -2; |
702 | 792 | np->head.next = htemp; |
703 | 793 | np->numhist=GLOBALS->vzt_table_vzt_c_1[txidx].numtrans +2 /*endcap*/ +1 /*frontcap*/; |
712 | 802 | } |
713 | 803 | |
714 | 804 | /* |
715 | * $Id: vzt.c,v 1.2 2007/08/26 21:35:46 gtkwave Exp $ | |
805 | * $Id: vzt.c,v 1.4 2008/07/20 20:48:08 gtkwave Exp $ | |
716 | 806 | * $Log: vzt.c,v $ |
807 | * Revision 1.4 2008/07/20 20:48:08 gtkwave | |
808 | * compressed hierarchy support | |
809 | * | |
810 | * Revision 1.3 2008/06/15 21:26:45 gtkwave | |
811 | * time -1 endcap add for LXT2 + VZT loaders | |
812 | * | |
717 | 813 | * Revision 1.2 2007/08/26 21:35:46 gtkwave |
718 | 814 | * integrated global context management from SystemOfCode2007 branch |
719 | 815 | * |
1237 | 1237 | { |
1238 | 1238 | gint rc; |
1239 | 1239 | gint page_num = gtk_notebook_get_current_page(GTK_NOTEBOOK(GLOBALS->notebook)); |
1240 | struct Global *g_old = GLOBALS; | |
1240 | /* struct Global *g_old = GLOBALS; */ | |
1241 | 1241 | |
1242 | 1242 | set_GLOBALS((*GLOBALS->contexts)[page_num]); |
1243 | 1243 | |
3114 | 3114 | GdkGC *cinf = GLOBALS->gc_w_wavewindow_c_1; |
3115 | 3115 | GdkGC *cfixed; |
3116 | 3116 | double mynan = strtod("NaN", NULL); |
3117 | double tmin = mynan, tmax = mynan, tv, tv2; | |
3117 | double tmin = mynan, tmax = mynan, tv=0.0, tv2; | |
3118 | 3118 | gint rmargin; |
3119 | 3119 | int is_nan = 0, is_nan2 = 0, is_inf = 0, is_inf2 = 0; |
3120 | 3120 | int any_infs = 0, any_infp = 0, any_infm = 0; |
3751 | 3751 | } |
3752 | 3752 | |
3753 | 3753 | /* |
3754 | * $Id: wavewindow.c,v 1.34 2008/04/03 16:56:11 gtkwave Exp $ | |
3754 | * $Id: wavewindow.c,v 1.36 2008/07/01 18:51:07 gtkwave Exp $ | |
3755 | 3755 | * $Log: wavewindow.c,v $ |
3756 | * Revision 1.36 2008/07/01 18:51:07 gtkwave | |
3757 | * compiler warning fixes for amd64 | |
3758 | * | |
3759 | * Revision 1.35 2008/06/11 08:01:57 gtkwave | |
3760 | * gcc 4.3.x compiler warning fixes | |
3761 | * | |
3756 | 3762 | * Revision 1.34 2008/04/03 16:56:11 gtkwave |
3757 | 3763 | * more time_trunc() removals |
3758 | 3764 | * |
24 | 24 | |
25 | 25 | pageinc=(gfloat)(((gdouble)GLOBALS->wavewidth)*GLOBALS->nspx); |
26 | 26 | hadj->page_size=hadj->page_increment=(pageinc>=1.0)?pageinc:1.0; |
27 | hadj->step_increment=(GLOBALS->nspx>=1.0)?GLOBALS->nspx:1.0; | |
27 | ||
28 | /* hadj->step_increment=(GLOBALS->nspx>=1.0)?GLOBALS->nspx:1.0; */ | |
29 | ||
30 | hadj->step_increment = pageinc / 10.0; | |
31 | if(hadj->step_increment < 1.0) hadj->step_increment = 1.0; | |
28 | 32 | |
29 | 33 | if(hadj->page_size >= (hadj->upper-hadj->lower)) hadj->value=hadj->lower; |
30 | 34 | if(hadj->value+hadj->page_size>hadj->upper) |
470 | 474 | } |
471 | 475 | |
472 | 476 | /* |
473 | * $Id: zoombuttons.c,v 1.4 2007/09/12 19:24:45 gtkwave Exp $ | |
477 | * $Id: zoombuttons.c,v 1.5 2008/08/05 20:14:26 gtkwave Exp $ | |
474 | 478 | * $Log: zoombuttons.c,v $ |
479 | * Revision 1.5 2008/08/05 20:14:26 gtkwave | |
480 | * make step_increment equal to 1/10 of the page inc rather than pixel level | |
481 | * | |
475 | 482 | * Revision 1.4 2007/09/12 19:24:45 gtkwave |
476 | 483 | * more ctx_swap_watchdog updates |
477 | 484 | * |