=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/io/pexpr_body.c,v retrieving revision 1.3 retrieving revision 1.12 diff -u -p -r1.3 -r1.12 --- OpenXM_contrib2/asir2000/io/pexpr_body.c 2004/05/14 06:02:54 1.3 +++ OpenXM_contrib2/asir2000/io/pexpr_body.c 2006/04/16 00:51:14 1.12 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM_contrib2/asir2000/io/pexpr_body.c,v 1.2 2004/03/26 08:25:36 noro Exp $ */ +/* $OpenXM: OpenXM_contrib2/asir2000/io/pexpr_body.c,v 1.11 2005/12/10 14:14:15 noro Exp $ */ #define PRINTHAT (fortran_output?PUTS("**"):PUTS("^")) @@ -11,6 +11,7 @@ void PRINTR(); void PRINTLIST(); void PRINTVECT(); void PRINTMAT(); +void PRINTIMAT(); /* IMAT */ void PRINTSTR(); void PRINTCOMP(); void PRINTDP(); @@ -19,6 +20,8 @@ void PRINTGF2MAT(); void PRINTGFMMAT(); void PRINTBYTEARRAY(); void PRINTQUOTE(); +void PRINTQUOTEARG(); +void PRINTNBP(); void PRINTERR(); void PRINTCPLX(); void PRINTLM(); @@ -37,14 +40,12 @@ void PRINTTB(); void PRINTDPV(); void PRINTFNODE(); void PRINTBF(); +void PRINTDAlg(); void PRINTEXPR(vl,p) VL vl; Obj p; { -#if defined(FPRINT) - if ( asir_texmacs && !user_print_function ) printf("\2verbatim:"); -#endif if ( !p ) { PRINTR(vl,(R)p); } else @@ -61,6 +62,10 @@ Obj p; PRINTVECT(vl,(VECT)p); break; case O_MAT: PRINTMAT(vl,(MAT)p); break; +/* IMAT */ + case O_IMAT: + PRINTIMAT(vl,(IMAT)p); break; +/* IMAT */ case O_STR: PRINTSTR((STRING)p); break; case O_COMP: @@ -83,6 +88,10 @@ Obj p; PRINTBYTEARRAY(vl,(BYTEARRAY)p); break; case O_QUOTE: PRINTQUOTE(vl,(QUOTE)p); break; + case O_QUOTEARG: + PRINTQUOTEARG(vl,(QUOTEARG)p); break; + case O_NBP: + PRINTNBP(vl,(NBP)p); break; case O_SYMBOL: PRINTSYMBOL((SYMBOL)p); break; case O_RANGE: @@ -94,10 +103,6 @@ Obj p; default: break; } -#if defined(FPRINT) - if ( asir_texmacs && !user_print_function ) - { putchar('\5'); fflush(stdout); } -#endif } #if defined(FPRINT) @@ -293,6 +298,49 @@ MAT mat; } } +/* IMAT */ +#if !defined(CPRINT) +void PRINTIMAT(vl,xmat) +VL vl; +IMAT xmat; +{ + int i,j,c; + int row, col, cr; + IMATC Im; + IENT ent; + + row = xmat->row; + col = xmat->col; + Im = (pointer)xmat->root; + if ( xmat->clen == 0 ) { + for(j = 0; j< row; j++) { + PUTS("( "); + for(i = 0; i < col; i++) PUTS("0 "); + PUTS(")"); + if ( j < row - 1 ) PUTS("\n"); + } + return; + } + c = -1; + GetNextIent(&Im, &ent, &c); + for(j = 0; j < row; j++) { + PUTS("( "); + for(i = 0; i < col; i++) { + cr = j * col + i; + if( ent.cr == cr ) { + PRINTEXPR(vl, (pointer)ent.body); PUTS(" "); + GetNextIent(&Im, &ent, &c); + } else { + PUTS("0 "); + } + } + PUTS(")"); + if ( j < row - 1 ) PUTS("\n"); + } +} +#endif +/* IMAT */ + void PRINTLIST(vl,list) VL vl; LIST list; @@ -509,6 +557,14 @@ void PRINTFNODE(FNODE f,int paren) PUTS(((ARF)FA0(f))->name); PRINTFNODE((FNODE)FA2(f),1); break; + case I_NARYOP: + t = (NODE)FA1(f); + PRINTFNODE((FNODE)BDY(t),1); + for ( t = NEXT(t); t; t = NEXT(t) ) { + PUTS(((ARF)FA0(f))->name); + PRINTFNODE((FNODE)BDY(t),1); + } + break; case I_COP: switch( (cid)FA0(f) ) { case C_EQ: opname = ("=="); break; @@ -560,7 +616,7 @@ void PRINTFNODE(FNODE f,int paren) /* lists */ case I_LIST: PUTS("["); PRINTFNODENODE((NODE)FA0(f)); PUTS("]"); break; /* function */ - case I_FUNC: + case I_FUNC: case I_FUNC_QARG: if ( !strcmp(((FUNC)FA0(f))->name,"@pi") ) PUTS("@pi"); else if ( !strcmp(((FUNC)FA0(f))->name,"@e") ) PUTS("@e"); else { @@ -597,6 +653,9 @@ void PRINTNUM(q) Num q; { char real_format[20]; + DAlg d; + DP nm; + Q dn; if ( !q ) { PUTS("0"); @@ -818,6 +877,19 @@ Num q; case N_GFSN: PRINTUM(BDY((GFSN)q)); break; + case N_DA: + d = (DAlg)q; + nm = d->nm; + dn = d->dn; + if ( SGN((Q)dn) == -1 ) PUTS("-"); + PUTS("("); + PRINTDP(CO,((DAlg)q)->nm); + PUTS(")"); + if ( !UNIN(NM(dn)) ) { + PUTS("/"); + PRINTN(NM(dn)); + } + break; } } @@ -995,6 +1067,37 @@ QUOTE quote; PRINTFNODE(BDY(quote),0); } else { PUTS("<...quoted...>"); + } +} + +void PRINTQUOTEARG(vl,quote) +VL vl; +QUOTEARG quote; +{ + PUTS("<...quoted...>"); +} + +void PRINTNBP(VL vl,NBP p) +{ + NODE t; + NBM m; + int d,i; + unsigned int *b; + if ( !p ) PUTS("0"); + else { + for ( t = BDY(p); t; t = NEXT(t) ) { + m = (NBM)BDY(t); + PUTS("("); + PRINTEXPR(vl,(Obj)m->c); + PUTS(")*"); + d = m->d; + b = m->b; + for ( i = 0; i < d; i++ ) { + if ( NBM_GET(b,i) ) PUTS("x"); + else PUTS("y"); + } + if ( NEXT(t) ) PUTS("+"); + } } }