diff --git a/books/bookvol10.3.pamphlet b/books/bookvol10.3.pamphlet index ce14582..9974eba 100644 --- a/books/bookvol10.3.pamphlet +++ b/books/bookvol10.3.pamphlet @@ -43878,6 +43878,168 @@ IndexCard() : Exports == Implementation where @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain IBITS IndexedBits} +<>= +)set break resume +)sys rm -f IndexedBits.output +)spool IndexedBits.output +)set message test on +)set message auto off +)clear all +--S 1 of 13 +a:IBITS(32):=new(32,false) +--R +--R +--R (1) "00000000000000000000000000000000" +--R Type: IndexedBits 32 +--E 1 + +--S 2 of 13 +b:IBITS(32):=new(32,true) +--R +--R +--R (2) "11111111111111111111111111111111" +--R Type: IndexedBits 32 +--E 2 + +--S 3 of 13 +elt(a,3) +--R +--R +--R (3) false +--R Type: Boolean +--E 3 + +--S 4 of 13 +setelt(a,3,true) +--R +--R +--R (4) true +--R Type: Boolean +--E 4 + +--S 5 of 13 +a +--R +--R +--R (5) "00000000000000000000000000000100" +--R Type: IndexedBits 32 +--E 5 + +--S 6 of 13 +#a +--R +--R +--R (6) 32 +--R Type: PositiveInteger +--E 6 + +--S 7 of 13 +(a=a)$IBITS(32) +--R +--R +--R (7) true +--R Type: Boolean +--E 7 + +--S 8 of 13 +(a=b)$IBITS(32) +--R +--R +--R (8) false +--R Type: Boolean +--E 8 + +--S 9 of 13 +(a ~= b) +--R +--R +--R (9) true +--R Type: Boolean +--E 9 + +--S 10 of 13 +Or(a,b) +--R +--R +--R (10) "11111111111111111111111111111111" +--R Type: IndexedBits 32 +--E 10 + +--S 11 of 13 +And(a,b) +--R +--R +--R (11) "00000000000000000000000000000100" +--R Type: IndexedBits 32 +--E 11 + +--S 12 of 13 +Not(a) +--R +--R +--R (12) "11111111111111111111111111111011" +--R Type: IndexedBits 32 +--E 12 + +--S 13 of 13 +c:=copy a +--R +--R +--R (13) "00000000000000000000000000000100" +--R Type: IndexedBits 32 +--E 13 +)spool +)lisp (bye) +@ + +<>= +==================================================================== +IndexedBits +==================================================================== + +a:IBITS(32):=new(32,false) + "00000000000000000000000000000000" + +b:IBITS(32):=new(32,true) + "11111111111111111111111111111111" + +elt(a,3) + false + +setelt(a,3,true) + true + +a + "00000000000000000000000000000100" + +#a + 32 + +(a=a)$IBITS(32) + true + +(a=b)$IBITS(32) + false + +(a ~= b) + true + +Or(a,b) + "11111111111111111111111111111111" + +And(a,b) + "00000000000000000000000000000100" + +Not(a) + "11111111111111111111111111111011" + +c:=copy a + "00000000000000000000000000000100" + +See Also: +o )show IndexedBits + +@ \pagehead{IndexedBits}{IBITS} \pagepic{ps/v103indexedbits.ps}{IBITS}{1.00} {\bf See}\\ @@ -44015,9 +44177,9 @@ IndexedBits(mn:Integer): BitAggregate() with _or(u, v) == (#v=#u => BVEC_-OR(v, u)$Lisp; map("or", v,u)) xor(v,u) == (#v=#u => BVEC_-XOR(v,u)$Lisp; map("xor",v,u)) setelt(v:%, i:Integer, f:Boolean) == - BVEC_-SETELT(v, range(v, i-mn), TRUTH_-TO_-BIT(f)$Lisp)$Lisp + BVEC_-SETELT(v, range(v, abs(i-mn)), TRUTH_-TO_-BIT(f)$Lisp)$Lisp elt(v:%, i:Integer) == - BIT_-TO_-TRUTH(BVEC_-ELT(v, range(v, i-mn))$Lisp)$Lisp + BIT_-TO_-TRUTH(BVEC_-ELT(v, range(v, abs(i-mn)))$Lisp)$Lisp Not v == BVEC_-NOT(v)$Lisp And(u, v) == (#v=#u => BVEC_-AND(v,u)$Lisp; map("and",v,u)) diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index 600bd38..89d9dab 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -15863,6 +15863,17 @@ valid for this level. @ +\defun{tersyscommand}{Terminate a system command} +\calls{tersyscommand}{spadThrow} +<>= +(defun tersyscommand () + (fresh-line) + (setq chr 'endoflinechr) + (setq tok 'end_unit) + (|spadThrow|)) + +@ + \defun{commandAmbiguityError}{commandAmbiguityError} \calls{commandAmbiguityError}{sayKeyedMsg} \calls{commandAmbiguityError}{sayMSG} @@ -19416,6 +19427,16 @@ o )quit \fnref{pquit} \fnref{quit}} +\defun{fin}{Exit from the interpreter to lisp} +\throws{fin}{spad-reader} +\uses{fin}{eof} +<>= +(defun |fin| () + (setq *eof* t) + (throw 'spad_reader nil)) + +@ + \section{Functions} This command is in the list of \verb|$noParseCommands| @@ -22826,6 +22847,23 @@ o )history @ +\defun{/read}{/read} +\calls{/read}{} +\uses{/read}{/editfile} +<>= +(defun /read (l q) + (declare (special /editfile)) + (setq /editfile l) + (cond + (q (/rq)) + (t (/rf)) ) + (flag |boot-NewKEY| 'key) + (|terminateSystemCommand|) + (|spadPrompt|)) + + +@ + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \cmdhead{savesystem help page} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -37558,6 +37596,191 @@ but the Axiom semantics are not the same. Because Axiom was originally written in Maclisp, then VMLisp, and then Common Lisp some of these old semantics survive. +\section{IndexedBits} +\defmacro{truth-to-bit}{IndexedBits new function support} +<>= +(defmacro truth-to-bit (x) `(cond (,x 1) ('else 0))) + +@ + +\defun{bvec-make-full}{IndexedBits new function support} +<>= +(defun bvec-make-full (n x) + (make-array (list n) :element-type 'bit :initial-element x)) + +@ + +\defmacro{bit-to-truth}{IndexedBits elt function support} +<>= +(defmacro bit-to-truth (b) `(eq ,b 1)) + +@ + +\defmacro{bvec-elt}{IndexedBits elt function support} +<>= +(defmacro bvec-elt (bv i) `(sbit ,bv ,i)) + +@ + +\defmacro{bvec-setelt}{IndexedBits setelt function support} +<>= +(defmacro bvec-setelt (bv i x) `(setf (sbit ,bv ,i) ,x)) + +@ + +\defmacro{bvec-size}{IndexedBits length function support} +<>= +(defmacro bvec-size (bv) `(size ,bv)) + +@ + +\defun{bvec-concat}{IndexedBits concat function support} +<>= +(defun bvec-concat (bv1 bv2) (concatenate '(vector bit) bv1 bv2)) + +@ + +\defun{bvec-copy}{IndexedBits copy function support} +<>= +(defun bvec-copy (bv) (copy-seq bv)) + +@ + +\defun{bvec-equal}{IndexedBits = function support} +<>= +(defun bvec-equal (bv1 bv2) (equal bv1 bv2)) + +@ + +\defun{bvec-greater}{IndexedBits $<$ function support} +<>= +(defun bvec-greater (bv1 bv2) + (let ((pos (mismatch bv1 bv2))) + (cond ((or (null pos) (>= pos (length bv1))) nil) + ((< pos (length bv2)) (> (bit bv1 pos) (bit bv2 pos))) + ((find 1 bv1 :start pos) t) + (t nil)))) + +@ + +\defun{bvec-and}{IndexedBits And function support} +<>= +(defun bvec-and (bv1 bv2) (bit-and bv1 bv2)) + +@ + +\defun{bvec-or}{IndexedBits Or function support} +<>= +(defun bvec-or (bv1 bv2) (bit-ior bv1 bv2)) + +@ + +\defun{bvec-xor}{IndexedBits xor function support} +<>= +(defun bvec-xor (bv1 bv2) (bit-xor bv1 bv2)) + +@ + +\defun{bvec-nand}{IndexedBits nand function support} +<>= +(defun bvec-nand (bv1 bv2) (bit-nand bv1 bv2)) + +@ + +\defun{bvec-nor}{IndexedBits nor function support} +<>= +(defun bvec-nor (bv1 bv2) (bit-nor bv1 bv2)) + +@ + +\defun{bvec-not}{IndexedBits not function support} +<>= +(defun bvec-not (bv) (bit-not bv)) + +@ + +\section{KeyedAccessFile} +\defun{rdefinstream}{KeyedAccessFile defstream function support} +This is a simpler interpface to RDEFIOSTREAM +\calls{rdefinstream}{rdefiostream} +<>= +(defun rdefinstream (&rest fn) + ;; following line prevents rdefiostream from adding a default filetype + (unless (rest fn) (setq fn (list (pathname (car fn))))) + (rdefiostream (list (cons 'file fn) '(mode . input)))) + +@ + +\defun{rdefoutstream}{KeyedAccessFile defstream function support} +\calls{rdefoutstream}{rdefiostream} +<>= +(defun rdefoutstream (&rest fn) + ;; following line prevents rdefiostream from adding a default filetype + (unless (rest fn) (setq fn (list (pathname (car fn))))) + (rdefiostream (list (cons 'FILE fn) '(mode . OUTPUT)))) + +@ + +\section{Table} +\defun{hashable}{Table InnerTable support} +We look inside the Key domain given to Table and find if there is an +equality predicate associated with the domain. If found then +Table will use a HashTable representation, otherwise it will use +an AssociationList representation +\calls{hashable}{knownEqualPred} +<>= +(defun |hashable| (dom) + (labels ( + (|knownEqualPred| (dom) + (let ((fun (|compiledLookup| '= '((|Boolean|) $ $) dom))) + (if fun + (get (bpiname (car fun)) '|SPADreplace|) + nil)))) + (memq (|knownEqualPred| dom) '(eq eql equal)))) + +@ + +\section{Integer} +\defun{divide2}{Integer divide function support} +Note that this is defined as a SPADReplace function in Integer +so that algebra code that uses the Integer divide function actually inlines +a call to this code. The Integer domain contains the line: +\begin{verbatim} +(PUT (QUOTE |INT;divide;2$R;44|) (QUOTE |SPADreplace|) (QUOTE DIVIDE2)) +\end{verbatim} +<>= +(defun divide2 (x y) + (multiple-value-call #'cons (truncate x y))) + +@ + +\defun{remainder2}{Integer quo function support} +Note that this is defined as a SPADReplace function in Integer +so that algebra code that uses the Integer quo function actually inlines +a call to this code. The Integer domain contains the line: +\begin{verbatim} +(PUT (QUOTE |INT;rem;3$;46|) (QUOTE |SPADreplace|) (QUOTE REMAINDER2)) +\end{verbatim} +Because these are identical except for name we make the symbol-functions +equivalent. This was done in the original code for efficiency. +<>= +(setf (symbol-function 'remainder2) #'rem) + +@ + +\defun{quotient2}{Integer quo function support} +Note that this is defined as a SPADReplace function in Integer +so that algebra code that uses the Integer quo function actually inlines +a call to this code. The Integer domain contains the line: +\begin{verbatim} +(PUT (QUOTE |INT;quo;3$;45|) (QUOTE |SPADreplace|) (QUOTE QUOTIENT2)) +\end{verbatim} +<>= +(defun quotient2 (x y) + (values (truncate x y))) + +@ + \section{IndexCard} \defun{alqlGetOrigin}{IndexCard origin function support} \calls{alqlGetOrigin}{dbPart} @@ -39160,6 +39383,10 @@ This needs to work off the internal exposure list, not the file. <> <> +<> +<> +<> +<> <> <> <> @@ -39197,8 +39424,9 @@ This needs to work off the internal exposure list, not the file. <> <> <> -<> <> +<> +<> <> <> @@ -39231,6 +39459,17 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> +<> +<> +<> +<> +<> +<> +<> +<> +<> +<> <> <> @@ -39331,6 +39570,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -39443,6 +39683,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -40218,10 +40459,14 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> +<> +<> <> <> +<> <> <> <> @@ -40233,6 +40478,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -40422,6 +40668,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> diff --git a/changelog b/changelog index b597ab2..32ffb06 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,10 @@ +20100301 tpd src/axiom-website/patches.html 2010301.01.tpd.patch +20100301 tpd src/interp/vmlisp.lisp remove unused functions +20100301 tpd src/interp/g-timer.lisp remove unused functions +20100301 tpd src/interp/g-error.lisp remove unused functions +20100301 tpd src/algebra/Makefile unit test IndexedBits +20100301 tpd books/bookvol5 add support for IndexedBits +20100301 tpd books/bookvol10.3 fix IndexedBits range error 20100228 tpd src/axiom-website/patches.html 20100228.02.tpd.patch 20100228 tpd src/interp/wi2.lisp remove MAKESTRING macro 20100228 tpd src/interp/wi1.lisp remove MAKESTRING macro diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet index 88433f6..8fe8448 100644 --- a/src/algebra/Makefile.pamphlet +++ b/src/algebra/Makefile.pamphlet @@ -16481,6 +16481,7 @@ SPADHELP=\ ${HELP}/Heap.help \ ${HELP}/HexadecimalExpansion.help \ ${HELP}/HomogeneousDistributedMultivariatePolynomial.help \ + ${HELP}/IndexedBits.help \ ${HELP}/Integer.help \ ${HELP}/IntegerCombinatoricFunctions.help \ ${HELP}/IntegerLinearDependence.help \ @@ -16630,6 +16631,7 @@ REGRESS= \ Heap.regress \ HexadecimalExpansion.regress \ HomogeneousDistributedMultivariatePolynomial.regress \ + IndexedBits.regress \ Integer.regress \ IntegerCombinatoricFunctions.regress \ IntegerLinearDependence.regress \ @@ -17178,6 +17180,15 @@ ${HELP}/HomogeneousDistributedMultivariatePolynomial.help: \ @echo "HomogeneousDistributedMultivariatePolynomial (HDMP)" \ >>${HELPFILE} +${HELP}/IndexedBits.help: ${BOOKS}/bookvol10.3.pamphlet + @echo 7415 create IndexedBits.help from ${BOOKS}/bookvol10.3.pamphlet + @${TANGLE} -R"IndexedBits.help" ${BOOKS}/bookvol10.3.pamphlet \ + >${HELP}/IndexedBits.help + @cp ${HELP}/IndexedBits.help ${HELP}/IBITS.help + @${TANGLE} -R"IndexedBits.input" ${BOOKS}/bookvol10.3.pamphlet \ + >${INPUT}/IndexedBits.input + @echo "IndexedBits (IBITS)" >>${HELPFILE} + ${HELP}/Integer.help: ${BOOKS}/bookvol10.3.pamphlet @echo 7420 create Integer.help from ${BOOKS}/bookvol10.3.pamphlet @${TANGLE} -R"Integer.help" ${BOOKS}/bookvol10.3.pamphlet \ diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 07abcd4..95f3272 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -2505,5 +2505,7 @@ src/interp/vmlisp.lisp remove unused functions
src/interp/vmlisp.lisp remove non-common lisp macros
20100228.02.tpd.patch src/interp/*.lisp.pamphlet remove MAKESTRING macro
+20100301.01.tpd.patch +books/bookvol10.3 fix IndexedBits range error
diff --git a/src/interp/g-error.lisp.pamphlet b/src/interp/g-error.lisp.pamphlet index 70ccab7..eff338b 100644 --- a/src/interp/g-error.lisp.pamphlet +++ b/src/interp/g-error.lisp.pamphlet @@ -70,8 +70,6 @@ (|errorSupervisor1| |errorType| |errorMsg| |$BreakMode|)) ;errorSupervisor1(errorType,errorMsg,$BreakMode) == -; $cclSystem and $BreakMode = 'trapNumerics => -; THROW('trapNumerics,$numericFailure) ; BUMPCOMPERRORCOUNT() ; errorLabel := ; errorType = $SystemError => '"System error" @@ -95,14 +93,10 @@ (DEFUN |errorSupervisor1| (|errorType| |errorMsg| |$BreakMode|) (DECLARE (SPECIAL |$BreakMode|)) (PROG (|errorLabel| |splitmsg| |msg|) - (DECLARE (SPECIAL |$AlgebraError| |$UserError| |$SystemError| - |$cclSystem| |$numericFailure|)) + (DECLARE (SPECIAL |$AlgebraError| |$UserError| |$SystemError|)) (RETURN - (SEQ (COND - ((AND |$cclSystem| - (BOOT-EQUAL |$BreakMode| '|trapNumerics|)) - (THROW '|trapNumerics| |$numericFailure|)) - ('T (BUMPCOMPERRORCOUNT) + (SEQ + (BUMPCOMPERRORCOUNT) (setq |errorLabel| (COND ((BOOT-EQUAL |errorType| |$SystemError|) @@ -154,7 +148,7 @@ (CONS |u| NIL)))))))))))) ('T (CONS " " |errorMsg|)))))) (|sayErrorly| |errorLabel| |msg|) - (|handleLispBreakLoop| |$BreakMode|))))))) + (|handleLispBreakLoop| |$BreakMode|))))) ;handleLispBreakLoop($BreakMode) == @@ -170,11 +164,6 @@ ; while not gotIt repeat ; gotIt := true ; msgQ := -; $cclSystem => -; ['%l,'" You have two options. Enter:",'%l,_ -; '" ",:bright '"top ",'" to return to top level, or",'%l,_ -; '" ",:bright '"break ",'" to enter a LISP break loop.",'%l,_ -; '%l,'" Please enter your choice now:"] ; ['%l,'" You have three options. Enter:",'%l,_ ; '" ",:bright '"continue",'" to continue processing,",'%l,_ ; '" ",:bright '"top ",'" to return to top level, or",'%l,_ @@ -182,8 +171,6 @@ ; '%l,'" Please enter your choice now:"] ; x := STRING2ID_-N(queryUser msgQ,1) ; x := -; $cclSystem => -; selectOptionLC(x,'(top break),NIL) ; selectOptionLC(x,'(top break continue),NIL) ; null x => ; sayBrightly bright '" That was not one of your choices!" @@ -191,7 +178,6 @@ ; x = 'top => returnToTopLevel() ; x = 'break => ; $BreakMode := 'break -; if not $cclSystem then ; sayBrightly ['" Enter",:bright '":C", ; '"when you are ready to continue processing where you ",'%l,_ ; '" interrupted the system, enter",:bright '"(TOP)",_ @@ -207,7 +193,6 @@ (defun |handleLispBreakLoop| (|$BreakMode|) (declare (special |$BreakMode|)) (let (msgQ x go-tit) - (declare (special |$cclSystem|)) (terpri) (enable-backtrace nil) (cond diff --git a/src/interp/g-timer.lisp.pamphlet b/src/interp/g-timer.lisp.pamphlet index 3aa0761..09bbb5c 100644 --- a/src/interp/g-timer.lisp.pamphlet +++ b/src/interp/g-timer.lisp.pamphlet @@ -502,8 +502,6 @@ ; currentGCTime:= elapsedGcTime() ; gcDelta := currentGCTime - $oldElapsedGCTime ; elapsedSeconds:= -; -- In CCL total time does not include GC time. -; $cclSystem => 1.*(currentTime-$oldElapsedTime)/$timerTicksPerSecond ; 1.*(currentTime-$oldElapsedTime-gcDelta)/$timerTicksPerSecond ; PUT('gc, 'TimeTotal,GET('gc,'TimeTotal) + ; 1.*gcDelta/$timerTicksPerSecond) @@ -514,7 +512,7 @@ (DEFUN |computeElapsedTime| () (PROG (|currentTime| |currentGCTime| |gcDelta| |elapsedSeconds|) (DECLARE (SPECIAL |$oldElapsedGCTime| |$oldElapsedTime| - |$timerTicksPerSecond| |$cclSystem|)) + |$timerTicksPerSecond|)) (RETURN (PROGN (SPADLET |currentTime| (|elapsedUserTime|)) @@ -522,21 +520,13 @@ (SPADLET |gcDelta| (SPADDIFFERENCE |currentGCTime| |$oldElapsedGCTime|)) (SPADLET |elapsedSeconds| - (COND - (|$cclSystem| - (QUOTIENT - (TIMES 1.0 - (SPADDIFFERENCE |currentTime| - |$oldElapsedTime|)) - |$timerTicksPerSecond|)) - ('T (QUOTIENT (TIMES 1.0 (SPADDIFFERENCE (SPADDIFFERENCE |currentTime| |$oldElapsedTime|) |gcDelta|)) - |$timerTicksPerSecond|)))) + |$timerTicksPerSecond|)) (PUT '|gc| '|TimeTotal| (PLUS (GETL '|gc| '|TimeTotal|) (QUOTIENT (TIMES 1.0 |gcDelta|) diff --git a/src/interp/vmlisp.lisp.pamphlet b/src/interp/vmlisp.lisp.pamphlet index 715ad43..ed9e1b6 100644 --- a/src/interp/vmlisp.lisp.pamphlet +++ b/src/interp/vmlisp.lisp.pamphlet @@ -5736,7 +5736,6 @@ now the function is defined but does nothing. (setq $maxlinenumber 0) (defvar /EDIT-FM 'A1) (defvar /EDIT-FT 'SPAD) -(defvar /RELEASE '"UNKNOWN") (defvar /rp '/RP) (defvar APLMODE NIL) (defvar error-print) @@ -5883,40 +5882,6 @@ now the function is defined but does nothing. ; SYSTEM COMMANDS ;************************************************************************ -(defun CLEARDATABASE () (OBEY "ERASE MODEMAP DATABASE")) - -(defun erase (FN FT) - (OBEY (STRCONC "ERASE " (STRINGIMAGE FN) " " (STRINGIMAGE FT)))) - -(defun READLISP (UPPER_CASE_FG) - (let (v expr val ) - (setq EXPR (READ-FROM-STRING - (IF UPPER_CASE_FG (string-upcase (line-buffer CURRENT-LINE)) - (line-buffer CURRENT-LINE)) - t nil :start (Line-CURRENT-INDEX CURRENT-LINE))) - (VMPRINT EXPR) - (setq VAL ((LAMBDA (|$InteractiveMode|) (EVAL EXPR)) NIL)) - (FORMAT t "~&VALUE = ~S" VAL) - (TERSYSCOMMAND))) - -(defun TERSYSCOMMAND () - (FRESH-LINE) - (SETQ CHR 'ENDOFLINECHR) - (SETQ TOK 'END_UNIT) - (|spadThrow|)) - -(defun /READ (L Q) -; (SETQ /EDIT-FN (OR (KAR L) /EDIT-FN)) -; (SETQ /EDIT-FT (OR (KAR (KDR L)) 'INPUT)) -; (SETQ /EDIT-FM (OR (KAR (KDR (KDR L))) '*)) -; (SETQ /EDITFILE (LIST /EDIT-FN /EDIT-FT /EDIT-FM)) - (SETQ /EDITFILE L) - (COND - (Q (/RQ)) - ('T (/RF)) ) - (FLAG |boot-NewKEY| 'KEY) - (|terminateSystemCommand|) - (|spadPrompt|)) (defun /EDIT (L) (SETQ /EDITFILE L) @@ -5932,20 +5897,6 @@ now the function is defined but does nothing. (|terminateSystemCommand|) (|spadPrompt|)) -(defun CPSAY (X) (let (n) (if (EQ 0 (setq N (OBEY X))) NIL (PRINT N)))) - -(defun /FLAG (L) - (MAKEPROP (FIRST L) 'FLAGS (LET ((X (UNION (CDR L)))) (GET (FIRST L) 'FLAGS))) - (SAY (FIRST L) " has flags: " X) - (TERSYSCOMMAND)) - -(defun |fin| () - (SETQ *EOF* 'T) - (THROW 'SPAD_READER NIL)) - - -(defun STRINGREST (X) (if (EQ (SIZE X) 1) (make-string 0) (SUBSTRING X 1 NIL))) - (defun STREAM2UC (STRM) (LET ((X (ELT (LASTATOM STRM) 1))) (SETELT X 0 (upcase (ELT X 0))))) @@ -5979,14 +5930,6 @@ now the function is defined but does nothing. (defun |sort| (seq spadfn) (sort (copy-seq seq) (function (lambda (x y) (SPADCALL X Y SPADFN))))) -(defun QUOTIENT2 (X Y) (values (TRUNCATE X Y))) - -(define-function 'REMAINDER2 #'REM) - -(defun DIVIDE2 (X Y) (multiple-value-call #'cons (TRUNCATE X Y))) - -(defmacro APPEND2 (x y) `(append ,x ,y)) - (defmacro |float| (x &optional (y 0.0d0)) `(float ,x ,y)) (defun |makeSF| (mantissa exponent) @@ -6168,102 +6111,10 @@ special. (COLLECT |formatCOLLECT|) (REDUCE |formatREDUCE|))) -(defun |boot2Lisp| (LINESET) - (let* (($TOP_STACK T) (*PROMPT* 'New) ($MAXLINENUMBER 0) - (NewFLAG T) (XTRANS '|boot-New|) (XCAPE '!) - (COMMENTCHR 'NOTHING) (XTOKENREADER 'NewSYSTOK) - ($NBOOT T) (ERRCOL 0) (COUNT 0) (COLUMN 0) - (OK T) (SPADERRORSTREAM CUROUTSTREAM) - ($LINESTACK 'BEGIN_UNIT) - (INPUTSTREAM LINESET) - (CHR 'ENDOFLINECHR)) - (REMFLAG S-SPADKEY 'KEY) - (FLAG |boot-NewKEY| 'KEY) - (NXTTOK) ; causes PREPARSE to be called - (|boot-Statement|) - (REMFLAG |boot-NewKEY| 'KEY) - (FLAG S-SPADKEY 'KEY) - (if (NULL OK) (|boot2LispError|)) - (|new2OldLisp| (CAR STACK)))) - -(defun /cx (L) - "CAUTION: will not work if function in L has DEFLOC with ft=NBOOT" - (if (not L) (SETQ L |$LastCxArg|)) - (SETQ |$LastCxArg| L) - (/D-1 L '|lisp2BootAndCompare| NIL NIL)) - -(defun /foobar (L) - (let (($xCount 0)) - (if (not L) (SETQ L $LastCxArg)) - (SETQ $LastCxArg L) - (/D-1 L 'foobar NIL NIL))) - -(defun foobar (X) |$xCount|) - -(defun |/cxd| (L) - (if (NULL L) (SETQ L $|LastCxArg|)) - (SETQ |$LastCxArg| L) - (/D-1 L '|lispOfBoot2NBootAndCompare| NIL NIL)) - -(defun |/rx| (L) - (let ((DEF-RENAME 'IDENTITY) - (DEF-PROCESS '|lispOfBoot2NBootAndCompare|) ) - (declare (SPECIAL DEF-RENAME DEF-PROCESS)) - (if (OR (NULL L) (NULL (ATOM (CAR L)))) - (EVAL (APPEND (CONS '/RF /EDITFILE) L)) - (CATCH 'FILENAM (/RF-1 L))))) - -(defun |/ry| (L) - (let ((DEF-RENAME 'IDENTITY) - (DEF-PROCESS '|pp|) ) - (declare (SPECIAL DEF-RENAME DEF-PROCESS)) - (if (OR (NULL L) (NULL (ATOM (CAR L)))) - (EVAL (APPEND (CONS '/RF /EDITFILE) L)) - (CATCH 'FILENAM (/RF-1 L))))) - -(defun |/tb| (L) - (let ((DEF-RENAME 'IDENTITY) (DEF-PROCESS 'lispOfBoot2NBAC1)) - (declare (special DEF-RENAME DEF-PROCESS)) - (if (NULL L) - (EVAL (CONS '/RQ /EDITFILE)) - (CATCH 'FILENAM - (PROG (OUTFILE ($PRETTYPRINT T)) - (SETQ /EDITFILE (LIST (CAR L) 'BOOT '*)) - (OBEY (STRCONC "ERASE " (PNAME (CAR /EDITFILE)) " NBOOT E1")) - (SETQ OUTFILE (LIST (CAR /EDITFILE) 'NBOOT 'E1)) - (RETURN (/RF-1 (APPEND /EDITFILE - (LIST (CONS 'TO= OUTFILE)))))))))) - -(defun |boot2LispError| () - "Print syntax error indication, underline character, scrub line." - (COND ((OR (EQ DEBUGMODE 'YES) (NULL (CONSOLEINPUTP INPUTSTREAM))) - (SPAD_LONG_ERROR)) - (T (SPAD_SHORT_ERROR))) - (SETQ OK T)) - -(defun |getTranslation| (|function| |fn| |ft| |rdr|) - (let ((|New-LEXPR| |rdr|) (|$TranslateOnly| T)) - (declare (special |New-LEXPR| |$TranslateOnly|)) - (/D-1 (LIST |function| (LIST 'FROM= |fn| |ft|)) 'IDENTITY NIL NIL) - |$Translation|)) - -(defmacro |incTimeSum| (a b) - (if (not |$InteractiveTimingStatsIfTrue|) a - (let ((key b) (oldkey (gensym)) (val (gensym))) - `(prog (,oldkey ,val) - (setq ,oldkey (|incrementTimeSum| ,key)) - (setq ,val ,a) - (|incrementTimeSum| ,oldkey) - (return ,val))))) - (defun GLESSEQP (X Y) (NOT (GGREATERP X Y))) (defun LEXLESSEQP (X Y) (NOT (LEXGREATERP X Y))) -(defun SETELTFIRST (A B C) (declare (ignore b)) (RPLACA A C)) - -(defun SETELTREST (A B C) (declare (ignore b)) (RPLACD A C)) - (defmacro |rplac| (&rest L) (let (a b s) (cond @@ -6287,25 +6138,6 @@ special. ((NULL (CDR LST)) (CAR LST)) ((LIST FN (CAR LST) (ASSOCIATER FN (CDR LST)))))) -(defun ISLOCALOP-1 (IND) - "Curindex points at character after '.'" - (prog (selector buf termtok (NEWCHR (NEXTCHARACTER))) - (if (TERMINATOR NEWCHR) (RETURN NIL)) - (setq SELECTOR - (do ((x nil)) - (nil) - (if (terminator newchr) - (reverse x) - (push (setq newchr (nextcharacter)) x)))) - (if (EQUAL NEWCHR '\.) (RETURN (ISLOCALOP-1 IND))) - (setq BUF (GETSTR (LENGTH SELECTOR))) - (mapc #'(lambda (x) (suffix x buf)) selector) - (setq buf (copy-seq selector)) - (setq TERMTOK (INTERN BUF)) - (if (NOT (GET TERMTOK 'GENERIC)) (RETURN NIL)) - (if (OR (GET TERMTOK '|Led|) (GET TERMTOK '|Nud|)) - (GET TERMTOK IND)) - (return TERMTOK))) ; **** X. Random tables (defvar MATBORCH "*") @@ -6349,95 +6181,19 @@ special. (MAKEPROP 'RARROW '|Led| '(== DEF 122 121)) (MAKEPROP 'SEGMENT '|Led| '(\.\. SEGMENT 401 699 (|boot-Seg|))) -;; NAME: DECIMAL-LENGTH -;; PURPOSE: Computes number of decimal digits in print representation of x -;; This should made as efficient as possible. - -(DEFUN DECIMAL-LENGTH (X) - (LET* ((K (FIX (* #.(LOG 2.0 10.) (INTEGER-LENGTH X)))) - (X (TRUNCATE (ABS X) (EXPT 10 (1- K))))) - (IF (LESSP X 10) K (1+ K)))) - -;(DEFUN DECIMAL-LENGTH2 (X) -; (LET ((K (FIX (* #.(LOG 2.0 10.) (INTEGER-LENGTH X))))) -; (IF (< (ABS X) (EXPT 10 K)) K (1+ K)))) - - ;; function to create byte and half-word vectors in new runtime system 8/90 -(defun |makeByteWordVec| (initialvalue) - (let ((n (cond ((null initialvalue) 7) ('t (reduce #'max initialvalue))))) - (make-array (length initialvalue) - :element-type (list 'mod (1+ n)) - :initial-contents initialvalue))) - (defun |makeByteWordVec2| (maxelement initialvalue) (let ((n (cond ((null initialvalue) 7) ('t maxelement)))) (make-array (length initialvalue) :element-type (list 'mod (1+ n)) :initial-contents initialvalue))) -(defun |knownEqualPred| (dom) - (let ((fun (|compiledLookup| '= '((|Boolean|) $ $) dom))) - (if fun (get (bpiname (car fun)) '|SPADreplace|) - nil))) - -(defun |hashable| (dom) - (memq (|knownEqualPred| dom) - '(EQ EQL EQUAL) - )) - -;; simpler interpface to RDEFIOSTREAM -(defun RDEFINSTREAM (&rest fn) - ;; following line prevents rdefiostream from adding a default filetype - (if (null (rest fn)) (setq fn (list (pathname (car fn))))) - (rdefiostream (list (cons 'FILE fn) '(mode . INPUT)))) - -(defun RDEFOUTSTREAM (&rest fn) - ;; following line prevents rdefiostream from adding a default filetype - (if (null (rest fn)) (setq fn (list (pathname (car fn))))) - (rdefiostream (list (cons 'FILE fn) '(mode . OUTPUT)))) - (defmacro |spadConstant| (dollar n) `(spadcall (svref ,dollar (the fixnum ,n)))) - -;;; The operations which traverse entire vectors are given as functions -;;; since the function calling overhead will be relatively small. -;;; The operations which extract or set a single part of the vector are -;;; provided as macros. - -(defmacro truth-to-bit (x) `(cond (,x 1) ('else 0))) -(defmacro bit-to-truth (b) `(eq ,b 1)) - -(defun bvec-make-full (n x) - (make-array (list n) :element-type 'bit :initial-element x)) - -(defmacro bvec-elt (bv i) `(sbit ,bv ,i)) -(defmacro bvec-setelt (bv i x) `(setf (sbit ,bv ,i) ,x)) -(defmacro bvec-size (bv) `(size ,bv)) - -(defun bvec-copy (bv) (copy-seq bv)) -(defun bvec-concat (bv1 bv2) (concatenate '(vector bit) bv1 bv2)) -(defun bvec-equal (bv1 bv2) (equal bv1 bv2)) -(defun bvec-greater (bv1 bv2) - (let ((pos (mismatch bv1 bv2))) - (cond ((or (null pos) (>= pos (length bv1))) nil) - ((< pos (length bv2)) (> (bit bv1 pos) (bit bv2 pos))) - ((find 1 bv1 :start pos) t) - (t nil)))) -(defun bvec-and (bv1 bv2) (bit-and bv1 bv2)) -(defun bvec-or (bv1 bv2) (bit-ior bv1 bv2)) -(defun bvec-xor (bv1 bv2) (bit-xor bv1 bv2)) -(defun bvec-nand (bv1 bv2) (bit-nand bv1 bv2)) -(defun bvec-nor (bv1 bv2) (bit-nor bv1 bv2)) -(defun bvec-not (bv) (bit-not bv)) - (SETQ |/MAJOR-VERSION| 7) (SETQ /VERSION 0) -(SETQ /RELEASE 0) - -(defconstant |$cclSystem| nil) ;; These two variables are referred to in setvars.boot. (setq input-libraries nil) @@ -6477,7 +6233,6 @@ special. (SETQ |$maxSignatureLineNumber| 0) (SETQ |$functionLocations| NIL) (SETQ |$functorLocalParameters| NIL) ; used in compSymbol -(SETQ /RELEASE '"UNKNOWN") (SETQ |$insideCategoryPackageIfTrue| NIL) (SETQ |$insideCompileBodyIfTrue| NIL) (SETQ |$globalExposureGroupAlist| NIL)