Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
If you have created an tool that you wish to show up in the toolmanager then the tool must obey the following rules:
If the tool is to be classified correctly, then a help file must be in the system, and built into the documentation. Otherwise the tool will be shown under unclassified (Note: this is considered a serious wart and will be fixed soon).
An example of a trival compliant tool is:
const foo := function() { public := [=]; public.type := function() {return 'foo'}; # A do-nothing-much function public.gui := function() { f:=frame(title='foo.gui'); b:=button(f, 'Press here to continue'); await b->press; note('foo.gui() finished'); f:=F; public:=F; return T; }; # Another do-nothing-much function public.another := function() { print "foo.another"; return T; }; # Another do-nothing-much cli public.anothercli := function() { print "foo.anothercli"; return T; }; # Another do-nothing-much gui public.anothergui := function() { f:=frame(title='foo.anothergui'); b:=button(f, 'Press here to continue'); await b->press; note('foo.anothergui() finished'); f:=F; public:=F; return T; } return ref public; } # Add the required meta-information types.class('foo').function('ctor_foo');
An example of a more detailed meta information file follows:
pragma include once; # Include once only include 'types.g'; # Required # Name the include file that defines the tool types.class('imager').includefile('imager.g'); # Constructors are preceeded by ctor_. Then follows the # list of arguments. Each argument is defined in this form: # # type(arg, default=unset, dir='in', checkeval=T) # # where type is defined in type.g and is one of: # # file|table|string|integer|float|double|record|boolean|vector_string|complex # # arg is the name of the argument # default sets default values (may be an executable string) # dir sets the direction of the argument # checkeval=T means that a string value is eval'ed and checked, # otherwise no such check is done. # # Define two constructors, one with just a table name, and the other # with more arguments types.function('ctor_imager').table('filename'). function('ctor_imagertester').string('filename', '3C273XC1.ms'). integer('size', 256).string('cell', '0.7arcsec').string('stokes', 'IV'). string('coordinates', 'b1950'); # Functions # Open with just a table name types.function('open').table('thems'); # Plain close types.function('close'); # Get the name back types.function('name').string('return'); # Summary types.function('summary'); # Set various image parameters. Note the use of the measures # tool to set the phasecenter. types.function('setimage').integer('nx',128).integer('ny',128). string('cellx','1arcsec').string('celly','1arcsec'). string('stokes', 'I'). boolean('doshift', F). record('phasecenter', 'dm.direction(\'b1950\', \'0d\', \'0d\')',checkeval=F). string('shiftx','0arcsec').string('shifty','0arcsec'). string('mode', 'mfs').integer('nchan', 1).integer('start', 1). integer('step', 1).string('mstart', '0km/s').string('mstep', '0km/s'). integer('spwid', 1).integer('fieldid', 1);
The toolmanager's own constructor is called during startup. Since only one toolmanager can be created, you should never have to call this constructor. The only toolmanager that exists has the conventional abbreviation tm.