File: link.h

package info (click to toggle)
covered 0.7.10-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,040 kB
  • sloc: ansic: 48,809; yacc: 11,650; xml: 8,838; tcl: 7,698; sh: 3,925; lex: 2,240; makefile: 362; perl: 329
file content (299 lines) | stat: -rw-r--r-- 7,425 bytes parent folder | download | duplicates (7)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
#ifndef __LINK_H__
#define __LINK_H__

/*
 Copyright (c) 2006-2010 Trevor Williams

 This program is free software; you can redistribute it and/or modify
 it 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/*!
 \file     link.h
 \author   Trevor Williams  (phase1geo@gmail.com)
 \date     11/28/2001
 \brief    Contains functions to manipulate a linked lists.
*/

#include "defines.h"


/*! \brief Adds specified string to str_link element at the end of the list. */
str_link* str_link_add(
  char*      str,
  str_link** head,
  str_link** tail
);

/*! \brief Adds specified statement to stmt_link element at the beginning of the list. */
stmt_link* stmt_link_add(
  statement*  stmt,
  bool        rm_stmt,
  stmt_link** head,
  stmt_link** tail
);

/*! \brief Adds specified expression to exp_link element at the end of the list. */
void exp_link_add(
  expression* expr,
  exp_link**  head,
  exp_link**  tail
);

/*! \brief Adds specified signal to sig_link element at the end of the list. */
void sig_link_add(
  vsignal*   sig,
  sig_link** head,
  sig_link** tail
);

/*! \brief Adds specified FSM to fsm_link element at the end of the list. */
void fsm_link_add(
  fsm*       table,
  fsm_link** head,
  fsm_link** tail
);

/*! \brief Adds specified functional unit to funit_link element at the end of the list. */
void funit_link_add(
  func_unit*   funit,
  funit_link** head,
  funit_link** tail
);

#ifndef VPI_ONLY
/*! \brief Adds specified generate item to the end of specified gitem list. */
void gitem_link_add(
  gen_item*    gi,
  gitem_link** head,
  gitem_link** tail
);
#endif

/*! \brief Adds specified functional unit instance to inst_link element at the end of the list. */
inst_link* inst_link_add(
  funit_inst* inst,
  inst_link** head,
  inst_link** tail
);

/*********************************************************************************/

/*! \brief Displays specified string list to standard output. */
void str_link_display(
  str_link* head
);

/*! \brief Displays specified statement list to standard output. */
void stmt_link_display(
  stmt_link* head
);

/*! \brief Displays specified expression list to standard output. */
void exp_link_display(
  exp_link* head
);

/*! \brief Displays specified signal list to standard output. */
void sig_link_display(
  sig_link* head
);

/*! \brief Displays specified functional unit list to standard output. */
void funit_link_display(
  funit_link* head
);

#ifndef VPI_ONLY
/*! \brief Displays specified generate item list to standard output. */
void gitem_link_display(
  gitem_link* head
);
#endif

/*! \brief Displays specified instance list to standard output. */
void inst_link_display(
  inst_link* head
);

/*********************************************************************************/

/*! \brief Finds specified string in the given str_link list. */
/*@null@*/ str_link* str_link_find(
  const char* value,
  str_link*   head
);

/*! \brief Finds specified statement in the given stmt_link list. */
/*@null@*/ stmt_link* stmt_link_find(
  int        id,
  stmt_link* head
);

/*! \brief Finds specified statement in the given stmt_link list. */
/*@null@*/ stmt_link* stmt_link_find_by_pos(
  unsigned int ppline,
  uint32       first_col,
  stmt_link*   head
);

/*! \brief Finds specified expression in the given exp_link list. */
/*@null@*/ exp_link* exp_link_find(
  int       id,
  exp_link* head
);

/*! \brief Finds specified expression in the given exp_link list. */
/*@null@*/ exp_link* exp_link_find_by_pos(
  exp_op_type  op,
  int          line,
  unsigned int col,
  exp_link*    head
);

/*! \brief Finds specified signal in given sig_link list. */
/*@null@*/ sig_link* sig_link_find(
  const char* name,
  sig_link*   head
);

/*! \brief Finds specified FSM structure in fsm_link list. */
/*@null@*/ fsm_link* fsm_link_find(
  const char* name,
  fsm_link*   head
);

/*! \brief Finds specified FSM structure in fsm_link list based on file position. */
/*@null@*/ fsm_link* fsm_link_find_by_pos(
  int         line,
  fsm_link*   head
);

/*! \brief Finds specified functional unit in given funit_link list. */
/*@null@*/ /*@shared@*/ funit_link* funit_link_find(
  const char* name,
  int         type,
  funit_link* head
);

#ifndef VPI_ONLY
/*! \brief Finds specified generate item in given gitem_link list. */
/*@null@*/ gitem_link* gitem_link_find(
  gen_item*   gi,
  gitem_link* head
);
#endif

/*! \brief Finds specified functional unit instance in given inst_link list. */
/*@null@*/ funit_inst* inst_link_find_by_scope(
  char*      scope,
  inst_link* head
);

/*! \brief Finds specified functional unit instance in given inst_link list. */
/*@null@*/ funit_inst* inst_link_find_by_funit(
  const func_unit* funit,
  inst_link*       head,
  int*             ignore
);

/*********************************************************************************/

/*! \brief Searches for and removes specified string link from list. */
void str_link_remove(
  char*      str,
  str_link** head,
  str_link** tail
);

/*! \brief Searches for and removes specified expression link from list. */
void exp_link_remove(
  expression* exp,
  exp_link**  head,
  exp_link**  tail,
  bool        recursive
);

#ifndef VPI_ONLY
/*! \brief Searches for and removes specified generate item link from list. */
void gitem_link_remove(
  gen_item*    gi,
  gitem_link** head,
  gitem_link** tail
);
#endif

/*! \brief Searches for and removes specified functional unit link from list. */
void funit_link_remove(
  func_unit*   funit,
  funit_link** head,
  funit_link** tail,
  bool         rm_funit
);

/*********************************************************************************/

/*! \brief Deletes entire list specified by head pointer. */
void str_link_delete_list(
  str_link* head
);

/*! \brief Unlinks the stmt_link specified by the specified statement */
void stmt_link_unlink(
  statement*  stmt,
  stmt_link** head,
  stmt_link** tail
);

/*! \brief Deletes entire list specified by head pointer. */
void stmt_link_delete_list(
  stmt_link* head
);

/*! \brief Deletes entire list specified by head pointer. */
void exp_link_delete_list(
  exp_link* head,
  bool      del_exp
);

/*! \brief Deletes entire list specified by head pointer. */
void sig_link_delete_list(
  sig_link* head,
  bool      del_sig
);

/*! \brief Deletes entire list specified by head pointer. */
void fsm_link_delete_list(
  fsm_link* head
);

/*! \brief Deletes entire list specified by head pointer. */
void funit_link_delete_list(
  funit_link** head,
  funit_link** tail,
  bool         rm_funit
);

#ifndef VPI_ONLY
/*! \brief Deletes entire list specified by head pointer. */
void gitem_link_delete_list(
  gitem_link* head,
  bool        rm_elems
);
#endif

/*! \brief Deletes entire list specified by head pointer. */
void inst_link_delete_list(
  inst_link* head
);

#endif