public class StubSource
extends java.lang.Object
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 java.util.List |
extendArgs(SymbolID selfId,
Method m,
Context context,
boolean indices) |
static java.util.List |
extendArgs(SymbolID selfId,
Method m,
Context context,
boolean indices,
boolean skip_retval)
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 |
generateGetIOR(SymbolID id,
LanguageWriter d_writer)
Generate the _getIOR function that provides access to the IOR functions
either through static linking or dynamic loading.
|
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)
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)
Generate the C signature for a FORTRAN subroutine to be called from C
or for a C function to be called from FORTRAN.
|
static void |
generateSuperEPV(Class cls,
LanguageWriter d_writer)
Just generates the variable superEPV
|
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,
Context context)
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 java.util.List |
stripArgs(java.util.List args,
java.util.Set S)
Strip arguments from the given argument lists based on their names.
|
static void |
writeStructSerializeSig(LanguageWriter writer,
SymbolID structid,
boolean serialize,
Context d_context) |
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
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 void generateMethodSymbol(LanguageWriter writer, java.lang.String methodName, Context context, Type type) throws CodeGenerationException
writer
- the place where the symbol is writtenmethodName
- the potentially mixed case form of the function
name.CodeGenerationException
public static void generateSignature(LanguageWriter writer, java.lang.String methodName, java.util.List arguments, Context context, Method method) throws CodeGenerationException
writer
- the place where the signature is written.methodName
- the name of the function.arguments
- a list of Argument
objects.CodeGenerationException
- something went wrong -- probably an unsupported type.public static boolean hasProxy(Type t, Context context)
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 descriptioncontext
- the current contexttrue
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 void generateSuperEPV(Class cls, LanguageWriter d_writer)
public static void generateGetIOR(SymbolID id, LanguageWriter d_writer)
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, boolean skip_retval) 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.List extendArgs(SymbolID selfId, Method m, Context context, boolean indices) throws CodeGenerationException
CodeGenerationException
public static java.util.List stripArgs(java.util.List args, java.util.Set S)
args
- The argument list to be consideredS
- A set of Strings with argument names to be filteredpublic 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 static void writeStructSerializeSig(LanguageWriter writer, SymbolID structid, boolean serialize, Context d_context) throws CodeGenerationException
CodeGenerationException
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.