version 1.24, 2014/10/11 03:57:13 |
version 1.25, 2015/07/21 07:13:59 |
|
|
|
|
int main(int, char *[]); |
int main(int, char *[]); |
|
|
|
|
/*** |
/*** |
*** Memory handling. |
*** Memory handling. |
***/ |
***/ |
|
|
n = ohash_insert(h, i, new_node(start, end)); |
n = ohash_insert(h, i, new_node(start, end)); |
return n; |
return n; |
} |
} |
|
|
#ifdef DEBUG |
#ifdef DEBUG |
static void |
static void |
dump_node(struct node *n) |
dump_node(struct node *n) |
|
|
for (i = 0; i < a->entries; i++) |
for (i = 0; i < a->entries; i++) |
dump_node(a->t[i]); |
dump_node(a->t[i]); |
} |
} |
|
|
static void |
static void |
dump_hash(struct ohash *h) |
dump_hash(struct ohash *h) |
{ |
{ |
|
|
dump_node(n); |
dump_node(n); |
} |
} |
#endif |
#endif |
|
|
|
|
/*** |
/*** |
*** Reading data. |
*** Reading data. |
***/ |
***/ |
|
|
|
|
toggle = 1; |
toggle = 1; |
a = NULL; |
a = NULL; |
|
|
while ((str = fgetln(f, &size)) != NULL) { |
while ((str = fgetln(f, &size)) != NULL) { |
char *sentinel; |
char *sentinel; |
|
|
|
|
} |
} |
return n; |
return n; |
} |
} |
|
|
#define ENQUEUE(h, n) do { \ |
#define ENQUEUE(h, n) do { \ |
if (hints_flag) \ |
if (hints_flag) \ |
enqueue((h), (n)); \ |
enqueue((h), (n)); \ |
|
|
assert(h->entries != 0); |
assert(h->entries != 0); |
for (i = 0; i < h->entries; i++) { |
for (i = 0; i < h->entries; i++) { |
struct node *n = h->t[i]; |
struct node *n = h->t[i]; |
/* No need to look further. */ |
/* No need to look further. */ |
if (n->refs == 1) |
if (n->refs == 1) |
return n; |
return n; |
if (n->refs != 0 && n->refs < best) { |
if (n->refs != 0 && n->refs < best) { |
|
|
assert(u != NULL); |
assert(u != NULL); |
return u; |
return u; |
} |
} |
|
|
/* Retrieve the node with the smallest order. */ |
/* Retrieve the node with the smallest order. */ |
static struct node * |
static struct node * |
find_smallest_node(struct array *h) |
find_smallest_node(struct array *h) |
|
|
n = n->from; |
n = n->from; |
if (!n) |
if (!n) |
return max; |
return max; |
o--; |
o--; |
} |
} |
} |
} |
} |
} |
|
|
o = traverse_node(n, o, c); |
o = traverse_node(n, o, c); |
} |
} |
} |
} |
|
|
assert(c->entries != 0); |
assert(c->entries != 0); |
n = c->t[0]; |
n = c->t[0]; |
best = n->refs; |
best = n->refs; |