Primitive Functionality Definition

After defining the primitive interface model, save your changes. MLDesigner then generates the primitive source file that contains items for all model properties and definitions.

If there is already a primitive source file, the primitive properties and definitions that are defined by the primitive interface model are replaced by the properties of the new primitive interface model. All the other definitions like existing functionality are preserved.

The generated primitive source file serves as a template for the definition of the functionality. The primitive source files are written in the Ptolemy language and are identified by the extension .pl. For a detailed description see the Ptolemy Language Description.

The Ptolemy language has several language constructs for the definition of the primitive interface. All these constructs are generated using the information from the primitive interface model. Furthermore, the Ptolemy language has some constructs for the definition of methods that describe the functionality of the primitive. These methods are executed at different stages in the life cycle of primitive instances. For example, the Ptolemy language allows for the definition of methods that are executed at:

The functionality of these methods is defined using C++ code. The Ptolemy language only defines the method structure. You can edit the primitive source file using the primitive editor. To edit the source code choose Open Source from the context menu or click the Open Source icon on the toolbar.

The primitive editor provides syntax highlighting and all additional source code generated by changes made to the primitive within the Design window, will be formatted automatically. After making your changes, save the file using the Save icon. Since the primitive editor is simply a text editor, changes to the primitive source file do not affect the primitive interface model directly. Changes to open primitives using the MLDesigner GUI are visible in the Source code editor on saving.