diff options
Diffstat (limited to 'src/bsr.c')
-rw-r--r-- | src/bsr.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -474,6 +474,33 @@ bsr_find(CCR_MOD(bsr *) b, CCR_MOD(Grammar *) g, return result; } +ht * +bsr_lookup(CCR_MOD(bsr *) b, BOOL * const restrict errorp, + NUM X, NUM i, NUM j) +{ + *errorp = 0; + ht *result = NULL; + + if (X < 0 || X >= b->f.len) { + fleprintf("Invalid X: %ld\n", X); + goto cleanup; + } + + if (!((b->f.array+X)->initialized)) goto success; + + pair2 p2 = (pair2) { .x = i, .y = j }; + + result = (ht *) ht_find((b->f.array+X)->table, &p2); + + goto success; + + cleanup: + *errorp = 1; + + success: + return result; +} + static void print_sep() { |