public class StubSource
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
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_self
The argument name that holds the object/interface pointer in
a call to an object method.
|
| Constructor and Description |
|---|
StubSource(LanguageWriter writer,
Context context)
Create an object to generate the stub code for a sidl class/interface.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
charCheck(Context context)
An
#ifdef to check whether character argument should be
treated like strings. |
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,
Context context)
Convert any rarray arguments to normal array arguments.
|
static boolean |
declareArgument(LanguageWriter writer,
java.lang.String argName,
Type argType,
boolean needComma,
Context context,
Method method)
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,
Context context,
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,
Context context)
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,
Context context)
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,
Context context)
Generate a sequence of
#include preprocessor directives
required by the stub. |
static void |
generateMethodSymbol(LanguageWriter writer,
java.lang.String methodName,
Context context,
Type type,
boolean fromSkelFunc)
Generate the compiler independent form of the function name.
|
static void |
generateSignature(LanguageWriter writer,
java.lang.String methodName,
java.util.List arguments,
Context context,
Method method,
boolean fromSkelFunc)
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,
Context context)
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. |
static void |
writeStructSerializeSig(LanguageWriter writer,
SymbolID structid,
boolean serialize) |
public static final java.lang.String s_self
public static final java.lang.String s_exception
public StubSource(LanguageWriter writer, Context context)
generateCode rather than used directly.writer - the stub code is generated to this output device.public static final java.lang.String charCheck(Context context)
#ifdef to check whether character argument should be
treated like strings.public static void generateSupers(Class cls, LanguageWriter writer, Context context) throws CodeGenerationException
cls - The class in which these supers are to be generatedwriter - the output writer to which the stub source will
be written. This will not be closed.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
CodeGenerationExceptionpublic 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, Context context, Method method) 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 generateMethodSymbol(LanguageWriter writer, java.lang.String methodName, Context context, Type type, boolean fromSkelFunc) throws CodeGenerationException
writer - the place where the symbol is writtenmethodName - the potentially mixed case form of the function
name.CodeGenerationExceptionpublic static void generateSignature(LanguageWriter writer, java.lang.String methodName, java.util.List arguments, Context context, Method method, boolean fromSkelFunc) throws CodeGenerationException
writer - the place where the signature is written.methodName - the name of the function.arguments - a list of Argument objects.fromSkelFunc - Need different logic to deal with Fortran Functions in
the skel file.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 descriptiontrue 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,
Context context)
public static java.util.List extendArgs(SymbolID selfId, Method m, Context context, 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, Context context) 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, Context context) throws CodeGenerationException
#include preprocessor directives
required by the stub.writer - the output device where output is sent.ext - the class or interface to generate includes for.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, Context context) 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.public static void writeStructSerializeSig(LanguageWriter writer, SymbolID structid, boolean serialize) throws CodeGenerationException
CodeGenerationException