TCLX_HELP_PATCHES -   1/8/98

This patch file adds help about the tcl2c utility to TclX8.0.4
(or later). It should be applied" by running the \"patch\" program
in the top-level directory of a clean TclX 8.0.4 release, using
the command \"patch -p0 <TCLX_HELP_PATCHES\""

*** tcl/help/tcl/intro/tcl2c.orig	Sun Nov 30 11:33:18 1997
--- tcl/help/tcl/intro/tcl2c	Sun Nov 30 11:35:31 1997
***************
*** 0 ****
--- 1,65 ----
+ NAME
+        tcl2c - Simple utility to convert Tcl-code to C-strings
+ 
+ SYNOPSIS
+        tcl2c -o ?fileName source1 source2 ... ?options??
+ 
+        tcl2c -help?
+ 
+ 
+ DESCRIPTION
+        Tcl2c  is  a  small  utility  to  convert tcl-code into C-
+        strings.
+ 
+ 
+ 
+ AVAILABLE OPTIONS
+             -a        create char  arrays  in  stead  of  strings
+        (needed for Windows)
+ 
+             -n varname     which name to use for variables.
+ 
+             -o filename    output file (default is stdout)
+ 
+             -tcl      use Tcl
+ 
+             -tclx     use Tclx
+ 
+             -otcl     use Otcl (not tested yet)
+ 
+             -pvm      use tkPvm
+ 
+             -tk       use Tk
+ 
+             -tkx      use Tkx (not really useful)
+ 
+             -img      use Img
+ 
+             -tix      use Tix (not tested yet)
+ 
+             -blt      use Blt (not tested yet)
+ 
+             -vtcl     use Vtcl (not tested yet)
+ 
+ 
+ 
+ HOW TO USE
+        Assume you have a script file myscript.tcl, which you want
+        to be compiled as a standalone executable. All you have to
+        do is:
+ 
+            tcl2c -o myscript.c myscript.tcl -tk
+ 
+            cc -o myscript <dir>/libtk8.0.a -lX11 \
+                <dir>/libtcl8.0.a -lX11 -lsocket -lnsl -lm -ldl
+ 
+        (these options may vary, depending on your system)
+ 
+        After that you have a standalone executable myscript which
+        functions exactly the  same  as  wish  myscript.tcl.  Only
+        everyting is in a single file and doesn't depend on Tcl/Tk
+        being installed on your system any more.
+ 
+ 
+ KEYWORDS
+        argument
*** tcl/help/tcl/intro/tclsh.orig	Sun Nov 30 11:32:53 1997
--- tcl/help/tcl/intro/tclsh	Sun Nov 30 11:40:40 1997
***************
*** 92,99 ****
         for  each  command with ``% ''.  You can change the prompt
         by setting the variables tcl_prompt1 and tcl_prompt2.   If
         variable  tcl_prompt1 exists then it must consist of a Tcl
!        script to output a prompt;  instead of outputting a prompt
!        tclsh  will evaluate the script in tcl_prompt1.  The vari-
         able tcl_prompt2 is used in a similar way when  a  newline
         is  typed  but  the current command isn't yet complete; if
         tcl_prompt2 isn't set then no prompt is output for  incom-
--- 92,100 ----
         for  each  command with ``% ''.  You can change the prompt
         by setting the variables tcl_prompt1 and tcl_prompt2.   If
         variable  tcl_prompt1 exists then it must consist of a Tcl
!        script to return a prompt;  instead of outputting a prompt
!        tclsh will evaluate the script in  tcl_prompt1  and  write
!        the   result  of  the  evaluation  to  stdout.  The  vari-
         able tcl_prompt2 is used in a similar way when  a  newline
         is  typed  but  the current command isn't yet complete; if
         tcl_prompt2 isn't set then no prompt is output for  incom-
*** unix/tools/tclmanpages.orig	Sun Nov 30 11:06:14 1997
--- unix/tools/tclmanpages	Sun Nov 30 11:06:50 1997
***************
*** 1,6 ****
--- 1,7 ----
  return {
      {Tcl.n          tcl/intro/syntax}
      {tclsh.1        tcl/intro/tclsh}
+     {tcl2c.1        tcl/intro/tcl2c}
      {append.n       tcl/strings/append}
      {array.n        tcl/variables/array}
      {binary.n       tcl/strings/binary}
*** tcl/generic/tclExtend.h.orig	Sun Nov 15 22:19:26 1998
--- tcl/generic/tclExtend.h	Mon Nov 23 00:24:11 1998
***************
*** 243,248 ****
--- 243,312 ----
                                     char       *prompt1,
                                     char       *prompt2));
  
