PRIVATE void collectarg(struct Arg *arg) { struct Macro *macro = New(struct Macro); INT quoted = arg->quoted; pbskipspaces(); while( quoted-- ) pbchar(c_quote); getdef(¯o->def); macro->nargs = 0; adddef((INT)s_macro,arg->sym,(INT)macro); }
main() { char w[MAXWORD]; struct nlist *p; while (getword(w, MAXWORD) != EOF) if (strcmp(w, "//") == 0) getdef(); else if (!isalpha(w[0])) printf("%s", w); else if ((p = lookup(w)) == NULL) printf("%s", w); else ungets(p->defn); return 0; }
int getpagesize() { #ifdef PAGESIZE return PAGESIZE; #else capability self; int clickshift, first, last; if (getinfo(&self, NILPD, 0) < 0) ERR(EIO, "getpagesize: getinfo failed"); if (getdef(&self, &clickshift, &first, &last) < 0) ERR(EIO, "getpagesize: getdef failed"); return 1<<clickshift; #endif }
int main(){ char w[MAXWORD]; nlist *p; while(getword(w, MAXWORD) != EOF){ if(strcmp(w, "#") == 0){ getdef(); }else if(!isalpha(w[0])){ printf("%s", w); }else if((p = lookup(w)) == NULL){ printf("%s", w); }else{ printf("%s", p->defn); } } return 0; }