Add a mark at simulation end for vcd/lxt/lxt2 files.
[iverilog.git] / libveriuser / typep.c
blob9a15089013c024541d09ab1467955a9474b34f8d
1 /*
2 * Copyright (c) 2002 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)
8 * any later version.
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
19 #ifdef HAVE_CVS_IDENT
20 #ident "$Id: typep.c,v 1.2 2003/03/13 05:07:46 steve Exp $"
21 #endif
23 #include <assert.h>
24 #include <veriuser.h>
25 #include <vpi_user.h>
27 PLI_INT32 tf_typep(PLI_INT32 narg)
29 vpiHandle sys_h, argv, arg_h = 0;
30 int rtn;
32 assert(narg > 0);
34 /* get task/func handle */
35 sys_h = vpi_handle(vpiSysTfCall, 0);
36 argv = vpi_iterate(vpiArgument, sys_h);
38 /* find nth arg */
39 while (narg > 0) {
40 /* Watch that the argument is not out of range. */
41 if (!(arg_h = vpi_scan(argv)))
42 return TF_NULLPARAM;
43 narg -= 1;
46 switch (vpi_get(vpiType, arg_h)) {
47 case vpiConstant:
48 switch (vpi_get(vpiConstType, arg_h)) {
49 case vpiStringConst:
50 rtn = TF_STRING;
51 break;
52 default:
53 rtn = TF_READONLY;
54 break;
56 break;
58 case vpiIntegerVar:
59 case vpiReg:
60 case vpiMemoryWord:
61 rtn = TF_READWRITE;
62 break;
64 default:
65 rtn = TF_READONLY;
66 break;
69 vpi_free_object(argv);
70 return rtn;
74 * $Log: typep.c,v $
75 * Revision 1.2 2003/03/13 05:07:46 steve
76 * Declaration warnings.
78 * Revision 1.1 2002/12/19 21:37:04 steve
79 * Add tf_message, tf_get/setworkarea, and
80 * ty_typep functions, along with defines
81 * related to these functions.