Go to the documentation of this file.
6 static char *
rcsid=
"@(#)$Id$";
11 #define g_marked(p) (bpointerof(p)->h.mark)
12 #define s_marked(p) (bpointerof(p)->h.smark)
13 #define p_marked(p) (bpointerof(p)->h.pmark)
14 #define g_mark_on(p) (bpointerof(p)->h.mark=1)
15 #define s_mark_on(p) (bpointerof(p)->h.smark=1)
16 #define p_mark_on(p) (bpointerof(p)->h.pmark=1)
17 #define g_mark_off(p) (bpointerof(p)->h.mark=0)
18 #define s_mark_off(p) (bpointerof(p)->h.smark=0)
19 #define p_mark_off(p) (bpointerof(p)->h.pmark=0)
20 #define to_upper(c) (islower(c) ? ((c)-'a'+'A') : (c))
21 #define to_lower(c) (isupper(c) ? ((c)-'A'+'a') : (c))
45 while (
l-->0) { c= *
s++;
writech(
f,to_lower(c));}
54 register pointer pkg,pkgname,pkgs,pnam;
63 if (pkg==curpkg)
return;
72 ccar(pkgs)->c.pkg.symvector, &hash))
75 else pkgs=ccdr(pkgs); }
76 else if (sym==cursym)
return;
87 {
register unsigned char *
s;
89 register int i,
l,c,down,escape=0,alldigits=1;
96 printf(
"printsym: illegal pname %p\n",pnm);
101 if (!ctx->slashflag) {
102 for (i=0; i<
l; i++) {
106 else if (Spevalof(
QREADTABLE)->c.rdtab.macro->c.vec.v[c] !=
NIL)
108 if (!
is_digit(c,base)) alldigits=0;}
109 if ((escape=(escape | alldigits)))
writech(
f,
'|');}
112 if (!ctx->slashflag) {
113 while (i<
l && i<256) {
116 b[i++]=((!escape && down)?to_lower(c):c);
121 while (i<
l && i<256) { c= *
s++; b[i++]=to_lower(c);}
134 {
if (!ctx->slashflag) {
137 if (*str==
'"' || *str==
'\\')
writech(
f,
'\\');
154 int base, field1, field2;
156 register int i=65,digit,sign,j;
160 if (num<0) { sign= -1; num= -num;}
else sign=0;
162 #if (WORD_SIZE == 64)
163 digit= (
unsigned long)num % base;
164 num=(
unsigned long)num / base;
166 digit= (unsigned)num % base;
167 num=(unsigned)num / base;
169 if (base<=10 || digit<10) work[--i]=
'0'+digit;
170 else if (downcase) work[--i]=
'a'+digit-10;
171 else work[--i]=
'A'+digit-10;}
174 if (field2> 65-i+1) j=field1-field2;
else j=field1-(65-i+1);}
176 if (field2> 65-i) j=field1-field2;
else j=field1-(65-i);}
189 double absnum,fraction;
190 register int i,len,intpart;
191 extern double fabs();
193 if (num==0.0)
writestr(
f,(
byte *)
"0.0",3);
196 if ((absnum<0.0001) || (absnum>1.0e+05)) {
197 sprintf(work,
"%1.6e",num); len=strlen(work);}
200 fraction=absnum-intpart;
202 else if (intpart<10) i=5;
203 else if (intpart<100) i=4;
204 else if (intpart<1000) i=3;
205 else if (intpart<10000) i=2;
207 sprintf(work,
"%1.*f",i,num);
209 while (len>2 && work[len-1]==
'0' && work[len-2]!=
'.') len--;}
216 sprintf(work,
"#x%x",val);
230 static void printbig(ctx, big, f, base, field1,field2)
233 int base, field1,field2;
255 if (field2<digits) i=field1-digits;
else i=field1-field2;
263 while (digits-- > 0) {
267 if (downcase) x=x+
'a'-10;
274 void printnum(ctx, nump, strm, base, field1, field2)
281 if (isint(nump))
printint(ctx,
intval(nump), strm, base, field1, field2);
283 else if (pisbignum(nump))
printbig(ctx,nump, strm, base, field1, field2);
284 else if (pisratio(nump))
printratio(ctx, nump, strm, base);
306 nm=ccar(p->c.pkg.names);
315 if (isnum(p) || (pissymbol(p) && p->
c.
sym.
homepkg !=
NIL) )
return;
318 if (pissymbol(p))
return;
320 if (elmtypeof(p)<ELM_POINTER)
return;
327 else if (s_marked(p))
return;
338 if (isint(x))
return(
intval(x));
348 eltype=elmtypeof(vec);
358 if (i % WORD_SIZE==0) x=1;}
369 while (i<n && prlength>0) {
379 while (i<n && prlength>0) {
394 printsym(ctx,classof(vec)->c.cls.name,
f);
398 while (i<n && prlength>0) {
409 {
switch(elmtypeof(vec)) {
412 #if (WORD_SIZE == 64)
413 bitmask=1L << (
index % 64);
416 bitmask=1 << (
index % 32);
421 case ELM_BYTE:
case ELM_CHAR:
440 {
register int i,
n,next;
444 for (i=0; i<
n; i++) {
450 if (
rank==1 && isint(
a->c.ary.fillpointer))
n=
intval(
a->c.ary.fillpointer);
451 for (i=0; i<
n; i++) {
460 register int prlevel;
462 register int i,j,
rank,etype,size=1,
index;
465 etype=elmtypeof(
a->c.ary.entity);
466 sprintf(
buf,
"#%d%c",
rank,(etype==ELM_FLOAT)?
'f':
467 (etype==ELM_INT)?
'i':
'a');
477 register int prlevel;
478 {
register pointer rest=ccdr(x);
481 if (fobj==
QUOTE && islist(rest) && ccdr(rest)==
NIL) {
483 prin1(ctx,ccar(rest),
f,prlevel-1);
485 else if (fobj==
FUNCTION && islist(rest) && ccdr(rest)==
NIL) {
487 prin1(ctx,ccar(rest),
f,prlevel-1);
490 prin1(ctx,fobj,
f,prlevel);
492 while (islist(x) && !s_marked(x)) {
498 prin1(ctx,ccar(x),
f,prlevel);
517 while (i<s && prlength>0) {
521 if (i==0)
prin1(ctx,fobj,
f,prlevel);
540 while (i<s && prlength-->0) {
542 if (i==0)
prin1(ctx,fobj,
f,prlevel);
552 register int prlevel;
554 register int shareix=0;
557 if (prlevel<=0) {
writech(
f,
'#');
return;}
559 else if (x==UNBOUND) {
writestr(
f,(
byte *)
"***UNBOUND***",13);
return;}
561 #if vax || sun4 || news || mips || alpha || Linux
567 else if (pisbignum(x)) {
575 sprintf(
ixbuf,
"#%d=",shareix);
577 fobj=
ixvec[shareix]; }
584 else if (pissymbol(x)) {
printsym(ctx,x,
f);
return;}
585 else if (pisvector(x))
printvector(ctx,x,
f,fobj,prlevel-1);
595 if (isnum(p))
return;
596 if (!s_marked(p) && !p_marked(p))
return;
598 if (p_marked(p)) fprintf(stderr,
"smarked?\n");
600 s_mark_off(p); p_mark_off(p);
601 if (pissymbol(p))
return;
602 else if (pisvector(p)) {
603 if (elmtypeof(p)<ELM_POINTER)
return;
619 if (isint(prlevel)) iprlevel=
intval(prlevel);
else iprlevel=65536;
static void print_symbol_prefix(context *ctx, pointer f, pointer pkg, char *colon)
int writestr(pointer, byte *, int)
int rank(int n, int p, MATRIX s)
eusinteger_t big_sign(pointer)
static void prinelm(context *ctx, pointer f, int prlevel, pointer vec, int index)
static char buf[CHAR_SIZE]
static int prinary(context *ctx, pointer f, int prlevel, pointer a, int rank, int axis, int index)
static void printarray(context *ctx, pointer a, pointer f, int prlevel)
static pointer printsym(context *ctx, pointer sym, pointer f)
static void printratio(context *ctx, pointer rat, pointer f, int base)
eusinteger_t div_int_big(eusinteger_t c, pointer x)
static void printmark(context *ctx, pointer p)
static void printhex(int val, pointer f)
static void prinxobj(context *ctx, pointer x, pointer f, pointer fobj, int prlevel)
static void printstr(context *ctx, int leng, byte *str, pointer f)
static int getprlength(context *ctx)
eusinteger_t big_zerop(pointer x)
static void printobj(context *ctx, pointer obj, pointer f)
enum ch_attr charattr[256]
context * euscontexts[MAXTHREAD]
struct class_desc classtab[MAXCLASS]
static pointer printvector(context *ctx, pointer vec, pointer f, pointer leng, int prlevel)
pointer csend(context *,...)
static void printstructure(context *ctx, pointer x, pointer f, pointer fobj, int prlevel)
static void symprefix(pointer sym, pointer f)
pointer prinx(context *ctx, pointer obj, pointer stream)
static void printunmark(pointer p)
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
static void printlist(context *ctx, pointer x, pointer f, pointer fobj, int prlevel)
static void prin1(context *, pointer, pointer, int)
void printint(context *ctx, eusinteger_t num, pointer f, int base, int field1, int field2)
void printnum(context *ctx, pointer nump, pointer strm, int base, int field1, int field2)
int writech(pointer, int)
static void printbig(context *ctx, pointer big, pointer f, int base, int field1, int field2)
static void printpkg(pointer p, pointer f)
static pointer printflt(double num, pointer f)
enum ch_type chartype[256]
euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43