コード例 #1
0
  /**
   * Reset the code generator.
   *
   * @exception IllegalActionException Not thrown in this base class, thrown by the parent if the
   *     container of the model cannot be set to null.
   */
  @Override
  protected void _reset() throws IllegalActionException {
    super._reset();

    _includes.clear();
    _libraries.clear();
  }
コード例 #2
0
 /**
  * Read in a template makefile, substitute variables and write the resulting makefile.
  *
  * <p>If a <code>.mk.in</code> file with the name of the sanitized model name, then that file is
  * used as a template. For example, if the model name is <code>Foo</code> and the file <code>
  * Foo.mk.in</code> exists, then the file <code>Foo.mk.in</code> is used as a makefile template.
  *
  * <p>If no <code>.mk.in</code> file is found, then the makefile template can be found by looking
  * up a resource name makefile.in in the package named by the <i>generatorPackage</i> parameter.
  * Thus, if the <i>generatorPackage</i> has the value "ptolemy.codegen.c", then we look for the
  * resource "ptolemy.codegen.c.makefile.in", which is usually found as <code>
  * $PTII/ptolemy/codegen/c/makefile.in</code>.
  *
  * <p>The makefile is written to a directory named by the <i>codeDirectory</i> parameter, with a
  * file name that is a sanitized version of the model name, and a ".mk" extension. Thus, for a
  * model named "Foo", we might generate a makefile in "$HOME/codegen/Foo.mk".
  *
  * <p>Under Java under Windows, your <code>$HOME</code> variable is set to the value of the <code>
  * user.home</code>System property, which is usually something like <code>
  * C:\Documents and Settings\<i>yourlogin</i></code>, thus for user <code>mrptolemy</code> the
  * makefile would be <code>C:\Documents and Settings\mrptolemy\codegen\Foo.mk</code>.
  *
  * <p>See the parent class {@link
  * ptolemy.cg.kernel.generic.program.ProgramCodeGenerator#_writeMakefile(CompositeEntity, String)}
  * for variable that are substituted by the parent class.
  *
  * <p>This class substitutes the following variables:
  *
  * <dl>
  *   <dt><code>@PTCGIncludes@</code>
  *   <dd>The elements of the set of include command arguments that were added by calling {@link
  *       #addInclude(String)}, where each element is separated by a space.
  * </dl>
  *
  * @param container The composite actor for which we generate the makefile
  * @param currentDirectory The director in which the makefile is to be written.
  * @exception IllegalActionException If there is a problem reading a parameter, if there is a
  *     problem creating the codeDirectory directory or if there is a problem writing the code to a
  *     file.
  */
 @Override
 protected void _writeMakefile(CompositeEntity container, String currentDirectory)
     throws IllegalActionException {
   _substituteMap.put("@PTCGIncludes@", _concatenateElements(_includes));
   super._writeMakefile(container, currentDirectory);
 }