Go to the documentation of this file.
9 static char *
rcsid=
"@(#)$Id$";
22 #define MAXTOKENLENGTH 1024
23 #define MAXSTRINGLENGTH 16384
24 #define to_upper(c) (islower(c) ? ((c)-'a'+'A') : (c))
25 #define to_lower(c) (isupper(c) ? ((c)-'A'+'a') : (c))
27 #define syntaxtype(ch) ((enum ch_type)(current_syntax[thr_self()][ch]))
188 #if IRIX || Linux_ppc
192 #define Char signed char
205 if (
ch==EOF)
return(EOF);}
206 if (
ch ==
';' && (Spevalof(
QREADTABLE)->c.rdtab.macro->c.vec.v[
ch]
211 if (
ch==EOF)
return(EOF); }
213 goto skipblank;}
return(
ch); }
233 if (obj->
c.
lab.
label==labid)
return(obj);
241 {
pointer unsol, *unsolp, result,newlab;
249 pointer_update(newlab->
c.
lab.
value,result);
252 #if sun3 || (!alpha && system5) || sanyo
255 #if (WORD_SIZE == 64)
261 pointer_update(*unsolp,result); }
268 #if sun3 ||( !alpha && system5 ) || sanyo
269 labp->c.lab.unsolved=(
pointer)addr;
271 #if sun4 || vax || news || mips || alpha || Linux
283 {
register pointer obj,element;
286 if ((element=obj->
c.
lab.
value)==UNBOUND)
return(obj);
287 else return(element);}
298 {
register pointer result,element;
305 while ((
ch!=
')') && (
ch!=EOF) && (i<size)) {
308 if (islabref(element)) {
310 else pointer_update(result->
c.
vec.
v[i],element);
314 while (i<size) {pointer_update(result->
c.
vec.
v[i],element);i++;}
320 while ((
ch!=
')') && (
ch!=EOF)) {
331 else pointer_update(result->
c.
vec.
v[i],element); }
345 while (
ch!=
')' &&
ch!=EOF) {
362 {
register int i=0,x;
371 while (
ch!=
')' &&
ch!=EOF) {
387 register pointer name, klass, elem, result;
399 if (isvecclass(klass)) {
405 else if (isclass(klass)) {
411 while (
ch!=
')' &&
ch!=EOF) {
414 if (islabref(elem)) {
416 else result->
c.
obj.
iv[i++]=elem;
425 {
register pointer name, klass, slot, elem, result, varvec, *slotp;
440 while (
ch!=
')' &&
ch!=EOF) {
447 if (islabref(elem)) {
449 else pointer_update(*slotp,elem); }
470 register int subchar;
479 if (
ch==
'#') {
if (--val<0)
return(UNBOUND);}
490 {
register int i=0,j,c,p,q;
493 char ch,
buf[WORD_SIZE];
498 j = i*4 - (
buf[0]<
'2' ? 3 :
501 if (j<WORD_SIZE-2) { sscanf(
buf,
"%lx",&val);
return(
makeint(val));}
506 for (j=i-1; j>=0; j--) {
508 x=(c<=
'9')?(c-
'0'):(c-
'A'+10);
509 bv[p/(WORD_SIZE-1)] |= ((x << q) & MASK);
510 if (q>=(WORD_SIZE-4) && (x>>(WORD_SIZE-1-q)))
511 bv[p/(WORD_SIZE-1) + 1] = x>>(WORD_SIZE-1-q);
512 p +=4; q = (q+4) % (WORD_SIZE-1);
524 char buf[WORD_SIZE/2],
ch;
528 sscanf(
buf,
"%lo",&val);
558 return(
eval(ctx,p));}
564 if (issymbol(expr))
return(
memq(expr,speval(
FEATURES)));
566 if (ccar(expr)==
QNOT) {
569 else if (ccar(expr)==
QAND) {
571 while (iscons(expr)) {
574 else expr=ccdr(expr);}
576 else if (ccar(expr)==
QOR) {
578 while (iscons(expr)) {
580 if (r!=
NIL)
return(
T);
581 else expr=ccdr(expr);}
588 {
register pointer flag,result;
599 {
register pointer flag,result;
610 {
register pointer element,result,obj;
615 element=speval(element);
616 if (element==UNBOUND || !isclass(element))
error(
E_NOCLASS,element);
617 obj=
read1(ctx,
f); val=ckintval(obj);
618 result=makepointer(val);
619 if (classof(result)!=element)
631 register int i=0,subchar;
636 if (
ch==EOF)
return(UNBOUND);
637 while (isdigit(
ch)) {
639 if (
ch==EOF)
return(UNBOUND);}
640 subchar=to_upper(
ch);
643 if (isint(macrofunc)) {
645 result=(*intmac)(ctx,
f,val,subchar,token);}
656 {
int tleng = 0, lengmax=MAXSTRINGLENGTH;
657 byte buf[MAXSTRINGLENGTH], *token, *newtoken;
663 while ((
ch!=terminator) && (
ch!=EOF)) {
666 if (tleng >= lengmax) {
668 newtoken=(
byte *)malloc(lengmax*2);
669 memcpy(newtoken,token,tleng);
670 if (malloced==
TRUE) cfree(token);
672 token=newtoken; lengmax=lengmax*2;
677 if (malloced==
TRUE) cfree(token);
683 register int leng,colon;
687 register int doublecolon=1;
697 if (doublecolon) colon--;
703 if (doublecolon)
return(
intern(ctx,&token[colon],leng-colon,pkg));
707 if (sym)
return(sym);
710 fprintf(stderr,
"%s ",token);
718 register char *str,**ptr;
722 while (isspace(*str)) str++;
724 if (
ch==
'+') str++;
else if (
ch==
'-') { str++; sign= -1;}
726 while (
'0'<= *str && *str<(
'0'+base)) val=val*base+(*str++)-
'0';
730 if (
'0'<= *str && *str<=
'9') val=val*base+(*str++ -
'0');
731 else if (
'A'<= *str && *str<(
'A'+base-10)) val=val*base+(*str++ -
'A'+10);
732 else if (
'a'<= *str && *str<(
'a'+base-10)) val=val*base+(*str++ -
'a'+10);
743 int head,i,sign=1, k;
750 if (token[0]==
'+') {
head=1;}
751 else if (token[0]==
'-') {
head=1; sign= -1;}
755 for (i=
head; i<len; i++) {
757 if (k>=
'0' && k<=
'9') k= k-
'0';
758 else if (k>=
'A' && k<=
'Z') k=k-
'A'+10;
759 else if (k>=
'a' && k<=
'z') k=k-
'a'+10;
760 else if (k==
'.')
continue;
767 ctx->lastalloc= vpop();
771 register int ch,base;
774 if (
ch<
'0'+base)
return(
TRUE);
776 else if (
ch<=
'9')
return(
TRUE);
777 else if (
'A'<=
ch &&
ch<
'A'+base-10)
return(
TRUE);
790 while (
ch!=delim_char &&
ch!=EOF) {
795 element=
read2(ctx,
f,0,0,1,token, -1);}
803 if (element!=UNBOUND && element!=(
pointer)EOF) ckpush(element);
805 while ((element=vpop())!=STOPPER) {
806 temp=
cons(ctx,element,result);
845 if(u<
v) {t=u; u=
v;
v=t;}
846 while(
v!=0){t=u %
v; u=
v;
v=t;}
858 if (
g!=0) { num /=
g; denom /=
g;}
860 if (denom==1)
return(
makeint(num));
867 int escaped,multiescaped,i;
878 extern double atof();
882 if (multiescaped)
goto step9;
886 if (
ch==EOF)
goto step10;
887 if (
ch<0)
ch &= 0xff;
888 ctype=syntaxtype(
ch);
894 else ch=to_upper(
ch);
895 token[i++]=
ch;
goto step8;
897 token[i++]=
readch(ins); escaped=1;
goto step8;
913 ctype=syntaxtype(
ch);
917 token[i++]=
ch;
goto step9;
926 if (escaped)
return(
readsymbol(ctx,i,colon,token));
930 if ((token[j]==
'+') || (token[j]==
'-')) j++;
931 else if (token[j]==
'.' && token[j+1]==
'\0')
933 if (
is_digit(token[j],base) || token[j]==
'.') {
934 while (
is_digit(token[j],base)) j++;
935 if (token[j] ==
'.') {
936 if (++j==i)
return(
readint(ctx,token,i));
938 while (
is_digit(token[j],base)) j++;
939 c=to_upper(token[j]);
940 if (c==
'E' || c==
'D' || c==
'F' || c==
'L') {
942 if ((token[j]==
'+') || (token[j]==
'-')) j++;
943 while (
is_digit(token[j],base)) j++;
944 if (j==i) { token[c]=
'E';
return(
makeflt(atof(token)));}
946 else if (j==i)
return(
makeflt(atof(token)));
948 else if (token[j] ==
'/') {
950 if (++j==i)
return(
readsymbol(ctx,i,colon,token));
952 while (
is_digit(token[j],base)) j++;
953 if (j==i)
return(
readratio(ctx,token,slash));
955 else if (j==i)
return(
readint(ctx,token,i));
957 c=to_upper(token[j]);
958 if (c==
'E' || c==
'D' || c==
'F' || c==
'L') {
960 if ((token[j]==
'+') || (token[j]==
'-')) j++;
961 while (
is_digit(token[j],base)) j++;
962 if (j==i) { token[c]=
'E';
return(
makeflt(atof(token)));}
964 else if (j==i)
return(
makeflt(atof(token)));
965 else return(
readsymbol(ctx,i,colon,token));} }
972 register int firstch;
973 register pointer macrofunc,result;
978 char token[MAXTOKENLENGTH];
987 ctype=syntaxtype(
ch);
994 if (isint(macrofunc)) {
996 result=(*intmac)(ctx,ins,
ch,token);}
1005 return(
read2(ctx,ins,1,0,1,token,colon));
1012 else ch=to_upper(
ch);
1014 return(
read2(ctx,ins,0,0,1,token,colon));}}
1026 if (recursivep==
NIL) {
1031 if (val==UNBOUND)
return(
NIL);
1068 pointer_update(Spevalof(
QREADTABLE),rdtable);
1069 for (i=0; i<256; i++) {
static pointer findlabel(eusinteger_t labx)
void complement_big(pointer x)
static char buf[CHAR_SIZE]
pointer read_delimited_list(context *ctx, pointer f, int delim_char, token)
int unreadch(pointer, int)
pointer makereadtable(context *)
static pointer readlist(context *ctx, pointer f, char ch, token)
static void addunsolved(pointer labp, pointer *addr)
static pointer readobject(context *ctx, pointer s)
pointer makevector(pointer, int)
static pointer read_sharp_eval(context *ctx, pointer f)
static pointer readint(context *ctx, char *token, int len)
static pointer readsharp(context *ctx, pointer f, Char ch, token)
static Char skip(context *ctx, pointer f, Char ch)
static pointer readivector(context *ctx, pointer s)
enum ch_type chartype[256]
pointer makestring(char *, int)
pointer searchpkg(byte *, int)
pointer makeobject(pointer)
static pointer read_sharp_char(context *ctx, pointer f, eusinteger_t val, int subchar)
static pointer read1(context *, pointer)
pointer intern(context *, char *, int, pointer)
static pointer readfvector(context *ctx, pointer s)
pointer oblabels[MAXTHREAD]
int strtol(char *str, char **ptr, int base)
pointer * getobjv(pointer, pointer, pointer)
pointer makesymbol(context *, char *, int, pointer)
static pointer read_sharp_octal(context *ctx, pointer f, eusinteger_t val, int subchar)
static pointer read_cond_plus(context *ctx, pointer f)
static pointer read_cond_minus(context *ctx, pointer f)
static pointer readlabdef(context *ctx, pointer f, eusinteger_t labx)
static pointer read_uninterned_symbol(context *ctx, pointer f, eusinteger_t val, int subchar, token)
pointer cons(context *, pointer, pointer)
pointer eval(context *, pointer)
static pointer readratio(context *ctx, char *token, int slash)
static pointer readstring(context *ctx, pointer f, int terminator)
static pointer readrparen(context *ctx, pointer f)
static pointer read2(context *, pointer, int, int, int, char *, int)
pointer reader(context *ctx, pointer f, pointer recursivep)
byte * current_syntax[MAXTHREAD]
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
static pointer read_sharp_comment(context *ctx, pointer f, eusinteger_t val, int subchar)
pointer normalize_bignum()
enum ch_attr charattr[256]
static int nextch(context *ctx, pointer f)
static pointer readstructure(context *ctx, pointer s)
int is_digit(int ch, int base)
static pointer read_sharp_object(context *ctx, pointer f)
static pointer eval_read_cond(context *ctx, pointer expr)
pointer ufuncall(context *, pointer, pointer, pointer, struct bindframe *, int)
static pointer read_sharp_hex(context *ctx, pointer f, eusinteger_t val, int subchar)
static pointer readvector(context *ctx, pointer f, int size)
static pointer readsymbol(context *ctx, int leng, int colon, token)
static pointer readquote(context *ctx, pointer f)
static pointer readcomment(context *ctx, pointer f)
static pointer read_sharp_function(context *ctx, pointer f, eusinteger_t val, int subchar)
void initreader(context *ctx)
static pointer readlabref(context *ctx, pointer f, eusinteger_t val, int subchar)
euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43