There is trouble with recusive calls to intepreter.  Ralf reported
problem with use of 'systemCommand("read foo.input")', after
fixing part of it I got a hang.  Earlier, doing

s := "1 + 1"
interpret_block(s)$Lisp

we got a hang.  I now found the reason: recursive call to
intepreter mangles '$timedNameStack' (and other timing
variables) causing infinite loop in statisctics code.
I am not sure what is proper fix for this (more precisely,
how should we time recursive calls).  The attached patch
works around infinite loop and fixes abort when doing 'read'
as system command.


-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/ZXZjgLsGX6dRcAN4%40fricas.org.
diff --git a/src/interp/i-map.boot b/src/interp/i-map.boot
index cbe7aa3c..78a0c362 100644
--- a/src/interp/i-map.boot
+++ b/src/interp/i-map.boot
@@ -635,7 +635,7 @@ interpMap(opName,tar) ==
   c := CATCH(catchName, interpret1(body,tar,nil))
 --  $interpMapTag and $interpMapTag ~= mapCatchName $mapName =>
 --    THROW($interpMapTag,c)
-  while savedTimerStack ~= $timedNameStack repeat
+  while $timedNameStack and savedTimerStack ~= $timedNameStack repeat
     stopTimingProcess peekTimedName()
   c  -- better be a triple
 
diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot
index 0b3e09f5..84a9c1d3 100644
--- a/src/interp/i-syscmd.boot
+++ b/src/interp/i-syscmd.boot
@@ -2212,8 +2212,6 @@ do_read(ll, quiet, pile_mode) ==
     $nopiles : local := pile_mode
     $edit_file := ll
     read_or_compile(quiet, false)
-    terminateSystemCommand()
-    spadPrompt()
 
 basename(x) == NAMESTRING(PATHNAME_-NAME(x))
 
diff --git a/src/interp/i-toplev.boot b/src/interp/i-toplev.boot
index 20b4773c..1013b2b3 100644
--- a/src/interp/i-toplev.boot
+++ b/src/interp/i-toplev.boot
@@ -261,7 +261,7 @@ interpretTopLevel(x, posnForm) ==
   --  for a thrown result
   savedTimerStack := COPY $timedNameStack
   c := CATCH('interpreter,interpret(x, posnForm))
-  while savedTimerStack ~= $timedNameStack repeat
+  while $timedNameStack and savedTimerStack ~= $timedNameStack repeat
     stopTimingProcess peekTimedName()
   c = 'tryAgain => interpretTopLevel(x, posnForm)
   c

Reply via email to