/** * Generate fire code for the Scale actor. * * @return The generated code. * @exception IllegalActionException If the code stream encounters an error in processing the * specified code block(s). */ protected String _generateFireCode() throws IllegalActionException { super._generateFireCode(); ptolemy.actor.lib.Scale actor = (ptolemy.actor.lib.Scale) getComponent(); String type = getCodeGenerator().isPrimitive(actor.input.getType()) ? "" : "Token"; _templateParser.getCodeStream().appendCodeBlock(type + "FireBlock", false); return processCode(_templateParser.getCodeStream().toString()); }
/** * Generate fire code for the Ramp actor. * * @return The generated code. * @exception IllegalActionException If the code stream encounters an error in processing the * specified code block(s). */ @Override protected String _generateFireCode() throws IllegalActionException { super._generateFireCode(); ptolemy.actor.lib.Ramp actor = (ptolemy.actor.lib.Ramp) getComponent(); String type = getCodeGenerator().codeGenType(actor.output.getType()); if (!getCodeGenerator().isPrimitive(type)) { type = "Token"; } CodeStream codeStream = _templateParser.getCodeStream(); codeStream.appendCodeBlock(type + "FireBlock"); return processCode(codeStream.toString()); }
/** * Generate fire code. The method reads in <code>fireBlock</code> from ElementsToArray.c, replaces * macros with their values and returns the processed code block. * * @return The generated code. * @exception IllegalActionException If the code stream encounters an error in processing the * specified code block(s). */ @Override protected String _generateFireCode() throws IllegalActionException { super._generateFireCode(); CodeStream codeStream = _templateParser.getCodeStream(); codeStream.append(super._generateFireCode()); ptolemy.actor.lib.ElementsToArray actor = (ptolemy.actor.lib.ElementsToArray) getComponent(); ArrayList args = new ArrayList(); args.add(Integer.valueOf(0).toString()); for (int i = 0; i < actor.input.getWidth(); i++) { args.set(0, Integer.valueOf(i).toString()); codeStream.appendCodeBlock("fillArray", args); } codeStream.appendCodeBlock("sendOutput"); return processCode(codeStream.toString()); }