Home

VERY LARGE TELESCOPE

image

Contents

1. 13 24 RUNNING THE SEQUENCER SHELLS weiss 6 88 5 6 ea I ed n 14 Before vui eie Quer Le eiut taa rait 14 24 2 Staring Up koe opes bebes bored edere eb Tav qe Ty 16 24 3 Example Sequencer script cy asad as uyu spa aaa CEPR ER prt baec Y Roe ao 18 2414 SUDDprocesseS ood quoe eR dpa ee ES EE 20 25 THE SEQUENCER AS IMBEDDABLE 21 26 DYNAMICALLY LOADABLE EXTENSIONS t nna nC e 21 2 6 1 Initialization a loadable extension 553 eens 21 2 6 2 Compiling loadable extensions a vereor bts quae Cae da cri grad 22 260 veces Ne bt AY wale aan MODE EE 22 264 Examples from the Sequencer ts cas icta 0 6 ADU EDU URS EDU CIR V anh 29 27 SEQUENCER VARIABLES ts icut uu x yan apy ae bed rg Eure es Pri Vae edd eae 23 2 8 INTERNET RESOURCES ON yn ee tp ta a eC a sea 25 3 INSTALLATION 27 pu REQUIREMENTS 2 T ee cee dud RR Maes Medi 27 Vi HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 3 2 COMPILATION AND INSTALLATION OF THE SEQUENCER 28 33 VERIFICATION ose vei gees Re ives pusa Ge ede uper ea ET E WE 29 4 REFERENCE 31 5 PUBLIC INTERFACE FILE 149 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 1 1 INTRODUCTION 1 1 PURPOSE This document is the User Ma
2. 35 E E E E 35 35 1 We want full precision for DB double values so let s set it up here set tcl precision 17 2 Let s declare our Sequencer to CCS giving him a personalized name 1 The lines of code needed to make this script executable are automatically inserted by provided the Makefile is properly defined i e according to the VLT standards HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 19 We ll also want to be wide open for asynchronous commands seq ccsInit seq S env USER seq ccsAsyncInput open 3 We are supposed to wait here until our PARTNER is ready This guy is started by somebody else and he doesn t know our name That means we ll have to poll him with a PING command Fortunately we know he s on our environment while catch seq msgSendCommand seq ccsEnvName PARTNER PING cmdId sleep 1 msgRecvReply ScmdId errNr lastReply 4 OK he s alive Let s tell it and go in an interactive commandloop echo PARTNER alive and kicking You can now send him a few commands or have any set of Sequencer commands executed interactively type CTRL D on a fresh line to go on commandloop return seq gt return 5866 ccsProcName 5 Fine Now ready for the real stuff let s send PARTNER some commands First comes the initialization com
3. a seq_msgDispatchBreak command ERROR if one of the following conditions is met corresponding error message is here between quotes wrong args should be seq_msgDispatch lt timeout gt lt nrMessages gt if the command contains more than 2 arguments bad argument lt argv gt should be an integer if either lt timeout gt or lt nrMessages gt have illegal values bad argument lt argv gt should be positive if lt nrMessages gt 18 a negative integer could not get msg queue file descriptor if seqGetMsgFd 3 failed timed out after xx messages can obviously only occur if timeout is greater than O0 Remark that most of these messages cannot appear when the seq msgDispatch is called via the fileevent scheme In this case we are 100 sure the arguments are set to legal values and there is a message on the queu Also internal messages which cannot be retrieved by the application but do cause a fileevent do not provoke any errors The causes of these errors are also logged via the standard CCS error system and logging CAUTIONS Incoming commands cannot be longer than 8K i e the limit of a single CCS message EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq msgDispatch 1000 1 1 seqWish seq msgDispatch 100000 5
4. while replies without an entry in the CDT will be treated as ASCII 2 last reply flag 0 for set 1 if set 8 reply received in the message if this reply is empty or contains any spaces it will be surrounded by curly braces This substitution is equivalent to F if the command was sent with command checking on see seq msgSendCommand n otherwise it behaves as A T timeout flag O for no timeout 1 for timeout 55 a single 5 character Whenever the substitution on the original script or the evaluation of the resulting script yields an error the corresponding event will be disabled On top of that the error will be logged and also signalled in a separate window popping up via Tcl BackgroundError Replies already on the internal stack will be treated as events After the last reply is dealt with the link between the lt cmdId gt and the script is deleted as in fact the command handle with all associated information is removed The distinction between the two forms of the seq evtAttach command is done based on the second argument if it is an integer then it must be the attachment to an event reply seq evtDetach will detach a previously attached event from a database attribute and delete the event handler lt eventHandle gt the event handle as returned by seq evtAttach seq evtSingleDisable will disable a previously attached event
5. it sets the global Tcl variable ccsType which reflects for what environment the Sequencer was built full for CCS RTAP light for CCS light if without CCS it defines the global Tcl variable zeg moduleld and sets up the proper callbacks to ensure this is never modified to a too long or too short string This variable is used as the module identifier in all errAdd calls it sets the global Tcl variable zeg ccsCmdCheck to CHECK the Sequencer shell atomic commands are declared the script file segInit tcl is evaluated It is searched for on the path given by the global Tcl variable zeg library see higher The main task of this script is to insert seq library at the top of the list of paths searched automatically when an unknown command is given This list is kept in the global Tcl variable auto path segInit tcl also determines your application window s icon appearing when you press your window manager s iconify button on the application window as follows based on the the application name e g seqWish or panel a pixmap icon is searched for with name applicationName Icon xpm If such colour icon exists it will be used for the application image name segIcon widget name segIcon If not a black and white bitmap with name lt applicationName gt Icon xbm is searched for which will end up as the application s icon if found If none of the two icons are found no icon will be defined and the default window manag
6. last flags to wait on the last reply and and return the data of the last reply only if option bin is not set lt nnn gt any integer giving the timeout in ms absolute value is taken nonewline indicate that the concatenation of multiple replies see all option should be without additional newlines Specifying this option in the absence of all does not have any effect nowait flags no wait i e first the internal queue is checked and if no reply is found a call to msgRecvMsg is placed with the appropriate filter and msgNO WAIT flag The option ascii is enabled by default if seq ccsCmdCheck was set to CHECK CMD when the command was sent otherwise the fbin option is active These defaults may be overridden by command line options cmdId as returned by seq msgSendCommand errorNumber the name of a Tcl variable where to store th rror number of th rror message structure returned as part of the reply The CCS convention is that 0 signals no error This variable can only be set after the message was received OK i e one should test first that the reply protocol did not fail then look at lt errorNumber gt When the errorNumber variable indicates the reception of an error message this error stack can be displayed with seq errDisplay until the next error comes in HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 lt lastReply gt the name of Tcl boolean vari
7. When seq msgDispatch gets a command from the message queue it will execute it Presently the following commands are recognized on top of the special commands BREAK KILL and PING predefined for all CCS applications EVENT the message body must contain legal Sequencer script which will be evaluated Similar to the SCRIPT command see below with the difference that no replies are generated the sender of the EVENT command will not receive and should not expect any reply on this command This command is useful in an environment where some process es need s to be informed of an event while it is considered too expensive to create access a database branch just for this purpose HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 121 If this command was sent via seq_msgSendCommand the latter needs to have the noreply option specified SCRIPT the message body must contain a legal Sequencer script which will b valuated The result of this evaluation i e the return string will be sent as the second reply to this command an immediate empty reply is given before the evaluation starts If in this script intermediate replies have to be sent the so called script command handle will be needed as this allows to retrieve the originator of the command This handle can be obtained with a substitution performed on the script before evaluation equivalent to the seq evt substitutions
8. 1 install mSQL as documented elsewhere 2 install the tar file for Tcl Tk TcIX BLT Msgltcl Img TkTable Snack and incr Tcl on your directory Remark that several of these packages as provided with the VLT software distribution have been patched for known problems ie one should not use tar files downloaded straight from the internet 3 extract each this tar file with 5 tar xvof lt file gt tar or if the tar file was compressed with gunzip file tar gz c tar xvof This will create subdirectories as appropriate 4 Make sure you will be compiling with gcc setenv CC gcc 5 install the static version of Tcl Tk and incr Tcl by typing from your shell the following configure prefix S TCLTK ROOT nable shared NO and then 5 make make install 6 Install the shared lib version of Tcl Tk and incr Tcl by typing from your shell the following 5 rm rf config cache make clean configure prefix STCLTK_ROOT nable shared and then 5 make make install 7 Install TclX as follows it does the static and shared lib versions in one go 5 cd tclxX8 3 unix configure prefix STCLTK_ROOT nable shared with help make make k install 8 Install BLT as follows cd blt2 4u configure prefix STCLTK_ROOT nable shared and then make make k install 9 Install MsqlTcl as follows cd msqitcl 1 99 28 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 conf
9. 55 script command handle it is needed by the seq msgSendReply command as it allows to identify the process which originated the SCRIPT command a single character If the result of the script evaluation is a string of a size which does not fit into a single reply seq msgDispatch will automatically chop up this string into multiple fragments send each fragment in the right order as a reply whereby only the last fragment will have the lastReply flag set It will be up to the sender of the SCRIPT command to re assemble these replies by concatenating these individual pieces All other commands will be logged as errors and an error message will be sent back as well to the originator of the command seq msgDispatch does also react on events Whenever an event messag comes in the script given at the time this event was defined see seq evtAttach n and seq msgRecvReply n will b xecuted Th evaluation of the script is at global level Whenever the substitution on the original script or the evaluation of the resulting script yields an error the corresponding event will be disabled and the error will be logged and also signalled via Tcl BackgroundError 3 Similar for alarms whenever an alarm message comes in the script given at the time this event was defined s seq alrmAttach n will b xecuted Th valuation of the script is at global level Same remark about script substitution evaluation errors
10. HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 57 seq dbGetFamilyNames n See seq dbGetAttrNames n Last change 28 03 02 10 36 58 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq dbGetFieldNames n See seq dbGetAttrNames n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 59 seq dbListAdd n See seq dbListCreate n Last change 28 03 02 10 36 60 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq dbListCreate n NAME seq dbListCreate seq dbListAdd seq dbListRemove seq dbListDestroy seq dbListPut seq dbListList commands for the handling of db multi read write lists SYNOPSIS seq dbListCreate environment access seq dbListAdd listId attrSymAddrl lt attrSymAddr2 gt seq dbListRemove listId lt attrSymAddrl gt lt attrSymAddr2 gt seq dbListDestroy listId seq db istExtract listId attrSymAddrl lt attrSymAddr2 gt seq dbListPut listId attrSymAddrl valuel attrSymAddr2 lt value2 gt seq dbListList lt environment gt D ESCRIPTION seq dbListCreate create an empty list of attributes envName environment name of the database to access access read or write access r for read w for write seq dbListCreate will create and initialize the structure used for subsequent multi read write operations It returns a listId which has
11. if any of these words were misspelled for the seq errDisplay command CAUTIONS Under NOCCS only seq errResetStack seq errAdd and seq errCloseStack are avaliable Under CCS lite the current setting of RTAPENV is taken whenever the first 91 92 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 CCS function gets called If this first CCS function is not a ccsInit this value of RTAPENV will anyway be used later when ccsInit get called independent of RTAPENV s value at that later time This means that e g in the wtctest environment issuing first seq errResetStack command followed by a set env RTAPENV xyz and a seq ccsInit command will lead to a ccsInit in the wtctest environment instead of the xyz environment This is not inherent to seq but rather to CCS lite In fact to enable an effective modification of the environment variable RTAPENV within a Sequencer script e g based on runstring options the Sequencer s internal initialization does not call any CCS function under CCS lite thereby shifting the responsibility to do things in the proper order to the application seq errGetStackSize and seq errGetFromStack manipulat ither the reply or the internal error stack The stack set aside for seq errAdd seq errCloseStack and seq errResetStack is a different one and hence cannot be seen by the seq errGet commands The arguments of seq errAdd will all be logged as errors with
12. pointName dbUnlockPoint returned an error CAUTIONS If the point is already locked this command will hang until the point has been released EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq dbLockPoint alias eric seqWish seq dbread lt alias gt eric my scalar 199 5 seqWish seq dbUnlockPoint alias eric seqWish HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 69 SEE ALSO Tcl and the Tk toolkit seqDbLockPoint 3 John K Ousterhout ISBN 0 201 6337 X seqDbUnlockPoint 3 Last change 28 03 02 10 36 70 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 S N s 5 5 5 5 5 n R 0 ETURN VALUES eq dbMultiRead n AME eq dbMultiRead seq dbMultiWrite commands for the handling of db multi read write operations YNOPSIS eq dbMultiRead gt 118 101 lt lt listId2 gt eq dbMultiWrite block listIdl lt listId2 gt ESCRIPTION eq dbMultiRead read a list of attributes on a particular environment lt listIdN gt list handle as returned by seq dbListCreate seq dbMultiRead will do the actual database access for all attributes in the multi read write list listIdN which was created and prepared previously with the seq dbList commands The actual values r
13. prompt and all replies on a new line HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seqWish gt seq_log seqWish gt blablabla Error invalid command name Gi Errors open seqWish seq log seqWish gt SEE ALSO Tcl and the Tk toolkit cl Errors close Seq errResetStack n seq errAdd n Last change 28 03 02 10 36 John K Ousterhout ISBN 0 201 6337 Seq errCloseStack n 117 118 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq msgCheck n NAME seq msgCheck seq msgList check and list commands with pending replies SYNOPSIS seq msgCheck lt cmdId gt lt envName gt procName command seq msgList lt envName gt lt procName gt lt command gt DESCRIPTION seq_msgCheck checks if there are still replies pending on a command identified by its arguments A 1 is returned if replies are pending 0 if not lt cmdId gt unique command handle as returned by seq_msgSendCommand lt envName gt environment name lt procName gt process name lt command gt command name seq_msgList returns a list with pairs one pair per pending reply Each pair contains a cmdId and a sublist with originating environment name process name and command name describing the command for which a reply is pending The optional list allows to refine the reply list progr
14. 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 101 seq evtSingleDisable n See seq evtAttach n Last change 28 03 02 10 36 102 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq evtSingleEnable n See seq evtAttach n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 103 seq findFile n See seq relToAbsPath n Last change 28 03 02 10 36 104 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq fitsDate n See seq relToAbsPath n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 105 seq isoTime n See seq relToAbsPath n Last change 28 03 02 10 36 106 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq isoTimeToClock n See seq relToAbsPath n Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq_losData n NAME seq logData store a single message in the local host s logfile SYNOPSIS seq logData lt logString gt DESCRIPTION seq logData will log a single line It will be logged with a logId of 0 general purpose log identifier lt logString gt string that has to be logged ENVIRONMENT no environment nor Tcl variables are read nor set RETURN VALUES OK return if no errors occurred The result string is empty ERROR return if one of the following conditions is met with corresponding rror message here between
15. Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 43 seq ccsExit n See seq ccsInit n Last change 28 03 02 10 36 44 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq ccsInit n NAME seq ccsInit seq ccsExit seq ccsAsyncInput interface to ccsInit ccsExit and the asynchronous input of messages SYNOPSIS seq ccsInit procName seq ccsExit DES seq seq ccsAsyncInput open close CRIPTION calls ccsInit to register the Sequencer in CCS lt procName gt string containing name under which to register the Sequencer seq ccsInit sets also the global Tcl variable seq 008558005 to CLOSED If lt procName gt is not given it defaults to the value of the Tcl variable seq ccsProcName If all went well the global Tcl variable seq ccsEnvName will be set to the name of the local environment seq ccsExit seq ENV RTA calls ccsExit and unsets the global variable seq ccsStatus Whenever seq ccsExit command completes successfully internal lists containing info about commands with pending replies are cleared i e seq msgList will return an empty list If the seq ccsExit command is given within the processing of a SCRIPT command see seq msgDispatch it will inform the originator s of this command that it is exiting sending a last reply with an error number 1 ccsAsyncInput enables o
16. echo Cannot proceed Quitting exit else seq msgRecvReply was OK let s see what sort of message came in if SlastReply more replies pending get them all set reply seq msgRecvReply all S cmdIdl errNr lastReply if SerrNr 0 set msg Sreply if SerrNr 0 Concatenate first reply with rest of them set reply msg n reply else got an error reply jump out of the procedure with an error error msg 4 And so it goes on 2 4 4 Subprocesses The Sequencer shells can of course also schedule other processes It has for that purpose the exec command This command normally waits until its subprocess is completed and the return value is the standard output of the child process If on the other hand the last argument of the exec com mand is amp the child process will be executed in the background and the return value will be the process id s of the child ren If such a background process terminates it is still possible to retrieve its exit status within the par ent process via the wait command see 161 manpage But until such a wait command is issued the exited child process will appear as a so called zombie in the process table A zombie process is a process that sent a SIGCHLD signal to its parent while the parent did not yet pay attention to this signal This misleadingly suggests something is wrong and actually some implementations of the top utility e
17. error message left by Tcl SetVar when trying to set the variable lt lastReply gt remark that when this error occurs the reply was 129 130 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 received properly CAUTIONS The identification of the command that caused a reply depends on the the commandId parameter sent together with the command It is therefore absolutely essential that all applications receiving Sequencer commands via the CCS message system return replies that contain the CommandId of the originating command When a reply comes in with the lastReply flag set the Sequencer shells will remove all information pertinent to this command after dealing with this reply If further replies would come in they will be properly logged as errors and should be interpreted as an indication of a buggy replying application For formatted binary replies the formatted string of a single reply is limited to 16 KBytes There is however no checking for overflow possible due to how the CCS procedure cmdFormatReply is implemented and if the DISPLAY FORMAT entry in the corresponding CDT leads to larger formatted strings a memory corruption will occur To be able to format replies the CDT must be loaded into cmdManager See cmdManager 1 and cmdSetup 1 EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming afte
18. includes the initialization of Tk the Tk main window can only appear or get updated when the Sequencer event loop is entered i e by calling from your application either Tcl Mainloop once or Tcl DoOneEvent repeatedly In other words if your application does not include such calls no window will appear segEval evaluates a script in the context of the interpreter it is passed interp initialized interpreter cf segInitInterp Script string containing any valid script to execute e g source myScriptFile or set a seq dbReadSymbolic alias myScalar error CCS error structure filled out only if the evaluation fails CAUTIONS The application calling this function is responsible for including the proper libraries i e a library containing the Tcl AppInit function Remark that the libseq library includes such a function which is identical to the one used for seqSh i e it does not include any initialization of Tk and related extension The seq src tkXAppInit c source can be used an example Tcl AppInit function including this Tk initialization SEE ALSO 34 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 Seq Init 3 NAME Seq Init initialization procedure for the Sequencer specific commands SYNOPSIS include segPrivat
19. lt eventHandle gt the event handle as returned by seq evtAttach 95 96 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq evtSingleEnable will enable a previously attached and disabled event lt eventHandle gt the event handle as returned by seq evtAttach seq evtList lists the already defined events with their properties as requested status tell whether for each event whether it is enable or disabled attrName give the attribute name to which the event is attached filter include also the filter script list the script that will b valuated when th vent occurs all shorthand for the above 4 properties The result string is contains per event a sublist with the elements as requested They will be listed in the order as given above i e independent of the order of these options on the command line and preceeded by the event handle Remark that attrName filter and script are in the order and format as required for seq evtAttach ENVIRONMENT The value of the seq ccsCmdCheck variable at the time the command was sent can be used to flag the expected presence of a CDT of the process the reply comes from It influences the behaviour of the R substitution See also seq msgSendCommand n and seqInit 3 The seq evt commands have corresponding entries in the global Tcl array variable seq debug which controls the printing of debug information see Seq Init 3
20. the global Tcl variables OSE EPR and EPW are set and accessed The global Tcl variable OSE refers to the original stderr file descriptor EPR and EPW are the reading resp writing end of a pipe created to divert the messages sent to stderr RETURN VALUES OK with and empty result string if no errors ERROR with corresponding message in the result string under the following conditions called seq logTclErrors with too many arguments if there was more than 1 argument given to this command wrong arg should be open or close if argument is not correct Tcl error logging already active if open has been given before i the global Tcl variable OSE exists Tcl error logging already disabled if close has been given befor i e the global Tcl variable OSE does not exist CAUTIONS When this error logging is active the Tcl variables OSE EPR and EPW are set at a global level by lack of static variables in Tcl They should not be modified The overhead caused by sending these messages also to the CCS error system is considerable on top of adding possibly quite a few messages to the log Its use should therefore be restricted to the bare minimum e g for debugging purposes Stderr must be open when Tcl error logging is started EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish
21. 17220 0737 seq errPrint n S Seq errResetStack n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 89 seq errResetStack n NAME seq errResetStack seq errAdd seq errCloseStack seq errPrint seq errDisplay seq errGetStackSize seq errGetFromStack interface to the CCS error logging SYNOPSIS seq errResetStack internal reply seq errAdd internal reply error sourceId seq errCloseStack internal reply seq errPrint internal reply seq errDisplay internal reply suspend seq errGetStackSize internal reply seq errGetFromStack internal reply lt frameNr gt DESCRIPTION These commands will handle the logging of errors for the Sequencer s further below for a description of the internal and reply options Seq errResetStack resets the error stack to be used after th successful recovery from an error or at initialization time before calling seq errAdd for the first time see also CAUTIONS section seq errAdd adds the string error to the error stack pointing to sourceId a string as the originator of the error The moduleId default seq with which it will be logged can be modified via the global Tcl variable seq moduleId Of course this would then require that a proper error definition file exist for this new moduleId In particular error number 1 is reserved for this command it needs to have been def
22. 5 seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X seq ccs n seq evtAttach n seq evtParseMsg 3 segMsgDispatch 3 seqMonitorQ 3 RtapEnvTable 4 Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 123 124 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq msgDispatchBreak n See seq msgDispatch n Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq_msgFlush n NAME seq msgFlush flush pending replies SYNOPSIS seq msgFlush option filter DESCRIPTION seq msgFlush waits a certain time for all replies to flush them as they come in or optionally flushes replies that are already available option can be either nowait flags not to wait i e flush only replies which are available at the time the command is given nnn an integer giving the timeout in ms to wait for replies If no option is specified the wait will be forever filter is a list with at least on lement it is either the environment and optionally the process name for which we want to flush the replies the word all to indicate replies to all commands ENVIRONMENT No Tcl variables are accessed RETURN VALUES OK with and empty result string if no errors ERROR with corresponding message in the result string under the following conditions called s
23. Ee eX ace Sa Y Ie dO e DI e 1 I5 GLOSS EA ad 00 ode EE 1 16 STXLISTIC CONVENTIONS tcc dad Rer a ar ue ede ceu P c P o te a E d e e o 2 1 7 PROBLEM REPORTING CHANGE REQUEST PREX RUE ERAS 2 2 USER S GUIDE 3 21 OVERVIEW EEN EE EE dE EES PX RAW SH LARA SES ERAS 3 22 SCRIPTING LANGUAGE SYNTAX sat get es vua bbc re bb ER ELA epus 4 22 1 Basie TUlesy uu p eie Ee Metteg 4 222 ever Pado etd VD ede ae dendo E 4 22 3 EE 5 2 221 Potential boot Bees pos 5 2 3 SEQUENCER SEIELE COMPONIBNN ES t sb ea nrw sth ex e a AC e ADR 7 2341 Environment Interface ur cascade uka ee dee Seef 8 2 3 2 CCS Message System Interface oo eege ger ret SOs Bead pra e 8 2 3 3 CCS On line Database Interface iudei reor 0 PW e ra ERE e dn 10 2 3 4 CCS Logging System Interface ciis eot ais coud UR Bast fas nune Gem dh d 10 2018 CCS Error System Interface pega decas 11 9816 CCS Scan System Interface u sso ee tah ta oc x Pes o Maa w aP eas PAAR 11 200 CCS Event u u taped qutt Y weer ee tad Eu duh 11 2 3 0 Error hatidling gt exe dro ebe cra 12 2307 EE EE E 12 2 3 10 Convenience procedures ess icta ELA Rh d 12 2 11 Deb gging helpis eee pare doa
24. RTAD 2 3 4 CCS Logging System Interface seq logData logs a single message up to 255 characters on the local host seq logTclErrors This command will send all output that normally goes to stderr also to the CCS error log As HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 11 this may produce quite some overhead depending on the amount of output its use should be limited to debugging purposes seq logFitsAction seq logFitsComment seq logFitsEvent seq logFitsParRecord seq logStringParRecord seq logIntParRecord seq logRealParRecord To generate FITS ops logs A specific command to retrieve logs can be implemented using the Tcl TclX file access commands and the CCS logging system filtering utilities 2 3 5 2 3 6 2 3 7 CCS Error System Interface seq errResetStack To reset the error stack used after successful recovery from error Maps into errResetStack 3 seq errAdd To add an error to the error stack Maps into errAdd 3 seq errCloseStack To log the and close the error stack no error recovery possible Maps into errCloseStack 3 seq errDisplay To display the current error stack in a separate window Related to errDisplay 3 seq errGetStackSize Io get the number of error frames currently occupying the error stack Maps into errGetStackSize seq errGetFromStack Returns a particular error frame from the stack in the same format as seq errPrint Maps into errGetFromStack seq_errLog
25. SCALAR VECTOR or TABLE the list of data types data types ar integers reflecting the type of the attribute s fields For SCALARs and VECTORs this is a single value hence not surrounded by curly braces the complection status of the multi read write operation for this particular attribute 0 means success 1 signals failure the quality of the data either OK SUSPECT ERROR or DISABLED for an explanation of the meaning of these words see the CCS db documentation the list of values For SCALARs this is a single value which will include braces if it contains spaces For VECTORs if the attribute covers multiple records this will be a list of values one per record For TABLEs each list of values for each record will contain as values as there are fields specified in the attribute This scheme is identical to what goes for the seq dbReadSymbolic command If a single attribute was given as argument the return string will be a list with the 5 elements as described abov If multiple attributes are passed the return string will be a list with one element per attribute and each element is on its turn a list with the 5 elements given above seq dbListPut prepare the listId s internal buffer corresponding to a certain attribute for a multi write operation lt listId gt list handle as returned by seq_dbListCreate lt attrSymAddrN gt symbolic addr
26. Tcl Interp interp This initialization procedure must contain a call to Tcl PkgProvide like Tcl PkgProvide interp Ext 1 0 where the second argument is a string with the package name and the third argument is a string with the version number in the format major nr minor nr At this point the initialization can proceed as usual setting variables and creating commands with the Tcl CreateCommand procedure The initialization procedure must return OK or TCL ERROR to indicate whether or not it com pleted successfully in the event of an error it should set interp gt result to point to an error message The result of the load command will be the result returned by the initialization procedure see the manpage of the Tcl load command 2 6 2 Compiling loadable extensions Loadable extensions need to be created as shared libraries This requires that the compiler gener ates position independent code option fPIC for gcc and that the linker is informed that the library to build is a shared one option shared for gcc In general libraries are not self contained they depend on a set of other libraries like the math li brary libm Your shared library needs to be built declaring this list of dependent libraries other wise there may be undefined externals when seqSh seqWish try to load this new package Of course these libraries need not be specified if they are already known by seqSh seqWish
27. The global Tcl variable seq moduleId has its effect on how errors are logged with seq errAdd S abov RETURN VALUES OK return if no errors occurred The result string is empty ERROR return if one of the following conditions is met with corresponding error message strings here printed in boldface wrong args should be seq errResetStack internal reply wrong args should be seq errAdd error internal reply sourceId wrong args should be seq errCloseStack internal reply wrong args should be seq errGetStackSize internal reply wrong args should be seq errGetFromStack internal reply lt frameNr gt wrong args should be seq errPrint internal reply wrong args should be seq errDisplay internal reply suspend the corresponding Sequencer command was given with the wrong number of arguments sourceId sourceId too long if the string length of sourceId exceeds the limits imposed by the ccsERROR structure rror message left by Tcl GetInt when trying to interpret lt frameNr gt as an integer could not do an errAdd check the log if during the processing of the seq errAdd command the call to errAdd 3 failed could not get error frame frameNr from stack if seq errGetFromStack returns an error e g lt frameNr gt exceeds the current stack size wrong option option should be internal reply or suspend
28. This seq logFitsParRecord command is normally used with a type option indicating what sort of conversion from string values should take place Without this type option seq logFitsParRecord should be used with extreme caution only as one needs to take care that value is at least 256 bytes long See also the CAUTIONS section below Conversion from string values is done using sscanf 3 which means that e g floats are simply truncated if converted to integer No errors are returned if this conversion fails e g attempting to convert abc to a integer but the value shown in the log will of course be wrong it will be set to zero HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 The exact format of the FITS logs generated by these commands is described in the manpages of the underlying respective logFits 3 procedures ENVIRONMENT The setting of the global Tcl variable seq moduleId is used as the CCS module identifier in the the underlying logFits 3 calls RETURN VALUES OK return if no errors occurred The result string is empty ERROR return if one of the following conditions is met with corresponding rror message here between quotes wrong args should be seq logFitsAction dictionary category lt subsys gt lt action gt the corresponding Sequencer command was given with the wrong number of arguments wrong args should be seq logFitsComment who logStr
29. Tk toolkit John K Ousterhout ISBN 0 201 6337 X errResetStack 3 errAdd 3 errCloseStack 3 errGetStackSize 3 errGetFromStack 3 errDisplay HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 93 Last change 28 03 02 10 36 94 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq evtAttach n NAME seq evtAttach seq evtDetach seq evtSingleDisable seq evtList database and event management commands SYNOPSIS seq ev or seq ev S q ev seq ev seq ev seq ev D tSingle ESCRIPTION seq evtAttach in its first form will attach an event to a database attribute tDetach eventHandle Disable eventHandle tSingleEnable eventHandle tAttach attrName filter script tAttach cmdId timeout script tList status attrName filter script seq vtSingleEnable all It can be attrName the database attribute to which an event has to be attached is either a symbolic address or its alias filter to condition which should generate th vent or LT for less than lt lt or LE for less or equal or EQ for equal or GT for greater than gt gt or GE for greater or equal or NE for not equal w or W for any write lt gt or gt lt for deadband script the script to execute when an event occurs this script will be evaluated at global level th
30. Tk was first released as free soft ware in early 1990 and since then the number of its users has grown exponentially The amount of good quality add ons to Tcl Tk available on the Internet is constantly growing and several of the extensions find their way into the Tcl Tk core every time a new version is released The current In ternet home site for Tcl Tk is SourceForge www sourceforge net project tcl A good WWW starting point for more information about Tcl Tk is the Tcl ers WIKI URL http mini net cgi bin wikit name More references to Tcl Tk information available via the Internet are given in section 2 8 The Sequencer in its present version is just another of these extensions incorporated into the Tcl Tk core It adds a series of commands which give access to CCS facilities Using these commands as basic building blocks combining them together into procedures scripts one can easily add higher level commands Compared with standard programming languages as C small scripts are most of the time easier to write and debug and the code is much more compact hence maintainable It is obvious that for many applications the Sequencer will be a handy prototyping tool And even in some cases there may be no need to convert this Sequencer language prototype to C language in particular whenever performance improvements are irrelevant The present release of the Sequencer contains 2 applications with this interpreter These shells ad dress mainl
31. To reset the stack add one error and close the stack Does not have a CCS counterpart seq_errPrint Returns all the elements of the error structure corresponding to the last CCS error on the stack at the time an errCloseStack command was given internally by the sequencer shell The latter happens any time when seq command fails due to some CCS error Does not have a CCS counterpart CCS Scan System Interface seq scanConfig args to configure the scan system this is a simple interface on top of the CCS scan system scanConfig utility passing it the list of arguments as given in args CCS Event Handling The CCS event handling is dealing exclusively with database events The Sequencer shells extend this concept to replies on CCS messages which were sent before see 2 3 2 The format of these commands is for the replies identical to the one for the database events The distinction is internally made based on the type of handle which is passed as an argument of each of the commands de scribed below Hence it is clear that only the database event part has a CCS counterpart 12 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq evtAttach To attach to a database event or to a reply event See also evtAttach 3 seq evtDetach To detach from a database event or from a reply event See also evtDetach 3 seq evtSingleDisable To disable a database or reply event See also evtSingleDisable 3 seq evtSingleEnable To e
32. about commands with pending replies or about registered events seq ccsAsyncInput This command does not have a counterpart in CCS it enables or disables the acceptance of asynchronous CCS messages If enabled and when messages come in they will be dispatched immediately using the services provided by zeg msgDispatch see 2 3 2 otherwise they will be rejected returning an error to the originator CCS Message System Interface seq msgSendCommand Maps into msgSendCommand 3 to send a command to a certain destination identified by the parameters of the command If successful this command will return a command handle This handle is internally linked to the relevant information of this command permitting a proper identification and filtering of incoming replies Part of this information is a unique integer number which is passed as the msgCMDID parameter in the msgSendCommand 3 call and it is therefore imperative that the recipient processes of such commands return the original command identifier in their reply When all replies on a certain command have been dealt with the respective command handle is automatically deleted Checking of the CDT of the receiving process can be enabled disabled by means of the zeg ccsCmdCheck variable or by using the no check option with the command seq_msgRecvReply Although without a direct one to one relationship with a CCS message system call this command is similar to msgRecvMsg 3 with a proper
33. and less than signs e g OK gt 13 The default value of 0 means no debugging info gets printed To use this feature some instructions have to be added to your scripts modifying the default value of 0 for the particular command s you want to trace This would typically be in an initialization procedure seq redirect This command allows to redirect output sent to any file descriptor to a disk file instead The size of the resulting file can be kept under control The seq debug global Tcl variable described 14 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 above can be used in combination with this seq_redirect command allowing to store the debug output into a file whose size is kept under control dputs breakpoint showInfo These are additional commands which can be inserted anywhere in a script where more information or access to particular variables is required This can obviously be done at numerous places Although these are very powerful commands it also requires some effort to enable disable these additional instructions in the necessary places and it doesn t work within incr Tcl code seqWish The interactive version of seqWish brings up a Tk application based on TkCon see further down in section 2 4 1 which can communicate with other Tk based applications In other words the commands you type in the seqWish window can be executed in the interpreter of another Tk based application on your screen This
34. are output 5 seqWishl A new window will pop up with the zeg Wich console based on J Hobbs TkCon application as il lustrated in Figure 1 This is now the standard when seqWish is started up interactively The previ ous behaviour can still be enforced by using the noTkCon runstring option Tkcon contains a lot of fancy stuff like command and variable name completion history scrolling via keyboard arrows possibility to save stdin stdout stderr or the command history to a file etc Extensive documenta tion on TkCon is available from its author via the URL http www cs uoregon edu r search tcl script tkcon The Sequencer interpreter can run interactively as a shell or it can also be started to execute imme 1 Most of the examples given here use seqWish this can be substituted by seg Sh according to your needs HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 15 seqWish te67 Main console TkCon Console Edit Interp Prefs History MMain console display active eallaert 1 seqWish 1 gt Figure 1 The console popping up as seqWish is started diately a script and finish when the script tells it has finished The Sequencer shells can actually get their input in each of the following ways Viaa script file This means the shell was invoked with the name of a script like in seqWish myScriptFile In this case myScriptFile contains all Tcl Seq commands the shell should execute Alternat
35. as for event messages The setting up of the queue monitoring is done via a call to segMonitorQ 3 Also the suspension of this service can be requested to the same routine Whenever the timeout in msec or the nrMessages to read leads to an unacceptable blocking of other tasks the read and dispatch loop can be broken with the seq msgDispatchBreak command Timeout defaults to 0 wait forever while nrMessages defaults to 1 The timeout is the time to wait on a msgRecvMsg 3 call for a single message i e it is not the cumulative timeout nor does it take the time to execute th command contained in the message into account seq msgDispatchBreak breaks the execution of seq msgDispatch ENVIRONMENT seq obiScript is a global Tcl variable containing the script to be executed when an obituary message is received This script can contain some variables single characters preceded by a sign giving information about the obituary itself they are substituted just before evaluation of the script 122 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 RETURN VALUES seq_msgDispatchBreak always returns an OK the remainder of this sections is for seq_msgDispatch only OK if no errors occurred the reply contains the number of messages effectively dispatched Remark that this may deviate from lt nrMessages gt depending on the setting of lt timeout gt and the intermediate reception of
36. but it is always safer to declare them explicitly just in case you d like to load your package in another inter preter The list of dependent libraries of a shared library or executable can be retrieved with the chatr utility HP UX or Idd on Solaris Remark that the exact path where your dependent libraries are searched at link time and run time depends a o on the setting of SHLIB PATH under HP UX and LD LIBRARY PATH on Solaris It is highly recommended to go through the documentation of vltMake and shared libraries on your system 2 6 3 Loading a package Once this package has been built successfully following the rules explained above and the resulting shared library libseq sl has been installed in e g TCLTK_ROOT lib it can be loaded into seqSh or seqWish using the load command seqSh gt load TCLTK ROOT lib libext sl If as in the example the package name is not explicitly provided as an argument to the load com mand Tcl will try to guess it as follows take the last element of the library filename strip off the first three characters Jib and use any following alphabetic and underline characters as the module name up to when a non alphabetic character appears So the result in our case is ext As the first character is for the package handling anyway upshifted ext is in this context equivalent to Ext HOS Sequencer Ulser Manual 3 VLT MAN ESO 17220 0737 23 which is just fine The resulting guessed name for th
37. empty ERROR return if argument count is wrong or if seq_logFitsParRecord fails with a corresponding error message CAUTIONS none EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq logStringRecord OBS OBS NAME this is my name seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X seq logFitsParRecord n logFitsParRecord 3 Last change 28 03 02 10 36 115 116 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq logTclErrors n NAME seq logTclErrors send all output for stderr also to the error log SYNOPSIS seq logTclErrors open close DESCRIPTIO seq logTclErrors allows to send strings that normally go to exclusively to stderr also to the CCS error log This feature is enabled by setting the argument to open and disabled by setting it to close Once active errors logged will all have the same stack id until this logging is closed This command relies on a file event Such events are only handled when the Sequencer is idle i e when it is not busy evaluating commands from a script In other words the output to the error log may not be visible immediately depending on the Sequencer s activity ENVIRONMENT When this error logging is active
38. is taken whenever the first CCS function gets called for CCS internal needs If this first CCS function is not a ccsInit this value of RTAPENV will anyway be used later when ccsInit gets called independent of RTAPENV s value at that later time This means that e g in the wtctest environment issuing first a seq errResetStack command followed by a set env RTAPENV xyz and a seq ccsInit command will lead to a ccsInit in the wtctest environment instead of the xyz environment This is not inherent to seg but rather to CCS lite In fact to enable an effective modification of the environment variable RTAPENV within a Sequencer script e g based on runstring options the Sequencer s internal initialization does not call any CCS function under CCS lite thereby shifting the responsibility to do things in the proper order to the application Remark that there are several seq commands apart from the obvious ones that could lead to calls of CCS functions e g seq catch seq errLog seq logTclErrors and seq errDisplay Repeated seq ccsExit commands will normally succeed as repeated ccsExit calls succeed Use the Tcl variable seq ccsStatus if you want to know what CCS state the Sequencer shell is in 45 46 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 The handling of the seq ccsInit command includes rtMonitorQueue Due to what seems to be a bug in the latter af
39. name of a point SYNOPSIS seq dbGetAttrNames lt pointName gt seq dbGetFamilyNames pointName view seq dbGetFieldNames attrName seq dbGetAlias lt pointName gt DESCRIPTION seq dbGetAttrNames will retrieve the list of names of the attributes belonging to a point lt pointName gt string containing a symbolic address of the point whose attributenames we want to know seq dbGetAttrNames will return a single list containing the names of the attributes seq dbGetFamilyNames will retrieve the symbolic addresses of the parent and the children of a point lt pointName gt string containing a symbolic address of the point whose family addresses we want to know ER view view specifier for the addresses can be either ABSOLUTI ALIAS or RELATIVE both upper and lowercase allowed seq dbGetFamilyNames will return a list containing the following values 1 the parent s address 2 the addresses of the children one list element per child If the point does not have any children this list will contain only one lement i e the parent s address seq dbGetFieldNames will retrieve the list of names of the fields of a TABLE attribute attrName string containing a full symbolic address of the attribute whose fieldnames we want to know seq dbGetFieldNames will return a single list containing the names of the fields seq dbGetAlias will retrieve the a
40. new commands 2 0 07 11 1997 Sections 2 3 4 Added description of new commands exten sions in sections 2 3 3 and 4 Added section 2 8 Internet resources on Tcl Tk 2 1 13 10 1998 Section 2 3 2 Added obituaries SPR 960459 Sections 2 3 8 2 7 New var seg_errReplyMerging SPR 980464 Section 2 3 10 New command seg deleteHandle 2 2 06 03 2001 Section 2 3 Updated version numbers of components Section 2 3 11 Added seg debug and zeg redirect description Section 2 8 Updated list of URLs Section 3 Updated version numbers instructions 3 28 03 2002 Section 2 3 4 Added seq logFits cmds SRP 2001098 Sections 2 3 1 Reflects new version of Tcl Tk HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 The information contained in this manual is intended to be used in the ESO VLT project by ESO and authorized external contractors only While every precaution has been taken in the development of the software and in the preparation of this documentation ESO assumes no responsibil ity for errors or omissions or for damage resulting from the use of the soft ware or of the information contained herein HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 1 INTRODUCTION 1 1d PURPOSE 0 rein 08 1 uta dieto dat p ESSA C I d 1 1 REFERENCE DOCUMENTS 424 4 dee a b etg educa a e ex a AO Lee OE Cod 1 14 ABBREVIATIONS AND ACRONJYMS e
41. not known in advance seq msgFlush Does not have a corresponding CCS message system call It flushes either the currently available replies or waits for all pending replies from a certain environment process seq msgDispatch seq msgDispatchBreak When asynchronous messages events are enabled seq msgDispatch will be executed automatically whenever a message is available on the queue It will pull this message from the queue and process it as required The Sequencer shells can deal with all standard CCS message types as shown below a The most frequent typical case is of course a reply or error reply message If it is of this type the message will be copied over to dynamically allocated memory until a request is made for this reply If the message is a reply to a command to which a callback script has been associated this script will be executed b The Sequencer shells can also receive a limited set of commands If the message is the command SCRIPT it will send an immediate acknowledge evaluate the body of the command and return a final reply with the result of the evaluation if this result does not fit into a single reply seq msgDispatch will chop it up automatically into multiple replies If the message is any other command except of course the commands supported by CSS like PING it will send an error reply c Similarly if the message is a database event the callback script associated to it will be evaluated If this e
42. number of arguments invalid cmd handle lt cmdId gt if lt cmdId gt is not a command handle invalid event handle eventHandle if eventHandle is not an event handle cannot detach eventHandle if the call to evtDetach 3 returns an error wrong args should be seq evtSingleDisable eventHandle when the seq evtSingleDisable command is given with the wrong number of arguments HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 cannot de activate lt eventHandle gt when seq_evtSingleDisable 3 returns an error wrong args should be seq_evtSingleEnable lt eventHandle gt when the seq evtSingleEnable command is given with the wrong number of arguments cannot re activate lt eventHandle gt when seq evtSingleEnable 3 returns an error wrong args should be seq evtList status attrName filter Script all when the seq evtList command is given with the wrong number of arguments bad option arg should be status attrName filter script or all when the seq evtList command is given with a bad argument CAUTIONS As events associated with LCU database attributes do not return the full information about the process causing the event an attempt to use the Sp substitution will result in errors in this case A deadband event can only be attached to an LCU database attribute moreover this requires th vent to be configured previously with a call to
43. quotes wrong 4 args should be seq logData logString the corresponding Sequencer command was given with the wrong number of arguments cannot log lt logString gt logData returned an error for this argument CAUTIONS None EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq logData Hi mom I crossed the street without looking seqWish SEE ALSO Tcl and the Tk toolkit John Ousterhout ISBN 0 201 6337 seqLogData 3 logData 3 Last change 28 03 02 10 36 107 108 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq logFitsAction n NAME seq logFitsAction seq logFitsComment seq logFitsEvent seq logFitsParRecord generate FITS logs SYNOPSIS seq logFitsAction dictionary category subsys action seq logFitsComment who logString seq logFitsEvent type lt logString gt seq logFitsParRecord type dictionary cat subsys param value DESCRIPTION seq logFitsAction will generate a FITS action record Its arguments are dictionary name of the dictionary that will be checked for correctness of the other arguments remark that this does not include the ESO VLT DIC prefix category 3 letter keyword category lt subsys gt
44. the attribute integer s in the dbTYPE range datatype Remark that for TABLEs only the data types of the fields which will be written into must be specified the number of attribute records to write the number of attribute fields to write The latter two pieces of informations correspond to the information returned by seq dbGetAttrInfo If attrInfo is not specified a call to dbGetAttrInfo will be issued to retrieve these data which may slow down this function somewhat value the new value s for the attribute For attributes of type VECTOR and TABLE the last argument is a list with as many elements as records have to be written As usual in Tcl Tk lists if only one record is written i e if this list contains only one element enclosing braces are not needed DH For attributes of type TABLE the data types part of attrInfo is a sublist This data type list contains on lement per field The argument with the values consists of on lement per record as for VECTORs However her ach element is a sublist with one element value per field The number of records to write for VECTORs and TABLEs is taken from the attrInfo its absence via a call to dbGetAttrInfo It is checked against the length of the list of new attribute values The DB end range character is fully supported for both record and field ranges as are record a
45. they are linked statically into the Sequenc er shells and are as such available from the very start up of the Sequencer shells There is nothing extra to be done to have access to the functionality offered by these extensions Other extensions like expect can be loaded dynamically as the need arises For a detailed explanation of these exten sions please refer to their accompanying documentation and manpages The rest of this section will concentrate on the specifics of the Sequencer shells All the Sequencer shell specific extensions to Tcl show up as commands with the prefix seq_ In as far as these extensions are atomic and have a clear mapping to a CCS function the rest of the com mand name is the one of the corresponding CCS command with the same case e g seq_dbGetAttrInfo For the other commands similar naming conventions are used Both Sequencer shells seqSh and seqWish include an identical set of seq_ commands For all CCS functionality required in the Sequencer shells atomic commands are made attempting to map a single CCS function into a single Sequencer shell command These basic commands can then be used to build more complex ones i e Tcl Sequencer procedures From the user s perspec tive there is no difference between procedures and C coded commands except perhaps for a slight performance penalty in the case of Tcl scripts In what follows the different Sequencer shell commands are grouped according to functionality
46. third wow again wow more seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X seqDbReadSymbolic 3 seqInit 3 dbReadSymbolic 3 dbDeToStr 3 Last change 28 03 02 10 36 73 74 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq dbSetCwp n NAME seq dbSetCwp seq dbGetCwp set get the current working point SYNOPSIS seq dbSetCwp pointName seq dbGetCwp lt envName gt DESCRIPTION seq dbSetCwp will set the current working point lt pointName gt the database point to set the current working directory to is either a symbolic address or its alias seq dbGetCwp will return the current working point envName name of the environment whose current working point has to be returned defaults to the current environment ENVIRONMENT no environment nor Tcl variables are read nor set RETURN VALUES OK return if no errors occurred For seq dbGetCwp the result string contains the current working point not including the environment name RROR return if one of the following conditions is met with corresponding rror message here between quotes wrong args should be seq dbSetCwp pointName the corresponding Sequencer command was given with the wrong number of arguments wrong args should be seq dbGetCwp envName the corresponding Sequencer command was giv
47. this command If it still does it will use a commandId which the Sequencer shell in the meantime may have allocated to another command This could obviously lead to confusion in the reply handling So this deletion of a command handle is intended for cases where one is confident that the partner process is no longer alive or when one has other means to prevent the partner from sending pending replies EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish set cmdId seq msgSendCommand env proc INIT yo us user notifies that S proc died during initialization seqWish seq deleteHandle cmdId seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X seqDeleteHandle 3 deleteHandle 3 Last change 28 03 02 10 36 81 82 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq errAdd n S Seq errResetStack n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 83 seq errCloseStack n S seq errResetStack n Last change 28 03 02 10 36 84 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq errDisplay n S Seq errResetStack n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 85 seq errGetFromStack n S seq errR
48. to be used in other seq dbList commands to refer to this particular list seq dbListAdd add attributes to the multi read write list lt listId gt list handle as returned by seq dbListCreate attrSymAddrN symbolic address of the database attribute including eventual indices but excluding the environment name as the environment to access was defined already by seg dbListCreate Remark that there will be no errors produced if the attribute is already in the list seq dbListRemove remove attributes from the multi read write list lt listId gt list handle as returned by seq dbListCreate attrSymAddrN symbolic address of the database attribute to remove in exactly the same format as it was added initially with seq dbListAdd seq dbListDestroy seq dbListExtract delete a multi read write list lt listId gt list handle as returned by seq dbListCreate extract the information of some attribute s from the multi read write list as a result of a read write operation lt listId gt list handle as returned by seq dbListCreate attrSymAddrN symbolic address of the database attribute whose info is wanted in exactly the same format as it was added initially with seq dbListAdd HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq dbListExtract will return a list with the following info for each attribute given as an argument the attribute type either
49. 1
50. 17220 0737 67 seq dbListRemove n See seq dbListCreate n Last change 28 03 02 10 36 68 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq dbLockPoint n NAME seq dbLockPoint seq dbUnlockPoint lock unlock a database point SYNOPSIS seq dbLockPoint lt pointName gt lt timeout gt seq dbUnlockPoint pointName DESCRIPTION seq dbLockPoint will lock a single point in the database lt pointName gt symbolic name or alias of the point to lock timeout number of seconds the point will be locked range 3 to 60 default 3 The point will remain locked for timeout seconds unless a seq dbUnlockPoint command is given before the timeout expires seq dbUnlockPoint will unlock a locked database point ENVIRONMENT no environment nor Tcl variables are read nor set RETURNVALUES OK return if no errors occurred The result string is empty ERROR return if one of the following conditions is met with corresponding rror message here between quotes wrong args should be seq dbLockPoint pointName timeout the command was given with the wrong number of arguments wrong args should be seq dbUnlockPoint lt pointName gt the command was given with the wrong number of arguments rror message left by Tcl GetInt applied on timeout cannot lock point pointName dbLockPoint returned an error for this argument cannot unlock point
51. EUROPEAN SOUTHERN OBSERVATORY Organisation Europ enne pour des Recherches Astronomiques dans l H misph re Austral Europ ische Organisation f r astronomische Forschung in der s dlichen Hemisph re VERY LARGE TELESCOPE VLT Software HOS SEQUENCER User Manual Doc No VLT MAN ESO 17220 0737 Issue 3 de Date 28 03 2002 E Allaert 28 03 2002 Prepared u a dune aeu eto u ia anaqman eus ER Name Date Signature G Raffi Approved a OS EROR det Eug Name Date Signature G Raffi Released go hd cu eU D bet de da p a us kt Name Date Signature VLT PROGRAMME TELEPHONE 49 89 32006 0 FAX 49 89 320 2362 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 Hi Change Record Issue Rev Date Section Page affected Reason Initiation Document Remarks 1 0 17 11 94 All First version 1 1 02 03 95 Section 2 Release of Sequencer version 1 2 with new func tionality 1 2 30 07 95 Sections 2 and 4 Release of Sequencer version 1 11 with new functionality Distinction between Sequencer shells and Sequencer tool 1 3 15 01 06 Section 2 Some commands added for release 1 21 of Sequencer shells 1 4 28 05 96 Sections 2 3 Reflected new version of Tcl Tk presence of RTD and Msgltcl extensions also 2 new com mands 1 5 24 04 97 Sections 2 3 Reflected new version of Tcl Tk Added section 2 4 4 SPR 970101 Added section 2 6 dynamic loading 2
52. Eval See seglnitInterp 3 Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 33 segInitInterp 3 NAME SegInitInterp seqEval create and initialize a Sequencer interpreter and evaluate a Sequencer script SYNOPSIS include seq h CCSCOMPL STAT seqInitInterp char reservedl char reserved2 vltLOGICAL interactive Tcl Interp interp CCSERROR error CCSCOMPL STAT seqEval Tcl Interp interp char script CCSERROR error DESCRIPTION segInitInterp creates and initializes a Sequencer interpreter reservedN dummy string interactive flag to signal if this is an interactive application like a shell i e if typed commands have to b xpected If true the Tcl variable tcl interactive is set to 1 This is needed for the initialization of TclX interp pointer to the returned interpreter pointer error CCS error structure pointer segInitInterp will call the Tcl AppInit function to initialize the interpreter The libseq library contains such a function which is identical to the Tcl AppInit function used by seqSh In other words the version of Tcl AppInit included in libseq initializes all extensions just as seqSh does i incr Tcl Tcl TclX and seq If more extensions are needed lik g SeqOslx they have to be loaded dynamically via seqEval see the Tcl load and package commands Remark that if Tcl AppInit
53. On top of that if bit 3 of seq debug seq msgDispatch is set there will be additional info printed on incoming event messages RETURN VALUES OK return if no errors occurred For seq evtAttach the result string contains the event handle eventNNN for database events lt cmdId gt for reply events to use when referring to this this event with any other seq evt command For seq evtList the result string is a list of sublists one sublist per event with elements as requested ERROR return if one of the following conditions is met with corresponding rror message here in bold face wrong args should be seq evtAttach attrName filter lt 1 50 gt or seq evtAttach cmdId timeout script when the seq evtAttach command was given with the wrong number of arguments invalid cmd handle lt cmdId gt no replies pending on it if a command was given with a cmdId which has no more pending replies i e th handle is no longer valid invalid event handle lt eventHandle gt no database events associated with it if a command was given with an lt eventHandle gt which is no longer valid invalid filter filter should be one of lt lt gt gt W when the filter is not valid cannot attach event to attrName if the call to evtAttach 3 returns an error wrong args should be seq evtDetach eventHandle when the seq evtDetach command is given with the wrong
54. VECTORs the number of records and number of fields RROR return if one of the following conditions is met with corresponding rror message here between quotes wrong args should be seq dbGetAttrInfo attrSymAddress the command was given with the wrong number of arguments cannot get info on attrSymAddress dbGetAttrInfo returned an error for this argument t EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish gt prompt and all replies on a new line seqWish seq dbGetAttrInfo lt alias gt eric myScalar SCALAR 5 1 1 seqWish seq dbGetAttrInfo lt alias gt eric myVector VECTOR 6 15 1 seqWish seq dbGetAttrInfo lt alias gt eric myTable ABLE 20 24 25 5 3 seqWish seq dbGetAttrInfo lt alias gt eric myTable 0 0 1 2 ABLE 24 25 12 seqWish 49 50 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 SEE ALSO Tcl and the Tk toolkit John K Ousterhout seqDbGetAttrInfo 3 dbGetDirAddr 3 Last change 28 03 02 10 36 ISBN 0 201 6337 X HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq dbGetAttrNames n NAME seq dbGetAttrNames seq_dbGetFamilyNames seq dbGetFieldNames seq dbGetAlias list the attributenames of a point get the symbolic addresses of parent and children list the field names of a table or get the alias
55. a severity of warning seq errDisplay will by default use the information of the last CCS error which is stored in a global C variable for use by all seq commands So if the seq errDisplay command is not called immediately after detecting such an error or if the suspend option is not used the displayed values may not correspond to what is expected Subsequent calls to seq errDisplay without destroying windows in between will simply update the information displayed in these error stack windows This may not be the desired effect for panels with classes that can try simultaneously to display errors via the seq errDisplay command EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq errResetStack seqWish seq errAdd Who the hell deleted this file my procedure seqWish seq errCloseStack This error can now be seen with the log monitor seqWish seqSendCommand wte67 otherSeq SCRIPT puts hello seqWIsh seq msgRecvReply 0000 en lr all SeqERR NO CMDS ALLOWED Command SCRIPT rejected no commands allowed seqWish seq errGetStackSize 1 seqWish seq errGetFromStack 1 wte67 0 4869 1 segMsgDispatch c seq 122 seqERR NO CMDS ALLOWED Command SCRIPT rejected no commands allowed 97 02 14 15 35 53 324656 seqWish SEE ALSO Tcl and the
56. able NOCCS exists when the installation procedure is started the Sequencer shells will not contain any CCS extensions i e they will be Tcl Tk windowing shells containing the extensions as described in the introduction of 2 3 Otherwise if RTAPROOT exists the CCS functionality based on RTAP calls will be included If both NOCCS and RTAPROOT are undefined the CCS light libraries will be used Remark that the settings of NOCCS and RTAPROOT should reflect the real status of the worksta tion the Sequencer shells are generated and supposed to be executed on Trying to generate e g a CCS light seqWish on a workstation equipped with RTAP and full CCS is not a good idea and may HOS Sequencer Ulser Manual 3 VLT MAN ESO 17220 0737 29 fail at any one stage 3 3 VERIFICATION The proper installation of the Sequencer can be tested as follows start up the Sequencer shell seqWish noTkCon The sequencer prompt seqWish gt should show up in the window where you started the Sequencer from type at the sequencer prompt wm deiconify Now a small window the Tk main window should pop up Continue with info commands seq and a list of all the Sequencer extensions to Tcl should be printed Do the same thing for BLT namespace eval blt info commands and incr Tcl info command itcl exit the shell exit If any of this fails the error messages should be a first and concise help for what went wrong One should in particular
57. able where to store the lastReply flag will contain 0 if there are more replies 1 if this reply is the last This variable will not be touched untill the reply ies came in successfully Remark that imbedded applications which call seqInitInterp can have an event loop out of the sequencer s control i e they can call ccsInit instead of eval ing seq ccsInit which would activate the monitoring of the message queue within the sequencer s event loop In these cases seq msgRecvReply will by default issue a blocking msgRecvMsg call with infinite timeout as it cannot count on the sequencer s monitoring of the message queue FILES no files are accessed ENVIRONMENT lt errornumber gt and lt lastReply gt see above The value of the seq ccsCmdCheck variable at the time the command was sent is used to flag the expected presence of the CDT of the process the reply comes from It influences the default behaviour of seq msgRecvReply ascii or fbin RETURN VALUES OK if the reception of the reply caused no errors In this case the result string contains either the reply or error message received An eventual error will be returned independent of the setting of the bin option Remark that this OK return does not necessarily mean that the originator of the reply signalled all is OK cf the lt errorNumber gt variable ERROR if one of the following conditions is met with
58. age sent with seq msgSendCommand The handle itself will be removed all buffers corresponding to replies which are already in but which are not yet retrieved via e g a seg msgRecvReply command will be freed Remark that also the corresponding commandId will be freed up for re use Consequently replies for this particular command which are not yet on the queue can no longer be handled properly after issuing a seq deleteHandl s CAUTIONS an event handle as obtained by issuing 8 seq_evtAttach command There will be an evtDetach call before the handle is removed This is equivalent to the command seq_evtDetach an alarm handle as obtained by issuing seq alrmAttach command There will be an alrmDetach call before the handle is removed This is equivalent to the command seq alrmDetach a script handle as received with 8 SCRIPT command s seq msgSendReply The process which sent this SCRIPT command will receive a final reply indicating that the script handle is being deleted and no further processing will take place a multi read write list as obtained with a seq dbListCreate command This is identical to issuing the seq dlListDestroy command As indicated above for event handles and list handles seq deleteHandle is equivalent to seq evtDetach resp seq dbListDestroy There is no obvious reason why one would want to delete a script handle as they are under normal condition
59. ame string returned by the command infox for all CCS cases this string is pointed to by tclAppLongName if defined CCS FULL define seqLONGNAME The VLT Sequencer with full CCS define seqCCSTYPE full elif defined CCS LIGHT define seqLONGNAME The VLT Sequencer with CCS light define seqCCSTYPE light else 149 150 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 define seqLONGNAME The VLT Sequencer without CCS define seqCCSTYPE none endif define tclPRECISION tcl precision Tcl var linked to define seqMODULEID seq moduleId Tcl var linked to segModuleId define seqERRLOGGING seq errLogging Tcl var linked to seqErrLogging define seqERRREPLYMERGING seq errReplyMerging linked to seqErrReplyMerging define seqCMDCHECK seq ccsCmdCheck Tcl var linked to seqCmdCheck define seqOBISCRIPT seq obiScript Tcl var linked to seqObiScript define seqREPLYTIMEOUT reply timed out return string value for a timedout reply define seqDEFAULTID seq default module Id cf errAdd package name is derived from this 1st character is upshifted define seqDEFAULTCHECK NO CHECK def check cf msgSendComma
60. and are described shortly More detailed explanation can be found in the references chapter 4 Re 1 Remark that up to and including the November 1996 release of the Sequencer RTD was a standard part of seqWish This is no longer the case RTD is now a loadable extension If any RTD function is required within seqWish if suffices to give first the command package require Rtd HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 mark that there are currently no differences between full RTAP based CCS and CCS light all commands and libraries available in the former are also available for the latter On the other hand if the Sequencer shells are built in an environment without CCS the CCS calls will obviously not be part of it One notorious exception to this is for the error handling where a CCS like replacement for some err calls exist and are being used in the Sequencer shells In particular seq errResetStack seq errAdd and seq errCloseStack exist also for a no CCS environment 2 3 1 2 3 2 CCS Environment Interface seq ccsInit Maps into ccsInit 3 to register the Sequencer shell with CCS as the process with an arbitrary name lt myProcName gt After this command has been issued this process is known to CCS as lt myProcName gt which is one of the parameters required to address this process via CCS cf msgSendCommand 3 seq_ccsExit To execute ccsExit 3 and reset internal linked lists containing information
61. ay n See seq relToAbsPath n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 145 seq waitTillActive n See seq relToAbsPath n Last change 28 03 02 10 36 146 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq waitTillDead n See seq relToAbsPath n Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 147 seqCon n NAME seqCon start up tkcon within the seqWish interpreter SYNOPSIS Source seqCon tcl DESCRIPTION seqCon is a script which will invoke tkcon and customize it to the seqWish style The script will however return without action if the seqWish runstring includes noTkCon or if this is a non interactive shell ENVIRONMENT The argv array is checked for the presence of the switch noTkCon in which case tkcon will not start up xl SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X kcon documentation http www cs uoregon edu research tcl script tkcon Last change 28 03 02 10 36 148 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 5 PUBLIC INTERFACE FILE ifndef SI define SI JAA HK IK kk k Kk K K K K K K K K K K KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK I KOK KOK KOK K ke 8 0 VLT projec
62. change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq dbGetDirAddr n NAME seq dbGetDirAddr seq dbDirAddrToNam get the internal address of a point or attribute or convert the direct address into a symbolic one SYNOPSIS seq dbGetDirAddr lt attrSymAddress gt seq dbDirAddrToName lt directAddress gt lt DESCRIPTION seq dbGetDirAddr will retrieve the detailed description of an attribute attrSymAddress string containing a symbolic address of the attribute in a format as permitted by dbGetDirAddr 3 seq dbGetDirAddr will return a formatted string which is understood by several db Rtap routines and utilities as a direct address seq dbDirAddrToName will convert the direct address into a symbolic one directAddress string with a direct address of a point attribute view view specifier for the address can be either ABSOLUTE ALIAS or RELATIVE both upper and lowercase allowed seq dbDirAddrToName will return the corresponding address in the form as specified in view ENVIRONMENT no environment nor Tcl variables are read nor set RETURN VALUES OK return if no errors occurred In this case the result string contains the address ERROR return if one of the following conditions is met with corresponding rror message here between quotes wrong args should be seq dbGetDirAddr lt attrSymAddress gt the command was given with th
63. d according to whether or not the noTkCon option is specified 16 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seqWish noTkCon seqWish To this category belongs also the typical constructs where input is piped into the shell echo seq ccsInit puts seq dbGetAlias wte67 PARAMS seqSh lt alias gt PARAMS 5 Remark that seqWish enters the event loop automatically when it sees EOF this is different from seqSh s standard behaviour which is to terminate when it reaches the EOF That means for the above examples with seqWish that the input should include an exit command if the desired behav iour is to exit when the EOF is reached If the other way around seqSh should not terminate a vwait or commandloop command is needed see the manpages of vwait n resp TclX n Contrary to the standard Tk shell wish you will not see a small blank square window popping up on your display if you run the shell interactively If you want to see this window type seqWish wm deiconify Although there are no major differences between running the Sequencer interactively vs non inter actively one should be aware of the following In an interactive shell the result string returned by a command executed from the prompt is normally echoed back to the user If an error occurs the error message will be displayed preceded by the string Error The set command is treated as a special case if set is called with two argum
64. d overriding the global setting of the seq ccsCmdCheck Tcl variable see below lt envName gt name of the environment where the command has to be sent to lt procName gt name of the recipient process command name of the command to send to the environment process args the arguments to pass along with command as the message body This can spread multiple words and the Sequencer will concatenate them into a single message body string separating neighbouring arguments by a single space similar to Tcl s join command Remark however that in this case the Tcl parser and the Sequencer need to do some work on args which can be avoided it is more efficient to have args grouped as a single word g between quotes or if there are no substitutions required between curly braces The joining of the args happens of course after applying the standard Tcl substitution and grouping rules When arguments containing quotes are involved unexperienced Tcl users will often consider this an odd behaviour Again this situation can be avoided by grouping args into a single Tcl word see EXAMPLES section In the absence of noreply and when send msgSendCommand is successful it returns the next available command handle This handle points to a o the msgCMDID parameter sent to the destination The latter msgCMDID is derived from the handle name it is the numeric part of it and i
65. d internal error stack while local means it will get appended to the default error stack accessed by seq errAdd n and company see also seq errResetStack n seq ccsCmdCheck is a global Tcl variable which is writable initialized to NO CHECK and linked to the global C variable seqCmdCheck of type msgCHECKFLAG This C variable is in seq msgSendCommand passed on to msgSendCommand 3 Allowed values for seq ccsCmdCheck are NO CHECK and CHECK It is also used in seq msgRecvReply to decide whether formatting of replies should be attempted by default i e it won t if seq ccsCmdCheck is set to NO CHECK seq ccsType is a global Tcl variable read only which reflects how the shell was linked It is set to either full light or none depending on whether the shell was linked with full CCS CCS light or without CCS seq debug is a global Tcl array variable which reflects the debug info flag for each of the primary seq commands it can handle Each of the elements of this array can be set to O default no debug info or have any combination of the following bits set bit 0 print stack level command name plus arguments to stderr 1 return value gets printed 2 print timestamp and 3 print internal command specific debug info If bit 1 is set the return value is printed as OK or ERR followed by the return string put in between greater than and less than signs e g OK lt 13 1 gt Th
66. d only initialized to SeqNAME as defined in seq h and linked to the global C variable myProcName This C variable is used as the default name under which to register the Sequencer with CCS see seq ccsInit seq moduleId is a global Tcl variable which is writable initialized to seq and linked to the global C variable segModuleId of type ccsMODULEID This C variable is used only in the seq errAdd command and allows to modify the moduleId argument of the underlying call to errAdd 3 seq errLogging is a global Tcl variable which is writable initialized to auto It reflects how the logging of errors occuring during the execution of seq commands should be dealt with auto leads to automatic logging of all unrecoverable errors by issuing an errCloseStack off will not log any error by issuing an errResetStack while manual will not issue any err Stack command assuming that the script will take care of this see seq err commands In all cases the error stack remains accessible with the seq errGetStackSize and seq errGetFromStack commands 35 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq errReplyMerging is a global Tcl variable which is writable initialized to off It reflects how the error stacks received as part of message replies are dealt with off means an error reply will not be merged into any other error stack internal means it will end up at the bottom of the so calle
67. data type info inconsistent with number of fields for TABLEs with less more data type info than the number of fields indicates record i expected m data values have got n for TABLES the number of values in each sublist record of the last argument should equal the number of dataType elements record i field m could not convert valueX to dbTYPE lt gt the routine dbStrToDe 3 choked on this conversion of a TABLE data element record i could not convert valueX to dbTYPE n as above but here for the conversion of a VECTOR record could not convert lt valueX gt to dbTYPE lt n gt as above but now for the conversion of a SCALAR cannot write to database the call to dbWriteSymbolic failed CAUTIONS Although named record and field indices are allowed they require an additional access to the database to convert them to numbers This means extra overhead which is avoided by giving numbers Additionally this works only for the local environment as it relies on dbGetDirAddr 3 The buffer needed to write the attributes values to the database via an dbWriteSymbolic call is automatically resized if necessary and never deallocated This may cause for unfairly big writes to TABLEs a one time noticeable growth of the process memory EXAMPLES For clarity s sake th xam
68. ddressing by content and field addressing by name Remark that some values e g time values can be sub lists ENVIRONMENT no environment nor Tcl variables are read nor set RETURN VALUES OK if no errors occurred with an empty result string ERROR if one of the following conditions is met with corresponding rror message here between quotes wrong args should be seq dbWriteSymbolic lt attrSymAddress gt XattrInfo lt value gt the corresponding Sequencer command was given with the wrong number of arguments 77 78 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 attrInfo should contain the data type if the attrInfo list has only one element attrInfo for VECTOR should contain the record count if the attrInfo list has only two elements for an attribute of type VECTOR attrInfo for TABLE should contain the record and field counts if the attrInfo list has less than 4 elements for an attribute of type ABLE attribute type attrType unknown should be SCALAR VECTOR or ABLE the attribute type specified is none of the thr listed errors from parsing integers data type record count field count errors from list splitting attrInfo dataType for TABLE value for VECTOR and TABLE amount of data incompatible with attribute info for VECTORs and TABLEs with less more data than the number of records indicates amount of supplied
69. ds to CCS PING messages env environment where the process is running proc name under which the process is registered with CCS timeout how long to wait in ms before the seq waitTillDead returns an error remark that this timer starts after the reply to lt exitCmd gt came in period period in ms for sending PING commands default 100 ms This determins the resolution of timeout lt exitCmd gt If not empty seq waitTilDeadlActive will first of all send the command exitCmd to proc using seq msgSendCommand before starting to test if it is still active If this parameter is given seq waitTillDead wait for a reply on this command and wait for an additional 2 seconds before polling with the PING command If the exitCmd argument is not given the script calling this command should make sure e g using a delay that the process had a reasonable chance to terminate before calling seq waitTillDead Otherwise the PING commands may still get on the queue of the terminating process while it is exiting and therefore it would not reply Although seq waitTillDead would finally timeout after timeout ms and consider the process for that reason dead this delay in coming to that conclusion could surprise the user There are no errors logged for the failed attempt to send a PING command nor for the failing of seq waitTillDead itself If seg waitTillDead cannot communicate with lt env gt lt p
70. e 3 choked on this conversion of a TABL element record i could not convert valueN to dbTYPE n as above but here for the conversion of a VECTOR record could not convert valueN to dbTYPE lt gt as above but now for the conversion of a SCALAR data CAUTIONS Comparing seq dbLisExtract s return string for the case of a single attribute with the case of multiple attributes one might detect a slight inconsistency For the latter the reply will consist of a list with one element per attribute Each of thes lements are on their turn a list containing the attribute type data type s status quality and value s some of which can again be sublists If there is on the other hand only one attribute passed to seq dbListExtract the reply will not be a list with a single element extrapolating the above scheme but rather the contents of that single element The advantage of this approach is that one does not need so many HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 layers of list handling commands in the most trivial case of a single attribute EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq dbListCreate wte67 r listo seqWish gt set attr
71. e current stack frame The optional argument level indicates how many more levels to go up in case several of these debug procedures are nested e g when dputs calls breakpoint showInfo print useful information about the stack level stack level procedure name and arguments to stderr Based on PracTcl Programming Tips Linux Journal October 1995 by Stephen Uhler RETURN VALUES as any Tcl procedure CAUTION The breakpoint proc seems to have some problems with namespaces i e when in a child namespace it can complain that perfectly fine procedures are not procedures It looks like a bug in the uplevel command Last change 28 03 02 10 36 40 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq catch n NAME seq catch evaluate a command and return its completion status SYNOPSIS seq catch command msg sourceId DESCRIPTION seq catch has an identical syntax and behaves as the Tcl catch command command any Sequencer script msg variable name where to store the result string for command sourceid string containing location identifier remark that only the first word of this string will be transmitted to the CCS error logging system On top of what catch does seq catch logs the error if any produced by command to the CCS error logging system For that purpose it can use the optional sourceId argument which is for the error system known as
72. e global variables accessed by the Sequencer shells The most important ones are argc number of commandline arguments argv0 the name of the executable script file or the shell s name argv the commandline arguments take into account that argument name value pairs which are recognized by the shell itself should come first on the commandline and willnot be part of argv E g 5 seqWish display myXTerm 0 0 myArgl Vall myArg2 Val2 seqWish set argv myArgl Vall myArg2 Val2 auto path list of paths to search to locate Tcl scripts Used by the auto load command and the unknown command handler Initialized by 161 TclInit tcl and extended by seglInit tcl env array variable whose elements are all of the process s environment variables tcl interactive set to 1 by TclX if the shell is invoked interactively tcl precision the number of significant digits to retain when real values are converted to strings tcl prompti contains Tcl code to generate the prompt used when interactively prompting for commands The code in this hook will be evaluated and the result will be used for the prompt Initially set to the programs s name followed by a greater than sign e g seqWish gt 1 The use of this variable is extended by the Sequencer interpreter to DB reads as well The Sequencer shells will also initialize this variable to a compiled in default 24 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 tc
73. e h int Seq Init Tcl Interp interp DESCRIPTION This function initializes the interpreter for the commands that are specific for the Sequencer This comes down to initializing a few global Tcl variables declaring the new commands and finally the execution of the initialization script segInit tcl FILES segInit tcl is evaluated at th nd i e after all commands have been successfully declared ENVIRONMENT The environment variable SEQ LIBRARY gives the pathname where a number of predefined Sequencer scripts are looked for including the initialization script segInit tcl seq library is a global Tcl variable derived from the environment variable SEQ LIBRARY If this environment variable is not set seq library will be set to one of the following paths in this order of precedence lib libseqTcl tcl SINTROOT lib libseqTcl tcl SVLTROOT lib libseqTcl tcl The environment variable SEQ DEFAULT PREC gives the default precision that will be used for printing floats and for conversion of database values to strings tcl precision is a global Tcl variable which is writable and which is set to SEQ DEFAULT PREC If this environment variable is not set a default precision which was given at compilation time will be used s Makefile tcl precision is also linked to the global C variable seqPrecision seq ccsProcName is a global Tcl variable which is rea
74. e initialization procedure is Ext_Init which is correct and which is or should be part of libext sl Ext Init will be called as soon as the actual loading of the shared library into shared memory is ready There are a few alternatives to this scheme in particular via the package command see the proper manpages but they all rely one way or the other on the load command 2 6 4 Examples from the Sequencer Actually the Sequencer is also built as a package contained in libseq sl However due to the licensing scheme this package cannot be loaded dynamically as it will result in an undefined exter nal When the Sequencer is built in a CCS light environment or without CCS it will not contain any commercial products with restrictive license schemes like so a shared seq library built under CCS light or without CCS can be loaded dynamically into any Tcl shell Another component of seqWish namely the package to load pixmap images is also built as a load able extension and can be used by any shell which includes Tk The package name is 5 the shared library is libseg Xpm sl Finally the SegOslx extension is also built as a loadable extension It is actually used as an example in the VLT software context under the example subdirectory of the seg module Check a o Make file seqOslx 2 7 SEQUENCER VARIABLES All global variables set and used by Tcl Tk TclX BLT Msqltc and iTcl are of course a subset of th
75. e start resp end of a comments block The output is a file named lt file gt cpp In the second form the actual pre processing takes place b keep blank lines cpp may actually insert a few blank lines By default blank lines are removed C keep comment lines They are removed by default D additional define directives tclCpp itself defines the MAKE TCL macro I pathnames for include directives file Tcl script file extended with pre processor directives Needs to have a cpp extension The output is a file named as file but without the cpp extension ENVIRONMENT GCC CC used to locate the C preprocessor to be used The default is ooch CAUTIONS tclCpp p will replace the and strings by default even in comment lines and within curly braces by 21 resp x2f x2f being the hexadecimal notation for If this not desired specify also the s option and ensure that these strings will not disturb RETURN VALUES 0 if everything OK 1 in case of errors tclCpp also creates an output file as described abov 31 32 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 5 tclppp p myScript tcl edit myScript tcl cpp to add pre processor directives tclppp myScript tcl cpp SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X cpp 1 Last change 28 03 02 10 36 seq
76. e wrong number of arguments wrong args should be seq dbDirAddrToName lt directAddress gt lt view gt the command was given with the wrong number of arguments cannot get internal address of attrSymAddress dbGetDirAddr 3 returned an error for this argument wrong view specifier should be ABSOLUTE ALIAS or RELATIVE cannot convert lt directAddress gt to a symblic address dbDirAddrToName 3 returned an error for this argument CAUTIONS Suffering from the same limitations as dbGetDirAddr 3 resp dbDirAddrToName 3 these commands work only for the local environment i e there should be no environment name part in lt attrSymAddress gt nor lt directAddress gt EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq dbGetDirAddr alias eric 6 10 55 56 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seqWish seq dbGetDirAddr lt alias gt eric myVector 6 10 0 seqWish gt seq_dbGetDirAddr lt alias gt eric myVector 1 2 10 0 1 2 seqWish seq dbDirAddrToName 10 0 alias lt alias gt eric myVector seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X seqDbGetDirAddr 3 dbGetDirAddr 3 seqDbDirAddrToName 3 dbDirAddrToName 3 Last change 28 03 02 10 36
77. ead can be extracted with the seq dbListExtract command eq dbMultiWrite write a list of attributes on a particular environment block option that signals that all attributes should be considered a unit and consequently to succeed all addresses must be correct and writable by the user Default no blocking lt listIdN gt list handle as returned by seq dbListCreate seq dbMultiWrite will do the actual database access for all attributes in the multi read write list listIdN which was created and prepared previously with the seq dbList commands ENVIRONMENT o environment nor Tcl variables are read nor set K return if no errors occurred The result string is empty ERROR return if one of the following conditions is met with corresponding rror message here between single quotes wrong args should be seq dbMultiRead listIdl lt listId2 gt the command was given with the wrong number of arguments wrong args should be seq dbMultiWrite block lt 1 1 gt lt listId2 gt the command was given with the wrong number of arguments invalid list handle lt listId gt lt listId gt does not start with the word list multi read write list lt listId gt is currently undefined the shell does not know of any multi read write list with this particular lt listId gt multi read for list lt listId gt failed the call to dbMultiRead failed mu
78. efine and execute a series of related observations These sequences are to be interpreted by a sequencer shell Tcl Tk Tool command language Toolkit A general purpose scripting language designed and 2 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 implemented by Dr John Ousterhout of the University of Berkeley CA presently working at Sun Microsystems Laboratories 1 6 STYLISTIC CONVENTIONS The following styles are used bold in the text for commands filenames pre suffixes as they have to be typed italic in the text for parts that have to be substituted with the real content before typing teletype for examples name in the examples for parts that have to be substituted with the real content before typing bold and italic are also used to highlight words 1 7 PROBLEM REPORTING CHANGE REQUEST Please refer to 3 1 to report a problem encountered using the software and or documentation 2 to suggest changes in the software or documentation HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 3 2 USER S GUIDE 2 1 OVERVIEW The Sequencer is intended as a general purpose tool allowing both technical and scientific staff to ease the definition and execution of sequences of commands intended to control the telescopes and instruments The Sequencer is based on Tcl Tk This is an embeddable interpreter with a quite powerful core allowing a o control structures and arithmetic operations Tcl
79. emented as commands rather than grammar They are not understood directly by the Tcl interpreter 2 2 2 Substitution The Tcl interpreter can perform 3 different types of substitution 1 variable substitution when a variable has been set previously it can be de referenced by using a sign in front of the variable name The Tcl interpreter replaces in the commandline the occurrences of the sign followed by a variable name with the string value of this variable Example set myVar 53 expr myVar myVar me Dynamic loading has been supported in Tcl since the release of Tcl 7 5 2 As far as syntax is concerned Tcl and the Sequencer are identical and are used interchangeably in this context HOS Sequencer Ulser Manual 3 VLT MAN ESO 17220 0737 5 will associate the string 53 with variable name myVar and then calculate the square of the variable myVar It is equivalent to expr 53 53 2 command substitution this allows to use the result of one commandline as an argument in another commandline Command substitution is invoked by square brackets Nesting is allowed Example set expr myVar myVar makes the Tcl interpreter first evaluate everything inside the brackets and that result the string 2809 is used as the second argument for the set command 3 backslash substitution the backslash character has in fact two functions It is an escape character for the previous substitutions and also allows to use various un
80. en with the wrong number of arguments cannot set CWP to lt pointName gt dbSetCwp returned an error for this argument cannot get CWP from envName dbGetCwp returned an error CAUTIONS none EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq dbSetCwp lt alias gt eric seqWish seq dbGetCwp users config eallaert seqWish SEE ALSO HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 75 Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X seqDbSetCwp 3 Last change 28 03 02 10 36 76 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq dbUnlockPoint n See seq dbLockPoint n Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq dbWriteSymbolic n NAME seq dbWriteSymbolic write a value to an attribute given its symbolic address SYNOPSIS seq dbWriteSymbolic attrSymAddress attrInfo value DESCRIPTION seq dbWriteSymbolic will write the value into an attribute pointed to by its symbolic address The arguments ar attrSymAddress string containing the symbolic address of the attribute attrInfo list containing 4 elements in the following order the type of the attribute i e SCALAR VECTOR or TABLE attrType the data type s of
81. ents i e to assign a value to a variable the result will not be echoed Such behaviour deviating from standard Tcl is introduced by If set is called with one argument the name of the variable then the result will be echoed as usual Ifthe interactive shell does not recognize a command entered from the prompt then the UNIX command path as specified in the environment variable PATH will be searched for a command of that name If such command is found it will be executed with any arguments remaining on the Tcl commandline being passed as arguments to the command Scripts on the other hand should use the Tcl exec or system commands to run UNIX commands In interactive shell the Sequencer will most likely spend most of its time in the idle loop after sending the prompt and while waiting for user input During this idle loop events X events file events CCS events are handled If the same commands are given from a script the Sequencer shell may not go through its idle loop until the last commandline in the script is evaluated hence it may appear not to be as responsive as when commands are given interactively You can get around this by inserting update commands in your script Depending on the commands given in the initialization script an interactive windowing shell may or may not display its main window Currently seqWish withdraws this window at start up if run interactively Give the command wm deiconify if y
82. eq ccsInit the Tcl filedescriptor used for the message queu monitoring an empty reply for all other commands ERROR if one of the following conditions is met corresponding error message is here between quotes wrong args should be seq ccsInit lt procName gt wrong args should be seq ccsExit or wrong args should be seq ccsAsyncInput open close if the command was given with an improper amount of arguments ccsInit failed if ccsInit failed ccsGetMyProcId failed if ccsGetMyProcId failed seq ccsInit was given before if more than one seq ccsInit command is given without a seq ccsExit in between and remark that CCS expects only one pair of init exit commands per application message left by Tcl LinkVar if the Tcl global variable seq ccsStatus or seq ccsEnvName could not be linked to a C variable after ccsInit succeeded ccsExit failed if ccsExit failed message left by Tcl UnsetVar2 if the global variable seq ccsStatus could not be unset after ccsExit succeeded bad argument arg should be open or close for a seq ccsAsyncInput command with an improper argument use seq ccsInit first if seq ccsAsyncInput is given before seq ccsInit call to seqMonitorQ failed if seq ccsAsyncInput got an error returned by this routine CCS errors are also logged via the CCS error logging system CAUTIONS Under CCS lite the current setting of RTAPENV
83. eq msgFlush with too many arguments if there were more than 2 arguments given to this command wrong filter should be lt envName gt lt procName gt if filter is wrong wrong option should be nowait or nnn if option is not correct any error message returned by seq msgRecvReply CAUTIONS The timeout given is applied to all replies separately i e the total cumulative timeout may be much larger than given by this number EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq msgList cmd5 wtel3 OS INIT cmd9 l1te18 ICS RESET cmd27 wtel3 DCS INIT seqWish seq msgFlush wtel3 seqWish seq msgList 9 ltel18 ICS RESET seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X 125 126 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq msgRecvReply n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 127 seq msgList n See seq msgCheck Last change 28 03 02 10 36 128 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq msgRecvReply n NAME seq msgRecvReply receive a reply on a CCS command sent before SYNOPSIS seq msgRecvReply lt options gt lt cmdId gt errorNumber lt
84. er s icon will be used This leaves the path open for easy definition of custom icons within the application s initialization code Remark that overloading an explicitly given icon with another one may require to give the instructions wm withdraw unmap the window from the screen wm deiconify or anything else which forces a re mapping in order for the window manager to notify the change The title for the icon window is anyway set seqWish to lt applicationName gt lt hostName gt If during any of these activities an error occurs the Sequencer shell will inform you and quit 3 If the Sequencer shell is run interactively a file named seqShRc resp seqWishRc in the user s home directory will be sourced if it exists This is intended as a facility to load development scripts not as a means to support final applications which should not rely like this on the user s environment From that point on if there were no errors user input is taken and evaluated 18 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 If CCS functionality is required i e the Sequencer shell is not just used as a shell that incorporates the TclX BLT Msgqltcl and incr Tcl extensions one should not forget to give a seq ccsInit com mand Try always to supply the first argument CCS process name or alternatively redefine the global Tcl variable zeg ccsProcName Otherwise in a multiple user multiple process environment one can end up with
85. esetStack n Last change 28 03 02 10 36 86 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq errGetStackSize n S Seq errResetStack n Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq errLog n NAME seq errLog log a single Sequencer error SYNOPSIS Seq errLog error lt srcId gt DESCRIPTION seq errLog will handle the logging of a single error for the Sequencer i e it will first reset the error stack then log error and finally close and thereby reset th rror stack error string containing a description of the error lt srcId gt string containing the source identifier ENVIRONMENT no environment nor Tcl variables are read nor set RETURN VALUES OK return if no errors occurred The result string is empty ERROR return if seq errAdd fails with a corresponding error message as generated by seq errAdd CAUTIONS none EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq errLog Who the hell deleted this file file proc seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X Seq errResetStack n seq errAdd n seq errCloseStack Last change 28 03 02 10 36 87 88 HOS Sequencer User Manual 3 VLT MAN ESO
86. ess of the attribute lt valueN gt list of values for this particular attribute in the format as returned by seq_dbReadSymbolic I e for attributes of type VECTOR and TABLE it is a list with as many elements as records have to be written As usual in Tcl Tk lists if only one record is written i e if this list contains only one element enclosing braces are not needed seq_dbListPut will take the values passed and store them in the memory assigned to this attribute so it is ready to be written out with a seq_dbMultiWrite command There is no database access involved with this command seq dbListList return a list with one element per listId Each such element contains the following information in the order as listed the list handle the environment name it is linked to the use flag for this list r for read w for write a list containing the attributes of this multi read write list The optional environment argument allows to restrict the list to this particular environment ENVIRONMENT no environment nor Tcl variables are read nor set ETURN VALUES K return if no errors occurred contain the strings as indicated above t rror message here between quotes wrong args The result string is empty except for seq dbListCreate seq dbListExtract and seq dbListList where it will RROR return if one of the following conditi
87. essage getting on the queue within this timeout the Sequencer shell will not be responsive for the duration of this timeout If the timeout is negative a no wait retrieval of messages will be done and no error will be reported if the queue is empty nrMessages number of messages to get default 1 The standard CCS message types can be retrieved this way including obituaries provided this shell s CCS process name has been entered in the RtapEnvTable with a proper value in the Care about Terminations field remark that processes doing a ccsInit ccsExit will generate obituaries by default When an obituary is received the script contained in the global variable seq obiScript will b xecuted after the following substitutions took place D 1 if the deceased process registered for debug 0 otherwise environment name of the deceased process environment deceased process name or if the environment deceased UM FI de de ge R 1 if the deceased process will be automatically restarted 0 otherwise 55 exit status of the terminating process integer value oe oe a single character Internal tables related to the deceased process like the ones kept for commands with pending replies will be cleaned upon reception of an obituary message This internal housekeeping takes place even if seq obiScript is empty and is actually done before evaluating seq obiScript
88. essively lt envName gt environment name lt procName gt process name lt command gt command name FILES no files are accessed ENVIRONMENT no Tcl variables are read nor set ETURN VALUES OK if no errors occurred In this case the result string contains the result as indicated above RROR if one of the following conditions is met with the corresponding rror message here between quotes seq msgCheck wrong args should be seq msgCheck lt cmdId gt lt envName gt lt procName gt command j bad argument argv 1 should be lt cmdId gt lt envName gt lt procName gt command j error message left by Tcl SplitList failing to parse the list error message left by TclX HandleXlate failing to parse the lt cmdId gt seq msgList char NULL wrong args should be seq msgList envName lt procName gt lt command gt bad argument argv 1 should be lt envName gt lt procName gt lt command gt error message left by Tcl SplitList failing to parse the list error message left by TclX HandleXlate failing to parse the lt cmdId gt HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 CAUTIONS The lt cmdId gt as returned by seq msgSendCommand is a unique identifier while lt lt command gt envName lt procName gt gt is not if several identical commands to a ce
89. et a expr 11 11 expr 12 12 will set a to the string 121144 Remark that a space between the first closing and second opening bracket would produce a syntax error For command substitution newlines and semi colons are significant as commandline terminators contrary to quoting Use the backslash substitution to escape such terminations Example set theNameOfThisVariableIsSoLongTheLineWillWrap expr 12345 6789 will produce a syntax error To avoid that append a backslash to the end of the first line Although e g the set command can manipulate arrays the Tcl interpreter itself does not know any special data types This means that in the case of arrays the parsing of the round brackets is done by the command not the Tcl interpreter It is very important where you have opening braces for the arguments of all commands that can take scripts or lists as arguments control flow commands procedures A construct like if S myVar 1 echo unexpected value for myVar SmyVar will result in an error as the if command needs two arguments and the newline after the first argument terminates the commandline This behaviour is due to the fact that control structures are depending on commands and not grammar like in C So the above example will be correct if we write it as if myVar 1 HOS Sequencer Ulser Manual 3 VLT MAN ESO 17220 0737 7 echo unexpected value for myVar SmyVar Remark that the
90. etCwp seqSh set env R wteb5 seqSh set env R Error cannot set CWP to AP ENV AP ENV seqSh seq ccsInit me SEE ALSO ct Tcl and the Tk toolkit kXAppInit 3 tclXAppInit 3 wtetest John K Ousterhout Last change 28 03 02 10 36 fails if no seq ccsInit given before will do a ccsInit in 5 ISBN 0 201 6337 X not wtetest 37 38 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 breakpoint n See dputs n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 39 dputs n NAME dputs breakpoint showInfo A couple of Tcl debug procedures SYNOPSIS Source seqDebug tcl dputs lt args gt breakpoint level showInfo lt level gt DESCRIPTION dputs prints out the lt args gt to stderr but only if the global Tcl variable Debug is set to the name of the procedure we want to debug or to toplevel if the toplevel is to be debugged If no arguments are passed a call to this procedure is equivalent to setting a breakpoint provided Debug is set to the name of the procedure to debug breakpoint set a breakpoint Four commands are interpreted directly by the breakpoint procedure itself to move up the call stack to move down the call stack to print information about the current stack frame C return from a breakpoint All other commands are evaluated in th
91. evtConfig 3 which only exists in 100 For reply events the CDT must be loaded into cmdManager in order to be able to format replies See cmdManager 1 and cmdSetup 1 The CDT is not accessed if A is used instead of R EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line M lt alias gt my scalar is a float with value 1 23 seqWish seq evtAttach alias my scalar w set new lindex D 2 set b 5 event2 seqWish set b 32 seqWish x euet lt alias gt my scalar gets modified to 32 1 seqWish gt set b 5 seqWish set new 32 1 seqWish set b 42 seqWish seq evtSingleDisable event2 seqWish alias my scalar gets modified to 4 3 seqWish set b 42 seqWish set new 32 L seqWish gt seq_evtDetach event2 seqWish gt SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 evtAttach 3 evtDetach 3 evtSingleDisable 3 evtSingleEnable 3 seq msgDispatch n seqInit 3 97 98 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 99 seq evtDetach n See seq evtAttach n Last change 28 03 02 10 36 100 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq evtList n See seq evtAttach n Last change
92. f seq_waitTillDead cannot communicate with lt env gt lt proc gt it is assumed that the process is dead already and a OK return will be made This behaviour is desired in most cases Beware however that this OK return will also occur when e g lt env gt has a wrong value On top of that timeouts for replies on accepted PING commands both for seq_waitTillActive and seq_waitTillDead result in the automatic deletion of the corresponding command handle All time related procedures require that the TimeZone is set to the proper value as time values are converted to from UTC based on this TZ info SEE ALSO clock n msgSchedule 1 Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq scanConfig n NAME seq scanConfig configure a db entry to be acquired by the scan system SYNOPSIS Seq scanConfig arguments DESCRIPTION see manpage for scanConfig 1 ENVIRONMENT No Tcl variables are accessed RETURN VALUES OK with a result string containing all what scanConfig 1 sent to stdout i f it terminated OK exit 0 ERROR with corresponding message in the result string if scanCOnfig 1 terminated abnormally exit 1 SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X scanConfig 1 Last change 28 03 02 10 36 143 144 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq timeOfD
93. flag indicating that Quality Errors should not be sent to the logging system which they are by default Remark that polling of bad attributes tends to fill up the log If noBadQLog is set the corresponding error stack will be reset i e it will be lost lt attrSymAddress gt string containing a symbolic address of the attribute lt badQualityFlag gt name of a Tcl boolean variable that will be set reset according to whether the quality is suspect bad resp OK This is useful for scanned attributes only seq dbReadSymbolic will convert the value read to a string and return it as the result string Scalar values are not seen as list elements i e they are never returned with enclosing braces unless they are of type string and the braces are part of that string Vector records are returned as a list and tables as a list of lists with each sub list containing the values of all fields of 1 record Surrounding curly braces are added to these sub lists for table reads with more than one field They will also appear around every list element which is a string containing spaces I e the use of lists is limited to the cases where they are really needed 5 also the CAUTIONS section For floats etc the precision is determined by tcl precision ENVIRONMENT tcl precision global Tcl variable whose value is passed on to dbDeToStr 3 as the argument determining the precision i e the maximum number of signif
94. fragment will have the lastReply flag set provided lt lastReply gt is true It is up to receiver of these replies to re assemble them by concatenating these individual pieces FILES no files are accessed RETURN VALUES OK if no errors occurred In this case the result string is empty except if the current option was given in the latter case th scriptId is returned ERROR if one of the following conditions is met with the corresponding rror message here between quotes wrong args should be seq msgSendReply current lt scriptId gt lt errorNr gt lt lastReply gt reply if seq msgSendReply is not given with the right amount of arguments not evaluating a SCRIPT command when the command was used with the current option while not evaluating a script that came with a SCRIPT 136 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 command no replies to be sent for lt scriptId gt when the lt scriptId gt handle does not or no longer exist e g the last reply was sent before could not send reply lt reply gt to lt envName gt lt procName gt if msgSendReply returned an error could not send reply reply nor get procName from msgPROCESSID if msgSendReply returned an error and also ccsGetProcName failed CAUTIONS The lt errorNr gt if set will be in the top of the error stack structure wich is sent as a reply and can be
95. gle character will be disabled the event ECTOR or TABLE the evaluation the corresponding event and the error will be logged and also signalled in HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 a separate window popping up via Tcl_BackgroundError in its second form will attach the execution of a script to an incoming reply lt cmdId gt as returned by seq_msgSendCommand lt timeout gt timeout value in ms a timeout error reply will be generated if no reply came in within that time Zero means no timeout The absolute value is taken script a script to be executed at global level when such a reply comes in this script will b xecuted once for each reply independent from the value for lastReply or the error condition including timeout In other words the script must intercept these different conditions The following substitutions will be performed on the script before it is evaluated A ASCII reply received in the message body if this reply is empty or contains any spaces it will be surrounded by curly braces o error number from the received error structure 0 means no error formatted binary reply received in the message body if this reply is empty or contains any spaces it will be surrounded by curly braces Remark that this also works fine on ASCII replies although it is not as efficient as A Unformatted binary replies will be left empty
96. he Tk toolkit John K Ousterhout ISBN 0 201 6337 X 137 138 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 oslxServer 1 Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 139 seq redirect n NAME seq redirect redirect 111616 to a disk file SYNOPSIS seq redirect lt fileId gt fileName lt checkPeriod gt lt maxSize gt DESCRIPTION When all 4 arguments of this command are specified seq redirect will redirect fileId to fileName This disk file is monitored each t checkPeriod seconds and whenever its size exceeds maxSize bytes only he last part 10 of maxSize will be kept If only the first argument is given this logging to a file for fileId is stopped This command is particularly useful to redirect e g stderr to a log file as debugging info is always written to stderr s seq debug array ENVIRONMENT no environment nor Tcl variables are read nor set RETURN VALUES returns OK with an empty result string if all is OK returns ERROR with corresponding message in the result string if a file access error occurred or if attempting to stop redirection for a fileId which is not being redirected EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish se
97. i e Seq seq obiScript a global Tcl variable containing the script to be executed when an obituary message is received This script can contain some variables single characters preceded by a sign giving information about the obituary itself they are substituted just before evaluation of the script 2 8 INTERNET RESOURCES ON TCL TK There is of course a lot more information on Tcl Tk available out there than ever can be con tained in this User Manual and the list is growing at an accelerating pace As a starter this section shows some of the Tcl Tk documentation resources available on the Internet These resources are given here as URLs e the new home of the Tcl Tk core is ActiveState http www activestate com the central archive with most contributions extensions to Tcl Tk used to be at http www NeoSoft com tcl recently the Tcl Tk community acquired the tcl tk domain http www tcl tk contains a wealth of links to all sorts of Tcl Tk documentation areal good place to start when one has particular questions or when looking for an exhaustive list of links or a bibliography is the FAQs at http resource tcl tk resource doc faq there is also an on line tutor available at http www msen com clif TclTutor html or you can look at some Tcl programming ideoms at http www doc ic ac uk np2 patterns tcl index html the home pages for iTcl iWidgets and BLT all used to start off from the
98. ibutel PARAMS SCALARS scalar_float seqWish gt set attribute2 PARAMS VECTORS vector_double 1 2 seqWish gt set attribute3 PARAMS TABLES full table 1 2 3 4 seqWish seq dbListAdd 115860 Sattributel Sattribute2 seqWish seqWish seq dbListRemove 11860 Sattribute2 seqWish seq dbListList 11510 wte67 r PARAMS SCALARS scalar float seqWish seq dbListAdd 1185060 3 seqWish seqWish seq dbMultiRead listO0 seqWish seq dbListExtract 11860 Sattributel Sattribute3 SCALAR 8 0 OK 5 75 TABLE 8 16 0 OK 4 5 3 4 seqWish seqWish seq dbListPut 11560 Sattributel 321 5 Sattribute2 3 7 seqWish seq dbListPut 11560 Sattribute3 1 2 there 2 hi seqWish seq dbMultiWrite list0 seqWish seqWish seq dbListDestroy 0 seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X seqDbListCreate 3 seqDbListAdd 3 seqDbListRemove 3 segDbListDestroy 3 Last change 28 03 02 10 36 63 64 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq dbListDestroy n See seq dbListCreate n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 65 seq dbListList n See seq dbListCreate n Last change 28 03 02 10 36 66 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq dbListPut n See seq dbListCreate n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO
99. ically which resets the stack rendering its previous contents unaccessible For seq errResetStack seg errAdd and seq errCloseStack the error stack referred to is completely independent from the Sequencer s internal error Stack used for returned CCS errors as described above unless th internal option is specified This option is intended for the cases where one does not want automatic logging by setting the global Tcl variable seq errLogging to manual see the description of seq errLogging below Remark however that issuing a seq errCloseStack command with seq errLogging set to manual behaves the same as for auto i e the error stack will be logged and it will be copied into the display stack for further display purposes The error stack referred to by seq errPrint seq errDisplay seq errGetStackSize and seq errGetFromStack is by default the display Stack i e a copy of either the last error message received by seq msgRecvReply the last internal error logged automatically or the last error stack logged explictly via seq errCloseStack Again the internal and reply options are only useful when the global Tcl variable seq errLogging is set to manual The reply option is to refer to the last error which was returned as a reply to a command This is useful in cases where due to further script execution the display stack may get overwritten by internal errors If both the internal and reply opti
100. icant digits of the conversion to string D ETURN VALUES OK if no errors occurred In this case the result string contains the db value s RROR if one of the following conditions is met with the corresponding rror message here between quotes wrong args should be seq dbReadSymbolic noBadQLog attrSymAddress lt badQualityFlag gt the command was given with the wrong number of arguments wrong option if seq dbReadSymbolic has 3 args of them must be noBadQLog as the message says cannot read lt attrSymAddress gt even after resizing buffer if dbReadSymbolic still returned an error even after the receiving buffer was resized properly RTAP only cannot read attrSymAddress if dbReadSymbolic returned an error from which seq dbReadSymbolic cannot recover CAUTIONS HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 The lt badQualityFlag gt can of course not be set to noBadOLog but variable names should never start with a dash Comparing the return string for the case of a single record single field like SCALAR with the case of multiple records one might detect a slight inconsistency For the latter the reply will consist of a list with one lement per record Each of these elements will on their turn be a list if multiple fields are involved If there is on the other hand only one record to read the reply will not be a list with a s
101. igure prefix STCLTK_ROOT nable shared with msql include STCLTK ROOT include with msql library TCLTK ROOT lib and then make make k install 10 Install the Img extension as follows cd imgl 2 4 5 configur prefix STCLTK_ROOT nable shared disable stubs and then make make k install 11 Install TkTable as follows cd Tktable2 7 unix configure prefix S TCLTK BOOT nable shared and then make make k install 12 Install Snack as follows cd snack2 1 unix 5 configure prefix STCLTK_ROOT nable shared N with tcl tc18 3 3 unix with tk tk8 3 3 unix disable stubs and then make make k install This will leave all the required libraries programs and scripts in directories under the TCLTK ROOT hierarchy e g TCLTK ROOT lib and TCLTK_ROOT lib tclX8 3 hence you will need write access to these If you do not want to have the TCLTK ROOT directory on your sys tem scan through the README and INSTALL files of all these packages for precise instructions 3 2 COMPILATION AND INSTALLATION OF THE SEQUENCER The standard procedures to install VLT SW modules apply to the Sequencer 1 Set your working directory to the VLT SW installation directory cd lt VLTSW gt INSTALL 2 Compile and install the Sequencer as part of HOS buildHOS 3 Make sure you have a clean environment if necessary reboot your workstation If the environment vari
102. inary extensions or packages on the fly This means that in many cases you can start off with a very slim core occupy ing little memory and add packages as you are running the interpreter without having to re com pile this core in order to make the new commands available In other words seqSh and seqWish can be extended with commonly available or your own packages during runtime Of course such packages should comply with certain rules in particular how they are compiled built and how they initialize Although several alternatives may exist and are described in the Tcl manpages in what follows these alternatives are narrowed down in a cookbook recipe fashion for a loadable extension with package name Ext and VLT module name ext 2 6 1 Initialization of a loadable extension Whenever a package is loaded dynamically it needs to get initialized a o to add new commands to the interpreter The Tcl core relies on a set of naming rules for the initialization procedure of any 22 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 package so it knows how to invoke this procedure The name of the initialization procedure which will be invoked is determined by the package name It will have the form Ext_Init where Ext is the same as the package name with the first letter con verted to upper case and all other letters converted to lower case The initialization procedure must match the following prototype typedef int Ext Init
103. ined with the format string 256s Seq errCloseStack logs the last added error and closes the stack used if no error recovery is possible Remark that after this the error Stack is reset automatically seq errPrint will return a list with all the elements of the last CCS error which was either produced internally or received as a reply The order of the list is as follows see also a description of the CCS error structure for more details environment name stackId structure hostId and localNumber as a list Stack sequence number location identifier module identifier error number must be gt 0 severity W for Warning S for Serious F for Fatal rror message between braces if it contains spaces timestamp of the error E EL Er OG O seq errDisplay will pop up a panel showing the stack of the last CCS error which was either produced internally or received as a reply If the suspend option is specified the Sequencer script will wait for this error panel to be closed before continuing 90 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq errGetStackSize returns the size of the stack of the last CCS error 0 means it is empty seq errGetFromStack will return the contents of the frame lt frameNr gt in the error stack as a list formatted similar as seq errPrint The Sequencer uses 3 different error stacks which can be selected via the presence or absence of the options interna
104. ing the corresponding Sequencer command was given with the wrong number of arguments wrong args should be seq logFitsEvent type lt logString gt the corresponding Sequencer command was given with the wrong number of arguments wrong args should be seq logFitsParRecord type dictionary cat lt subsys gt param lt value gt the corresponding Sequencer command was given with the wrong number of arguments cannot generate FITS action log dictionary dictionary category category subsystem subsys action lt action gt the underlying logFitsAction 3 call returned an error wrong generator who should be ob observer rc remote control sa staff or na night assistant cannot generate FITS comment log logString the underlying call to logFitsComment 3 returned an error wrong type lt type gt should be ufo unforeseen or rec recovery cannot generate FITS event log logString the underlying call to logFitsEvent 3 returned an error wrong type lt type gt should be int real or string cannot generate FITS paramater record log dictionary dictionary category cat subsystem lt subsys gt param lt param gt value value the underlying logFitsParRecord 3 call returned an error CAUTIONS The seq logFitsParRecord command calls the logFitsParRecord 3 function which does a bina
105. ingle element extrapolating the above scheme but rather the contents of that singl lement i e the value s of the field s So a table with one record one field gives a result string containing a single value One record multiple fields gives a list with one element per field each element containing a field s value Multiple records one field gives a similar list Multiple records multiple fields result in a list with on lement per record Each of thes lements are on their turn a list with on lement per field The advantage of this approach is that one does not need so many layers of list handling commands in the most trivial case of a single value The internal buffer needed to read the attribute s value is automatically increased if necessary This memory is not returned to the system until the shell is stopped EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq dbReadSymbolic PARAMS SCALARS scalar float bad 12 345679 seqWish set bad 0 seqWish set tcl precision 3 seqWish seq dbReadSymbolic PARAMS SCALARS scalar float 12 3 seqWish set tcl precision 10 seqWish seq dbReadSymbolic PARAMS VECTORS vector double 2 4 12 34567890 0 0 987654321 seqWish seq dbReadSymbolic PARAMS TABLES full table 0 1 First field second
106. is provides basic functionality to debug scripts at the seq level 9 URN VALUES TCL_OK if no errors occurred CL_ERROR if one of the following conditions is met with the corresponding rror message between quotes rror message left by Tcl LinkVar if tcl precision could not be linked to segPrecision rror message produced by evaluating segInit tcl which contains error The callback routine which checks the modification of seq moduleId will produce an error whenever the new value contains less than 3 or more than 6 characters CAUTIONS Renaming a seq command will not affect this command s name in the seq debug array So after renaming the original name has still to be used to modify the debug flag Some debugable seq commands are implemented as Tcl procedures seq catch seq errDisplay and seq msgFlush Each of these procedures calls itself one or more seq commands implemented in C If all of their debugging flags are on you will see a nesting of debugging output Remark that due to the way CCS keeps track of the environment name changing the RTAPENV environment variable after any CCS function has been called explicitly via a seq command or implicitly as the result of calling a seq command e g when errors are logged will have no effect on CCS Example HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seqSh seq dbS
107. is script before he attribute causing the event this is a list A D oe H oe oe oe Whenever the substitution on the original script or of the resulting script yields an error be performed on name of t event data attribu for SCALA for V for TABLI info abou elements ECTO t R R me ype as follows evaluation The following substitutions will whos s also contents depends on the vtParseMsg 3 lt dataType gt lt oldValue gt lt newValue gt lt star Element gt lt end lt startElement gt lt end lt endField gt t the process causing lt envName gt lt processName gt the event Element Element startField a list with two Remark however that events associated with LCU database attributes do not return this information and an attemp will result in errors in this case quality lt oldQuality gt lt newQuality gt where lt oldQuality gt and lt newQuality gt can be ei The exact meaning of these SUSP for scalars only ECT ERROR or DISABLI words can be found in the For vectors and tables Either SCALAR V t ED evtParseMsg 3 his will give an emp t to use this substitution It gives a list with 2 values ther OK manpage ty list attribute type the user message part of a sin
108. is useful as a debugging aid of hermetic Tk or seqWish scripts Without modifying or editing the source of such applications directly you can look into its variables change the definition of procedures make the CCS error display pop up via the seq errDisplay command etc To use this feature click on the Console menu then select Attach Console followed by the selection of your Tk application under the Foreien Tk Interpreters section There are two caveats related to the use of this feature as it relies on Tk s send command a It will not work with a pure seqSh Tcl script i e it needs Tk b xhost style access must be enabled and the list of enabled hosts must be empty This is because the send command is potentially a serious security loophole since any application that can connect to your X server can send scripts to your Tk applications These incoming scripts can use Tcl to read and write your files and invoke subprocesses under your name The latter observation is of course true for all Tk applications and not only during debugging More information on securing Tk applications can be obtained from the appropriate Tcl Tk literature the Tcl Tk FAQs see also section 2 8 and manpages xhost 1 xauth 1 send n etc 2 4 RUNNING THE SEQUENCER SHELLS 2 4 1 Before you start To run a Sequencer shell ensure the binaries seqSh and Wish are in your path and type from your login shell prompt characters in italics
109. ively one can make myScriptFile executable edit it and put on the first line vlt bin seqWish whereby olt bin must be replaced by the path where the seqWish binary is installed Remark however that this line should not exceed a system defined maximum number of characters on most systems only 32 or else exec will fail see the exec 2 manpages This results in misleading error messages workaround for this can be found in most of the Sequencer scripts which are part of the SW distribution which have their header inserted by vItMake Via the c runstring option only valid for seqSh not seqWish seqSh c command where lt command gt is any Tcl Seq command to execute It may contain a series of commands to execute separated by The shell will execute lt command gt and then exit This is useful to obtain on stdout some values which can be used as input for other processes Example seqSh c seq ccsInit puts seq dbGetAlias wte67 PARAMS will send to stdout the following string lt alias gt PARAMS and then terminate This output could be used to pipe into another process Interactively when none of the above options have been applied In this case a prompt will appear inviting the user to enter the commands via the standard input device normally the keyboard this interactive input must be given either in the new console window or in the original terminal window from which seqWish was starte
110. l prompt2 contains Tcl code to generate the prompt used when interactively prompting for continuation of an incomplete command The code in this hook will be evaluated and the result will be used for the prompt Initially set to gt tk library set by Tk to hold the path name of the directory containing a library of standard Tk scripts and demos This variable is set from the environment variable TK LIBRARY if it exists or from a compiled in default otherwise tk_strictMotif if set to 1 by the application Tk will try to observe Motif compliance The public global variables added to this list by the Sequencer shells are seq ccsCmdCheck enables disables the CCS message system command reply checking based on CDTs Must be set to either NO CHECK or CHECK CMD The default is NO CHECK Remark that the value of this variable at the time a command is sent has also an impact on the behaviour of seq msgRecoReply for replies on this command i e whether the will be accessed to format the reply or not See the zeg msgRecoReply manpage seq ccsEnvName a read only variable containing the name of the environment under which the Sequencer shell is running The initial value is an empty string and it is set by a successful seq ccsInit seq ccsProcName initialized to segNAME as defined in the include file seq h Can also be retrieved with the infox appName command It is used as the default name under which to register the Sequencer shell wi
111. l and reply Also the logging of these stacks can be influenced via the setting of the Tcl variable seq errLogging The use of this variable and the selection plus purpose of the different stacks is explained in the next few paragraphs Whenever the Sequencer gets a CCS error it cannot recover from the internal error stack will be submitted to an errCloseStack call seq errLogging set to auto This means that the Sequencer script does not need to include any instructions to close and log any error stack In this case the call to errCloseStack will actually be preceded by an errAdd call identifying the Sequencer as the top level If the Sequencer receives via seq msgRecvReply an error reply this reply error stack will also be logged automatically if the default setting of the variables seq errLogging and seq errReplyMerging is used see below however without the Sequencer appending its own message If you want to add your own error messages to this reply stack you can set seq errLogging to manual and then give the proper seq errAdd seq errCloseStack commands using the option reply Alternatively one can use the seq errReplyMerging variable to have this stack automatically merged into one of the two other stacks see below In both cases a copy of this error stack is kept in the display stack so that it still can be displayed with e g the seq errGet commands even after errCloseStack was called automat
112. lastReply gt DESCRIPTION seq msgRecvReply waits for a single or all replies on a command identified by its first argument or for the specified timeout whichever comes first options any of the following options in any order if contradicting options appear the last one will prevail all flags to get all replies in instead of only one and return all replies separated by a newline in absence of option bin empty replies do not get a newline appended nor is there a newline appended to each reply if the nonewline option is specified ascii flags reply is supposed to contain ASCII data the CDT s data for the reply s format is not checked nor used This is slightly more efficient if you know in advance that the reply is ASCII and or that the CDT is not available flags data should not returned result string e g when reply contains unformatted binary data fbin flags data should be formatted according to the command s entry in the CDT DISPLAY_FORMAT field This works fine for formatted binary and ASCII replies although for the latter it is more efficient to use the ascii option so no formatting needs to be attempted Unformatted binary replies will result in an empty string although again it is more efficient to do that via the bin option If the reply does not have an entry in the CDT it will be considered as ASCII same remark again
113. lias name of a point lt pointName gt string containing a symbolic address of the point whose alias we want to know seq dbGetAlias will return the alias name 51 52 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 ENVIRONMENT no environment nor Tcl variables are read nor set DO ETURN VALUES OK return if no errors occurred In this case the result string contains the attribute family or alias names as indicated above RROR return if one of the following conditions is met with corresponding rror message here between quotes wrong args should be seq_dbGetAttrNames lt pointName gt the command was given with the wrong number of arguments wrong args should be seq dbGetFamilyNames pointName lt view gt the command was given with the wrong number of arguments wrong args should be seq dbGetFieldNames attrName the command was given with the wrong number of arguments wrong args should be seq dbGetAlias pointName the command was given with the wrong number of arguments wrong view specifier should be ABSOLUTE ALIAS or RELATIVE cannot get attribute names of pointName dbGetAttrNames returned an error for this argument cannot get family info on pointName dbGetFamilyNames returned an error for this argument cannot get field names of pointName dbGetFamilyNames returned an error for
114. lti write for list lt listId gt failed the call to dbMultiWrite failed EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 71 seqWish seq dbListCreate wte67 listo seqWish gt set attributel PARAMS SCALARS scalar_float seqWish gt set attribute2 PARAMS VECTORS vector_double 1 2 seqWish gt set attribute3 PARAMS TABLES full table 1 2 3 4 seqWish seq dbListAdd list0O Sattributel Sattribute2 Sattribute3 seqWish gt seqWish seq dbListPut 11560 Sattributel 321 5 Sattribute2 3 7 seqWish seq dbListPut 11560 Sattribute3 1 2 hi there 2 hi seqWish seq dbMultiWrite list0 seqWish xl SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X seqDbListCreate 3 seqDbListAdd 3 seqDbListRemove 3 seqDbListDestroy 3 Last change 28 03 02 10 36 seq dbMultiWrite n See seq dbMultiRead n Last change 28 03 02 10 36 72 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq dbReadSymbolic n NAME seq dbReadSymbolic read attribute values from on line database points SYNOPSIS seq dbReadSymbolic noBadQLog lt attrSymAddress gt lt badQualityFlag gt DESCRIPTION seq dbReadSymbolic will read a value of an attribute noBadQLog an optional
115. ly set filter It allows to receive a single or all replies to a previously given command which is identified by its handle the cmdlId returned by seq msgSendCommand n An alternative way to retrieve and deal with incoming replies is provided by the event mechanism see 2 3 7 This allows to attach a callback to a command handle which will be executed in the background at global level whenever a reply comes in seq msgSendReply Maps into msgSendReply 3 it is used to return a reply to a process which sent a SCRIPT command to the Sequencer shell see seq msgDispatch Normally the Sequencer shell will return an empty reply immediately after receiving the SCRIPT command and a second final HOS Sequencer Ulser Manual 3 VLT MAN ESO 17220 0737 9 reply after evaluating the script This is done automatically If intermediate replies are needed e g in the VERBOSE mode seq msgSendReply has to be used from within the evaluation of the script seq msgList Does not have a corresponding CCS message system call It lists the commands for which there are still replies pending The information returned includes the cmdld the name of the command plus the environment and process it was sent to seq msgCheck Does not have a corresponding CCS message system call It is a boolean function checking if there are still replies pending on a certain command This may not always be obvious as the number of replies on a command is many times
116. mand and we d better wait for a positive reply on that one set cmdId seq msgSendCommand seq ccsEnvName PARTNER INIT set msg seq msgRecvReply all ScmdId errNr if SerrNr 0 puts stderr Something went wrong received error msg V msgV puts stderr I cannot continue Quitting exit 1 else bring the good news echo msg 6 Next some more commands of which some can take their time to finish let s send them out all and wait for the slow ones at the end set cmdIdl seq msgSendCommand seq ccsEnvName PARTNER CMD1 argl set cmdId2 seq msgSendCommand seq ccsEnvName PARTNER CMD2 arg2 arg3 set cmdId3 seq msgSendCommand seq ccsEnvName PARTNER CMD3 set replyl Some more action could come e g right here 7 Get replies on CMD2 and CMD3 they should finish relatively quickly set reply2 seq msgRecvReply all ScmdId2 errNr if SerrNr 0 do handling for error reply set reply3 seq msgRecvReply 811 ScmdId3 errNr if SerrNr 0 20 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 do handling for error reply sas 8 Now we have to wait for the reply on our slow coach if catch seq msgRecvReply 500 5000101 errNr lastReply msg check if the error is simply msg queue empty or other if cequal msg reply timed out echo Got an error on receiving replies on CMD1 msg
117. nable a database or reply event See also evtSingleEnable 3 seq evtList To list information related to database events Has no CCS counterpart and is not yet implemented for reply events 2 3 8 Error handling Errors occurring during the execution of commands which are Sequencer extensions to Tcl Tk are by default logged automatically using the standard CCS error system calls Eg if seq msgSendCommand is used to send a command to an inactive application seq msgSendCommand will fail and the error stack will be logged automatically identifying the Sequencer shell as topmost layer Similarly if zeg msgSendCommand is used to send a command to a properly running application which replies with an error message on the execution of the command the subsequent seq msg RecoReply command will of course retrieve this error stack and log it without the need of additional instructions done internally via an errCloseStack call This default behaviour can be modified and more control over this error stack can be obtained by setting the global Tcl variables seq errLogging and or seq errReplyMerging to appropriate values see section 2 7 and the manpages of the seq err commands On top of this feature and the CSS error system interface see 2 3 5 there are two Sequencer shell commands which allow additional error manipulation and logging seq catch To evaluate a command and return its completion status This command is similar to the Tcl c
118. nd define seqCMD HANDLE BASE cmd basis for command handle name define seqEVT HANDLE BASE event basis for event handle name define seqSCR HANDLE BASE script basis for script handle name define seqLIST HANDLE BASE list basis for db list handle name define seqALRM HANDLE BASE alarm basis for alarm handle name Global variables see also seqInit c seqMsgDispatch Ey extern unsigned int seqPrecision C variable linked to tclPRECISION type must correspond to int extern char segModuleId C variable linked to seqMODULEID see a o errAdd max 6 chars extern int segErrLogMethod C var reflecting seqERRLOGGING O0 off l auto 2 manual extern int seqErrReplyMergeMethod C var corr to seqERRREPLYMERGING O off l internal 2 local extern char numericVersion string containing version dif defined CCS_FULL extern extern ex ex Lern cern cern extern CCSERROR lastError char segObiScript CCSENVNAME myEnvName CCSPROCNU myProcNum CCSPROCNAME myProcName vltLOGICAL cmdsAllowed CCS FULL CCS LIGHT Data types defined CCS_LIGHT CCS error at last errCloseStack C var linked 2 string seqOBISCRIPT cf obituaries in seqMsgDispatch local environment name Sequencer process number the CCS name of this
119. nd children of a point Maps into dbGetFamilyNames 3 seq dbGetFieldNames To get the field names of a table attribute Maps into dbGetFieldNames 3 seq dbGetDirAddr To convert a symbolic address into a direct one Maps into dbGetDirAddr 3 The direct address returned can e g be used to write into an OLDB table containing sampling plotting configuration information At present only the seg dbDirAddrToName command can use this type of address as an argument seq dbReadSymbolic To read the value of an attribute Maps into dbReadSymbolic 3 seq dbWriteSymbolic To write a value to an attribute Maps into dbWriteSymbolic 3 seq dbListCreate seq dbListAdd seq dbListRemove seq dbListDestroy seq dbListExtract seq dbListPut seq dbListList To manipulate multi read write lists Most of these commands have a one to one mapping into a CCS equivalent seq dbMultiRead seq dbMultiWrite The execution of the db multi read write operation Equivalent to dbMultiRead 3 resp dbMultiWrite 3 seq dbGetCwp To retrieve the pathname of the current working point Maps into dbGetCwp 3 seq dbSetCwp To set the current working point to a pathname Maps into dbSetCwp 3 seq dbLockPoint To lock a db point Maps into dbLockPoint 3 seq dbUnlockPoint To unlock db point Maps into dbUnlockPoint 3 Remark that seq dbGetDirAddr seq dbDirAddrToName seq dbLockPoint and seq dbUnlockPoint are only available in a full CCS environment i e with
120. ndle lt listId gt no multi read write items associated to it the shell does not know of any multi read write list with this particular listId cannot get info on lt attrSymAddrN gt during seq dbListAdd the call to dbGetAttrInfo failed most likely because this symbolic address is not correct Cannot add lt attrSymAddrN gt to multi read write list lt listId gt the call to dbListAdd failed for this symbolic address cannot remove attrSymAddrN from multi read write list lt listId gt this symbolic address is not a member of the multi read write list or the call to dbListRemove failed for other reasons Cannot extract info of lt attrSymAddrN gt from multi read write list lt listId gt this symbolic address is not a member of the multi read write list or the call to dbListExtract failed for other reasons cannot destroy multi read write list listId the call to dbListDestroy returned an error errors from list splitting valueN for VECTOR and TABLE attributes amount of data incompatible with attribute info during execution of seq dbListPut for VECTORs and TABLEs with less more data than the number of records indicates record i expected m data values have got n for TABLES the number of values in each sublist record of value should equal the number of dataType elements record i field m could not convert valueN to dbTYP the routine dbStrToD
121. nual for the HOS Sequencer version 2 69 and is intended to provide all the necessary information for the installation and use of this module 12 SCOPE The Sequencer module in its present release 2 69 is limited to an embeddable interpreter with low level commands The use of this interpreter and its shells seqWish and segSh will typically be in workstation applications offering higher level functionality including a user interface and acces to the CCS functionality The user interface to create and execute Sequencer scripts is named sequencer It is currently not in cluded It will create scripts that can be interpreted by seqWish and seqSh and will itself be a set of Sequencer scripts 1 3 REFERENCE DOCUMENTS The following documents are referenced in this document 1 Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X 2 Practical Programming in Tcl and Tk Brent Welch ISBN 0 13 182007 9 3 VLI MAN ESO 17200 0981 1 0 15 01 96 VLT SW Problem Report Change Request User Mnl 4 VLI MAN ESO 17229 0866 2 8 16 05 1999 VLT SW Real Time Display User Manual 1 4 ABBREVIATIONS AND ACRONYMS The following abbreviations and acronyms are used in this document CCS Central Control Software HOS High Level Operating Software HW Hardware I O Input Output SW Software TBD To Be Defined VLT Very Large Telescope WS Workstation 15 GLOSSARY sequence a set of commands in Sequencer language generally intended to d
122. numerous processes which for CCS are all called Sequencer and all com mands addressed to Sequencer will be going to a single process the one which did the last seq ccsInit Fortunately for the Sequencer shells this is only a problem for incoming commands not replies 2 4 3 Example Sequencer script dE lt Ck Ck k k K K K K kk kk kk Kk SKK SKK Ck Ck K KOK OK ck ck ck ck ck ck KOK KOK KOK KOK kk KOK KOK KOK K ck ck ck kc k kc kk E S 0 VLT project seqkExample tcl who when what eallaert 15 10 94 initial version che db db db dE Ck Ck kk K K K K K K Ck K kk KK KK CC KC Ck Ck kk Sk Sk kk ck Ck KOK KOK OK OK KOK KOK KOK KOK KOK kk kc k NAME seqk Sequencer script for demonstration purposes SYNOPSIS seqkExample DESCRIPTION This script does a number of things 1 It sets the precision for reals to the maximum value 2 It initializes itself with CCS 3 It waits until another CCS application PARTNER is up and running 4 It 5 t 6 7 8 goes into an interactive commandloop It sends an INIT command to PARTNER and waits for a reply 3 more commands are sent to PARTNER without waiting for the reply Wait for replies on the 2nd and 3rd command Wait for replies on the lst command CAUTIONS This script requires a PARTNER to execute
123. of this section paying special at tention to potential traps and pitfalls 2 2 1 Basic rules The Sequencer shells interpret commandlines These commandlines can be given interactively one by one or they can be grouped together in a script A script is a collection of one or more command lines often grouped together in a file The basic syntax for all Sequencer shell commandlines is command argl arg2 arg3 So each commandline consists of one or more words whereby words are separated by spaces or blanks The first word of a commandline is the command which is either the name of a built in com mand programmed in C or a Sequencer shell procedure programmed in Tcl Sequencer The fol lowing words are the arguments passed to that command Arguments are string valued i e they are always passed as strings to the command The commandline is terminated by a newline or a semicolon All commandlines return a string as a result which in some cases depending on the command and its arguments can be an empty string This exposes one of the fundamentals of Tcl everything is a string On top of this simple piece of syntax there are only the rules for substitution and quoting These are the only mechanisms employed by the Tcl interpreter before it runs a command After single pass substitution the arguments are as said passed as strings to the command which has to interpret them Features like control flow procedures and expressions are impl
124. ome more arbeit for seqWish seqWish seq msgSendCommand check wtel3 ICS TEST parl 2 par3 15 seqWish gt The easy to pass parameter including quotes seqWish seq msgSendCommand wtel3 105 TEST 1 2 3rd parameter with quotes cmd16 seqWish gt The same result but novices may have to think a bit about this seqWish seq msgSendCommand wtel3 105 TEST 1 2 3rd parameter with quotes cmd17 seqWish gt Here the third parameter is a string which does not include seqWish gt quotes as it contains spaces the whole is after concatenation seqWish gt with the first two arguments equivalent to a string with 6 seqWish gt individual parameters seqWish seq msgSendCommand wtel3 ICS TEST 1 2 3rd 4th 5th 6th cmd18 seqWish gt SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 134 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seqMsgSendCommand 3 seq msgRecvReply n msgSendCommand 3 Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 135 seq msgSendReply n NAME seq msgSendReply send a CCS reply message SYNOPSIS seq msgSendReply current lt scriptId gt lt errorNr gt lt lastReply gt reply DESCRIPTION seq msgSendReply allows to send intermediate replies to the originator of the SCRIPT command see seq msgDispatch n As such the only place where it can appear i
125. omment n See seq logFitsAction n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 111 seq logFitsEvent n See seq logFitsAction n Last change 28 03 02 10 36 112 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq logFitsParRecord n See seq logFitsAction n Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 113 seq logIntParRecord n See seq logStringParRecord n Last change 28 03 02 10 36 114 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq logRealParRecord n See seq logStringParRecord n Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq logStringParRecord n NAME seq logStringParRecord seq logIntParRecord seq logRealParRecord FITS parameter logging for strings integers and floats SYNOPSIS seq logStringParRecord dictionary category lt subsys gt parameter value seq logIntParRecord dictionary category lt subsys gt parameter value seq logRealParRecord dictionary category lt subsys gt parameter value DESCRIPTION These commands are all simple wrappers around seq logFitsParRecord ensuring that the latter is called with the right option string int or real VIRONMENT no environment nor Tcl variables are read nor set RETURN VALUES OK return if no errors occurred The result string is
126. ons are given the one given last prevails ENVIRONMENT The environment variable NO ERR DISPLAY affects the behaviour of seq errDisplay in that it will send its output to stdout instead of HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 popping up a new window if set S also errDisplay 3 The global Tcl variable seq errLogging reflects how the logging of errors occuring during the execution of seq commands are dealt with auto default leads to automatic logging of all unrecoverable errors by issuing an errCloseStack off will not log any error by issuing an errResetStack while manual will not issue any err Stack command In the latter case it is assumed that the script will take care of th rror stack via seq err internal reply commands In all cases the corresponding error stack will be copied over to the display stack The global Tcl variable seq errReplyMerging determines how the merging of error replies will take place internal will append the reply stack to the internal error stack local will make the reply stack append to the default stack of seq errAdd etc while off default leaves the error reply stack alone In the former 2 cases th rror reply stack will be reset after merging without any logging In the latter case it will get logged automatically if seq errLogging is set to auto in which case it will also be copied over to the display stack
127. ons is met with corresponding should be seq dbListCreate envName access the command was given with the wrong number of arguments wrong args should be seq dbListAdd lt listId gt lt attrSymAddr1 gt 61 62 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 lt attrSymAddr2 gt the command was given with the wrong number of arguments wrong args should be seq dbListRemove lt listId gt attrSymAddrl lt attrSymAddr2 gt the command was given with the wrong number of arguments wrong args should be seq dbListDestroy listId the command was given with the wrong number of arguments wrong args should be seq dbListExtract lt listId gt lt attrSymAddr1 gt lt attrSymAddr2 gt the command was given with the wrong number of arguments wrong args should be seq dbListPut lt listId gt attrSymAddrl lt valuel gt attrSymAddr2 lt value2 gt the command was given with less than 3 arguments or an even number of arguments wrong args should be seq dbListList lt environment gt the command was given with the wrong number of arguments wrong value for access lt access gt should be either r or w cannot create a multi read write list for env envName access lt access gt the call to dbListCreate returned an error invalid list handle lt listId gt lt listId gt does not start with the word list invalid list ha
128. ore command catch except that eventual errors are logged to the CCS error system This provides a tracing facility which anyhow has to be enabled very explicitly seq logTclErrors See2 3 4 2 3 9 OSLX seq oslxCmd To give an interface to OSLX functionality It is accessible at script level after giving the command package require 5 The OSLX functionality is available as a dynamically loadable package see 2 6 You need to issue the command package require SeqOslx to have this function available in any of the Sequencer shells The SegOslx package is also available under CCS light 2 3 10 Convenience procedures The Sequencer shells include a number of convenience procedures which have no CCS counter HOS Sequencer Ulser Manual 3 VLT MAN ESO 17220 0737 13 parts They are 2 3 11 seq_deleteHandle will delete a handle plus related resources where the handle can be either of the command event script or multi read write list type Only for a full or light CCS environment seq relToAbsPath will return the absolute pathname corresponding to a relative pathname seq findFile will return the absolute pathname of a file after it has been searched for in INTROOT and VLTROOT in that order seq waitTillActive will wait until a certain process is active i e until it can receive CCS messages Only for a full or light CCS environment seq waitTillDead will wait until a certain process is inac
129. ou want this window to be displayed 24 2 Starting up In all cases before the Sequencer shell starts interpreting user commands it initializes itself in the following way 1 It initializes the Tcl TcIX Tk incr Tcl incr Tk Msqltcl and BLT extensions in that order for seqWish for seqSh it initializes Tcl TclX incr Tcl and Msgltcl If anything fails the Sequencer shell will tell so and quit The list of environment variables used needed by each HOS Sequencer Ulser Manual 3 VLT MAN ESO 17220 0737 17 of these applications and the list of global Tcl variables set by them can be found in the respective manpages of these extensions 2 It initializes the Sequencer extensions it sets the version number and makes it available via the infox command it sets the global Tcl variable zeg ccsProcName to the string sequencer This variable is used as the default process name for the seq ccsInit command the global Tcl variable tc precision is initialized to a default value set at compilation time see Makefile This variable is used whenever a real is converted to a string e g using the expr command or seq dbReadSymbolic it defines the global Tcl variable seq library by looking first if there is an environment variable named SEQ LIBRARY if not it looks for the shell libraries relative to the working directory the integration directory INTROOT and finally the root directory VLTROOT
130. pay attention to the availability of script files on the right directories 30 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 4 REFERENCE tclCpp 1 NAME tclCpp do cpp style pre processing on 8 Tcl script SYNOPSIS tclCpp p s lt file gt tclCpp b c D name value I pathname lt file gt DESCRIPTION tclCpp pre processes lt file gt with cpp This means lt file gt can contain cpp style pre processor directives like include and define statements Apart from these pre processor directives lt file gt needs to be written according to the Tcl syntax To avoid confusion between Tcl commentlines and pre processor directives both starting with a sign the following rule applies lines starting with a hash sign followed immediately by a lowercase alphabetic character are considered pre processor directives otherwise they are considered Tcl commentlines In its first form option lt file gt is a Tcl script which gets its commentlines prettified prepared for the cpp preprocessing lines starting with a hash sign followed immediately by a lowercase alphabetic character get a space inserted after the sign p prettify commentlines s do not substitute and by their hexadecimal representation By default tclCpp will replace these strings in order to avoid conflicts with cpp which considers them th
131. ple is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq dbWriteSymbolic alias me myScalar SCALAR 5 1 1 327 seqWish seq dbWriteSymbolic alias me myVector 1 2 VEC 6 15 1 3 7 attribute type VEC unknown should be SCALAR VECTOR or TABLE seqWish seq dbWriteSymbolic alias me myVector 1 2 VECTOR 6 15 1 3 7 seqWish set a seq dbReadSymbolic alias me myTable 0 0 seqWish seq dbWriteSymbolic alias me myTable 1 1 TABLE 20 25 5 2 8 seqWish seq dbWriteSymbolic alias me myTable 1 1 1 1 TABLE 25 5 2 seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X seqDbWriteSymbolic 3 dbStrToType 3 dbWriteSymbolic 3 dbGetDirAddr 3 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 79 Last change 28 03 02 10 36 80 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq deleteHandle n NAME seq deleteHandl delete a handle and release related memory SYNOPSIS seq deleteHandle handle DESCRIPTION seq deleteHandle will delete a handle and its related resources It provides a unified way to do this for any of the handles currently used by the Sequencer shell a command handle as obtained by issuing a seq msgSendCommand in this section the word command refers to such a mess
132. printable characters like newline in a commandline Example set squareBrackets N N set doubleQuote N set newLine Nn 2 2 3 Quoting In 2 2 1 we have seen that blanks are separators for Tcl words This leads to a problem when a sin gle argument is or should be a string containing blanks We need something that allows to group words together There are actually two ways to obtain that 1 Double quotes Blanks and even newlines within double quotes are part of the Tcl word Substitutions as described in 2 2 2 still take place Double quotes do not nest as the opening and closing double quote are the same ASCII character Example set result The square of SmyVar is expr SmyVar SmyVar puts stdout result will print the string The square of 53 is 2809 to stdout 2 Curly braces The only character that is special after an opening curly brace is a closing curly brace All other characters including blanks newlines and double quotes have no special meaning and are part of the Tcl word Substitutions are prevented within matching curly braces Braces nest Example set result The square of myVar is expr SmyVar SmyVar puts stdout result will print the string The square of myVar is expr myVar myVar to stdout 2 2 4 Potential pitfalls Although the rules for the Tcl syntax are simple and few many people experience some difficulties with it in the beginning mainly because the behaviour is different from what one i
133. process reflects whether Sequencer event loop will allow incoming cmds HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 Function prototypes int Seq Init Sequencer interpreter initialization Tcl_Interp interp pointer to interpreter structure called by Tcl_AppInit amp seqInitInterp if defined CCS_FULL defined CCS_LIGHT EXTERN ccsCOMPL STAT seqInitInterp creates initializes a Sequencer interp char display string with display term name char name label for main window vltLOGICAL interactive flags if application is shell like Tcl Interp interp Tcl interpreter structure pointer pointer CCSERROR error EXTERN ccsCOMPL STAT seqEval Sequencer interface to Tcl Eval Tcl Interp interp Tcl interpreter pointer char script string with script CCSERROR error error structure pointer EXTERN ccsCOMPL STAT seqMonitorQ enables disables monitoring of msg queue Tcl Interp interp result string goes to interp result vltLOGICAL stateflag ccsTRUE gt enable ccsFALSE gt disable CCSERROR error returned error structure endif CCS FULL CCS LIGHT EXTERN ccsCOMPL STAT saveAndCloseStack does a errCloseStack after saving CCSERROR error this error structure in global lastError endif SEQ H 15
134. q redirect stderr tmp myLogFile 3600 1000000 seqWish seqWish seq redirect stderr seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X Last change 28 03 02 10 36 140 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq relToAbsPath n NAME seq relToAbsPath seq findFile seq waitTillActive seq waitTillDeagd seq isoTime seq fitsDate seq timeOfDay seq isoTimeToClock a collection of Sequencer procedures SYNOPSIS seq relToAbsPath lt pathName gt seq findFile lt relPath gt seq waitTillActive env proc timeout N lt period gt lt runstring gt preferExec seq_waitTillDead lt env gt lt proc gt lt timeout gt lt period gt lt exitCmd gt seq_isoTime seq_fitsDate seq_timeOfDay seq_isoTimeString2Clock lt timeString gt DESCRIPTION seq_relToAbsPath will return the absolute pathname corresponding to a relative lt pathName gt works for files as well as directories seq_findFile will return the absolute path of lt relPath gt after looking for it in the following order 1 the current working directory i e lt relPath gt 2 relPath 3 SINTROOT lt relPath gt 4 VLTROOT lt relPath gt If lt relPath gt is not found an error is returned lt relPath gt not found seq_waitTillActive will wait untill a certain process is active i e until it can receive CCS messages
135. r disables the treatment of commands that are sent to the Sequencer via the CCS message system open enable the input of commands close disable the input of commands IRONMEN PENV an environment variable used to determine under which CCS environment the application needs to registered by the seq ccsInit command See also the CAUTIONS section seq ccsEnvName a read only global Tcl variable initialized after the first seq ccsInit command to the string value given by CCS as the local environment name seq cosProcName a read only global Tcl variable initialized by seqInit to seqNAME as defined in seq h and linked to the global C variable myProcName This variable is used as the default name under which to register the Sequencer with CCS If the seq_ccsInit command includes the lt procName gt parameter seq_ccsProcName will be updated accordingly after a successful ccsInit seq_ccsStatus HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 a read only global Tcl variable which reflects the status of initialization the Sequencer went through values can be CLOSED seq ccsInit has been given befor OPEN seq ccsAsyncInput open was given after seg ccsInit succeeded if the variable does not exist seq ccsInit was never given befor or seq ccsExit was given after seq ccsInit g ETURN VALUES OK if no errors occurred accompanied by for s
136. r the seqWish prompt and all replies on a new line seqWish seq msgSendCommand wtel13 DCS init cmd145 seqWish seqWish seq msgRecvReply 000145 errNr lr CCD 87 having problems trying again seqWish echo lr 0 seqWish seq msgRecvReply 000145 errNr lr CCD 87 initialization failed seqWish gt echo Slr 1 seqWish gt echo SerrNr i5 seqWish seq msgSendCommand wtel13 DCS init cmd187 seqWish seq msgRecvReply cmd187 errNr lr last CCD 87 initialized OK seqWish gt echo lr 1 seqWish gt echo SerrNr 0 seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X segqMsgRecvReply 3 seq msgSendCommand n msgRecvMsg 3 msgParseMsg 3 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 131 Last change 28 03 02 10 36 132 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq msgSendCommand n NAME seq msgSendCommand send a CCS message SYNOPSIS seq msgSendCommand noreply check nocheck N lt envName gt procName command lt args gt DESCRIPTION noreply flag that this command is of an event type i e there will be no replies to be sent back check flag to request command and parameter checking for this particular command overriding the global setting of the seq ccsCmdCheck Tcl variable see below nocheck flag to turn off command and parameter checking for this particular comman
137. retrieved as such by the receiving side This means that the generic error mnemonic seqERR CMD SCRIPT used for these cases does not correspond to a fixed error number its number gets overwritten with lt errorNr gt EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish gt prompt and all replies on a new line seqWish seq msgSendReply 585021260 0 I am still doing seqWish seqWish seq msgSendReply 585021260 5 I have found an error msg seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X segMsgDispatch n seq msgRecvReply msgSendReply 3 Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq_oslxCmd n NAME Seq oslxCmd process an oslx command SYNOPSIS seq oslxCmd command parameter instanceId lt arguments gt DESCRIPTION seq oslxCmd will invoke oslxSHELL CmdParser with the following arguments command name of a command supported by oslxServer Xparameter parameter name going with this command see the CDT of oslxServer instanceId instance Id of the command must be unique Remark that not all commands require this parameter lt arguments gt additional arguments of this lt command gt to be passed to oslsServer how many of these arguments there are depends on the
138. rly captured by the parent Sequencer shell 2 5 THE SEQUENCER AS AN IMBEDDABLE INTERPRETER The Sequencer comes with a C library libseqC a and or libseqC sl which allows it to be embed ded into any application written in C language This opens interesting perspectives as it means that a certain application can be partially written in C and partially as a Sequencer script Remark that this is quite different from e g sending a command to the Sequencer shell asking it to execute a certain script in the latter case 2 processes are involved in the former only one The library function which has to be called in this case to initialize the Sequencer embedded appli cation is segInitInterp Once this is done the evaluation of any script can be requested calling se qEval A word of warning though if you ask the interpreter to do a ccsInit passing him a script which contains a seq ccsInit command it means the interpreter will watch out for CCS messages events in its event loop ie whenever a script contains update or a call is made at C level to Tcl MainLoop0 or Tcl DoOneEvent0 and you may end up completely confused if you have your own event loop declared for such messages In other words one should decide whether the inter preter or the additional C code should take care of CCS messages events and not mix the two up 2 6 DYNAMICALLY LOADABLE EXTENSIONS The Sequencer shells being based on Tcl 8 3 3 include the possibility to load b
139. roc gt it is assumed that the process is dead already or that env is no longer active and a OK return will be taken seq isoTime will return the current UTC time in ISO 8601 format i e in the format yyyy mm ddThh mm ss seq fitsDate will return the current UTC date in the format yyyy mm dd seq timeOfDay will return the current UTC time of the day in the format hh mm ss seq isoTimeToClock will convert the UTC time timeString ISO format to the internal clock value integer timezone adjusted corresponding to this UTC time This is useful if one wants to mak lapsed tim calculations starting from ISO format time strings or to convert an ISO timeString to another non ISO format e g clock format seq isoTimeToClock timeString will return the time in the format as the standard Unix date command RETURN VALUES as any Tcl procedure OK returns are always empty except for seq waitTillActive when exec is used in this case the Unix process id of the scheduled process is returned In case of an error the following self explanatory error messages can be returned seq findFile relPath not found in standard search path seq waitTillActive process proc env lt env gt not active after timeout ms seq waitTillDead process proc env lt env gt still active after timeout ms 141 142 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 CAUTIONS I
140. rtain process have replies pending Hence it is strongly advised to use the former as argument for this command EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq msgSendCommand wtel3 DCS init cmd15 seqWish gt seqWish seq msgCheck cmd15 1 seqWish seq msgList wtel3 11 wtel3 ICS START cmd15 wtel3 DCS INIT seqWish gt seq_msgRecvReply cmd15 CCD 87 initialized OK seqWish seq msgCheck cmd15 0 Se 1 SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 seqMsgSendCommand 3 segMsgRecvReply 3 Last change 28 03 02 10 36 119 120 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq msgDispatch n NAME seq msgDispatch seq msgDispatchBreak enable asynchronous queue monitoring via file descriptor SYNOPSIS seq msgDispatch timeout nrMessages seq msgDispatchBreak D ESCRIPTION seq msgDispatch the Sequencer command executed automatically whenever a message is available on the queue and message reading has been enabled s seq css n As a registered Sequencer command it can be called just like any other command although this is not its primary reason for existence timeout timeout value in ms default 0 wait forever Remark that if there is no m
141. ry copy of 256 bytes of value This means that in the presence of a valid type option there will internally be a conversion into a 256 byte buffer Without this type option the user of this command mandatorily needs to take care of th ncoding i e put the right number of bytes in the proper order within value and in particular that value does contain at least 256 bytes Not following this rule could result in segmentation errors See see also Tcl s binary n command and the example below EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq logFitsComment This is a free field FITS comments log seqWish gt seqWish gt the easy way to log an integer value 109 110 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seqWish seq logFitsParRecord int OBS OBS ID Svalue seqWish gt or the hard way seqWish if cequal tcl platform byteOrder bigEndian set i I seqWish seq logFitsParRecord OBS OBS ID binary format i x252 value seqWish seqWish seq logFitsParRecord string OBS OBS NAME any string seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X logFitsAction 3 logFitsComment 3 logFitsEvent 3 logFitsParRecord 3 Last change 28 03 02 10 36 seq logFitsC
142. s short lived and anyway not numerous but for reasons of uniformity this type of handles can be dealt with as well So the objects of seq deleteHandle might remain limited to the command handles ENVIRONMENT no environment nor Tcl variables are read nor set RETURN VALUES OK return if no errors occurred The result string is empty RROR return if one of the following conditions is met with corresponding rror message here between single quotes wrong args should be seq deleteHandle handle the corresponding Sequencer command was given with the wrong number of arguments invalid handle handle if the handle is not one of the four types listed above looking at the first few characters HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 invalid cmd handle lt handle gt no replies pending it if the command handle does not have any replies pending on it invalid event handle lt handle gt no database events associated to it if th vent handle does not have any attributes attached invalid script handle handle no SCRIPT command related to it invalid list handle handle no multi read write items associated bo mt CAUTIONS rhe deletion of a command handle should be exercised with proper care The reason being that the process who received the associated command will not be informed that it should no longer send replies to
143. s used to in an other language So take care about the following The grouping of words by quoting is done before substitutions are performed 1 6 the values of variables or command results do not affect grouping Example 1 Remark that from this point on there is a difference between normal words and Tcl words the former cannot contain whitespace or newlines the latter is like any C string HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 set expr set b set c 50 puts stdout The square of c is a c c b will print the string The square of c is expr 50 50 There is only a single round of substitutions before command invocation the result of a substitution is not interpreted a second time Example set a 50 set b 88 set c b will set c to the string a not to the string 50 A left curly brace can only be preceded by whitespace word separator another left brace nesting or opening square bracket command substitution Likewise a right curly brace can only be followed by whitespace another right brace or closing square bracket The Tel interpreter will trip over and complain about any other character A double quote character can only be an opening quote for grouping if it is preceded by whitespace Example set tenInch 10 is perfectly legal and will set tenInch to the string 10 Square brackets used for command substitution do not require spaces around them Example s
144. s within the script received with this SCRIPT command or within a procedure called by this script current a flag indicating that the scriptId of the current SCRIPT command should be used instead of an explicitly specified lt scriptId gt This provides an alternative to the 55 substitution see below In case various SCRIPTS commands are nested possible if a script being evaluated includes e g an update command the handle used is always the one of the current context lt scriptId gt script command handle as substituted for 55 by seq msgDispatch at the time it received the SCRIPT command this handle allows to identify the process which originated the SCRIPT command lt errorNr gt number of the error 0 means no error lt lastReply gt a Tcl boolean variable to flag if this is the last reply Its default value is 0 If lt errorNr gt is not 0 the value Specified for lastReply is irrelevant i e an error reply is by definition the last reply reply string containing reply if lt errorNr gt is 0 this will be in the message buffer at the receiving side otherwise this string will be in the ccsERROR structure passed across which means this is then also the last reply If reply is of a size which does not fit into a single reply seq msgSendReply will automatically chop up this string into multiple fragments send each fragment in the right order as a reply whereby only the last
145. same site http www tcltk com however this site has been down lately and it is not clear to which other site this info is going to be relocated In any case the code sources for these extensions are currently on SourceForge there are some html pages ordered as an index to a set of Tcl Tk references available on the WWW http www sco com Technology tcl Tcl html ofcourse there are also newsgroups dedicated to Tcl Tk news comp lang tcl 1 All of these URLs were checked at the time of inclusion in this manual of course there is no guarantee that at the time of reading they are all still correct in particular the ones referring to home directories of individuals 26 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 news comp lang tcl announce The latter newsgroup is moderated An archive of it can be found at http www findmail com list tcl announce HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 27 3 INSTALLATION This chapter is intended for the people who have to write maintain the VLT Common Software in stallation procedures It contains the information needed to create the proper scripts for the genera tion and installation of the Tcl Tk core and extensions as part of the VLT Common Software 3 1 REQUIREMENTS The Tcl extensions which are incorporated into the Sequencer must have been installed properly before the installation of the Sequencer is attempted The cookbook recipe for that is
146. space on the first line between the closing brace of the first argument and the opening brace of the second is essential 23 SEQUENCER SHELL COMPONENTS The Sequencer shells segSh and seqWish are statically built on top of Tcl Tk 8 3 3 seqWish which includes Tk functionality contains all of the following extensions incr Tcl version 3 2 the extension that supports object oriented programming in Tcl Tk This also includes incr Tk version 3 2 which gives the framework to build megawidgets and iwidgets 3 0 1 which is a set of megawidgets TclX version 8 3 and version 8 3 the extended Tcl Tk command set adding several UNIX commands file I O commands and math commands BLT version 2 4u the Bell Lab Toolkit consists of about a dozen graphical commands all in the namespace msqltcl version 1 99 an extension that provides high level access to a Mini SQL mSQL database server Mini SQL mSQL is a freely available lightweight database engine Img version 1 2 4 a package which enhances Tk adding support for many other Image formats BMP XBM XPM GIF with transparency PNG JPEG TIFF and postscript seqSh on the other hand does not have X capabilities by default i e it contains only Tcl incr Tcl TclX and msgqltcl However dynamic loading permits to add incr Tk iwidgets BLT and Img at runtime into seqSh These listed extensions are available as static packages i e
147. specific lt command gt ENVIRONMENT no environment nor Tcl variables are read nor set Ke ETURN VALUES K return if no errors occurred Also the reply buffer of this lt command gt will be returned in the result string RROR return if one of the following conditions is met with corresponding rror message here between quotes wrong args should be seq oslxCmd command parameter XinstanceId lt arguments gt the corresponding Sequencer command was given with too few arguments could not parse command parameter 1 if oslx returned an error th rror message from oslx is included t CAUTIONS Remark that although the generic command syntax rules allows several parameters and their corresponding values to be combined in a single command oslxServer does not do so So lt parameter gt is a single parameter of lt command gt Some of the oslxServer commands affect environment variables In order to keep the Tcl array env aligned with the process environment it is therefore imperative that the seq oslxCmd command is given within a shell which takes care of this aspect like seqSh or seqWish EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seqWish SEE ALSO Tcl and t
148. ssue any err Stack command nor access the display stack In the latter case it is assumed that the script will take care of the error stack via seg ert internal reply commands In all cases the corresponding error stack will be copied over to the display stack seq errReplyMerging a global Tcl variable which determines how the merging of error replies will take place internal will append the reply stack to the internal error stack local will make the reply stack append to the default stack of zeg errAdd etc while off default leaves the error reply stack alone In the former two cases the error reply stack will be reset after merging without any logging In the latter case it will get logged automatically if seg errLogging is set to auto in which case it will also be copied over to the display stack HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 25 seq library set by the Sequencer shell to hold the path name of the directory containing a library of standard Sequencer scripts This variable is set from the environment variable SEQ LIBRARY if it exists or after locating the shell library scripts under either lib INTROOT lib or SVLTROOT lib seq moduleld initialized to seq and used throughout the Sequencer interpreter for CCS error and logging system calls The package name is also derived from this default value presently seq it is the same with the first character converted to uppercase
149. subsystem name s lt action gt verb defining the action corresponds to parameter name in the dictionary seq_logFitsComment will generate a FITS comment record Its arguments are lt who gt classname of generator of this log legal values are observer staff remote control or night assistant These names can also be abbreviated to ob sa rc respectively na and they can contain any mixture of lower and uppercase characters If who is not specified a free format comment will be logged lt logString gt string that has to be logged seq logFitsEvent will generate a FITS event record Its arguments are type unforeseen default or recovery These names can also be abbreviated to ufo resp rec and they can contain any mixture of lower and uppercase characters lt logString gt string that has to be logged seq logFitsParRecord generates a FITS parameter record Its arguments are type either int for 32 bit integers real for doubles or string for strings containing up to 256 characters dictionary name of the dictionary that will be checked for correctness of the other arguments remark that this does not include the ESO VLT DIC prefix cat 3 letter keyword category lt subsys gt subsystem name s lt parameter gt parameter name last substring of the short fits keyword value value for the parameter in 256 byte string
150. t EM 2 OH OH Id seq h v 2 69 2002 02 15 14 04 41 vltsccm Exp seq h who when what eallaert 30 03 94 created eallaert 28 07 95 differentiation of seqLONGNAME according to use of CCS eallaert 11 10 95 fixed various problems for compilation without CCS eallaert 03 05 96 Seq Init name compatible with load in Tcl 7 5 RK HK IK KK E kk KOK e ke k k This is the public interface file for the Sequencer extensions to Tcl Tk Remark that if you use it the following compilation flags should be set CCS FULL if the compilation is with full CCS CCS LIGHT if the compilation is with CCS light neither of the above if the compilation is without CCS Other header files y if defined CCS FULL defined CCS LIGHT include segErrors h error interface file else include seqErrorsNoCcs h error interface file endif include tclExtend h interface file for Tcl TclX if defined CCS FULL defined CCS LIGHT include ccs h declares the vlt and ccs datatypes endif CCS FULL CCS LIGHT Definition of constants define seqVFRSION Revision 2 69 string containing revision code tclAppVersion points to digits only infox appversion returns digits only define seqNAME sequencer default name stored in tclAppN
151. t can be used to construct a filter for receiving replies on this command It is therefore imperative that the recipients of such messages return the original command identifier in the reply If noreply is given the command will be sent with a msgCMDID of value 0 and the return will be empty as there are supposed to be no replies coming back This option is useful in an environment where some well known process es need s to be informed of an event while it is considered too xpensive to create access a database branch just for this purpose This option is functionally equivalent to sending a normal command and then receiving and discarding replies e g via the seq evtAttach mechanism but it is of course a lot more efficient If the recipient process is a Sequencer shell the command needs to be EVENT instead of SCRIPT as this disables the return of replies by the recipient The checking of commands is in the absence of th cmdCheck and noCheck options done according to the value of the global Tcl variable seq ccsCmdCheck HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 133 no files are accessed ENVIRONMENT seq ccsCmdCheck is a global Tcl variable whose value determines whether th CCS message system will perform command checking based on the CDTs It must be set to either NO CHECK or CHECK CMD The default is NO CHECK Its application can be overridden by
152. ter messages came on call th queue this file descriptor will not be released by seq ccsExit In words seq ccsInit seq ccsExit cycli may lead to high numbered fil other descriptors and even to some memory leaking Remark that ccsInit ccsExit cycli are not officially supported by CCS EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq ccsInit file5 seqWish echo seq ccsStatus CLOSED seqWish seq ccsInit Error seq ccsInit was given before seqWish seq ccsAsyncInput open seqWish echo seq ccsStatus OPEN seqWish seq ccsExit seqWish echo seq ccsStatus can t read seq ccsStatus no such variable seqWish seq ccsExit seqWish These 3 characters are only there to avoid that docDoManPages interprets the words CLOSED and OPEN as new sections of the manpage SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X seq msgDispatch n seqCcsInit 3 seqCcsExit 3 ccsInit 3 ccsExit 3 seqInit 3 Last change 28 03 02 10 36 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 47 seq dbDirAddrToName n See seq dbGetDirAddr n Last change 28 03 02 10 36 48 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq dbGetAlias n See seq dbGetA
153. terpret existing scripts and secondly there is or will be a tool to assist in the creation of sequencer scripts Although in principle the tool can be used by anybody provided there are different user levels writing a script with an editor will in most cases outperform the script created with the tool The two shells that are part of the Sequencer module are called segSh and seqWish The latter in 4 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 cludes the usual Tk widget commands while the former does not have any Tk windowing capabil ities or commands and consequently does not require a DISPLAY environment variable The name sequencer as application name is reserved for the tool described above With the integration of the Sequencer module into one of the latest Tcl cores dynamic loading be came available This means that extensions with extra functionality can be loaded during runtime if they are built according to a certain scheme There is no longer the need to create a monolithic in terpreter containing all the extensions you may ever need they can be loaded into memory as the need presents itself Some of the functionality of the Sequencer is offered this way A detailed ex planation of this feature is given in section 2 6 2 2 SCRIPTING LANGUAGESYNTAX The Tcl and Sequencer shells2 language have only a few basic rules A complete description can be found in 1 chapter 2 and in 2 This is summarized in the rest
154. th seq ccsInit seq ccsStatus reflects the CCS status of the Sequencer This variable is either undefined no seq ccsInit given or it is set to OPEN or CLOSED depending on whether a seq ccsInit was followed by a seq ccsAsyncInput open or not seq ccsType a global Tcl variable read only which reflects how the shell was linked It is set to either full light or none depending on whether the shell was linked with full CCS CCS light or without CCS seq debug a global Tcl array variable which reflects the debug info flag for each of the primary seq commands it can handle Each of the elements of this array can be set to 0 default no debug info or have any combination of the following bits set bit 0 print stack level command name plus arguments to stderr 1 return value gets printed 2 print timestamp and 3 print internal command specific debug info If bit 1 is set the return value is printed as OK or ERR followed by the return string put in between greater than and less than signs e g OK gt 13 1 lt This provides basic functionality to debug scripts at the seq level see also section 2 3 11 seq errLogging a global Tcl variable reflecting how the logging of errors occuring during the execution of seq commands are dealt with auto default leads to automatic logging of all unrecoverable errors by issuing an errCloseStack off will not log any error by issuing an errResetStack while manual will not i
155. the location identifier Typically the caller could set sourceId to info script If lt sourceId gt is not specified it will be set to the name of the script file which executes this seq catch command ENVIRONMENT no environment nor Tcl variables are read nor set RETURN VALUES identical to catch returns OK with the result string set to 0 if command did not produce an error If command returned an error the result string contains 1 and msg if given will be set to th rror message left by command returns ERROR with corresponding message in the result string under the following conditions wrong args should be seq catch command msg sourceId if there were more than 2 arguments given to this command EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq catch set a b msg MyProcedure 0 seqWish seq catch set a c msg MyProcedure 1 seqWish set msg can t read c no such variable seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X catch n seq errAdd n HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 41 Last change 28 03 02 10 36 42 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq ccsAsyncInput n See seq ccsInit n
156. the corresponding rror message here between quotes wrong args should be seq msgRecvReply all ascii bin fbin last nnn nonewline nowait cmdId lt errorNumber gt lt lastReply gt if there were not at least two additional arguments on top of eventual options invalid cmd handle option optionX should be all ascii Din fbin last nowait nonewline or a numeric value if one of the options is wrong invalid cmd handle cmdId no replies pending on it failed to allocate memory to format binary reply if there seems to be no memory available for the temporary formatting buffer this allocation is done the first time formatting of a reply is attempted reply on cmdId command cmd to lt env gt lt proc gt could not be formatted if the formatting failed most likely there is something wrong with the CDT check th rror stack and CDT reply timed out if no reply came in within the specified timeout message queu mpty if nowait was specified and no reply was in yet could not receive message if msgRecvMsg returned an error could not parse reply received reply on lt command gt with wrong commandId lt commandId gt when the replier either did not set the orgCommandId properly or sends more replies after the lastReply flag was set no memory available to store replies if in the handling of incoming replies a malloc failed
157. the options check and nocheck See also the description of the argument flag in the manpage of msgSendCommand 3 RETURN VALUES OK if no errors occurred In this case the result string is either empty if noreply was specified or otherwise contains the next available command handle as mentioned abov ERROR if one of the following conditions is met with the corresponding rror message here in bold face wrong args should be seq msgSendCommand noreply check nocheck envName procName command lt args gt if seq msgSendCommand is not given with at least 3 additional arguments wrong option xyz should be noreply check or nocheck if an unknown option xyz was specified could not send command command lt args gt to lt envName gt lt procName gt if msgSendCommand 3 returned an error CAUTIONS command will be converted to UPPERCASE as required by CCS a consequence the Sequencer shells cannot deal with command synonyms containing lowercase characters EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish The trivial case 3 parameters without quotes and spaces seqWish seq msgSendCommand check wtel3 ICS TEST parl 2 par3 cmd14 seqWish gt The same result easy to grasp but s
158. this argument cannot get alias name of pointName dbGetAlias returned an error for this argument CAUTIONS Unfortunately point and attribute names can in principle contain spaces If this is the case such name will be surrounded by braces as any proper Tcl list element EXAMPLES For clarity s sake th xample is for an interactive session with input typed by the user coming after the seqWish prompt and all replies on a new line seqWish seq dbGetAttrNames PARAMS SCALARS scalar double scalar float scalar int32 scalar logical scalar string128 seqWish seq dbGetFamilyNames PARAMS SCALARS absolute PARAMS seqWish gt seq_dbGetFamilyNames PARAMS absolute PARAMS SCALARS PARAMS TABLES PARAMS VECTORS seqWish seq dbGetFamilyNames PARAMS alias alias root lt alias gt SCALARS lt alias gt TABLES lt alias gt VECTORS seqWish gt seq_dbGetAttrNames PARAMS TABLES full_table seqWish gt seq_dbGetFieldNames PARAMS TABLES full_table logical int8 uint32 float string4 string32 seqWish gt seq_dbGetAlias PARAMS TABLES lt alias gt TABLES seqWish SEE ALSO Tcl and the Tk toolkit John K Ousterhout ISBN 0 201 6337 X seqDbGetFamilyNames 3 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 53 Last change 28 03 02 10 36 54 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 seq dbGetCwp n See seq dbSetCwp n Last
159. this is tested by sending periodically PING commands with the CCS message system lt env gt environment where the process will run lt proc gt name under which the process will register itself with CCS timeout how long to wait in ms before the seq waitTillActive returns an error period period in ms for sending PING commands default 100 ms This determines the resolution of timeout runstring If not empty seq waitTillActive will first of all schedule he process in the environment env If this env is the t local environment exec can be used for this scheduling S lt preferExec gt thereby setting stdout of this new process the same as the script s stdout otherwise the msgSchedule 1 u b u tility is used and there will be no stdout messages In oth cases the lt runstring gt is passed to the scheduling tility lt preferExec gt a boolean variable if set to 1 and lt env gt is the local environment use exec n for the scheduling instead of msgSchedule 1 s above Default use msgSchedule 1 There are no errors logged for the failed attempts to send a PING command nor for the failing of seq waitTillActive itself If the scheduling is done with exec n the Unix process id will be returned if successful HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq waitTillDead will wait untill a certain process is inactive i e until it no longer respon
160. tive Only for a full or light CCS environment seq isoTime returns the current UTC time in ISO 8601 format i e as yyyy mm ddThh mm ss seq fitsDate returns the current UTC date in the format y yy y mm dd seq timeOfDay returns the current UTC time of the day in the format hh mm ss seq isoTimeToClock will convert a UTC time string in ISO format to the internal clock value integer timezone adjusted corresponding to this UTC time Debugging help The environment installed with the seq module includes some debugging facilities of scripts writ ten in the Sequencer language at different levels tcICheck This is a contribution to the Tcl archive which allows to check the syntax of the script It isa program which can run a basic check on the syntax of a Tcl script Very useful to detect mismatching curly braces brackets etc Using this utility does not require any modification in your script seq debug The Sequencer shells contain a global Tcl variable called seg debug which is an array with all debugable seq commands as elements Assigning a particular element the value 1 bit 0 will log the stack level command name plus arguments to stderr setting bit 1 means the return value will get printed bit 2 stands for the timestamp while bit 3 is for internal command specific debug info If bit 1 is set the return value is printed as OK or ERR followed by the return string put in between greater than
161. ttrNames n Last change 28 03 02 10 36 HOS Sequencer Llser Manual 3 VLT MAN ESO 17220 0737 seq dbGetAttrInfo n NAME seq dbGetAttrInfo get the detailed characteristics of an attribute SYNOPSIS seq dbGetAttrInfo lt attrSymAddress gt DESCRIPTION seq dbGetAttrInfo will retrieve the detailed description of an attribute lt attrSymAddress gt string containing a symbolic address of the attribute in a format as permitted by dbGetAttrInfo 3 M cq M will return 4 values in the following order the attribute type SCALAR VECTOR or TABLE a list of data types In the case of SCALARs and VECTORs this list contains a single element without braces For TABLEs this list contains on lement per field if no field indices were specified th data types of all fields will be returned the number of records always 1 for SCALARS for TABLES it is according to the record indices or the total number of records in the table if no record indices were given the number of fields always 1 for SCALARS and VECTORs for TABLES it is according to the field indices or the total number of fields in the table if no field indices were given ENVIRONMENT no environment nor Tcl variables are read nor set ETURN VALUES K return if no errors occurred In this case the result string contains the attribute type the list of data types a single element for SCALARs and
162. valuation causes problems the event will be disabled so errors do not pop up continuously d Finally if the message is of the obituary type the script contained in the global Tcl variable seq obiScript will be executed Remark that any process interested in receiving obituaries needs to have an entry in RtapEnvTable with the Care about Terminations field properly set on the other hand all processes doing a ccsInit ccsExit will generate obituaries by default ie even when they are not listed in RtapEnvTable seg msgDispatchBreak is a companion command to break out from the waiting on the message queue when it is empty The latter is never the case when seq msgDispatch has been set up via seq ccsAsyncInput Both these commands seq msgDispatch and seq msgDispatchBreak are normally not given directly by the user seq msgDispatch gets automatically invoked after a message of any type comes on the queue 10 2 3 3 HOS Sequencer User Manual 3 VLT MAN ESO 17220 0737 CCS On line Database Interface seq dbDirAddrToName Convert a direct address into a symbolic address Maps into dbDirAddrToName 3 seq dbGetAlias To retrieve the alias name of a point Maps into dbGetAlias 3 seq dbGetAttrInfo To retrieve the information on an attribute Maps into dbGetAttrInfo 3 seq dbGetAttrNames To get the names of the attributes of a point Maps into dbGetAttrNames 3 seq dbGetFamilyNames To retrieve the point names of parent a
163. ven insinuate that such zombie processes still consume CPU cycles which is not the case Anyway the existence of some zombies is normally not so alarming if such a process is launched again the system will re use the process table of the zombie So if a Sequencer application exec s only a limited set of children in the background it is not necessary to do extra clean up When the HOS Sequencer Ulser Manual 3 VLT MAN ESO 17220 0737 21 parent Sequencer shell exits its zombie children will be removed from the process table If on the other hand a Sequencer application can schedule in the background an infinite set of dif ferent processes which then terminate as zombies it could exhaust the process table if no measures are taken There are some alternatives to cope with this see also the TclX manpages run occasionally the wait nohang command either periodically via after or whenever some background idle task is performed Remark however that the application needs to ensure that this does not interfere with pieces of code that check if a background process has terminated i e other uses of the wait command keep track of the children process ids and check them occasionally with the wait command ignore the SIGCHLD signal via the command signal ignore SIGCHLD This can only be done if the application does not exec processes in the foreground as otherwise these children would be lost their termination would not be prope
164. y the needs of technically oriented people and will not satisfy the generic public The reason is quite simple being an extension to Tcl Tk the Sequencer s syntax is the one inherited from Tcl Tk such syntax as the syntax of any popular programming or shell language will not be mastered or even appreciated by many observers It simply does not allow to describe easily and intuitively the steps required to execute a sequence of observations The Sequencer needs therefore to be extended towards the higher level There are a couple of direc tions which can offer solutions The development of higher level commands such procedures can hide to some extent the intricacies of the system and the scripting language at least if these higher level commands do not allow lots of arguments and or options The use of tables tables describing sequences of repeated actions are easy to construct on any hardware platform very intuitive and straightforward to interpret by an interpreter like the Sequencer This can be considered a specific case of the previous point The use of visual programming tools this area looks quite promising If carefully designed and implemented it gives a means to write and execute sequences in a very intuitive way This is being investigated right now Careful readers will have noticed that technically speaking the Sequencer is more than one applica tion First of all we have the interpreter shells able to in

Download Pdf Manuals

image

Related Search

Related Contents

溶存酸素計取扱説明書 - 山形東亜DKK株式会社  "取扱説明書"  Demandas-Especificas-2006-05-SEMAR  Guida di installazione rapida  HP Mini 210-2206si    Health and Safety Plan - UW NNIN Washington Nanofabrication  user manual - Document Plus  American Dryer Corp. AD/UD-50 User's Manual  Mise en page 1  

Copyright © All rights reserved.
Failed to retrieve file