Add the %t formatting escape.

This commit is contained in:
steve 1999-10-08 17:47:49 +00:00
parent eb0103deb5
commit 0f919ab5f3
1 changed files with 20 additions and 1 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #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 #endif
# include "vpi_user.h" # include "vpi_user.h"
@ -67,6 +67,17 @@ static void format_m(vpiHandle argv, int fsize)
vpi_printf("%s", vpi_get_str(vpiFullName, item)); 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 * 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 * 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); format_m(argv, fsize);
cp += 1; cp += 1;
break; break;
case 't':
case 'T':
format_time(argv, fsize);
cp += 1;
break;
case '%': case '%':
vpi_printf("%%"); vpi_printf("%%");
cp += 1; cp += 1;
@ -228,6 +244,9 @@ void sys_display_register()
/* /*
* $Log: sys_display.c,v $ * $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 * Revision 1.2 1999/09/29 01:41:18 steve
* Support the $write system task, and have the * Support the $write system task, and have the
* vpi_scan function free iterators as needed. * vpi_scan function free iterators as needed.