File cmdTrace.c

 ** ** Module Header ******************************************************* **
 ** 									     **
 **   Modules Revision 3.0						     **
 **   Providing a flexible user environment				     **
 ** 									     **
 **   File:		cmdTrace.c					     **
 **   First Edition:	95/12/26					     **
 ** 									     **
 **   Authors:	Jens Hamisch, jens@Strawberry.COM			     **
 ** 									     **
 **   Description:	The Tcl module-trace routine which provides a con-   **
 **			trolling interface to the modulecmd tracing feature  **
 ** 									     **
 **   Exports:		cmdModuleTrace					     **
 **			GetTraceSel					     **
 **			CheckTracing					     **
 **			CheckTracingList				     **
 ** 									     **
 **   Notes:								     **
 ** 									     **
 ** ************************************************************************ **
References Variables: IdcmdTrace.c
  _all_offcmdTrace.c
  addREmain.c
  aproposREmain.c
  availREmain.c
  clearREmain.c
  dispREmain.c
  helpREmain.c
  initREmain.c
  listREmain.c
  purgeREmain.c
  rmREmain.c
  swREmain.c
  unuseREmain.c
  updateREmain.c
  useREmain.c
  whatisREmain.c

Included Files


Preprocessor definitions

#define MOD_TR_LOAD _all_off

#define MOD_TR_UNLOAD _all_off

#define MOD_TR_SWITCH _all_off

#define MOD_TR_DISP _all_off

#define MOD_TR_LIST _all_off

#define MOD_TR_AVAIL _all_off

#define MOD_TR_HELP _all_off

#define MOD_TR_INIT _all_off

#define MOD_TR_USE _all_off

#define MOD_TR_UNUSE _all_off

#define MOD_TR_UPDATE _all_off

#define MOD_TR_PURGE _all_off

#define MOD_TR_CLEAR _all_off

#define MOD_TR_APROPOS _all_off

#define MOD_TR_WHATIS _all_off


Typedef ModTrace

typedef struct _mod_trace ModTrace
struct _mod_trace 
   { 
     char** re_ptr; 
     char const* cmd; 
     char* tracing; 
     char alloc; 
   } 

Local Variables

Id
static char Id[]
Used in:  cmdTrace.c

UseId
static void* UseId[]

module_name
static char module_name[]
Used in: ChangeTraceSel()
  CheckTracing()
  CheckTracingList()
  cmdModuleTrace()

_all
static char _all[]
Used in: ChangeTraceSel()
  cmdModuleTrace()

_all_on
static char _all_on[]
Used in: ChangeTraceSel()

_all_off
static char _all_off[]
Used in:  cmdTrace.c
  ChangeTraceSel()

TraceSelect
static ModTrace TraceSelect[]
Used in: ChangeTraceSel()
  CheckTracing()
  CheckTracingList()
  GetTraceSel()
  GetTraceTable()
  cmdModuleTrace()


Global Function CheckTracing()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		CheckTracing					     **
 ** 									     **
 **   Description:	Check wheter thracing is turned on for the passed    **
 **			command and modulefile				     **
 ** 									     **
 **   First Edition:	95/12/26					     **
 ** 									     **
 **   Parameters:	char	*cmd		Subcommand to be checked     **
 **			char	*modulefile	Modulefile to be checked     **
 ** 									     **
 **   Result:		int	0		No tracing		     **
 **				1		Tracing enabled		     **
 ** 									     **
 ** ************************************************************************ **
int CheckTracing ( Tcl_Interp* interp, char* cmd, char* modulefile )
Prototyped in: modules_def.h
Calls: CheckTracingPat()cmdTrace.c
  GetTraceTable()cmdTrace.c
  Module_Error()error.c
Called by: cmdModuleInfo()cmdInfo.c
References Variables: TraceSelectcmdTrace.c
  module_namecmdTrace.c

Global Function CheckTracingList()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		CheckTracingList				     **
 ** 									     **
 **   Description:	Check wheter tracing is turned on for the passed     **
 **			command and at least one of the passed modulefiles   **
 ** 									     **
 **   First Edition:	95/12/26					     **
 ** 									     **
 **   Parameters:	char	*cmd		Subcommand to be checked     **
 **			int	 count		Number of passed modulefiles **
 **			char	**modules	Modulefiles to be checked    **
 ** 									     **
 **   Result:		int	0		No tracing		     **
 **				1		Tracing enabled		     **
 ** 									     **
 ** ************************************************************************ **
int CheckTracingList ( Tcl_Interp* interp, char* cmd, int count, char** modules )
Prototyped in: modules_def.h
Calls: CheckTracingPat()cmdTrace.c
  GetTraceTable()cmdTrace.c
  Module_Error()error.c
Called by: cmdModule()cmdModule.c
References Variables: TraceSelectcmdTrace.c
  module_namecmdTrace.c

Global Function GetTraceSel()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		GetTraceSel					     **
 ** 									     **
 **   Description:	Retrieve the trace selection pattern for the passed  **
 **			module command					     **
 ** 									     **
 **   First Edition:	95/12/26					     **
 ** 									     **
 **   Parameters:	char	*cmd		Subcommand to be checked     **
 ** 									     **
 **   Result:		char *	NULL		Module subcommand not found  **
 **				Otherwise	Assigned trace pattern	     **
 ** 									     **
 ** ************************************************************************ **
