2 * Copyright (c) 2003 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 #ident "$Id: sys_fileio.c,v 1.10 2007/03/14 04:05:51 steve Exp $"
23 # include "vpi_user.h"
24 # include "sys_priv.h"
30 #define IS_MCD(mcd) !((mcd)>>31&1)
34 * Implement the $fopen system function.
36 static PLI_INT32
sys_fopen_compiletf(PLI_BYTE8
*name
)
38 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
39 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
43 vpi_printf("%s: file name argument missing.\n", name
);
44 vpi_control(vpiFinish
, 1);
48 item
= vpi_scan(argv
);
50 vpi_printf("%s: file name argument missing.\n", name
);
51 vpi_control(vpiFinish
, 1);
55 item
= vpi_scan(argv
);
57 /* The mode argument is optional. It is OK for it
58 to be missing. In this case, there are no more
59 arguments, and we're done. */
63 if (! is_constant(item
)) {
64 vpi_printf("ERROR: %s mode argument must be a constant\n", name
);
65 vpi_control(vpiFinish
, 1);
68 if (vpi_get(vpiConstType
, item
) != vpiStringConst
) {
69 vpi_printf("ERROR: %s mode argument must be a string.\n", name
);
70 vpi_control(vpiFinish
, 1);
73 item
= vpi_scan(argv
);
75 /* There should be no more arguments. */
79 vpi_free_object(argv
);
80 vpi_printf("%s: Too many arguments to system function.\n", name
);
84 static PLI_INT32
sys_fopen_calltf(PLI_BYTE8
*name
)
87 char *mode_string
= 0;
89 vpiHandle call_handle
= vpi_handle(vpiSysTfCall
, 0);
90 vpiHandle argv
= vpi_iterate(vpiArgument
, call_handle
);
91 vpiHandle item
= vpi_scan(argv
);
92 vpiHandle mode
= vpi_scan(argv
);
97 value
.format
= vpiStringVal
;
98 vpi_get_value(mode
, &value
);
99 mode_string
= strdup(value
.value
.str
);
101 vpi_free_object(argv
);
104 /* Get the string form of the file name from the file name
106 value
.format
= vpiStringVal
;
107 vpi_get_value(item
, &value
);
109 if ((value
.format
!= vpiStringVal
) || !value
.value
.str
) {
110 vpi_printf("ERROR: %s: File name argument (type=%d)"
111 " does not have a string value\n",
112 name
, vpi_get(vpiType
, item
));
113 if (mode
) free(mode_string
);
117 value
.format
= vpiIntVal
;
119 value
.value
.integer
= vpi_fopen(value
.value
.str
, mode_string
);
122 value
.value
.integer
= vpi_mcd_open(value
.value
.str
);
124 vpi_put_value(call_handle
, &value
, 0, vpiNoDelay
);
130 * Implement the $fopenr(), $fopenw() and $fopena() system functions
131 * from Chris Spear's File I/O for Verilog.
133 static PLI_INT32
sys_fopenrwa_compiletf(PLI_BYTE8
*name
)
135 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
136 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
139 /* Check that there are arguments. */
141 vpi_printf("ERROR: %s requires a single argument.\n", name
);
142 vpi_control(vpiFinish
, 1);
146 file
= vpi_scan(argv
); /* This should never be zero. */
148 /* These functions take at most one argument. */
149 file
= vpi_scan(argv
);
151 vpi_printf("ERROR: %s takes only a single argument.\n", name
);
152 vpi_control(vpiFinish
, 1);
156 /* vpi_scan returning 0 (NULL) has already freed argv. */
160 static PLI_INT32
sys_fopenrwa_calltf(PLI_BYTE8
*name
)
164 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
165 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
166 vpiHandle file
= vpi_scan(argv
);
167 vpi_free_object(argv
);
170 mode
= name
+ strlen(name
) - 1;
172 /* Get the filename. */
173 val
.format
= vpiStringVal
;
174 vpi_get_value(file
, &val
);
175 if ((val
.format
!= vpiStringVal
) || !val
.value
.str
) {
176 vpi_printf("ERROR: %s's file name argument must be a string.\n",
178 vpi_control(vpiFinish
, 1);
182 /* Open the file and return the result. */
183 val
.format
= vpiIntVal
;
184 val
.value
.integer
= vpi_fopen(val
.value
.str
, mode
);
185 vpi_put_value(callh
, &val
, 0, vpiNoDelay
);
190 * Implement $fclose system function
192 static PLI_INT32
sys_fclose_calltf(PLI_BYTE8
*name
)
198 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
199 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
200 vpiHandle item
= vpi_scan(argv
);
203 vpi_printf("%s: mcd parameter missing.\n", name
);
206 type
= vpi_get(vpiType
, item
);
213 vpi_printf("ERROR: %s mcd parameter must be of integral type",
215 vpi_printf(", got vpiType=%d\n", type
);
216 vpi_free_object(argv
);
220 value
.format
= vpiIntVal
;
221 vpi_get_value(item
, &value
);
222 mcd
= value
.value
.integer
;
228 static PLI_INT32
sys_fflush_compiletf(PLI_BYTE8
*ud
)
230 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
231 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
235 /* The argument is optional. */
239 /* Check that the file/MC descriptor is the right type. */
240 item
= vpi_scan(argv
);
241 type
= vpi_get(vpiType
, item
);
248 vpi_printf("ERROR: %s fd parameter must be integral", ud
);
249 vpi_printf(", got vpiType=%d\n", type
);
250 vpi_control(vpiFinish
, 1);
254 /* Check that there is at most one argument. */
255 item
= vpi_scan(argv
);
257 vpi_printf("ERROR: %s takes at most a single argument.\n", ud
);
258 vpi_control(vpiFinish
, 1);
262 /* vpi_scan returning 0 (NULL) has already freed argv. */
266 static PLI_INT32
sys_fflush_calltf(PLI_BYTE8
*name
)
268 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
269 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
275 /* If we have no argument then flush all the streams. */
281 /* Get the file/MC descriptor. */
282 item
= vpi_scan(argv
);
283 vpi_free_object(argv
);
284 val
.format
= vpiIntVal
;
285 vpi_get_value(item
, &val
);
286 fd_mcd
= val
.value
.integer
;
288 if (IS_MCD(fd_mcd
)) {
289 vpi_mcd_flush(fd_mcd
);
291 /* If we have a valid file descriptor flush the file. */
292 fp
= vpi_get_file(fd_mcd
);
300 static PLI_INT32
sys_fputc_calltf(PLI_BYTE8
*name
)
305 s_vpi_value value
, xvalue
;
306 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
307 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
308 vpiHandle item
= vpi_scan(argv
);
312 vpi_printf("%s: mcd parameter missing.\n", name
);
316 type
= vpi_get(vpiType
, item
);
323 vpi_printf("ERROR: %s mcd parameter must be of integral", name
);
324 vpi_printf(", got vpiType=%d\n", type
);
325 vpi_free_object(argv
);
329 value
.format
= vpiIntVal
;
330 vpi_get_value(item
, &value
);
331 mcd
= value
.value
.integer
;
333 if (IS_MCD(mcd
)) return EOF
;
335 item
= vpi_scan(argv
);
337 xvalue
.format
= vpiIntVal
;
338 vpi_get_value(item
, &xvalue
);
339 x
= xvalue
.value
.integer
;
341 fp
= vpi_get_file(mcd
);
347 static PLI_INT32
sys_fgetc_calltf(PLI_BYTE8
*name
)
351 s_vpi_value value
, rval
;
352 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
353 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
354 vpiHandle item
= vpi_scan(argv
);
358 vpi_printf("%s: mcd parameter missing.\n", name
);
362 type
= vpi_get(vpiType
, item
);
369 vpi_printf("ERROR: %s mcd parameter must be of integral", name
);
370 vpi_printf(", got vpiType=%d\n", type
);
371 vpi_free_object(argv
);
375 value
.format
= vpiIntVal
;
376 vpi_get_value(item
, &value
);
377 mcd
= value
.value
.integer
;
379 rval
.format
= vpiIntVal
;
381 fp
= vpi_get_file(mcd
);
382 if (!fp
|| IS_MCD(mcd
))
383 rval
.value
.integer
= EOF
;
385 rval
.value
.integer
= fgetc(fp
);
387 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
392 static PLI_INT32
sys_fgets_compiletf(PLI_BYTE8
*name
)
394 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
395 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
396 vpiHandle item
= vpi_scan(argv
);
400 vpi_printf("%s: string parameter missing.\n", name
);
404 type
= vpi_get(vpiType
, item
);
406 if (type
!= vpiReg
) {
407 vpi_printf("%s: string parameter must be a reg.\n", name
);
408 vpi_free_object(argv
);
412 item
= vpi_scan(argv
);
414 vpi_printf("%s: mcd parameter missing.\n", name
);
418 /* That should be all the arguments. */
419 item
= vpi_scan(argv
);
425 static PLI_INT32
sys_fgets_calltf(PLI_BYTE8
*name
)
429 s_vpi_value value
, rval
;
434 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
435 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
436 vpiHandle str
= vpi_scan(argv
);
437 vpiHandle mch
= vpi_scan(argv
);
439 value
.format
= vpiIntVal
;
440 vpi_get_value(mch
, &value
);
441 mcd
= value
.value
.integer
;
443 fd
= vpi_get_file(mcd
);
444 if (!fd
|| IS_MCD(mcd
)) {
445 rval
.format
= vpiIntVal
;
446 rval
.value
.integer
= 0;
447 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
451 txt_len
= vpi_get(vpiSize
, str
) / 8;
452 txt
= malloc(txt_len
+ 1);
454 if (fgets(txt
, txt_len
+1, fd
) == 0) {
455 rval
.format
= vpiIntVal
;
456 rval
.value
.integer
= 0;
457 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
462 rval
.format
= vpiIntVal
;
463 rval
.value
.integer
= strlen(txt
);
464 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
466 value
.format
= vpiStringVal
;
467 value
.value
.str
= txt
;
468 vpi_put_value(str
, &value
, 0, vpiNoDelay
);
475 static PLI_INT32
sys_ungetc_compiletf(PLI_BYTE8
*name
)
478 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
479 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
480 vpiHandle item
= vpi_scan(argv
);
483 vpi_printf("%s: character parameter missing.\n", name
);
486 type
= vpi_get(vpiType
, item
);
489 case vpiRealVal
: // Is this correct?
493 vpi_printf("ERROR: %s character parameter must be ", name
);
494 vpi_printf("integral, got vpiType=%d\n", type
);
495 vpi_free_object(argv
);
499 item
= vpi_scan(argv
);
500 type
= vpi_get(vpiType
, item
);
503 case vpiRealVal
: // Is this correct?
507 vpi_printf("ERROR: %s mcd parameter must be integral, ", name
);
508 vpi_printf("got vpiType=%d\n", type
);
509 vpi_free_object(argv
);
513 /* That should be all the arguments. */
514 item
= vpi_scan(argv
);
520 static PLI_INT32
sys_ungetc_calltf(PLI_BYTE8
*name
)
524 s_vpi_value val
, rval
;
525 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
526 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
527 vpiHandle item
= vpi_scan(argv
);
530 rval
.format
= vpiIntVal
;
532 val
.format
= vpiIntVal
;
533 vpi_get_value(item
, &val
);
534 x
= val
.value
.integer
;
536 item
= vpi_scan(argv
);
538 val
.format
= vpiIntVal
;
539 vpi_get_value(item
, &val
);
540 mcd
= val
.value
.integer
;
543 rval
.value
.integer
= EOF
;
544 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
548 fp
= vpi_get_file(mcd
);
550 rval
.value
.integer
= EOF
;
551 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
557 rval
.value
.integer
= 0;
558 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
562 static PLI_INT32
sys_check_fd_compiletf(PLI_BYTE8
*ud
)
564 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
565 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
569 /* Check that there is an argument. */
571 vpi_printf("ERROR: %s requires an argument.\n", ud
);
572 vpi_control(vpiFinish
, 1);
575 /* Check that the file descriptor is the right type. */
576 item
= vpi_scan(argv
);
577 type
= vpi_get(vpiType
, item
);
584 vpi_printf("ERROR: %s fd parameter must be integral", ud
);
585 vpi_printf(", got vpiType=%d\n", type
);
586 vpi_control(vpiFinish
, 1);
590 /* Check that there is at most one argument. */
591 item
= vpi_scan(argv
);
593 vpi_printf("ERROR: %s takes a single argument.\n", ud
);
594 vpi_control(vpiFinish
, 1);
598 /* vpi_scan returning 0 (NULL) has already freed argv. */
602 static PLI_INT32
sys_rewind_calltf(PLI_BYTE8
*ud
)
604 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
605 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
606 vpiHandle item
= vpi_scan(argv
);
611 /* Get the file pointer. */
612 vpi_free_object(argv
);
613 val
.format
= vpiIntVal
;
614 vpi_get_value(item
, &val
);
615 fd
= val
.value
.integer
;
617 vpi_printf("ERROR: %s cannot be used with a MCD.\n", ud
);
618 vpi_control(vpiFinish
, 1);
621 fp
= vpi_get_file(fd
);
623 /* If we have a valid file descriptor rewind the file. */
625 val
.value
.integer
= EOF
;
628 val
.value
.integer
= 0;
630 vpi_put_value(callh
, &val
, 0 , vpiNoDelay
);
635 /* $feof() is from 1364-2005. */
636 static PLI_INT32
sys_ftell_feof_calltf(PLI_BYTE8
*ud
)
638 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
639 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
640 vpiHandle item
= vpi_scan(argv
);
645 /* Get the file pointer. */
646 vpi_free_object(argv
);
647 val
.format
= vpiIntVal
;
648 vpi_get_value(item
, &val
);
649 fd
= val
.value
.integer
;
651 vpi_printf("ERROR: %s cannot be used with a MCD.\n", ud
);
652 vpi_control(vpiFinish
, 1);
655 fp
= vpi_get_file(fd
);
657 /* If we do not have a valid file descriptor return EOF, otherwise
658 * return that value. */
660 val
.value
.integer
= EOF
;
663 val
.value
.integer
= feof(fp
);
665 val
.value
.integer
= ftell(fp
);
668 vpi_put_value(callh
, &val
, 0 , vpiNoDelay
);
673 static PLI_INT32
sys_fseek_compiletf(PLI_BYTE8
*ud
)
675 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
676 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
680 /* Check that there is an argument. */
682 vpi_printf("ERROR: %s requires three arguments.\n", ud
);
683 vpi_control(vpiFinish
, 1);
686 /* Check that the file descriptor is the right type. */
687 item
= vpi_scan(argv
);
688 type
= vpi_get(vpiType
, item
);
695 vpi_printf("ERROR: %s fd parameter must be integral", ud
);
696 vpi_printf(", got vpiType=%d\n", type
);
697 vpi_control(vpiFinish
, 1);
701 /* Check that there is an offset argument. */
702 item
= vpi_scan(argv
);
704 vpi_printf("ERROR: %s is missing an offset and operation "
706 vpi_control(vpiFinish
, 1);
710 /* Check that there is an operation argument. */
711 item
= vpi_scan(argv
);
713 vpi_printf("ERROR: %s is missing an operation argument.\n", ud
);
714 vpi_control(vpiFinish
, 1);
718 /* Check that there is at most one argument. */
719 item
= vpi_scan(argv
);
721 vpi_printf("ERROR: %s takes at most three argument.\n", ud
);
722 vpi_control(vpiFinish
, 1);
726 /* vpi_scan returning 0 (NULL) has already freed argv. */
731 static PLI_INT32
sys_fseek_calltf(PLI_BYTE8
*ud
)
733 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
734 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
737 PLI_INT32 fd
, offset
, oper
;
740 val
.format
= vpiIntVal
;
742 /* Get the file pointer. */
743 item
= vpi_scan(argv
);
744 vpi_get_value(item
, &val
);
745 fd
= val
.value
.integer
;
747 vpi_printf("ERROR: %s cannot be used with a MCD.\n", ud
);
748 vpi_control(vpiFinish
, 1);
751 fp
= vpi_get_file(fd
);
753 /* Get the offset. */
754 item
= vpi_scan(argv
);
755 vpi_get_value(item
, &val
);
756 offset
= val
.value
.integer
;
758 /* Get the operation. */
759 item
= vpi_scan(argv
);
760 vpi_get_value(item
, &val
);
761 oper
= val
.value
.integer
;
762 /* Should this translate to the SEEK_??? codes? */
763 /* What about verifying offset value vs operation ($fseek(fd, -1, 0))? */
764 if ((oper
< 0) || (oper
> 2)) {
765 vpi_printf("ERROR: %s's operation must be 0, 1 or 2 given %d.\n",
767 vpi_control(vpiFinish
, 1);
771 /* If we do not have a valid file descriptor return EOF, otherwise
772 * return that value. */
774 val
.value
.integer
= EOF
;
776 fseek(fp
, offset
, oper
);
777 val
.value
.integer
= 0;
779 vpi_put_value(callh
, &val
, 0 , vpiNoDelay
);
781 vpi_free_object(argv
);
785 static PLI_INT32
sys_integer_sizetf(PLI_BYTE8
*ud
)
790 void sys_fileio_register()
792 s_vpi_systf_data tf_data
;
794 //============================== fopen
795 tf_data
.type
= vpiSysFunc
;
796 tf_data
.tfname
= "$fopen";
797 tf_data
.calltf
= sys_fopen_calltf
;
798 tf_data
.compiletf
= sys_fopen_compiletf
;
799 tf_data
.sizetf
= sys_integer_sizetf
;
800 tf_data
.user_data
= "$fopen";
801 vpi_register_systf(&tf_data
);
803 //============================== fopenr
804 tf_data
.type
= vpiSysFunc
;
805 tf_data
.tfname
= "$fopenr";
806 tf_data
.calltf
= sys_fopenrwa_calltf
;
807 tf_data
.compiletf
= sys_fopenrwa_compiletf
;
808 tf_data
.sizetf
= sys_integer_sizetf
;
809 tf_data
.user_data
= "$fopenr";
810 vpi_register_systf(&tf_data
);
812 //============================== fopenw
813 tf_data
.tfname
= "$fopenw";
814 tf_data
.user_data
= "$fopenw";
815 vpi_register_systf(&tf_data
);
817 //============================== fopena
818 tf_data
.tfname
= "$fopena";
819 tf_data
.user_data
= "$fopena";
820 vpi_register_systf(&tf_data
);
822 //============================== fclose
823 tf_data
.type
= vpiSysTask
;
824 tf_data
.tfname
= "$fclose";
825 tf_data
.calltf
= sys_fclose_calltf
;
826 tf_data
.compiletf
= 0;
828 tf_data
.user_data
= "$fclose";
829 vpi_register_systf(&tf_data
);
831 //============================== fflush
832 tf_data
.type
= vpiSysTask
;
833 tf_data
.tfname
= "$fflush";
834 tf_data
.calltf
= sys_fflush_calltf
;
835 tf_data
.compiletf
= sys_fflush_compiletf
;
837 tf_data
.user_data
= "$fflush";
838 vpi_register_systf(&tf_data
);
840 //============================== fputc
841 tf_data
.type
= vpiSysTask
;
842 tf_data
.tfname
= "$fputc";
843 tf_data
.calltf
= sys_fputc_calltf
;
844 tf_data
.compiletf
= 0;
846 tf_data
.user_data
= "$fputc";
847 vpi_register_systf(&tf_data
);
849 //============================== fgetc
850 tf_data
.type
= vpiSysFunc
;
851 tf_data
.sysfunctype
= vpiSysFuncInt
;
852 tf_data
.tfname
= "$fgetc";
853 tf_data
.calltf
= sys_fgetc_calltf
;
854 tf_data
.compiletf
= 0;
855 tf_data
.sizetf
= sys_integer_sizetf
;
856 tf_data
.user_data
= "$fgetc";
857 vpi_register_systf(&tf_data
);
859 //============================== fgets
860 tf_data
.type
= vpiSysFunc
;
861 tf_data
.sysfunctype
= vpiSysFuncInt
;
862 tf_data
.tfname
= "$fgets";
863 tf_data
.calltf
= sys_fgets_calltf
;
864 tf_data
.compiletf
= sys_fgets_compiletf
;
866 tf_data
.user_data
= "$fgets";
867 vpi_register_systf(&tf_data
);
869 //============================== ungetc
870 tf_data
.type
= vpiSysFunc
;
871 tf_data
.sysfunctype
= vpiSysFuncInt
;
872 tf_data
.tfname
= "$ungetc";
873 tf_data
.calltf
= sys_ungetc_calltf
;
874 tf_data
.compiletf
= sys_ungetc_compiletf
;
875 tf_data
.sizetf
= sys_integer_sizetf
;
876 tf_data
.user_data
= "$ungetc";
877 vpi_register_systf(&tf_data
);
879 //============================== ftell
880 tf_data
.type
= vpiSysFunc
;
881 tf_data
.sysfunctype
= vpiSysFuncInt
;
882 tf_data
.tfname
= "$ftell";
883 tf_data
.calltf
= sys_ftell_feof_calltf
;
884 tf_data
.compiletf
= sys_check_fd_compiletf
;
885 tf_data
.sizetf
= sys_integer_sizetf
;
886 tf_data
.user_data
= "$ftell";
887 vpi_register_systf(&tf_data
);
889 //============================== fseek
890 tf_data
.type
= vpiSysFunc
;
891 tf_data
.sysfunctype
= vpiSysFuncInt
;
892 tf_data
.tfname
= "$fseek";
893 tf_data
.calltf
= sys_fseek_calltf
;
894 tf_data
.compiletf
= sys_fseek_compiletf
;
895 tf_data
.sizetf
= sys_integer_sizetf
;
896 tf_data
.user_data
= "$fseek";
897 vpi_register_systf(&tf_data
);
899 //============================== rewind
900 tf_data
.type
= vpiSysFunc
;
901 tf_data
.sysfunctype
= vpiSysFuncInt
;
902 tf_data
.tfname
= "$rewind";
903 tf_data
.calltf
= sys_rewind_calltf
;
904 tf_data
.compiletf
= sys_check_fd_compiletf
;
905 tf_data
.sizetf
= sys_integer_sizetf
;
906 tf_data
.user_data
= "$rewind";
907 vpi_register_systf(&tf_data
);
909 /* $feof() is from 1364-2005. */
910 //============================== feof
911 tf_data
.type
= vpiSysFunc
;
912 tf_data
.sysfunctype
= vpiSysFuncInt
;
913 tf_data
.tfname
= "$feof";
914 tf_data
.calltf
= sys_ftell_feof_calltf
;
915 tf_data
.compiletf
= sys_check_fd_compiletf
;
916 tf_data
.sizetf
= sys_integer_sizetf
;
917 tf_data
.user_data
= "$feof";
918 vpi_register_systf(&tf_data
);