Examples of this are the desire to use Ptolemy kernel classes such as
StringList or the need to isolate an obscure bug or memory leak. The $PTOLEMY/mk/standalone.mk file provides the make definitions to make this possible. This file provides make rule definitions to build various binaries some using the
Pure Sofware Inc.1 utilities.
The usage for this makefile is:
make -f $PTOLEMY/mk/standalone.mk stars.mk_variable_defs filename.suffixstars.mk_variable_defs is zero or more makefile variables used in $PTOLEMY/mk/stars.mk, such as SDF=1. filename is the base name of the file to be compiled, and the basename of the output file. and
suffix is one of the forms listed in table
1-1.
TABLE 1-1: Table of filename suffixes and binary types.
standalone.mk. To specify no Ptolemy libraries, use the make argument NOPTOLEMY=1. 1.6.1 Standalone example using StringList
For example, say you want to use the StringList class in a standalone program named bar.cc:
#include "StringList.h"
main() {
StringList testing = "This is a test\n";
cout << testing;
}
ln -s $PTOLEMY/mk/standalone.mk make.template-f $PTOLEMY/mk/standalone.mk as before.1.6.2 Standalone example that tests a Scheduler
Here is an example of a minimal file that can be used to call the setup in a Scheduler for instance. If the file testAcyLoopSched.cc contains:
#include "Galaxy.h"
#include "SDFStar.h"
#include "AcyCluster.h"
#include "AcyLoopScheduler.h"
#include "SDFPortHole.h"
main() {
// First create a simple galaxy and some stars.
SDFStar star[3];
Galaxy topGalaxy;
topGalaxy.setDomain("SDF");
topGalaxy.setName("topGalaxy");
topGalaxy.addBlock(star[0],"star0");
topGalaxy.addBlock(star[1],"star1");
topGalaxy.addBlock(star[2],"star2");
// Add ports to stars.
OutSDFPort p0,p1;
InSDFPort p2,p3;
// initialize the ports
p0.setPort("output1",&star[0],FLOAT,2);
star[0].addPort(p0);
p1.setPort("output2",&star[0],FLOAT,3);
star[0].addPort(p1);
p2.setPort("input",&star[1],FLOAT,3);
p3.setPort("input",&star[2],FLOAT,2);
star[1].addPort(p2);
star[2].addPort(p3);
// Connect `em up. The graph is
// star[1] (3) <--- (2) star[0] (3) ---> (2) star[2]
p0.connect(p2,0);
p1.connect(p3,0);
// Scheduling
AcyLoopScheduler sched;
sched.setGalaxy(topGalaxy);
cout << "No problem till now. Calling sched.setup()...\n";
sched.setup();
int i;
for (i = 0 ; i < 3 ; i++) {
cout << star[i].fullName() << "\n";
cout << "Repetitions = " << star[i].reps() << "\n";
}
StringList sch = sched.displaySchedule();
cout << sch;
}
USE_SHARED_LIBS=yes testAcyLoopSched.debug
Copyright © 1990-1997, University of California. All rights reserved.