From 0f919ab5f30b3670ddfe354fb4d2a37766849da2 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 8 Oct 1999 17:47:49 +0000 Subject: [PATCH] Add the %t formatting escape. --- vpi/sys_display.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/vpi/sys_display.c b/vpi/sys_display.c index f7b424dda..0ed896498 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: sys_display.c,v 1.2 1999/09/29 01:41:18 steve Exp $" +#ident "$Id: sys_display.c,v 1.3 1999/10/08 17:47:49 steve Exp $" #endif # include "vpi_user.h" @@ -67,6 +67,17 @@ static void format_m(vpiHandle argv, int fsize) vpi_printf("%s", vpi_get_str(vpiFullName, item)); } +static void format_time(vpiHandle argv, int fsize) +{ + s_vpi_value value; + vpiHandle item = vpi_scan(argv); + if (item == 0) return; + + value.format = vpiDecStrVal; + vpi_get_value(item, &value); + vpi_printf("%s", value.value.str); +} + /* * If $display discovers a string as a parameter, this function is * called to process it as a format string. I need the argv handle as @@ -120,6 +131,11 @@ static void format(s_vpi_value*fmt, vpiHandle argv) format_m(argv, fsize); cp += 1; break; + case 't': + case 'T': + format_time(argv, fsize); + cp += 1; + break; case '%': vpi_printf("%%"); cp += 1; @@ -228,6 +244,9 @@ void sys_display_register() /* * $Log: sys_display.c,v $ + * Revision 1.3 1999/10/08 17:47:49 steve + * Add the %t formatting escape. + * * Revision 1.2 1999/09/29 01:41:18 steve * Support the $write system task, and have the * vpi_scan function free iterators as needed.