This patch is for axserver.spad.pamphlet to fix the lastType function which
wasn't doing the right thing.
Arthur
--- axserver.spad.pamphlet 2007-12-19 05:04:38.000000000 -0800
+++ axserver.spad.pamphlet.new 2007-12-19 05:06:23.000000000 -0800
@@ -149,13 +149,45 @@
lastType():String ==
--- The last history entry is the first item in the $internalHistoryTable list so
--- car(_$internalHistoryTable$Lisp) selects it. Here's an example:
--- (3 (x+y)**3 (% (value (Polynomial (Integer)) WRAPPED 1 y (3 0 . 1) (2 1 x (1 0 . 3)) (1 1 x (2 0 . 3)) (0 1 x (3 0 . 1)))))
--- This corresponds to the input "(x+y)**3" being issued as the third command after
--- starting axiom. The following line selects the type information.
- string car(cdr(car(cdr(car(cdr(cdr(car(_$internalHistoryTable$Lisp)$Lisp)$Lisp)$Lisp)$Lisp)$Lisp)$Lisp)$Lisp)$Lisp
-
+ -- to examine the $internalHistoryTable uncomment the following lines
+ -- WriteLine$Lisp "lastType begin"
+ -- WriteLine$Lisp string _$internalHistoryTable$Lisp
+ -- need to pick out first member of internalHistoryTable and then pick out
+ -- the element with % as first element, here's an example showing just
+ -- the first element of the list, which correponds to the last command.
+ -- Note that the last command does not necessarily correspond to the last
+ -- element of the first element of $internalHistoryTable as it is in this
+ -- example.
+ --(
+ -- (4 NIL
+ -- (x (value (BasicOperator) WRAPPED . #<vector 09a93bd0>))
+ -- (y (value (BasicOperator) WRAPPED . #<vector 09a93bb4>))
+ -- (% (value (Matrix (Polynomial (Integer))) WRAPPED . #<vector 0982e0e0>))
+ -- )
+ --...
+ --)
+ -- Also need to check for input error in which case the $internalHistoryTable
+ -- is not changed and the type retrieved would be that for the last correct
+ -- input.
+ SETQ(first$Lisp,FIRST(_$internalHistoryTable$Lisp)$Lisp)$Lisp
+ count:Integer := 0
+ hisLength:Integer := LIST_-LENGTH(_$internalHistoryTable$Lisp)$Lisp
+ length:Integer := LIST_-LENGTH(first$Lisp)$Lisp
+ -- This initializes stepSav. The test is a bit of a hack, maybe I'll
+ -- figure out the right way to do it later.
+ if string stepSav$Lisp = "#<OBJNULL>" then SETQ(stepSav$Lisp, 0$Lisp)$Lisp
+ -- If hisLength = 0 then the history table has been reset to NIL
+ -- and we're starting numbering over
+ if hisLength = 0 then SETQ(stepSav$Lisp, 0$Lisp)$Lisp
+ if hisLength > 0 and
+ car(car(_$internalHistoryTable$Lisp)$Lisp)$Lisp ^= stepSav$Lisp then
+ SETQ(stepSav$Lisp, car(car(_$internalHistoryTable$Lisp)$Lisp)$Lisp)$Lisp
+ while count < length repeat
+ position(char "%",string FIRST(first$Lisp)$Lisp) = 2 => count := length+1
+ count := count +1
+ SETQ(first$Lisp,REST(first$Lisp)$Lisp)$Lisp
+ count = length + 1 => string SECOND(SECOND(FIRST(first$Lisp)$Lisp)$Lisp)$Lisp
+ ""
lastStep():String ==
string car(car(_$internalHistoryTable$Lisp)$Lisp)$Lisp
_______________________________________________ Axiom-developer mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/axiom-developer
