ptolemy.codegen.rtmaude.kernel
Class RTMaudeCodeGenerator

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.codegen.kernel.CodeGenerator
              extended by ptolemy.codegen.rtmaude.kernel.RTMaudeCodeGenerator
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ComponentCodeGenerator, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class RTMaudeCodeGenerator
extends CodeGenerator

RTMaude code generator.

Since:
Ptolemy II 8.0
Version:
$Id: RTMaudeCodeGenerator.java 59167 2010-09-21 17:08:02Z cxh $, $Id: RTMaudeCodeGenerator.java 59167 2010-09-21 17:08:02Z cxh $
Author:
Kyungmin Bae
See Also:
CodeGenerator, Serialized Form
Proposed Rating:
Red (kquine)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
(package private)  java.lang.String maudeCommand
          The default path of the Maude program.
(package private)  Parameter simulation_bound
          The bound (natural number) of steps to simulate a given model.
 
Fields inherited from class ptolemy.codegen.kernel.CodeGenerator
_codeFileName, _commandFlags, _commandOptions, _commandTemplate, _DEFAULT_TARGET, _eol, _executeCommands, _includes, _INDENT1, _INDENT2, _INDENT3, _libraries, _macros, _model, _modifiedVariables, _newTypesUsed, _postfireCode, _primitiveTypes, _sanitizedModelName, _tokenFuncUsed, _typeFuncUsed, allowDynamicMultiportReference, codeDirectory, compile, compileTarget, generateComment, generateCpp, generateEmbeddedCode, generatorPackage, inline, measureTime, overwriteFiles, padBuffers, run, sourceLineBinding, target
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
RTMaudeCodeGenerator(NamedObj container, java.lang.String name)
          Create a new instance of the RTMaude code generator.
 
Method Summary
protected  int _executeCommands()
          Execute the compile and run commands in the codeDirectory directory.
protected  java.lang.StringBuffer _finalPassOverCode(java.lang.StringBuffer code)
          Make a final pass over the generated code.
protected  java.lang.String _generateBodyCode()
          Generate the body code that lies between variable declaration and wrapup.
protected  java.lang.String _generateIncludeFiles()
          Generate include files.
 java.lang.String formatComment(java.lang.String comment)
          Return a formatted comment containing the specified string.
 java.lang.String generateMainEntryCode()
          Generate the main entry point.
 java.lang.String generateMainExitCode()
          Generate the main exit point.
 
Methods inherited from class ptolemy.codegen.kernel.CodeGenerator
_addActorIncludeDirectories, _addActorLibraries, _analyzeTypeConversions, _codeDirectoryAsFile, _generatePreinitializeCode, _generateSharedCode, _getHelper, _getHelper, _printExecutionTime, _printTimeAndMemory, _recordStartTime, _usage, _writeCode, _writeMakefile, addInclude, addLibrary, addLibraryIfNecessary, attributeChanged, codeGenType, comment, comment, containsCode, generateClosingEntryCode, generateClosingExitCode, generateCode, generateCode, generateCode, generateCopyright, generateFireFunctionCode, generateFunctionTable, generateInitializeCode, generateInitializeEntryCode, generateInitializeExitCode, generateInitializeProcedureName, generateLineInfo, generatePostfireCode, generatePostfireEntryCode, generatePostfireExitCode, generatePostfireProcedureName, generateTypeConvertCode, generateVariableDeclaration, generateVariableInitialization, generateVariableName, generateWrapupCode, generateWrapupEntryCode, generateWrapupExitCode, generateWrapupProcedureName, getCodeFileName, getComponent, getExecuteCommands, getMacros, getModifiedVariables, getOutputFilename, isPrimitive, isPrimitive, isTopLevel, main, parseArg, ptolemyType, reset, setCodeGenerator, setContainer, setExecuteCommands, splitLongBody, targetType
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

maudeCommand

java.lang.String maudeCommand
The default path of the Maude program. FIXME: Users may need to change this.


simulation_bound

Parameter simulation_bound
The bound (natural number) of steps to simulate a given model.

Constructor Detail

RTMaudeCodeGenerator

public RTMaudeCodeGenerator(NamedObj container,
                            java.lang.String name)
                     throws IllegalActionException,
                            NameDuplicationException
Create a new instance of the RTMaude code generator.

Parameters:
container - The container.
name - The name of the code generator.
Throws:
IllegalActionException - If the super class throws the exception or error occurs when setting the file path.
NameDuplicationException - If the super class throws the exception or an error occurs when setting the file path.
Method Detail

_generateBodyCode

protected java.lang.String _generateBodyCode()
                                      throws IllegalActionException
Description copied from class: CodeGenerator
Generate the body code that lies between variable declaration and wrapup. This method delegates to the director helper to generate a main loop.

Overrides:
_generateBodyCode in class CodeGenerator
Returns:
The generated body code.
Throws:
IllegalActionException - If there is no director.

generateMainEntryCode

public java.lang.String generateMainEntryCode()
                                       throws IllegalActionException
Description copied from class: CodeGenerator
Generate the main entry point.

Overrides:
generateMainEntryCode in class CodeGenerator
Returns:
Return the definition of the main entry point for a program.
Throws:
IllegalActionException - Not thrown in this base class.

generateMainExitCode

public java.lang.String generateMainExitCode()
                                      throws IllegalActionException
Description copied from class: CodeGenerator
Generate the main exit point.

Overrides:
generateMainExitCode in class CodeGenerator
Returns:
Return a string that declares the end of the main() function.
Throws:
IllegalActionException - Not thrown in this base class.

_generateIncludeFiles

protected java.lang.String _generateIncludeFiles()
                                          throws IllegalActionException
Description copied from class: CodeGenerator
Generate include files. This base class just returns an empty string.

Overrides:
_generateIncludeFiles in class CodeGenerator
Returns:
The include files.
Throws:
IllegalActionException - If the helper class for some actor cannot be found.

_finalPassOverCode

protected java.lang.StringBuffer _finalPassOverCode(java.lang.StringBuffer code)
                                             throws IllegalActionException
Description copied from class: CodeGenerator
Make a final pass over the generated code. Subclass may extend this method to do extra processing to format the output code.

Overrides:
_finalPassOverCode in class CodeGenerator
Parameters:
code - The given code to be processed.
Returns:
The processed code.
Throws:
IllegalActionException - If #getOutputFilename() throws it.

formatComment

public java.lang.String formatComment(java.lang.String comment)
Description copied from class: CodeGenerator
Return a formatted comment containing the specified string. In this base class, the comments is a C-style comment, which begins with "\/*" and ends with "*\/" followed by the platform dependent end of line character(s): under Unix: "\n", under Windows: "\n\r". Subclasses may override this produce comments that match the code generation language.

Overrides:
formatComment in class CodeGenerator
Parameters:
comment - The string to put in the comment.
Returns:
A formatted comment.

_executeCommands

protected int _executeCommands()
                        throws IllegalActionException
Description copied from class: CodeGenerator
Execute the compile and run commands in the codeDirectory directory. In this base class, 0 is returned by default.

Overrides:
_executeCommands in class CodeGenerator
Returns:
The result of the execution.
Throws:
IllegalActionException - Not thrown in this base class.