1: # include "e.h"
   2: #include "e.def"
   3: 
   4: #define TBLSIZE 100
   5: 
   6: tbl *keytbl[TBLSIZE];   /* key words */
   7: tbl *restbl[TBLSIZE];   /* reserved words */
   8: tbl *deftbl[TBLSIZE];   /* user-defined names */
   9: 
  10: struct {
  11:     char    *key;
  12:     int keyval;
  13: } keyword[] ={
  14:     "sub",  SUB,
  15:     "sup",  SUP,
  16:     ".EN",  EOF,
  17:     "from",     FROM,
  18:     "to",   TO,
  19: /*	"sum", 	SUM,  removed by stan */
  20:     "hat",  HAT,
  21:     "vec", VEC,
  22:     "dyad", DYAD,
  23:     "dot",  DOT,
  24:     "dotdot",   DOTDOT,
  25:     "bar",  BAR,
  26:     "tilde",    TILDE,
  27:     "under",    UNDER,
  28: /*	"prod", 	PROD,
  29: 	"int", 	INT,
  30: 	"integral", 	INT,
  31: 	"union", 	UNION,
  32: 	"inter", 	INTER,    removed by stan */
  33:     "pile",     PILE,
  34:     "lpile",    LPILE,
  35:     "cpile",    CPILE,
  36:     "rpile",    RPILE,
  37:     "over",     OVER,
  38:     "sqrt",     SQRT,
  39:     "above",    ABOVE,
  40:     "size",     SIZE,
  41:     "font",     FONT,
  42:     "fat", FAT,
  43:     "roman",    ROMAN,
  44:     "italic",   ITALIC,
  45:     "bold",     BOLD,
  46:     "left",     LEFT,
  47:     "right",    RIGHT,
  48:     "delim",    DELIM,
  49:     "define",   DEFINE,
  50: 
  51: #ifdef  NEQN    /* make ndefine synonym for define, tdefine a no-op */
  52: 
  53:     "tdefine",  TDEFINE,
  54:     "ndefine",  DEFINE,
  55: 
  56: #else       /* tdefine = define, ndefine = no-op */
  57: 
  58:     "tdefine",  DEFINE,
  59:     "ndefine",  NDEFINE,
  60: 
  61: #endif
  62: 
  63:     "gsize",    GSIZE,
  64:     ".gsize",   GSIZE,
  65:     "gfont",    GFONT,
  66:     "include",  INCLUDE,
  67:     "up",   UP,
  68:     "down",     DOWN,
  69:     "fwd",  FWD,
  70:     "back",     BACK,
  71:     "mark",     MARK,
  72:     "lineup",   LINEUP,
  73:     "matrix",   MATRIX,
  74:     "col",  COL,
  75:     "lcol",     LCOL,
  76:     "ccol",     CCOL,
  77:     "rcol",     RCOL,
  78:     0,  0
  79: };
  80: 
  81: struct {
  82:     char    *res;
  83:     char    *resval;
  84: } resword[] = {
  85:     "alpha",    "\\(*a",
  86:     "beta",     "\\(*b",
  87:     "gamma",    "\\(*g",
  88:     "delta",    "\\(*d",
  89:     "epsilon",  "\\(*e",
  90:     "zeta",     "\\(*z",
  91:     "eta",      "\\(*y",
  92:     "theta",    "\\(*h",
  93:     "iota",     "\\(*i",
  94:     "kappa",    "\\(*k",
  95:     "lambda",   "\\(*l",
  96:     "mu",       "\\(*m",
  97:     "nu",       "\\(*n",
  98:     "xi",       "\\(*c",
  99:     "omicron",  "\\(*o",
 100:     "pi",       "\\(*p",
 101:     "rho",      "\\(*r",
 102:     "sigma",    "\\(*s",
 103:     "tau",      "\\(*t",
 104:     "upsilon",  "\\(*u",
 105:     "phi",      "\\(*f",
 106:     "chi",      "\\(*x",
 107:     "psi",      "\\(*q",
 108:     "omega",    "\\(*w",
 109:     "ALPHA",    "\\(*A",
 110:     "BETA",     "\\(*B",
 111:     "GAMMA",    "\\(*G",
 112:     "DELTA",    "\\(*D",
 113:     "EPSILON",  "\\(*E",
 114:     "ZETA",     "\\(*Z",
 115:     "ETA",      "\\(*Y",
 116:     "THETA",    "\\(*H",
 117:     "IOTA",     "\\(*I",
 118:     "KAPPA",    "\\(*K",
 119:     "LAMBDA",   "\\(*L",
 120:     "MU",       "\\(*M",
 121:     "NU",       "\\(*N",
 122:     "XI",       "\\(*C",
 123:     "OMICRON",  "\\(*O",
 124:     "PI",       "\\(*P",
 125:     "RHO",      "\\(*R",
 126:     "SIGMA",    "\\(*S",
 127:     "TAU",      "\\(*T",
 128:     "UPSILON",  "\\(*U",
 129:     "PHI",      "\\(*F",
 130:     "CHI",      "\\(*X",
 131:     "PSI",      "\\(*Q",
 132:     "OMEGA",    "\\(*W",
 133:     ">",        "\\fG>\\fP",
 134:     "<",        "\\fG<\\fP",
 135:     ">=",       "\\(>=",
 136:     "<=",       "\\(<=",
 137:     "==",       "\\(==",
 138:     "!=",       "\\(!=",
 139:     "+-",       "\\(+-",
 140:     "-+",       "\\fSl\\fP",
 141:     "->",       "\\(->",
 142:     "<-",       "\\(<-",
 143:     "<<",       "\\fSG\\fP",
 144:     ">>",       "\\fSg\\fP",
 145:     "><",       "\\fSI\\fP",
 146:     "<>",       "\\fSi\\fP",
 147:     "=~",       "\\fSK\\fP",
 148:     "!<",       "\\fSM\\fP",
 149:     "!>",       "\\fSm\\fP",
 150:     "inf",      "\\(if",
 151:     "infinity", "\\(if",
 152:     "partial",  "\\(pd",
 153:     "half",     "\\fR1\\(sl2\\fP",
 154:     "prime",    "\\fR\\(aa\\fP",
 155:     "approx",   "\\(ap",
 156:     "propor",   "\\(pt",
 157:     "nothing",  "",
 158:     "cdot",     "\\fG,\\fP",
 159:     "times",    "\\(mu",
 160:     "divide",   "\\(di",
 161:     "del",      "\\(gr",
 162:     "grad",     "\\(gr",
 163:     "laplace",  "\\fSv\\fP",
 164:     "box",      "\\(sq",
 165:     "...",      "\\fG,,,\\fP",
 166:     ",...,",    ",\\fG,,,\\fP,",
 167:     "sum",      "\\fGF\\fP",
 168:     "int",      "\\b'\\(ti\\(bi'",
 169:     "bint",     "\\b'\\(ti\\(bv\\(bi'",
 170:     "prod",     "\\fGW\\fP",
 171:     "union",    "\\fST\\fP",
 172:     "inter",    "\\fSt\\fP",
 173:     "subset",   "\\fSU\\fP",
 174:     "supset",   "\\fSu\\fP",
 175:     "member",   "\\fS\\zU\\v'.15m'-\\v'-.15m'\\fP",
 176:     "empty",    "\\fR\\o'O/'\\fP",
 177:     "ang",      "\\fSS\\fP",
 178:     "lang",     "\\fSq\\fP",
 179:     "rang",     "\\fSQ\\fP",
 180:     "perp",     "\\fSY\\fP",
 181:     "scriptl",  "\\fSs\\fP",
 182:     "norm",     "\\fSy\\fP",
 183:     "uarrow",   "\\fS^\\fP",
 184:     "larrow",   "\\fSw\\fP",
 185:     "rarrow",   "\\fSW\\fP",
 186:     "darrow",   "\\fS\\(dl\\fP",
 187:     "dagger",   "\\(dg",
 188:     "sub0",     "\\fS0\\fP",
 189:     "sub1",     "\\fS1\\fP",
 190:     "sub2",     "\\fS2\\fP",
 191:     "sub3",     "\\fS3\\fP",
 192:     "sub4",     "\\fS4\\fP",
 193:     "sub5",     "\\fS5\\fP",
 194:     "sub6",     "\\fS6\\fP",
 195:     "sub7",     "\\fS7\\fP",
 196:     "sub8",     "\\fS8\\fP",
 197:     "sub9",     "\\fS9\\fP",
 198:     "sup0",     "\\fS{\\fP",
 199:     "sup1",     "\\fS!\\fP",
 200:     "sup2",     "\\fS\"\\fP",
 201:     "sup3",     "\\fS#\\fP",
 202:     "sup4",     "\\fS$\\fP",
 203:     "sup5",     "\\fS%\\fP",
 204:     "sup6",     "\\fS&\\fP",
 205:     "sup7",     "\\fS\\(aa\\fP",
 206:     "sup8",     "\\fS(\\fP",
 207:     "sup9",     "\\fS)\\fP",
 208:     "ciplus",   "\\fRO\\E*\\(esN+*\\fP",
 209:     "citimes",  "\\fR\\zo\\fP\\fS<\\fP",
 210:     "cidot",    "\\fR\\zO\\fP\\fG,\\fP",
 211:     "=wig",     "\\fSK\\fP",
 212:     "-wig",     "\\fSk\\fP",
 213:     "=dot",     "=\\v'-0.35m'\\h'-\\w*=\\fG,*u/2u'\\fG,\\v'0.35m'\\fP",
 214:     "-dot",     "-\\v'-0.3m'\\h'-\\w*-\\fG,*u/2u'\\fG,\\v'0.3m'\\fP",
 215:     "=hat",     "\\fSn\\fP",
 216: /*	"bstar",	"\\fR\\o'X|-'\\fP",	*/
 217:     "oppA",     "\\fRV\\E'\\(esN-'\\fP",
 218:     "andsign",  "\\fG/\\h'-26u'\\(ss\\fP",
 219:     "orsign",   "\\fG\\(ss\\h'-26u'/\\fP",
 220:     "oppE",
 221: "\\fG\\z_\\v'50u'\\z_\\v'50u'\\z_\\v'-100u'\\h'40u'|\\h'-140u'\\(ss\\fP",
 222:     "nexist",
 223: "\\fG\\z_\\v'50u'\\z_\\v'50u'\\z_\\v'-100u'\\h'40u'|\\h'-140u'\\(ss\\fP",
 224:     "exist",
 225: "\\fG\\z_\\v'50u'\\z_\\v'50u'\\z_\\v'-100u'\\h'40u'|\\h'-40u'\\fP",
 226:     "abs",      "\\fG&\\fP",
 227:     "nie",      "\\fSN\\fP\\E'\\fG\\(esN/'\\fP",
 228:     "angst",    "\\fGA\\h'-100u'\\v'-40u';\\v'40u'\\fP",
 229:     "star",     "*",
 230:     "hbar",     "\\fGf\\fP",
 231:     "<->",      "\\fSw\\E*\\(esNW*\\fP",
 232:     "<=>",      "<=>",
 233:     "3dot", "\\fG\\z.\\v'-50u'\\z.\\v'-50u'.\\v'100u'\\fP",
 234:     "thf",  "\\fG\\h'-34u'.\\h'-60u'\\v'-60u'.\\v'60u'\\h'-60u'.\\h'-46u'\\fP",
 235:     "quarter",  "\\fR1\\(sl4\\fP",
 236:     "3quarter", "\\fR3\\(sl4\\fP",
 237:     "degree",   "\\fG;\\fP",
 238:     "circle",   "\\fRO\\fP",
 239: /*	"blot",		"\\fR\\o'HIX0'\\fP",	*/
 240:     "vbar",     "\\(br",
 241: /*	"bullet",	"\\fR\\(bu\\fP",	*/
 242:     "curse",    "\\@!\\#$\\(st",
 243:     "lfl",      "\\(lf",
 244:     "rfl",      "\\(rf",
 245:     "lcl",      "\\(lc",
 246:     "rcl",      "\\(rc",
 247:     "lbs",      "\\fG?\\fP",
 248:     "and",      "\\fRand\\fP",
 249:     "for",      "\\fRfor\\fP",
 250:     "if",       "\\fRif\\fP",
 251:     "Re",       "\\fRRe\\fP",
 252:     "Im",       "\\fRIm\\fP",
 253:     "sin",      "\\fRsin\\fP",
 254:     "cos",      "\\fRcos\\fP",
 255:     "tan",      "\\fRtan\\fP",
 256:     "arc",      "\\fRarc\\fP",
 257:     "sinh",     "\\fRsinh\\fP",
 258:     "coth",     "\\fRcoth\\fP",
 259:     "tanh",     "\\fRtanh\\fP",
 260:     "cosh",     "\\fRcosh\\fP",
 261:     "lim",      "\\fRlim\\fP",
 262:     "log",      "\\fRlog\\fP",
 263:     "max",      "\\fRmax\\fP",
 264:     "min",      "\\fRmin\\fP",
 265:     "ln",       "\\fRln\\fP",
 266:     "exp",      "\\fRexp\\fP",
 267:     "det",      "\\fRdet\\fP",
 268:     0,  0
 269: };
 270: 
 271: tbl *lookup(tblp, name, defn)   /* find name in tbl. if defn non-null, install */
 272: tbl **tblp;
 273: char *name, *defn;
 274: {
 275:     register tbl *p;
 276:     register int h;
 277:     register char *s = name;
 278:     char *malloc();
 279: 
 280:     for (h = 0; *s != '\0'; )
 281:         h += *s++;
 282:     h %= TBLSIZE;
 283: 
 284:     for (p = tblp[h]; p != NULL; p = p->next)
 285:         if (strcmp(name, p->name) == 0) {   /* found it */
 286:             if (defn != NULL)
 287:                 p->defn = defn;
 288:             return(p);
 289:         }
 290:     /* didn't find it */
 291:     if (defn == NULL)
 292:         return(NULL);
 293:     p = (tbl *) malloc(sizeof (tbl));
 294:     if (p == NULL)
 295:         error(FATAL, "out of space in lookup");
 296:     p->name = name;
 297:     p->defn = defn;
 298:     p->next = tblp[h];
 299:     tblp[h] = p;
 300:     return(p);
 301: }
 302: 
 303: init_tbl()  /* initialize all tables */
 304: {
 305:     int i;
 306: 
 307:     for (i = 0; keyword[i].key != NULL; i++)
 308:         lookup(keytbl, keyword[i].key, keyword[i].keyval);
 309:     for (i = 0; resword[i].res != NULL; i++)
 310:         lookup(restbl, resword[i].res, resword[i].resval);
 311: }

Defined functions

init_tbl defined in line 303; used 1 times
lookup defined in line 271; used 9 times

Defined variables

deftbl defined in line 8; never used
keytbl defined in line 6; used 1 times
restbl defined in line 7; used 1 times

Defined macros

TBLSIZE defined in line 4; used 4 times
Last modified: 1982-03-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 711
Valid CSS Valid XHTML 1.0 Strict