char* GetTraceSel ( Tcl_Interp* interp, char* cmd )
Prototyped in: modules_def.h
Calls: GetTraceTable()cmdTrace.c
Called by: cmdModuleInfo()cmdInfo.c
References Variables: TraceSelectcmdTrace.c

Global Function cmdModuleTrace()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		cmdModuleTrace					     **
 ** 									     **
 **   Description:	Callback function for 'trace'			     **
 ** 									     **
 **   First Edition:	95/12/26					     **
 ** 									     **
 **   Parameters:	ClientData	 client_data			     **
 **			Tcl_Interp	*interp		According Tcl interp.**
 **			int		 argc		Number of arguments  **
 **			char		*argv[]		Argument array	     **
 ** 									     **
 **   Result:		int	TCL_OK		Successfull completion	     **
 **				TCL_ERROR	Any error		     **
 ** 									     **
 **   Attached Globals:	TraceSelect	List containing all tracing settings **
 **   			g_flags		These are set up accordingly before  **
 **					this function is called in order to  **
 **					control everything		     **
 ** 									     **
 ** ************************************************************************ **
int cmdModuleTrace ( ClientData client_data, Tcl_Interp* interp, int argc, char* argv[] )
Prototyped in: modules_def.h
Calls: ChangeTraceSel()cmdTrace.c
  GetTraceTable()cmdTrace.c
  Module_Error()error.c
  fprintf(), malloc(), memset(), strcmp(), strlen(), strncmp()
Used in: InitializeModuleCommands()init.c
References Variables: TraceSelectcmdTrace.c
  _allcmdTrace.c
  g_flagsmain.c
  module_namecmdTrace.c

Local Function ChangeTraceSel()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		ChangeTraceSel					     **
 ** 									     **
 **   Description:	Change the trace selection for all commands speci-   **
 **			fied in the passed 'cmd_table'. The passed module-   **
 **			name has to be changed according 'on_off'	     **
 ** 									     **
 **   First Edition:	95/12/26					     **
 ** 									     **
 **   Parameters:	char	*cmd_table	Boolean array indicating all **
 **						commands in the TraceSelect  **
 **						table to be changed	     **
 **			int	 cmd_tab_size	Size of this array	     **
 **			char	 on_off		'+' switch tracing on	     **
 **						'-' switch tracing off       **
 **			char	*module_pat	Pattern for the affected     **
 **						module files		     **
 ** 									     **
 **   Result:		int	TCL_OK		Successfull completion	     **
 **				TCL_ERROR	Any error		     **
 ** 									     **
 ** ************************************************************************ **
static int ChangeTraceSel ( Tcl_Interp* interp, char* cmd_table, int cmd_tab_size, char on_off, char* module_pat )
Prototyped in: cmdTrace.c
Calls: Module_Error()error.c
  malloc(), strchr(), strcmp(), strcpy(), strlen(), strtok()
Called by: cmdModuleTrace()cmdTrace.c
References Variables: TraceSelectcmdTrace.c
  _allcmdTrace.c
  _all_offcmdTrace.c
  _all_oncmdTrace.c
  module_namecmdTrace.c

Local Function CheckTracingPat()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		CheckTracingPat					     **
 ** 									     **
 **   Description:	Check the passed pattern if it enables tracing for   **
 **			the passed module file				     **
 ** 									     **
 **   First Edition:	95/12/26					     **
 ** 									     **
 **   Parameters:	char	*pattern	Pattern to be checked	     **
 **			char	*modulefile	Modulefile to be checked     **
 ** 									     **
 **   Result:		int	0		No tracing		     **
 **				1		Tracing enabled		     **
 ** 									     **
 ** ************************************************************************ **
static int CheckTracingPat ( Tcl_Interp* interp, char* pattern, char* modulefile )
Prototyped in: cmdTrace.c
Calls: Tcl_RegExpMatch(), strtok()
Called by: CheckTracing()cmdTrace.c
  CheckTracingList()cmdTrace.c

Local Function GetTraceTable()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		GetTraceTable					     **
 ** 									     **
 **   Description:	Returns the TraceSelect index for the passed module  **
 **			subcommand					     **
 ** 									     **
 **   First Edition:	95/12/26					     **
 ** 									     **
 **   Parameters:	char	*cmd		Subcommand to be checked     **
 **			int	 num		Number of commands to be chk **
 ** 									     **
 **   Result:		int	>= 0		Successfull completion	     **
 **				-1		Any error		     **
 ** 									     **
 ** ************************************************************************ **
static int GetTraceTable ( Tcl_Interp* interp, char* cmd, int num )
Prototyped in: cmdTrace.c
Calls: Tcl_RegExpMatch()
Called by: CheckTracing()cmdTrace.c
  CheckTracingList()cmdTrace.c
  GetTraceSel()cmdTrace.c
  cmdModuleTrace()cmdTrace.c
References Variables: TraceSelectcmdTrace.c