SCCS works best for ASCII files because it stores the difference between incremental changes. Binary files are supported, but each version requires a new copy, so the size of each corresponding SCCS history file will grow linearly with the number of versions.
Each SCCS file can only be checked for editing by one user via the Unix command
sccs edit filenameTo get a read-only copy of the latest version of a file, use the command
sccs get filenameOne can retrieve an older version x.y and save it to filex.y by the command
sccs get -rx.y -p filename >filex.yOne can back out of the most recently submitted change to a file by removing it:
sccs rmdel -rx.y filenameTo view a history of the different versions of an SCCS file, use
sccs prs -e filenameTo see what files are being edited in the current directory, use
sccs info
SCCS has two drawbacks:
chmod a+x
Ptolemy developers should have their own development trees with links that point to the SCCS directories in the development version. Please do not use SCCS when you are logged in as ptuser. The reason is that if you use SCCS when you are ptuser, then it is impossible to determine who made the changes. The environment for ptuser has been modified so that ptuser cannot check out files from SCCS for editing.
If you only need to make a minor change, such as fixing a comment, to the following, as yourself, in your own directory:
sccs -d ~ptdesign/mk edit common.mkOnce you've made your change, just use the "-d" option to sccs to check your changed file back in.
Continuing with the above example:
sccs -d ~ptdesign/mk delta common.mk
You can always use sccs as yourself in your own directory by using the PROJECTDIR environment variable or the "-d" option to sccs. For example, to list checked-out files and update the file common.mk:
% setenv PROJECTDIR ~ptdesign/mk % sccs info % sccs edit common.mk ... % sccs delta common.mk % unsetenv PROJECTDIRor
% sccs -d ~ptdesign/mk info % sccs -d ~ptdesign/mk edit common.mk ... % sccs -d ~ptdesign/mk delta common.mkTo check in a new file:
sccs create -fi newfile.cThe
-fi
option will have SCCS check to make sure that you
have included SCCS identifier strings in the file.
After you edit a file and check it in, you can set up your makefiles to
update the file's version to the latest one available under SCCS.
For more information, refer to the man page for sccs.
You can print the contents of a file to stdout with the version id for each line prepended with:
sccs get -p -m myfile.ccThis is very useful when you are trying to track down what change modified a specific line of a file.
ptolemy
group and group
writable with the group stickbit set. Here is a proper example.
ptuser
and doing:
For more information about Purify, see
The makefiles in the $PTOLEMY/obj.$PTARCH/pigiRpc
have automated the inclusion of Purify into the Ptolemy binaries.
Generally, one just has to say
cd $PTOLEMY/obj.sol2/pigiRpc make pigiRpc.ptrim.purify setenv PIGIRPC $PTOLEMY/obj.$PTARCH/pigiRpc/pigiRpc.debug.purify pigi &or, if you want to investigate where in the source code the memory leaks are incurring in an interactive fashion, build
cd $PTOLEMY/obj.sol2/pigiRpc make pigiRpc.ptrim.debug.purify setenv PIGIRPC $PTOLEMY/obj.$PTARCH/pigiRpc/pigiRpc.ptrim.debug.purify pigi -debug &The latter command will create a Vem window, a demo palette window, a window shared by the GNU debugger and the Ptolemy console, and a Purify window.
Purify will report memory leaks and violations as they happen, and you can use the GNU debugger to examine the leak or violation when it occurs. When the GNU debugger starts, give it the command
break purify_stop_hereThis will cause the GNU debugger to stop whenever a memory leak or violation occurs. To set a purify watch point, in gdb do:
print purify_watch_n(char *addr, unsigned int size, char *type)where,
addr - the address of the mem location to watch size - number of bytes to watch starting at addr type - one of "r" "w" "rw"The print command will return the purify watch point number. To remove a watch point:
print purify_watch_remove(#)or to remove all watch points:
print purify_watch_remove_all()
We have used Purify to fix approximately 1000 memory leaks and violations
between the Ptolemy 0.5.2 and Ptolemy 0.6 releases.
Even so, there are still many memory leaks and violations that
remain in Ptolemy.
You can ignore the memory leaks and violations in the graphical
user interface (pigilib).
You can also ignore the memory leaks and violations that Purify
reports in X window routines, standard C library routines, and so forth,
because we cannot fix them.
You can supress the reporting of certain memory leaks and violations
by defining a ~/.purify
file, e.g., see
/users/ptdesign/.purify
.
When you exit Ptolemy, Purify will backtrack over the memory that
has not been deallocated and report them as errors.
Purify will report about 20 messages per domain that CGTarget
is leaking memory:
MLK: 91 bytes leaked in 9 chunks This memory was allocated from: malloc [rtlib.o] __builtin_new [libgcc.a] __builtin_vec_new [libgcc.a] NamedNode::NamedNode(void*,const char*) [miscFuncs.h:90] NamedList::append(void*,const char*) [NamedList.cc:72] CGTarget::addStream(const char*,CodeStream*) [CodeStreamList.h:51]These leaks are due to static declarations of instances of targets, e.g. in the CGC domain,
static CGCBDFTarget proto("bdf-CGC", "CGCStar", ... static CGCMakefileTarget targ("Makefile_C","CGCStar", ... static CGCMultiTarget targ("unixMulti_C","CGCStar", ... static CGCNOWamTarget targ("CGCNOWam","CGCStar", ...The constructors of these static instances create dynamic memory. However, the static instances are never destroyed (because they themselves are not dynamic) so Purify reports a memory leak.
Purify should detect violation in Tcl variables and procedures, but it does not. If you define a Tcl star in Ptolemy, for example, that creates a global variable "fred$starID", then you must unset this variable in the star destructor. Otherwise, you've created a memory leak. If you don't want to hassle with this, then use the recommended array mechanism for Tcl stars: define ${starID}(fred). The base class takes care of freeing the array $starID.
cd ~ptdesign/obj.sol2/octtools/vem make CC="/usr/tools/bin/purify cc" mv vem.debug ~ptdesign/octtools/bin.sol2/vem.debugpurify setenv VEMBINARY ~ptdesign/octtools/bin.sol2/vem.debugpurifyApparently, if the binary is nameed vem.debug.pure, then you will get an error message about a bad default (autosave) upon startup. See Debugging Vem for more information.
Purify will produce a lot of warnings, you may find it useful to have a ~/.purify file that contains at least the following to filter out memory leaks from the X library:
suppress umr writev; _XSendClientPrefix; XOpenDisplay suppress umr XNextEvent; Tk_DoOneEvent suppress umr XDrawString suppress umr XTextExtents suppress umr _XUpdateGCCache; XCreateGC suppress umr _XSendClientPrefix; XOpenDisplay suppress umr _XFreeExtData; XFreeGC suppress umr write; _XFlush suppress umr write; _XFlush suppress umr writev; _XSendYou may also want to add the following to your ~/.purify file to filter out warnings generated by pigilib, the clunky interface between Tcl/Tk and Vem/Oct plus three others:
suppress umr RPCSendOctObject ; octOpenRelative suppress umr RPCSendOctObject ; octGetOrCreate suppress umr RPCSendOctObject ; octCreate suppress umr RPCSendOctObject ; octCreateOrModify suppress umr RPCSendOctGenerator suppress umr RPCoctInitGenSpecial suppress mlk RPCReceiveString suppress plk malloc; RPCReceiveString suppress umr ptkRun ; RpcRun ; ptkRPCFileHandler suppress umr InitKeymapInfo suppress umr qckBoot suppress umr qckGetY
PureLink addresses the problem of long link times and significantly improves the throughput on executable program generation after an edit-compile cycle."
Note that with shared libraries, we no longer need to use Purelink under Solaris.
Purelink has manpage.
To link pigiRpc with purelink :
cd ~ptdesign/obj.sol2/pigiRpc make LINKER="/usr/tools/bin/purelink -collector=/users/ptdesign/vendors/bin/ld-collect-2.4.3 g++"
Quantify has manpage.
See /usr/sww/doc/Pure/pure.doc
for a simple quantify demo.
To build a quantify pigiRpc.debug, try:
cd ~ptdesign/obj.sol2/pigiRpc make pigiRpc.debug.quantify
Purecov has manpage.
See /usr/sww/doc/Pure/pure.doc
for a simple purecov demo.
To build a purecov pigiRpc.debug, try:
cd ~ptdesign/obj.sol2/pigiRpc make pigiRpc.debug.purecov
/usr/sww/doc/Pure/pure.doc
for some hints.
limit descriptors 128
To see what your limits are, type: 'limit'
In cg/ddfScheduler, quantify fails to process libcgddf.so
The two files CGDDFScheduler.o and CGRecurScheduler.o are necessary to replicate the bug. If I create a shared library with:
However, if CGRecurScheduler is compiled without -O2, then quantify works. Compiling with the -O option or with no optimization at all works fine.
My guess is that there is a bug in GNU's optimizer. CGRecurScheduler defines a class that uses multiple inheritance, I'm not surprised that there is a bug.
I've submitted a bug report to Pure Inc. I also upgraded our installation of quantify from 2.0 to 2.0.1
So, in the unlikely event (of a water landing :-) that you are quantifying a full pigiRpc, you will have to build CGRecurScheduler.o with -O, install a new libcgddf.so and re run quantify.
RPATH
in a file. You may see something like:
$PTOLEMY/gnu/$PTARCH/lib
to
your LD_LIBRARY_PATH
before attempting to run demos
that multilink.
thestring = new char[buflen];This code should be
delete [] thestring; thestring = new char[buflen];In writing stars, the delete operator should be applied to variables containing dynamic memory in both the star's setup and destructor methods, and in the star's constructor method, the pointers to dynamic memory should be initialized to zero. By freeing up memory in both the setup and destructor, you cover the cases when (1) the user stops and restarts a simulation and (2) the user exits a simulation, respectively.
savestring( expandPathName(s) )is redundant and should be simplified to
expandPathName(s)to avoid a memory leak.
char* localstring = new char[len + 1]; if ( dude == bogus ) return; strcpy(localstring, otherstring); delete [] localstring; return;could easily return without deallocating localstring. The code should be rewritten to use either the StringList or InfString class, e.g.,
InfString localstring; if ( dude == bogus ) return; localstring = otherstring; return;There are casts defined that will automatically convert StringList to a const char* and InfString to a const char* or a char*, so that instances of the StringList and InfString classes can be passed into routines that take string arguments. You should use StringList when you want a list of strings, and InfString when you want a string of unbounded size. Now, when the function or method exits, the destructors of the StringList and InfString variables will be called which will automatically deallocate their memory.
It is tempting to use constructs like
char localstring[buflen + 1];in which buflen is a variable, instead of StringList and InfString classes, but this syntax is a GNU extension and not portable to other C++ compilers.
puts( savestring(s) );
PTARCH
s: sol2.cfront
,
sol2.5.cfront
and hppa.cfront
.
One of the problems with the non-g++ compilers is that
make depend
may not work right. This means that
you should first do "make sources" with
PTARCH=sol2
in the source tree before attempting
a non-g++ build.
To build with sol2.cfront as ptuser
setenv PTARCH sol2.cfront set path = ( $PTOLEMY/bin.$PTARCH /usr/lang $path) cd ~ptdesign MAKEARCH make install >& ~ptdesign/logs.cfront/installTodaysDateCfront is an excellent way to catch bugs that g++ will not catch. Note that cfront .o files and g++ .o files are not compatible.
If you want to just test out building a few files, you can do:
make PTARCH=sol2.cfrontDon't forget to remove the .o files when you are done, lest you poison your binaries. One good way to avoid this problem is to create the cfront .o files in your src directory, and then remove the .o file when you are done.
General rule for when to re-run make depend:
If you change an #include line in any file (add one or remove one), at least some of the dependencies are going to be out of date. If the changed #include line is in a .cc file, re-running make depend just in that source directory is enough. If it is in an .h file, you'll have to re-run make depend also in all directories that might have files that include that .h file: if in doubt, do it from the top.
Symptoms that "make depend" may be the problem: mysterious crashes where virtual function calls seem to go off into hyperspace or call the wrong function.
Edward says:
Note that there are many changes you can make to a star.pl file that, in effect, cause a new #include to appear in the .cc or .h file. For instance, adding a new state of some new type. So if you do such changes, its a good idea to run "make depend" in the directory where the star is defined. Just there should be enough.
Note that make depend
on non-g++ platforms can fail,
you should always run make depend
with the
g++
compiler.
make pigiRpc.debugor
make ptcl.debugrespectively.
Alternatively, to debug hppa.cfront code, one can use the hppa debugger 'xdb'
To debug with xdb, "The support module /usr/lib/end.o must be included as the last object file linked, except for libraries included with the -l option to ld (see ld(1))." To build an xdb pigiRpc.debug:
make SYSLIBS="-lm /usr/lib/end.o" pigiRpc.debugThe ~ptdesign/bin/pigiEnv.csh has been modified so that if the -debug flag is present ant the architecture is hppa.cfront, then xdb is used, rather than gdb.
$PTOLEMY/octtools/bin.$PTARCH
should contain two
binaries, vem
and vem.debug
.
I've modified the pigiEnv.csh script so that you can determinie
which vem is run by setting an environment variable, VEMBINARY
.
Usually pigiEnv.csh will run $PTOLEMY/bin.$PTARCH/vem
.
To run a debug version of vem, set the VEMBINARY
variable with:
If you are having problems with bindings or fonts while running
vem.debug
, then you may need to rename the
vem.debug
binary to vem
to get the right
resources. The default octtools installation creates a link for you
at $PTOLEMY/octtools/bin.$PTARCH/debug/vem
for you.
If you are custom building a vem, you could try making a private
link from from vem
to vem.debug
:
One potential fix to this would be to change the Xresource
defaults from vem*
to Vem*
. See bug
vem/296: Setting VEMBINARY to vem.debug results in bogus Xresources
for more information.
If you create a core file with vem.debug
, use gdb to get a
backtrace:
You may find it helpful to use the 'dir' command inside gdb to set the path that gdb looks for sources with:
Here's how to [debug with gdb from within emacs] with pigi code.
Set your PIGIRPC to point to a pigiRpc.debug (or some other image that has debugging info). Start pigi *without* specifying debugging.
Now, what you need to know is the process ID of the pigiRpc process. This number will appear in the vem window when the startup window pops up, in the form
Version:For example, I just fired it up and got a process ID of 10622. Now, in emacs, type ESC-x gdbcreated Running ,
attachIn my case I would type
attach 10622This attaches gdb to the pigiRpc process. The pigiRpc process will be stopped; you can set breakpoints, examine variables, or re-start the process by typing the "continue" command (or just "c") to gdb.
To find out more about the gdb mode, try
M-x info Then type: m emacsThen go down to:
Running Debuggers Under Emacs * Starting GUD:: How to start a debugger subprocess. * Debugger Operation:: Connection between the \ debugger and source buffers. * Commands of GUD:: Key bindings for common commands. * GUD Customization:: Defining your own commands for GUD.The GUD mode command:
`C-c C-l' `C-x C-a C-l' Display in another window the last line referred to in the GUD buffer (that is, the line indicated in the last location message). This runs the command `gud-refresh'.Is quite useful
Tom points out:
I modified the "pigiRpcDebug" script so that if you define an environment variable PT_DEBUG, then that program will be used instead of just running gdb inside an xterm. I also installed a script "ptgdb" in ~ptdesign/bin that will run gdb inside emacs. So if you "setenv PT_DEBUG ptgdb" then you'll be all set.Note that the documentation for gdb says the following:I'm still looking at mxgdb and xxgdb, but they seem to be a bit too buggy to be useful. William Li mentioned that there is a Tk interface to gdb, but I haven't had time to look for it.
*Warning:* GDB runs your program using the shell indicated by your `SHELL' environment variable if it exists (or `/bin/sh' if not). If your `SHELL' variable names a shell that runs an initialization file--such as `.cshrc' for C-shell, or `.bashrc' for BASH--any variables you set in that file affect your program. You may wish to move setting of environment variables to files that are only run when you sign on, such as `.login' or `.profile'.
StringLists
printStringList
function call does not print out the
contents of a StringList
, it dumps core. Jose Pino
suggests the following solution below.
The function printStringList
looks like:
I have written and tested the two functions:
The first thing we tried was recompiling the kernel with out
optimization:
cd $PTOLEMY/obj.$PTARCH/kernel; make clean; make OPTIMIZER= install
The problem persisted.
The code looked like:
break FileParticle::initParticleStack
and then run the program, it would stop inside NamedObj.h
.
This
seems bogus, but the first line of FileParticle::initParticleStack
is:
StringArrayState
inherits from
StringState
which inherits from State
which
inherits from NamedObj
. So, the first code that gets
executed in FileParticle::initParticlStack
is the
NamedObj
constructor which makes sense.
If we set a break point at line 102, then gdb would actually stop at line 101. I think the problem might have to do with having the bracket at the end of the line, rather than on a separate line. If we change:
The next weird problem was that the execution of the program seemed to jump around in a non-sequential fashion, even if the program was compiled with the optimizer off. What was happening was that we would hit
The problem here is that we are declaring an int part way through the block, and I think g++ is reordering things to that the int is actually declared at the top of the block. Personally, I prefer to see variables declared at the top of a block, rather than in the middle. Changing the code to
$PTOLEMY
is set to what you thing
it is set to If you are building binaries in your private
tree, be sure that $PTOLEMY
is set to your
private tree and not ~ptdesign.
$LD_LIBRARY_PATH
does not include
libraries in another ptolemy tree. You could do
unsetenv $LD_LIBRARY_PATH
$PTOLEMY
and
$LD_LIBRARY_PATH could be different. Inside gdb, use
show env PTOLEMY
to see what it is set to. This
problem is especially common if you are running gdb inside
emacs via ptgdb.
rm myfile.o; make OPTIMIZER= install
Then rebuild your pigiRpc
stepi
to step by instructions, rather than
step
.
If you are spending a lot of time debugging a problem, you may want to use ptcl instead of pigiRpc, as ptcl is smaller and starts up faster. Also, you can keep your breakpoints between invocations of ptcl, as debugging ptcl does not start up a separate emacs each time. However, ptcl cannot handle demos that use tk or hof. Here's how to use ptcl to debug.
~/pigiLog.pt
file. Note the number of iterations
for the universe, and then exit pigiRpc
~/pigiLog.pt
to somewhere. I suggest something
like /tmp/tst.tcl
. Use a short filename here
since you may be typing it alot, and don't use something
inside your home directory as you can't easily use
~
inside ptcl. If the file is named
~cxh/t.tcl
, then I would have to type
/users/cxh/t.tcl
, which is a lot longer than
/tmp/t.tcl
run
XXX line and a
wrapup
line at the end. If the demo should run
for 100 iterations, then add:
ptcl.ptiny.debug
.
/users/cxh/pt/obj.sol2/ptcl/ptcl.ptiny.debug
You can then set breakpoints in the gdb window, then type
r
to start the process, and then source your demo
with: source /tmp/tst.tcl
If you want to recompile your demo outside of gdb and then reload
it into your gdb session, use the file command inside gdb
/usr/sww/lib/emacs-18/lisp/elib /users/parks/lib/elisp
(require 'pt-compile) (setq compile-command (pt-default-compile-command))
(load "pt-browse")in your .emacs file. The ~ptdesign/src/makefile still needs a little work, but I did build a TAGS table in ~ptdesign/src by hand. I think I'll define a TDIRS variable that specifies which subdirectories should have TAGS tables. Once this works, then there should be nightly jobs to rebuild the tables.
The TAGS file is built with a special version of the etags program, installed as etags++ on sww. It does not like some of the files in ptdesign. I think that is is possible to concatenate small TAGS files to create larger ones, so it may not be too hard to add a TAGS target to the makefiles in ptolemy.
For more documentation, view the file /usr/sww/share/lib/info/c++-browse with info or tkinfo.
See also tycho class browser docs.
2#includeTry compiling the file with gcc -v and -H flags turned on. -v tells you what steps the compiler is running, -H tells you what include files are being run.main() { cout << "Hello, Ptolemy.\n"; }
gcc -v -H hello.ccLook at each step of the compile, and pay particular attention to the assembler and loader steps.
You can use the -save-temps gcc option to save any temporary files created in each step. Then, if necessary, you can try running each step by hand.
You can pass the collector arguments so that it will print out more information. Try
g++ -v -Wl,-debug hello.ccor:
make LINKER="g++ -v -Wl,-debug" PURELINK=The collector will also respond to certain environment variables, see the source in ~ptolemy/src/gnu/src/gcc/collect2.c
collect creates a temporary file that has the constructors and destructors in it. To get collect to save the temporary file, set the following environment variable:
setenv COLLECT_GCC_OPTIONS -save-temps
If the collector is getting an old version of GNU nm, then you could have problems
setenv GCC_EXEC_PREFIX $PTOLEMY/gnu/$PTARCH/lib/gcc-lib/$PTARCH/2.5.8/ setenv C_INCLUDE_PATH $PTOLEMY/gnu/$PTARCH/lib/gcc-lib/$PTARCH setenv CPLUS_INCLUDE_PATH $PTOLEMY/gnu/$PTARCH/lib/g++-include:$PTOLEMY/gnu/$PTARCH/$PTARCH/include setenv LIBRARY_PATH $PTOLEMY/gnu/$PTARCH/libSee the gcc info format file for a complete list of environment variables. Note that GCC_EXEC_PREFIX must have a trailing /
If, under gcc-2.5.8, you get warnings about 'conflict with built in declaration', and your compiler is not installed where it was built, you may need to create a link in your gcc-lib. If you compile the file with the -v option, you can see what directories it is including. You could try creating a link:
(cd $PTOLEMY/gnu/$PTARCH/lib/gcc-lib/$PTARCH/2.5.8; ln -s .. $PTARCH)
gcc -v -save-tempsthen you can try running trace on the various steps, and see each system call. Unfortunately, the filenames are truncated, but often this is enough to see what's going on.
The gcc -E and -P options are very useful in wading through include file problems. -E stops compilation after the C preprocessor runs, and outputs the resulting file. -P strips off the line numbers from the output.
cxh@dewitt 18% make OPTIMIZER=-E Linker.o > Linker.e cxh@dewitt 19% ls -l Linker.e -rw-r--r-- 1 cxh 68392 Jun 15 09:06 Linker.e cxh@dewitt 20%
make OPTIMIZER="-E -P" Linker.o > tst.ccEdit tst.cc and remove the first line, which will have the gcc command in it. Make tst.o
make OPTIMIZER="-v -H" tst.oIf you are getting weird substitutions this will help.
/users/ptdesign/src/gnu/g++-FAQ.txt
/usr/sww/doc/faq/c.faq
/usr/sww/doc/faq/c++.faq
/usr/sww/doc/faq/hpux.faq
/usr/sww/doc/faq/Sun/solaris2.faq
/usr/sww/doc/faq/Sun/solaris2_porting.faq
/usr/sww/doc/faq/Sun/sun_sysadmin.faq
For example, if there was an undefined symbol, called __MyMissingSymbol, during the pigiRpc link.
nm -o $PTOLEMY/lib.$PTARCH/* | grep __MyMissingSymbolIf you find the missing symbol, then go to that library and try reinstalling it. That will often solve the problem.
Copy the link command into a separate tmp file, edit the tmp file so that only the .o files remain, and add 'nm -o' to the beginning
If the link command is
g++ -L../../lib.sol2 -Xlinker -S -Xlinker -x -static pigiMain.o \ defpalettes.o ../ptcl/PTcl.o ../../lib.sol2/sdfstars.o \ ../domains/cgc/targets/main/CGCBDFTarget.o -L../../octtools/lib.sol2 \ -lsdfimagestars -lImage -lsdfdspstars -lsdfstars -lLS -lsdf \ -lsdfmatrixstars -lsdftclstars -lrpc -lpigi -lptk -lgantt -lptolemy -loh \ -lrpc -llist -ltr -lutility -lst -lerrtrap -luprintf -lport \ -L../../tcltk/tk.sol2/lib -ltk -lXpm -L../../tcltk/tcl.sol2/lib -ltcl \ -L/usr/X11/lib -lX11 -lg++ -lm version.othen edit this down to:
nm -o \ pigiMain.o defpalettes.o ../ptcl/PTcl.o ../../lib.sol2/sdfstars.o \ ../domains/cgc/targets/main/CGCBDFTarget.o version.oIf you have problems with line length and vi, then either use Emacs, or use backslashes to break up the line into multiple lines.
One could write a makefile that automates this.
sh ~/nmit | grep __MyMissingSymbolLook for files that contain the undefined reference.
You may find it useful to see what steps the linker is taking. For instance, the linker might be accessing different library files than what you think. A common error is to be accessing the libg++.a file from an old version of libg++.
Note that the name mangling scheme differs for different compilers. So you need to use a different c++filt for Cfront and GNU compilers. /usr/sww/bin/c++filt should work with GNU compilers. Be sure you are using the right c++filt with the right compiler. Locally, /usr/lang/c++filt might be in your path before /usr/sww/bin/c++filt
If your symbol has special characters, you may need to place it in quotes.
ptuser@babbage 22: echo '__$_4KUIM' | /usr/sww/bin/c++filt KUIM::~KUIM(void)Note also, that the mangling scheme in GNU compilers changes between versions of the compiler, so c++filt might not be able to figure everything out.
c++filt can be found in the GNU binutils distribution.
Under Suns running SunOS4.1.3 with GNU C and C++ (ARCH=sol2):
cd $PTOLEMY/obj.sol2/ptcl make LINKER="g++ -v -Wl,-debug -Wl,-t" PURELINK=Under Sun cfront, the following will tell you what files ld is processing.
cd $PTOLEMY/obj.cfront/ptcl make ARCH=cfront LINKER="CC -qoption ld -t -v -V"
On tereza, you will have to do your testing in the ~ptolemy directory and hope for the best, as tereza is not mounting /scratch.
If you have an aniljain account, then you should work from it. On both aniljain and tereza, if you don't have your own account, you should work as ptuser, not as ptolemy. For best results, try setting the path:
set path = ($PTOLEMY/bin /usr/bin /usr/ucb /bin .)
sdf/multirate: barfs on 'broken' sdf/signalProcessingSystems: barfs on 'animatedLMS' sdf/matrix: barfs on MatrixTest1 (crashes pigiRpc) cgc/multirate: barfs on filterBank
setenv GCC_EXEC_PREFIX $PTOLEMY/gnu/$PTARCH/lib/gcc-lib/$PTARCH/2.5.8/ setenv C_INCLUDE_PATH $PTOLEMY/gnu/$PTARCH/lib/gcc-lib/$PTARCH setenv CPLUS_INCLUDE_PATH $PTOLEMY/gnu/$PTARCH/lib/g++-include:$PTOLEMY/gnu/$PTARCH/$PTARCH/include setenv LIBRARY_PATH $PTOLEMY/gnu/$PTARCH/lib
(cd ~ptolemy; gfind . -xdev -size 0 -ls)or
(cd ~ptolemy/src; make checkjunk)
Star classWhen you are referring to the generic term star (vs. the class), don't capitalize
starStar and star will be two separate index entries. Also, we should avoid plurals.
starnot
starsAlso, when you give a method, do it like this:
Star:print methodThis will make an index subentry. Not:
Star::print()Nor:
print methodThe following would be OK, if you have reason for it:
print method:in Star class
We use specialized markers to indicate the different types of
indexes. The markers are renamed in the
$FMHOME/fminit/usenglish/Maker.us
file. If Framemaker is
updated on the Software Warehouse, then you will need to build a dummy
tree locally so that we can modify this file. Usually the tree is in
/opt
and the FMHOME
variable is set to that
directory. To build the tree, as root you could do something like:
Maker.us
. Below are the diffs:
5-9
is the cross
reference, and the anchor should be just after the
cross reference. Note that you have to create the
figure before creating the cross reference.
figure
paragraph that describes the figure.
The cross reference will refer to this paragraph
Control-P
to bring up the Ptolemy print
window. Then print your facet to a file. In the
final results, you probably want to have each icon
about 1/2 inch on a side. If you save the facet after
printing it, your offsets will be saved on disk. Note
that because of a bug in pigi, upon exiting you will
not be prompted to save your facet, you will need to
remember to save it yourself.
Special->Anchored Frame
#include
/users/ptdesign/src/domains/sdf/demo/init.pal.ps
Format->Customize layout->Customize
Text frame
, select the Postscript code
box
fixframeps
and then
ghostview
figure
format.
From: Tom Parks
If you want to document a demo for the World Wide Web (WWW),
then first have a look at the demos that are already
installed. Start at the Ptolemy home page
To create your own document, create a new directory to keep
all your files in. You'll need a HTML file, a screen dump of
the facet, screen dumps of plots, and and sound files that are
generated. Once you have it ready, let me know where to find
it, and I'll install it on the FTP site.
I have installed the script "xgif" in ~ptdesign/bin. It
passes any command line arguments to xwd (I suggest you read
the man page for xwd) then converts the window dump into a GIF
file and writes it to stdout. If you want to make a movie,
talk to me and I can give you some help.
Tom's tips:
Here are some tips I have figured out in the process of preparing
scanned images for my WWW home page.
When I scan an image, I adjust the resolution (dpi) so that
the image will be between 500 and 1000 pixels in the larger
dimension. Keep in mind that your screen is probably
1152x900, so there isn't any point in making really huge
images. I save the scanned images as 24-bit color TIFF files,
then use FTP to transfer them from the Macintosh to my
workstation. Then I use xv to convert the file to JPEG and
save it with the default quality setting of 75. JPEG offers
about 30 to 1 compression with very little loss of quality. I
find that the artifacts from quantizing the color map to 8-bit
color for display are much more dramatic than the losses in
JPEG coding. At this point I discard the original TIFF file
and the JPEG file becomes my "master" copy.
Because JPEG images cannot be included inline with HTML (but
they can still be used with external viewers), it is necessary
to create a GIF format version of your image. The goal for
inline images is to make the file as small as possible so that
it won't take too long to download over the net. I suggest
that you crop your image and shrink it by a factor of 4 or
more, then save it as a *reduced color* GIF. The reduced
color option saves space, and it doesn't really degrade the
image because Mosaic only reserves a small number of colors
for inline images anyway.
The URL to access the Ptolemy front page is:
When I generate a patch, I always try running it on the
original source to make sure it works. Note that the ptolemy
source has some links in it which means that some files end up
in the patch twice (ddf/cg and tech/ptolemy are two
offenders). If a file is in the patch twice, then the second
time you will be asked if you want to reverse the patch.
Merely edit the patch file by hand and remove the second diff.
Any version of diff should work, the key thing is to use the
-c flag, which causes the lines around the line that is
different to be printed. I guess I do use GNU diff, but
anything should work.
Between release, we may end up producing patches to fix bugs,
or provide enhancements.
The patches should be applied in order. If a user needs
patch3, then they should apply patch1 and then patch2.
~ptolemy/adm/gen-0.5/makefile contains targets to produce
patches. ~ptolemy/adm/gen-0.5/mkpatch is a shell script that
will produce a context style patch. See the makefile for
usage.
mkpatch automatically includes changes to pigiRpc/makefile
that reflect the new patch number.
Before releasing a patch, you should test it out on as many
platforms as possible.
When you build a patch, you may want to rebuild the binaries
and create a tar file with the new binaries. The name of the
tar file should be something like pt-0.5p1.sol2.tar.Z
If at all possible, we should never replace files in a ftp tar
file without changing the name to something else.
If you move ~ptolemy to point to the version on sww, be sure
that the .forward file in the new location is the same as the
.forward file in the old location. Also check that the .plan
file is the same in both locations.
Some users depend on .o files in ~ptolemy/obj.sol2, so it
would be nice if that directory was present in the new tree.
To move ~ptolemy you will need root permission:
If you are on a non GNU compiler, try looking at the cpp man
page for hints about what symbols are predefined. If
necessary, you can pass the compiler a symbol from your
config-$PTARCH.mk file (i.e. CCFLAGS=-DMYARCH).
For SystemV architectures, adding -DUSG -DSYSV to CCFLAGS in
config-$PTARCH.mk could help.
(Of course, all the compat.h stuff are merely guidelines)
Then build tcltk.
Then try to build what is necessary to build a SDF and DE only
ptcl (kernel, ptcl, domains/de domains/df). The try a
complete build.
Eventually, we should use the GNU autoconfig tool, which would
allow us to use defines like -DHAS_FOO, instead of depending
on #if defined(mynewarch).
If you use EPS in a Frame doc that will be part of the Ptolemy
distribution, you should add rules to the appropriate makefile
that will run fixPS on your Postscript file. For example,
cg56.ps and cg96.ps in the users manual need to have fixPS run
on them. So, ~ptdesign/doc/users_man/makefile contains the lines:
The Ptolemy development group is interested in any stars
Ptolemy users might want to contribute to the project, but we
have limited resources, so here are a few guidelines for
contributions:
Distributing stars
We are proposing two methods of distributing stars: via ftp
and via the next Ptolemy distribution. These instructions are
primarily for distribution via ftp from our ftp site.
If you stars are to be distributed from our ftp site, we will
put them in a contrib directory.
If we distribute your star in the next Ptolemy release, we
will probably want to add the Berkeley copyright to your stars.
We have not resolved the details of where contrib stars will
go, but currently we are thinking of putting stars into
contrib directories next to the stars directories. So,
$PTOLEMY/src/domains/sdf/contrib/stars would contain sdf .pl
files that users had contributed. Stars that we find really
useful, we would like to incorporate into the main stars/
directories. The primary reason for a contrib directory is
that we don't have the resources to fold in all stars into the
main tree.
Packaging contrib stars to be included into the next Ptolemy
release is more work for everyone involved, but the stars are
more likely to be used. Due to time constraints, we
might not be able to get contrib stars into the 'next' Ptolemy
release, but we will try.
Copyright
If your stars are to be included in the Ptolemy distribution
then we would like to put
It makes our lives a lot easier if you put the UC Berkeley
copyright on the .pl files. See any .pl file for the current
UC Berkeley copyright. If you need a different
copyright, then we'll have to negotiate.
What to include
If you are contributing stars, please include .pl files,
icons, and demos.
1) Your .pl file should have a description of the star. Be sure
to include your name as the author in the .pl file.
2) The demo directory should contain a facet "init.pal" with
an icon for each demo and a facet "user.pal" with icons for
each star. Including a custom icon is nice. Including a demo
really helps the Ptolemy group test your star. Stars with out
demos are more likely to be broken.
[This step needs to be polished -cxh]
3) The init.pal and user.pal palettes, and all demos, should contain
***only*** references to the directory
$PTOLEMY/src/domains/the-domain/contrib/your_hopefully_unique_dir_name.
To check this latter condition, run
http://ptolemy.eecs.berkeley.edu/
then follow the link to the "quick tour". Use the "View
Source" or "Save As..." items in the "File" menu of Mosaic if
you want to view or save the hyper-text markup language (HTML)
source for these demos. There is also on-line documentation
available for HTML under the "Help" menu.
http://ptolemy.eecs.berkeley.edu
The http docs are installed as:
file://localhost/usr/tools/etc/httpd/docs/index.html
messier the machine running the httpd daemon.
Patches
To generate patches, I use diff -c. I don't think I have it
quite right as my patches require the -p2 flag to ignore the
first two components of the diff.
What I do is this:
This is probably not the best way to do it, but it works for
my purposes. Note that you should probably make a separate
tar file for the octtools changes (get
pt-0.5.1.other.src.tar.gz)
mkdir old
cd old
gzcat pt-0.5.1.src.tar.gz | tar -xf -
cd ..
mkdir new
Untar the new stuff
old/ptolemy
new/ptolemy
diff -c -r old new > patch3
We provide patch binaries and source on our ftp site in
pub/gnu
zcat /vol/ptolemy/pt0/ftp/pub/ptolemy/ptolemy0.5/pt-0.5.src.tar.Z | tar -xf -
zcat /vol/ptolemy/pt0/ftp/pub/ptolemy/ptolemy0.5/pt-0.5.other.src.tar.Z | tar -xf -
cd ptolemy
patch < /vol/ptolemy/pt0/ftp/pub/ptolemy/ptolemy0.5/patches/patch/pt-0.5-patch1
patch < /vol/ptolemy/pt0/ftp/pub/ptolemy/ptolemy0.5/patches/patch/pt-0.5-patch2
etc . . .
setenv PTOLEMY `pwd`
set path = ($PTOLEMY/bin.$PTARCH $PTOLEMY $path)
make install_octtools >& oct.0421 &
If you are not rebuilding octtools and tcltk, make links:
cd $PTOLEMY/tcltk; ln -s ~ptolemy/tcltk/* .
cd $PTOLEMY/octtools; ln -s ~ptolemy/octtools/*
make install >& in.0421 &
Moving Ptolemy
Sometimes it is necessary to make ~ptolemy point to a
different location. A common reason to do this is that the
local ~ptolemy disk or machine needs work.
./doall "amd-restart" `cat ohm`
./doall "cd /users/ptolemy;pwd" `cat ohm`
more *.out | cat
Porting to a new architecture
If you port to a new architecture, here are some of the files
to look at:
Getting dynamic linking to work is tricky.
You may find it useful to determine what symbols are
predefined for a new architecture. If you are using g++, try
compiling a simple c++ file with the -E -dM flags. This will
print out the cpp symbols that are defined at the end. See
the gcc info (you can use tkinfo) for more information.
compat.h
I'm trying to move more of the system dependent code into
src/compat/ptolemy/compat.h. If more of the system dependent
code is in one place, then ports might be easier.
#ifdef arch
If you need to make #ifdefs in a file that are architecture
dependent, try using the #defines from compat.h. All the
architectures should have a #define. For example, sol2 has
#define PTSOL2 in compat.h, and sol2.cfront has
#define PTSOL2_CFRONT. If you use the PTxxx defines, then you
won't have to have some of the crazy 'how do I tell I'm on a
solaris2 sun running cfront' #defines.
function prototypes
If you need to add a system call function prototype, you may
want to add it to compat.h. Note that getting function
prototypes to work on all platforms can be tricky. For
example, Sun4 cc does not handle function prototypes. If you
are working on site, you can use
'glimpse -H ~ptdesign/src a_function_call' to see if other
files use 'a_function_call'.
include files
If you want to add another include file, the first thing to
try is to look on an older machine, such as a SunOS4.1 machine
and see if it is there. The second thing to do is to use glimpse to
search for other files that use the include file in question
general procedure
First thing to port is octtools, make sure that vem starts up.
If you do 'setenv OCTTOOLS $PTOLEMY', then vem should start.
testing
Octtools has some tests now. The tests are not perfect, but
they will point out some bugs. To run the octtools tests,
build octtools and then do
"cd $PTOLEMY/obj.$PTARCH/octtools; make tests"
Changing gcc versions
If you change gcc versions, you should look at the defines in
$PTOLEMY/.cshrc and $PTOLEMY/bin/g++-setup make sure that they
refer to the right version. Also, $PTOLEMY/src/gnu/makefile contains
references to the current version, along with
$PTOLEMY/src/gnu/README and $PTOLEMY/src/gnu/INSTALL.
Also, check out the COLLECTOR variables in $PTOLEMY/mk/config-*.mk
Ptk commands
Currently, the ptk tcl/tk commands are not really documented.
I believe that the interface is still in flux, so we don't
want to publicize the specification. See
~ptdesign/adm/doc/ptk.doc for more info.
Embedded Postscript (EPS) in Frame docs
If you use EPS in a Frame doc that will be part of the Ptolemy
doc distribution, then you must run ~ptdesign/bin/fixPS on it.
FIXPS=/users/ptdesign/bin/fixPS
fm2ps: update_book
fmprint2ps $(DOCS)
$(FIXPS) cg56.ps
$(FIXPS) cg96.ps
If you don't run fixPS on your Frame postscript files that use
EPS, we will hear about it in the next release.
Contributing Stars
[This section should move into the users manual, perhaps into
AppendixA]
masters {init.pal, user.pal ...}
Type a ? to list the references. Any that have absolute path names,
such as
/usr/users/my_home/my_stars/star_name
or relative path names using a user's home directory, such as
~user_name/my_stars/starname
are no good. You can easily replace these with $PTOLEMY/contrib/...
using the masters program.
For example, a good contrib directory would look like:
$PTOLEMY/src/domains/sdf/contrib/my_star/src/SDFMyStar.pl
The demo and icon directories below would be included
$PTOLEMY/src/domains/sdf/contrib/my_star/demo/MyStarDemo
$PTOLEMY/src/domains/sdf/contrib/my_star/icons/MyStar
$PTOLEMY/src/domains/sdf/contrib/my_star/icons/init.pal
$PTOLEMY/src/domains/sdf/contrib/my_star/icons/user.pal
Below is an example session that runs masters
cp -R my_directory/* $PTOLEMY/src/domains/sdf/contrib/my_star
cd $PTOLEMY/src/domains/sdf/contrib/my_star/icons
remove junk
masters init.pal
...
masters user.pal
...
masters others...
cd $PTOLEMY/src/domains/sdf/contrib/my_star/demo
masters MyStarDemo
tar cvf ...
uuendcode ...
FTP
For security reasons, we don't have a writable anonymous ftp
site, so sending us stars can be tricky. If you have
anonymous ftp, then we could pick up your stars. Another
solution is to create a tar file of the facets and .pl files
and then use uuencode to mail them.
Misc.
See Also