Provide a collection of static methods to provide the mapping of sidl
concepts into FORTRAN. This class provides the mapping of symbol names
to FORTRAN symbols, the mapping of the wrapper code to a set of files,
and the mapping of types.
arrayIOR
public static String arrayIOR(Context context)
arrayIndices
public static String arrayIndices(List indices)
generateStubIncludes
public static Set generateStubIncludes(LanguageWriterForC writer,
Extendable ext)
throws CodeGenerationException
Generates include directives for all the Babel clases used in this
fortran stub or skel
writer
- Language writer for Cext
- Extendible (Class or Interface) to generate dependencies
getAltStubName
public static String getAltStubName(SymbolID id,
Method method)
Get the function name that should be used for the FORTRAN stubs to the
sidl object methods. This method does not take into account the
compiler specific issues (i.e. whether the symbol should be all upper
or lower case or whether it has underscores appended); it provides
the starting name with potentially mixed case.
id
- the name of the symbol who has the method.method
- information about the method to be named.
- the name of the function to be used in the FORTRAN stub.
getAltSuffix
public static String getAltSuffix()
Return the appropriate FORTRAN alternative stub name.
- the FORTRAN method name suffix.
getArrayConstructor
public static String getArrayConstructor(SymbolID id,
Context context)
Generate the name of the array constructor function.
getArrayDestructor
public static String getArrayDestructor(SymbolID id,
Context context)
Generate the name of the array destructor function.
getArrayDimen
public static String getArrayDimen(SymbolID id,
Context context)
Generate the name of the array dimension access function.
getArrayFile
public static String getArrayFile(SymbolID id)
getArrayGet
public static String getArrayGet(SymbolID id,
Context context)
Generate the name of the array get element function.
getArrayGet
public static String getArrayGet(SymbolID id,
int numArgs,
Context context)
Generate the name of the array get element function.
getArrayLength
public static String getArrayLength(SymbolID id,
Context context)
Generate the name of the array length access function.
getArrayLower
public static String getArrayLower(SymbolID id,
Context context)
Generate the name of the array lower bound access function.
getArrayModule
public static String getArrayModule(SymbolID id)
getArrayName
public static String getArrayName(SymbolID id,
int dim)
getArraySet
public static String getArraySet(SymbolID id,
Context context)
Generate the name of the array set element function.
getArraySet
public static String getArraySet(SymbolID id,
int numArgs,
Context context)
Generate the name of the array set element function.
getArrayUpper
public static String getArrayUpper(SymbolID id,
Context context)
Generate the name of the array upper bound access function.
getDelRefArray
public static String getDelRefArray(Type arrayType)
getEnsureArray
public static String getEnsureArray(Type arrayType)
getEnumStubFile
public static String getEnumStubFile(SymbolID id)
Return the name of the stub file for a particular enumeration.
The stub file is a DEC FORTRAN include file that defines
integer parameters that hold the values of the enumerations.
id
- the symbol whose stub file will be returned
- the filename of a FORTRAN inc file containing the implementation of
the FORTRAN stubs.
getEnumStubImpl
public static String getEnumStubImpl(SymbolID id)
Return the name of the stub impl file for a particular enumeration.
The stub file is a C source file that holds the array of enumeration
stubs.
id
- the symbol whose stub file will be returned
- the filename of a C file containing the implementation of
the FORTRAN enum array stubs.
getExtendedMethodName
public static String getExtendedMethodName(SymbolID id,
String baseName)
Return the extended function name (i.e., one with the full name
prepended).
id
- the name of the symbol who has the method.baseName
- the base method name.
- the name of the FORTRAN subroutine that implements this method.
getFortranPrefix
public static String getFortranPrefix(Context context)
Return the sidl Fortran prefix for macros and types.
getFortranSymbol
public static String getFortranSymbol(Context context)
Return the appropriate version of SIDLFortran##Symbol.
- the appropriate version of SIDLFortran##Symbol.
getFortranTypeInC
public static String getFortranTypeInC(Type type,
Context context)
throws CodeGenerationException
Return the C type corresponding to the FORTRAN type corresponding to
a particular sidl type. This is the type that a C subroutine would
need to pass to FORTRAN, or the type that a C subroutine could expect
to receive from a FORTRAN caller.
type
- the sidl type description.
- the C type corresponding to the FORTRAN type corresponding
to the sidl type.
getFortranVersion
public static int getFortranVersion(Context context)
Return the appropriate version of Fortran (i.e., 77 or 90).
- the version of Fortran being generated
getHeaderFile
public static String getHeaderFile(SymbolID id)
Return the name of the stub header file for a particular symbol.
The stub header file is a C file that globablly externs a few
special functions in the fStub.
id
- the symbol whose stub file will be returned
- the filename of a C file containing the implementation of
the FORTRAN stubs.
getImplExtension
public static String getImplExtension(Context context)
Return the appropriate FORTRAN extension.
- the FORTRAN file extension.
getImplFile
public static String getImplFile(SymbolID id,
Context context)
Return the name of the file that hold the implementation of the
FORTRAN sidl object. The BABEL system generates the subroutine
declarations, but the user needs to fill in the subroutine bodies.
id
- the name of the symbol
- the filename for the sidl object implementation.
getImplMethodSuffix
public static String getImplMethodSuffix(Context context)
Return the appropriate FORTRAN impl method name suffix based.
- the FORTRAN impl method name suffix.
getImplModuleFile
public static String getImplModuleFile(SymbolID id,
Context context)
Return the name of the file that hold the derived types for
implementation of the FORTRAN sidl object.
id
- the name of the symbol
- the filename for the sidl impl module file.
getInitArray
public static String getInitArray(Type arrayType)
getMethodImplName
public static String getMethodImplName(SymbolID id,
Method method,
NameMangler mang,
Context context)
throws CodeGenerationException
Return the function name that should be used for the FORTRAN subroutine
that implements a particular method. The returned string leaves
the cast of the components of the name unchanged. If id
and the method name have mixed case, this method returns a mixed case
string.
id
- the name of the symbol who has the method.method
- the information about the method.mang
- the name mangler being used to address long names.
- the name of the FORTRAN subroutine that implements this method.
getMethodSkelName
public static String getMethodSkelName(SymbolID id,
Method method)
Return the C function name that should be used for the skeleton
method. This is a C function that is called by the IOR.
id
- the name of the symbol who has the methodmethod
- information about the method.
- the name of the C skeleton function.
getMethodStubName
public static String getMethodStubName(SymbolID id,
Method method,
Context context)
Get the function name that should be used for the FORTRAN stubs to the
sidl object methods. This method does not take into account the
compiler specific issues (i.e. whether the symbol should be all upper
or lower case or whether it has underscores appended); it provides
the starting name with potentially mixed case.
id
- the name of the symbol who has the method.method
- information about the method to be named.
- the name of the function to be used in the FORTRAN stub.
getMethodSuffix
public static String getMethodSuffix(Context context)
Return the appropriate FORTRAN method name suffix based on the version.
- the FORTRAN method name suffix.
getMethodSuperImplName
public static String getMethodSuperImplName(SymbolID id,
Method method,
NameMangler mang,
Context context)
throws CodeGenerationException
Return the function name that should be used for the FORTRAN subroutine
that implements a particular SUPER method. The returned string leaves
the cast of the components of the name unchanged. If id
and the method name have mixed case, this method returns a mixed case
string.
id
- the name of the symbol who has the method.method
- the information about the method.mang
- the name mangler being used to address long names.
- the name of the FORTRAN subroutine that implements this method.
getMethodSuperName
public static String getMethodSuperName(SymbolID id,
Method method,
NameMangler mang,
Context context)
throws CodeGenerationException
Get the function name that should be used for the FORTRAN super method
in the skels (availible in this Impls). This method does not take into account the
compiler specific issues (i.e. whether the symbol should be all upper
or lower case or whether it has underscores appended); it provides
the starting name with potentially mixed case.
id
- the name of the symbol who has the method.method
- information about the method to be named.
- the name of the function to be used in the FORTRAN stub.
getModule
public static String getModule(SymbolID id)
getModuleFile
public static String getModuleFile(SymbolID id)
Return the name of the F90 stub module file for a particular
symbol. The module file is an F90 file used to package "global
data, derived types and their associated operations, interface
blocks, and namelist groups."
id
- the symbol whose stub documentation file will be returned
- the filename of a text file containing the documentation
of the FORTRAN stubs.
getReturnString
public static String getReturnString(Type type,
Context context)
throws CodeGenerationException
Return the FORTRAN type declaration corresponding to type
,
a particular sidl type.
type
- a sidl type description.
- the FORTRAN type used to some something of the given sidl
type.
getSkelFile
public static String getSkelFile(SymbolID id)
Return the name of the file that holds the implementation of the
skeletons for FORTRAN. The skeleton file is written in C, and it is
the glue between the IOR and a FORTRAN.
getStructModuleFile
public static String getStructModuleFile(SymbolID id,
Context context)
Return the name of the file that hold the derived types for
Fortran/BindC to C/C++ interoperability.
id
- the name of the symbol
- the filename for the sidl struct module file.
getStubDocFile
public static String getStubDocFile(SymbolID id)
Return the name of the F77 stub documentation file for a particular
symbol. The documentation file is FORTRAN pseudo-code to
document the calling interface for FORTRAN clients.
id
- the symbol whose stub documentation file will be returned
- the filename of a text file containing the documentation
of the FORTRAN stubs.
getStubFile
public static String getStubFile(SymbolID id)
Return the name of the stub file for a particular symbol.
The stub file is a C file that receives calls from FORTRAN client.
id
- the symbol whose stub file will be returned
- the filename of a C file containing the implementation of
the FORTRAN stubs.
getStubNameFile
public static String getStubNameFile(SymbolID id)
getSymbolName
public static String getSymbolName(SymbolID id)
Convert a symbol name into string with the pieces of the symbol joined
together with underline characters.
id
- the symbol id to convert.
- a string representation of the symbol with periods replaced
with underline characters.
getSymbolNameForFile
public static String getSymbolNameForFile(SymbolID id)
Convert a symbol name into string with the pieces of the symbol joined
together with underline characters. Generate short file names
if the options for generating code in package-dependent subdirectories
and excluding external symbols are enabled (--generate-subdirs and
--exclude-external).
id
- the symbol id to convert.
- a string representation of the symbol with periods replaced
with underline characters.
getSymbolNameForFile
public static String getSymbolNameForFile(SymbolID id,
boolean isImpl,
Context context)
Same as above method, but use an extra argument for determining
when the file whose name is to be generated corresponds to an impl.
getTypeFile
public static String getTypeFile(SymbolID id)
Return the name of the F90 type module file for a particular
symbol. The module file is an F90 file used to package the
derived type for the symbol.
id
- the symbol whose stub documentation file will be returned
- the filename of a text file containing the documentation
of the FORTRAN stubs.
getTypeModule
public static String getTypeModule(SymbolID id)
getTypeName
public static String getTypeName(SymbolID id)
hasBindC
public static boolean hasBindC(Context context)
hasDirectAccess
public static boolean hasDirectAccess(Type t)
isFortran7731
public static boolean isFortran7731(Context context)
isFortran90
public static boolean isFortran90(Context context)
needsAbbrev
public static boolean needsAbbrev(Context context)
reorderArguments
public static List reorderArguments(List args)
Reorder an argument list to guarantee that all raw arrays occur at the
end of the argument list. The relative position of non-raw arrays
arguments is unchanged by this function.
args
- the incoming list of arguments
- the incoming list has been reordered such that all raw arrays
appear at the end.