3 # This script writes to stdout, a single source file (e.g. jimsh0.c)
4 # which can be compiled to provide a bootstrap version of jimsh.
5 # e.g. cc -o jimsh0 jimsh0.c
10 basename=`basename "$source" .tcl`
12 int Jim_${basename}Init(Jim_Interp *interp)
14 if (Jim_PackageProvide(interp, "$basename", "1.0", JIM_ERRMSG))
17 return Jim_EvalSource(interp, "$source", 1,
20 # Note: Keep newlines so that line numbers match in error messages
21 sed -e 's/^[ ]*#.*//' -e 's@\\@\\\\@g' -e 's@"@\\"@g' -e 's@^\(.*\)$@"\1\\n"@' $source
30 int Jim_InitStaticExtensions(Jim_Interp *interp)
34 echo "extern int Jim_${ext}Init(Jim_Interp *);"
37 echo "Jim_${ext}Init(interp);"
43 cexts
="aio readdir regexp file exec clock array"
44 tclexts
="bootstrap initjimsh glob stdlib tclcompat"
47 allexts
="bootstrap aio readdir regexp file glob exec clock array stdlib tclcompat"
49 echo "/* This is single source file, bootstrap version of Jim Tcl. See http://jim.tcl.tk/ */"
51 # define some core features
52 for i
in JIM_TCL_COMPAT JIM_REFERENCES JIM_ANSIC JIM_REGEXP HAVE_NO_AUTOCONF _JIMAUTOCONF_H
; do
55 echo '#define TCL_LIBRARY "."'
58 echo "#define jim_ext_$i"
63 #define TCL_PLATFORM_OS "windows"
64 #define TCL_PLATFORM_PLATFORM "windows"
65 #define TCL_PLATFORM_PATH_SEPARATOR ";"
66 #define HAVE_MKDIR_ONE_ARG
68 #elif defined(__MINGW32__)
69 #define TCL_PLATFORM_OS "mingw"
70 #define TCL_PLATFORM_PLATFORM "windows"
71 #define TCL_PLATFORM_PATH_SEPARATOR ";"
72 #define HAVE_MKDIR_ONE_ARG
74 #define HAVE_SYS_TIME_H
78 #define TCL_PLATFORM_OS "unknown"
79 #define TCL_PLATFORM_PLATFORM "unix"
80 #define TCL_PLATFORM_PATH_SEPARATOR ":"
92 #define HAVE_SYS_TIME_H
98 # get JIM_VERSION from auto.def
99 sed -n -e 's/^\(define JIM_VERSION.*\)/#\1/p' auto.def
103 sed -e '/#include.*jim/d' -e '/#include.*utf8/d' \
104 -e '/^#.*if.*JIM_BOOTSTRAP/,/^#endif.*JIM_BOOTSTRAP/d' \
105 -e 's/\/\*.*\*\///' -e '/^[ ]*\/\*/,/\*\//d' $1
108 # Now output header files, removing references to jim header files
109 for i
in jim-win32compat.h utf8.h jim.h jim-subcmd.h jimregexp.h
; do
113 # Now extension source code
114 for i
in $tclexts; do
118 outputsource jim-
$i.c
120 makeloadexts
$allexts
122 # And finally the core source code
123 for i
in jim.c jim-subcmd.c utf8.c jim-format.c jimregexp.c jim-win32compat.c
; do
126 echo "#ifndef JIM_BOOTSTRAP_LIB_ONLY"
127 outputsource jim-interactive.c