Add a mark at simulation end for vcd/lxt/lxt2 files.
[iverilog.git] / libveriuser / workarea.c
blobec2a36ed99f39593ff429d1843a9b29d36e4b63e
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: workarea.c,v 1.1 2002/12/19 21:37:04 steve Exp $"
21 #endif
23 # include <veriuser.h>
24 # include <vpi_user.h>
25 # include <stdlib.h>
26 #ifdef HAVE_MALLOC_H
27 # include <malloc.h>
28 #endif
31 * Keep a list of sys handle to work area bindings.
33 struct workarea_cell {
34 vpiHandle sys;
35 void* area;
36 struct workarea_cell*next;
39 static struct workarea_cell*area_list = 0;
41 PLI_INT32 tf_setworkarea(void*workarea)
43 vpiHandle sys;
44 struct workarea_cell*cur;
46 sys = vpi_handle(vpiSysTfCall, 0);
47 cur = area_list;
49 while (cur) {
50 if (cur->sys == sys) {
51 cur->area = workarea;
52 return 0;
55 cur = cur->next;
58 cur = calloc(1, sizeof (struct workarea_cell));
59 cur->next = area_list;
60 cur->sys = sys;
61 cur->area = workarea;
62 area_list = cur;
64 return 0;
67 PLI_BYTE8* tf_getworkarea(void)
69 struct workarea_cell*cur;
70 vpiHandle sys;
72 sys = vpi_handle(vpiSysTfCall, 0);
73 cur = area_list;
75 while (cur) {
76 if (cur->sys == sys) {
77 return cur->area;
80 cur = cur->next;
83 return 0;
87 * $Log: workarea.c,v $
88 * Revision 1.1 2002/12/19 21:37:04 steve
89 * Add tf_message, tf_get/setworkarea, and
90 * ty_typep functions, along with defines
91 * related to these functions.