On Mon, Jan 08, 2024 at 07:47:59PM +0800, Qian Yun wrote:
> Looks good.
> 
> Except that the "updateHist()" after that still uses '$timedNameStack',

Yes.

> so you should use $savedTimeStack to prevent resetting '$timedNameStack'
> to NIL.

The attached patch handles this: cleanup is run only after all
real work is done.

-- 
                              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/ZZwX6vj_fVtbLGQA%40fricas.org.
diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot
index 21c2b3d..8e337d5 100644
--- a/src/interp/i-syscmd.boot
+++ b/src/interp/i-syscmd.boot
@@ -2861,7 +2861,7 @@ processSynonyms() ==
 -- functions for interfacing to system commands from algebra code
 -- common lisp dependent
 
-doSystemCommand string ==
+doSystemCommand1(string) ==
    string := CONCAT('")", string)
    LINE: fluid := string
    processSynonyms()
@@ -2880,6 +2880,9 @@ doSystemCommand string ==
         nil
    nil
 
+doSystemCommand(string) ==
+    CATCH('SPAD_READER, doSystemCommand1(string))
+
 )if false
 The system commands given by the global variable
 [[|$noParseCommands|]]\cite{1} require essentially no
diff --git a/src/interp/i-toplev.boot b/src/interp/i-toplev.boot
index 52da728..a8fd599 100644
--- a/src/interp/i-toplev.boot
+++ b/src/interp/i-toplev.boot
@@ -127,12 +127,18 @@ readSpadProfileIfThere() ==
 DEFPARAMETER($inRetract, nil)
 
 processInteractive(form, posnForm) ==
+    $timedNameStack : local := NIL
+    initializeTimedNames($interpreterTimedNames,$interpreterTimedClasses);
+    finally(
+        object := processInteractive0(form, posnForm),
+          while $timedNameStack repeat stopTimingProcess peekTimedName())
+    object
+
+processInteractive0(form, posnForm) ==
   --  Top-level dispatcher for the interpreter.  It sets local variables
   --  and then calls processInteractive1 to do most of the work.
   --  This function receives the output from the parser.
 
-  initializeTimedNames($interpreterTimedNames,$interpreterTimedClasses)
-
   $op: local:= (form is [op,:.] => op; form) --name of operator
   $Coerce: local := NIL
   $compErrorMessageStack:local := nil

Reply via email to