All I really want to do is use a bunch of the same type of star, and somehow
assign a unique number to each instance of the star without the user having
to enter the unique number as a parameter on every star. I thought
accessing the OctHandle might be a way to do this. Right now I'm trying to
create a global integer variable that is initialized to 0 the first time
that type of star is accessed. Then if it is not the first time, the
variable is incremented through a C function call. But this seems to be
unusually difficult too. Any tips? Here are my C files that define the
function and initialization of the global variable:
------------------------ InitPath.h --------------------------------
#ifndef _InitPath_h
#define _InitPath_h
extern int GetUniquePath(void);
#endif
#ifndef UNIQUE_ID
#define UNIQUE_ID
int *unique = 0;
#endif
-------------------------- InitPath.cc ----------------------------
#include "InitPath.h"
int GetUniqueID(void) {
(*unique)++;
return *unique;
}
-------------------------------------------------------------------------
Then from the star I call the function
int starNumb = GetUniqueID();
to get a unique number, but every time ptolemy crashes as though I'm
stepping on memory.
Thanks again,
Beth Savoy
Corning, Inc
(607) 974-8813
> ----------
> From: Tom Lane[SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, February 24, 1999 11:35 AM
> To: Savoy, Elizabeth S
> Cc: 'Ptolemy Hackers'
> Subject: Re: icon tied to parameters
>
> "Savoy, Elizabeth S" <[EMAIL PROTECTED]> writes:
> > 1) I created a facet with a Tcl script star which calls a tcl file with
> one
> > of the following lines (I'm not sure what $name should be):
> > set myOctHandle [ptkOpenFacet /home/savoy/testFacet.TclScript]
> > set myOctHandle [ptkOpenFacet *this]
> > result: "invalid command name ptkOpenFacet"
>
> That seems like it should work --- not sure why you got that failure.
>
> However, it's unlikely that you want to manipulate Oct handles from
> within a star's script, anyway. By the time the star gets to run,
> the Oct facet has been compiled down into a set of Ptolemy stars and
> will no longer have any effect on the progress of the simulation.
>
> My guess is that you need to do whatever you have in mind by adding
> code to $PTOLEMY/lib/tcl/ptkControl.tcl ...
>
> regards, tom lane
>
----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list. Please send administrative
mail for this list to: [EMAIL PROTECTED]