summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/runfile.in
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/runfile.in')
-rw-r--r--Build/source/utils/asymptote/runfile.in96
1 files changed, 46 insertions, 50 deletions
diff --git a/Build/source/utils/asymptote/runfile.in b/Build/source/utils/asymptote/runfile.in
index bde9407ff64..584b97f1394 100644
--- a/Build/source/utils/asymptote/runfile.in
+++ b/Build/source/utils/asymptote/runfile.in
@@ -40,72 +40,68 @@ file* :nullFile()
return &camp::nullfile;
}
-file* input(string name, bool check=true, string comment=commentchar)
-{
- char c=comment.empty() ? (char) 0 : comment[0];
- file *f=new ifile(name,c,check);
- f->open();
- return f;
-}
-
-file* output(string name, bool update=false, string comment=commentchar)
+file* input(string name=emptystring, bool check=true,
+ string comment=commentchar, string mode=emptystring)
{
file *f;
- if(update) {
- char c=comment.empty() ? (char) 0 : comment[0];
- f=new iofile(name,c);
- } else f=new ofile(name);
- f->open();
- if(update) f->seek(0,false);
- return f;
-}
-
-file* xinput(string name, bool check=true)
-{
+ if(mode == "binary") {
+ f=new ibfile(name,check);
+ } else if(mode == "xdr") {
#ifdef HAVE_RPC_RPC_H
- file *f=new ixfile(name,check);
- f->open();
- return f;
+ f=new ixfile(name,check);
#else
ostringstream buf;
buf << name << ": XDR read support not enabled";
error(buf);
- unused(&check); // Suppress unused variable warning
-#endif
-}
-
-file* xoutput(string name, bool update=false)
-{
-#ifdef HAVE_RPC_RPC_H
- file *f;
- if(update)
- f=new ioxfile(name);
- else f=new oxfile(name);
- f->open();
- if(update) f->seek(0,false);
- return f;
-#else
- ostringstream buf;
- buf << name << ": XDR write support not enabled";
- error(buf);
- unused(&update); // Suppress unused variable warning
#endif
-}
-
-file* binput(string name, bool check=true)
-{
- file *f=new ibfile(name,check);
+ } else if(mode == "") {
+ char c=comment.empty() ? (char) 0 : comment[0];
+ f=new ifile(name,c,check);
+ } else {
+ f=NULL;
+ ostringstream buf;
+ buf << name << ": invalid file mode '" << mode << "'";
+ error(buf);
+ }
+
f->open();
return f;
}
-file* boutput(string name, bool update=false)
+file* output(string name=emptystring, bool update=false,
+ string comment=commentchar, string mode=emptystring)
{
file *f;
- if(update) f=new iobfile(name);
- else f=new obfile(name);
+ if(mode == "pipe") {
+ f=new opipe(name);
+ } else if(mode == "binary") {
+ if(update) f=new iobfile(name);
+ else f=new obfile(name);
+ } else if(mode == "xdr") {
+#ifdef HAVE_RPC_RPC_H
+ if(update)
+ f=new ioxfile(name);
+ else f=new oxfile(name);
+#else
+ ostringstream buf;
+ buf << name << ": XDR write support not enabled";
+ error(buf);
+#endif
+ } else if(mode == "") {
+ if(update) {
+ char c=comment.empty() ? (char) 0 : comment[0];
+ f=new iofile(name,c);
+ } else f=new ofile(name);
+ } else {
+ f=NULL;
+ ostringstream buf;
+ buf << name << ": invalid file mode '" << mode << "'";
+ error(buf);
+ }
+
f->open();
if(update) f->seek(0,false);
+
return f;
}