Clean up warnings for round() function declaration.
[iverilog.git] / libveriuser / a_fetch_type.c
blob7563a626a80b39a59d8e253e2871d98737c60c25
1 /*
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)
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: a_fetch_type.c,v 1.8 2004/10/04 01:10:56 steve Exp $"
21 #endif
23 # include <acc_user.h>
24 # include <vpi_user.h>
25 # include <assert.h>
27 PLI_INT32 acc_fetch_size(handle obj)
29 return vpi_get(vpiSize, obj);
32 PLI_INT32 acc_fetch_type(handle obj)
34 switch (vpi_get(vpiType, obj)) {
36 case vpiConstant:
37 /*XXXX SWIFT PLI tasks seem to assume that string
38 constants show up an accParameter, instead of
39 accConstant. */
40 if (vpi_get(vpiConstType, obj) == vpiStringConst)
41 return accParameter;
42 else
43 return accConstant;
45 case vpiNamedEvent:
46 return accNamedEvent;
48 case vpiNet:
49 return accNet;
51 case vpiParameter:
52 return accParameter;
54 case vpiReg:
55 return accReg;
57 case vpiIntegerVar:
58 return accIntegerVar;
60 case vpiModule:
61 return accModule;
63 default:
64 vpi_printf("acc_fetch_type: vpiType %d is what accType?\n",
65 vpi_get(vpiType, obj));
66 return accUnknown;
69 return 0;
72 PLI_INT32 acc_fetch_fulltype(handle obj)
74 int type = vpi_get(vpiType, obj);
76 switch (type) {
77 case vpiNet: {
78 type = vpi_get(vpiNetType, obj);
79 switch(type) {
80 case vpiWire: return accWire;
81 default:
82 vpi_printf("acc_fetch_fulltype: vpiNetType %d unknown?\n",
83 type);
84 return accUnknown;
88 case vpiConstant:
89 /* see acc_fetch_type */
90 if (vpi_get(vpiConstType, obj) == vpiStringConst)
91 return accStringParam;
92 else
93 return accConstant;
95 case vpiIntegerVar: return accIntegerVar;
97 case vpiModule:
98 if (!vpi_handle(vpiScope, obj))
99 return accTopModule;
100 else
101 return accModuleInstance;
102 // FIXME accCellInstance
104 case vpiNamedEvent: return accNamedEvent;
106 case vpiParameter:
107 switch(vpi_get(vpiConstType, obj)) {
108 case vpiRealConst: return accRealParam;
109 case vpiStringConst: return accStringParam;
110 default: return accIntegerParam;
113 case vpiReg: return accReg;
115 default:
116 vpi_printf("acc_fetch_fulltype: vpiType %d unknown?\n",
117 type);
118 return accUnknown;
123 * $Log: a_fetch_type.c,v $
124 * Revision 1.8 2004/10/04 01:10:56 steve
125 * Clean up spurious trailing white space.
127 * Revision 1.7 2003/06/04 01:56:20 steve
128 * 1) Adds configure logic to clean up compiler warnings
129 * 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
130 * tf_isetrealdelay, acc_handle_scope
131 * 3) makes acc_next reentrant
132 * 4) adds basic vpiWire type support
133 * 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
134 * 6) add vpiLeftRange/RigthRange to signals
136 * Revision 1.6 2003/05/30 04:18:31 steve
137 * Add acc_next function.
139 * Revision 1.5 2003/05/29 02:35:41 steve
140 * acc_fetch_type supports module.
142 * Revision 1.4 2003/04/24 18:57:06 steve
143 * Add acc_fetch_fulltype function.
145 * Revision 1.3 2003/04/12 18:57:14 steve
146 * More acc_ function stubs.
148 * Revision 1.2 2003/03/13 04:35:09 steve
149 * Add a bunch of new acc_ and tf_ functions.
151 * Revision 1.1 2003/02/17 06:39:47 steve
152 * Add at least minimal implementations for several
153 * acc_ functions. Add support for standard ACC
154 * string handling.
156 * Add the _pli_types.h header file to carry the
157 * IEEE1364-2001 standard PLI type declarations.