Codebase list gtkwave / 8959a9d
Imported Upstream version 3.3.95 أحمد المحمودي (Ahmed El-Mahmoudy) 5 years ago
32 changed file(s) with 816 addition(s) and 268 deletion(s). Raw diff Collapse all Expand all
16641664 3.3.94 03sep18 Applied ghwlib.c patch for dealing with null ranges.
16651665 Added second chance algorithm for find_dumpfile() in case
16661666 it fails.
1667 3.3.95 07oct18 Added fflush on stdout for help text as fix for possible
1668 stdout problem with mingw/msys shells.
1669 Added preliminary support for Time datatype.
1670 Warnings fixes for Verilator integration.
1671 Fixed install_proc_filter usage for Tcl invocation.
1672 Change integer type to "integer" in SST to differentiate it
1673 from sv ints.
1674 Premiminary support for enum tables embedded in FST files.
00 ##########################################################################
11
2 GTKWave 3.3.94 Wave Viewer is Copyright (C) 1999-2018 Tony Bybell.
2 GTKWave 3.3.95 Wave Viewer is Copyright (C) 1999-2018 Tony Bybell.
33 Portions of GTKWave are Copyright (C) 1999-2018 Udi Finkelstein.
44 Context support is Copyright (C) 2007-2018 Kermin Elliott Fleming.
55 Trace group support is Copyright (C) 2009-2018 Donald Baltus.
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for gtkwave 3.3.94.
2 # Generated by GNU Autoconf 2.69 for gtkwave 3.3.95.
33 #
44 # Report bugs to <bybell@rocketmail.com>.
55 #
579579 # Identity of this package.
580580 PACKAGE_NAME='gtkwave'
581581 PACKAGE_TARNAME='gtkwave'
582 PACKAGE_VERSION='3.3.94'
583 PACKAGE_STRING='gtkwave 3.3.94'
582 PACKAGE_VERSION='3.3.95'
583 PACKAGE_STRING='gtkwave 3.3.95'
584584 PACKAGE_BUGREPORT='bybell@rocketmail.com'
585585 PACKAGE_URL=''
586586
14041404 # Omit some internal or obsolete options to make the list less imposing.
14051405 # This message is too long to be a string in the A/UX 3.1 sh.
14061406 cat <<_ACEOF
1407 \`configure' configures gtkwave 3.3.94 to adapt to many kinds of systems.
1407 \`configure' configures gtkwave 3.3.95 to adapt to many kinds of systems.
14081408
14091409 Usage: $0 [OPTION]... [VAR=VALUE]...
14101410
14701470
14711471 if test -n "$ac_init_help"; then
14721472 case $ac_init_help in
1473 short | recursive ) echo "Configuration of gtkwave 3.3.94:";;
1473 short | recursive ) echo "Configuration of gtkwave 3.3.95:";;
14741474 esac
14751475 cat <<\_ACEOF
14761476
16291629 test -n "$ac_init_help" && exit $ac_status
16301630 if $ac_init_version; then
16311631 cat <<\_ACEOF
1632 gtkwave configure 3.3.94
1632 gtkwave configure 3.3.95
16331633 generated by GNU Autoconf 2.69
16341634
16351635 Copyright (C) 2012 Free Software Foundation, Inc.
22732273 This file contains any messages produced by compilers while
22742274 running configure, to aid debugging if configure makes a mistake.
22752275
2276 It was created by gtkwave $as_me 3.3.94, which was
2276 It was created by gtkwave $as_me 3.3.95, which was
22772277 generated by GNU Autoconf 2.69. Invocation command line was
22782278
22792279 $ $0 $@
31403140
31413141 # Define the identity of the package.
31423142 PACKAGE='gtkwave'
3143 VERSION='3.3.94'
3143 VERSION='3.3.95'
31443144
31453145
31463146 cat >>confdefs.h <<_ACEOF
1149811498 # report actual input values of CONFIG_FILES etc. instead of their
1149911499 # values after options handling.
1150011500 ac_log="
11501 This file was extended by gtkwave $as_me 3.3.94, which was
11501 This file was extended by gtkwave $as_me 3.3.95, which was
1150211502 generated by GNU Autoconf 2.69. Invocation command line was
1150311503
1150411504 CONFIG_FILES = $CONFIG_FILES
1156411564 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1156511565 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1156611566 ac_cs_version="\\
11567 gtkwave config.status 3.3.94
11567 gtkwave config.status 3.3.95
1156811568 configured by $0, generated by GNU Autoconf 2.69,
1156911569 with options \\"\$ac_cs_config\\"
1157011570
11 # Process this file with autoconf to produce a configure script.
22
33 AC_PREREQ(2.59)
4 AC_INIT(gtkwave, 3.3.94, bybell@rocketmail.com)
4 AC_INIT(gtkwave, 3.3.95, bybell@rocketmail.com)
55 AC_CONFIG_SRCDIR([src/vcd.c])
66 AM_INIT_AUTOMAKE
77 AC_CONFIG_HEADER([config.h])
77 <key>CFBundleExecutable</key>
88 <string>gtkwave</string>
99 <key>CFBundleGetInfoString</key>
10 <string>3.3.94, (C) 1999-2018 Tony Bybell http://gtkwave.sourceforge.net</string>
10 <string>3.3.95, (C) 1999-2018 Tony Bybell http://gtkwave.sourceforge.net</string>
1111 <key>CFBundleIconFile</key>
1212 <string>gtkwave.icns</string>
1313 <key>CFBundleIdentifier</key>
1717 <key>CFBundlePackageType</key>
1818 <string>APPL</string>
1919 <key>CFBundleShortVersionString</key>
20 <string>3.3.94</string>
20 <string>3.3.95</string>
2121 <key>CFBundleSignature</key>
2222 <string>????</string>
2323 <key>CFBundleVersion</key>
24 <string>3.3.94</string>
24 <string>3.3.95</string>
2525 <key>NSHumanReadableCopyright</key>
2626 <string>Copyright 1999 - 2018 Tony Bybell, GNU General Public License.</string>
2727 <key>LSMinimumSystemVersion</key>
Binary diff not shown
173173 accel "/Edit/Data Format/Binary" <Alt>B
174174 accel "/Edit/Data Format/Octal" <Alt>O
175175 accel "/Edit/Data Format/ASCII" (null)
176 accel "/Edit/Data Format/Time", (null)
177 accel "/Edit/Data Format/Enum", (null)
176178 accel "/Edit/Data Format/BitsToReal" (null)
177179 accel "/Edit/Data Format/RealToBits/On" (null)
178180 accel "/Edit/Data Format/RealToBits/Off" (null)
240240 if(GLOBALS->default_flags&TR_NUMMASK) t->flags=GLOBALS->default_flags;
241241 else t->flags=(t->flags&TR_NUMMASK)|GLOBALS->default_flags;
242242
243 if(!t->vector && GLOBALS->enum_nptrs_jrb)
244 {
245 JRB enum_nptr = jrb_find_vptr(GLOBALS->enum_nptrs_jrb, t->n.nd);
246 if(enum_nptr)
247 {
248 int e_filter = enum_nptr->val.ui;
249 if((e_filter > 0) && (e_filter <= GLOBALS->num_xl_enum_filter))
250 {
251 t->e_filter = e_filter;
252 if(!(GLOBALS->default_flags&TR_NUMMASK)) t->flags = (t->flags & (~TR_NUMMASK)) | TR_ENUM | TR_BIN; /* need to downgrade to bin to make visible */
253 }
254 }
255 }
256
243257 if(GLOBALS->default_flags & TR_FTRANSLATED)
244258 {
245259 t->f_filter = GLOBALS->current_translate_file;
259273 if(!t->vector)
260274 {
261275 bvptr v;
262 int cache_hi = t->flags & TR_HIGHLIGHT;
276 TraceFlagsType cache_hi = t->flags & TR_HIGHLIGHT;
263277
264278 t->flags |= TR_HIGHLIGHT;
265279 v = combine_traces(1, t); /* down: make single signal a vector */
364378 {
365379 Trptr t;
366380 char *comment;
367 unsigned int flags_filtered;
381 TraceFlagsType flags_filtered;
368382
369383 if( (t = (Trptr) calloc_2( 1, sizeof( TraceEnt ))) == NULL )
370384 {
397411 /*
398412 * Insert a blank [or comment] trace into the display...
399413 */
400 int InsertBlankTrace(char *comment, int different_flags)
414 int InsertBlankTrace(char *comment, TraceFlagsType different_flags)
401415 {
402416 TempBuffer tb;
403417 char *comm;
215215 static const char *vartype_strings[] = { \
216216 "", \
217217 "event", \
218 "int", \
218 "integer", \
219219 "parm", \
220220 "real", \
221221 "real_parm", \
377377 /* if ND_DIR_MAX exceeds 7, need to update struct Node's "unsigned vardir : 3" declaration */
378378 };
379379
380
381 typedef uint64_t TraceFlagsType;
382 #define TRACEFLAGSSCNFMT SCNx64
383 #define TRACEFLAGSPRIFMT PRIx64
384 #define TRACEFLAGSPRIuFMT PRIu64
385
380386 typedef struct BitAttributes
381387 {
382388 TimeType shift;
383 unsigned int flags;
389 TraceFlagsType flags;
384390 } BitAttributes;
385391
386392
470476 int buffercount; /* number of traces in buffer */
471477 } TempBuffer;
472478
479
473480 typedef struct TraceEnt
474481 {
475482 Trptr t_next; /* doubly linked list of traces */
494501 bvptr vec;
495502 } n;
496503
497 unsigned int flags; /* see def below in TraceEntFlagBits */
498 unsigned int cached_flags; /* used for tcl for saving flags during cut and paste */
504 TraceFlagsType flags; /* see def below in TraceEntFlagBits */
505 TraceFlagsType cached_flags; /* used for tcl for saving flags during cut and paste */
499506
500507 int f_filter; /* file filter */
501508 int p_filter; /* process filter */
502509 int t_filter; /* transaction process filter */
510 int e_filter; /* enum filter (from FST) */
503511
504512 unsigned int t_color; /* trace color index */
505513 unsigned char t_fpdecshift; /* for fixed point decimal */
527535 TR_REAL2BITS_B, TR_TTRANSLATED_B,
528536 TR_POPCNT_B,
529537 TR_FPDECSHIFT_B,
538 TR_TIME_B,
539 TR_ENUM_B,
530540
531541 TR_RSVD_B /* for use internally such as temporary caching of highlighting, not for use in traces */
532542 };
533543
534 #define TR_HIGHLIGHT (1<<TR_HIGHLIGHT_B)
535 #define TR_HEX (1<<TR_HEX_B)
536 #define TR_ASCII (1<<TR_ASCII_B)
537 #define TR_DEC (1<<TR_DEC_B)
538 #define TR_BIN (1<<TR_BIN_B)
539 #define TR_OCT (1<<TR_OCT_B)
540 #define TR_RJUSTIFY (1<<TR_RJUSTIFY_B)
541 #define TR_INVERT (1<<TR_INVERT_B)
542 #define TR_REVERSE (1<<TR_REVERSE_B)
543 #define TR_EXCLUDE (1<<TR_EXCLUDE_B)
544 #define TR_BLANK (1<<TR_BLANK_B)
545 #define TR_SIGNED (1<<TR_SIGNED_B)
546 #define TR_ANALOG_STEP (1<<TR_ANALOG_STEP_B)
547 #define TR_ANALOG_INTERPOLATED (1<<TR_ANALOG_INTERPOLATED_B)
548 #define TR_ANALOG_BLANK_STRETCH (1<<TR_ANALOG_BLANK_STRETCH_B)
549 #define TR_REAL (1<<TR_REAL_B)
550 #define TR_ANALOG_FULLSCALE (1<<TR_ANALOG_FULLSCALE_B)
551 #define TR_ZEROFILL (1<<TR_ZEROFILL_B)
552 #define TR_ONEFILL (1<<TR_ONEFILL_B)
553 #define TR_CLOSED (1<<TR_CLOSED_B)
554
555 #define TR_GRP_BEGIN (1<<TR_GRP_BEGIN_B)
556 #define TR_GRP_END (1<<TR_GRP_END_B)
544 #define TR_HIGHLIGHT (UINT64_C(1)<<TR_HIGHLIGHT_B)
545 #define TR_HEX (UINT64_C(1)<<TR_HEX_B)
546 #define TR_ASCII (UINT64_C(1)<<TR_ASCII_B)
547 #define TR_DEC (UINT64_C(1)<<TR_DEC_B)
548 #define TR_BIN (UINT64_C(1)<<TR_BIN_B)
549 #define TR_OCT (UINT64_C(1)<<TR_OCT_B)
550 #define TR_RJUSTIFY (UINT64_C(1)<<TR_RJUSTIFY_B)
551 #define TR_INVERT (UINT64_C(1)<<TR_INVERT_B)
552 #define TR_REVERSE (UINT64_C(1)<<TR_REVERSE_B)
553 #define TR_EXCLUDE (UINT64_C(1)<<TR_EXCLUDE_B)
554 #define TR_BLANK (UINT64_C(1)<<TR_BLANK_B)
555 #define TR_SIGNED (UINT64_C(1)<<TR_SIGNED_B)
556 #define TR_ANALOG_STEP (UINT64_C(1)<<TR_ANALOG_STEP_B)
557 #define TR_ANALOG_INTERPOLATED (UINT64_C(1)<<TR_ANALOG_INTERPOLATED_B)
558 #define TR_ANALOG_BLANK_STRETCH (UINT64_C(1)<<TR_ANALOG_BLANK_STRETCH_B)
559 #define TR_REAL (UINT64_C(1)<<TR_REAL_B)
560 #define TR_ANALOG_FULLSCALE (UINT64_C(1)<<TR_ANALOG_FULLSCALE_B)
561 #define TR_ZEROFILL (UINT64_C(1)<<TR_ZEROFILL_B)
562 #define TR_ONEFILL (UINT64_C(1)<<TR_ONEFILL_B)
563 #define TR_CLOSED (UINT64_C(1)<<TR_CLOSED_B)
564
565 #define TR_GRP_BEGIN (UINT64_C(1)<<TR_GRP_BEGIN_B)
566 #define TR_GRP_END (UINT64_C(1)<<TR_GRP_END_B)
557567 #define TR_GRP_MASK (TR_GRP_BEGIN|TR_GRP_END)
558568
559 #define TR_BINGRAY (1<<TR_BINGRAY_B)
560 #define TR_GRAYBIN (1<<TR_GRAYBIN_B)
569 #define TR_BINGRAY (UINT64_C(1)<<TR_BINGRAY_B)
570 #define TR_GRAYBIN (UINT64_C(1)<<TR_GRAYBIN_B)
561571 #define TR_GRAYMASK (TR_BINGRAY|TR_GRAYBIN)
562572
563 #define TR_REAL2BITS (1<<TR_REAL2BITS_B)
564
565 #define TR_NUMMASK (TR_ASCII|TR_HEX|TR_DEC|TR_BIN|TR_OCT|TR_SIGNED|TR_REAL)
566
567 #define TR_COLLAPSED (1<<TR_COLLAPSED_B)
573 #define TR_REAL2BITS (UINT64_C(1)<<TR_REAL2BITS_B)
574
575 #define TR_NUMMASK (TR_ASCII|TR_HEX|TR_DEC|TR_BIN|TR_OCT|TR_SIGNED|TR_REAL|TR_TIME|TR_ENUM)
576
577 #define TR_COLLAPSED (UINT64_C(1)<<TR_COLLAPSED_B)
568578 #define TR_ISCOLLAPSED (TR_BLANK|TR_COLLAPSED)
569579
570 #define TR_FTRANSLATED (1<<TR_FTRANSLATED_B)
571 #define TR_PTRANSLATED (1<<TR_PTRANSLATED_B)
572 #define TR_TTRANSLATED (1<<TR_TTRANSLATED_B)
573
574 #define TR_POPCNT (1<<TR_POPCNT_B)
575 #define TR_FPDECSHIFT (1<<TR_FPDECSHIFT_B)
580 #define TR_FTRANSLATED (UINT64_C(1)<<TR_FTRANSLATED_B)
581 #define TR_PTRANSLATED (UINT64_C(1)<<TR_PTRANSLATED_B)
582 #define TR_TTRANSLATED (UINT64_C(1)<<TR_TTRANSLATED_B)
583
584 #define TR_POPCNT (UINT64_C(1)<<TR_POPCNT_B)
585 #define TR_FPDECSHIFT (UINT64_C(1)<<TR_FPDECSHIFT_B)
586
587 #define TR_TIME (UINT64_C(1)<<TR_TIME_B)
588 #define TR_ENUM (UINT64_C(1)<<TR_ENUM_B)
576589
577590 #define TR_ANALOGMASK (TR_ANALOG_STEP|TR_ANALOG_INTERPOLATED)
578591
579 #define TR_RSVD (1<<TR_RSVD_B)
592 #define TR_RSVD (UINT64_C(1)<<TR_RSVD_B)
580593
581594 Trptr GiveNextTrace(Trptr t);
582595 Trptr GivePrevTrace(Trptr t);
588601 int AddNodeUnroll(nptr nd, char *aliasname);
589602 int AddVector(bvptr vec, char *aliasname);
590603 int AddBlankTrace(char *commentname);
591 int InsertBlankTrace(char *comment, int different_flags);
604 int InsertBlankTrace(char *comment, TraceFlagsType different_flags);
592605 void RemoveNode(nptr n);
593606 void RemoveTrace(Trptr t, int dofree);
594607 void FreeTrace(Trptr t);
257257 */
258258 static char *convert_ascii_2(Trptr t, vptr v)
259259 {
260 Ulong flags;
260 TraceFlagsType flags;
261261 int nbits;
262262 unsigned char *bits;
263263 char *os, *pnt, *newbuff;
695695 }
696696 else
697697 {
698 sprintf(os, TTFormat, val);
698 if(!(flags&TR_TIME))
699 {
700 sprintf(os, TTFormat, val);
701 }
702 else
703 {
704 free_2(os);
705 os = calloc_2(1, 128);
706 reformat_time(os, val, GLOBALS->time_dimension);
707 }
699708 }
700709 }
701710 else
792801 }
793802 else
794803 {
795 sprintf(os, UTTFormat, val);
804 if(!(flags&TR_TIME))
805 {
806 sprintf(os, UTTFormat, val);
807 }
808 else
809 {
810 free_2(os);
811 os = calloc_2(1, 128);
812 reformat_time(os, val, GLOBALS->time_dimension);
813 }
796814 }
797815 }
798816 else
956974 */
957975 char *convert_ascii_vec_2(Trptr t, char *vec)
958976 {
959 Ulong flags;
977 TraceFlagsType flags;
960978 int nbits;
961979 char *bits;
962980 char *os, *pnt, *newbuff;
14081426 }
14091427 else
14101428 {
1411 sprintf(os, TTFormat, val);
1429 if(!(flags&TR_TIME))
1430 {
1431 sprintf(os, TTFormat, val);
1432 }
1433 else
1434 {
1435 free_2(os);
1436 os = calloc_2(1, 128);
1437 reformat_time(os, val, GLOBALS->time_dimension);
1438 }
14121439 }
14131440 }
14141441 else
15061533 }
15071534 else
15081535 {
1509 sprintf(os, UTTFormat, val);
1536 if(!(flags&TR_TIME))
1537 {
1538 sprintf(os, UTTFormat, val);
1539 }
1540 else
1541 {
1542 free_2(os);
1543 os = calloc_2(1, 128);
1544 reformat_time(os, val, GLOBALS->time_dimension);
1545 }
15101546 }
15111547 }
15121548 else
15481584 return(s);
15491585 }
15501586
1587 static char *edofilter(Trptr t, char *s)
1588 {
1589 if(t->flags & TR_ENUM)
1590 {
1591 int filt = t->e_filter - 1;
1592
1593 #ifdef _WAVE_HAVE_JUDY
1594 PPvoid_t pv = JudyHSGet(GLOBALS->xl_enum_filter[filt], s, strlen(s));
1595 if(pv)
1596 {
1597 free_2(s);
1598 s = malloc_2(strlen(*pv) + 1);
1599 strcpy(s, *pv);
1600 }
1601 #else
1602 GLOBALS->xl_enum_filter[filt] = xl_splay(s, GLOBALS->xl_enum_filter[filt]);
1603
1604 if(!strcasecmp(s, GLOBALS->xl_enum_filter[filt]->item))
1605 {
1606 free_2(s);
1607 s = malloc_2(strlen(GLOBALS->xl_enum_filter[filt]->trans) + 1);
1608 strcpy(s, GLOBALS->xl_enum_filter[filt]->trans);
1609 }
1610 #endif
1611 else
1612 {
1613 char *zerofind = s;
1614 char *dst = s, *src;
1615 while(*zerofind == '0') zerofind++;
1616 if(zerofind != s)
1617 {
1618 src = (!*zerofind) ? (zerofind-1) : zerofind;
1619 while(*src)
1620 {
1621 *(dst++) = *(src++);
1622 }
1623 *dst = 0;
1624 }
1625 }
1626 }
1627
1628 return(s);
1629 }
1630
15511631 static char *pdofilter(Trptr t, char *s)
15521632 {
15531633 struct pipe_ctx *p = GLOBALS->proc_filter[t->p_filter];
16231703 {
16241704 char *s = convert_ascii_vec_2(t, vec);
16251705
1626 if(!(t->f_filter|t->p_filter))
1706 if(!(t->f_filter|t->p_filter|t->e_filter))
16271707 {
16281708 }
16291709 else
16301710 {
1711 if(t->e_filter)
1712 {
1713 s = edofilter(t, s);
1714 }
1715 else
16311716 if(t->f_filter)
16321717 {
16331718 s = dofilter(t, s);
16681753 }
16691754 }
16701755
1671 if(!(t->f_filter|t->p_filter))
1756 if(!(t->f_filter|t->p_filter|t->e_filter))
16721757 {
16731758 }
16741759 else
16751760 {
1761 if(t->e_filter)
1762 {
1763 s = edofilter(t, s);
1764 }
1765 else
16761766 if(t->f_filter)
16771767 {
16781768 s = dofilter(t, s);
785785 else
786786 if(state==2)
787787 {
788 sscanf(wild, "%x", &ba[nodepnt-1].flags);
788 sscanf(wild, "%"TRACEFLAGSSCNFMT, &ba[nodepnt-1].flags);
789789 state = 0;
790790 goto fw;
791791 }
452452 GLOBALS->fst_synclock_str = strdup_2(h->u.attr.name);
453453 }
454454 }
455 else
456 if(h->u.attr.subtype == FST_MT_ENUMTABLE)
457 {
458 if(h->u.attr.name)
459 {
460 GLOBALS->queued_xl_enum_filter = h->u.attr.arg; /* consumed by next enum variable definition */
461
462 if(h->u.attr.name_length)
463 {
464 struct fstETab *fe = fstUtilityExtractEnumTableFromString(h->u.attr.name);
465 /* currently fe->name is unused */
466 if(fe)
467 {
468 int ie;
469 #ifdef _WAVE_HAVE_JUDY
470 Pvoid_t e = (Pvoid_t) NULL;
471 for(ie=0; ie<fe->elem_count; ie++)
472 {
473 PPvoid_t pv = JudyHSIns(&e, fe->val_arr[ie], strlen(fe->val_arr[ie]), NULL);
474 if(*pv)
475 {
476 free_2(*pv);
477 }
478 *pv = (void *)strdup_2(fe->literal_arr[ie]);
479 }
480 #else
481 struct xl_tree_node *e = NULL;
482
483 for(ie=0; ie<fe->elem_count; ie++)
484 {
485 e = xl_insert(fe->val_arr[ie], e, fe->literal_arr[ie]);
486 }
487 #endif
488
489 if(GLOBALS->xl_enum_filter)
490 {
491 GLOBALS->num_xl_enum_filter++;
492 GLOBALS->xl_enum_filter = realloc_2(GLOBALS->xl_enum_filter, GLOBALS->num_xl_enum_filter * sizeof(struct xl_tree_node *));
493 }
494 else
495 {
496 GLOBALS->num_xl_enum_filter++;
497 GLOBALS->xl_enum_filter = malloc_2(sizeof(struct xl_tree_node *));
498 }
499
500 GLOBALS->xl_enum_filter[GLOBALS->num_xl_enum_filter-1] = e;
501
502 if(GLOBALS->num_xl_enum_filter != h->u.attr.arg)
503 {
504 fprintf(stderr, FST_RDLOAD"Internal error, nonsequential enum tables definition encountered, exiting.\n");
505 exit(255);
506 }
507
508 fstUtilityFreeEnumTable(fe);
509 }
510 }
511 }
512 }
455513 }
456514 break;
457515
9791037 GLOBALS->facs[i]=&sym_block[i];
9801038 n=&node_block[i];
9811039
1040 if(GLOBALS->queued_xl_enum_filter)
1041 {
1042 Jval jv;
1043 jv.ui = GLOBALS->queued_xl_enum_filter;
1044 GLOBALS->queued_xl_enum_filter = 0;
1045
1046 if(!GLOBALS->enum_nptrs_jrb) GLOBALS->enum_nptrs_jrb = make_jrb();
1047 jrb_insert_vptr(GLOBALS->enum_nptrs_jrb, n, jv);
1048 }
1049
9821050 if(GLOBALS->do_hier_compress)
9831051 {
9841052 n->nname = compress_facility((unsigned char *)s->name, longest_nam_candidate);
347347 0, /* istem_valid */
348348 NULL, /* fst_synclock_str */
349349 NULL, /* synclock_jrb */
350 NULL, /* xl_enum_filter */
351 0, /* num_xl_enum_filter */
352 0, /* queued_xl_enum_filter */
353 NULL, /* enum_nptrs_jrb */
350354
351355
352356 /*
20762080 GLOBALS->synclock_jrb = NULL;
20772081 }
20782082
2083 if(GLOBALS->enum_nptrs_jrb)
2084 {
2085 jrb_free_tree(GLOBALS->enum_nptrs_jrb);
2086 GLOBALS->enum_nptrs_jrb = NULL;
2087 }
2088
2089 #ifdef _WAVE_HAVE_JUDY
2090 if(GLOBALS->num_xl_enum_filter)
2091 {
2092 int ie;
2093 for(ie=0;ie<GLOBALS->num_xl_enum_filter;ie++)
2094 {
2095 JudyHSFreeArray(&GLOBALS->xl_enum_filter[ie], NULL);
2096 }
2097
2098 GLOBALS->num_xl_enum_filter = 0;
2099 }
2100 #endif
20792101
20802102 /* deallocate any loader-related stuff */
20812103 switch(GLOBALS->loaded_file_type) {
103103 /*
104104 * analyzer.c
105105 */
106 unsigned int default_flags; /* from analyzer.c 5 */
106 TraceFlagsType default_flags; /* from analyzer.c 5 */
107107 unsigned int default_fpshift;
108108 Times tims; /* from analyzer.c 6 */
109109 Traces traces; /* from analyzer.c 7 */
348348 unsigned istem_valid : 1;
349349 char *fst_synclock_str;
350350 JRB synclock_jrb;
351 #ifdef _WAVE_HAVE_JUDY
352 Pvoid_t *xl_enum_filter;
353 #else
354 struct xl_tree_node **xl_enum_filter;
355 #endif
356 int num_xl_enum_filter;
357 fstEnumHandle queued_xl_enum_filter;
358 JRB enum_nptrs_jrb;
351359
352360
353361 /*
847855 GtkWidget *window_showchange_c_8; /* from showchange.c 392 */
848856 void (*cleanup_showchange_c_6)(void); /* from showchange.c 393 */
849857 struct TraceEnt *tcache_showchange_c_1; /* from showchange.c 394 */
850 unsigned int flags_showchange_c_1; /* from showchange.c 395 */
858 TraceFlagsType flags_showchange_c_1; /* from showchange.c 395 */
851859
852860
853861 /*
9494 // value changes
9595
9696 varint maxhandle associated with the value change data
97 uint8_t pack type ('F' is fastlz, '4' is lz4,
97 uint8_t pack type ('F' is fastlz, '4' is lz4,
9898 others ['Z'/'!'] are zlib)
9999
100100 varint chain 0 compressed data length (0 = uncompressed)
101 [compressed data]
101 [compressed data]
102102 ...
103103 varint chain n compressed data length (0 = uncompressed)
104 [compressed data]
104 [compressed data]
105105
106106 ---
107107
282282 #if (defined(__MACH__) && defined(__APPLE__))
283283 if(!resolved_path)
284284 {
285 resolved_path = malloc(PATH_MAX+1); /* fixes bug on Leopard when resolved_path == NULL */
285 resolved_path = (unsigned char *)malloc(PATH_MAX+1); /* fixes bug on Leopard when resolved_path == NULL */
286286 }
287287 #endif
288288
292292 #ifdef __MINGW32__
293293 if(!resolved_path)
294294 {
295 resolved_path = malloc(PATH_MAX+1);
295 resolved_path = (unsigned char *)malloc(PATH_MAX+1);
296296 }
297297 return(_fullpath(resolved_path, path, PATH_MAX));
298298 #else
316316 {
317317 (void)__off;
318318
319 unsigned char *pnt = malloc(__len);
319 unsigned char *pnt = (unsigned char *)malloc(__len);
320320 off_t cur_offs = lseek(__fd, 0, SEEK_CUR);
321321 size_t i;
322322
792792 char *valpos_handle_nam;
793793 char *curval_handle_nam;
794794 char *tchn_handle_nam;
795
796 fstEnumHandle max_enumhandle;
795797 };
796798
797799
803805 {
804806 xc->fseek_failed = 1;
805807 #ifdef FST_DEBUG
806 fprintf(stderr, FST_APIMESS"Seek to #%"PRId64" (whence = %d) failed!\n", offset, whence);
808 fprintf(stderr, FST_APIMESS"Seek to #%" PRId64 " (whence = %d) failed!\n", offset, whence);
807809 perror("Why");
808810 #endif
809811 }
969971 if(!xc->valpos_mem)
970972 {
971973 fflush(xc->valpos_handle);
972 xc->valpos_mem = fstMmap(NULL, xc->maxhandle * 4 * sizeof(uint32_t), PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->valpos_handle), 0);
974 xc->valpos_mem = (uint32_t *)fstMmap(NULL, xc->maxhandle * 4 * sizeof(uint32_t), PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->valpos_handle), 0);
973975 }
974976 if(!xc->curval_mem)
975977 {
976978 fflush(xc->curval_handle);
977 xc->curval_mem = fstMmap(NULL, xc->maxvalpos, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->curval_handle), 0);
979 xc->curval_mem = (unsigned char *)fstMmap(NULL, xc->maxvalpos, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->curval_handle), 0);
978980 }
979981 }
980982
11051107 */
11061108 void *fstWriterCreate(const char *nam, int use_compressed_hier)
11071109 {
1108 struct fstWriterContext *xc = calloc(1, sizeof(struct fstWriterContext));
1110 struct fstWriterContext *xc = (struct fstWriterContext *)calloc(1, sizeof(struct fstWriterContext));
11091111
11101112 xc->compress_hier = use_compressed_hier;
11111113 fstDetermineBreakSize(xc);
11191121 else
11201122 {
11211123 int flen = strlen(nam);
1122 char *hf = calloc(1, flen + 6);
1124 char *hf = (char *)calloc(1, flen + 6);
11231125
11241126 memcpy(hf, nam, flen);
11251127 strcpy(hf + flen, ".hier");
11301132 xc->curval_handle = tmpfile_open(&xc->curval_handle_nam); /* .bits */
11311133 xc->tchn_handle = tmpfile_open(&xc->tchn_handle_nam); /* .tchn */
11321134 xc->vchg_alloc_siz = xc->fst_break_size + xc->fst_break_add_size;
1133 xc->vchg_mem = malloc(xc->vchg_alloc_siz);
1135 xc->vchg_mem = (unsigned char *)malloc(xc->vchg_alloc_siz);
11341136
11351137 if(xc->hier_handle && xc->geom_handle && xc->valpos_handle && xc->curval_handle && xc->vchg_mem && xc->tchn_handle)
11361138 {
11791181 int rc;
11801182
11811183 destlen = xc->maxvalpos;
1182 dmem = malloc(compressBound(destlen));
1184 dmem = (unsigned char *)malloc(compressBound(destlen));
11831185 rc = compress2(dmem, &destlen, xc->curval_mem, xc->maxvalpos, 4); /* was 9...which caused performance drag on traces with many signals */
11841186
11851187 fputc(FST_BL_SKIP, xc->handle); /* temporarily tag the section, use FST_BL_VCDATA on finalize */
12681270 xc->already_in_flush = 1; /* should really do this with a semaphore */
12691271
12701272 xc->section_header_only = 0;
1271 scratchpad = malloc(xc->vchg_siz);
1273 scratchpad = (unsigned char *)malloc(xc->vchg_siz);
12721274
12731275 vchg_mem = xc->vchg_mem;
12741276
12781280 fpos = 1;
12791281
12801282 packmemlen = 1024; /* maintain a running "longest" allocation to */
1281 packmem = malloc(packmemlen); /* prevent continual malloc...free every loop iter */
1283 packmem = (unsigned char *)malloc(packmemlen); /* prevent continual malloc...free every loop iter */
12821284
12831285 for(i=0;i<xc->maxhandle;i++)
12841286 {
13981400 idx = ((vm4ip[1]+7) & ~7);
13991401 switch(vm4ip[1] & 7)
14001402 {
1401 case 0: do { acc = (pnt[idx+7-8] & 1) << 0;
1402 case 7: acc |= (pnt[idx+6-8] & 1) << 1;
1403 case 6: acc |= (pnt[idx+5-8] & 1) << 2;
1404 case 5: acc |= (pnt[idx+4-8] & 1) << 3;
1405 case 4: acc |= (pnt[idx+3-8] & 1) << 4;
1406 case 3: acc |= (pnt[idx+2-8] & 1) << 5;
1407 case 2: acc |= (pnt[idx+1-8] & 1) << 6;
1403 case 0: do { acc = (pnt[idx+7-8] & 1) << 0; /* fallthrough */
1404 case 7: acc |= (pnt[idx+6-8] & 1) << 1; /* fallthrough */
1405 case 6: acc |= (pnt[idx+5-8] & 1) << 2; /* fallthrough */
1406 case 5: acc |= (pnt[idx+4-8] & 1) << 3; /* fallthrough */
1407 case 4: acc |= (pnt[idx+3-8] & 1) << 4; /* fallthrough */
1408 case 3: acc |= (pnt[idx+2-8] & 1) << 5; /* fallthrough */
1409 case 2: acc |= (pnt[idx+1-8] & 1) << 6; /* fallthrough */
14081410 case 1: acc |= (pnt[idx+0-8] & 1) << 7;
14091411 *(--scratchpnt) = acc;
14101412 idx -= 8;
14401442 else
14411443 {
14421444 free(packmem);
1443 dmem = packmem = malloc(compressBound(packmemlen = wrlen));
1445 dmem = packmem = (unsigned char *)malloc(compressBound(packmemlen = wrlen));
14441446 }
14451447
14461448 rc = compress2(dmem, &destlen, scratchpnt, wrlen, 4);
14951497 else
14961498 {
14971499 free(packmem);
1498 dmem = packmem = malloc(packmemlen = (wrlen * 2) + 2);
1500 dmem = packmem = (unsigned char *)malloc(packmemlen = (wrlen * 2) + 2);
14991501 }
15001502
15011503 rc = (xc->fourpack) ? LZ4_compress((char *)scratchpnt, (char *)dmem, wrlen) : fastlz_compress(scratchpnt, wrlen, dmem);
16771679 tlen = ftello(xc->tchn_handle);
16781680 fstWriterFseeko(xc, xc->tchn_handle, 0, SEEK_SET);
16791681
1680 tmem = fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->tchn_handle), 0);
1682 tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->tchn_handle), 0);
16811683 if(tmem)
16821684 {
16831685 unsigned long destlen = tlen;
1684 unsigned char *dmem = malloc(compressBound(destlen));
1686 unsigned char *dmem = (unsigned char *)malloc(compressBound(destlen));
16851687 int rc = compress2(dmem, &destlen, tmem, tlen, 9);
16861688
16871689 if((rc == Z_OK) && (((off_t)destlen) < tlen))
17801782
17811783 if(xc->parallel_enabled)
17821784 {
1783 struct fstWriterContext *xc2 = malloc(sizeof(struct fstWriterContext));
1785 struct fstWriterContext *xc2 = (struct fstWriterContext *)malloc(sizeof(struct fstWriterContext));
17841786 unsigned int i;
17851787
17861788 pthread_mutex_lock(&xc->mutex);
17891791 xc->xc_parent = xc;
17901792 memcpy(xc2, xc, sizeof(struct fstWriterContext));
17911793
1792 xc2->valpos_mem = malloc(xc->maxhandle * 4 * sizeof(uint32_t));
1794 xc2->valpos_mem = (uint32_t *)malloc(xc->maxhandle * 4 * sizeof(uint32_t));
17931795 memcpy(xc2->valpos_mem, xc->valpos_mem, xc->maxhandle * 4 * sizeof(uint32_t));
17941796
17951797 /* curval mem is updated in the thread */
17961798 #ifdef FST_REMOVE_DUPLICATE_VC
1797 xc2->curval_mem = malloc(xc->maxvalpos);
1799 xc2->curval_mem = (unsigned char *)malloc(xc->maxvalpos);
17981800 memcpy(xc2->curval_mem, xc->curval_mem, xc->maxvalpos);
17991801 #endif
18001802
1801 xc->vchg_mem = malloc(xc->vchg_alloc_siz);
1803 xc->vchg_mem = (unsigned char *)malloc(xc->vchg_alloc_siz);
18021804 xc->vchg_mem[0] = '!';
18031805 xc->vchg_siz = 1;
18041806
19071909 /* write out geom section */
19081910 fflush(xc->geom_handle);
19091911 tlen = ftello(xc->geom_handle);
1910 tmem = fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->geom_handle), 0);
1912 tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->geom_handle), 0);
19111913 if(tmem)
19121914 {
19131915 unsigned long destlen = tlen;
1914 unsigned char *dmem = malloc(compressBound(destlen));
1916 unsigned char *dmem = (unsigned char *)malloc(compressBound(destlen));
19151917 int rc = compress2(dmem, &destlen, tmem, tlen, 9);
19161918
19171919 if((rc != Z_OK) || (((off_t)destlen) > tlen))
19791981 int zfd;
19801982 int fourpack_duo = 0;
19811983 #ifndef __MINGW32__
1982 char *fnam = malloc(strlen(xc->filename) + 5 + 1);
1984 char *fnam = (char *)malloc(strlen(xc->filename) + 5 + 1);
19831985 #endif
19841986
19851987 fixup_offs = ftello(xc->handle);
19901992
19911993 if(!xc->fourpack)
19921994 {
1993 unsigned char *mem = malloc(FST_GZIO_LEN);
1995 unsigned char *mem = (unsigned char *)malloc(FST_GZIO_LEN);
19941996 zfd = dup(fileno(xc->handle));
19951997 fflush(xc->handle);
19961998 zhandle = gzdopen(zfd, "wb4");
20212023 fflush(xc->handle);
20222024
20232025 lz4_maxlen = LZ4_compressBound(xc->hier_file_len);
2024 mem = malloc(lz4_maxlen);
2025 hmem = fstMmap(NULL, xc->hier_file_len, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->hier_handle), 0);
2026 mem = (unsigned char *)malloc(lz4_maxlen);
2027 hmem = (unsigned char *)fstMmap(NULL, xc->hier_file_len, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->hier_handle), 0);
20262028 packed_len = LZ4_compress((char *)hmem, (char *)mem, xc->hier_file_len);
20272029 fstMunmap(hmem, xc->hier_file_len);
20282030
20352037 int packed_len_duo;
20362038
20372039 lz4_maxlen_duo = LZ4_compressBound(packed_len);
2038 mem_duo = malloc(lz4_maxlen_duo);
2040 mem_duo = (unsigned char *)malloc(lz4_maxlen_duo);
20392041 packed_len_duo = LZ4_compress((char *)mem, (char *)mem_duo, packed_len);
20402042
20412043 fstWriterVarint(xc->handle, packed_len); /* 1st round compressed length */
20952097 FILE *fp;
20962098 off_t offpnt, uclen;
20972099 int flen = strlen(xc->filename);
2098 char *hf = calloc(1, flen + 5);
2100 char *hf = (char *)calloc(1, flen + 5);
20992101
21002102 strcpy(hf, xc->filename);
21012103 strcpy(hf+flen, ".pak");
21032105
21042106 if(fp)
21052107 {
2106 void *dsth;
2108 gzFile dsth;
21072109 int zfd;
21082110 char gz_membuf[FST_GZIO_LEN];
21092111
23022304 const unsigned char *path2 = (const unsigned char *)path;
23032305 PPvoid_t pv;
23042306 #else
2305 char *path2 = alloca(slen + 1); /* judy lacks const qualifier in its JudyHSIns definition */
2307 char *path2 = (char *)alloca(slen + 1); /* judy lacks const qualifier in its JudyHSIns definition */
23062308 PPvoid_t pv;
23072309 strcpy(path2, path);
23082310 #endif
25852587 xc->vchg_alloc_siz = xc->fst_break_size + xc->fst_break_add_size;
25862588 if(xc->vchg_mem)
25872589 {
2588 xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz);
2590 xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz);
25892591 }
25902592 }
25912593 }
27232725 }
27242726
27252727
2728 fstEnumHandle fstWriterCreateEnumTable(void *ctx, const char *name, uint32_t elem_count, unsigned int min_valbits, const char **literal_arr, const char **val_arr)
2729 {
2730 fstEnumHandle handle = 0;
2731 unsigned int *literal_lens = NULL;
2732 unsigned int *val_lens = NULL;
2733 int lit_len_tot = 0;
2734 int val_len_tot = 0;
2735 int name_len;
2736 char elem_count_buf[16];
2737 int elem_count_len;
2738 int total_len;
2739 int pos = 0;
2740 char *attr_str = NULL;
2741
2742 if(ctx && name && literal_arr && val_arr && (elem_count != 0))
2743 {
2744 struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
2745
2746 uint32_t i;
2747
2748 name_len = strlen(name);
2749 elem_count_len = sprintf(elem_count_buf, "%" PRIu32, elem_count);
2750
2751 literal_lens = (unsigned int *)calloc(elem_count, sizeof(unsigned int));
2752 val_lens = (unsigned int *)calloc(elem_count, sizeof(unsigned int));
2753
2754 for(i=0;i<elem_count;i++)
2755 {
2756 literal_lens[i] = strlen(literal_arr[i]);
2757 lit_len_tot += fstUtilityBinToEscConvertedLen((unsigned char*)literal_arr[i], literal_lens[i]);
2758
2759 val_lens[i] = strlen(val_arr[i]);
2760 val_len_tot += fstUtilityBinToEscConvertedLen((unsigned char*)val_arr[i], val_lens[i]);
2761
2762 if(min_valbits > 0)
2763 {
2764 if(val_lens[i] < min_valbits)
2765 {
2766 val_len_tot += (min_valbits - val_lens[i]); /* additional converted len is same for '0' character */
2767 }
2768 }
2769 }
2770
2771 total_len = name_len + 1 + elem_count_len + 1 + lit_len_tot + elem_count + val_len_tot + elem_count;
2772
2773 attr_str = (char*)malloc(total_len);
2774 pos = 0;
2775
2776 memcpy(attr_str+pos, name, name_len);
2777 pos += name_len;
2778 attr_str[pos++] = ' ';
2779
2780 memcpy(attr_str+pos, elem_count_buf, elem_count_len);
2781 pos += elem_count_len;
2782 attr_str[pos++] = ' ';
2783
2784 for(i=0;i<elem_count;i++)
2785 {
2786 pos += fstUtilityBinToEsc((unsigned char*)attr_str+pos, (unsigned char*)literal_arr[i], literal_lens[i]);
2787 attr_str[pos++] = ' ';
2788 }
2789
2790 for(i=0;i<elem_count;i++)
2791 {
2792 if(min_valbits > 0)
2793 {
2794 if(val_lens[i] < min_valbits)
2795 {
2796 memset(attr_str+pos, '0', min_valbits - val_lens[i]);
2797 pos += (min_valbits - val_lens[i]);
2798 }
2799 }
2800
2801 pos += fstUtilityBinToEsc((unsigned char*)attr_str+pos, (unsigned char*)val_arr[i], val_lens[i]);
2802 attr_str[pos++] = ' ';
2803 }
2804
2805 attr_str[pos-1] = 0;
2806
2807 #ifdef FST_DEBUG
2808 fprintf(stderr, FST_APIMESS"fstWriterCreateEnumTable() total_len: %d, pos: %d\n", total_len, pos);
2809 fprintf(stderr, FST_APIMESS"*%s*\n", attr_str);
2810 #endif
2811
2812 fstWriterSetAttrBegin(xc, FST_AT_MISC, FST_MT_ENUMTABLE, attr_str, handle = ++xc->max_enumhandle);
2813
2814 free(attr_str);
2815 free(val_lens);
2816 free(literal_lens);
2817 }
2818
2819 return(handle);
2820 }
2821
2822
2823 void fstWriterEmitEnumTableRef(void *ctx, fstEnumHandle handle)
2824 {
2825 struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
2826 if(xc && handle)
2827 {
2828 fstWriterSetAttrBegin(xc, FST_AT_MISC, FST_MT_ENUMTABLE, NULL, handle);
2829 }
2830 }
2831
2832
27262833 /*
27272834 * value and time change emission
27282835 */
27572864 if((fpos + len + 10) > xc->vchg_alloc_siz)
27582865 {
27592866 xc->vchg_alloc_siz += (xc->fst_break_add_size + len); /* +len added in the case of extremely long vectors and small break add sizes */
2760 xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz);
2867 xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz);
27612868 if(!xc->vchg_mem)
27622869 {
27632870 fprintf(stderr, FST_APIMESS"Could not realloc() in fstWriterEmitValueChange, exiting.\n");
28712978 if((fpos + len + 10 + 5) > xc->vchg_alloc_siz)
28722979 {
28732980 xc->vchg_alloc_siz += (xc->fst_break_add_size + len + 5); /* +len added in the case of extremely long vectors and small break add sizes */
2874 xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz);
2981 xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz);
28752982 if(!xc->vchg_mem)
28762983 {
28772984 fprintf(stderr, FST_APIMESS"Could not realloc() in fstWriterEmitVariableLengthValueChange, exiting.\n");
29483055
29493056 if(xc)
29503057 {
2951 struct fstBlackoutChain *b = calloc(1, sizeof(struct fstBlackoutChain));
3058 struct fstBlackoutChain *b = (struct fstBlackoutChain *)calloc(1, sizeof(struct fstBlackoutChain));
29523059
29533060 b->tim = xc->curtime;
29543061 b->active = (enable != 0);
31193226 {
31203227 xc->fseek_failed = 1;
31213228 #ifdef FST_DEBUG
3122 fprintf(stderr, FST_APIMESS"Seek to #%"PRId64" (whence = %d) failed!\n", offset, whence);
3229 fprintf(stderr, FST_APIMESS"Seek to #%" PRId64 " (whence = %d) failed!\n", offset, whence);
31233230 perror("Why");
31243231 #endif
31253232 }
32473354 struct fstReaderContext *xc = (struct fstReaderContext *)ctx;
32483355 if(xc)
32493356 {
3250 struct fstCurrHier *ch = malloc(sizeof(struct fstCurrHier));
3357 struct fstCurrHier *ch = (struct fstCurrHier *)malloc(sizeof(struct fstCurrHier));
32513358 int chl = xc->curr_hier ? xc->curr_hier->len : 0;
32523359 int len = chl + 1 + strlen(nam);
32533360 if(len >= xc->flat_hier_alloc_len)
32543361 {
3255 xc->curr_flat_hier_nam = xc->curr_flat_hier_nam ? realloc(xc->curr_flat_hier_nam, len+1) : malloc(len+1);
3362 xc->curr_flat_hier_nam = xc->curr_flat_hier_nam ? (char *)realloc(xc->curr_flat_hier_nam, len+1) : (char *)malloc(len+1);
32563363 }
32573364
32583365 if(chl)
34723579 int fstReaderGetFileType(void *ctx)
34733580 {
34743581 struct fstReaderContext *xc = (struct fstReaderContext *)ctx;
3475 return(xc ? xc->filetype : FST_FT_VERILOG);
3582 return(xc ? (int)xc->filetype : (int)FST_FT_VERILOG);
34763583 }
34773584
34783585
36053712 if(!xc->fh)
36063713 {
36073714 off_t offs_cache = ftello(xc->f);
3608 char *fnam = malloc(strlen(xc->filename) + 6 + 16 + 32 + 1);
3609 unsigned char *mem = malloc(FST_GZIO_LEN);
3715 char *fnam = (char *)malloc(strlen(xc->filename) + 6 + 16 + 32 + 1);
3716 unsigned char *mem = (unsigned char *)malloc(FST_GZIO_LEN);
36103717 off_t hl, uclen;
36113718 off_t clen = 0;
36123719 gzFile zhandle = NULL;
37033810 else
37043811 if(htyp == FST_BL_HIER_LZ4DUO)
37053812 {
3706 unsigned char *lz4_cmem = malloc(clen);
3707 unsigned char *lz4_ucmem = malloc(uclen);
3813 unsigned char *lz4_cmem = (unsigned char *)malloc(clen);
3814 unsigned char *lz4_ucmem = (unsigned char *)malloc(uclen);
37083815 unsigned char *lz4_ucmem2;
37093816 uint64_t uclen2;
37103817 int skiplen2 = 0;
37123819 fstFread(lz4_cmem, clen, 1, xc->f);
37133820
37143821 uclen2 = fstGetVarint64(lz4_cmem, &skiplen2);
3715 lz4_ucmem2 = malloc(uclen2);
3822 lz4_ucmem2 = (unsigned char *)malloc(uclen2);
37163823 pass_status = (uclen2 == (uint64_t)LZ4_decompress_safe_partial ((char *)lz4_cmem + skiplen2, (char *)lz4_ucmem2, clen - skiplen2, uclen2, uclen2));
37173824 if(pass_status)
37183825 {
37313838 else
37323839 if(htyp == FST_BL_HIER_LZ4)
37333840 {
3734 unsigned char *lz4_cmem = malloc(clen);
3735 unsigned char *lz4_ucmem = malloc(uclen);
3841 unsigned char *lz4_cmem = (unsigned char *)malloc(clen);
3842 unsigned char *lz4_ucmem = (unsigned char *)malloc(uclen);
37363843
37373844 fstFread(lz4_cmem, clen, 1, xc->f);
37383845 pass_status = (uclen == LZ4_decompress_safe_partial ((char *)lz4_cmem, (char *)lz4_ucmem, clen, uclen, uclen));
39694076 }
39704077 }
39714078
3972 str = malloc(FST_ID_NAM_ATTR_SIZ+1);
4079 str = (char *)malloc(FST_ID_NAM_ATTR_SIZ+1);
39734080
39744081 if(fv)
39754082 {
39784085
39794086 fprintf(fv, "$date\n\t%s\n$end\n", xc->date);
39804087 fprintf(fv, "$version\n\t%s\n$end\n", xc->version);
3981 if(xc->timezero) fprintf(fv, "$timezero\n\t%"PRId64"\n$end\n", xc->timezero);
4088 if(xc->timezero) fprintf(fv, "$timezero\n\t%" PRId64 "\n$end\n", xc->timezero);
39824089
39834090 switch(xc->timescale)
39844091 {
39854092 case 2: time_scale = 100; time_dimension[0] = 0; break;
3986 case 1: time_scale = 10;
4093 case 1: time_scale = 10; /* fallthrough */
39874094 case 0: time_dimension[0] = 0; break;
39884095
39894096 case -1: time_scale = 100; time_dimension[0] = 'm'; break;
3990 case -2: time_scale = 10;
4097 case -2: time_scale = 10; /* fallthrough */
39914098 case -3: time_dimension[0] = 'm'; break;
39924099
39934100 case -4: time_scale = 100; time_dimension[0] = 'u'; break;
3994 case -5: time_scale = 10;
4101 case -5: time_scale = 10; /* fallthrough */
39954102 case -6: time_dimension[0] = 'u'; break;
39964103
39974104 case -10: time_scale = 100; time_dimension[0] = 'p'; break;
3998 case -11: time_scale = 10;
4105 case -11: time_scale = 10; /* fallthrough */
39994106 case -12: time_dimension[0] = 'p'; break;
40004107
40014108 case -13: time_scale = 100; time_dimension[0] = 'f'; break;
4002 case -14: time_scale = 10;
4109 case -14: time_scale = 10; /* fallthrough */
40034110 case -15: time_dimension[0] = 'f'; break;
40044111
40054112 case -16: time_scale = 100; time_dimension[0] = 'a'; break;
4006 case -17: time_scale = 10;
4113 case -17: time_scale = 10; /* fallthrough */
40074114 case -18: time_dimension[0] = 'a'; break;
40084115
40094116 case -19: time_scale = 100; time_dimension[0] = 'z'; break;
4010 case -20: time_scale = 10;
4117 case -20: time_scale = 10; /* fallthrough */
40114118 case -21: time_dimension[0] = 'z'; break;
40124119
40134120 case -7: time_scale = 100; time_dimension[0] = 'n'; break;
4014 case -8: time_scale = 10;
4121 case -8: time_scale = 10; /* fallthrough */
40154122 case -9:
40164123 default: time_dimension[0] = 'n'; break;
40174124 }
40234130 xc->num_alias = 0;
40244131
40254132 free(xc->signal_lens);
4026 xc->signal_lens = malloc(num_signal_dyn*sizeof(uint32_t));
4133 xc->signal_lens = (uint32_t *)malloc(num_signal_dyn*sizeof(uint32_t));
40274134
40284135 free(xc->signal_typs);
4029 xc->signal_typs = malloc(num_signal_dyn*sizeof(unsigned char));
4136 xc->signal_typs = (unsigned char *)malloc(num_signal_dyn*sizeof(unsigned char));
40304137
40314138 fstReaderFseeko(xc, xc->fh, 0, SEEK_SET);
40324139 while(!feof(xc->fh))
40714178 switch(attrtype)
40724179 {
40734180 case FST_AT_ARRAY: if((subtype < FST_AR_NONE) || (subtype > FST_AR_MAX)) subtype = FST_AR_NONE;
4074 fprintf(fv, "$attrbegin %s %s %s %"PRId64" $end\n", attrtypes[attrtype], arraytypes[subtype], str, attrarg);
4181 fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], arraytypes[subtype], str, attrarg);
40754182 break;
40764183 case FST_AT_ENUM: if((subtype < FST_EV_SV_INTEGER) || (subtype > FST_EV_MAX)) subtype = FST_EV_SV_INTEGER;
4077 fprintf(fv, "$attrbegin %s %s %s %"PRId64" $end\n", attrtypes[attrtype], enumvaluetypes[subtype], str, attrarg);
4184 fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], enumvaluetypes[subtype], str, attrarg);
40784185 break;
40794186 case FST_AT_PACK: if((subtype < FST_PT_NONE) || (subtype > FST_PT_MAX)) subtype = FST_PT_NONE;
4080 fprintf(fv, "$attrbegin %s %s %s %"PRId64" $end\n", attrtypes[attrtype], packtypes[subtype], str, attrarg);
4187 fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], packtypes[subtype], str, attrarg);
40814188 break;
40824189 case FST_AT_MISC:
40834190 default: attrtype = FST_AT_MISC;
40924199 int sidx_skiplen_dummy = 0;
40934200 uint64_t sidx = fstGetVarint64((unsigned char *)str, &sidx_skiplen_dummy);
40944201
4095 fprintf(fv, "$attrbegin %s %02x %"PRId64" %"PRId64" $end\n", attrtypes[attrtype], subtype, sidx, attrarg);
4202 fprintf(fv, "$attrbegin %s %02x %" PRId64 " %" PRId64 " $end\n", attrtypes[attrtype], subtype, sidx, attrarg);
40964203 }
40974204 else
40984205 {
4099 fprintf(fv, "$attrbegin %s %02x %s %"PRId64" $end\n", attrtypes[attrtype], subtype, str, attrarg);
4206 fprintf(fv, "$attrbegin %s %02x %s %" PRId64 " $end\n", attrtypes[attrtype], subtype, str, attrarg);
41004207 }
41014208 }
41024209 break;
41544261 if(xc->maxhandle == num_signal_dyn)
41554262 {
41564263 num_signal_dyn *= 2;
4157 xc->signal_lens = realloc(xc->signal_lens, num_signal_dyn*sizeof(uint32_t));
4158 xc->signal_typs = realloc(xc->signal_typs, num_signal_dyn*sizeof(unsigned char));
4264 xc->signal_lens = (uint32_t *)realloc(xc->signal_lens, num_signal_dyn*sizeof(uint32_t));
4265 xc->signal_typs = (unsigned char *)realloc(xc->signal_typs, num_signal_dyn*sizeof(unsigned char));
41594266 }
41604267 xc->signal_lens[xc->maxhandle] = len;
41614268 xc->signal_typs[xc->maxhandle] = vartype;
41764283 char vcdid_buf[16];
41774284 uint32_t modlen = (vartype != FST_VT_VCD_PORT) ? len : ((len - 2) / 3);
41784285 fstVcdID(vcdid_buf, xc->maxhandle+1);
4179 fprintf(fv, "$var %s %"PRIu32" %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str);
4286 fprintf(fv, "$var %s %" PRIu32 " %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str);
41804287 }
41814288 xc->maxhandle++;
41824289 }
41924299 char vcdid_buf[16];
41934300 uint32_t modlen = (vartype != FST_VT_VCD_PORT) ? len : ((len - 2) / 3);
41944301 fstVcdID(vcdid_buf, alias);
4195 fprintf(fv, "$var %s %"PRIu32" %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str);
4302 fprintf(fv, "$var %s %" PRIu32 " %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str);
41964303 }
41974304 xc->num_alias++;
41984305 }
42074314
42084315 maxhandle_scanbuild = xc->maxhandle ? xc->maxhandle : 1; /*scan-build warning suppression, in reality we have at least one signal */
42094316
4210 xc->signal_lens = realloc(xc->signal_lens, maxhandle_scanbuild*sizeof(uint32_t));
4211 xc->signal_typs = realloc(xc->signal_typs, maxhandle_scanbuild*sizeof(unsigned char));
4317 xc->signal_lens = (uint32_t *)realloc(xc->signal_lens, maxhandle_scanbuild*sizeof(uint32_t));
4318 xc->signal_typs = (unsigned char *)realloc(xc->signal_typs, maxhandle_scanbuild*sizeof(unsigned char));
42124319
42134320 free(xc->process_mask);
4214 xc->process_mask = calloc(1, (maxhandle_scanbuild+7)/8);
4321 xc->process_mask = (unsigned char *)calloc(1, (maxhandle_scanbuild+7)/8);
42154322
42164323 free(xc->temp_signal_value_buf);
4217 xc->temp_signal_value_buf = malloc(xc->longest_signal_value_len + 1);
4324 xc->temp_signal_value_buf = (unsigned char *)malloc(xc->longest_signal_value_len + 1);
42184325
42194326 xc->var_count = xc->maxhandle + xc->num_alias;
42204327
42434350 FILE *fcomp;
42444351 off_t offpnt, uclen;
42454352 char gz_membuf[FST_GZIO_LEN];
4246 void *zhandle;
4353 gzFile zhandle;
42474354 int zfd;
42484355 int flen = strlen(xc->filename);
42494356 char *hf;
42534360
42544361 if(!seclen) return(0); /* not finished compressing, this is a failed read */
42554362
4256 hf = calloc(1, flen + 16 + 32 + 1);
4363 hf = (char *)calloc(1, flen + 16 + 32 + 1);
42574364
42584365 sprintf(hf, "%s.upk_%d_%p", xc->filename, getpid(), (void *)xc);
42594366 fcomp = fopen(hf, "w+b");
44164523 {
44174524 uint64_t clen = seclen - 24;
44184525 uint64_t uclen = fstReaderUint64(xc->f);
4419 unsigned char *ucdata = malloc(uclen);
4526 unsigned char *ucdata = (unsigned char *)malloc(uclen);
44204527 unsigned char *pnt = ucdata;
44214528 unsigned int i;
44224529
44254532 xc->longest_signal_value_len = 32; /* arbitrarily set at 32...this is much longer than an expanded double */
44264533
44274534 free(xc->process_mask);
4428 xc->process_mask = calloc(1, (xc->maxhandle+7)/8);
4535 xc->process_mask = (unsigned char *)calloc(1, (xc->maxhandle+7)/8);
44294536
44304537 if(clen != uclen)
44314538 {
4432 unsigned char *cdata = malloc(clen);
4539 unsigned char *cdata = (unsigned char *)malloc(clen);
44334540 unsigned long destlen = uclen;
44344541 unsigned long sourcelen = clen;
44354542 int rc;
44514558 }
44524559
44534560 free(xc->signal_lens);
4454 xc->signal_lens = malloc(sizeof(uint32_t) * xc->maxhandle);
4561 xc->signal_lens = (uint32_t *)malloc(sizeof(uint32_t) * xc->maxhandle);
44554562 free(xc->signal_typs);
4456 xc->signal_typs = malloc(sizeof(unsigned char) * xc->maxhandle);
4563 xc->signal_typs = (unsigned char *)malloc(sizeof(unsigned char) * xc->maxhandle);
44574564
44584565 for(i=0;i<xc->maxhandle;i++)
44594566 {
44804587 }
44814588
44824589 free(xc->temp_signal_value_buf);
4483 xc->temp_signal_value_buf = malloc(xc->longest_signal_value_len + 1);
4590 xc->temp_signal_value_buf = (unsigned char *)malloc(xc->longest_signal_value_len + 1);
44844591
44854592 free(ucdata);
44864593 }
45094616
45104617 xc->num_blackouts = fstReaderVarint32(xc->f);
45114618 free(xc->blackout_times);
4512 xc->blackout_times = calloc(xc->num_blackouts, sizeof(uint64_t));
4619 xc->blackout_times = (uint64_t *)calloc(xc->num_blackouts, sizeof(uint64_t));
45134620 free(xc->blackout_activity);
4514 xc->blackout_activity = calloc(xc->num_blackouts, sizeof(unsigned char));
4621 xc->blackout_activity = (unsigned char *)calloc(xc->num_blackouts, sizeof(unsigned char));
45154622
45164623 for(i=0;i<xc->num_blackouts;i++)
45174624 {
45464653
45474654 void *fstReaderOpenForUtilitiesOnly(void)
45484655 {
4549 struct fstReaderContext *xc = calloc(1, sizeof(struct fstReaderContext));
4656 struct fstReaderContext *xc = (struct fstReaderContext *)calloc(1, sizeof(struct fstReaderContext));
45504657
45514658 return(xc);
45524659 }
45544661
45554662 void *fstReaderOpen(const char *nam)
45564663 {
4557 struct fstReaderContext *xc = calloc(1, sizeof(struct fstReaderContext));
4664 struct fstReaderContext *xc = (struct fstReaderContext *)calloc(1, sizeof(struct fstReaderContext));
45584665
45594666 if((!nam)||(!(xc->f=fopen(nam, "rb"))))
45604667 {
45644671 else
45654672 {
45664673 int flen = strlen(nam);
4567 char *hf = calloc(1, flen + 6);
4674 char *hf = (char *)calloc(1, flen + 6);
45684675 int rc;
45694676
45704677 #if defined(__MINGW32__) || defined(FST_MACOSX)
47034810
47044811 if(!xc) return(0);
47054812
4706 scatterptr = calloc(xc->maxhandle, sizeof(uint32_t));
4707 headptr = calloc(xc->maxhandle, sizeof(uint32_t));
4708 length_remaining = calloc(xc->maxhandle, sizeof(uint32_t));
4813 scatterptr = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
4814 headptr = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
4815 length_remaining = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
47094816
47104817 if(fv)
47114818 {
47674874
47684875
47694876 mem_required_for_traversal = fstReaderUint64(xc->f);
4770 mem_for_traversal = malloc(mem_required_for_traversal + 66); /* add in potential fastlz overhead */
4877 mem_for_traversal = (unsigned char *)malloc(mem_required_for_traversal + 66); /* add in potential fastlz overhead */
47714878 #ifdef FST_DEBUG
47724879 fprintf(stderr, FST_APIMESS"sec: %u seclen: %d begtim: %d endtim: %d\n",
47734880 secnum, (int)seclen, (int)beg_tim, (int)end_tim);
47934900 (int)tsec_uclen, (int)tsec_clen, (int)tsec_nitems);
47944901 #endif
47954902 if(tsec_clen > seclen) break; /* corrupted tsec_clen: by definition it can't be larger than size of section */
4796 ucdata = malloc(tsec_uclen);
4903 ucdata = (unsigned char *)malloc(tsec_uclen);
47974904 if(!ucdata) break; /* malloc fail as tsec_uclen out of range from corrupted file */
47984905 destlen = tsec_uclen;
47994906 sourcelen = tsec_clen;
48024909
48034910 if(tsec_uclen != tsec_clen)
48044911 {
4805 cdata = malloc(tsec_clen);
4912 cdata = (unsigned char *)malloc(tsec_clen);
48064913 fstFread(cdata, tsec_clen, 1, xc->f);
48074914
48084915 rc = uncompress(ucdata, &destlen, cdata, sourcelen);
48214928 }
48224929
48234930 free(time_table);
4824 time_table = calloc(tsec_nitems, sizeof(uint64_t));
4931 time_table = (uint64_t *)calloc(tsec_nitems, sizeof(uint64_t));
48254932 tpnt = ucdata;
48264933 tpval = 0;
48274934 for(ti=0;ti<tsec_nitems;ti++)
48324939 tpnt += skiplen;
48334940 }
48344941
4835 tc_head = calloc(tsec_nitems /* scan-build */ ? tsec_nitems : 1, sizeof(uint32_t));
4942 tc_head = (uint32_t *)calloc(tsec_nitems /* scan-build */ ? tsec_nitems : 1, sizeof(uint32_t));
48364943 free(ucdata);
48374944 }
48384945
48464953 {
48474954 if((beg_tim != time_table[0]) || (blocks_skipped))
48484955 {
4849 unsigned char *mu = malloc(frame_uclen);
4956 unsigned char *mu = (unsigned char *)malloc(frame_uclen);
48504957 uint32_t sig_offs = 0;
48514958
48524959 if(fv)
48564963
48574964 if(beg_tim)
48584965 {
4859 wx_len = sprintf(wx_buf, "#%"PRIu64"\n", beg_tim);
4966 wx_len = sprintf(wx_buf, "#%" PRIu64 "\n", beg_tim);
48604967 fstWritex(xc, wx_buf, wx_len);
48614968 }
48624969 if((xc->num_blackouts)&&(cur_blackout != xc->num_blackouts))
48754982 }
48764983 else
48774984 {
4878 unsigned char *mc = malloc(frame_clen);
4985 unsigned char *mc = (unsigned char *)malloc(frame_clen);
48794986 int rc;
48804987
48814988 unsigned long destlen = frame_uclen;
50605167 #ifdef FST_DEBUG
50615168 fprintf(stderr, FST_APIMESS"indx_pos: %d (%d bytes)\n", (int)indx_pos, (int)chain_clen);
50625169 #endif
5063 chain_cmem = malloc(chain_clen);
5170 chain_cmem = (unsigned char *)malloc(chain_clen);
50645171 if(!chain_cmem) goto block_err;
50655172 fstReaderFseeko(xc, xc->f, indx_pos, SEEK_SET);
50665173 fstFread(chain_cmem, chain_clen, 1, xc->f);
50715178 free(chain_table_lengths);
50725179
50735180 vc_maxhandle_largest = vc_maxhandle;
5074 chain_table = calloc((vc_maxhandle+1), sizeof(off_t));
5075 chain_table_lengths = calloc((vc_maxhandle+1), sizeof(uint32_t));
5181 chain_table = (off_t *)calloc((vc_maxhandle+1), sizeof(off_t));
5182 chain_table_lengths = (uint32_t *)calloc((vc_maxhandle+1), sizeof(uint32_t));
50765183 }
50775184
50785185 if(!chain_table || !chain_table_lengths) goto block_err;
51775284 }
51785285
51795286 #ifdef FST_DEBUG
5180 fprintf(stderr, FST_APIMESS"decompressed chain idx len: %"PRIu32"\n", idx);
5287 fprintf(stderr, FST_APIMESS"decompressed chain idx len: %" PRIu32 "\n", idx);
51815288 #endif
51825289
51835290 mc_mem_len = 16384;
5184 mc_mem = malloc(mc_mem_len); /* buffer for compressed reads */
5291 mc_mem = (unsigned char *)malloc(mc_mem_len); /* buffer for compressed reads */
51855292
51865293 /* check compressed VC data */
51875294 if(idx > xc->maxhandle) idx = xc->maxhandle;
52115318 if(mc_mem_len < chain_table_lengths[i])
52125319 {
52135320 free(mc_mem);
5214 mc_mem = malloc(mc_mem_len = chain_table_lengths[i]);
5321 mc_mem = (unsigned char *)malloc(mc_mem_len = chain_table_lengths[i]);
52155322 }
52165323 mc = mc_mem;
52175324
52905397 }
52915398 }
52925399
5293 wx_len = sprintf(wx_buf, "#%"PRIu64"\n", time_table[i]);
5400 wx_len = sprintf(wx_buf, "#%" PRIu64 "\n", time_table[i]);
52945401 fstWritex(xc, wx_buf, wx_len);
52955402
52965403 if((xc->num_blackouts)&&(cur_blackout != xc->num_blackouts))
53905497
53915498 vcdid_len = fstVcdIDForFwrite(vcd_id+1, idx+1);
53925499 {
5393 unsigned char *vesc = malloc(len*4 + 1);
5500 unsigned char *vesc = (unsigned char *)malloc(len*4 + 1);
53945501 int vlen = fstUtilityBinToEsc(vesc, vdata, len);
53955502 fstWritex(xc, vesc, vlen);
53965503 free(vesc);
57175824 {
57185825 uint32_t cur_offs = 0;
57195826
5720 xc->rvat_sig_offs = calloc(xc->maxhandle, sizeof(uint32_t));
5827 xc->rvat_sig_offs = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
57215828 for(i=0;i<xc->maxhandle;i++)
57225829 {
57235830 xc->rvat_sig_offs[i] = cur_offs;
58215928 fprintf(stderr, FST_APIMESS"time section unc: %d, com: %d (%d items)\n",
58225929 (int)tsec_uclen, (int)tsec_clen, (int)tsec_nitems);
58235930 #endif
5824 ucdata = malloc(tsec_uclen);
5931 ucdata = (unsigned char *)malloc(tsec_uclen);
58255932 destlen = tsec_uclen;
58265933 sourcelen = tsec_clen;
58275934
58285935 fstReaderFseeko(xc, xc->f, -24 - ((off_t)tsec_clen), SEEK_CUR);
58295936 if(tsec_uclen != tsec_clen)
58305937 {
5831 cdata = malloc(tsec_clen);
5938 cdata = (unsigned char *)malloc(tsec_clen);
58325939 fstFread(cdata, tsec_clen, 1, xc->f);
58335940
58345941 rc = uncompress(ucdata, &destlen, cdata, sourcelen);
58465953 fstFread(ucdata, tsec_uclen, 1, xc->f);
58475954 }
58485955
5849 xc->rvat_time_table = calloc(tsec_nitems, sizeof(uint64_t));
5956 xc->rvat_time_table = (uint64_t *)calloc(tsec_nitems, sizeof(uint64_t));
58505957 tpnt = ucdata;
58515958 tpval = 0;
58525959 for(ti=0;ti<tsec_nitems;ti++)
58655972 frame_uclen = fstReaderVarint64(xc->f);
58665973 frame_clen = fstReaderVarint64(xc->f);
58675974 xc->rvat_frame_maxhandle = fstReaderVarint64(xc->f);
5868 xc->rvat_frame_data = malloc(frame_uclen);
5975 xc->rvat_frame_data = (unsigned char *)malloc(frame_uclen);
58695976
58705977 if(frame_uclen == frame_clen)
58715978 {
58735980 }
58745981 else
58755982 {
5876 unsigned char *mc = malloc(frame_clen);
5983 unsigned char *mc = (unsigned char *)malloc(frame_clen);
58775984 int rc;
58785985
58795986 unsigned long destlen = frame_uclen;
59066013 #ifdef FST_DEBUG
59076014 fprintf(stderr, FST_APIMESS"indx_pos: %d (%d bytes)\n", (int)indx_pos, (int)chain_clen);
59086015 #endif
5909 chain_cmem = malloc(chain_clen);
6016 chain_cmem = (unsigned char *)malloc(chain_clen);
59106017 fstReaderFseeko(xc, xc->f, indx_pos, SEEK_SET);
59116018 fstFread(chain_cmem, chain_clen, 1, xc->f);
59126019
5913 xc->rvat_chain_table = calloc((xc->rvat_vc_maxhandle+1), sizeof(off_t));
5914 xc->rvat_chain_table_lengths = calloc((xc->rvat_vc_maxhandle+1), sizeof(uint32_t));
6020 xc->rvat_chain_table = (off_t *)calloc((xc->rvat_vc_maxhandle+1), sizeof(off_t));
6021 xc->rvat_chain_table_lengths = (uint32_t *)calloc((xc->rvat_vc_maxhandle+1), sizeof(uint32_t));
59156022
59166023 pnt = chain_cmem;
59176024 idx = 0;
59206027 if(sectype == FST_BL_VCDATA_DYN_ALIAS2)
59216028 {
59226029 uint32_t prev_alias = 0;
5923
6030
59246031 do {
59256032 int skiplen;
5926
6033
59276034 if(*pnt & 0x01)
59286035 {
59296036 int64_t shval = fstGetSVarint64(pnt, &skiplen) >> 1;
59386045 xc->rvat_chain_table[idx] = 0; /* need to explicitly zero as calloc above might not run */
59396046 xc->rvat_chain_table_lengths[idx] = prev_alias = shval; /* because during this loop iter would give stale data! */
59406047 idx++;
5941 }
6048 }
59426049 else
59436050 {
59446051 xc->rvat_chain_table[idx] = 0; /* need to explicitly zero as calloc above might not run */
59496056 else
59506057 {
59516058 uint64_t val = fstGetVarint32(pnt, &skiplen);
5952
6059
59536060 fstHandle loopcnt = val >> 1;
59546061 for(i=0;i<loopcnt;i++)
59556062 {
59566063 xc->rvat_chain_table[idx++] = 0;
59576064 }
59586065 }
5959
6066
59606067 pnt += skiplen;
59616068 } while (pnt != (chain_cmem + chain_clen));
59626069 }
59666073 {
59676074 int skiplen;
59686075 uint64_t val = fstGetVarint32(pnt, &skiplen);
5969
6076
59706077 if(!val)
59716078 {
59726079 pnt += skiplen;
59906097 xc->rvat_chain_table[idx++] = 0;
59916098 }
59926099 }
5993
6100
59946101 pnt += skiplen;
59956102 } while (pnt != (chain_cmem + chain_clen));
59966103 }
60156122 }
60166123
60176124 #ifdef FST_DEBUG
6018 fprintf(stderr, FST_APIMESS"decompressed chain idx len: %"PRIu32"\n", idx);
6125 fprintf(stderr, FST_APIMESS"decompressed chain idx len: %" PRIu32 "\n", idx);
60196126 #endif
60206127
60216128 xc->rvat_data_valid = 1;
60536160 xc->rvat_chain_len = fstReaderVarint32WithSkip(xc->f, &skiplen);
60546161 if(xc->rvat_chain_len)
60556162 {
6056 unsigned char *mu = malloc(xc->rvat_chain_len);
6057 unsigned char *mc = malloc(xc->rvat_chain_table_lengths[facidx]);
6163 unsigned char *mu = (unsigned char *)malloc(xc->rvat_chain_len);
6164 unsigned char *mc = (unsigned char *)malloc(xc->rvat_chain_table_lengths[facidx]);
60586165 unsigned long destlen = xc->rvat_chain_len;
60596166 unsigned long sourcelen = xc->rvat_chain_table_lengths[facidx];
60606167 int rc = Z_OK;
60856192 else
60866193 {
60876194 int destlen = xc->rvat_chain_table_lengths[facidx] - skiplen;
6088 unsigned char *mu = malloc(xc->rvat_chain_len = destlen);
6195 unsigned char *mu = (unsigned char *)malloc(xc->rvat_chain_len = destlen);
60896196 fstFread(mu, destlen, 1, xc->f);
60906197 /* data to process is for(j=0;j<destlen;j++) in mu[j] */
60916198 xc->rvat_chain_mem = mu;
63866493 c += length;
63876494 switch(len) /* all the case statements fall through */
63886495 {
6389 case 11: c+=((uint32_t)k[10]<<24);
6390 case 10: c+=((uint32_t)k[9]<<16);
6391 case 9 : c+=((uint32_t)k[8]<<8);
6496 case 11: c+=((uint32_t)k[10]<<24); /* fallthrough */
6497 case 10: c+=((uint32_t)k[9]<<16); /* fallthrough */
6498 case 9 : c+=((uint32_t)k[8]<<8); /* fallthrough */
63926499 /* the first byte of c is reserved for the length */
6393 case 8 : b+=((uint32_t)k[7]<<24);
6394 case 7 : b+=((uint32_t)k[6]<<16);
6395 case 6 : b+=((uint32_t)k[5]<<8);
6396 case 5 : b+=k[4];
6397 case 4 : a+=((uint32_t)k[3]<<24);
6398 case 3 : a+=((uint32_t)k[2]<<16);
6399 case 2 : a+=((uint32_t)k[1]<<8);
6500 case 8 : b+=((uint32_t)k[7]<<24); /* fallthrough */
6501 case 7 : b+=((uint32_t)k[6]<<16); /* fallthrough */
6502 case 6 : b+=((uint32_t)k[5]<<8); /* fallthrough */
6503 case 5 : b+=k[4]; /* fallthrough */
6504 case 4 : a+=((uint32_t)k[3]<<24); /* fallthrough */
6505 case 3 : a+=((uint32_t)k[2]<<16); /* fallthrough */
6506 case 2 : a+=((uint32_t)k[1]<<8); /* fallthrough */
64006507 case 1 : a+=k[0];
64016508 /* case 0: nothing left to add */
64026509 }
64316538
64326539 if(!*base)
64336540 {
6434 *base = calloc(1, (hashmask + 1) * sizeof(void *));
6541 *base = (struct collchain_t **)calloc(1, (hashmask + 1) * sizeof(void *));
64356542 }
64366543 ar = *base;
64376544
64546561 chain = chain->next;
64556562 }
64566563
6457 chain = calloc(1, sizeof(struct collchain_t) + length - 1);
6564 chain = (struct collchain_t *)calloc(1, sizeof(struct collchain_t) + length - 1);
64586565 memcpy(chain->mem, mem, length);
64596566 chain->fullhash = hf;
64606567 chain->length = length;
65006607 /*** ***/
65016608 /************************/
65026609
6503 int fstUtilityBinToEsc(unsigned char *d, unsigned char *s, int len)
6504 {
6505 unsigned char *src = s;
6610 int fstUtilityBinToEscConvertedLen(const unsigned char *s, int len)
6611 {
6612 const unsigned char *src = s;
6613 int dlen = 0;
6614 int i;
6615
6616 for(i=0;i<len;i++)
6617 {
6618 switch(src[i])
6619 {
6620 case '\a': /* fallthrough */
6621 case '\b': /* fallthrough */
6622 case '\f': /* fallthrough */
6623 case '\n': /* fallthrough */
6624 case '\r': /* fallthrough */
6625 case '\t': /* fallthrough */
6626 case '\v': /* fallthrough */
6627 case '\'': /* fallthrough */
6628 case '\"': /* fallthrough */
6629 case '\\': /* fallthrough */
6630 case '\?': dlen += 2; break;
6631 default: if((src[i] > ' ') && (src[i] <= '~')) /* no white spaces in output */
6632 {
6633 dlen++;
6634 }
6635 else
6636 {
6637 dlen += 4;
6638 }
6639 break;
6640 }
6641 }
6642
6643 return(dlen);
6644 }
6645
6646
6647 int fstUtilityBinToEsc(unsigned char *d, const unsigned char *s, int len)
6648 {
6649 const unsigned char *src = s;
65066650 unsigned char *dst = d;
65076651 unsigned char val;
65086652 int i;
66016745
66026746 return(dst - s);
66036747 }
6748
6749
6750 struct fstETab *fstUtilityExtractEnumTableFromString(const char *s)
6751 {
6752 struct fstETab *et = NULL;
6753 int num_spaces = 0;
6754 int i;
6755 int newlen;
6756
6757 if(s)
6758 {
6759 const char *csp = strchr(s, ' ');
6760 int cnt = atoi(csp+1);
6761
6762 for(;;)
6763 {
6764 csp = strchr(csp+1, ' ');
6765 if(csp) { num_spaces++; } else { break; }
6766 }
6767
6768 if(num_spaces == (2*cnt))
6769 {
6770 char *sp, *sp2;
6771
6772 et = (struct fstETab*)calloc(1, sizeof(struct fstETab));
6773 et->elem_count = cnt;
6774 et->name = strdup(s);
6775 et->literal_arr = (char**)calloc(cnt, sizeof(char *));
6776 et->val_arr = (char**)calloc(cnt, sizeof(char *));
6777
6778 sp = strchr(et->name, ' ');
6779 *sp = 0;
6780
6781 sp = strchr(sp+1, ' ');
6782
6783 for(i=0;i<cnt;i++)
6784 {
6785 sp2 = strchr(sp+1, ' ');
6786 *(char*)sp2 = 0;
6787 et->literal_arr[i] = sp+1;
6788 sp = sp2;
6789
6790 newlen = fstUtilityEscToBin(NULL, (unsigned char*)et->literal_arr[i], strlen(et->literal_arr[i]));
6791 et->literal_arr[i][newlen] = 0;
6792 }
6793
6794 for(i=0;i<cnt;i++)
6795 {
6796 sp2 = strchr(sp+1, ' ');
6797 if(sp2) { *sp2 = 0; }
6798 et->val_arr[i] = sp+1;
6799 sp = sp2;
6800
6801 newlen = fstUtilityEscToBin(NULL, (unsigned char*)et->val_arr[i], strlen(et->val_arr[i]));
6802 et->val_arr[i][newlen] = 0;
6803 }
6804 }
6805 }
6806
6807 return(et);
6808 }
6809
6810
6811 void fstUtilityFreeEnumTable(struct fstETab *etab)
6812 {
6813 if(etab)
6814 {
6815 free(etab->literal_arr);
6816 free(etab->val_arr);
6817 free(etab->name);
6818 free(etab);
6819 }
6820 }
00 /*
1 * Copyright (c) 2009-2017 Tony Bybell.
1 * Copyright (c) 2009-2018 Tony Bybell.
22 *
33 * Permission is hereby granted, free of charge, to any person obtaining a
44 * copy of this software and associated documentation files (the "Software"),
3838 #define FST_RDLOAD "FSTLOAD | "
3939
4040 typedef uint32_t fstHandle;
41 typedef uint32_t fstEnumHandle;
4142
4243 enum fstWriterPackType {
4344 FST_WR_PT_ZLIB = 0,
195196 FST_MT_SOURCESTEM = 4, /* use fstWriterSetSourceStem() to emit */
196197 FST_MT_SOURCEISTEM = 5, /* use fstWriterSetSourceInstantiationStem() to emit */
197198 FST_MT_VALUELIST = 6, /* use fstWriterSetValueList() to emit, followed by fstWriterCreateVar*() */
198 FST_MT_UNKNOWN = 7,
199
200 FST_MT_MAX = 7
199 FST_MT_ENUMTABLE = 7, /* use fstWriterCreateEnumTable() and fstWriterEmitEnumTableRef() to emit */
200 FST_MT_UNKNOWN = 8,
201
202 FST_MT_MAX = 8
201203 };
202204
203205 enum fstArrayType {
227229 FST_EV_SV_UNSIGNED_LONGINT = 12,
228230 FST_EV_SV_UNSIGNED_BYTE = 13,
229231
230 FST_EV_MAX = 13
232 FST_EV_REG = 14,
233 FST_EV_TIME = 15,
234
235 FST_EV_MAX = 15
231236 };
232237
233238 enum fstPackType {
323328 };
324329
325330
331 struct fstETab
332 {
333 char *name;
334 uint32_t elem_count;
335 char **literal_arr;
336 char **val_arr;
337 };
338
339
326340 /*
327341 * writer functions
328342 */
329343 void fstWriterClose(void *ctx);
330344 void * fstWriterCreate(const char *nam, int use_compressed_hier);
345 fstEnumHandle fstWriterCreateEnumTable(void *ctx, const char *name, uint32_t elem_count, unsigned int min_valbits, const char **literal_arr, const char **val_arr);
331346 /* used for Verilog/SV */
332347 fstHandle fstWriterCreateVar(void *ctx, enum fstVarType vt, enum fstVarDir vd,
333348 uint32_t len, const char *nam, fstHandle aliasHandle);
336351 fstHandle fstWriterCreateVar2(void *ctx, enum fstVarType vt, enum fstVarDir vd,
337352 uint32_t len, const char *nam, fstHandle aliasHandle,
338353 const char *type, enum fstSupplementalVarType svt, enum fstSupplementalDataType sdt);
354 void fstWriterEmitDumpActive(void *ctx, int enable);
355 void fstWriterEmitEnumTableRef(void *ctx, fstEnumHandle handle);
339356 void fstWriterEmitValueChange(void *ctx, fstHandle handle, const void *val);
340357 void fstWriterEmitVariableLengthValueChange(void *ctx, fstHandle handle, const void *val, uint32_t len);
341 void fstWriterEmitDumpActive(void *ctx, int enable);
342358 void fstWriterEmitTimeChange(void *ctx, uint64_t tim);
343359 void fstWriterFlushContext(void *ctx);
344360 int fstWriterGetDumpSizeLimitReached(void *ctx);
421437 /*
422438 * utility functions
423439 */
424 int fstUtilityBinToEsc(unsigned char *d, unsigned char *s, int len);
440 int fstUtilityBinToEscConvertedLen(const unsigned char *s, int len); /* used for mallocs for fstUtilityBinToEsc() */
441 int fstUtilityBinToEsc(unsigned char *d, const unsigned char *s, int len);
425442 int fstUtilityEscToBin(unsigned char *d, unsigned char *s, int len);
443 struct fstETab *fstUtilityExtractEnumTableFromString(const char *s);
444 void fstUtilityFreeEnumTable(struct fstETab *etab); /* must use to free fstETab properly */
445
426446
427447 #ifdef __cplusplus
428448 }
227227 #define GB *(1U<<30)
228228
229229 #define MAXD_LOG 16
230 #ifdef MAX_DISTANCE
231 #undef MAX_DISTANCE
232 #endif
230233 #define MAX_DISTANCE ((1 << MAXD_LOG) - 1)
231234
232235 #define ML_BITS 4
9696
9797 static void wave_msort(struct lxt2_wr_symbol **a, int num)
9898 {
99 struct lxt2_wr_symbol **b = malloc(((num/2)+1) * sizeof(struct lxt2_wr_symbol *));
99 struct lxt2_wr_symbol **b = (struct lxt2_wr_symbol**)malloc(((num/2)+1) * sizeof(struct lxt2_wr_symbol *));
100100
101101 wave_mergesort(a, b, 0, num-1);
102102
582582 if((lt)&&(lt->numfacs))
583583 {
584584 struct lxt2_wr_symbol *s = lt->symchain;
585 struct lxt2_wr_symbol **aliascache = calloc(lt->numalias ? lt->numalias : 1, sizeof(struct lxt2_wr_symbol *));
585 struct lxt2_wr_symbol **aliascache = (struct lxt2_wr_symbol**)calloc(lt->numalias ? lt->numalias : 1, sizeof(struct lxt2_wr_symbol *));
586586 unsigned int aliases_encountered, facs_encountered;
587587
588588 lt->sorted_facs = (struct lxt2_wr_symbol **)calloc(lt->numfacs, sizeof(struct lxt2_wr_symbol *));
919919 s->len = 32;
920920 }
921921
922 s->value = malloc(s->len + 1);
922 s->value = (char*)malloc(s->len + 1);
923923 memset(s->value, lt->initial_value, s->len);
924924 s->value[s->len]=0;
925925
10161016 {
10171017 unsigned int len = strlen(lt->lxtname);
10181018 int i;
1019 char *tname = malloc(len + 30);
1019 char *tname = (char*)malloc(len + 30);
10201020 FILE *f2, *clone;
10211021 off_t cnt, seg;
10221022 char buf[32768];
18091809 valuelen = strlen(value); /* ensure string is proper length */
18101810 if(valuelen == s->len)
18111811 {
1812 vfix = wave_alloca(s->len+1);
1812 vfix = (char*)wave_alloca(s->len+1);
18131813 strcpy(vfix, value);
18141814 value = vfix;
18151815 }
18161816 else
18171817 {
1818 vfix = wave_alloca(s->len+1);
1818 vfix = (char*)wave_alloca(s->len+1);
18191819
18201820 if(valuelen < s->len)
18211821 {
20872087 else
20882088 {
20892089 free(s->value);
2090 s->value = calloc(1, 1*sizeof(char));
2090 s->value = (char*)calloc(1, 1*sizeof(char));
20912091 }
20922092 }
20932093 }
21002100 {
21012101 if((!(s->flags&LXT2_WR_SYM_F_ALIAS))&&(s->rows<2))
21022102 {
2103 char tmp[16]; /* To get rid of the warning */
21032104 if(!(s->flags&(LXT2_WR_SYM_F_DOUBLE|LXT2_WR_SYM_F_STRING)))
21042105 {
2105 lxt2_wr_emit_value_bit_string(lt, s, 0, "x");
2106 strcpy(tmp, "x");
2107 lxt2_wr_emit_value_bit_string(lt, s, 0, tmp);
21062108 }
21072109 else if (s->flags&LXT2_WR_SYM_F_DOUBLE)
21082110 {
21122114 }
21132115 else if (s->flags&LXT2_WR_SYM_F_STRING)
21142116 {
2115 lxt2_wr_emit_value_string(lt, s, 0, "UNDEF");
2117 strcpy(tmp, "UNDEF");
2118 lxt2_wr_emit_value_string(lt, s, 0, tmp);
21162119 }
21172120 }
21182121 s=s->symchain;
22012204 lt->timezero = timeval;
22022205 }
22032206 }
2204
4242 #define ftello ftell
4343 #endif
4444
45 #include <wavealloca.h>
45 #include "wavealloca.h"
4646
4747 #define LXT2_WR_HDRID (0x1380)
4848 #define LXT2_WR_VERSION (0x0001)
313313 #endif
314314
315315 #endif
316
373373 #endif
374374 #endif
375375 );
376
377 #ifdef __MINGW32__
378 fflush(stdout); /* fix for possible problem with mingw/msys shells */
379 #endif
376380
377381 exit(0);
378382 }
44754475 (void)data;
44764476
44774477 Trptr t;
4478 Ulong flags;
4478 TraceFlagsType flags;
44794479
44804480 t=GLOBALS->showchangeall_menu_c_1;
44814481 if(t)
63976397 /**/
63986398
63996399
6400 static void dataformat(int mask, int patch)
6400 static void dataformat(TraceFlagsType mask, TraceFlagsType patch)
64016401 {
64026402 Trptr t;
64036403 int fix=0;
67676767 dataformat( ~(TR_POPCNT), 0 );
67686768 }
67696769
6770
6771 void
6772 menu_dataformat_time(gpointer null_data, guint callback_action, GtkWidget *widget)
6773 {
6774 (void)null_data;
6775 (void)callback_action;
6776 (void)widget;
6777
6778 if(GLOBALS->helpbox_is_active)
6779 {
6780 help_text_bold("\n\nData Format-Time");
6781 help_text(
6782 " will step through all highlighted traces and ensure that"
6783 " bits and vectors with this qualifier will display as time values."
6784 );
6785 return;
6786 }
6787
6788 dataformat( ~(TR_NUMMASK), (TR_TIME | TR_DEC) );
6789 }
6790
6791 void
6792 menu_dataformat_enum(gpointer null_data, guint callback_action, GtkWidget *widget)
6793 {
6794 (void)null_data;
6795 (void)callback_action;
6796 (void)widget;
6797
6798 if(GLOBALS->helpbox_is_active)
6799 {
6800 help_text_bold("\n\nData Format-Enum");
6801 help_text(
6802 " will step through all highlighted traces and ensure that"
6803 " bits and vectors with this qualifier will display as enum values, provided such values were dumped into file."
6804 );
6805 return;
6806 }
6807
6808 dataformat( ~(TR_NUMMASK), (TR_ENUM | TR_BIN) );
6809 }
6810
6811
67706812 void
67716813 menu_dataformat_fpshift_on(gpointer null_data, guint callback_action, GtkWidget *widget)
67726814 {
68196861 Trptr t;
68206862 int fix=0;
68216863 int shamt = GLOBALS->entrybox_text ? atoi(GLOBALS->entrybox_text) : 0;
6822 int mask = ~(TR_FPDECSHIFT);
6823 int patch = TR_FPDECSHIFT;
6864 TraceFlagsType mask = ~(TR_FPDECSHIFT);
6865 TraceFlagsType patch = TR_FPDECSHIFT;
68246866
68256867 if((shamt < 0)||(shamt > 255)) { shamt = 0; patch = 0; }
68266868
79117953 WAVE_GTKIFE("/Edit/Data Format/Binary", "<Alt>B", menu_dataformat_bin, WV_MENU_EDFB, "<Item>"),
79127954 WAVE_GTKIFE("/Edit/Data Format/Octal", "<Alt>O", menu_dataformat_oct, WV_MENU_EDFO, "<Item>"),
79137955 WAVE_GTKIFE("/Edit/Data Format/ASCII", NULL, menu_dataformat_ascii, WV_MENU_EDFA, "<Item>"),
7956 WAVE_GTKIFE("/Edit/Data Format/Time", NULL, menu_dataformat_time, WV_MENU_TIME, "<Item>"),
7957 WAVE_GTKIFE("/Edit/Data Format/Enum", NULL, menu_dataformat_enum, WV_MENU_ENUM, "<Item>"),
79147958 WAVE_GTKIFE("/Edit/Data Format/BitsToReal", NULL, menu_dataformat_real, WV_MENU_EDRL, "<Item>"),
79157959 WAVE_GTKIFE("/Edit/Data Format/RealToBits/On", NULL, menu_dataformat_real2bon, WV_MENU_EDR2BON, "<Item>"),
79167960 WAVE_GTKIFE("/Edit/Data Format/RealToBits/Off", NULL, menu_dataformat_real2boff, WV_MENU_EDR2BOFF, "<Item>"),
86128656 WAVE_GTKIFE("/Data Format/Binary", NULL, menu_dataformat_bin, WV_MENU_EDFB, "<Item>"),
86138657 WAVE_GTKIFE("/Data Format/Octal", NULL, menu_dataformat_oct, WV_MENU_EDFO, "<Item>"),
86148658 WAVE_GTKIFE("/Data Format/ASCII", NULL, menu_dataformat_ascii, WV_MENU_EDFA, "<Item>"),
8659 WAVE_GTKIFE("/Data Format/Time", NULL, menu_dataformat_time, WV_MENU_TIME, "<Item>"),
8660 WAVE_GTKIFE("/Data Format/Enum", NULL, menu_dataformat_enum, WV_MENU_ENUM, "<Item>"),
86158661 WAVE_GTKIFE("/Data Format/BitsToReal", NULL, menu_dataformat_real, WV_MENU_EDRL, "<Item>"),
86168662 WAVE_GTKIFE("/Data Format/RealToBits/On", NULL, menu_dataformat_real2bon, WV_MENU_EDR2BON, "<Item>"),
86178663 WAVE_GTKIFE("/Data Format/RealToBits/Off", NULL, menu_dataformat_real2boff, WV_MENU_EDR2BOFF, "<Item>"),
135135 WV_MENU_EDFB,
136136 WV_MENU_EDFO,
137137 WV_MENU_EDFA,
138 WV_MENU_TIME,
139 WV_MENU_ENUM,
138140 WV_MENU_EDRL,
139141 WV_MENU_EDR2BON,
140142 WV_MENU_EDR2BOFF,
2626
2727 static int determine_trace_flags(Trptr t, char *ch)
2828 {
29 unsigned int flags = t->flags;
29 TraceFlagsType flags = t->flags;
3030 int pos = 0;
3131
3232 /* [0] */
5353
5454 static int determine_trace_flags(Trptr t, char *ch)
5555 {
56 unsigned int flags = t->flags;
56 TraceFlagsType flags = t->flags;
5757 int pos = 0;
5858
5959 /* [0] */
110110 void write_save_helper(const char *savnam, FILE *wave) {
111111 Trptr t;
112112 int i;
113 unsigned int def=0;
113 TraceFlagsType def=0;
114114 int sz_x, sz_y;
115115 TimeType prevshift=LLDescriptor(0);
116116 int root_x, root_y;
254254 if((t->flags & TR_PTRANSLATED) && (!t->p_filter)) t->flags &= (~TR_PTRANSLATED);
255255 if((t->flags & TR_FTRANSLATED) && (!t->f_filter)) t->flags &= (~TR_FTRANSLATED);
256256 if((t->flags & TR_TTRANSLATED) && (!t->t_filter)) t->flags &= (~TR_TTRANSLATED);
257 fprintf(wave,"@%x\n",def=t->flags);
257 fprintf(wave,"@%"TRACEFLAGSPRIFMT"\n",def=t->flags);
258258 }
259259
260260 if((t->shift)||((prevshift)&&(!t->shift)))
365365 }
366366 if(ba)
367367 {
368 fprintf(wave, " "TTFormat" %x", ba[ix].shift, ba[ix].flags);
368 fprintf(wave, " "TTFormat" %"TRACEFLAGSPRIFMT, ba[ix].shift, ba[ix].flags);
369369 }
370370 }
371371 fprintf(wave,"\n");
442442 if((t->flags & TR_FTRANSLATED) && (!t->f_filter)) t->flags &= (~TR_FTRANSLATED);
443443 if((t->flags & TR_PTRANSLATED) && (!t->p_filter)) t->flags &= (~TR_PTRANSLATED);
444444 if((t->flags & TR_TTRANSLATED) && (!t->t_filter)) t->flags &= (~TR_TTRANSLATED);
445 fprintf(wave,"@%x\n",def=t->flags);
445 fprintf(wave,"@%"TRACEFLAGSPRIFMT"\n",def=t->flags);
446446 }
447447
448448 if((t->shift)||((prevshift)&&(!t->shift)))
534534 }
535535 if(ba)
536536 {
537 fprintf(wave, " "TTFormat" %x", ba[ix].shift, ba[ix].flags);
537 fprintf(wave, " "TTFormat" %"TRACEFLAGSPRIFMT, ba[ix].shift, ba[ix].flags);
538538 }
539539 }
540540 fprintf(wave,"\n");
11231123 if(*w2=='@')
11241124 {
11251125 /* handle trace flags */
1126 sscanf(w2+1, "%x", &GLOBALS->default_flags);
1126 sscanf(w2+1, "%"TRACEFLAGSSCNFMT, &GLOBALS->default_flags);
11271127 if( (GLOBALS->default_flags & (TR_FTRANSLATED|TR_PTRANSLATED)) == (TR_FTRANSLATED|TR_PTRANSLATED) )
11281128 {
11291129 GLOBALS->default_flags &= ~TR_PTRANSLATED; /* safest bet though this is a cfg file error */
1818 #include "debug.h"
1919
2020
21 static void toggle_generic(GtkWidget *widget, Ulong msk)
21 static void toggle_generic(GtkWidget *widget, TraceFlagsType msk)
2222 {
2323 if(GTK_TOGGLE_BUTTON(widget)->active)
2424 {
16551655 void cache_actual_pattern_mark_traces(void)
16561656 {
16571657 Trptr t;
1658 unsigned int def=0;
1658 TraceFlagsType def=0;
16591659 TimeType prevshift=LLDescriptor(0);
16601660 struct strace *st;
16611661
16811681
16821682 if((t->flags!=def)||(st==GLOBALS->strace_ctx->straces))
16831683 {
1684 mprintf("@%x\n",def=t->flags);
1684 mprintf("@%"TRACEFLAGSPRIFMT"\n",def=t->flags);
16851685 }
16861686
16871687 if((t->shift)||((prevshift)&&(!t->shift)))
111111 return(TCL_OK);
112112 }
113113
114 static int gtkwavetcl_printTraceFlagsType(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], TraceFlagsType ttVal)
115 {
116 (void)clientData;
117 (void)objc;
118 (void)objv;
119
120 Tcl_Obj *aobj;
121 char reportString[65];
122
123 sprintf(reportString, "%"TRACEFLAGSPRIuFMT, ttVal);
124
125 aobj = Tcl_NewStringObj(reportString, -1);
126 Tcl_SetObjResult(interp, aobj);
127
128 return(TCL_OK);
129 }
130
114131 static int gtkwavetcl_printDouble(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], double dVal)
115132 {
116133 (void)clientData;
494511 {
495512 if(i == which)
496513 {
497 return(gtkwavetcl_printInteger(clientData, interp, objc, objv, t->flags));
514 return(gtkwavetcl_printTraceFlagsType(clientData, interp, objc, objv, t->flags));
498515 }
499516
500517 i++;
17891806
17901807 if(t)
17911808 {
1792 return(gtkwavetcl_printInteger(clientData, interp, objc, objv, t->flags));
1809 return(gtkwavetcl_printTraceFlagsType(clientData, interp, objc, objv, t->flags));
17931810 }
17941811 }
17951812 else
20342051 {
20352052 char *s = get_Tcl_string(objv[1]);
20362053 unsigned int which = atoi(s);
2037 gint rc = install_file_filter(which);
2054 gint rc = install_proc_filter(which);
20382055
20392056 gtkwave_main_iteration();
20402057 return(gtkwavetcl_printInteger(clientData, interp, objc, objv, rc));
862862 Trptr t;
863863 nptr nexp;
864864 int i;
865 unsigned int default_flags = GLOBALS->default_flags;
865 TraceFlagsType default_flags = GLOBALS->default_flags;
866866 bvptr v;
867867
868868 Trptr buffer; /* cut/copy buffer of traces */
15951595 static char *give_value_string(Trptr t)
15961596 {
15971597 char *rc = NULL;
1598 unsigned int flags;
1598 TraceFlagsType flags;
15991599 int f_filter, p_filter;
16001600
16011601 if(t)
21422142 char *emit_gtkwave_savefile_formatted_entries_in_tcl_list(Trptr t, gboolean use_tcl_mode) {
21432143 char *one_entry, *mult_entry = NULL;
21442144 unsigned int mult_len = 0;
2145 unsigned int prev_flags = 0;
2146
2147 unsigned int def=0;
2145 TraceFlagsType prev_flags = 0;
2146
2147 TraceFlagsType def=0;
21482148 TimeType prevshift=LLDescriptor(0);
21492149 char is_first = 1;
21502150 char flag_skip;
21802180 is_first = 0;
21812181 if((t->flags & TR_PTRANSLATED) && (!t->p_filter)) t->flags &= (~TR_PTRANSLATED);
21822182 if((t->flags & TR_FTRANSLATED) && (!t->f_filter)) t->flags &= (~TR_FTRANSLATED);
2183 one_entry = make_message("@%x\n",(def=t->flags) & ~TR_HIGHLIGHT);
2183 one_entry = make_message("@%"TRACEFLAGSPRIFMT"\n",(def=t->flags) & ~TR_HIGHLIGHT);
21842184 WAVE_OE_ME
21852185 if(!flag_skip) prev_flags = def;
21862186 }
22912291 }
22922292 if(ba)
22932293 {
2294 one_entry = make_message(" "TTFormat" %x", ba[i].shift, ba[i].flags);
2294 one_entry = make_message(" "TTFormat" %"TRACEFLAGSPRIFMT, ba[i].shift, ba[i].flags);
22952295 WAVE_OE_ME
22962296 }
22972297 }
517517 }
518518
519519 /* Return the base prefix for the signal value */
520 char *signal_value_prefix(int flags) {
520 char *signal_value_prefix(TraceFlagsType flags) {
521521 if(flags & TR_BIN) return "0b" ;
522522 if(flags & TR_HEX) return "0x" ;
523523 if(flags & TR_OCT) return "0" ;
00 /*
1 * Copyright (c) Tony Bybell 1999.
1 * Copyright (c) 1999 Tony Bybell.
22 *
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.
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19 * DEALINGS IN THE SOFTWARE.
720 */
821
922 #ifndef WAVE_ALLOCA_H