2 ** LCLint - annotation-assisted static program checker
3 ** Copyright (C) 1994-2000 University of Virginia,
4 ** Massachusetts Institute of Technology
6 ** This program is free software; you can redistribute it and/or modify it
7 ** under the terms of the GNU General Public License as published by the
8 ** Free Software Foundation; either version 2 of the License, or (at your
9 ** option) any later version.
11 ** This program is distributed in the hope that it will be useful, but
12 ** WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ** General Public License for more details.
16 ** The GNU General Public License is available from http://www.gnu.org/ or
17 ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18 ** MA 02111-1307, USA.
20 ** For information on lclint: lclint-request@cs.virginia.edu
21 ** To report a bug: lclint-bug@cs.virginia.edu
22 ** For more information: http://lclint.cs.virginia.edu
27 ** based on list_template.c
29 ** where T has T_equal (or change this) and T_unparse
32 # include "lclintMacros.nf"
35 constraintList constraintList_new ()
37 constraintList s = (constraintList) dmalloc (sizeof (*s));
40 s->nspace = constraintListBASESIZE;
41 s->elements = (constraint *)
42 dmalloc (sizeof (*s->elements) * constraintListBASESIZE);
48 constraintList_grow (constraintList s)
51 constraint *newelements;
53 s->nspace += constraintListBASESIZE;
54 newelements = (constraint *) dmalloc (sizeof (*newelements)
55 * (s->nelements + s->nspace));
57 for (i = 0; i < s->nelements; i++)
59 newelements[i] = s->elements[i];
63 s->elements = newelements;
66 void constraintList_exprNodemerge()
70 constraintList_add (constraintList s, constraint el)
73 constraintList_grow (s);
76 s->elements[s->nelements] = el;
81 constraintList constraintList_addList (constraintList s, constraintList new)
83 constraintList_elements(new, elem)
84 s = constraintList_add (s, elem);
85 end_constraintList_elements
90 constraintList_print (constraintList s)
93 cstring st = cstring_undefined;
96 if (s->nelements == 0)
97 st = cstring_makeLiteral("<List Empty>");
99 for (i = 0; i < s->nelements; i++)
101 cstring type = cstring_undefined;
102 constraint current = s->elements[i];
106 cstring temp1 = constraint_print(current);
107 type = message ("%q %q\n", type, temp1 );
117 st = message ("%q, %q", st, type);
124 constraintList_free (constraintList s)
127 for (i = 0; i < s->nelements; i++)
129 // constraint_free (s->elements[i]);
137 constraintList_copy (constraintList s)
139 constraintList ret = constraintList_new ();
141 constraintList_elements (s, el)
143 ret = constraintList_add (ret, constraint_copy (el));
144 } end_constraintList_elements;