aboutsummaryrefslogtreecommitdiff
path: root/src/interp/i-output.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-08-25 22:12:54 +0000
committerdos-reis <gdr@axiomatics.org>2010-08-25 22:12:54 +0000
commit5a9b61c826838b7f97db1ad3b3c350482d407377 (patch)
tree3323b95d8ee99ab8de95dce9068878eca4a4d531 /src/interp/i-output.boot
parent7ffa34642e7d2671da8664936befb5fcd78c37c0 (diff)
downloadopen-axiom-5a9b61c826838b7f97db1ad3b3c350482d407377.tar.gz
* interp/i-output.boot (newlineIfDisplaying): New.
(mathprintWithNumber): Take type of value as second argument. (maprinChk): Tidy. (maprinRows): Likewise. (spadPrint): Likewise. (output): Likewise. (printMap): Likewise. (bracketagglist): Likewise. (mathPrint): Likewise. (mathPrint1): Likewise. * interp/i-toplev.boot (recordAndPrint): Likewise. * interp/setvart.boot: Introduce flag for asgard forms.
Diffstat (limited to 'src/interp/i-output.boot')
-rw-r--r--src/interp/i-output.boot47
1 files changed, 30 insertions, 17 deletions
diff --git a/src/interp/i-output.boot b/src/interp/i-output.boot
index c6168293..b25ec177 100644
--- a/src/interp/i-output.boot
+++ b/src/interp/i-output.boot
@@ -217,8 +217,6 @@ MATBORCH == '"*"
_*TALLPAR := false
-$collectOutput := false
-
--% Output functions dispatch tables.
for x in '((+ WIDTH sumWidth)
@@ -384,6 +382,14 @@ for x in '((+ APP plusApp)
--%
+$collectOutput := false
+
+++ Start a a new line if we are in 2-d ASCII art display mode.
+newlineIfDisplaying() ==
+ if not $collectOutput then
+ TERPRI $algebraOutputStream
+
+
specialChar(symbol) ==
-- looks up symbol in $specialCharacterAlist, gets the index
-- into the EBCDIC table, and returns the appropriate character
@@ -463,8 +469,15 @@ print(x,domain) ==
$dontDisplayEquatnum: local:= true
output(x,dom)
-mathprintWithNumber x ==
+++ Write x as an asgard form on the standard output.
+outputAsgardForm(x,t) ==
+ f := ['%OBJECT,x,devaluate t]
+ WRITE(f,KEYWORD::STREAM,$algebraOutputStream)
+ FRESH_-LINE $algebraOutputStream
+
+mathprintWithNumber(x,t) ==
x:= outputTran x
+ $asgardForm => outputAsgardForm(x,t)
maprin
$IOindex => ['EQUATNUM,$IOindex,x]
x
@@ -1162,20 +1175,20 @@ maprinChk x ==
-- deleteAssoc no longer exists
$MatrixList := delete(u,$MatrixList)
maPrin ['EQUATNUM,n,rest u]
- if not $collectOutput then TERPRI $algebraOutputStream
+ newlineIfDisplaying()
maPrin x
maPrin x
-- above line added JHD 13/2/93 since otherwise x gets lost
maprinRows matrixList ==
- if not $collectOutput then TERPRI($algebraOutputStream)
+ newlineIfDisplaying()
while matrixList repeat
y:=nreverse matrixList
--Makes the matrices come out in order, since CONSed on backwards
matrixList:=nil
firstName := first first y
for [name,:m] in y for n in 0.. repeat
- if not $collectOutput then TERPRI($algebraOutputStream)
+ newlineIfDisplaying()
andWhere := (name = firstName => '"where "; '"and ")
line := strconc(andWhere, PNAME name)
maprinChk ["=",line,m]
@@ -1504,9 +1517,9 @@ splitConcat(list,maxWidth,firstTimeIfTrue) ==
spadPrint(x,m) ==
m = $NoValueMode => x
- if not $collectOutput then TERPRI $algebraOutputStream
+ newlineIfDisplaying()
output(x,m)
- if not $collectOutput then TERPRI $algebraOutputStream
+ newlineIfDisplaying()
formulaFormat expr ==
sff := '(ScriptFormulaFormat)
@@ -1553,10 +1566,10 @@ output(expr,domain) ==
if $formulaFormat then formulaFormat expr
if $texFormat then texFormat expr
if $mathmlFormat then mathmlFormat expr
- if $algebraFormat then mathprintWithNumber expr
+ if $algebraFormat then mathprintWithNumber(expr,domain)
categoryForm? domain or member(domain,'((Mode) (Domain) (Type))) =>
if $algebraFormat then
- mathprintWithNumber outputDomainConstructor expr
+ mathprintWithNumber(outputDomainConstructor expr,domain)
if $texFormat then
texFormat outputDomainConstructor expr
T := coerceInteractive(objNewWrap(expr,domain),$OutputForm) =>
@@ -1567,7 +1580,7 @@ output(expr,domain) ==
if not $collectOutput then TERPRI $fortranOutputStream
FORCE_-OUTPUT $fortranOutputStream
if $algebraFormat then
- mathprintWithNumber x
+ mathprintWithNumber(x,domain)
if $texFormat then texFormat x
if $mathmlFormat then mathmlFormat x
(FUNCTIONP(opOf domain)) and
@@ -1657,7 +1670,7 @@ printMap u ==
printMap1(x,initialFlag and x is [[n],:.] and n=1)
for y in l repeat (printBasic " , "; printMap1(y,initialFlag))
printBasic specialChar 'rbrk
- if not $collectOutput then TERPRI $algebraOutputStream
+ newlineIfDisplaying()
isInitialMap u ==
u is [[[n],.],:l] and integer? n and
@@ -2098,7 +2111,7 @@ longext(u, i, n) ==
y := first x
u := remWidth(REVERSEWOC(['" ",:rest x]))
charybdis(u, i, n)
- if not $collectOutput then TERPRI $algebraOutputStream
+ newlineIfDisplaying()
charybdis(['ELSE, :[y]], i, n)
'" "
@@ -2341,7 +2354,7 @@ bracketagglist(u, start, linelength, tchr, open, close) ==
if null nextu then LAST(u).rest.rest.first := close
x := ASSOCIATER('CONCAT, [ichr,:u])
charybdis(ASSOCIATER('CONCAT, u), start, linelength)
- if $collectOutput then TERPRI $algebraOutputStream
+ newlineIfDisplaying()
ichr := '" "
u := nextu
null u => return(nil)
@@ -2555,7 +2568,7 @@ binomialSuper u == height u.1 + 1
binomialWidth u == 2 + MAX(WIDTH u.1, WIDTH u.2)
mathPrint u ==
- if not $collectOutput then TERPRI $algebraOutputStream
+ newlineIfDisplaying()
(u := string? mathPrint1(mathPrintTran u, nil) =>
PSTRING u; nil)
@@ -2567,9 +2580,9 @@ mathPrintTran u ==
u
mathPrint1(x,fg) ==
- if fg and not $collectOutput then TERPRI $algebraOutputStream
+ if fg then newlineIfDisplaying()
maPrin x
- if fg and not $collectOutput then TERPRI $algebraOutputStream
+ if fg then newlineIfDisplaying()
maPrin u ==
null u => nil