version 1.15, 2001/10/09 01:36:05 |
version 1.18, 2003/11/01 23:58:43 |
|
|
* 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/builtin/file.c,v 1.14 2001/08/20 09:03:24 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/file.c,v 1.17 2003/02/14 22:29:07 ohara Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
#include "ox.h" |
#include "ox.h" |
#include "base.h" |
#include "base.h" |
|
#if !defined(VISUAL) |
#include "unistd.h" |
#include "unistd.h" |
#if PARI |
#endif |
|
#if defined(PARI) |
#include "genpari.h" |
#include "genpari.h" |
#endif |
#endif |
|
|
Line 129 void Popen_file(NODE arg,Q *rp) |
|
Line 131 void Popen_file(NODE arg,Q *rp) |
|
if ( i == BUFSIZ ) |
if ( i == BUFSIZ ) |
error("open_file : too many open files"); |
error("open_file : too many open files"); |
name = BDY((STRING)ARG0(arg)); |
name = BDY((STRING)ARG0(arg)); |
if ( argc(arg) == 2 ) { |
if (strcmp(name,"unix://stdin") == 0) { |
|
fp = stdin; |
|
}else if (strcmp(name,"unix://stdout") == 0) { |
|
fp = stdout; |
|
}else if (strcmp(name,"unix://stderr") == 0) { |
|
fp = stderr; |
|
}else{ |
|
if ( argc(arg) == 2 ) { |
asir_assert(ARG1(arg),O_STR,"open_file"); |
asir_assert(ARG1(arg),O_STR,"open_file"); |
fp = fopen(name,BDY((STRING)ARG1(arg))); |
fp = fopen(name,BDY((STRING)ARG1(arg))); |
} else |
} else |
fp = fopen(name,"r"); |
fp = fopen(name,"r"); |
|
} |
if ( !fp ) { |
if ( !fp ) { |
sprintf(errbuf,"open_file : cannot open \"%s\"",name); |
sprintf(errbuf,"open_file : cannot open \"%s\"",name); |
error(errbuf); |
error(errbuf); |
Line 321 void Ploadfiles(NODE arg,Q *rp) |
|
Line 331 void Ploadfiles(NODE arg,Q *rp) |
|
|
|
void Poutput(NODE arg,Q *rp) |
void Poutput(NODE arg,Q *rp) |
{ |
{ |
#if PARI |
#if defined(PARI) |
extern FILE *outfile; |
extern FILE *outfile; |
#endif |
#endif |
FILE *fp; |
FILE *fp; |
Line 339 void Poutput(NODE arg,Q *rp) |
|
Line 349 void Poutput(NODE arg,Q *rp) |
|
error("output : invalid filename"); |
error("output : invalid filename"); |
break; |
break; |
} |
} |
#if PARI |
#if defined(PARI) |
pari_outfile = |
pari_outfile = |
#endif |
#endif |
asir_out = fp; |
asir_out = fp; |