| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#include "rx.h" |
| 22 |
#include "rxall.h" |
| 23 |
#include "rxhash.h" |
| 24 |
#include "rxnfa.h" |
| 25 |
#include "rxsuper.h" |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
const char rx_version_string[] = "GNU Rx version 1.5"; |
| 30 |
|
| 31 |
|
| 32 |
#ifdef __STDC__ |
| 33 |
struct rx * |
| 34 |
rx_make_rx (int cset_size) |
| 35 |
#else |
| 36 |
struct rx * |
| 37 |
rx_make_rx (cset_size) |
| 38 |
int cset_size; |
| 39 |
#endif |
| 40 |
{ |
| 41 |
static int rx_id = 0; |
| 42 |
struct rx * new_rx; |
| 43 |
new_rx = (struct rx *)malloc (sizeof (*new_rx)); |
| 44 |
rx_bzero ((char *)new_rx, sizeof (*new_rx)); |
| 45 |
new_rx->rx_id = rx_id++; |
| 46 |
new_rx->cache = rx_default_cache; |
| 47 |
new_rx->local_cset_size = cset_size; |
| 48 |
new_rx->instruction_table = rx_id_instruction_table; |
| 49 |
new_rx->next_nfa_id = 0; |
| 50 |
return new_rx; |
| 51 |
} |
| 52 |
|
| 53 |
#ifdef __STDC__ |
| 54 |
void |
| 55 |
rx_free_rx (struct rx * rx) |
| 56 |
#else |
| 57 |
void |
| 58 |
rx_free_rx (rx) |
| 59 |
struct rx * rx; |
| 60 |
#endif |
| 61 |
{ |
| 62 |
if (rx->start_set) |
| 63 |
rx->start_set->starts_for = 0; |
| 64 |
rx_free_nfa (rx); |
| 65 |
free (rx); |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
#ifdef __STDC__ |
| 70 |
void |
| 71 |
rx_bzero (char * mem, int size) |
| 72 |
#else |
| 73 |
void |
| 74 |
rx_bzero (mem, size) |
| 75 |
char * mem; |
| 76 |
int size; |
| 77 |
#endif |
| 78 |
{ |
| 79 |
while (size) |
| 80 |
{ |
| 81 |
*mem = 0; |
| 82 |
++mem; |
| 83 |
--size; |
| 84 |
} |
| 85 |
} |