1: /*
2: * Routines for determining if a name is a built-in function.
3: */
4:
5: #include "ilink.h"
6:
7: /*
8: * btable is an array of the names of the Icon builtin functions.
9: */
10: char *btable[] = {
11: #define PDEF(p) "p",
12: #include "../h/pdef.h"
13: #undef PDEF
14: };
15:
16: #define NBUILTIN (sizeof(btable)/sizeof(char *))
17:
18: /*
19: * blocate - binary search for a builtin function.
20: * If found, returns pointer to entry.
21: */
22:
23: blocate(s)
24: register char *s;
25: {
26: register int test, cmp;
27: int low, high;
28:
29: low = 0;
30: high = NBUILTIN;
31: do {
32: test = (low + high) / 2;
33: cmp = strcmp(btable[test], s);
34: if (cmp < 0)
35: low = test + 1;
36: else if (cmp > 0)
37: high = test;
38: else
39: return (test+1);
40: } while (low < high);
41: return (0);
42: }
Defined functions
Defined variables
Defined macros
PDEF
defined in line
11; used 1 times