/* ^@ nul ^A soh ^B stx ^C etx ^D eot ^E eng ^F ack ^G bel */
VERR
, VERR
, VERR
, VERR
, VERR
, VERR
, VERR
, VERR
,
/* ^H bs ^I ht ^J nl ^K vt ^L np ^M cr ^N so ^O si */
VCHAR
, VSEP
, VSEP
, VSEP
, VSEP
, VSEP
, VERR
, VERR
,
/* ^P dle ^Q dc1 ^R dc2 ^S dc3 ^T dc4 ^U nak ^V syn ^W etb */
VERR
, VERR
, VERR
, VERR
, VERR
, VERR
, VERR
, VERR
,
/* ^X can ^Y em ^Z sub ^[ esc ^\ fs ^] gs ^^ rs ^_ us */
VERR
, VERR
, VERR
, VSEP
, VERR
, VERR
, VERR
, VERR
,
VSEP
, VCHAR
, VDQ
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VSQ
,
VLPARA
, VRPARA
, VCHAR
, VSIGN
, VCHAR
, VSIGN
, VPERD
, VCHAR
,
VNUM
, VNUM
, VNUM
, VNUM
, VNUM
, VNUM
, VNUM
, VNUM
,
VNUM
, VNUM
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
,
VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
,
VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
,
VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
,
VCHAR
, VCHAR
, VCHAR
, VLBRCK
, VESC
, VRBRCK
, VCHAR
, VCHAR
,
VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
,
VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
,
VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
,
VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VCHAR
, VEOF
,
/* unused unused Xesc Xdqc */
char *ctable
= initread
.ctable
;
lispval atomval
; /* external varaible containing atom returned
from internal atom reading routine */
lispval
readrx(); lispval
readr(); lispval
readry();
lispval lastrtab
; /* external variable designating current reader
"Bad reader construction: (. <something>)\nShould be (nil . <something>)\n";
"Bad reader construction: (<something> .)\n\
Should be (<something> . <something>), assumed to be (<something>)";
"Bad reader construction: (<something> . <something> not followed by )";
/* readr ****************************************************************/
/* returns a s-expression read in from the port specified as the first */
/* argument. Handles superbrackets, reader macros. */
register lispval handy
= Vreadtable
->clb
;
rdrport
= (FILE *) useport
;
handy
= readrx(Iratom());
/* readrx **************************************************************/
/* returns a s-expression beginning with the syntax code of an atom */
/* passed in the first */
/* argument. Does the actual work for readr, including list, dotted */
/* pair, and quoted atom detection */
register lispval
*current
;
register struct argent
*result
;
register struct argent
*lbot
, *np
;
np
++->val
= nil
; /*protect(nil);*/
*current
= work
= newdot();
current
= (lispval
*) &(work
->cdr
);
macrox(); /* input and output in atomval */
errorh(Vermisc
,"Non-list returned from splicing macro",nil
,FALSE
,7,*current
);
current
=(lispval
*)&((*current
)->cdr
);
work
= result
->val
=newdot();
current
= (lispval
*) &(work
->cdr
);
return(errorh(Vermisc
,baddot2
,nil
,TRUE
,58,result
->val
));
if((code
= Iratom())!=TRPARA
) {
errorh(Vermisc
,baddot3
,nil
,TRUE
,59,result
->val
,atomval
);
error("Premature end of file.", FALSE
);
if((work
= atomval
)!=nil
) {
if(TYPE(work
)==DTPR
&& work
->cdr
==nil
)
"Improper value returned from splicing macro at top-level",nil
,FALSE
,9,work
);
/* return(readrx(Iratom())); */
(work
= result
->val
)->car
= quota
;
work
= work
->cdr
= newdot();
work
->car
= readrx(Iratom());
return(error("Readlist error",FALSE
));
protect(Iget(atomval
,macro
));
/* ratomr ***************************************************************/
/* this routine returns a pointer to an atom read in from the port given*/
/* by the first argument */
register FILE *useport
= rdrport
;
register char c
, marker
, *name
;
extern lispval
finatom(), calcnum(), getnum();
again
: c
= getc(useport
) & 0177;
switch(ctable
[c
] & 0377) {
atomval
= (getnum(name
));
*name
++ = getc(useport
) & 0177;
atomval
= (finatom(name
));
atomval
= (finatom(name
));
case VLPARA
: return(TLPARA
);
case VRPARA
: return(TRPARA
);
case VPERD
: c
= peekc(useport
);
atomval
= (getnum(name
));
case VLBRCK
: return(TLBKT
);
case VRBRCK
: rbktf
= TRUE
;
case VEOF
: /*printf("returning eof atom\n");*/
case VSD
: strflag
= TRUE
;
while ((c
= getc(useport
)) != marker
) {
if(VESC
==ctable
[c
]) c
= getc(useport
);
error("ATOM TOO LONG",FALSE
);
error("EOF ecountered while reading atom", FALSE
);
atomval
= (lispval
) inewstr(strbuf
);
atomval
= (getatom(name
));
case VERR
: if (c
== '\0') goto same
; /* null pname */
fprintf(stderr
,"%c (%o): ",c
,(int) c
);
error("ILLEGAL CHARACTER IN ATOM",TRUE
);
#define push(); if(name==endstrb) error("Int too long",FALSE); else *name++=c;
#define next() (stats = ctable[c=getc(useport) & 0177])
register FILE *useport
=rdrport
;
extern lispval
finatom(), calcnum(), newdoub(), dopow();
push(); /* recognize [0-9]*, in "ex" parlance */
} else if(stats
& SEPMASK
) {
return(calcnum(strbuf
,name
,ibase
->clb
->i
));
return(dopow(name
,ibase
->clb
->i
));
/* at this point we have [0-9]*\. , which might
be a decimal int or the leading part of a
if(c
=='e' || c
=='E' || c
=='d' ||c
=='D')
return(dopow(name
,ibase
->clb
->i
));
/* Here we have 1.x where x not num, not sep */
/* Here we have decimal int. NOT FORTRAN! */
return(calcnum(strbuf
,name
-1,10));
/* Here we have [0-9]*\.[0-9]* */
else if(c
!='e' && c
!='E' && c
!='d' && c
!='D') {
sscanf(strbuf
,"%F",&realno
);
(result
= newdoub())->r
= realno
;
register char *name
= part2
;
register FILE *useport
= rdrport
;
register struct argent
*lbot
, *np
;
char *end1
= part2
- 1; lispval
Ltimes();
if(c
!='.' && !(stats
& SEPMASK
)) {
np
++->val
= inewint(base
);
/* calculate "mantissa"*/
np
++->val
= calcnum(strbuf
,end1
-1,10);
np
++->val
= calcnum(strbuf
,end1
,ibase
->clb
->i
);
power
= calcnum(part2
,name
,10)->i
;
power
= calcnum(part2
,name
,ibase
->clb
->i
)->i
;
calcnum(strbuf
,name
,base
)
register lispval result
, temp
;
temp
= rdrsdot
; /* initialize sdot cell */
else if(*p
=='-') {negflag
= 1; p
++;}
if(p
>=name
) return(getatom());
result
= inewint(temp
->i
);
(result
= newsdot())->i
= temp
->i
;
register FILE *useport
= rdrport
;
savenm
= name
- 1; /* remember start of name */
while(!(next()&SEPMASK
)) {
if(stats
== VESC
) c
= getc(useport
) & 0177;
error("ATOM TOO LONG",FALSE
);
if (uctolc
) for(; *savenm
; savenm
++)
if( isupper(*savenm
) ) *savenm
= tolower(*savenm
);
/* printr ***************************************************************/
/* prints the first argument onto the port specified by the second */
error("BAD LISP DATA ENCOUNTERED BY PRINTR",TRUE
);
case UNBO
: fputs("<UNBOUND>",useport
);
case VALUE
: fputs("(ptr to)",useport
);
case INT
: fprintf(useport
,"%d",a
->i
);
case DOUB
: fprintf(useport
,"%0.16G",a
->r
);
case PORT
: fputs("port",useport
);
case ARRAY
: fputs("array[",useport
);
printr(a
->length
,useport
);
case BCD
: fprintf(useport
,"#%X-",a
->entry
);
printr(a
->discipline
,useport
);
case SDOT
: pbignum(a
,useport
);
case DTPR
: if(a
->car
==quota
&& a
->cdr
!=nil
printr(a
->cdr
->car
,useport
);
morelist
: printr(a
->car
,useport
);
if (TYPE(a
) == DTPR
) goto morelist
;
case STRNG
: strflag
= TRUE
;
char *front
, *temp
; int clean
;
temp
= front
= (strflag
? ((char *) a
) : a
->pname
);
if (*temp
== '-') temp
++;
clean
= clean
&& (ctable
[*temp
] != VNUM
);
clean
= (!(ctable
[*temp
++] & QUTMASK
));
for(temp
=front
;*temp
;temp
++) {
|| ctable
[*temp
] == VESC
)
register char *cp
= front
;
/* dmpport ****************************************************************/
/* outputs buffer indicated by first argument whether full or not */
register lispval useport
;
/* protect and unprot moved to eval.c (whr) */