| // Do case-insensitive lookup of key[0:keylen] in t[0:n] (key part), |
| // returning 1 if found, 0 if not. |
| // Array t must be sorted in increasing lexicographic order of key. |
| // If found, return corresponding val in *pans. |
| _lookup(StringInt* t, int n, Rune* key, int keylen, int* pans) |
| cmpresult = _Strncmpci(key, keylen, t[try].key); |
| // Return first key in t[0:n] that corresponds to val, |
| _revlookup(StringInt* t, int n, int val) |
| // Make a StringInt table out of a[0:n], mapping each string |
| // to its index. Check that entries are in alphabetical order. |
| _makestrinttab(Rune** a, int n) |
| ans = (StringInt*)emalloc(n * sizeof(StringInt)); |
| assert(i == 0 || runestrcmp(a[i], a[i - 1]) >= 0); |