Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.naic.edu/~phil/software/datataking/aotclREADME
Дата изменения: Sat Mar 13 18:49:53 2010
Дата индексирования: Sat Mar 1 02:27:20 2014
Кодировка:
history:
11jul01- pnt_Cmd.c -> pnt_CmdNew.c
start added pnt_TerCmd code to support the tertiary. This
junk goes to pntMProg.c instead of directly to terProg (pnt_TerCmd).
------------------------------------------------------------------------------------
Commands:
------------------------------------------------------------------------------------
There are three separate ao related commands
aog - ao generic commands
defined in aog_Cmd.c
pnt - pointing commands
defined in pnt_Cmd.c
mcp - datataking commands
defined in mcp_Cmd.c
sock- socket commands

------------------------------------------------------------------------------------
Programs:
------------------------------------------------------------------------------------
There are three separate programs (tcl interpreters) that we use:
- aogProg - contains aog command. (aogProg.c)
- pntProg - contains aog, pnt commands. (pntTcl.c)
- mcpProg - contains aog, pnt,mcp commands. (mcpProg.c)

------------------------------------------------------------------------------------
program Structure:
------------------------------------------------------------------------------------
setMyPriority.. sets programs priority.
aoTcl(){ call aoTcl (source aoTcl.c).
Tcl_CreateInterp() creates interpreter
aoTcl_AppInit(interp,&paoI) .. initalize
loop
process cmds till exit
end loop
aoTcl_AppDelete(interp,paoI); program specific cleanup
aoTcl_Delete(interp,paoI); generic cleanup
return;
}
exit

aoTcl_AppInit and apTcl_AppDelete are defined in the program file (mcpProg.c,
pntTcl.c, aogProg.c).
They do the program specific initialization:

aoTcl_AppInit{
aoTcl_Init(...ppaoI) (aoTclLib.c done for all programs)
- add task variable for reentrancy
- malloc AO_TCL_INFO structure , fill it in
- setup reply messages queue for us.
- tell program manager we are running.
- setup signal handlers
- execute source /home/online/Tcl/Lib/init.tcl
this sets global variables basevw,baseTcl, etc
does an add procedure all to $baseTcl/base
xxx_Init
- cmd specific initilization
- malloc cmd specific buffers
- Tcl_CreateCmd() ..create the command, add to tcl
Aog_Init(interp,*ppaoI){
Pnt_Init(interp,*ppaoI){
sources "/Setups/setups.pnt"
Mcp_Init(interp,*ppaoI){
}
------------------------------------------------------------------------------------
Initializations:
------------------------------------------------------------------------------------
generic:
1. aoTcl_Init executes Tcl/Lib/init.tcl

program specific
1. mcpProg starts via datatakingcpu.exp
rsh cpu
source baseTcl/Setups/setups.$CPU
execute init()
execute setup()
- init()
addprocall baseProc/gen
setup mcpstate
- setup()
addprocgen
addprocatm gen
addprocastro sband
addprocastro ri
2. pntTcl()
doesn't use a expect script, sourcing done in Pnt_init
3. aogProg()
no file sourced
doesn't use a expect script, sourcing done int Pnt_init
2. pntTcl - sources "/Setups/setups.pnt"
------------------------------------------------------------------------------------
Signals:
------------------------------------------------------------------------------------
definitions
Signal number 1..5 are mapped to SIG_ numbers in aoTcl.h
1 - ctrl-c, 2-ctrl\, 3 sighup, 4 sigterm, 5 sigkill

Sending.
Signals are sent by aog sig send prgName {signum} from within a tcl
interpreter, and via aoTcl_Kill(prgName,sig) from another program on
vxWorks. From withint the interpreters, you can have prgName@cpu.
The external programs should be called from the cpu that has the prog
you want to kill.

rcving.
All signals (1..5) are caught by aoTcl_SigHan in aoTclLib.h. It
uses a taskvariable to keep the signals to a particular program.

On reception, AO_TCL_INFO . sigOccurred, sigLast, sigNum are updated.

all ao_cmds check for sig1 on entry to ao cmds and in any wait
routines aog wait tick secmid, etc. They return error if sig1
occurs.

aog sig wait timeoutsecs can be used to catch all the other sigs.
It will return the signum that occured 2..5 or 0 on timeout.
it will return TCL_ERROR if sig1 occurs.