version 1.13, 2001/04/20 02:34:23 |
version 1.16, 2001/09/03 07:01:08 |
|
|
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* $OpenXM: OpenXM_contrib2/asir2000/io/pexpr.c,v 1.12 2001/03/15 05:52:12 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/io/pexpr.c,v 1.15 2001/08/28 05:46:26 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "al.h" |
#include "al.h" |
|
|
int fortran_output; |
int fortran_output; |
int double_output; |
int double_output; |
int real_digit; |
int real_digit; |
|
int print_quote; |
|
|
#define TAIL |
#define TAIL |
#define PUTS(s) fputs(s,OUT) |
#define PUTS(s) fputs(s,OUT) |
|
|
#define PRINTEOP printeop |
#define PRINTEOP printeop |
#define PRINTQOP printqop |
#define PRINTQOP printqop |
#define PRINTUP printup |
#define PRINTUP printup |
|
#define PRINTUM printum |
|
#define PRINTSF printsf |
#endif |
#endif |
|
|
#ifdef SPRINT |
#ifdef SPRINT |
Line 106 static char *buf; |
|
Line 109 static char *buf; |
|
extern char DFORMAT[BUFSIZ]; |
extern char DFORMAT[BUFSIZ]; |
extern int hex_output; |
extern int hex_output; |
extern int fortran_output; |
extern int fortran_output; |
|
extern int double_output; |
|
extern int real_digit; |
|
extern int print_quote; |
|
|
#define TAIL while ( *OUT ) OUT++; |
#define TAIL while ( *OUT ) OUT++; |
#define PUTS(s) strcat(OUT,s) |
#define PUTS(s) strcat(OUT,s) |
Line 138 extern int fortran_output; |
|
Line 144 extern int fortran_output; |
|
#define PRINTEOP sprinteop |
#define PRINTEOP sprinteop |
#define PRINTQOP sprintqop |
#define PRINTQOP sprintqop |
#define PRINTUP sprintup |
#define PRINTUP sprintup |
|
#define PRINTUM sprintum |
|
#define PRINTSF sprintsf |
#endif |
#endif |
|
|
void PRINTEXPR(); |
void PRINTEXPR(); |
|
|
} |
} |
} |
} |
|
|
|
#if defined(FPRINT) |
#if defined(ITVDEBUG) |
#if defined(ITVDEBUG) |
void printbin(double z) |
void printbin(double z) |
{ |
{ |
Line 332 void printbin(double z) |
|
Line 341 void printbin(double z) |
|
fprintf(stderr,"\n"); |
fprintf(stderr,"\n"); |
} |
} |
#endif |
#endif |
|
#endif |
|
|
|
#if defined(FPRINT) |
#if 0 |
#if 0 |
int printmode = PRINTF_E; |
int printmode = PRINTF_E; |
#else |
#else |
int printmode = PRINTF_G; |
int printmode = PRINTF_G; |
#endif |
#endif |
|
#else |
|
extern int printmode; |
|
#endif |
|
|
void PRINTNUM(q) |
void PRINTNUM(q) |
Num q; |
Num q; |
|
|
PRINTUP((UP)(((GFPN)q)->body)); |
PRINTUP((UP)(((GFPN)q)->body)); |
break; |
break; |
case N_GFS: |
case N_GFS: |
TAIL PRINTF(OUT,"@_%d",CONT((GFS)q)); break; |
TAIL PRINTF(OUT,"@_%d",CONT((GFS)q)); |
break; |
break; |
|
case N_GFSN: |
|
PRINTUM(BDY((GFSN)q)); |
|
break; |
} |
} |
} |
} |
|
|
Line 756 void PRINTQUOTE(vl,quote) |
|
Line 773 void PRINTQUOTE(vl,quote) |
|
VL vl; |
VL vl; |
QUOTE quote; |
QUOTE quote; |
{ |
{ |
PUTS("<...quoted...>"); |
LIST list; |
|
|
|
if ( print_quote ) { |
|
fnodetotree(BDY(quote),&list); |
|
PRINTEXPR(vl,(Obj)list); |
|
} else { |
|
PUTS("<...quoted...>"); |
|
} |
} |
} |
|
|
void PRINTERR(vl,e) |
void PRINTERR(vl,e) |
|
|
} |
} |
} |
} |
PUTS(")"); |
PUTS(")"); |
|
} |
|
} |
|
|
|
PRINTUM(n) |
|
UM n; |
|
{ |
|
int i,d; |
|
|
|
if ( !n ) |
|
PUTS("0"); |
|
else if ( !n->d ) |
|
PRINTSF(n->c[0]); |
|
else { |
|
d = n->d; |
|
PUTS("("); |
|
if ( !d ) { |
|
PRINTSF(n->c[d]); |
|
} else if ( d == 1 ) { |
|
PRINTSF(n->c[d]); |
|
PUTS("*@s"); |
|
} else { |
|
PRINTSF(n->c[d]); |
|
PUTS("*@s"); PRINTHAT; TAIL PRINTF(OUT,"%d",d); |
|
} |
|
for ( i = d-1; i >= 0; i-- ) { |
|
if ( n->c[i] ) { |
|
PUTS("+("); PRINTSF(n->c[i]); PUTS(")"); |
|
if ( i >= 2 ) { |
|
PUTS("*@s"); PRINTHAT; TAIL PRINTF(OUT,"%d",i); |
|
} else if ( i == 1 ) |
|
PUTS("*@s"); |
|
} |
|
} |
|
PUTS(")"); |
|
} |
|
} |
|
|
|
PRINTSF(i) |
|
unsigned int i; |
|
{ |
|
if ( !i ) { |
|
PUTS("0"); |
|
} else { |
|
TAIL PRINTF(OUT,"@_%d",IFTOF(i)); |
} |
} |
} |
} |