# 2.11BSD#431 - /usr/ingres/source/equel/getkey.c

##### Functions

    getkey            X

       1: #
       2: # include   <stdio.h>
       3:
       4: # include   "constants.h"
       5: # include   "globals.h"
       6: /*
       7: **  GETKEY -- Get the optab entry for a keyword
       8: **
       9: **	Performs a binary search through Kwrdtab
      10: **	for a given keyword.
      11: **
      12: **	Parameters:
      13: **		key -- char * to the keywords character
      14: **			representation.
      15: **
      16: **	Returns:
      17: **		a pointer to the optab struct node for that
      18: **		keyword, or 0 if not found.
      19: **
      20: **	Requires:
      21: **		Kwrdtab -- to search through
      22: **		Kwrdnum -- the number of entries in the
      23: **			key word table [tokens.y].
      24: **
      25: **	Called By:
      26: **		name() [name.c]
      27: **
      28: **	History:
      29: **		6/1/78 -- (marc) written
      30: **
      31: */
      32:
      33:
      34:
      35: struct optab
      36: *getkey(key)
      37: char        *key;
      38: {
      39:     register struct optab   *op;
      40:     int         top, bot;
      41:     register int        k;
      42:     extern int      Kwrdnum;
      43:
      44:     op = Kwrdtab;
      45:     bot = 0;
      46:     top = Kwrdnum - 1;
      47:     do
      48:     {
      49:         k = (top + bot) / 2;
      50:         switch (scompare(key, 0, op [k].op_term, 0))
      51:         {
      52:
      53:           case 1 :
      54:             bot = k + 1;
      55:             break;
      56:
      57:           case 0 :
      58:             return (&op [k]);
      59:
      60:           case -1 :
      61:             top = k - 1;
      62:             break;
      63:         }
      64:     }  while (bot <= top);
      65:     return (0);
      66: }

#### Defined functions

getkey defined in line 35; used 2 times

- in /usr/ingres/source/equel/name.c line 74, 121

Last modified: 1995-02-05 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 844 |