From 29a69bacd0bea51317868b6cdc1c59e02a389e31 Mon Sep 17 00:00:00 2001 From: Cary R Date: Mon, 1 Nov 2010 15:04:46 -0800 Subject: [PATCH] Update GTKWave files to the latest from GTKWave CVS. This update fixes a rare bug in the FST file creation process along with a general sync of the files. (cherry picked from commit a359cc301ce380711c686ef4b2ddc75f892b349f) --- vpi/fstapi.c | 11 ++++++++++- vpi/fstapi.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/vpi/fstapi.c b/vpi/fstapi.c index 59211b772..802238f6a 100644 --- a/vpi/fstapi.c +++ b/vpi/fstapi.c @@ -504,6 +504,7 @@ unsigned compress_hier : 1; unsigned repack_on_close : 1; unsigned skip_writing_section_hdr : 1; unsigned size_limit_locked : 1; +unsigned section_header_only : 1; /* should really be semaphores, but are bytes to cut down on read-modify-write window size */ unsigned char already_in_flush; /* in case control-c handlers interrupt */ @@ -703,6 +704,13 @@ if(xc && !xc->already_in_close && !xc->already_in_flush) xc->already_in_close = 1; /* never need to zero this out as it is freed at bottom */ + if(xc->section_header_only && xc->section_header_truncpos) + { + fstFtruncate(fileno(xc->handle), xc->section_header_truncpos); + fseeko(xc->handle, xc->section_header_truncpos, SEEK_SET); + xc->section_header_only = 0; + } + xc->skip_writing_section_hdr = 1; if(!xc->size_limit_locked) { @@ -969,6 +977,7 @@ if(xc) fputc(FST_BL_SKIP, xc->handle); /* temporarily tag the section, use FST_BL_VCDATA on finalize */ xc->section_start = ftello(xc->handle); + xc->section_header_only = 1; /* indicates truncate might be needed */ fstWriterUint64(xc->handle, 0); /* placeholder = section length */ fstWriterUint64(xc->handle, xc->is_initial_time ? xc->firsttime : xc->curtime); /* begin time of section */ fstWriterUint64(xc->handle, xc->curtime); /* end time of section (placeholder) */ @@ -1024,6 +1033,7 @@ struct fstWriterContext *xc = (struct fstWriterContext *)ctx; if((!xc)||(xc->vchn_siz <= 1)||(xc->already_in_flush)) return; xc->already_in_flush = 1; /* should really do this with a semaphore */ +xc->section_header_only = 0; scratchpad = malloc(xc->vchn_siz); fflush(xc->vchn_handle); @@ -1323,7 +1333,6 @@ if(xc->dump_size_limit) } } - if(!xc->skip_writing_section_hdr) { fstWriterEmitSectionHeader(xc); /* emit next section header */ diff --git a/vpi/fstapi.h b/vpi/fstapi.h index 0fa158dd0..72efbaa9c 100644 --- a/vpi/fstapi.h +++ b/vpi/fstapi.h @@ -126,7 +126,7 @@ union { /* if htyp == FST_HT_VAR */ struct fstHierVar { - unsigned char typ; /* FST_VT_VCD_EVENT ... FST_VT_VCD_WOR */ + unsigned char typ; /* FST_VT_VCD_EVENT ... FST_VT_VCD_REALTIME */ unsigned char direction; /* FST_VD_IMPLICIT ... FST_VD_INOUT */ const char *name; uint32_t length;