public class RunnableCodeGenerator extends GenericCodeGenerator
GenericCodeGenerator.GeneratorPackageListParser
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
_runCommandDefault
The initial default value of the runCommand parameter.
|
protected java.util.Map<java.lang.String,java.lang.String> |
_substituteMap
Map of '@' delimited keys to values.
|
Parameter |
run
If true, then run the generated code.
|
StringParameter |
runCommand
The command to use to run the generated code if the
useMake parameter is false.
|
_codeFileName, _eol, _executeCommands, _generateInSubdirectory, _model, _sanitizedModelName, codeDirectory, generateInSubdirectory, generatorPackage, generatorPackageList, INDENT1, INDENT2, INDENT3, overwriteFiles
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
RunnableCodeGenerator(NamedObj container,
java.lang.String name,
java.lang.String outputFileExtension)
Create a new instance of the ProgramCodeGenerator.
|
Modifier and Type | Method and Description |
---|---|
protected int |
_executeCommands()
Execute the compile and run commands in the
codeDirectory directory.
|
protected void |
_reset()
Reset the code generator.
|
protected java.lang.String |
_runCommand()
Return the command to run the generated code.
|
protected java.util.List<java.lang.String> |
_setupCommands()
Return a list of setup commands to be invoked before
the run command.
|
protected void |
_updateSubstituteMap()
Update the substitute map for the setup and run commands
In this base class, @codeDirectory@, @modelName@
and @PTII@ are added to the map.
|
java.lang.Object |
clone(Workspace workspace)
Clone the attribute into the specified workspace.
|
java.lang.String[][] |
updateCommandOptions()
Return an updated array of command line options.
|
_copyCFilesTosrc, _copyCFileTosrc, _generateCode, _getAdapter, _getAdapterClassFilter, _getAutoGeneratedAdapter, _getOutputFilename, _instantiateAdapter, _isTopLevel, _printTimeAndMemory, _resetAll, _writeCode, _writeCodeFileName, attributeChanged, comment, createDecoratorAttributes, decoratedObjects, generateCode, generateCode, generateCode, generateCopyright, getAdapter, getCodeFileName, getComponent, getExecuteCommands, getMethodExceptionString, getMethodVisibilityString, isGlobalDecorator, main, setCodeGenerator, setContainer, setExecuteCommands
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
description, getContainer, getDisplayName, getFullName, getName, getName, setName
public Parameter run
public StringParameter runCommand
If the string "@help:all@" appears, then all the key/value pairs are echoed at run time, though this may not result in a syntactically correct command.
If useMake is true, then the value of this parameter is ignored.
protected static final java.lang.String _runCommandDefault
protected java.util.Map<java.lang.String,java.lang.String> _substituteMap
public RunnableCodeGenerator(NamedObj container, java.lang.String name, java.lang.String outputFileExtension) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of the ProgramCodeGenerator.outputFileExtension
- The extension of the output file.
(for example c in case of C and java in case of Java)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.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class GenericCodeGenerator
workspace
- The workspace for the new object.java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
protected void _reset() throws IllegalActionException
_reset
in class GenericCodeGenerator
IllegalActionException
- Not thrown in this base class,
thrown by the parent if the container of the model
cannot be set to null.public java.lang.String[][] updateCommandOptions()
updateCommandOptions
in class GenericCodeGenerator
protected int _executeCommands() throws IllegalActionException
_executeCommands
in class GenericCodeGenerator
IllegalActionException
- If there are problems reading
parameters or executing the commands.protected java.lang.String _runCommand() throws IllegalActionException
_updateSubstituteMap()
.IllegalActionException
- If the there is a problem
substituting the @...@ tags.protected java.util.List<java.lang.String> _setupCommands() throws IllegalActionException
IllegalActionException
- Not thrown in this base class.protected void _updateSubstituteMap() throws IllegalActionException
IllegalActionException
- Not thrown in this base class,
Derived classes should throw it if there is a problem parsing
a value.