Download Vol. 2 - Ptolemy 0.7 Programmer`s Manual

Transcript
1. Extending Ptolemy — Introduction ........................................ 1-1
1.1
1.2
1.3
1.4
1.5
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
File Organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Ptolemy environment variables 1-2
Directory Structure 1-3
Creating Custom Versions of pigiRpc . . . . . . . . . . . . . . . . 1-6
Creating a pigiRpc that includes your own stars 1-7
Creating a pigiRpc with more extensive customizations 1-8
Using mkPtolemyTree to create a custom Ptolemy trees. 1-9
mkPtolemyTree example 1-9
How mkPtolemyTree works 1-10
Combining mkPtolemyTree and pigiExample 1-11
Known Bugs in mkPtolemyTree 1-11
Using csh aliases to create a Parallel Software Development Tree
1-12
1.6
1.7
Aliases for Managing Symbolic Links 1-12
Creating a Duplicate Hierarchy 1-16
Source Code Control 1-18
Building standalone programs that use Ptolemy libraries.1-19
Standalone example using StringList 1-19
Standalone example that tests a Scheduler 1-20
Debugging Ptolemy and Extensions Within Pigi . . . . . . . 1-21
A quick scan of the stack 1-22
More extensive debugging 1-23
Debugging hints 1-25
2. Writing Stars for Simulation.................................................... 2-1
2.1
2.2
2.3
2.4
2.5
2.6
2.7
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Adding stars dynamically to Ptolemy . . . . . . . . . . . . . . . . . 2-1
The Ptolemy preprocessor language (ptlang) . . . . . . . . . . 2-3
Invoking the preprocessor 2-4
An example 2-4
Items that appear in a defstar 2-5
Writing C++ code for stars . . . . . . . . . . . . . . . . . . . . . . . . . 2-16
The structure of a Ptolemy star 2-17
Reading inputs and writing outputs 2-17
States 2-21
Array States 2-23
Modifying PortHoles and States in Derived Classes. . . . 2-26
Programming examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-26
Preventing Memory Leaks in C++ Code . . . . . . . . . . . . . . 2-28
3. Infrastructure for Star Writers................................................. 3-1
Ptolemy
Last updated: 10/17/97