tab.c (6840B)
1 /* 23feb08abu 2 * (c) Software Lab. Alexander Burger 3 */ 4 5 #include "pico.h" 6 7 typedef struct symInit {fun code; char *name;} symInit; 8 9 #include "mod.h" 10 11 static symInit Symbols[] = { 12 #include "mod.fn" 13 {doAbs, "abs"}, 14 {doAdd, "+"}, 15 {doAll, "all"}, 16 {doAnd, "and"}, 17 {doAny, "any"}, 18 {doAppend, "append"}, 19 {doApply, "apply"}, 20 {doArg, "arg"}, 21 {doArgs, "args"}, 22 {doArgv, "argv"}, 23 {doAs, "as"}, 24 {doAsoq, "asoq"}, 25 {doAssoc, "assoc"}, 26 {doAt, "at"}, 27 {doAtom, "atom"}, 28 {doBind, "bind"}, 29 {doBitAnd, "&"}, 30 {doBitOr, "|"}, 31 {doBitQ, "bit?"}, 32 {doBitXor, "x|"}, 33 {doBool, "bool"}, 34 {doBox, "box"}, 35 {doBoxQ, "box?"}, 36 {doBreak, "!"}, 37 {doBy, "by"}, 38 {doBye, "bye"}, 39 {doCaaar, "caaar"}, 40 {doCaadr, "caadr"}, 41 {doCaar, "caar"}, 42 {doCadar, "cadar"}, 43 {doCadddr, "cadddr"}, 44 {doCaddr, "caddr"}, 45 {doCadr, "cadr"}, 46 {doCar, "car"}, 47 {doCase, "case"}, 48 {doCatch, "catch"}, 49 {doCdaar, "cdaar"}, 50 {doCdadr, "cdadr"}, 51 {doCdar, "cdar"}, 52 {doCddar, "cddar"}, 53 {doCddddr, "cddddr"}, 54 {doCdddr, "cdddr"}, 55 {doCddr, "cddr"}, 56 {doCdr, "cdr"}, 57 {doChar, "char"}, 58 {doChain, "chain"}, 59 {doChop, "chop"}, 60 {doCirc, "circ"}, 61 {doClip, "clip"}, 62 {doCnt, "cnt"}, 63 {doCol, ":"}, 64 {doCon, "con"}, 65 {doConc, "conc"}, 66 {doCond, "cond"}, 67 {doCons, "cons"}, 68 {doCopy, "copy"}, 69 {doCut, "cut"}, 70 {doDate, "date"}, 71 {doDe, "de"}, 72 {doDec, "dec"}, 73 {doDef, "def"}, 74 {doDefault, "default"}, 75 {doDel, "del"}, 76 {doDelete, "delete"}, 77 {doDelq, "delq"}, 78 {doDiff, "diff"}, 79 {doDiv, "/"}, 80 {doDm, "dm"}, 81 {doDo, "do"}, 82 {doE, "e"}, 83 {doEnv, "env"}, 84 {doEof, "eof"}, 85 {doEol, "eol"}, 86 {doEq, "=="}, 87 {doEqual, "="}, 88 {doEqual0, "=0"}, 89 {doEqualT, "=T"}, 90 {doEval, "eval"}, 91 {doExtra, "extra"}, 92 {doFifo, "fifo"}, 93 {doFill, "fill"}, 94 {doFilter, "filter"}, 95 {doFin, "fin"}, 96 {doFinally, "finally"}, 97 {doFind, "find"}, 98 {doFish, "fish"}, 99 {doFlgQ, "flg?"}, 100 {doFlip, "flip"}, 101 {doFlush, "flush"}, 102 {doFold, "fold"}, 103 {doFor, "for"}, 104 {doFormat, "format"}, 105 {doFrom, "from"}, 106 {doFull, "full"}, 107 {doFunQ, "fun?"}, 108 {doGc, "gc"}, 109 {doGe, ">="}, 110 {doGe0, "ge0"}, 111 {doGet, "get"}, 112 {doGetl, "getl"}, 113 {doGlue, "glue"}, 114 {doGt, ">"}, 115 {doGt0, "gt0"}, 116 {doHead, "head"}, 117 {doHeap, "heap"}, 118 {doHide, "===="}, 119 {doIdx, "idx"}, 120 {doIf, "if"}, 121 {doIf2, "if2"}, 122 {doIfn, "ifn"}, 123 {doIn, "in"}, 124 {doInc, "inc"}, 125 {doIndex, "index"}, 126 {doIntern, "intern"}, 127 {doIsa, "isa"}, 128 {doJob, "job"}, 129 {doLast, "last"}, 130 {doLe, "<="}, 131 {doLength, "length"}, 132 {doLet, "let"}, 133 {doLetQ, "let?"}, 134 {doLine, "line"}, 135 {doLink, "link"}, 136 {doList, "list"}, 137 {doLit, "lit"}, 138 {doLstQ, "lst?"}, 139 {doLoad, "load"}, 140 {doLookup, "->"}, 141 {doLoop, "loop"}, 142 {doLowQ, "low?"}, 143 {doLowc, "lowc"}, 144 {doLt, "<"}, 145 {doLt0, "lt0"}, 146 {doLup, "lup"}, 147 {doMade, "made"}, 148 {doMake, "make"}, 149 {doMap, "map"}, 150 {doMapc, "mapc"}, 151 {doMapcan, "mapcan"}, 152 {doMapcar, "mapcar"}, 153 {doMapcon, "mapcon"}, 154 {doMaplist, "maplist"}, 155 {doMaps, "maps"}, 156 {doMatch, "match"}, 157 {doMax, "max"}, 158 {doMaxi, "maxi"}, 159 {doMember, "member"}, 160 {doMemq, "memq"}, 161 {doMeta, "meta"}, 162 {doMethod, "method"}, 163 {doMin, "min"}, 164 {doMini, "mini"}, 165 {doMix, "mix"}, 166 {doMmeq, "mmeq"}, 167 {doMul, "*"}, 168 {doMulDiv, "*/"}, 169 {doName, "name"}, 170 {doNand, "nand"}, 171 {doNEq, "n=="}, 172 {doNEq0, "n0"}, 173 {doNEqT, "nT"}, 174 {doNEqual, "<>"}, 175 {doNeed, "need"}, 176 {doNew, "new"}, 177 {doNext, "next"}, 178 {doNil, "nil"}, 179 {doNond, "nond"}, 180 {doNor, "nor"}, 181 {doNot, "not"}, 182 {doNth, "nth"}, 183 {doNumQ, "num?"}, 184 {doOff, "off"}, 185 {doOffset, "offset"}, 186 {doOn, "on"}, 187 {doOne, "one"}, 188 {doOnOff, "onOff"}, 189 {doOpt, "opt"}, 190 {doOr, "or"}, 191 {doOut, "out"}, 192 {doPack, "pack"}, 193 {doPair, "pair"}, 194 {doPass, "pass"}, 195 {doPath, "path"}, 196 {doPatQ, "pat?"}, 197 {doPeek, "peek"}, 198 {doPick, "pick"}, 199 {doPop, "pop"}, 200 {doPreQ, "pre?"}, 201 {doPrin, "prin"}, 202 {doPrinl, "prinl"}, 203 {doPrint, "print"}, 204 {doPrintln, "println"}, 205 {doPrintsp, "printsp"}, 206 {doProg, "prog"}, 207 {doProg1, "prog1"}, 208 {doProg2, "prog2"}, 209 {doProp, "prop"}, 210 {doPropCol, "::"}, 211 {doProve, "prove"}, 212 {doPush, "push"}, 213 {doPush1, "push1"}, 214 {doPut, "put"}, 215 {doPutl, "putl"}, 216 {doQueue, "queue"}, 217 {doQuit, "quit"}, 218 {doRand, "rand"}, 219 {doRank, "rank"}, 220 {doRead, "read"}, 221 {doRem, "%"}, 222 {doReplace, "replace"}, 223 {doRest, "rest"}, 224 {doReverse, "reverse"}, 225 {doRot, "rot"}, 226 {doRun, "run"}, 227 {doSave, "save"}, 228 {doSect, "sect"}, 229 {doSeed, "seed"}, 230 {doSeek, "seek"}, 231 {doSemicol, ";"}, 232 {doSend, "send"}, 233 {doSet, "set"}, 234 {doSetCol, "=:"}, 235 {doSetq, "setq"}, 236 {doShift, ">>"}, 237 {doSize, "size"}, 238 {doSkip, "skip"}, 239 {doSort, "sort"}, 240 {doSpace, "space"}, 241 {doSplit, "split"}, 242 {doSpQ, "sp?"}, 243 {doSqrt, "sqrt"}, 244 {doState, "state"}, 245 {doStem, "stem"}, 246 {doStk, "stk"}, 247 {doStr, "str"}, 248 {doStrip, "strip"}, 249 {doStrQ, "str?"}, 250 {doSub, "-"}, 251 {doSum, "sum"}, 252 {doSuper, "super"}, 253 {doSym, "sym"}, 254 {doSymQ, "sym?"}, 255 {doT, "t"}, 256 {doTail, "tail"}, 257 {doText, "text"}, 258 {doThrow, "throw"}, 259 {doTill, "till"}, 260 {doTrace, "$"}, 261 {doTrim, "trim"}, 262 {doTry, "try"}, 263 {doType, "type"}, 264 {doUnify, "unify"}, 265 {doUnless, "unless"}, 266 {doUntil, "until"}, 267 {doUp, "up"}, 268 {doUppQ, "upp?"}, 269 {doUppc, "uppc"}, 270 {doUse, "use"}, 271 {doVal, "val"}, 272 {doWhen, "when"}, 273 {doWhile, "while"}, 274 {doWith, "with"}, 275 {doXchg, "xchg"}, 276 {doXor, "xor"}, 277 {doYoke, "yoke"}, 278 {doZap, "zap"}, 279 {doZero, "zero"}, 280 }; 281 282 static any initSym(any v, char *s) { 283 any x; 284 285 val(x = intern(mkSym((byte*)s), Intern)) = v; 286 return x; 287 } 288 289 void initSymbols(void) { 290 int i; 291 292 Nil = symPtr(Avail), Avail = Avail->car->car; // Allocate 2 cells for NIL 293 tail(Nil) = txt(83 | 73<<7 | 79<<14); 294 val(Nil) = tail(Nil+1) = val(Nil+1) = Nil; 295 Intern[0] = Intern[1] = Transient[0] = Transient[1] = Nil; 296 intern(Nil, Intern); 297 Meth = initSym(boxSubr(doMeth), "meth"); 298 Quote = initSym(boxSubr(doQuote), "quote"); 299 T = initSym(Nil, "T"), val(T) = T; // Last protected symbol 300 301 At = initSym(Nil, "@"); 302 At2 = initSym(Nil, "@@"); 303 At3 = initSym(Nil, "@@@"); 304 This = initSym(Nil, "This"); 305 Dbg = initSym(Nil, "*Dbg"); 306 Scl = initSym(Zero, "*Scl"); 307 Class = initSym(Nil, "*Class"); 308 Up = initSym(Nil, "^"); 309 Err = initSym(Nil, "*Err"); 310 Rst = initSym(Nil, "*Rst"); 311 Msg = initSym(Nil, "*Msg"); 312 Bye = initSym(Nil, "*Bye"); // Last unremovable symbol 313 314 for (i = 0; i < (int)(sizeof(Symbols)/sizeof(symInit)); ++i) 315 initSym(boxSubr(Symbols[i].code), Symbols[i].name); 316 }