From 7ef45769a724b21fa1300115fb80e5becd0d0328 Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 2 Oct 2003 21:30:06 +0000 Subject: [PATCH] Use configured TIME_FMT in vcd dump printf. --- _pli_types.h.in | 22 ++++++++++++++-------- vpi/sys_vcd.c | 15 +++++++++++---- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/_pli_types.h.in b/_pli_types.h.in index 5902ea4e3..67a608a74 100644 --- a/_pli_types.h.in +++ b/_pli_types.h.in @@ -19,19 +19,22 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: _pli_types.h.in,v 1.2 2003/10/02 19:33:44 steve Exp $" +#ident "$Id: _pli_types.h.in,v 1.3 2003/10/02 21:30:06 steve Exp $" #endif -# undef HAVE_STDINT_H +# undef HAVE_INTTYPES_H -#ifdef HAVE_STDINT_H +#ifdef HAVE_INTTYPES_H /* * If the host enhironment has the stdint.h header file, * then use that to size our PLI types. */ +#ifndef __STDC_FORMAT_MACROS +# define __STDC_FORMAT_MACROS +#endif -# include +# include typedef uint64_t PLI_UINT64; typedef int64_t PLI_INT64; typedef uint32_t PLI_UINT32; @@ -56,21 +59,21 @@ typedef unsigned char PLI_UBYTE8; #if SIZEOF_UNSIGNED >= 8 typedef unsigned PLI_UINT64; typedef int PLI_INT64; -# define TIME_FMT "" +# define TIME_FMT "%u" #else # if SIZEOF_UNSIGNED_LONG >= 8 typedef unsigned long PLI_UINT64; typedef long PLI_INT64; -# define TIME_FMT "l" +# define TIME_FMT "%lu" # else # if SIZEOF_UNSIGNED_LONG_LONG > SIZEOF_UNSIGNED_LONG typedef unsigned long long PLI_UINT64; typedef long long PLI_INT64; -# define TIME_FMT "ll" +# define TIME_FMT "%llu" # else typedef unsigned long PLI_UINT64; typedef long PLI_INT64; -# define TIME_FMT "l" +# define TIME_FMT "%lu" # endif # endif #endif @@ -85,6 +88,9 @@ typedef unsigned char PLI_UBYTE8; /* * $Log: _pli_types.h.in,v $ + * Revision 1.3 2003/10/02 21:30:06 steve + * Use configured TIME_FMT in vcd dump printf. + * * Revision 1.2 2003/10/02 19:33:44 steve * Put libraries in libdir64. * diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index 2eac8aefe..88cf49f29 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: sys_vcd.c,v 1.47 2003/09/30 01:33:39 steve Exp $" +#ident "$Id: sys_vcd.c,v 1.48 2003/10/02 21:30:06 steve Exp $" #endif # include "config.h" @@ -39,6 +39,10 @@ #endif # include "vcd_priv.h" +#ifdef HAVE_INTTYPES_H +# define TIME_FMT PRIu64 +#endif + static FILE*dump_file = 0; static const char*units_names[] = { @@ -289,7 +293,7 @@ static int sys_dumpoff_calltf(char*name) now64 = timerec_to_time64(&now); if (now64 > vcd_cur_time) - fprintf(dump_file, "#%" TIME_FMT "u\n", now64); + fprintf(dump_file, "#" TIME_FMT "\n", now64); vcd_cur_time = now64; fprintf(dump_file, "$dumpoff\n"); @@ -320,7 +324,7 @@ static int sys_dumpon_calltf(char*name) now64 = timerec_to_time64(&now); if (now64 > vcd_cur_time) - fprintf(dump_file, "#%" TIME_FMT "u\n", now64); + fprintf(dump_file, "#" TIME_FMT "\n", now64); vcd_cur_time = now64; fprintf(dump_file, "$dumpon\n"); @@ -346,7 +350,7 @@ static int sys_dumpall_calltf(char*name) now64 = timerec_to_time64(&now); if (now64 > vcd_cur_time) - fprintf(dump_file, "#%" TIME_FMT "u\n", now64); + fprintf(dump_file, "#" TIME_FMT "\n", now64); vcd_cur_time = now.low; fprintf(dump_file, "$dumpall\n"); @@ -811,6 +815,9 @@ void sys_vcd_register() /* * $Log: sys_vcd.c,v $ + * Revision 1.48 2003/10/02 21:30:06 steve + * Use configured TIME_FMT in vcd dump printf. + * * Revision 1.47 2003/09/30 01:33:39 steve * dumpers must be aware of 64bit time. *