home *** CD-ROM | disk | FTP | other *** search
-
-
- Tcla can panic.
-
- This means that Tcla can encounter a situation that it can't recover from.
- For example, it might detect corruption of one of its linked lists, be
- unable to create a port, or detect some other error condition or get to
- somewhere where it was expedient for Tcl to "throw up its hands."
-
- If Tcla panics, by default it will display a requester that makes some
- explanation of what the problem was, where the "continue" and "cancel"
- options instead both say "panic."
-
- After the user clicks on one of the panic gadgets, panic continues by
- calling a user-specified cleanup routine, if one has been specified.
- The user-specified routine can perform cleanup operations, including
- calling Tcl_DeleteInterpreter, which will cause Tcla to perform all
- of its cleanup. The user cleanup routine should then call exit, _exit,
- Exit or whatever. (So far, we have found that it is safe to go ahead
- and call Tcl_DeleteInterp after a panic)
-
- There are Tcla calls that allow the user to specify three special "upcall"
- routines for use by Tcla. These are routines that you specify that Tcl
- can call when it gets into trouble. One, Tcla_CleanupRoutine, allows the
- user to specify a cleanup routine that panic will call. The second,
- Tcla_PanicRoutine, allows the user to replace the default panic behavior
- with one of their own choosing. When your panic routine is called, it
- receives an argument of "char *" containing the panic text. This routine
- must take a standard Aztec C call (Lattice may work); that is, it must not
- have a #pragma defined that causes it to expect or return arguments in
- registers.
-
- void
- Tcla_CleanupRoutine(struct TclaHeader *TclaHead,
- void (*cleanup_routine)(void));
-
- void
- Tcla_PanicRoutine(struct TclaHeader *TclaHead,
- void (*panic_routine)(char *));
-
- void Tcla_LowMemRoutine(struct TclaHeader *TclaHead,
- int (*lowmem_routine)(long));
-
- The user-routine specified by Tcla_LowMemRoutine is called by Tcla if it
- is unable to allocate some memory it has requested. An argument to the
- routine is the long int number of bytes requested. The routine is to
- return a zero if Tcla is to go ahead and retry the memory allocation
- (presumably the user routine has freed some memory), or a nonzero to
- indicate that Tcla is to go ahead and panic. (A zero value was used to
- mean that the allocation is to be retried to prevent a garbaged
- argument from causing an infinitie loop while trying to allocate and
- continuously failing.)
-
-