diff options
-rw-r--r-- | jim-aio.c | 20 | ||||
-rw-r--r-- | jim.c | 9 | ||||
-rw-r--r-- | jimregexp.c | 5 | ||||
-rwxr-xr-x | make-bootstrap-jim | 13 | ||||
-rw-r--r-- | tests/Makefile | 2 | ||||
-rw-r--r-- | utf8.c | 4 | ||||
-rw-r--r-- | utf8.h | 4 |
7 files changed, 33 insertions, 24 deletions
@@ -76,7 +76,7 @@ #endif #endif -#ifndef JIM_ANSIC +#if !defined(JIM_ANSIC) && !defined(JIM_BOOTSTRAP) union sockaddr_any { struct sockaddr sa; struct sockaddr_in sin; @@ -95,7 +95,7 @@ const char *inet_ntop(int af, const void *src, char *dst, int size) return dst; } #endif -#endif +#endif /* JIM_BOOTSTRAP */ typedef struct AioFile { @@ -117,7 +117,7 @@ typedef struct AioFile static int JimAioSubCmdProc(Jim_Interp *interp, int argc, Jim_Obj *const *argv); -#ifndef JIM_ANSIC +#if !defined(JIM_ANSIC) && !defined(JIM_BOOTSTRAP) static int JimParseIPv6Address(Jim_Interp *interp, const char *hostport, union sockaddr_any *sa, int *salen) { #if IPV6 @@ -259,7 +259,7 @@ static int JimParseDomainAddress(Jim_Interp *interp, const char *path, struct so return JIM_OK; } #endif -#endif +#endif /* JIM_BOOTSTRAP */ static void JimAioSetError(Jim_Interp *interp, Jim_Obj *name) { @@ -503,7 +503,7 @@ static int aio_cmd_puts(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return JIM_ERR; } -#ifndef JIM_ANSIC +#if !defined(JIM_ANSIC) && !defined(JIM_BOOTSTRAP) static int aio_cmd_recvfrom(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { AioFile *af = Jim_CmdPrivData(interp); @@ -639,7 +639,7 @@ static int aio_cmd_listen(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return JIM_OK; } -#endif +#endif /* JIM_BOOTSTRAP */ static int aio_cmd_flush(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { @@ -873,7 +873,7 @@ static const jim_subcmd_type aio_command_table[] = { .maxargs = 2, .description = "Write the string, with newline unless -nonewline" }, -#ifndef JIM_ANSIC +#if !defined(JIM_ANSIC) && !defined(JIM_BOOTSTRAP) { .cmd = "recvfrom", .args = "len ?addrvar?", .function = aio_cmd_recvfrom, @@ -899,7 +899,7 @@ static const jim_subcmd_type aio_command_table[] = { .maxargs = 1, .description = "Set the listen backlog for server socket" }, -#endif +#endif /* JIM_BOOTSTRAP */ { .cmd = "flush", .function = aio_cmd_flush, .description = "Flush the stream" @@ -1050,7 +1050,7 @@ static int JimAioOpenCommand(Jim_Interp *interp, int argc, return JIM_OK; } -#ifndef JIM_ANSIC +#if !defined(JIM_ANSIC) && !defined(JIM_BOOTSTRAP) /** * Creates a channel for fd. @@ -1353,7 +1353,7 @@ static int JimAioSockCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return JimMakeChannel(interp, argv[1], hdlfmt, sock, family, mode); } -#endif +#endif /* JIM_BOOTSTRAP */ FILE *Jim_AioFilehandle(Jim_Interp *interp, Jim_Obj *command) { @@ -4776,11 +4776,12 @@ static const Jim_HashTableType JimRefMarkHashTableType = { /* Performs the garbage collection. */ int Jim_Collect(Jim_Interp *interp) { + int collected = 0; +#ifndef JIM_BOOTSTRAP Jim_HashTable marks; Jim_HashTableIterator *htiter; Jim_HashEntry *he; Jim_Obj *objPtr; - int collected = 0; /* Avoid recursive calls */ if (interp->lastCollectId == -1) { @@ -4905,6 +4906,7 @@ int Jim_Collect(Jim_Interp *interp) Jim_FreeHashTable(&marks); interp->lastCollectId = interp->referenceNextId; interp->lastCollectTime = time(NULL); +#endif /* JIM_BOOTSTRAP */ return collected; } @@ -12046,7 +12048,7 @@ static int Jim_AppendCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *a /* [debug] */ static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { -#ifdef JIM_DEBUG_COMMAND +#if defined(JIM_DEBUG_COMMAND) && !defined(JIM_BOOTSTRAP) static const char * const options[] = { "refcount", "objcount", "objects", "invstr", "scriptlen", "exprlen", "exprbc", "show", @@ -12247,7 +12249,8 @@ static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *ar return JIM_ERR; } /* unreached */ -#else +#endif /* JIM_BOOTSTRAP */ +#if !defined(JIM_DEBUG_COMMAND) Jim_SetResultString(interp, "unsupported", -1); return JIM_ERR; #endif diff --git a/jimregexp.c b/jimregexp.c index b138cb1..4b30efa 100644 --- a/jimregexp.c +++ b/jimregexp.c @@ -1340,7 +1340,6 @@ static int regmatch(regex_t *preg, int prog) int c; #ifdef DEBUG if (regnarrate) { - //fprintf(stderr, "%s...\n", regprop(scan)); fprintf(stderr, "%3d: %s...\n", scan, regprop(OP(preg, scan))); /* Where, what. */ } #endif @@ -1568,7 +1567,7 @@ static int regnext(regex_t *preg, int p ) return(p+offset); } -#ifdef DEBUG +#if defined(DEBUG) && !defined(JIM_BOOTSTRAP) /* - regdump - dump a regexp onto stdout in vaguely comprehensible form @@ -1712,7 +1711,7 @@ static const char *regprop( int op ) return(buf); } } -#endif +#endif /* JIM_BOOTSTRAP */ size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) { diff --git a/make-bootstrap-jim b/make-bootstrap-jim index fb6de59..cc2cd5d 100755 --- a/make-bootstrap-jim +++ b/make-bootstrap-jim @@ -77,9 +77,16 @@ cat <<EOF #endif EOF +outputsource() +{ + sed -e '/#include.*jim/d' -e '/#include.*utf8/d' \ + -e '/^#.*if.*JIM_BOOTSTRAP/,/^#endif.*JIM_BOOTSTRAP/d' \ + -e 's/\/\*.*\*\///' -e '/^[ ]*\/\*/,/\*\//d' $1 +} + # Now output header files, removing references to jim header files for i in utf8.h jim.h jim-subcmd.h jimregexp.h ; do - sed -e '/#include.*jim/d' -e '/#include.*utf8/d' $i + outputsource $i done # Now extension source code @@ -87,11 +94,11 @@ for i in $tclexts; do makeext $i.tcl done for i in $cexts; do - sed -e '/#include.*jim/d' jim-$i.c + outputsource jim-$i.c done makeloadexts $allexts # And finally the core source code for i in jim.c jim-subcmd.c utf8.c jim-interactive.c jim-format.c jimregexp.c jimsh.c; do - sed -e '/#include.*jim/d' -e '/#include.*utf8/d' $i + outputsource $i done diff --git a/tests/Makefile b/tests/Makefile index 36ed253..bf0bf11 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,7 +1,7 @@ jimsh ?= ../jimsh test: - @set -e; for i in *.test; do LD_LIBRARY_PATH=..:$(LD_LIBRARY_PATH) $(jimsh) $$i; done + @for i in *.test; do LD_LIBRARY_PATH=..:$(LD_LIBRARY_PATH) $(jimsh) $$i; done clean: rm -f gorp.file2 cat gorp.file sleep exit wc sh echo test1 @@ -33,7 +33,7 @@ int utf8_fromunicode(char *p, unsigned short uc) } } -#ifdef JIM_UTF8 +#if defined(JIM_UTF8) && !defined(JIM_BOOTSTRAP) int utf8_charlen(int c) { if ((c & 0x80) == 0) { @@ -189,4 +189,4 @@ int utf8_lower(int uc) return utf8_map_case(uc, 0); } -#endif +#endif /* JIM_BOOTSTRAP */ @@ -29,7 +29,7 @@ int utf8_fromunicode(char *p, unsigned short uc); #define utf8_charlen(C) 1 #define utf8_prev_len(S, L) 1 -#else +#elif !defined(JIM_BOOTSTRAP) /** * Returns the length of the utf-8 sequence starting with 'c'. * @@ -103,6 +103,6 @@ int utf8_upper(int uc); */ int utf8_lower(int uc); -#endif +#endif /* JIM_BOOTSTRAP */ #endif |