summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/process.cc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-10 18:49:48 +0000
committerKarl Berry <karl@freefriends.org>2019-01-10 18:49:48 +0000
commit8d656f7b22badc7a1e4e48811521048ef3df7101 (patch)
tree207c9332ac340eef8b84e90d67a0f0c6a734e547 /Build/source/utils/asymptote/process.cc
parentc75ad7aa4d5821b7c4034c949a5ed2401e589bea (diff)
asy 2.47 sources
git-svn-id: svn://tug.org/texlive/trunk@49658 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/process.cc')
-rw-r--r--Build/source/utils/asymptote/process.cc38
1 files changed, 30 insertions, 8 deletions
diff --git a/Build/source/utils/asymptote/process.cc b/Build/source/utils/asymptote/process.cc
index 5bed94c807f..8622be8366e 100644
--- a/Build/source/utils/asymptote/process.cc
+++ b/Build/source/utils/asymptote/process.cc
@@ -31,6 +31,8 @@ pen& defaultpen() {
}
}
+unsigned int count=0;
+
namespace run {
void cleanup();
void exitFunction(vm::stack *Stack);
@@ -306,9 +308,11 @@ public:
block *tree=getTree();
if (tree) {
for(mem::list<runnable *>::iterator r=tree->stms.begin();
- r != tree->stms.end(); ++r)
+ r != tree->stms.end(); ++r) {
+ processData().fileName=(*r)->getPos().filename();
if(!em.errors() || getSetting<bool>("debug"))
runRunnable(*r,e,s,tm);
+ }
}
}
@@ -361,8 +365,7 @@ public:
ifile(const string& filename)
: itree(filename),
filename(filename),
- outname((string) (filename == "-" ? settings::outname() :
- stripDir(stripExt(string(filename), suffix)))) {}
+ outname(stripDir(stripExt(string(filename == "-" ? settings::outname() : filename), suffix))) {}
block *buildTree() {
return !filename.empty() ? parser::parseFile(filename,"Loading") : 0;
@@ -749,7 +752,9 @@ class iprompt : public icore {
// line and is being continued (either because of a backslash or the parser
// detecting it in multiline mode).
string getline(bool continuation) {
- string prompt=getSetting<string>(continuation ? "prompt2" : "prompt");
+ string prompt;
+ if(!getSetting<bool>("xasy"))
+ prompt=getSetting<string>(continuation ? "prompt2" : "prompt");
string line=interact::simpleline(prompt);
if (continuation)
@@ -775,15 +780,33 @@ class iprompt : public icore {
}
}
+ // Continue taking input until a termination command is received from xasy.
+ block *parseXasyLine(string line) {
+
+#ifdef __MSDOS__
+ const string EOT="\x04\r\n";
+#else
+ const string EOT="\x04\n";
+#endif
+ string s;
+ while((s=getline(true)) != EOT)
+ line += s;
+ return parser::parseString(line, "-", true);
+ }
+
void runLine(coenv &e, istack &s, string line) {
try {
- if (getSetting<bool>("multiline")) {
+ if(getSetting<bool>("multiline")) {
block *code=parseExtendableLine(line);
icode i(code);
i.run(e,s,TRANS_INTERACTIVE);
- }
- else {
+ } else if(getSetting<bool>("xasy")) {
+ block *code=parseXasyLine(line);
+
+ icode i(code);
+ i.run(e,s,TRANS_INTERACTIVE);
+ } else {
// Add a semi-colon to the end of the line if one is not there. Do this
// to the history as well, so the transcript can be run as regular asy
// code. This also makes the history work correctly if the multiline
@@ -836,7 +859,6 @@ public:
while (running) {
// Read a line from the prompt.
string line=getline(false);
-
// Check if it is a special command.
if (handleCommand(e,s,line))
continue;