-
Notifications
You must be signed in to change notification settings - Fork 512
/
a_vcl.c
106 lines (90 loc) · 2.72 KB
/
a_vcl.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* Copyright (c) 2003 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_vcl.c,v 1.4 2003/04/30 01:09:29 steve Exp $"
#endif
#include <vpi_user.h>
#include <acc_user.h>
#include <stdlib.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "priv.h"
struct vcl_record {
vpiHandle obj;
PLI_INT32(*consumer)(p_vc_record);
void*user_data;
PLI_INT32 vcl_flag;
vpiHandle callback;
struct vcl_record*next;
};
static struct vcl_record*vcl_list = 0;
static PLI_INT32 vcl_value_callback(struct t_cb_data*cb)
{
struct vcl_record*cur = (struct vcl_record*)cb->user_data;
vpi_printf("XXXX Call vcl_callback(<type=%d>);\n",
vpi_get(vpiType, cur->obj));
return 0;
}
void acc_vcl_add(handle obj, PLI_INT32(*consumer)(p_vc_record),
void*data, PLI_INT32 vcl_flag)
{
struct vcl_record*cur;
struct t_cb_data cb;
switch (vpi_get(vpiType, obj)) {
case vpiNet:
cur = malloc(sizeof (struct vcl_record));
cur->obj = obj;
cur->consumer = consumer;
cur->user_data = data;
cur->vcl_flag = vcl_flag;
cur->next = vcl_list;
vcl_list = cur;
cb.reason = cbValueChange;
cb.cb_rtn = vcl_value_callback;
cb.obj = obj;
cb.user_data = (void*)cur;
cur->callback = vpi_register_cb(&cb);
break;
default:
vpi_printf("XXXX Call acc_vcl_add(<type=%d>, ..., %d);\n",
vpi_get(vpiType, obj), vcl_flag);
break;
}
}
void acc_vcl_delete(handle obj, PLI_INT32(*consumer)(p_vc_record),
void*data, PLI_INT32 vcl_flag)
{
vpi_printf("XXXX Call acc_vcl_delete\n");
}
/*
* $Log: a_vcl.c,v $
* Revision 1.4 2003/04/30 01:09:29 steve
* Conditionally include malloc.h
*
* Revision 1.3 2003/04/24 02:02:37 steve
* Clean up some simple warnings.
*
* Revision 1.2 2003/04/20 02:48:39 steve
* Support value change callbacks.
*
* Revision 1.1 2003/04/12 18:57:14 steve
* More acc_ function stubs.
*
*/