+ 
+ typedef struct TclX_StubTable {
+     int (*runtimeInit) _ANSI_ARGS_((Tcl_Interp *interp,
+ 	    char       *which,
+ 	    char       *defaultLib,
+ 	    char       *version));
+     int (*asyncCommandLoop) _ANSI_ARGS_((Tcl_Interp *interp,
+ 	    int         options,
+ 	    char       *endCommand,
+ 	    char       *prompt1,
+ 	    char       *prompt2));
+     void (*errorExit) _ANSI_ARGS_(TCL_VARARGS_DEF(Tcl_Interp *, interpArg));
+     int (*eval) _ANSI_ARGS_((Tcl_Interp  *interp,
+ 	    unsigned     options,
+ 	    char        *cmd));
+     void (*evalRCFile) _ANSI_ARGS_((Tcl_Interp *interp));
+     void (*printResult) _ANSI_ARGS_((Tcl_Interp *interp,
+ 	    int         intResult,
+ 	    char       *checkCmd));
+     void (*setupSigInt) _ANSI_ARGS_((void));
+     void (*setAppSignalErrorHandler) _ANSI_ARGS_((
+ 	    TclX_AppSignalErrorHandler errorFunc,
+ 	    ClientData                 clientData));
+     void (*setAppInfo) _ANSI_ARGS_((int   defaultValues,
+ 	    char *appName,
+ 	    char *appLongName,
+ 	    char *appVersion,
+ 	    int   appPatchlevel));
+     void (*shellExit) _ANSI_ARGS_((Tcl_Interp *interp,
+ 	    int         exitCode));
+ } TclX_StubTable;
+ 
+ 
+ #ifdef TCLX_USE_STUBS
+ 
+ extern TclX_StubTable *tclxStubTable;
+ #define TclX_Required(interp, version, exact) \
+ 		((Tcl_FakeInterp*) (interp))->stub->pkgRequire(interp, \
+ 		"Tclx", version, exact, (ClientData *) &tclxStubTable)
+ #define TclXRuntimeInit(interp, which, defaultLib, version) \
+ 	(tclxStubTable->runtimeInit(interp, which, defaultLib, version))
+ #define TclX_AsyncCommandLoop(interp, options, endCommand, prompt1, prompt2) \
+ 	(tclxStubTable->asyncCommandLoop(interp, options, endCommand, \
+ 		prompt1, prompt2))
+ #define TclX_ErrorExit \
+ 	(tclxStubTable->errorExit)
+ #define TclX_Eval(interp, options, cmd) \
+ 	(tclxStubTable->eval(interp, options, cmd))
+ #define TclX_EvalRCFile(interp) \
+ 	(tclxStubTable->evalRCFile(interp))
+ #define TclX_PrintResult(interp, intResult, checkCmd) \
+ 	(tclxStubTable->printResult(interp, intResult, checkCmd))
+ #define TclX_SetupSigInt() \
+ 	(tclxStubTable->setupSigInt())
+ #define TclX_SetAppSignalErrorHandler(errorFunc, clientData) \
+ 	(tclxStubTable->setAppSignalErrorHandler(errorFunc, clientData))
+ #define TclX_SetAppInfo(defaultValues, appName, appLongName, appVersion, appPatchLevel) \
+ 	(tclxStubTable->setAppInfo(defaultValues, appName, appLongName, \
+ 		appVersion, appPatchLevel))
+ #define TclX_ShellExit(interp, exitCode) \
+ 	(tclxStubTable->shellExit(interp, exitCode))
+ 
+ #endif /* TCLX_USE_STUBS */
+ 
  /*
   * Tk with TclX initialization.
   */
*** tcl/generic/tclXinit.c.orig	Sun Nov 15 11:09:50 1998
--- tcl/generic/tclXinit.c	Mon Nov 23 00:17:07 1998
***************
*** 18,23 ****
--- 18,30 ----
  
  #include "tclExtdInt.h"
  
