This class defines some of the fundamental mapping rules for translating
a symbol in the sidl file into Python. These fundamental mapping rules
are used repeatedly in the generation of client and server side bindings,
so they are seperated into a class that can be shared by all Python code
generators.
Some of the particular features include:
- Provide the header file name
StubHeaderFiles
public static void StubHeaderFiles(LanguageWriterForC writer)
Generate an include file for a symbol.
addInclude
public static void addInclude(LanguageWriterForC writer,
String filename,
boolean useGuard)
allocateStringSpace
public static String allocateStringSpace(String s_strSize)
Generate a string which allocate space a character array.
argComment
public static String argComment(Argument arg)
Create a comment to describe the SIDL type for the C signature.
arg
- the argument to make a comment from
- usually this is just the mode as a string. For arrays
and rarrays more information is returned.
checkMxClass
public static String checkMxClass(Type argType,
String mxName,
int i,
boolean isStatic)
Generate a string which checks if a matrix has the proper class
to match the argument type in SIDL specification.
createStub
public static LanguageWriterForC createStub(Symbol symbol,
String description,
Context context)
throws CodeGenerationException
Generate an IO stream to receive the C stub file for the Matlab clients.
CodeGenerationException
- this is a catch all exception for problems during the code
generation phase.
Currently: setJavaStylePackageGeneration is set to false,
need set to true later and does some work on adding new
matpath automatically for each created stub directory named after
sidl package name
generatePlhsMatrix
public static String generatePlhsMatrix(Type t,
int idx,
String varName)
Generate a string which creates a Mx matrix for the given
Matlab data type.
getClientMatFile
public static String getClientMatFile(SymbolID id)
Generate the Matlab filename for the client using the specified
symbol identifier.
getConstructorStubFile
public static String getConstructorStubFile(SymbolID id)
getConstructorStubName
public static String getConstructorStubName(SymbolID id)
getFullMethodName
public static String getFullMethodName(SymbolID id,
Method method)
Generate the full method name associated with the symbol id and the
specified method. The returned name prepends the symbol name and
only one underbar to the method's name.
id
- the SymbolID
of the Symbol
associated with the method.method
- the Method
whose full name is being built.
getHeaderFile
public static String getHeaderFile(SymbolID id)
getMethodStubFile
public static String getMethodStubFile(SymbolID id,
Method method)
getMxType
public static String getMxType(String sidlType)
Generate an return string for the Matlab type mapping to
the specific SIDL Type. Currently supported SIDL types:
int, long, float, double, bool.
getObjectName
public static String getObjectName(SymbolID id)
Convert a SIDL symbol name into its object name -- for the purposes of
this package that means convert it into its typedef object name. The
typedef name is the SIDL symbol name with the "." scope separators
replaced by underscores.
id
- the SymbolID
of the Symbol
.
getSidlReturnType
public static String getSidlReturnType(Method method)
Generate a return string for the specified SIDL type.
getSymbolName
public static String getSymbolName(SymbolID id)
Generate the symbol name using the specified * symbol identifier.
Simply replace the "." to "_". name.
sourceFilename
public static String sourceFilename(Symbol symbol,
String modifier)
Return a string for the JNI native type corresponding to the specified
Java type. Everything that is not a primitive type like integer or
boolean is converted into an JNI object.
writeMexFunctionSignature
public static void writeMexFunctionSignature(LanguageWriterForC writer)