Go to the documentation of this file.
9 static char *
rcsid=
"@(#)$Id$";
20 #define MAXTOKENLENGTH 1024
21 #define MAXSTRINGLENGTH 16384
22 #define to_upper(c) (islower(c) ? ((c)-'a'+'A') : (c))
23 #define to_lower(c) (isupper(c) ? ((c)-'A'+'a') : (c))
25 #define syntaxtype(ch) ((enum ch_type)(current_syntax[ch]))
186 #if IRIX || Linux_ppc
199 if (
ch==EOF)
return(EOF);}
200 if (
ch ==
';' && (Spevalof(
QREADTABLE)->c.rdtab.macro->c.vec.v[
ch]
205 if (
ch==EOF)
return(EOF); }
207 goto skipblank;}
return(
ch); }
227 if (obj->
c.
lab.
label==labid)
return(obj);
235 {
pointer unsol, *unsolp, result,newlab;
246 #if sun3 || (!alpha && system5) || sanyo
249 #if sun4 || vax || news || mips || alpha || i386
260 #if sun3 ||( !alpha && system5 ) || sanyo
263 #if sun4 || vax || news || mips || alpha || i386
272 {
register pointer obj,element;
275 if ((element=obj->
c.
lab.
value)==UNBOUND)
return(obj);
276 else return(element);}
287 {
register pointer result,element;
294 while ((
ch!=
')') && (
ch!=EOF) && (i<size)) {
297 if (islabref(element)) {
299 else result->
c.
vec.
v[i]=element;
303 while (i<size) result->
c.
vec.
v[i++]=element;
309 while ((
ch!=
')') && (
ch!=EOF)) {
320 else result->
c.
vec.
v[i]=element; }
326 {
register int i=0,x;
332 while (
ch!=
')' &&
ch!=EOF) {
346 x=(
intval(vpop())<<16) + x;
353 {
register int i=0,x;
362 while (
ch!=
')' &&
ch!=EOF) {
378 register pointer name, klass, elem, result;
389 if (isvecclass(klass)) {
395 else if (isclass(klass)) {
401 while (
ch!=
')' &&
ch!=EOF) {
404 if (islabref(elem)) {
406 else result->
c.
obj.
iv[i++]=elem;
415 {
register pointer name, klass, slot, elem, result, varvec, *slotp;
430 while (
ch!=
')' &&
ch!=EOF) {
437 if (islabref(elem)) {
458 register int val,subchar;
467 if (
ch==
'#') {
if (--val<0)
return(UNBOUND);}
478 {
register int i=0,j,x,c,p,q;
481 char ch,
buf[WORD_SIZE];
491 for (j=i-1; j>=0; j--) {
493 x=(c<=
'9')?(c-
'0'):(c-
'A'+10);
494 bv[p/(WORD_SIZE-1)] |= ((x << q) & MASK);
495 if (q>=(WORD_SIZE-4)) bv[p/(WORD_SIZE-1) + 1] = x>>(WORD_SIZE-1-q);
496 p +=4; q = (q+4) % (WORD_SIZE-1);
508 char buf[WORD_SIZE/2],
ch;
512 sscanf(
buf,
"%lo",&val);
540 return(
eval(ctx,p));}
546 if (issymbol(expr))
return(
memq(expr,speval(
FEATURES)));
548 if (ccar(expr)==
QNOT) {
551 else if (ccar(expr)==
QAND) {
553 while (iscons(expr)) {
556 else expr=ccdr(expr);}
558 else if (ccar(expr)==
QOR) {
560 while (iscons(expr)) {
562 if (r!=
NIL)
return(
T);
563 else expr=ccdr(expr);}
570 {
register pointer flag,result;
581 {
register pointer flag,result;
592 {
register pointer element,result,obj;
597 element=speval(element);
598 if (element==UNBOUND || !isclass(element))
error(
E_NOCLASS,element);
599 obj=
read1(ctx,
f); val=ckintval(obj);
600 result=makepointer(val);
601 if (classof(result)!=element)
612 {
register int i=0,val=0,subchar;
617 if (
ch==EOF)
return(UNBOUND);
618 while (isdigit(
ch)) {
620 if (
ch==EOF)
return(UNBOUND);}
621 subchar=to_upper(
ch);
624 if (isint(macrofunc)) {
626 result=(*intmac)(ctx,
f,val,subchar,token);}
637 {
int tleng = 0, lengmax=MAXSTRINGLENGTH;
638 byte buf[MAXSTRINGLENGTH], *token, *newtoken;
644 while ((
ch!=terminator) && (
ch!=EOF)) {
647 if (tleng >= lengmax) {
649 newtoken=(
byte *)malloc(lengmax*2);
650 if (newtoken ==
NULL) {
651 if (malloced==
TRUE) cfree(token);
653 memcpy(newtoken,token,tleng);
654 if (malloced==
TRUE) cfree(token);
656 token=newtoken; lengmax=lengmax*2;
661 if (malloced==
TRUE) cfree(token);
667 register int leng,colon;
671 register int doublecolon=1;
681 if (doublecolon) colon--;
687 if (doublecolon)
return(
intern(ctx,&token[colon],leng-colon,pkg));
691 if (sym)
return(sym);
694 fprintf(stderr,
"%s ",token);
702 register char *str,**ptr;
706 while (isspace(*str)) str++;
708 if (
ch==
'+') str++;
else if (
ch==
'-') { str++; sign= -1;}
710 while (
'0'<= *str && *str<(
'0'+base)) val=val*base+(*str++)-
'0';
714 if (
'0'<= *str && *str<=
'9') val=val*base+(*str++ -
'0');
715 else if (
'A'<= *str && *str<(
'A'+base-10)) val=val*base+(*str++ -
'A'+10);
716 else if (
'a'<= *str && *str<(
'a'+base-10)) val=val*base+(*str++ -
'a'+10);
727 int head,i,sign=1, k;
734 if (token[0]==
'+') {
head=1;}
735 else if (token[0]==
'-') {
head=1; sign= -1;}
739 for (i=
head; i<len; i++) {
741 if (k>=
'0' && k<=
'9') k= k-
'0';
742 else if (k>=
'A' && k<=
'Z') k=k-
'A'+10;
743 else if (k>=
'a' && k<=
'z') k=k-
'a'+10;
744 else if (k==
'.')
continue;
751 ctx->lastalloc= vpop();
755 register int ch,base;
758 if (
ch<
'0'+base)
return(
TRUE);
760 else if (
ch<=
'9')
return(
TRUE);
761 else if (
'A'<=
ch &&
ch<
'A'+base-10)
return(
TRUE);
774 while (
ch!=delim_char &&
ch!=EOF) {
779 element=
read2(ctx,
f,0,0,1,token, -1);}
787 if (element!=UNBOUND && element!=(
pointer)EOF) ckpush(element);
789 while ((element=vpop())!=STOPPER) {
790 temp=
cons(ctx,element,result);
826 if(u<
v) {t=u; u=
v;
v=t;}
827 while(
v!=0){t=u %
v; u=
v;
v=t;}
839 if (
g!=0) { num /=
g; denom /=
g;}
841 if (denom==1)
return(
makeint(num));
848 int escaped,multiescaped,i;
851 {
register int j,c, base;
858 extern double atof();
862 if (multiescaped)
goto step9;
866 if (
ch==EOF)
goto step10;
867 if (
ch<0)
ch &= 0xff;
868 ctype=syntaxtype(
ch);
874 else ch=to_upper(
ch);
875 token[i++]=
ch;
goto step8;
877 token[i++]=
readch(ins); escaped=1;
goto step8;
893 ctype=syntaxtype(
ch);
897 token[i++]=
ch;
goto step9;
906 if (escaped)
return(
readsymbol(ctx,i,colon,token));
910 if ((token[j]==
'+') || (token[j]==
'-')) j++;
911 else if (token[j]==
'.' && token[j+1]==
'\0')
913 if (
is_digit(token[j],base) || token[j]==
'.') {
914 while (
is_digit(token[j],base)) j++;
915 if (token[j] ==
'.') {
916 if (++j==i)
return(
readint(ctx,token,i));
918 while (
is_digit(token[j],base)) j++;
919 c=to_upper(token[j]);
920 if (c==
'E' || c==
'D' || c==
'F' || c==
'L') {
922 if ((token[j]==
'+') || (token[j]==
'-')) j++;
923 while (
is_digit(token[j],base)) j++;
924 if (j==i) { token[c]=
'E';
return(
makeflt(atof(token)));}
926 else if (j==i)
return(
makeflt(atof(token)));
928 else if (token[j] ==
'/') {
932 while (
is_digit(token[j],base)) j++;
933 if (j==i)
return(
readratio(ctx,token,slash));
935 else if (j==i)
return(
readint(ctx,token,i));
937 c=to_upper(token[j]);
938 if (c==
'E' || c==
'D' || c==
'F' || c==
'L') {
940 if ((token[j]==
'+') || (token[j]==
'-')) j++;
941 while (
is_digit(token[j],base)) j++;
942 if (j==i) { token[c]=
'E';
return(
makeflt(atof(token)));}
944 else if (j==i)
return(
makeflt(atof(token)));
945 else return(
readsymbol(ctx,i,colon,token));} }
952 register int firstch;
953 register pointer macrofunc,result;
958 char token[MAXTOKENLENGTH];
967 ctype=syntaxtype(
ch);
974 if (isint(macrofunc)) {
976 result=(*intmac)(ctx,ins,
ch,token);}
985 return(
read2(ctx,ins,1,0,1,token,colon));
992 else ch=to_upper(
ch);
994 return(
read2(ctx,ins,0,0,1,token,colon));}}
1006 if (recursivep==
NIL) {
1011 if (val==UNBOUND)
return(
NIL);
1049 for (i=0; i<256; i++) {
static pointer readint(context *ctx, char *token, int len)
void complement_big(pointer x)
static pointer read_sharp_function(context *ctx, pointer f, int val, int subchar)
static char buf[CHAR_SIZE]
int unreadch(pointer, int)
static addunsolved(pointer labp, pointer *addr)
pointer makereadtable(context *)
static pointer read1(context *, pointer)
static pointer readsharp(context *ctx, pointer f, Char ch, token)
static pointer read_cond_minus(context *ctx, pointer f)
static pointer readratio(context *ctx, char *token, int slash)
static pointer readrparen(ctx, f)
static pointer readlabdef(context *ctx, pointer f, int labx)
static pointer read_sharp_comment(context *ctx, pointer f, int val, int subchar)
pointer makevector(pointer, int)
static pointer read2(context *, pointer, int, int, int, char *, int)
pointer read_delimited_list(context *ctx, pointer f, int delim_char, token)
static pointer read_uninterned_symbol(context *ctx, pointer f, int val, int subchar, token)
static pointer readsymbol(context *ctx, int leng, int colon, token)
static pointer findlabel(int labx)
pointer makestring(char *, int)
static pointer readstring(context *ctx, pointer f, int terminator)
static pointer read_sharp_hex(context *ctx, pointer f, eusinteger_t val, int subchar)
static pointer readquote(context *ctx, pointer f)
pointer searchpkg(byte *, int)
pointer makeobject(pointer)
pointer normalize_bignum()
pointer intern(context *, char *, int, pointer)
static Char skip(context *ctx, pointer f, Char ch)
static pointer eval_read_cond(context *ctx, pointer expr)
int strtol(char *str, char **ptr, int base)
static pointer readlabref(ctx, pointer f, val, subchar)
static pointer readcomment(ctx, pointer f)
static pointer readivector(context *ctx, pointer s)
static pointer readstructure(context *ctx, pointer s)
pointer * getobjv(pointer, pointer, pointer)
enum ch_type chartype[256]
pointer makesymbol(context *, char *, int, pointer)
enum ch_attr charattr[256]
pointer cons(context *, pointer, pointer)
pointer eval(context *, pointer)
static pointer readlist(context *ctx, pointer f, char ch, token)
static pointer readobject(context *ctx, pointer s)
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
static pointer readfvector(context *ctx, pointer s)
static int nextch(context *ctx, pointer f)
static pointer read_sharp_char(context *ctx, pointer f, int val, int subchar)
is_digit(int ch, int base)
static pointer read_cond_plus(context *ctx, pointer f)
pointer ufuncall(context *, pointer, pointer, pointer, struct bindframe *, int)
static pointer readvector(context *ctx, pointer f, int size)
static pointer read_sharp_object(context *ctx, pointer f)
static pointer read_sharp_eval(context *ctx, pointer f)
static pointer read_sharp_octal(context *ctx, pointer f, eusinteger_t val, int subchar)
pointer reader(context *ctx, pointer f, pointer recursivep)
euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43