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

blocate defined in line 23; used 1 times

Defined variables

btable defined in line 10; used 2 times

Defined macros

NBUILTIN defined in line 16; used 1 times
  • in line 30
PDEF defined in line 11; used 1 times
  • in line 13
Last modified: 1984-11-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 864
Valid CSS Valid XHTML 1.0 Strict