Пример #1
0
/* Construct a name cell */
any consName(word w, any n) {
   cell *p;

   if (!(p = Avail)) {
      gc(CELLS);
      p = Avail;
   }
   Avail = p->car;
   p = symPtr(p);
   val(p) = n;
   tail(p) = (any)w;
   return p;
}
Пример #2
0
void initSymbols(void) {
    int i;

    Nil = symPtr(Avail),  Avail = Avail->car->car;  // Allocate 2 cells for NIL
    val(Nil) = tail(Nil) = val(Nil+1) = tail(Nil+1) = Nil;
    Zero = box(0);
    One = box(2);
    for (i = 0; i < IHASH; ++i)
        Intern[i] = Transient[i] = Nil;
    for (i = 0; i < EHASH; ++i)
        Extern[i] = Nil;
    initSym(mkStr(_OS), "*OS");
    DB    = initSym(Nil, "*DB");
    Meth  = initSym(box(num(doMeth)), "meth");
    Quote = initSym(box(num(doQuote)), "quote");
    T     = initSym(Nil, "T"),  val(T) = T;  // Last protected symbol

    mkExt(val(DB) = DbVal = consStr(DbTail = box('1')));
    Extern['1'] = cons(DbVal, Nil);

    Solo  = initSym(Zero, "*Solo");
    PPid  = initSym(Nil, "*PPid");
    Pid   = initSym(boxCnt(getpid()), "*Pid");
    At    = initSym(Nil, "@");
    At2   = initSym(Nil, "@@");
    At3   = initSym(Nil, "@@@");
    This  = initSym(Nil, "This");
    Dbg   = initSym(Nil, "*Dbg");
    Zap   = initSym(Nil, "*Zap");
    Ext   = initSym(Nil, "*Ext");
    Scl   = initSym(Zero, "*Scl");
    Class = initSym(Nil, "*Class");
    Run   = initSym(Nil, "*Run");
    Hup   = initSym(Nil, "*Hup");
    Sig1  = initSym(Nil, "*Sig1");
    Sig2  = initSym(Nil, "*Sig2");
    Up    = initSym(Nil, "^");
    Err   = initSym(Nil, "*Err");
    Msg   = initSym(Nil, "*Msg");
    Uni   = initSym(Nil, "*Uni");
    Led   = initSym(Nil, "*Led");
    Tsm   = initSym(Nil, "*Tsm");
    Adr   = initSym(Nil, "*Adr");
    Fork  = initSym(Nil, "*Fork");
    Bye   = initSym(Nil, "*Bye");  // Last unremovable symbol

    for (i = 0; i < (int)(sizeof(Symbols)/sizeof(symInit)); ++i)
        initSym(box(num(Symbols[i].code)), Symbols[i].name);
}
Пример #3
0
/* Construct a symbol */
any consSym(any val, word w) {
   cell *p;

   if (!(p = Avail)) {
      cell c1;

      if (!val)
         gc(CELLS);
      else {
         Push(c1,val);
         gc(CELLS);
         drop(c1);
      }
      p = Avail;
   }
   Avail = p->car;
   p = symPtr(p);
   val(p) = val ?: p;
   tail(p) = txt(w);
   return p;
}