Changes In Branch merge-kitdll-kitsh-common Through [b5b42e2343] Excluding Merge-Ins
This is equivalent to a diff from 4fa3b7d3ea to b5b42e2343
2011-05-21
| ||
15:09 | More work towards integrating KitDLL and KitSH -- C-VFS tested working within KitSH check-in: 7d18befb92 user: rkeene tags: merge-kitdll-kitsh-common | |
2011-05-20
| ||
06:31 |
Fixed bug with determining which build is selected
Fixed unexplained bug with determining the target OS information Updated to supply the VFS before building (in support of future C-VFS) check-in: b5b42e2343 user: rkeene tags: merge-kitdll-kitsh-common | |
05:50 | First set of merges from KitDLL to KitSH check-in: 55cb9f600a user: rkeene tags: merge-kitdll-kitsh-common | |
2011-05-19
| ||
23:00 |
Updated to try harder to look for a working Tcl interpreter for building KitDLL
Updated to return in failure if installvfs fails check-in: 3f354ca762 user: rkeene tags: trunk | |
18:04 | Merged trunk check-in: b7c6c8232c user: rkeene tags: merge-kitdll-kitsh-common | |
2011-05-17
| ||
01:33 | Updated to pull user-specified (or default) kit.ico and kit.rc into Tk, if built and not include KitSH's own resource file when including Tk's since they conflict check-in: 4fa3b7d3ea user: rkeene tags: trunk | |
2011-05-08
| ||
19:16 | Added basic Incr Tcl test check-in: 36e900cf16 user: rkeene tags: trunk | |
Deleted kitdll/buildsrc/kitdll-0.0/Makefile.in version [54a46a52d1].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/aclocal.m4 version [0c2240a08b].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/config.guess version [23da712e9c].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/config.sub version [1f0ad14050].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/configure.ac version [ae66df7b9e].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/dir2c.tcl version [28f9b94a91].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/install-sh version [82b003ed45].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/pwb.c version [d3bbfc6849].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/rechan.c version [95be374a42].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/stringify.tcl version [07e25e6903].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/tclsh.c version [5950dce536].
|
| < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/vfs_kitdll.tcl version [662da588b0].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/vfs_kitdll_data.c version [e51d57abbf].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/wish.c version [59698e12d8].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitdll/buildsrc/kitdll-0.0/zlib.c version [d3ecfd237b].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified kitsh/build.sh from [9ac6c7313f] to [2d7f94aadf].
︙ | ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ( cp -r 'buildsrc' 'build' cd "${BUILDDIR}" || exit 1 # Cleanup, just incase the incoming directory was not pre-cleaned ${MAKE:-make} distclean >/dev/null 2>/dev/null # Figure out if zlib compiled (if not, the system zlib will be used and we # will need to have that present) ZLIBDIR="$(cd "${OTHERPKGSDIR}/zlib/inst" 2>/dev/null && pwd)" export ZLIBDIR if [ -z "${ZLIBDIR}" -o ! -f "${ZLIBDIR}/lib/libz.a" ]; then unset ZLIBDIR fi | > > > > > > > > > > > > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ( cp -r 'buildsrc' 'build' cd "${BUILDDIR}" || exit 1 # Cleanup, just incase the incoming directory was not pre-cleaned ${MAKE:-make} distclean >/dev/null 2>/dev/null # Create VFS directory mkdir "starpack.vfs" mkdir "starpack.vfs/lib" ## Copy in all built directories cp -r "${OTHERPKGSDIR}"/*/out/* 'starpack.vfs/' ## Rename the "vfs" package directory to what "boot.tcl" expects mv 'starpack.vfs/lib'/vfs* 'starpack.vfs/lib/vfs' ## Install "boot.tcl" cp 'boot.tcl' 'starpack.vfs/' # Figure out if zlib compiled (if not, the system zlib will be used and we # will need to have that present) ZLIBDIR="$(cd "${OTHERPKGSDIR}/zlib/inst" 2>/dev/null && pwd)" export ZLIBDIR if [ -z "${ZLIBDIR}" -o ! -f "${ZLIBDIR}/lib/libz.a" ]; then unset ZLIBDIR fi |
︙ | ︙ | |||
77 78 79 80 81 82 83 | echo "Running: ${MAKE:-make}" ${MAKE:-make} || exit 1 # Strip the kit of all symbols, if possible "${STRIP:-strip}" kit >/dev/null 2>/dev/null | < < < < < < < < < < < < < | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | echo "Running: ${MAKE:-make}" ${MAKE:-make} || exit 1 # Strip the kit of all symbols, if possible "${STRIP:-strip}" kit >/dev/null 2>/dev/null # Intall VFS onto kit ## Determine if we have a Tclkit to do this work TCLKIT="${TCLKIT:-tclkit}" if echo 'exit 0' | "${TCLKIT}" >/dev/null 2>/dev/null; then ## Install using existing Tclkit ### Call installer echo "Running: \"${TCLKIT}\" installvfs.tcl kit starpack.vfs \"${ENABLECOMPRESSION}\"" |
︙ | ︙ |
Deleted kitsh/buildsrc/kitsh-0.0/Makefile.in version [6f33927faa].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Added kitsh/buildsrc/kitsh-0.0/Makefile.kitdll.in version [54a46a52d1].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | CC = @CC@ OBJCOPY = @OBJCOPY@ CFLAGS = @CFLAGS@ @SHOBJFLAGS@ -Wall CPPFLAGS = @CPPFLAGS@ @DEFS@ -DKITDLL_MAKE_LOADABLE=1 WISH_CFLAGS = @WISH_CFLAGS@ LDFLAGS = @LDFLAGS@ SHOBJLDFLAGS = @SHOBJLDFLAGS@ LIBS = @LIBS@ STATICLIBS = @ARCHS@ STRIPLIBS = @STRIPLIBS@ @EXTRA_OBJS@ OBJS = vfs_kitdll_data_tcl.o kitInit.o rechan.o pwb.o zlib.o EXTRA_OBJS = @EXTRA_OBJS@ TCLSH_NATIVE = tclsh # Default target all: libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ # Build targets ## VFS Build vfs_kitdll_data_tcl.o: vfs_kitdll_data_tcl.c vfs_kitdll_data_tcl.c: dir2c.tcl starpack.vfs vfs_kitdll_data.c "$(TCLSH_NATIVE)" dir2c.tcl tcl starpack.vfs > vfs_kitdll_data_tcl.c ## Tclkit Build kitInit.o: kitInit.c vfs_kitdll.tcl.h vfs_kitdll.tcl.h: vfs_kitdll.tcl "$(TCLSH_NATIVE)" ./stringify.tcl vfs_kitdll.tcl > vfs_kitdll.tcl.h ## Extensions rechan.o: rechan.c pwb.o: pwb.c zlib.o: zlib.c ## DLL Build libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@: $(OBJS) $(EXTRA_OBJS) -for striplib in $(STRIPLIBS); do $(OBJCOPY) --weaken "$${striplib}"; done $(CC) $(CPPFLAGS) $(CFLAGS) -o libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(OBJS) $(EXTRA_OBJS) $(LDFLAGS) $(SHOBJLDFLAGS) @WHOLEARCHIVE@ $(STATICLIBS) @NOWHOLEARCHIVE@ $(LIBS) # Test driver tclsh.o: tclsh.c tclsh: tclsh.o $(EXTRA_OBJS) libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(CC) $(CPPFLAGS) $(CFLAGS) -o tclsh tclsh.o $(EXTRA_OBJS) -L. -ltclkit@KITDLL_LIB_VERSION@ -Wl,-rpath,. wish.o: wish.c wish: wish.o $(EXTRA_OBJS) libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(CC) $(CPPFLAGS) $(CFLAGS) $(WISH_CFLAGS) -o wish wish.o $(EXTRA_OBJS) -L. -ltclkit@KITDLL_LIB_VERSION@ -Wl,-rpath,. # Cleanup routeines clean: rm -f libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ rm -f $(OBJS) rm -f vfs_kitdll_data_tcl.c rm -f vfs_kitdll.tcl.h rm -f tclsh.o tclsh tclsh.exe rm -f wish.o wish wish.exe distclean: clean rm -f config.status config.log rm -f *~ rm -f Makefile rm -rf starpack.vfs mrproper: distclean .PHONY: all clean distclean |
Added kitsh/buildsrc/kitsh-0.0/Makefile.tclkit.in version [ca60ee8255].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | CC = @CC@ RC = @RC@ CFLAGS = @CFLAGS@ @DEFS@ -DTK_LOCAL_APPINIT=TclKit_AppInit CPPFLAGS = @CPPFLAGS@ @DEFS@ -DTK_LOCAL_APPINIT=TclKit_AppInit LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ ARCHS = @ARCHS@ OBJS = kitInit.o main.o pwb.o rechan.o zlib.o winMain.o EXTRA_OBJS = @EXTRA_OBJS@ all: kit kit.res.o: kit.rc kit.ico $(RC) -o kit.res.o $(CPPFLAGS) kit.rc kit: $(OBJS) $(EXTRA_OBJS) $(ARCHS) $(CC) $(CPPFLAGS) $(CFLAGS) -o kit $(OBJS) $(EXTRA_OBJS) $(ARCHS) $(LDFLAGS) $(LIBS) boot.tcl.h: boot.tcl ./stringify.tcl boot.tcl > boot.tcl.h zipvfs.tcl.h: zipvfs.tcl ./stringify.tcl zipvfs.tcl > zipvfs.tcl.h clean: rm -f kit $(OBJS) kit.res.o distclean: clean rm -f config.h Makefile Makefile.in config.log config.status rm -rf autom4te.cache mrproper: distclean rm -f configure config.h boot.tcl.h zipvfs.tcl.h .PHONY: all clean distclean |
Modified kitsh/buildsrc/kitsh-0.0/aclocal.m4 from [9a1977c3cc] to [c050f768b5].
︙ | ︙ | |||
185 186 187 188 189 190 191 192 193 194 195 196 197 198 | fi done AC_SUBST(ARCHS) ]) AC_DEFUN(DC_SETUP_TCL_PLAT_DEFS, [ AC_CANONICAL_HOST AC_MSG_CHECKING(host operating system) AC_MSG_RESULT($host_os) case $host_os in mingw32*) | > | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | fi done AC_SUBST(ARCHS) ]) AC_DEFUN(DC_SETUP_TCL_PLAT_DEFS, [ AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_MSG_CHECKING(host operating system) AC_MSG_RESULT($host_os) case $host_os in mingw32*) |
︙ | ︙ | |||
256 257 258 259 260 261 262 | AC_MSG_RESULT([found]) AC_DEFINE(HAVE_ACCEPTABLE_DLADDR, [1], [Define to 1 if you have an acceptable dladdr implementation with dli_fname]) ], [ AC_MSG_RESULT([not found]) ] ) ]) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | AC_MSG_RESULT([found]) AC_DEFINE(HAVE_ACCEPTABLE_DLADDR, [1], [Define to 1 if you have an acceptable dladdr implementation with dli_fname]) ], [ AC_MSG_RESULT([not found]) ] ) ]) dnl Usage: dnl DC_TEST_SHOBJFLAGS(shobjflags, shobjldflags, action-if-not-found) dnl AC_DEFUN(DC_TEST_SHOBJFLAGS, [ AC_SUBST(SHOBJFLAGS) AC_SUBST(SHOBJLDFLAGS) OLD_LDFLAGS="$LDFLAGS" SHOBJFLAGS="" LDFLAGS="$OLD_LDFLAGS $1 $2" AC_TRY_LINK([#include <stdio.h> int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="$1"; SHOBJLDFLAGS="$2" ], [ LDFLAGS="$OLD_LDFLAGS" $3 ]) LDFLAGS="$OLD_LDFLAGS" ]) AC_DEFUN(DC_GET_SHOBJFLAGS, [ AC_SUBST(SHOBJFLAGS) AC_SUBST(SHOBJLDFLAGS) AC_MSG_CHECKING(how to create shared objects) if test -z "$SHOBJFLAGS" -a -z "$SHOBJLDFLAGS"; then DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -mimpure-text], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -mimpure-text], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -Wl,-G,-z,textoff], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -Wl,-G,-z,textoff], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -dynamiclib -flat_namespace -undefined suppress -bind_at_load], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress -bind_at_load], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-Wl,-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-bind_at_load], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib], [ AC_MSG_RESULT(cant) AC_MSG_ERROR([We are unable to make shared objects.]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) fi AC_MSG_RESULT($SHOBJLDFLAGS $SHOBJFLAGS) ]) AC_DEFUN(DC_CHK_OS_INFO, [ AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_SUBST(SHOBJEXT) AC_SUBST(AREXT) AC_SUBST(SHOBJFLAGS) AC_SUBST(SHOBJLDFLAGS) AC_MSG_CHECKING(host operating system) AC_MSG_RESULT($host_os) SHOBJEXT="so" AREXT="a" case $host_os in darwin*) SHOBJEXT="dylib" ;; hpux*) SHOBJEXT="sl" ;; mingw*) SHOBJEXT="dll" SHOBJFLAGS="-mno-cygwin -mms-bitfields -DPIC" SHOBJLDFLAGS='-shared -Wl,--dll -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a -Wl,--export-all-symbols -Wl,--add-stdcall-alias' ;; esac ]) AC_DEFUN(DC_TEST_WHOLE_ARCHIVE_SHARED_LIB, [ SAVE_LIBS="${LIBS}" LIBS="${WHOLEARCHIVE} $1 ${NOWHOLEARCHIVE} ${SAVE_LIBS}" AC_LINK_IFELSE( AC_LANG_PROGRAM([[ ]], [[ ]] ), [ LIBS="${SAVE_LIBS}" $2 ], [ LIBS="${SAVE_LIBS}" $3 ] ) ]) AC_DEFUN(DC_CHECK_FOR_WHOLE_ARCHIVE, [ AC_MSG_CHECKING([for how to link whole archive]) SAVE_CFLAGS="${CFLAGS}" wholearchive="" for check in "-Wl,--whole-archive -Wl,--no-whole-archive" "-Wl,-z,allextract -Wl,-z,defaultextract"; do CFLAGS="${SAVE_CFLAGS} ${check}" AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ wholearchive="${check}" break ] ) done CFLAGS="${SAVE_CFLAGS}" if test -z "${wholearchive}"; then AC_MSG_RESULT([not found]) else AC_MSG_RESULT([${wholearchive}]) WHOLEARCHIVE=`echo "${wholearchive}" | cut -f 1 -d ' '` NOWHOLEARCHIVE=`echo "${wholearchive}" | cut -f 2 -d ' '` fi AC_SUBST(WHOLEARCHIVE) AC_SUBST(NOWHOLEARCHIVE) ]) |
Modified kitsh/buildsrc/kitsh-0.0/configure.ac from [da08c3d389] to [a823c6235c].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | dnl What are we running AC_INIT(kitsh, 0.0) dnl Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_INSTALL AC_AIX AC_GNU_SOURCE dnl Find the appropriate libraries to link to AC_SEARCH_LIBS(acos, m,, [ AC_MSG_WARN([Couldn't find acos (normally in libm)!]) ]) AC_SEARCH_LIBS(dlsym, dl,, [ AC_MSG_WARN([Couldn't find dlsym (normally in libdl)!]) ]) | > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | dnl What are we running AC_INIT(kitsh, 0.0) dnl Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_INSTALL AC_AIX AC_GNU_SOURCE dnl Find out if we should build a DLL or an Executable TARGET="tclkit" AC_MSG_CHECKING([what target to build]) AC_ARG_ENABLE(kitdll, AC_HELP_STRING([--enable-kitdll], [Enable building KitDLL instead of Tclkit (default: no)]), [ case "$enableval" in yes|kitdll) TARGET="kitdll" ;; no) true ;; *) AC_MSG_RESULT([unknown]) AC_MSG_ERROR([Invalid option: $enableval]) ;; esac ]) AC_MSG_RESULT([$TARGET]) dnl Find the appropriate libraries to link to AC_SEARCH_LIBS(acos, m,, [ AC_MSG_WARN([Couldn't find acos (normally in libm)!]) ]) AC_SEARCH_LIBS(dlsym, dl,, [ AC_MSG_WARN([Couldn't find dlsym (normally in libdl)!]) ]) if test "$TARGET" = "tclkit"; then dnl Figure out how to statically link to libgcc, if needed DC_STATIC_LIBGCC else dnl We have KitDLL dnl Determine system information DC_CHK_OS_INFO dnl Determine how to create a shared object DC_GET_SHOBJFLAGS dnl KitDLL always uses C-VFS AC_DEFINE([KIT_STORAGE_CVFS], [1], [Define if you are going to use C-VFS for kit storage]) dnl Define KitDLL usage AC_DEFINE([TCLKIT_DLL], [1], [Define if you are using a KitDLL rather than a Tclkit]) fi dnl Find the appropriate Tcl headers and libraries DC_DO_TCL dnl Find archives we need to link to DC_FIND_TCLKIT_LIBS |
︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | EXTRA_OBJS="$EXTRA_OBJS kit.res.o" fi fi dnl Check for Tcl features SAVE_LIBS="${LIBS}" LIBS="${ARCHS} ${LIBS}" dnl Determine if we have "Tcl_SetStartupScript" (8.6.x) or "TclSetStartupScriptPath" (8.4.x) AC_CHECK_FUNCS(Tcl_SetStartupScript TclSetStartupScriptPath) dnl Check for the ability to get the current system encoding AC_CHECK_FUNCS(Tcl_GetEncodingNameFromEnvironment Tcl_SetSystemEncoding) LIBS="${SAVE_LIBS}" dnl Check for optional headers AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h string.h strings.h) dnl Check for optional system calls AC_CHECK_FUNCS(readlink) dnl Check for acceptable dladdr so we can find ourselves on Solaris DC_CHECK_FOR_ACCEPTABLE_DLADDR dnl Find zlib AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [directory containing zlib]), [ CPPFLAGS="${CPPFLAGS} -I${with_zlib}/include -I${with_zlib}" CFLAGS="${CFLAGS} -I${with_zlib}/include -I${with_zlib}" LDFLAGS="${LDFLAGS} -L${with_zlib}/lib -L${with_zlib}" ]) | > > > > > | | | | | | | > > > | > | > | > > > > > | | | | | > > > > > > > > > > > > > > > | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | EXTRA_OBJS="$EXTRA_OBJS kit.res.o" fi fi dnl Check for Tcl features SAVE_LIBS="${LIBS}" LIBS="${ARCHS} ${LIBS}" dnl Determine if we have "Tcl_SetStartupScript" (8.6.x) or "TclSetStartupScriptPath" (8.4.x) AC_CHECK_FUNCS(Tcl_SetStartupScript TclSetStartupScriptPath) dnl Check for the ability to get the current system encoding AC_CHECK_FUNCS(Tcl_GetEncodingNameFromEnvironment Tcl_SetSystemEncoding) LIBS="${SAVE_LIBS}" dnl Check for optional headers AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h string.h strings.h) dnl Check for optional system calls AC_CHECK_FUNCS(readlink) dnl Check for acceptable dladdr so we can find ourselves on Solaris DC_CHECK_FOR_ACCEPTABLE_DLADDR dnl Find zlib AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [directory containing zlib]), [ CPPFLAGS="${CPPFLAGS} -I${with_zlib}/include -I${with_zlib}" CFLAGS="${CFLAGS} -I${with_zlib}/include -I${with_zlib}" LDFLAGS="${LDFLAGS} -L${with_zlib}/lib -L${with_zlib}" ]) dnl Only needed for Tclkit if test "$TARGET" = "tclkit"; then DC_DO_STATIC_LINK_LIB(zlib, -lz,, [ DC_DO_STATIC_LINK_LIB(zlib, -lzlib,, [ AC_SEARCH_LIBS(inflate, z zlib,, [ AC_MSG_WARN([Couldn't find inflate (normally in zlib)!]) ]) ]) ]) fi dnl Determine which storage mechanism to use AC_MSG_CHECKING([which Tclkit Storage mechanism to use]) storage_mech="auto" AC_ARG_ENABLE(kit-storage, AC_HELP_STRING([--enable-kit-storage={zip|mk4|cvfs}], [Specify storage mechanism to use for built-in VFS (default: auto)]), [ case "$enableval" in mk4) storage_mech="mk4" AC_DEFINE([KIT_STORAGE_MK4], [1], [Define if you are going to use Metakit4 for kit storage]) ;; zip) storage_mech="zip" AC_DEFINE([KIT_STORAGE_ZIP], [1], [Define if you are going to use ZIP for kit storage]) ;; cvfs) storage_mech="cvfs" AC_DEFINE([KIT_STORAGE_CVFS], [1], [Define if you are going to use C-VFS for kit storage]) ;; yes) # If they just want to enable kit storage, but nothing specifically, do nothing storage_mech="auto" ;; auto) # Auto is how it works by default storage_mech="auto" ;; no) # You can't disable kit storage AC_MSG_RESULT([fail]) AC_MSG_ERROR([Kit Storage cannot be disabled]) ;; *) AC_MSG_RESULT([fail]) AC_MSG_ERROR([Unknown kit storage type: $enableval]) ;; esac ]) AC_MSG_RESULT([$storage_mech]) dnl Verify sanity of storage mechanism if ! test "$TARGET" = "tclkit"; then case "$storage_mech" in auto|cvfs) true ;; *) AC_MSG_ERROR([Only "cvfs" and "auto" are valid storage mechanisms when building KitDLL]) ;; esac fi dnl Put correct Makefile template in place rm -f Makefile.in cp Makefile.${TARGET}.in Makefile.in dnl Produce output AC_OUTPUT(Makefile) |
Added kitsh/buildsrc/kitsh-0.0/dir2c.tcl version [28f9b94a91].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | #! /usr/bin/env tclsh if {[llength $argv] != 2} { puts stderr "Usage: kitdll <hashkey> <startdir>" exit 1 } set hashkey [lindex $argv 0] set startdir [lindex $argv 1] proc shorten_file {dir file} { set dirNameLen [string length $dir] if {[string range $file 0 [expr {$dirNameLen - 1}]] == $dir} { set file [string range $file $dirNameLen end] } if {[string index $file 0] == "/"} { set file [string range $file 1 end] } return $file } proc recursive_glob {dir} { set children [glob -nocomplain -directory $dir *] set ret [list $dir] foreach child $children { unset -nocomplain childinfo catch { file stat $child childinfo } if {![info exists childinfo(type)]} { continue } if {$childinfo(type) == "directory"} { foreach add [recursive_glob $child] { lappend ret $add } continue } if {$childinfo(type) != "file"} { continue } lappend ret $child } return $ret } # Convert a string into a C-style binary string ## XXX: This function needs to be optimized proc stringify {data} { set ret "\"" for {set idx 0} {$idx < [string length $data]} {incr idx} { binary scan [string index $data $idx] H* char append ret "\\x${char}" if {($idx % 20) == 0 && $idx != 0} { append ret "\"\n\"" } } set ret [string trim $ret "\n\""] set ret "\"$ret\"" return $ret } # This function must be kept in-sync with the generated C function below proc kitdll_hash {path} { set h 0 set g 0 for {set idx 0} {$idx < [string length $path]} {incr idx} { binary scan [string index $path $idx] H* char set char "0x$char" set h [expr {($h << 4) + $char}] set g [expr {$h & 0xf0000000}] if {$g != 0} { set h [expr {($h & 0xffffffff) ^ ($g >> 24)}] } set h [expr {$h & ((~$g) & 0xffffffff)}] } return $h } # Generate list of files to include in output set files [recursive_glob $startdir] # Insert dummy entry cooresponding to C dummy entry set files [linsert $files 0 "__DUMMY__"] # Produce C89 compatible header set cpp_tag "KITDLL_[string toupper $hashkey]" set code_tag "kitdll_[string tolower $hashkey]" set hashkey [string tolower $hashkey] puts "#ifndef $cpp_tag" puts "# define $cpp_tag 1" puts { # ifdef HAVE_STDC # ifndef HAVE_UNISTD_H # define HAVE_UNISTD_H 1 # endif # ifndef HAVE_STRING_H # define HAVE_STRING_H 1 # endif # endif # ifdef HAVE_UNISTD_H # include <unistd.h> # endif # ifdef HAVE_STRING_H # include <string.h> # endif # ifndef LOADED_KITDLL_COMMON # define LOADED_KITDLL_COMMON 1 typedef enum { KITDLL_FILETYPE_FILE, KITDLL_FILETYPE_DIR } kitdll_filetype_t; struct kitdll_data { const char * name; unsigned long index; unsigned long size; kitdll_filetype_t type; const unsigned char * data; }; static unsigned long kitdll_hash(const unsigned char *path) { unsigned long i, h = 0, g = 0; for (i = 0; path[i]; i++) { h = (h << 4) + path[i]; g = h & 0xf0000000; if (g) { h ^= (g >> 24); } h &= ((~g) & 0xffffffffLU); } return(h); } # endif /* !LOADED_KITDLL_COMMON */} puts "" puts "static struct kitdll_data ${code_tag}_data\[\] = {" puts "\t{" puts "\t\t.name = NULL," puts "\t\t.index = 0," puts "\t\t.type = 0," puts "\t\t.size = 0," puts "\t\t.data = NULL," puts "\t}," for {set idx 1} {$idx < [llength $files]} {incr idx} { set file [lindex $files $idx] set shortfile [shorten_file $startdir $file] unset -nocomplain finfo type file stat $file finfo switch -- $finfo(type) { "file" { set type "KITDLL_FILETYPE_FILE" set size $finfo(size) set fd [open $file] fconfigure $fd -translation binary set data [read $fd] close $fd set data "(unsigned char *) [stringify $data]" } "directory" { set type "KITDLL_FILETYPE_DIR" set data "NULL" set size 0 } } puts "\t{" puts "\t\t.name = \"$shortfile\"," puts "\t\t.index = $idx," puts "\t\t.type = $type," puts "\t\t.size = $size," puts "\t\t.data = $data," puts "\t}," } puts "};" puts "" puts "static unsigned long ${code_tag}_lookup_index(const char *path) {" puts "\tswitch (kitdll_hash((unsigned char *) path)) {" for {set idx 1} {$idx < [llength $files]} {incr idx} { set file [lindex $files $idx] set shortfile [shorten_file $startdir $file] set hash [kitdll_hash $shortfile] lappend indexes_per_hash($hash) [list $shortfile $idx] } foreach {hash idx_list} [array get indexes_per_hash] { puts "\t\tcase $hash:" if {[llength $idx_list] == 1} { set idx [lindex $idx_list 0 1] puts "\t\t\treturn($idx);" } else { foreach idx_ent $idx_list { set shortfile [lindex $idx_ent 0] set idx [lindex $idx_ent 1] puts "\t\t\tif (strcmp(path, \"$shortfile\") == 0) return($idx);" } puts "\t\t\tbreak;" } } puts "\t}" puts "\treturn(0);" puts "}" puts "" puts "static struct kitdll_data *${code_tag}_getData(const char *path, unsigned long index) {" puts "\tif (path != NULL) {" puts "\t\tindex = ${code_tag}_lookup_index(path);" puts "\t}" puts "" puts "\tif (index == 0) {" puts "\t\treturn(NULL);" puts "\t}" puts "" puts "\tif (path != NULL) {" puts "\t\tif (strcmp(path, ${code_tag}_data\[index\].name) != 0) {" puts "\t\t\treturn(NULL);" puts "\t\t}" puts "\t}" puts "" puts "\treturn(&${code_tag}_data\[index\]);" puts "}" puts "" puts "static unsigned long ${code_tag}_getChildren(const char *path, unsigned long *outbuf, unsigned long outbuf_count) {" puts "\tunsigned long index;" puts "\tunsigned long num_children = 0;" puts "" puts "\tindex = ${code_tag}_lookup_index(path);" puts "\tif (index == 0) {" puts "\t\treturn(0);" puts "\t}" puts "" puts "\tif (${code_tag}_data\[index\].type != KITDLL_FILETYPE_DIR) {" puts "\t\treturn(0);" puts "\t}" puts "" puts "\tif (strcmp(path, ${code_tag}_data\[index\].name) != 0) {" puts "\t\treturn(0);" puts "\t}" puts "" puts "\tswitch (index) {" unset -nocomplain children array set children [list] for {set idx 1} {$idx < [llength $files]} {incr idx} { set file [lindex $files $idx] set shortfile [shorten_file $startdir $file] unset -nocomplain finfo type file stat $file finfo if {$finfo(type) != "directory"} { continue; } # Determine which children are under this directory ## Convert the current pathname to a regular expression that matches exactly set file_regexp [string map [list "\\" "\\\\" "." "\\." "\{" "\\\{" "\}" "\\\}" "*" "\\*"] $file] ## Search for pathnames which start with exactly our name, followed by a slash ## followed by no more slashes (direct descendants) set child_idx_list [lsearch -regexp -all $files "^${file_regexp}/\[^/\]*$"] set children($idx) $child_idx_list puts "\t\tcase $idx:" puts "\t\t\tnum_children = [llength $child_idx_list];" puts "\t\t\tbreak;" } puts "\t}" puts "" puts "\tif (outbuf == NULL) {" puts "\t\treturn(num_children);" puts "\t}" puts "" puts "\tif (num_children > outbuf_count) {" puts "\t\tnum_children = outbuf_count;" puts "\t}" puts "" puts "\tif (num_children == 0) {" puts "\t\treturn(num_children);" puts "\t}" puts "" puts "\tif (outbuf_count > num_children) {" puts "\t\toutbuf_count = num_children;" puts "\t}" puts "" puts "\tswitch (index) {" foreach {idx child_idx_list} [array get children] { if {[llength $child_idx_list] == 0} { continue } puts "\t\tcase $idx:" puts "\t\t\tswitch(outbuf_count) {" for {set child_idx_idx [expr {[llength $child_idx_list] - 1}]} {$child_idx_idx >= 0} {incr child_idx_idx -1} { set child_idx [lindex $child_idx_list $child_idx_idx] puts "\t\t\t\tcase [expr {$child_idx_idx + 1}]:" puts "\t\t\t\t\toutbuf\[$child_idx_idx\] = $child_idx;" } puts "\t\t\t}" puts "\t\t\tbreak;" } puts "\t}" puts "" puts "\treturn(num_children);" puts "}" puts "" puts "# ifdef KITDLL_MAKE_LOADABLE" set fd [open "vfs_kitdll_data.c"] puts [read $fd] close $fd puts "static cmd_getData_t *getCmdData(const char *hashkey) {" puts "\treturn(${code_tag}_getData);" puts "}" puts "" puts "static cmd_getChildren_t *getCmdChildren(const char *hashkey) {" puts "\treturn(${code_tag}_getChildren);" puts "}" puts "" puts "int Vfs_kitdll_data_${hashkey}_Init(Tcl_Interp *interp) {" puts "\tTcl_Command tclCreatComm_ret;" puts "\tint tclPkgProv_ret;" puts "" puts "\ttclCreatComm_ret = Tcl_CreateObjCommand(interp, \"::vfs::kitdll::data::${hashkey}::getMetadata\", getMetadata, NULL, NULL);" puts "\tif (!tclCreatComm_ret) {" puts "\t\treturn(TCL_ERROR);" puts "\t}" puts "" puts "\ttclCreatComm_ret = Tcl_CreateObjCommand(interp, \"::vfs::kitdll::data::${hashkey}::getData\", getData, NULL, NULL);" puts "\tif (!tclCreatComm_ret) {" puts "\t\treturn(TCL_ERROR);" puts "\t}" puts "" puts "\ttclCreatComm_ret = Tcl_CreateObjCommand(interp, \"::vfs::kitdll::data::${hashkey}::getChildren\", getChildren, NULL, NULL);" puts "\tif (!tclCreatComm_ret) {" puts "\t\treturn(TCL_ERROR);" puts "\t}" puts "" puts "\ttclPkgProv_ret = Tcl_PkgProvide(interp, \"vfs::kitdll::data::${hashkey}\", \"1.0\");" puts "" puts "\treturn(tclPkgProv_ret);" puts "\t}" puts "# endif /* KITDLL_MAKE_LOADABLE */" puts "#endif /* !$cpp_tag */" |
Modified kitsh/buildsrc/kitsh-0.0/installvfs.tcl from [01a4e2e7f2] to [d2ae77312e].
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | close $fd if {[string match "*KIT_STORAGE_ZIP*" $data]} { set tclKitStorage zip } if {[string match "*KIT_STORAGE_MK4*" $data]} { set tclKitStorage mk4 } if {![info exists tclKitStorage]} { if {[string match "*KIT_INCLUDES_MK4TCL*" $data]} { set tclKitStorage mk4 } else { set tclKitStorage zip | > > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | close $fd if {[string match "*KIT_STORAGE_ZIP*" $data]} { set tclKitStorage zip } if {[string match "*KIT_STORAGE_MK4*" $data]} { set tclKitStorage mk4 } if {[string match "*KIT_STORAGE_CVFS*" $data]} { set tclKitStorage cvfs } if {![info exists tclKitStorage]} { if {[string match "*KIT_INCLUDES_MK4TCL*" $data]} { set tclKitStorage mk4 } else { set tclKitStorage zip |
︙ | ︙ |
Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [2ea4599da9] to [dd6f45df03].
︙ | ︙ | |||
13 14 15 16 17 18 19 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id$ */ #ifdef KIT_INCLUDES_TK # include <tk.h> | < < > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id$ */ #ifdef KIT_INCLUDES_TK # include <tk.h> #endif /* KIT_INCLUDES_TK */ #include <tcl.h> #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN # include <windows.h> # undef WIN32_LEAN_AND_MEAN #endif /* _WIN32 */ |
︙ | ︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85 # define KIT_INCLUDES_PWB 1 #endif #if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86 # define KIT_INCLUDES_ZLIB 1 #endif #ifdef KIT_INCLUDES_ITCL Tcl_AppInitProc Itcl_Init; #endif #ifdef KIT_INCLUDES_MK4TCL Tcl_AppInitProc Mk4tcl_Init; #endif Tcl_AppInitProc Vfs_Init, Rechan_Init; #ifdef KIT_INCLUDES_PWB Tcl_AppInitProc Pwb_Init; #endif #ifdef KIT_INCLUDES_ZLIB Tcl_AppInitProc Zlib_Init; #endif #ifdef TCL_THREADS Tcl_AppInitProc Thread_Init; #endif #ifdef _WIN32 Tcl_AppInitProc Dde_Init, Registry_Init; #endif | > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | | > | | > | > | | > | | | | | | | > > > > | | > > > > > > > > > > > > > > > | | | | | | | | > < < < < < < < < < < | > > > > > > > > > > > > > > > > > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | #if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85 # define KIT_INCLUDES_PWB 1 #endif #if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86 # define KIT_INCLUDES_ZLIB 1 #endif /* Determine which type of storage to use -- MK4, ZIP, or CVFS */ #if defined(KIT_STORAGE_MK4) && defined(KIT_STORAGE_ZIP) # undef KIT_STORAGE_ZIP #endif #if defined(KIT_STORAGE_MK4) && defined(KIT_STORAGE_CVFS) # ifdef TCLKIT_DLL # undef KIT_STORAGE_MK4 # else # undef KIT_STORAGE_CVFS # endif #endif #if !defined(KIT_STORAGE_MK4) && !defined(KIT_STORAGE_ZIP) && !defined(KIT_STORAGE_CVFS) # ifdef TCLKIT_DLL # define KIT_STORAGE_CVFS 1 # else # ifdef KIT_INCLUDES_MK4TCL # define KIT_STORAGE_MK4 1 # else # define KIT_STORAGE_ZIP 1 # endif # endif #endif #ifdef KIT_INCLUDES_ITCL Tcl_AppInitProc Itcl_Init; #endif #ifdef KIT_INCLUDES_MK4TCL Tcl_AppInitProc Mk4tcl_Init; #endif Tcl_AppInitProc Vfs_Init, Rechan_Init; #ifdef KIT_INCLUDES_PWB Tcl_AppInitProc Pwb_Init; #endif #ifdef KIT_INCLUDES_ZLIB Tcl_AppInitProc Zlib_Init; #endif #ifdef KIT_STORAGE_CVFS Tcl_AppInitProc Vfs_kitdll_data_tcl_Init; #endif #ifdef TCL_THREADS Tcl_AppInitProc Thread_Init; #endif #ifdef _WIN32 Tcl_AppInitProc Dde_Init, Registry_Init; #endif #ifdef TCLKIT_DLL # define TCLKIT_MOUNTPOINT "/.KITDLL_TCL" #else # define TCLKIT_MOUNTPOINT "[info nameofexecutable]" #endif /* TCLKIT_DLL */ #ifdef HAVE_ACCEPTABLE_DLADDR # ifdef KITSH_NEED_WINMAIN # ifdef _WIN32_WCE int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow); # else int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow); # endif /* _WIN32_WCE */ # endif /* KITSH_NEED_WINMAIN */ int main(int argc, char **argv); #endif /* HAVE_ACCEPTABLE_DLADDR */ #ifdef TCLKIT_REQUIRE_TCLEXECUTABLENAME char *tclExecutableName; #endif /* * Attempt to load a "boot.tcl" entry from the embedded MetaKit file. * If there isn't one, try to open a regular "setup.tcl" file instead. * If that fails, this code will throw an error, using a message box. */ /* * This Tcl code is invoked whenever Tcl_Init() is called on an * interpreter. It should mount up the VFS and make everything ready for * that interpreter to do its job. */ static char *preInitCmd = #if defined(_WIN32_WCE) && !defined(TCLKIT_DLL) /* silly hack to get wince port to launch, some sort of std{in,out,err} problem */ "open /kitout.txt a; open /kitout.txt a; open /kitout.txt a\n" /* this too seems to be needed on wince - it appears to be related to the above */ "catch {rename source ::tcl::source}\n" "proc source file {\n" "set old [info script]\n" "info script $file\n" "set fid [open $file]\n" "set data [read $fid]\n" "close $fid\n" "set code [catch {uplevel 1 $data} res]\n" "info script $old\n" "if {$code == 2} { set code 0 }\n" "return -code $code $res\n" "}\n" #endif /* _WIN32_WCE && !TCLKIT_DLL */ "proc tclKitInit {} {\n" "rename tclKitInit {}\n" #ifdef KIT_INCLUDES_ZLIB "catch { load {} zlib }\n" #endif #ifdef KIT_INCLUDES_MK4TCL "catch { load {} Mk4tcl }\n" #endif #ifdef TCLKIT_DLL "load {} tclkit::init\n" #endif "set bootfile [file join " TCLKIT_MOUNTPOINT " boot.tcl]\n" "if {[file exists $bootfile]} {\n" "catch {\n" "set f [open $bootfile]\n" "set s [read $f]\n" "close $f\n" "}\n" "}\n" #ifdef KIT_STORAGE_MK4 "set ::tclKitStorage \"mk4\"\n" "if {![info exists s]} {\n" "mk::file open exe [info nameofexecutable] -readonly\n" "set n [mk::select exe.dirs!0.files name boot.tcl]\n" "if {$n != \"\"} {\n" "set s [mk::get exe.dirs!0.files!$n contents]\n" "if {![string length $s]} { error \"empty boot.tcl\" }\n" "catch {load {} zlib}\n" "if {[mk::get exe.dirs!0.files!$n size] != [string length $s]} {\n" "set s [zlib decompress $s]\n" "}\n" "}\n" "}\n" #endif /* KIT_STORAGE_MK4 */ #ifdef KIT_STORAGE_ZIP "set ::tclKitStorage \"zip\"\n" "catch { load {} vfs }\n" "if {![info exists s]} {\n" # include "zipvfs.tcl.h" "catch {\n" "set ::tclKitStorage_fd [::zip::open [info nameofexecutable]]\n" "::zip::stat $::tclKitStorage_fd boot.tcl sb\n" "seek $::tclKitStorage_fd $sb(ino)\n" "::zip::Data $::tclKitStorage_fd sb s\n" "}\n" "}\n" #endif /* KIT_STORAGE_ZIP */ #ifdef KIT_STORAGE_CVFS "set ::tclKitStorage \"cvfs\"\n" "load {} rechan\n" "load {} vfs\n" "load {} vfs_kitdll_data_tcl\n" #include "vfs_kitdll.tcl.h" "if {![info exists s]} {\n" "catch {\n" "set s [::vfs::kitdll::data::getData tcl boot.tcl]\n" "}\n" "}\n" #endif /* KIT_STORAGE_CVFS */ #ifdef TCLKIT_DLL "::tclkit::init::initInterp\n" "rename ::tclkit::init::initInterp {}\n" #else "if {![info exists s]} {\n" "set f [open setup.tcl]\n" "set s [read $f]\n" "close $f\n" "}\n" #endif /* TCLKIT_DLL */ "uplevel #0 $s\n" #if defined(KIT_INCLUDES_TK) && defined(KIT_TK_VERSION) "package ifneeded Tk " KIT_TK_VERSION " {\n" "load {} Tk\n" "}\n" #endif #ifdef _WIN32 |
︙ | ︙ | |||
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | return; } } } #endif /* HAVE_READLINK */ #ifdef HAVE_ACCEPTABLE_DLADDR if (Tcl_GetNameOfExecutable() == NULL) { dladdr_ret = dladdr(&SetExecName, &syminfo); if (dladdr_ret != 0) { SetExecName(interp, syminfo.dli_fname); } } #endif /* HAVE_ACCEPTABLE_DLADDR */ if (Tcl_GetNameOfExecutable() == NULL) { lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY); execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv); SetExecName(interp, Tcl_GetStringFromObj(execNameObj, &len)); return; } return; } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < | > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | return; } } } #endif /* HAVE_READLINK */ #ifdef HAVE_ACCEPTABLE_DLADDR # ifndef TCLKIT_DLL if (Tcl_GetNameOfExecutable() == NULL) { dladdr_ret = dladdr(&SetExecName, &syminfo); if (dladdr_ret != 0) { SetExecName(interp, syminfo.dli_fname); return; } } # endif /* !TCLKIT_DLL */ # ifdef KITSH_NEED_WINMAIN if (Tcl_GetNameOfExecutable() == NULL) { # ifdef _WIN32_WCE dladdr_ret = dladdr(&WinMain, &syminfo); # else dladdr_ret = dladdr(&wWinMain, &syminfo); # endif /* _WIN32_WCE */ if (dladdr_ret != 0) { SetExecName(interp, syminfo.dli_fname); return; } } # endif /* KITSH_NEED_WINMAIN */ if (Tcl_GetNameOfExecutable() == NULL) { dladdr_ret = dladdr(&main, &syminfo); if (dladdr_ret != 0) { SetExecName(interp, syminfo.dli_fname); return; } } #endif /* HAVE_ACCEPTABLE_DLADDR */ if (Tcl_GetNameOfExecutable() == NULL) { lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY); execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv); SetExecName(interp, Tcl_GetStringFromObj(execNameObj, &len)); return; } return; } static void _Tclkit_Generic_Init(void) { #ifdef KIT_INCLUDES_ITCL Tcl_StaticPackage(0, "Itcl", Itcl_Init, NULL); #endif #ifdef KIT_INCLUDES_MK4TCL Tcl_StaticPackage(0, "Mk4tcl", Mk4tcl_Init, NULL); #endif #ifdef KIT_INCLUDES_PWB Tcl_StaticPackage(0, "pwb", Pwb_Init, NULL); #endif Tcl_StaticPackage(0, "rechan", Rechan_Init, NULL); Tcl_StaticPackage(0, "vfs", Vfs_Init, NULL); #ifdef KIT_INCLUDES_ZLIB Tcl_StaticPackage(0, "zlib", Zlib_Init, NULL); #endif #ifdef KIT_STORAGE_CVFS Tcl_StaticPackage(0, "vfs_kitdll_data_tcl", Vfs_kitdll_data_tcl_Init, NULL); #endif #ifdef TCL_THREADS Tcl_StaticPackage(0, "Thread", Thread_Init, NULL); #endif #ifdef _WIN32 Tcl_StaticPackage(0, "dde", Dde_Init, NULL); Tcl_StaticPackage(0, "registry", Registry_Init, NULL); #endif #ifdef KIT_INCLUDES_TK Tcl_StaticPackage(0, "Tk", Tk_Init, Tk_SafeInit); #endif TclSetPreInitScript(preInitCmd); return; } static void _Tclkit_Interp_Init(Tcl_Interp *interp) { #ifdef TCLKIT_CAN_SET_ENCODING Tcl_DString encodingName; #endif /* TCLKIT_CAN_SET_ENCODING */ /* the tcl_rcFileName variable only exists in the initial interpreter */ #ifdef _WIN32 Tcl_SetVar(interp, "tcl_rcFileName", "~/tclkitrc.tcl", TCL_GLOBAL_ONLY); #else Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclkitrc", TCL_GLOBAL_ONLY); #endif #ifdef TCLKIT_CAN_SET_ENCODING /* Set the encoding from the Environment */ Tcl_GetEncodingNameFromEnvironment(&encodingName); Tcl_SetSystemEncoding(NULL, Tcl_DStringValue(&encodingName)); Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&encodingName), 0); Tcl_DStringFree(&encodingName); #endif /* Hack to get around Tcl bug 1224888. This must be run here and * in LibraryPathObjCmd because this information is needed both * before and after that command is run. */ FindAndSetExecName(interp); return; } int TclKit_AppInit(Tcl_Interp *interp) { #ifdef KIT_INCLUDES_TK # ifdef _WIN32 # ifndef _WIN32_WCE char msgBuf[2049]; # endif /* !_WIN32_WCE */ # endif /* _WIN32 */ #endif /* KIT_INCLUDES_TK */ /* Perform common initialization */ _Tclkit_Generic_Init(); _Tclkit_Interp_Init(interp); if (Tcl_Init(interp) == TCL_ERROR) { goto error; } #ifdef KIT_INCLUDES_TK # ifdef _WIN32 if (Tk_Init(interp) == TCL_ERROR) { |
︙ | ︙ | |||
376 377 378 379 380 381 382 | # endif /* !_WIN32_WCE */ /* we won't reach this, but we need the return */ # endif /* _WIN32 */ #endif /* KIT_INCLUDES_TK */ return TCL_ERROR; } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | # endif /* !_WIN32_WCE */ /* we won't reach this, but we need the return */ # endif /* _WIN32 */ #endif /* KIT_INCLUDES_TK */ return TCL_ERROR; } #ifdef TCLKIT_DLL # ifdef HAVE_ACCEPTABLE_DLADDR /* Symbol to resolve against dladdr() */ static void _tclkit_dummy_func(void) { return; } # endif /* HAVE_ACCEPTABLE_DLADDR */ /* * This function will return a pathname we can open() to treat as a VFS, * hopefully */ static char *find_tclkit_dll_path(void) { #ifdef HAVE_ACCEPTABLE_DLADDR Dl_info syminfo; int dladdr_ret; #endif /* HAVE_ACCEPTABLE_DLADDR */ #ifdef _WIN32 TCHAR modulename[8192]; DWORD gmfn_ret; #endif /* _WIN32 */ #ifdef HAVE_ACCEPTABLE_DLADDR dladdr_ret = dladdr(&_tclkit_dummy_func, &syminfo); if (dladdr_ret != 0) { if (syminfo.dli_fname && syminfo.dli_fname[0] != '\0') { return(strdup(syminfo.dli_fname)); } } #endif /* HAVE_ACCEPTABLE_DLADDR */ #ifdef _WIN32 gmfn_ret = GetModuleFileName(TclWinGetTclInstance(), modulename, sizeof(modulename) / sizeof(modulename[0]) - 1); if (gmfn_ret != 0) { return(strdup(modulename)); } #endif /* _WIN32 */ return(NULL); } /* * This function exists to allow C code to initialize a particular * interpreter. */ static int tclkit_init_initinterp(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { char *kitdll_path; kitdll_path = find_tclkit_dll_path(); if (kitdll_path != NULL) { Tcl_SetVar(interp, "tclKitFilename", kitdll_path, TCL_GLOBAL_ONLY); free(kitdll_path); } _Tclkit_Interp_Init(interp); return(TCL_OK); } /* * Create a package for initializing a particular interpreter. This is * our hook to have Tcl invoke C commands when creating an interpreter. * The preInitCmd will load the package in the new interpreter and invoke * this function. */ int Tclkit_init_Init(Tcl_Interp *interp) { Tcl_Command tclCreatComm_ret; int tclPkgProv_ret; tclCreatComm_ret = Tcl_CreateObjCommand(interp, "::tclkit::init::initInterp", tclkit_init_initinterp, NULL, NULL); if (!tclCreatComm_ret) { return(TCL_ERROR); } tclPkgProv_ret = Tcl_PkgProvide(interp, "tclkit::init", "1.0"); return(tclPkgProv_ret); } /* * Initialize the Tcl system when we are loaded, that way Tcl functions * are ready to be used when invoked. */ void __attribute__((constructor)) _Tclkit_Init(void) { Tcl_StaticPackage(0, "tclkit::init", Tclkit_init_Init, NULL); _Tclkit_Generic_Init(); return; } #endif |
Added kitsh/buildsrc/kitsh-0.0/tclsh.c version [5950dce536].
> > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 | #include <tcl.h> int Tcl_AppInit(Tcl_Interp *interp) { return(Tcl_Init(interp)); } int main(int argc, char **argv) { Tcl_Main(argc, argv, Tcl_AppInit); return(1); } |
Added kitsh/buildsrc/kitsh-0.0/vfs_kitdll.tcl version [662da588b0].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | #! /usr/bin/env tcl package require vfs namespace eval ::vfs::kitdll {} # Convience functions proc ::vfs::kitdll::Mount {hashkey local} { vfs::filesystem mount $local [list ::vfs::kitdll::vfshandler $hashkey] catch { vfs::RegisterMount $local [list ::vfs::kitdll::Unmount] } } proc ::vfs::kitdll::Unmount {local} { vfs::filesystem unmount $local } # Implementation ## I/O Handlers (pass to appropriate hashkey) namespace eval ::vfs::kitdll::data {} proc ::vfs::kitdll::data::getChildren args { set hashkey [lindex $args 0] set cmd "::vfs::kitdll::data::${hashkey}::getChildren" set cmd [linsert $args 0 $cmd] eval $cmd } proc ::vfs::kitdll::data::getMetadata args { set hashkey [lindex $args 0] set cmd "::vfs::kitdll::data::${hashkey}::getMetadata" set cmd [linsert $args 0 $cmd] eval $cmd } proc ::vfs::kitdll::data::getData args { set hashkey [lindex $args 0] set cmd "::vfs::kitdll::data::${hashkey}::getData" set cmd [linsert $args 0 $cmd] eval $cmd } ## VFS and Chan I/O ### Dispatchers proc ::vfs::kitdll::vfshandler {hashkey subcmd args} { set cmd $args set cmd [linsert $cmd 0 "::vfs::kitdll::vfsop_${subcmd}" $hashkey] return [eval $cmd] } proc ::vfs::kitdll::chanhandler {hashkey subcmd args} { set cmd $args set cmd [linsert $cmd 0 "::vfs::kitdll::chanop_${subcmd}" $hashkey] return [eval $cmd] } ### Actual handlers #### Channel operation handlers proc ::vfs::kitdll::chanop_initialize {hashkey chanId mode} { return [list initialize finalize watch read seek] } proc ::vfs::kitdll::chanop_finalize {hashkey chanId} { unset -nocomplain ::vfs::kitdll::chandata([list $hashkey $chanId]) return } proc ::vfs::kitdll::chanop_watch {hashkey chanId eventSpec} { array set chaninfo $::vfs::kitdll::chandata([list $hashkey $chanId]) set chaninfo(watching) $eventSpec set ::vfs::kitdll::chandata([list $hashkey $chanId]) [array get chaninfo] if {[lsearch -exact $chaninfo(watching) "read"] != -1} { after 0 [list catch "chan postevent $chanId [list {read}]"] } return } proc ::vfs::kitdll::chanop_read {hashkey chanId bytes} { array set chaninfo $::vfs::kitdll::chandata([list $hashkey $chanId]) set pos $chaninfo(pos) set len $chaninfo(len) if {[lsearch -exact $chaninfo(watching) "read"] != -1} { after 0 [list catch "chan postevent $chanId [list {read}]"] } if {$pos == $len} { return "" } set end [expr {$pos + $bytes}] if {$end > $len} { set end $len } set data [::vfs::kitdll::data::getData $hashkey $chaninfo(file) $pos $end] set dataLen [string length $data] incr pos $dataLen set chaninfo(pos) $pos set ::vfs::kitdll::chandata([list $hashkey $chanId]) [array get chaninfo] return $data } proc ::vfs::kitdll::chanop_seek {hashkey chanId offset origin} { array set chaninfo $::vfs::kitdll::chandata([list $hashkey $chanId]) set pos $chaninfo(pos) set len $chaninfo(len) switch -- $origin { "start" - "0" { set pos $offset } "current" - "1" { set pos [expr {$pos + $offset}] } "end" - "2" { set pos [expr {$len + $offset}] } } if {$pos < 0} { set pos 0 } if {$pos > $len} { set pos $len } set chaninfo(pos) $pos set ::vfs::kitdll::chandata([list $hashkey $chanId]) [array get chaninfo] return $pos } #### VFS operation handlers proc ::vfs::kitdll::vfsop_stat {hashkey root relative actualpath} { catch { set ret [::vfs::kitdll::data::getMetadata $hashkey $relative] } if {![info exists ret]} { vfs::filesystem posixerror $::vfs::posix(ENOENT) } return $ret } proc ::vfs::kitdll::vfsop_access {hashkey root relative actualpath mode} { set ret [::vfs::kitdll::data::getMetadata $hashkey $relative] if {$mode & 0x2} { vfs::filesystem posixerror $::vfs::posix(EROFS) } return 1 } proc ::vfs::kitdll::vfsop_matchindirectory {hashkey root relative actualpath pattern types} { set ret [list] catch { array set metadata [::vfs::kitdll::data::getMetadata $hashkey $relative] } if {![info exists metadata]} { return [list] } if {$pattern == ""} { set children [list $relative] } else { set children [::vfs::kitdll::data::getChildren $hashkey $relative] } foreach child $children { if {$pattern != ""} { if {![string match $pattern $child]} { continue } } unset -nocomplain metadata catch { array set metadata [::vfs::kitdll::data::getMetadata $hashkey $child] } if {[string index $root end] == "/"} { set child "${root}${child}" } else { set child "${root}/${child}" } if {[string index $child end] == "/"} { set child [string range $child 0 end-1] } if {![info exists metadata(type)]} { continue } set filetype 0 switch -- $metadata(type) { "directory" { set filetype [expr {$filetype | 0x04}] } "file" { set filetype [expr {$filetype | 0x10}] } "link" { set filetype [expr {$filetype | 0x20}] } default { continue } } if {($filetype & $types) != $types} { continue } lappend ret $child } return $ret } proc ::vfs::kitdll::vfsop_fileattributes {hashkey root relative actualpath {index -1} {value ""}} { set attrs [list -owner -group -permissions] if {$value != ""} { vfs::filesystem posixerror $::vfs::posix(EROFS) } if {$index == -1} { return $attrs } array set metadata [::vfs::kitdll::data::getMetadata $hashkey $relative] set attr [lindex $attrs $index] switch -- $attr { "-owner" { return $metadata(uid) } "-group" { return $metadata(gid) } "-permissions" { if {$metadata(type) == "directory"} { set metadata(mode) [expr {$metadata(mode) | 040000}] } return [format {0%o} $metadata(mode)] } } return -code error "Invalid index" } proc ::vfs::kitdll::vfsop_open {hashkey root relative actualpath mode permissions} { if {$mode != "" && $mode != "r"} { vfs::filesystem posixerror $::vfs::posix(EROFS) } catch { array set metadata [::vfs::kitdll::data::getMetadata $hashkey $relative] } if {![info exists metadata]} { vfs::filesystem posixerror $::vfs::posix(ENOENT) } if {$metadata(type) == "directory"} { vfs::filesystem posixerror $::vfs::posix(EISDIR) } if {[info command chan] != ""} { set chan [chan create [list "read"] [list ::vfs::kitdll::chanhandler $hashkey]] set ::vfs::kitdll::chandata([list $hashkey $chan]) [list file $relative pos 0 len $metadata(size) watching ""] return [list $chan] } if {[info command rechan] == ""} { catch { package require rechan } } if {[info command rechan] != ""} { set chan [rechan [list ::vfs::kitdll::chanhandler $hashkey] 2] set ::vfs::kitdll::chandata([list $hashkey $chan]) [list file $relative pos 0 len $metadata(size) watching ""] return [list $chan] } return -code error "No way to generate a channel, need either Tcl 8.5+, \"rechan\"" } ##### No-Ops since we are a readonly filesystem proc ::vfs::kitdll::vfsop_createdirectory {args} { vfs::filesystem posixerror $::vfs::posix(EROFS) } proc ::vfs::kitdll::vfsop_deletefile {args} { vfs::filesystem posixerror $::vfs::posix(EROFS) } proc ::vfs::kitdll::vfsop_removedirectory {args} { vfs::filesystem posixerror $::vfs::posix(EROFS) } proc ::vfs::kitdll::vfsop_utime {} { vfs::filesystem posixerror $::vfs::posix(EROFS) } package provide vfs::kitdll 1.0 |
Added kitsh/buildsrc/kitsh-0.0/vfs_kitdll_data.c version [e51d57abbf].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | #include <tcl.h> #ifdef HAVE_STDLIB_H # include <stdlib.h> #endif typedef struct kitdll_data *(cmd_getData_t)(const char *, unsigned long); typedef unsigned long (cmd_getChildren_t)(const char *, unsigned long *, unsigned long); /* Your implementation must provide these */ static cmd_getData_t *getCmdData(const char *hashkey); static cmd_getChildren_t *getCmdChildren(const char *hashkey); /* Tcl Commands */ static int getMetadata(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { cmd_getData_t *cmd_getData; cmd_getChildren_t *cmd_getChildren; struct kitdll_data *finfo = NULL; Tcl_Obj *ret_list, *ret_list_items[20]; unsigned long num_children; const char *hashkey; const char *file; if (objc != 3) { Tcl_SetResult(interp, "wrong # args: should be \"getMetadata hashKey fileName\"", TCL_STATIC); return(TCL_ERROR); } hashkey = Tcl_GetString(objv[1]); file = Tcl_GetString(objv[2]); cmd_getData = getCmdData(hashkey); cmd_getChildren = getCmdChildren(hashkey); if (cmd_getData == NULL || cmd_getChildren == NULL) { Tcl_SetResult(interp, "No such hashkey", TCL_STATIC); return(TCL_ERROR); } finfo = cmd_getData(file, 0); if (finfo == NULL) { Tcl_SetResult(interp, "No such file or directory", TCL_STATIC); return(TCL_ERROR); } /* Values that can be derived from "finfo" */ ret_list_items[0] = Tcl_NewStringObj("type", 4); ret_list_items[2] = Tcl_NewStringObj("mode", 4); ret_list_items[4] = Tcl_NewStringObj("nlink", 5); if (finfo->type == KITDLL_FILETYPE_DIR) { num_children = cmd_getChildren(file, NULL, 0); ret_list_items[1] = Tcl_NewStringObj("directory", 9); ret_list_items[3] = Tcl_NewLongObj(040555); ret_list_items[5] = Tcl_NewLongObj(num_children); } else { ret_list_items[1] = Tcl_NewStringObj("file", 4); ret_list_items[3] = Tcl_NewLongObj(0444); ret_list_items[5] = Tcl_NewLongObj(1); } ret_list_items[6] = Tcl_NewStringObj("ino", 3); ret_list_items[7] = Tcl_NewLongObj(finfo->index); ret_list_items[8] = Tcl_NewStringObj("size", 4); ret_list_items[9] = Tcl_NewLongObj(finfo->size); /* Dummy values */ ret_list_items[10] = Tcl_NewStringObj("uid", 3); ret_list_items[11] = Tcl_NewStringObj("0", 1); ret_list_items[12] = Tcl_NewStringObj("gid", 3); ret_list_items[13] = Tcl_NewStringObj("0", 1); ret_list_items[14] = Tcl_NewStringObj("atime", 5); ret_list_items[15] = Tcl_NewStringObj("0", 1); ret_list_items[16] = Tcl_NewStringObj("mtime", 5); ret_list_items[17] = Tcl_NewStringObj("0", 1); ret_list_items[18] = Tcl_NewStringObj("ctime", 5); ret_list_items[19] = Tcl_NewStringObj("0", 1); ret_list = Tcl_NewListObj(sizeof(ret_list_items) / sizeof(ret_list_items[0]), ret_list_items); Tcl_SetObjResult(interp, ret_list); return(TCL_OK); } static int getData(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { struct kitdll_data *finfo = NULL; cmd_getData_t *cmd_getData; const char *hashkey; const char *file; const char *end_str; Tcl_Obj *ret_str; long start = 0; long end = -1; int tclGetLFO_ret; if (objc < 3 || objc > 5) { Tcl_SetResult(interp, "wrong # args: should be \"getData hashKey fileName ?start? ?end?\"", TCL_STATIC); return(TCL_ERROR); } hashkey = Tcl_GetString(objv[1]); file = Tcl_GetString(objv[2]); if (objc > 3) { tclGetLFO_ret = Tcl_GetLongFromObj(interp, objv[3], &start); if (tclGetLFO_ret != TCL_OK) { return(tclGetLFO_ret); } } if (objc > 4) { end_str = Tcl_GetString(objv[4]); if (strcmp(end_str, "end") == 0) { end = -1; } else { tclGetLFO_ret = Tcl_GetLongFromObj(interp, objv[4], &end); if (tclGetLFO_ret != TCL_OK) { return(tclGetLFO_ret); } } } cmd_getData = getCmdData(hashkey); if (cmd_getData == NULL) { Tcl_SetResult(interp, "No such hashkey", TCL_STATIC); return(TCL_ERROR); } finfo = cmd_getData(file, 0); if (finfo == NULL) { Tcl_SetResult(interp, "No such file or directory", TCL_STATIC); return(TCL_ERROR); } if (finfo->type != KITDLL_FILETYPE_FILE) { Tcl_SetResult(interp, "Not a file", TCL_STATIC); return(TCL_ERROR); } if (end == -1) { end = finfo->size; } if (end > finfo->size) { end = finfo->size; } if (start < 0) { start = 0; } if (end < 0) { end = 0; } if (end < start) { Tcl_SetResult(interp, "Invalid arguments, start must be less than end", TCL_STATIC); return(TCL_ERROR); } ret_str = Tcl_NewByteArrayObj(finfo->data + start, (end - start)); Tcl_SetObjResult(interp, ret_str); return(TCL_OK); } static int getChildren(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { struct kitdll_data *finfo = NULL; cmd_getChildren_t *cmd_getChildren; cmd_getData_t *cmd_getData; unsigned long num_children, idx; unsigned long *children; const char *hashkey; const char *file; const char *child; Tcl_Obj *ret_list, *ret_curr_obj; if (objc != 3) { Tcl_SetResult(interp, "wrong # args: should be \"getChildren hashKey fileName\"", TCL_STATIC); return(TCL_ERROR); } hashkey = Tcl_GetString(objv[1]); file = Tcl_GetString(objv[2]); cmd_getData = getCmdData(hashkey); cmd_getChildren = getCmdChildren(hashkey); if (cmd_getData == NULL || cmd_getChildren == NULL) { Tcl_SetResult(interp, "No such hashkey", TCL_STATIC); return(TCL_ERROR); } finfo = cmd_getData(file, 0); if (finfo == NULL) { Tcl_SetResult(interp, "No such file or directory", TCL_STATIC); return(TCL_ERROR); } if (finfo->type != KITDLL_FILETYPE_DIR) { Tcl_SetResult(interp, "Not a directory", TCL_STATIC); return(TCL_ERROR); } num_children = cmd_getChildren(file, NULL, 0); if (num_children == 0) { /* Return immediately if there are no children */ Tcl_SetResult(interp, "", TCL_STATIC); return(TCL_OK); } ret_list = Tcl_NewObj(); if (ret_list == NULL) { Tcl_SetResult(interp, "Failed to allocate new object", TCL_STATIC); return(TCL_ERROR); } children = malloc(sizeof(*children) * num_children); num_children = cmd_getChildren(file, children, num_children); for (idx = 0; idx < num_children; idx++) { finfo = cmd_getData(NULL, children[idx]); if (finfo == NULL || finfo->name == NULL) { continue; } child = finfo->name; ret_curr_obj = Tcl_NewStringObj(child, strlen(child)); Tcl_ListObjAppendList(interp, ret_list, ret_curr_obj); } free(children); Tcl_SetObjResult(interp, ret_list); return(TCL_OK); } |
Added kitsh/buildsrc/kitsh-0.0/wish.c version [59698e12d8].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include <tk.h> int Tcl_AppInit(Tcl_Interp *interp) { int tcl_ret; tcl_ret = Tcl_Init(interp); if (tcl_ret == TCL_ERROR) { return(tcl_ret); } tcl_ret = Tk_Init(interp); if (tcl_ret == TCL_ERROR) { return(tcl_ret); } #ifdef _WIN32 tcl_ret = Tk_CreateConsoleWindow(interp); if (tcl_ret == TCL_ERROR) { return(tcl_ret); } #endif return(TCL_OK); } int main(int argc, char **argv) { Tk_Main(argc, argv, Tcl_AppInit); return(1); } |