00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 # include "lclintMacros.nf"
00029 # include "basic.h"
00030
00031 qualList
00032 qualList_new ()
00033 {
00034 return qualList_undefined;
00035 }
00036
00037 static qualList
00038 qualList_newEmpty (void)
00039 {
00040 qualList s = (qualList) dmalloc (sizeof (*s));
00041
00042 s->nelements = 0;
00043 s->free = qualListBASESIZE;
00044 s->elements = (qual *) dmalloc (sizeof (*s->elements) * qualListBASESIZE);
00045
00046 return (s);
00047 }
00048
00049 void
00050 qualList_clear (qualList q)
00051 {
00052 if (qualList_isDefined (q))
00053 {
00054 q->free += q->nelements;
00055 q->nelements = 0;
00056 }
00057 }
00058
00059 static void
00060 qualList_grow ( qualList s)
00061 {
00062 int i;
00063 qual *oldelements = s->elements;
00064
00065 s->free += qualListBASESIZE;
00066
00067 s->elements = (qual *) dmalloc (sizeof (*s->elements) * (s->nelements + s->free));
00068
00069 for (i = 0; i < s->nelements; i++)
00070 {
00071 s->elements[i] = oldelements[i];
00072 }
00073
00074 sfree (oldelements);
00075 }
00076
00077 qualList qualList_add (qualList s, qual el)
00078 {
00079 if (qualList_isUndefined (s))
00080 {
00081 s = qualList_newEmpty ();
00082 }
00083
00084 if (s->free <= 0)
00085 qualList_grow (s);
00086
00087 s->free--;
00088 s->elements[s->nelements] = el;
00089 s->nelements++;
00090
00091 return (s);
00092 }
00093
00094 qualList qualList_appendList (qualList s, qualList t)
00095 {
00096 qualList_elements (t, current)
00097 {
00098 s = qualList_add (s, current);
00099 } end_qualList_elements;
00100
00101 return s;
00102 }
00103
00104 # ifndef NOLCL
00105 qualList qualList_copy (qualList s)
00106 {
00107 qualList t = qualList_new ();
00108
00109 qualList_elements (s, current)
00110 {
00111 t = qualList_add (t, current);
00112 } end_qualList_elements;
00113
00114 return t;
00115 }
00116 # endif
00117
00118 cstring
00119 qualList_unparse (qualList s)
00120 {
00121 int i;
00122 cstring st = cstring_undefined;
00123
00124 if (qualList_isDefined (s))
00125 {
00126 for (i = 0; i < qualList_size (s); i++)
00127 {
00128 if (i == 0)
00129 {
00130 st = message ("%q%s ", st, qual_unparse (s->elements[i]));
00131 }
00132 else
00133 st = message ("%q%s ", st, qual_unparse (s->elements[i]));
00134 }
00135 }
00136
00137 return st;
00138 }
00139
00140 # ifndef NOLCL
00141 cstring
00142 qualList_toCComments (qualList s)
00143 {
00144 int i;
00145 cstring st = cstring_undefined;
00146
00147 if (qualList_isDefined (s))
00148 {
00149 for (i = 0; i < qualList_size (s); i++)
00150 {
00151 if (i == 0)
00152 {
00153 st = message ("%q/*@%s@*/ ", st, qual_unparse (s->elements[i]));
00154 }
00155 else
00156 st = message ("%q/*@%s@*/ ", st, qual_unparse (s->elements[i]));
00157 }
00158 }
00159
00160 return st;
00161 }
00162 # endif
00163
00164 bool
00165 qualList_hasAliasQualifier (qualList s)
00166 {
00167 if (qualList_isDefined (s))
00168 {
00169 qualList_elements (s, q)
00170 {
00171 if (qual_isAliasQual (q)) return TRUE;
00172 } end_qualList_elements;
00173 }
00174
00175 return FALSE;
00176 }
00177
00178 bool
00179 qualList_hasExposureQualifier (qualList s)
00180 {
00181 if (qualList_isDefined (s))
00182 {
00183 qualList_elements (s, q)
00184 {
00185 if (qual_isExQual (q)) return TRUE;
00186 } end_qualList_elements;
00187 }
00188
00189 return FALSE;
00190 }
00191
00192 void
00193 qualList_free ( qualList s)
00194 {
00195 if (qualList_isDefined (s))
00196 {
00197 sfree (s->elements);
00198 sfree (s);
00199 }
00200 }
00201
00202
00203
00204