/usr/share/axiom-20170501/src/algebra/FTEM.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | )abbrev domain FTEM FortranTemplate
++ Author: Mike Dewar
++ Date Created: October 1992
++ Description:
++ Code to manipulate Fortran templates
FortranTemplate() : SIG == CODE where
SIG ==> FileCategory(FileName, String) with
processTemplate : (FileName, FileName) -> FileName
++ processTemplate(tp,fn) processes the template tp, writing the
++ result out to fn.
processTemplate : (FileName) -> FileName
++ processTemplate(tp) processes the template tp, writing the
++ result to the current FORTRAN output stream.
fortranLiteralLine : String -> Void
++ fortranLiteralLine(s) writes s to the current Fortran output stream,
++ followed by a carriage return
fortranLiteral : String -> Void
++ fortranLiteral(s) writes s to the current Fortran output stream
fortranCarriageReturn : () -> Void
++ fortranCarriageReturn() produces a carriage return on the current
++ Fortran output stream
CODE ==> TextFile add
import TemplateUtilities
import FortranOutputStackPackage
Rep := TextFile
fortranLiteralLine(s:String):Void ==
PRINC(s,_$fortranOutputStream$Lisp)$Lisp
TERPRI(_$fortranOutputStream$Lisp)$Lisp
fortranLiteral(s:String):Void ==
PRINC(s,_$fortranOutputStream$Lisp)$Lisp
fortranCarriageReturn():Void ==
TERPRI(_$fortranOutputStream$Lisp)$Lisp
writePassiveLine!(line:String):Void ==
-- We might want to be a bit clever here and look for new SubPrograms etc.
fortranLiteralLine line
processTemplate(tp:FileName, fn:FileName):FileName ==
pushFortranOutputStack(fn)
processTemplate(tp)
popFortranOutputStack()
fn
getLine(fp:TextFile):String ==
line : String := stripCommentsAndBlanks readLine!(fp)
while not empty?(line) and elt(line,maxIndex line) = char "__" repeat
setelt(line,maxIndex line,char " ")
line := concat(line, stripCommentsAndBlanks readLine!(fp))$String
line
processTemplate(tp:FileName):FileName ==
fp : TextFile := open(tp,"input")
active : Boolean := true
line : String
endInput : Boolean := false
while not (endInput or endOfFile? fp) repeat
if active then
line := getLine fp
line = "endInput" => endInput := true
if line = "beginVerbatim" then
active := false
else
not empty? line => interpretString line
else
line := readLine!(fp)
if line = "endVerbatim" then
active := true
else
writePassiveLine! line
close!(fp)
if not active then
error concat(["Missing `endVerbatim' line in ",tp::String])$String
string(_$fortranOutputFile$Lisp)::FileName
|