/usr/share/axiom-20170501/src/algebra/FORT.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 87 88 89 90 91 92 93 94 95 | )abbrev package FORT FortranPackage
-- Because of a bug in the compiler:
)bo $noSubsumption:=true
++ Author: Mike Dewar
++ Date Created: October 6 1991
++ Date Last Updated: 13 July 1994
++ Description:
++ provides an interface to the boot code for calling Fortran
FortranPackage() : SIG == CODE where
FST ==> FortranScalarType
SEX ==> SExpression
L ==> List
S ==> Symbol
FOP ==> FortranOutputStackPackage
U ==> Union(array:L S,scalar:S)
SIG ==> with
linkToFortran : (S, L U, L L U, L S) -> SEX
++ linkToFortran(s,l,ll,lv) \undocumented{}
linkToFortran : (S, L U, L L U, L S, S) -> SEX
++ linkToFortran(s,l,ll,lv,t) \undocumented{}
linkToFortran : (S,L S,TheSymbolTable,L S) -> SEX
++ linkToFortran(s,l,t,lv) \undocumented{}
outputAsFortran : FileName -> Void
++ outputAsFortran(fn) \undocumented{}
setLegalFortranSourceExtensions : List String -> List String
++ setLegalFortranSourceExtensions(l) \undocumented{}
CODE ==> add
legalFortranSourceExtensions : List String := ["f"]
setLegalFortranSourceExtensions(l:List String):List String ==
legalFortranSourceExtensions := l
checkExtension(fn : FileName) : String ==
-- Does it end in a legal extension ?
stringFn := fn::String
not member?(extension fn,legalFortranSourceExtensions) =>
error [stringFn,"is not a legal Fortran Source File."]
stringFn
outputAsFortran(fn:FileName):Void ==
source : String := fn::String
not readable? fn =>
popFortranOutputStack()$FOP
error([source,"is not readable"]@List(String))
target : String := topFortranOutputStack()$FOP
command : String :=
concat(["sys rm -f ",target," ; cp ",source," ",target])$String
systemCommand(command)$MoreSystemCommands
void()$Void
linkToFortran(name:S,args:L U, decls:L L U, res:L(S)):SEX ==
makeFort(name,args,decls,res,NIL$Lisp,NIL$Lisp)$Lisp
linkToFortran(name:S,args:L U, decls:L L U, res:L(S),returnType:S):SEX ==
makeFort(name,args,decls,res,returnType,NIL$Lisp)$Lisp
dimensions(type:FortranType):SEX ==
convert([convert(convert(u)@InputForm)@SEX _
for u in dimensionsOf(type)])@SEX
ftype(name:S,type:FortranType):SEX ==
[name,scalarTypeOf(type),dimensions(type),external? type]$Lisp
makeAspList(asp:S,syms:TheSymbolTable):SExpression==
symtab : SymbolTable := symbolTableOf(asp,syms)
[asp,returnTypeOf(asp,syms),argumentListOf(asp,syms), _
[ftype(u,fortranTypeOf(u,symtab)) for u in parametersOf symtab]]$Lisp
linkToFortran(name:S,aArgs:L S,syms:TheSymbolTable,res:L S):SEX ==
arguments : L S := argumentListOf(name,syms)$TheSymbolTable
dummies : L S := setDifference(arguments,aArgs)
symbolTable:SymbolTable := symbolTableOf(name,syms)
symbolList := newTypeLists(symbolTable)
rt:Union(fst: FST,void: "void") := returnTypeOf(name,syms)$TheSymbolTable
-- Look for arguments which are subprograms
asps :=[makeAspList(u,syms) for u in externalList(symbolTable)$SymbolTable]
rt case fst =>
makeFort1(name,arguments,aArgs,dummies,symbolList,_
res,(rt.fst)::S,asps)$Lisp
makeFort1(name,arguments,aArgs,dummies,symbolList,res,NIL$Lisp,asps)$Lisp
|