diff options
author | dos-reis <gdr@axiomatics.org> | 2007-08-14 05:14:52 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2007-08-14 05:14:52 +0000 |
commit | ab8cc85adde879fb963c94d15675783f2cf4b183 (patch) | |
tree | c202482327f474583b750b2c45dedfc4e4312b1d /src/algebra/out.spad.pamphlet | |
download | open-axiom-ab8cc85adde879fb963c94d15675783f2cf4b183.tar.gz |
Initial population.
Diffstat (limited to 'src/algebra/out.spad.pamphlet')
-rw-r--r-- | src/algebra/out.spad.pamphlet | 311 |
1 files changed, 311 insertions, 0 deletions
diff --git a/src/algebra/out.spad.pamphlet b/src/algebra/out.spad.pamphlet new file mode 100644 index 00000000..19388b78 --- /dev/null +++ b/src/algebra/out.spad.pamphlet @@ -0,0 +1,311 @@ +\documentclass{article} +\usepackage{axiom} +\begin{document} +\title{\$SPAD/src/algebra out.spad} +\author{Stephen M. Watt, Robert S. Sutor} +\maketitle +\begin{abstract} +\end{abstract} +\eject +\tableofcontents +\eject +\section{package OUT OutputPackage} +<<package OUT OutputPackage>>= +)abbrev package OUT OutputPackage +++ Author: Stephen M. Watt +++ Date Created: February 1986 +++ Date Last Updated: October 27 1995 (MCD) +++ Basic Operations: output +++ Related Constructors: OutputForm +++ Also See: +++ AMS Classifications: +++ Keywords: +++ References: +++ Description: OutPackage allows pretty-printing from programs. + +OutputPackage: with + output: String -> Void + ++ output(s) displays the string s on the ``algebra output'' + ++ stream, as defined by \spadsyscom{set output algebra}. + output: OutputForm -> Void + ++ output(x) displays the output form x on the + ++ ``algebra output'' stream, as defined by + ++ \spadsyscom{set output algebra}. + output: (String, OutputForm) -> Void + ++ output(s,x) displays the string s followed by the form x + ++ on the ``algebra output'' stream, as defined by + ++ \spadsyscom{set output algebra}. + outputList: (List Any) -> Void + ++ outputList(l) displays the concatenated components of the + ++ list l on the ``algebra output'' stream, as defined by + ++ \spadsyscom{set output algebra}; quotes are stripped + ++ from strings. + + == add + --ExpressionPackage() + E ==> OutputForm + putout ==> mathprint$Lisp + + s: String + e: OutputForm + l: List Any + + output e == + mathprint(e)$Lisp + void() + output s == + output(s:E) + output(s,e) == + output blankSeparate [s:E, e] + outputList(l) == -- MGR + output hconcat + [if retractable?(x)$AnyFunctions1(String) then + message(retract(x)$AnyFunctions1(String))$OutputForm + else + x::OutputForm + for x in l] + +@ +\section{package SPECOUT SpecialOutputPackage} +<<package SPECOUT SpecialOutputPackage>>= +)abbrev package SPECOUT SpecialOutputPackage +++ Author: Stephen M. Watt +++ Date Created: September 1986 +++ Date Last Updated: May 23, 1991 +++ Basic Operations: outputAsFortran, outputAsScript, outputAsTex +++ Related Constructors: +++ Also See: +++ AMS Classifications: +++ Keywords: +++ References: +++ Description: SpecialOutputPackage allows FORTRAN, Tex and +++ Script Formula Formatter output from programs. + +SpecialOutputPackage: public == private where + public == with + outputAsFortran: (String,OutputForm) -> Void + ++ outputAsFortran(v,o) sends output v = o in FORTRAN format + ++ to the destination defined by \spadsyscom{set output fortran}. + outputAsFortran: OutputForm -> Void + ++ outputAsFortran(o) sends output o in FORTRAN format. + outputAsScript: OutputForm -> Void + ++ outputAsScript(o) sends output o in Script Formula Formatter format + ++ to the destination defined by \spadsyscom{set output formula}. + outputAsTex: OutputForm -> Void + ++ outputAsTex(o) sends output o in Tex format to the destination + ++ defined by \spadsyscom{set output tex}. + outputAsFortran: List OutputForm -> Void + ++ outputAsFortran(l) sends (for each expression in the list l) + ++ output in FORTRAN format to the destination defined by + ++ \spadsyscom{set output fortran}. + outputAsScript: List OutputForm -> Void + ++ outputAsScript(l) sends (for each expression in the list l) + ++ output in Script Formula Formatter format to the destination defined. + ++ by \spadsyscom{set output forumula}. + outputAsTex: List OutputForm -> Void + ++ outputAsTex(l) sends (for each expression in the list l) + ++ output in Tex format to the destination as defined by + ++ \spadsyscom{set output tex}. + + private == add + e : OutputForm + l : List OutputForm + var : String + --ExpressionPackage() + + juxtaposeTerms: List OutputForm -> OutputForm + juxtaposeTerms l == blankSeparate l + + outputAsFortran e == + dispfortexp$Lisp e + void()$Void + + outputAsFortran(var,e) == + e := var::Symbol::OutputForm = e + dispfortexp(e)$Lisp + void()$Void + + outputAsFortran l == + dispfortexp$Lisp juxtaposeTerms l + void()$Void + + outputAsScript e == + formulaFormat$Lisp e + void()$Void + + outputAsScript l == + formulaFormat$Lisp juxtaposeTerms l + void()$Void + + outputAsTex e == + texFormat$Lisp e + void()$Void + + outputAsTex l == + texFormat$Lisp juxtaposeTerms l + void()$Void + +@ +\section{package DISPLAY DisplayPackage} +<<package DISPLAY DisplayPackage>>= +)abbrev package DISPLAY DisplayPackage +++ Author: Robert S. Sutor +++ Date Created: September 1986 +++ Date Last Updated: +++ Basic Operations: bright, newLine, copies, center, say, sayLength +++ Related Constructors: +++ Also See: +++ AMS Classifications: +++ Keywords: +++ References: +++ Description: DisplayPackage allows one to print strings in a nice manner, +++ including highlighting substrings. + +DisplayPackage: public == private where + I ==> Integer + L ==> List + S ==> String + RECLR ==> Record(lhs : S, rhs : S) + + public == with + bright: S -> L S + ++ bright(s) sets the font property of the string s to bold-face type. + bright: L S -> L S + ++ bright(l) sets the font property of a list of strings, l, to + ++ bold-face type. + newLine: () -> S + ++ newLine() sends a new line command to output. + + copies: (I,S) -> S + ++ copies(i,s) will take a string s and create a new string composed of + ++ i copies of s. + center: (S,I,S) -> S + ++ center(s,i,s) takes the first string s, and centers it within a string + ++ of length i, in which the other elements of the string are composed + ++ of as many replications as possible of the second indicated string, s + ++ which must have a length greater than that of an empty string. + center: (L S,I,S) -> L S + ++ center(l,i,s) takes a list of strings l, and centers them within a + ++ list of strings which is i characters long, in which the remaining + ++ spaces are filled with strings composed of as many repetitions as + ++ possible of the last string parameter s. + + say: S -> Void + ++ say(s) sends a string s to output. + say: L S -> Void + ++ say(l) sends a list of strings l to output. + sayLength: S -> I + ++ sayLength(s) returns the length of a string s as an integer. + sayLength: L S -> I + ++ sayLength(l) returns the length of a list of strings l as an integer. + + private == add + --StringManipulations() + + center0: (I,I,S) -> RECLR + + s : S + l : L S + + HION : S := "%b" + HIOFF : S := "%d" + NEWLINE : S := "%l" + + bright s == [HION,s,HIOFF]$(L S) + bright l == cons(HION,append(l,list HIOFF)) + newLine() == NEWLINE + + copies(n : I, s : S) == + n < 1 => "" + n = 1 => s + t : S := copies(n quo 2, s) + odd? n => concat [s,t,t] + concat [t,t] + + center0(len : I, wid : I, fill : S) : RECLR == + (wid < 1) or (len >= wid) => ["",""]$RECLR + m : I := (wid - len) quo 2 + t : S := copies(1 + (m quo (sayLength fill)),fill) + [t(1..m),t(1..wid-len-m)]$RECLR + + center(s, wid, fill) == + wid < 1 => "" + len : I := sayLength s + len = wid => s + len > wid => s(1..wid) + rec : RECLR := center0(len,wid,fill) + concat [rec.lhs,s,rec.rhs] + + center(l, wid, fill) == + wid < 1 => [""]$(L S) + len : I := sayLength l + len = wid => l +-- len > wid => s(1..wid) + rec : RECLR := center0(len,wid,fill) + cons(rec.lhs,append(l,list rec.rhs)) + + say s == + sayBrightly$Lisp s + void()$Void + + say l == + sayBrightly$Lisp l + void()$Void + + sayLength s == #s + + sayLength l == + sum : I := 0 + for s in l repeat + s = HION => sum := sum + 1 + s = HIOFF => sum := sum + 1 + s = NEWLINE => sum + sum := sum + sayLength s + sum + +@ +\section{License} +<<license>>= +--Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. +--All rights reserved. +-- +--Redistribution and use in source and binary forms, with or without +--modification, are permitted provided that the following conditions are +--met: +-- +-- - Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- +-- - Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in +-- the documentation and/or other materials provided with the +-- distribution. +-- +-- - Neither the name of The Numerical ALgorithms Group Ltd. nor the +-- names of its contributors may be used to endorse or promote products +-- derived from this software without specific prior written permission. +-- +--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +--IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +--TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +--PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +--OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +--EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +--PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +--PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +--LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +--NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +--SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +@ +<<*>>= +<<license>> + +<<package OUT OutputPackage>> +<<package SPECOUT SpecialOutputPackage>> +<<package DISPLAY DisplayPackage>> +@ +\eject +\begin{thebibliography}{99} +\bibitem{1} nothing +\end{thebibliography} +\end{document} |