Go to the source code of this file.
|
| ABC_NAMESPACE_IMPL_START sm_row * | sm_row_alloc () |
| |
| void | sm_row_free (sm_row *prow) |
| |
| sm_row * | sm_row_dup (sm_row *prow) |
| |
| sm_element * | sm_row_insert (sm_row *prow, int col) |
| |
| void | sm_row_remove (sm_row *prow, int col) |
| |
| sm_element * | sm_row_find (sm_row *prow, int col) |
| |
| int | sm_row_contains (sm_row *p1, sm_row *p2) |
| |
| int | sm_row_intersects (sm_row *p1, sm_row *p2) |
| |
| int | sm_row_compare (sm_row *p1, sm_row *p2) |
| |
| sm_row * | sm_row_and (sm_row *p1, sm_row *p2) |
| |
| int | sm_row_hash (sm_row *prow, int modulus) |
| |
| void | sm_row_remove_element (sm_row *prow, sm_element *p) |
| |
| void | sm_row_print (FILE *fp, sm_row *prow) |
| |
◆ sm_row_alloc()
Definition at line 21 of file rows.c.
22{
24
25#ifdef FAST_AND_LOOSE
28 } else {
29 prow = sm_row_freelist;
31 }
32#else
34#endif
35
42 return prow;
43}
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
struct sm_row_struct sm_row
◆ sm_row_and()
Definition at line 247 of file rows.c.
249{
252
254 q1 = p1->first_col;
255 q2 = p2->first_col;
256 if (q1 == 0 || q2 == 0) return result;
257 for(;;) {
258 if (q1->col_num < q2->col_num) {
259 if ((q1 = q1->next_col) == 0) {
260 return result;
261 }
262 } else if (q1->col_num > q2->col_num) {
263 if ((q2 = q2->next_col) == 0) {
264 return result;
265 }
266 } else {
268 if ((q1 = q1->next_col) == 0) {
269 return result;
270 }
271 if ((q2 = q2->next_col) == 0) {
272 return result;
273 }
274 }
275 }
276}
ABC_NAMESPACE_IMPL_START sm_row * sm_row_alloc()
sm_element * sm_row_insert()
◆ sm_row_compare()
Definition at line 218 of file rows.c.
220{
222
223 q1 = p1->first_col;
224 q2 = p2->first_col;
225 while(q1 != 0 && q2 != 0) {
226 if (q1->col_num != q2->col_num) {
227 return q1->col_num - q2->col_num;
228 }
229 q1 = q1->next_col;
230 q2 = q2->next_col;
231 }
232
233 if (q1 != 0) {
234 return 1;
235 } else if (q2 != 0) {
236 return -1;
237 } else {
238 return 0;
239 }
240}
◆ sm_row_contains()
Definition at line 165 of file rows.c.
167{
169
170 q1 = p1->first_col;
171 q2 = p2->first_col;
172 while (q1 != 0) {
173 if (q2 == 0 || q1->col_num < q2->col_num) {
174 return 0;
175 } else if (q1->col_num == q2->col_num) {
176 q1 = q1->next_col;
177 q2 = q2->next_col;
178 } else {
179 q2 = q2->next_col;
180 }
181 }
182 return 1;
183}
◆ sm_row_dup()
Definition at line 82 of file rows.c.
84{
87
91 }
92 return pnew;
93}
◆ sm_row_find()
Definition at line 146 of file rows.c.
149{
151
152 for(
p = prow->
first_col;
p != 0 &&
p->col_num < col;
p =
p->next_col)
153 ;
154 if (
p != 0 &&
p->col_num == col) {
156 } else {
158 }
159}
◆ sm_row_free()
| void sm_row_free |
( |
sm_row * | prow | ) |
|
Definition at line 53 of file rows.c.
55{
56#if defined(FAST_AND_LOOSE) && ! defined(COLS)
58
59 prow->
last_col->next_col = sm_element_freelist;
61 }
62
63
65 sm_row_freelist = prow;
66#else
68
72 }
74#endif
75}
#define sm_element_free(e)
◆ sm_row_hash()
| int sm_row_hash |
( |
sm_row * | prow, |
|
|
int | modulus ) |
Definition at line 279 of file rows.c.
282{
283 register int sum;
285
286 sum = 0;
288 sum = (sum*17 +
p->col_num) % modulus;
289 }
290 return sum;
291}
◆ sm_row_insert()
Definition at line 100 of file rows.c.
103{
105
106
108 test = element;
110 next_col, prev_col, col_num, col, test);
111
112
113 if (element != test) {
115 }
116
117
118 return test;
119}
#define sm_element_alloc(newobj)
◆ sm_row_intersects()
Definition at line 190 of file rows.c.
192{
194
195 q1 = p1->first_col;
196 q2 = p2->first_col;
197 if (q1 == 0 || q2 == 0) return 0;
198 for(;;) {
199 if (q1->col_num < q2->col_num) {
200 if ((q1 = q1->next_col) == 0) {
201 return 0;
202 }
203 } else if (q1->col_num > q2->col_num) {
204 if ((q2 = q2->next_col) == 0) {
205 return 0;
206 }
207 } else {
208 return 1;
209 }
210 }
211}
◆ sm_row_print()
| void sm_row_print |
( |
FILE * | fp, |
|
|
sm_row * | prow ) |
Definition at line 308 of file rows.c.
311{
313
315 (void) fprintf(fp,
" %d",
p->col_num);
316 }
317}
◆ sm_row_remove()
| void sm_row_remove |
( |
sm_row * | prow, |
|
|
int | col ) |
Definition at line 126 of file rows.c.
129{
131
132 for(
p = prow->
first_col;
p != 0 &&
p->col_num < col;
p =
p->next_col)
133 ;
134 if (
p != 0 &&
p->col_num == col) {
136 next_col, prev_col, prow->
length);
138 }
139}
#define dll_unlink(p, first, last, next, prev, count)
◆ sm_row_remove_element()
Definition at line 297 of file rows.c.
300{
302 next_col, prev_col, prow->
length);
304}