+ #ifdef TCL_USE_STUBS
+ Tcl_StubTable *tclStubTable;
+ #else
+ #define Tcl_Required(a,b,c) Tcl_PkgRequire(a,"Tcl",b,c)
+ #define Tcl_PkgProvide2(a,b,c,d) Tcl_PkgProvide(a,b,c)
+ #endif
+ 
  /*
   * Tcl procedure to search for an init for either TclX or TkX startup file.  
   * The algorithm is, with $w being either tcl or tk:
***************
*** 308,321 ****
   *   So setup common to both normal and safe initialization.
   *-----------------------------------------------------------------------------
   */
  static int
  InitSetup (interp)
      Tcl_Interp *interp;
  {
!     if (Tcl_PkgRequire (interp, "Tcl", TCL_VERSION, 1) == NULL) {
  	return TCL_ERROR;
      }
!     if (Tcl_PkgProvide (interp, "Tclx", TCLX_VERSION) != TCL_OK) {
  	return TCL_ERROR;
      }
  
--- 315,344 ----
   *   So setup common to both normal and safe initialization.
   *-----------------------------------------------------------------------------
   */
+ 
+ #ifdef TCL_USE_STUBS
+ static TclX_StubTable stubTable = {
+     TclXRuntimeInit,
+     TclX_AsyncCommandLoop,
+     TclX_ErrorExit,
+     TclX_Eval,
+     TclX_EvalRCFile,
+     TclX_PrintResult,
+     TclX_SetupSigInt,
+     TclX_SetAppSignalErrorHandler,
+     TclX_SetAppInfo,
+     TclX_ShellExit
+ };
+ #endif
+ 
  static int
  InitSetup (interp)
      Tcl_Interp *interp;
  {
!     if (Tcl_Required(interp, TCL_VERSION, 1) == NULL) {
  	return TCL_ERROR;
      }
!     if (Tcl_PkgProvide2(interp, "Tclx", TCLX_VERSION, &stubTable) != TCL_OK) {
  	return TCL_ERROR;
      }
  
*** tcl/generic/tclXlib.c.orig	Mon Nov 23 00:17:48 1998
--- tcl/generic/tclXlib.c	Mon Nov 23 00:19:13 1998
***************
*** 165,171 ****
      int result;
      off_t fileSize;
      Tcl_DString pathBuf, cmdBuf;
!     char *oldScriptFile, *buf;
      Tcl_Channel channel = NULL;
  
      Tcl_ResetResult (interp);
--- 165,172 ----
      int result;
      off_t fileSize;
      Tcl_DString pathBuf, cmdBuf;
!     CONST char *oldScriptFile;
!     char *buf;
      Tcl_Channel channel = NULL;
  
      Tcl_ResetResult (interp);
***************
*** 210,216 ****
      oldScriptFile = iPtr->scriptFile;
      iPtr->scriptFile = fileName;
      result = Tcl_GlobalEval (interp, cmdBuf.string);
!     iPtr->scriptFile = oldScriptFile;
      
      Tcl_DStringFree (&pathBuf);
      Tcl_DStringFree (&cmdBuf);
--- 211,217 ----
      oldScriptFile = iPtr->scriptFile;
      iPtr->scriptFile = fileName;
      result = Tcl_GlobalEval (interp, cmdBuf.string);
!     iPtr->scriptFile = (char *) oldScriptFile;
      
      Tcl_DStringFree (&pathBuf);
      Tcl_DStringFree (&cmdBuf);
*** tk/generic/tkXinit.c.orig	Sun Nov 15 22:09:15 1998
--- tk/generic/tkXinit.c	Mon Nov 23 00:38:45 1998
***************
*** 20,25 ****
--- 20,44 ----
  #include "tclExtdInt.h"
  #include "tk.h"
  
+ #ifdef TCL_USE_STUBS
+ Tcl_StubTable *tclStubTable;
+ #else
+ #define Tcl_Required(a,b,c) Tcl_PkgRequire(a,"Tcl",b,c)
+ #endif
+ 
+ #ifdef TCLX_USE_STUBS
+ TclX_StubTable *tclxStubTable;
+ #else
+ #define TclX_Required(a,b,c) Tcl_PkgRequire(a,"Tclx",b,c)
+ #endif
+ 
+ #ifdef TK_USE_STUBS
+ Tk_StubTable *tkStubTable;
+ #else
+ #define Tk_Required(a,b,c) Tcl_PkgRequire(a,"Tk",b,c)
+ #endif
+ 
+ 
  
  /*-----------------------------------------------------------------------------
   * InitSetup --
***************
*** 36,45 ****
  InitSetup (interp)
      Tcl_Interp  *interp;
  {
!     if (Tcl_PkgRequire (interp, "Tk", TK_VERSION, 1) == NULL) {
   	return TCL_ERROR;
      }
!     if (Tcl_PkgRequire (interp, "Tclx", TCLX_VERSION, 1) == NULL) {
   	return TCL_ERROR;
      }
      return Tcl_PkgProvide (interp, "Tkx", TKX_VERSION);
--- 55,67 ----
  InitSetup (interp)
      Tcl_Interp  *interp;
  {
!     if (Tcl_Required(interp, TCL_VERSION, 1) == NULL) {
   	return TCL_ERROR;
      }
!     if (Tk_Required(interp, TK_VERSION, 1) == NULL) {
!  	return TCL_ERROR;
!     }
!     if (TclX_Required(interp, TCLX_VERSION, 1) == NULL) {
   	return TCL_ERROR;
      }
      return Tcl_PkgProvide (interp, "Tkx", TKX_VERSION);
