Clean up warnings for round() function declaration.
[iverilog.git] / libveriuser / a_next.c
blobec3e9c7ea1619c2f521ded54cb48a1bbf77677c1
1 /* vi:sw=6
2 * Copyright (c) 2003 Michael Ruff (mruff at chiaro.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_next.c,v 1.4 2006/10/30 22:45:37 steve Exp $"
21 #endif
23 #include <stdio.h>
24 #include <acc_user.h>
25 #include <vpi_user.h>
26 #include "priv.h"
29 * acc_next and friends implemented using VPI
31 handle acc_next(PLI_INT32 *type, handle scope, handle prev)
33 vpiHandle iter, hand = 0;
35 /* trace */
36 if (pli_trace) {
37 PLI_INT32 *ip;
38 fprintf(pli_trace, "acc_next(%p <", type);
39 for (ip = type; *ip; ip++) {
40 fprintf(pli_trace, "%s%d", ip != type ? "," : "", *ip);
42 fprintf(pli_trace, ">, %p", scope);
43 if (scope)
44 fprintf(pli_trace, " \"%s\"", vpi_get_str(vpiName, scope));
45 fprintf(pli_trace, ", %p", prev);
46 if (prev)
47 fprintf(pli_trace, " \"%s\"", vpi_get_str(vpiName, prev));
48 else
49 fprintf(pli_trace, ")");
50 fflush(pli_trace);
54 * The acc_next_* functions need to be reentrant, so we need to
55 * rescan all the items upto the previous one, then return
56 * the next one.
58 iter = vpi_iterate(vpiScope, scope); // ICARUS extension
59 if (prev) {
60 while ((hand = vpi_scan(iter))) {
61 if (hand == prev) break;
65 /* scan for next */
66 if (!prev || hand) {
67 while ((hand = vpi_scan(iter))) {
68 if (acc_object_in_typelist(hand, type))
69 break;
73 /* don't leak iterators */
74 if (hand) vpi_free_object(iter);
76 /* trace */
77 if (pli_trace) {
78 fprintf(pli_trace, " --> %p", hand);
79 if (hand)
80 fprintf(pli_trace, " \"%s\"\n", vpi_get_str(vpiName, hand));
81 else
82 fprintf(pli_trace, "\n");
86 return hand;
89 handle acc_next_scope(handle scope, handle prev)
91 PLI_INT32 type[2] = {accScope, 0};
92 return acc_next(type, scope, prev);
96 * $Log: a_next.c,v $
97 * Revision 1.4 2006/10/30 22:45:37 steve
98 * Updates for Cygwin portability (pr1585922)
100 * Revision 1.3 2003/06/17 16:55:07 steve
101 * 1) setlinebuf() for vpi_trace
102 * 2) Addes error checks for trace file opens
103 * 3) removes now extraneous flushes
104 * 4) fixes acc_next() bug
106 * Revision 1.2 2003/06/04 01:56:20 steve
107 * 1) Adds configure logic to clean up compiler warnings
108 * 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
109 * tf_isetrealdelay, acc_handle_scope
110 * 3) makes acc_next reentrant
111 * 4) adds basic vpiWire type support
112 * 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
113 * 6) add vpiLeftRange/RigthRange to signals
115 * Revision 1.1 2003/05/30 04:18:31 steve
116 * Add acc_next function.