Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

nlist.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cpp.h"

Include dependency graph for nlist.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  kwtab

Defines

#define NLSIZE   128

Functions

int getopt (int, char *const *, const char *)
Nlistlookup (Token *tp, int install)
void setup_kwtab (void)

Variables

int Cplusplus
Nlistkwdefined
kwtab kwtab []
unsigned long namebit [077+1]
Nlistnlist [NLSIZE]
Nlistnp
char * optarg
int optind
int verbose
char wd [128]


Define Documentation

#define NLSIZE   128
 

Definition at line 14 of file nlist.c.


Function Documentation

int getopt int  ,
char *const *  ,
const char * 
 

Nlist* lookup Token tp,
int  install
 

Definition at line 73 of file nlist.c.

References nlist::ap, cp, nlist::flag, h(), nlist::len, token::len, nlist::name, newstring(), nlist::next, nlist, Nlist, np, quickset, strncmp(), token::t, Token, uchar, nlist::val, and nlist::vp.

00074 {
00075     unsigned int h;
00076     Nlist *np;
00077     uchar *cp, *cpe;
00078 
00079     h = 0;
00080     for (cp=tp->t, cpe=cp+tp->len; cp<cpe; )
00081         h += *cp++;
00082     h %= NLSIZE;
00083     np = nlist[h];
00084     while (np) {
00085         if (*tp->t==*np->name && tp->len==np->len 
00086          && strncmp((char*)tp->t, (char*)np->name, tp->len)==0)
00087             return np;
00088         np = np->next;
00089     }
00090     if (install) {
00091         np = new(Nlist);
00092         np->vp = NULL;
00093         np->ap = NULL;
00094         np->flag = 0;
00095         np->val = 0;
00096         np->len = tp->len;
00097         np->name = newstring(tp->t, tp->len, 0);
00098         np->next = nlist[h];
00099         nlist[h] = np;
00100         quickset(tp->t[0], tp->len>1? tp->t[1]:0);
00101         return np;
00102     }
00103     return NULL;
00104 }

Here is the call graph for this function:

void setup_kwtab void   ) 
 

Definition at line 49 of file nlist.c.

References nlist::ap, kwtab::flag, nlist::flag, kwtab::kw, kwdefined, token::len, lookup(), Nlist, np, strlen(), token::t, t, Token, Tokenrow, uchar, kwtab::val, nlist::val, and nlist::vp.

Referenced by setup().

00050 {
00051     struct kwtab *kp;
00052     Nlist *np;
00053     Token t;
00054     static Token deftoken[1] = {{ NAME, 0, 0, 0, 7, (uchar*)"defined" }};
00055     static Tokenrow deftr = { deftoken, deftoken, deftoken+1, 1 };
00056 
00057     for (kp=kwtab; kp->kw; kp++) {
00058         t.t = (uchar*)kp->kw;
00059         t.len = strlen(kp->kw);
00060         np = lookup(&t, 1);
00061         np->flag = kp->flag;
00062         np->val = kp->val;
00063         if (np->val == KDEFINED) {
00064             kwdefined = np;
00065             np->val = NAME;
00066             np->vp = &deftr;
00067             np->ap = 0;
00068         }
00069     }
00070 }

Here is the call graph for this function:


Variable Documentation

int Cplusplus
 

Definition at line 13 of file unix.c.

Nlist* kwdefined
 

Definition at line 11 of file nlist.c.

Referenced by eval(), and setup_kwtab().

struct kwtab kwtab[]
 

unsigned long namebit[077+1]
 

Definition at line 45 of file nlist.c.

Nlist* nlist[NLSIZE] [static]
 

Definition at line 16 of file nlist.c.

Referenced by lookup().

Nlist* np
 

Definition at line 46 of file nlist.c.

Referenced by control(), doadefine(), dodefine(), Entity_Clone(), Entity_CopyClone(), eval(), expand(), expandrow(), lookup(), newhideset(), prhideset(), setup_kwtab(), substargs(), and tokval().

char* optarg
 

Definition at line 7 of file getopt.c.

int optind
 

Definition at line 5 of file getopt.c.

int verbose
 

Definition at line 210 of file l_cmd.c.

char wd[128]
 

Definition at line 12 of file nlist.c.

Referenced by genline().


Generated on Thu Aug 25 15:47:52 2005 for Quake III Arena by  doxygen 1.3.9.1