Go to the source code of this file.
|
| ABC_NAMESPACE_IMPL_START sm_col * | sm_col_alloc () |
| |
| void | sm_col_free (sm_col *pcol) |
| |
| sm_col * | sm_col_dup (sm_col *pcol) |
| |
| sm_element * | sm_col_insert (sm_col *pcol, int row) |
| |
| void | sm_col_remove (sm_col *pcol, int row) |
| |
| sm_element * | sm_col_find (sm_col *pcol, int row) |
| |
| int | sm_col_contains (sm_col *p1, sm_col *p2) |
| |
| int | sm_col_intersects (sm_col *p1, sm_col *p2) |
| |
| int | sm_col_compare (sm_col *p1, sm_col *p2) |
| |
| sm_col * | sm_col_and (sm_col *p1, sm_col *p2) |
| |
| int | sm_col_hash (sm_col *pcol, int modulus) |
| |
| void | sm_col_remove_element (sm_col *pcol, sm_element *p) |
| |
| void | sm_col_print (FILE *fp, sm_col *pcol) |
| |
◆ sm_col_alloc()
Definition at line 21 of file cols.c.
22{
24
25#ifdef FAST_AND_LOOSE
28 } else {
29 pcol = sm_col_freelist;
31 }
32#else
34#endif
35
42 return pcol;
43}
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
struct sm_col_struct sm_col
◆ sm_col_and()
Definition at line 247 of file cols.c.
249{
252
254 q1 = p1->first_row;
255 q2 = p2->first_row;
256 if (q1 == 0 || q2 == 0) return result;
257 for(;;) {
258 if (q1->row_num < q2->row_num) {
259 if ((q1 = q1->next_row) == 0) {
260 return result;
261 }
262 } else if (q1->row_num > q2->row_num) {
263 if ((q2 = q2->next_row) == 0) {
264 return result;
265 }
266 } else {
268 if ((q1 = q1->next_row) == 0) {
269 return result;
270 }
271 if ((q2 = q2->next_row) == 0) {
272 return result;
273 }
274 }
275 }
276}
ABC_NAMESPACE_IMPL_START sm_col * sm_col_alloc()
sm_element * sm_col_insert()
◆ sm_col_compare()
Definition at line 218 of file cols.c.
220{
222
223 q1 = p1->first_row;
224 q2 = p2->first_row;
225 while(q1 != 0 && q2 != 0) {
226 if (q1->row_num != q2->row_num) {
227 return q1->row_num - q2->row_num;
228 }
229 q1 = q1->next_row;
230 q2 = q2->next_row;
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_col_contains()
Definition at line 165 of file cols.c.
167{
169
170 q1 = p1->first_row;
171 q2 = p2->first_row;
172 while (q1 != 0) {
173 if (q2 == 0 || q1->row_num < q2->row_num) {
174 return 0;
175 } else if (q1->row_num == q2->row_num) {
176 q1 = q1->next_row;
177 q2 = q2->next_row;
178 } else {
179 q2 = q2->next_row;
180 }
181 }
182 return 1;
183}
◆ sm_col_dup()
Definition at line 82 of file cols.c.
84{
87
91 }
92 return pnew;
93}
◆ sm_col_find()
Definition at line 146 of file cols.c.
149{
151
152 for(
p = pcol->
first_row;
p != 0 &&
p->row_num < row;
p =
p->next_row)
153 ;
154 if (
p != 0 &&
p->row_num == row) {
156 } else {
158 }
159}
◆ sm_col_free()
| void sm_col_free |
( |
sm_col * | pcol | ) |
|
Definition at line 53 of file cols.c.
55{
56#if defined(FAST_AND_LOOSE) && ! defined(COLS)
58
59 pcol->
last_row->next_row = sm_element_freelist;
61 }
62
63
65 sm_col_freelist = pcol;
66#else
68
72 }
74#endif
75}
#define sm_element_free(e)
◆ sm_col_hash()
| int sm_col_hash |
( |
sm_col * | pcol, |
|
|
int | modulus ) |
Definition at line 279 of file cols.c.
282{
283 register int sum;
285
286 sum = 0;
288 sum = (sum*17 +
p->row_num) % modulus;
289 }
290 return sum;
291}
◆ sm_col_insert()
Definition at line 100 of file cols.c.
103{
105
106
108 test = element;
110 next_row, prev_row, row_num, row, test);
111
112
113 if (element != test) {
115 }
116
117
118 return test;
119}
#define sm_element_alloc(newobj)
◆ sm_col_intersects()
Definition at line 190 of file cols.c.
192{
194
195 q1 = p1->first_row;
196 q2 = p2->first_row;
197 if (q1 == 0 || q2 == 0) return 0;
198 for(;;) {
199 if (q1->row_num < q2->row_num) {
200 if ((q1 = q1->next_row) == 0) {
201 return 0;
202 }
203 } else if (q1->row_num > q2->row_num) {
204 if ((q2 = q2->next_row) == 0) {
205 return 0;
206 }
207 } else {
208 return 1;
209 }
210 }
211}
◆ sm_col_print()
| void sm_col_print |
( |
FILE * | fp, |
|
|
sm_col * | pcol ) |
Definition at line 308 of file cols.c.
311{
313
315 (void) fprintf(fp,
" %d",
p->row_num);
316 }
317}
◆ sm_col_remove()
| void sm_col_remove |
( |
sm_col * | pcol, |
|
|
int | row ) |
Definition at line 126 of file cols.c.
129{
131
132 for(
p = pcol->
first_row;
p != 0 &&
p->row_num < row;
p =
p->next_row)
133 ;
134 if (
p != 0 &&
p->row_num == row) {
136 next_row, prev_row, pcol->
length);
138 }
139}
#define dll_unlink(p, first, last, next, prev, count)
◆ sm_col_remove_element()
Definition at line 297 of file cols.c.
300{
302 next_row, prev_row, pcol->
length);
304}