|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gov.llnl.babel.backend.fortran.StubSource
This class generates the C code that sits between a FORTRAN client and the internal object representation (IOR) of a SIDL object/interface. For each method, this generates a C function that will be called from FORTRAN. This C function massages the arguments from Fortran, calls the IOR, massages the out values from the IOR call, and returns the outgoing values to the Fortran caller.
Field Summary | |
static java.lang.String |
s_charCheck
An #ifdef to check whether character argument should be
treated like strings. |
static java.lang.String |
s_exception
The argument name that holds the exception pointer which a method may throw an exception. |
static java.lang.String |
s_return
The argument name that holds the return value of a method. |
static java.lang.String |
s_self
The argument name that holds the object/interface pointer in a call to an object method. |
Constructor Summary | |
StubSource(LanguageWriter writer)
Create an object to generate the stub code for a SIDL class/interface. |
Method Summary | |
static boolean |
comma(LanguageWriter writer,
boolean needComma)
Write a comma and newline to writer iff
needComma is true . |
static boolean |
declareArgument(LanguageWriter writer,
java.lang.String argName,
Type argType,
boolean needComma)
Write an argument declaration in C for an argument being passed in from a FORTRAN caller or from C to a FORTRAN subroutine. |
static java.util.List |
extendArgs(SymbolID selfId,
Method m)
Add extra arguments to the original argument list of a method as needed for the self pointer, the return value and the exception argument. |
void |
generateCode(Symbol symbol)
Generate a C file to provide FORTRAN stubs for a SIDL object/interface. |
static void |
generateCode(Symbol ext,
LanguageWriter writer)
Generate a C file to provide FORTRAN stubs for a SIDL object/interface. |
void |
generateEnum(Enumeration enum)
Generate a FORTRAN include file containing integer constants for the members of an enumerated type. |
static void |
generateIncludes(LanguageWriterForC writer,
Extendable ext)
Generate a sequence of #include
|
static void |
generateSignature(LanguageWriter writer,
java.lang.String methodName,
java.util.List arguments)
Generate the C signature for a FORTRAN subroutine to be called from C or for a C function to be called from FORTRAN. |
static boolean |
hasProxy(Type t)
Return true iff the type present requires a proxy. |
static boolean |
isPointer(Type t)
Return true if a particular SIDL type is implemented using
a pointer type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String s_self
public static final java.lang.String s_return
public static final java.lang.String s_exception
public static final java.lang.String s_charCheck
#ifdef
to check whether character argument should be
treated like strings.
Constructor Detail |
public StubSource(LanguageWriter writer)
generateCode
rather than used directly.
writer
- the stub code is generated to this output device.Method Detail |
public static boolean comma(LanguageWriter writer, boolean needComma)
writer
iff
needComma
is true
. This always returns
false
.
writer
- the device to which the comma should be output.needComma
- If true
, this method will write a
comma followed by a newline; otherwise, this
method takes no action.
false
is always returned.public static boolean declareArgument(LanguageWriter writer, java.lang.String argName, Type argType, boolean needComma) throws CodeGenerationException
writer
- the place where the code is generated.argName
- the formal name of the argument.argType
- the type of the argument.needComma
- whether a comma is needed or not.
true
means a comma is needed before
the next argument; false
means a comma
is not needed.
CodeGenerationException
- the type of the argument is unsupported.public static void generateSignature(LanguageWriter writer, java.lang.String methodName, java.util.List arguments) throws CodeGenerationException
writer
- the place where the signature is written.methodName
- the name of the function.
CodeGenerationException
- something went wrong -- probably an unsupported type.public static boolean hasProxy(Type t)
true
iff the type present requires a proxy. A
proxy is required when the FORTRAN types is not directly compatible
with the C type for a particular SIDL type.
t
- the SIDL type description
true
means that t
requires a proxy;
false
means that t
does not require a
proxy.public static boolean isPointer(Type t)
true
if a particular SIDL type is implemented using
a pointer type.
t
- the SIDL type description.
true
means the type is implemented using a pointer
type; false
means the type is not implemented using a
pointer type.public static java.util.List extendArgs(SymbolID selfId, Method m) throws CodeGenerationException
selfId
- the name of the class/interface who owns the method.m
- the method whose argument list will be extended.
CodeGenerationException
- a catch all exception for problems in the code generation phase.public static void generateIncludes(LanguageWriterForC writer, Extendable ext) throws CodeGenerationException
#include
- Parameters:
writer
- the output device where output is sent.ext
- the class or interface to generate includes for.
- Throws:
CodeGenerationException
- a catch all exception for problems in the code generation phase.
public void generateEnum(Enumeration enum) throws CodeGenerationException
enum
- an enumeration object to provide an include file for.
CodeGenerationException
- a catch all exception to indicate problems during the code generation
phase of the SIDL processing.public void generateCode(Symbol symbol) throws CodeGenerationException
generateCode
instead of calling this method
directly.
symbol
- the symbol for which stubs will be generated.
CodeGenerationException
- a catch all exception to indicate problems during the code generation
phase of the SIDL processing.public static void generateCode(Symbol ext, LanguageWriter writer) throws CodeGenerationException
ext
- the symbol for which stubs will be generated.writer
- the output device where the stub should be written.
CodeGenerationException
- a catch all exception to indicate problems during the code generation
phase of the SIDL processing.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |