Package ptolemy.data

Examples of ptolemy.data.ObjectToken


                // its vaule can be directly changed during execution
                // (e.g., in commit action of a modal controller), then this
                // variable is declared in the target language and should be
                // referenced by the name anywhere it is used.
                if (_codeGenerator._modifiedVariables.contains(result)) {
                    return new ObjectToken(_codeGenerator
                            .generateVariableName(result));
                } else {
                    // This will lead to recursive call until a variable found
                    // is either directly specified by a constant or it is a
                    // modified variable.
                    return new ObjectToken("("
                            + getParameterValue(name, result.getContainer())
                            + ")");
                }
            } else {
                return null;
View Full Code Here


                        // in the generated C code.
                        code.append("[(" + writeOffset + " + "
                                + (bufferSizeOfChannel - 1) + ")&"
                                + (bufferSizeOfChannel - 1) + "]");
                    }
                    return new ObjectToken(code.toString());
                }

                // try the format: inputPortNameArray
                found = false;
                channelNumber = 0;
                if (name.equals(inputPort.getName() + "Array")) {
                    found = true;
                    code.append(generateName(inputPort));
                    if (inputPort.isMultiport()) {
                        code.append("[0]");
                    }
                } else {
                    for (int i = 0; i < inputPort.getWidth(); i++) {
                        // try the format: inputPortName_channelNumberArray
                        if (name
                                .equals(inputPort.getName() + "_" + i + "Array")) {
                            found = true;
                            channelNumber = i;
                            code.append(generateName(inputPort));
                            code.append("[" + i + "]");
                            break;
                        }
                    }
                }
                if (found) {
                    int bufferSize = getBufferSize(inputPort);
                    if (bufferSize > 1) {
                        int bufferSizeOfChannel = getBufferSize(inputPort,
                                channelNumber);
                        String writeOffset = (String) getWriteOffset(inputPort,
                                channelNumber);
                        // '@' represents the array index in the parsed expression.
                        // It will be replaced by actual array index in
                        // the method visitFunctionApplicationNode() in
                        // ParseTreeCodeGenerator.
                        // Note here inputPortNameArray(i) in the original expression
                        // is converted to
                        // inputPortVariable[(writeOffset - i - 1
                        // + bufferSizeOfChannel)&(bufferSizeOfChannel-1)]
                        // in the generated C code.
                        code.append("[(" + writeOffset + " - (@)" + " + "
                                + (bufferSizeOfChannel - 1) + ")&"
                                + (bufferSizeOfChannel - 1) + "]");
                    }
                    return new ObjectToken(code.toString());
                }

            }

            // try variable
View Full Code Here

TOP

Related Classes of ptolemy.data.ObjectToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.