|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.llnl.babel.backend.fortran.StubSource
public class 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 java.util.List |
convertRarrayToArray(java.util.List args)
Convert any rarray arguments to normal array arguments. |
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,
boolean indices)
Add extra arguments to the original argument list of a method as needed for the self pointer, the return value and the exception argument. |
static java.util.Set |
extendedReferences(Extendable ext)
Generate the expanded set of referenced SymbolID 's. |
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 enm)
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. |
void |
generateSupers(Class cls)
|
static void |
generateSupers(Class cls,
LanguageWriter writer)
This is a convenience utility function specifically for the generation of super "Stub" functions in the Impl files. |
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 void generateSupers(Class cls, LanguageWriter writer) throws CodeGenerationException
methods
- is a collection of super methods to be generated.writer
- the output writer to which the stub source will
be written. This will not be closed.cls
- The class in which these supers are to be generated
CodeGenerationException
- this is a catch all exception. It can be caused by I/O trouble or
violations of the data type invariants.public void generateSupers(Class cls) throws CodeGenerationException
CodeGenerationException
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.argument
- a list of Argument
objects.
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 convertRarrayToArray(java.util.List args)
public static java.util.List extendArgs(SymbolID selfId, Method m, boolean indices) throws CodeGenerationException
selfId
- the name of the class/interface who owns the method.m
- the method whose argument list will be extended.indices
- If true, get the argument list including rarray
indices. Should be true for places that support rarrays.
CodeGenerationException
- a catch all exception for problems in the code generation phase.public static java.util.Set extendedReferences(Extendable ext) throws CodeGenerationException
SymbolID
's. This
includes sidl.BaseException
if any of the methods throws
an exception.
ext
- the class or interface to generate includes for.
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 enm) throws CodeGenerationException
enm
- 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 |