wok rev 20387

Add tcl2c
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 23 11:56:52 2018 +0200 (2018-06-23)
parents 29ddbebcc777
children 32c2394f606d
files tcl2c/receipt tcl2c/stuff/tcl2c.u
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tcl2c/receipt	Sat Jun 23 11:56:52 2018 +0200
     1.3 @@ -0,0 +1,28 @@
     1.4 +# SliTaz package receipt v2.
     1.5 +
     1.6 +PACKAGE="tcl2c"
     1.7 +VERSION="2016.4"
     1.8 +CATEGORY="development"
     1.9 +SHORT_DESC="Create a C file from Tcl file for C compiler"
    1.10 +MAINTAINER="al.bobylev@gmail.com"
    1.11 +LICENSE="GPL2"
    1.12 +WEB_SITE="http://tcl2c.sourceforge.net/"
    1.13 +
    1.14 +TARBALL="$PACKAGE.$VERSION.zip"
    1.15 +WGET_URL="$SF_MIRROR/tcl2c/$TARBALL"
    1.16 +
    1.17 +DEPENDS="tcl"
    1.18 +BUILD_DEPENDS="tcl-dev"
    1.19 +
    1.20 +compile_rules() {
    1.21 +	cd generic
    1.22 +	sed -i 's|libtcl8\.5\.so|-ltcl8.6|' makefile
    1.23 +	patch -p1 < $stuff/tcl2c.u
    1.24 +
    1.25 +	make linux &&
    1.26 +	install -Dm755 tcl2c $install/usr/bin/tcl2c
    1.27 +}
    1.28 +
    1.29 +genpkg_rules() {
    1.30 +	cp -a $install/usr $fs
    1.31 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tcl2c/stuff/tcl2c.u	Sat Jun 23 11:56:52 2018 +0200
     2.3 @@ -0,0 +1,932 @@
     2.4 +http://web.tiscali.it/pas80/tklauncher.htm
     2.5 +http://web.tiscali.it/pas80/tcl2c.tar.gz
     2.6 +@@ -1,26 +1,10 @@
     2.7 +-//tcl2c @ 1997-2016 (04/2016) - Under G.P.L. License
     2.8 +-//Based on tcl2c.c written by: Jan Nijtmans
     2.9 +-//Cyril BARBATO 
    2.10 +-//tcl2c.sourceforge.net
    2.11 +-//cyril.barbato@gmx.com
    2.12 ++#include <tcl.h>
    2.13 + 
    2.14 +-#include "tcl.h"
    2.15 +-#include <stdio.h>
    2.16 +-#include <stdlib.h>
    2.17 +-
    2.18 +-#ifdef _APPLICATION_IS_ROOT_PATH_
    2.19 +-#include <string.h>
    2.20 +-#include <limits.h>
    2.21 +-#include <unistd.h>
    2.22 +-#endif
    2.23 +-
    2.24 + #ifdef __cplusplus
    2.25 + extern C {
    2.26 + #endif
    2.27 + 
    2.28 + extern void exit _ANSI_ARGS_((int status));
    2.29 +-extern int isupper _ANSI_ARGS_((int ch));
    2.30 +-extern int tolower _ANSI_ARGS_((int ch));
    2.31 + 
    2.32 + #ifdef __cplusplus
    2.33 + }
    2.34 +@@ -44,55 +28,48 @@
    2.35 + 
    2.36 + static tableitem table[] = {
    2.37 + {"Tcl"  ,"-tcl"  ,  1},
    2.38 +-{"Tk"   ,"-tk"   ,  3},
    2.39 +-{"Tclx" ,"-tclx" ,  5},
    2.40 +-{"Itcl" ,"-itcl" ,  9},
    2.41 +-{"Otcl" ,"-otcl" , 17},	/* not tested yet */
    2.42 +-{"Pvm"  ,"-pvm"  , 33},
    2.43 +-{"Tkx"  ,"-tkx"  , 71},
    2.44 +-{"Itk"  ,"-itk" ,  139},
    2.45 +-{"Iwidgets" ,"-iwidgets" ,  395},
    2.46 +-{"Img"  ,"-img"  ,515},
    2.47 +-{"Tix"  ,"-tix"  ,1027}, /* not tested yet */
    2.48 +-{"Blt"  ,"-blt"  ,2051}, /* not tested yet */
    2.49 +-{"Vtcl" ,"-vtcl" ,4103}, /* not tested yet */
    2.50 ++{"Tclx" ,"-tclx" ,  3},
    2.51 ++{"Itcl" ,"-itcl" ,  5},
    2.52 ++{"Otcl" ,"-otcl" ,  9},	/* not tested yet */
    2.53 ++{"Pvm"  ,"-pvm"  , 17},
    2.54 ++{"Tk"   ,"-tk"   , 33},
    2.55 ++{"Tkx"  ,"-tkx"  , 99},
    2.56 ++{"Itk"  ,"-itk" ,  165},
    2.57 ++{"Iwidgets" ,"-iwidgets" ,  421},
    2.58 ++{"Img"  ,"-img"  ,545},
    2.59 ++{"Tix"  ,"-tix"  ,1057},  /* not tested yet */
    2.60 ++{"Blt"  ,"-blt"  ,2081}, /* not tested yet */
    2.61 ++{"Vtcl" ,"-vtcl" ,4261}, /* not tested yet */
    2.62 + };
    2.63 + 
    2.64 +-static char verbose[] = "\n\
    2.65 ++static char *verbose = "\n\
    2.66 + *************************** tcl2c ********************************\n\
    2.67 +-Based on tcl2c.c written by: Jan Nijtmans\n\
    2.68 +-            CMG (Computer Management Group) Arnhem B.V.\n\
    2.69 +-	    email: Jan.Nijtmans@wxs.nl (private)\n\
    2.70 +-	           Jan.Nijtmans@cmg.nl (work)\n\
    2.71 +-	    url:   http://home.wxs.nl/~nijtmans/\n\n\
    2.72 +-    new options for gcc by:  Cyril Barbato (cyril.barbato@gmx.com)\n\
    2.73 +-            -D__MALLOC__ : for using malloc()\n\
    2.74 +-            -D__LIBPATH__=\"your lib\" : change tcl lib path\n\
    2.75 +-            -D_APPLICATION_IS_ROOT_PATH_ : for application is root path\n\\n\
    2.76 +-			-D_CONSOLEWOZHIDE_ : Hide windows console\n\\n\
    2.77 +-	new, add 2 tcl commands for windows console :\n\
    2.78 +-			_tcl2c_consoleWOZHide for Hide windows console\n\
    2.79 +-			_tcl2c_consoleWOZShow for Show windows console\n\\n\
    2.80 +-	url :   http://tcl2c.sourceforge.net/\n\n\
    2.81 +-	usage:	tcl2c -o file source1 source2 ... ?options?\n\
    2.82 ++written by: Jan Nijtmans\n\
    2.83 ++            NICI (Nijmegen Institute of Cognition and Information)\n\
    2.84 ++	    email: nijtmans@nici.kun.nl\n\
    2.85 ++	    url:   http://www.cogsci.kun.nl/~nijtmans/\n\n\
    2.86 ++usage:	tcl2c -o file source1 source2 ... ?options?\n\
    2.87 + 			tcl2c -help\n\
    2.88 + ";
    2.89 + 
    2.90 +-static char help[] = "\n\
    2.91 ++static char *help = "\n\
    2.92 + available options:\n\
    2.93 +         -a              use character array instead of string for script\n\
    2.94 +         -n script_name  name of script variable\n\
    2.95 +         -o filename	output file (default is stdout)\n\
    2.96 + 	-tcl		use Tcl\n\
    2.97 + 	-tclx		use Tclx\n\
    2.98 ++	-itcl		use Itcl\n\
    2.99 + 	-otcl		use Otcl (not tested yet)\n\
   2.100 + 	-pvm		use tkPvm\n\
   2.101 + 	-tk		use Tk\n\
   2.102 +-	-tkx		use Tkx (not really useful)\n\
   2.103 +-	-img		use Img\n\
   2.104 ++	-tkx		use Tkx (not really usefull)\n\
   2.105 ++	-itk		use Itk\n\
   2.106 ++	-iwidgets	use Iwidgets\n\
   2.107 + 	-tix		use Tix (not tested yet)\n\
   2.108 + 	-blt		use Blt (not tested yet)\n\
   2.109 + 	-vtcl		use Vtcl (not tested yet)\n\
   2.110 ++	-index		convert tclIndex files\n\n\
   2.111 + Other command line arguments are assumed to be tcl script-files. It is \n\
   2.112 + possible to include C-files (with the extension .c), which are already\n\
   2.113 + converted tcl-scripts. These are included using the \"#include\".\n\n\
   2.114 +@@ -101,7 +78,7 @@
   2.115 + 
   2.116 + static char *part1 = "\n\
   2.117 + /* This file is created by the \"tcl2c\" utility, which is included in\n\
   2.118 +- * most \"plus\"-patches (e.g. for Tcl8.6). Standalone\n\
   2.119 ++ * most \"plus\"-patches (e.g. for Tcl7.6 and Tcl8.0). Standalone\n\
   2.120 +  * executables can be made by providing alternative initialization\n\
   2.121 +  * functions which don't read files any more. Sometimes, small\n\
   2.122 +  * adaptations to the original libraries are needed to get the\n\
   2.123 +@@ -111,68 +88,29 @@
   2.124 +  * easyly extend the \"tcl2c\" utility to your own requirements.\n\
   2.125 +  *\n\
   2.126 +  *	Jan Nijtmans\n\
   2.127 +- *	CMG (Computer Management Group) Arnhem B.V.\n\
   2.128 +- *	email: Jan.Nijtmans@wxs.nl (private)\n\
   2.129 +- *	       Jan.Nijtmans@cmg.nl (work)\n\
   2.130 +- *	url:   http://home.wxs.nl/~nijtmans/\n\
   2.131 +- *\n\
   2.132 +- *new options for gcc by:  Cyril Barbato (cyril.barbato@gmx.com)\n\
   2.133 +- *          -D__MALLOC__ : for using malloc()\n\
   2.134 +- *          -D__LIBPATH__=\"your lib\" : change tcl lib path\n\
   2.135 +- *			-D_APPLICATION_IS_ROOT_PATH_ : for application is root path\n\\n\
   2.136 +-			-D_CONSOLEWOZHIDE_ : Hide windows console\n\
   2.137 +- *\n\
   2.138 +-	new, add 2 tcl commands for windows console :\n\
   2.139 +-			_tcl2c_consoleWOZHide for Hide windows console\n\
   2.140 +-			_tcl2c_consoleWOZShow for Show windows console\n\\n\
   2.141 +- *\n\
   2.142 +- *	    url:   http://tcl2c.sourceforge.net/\n\
   2.143 +- *\n\
   2.144 +- * usage:	tcl2c -o file source1 source2 ... ?options?\n\
   2.145 +- *			tcl2c -help\n\
   2.146 ++ *	NICI (Nijmegen Institute of Cognition and Information)\n\
   2.147 ++ *	email: nijtmans@nici.kun.nl\n\
   2.148 ++ *	url:   http://www.cogsci.kun.nl/~nijtmans/\n\
   2.149 +  */\n\
   2.150 ++#define USE_INTERP_RESULT 1\n\
   2.151 + #include \"tcl.h\"\n\
   2.152 +-#ifdef _MACOSX_APP_\n\
   2.153 +-#import <crt_externs.h>\n\
   2.154 +-#endif\n\
   2.155 +-#ifdef __WIN32__\n\
   2.156 +-#define _WIN32_WINNT 0x0500\n\
   2.157 +-#define WIN32_LEAN_AND_MEAN\n\
   2.158 +-#include <windows.h>\n\
   2.159 +-#undef WIN32_LEAN_AND_MEAN\n\
   2.160 +-#ifndef __MALLOC_H__\n\
   2.161 +-#include <malloc.h>\n\
   2.162 +-#endif\n\
   2.163 +-#include <locale.h>\n\
   2.164 +-#ifndef __LIBPATH__\n\
   2.165 +-#define __LIBPATH__ \"lib\"\n\
   2.166 +-#endif\n\
   2.167 +-#include <unistd.h>\n\
   2.168 +-#ifdef _APPLICATION_IS_ROOT_PATH_\n\
   2.169 +-#include <string.h>\n\
   2.170 +-#include <limits.h>\n\
   2.171 +-#include <unistd.h>\n\
   2.172 +-#endif\n\
   2.173 + \n\
   2.174 +-static int setargv _ANSI_ARGS_((char ***argvPtr));\n\
   2.175 +-static void TclshPanic _ANSI_ARGS_(TCL_VARARGS(char *,format));\n\
   2.176 +-extern void TclWinInit(HINSTANCE instance);\n\
   2.177 +-extern int  Registry_Init _ANSI_ARGS_((Tcl_Interp *interp));\n\
   2.178 +-\n\
   2.179 +-#endif\n\
   2.180 +-\n\
   2.181 + /*\n\
   2.182 +  * Defines to replace the standard Xxx_Init calls to Xxx_InitStandAlone.\n\
   2.183 +  * If you don't have this function, just delete the corresponding\n\
   2.184 +  * define such that the normal initialization function is used.\n\
   2.185 +- * If no Xxx_SafeInit function exists, use NULL pointers instead\n\
   2.186 +- * by commenting out the appropriate lines below.\n\
   2.187 ++ * Similar: If SafeInit functions exists, you can use these\n\
   2.188 ++ * by commenting out the corresponding lines below.\n\
   2.189 +  */\n\
   2.190 + \n\
   2.191 +-#if defined(TCL_ACTIVE) && !defined(SHARED)\n\
   2.192 ++#ifdef TCL_ACTIVE\n\
   2.193 + ";
   2.194 + 
   2.195 +-static char *part2 = "\n\
   2.196 ++static char *part2 = "#endif\n\
   2.197 ++\n\
   2.198 ++";
   2.199 ++
   2.200 ++static char *part3 = "\n\
   2.201 + /*\n\
   2.202 +  * Prototypes of all initialization functions and the free() function.\n\
   2.203 +  * So, only \"tcl.h\" needs to be included now.\n\
   2.204 +@@ -182,27 +120,8 @@
   2.205 + extern \"C\" {\n\
   2.206 + #endif\n\
   2.207 + \n\
   2.208 +-#ifndef USE_TCLALLOC\n\
   2.209 +-#   define USE_TCLALLOC 0\n\
   2.210 +-#endif\n\
   2.211 +-#if USE_TCLALLOC == 0\n\
   2.212 + extern void free _ANSI_ARGS_((void *));\n\
   2.213 +-extern VOID *malloc _ANSI_ARGS_((int));\n\
   2.214 +-#endif\n\
   2.215 +-extern int  Tcl_Init _ANSI_ARGS_((Tcl_Interp *interp));\n\
   2.216 +-\n\
   2.217 + ";
   2.218 +-
   2.219 +-static char *part3 = "\n\
   2.220 +-extern void Tk_MainLoop _ANSI_ARGS_((void));\n\
   2.221 +-#define HAS_TK\n\
   2.222 +-#ifdef __WIN32__\n\
   2.223 +-extern void TkWinXInit _ANSI_ARGS_((HINSTANCE hinstance));\n\
   2.224 +-extern void TkWinXCleanup _ANSI_ARGS_((HINSTANCE hinstance));\n\
   2.225 +-#endif\n\
   2.226 +-\n\
   2.227 +-";
   2.228 +-
   2.229 + static char *part4 = "\n\
   2.230 + #ifdef __cplusplus\n\
   2.231 + }\n\
   2.232 +@@ -213,64 +132,10 @@
   2.233 +  * It will be executed in tclAppInit() after the other initializations.\n\
   2.234 +  */\n\
   2.235 + \n\
   2.236 +-";
   2.237 +-
   2.238 +-static char *part4a = "\
   2.239 +-static char *lineformat = \"%%.0s%%d\";\n\
   2.240 + static int line = (__LINE__ + 1);\n\
   2.241 + ";
   2.242 + 
   2.243 +-static char *part4b = "\
   2.244 +-static char *lineformat = \"%%s_line%%d\";\n\
   2.245 +-static int line = 0;\n\
   2.246 +-";
   2.247 +-
   2.248 + static char *part5 = "\
   2.249 +-#ifdef _APPLICATION_IS_ROOT_PATH_\n\
   2.250 +-#define PATH_MAX 1024\n\
   2.251 +-char abs_exe_path[PATH_MAX];\n\
   2.252 +-char *\n\
   2.253 +-#ifdef _USING_PROTOTYPES_\n\
   2.254 +-app_GetPath(\n\
   2.255 +-	int argc,\n\
   2.256 +-	char *argv[])\n\
   2.257 +-#else\n\
   2.258 +-app_GetPath(argc, argv)\n\
   2.259 +-	int argc;\n\
   2.260 +-	char *argv[];\n\
   2.261 +-#endif\n\
   2.262 +-{\n\
   2.263 +-  char path_save[PATH_MAX];\n\
   2.264 +-  char *p;\n\
   2.265 +-  if(!(p = strrchr(argv[0], '/')))\n\
   2.266 +-    getcwd(abs_exe_path, sizeof(abs_exe_path));\n\
   2.267 +-  else\n\
   2.268 +-  {\n\
   2.269 +-    *p = '\\0';\n\
   2.270 +-    getcwd(path_save, sizeof(path_save));\n\
   2.271 +-    chdir(argv[0]);\n\
   2.272 +-    getcwd(abs_exe_path, sizeof(abs_exe_path));\n\
   2.273 +-    chdir(path_save);\n\
   2.274 +-  }\n\
   2.275 +-  //printf(\"Absolute path to executable is: %s\\n\", abs_exe_path);\n\
   2.276 +-  return abs_exe_path;\n\
   2.277 +-};\n\
   2.278 +-#endif\n\
   2.279 +-#ifdef __WIN32__\n\
   2.280 +-HWND hConsoleWnd=NULL;\n\
   2.281 +-int _tcl2c_consoleWOZHideCmd(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {\n\
   2.282 +-	if (hConsoleWnd==NULL) {hConsoleWnd = GetConsoleWindow();};\n\
   2.283 +-	if (hConsoleWnd==NULL) {return TCL_OK;};\n\
   2.284 +-	SetWindowPos(hConsoleWnd,HWND_NOTOPMOST,0,0,320,240,SWP_HIDEWINDOW);\n\
   2.285 +-	return TCL_OK;\n\
   2.286 +-};\n\
   2.287 +-int _tcl2c_consoleWOZShowCmd(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {\n\
   2.288 +-	if (hConsoleWnd==NULL) {hConsoleWnd = GetConsoleWindow();};\n\
   2.289 +-	if (hConsoleWnd==NULL) {return TCL_OK;};\n\
   2.290 +-	ShowWindow(hConsoleWnd,SW_SHOW);\n\
   2.291 +-	return TCL_OK;\n\
   2.292 +-};\n\
   2.293 +-#endif\n\
   2.294 + /*\n\
   2.295 +  *----------------------------------------------------------------------\n\
   2.296 +  *\n\
   2.297 +@@ -287,18 +152,7 @@
   2.298 +  *----------------------------------------------------------------------\n\
   2.299 +  */\n\
   2.300 + \n\
   2.301 +-#if defined(__WIN32__) && defined(HAS_TK)\n\
   2.302 +-int APIENTRY\n\
   2.303 +-WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,\n\
   2.304 +-    LPSTR lpszCmdLine, int nCmdShow)\n\
   2.305 +-{\n\
   2.306 +-    char **argv;\n\
   2.307 +-    int argc;\n\
   2.308 +-#else\n\
   2.309 +-";
   2.310 +-//MAIN Tcl App
   2.311 +-static char *part5a = "\
   2.312 +-int\n\
   2.313 ++void\n\
   2.314 + #ifdef _USING_PROTOTYPES_\n\
   2.315 + main (int    argc,		/* Number of command-line arguments. */\n\
   2.316 +       char **argv)		/* Values of command-line arguments. */\n\
   2.317 +@@ -308,78 +162,12 @@
   2.318 +     char **argv;		/* Values of command-line arguments. */\n\
   2.319 + #endif\n\
   2.320 + {\n\
   2.321 +-#endif\n\
   2.322 +     Tcl_Interp *interp;\n\
   2.323 +     char **p = %s;\n\
   2.324 +-    char *q, buffer[16];\n\
   2.325 ++    char *q, buffer[10];\n\
   2.326 +     Tcl_DString data;\n\
   2.327 +     Tcl_Channel inChannel, outChannel, errChannel;\n\
   2.328 + \n\
   2.329 +-#ifdef __LIBPATH__\n\
   2.330 +-	////char _cwd[1024];\n\
   2.331 +-	char _libpath[2048];\n\
   2.332 +-#endif\n\
   2.333 +-#ifdef __WIN32__\n\
   2.334 +-    char argv0[128];\n\
   2.335 +-#endif\n\
   2.336 +-#ifdef _MACOSX_APP_\n\
   2.337 +-argc = *_NSGetArgc();\n\
   2.338 +-char *progname = *_NSGetProgname();\n\
   2.339 +-char **envp = *_NSGetEnviron();\n\
   2.340 +-argv = *_NSGetArgv();\n\
   2.341 +-#endif\n\
   2.342 +-#ifdef _APPLICATION_IS_ROOT_PATH_\n\
   2.343 +-	/* GOTO APPLICATION PATH FOR MAC OS*/\n\
   2.344 +-	chdir(app_GetPath(argc, argv));\n\
   2.345 +-#endif\n\
   2.346 +-#ifdef __WIN32__\n\
   2.347 +-#ifdef _CONSOLEWOZHIDE_\n\
   2.348 +-_tcl2c_consoleWOZHideCmd(NULL, NULL, NULL, (char **) NULL);\n\
   2.349 +-#endif\n\
   2.350 +-#if defined(TCL_ACTIVE) && !defined(SHARED) && defined(HAS_TK)\n\
   2.351 +-    TclWinInit(hInstance);\n\
   2.352 +-    TkWinXInit(hInstance);\n\
   2.353 +-    Tcl_CreateExitHandler((Tcl_ExitProc *) TkWinXCleanup, (ClientData) hInstance);\n\
   2.354 +-#endif\n\
   2.355 +-\n\
   2.356 +-    Tcl_SetPanicProc(TclshPanic);\n\
   2.357 +-\n";
   2.358 +-
   2.359 +-static char *part5b = "\n\
   2.360 +-    /*\n\
   2.361 +-     * Set up the default locale to be standard \"C\" locale so parsing\n\
   2.362 +-     * is performed correctly.\n\
   2.363 +-     */\n\
   2.364 +-\n\
   2.365 +-    setlocale(LC_ALL, \"C\");\n\
   2.366 +-\n\
   2.367 +-    /*\n\
   2.368 +-     * Increase the application queue size from default value of 8.\n\
   2.369 +-     * At the default value, cross application SendMessage of WM_KILLFOCUS\n\
   2.370 +-     * will fail because the handler will not be able to do a PostMessage!\n\
   2.371 +-     * This is only needed for Windows 3.x, since NT dynamically expands\n\
   2.372 +-     * the queue.\n\
   2.373 +-     */\n\
   2.374 +-    SetMessageQueue(64);\n\
   2.375 +-\n\
   2.376 +-    argc = setargv(&argv);\n\
   2.377 +-\n\
   2.378 +-    /*\n\
   2.379 +-     * Replace argv[0] with full pathname of executable, and forward\n\
   2.380 +-     * slashes substituted for backslashes.\n\
   2.381 +-     */\n\
   2.382 +-\n\
   2.383 +-";
   2.384 +-static char *part5c = "\
   2.385 +-    GetModuleFileName(NULL, argv0, sizeof(argv0));\n\
   2.386 +-    argv[0] = argv0;\n\
   2.387 +-    for (q = argv0; *q != '\\0'; q++) {\n\
   2.388 +-	if (*q == '\\\\') {\n\
   2.389 +-	    *q = '/';\n\
   2.390 +-	}\n\
   2.391 +-    }\n\
   2.392 +-\n\
   2.393 +-#endif\n\
   2.394 +     Tcl_FindExecutable(argv[0]);\n\
   2.395 +     interp = Tcl_CreateInterp();\n\
   2.396 + \n\
   2.397 +@@ -391,32 +179,8 @@
   2.398 +     Tcl_SetVar(interp, \"argv0\", argv[0],TCL_GLOBAL_ONLY);\n\
   2.399 +     Tcl_SetVar(interp, \"tcl_interactive\",\"0\", TCL_GLOBAL_ONLY);\n\
   2.400 + \n\
   2.401 +-#ifdef __LIBPATH__\n\
   2.402 +-	////chdir(__LIBPATH__);\n\
   2.403 +-	////getcwd(_cwd,sizeof(_cwd));\n\
   2.404 +-	////printf(\"libpath:%%s\\n\", _cwd);\n\
   2.405 +-	sprintf(_libpath, \"set env(PWD) [pwd]\");\n\
   2.406 +-	Tcl_Eval(interp, _libpath);\n\
   2.407 +-	sprintf(_libpath, \"%%s/%%s/tcl%%s\", Tcl_GetVar2(interp, \"env\", \"PWD\", TCL_GLOBAL_ONLY),__LIBPATH__, Tcl_GetVar(interp,\"tcl_version\", TCL_GLOBAL_ONLY));\n\
   2.408 +-	Tcl_SetVar2(interp, \"env\", \"TCL_LIBRARY\", _libpath, TCL_GLOBAL_ONLY);\n\
   2.409 +-	Tcl_SetVar2(interp, \"env\", \"TK_LIBRARY\", _libpath, TCL_GLOBAL_ONLY);\n\
   2.410 +-	Tcl_SetVar(interp, \"auto_path\", _libpath, TCL_GLOBAL_ONLY);\n\
   2.411 +-	Tcl_SetVar(interp, \"tcl_libPath\", _libpath, TCL_GLOBAL_ONLY);\n\
   2.412 +-#endif\n\
   2.413 +-\n\
   2.414 +-if (Tcl_Init(interp) != TCL_OK) {\n\
   2.415 +-        goto error;\n\
   2.416 +-    }\n\
   2.417 +-\n\
   2.418 +-#ifdef __WIN32__\n\
   2.419 +-	Tcl_StaticPackage((Tcl_Interp *) NULL, \"registry\", Registry_Init,\n\
   2.420 +-	    (Tcl_PackageInitProc *) NULL);\n\n\
   2.421 +-	//Create commands _tcl2c_consoleWOZHide and _tcl2c_consoleWOZShow\n\
   2.422 +-	Tcl_CreateCommand(interp, \"_tcl2c_consoleWOZHide\", _tcl2c_consoleWOZHideCmd, NULL, NULL);\n\
   2.423 +-	Tcl_CreateCommand(interp, \"_tcl2c_consoleWOZShow\", _tcl2c_consoleWOZShowCmd, NULL, NULL);\n\n\
   2.424 +-#endif\n\
   2.425 +-\n\
   2.426 + ";
   2.427 ++
   2.428 + static char *part6 = "\n\
   2.429 +     /*\n\
   2.430 +      * Execute the script that is compiled in.\n\
   2.431 +@@ -436,17 +200,27 @@
   2.432 + 		}\n\
   2.433 + 		line++;\n\
   2.434 + 	    }\n\
   2.435 +-	    sprintf(buffer,lineformat,\"%s\",line);\n\
   2.436 +-		printf(\"ERROR : (line %%s) : %%s\\n\", buffer, Tcl_GetVar(interp, \"errorInfo\", TCL_GLOBAL_ONLY));\n\
   2.437 ++	    sprintf(buffer,\"%%d\",line);\n\
   2.438 ++	    Tcl_AddErrorInfo(interp,\"\\n	( Error in file: \\\"\");\n\
   2.439 ++	    Tcl_AddErrorInfo(interp,__FILE__);\n\
   2.440 ++	    Tcl_AddErrorInfo(interp,\"\\\", line: \");\n\
   2.441 ++	    Tcl_AddErrorInfo(interp,buffer);\n\
   2.442 ++	    Tcl_AddErrorInfo(interp,\")\");\n\
   2.443 ++	    errChannel = Tcl_GetStdChannel(TCL_STDERR);\n\
   2.444 ++	    if (errChannel) {\n\
   2.445 ++		Tcl_Write(errChannel,\n\
   2.446 ++			Tcl_GetVar(interp, \"errorInfo\", TCL_GLOBAL_ONLY), -1);\n\
   2.447 ++		Tcl_Write(errChannel, \"\\n\", 1);\n\
   2.448 ++	    }\n\
   2.449 ++	    sprintf(buffer, \"exit %%d\", 1);\n\
   2.450 + 	    Tcl_Eval(interp, buffer);\n\
   2.451 +-	}};\n\
   2.452 +-";
   2.453 +-
   2.454 +-static char *part6a = "\
   2.455 +-    Tk_MainLoop();\n\
   2.456 +-";
   2.457 +-
   2.458 +-static char *part6b = "\
   2.459 ++	}\n\
   2.460 ++    }\n\
   2.461 ++    Tcl_DStringFree(&data);\n\
   2.462 ++\n\
   2.463 ++    while (Tcl_DoOneEvent(0)) {\n\
   2.464 ++	/* empty loop body */ ;\n\
   2.465 ++    }\n\
   2.466 +     sprintf(buffer, \"exit %%d\", 0);\n\
   2.467 +     Tcl_Eval(interp, buffer);\n\
   2.468 + \n\
   2.469 +@@ -455,185 +229,20 @@
   2.470 +     if (errChannel) {\n\
   2.471 + 	Tcl_Write(errChannel,\n\
   2.472 + 		\"application-specific initialization failed: \", -1);\n\
   2.473 +-	Tcl_Write(errChannel, Tcl_GetStringResult(interp), -1);\n\
   2.474 ++	Tcl_Write(errChannel, interp->result, -1);\n\
   2.475 + 	Tcl_Write(errChannel, \"\\n\", 1);\n\
   2.476 +     }\n\
   2.477 +-#ifdef __WIN32__\n\
   2.478 +-    TclshPanic(Tcl_GetStringResult(interp));\n\
   2.479 +-#endif\n\
   2.480 +     sprintf(buffer, \"exit %%d\", 1);\n\
   2.481 +     Tcl_Eval(interp, buffer);\n\
   2.482 +-    return 0;\n\
   2.483 + }\n\
   2.484 +-\n\
   2.485 +-#ifdef __WIN32__\n\
   2.486 +-/*\n\
   2.487 +- *----------------------------------------------------------------------\n\
   2.488 +- *\n\
   2.489 +- * TclshPanic --\n\
   2.490 +- *\n\
   2.491 +- *	Display a message and exit.\n\
   2.492 +- *\n\
   2.493 +- * Results:\n\
   2.494 +- *	None.\n\
   2.495 +- *\n\
   2.496 +- * Side effects:\n\
   2.497 +- *	Exits the program.\n\
   2.498 +- *\n\
   2.499 +- *----------------------------------------------------------------------\n\
   2.500 +- */\n\
   2.501 +-\n\
   2.502 +-void\n\
   2.503 +-TclshPanic TCL_VARARGS_DEF(char *,arg1)\n\
   2.504 +-{\n\
   2.505 +-    va_list argList;\n\
   2.506 +-    char buf[1024];\n\
   2.507 +-    char *format;\n\
   2.508 +-\n\
   2.509 +-    format = TCL_VARARGS_START(char *,arg1,argList);\n\
   2.510 +-    vsprintf(buf, format, argList);\n\
   2.511 +-\n\
   2.512 +-    MessageBeep(MB_ICONEXCLAMATION);\n\
   2.513 +-    MessageBox(NULL, buf, \"Fatal Error in Tclsh\",\n\
   2.514 +-	    MB_ICONSTOP | MB_OK | MB_TASKMODAL | MB_SETFOREGROUND);\n\
   2.515 +-#ifdef _MSC_VER\n\
   2.516 +-    DebugBreak();\n\
   2.517 +-#endif\n\
   2.518 +-    ExitProcess(1);\n\
   2.519 +-}\n\
   2.520 + ";
   2.521 + 
   2.522 +-static char *part6c = "\
   2.523 +-\n\
   2.524 +-/*\n\
   2.525 +- *-------------------------------------------------------------------------\n\
   2.526 +- *\n\
   2.527 +- * setargv --\n\
   2.528 +- *\n\
   2.529 +- *	Parse the Windows command line string into argc/argv.  Done here\n\
   2.530 +- *	because we don't trust the builtin argument parser in crt0.  \n\
   2.531 +- *	Windows applications are responsible for breaking their command\n\
   2.532 +- *	line into arguments.\n\
   2.533 +- *\n\
   2.534 +- *	2N backslashes + quote -> N backslashes + begin quoted string\n\
   2.535 +- *	2N + 1 backslashes + quote -> literal\n\
   2.536 +- *	N backslashes + non-quote -> literal\n\
   2.537 +- *	quote + quote in a quoted string -> single quote\n\
   2.538 +- *	quote + quote not in quoted string -> empty string\n\
   2.539 +- *	quote -> begin quoted string\n\
   2.540 +- *\n\
   2.541 +- * Results:\n\
   2.542 +- *	returns the number of arguments and fill argvPtr with the\n\
   2.543 +- *	array of arguments.\n\
   2.544 +- *\n\
   2.545 +- * Side effects:\n\
   2.546 +- *	Memory allocated.\n\
   2.547 +- *\n\
   2.548 +- *--------------------------------------------------------------------------\n\
   2.549 +- */\n\
   2.550 +-\n\
   2.551 +-";
   2.552 +-
   2.553 +-static char *part6d = "\
   2.554 +-static int\n\
   2.555 +-setargv(argvPtr)\n\
   2.556 +-    char ***argvPtr;		/* Filled with argument strings (malloc'd). */\n\
   2.557 +-{\n\
   2.558 +-    char *cmdLine, *p, *arg, *argSpace;\n\
   2.559 +-    char **argv;\n\
   2.560 +-    int argc, size, inquote, copy, slashes;\n\
   2.561 +-\n\
   2.562 +-    cmdLine = GetCommandLine();\n\
   2.563 +-\n\
   2.564 +-    /*\n\
   2.565 +-     * Precompute an overly pessimistic guess at the number of arguments\n\
   2.566 +-     * in the command line by counting non-space spans.\n\
   2.567 +-     */\n\
   2.568 +-\n\
   2.569 +-    size = 2;\n\
   2.570 +-    for (p = cmdLine; *p != '\\0'; p++) {\n\
   2.571 +-	if (isspace(*p)) {\n\
   2.572 +-	    size++;\n\
   2.573 +-	    while (isspace(*p)) {\n\
   2.574 +-		p++;\n\
   2.575 +-	    }\n\
   2.576 +-	    if (*p == '\\0') {\n\
   2.577 +-		break;\n\
   2.578 +-	    }\n\
   2.579 +-	}\n\
   2.580 +-    }\n\
   2.581 +-    argSpace = (char *) ckalloc((unsigned) (size * sizeof(char *)\n\
   2.582 +-	    + strlen(cmdLine) + 1));\n\
   2.583 +-    argv = (char **) argSpace;\n\
   2.584 +-    argSpace += size * sizeof(char *);\n\
   2.585 +-    size--;\n\
   2.586 +-\n\
   2.587 +-    p = cmdLine;\n\
   2.588 +-    for (argc = 0; argc < size; argc++) {\n\
   2.589 +-	argv[argc] = arg = argSpace;\n\
   2.590 +-	while (isspace(*p)) {\n\
   2.591 +-	    p++;\n\
   2.592 +-	}\n\
   2.593 +-	if (*p == '\\0') {\n\
   2.594 +-	    break;\n\
   2.595 +-	}\n\
   2.596 +-\n\
   2.597 +-";
   2.598 +-
   2.599 +-static char *part6e = "\
   2.600 +-	inquote = 0;\n\
   2.601 +-	slashes = 0;\n\
   2.602 +-	while (1) {\n\
   2.603 +-	    copy = 1;\n\
   2.604 +-	    while (*p == '\\\\') {\n\
   2.605 +-		slashes++;\n\
   2.606 +-		p++;\n\
   2.607 +-	    }\n\
   2.608 +-	    if (*p == '\"') {\n\
   2.609 +-		if ((slashes & 1) == 0) {\n\
   2.610 +-		    copy = 0;\n\
   2.611 +-		    if ((inquote) && (p[1] == '\"')) {\n\
   2.612 +-			p++;\n\
   2.613 +-			copy = 1;\n\
   2.614 +-		    } else {\n\
   2.615 +-			inquote = !inquote;\n\
   2.616 +-		    }\n\
   2.617 +-                }\n\
   2.618 +-                slashes >>= 1;\n\
   2.619 +-            }\n\
   2.620 +-\n\
   2.621 +-            while (slashes) {\n\
   2.622 +-		*arg = '\\\\';\n\
   2.623 +-		arg++;\n\
   2.624 +-		slashes--;\n\
   2.625 +-	    }\n\
   2.626 +-\n\
   2.627 +-	    if ((*p == '\\0') || (!inquote && isspace(*p))) {\n\
   2.628 +-		break;\n\
   2.629 +-	    }\n\
   2.630 +-	    if (copy != 0) {\n\
   2.631 +-		*arg = *p;\n\
   2.632 +-		arg++;\n\
   2.633 +-	    }\n\
   2.634 +-	    p++;\n\
   2.635 +-        }\n\
   2.636 +-	*arg = '\\0';\n\
   2.637 +-	argSpace = arg + 1;\n\
   2.638 +-    }\n\
   2.639 +-    argv[argc] = NULL;\n\
   2.640 +-\n\
   2.641 +-    *argvPtr = argv;\n\
   2.642 +-    return argc;\n\
   2.643 +-}\n\
   2.644 +-#endif /* __WIN32__ */\n\
   2.645 +-";
   2.646 +-
   2.647 +-static char *defineproto = "\
   2.648 ++static char *defineproto1 = "\
   2.649 + #define %s_Init %s_InitStandAlone\n\
   2.650 + ";
   2.651 + 
   2.652 + static char *defineproto2 = "\
   2.653 +-/*#define %s_SafeInit ((Tcl_PackageInitProc *) NULL)*/\n\
   2.654 ++#define %s_SafeInit (Tcl_PackageInitProc *) NULL\n\
   2.655 + ";
   2.656 + 
   2.657 + static char *initproto = "\
   2.658 +@@ -653,9 +262,8 @@
   2.659 +     }\n\
   2.660 + ";
   2.661 + 
   2.662 +-static char *buffer;
   2.663 ++static char buffer[32768];
   2.664 + static unsigned int max_buffer = 0;
   2.665 +-static unsigned int buffer_size = MAX_STRING_LEN;
   2.666 + static char max_buffer_content[80];
   2.667 + 
   2.668 + static char array_instead_of_string = 0;
   2.669 +@@ -663,23 +271,25 @@
   2.670 + 
   2.671 + static char script_name[256];
   2.672 + 
   2.673 +-int printline _ANSI_ARGS_((FILE *f, char *dir, int flags));
   2.674 ++int printline _ANSI_ARGS_((FILE *f, char *buf, char *dir, int flags));
   2.675 + int printfile _ANSI_ARGS_((FILE *fout, char *filename, char *dir, int flags));
   2.676 + 
   2.677 + int
   2.678 + #ifdef _USING_PROTOTYPES_
   2.679 + printline (
   2.680 +     FILE *f,
   2.681 ++    char *buf,
   2.682 +     char *dir,
   2.683 +     int flags)
   2.684 + #else
   2.685 +-printline(f, dir, flags)
   2.686 ++printline(f,buf,dir,flags)
   2.687 +     FILE *f;
   2.688 ++    char *buf;
   2.689 +     char *dir;
   2.690 +     int flags;
   2.691 + #endif
   2.692 + {
   2.693 +-    char *p, *q, *buf = buffer;
   2.694 ++    char *p,*q;
   2.695 +     char path[128];
   2.696 +     unsigned int l;
   2.697 + 
   2.698 +@@ -730,7 +340,7 @@
   2.699 + 	    *q='}';
   2.700 + 	}
   2.701 +     }
   2.702 +-    p = buffer;
   2.703 ++    p = buf;
   2.704 +     while ((p = strstr(p, "[list source [file join $dir")) != NULL) {
   2.705 + 	q = strstr(p,".tcl]]");
   2.706 + 	if (q != NULL) {
   2.707 +@@ -805,14 +415,6 @@
   2.708 +     p = q = buffer;
   2.709 +     while ((c=fgetc(fin))!=EOF) {
   2.710 + 	*p = 0;
   2.711 +-        if (p + 10 > buffer + buffer_size) {
   2.712 +-	    char *new;
   2.713 +-	    buffer_size += MAX_STRING_LEN;
   2.714 +-	    new = (char *) realloc(buffer, buffer_size);
   2.715 +-	    p = new + (p - buffer);
   2.716 +-	    q = new + (q - buffer);
   2.717 +-	    buffer = new;
   2.718 +-        }
   2.719 + 	if (c=='\n') {
   2.720 + 	    if (!strncmp(buffer,"if {[info exists tk_library] && [string compare $tk_library {}]} {",66)) {
   2.721 + 		int flag = 1;
   2.722 +@@ -823,6 +425,7 @@
   2.723 + 			flag--;
   2.724 + 		    }
   2.725 + 		}
   2.726 ++		flag=0;
   2.727 + 		p=q=buffer;
   2.728 + 	    } else if ((p==buffer)||(*q=='\n')||(*q=='#')) {
   2.729 + 		if ((*q=='#') && (*(p-1)=='\\')) {
   2.730 +@@ -833,54 +436,23 @@
   2.731 + 	    } else {
   2.732 + 		*p++ = '\n'; *p=0;
   2.733 + 		if (Tcl_CommandComplete(buffer)) {
   2.734 +-		    p--; *p = 0; printline(fout,dir,flags);
   2.735 ++		    p--; *p = 0; printline(fout,buffer,dir,flags);
   2.736 + 		    p = q = buffer;
   2.737 + 		} else {
   2.738 + 		    q=p;
   2.739 + 		}
   2.740 + 	    }
   2.741 + 	} else {
   2.742 +-	    *p++ = (char) c;
   2.743 ++	    *p++ = c;
   2.744 + 	}
   2.745 +     }
   2.746 +     if (p!=buffer) {
   2.747 +-	*p=0; printline(fout, dir, flags);
   2.748 ++	*p=0; printline(fout,buffer,dir,flags);
   2.749 +     }
   2.750 +     fclose(fin);
   2.751 +     return 0; /* O.K. */
   2.752 + }
   2.753 + 
   2.754 +-#ifdef _APPLICATION_IS_ROOT_PATH_
   2.755 +-char abs_exe_path[PATH_MAX];
   2.756 +-char *
   2.757 +-#ifdef _USING_PROTOTYPES_
   2.758 +-app_GetPath(
   2.759 +-	int argc,
   2.760 +-	char *argv[])
   2.761 +-#else
   2.762 +-app_GetPath(argc, argv)
   2.763 +-	int argc;
   2.764 +-	char *argv[];
   2.765 +-#endif
   2.766 +-{
   2.767 +-  char path_save[PATH_MAX];
   2.768 +-  char *p;
   2.769 +-  if(!(p = strrchr(argv[0], '/')))
   2.770 +-    getcwd(abs_exe_path, sizeof(abs_exe_path));
   2.771 +-  else
   2.772 +-  {
   2.773 +-    *p = '\0';
   2.774 +-    getcwd(path_save, sizeof(path_save));
   2.775 +-    chdir(argv[0]);
   2.776 +-    getcwd(abs_exe_path, sizeof(abs_exe_path));
   2.777 +-    chdir(path_save);
   2.778 +-  }
   2.779 +-  //printf("Absolute path to executable is: %s\n", abs_exe_path);
   2.780 +-  return abs_exe_path;
   2.781 +-};
   2.782 +-#endif
   2.783 +-
   2.784 +-/* MAIN */
   2.785 + int
   2.786 + #ifdef _USING_PROTOTYPES_
   2.787 + main (
   2.788 +@@ -898,11 +470,6 @@
   2.789 +     tableitem *t;
   2.790 +     int c,i, flags=0;
   2.791 + 
   2.792 +-#ifdef _APPLICATION_IS_ROOT_PATH_
   2.793 +-	/* GOTO APPLICATION PATH */
   2.794 +-	chdir(app_GetPath(argc, argv));
   2.795 +-#endif
   2.796 +-
   2.797 +     if (argc==1) {
   2.798 + 	printf(verbose);
   2.799 + 	exit(0);
   2.800 +@@ -921,6 +488,8 @@
   2.801 + 	    i++; strcpy(script_name,argv[i]);
   2.802 + 	} else if (!strcmp(argv[i],"-o")) {
   2.803 + 	    i++; filename = argv[i];
   2.804 ++	} else if (!strcmp(argv[i],"-index")) {
   2.805 ++	    flags = -1;
   2.806 + 	} else {
   2.807 + 	    for (t=table;t<table+(sizeof(table)/sizeof(tableitem));t++) {
   2.808 + 		if (!strcmp(argv[i],t->option)) {
   2.809 +@@ -950,61 +519,41 @@
   2.810 + 	p = q+1;
   2.811 +     }
   2.812 +     strcpy(script_name,p);
   2.813 +-    q = script_name;
   2.814 +-    while (*q) {
   2.815 +-	if (*q == '.') {
   2.816 +-	    *q = '_';
   2.817 +-	} else if (isupper(*q)) {
   2.818 +-	    *q = tolower(*q);
   2.819 +-	}
   2.820 +-	q++;
   2.821 +-    }
   2.822 +     while ((q = strchr(script_name,'.')) != NULL) {
   2.823 + 	*q = '_';
   2.824 +     }
   2.825 + /* create prototypes for all initialization functions that are used */
   2.826 +-    if (flags) {
   2.827 ++    if (flags  && (flags != -1)) {
   2.828 + 	if (script_name[0] == 0) {
   2.829 + 	    strcpy(script_name,"script");
   2.830 + 	}
   2.831 + 	fprintf(fout, part1);
   2.832 + 	for (i=0,c=1;i<(sizeof(table)/sizeof(tableitem));i++,c<<=1) {
   2.833 + 	    if (flags & c) {
   2.834 +-		fprintf(fout,defineproto,table[i].package,
   2.835 ++		fprintf(fout,defineproto1,table[i].package,
   2.836 + 			table[i].package);
   2.837 + 	    }
   2.838 + 	}
   2.839 +-	fprintf(fout, "#endif\n\n");
   2.840 +-	for (i=1,c=2;i<(sizeof(table)/sizeof(tableitem));i++,c<<=1) {
   2.841 ++	fprintf(fout, part2);
   2.842 ++	for (i=0,c=1;i<(sizeof(table)/sizeof(tableitem));i++,c<<=1) {
   2.843 + 	    if (flags & c) {
   2.844 + 		fprintf(fout,defineproto2,table[i].package);
   2.845 + 	    }
   2.846 + 	}
   2.847 +-	fprintf(fout, part2);
   2.848 +-
   2.849 +-	if (flags & 2) {
   2.850 + 	    fprintf(fout, part3);
   2.851 +-	}
   2.852 +-	for (i=1,c=2;i<(sizeof(table)/sizeof(tableitem));i++,c<<=1) {
   2.853 ++	for (i=0,c=1;i<(sizeof(table)/sizeof(tableitem));i++,c<<=1) {
   2.854 + 	    if (flags & c) {
   2.855 + 		fprintf(fout,initproto,table[i].package,
   2.856 + 			table[i].package,table[i].package);
   2.857 + 	    }
   2.858 + 	}
   2.859 + 	fprintf(fout, part4, script_name);
   2.860 +-	if (array_instead_of_string) {
   2.861 +-	    fprintf(fout, part4b);
   2.862 +-	} else {
   2.863 +-	    fprintf(fout, part4a);
   2.864 + 	}
   2.865 +-    }
   2.866 +     if ( !array_instead_of_string && script_name[0]) {
   2.867 + 	fprintf(fout, "static char *%s[] = {\n", script_name);
   2.868 +     }
   2.869 + /* handle all remaining arguments */
   2.870 +     if (argc) {argc--; argv++;}
   2.871 +-    buffer = (char *) malloc(4*MAX_STRING_LEN);
   2.872 +-    buffer_size = 4*MAX_STRING_LEN;
   2.873 +     while(argc) {
   2.874 + 	if ((*argv)[0]=='-') {
   2.875 + 	    if ((((*argv)[1]=='o')||((*argv)[1]=='n'))&&((*argv)[2]==0)) {
   2.876 +@@ -1021,7 +570,6 @@
   2.877 + 	}
   2.878 + 	argc--; argv++;
   2.879 +     }
   2.880 +-    free(buffer);
   2.881 +     if ( array_instead_of_string ) {
   2.882 +       fprintf(fout, "static char *%s[] = {\n", script_name);
   2.883 +       for (i = 0; (unsigned int)i < num_lines;)
   2.884 +@@ -1031,39 +579,34 @@
   2.885 +       fprintf(fout, "(char *) NULL\n};\n\n");
   2.886 +     }
   2.887 + /* end of scripts, finally the functions main() and tclAppInit()  */
   2.888 +-    if (flags) {
   2.889 ++    if (flags  && (flags != -1)) {
   2.890 + 	fprintf(fout, part5, script_name);
   2.891 +-	fprintf(fout, part5a, script_name);
   2.892 +-	fprintf(fout, part5b);
   2.893 +-	fprintf(fout, part5c);
   2.894 +-	for (i=1,c=2;i<(sizeof(table)/sizeof(tableitem));i++,c<<=1) {
   2.895 +-	    if (flags & c) {
   2.896 +-		fprintf(fout,callinit,table[i].package);
   2.897 ++	fprintf(fout,callinit,table[0].package);
   2.898 ++	if (flags & 0x20) {
   2.899 ++	    fprintf(fout,callinit,table[5].package);
   2.900 ++	}
   2.901 ++	for (i=0,c=1;i<(sizeof(table)/sizeof(tableitem));i++,c<<=1) {
   2.902 ++	    if ((flags & c) && (i!=0))
   2.903 + 		fprintf(fout,packageproto,table[i].package,table[i].package,table[i].package);
   2.904 + 	    }
   2.905 ++	for (i=0,c=1;i<(sizeof(table)/sizeof(tableitem));i++,c<<=1) {
   2.906 ++	    if ((flags & c) && (i!=0) && (i!=5))
   2.907 ++		fprintf(fout,callinit,table[i].package);
   2.908 + 	}
   2.909 + 	p=filename?filename:"app";
   2.910 + 	if ((q=strrchr(p,'/')) != NULL) p=q+1;
   2.911 + 	if ((q=strchr(p,'.')) != NULL) *q=0;
   2.912 + 	if (!*p) p="app";
   2.913 +-	fprintf(fout, part6,script_name,script_name,p,p);
   2.914 +-	if (flags & 2) {
   2.915 +-	    fprintf(fout, part6a);
   2.916 ++	fprintf(fout, part6,script_name,p,p);
   2.917 + 	}
   2.918 +-	fprintf(fout, part6b);
   2.919 +-	fprintf(fout, part6c);
   2.920 +-	fprintf(fout, part6d);
   2.921 +-	fprintf(fout, part6e);
   2.922 +-    }
   2.923 + /* close output-file, if not stdout */
   2.924 +     if (fout!=stdout) {
   2.925 + 	fclose(fout);
   2.926 +     }
   2.927 +     if (max_buffer>MAX_STRING_LEN) {
   2.928 +-	fprintf(stderr,"warning: largest sting in output file is %d bytes\n\
   2.929 ++	fprintf(stderr,"warning: largest string in output file is %d bytes\n\
   2.930 +          many compilers can only handle %d characters in a string\n\
   2.931 + 	 first line: %s\n",max_buffer,MAX_STRING_LEN,max_buffer_content);
   2.932 +     }
   2.933 +     exit(0);
   2.934 +-    return 0;
   2.935 + }