diff options
-rwxr-xr-x | configure | 624 | ||||
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | doc/jim_tcl.txt | 105 | ||||
-rw-r--r-- | jim-aio.c | 6 | ||||
-rw-r--r-- | jim-eventloop.c | 3 | ||||
-rw-r--r-- | jim-package.c | 2 | ||||
-rw-r--r-- | jim.c | 6 | ||||
-rw-r--r-- | jim.h | 16 |
8 files changed, 727 insertions, 42 deletions
@@ -170,7 +170,8 @@ test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else @@ -553,6 +554,42 @@ PACKAGE_STRING='jim 0.62' PACKAGE_BUGREPORT='steveb@workware.net.au' PACKAGE_URL='' +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# ifdef HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + ac_subst_vars='LTLIBOBJS LIBOBJS LIBDL @@ -571,6 +608,9 @@ build_os build_vendor build_cpu build +EGREP +GREP +CPP SET_MAKE OBJEXT EXEEXT @@ -632,7 +672,8 @@ CC CFLAGS LDFLAGS LIBS -CPPFLAGS' +CPPFLAGS +CPP' # Initialize some variables set by options. @@ -1264,6 +1305,7 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> + CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1383,6 +1425,170 @@ fi } # ac_fn_c_try_compile +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_type + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile + # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. @@ -2647,6 +2853,417 @@ $as_echo "no" >&6; } fi +# Checks for types + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ctype.h> +#include <stdlib.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default" +if test "x$ac_cv_type_long_long" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_LONG_LONG 1 +_ACEOF + +EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LONG_LONG" +fi + + # Shared library support. Because we don't believe in automake! ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -2798,7 +3415,7 @@ $as_echo "enabling jim extensions: $jim_extensions" >&6; } JIM_EXTENSIONS=$jim_extensions for i in $jim_extensions; do - EXTRA_CFLAGS="$EXTRA_CFLAGS -Dwith_jim_ext_$i" + EXTRA_CFLAGS="$EXTRA_CFLAGS -Djim_ext_$i" done JIM_LIBTYPE=static @@ -2816,7 +3433,6 @@ fi JIM_LIBTYPE=$JIM_LIBTYPE - for ac_func in ualarm do : ac_fn_c_check_func "$LINENO" "ualarm" "ac_cv_func_ualarm" diff --git a/configure.ac b/configure.ac index bb2d251..3c3891e 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,9 @@ AC_INIT([jim], [0.62], [steveb@workware.net.au]) AC_PROG_CC AC_PROG_MAKE_SET +# Checks for types +AC_CHECK_TYPES(long long,EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LONG_LONG") + # Shared library support. Because we don't believe in automake! AC_CANONICAL_HOST case $host in @@ -52,8 +55,8 @@ AC_ARG_WITH(jim-ext, AC_MSG_RESULT(enabling jim extensions: $jim_extensions) AC_SUBST(JIM_EXTENSIONS,$jim_extensions) for i in $jim_extensions; do - dnl AC_DEFINE_UNQUOTED(with_jim_ext_$i) - EXTRA_CFLAGS="$EXTRA_CFLAGS -Dwith_jim_ext_$i" + dnl AC_DEFINE_UNQUOTED(jim_ext_$i) + EXTRA_CFLAGS="$EXTRA_CFLAGS -Djim_ext_$i" done JIM_LIBTYPE=static diff --git a/doc/jim_tcl.txt b/doc/jim_tcl.txt index 8212779..fa900f9 100644 --- a/doc/jim_tcl.txt +++ b/doc/jim_tcl.txt @@ -947,6 +947,9 @@ procedure interpreter handles +JIM_RETURN+ codes. The 'catch' command allows Tcl programs to catch errors and handle them without aborting command interpretation any further. +The 'info returncodes' command may be used to programmatically map between +return codes and names. + PROCEDURES ---------- Tcl allows you to extend the command interface by defining @@ -958,7 +961,7 @@ Tcl commands. The 'proc' command is used to create a new Tcl command procedure: - +*proc* 'name args ?statics? body'+ ++*proc* 'name args ?statics? body'+ The new command is name *name*, and it replaces any existing command there may have been by that name. Whenever the new command is @@ -1001,6 +1004,7 @@ required arguments, and there must not be any extra actual arguments (unless the Variable Argument is specified). Actual arguments are assigned to formal arguments as follows: + 1. Left Required Arguments are assigned from the left 2. Right Required Arguments are assigned from the right 3. Default Arguments are assigned from the left, following the Left Required Arguments. @@ -1022,17 +1026,17 @@ Either from the static variable definition, or from the enclosing scope. Consider the following example: - set a 1 - proc a {} {a {b 2}} { + jim> set a 1 + jim> proc a {} {a {b 2}} { set c 1 puts "$a $b $c" incr a incr b incr c } - . a + jim> a 1 2 1 - . a + jim> a 2 3 1 The static variable *a* has no initialiser, so it is initialised from @@ -1149,12 +1153,13 @@ will output: DICTIONARY VALUES ----------------- -In Tcl 8.5 the dict command has been introduced. This provides -efficient access to key-value pairs, just like arrays, but dictionaries -are pure values. This means that you can pass them to a procedure -just as a list or a string. Tcl dictionaries are therefore much -more like Tcl lists, except that they represent a mapping from keys -to values, rather than an ordered sequence. +Tcl 8.5 introduced the dict command, and Jim Tcl has added a version +of this command. Dictionaries provide efficient access to key-value +pairs, just like arrays, but dictionaries are pure values. This +means that you can pass them to a procedure just as a list or a +string. Tcl dictionaries are therefore much more like Tcl lists, +except that they represent a mapping from keys to values, rather +than an ordered sequence. You can nest dictionaries, so that the value for a particular key consists of another dictionary. That way you can elegantly build @@ -1263,7 +1268,7 @@ The finalizer for a reference may be examined or changed with the 'finalize' com newf Lambda ------- +~~~~~~ Jim provides a garbage collected lambda function. This is a procedure which is able to create an anonymous procedure. Consider: @@ -1274,10 +1279,15 @@ which is able to create an anonymous procedure. Consider: 3 jim> set f "" -This create an anonymous procedure, 'f', with a static variable +This create an anonymous procedure (with the name stored in 'f'), with a static variable which is incremented by the supplied value and the result returned. -Once the procedure is renamed to "", the procedure is automatically deleted. +Once the procedure name is no longer accessible, it will automatically be deleted +when the garbage collector runs. + +The procedure may also be delete immediately by renaming it "". e.g. + + jim> rename $f "" BUILT-IN COMMANDS ----------------- @@ -1533,6 +1543,15 @@ Closes the file given by *fileId*. of the 'open' command; after this command, it should not be used anymore. +collect +~~~~~~~ ++*collect*+ + +Normally reference garbage collection is automatically performed periodically. +However it may be run immediately with the 'collect' command. + +See GARBAGE COLLECTION, REFERENCES, LAMBDA for more detail. + concat ~~~~~~ +*concat* 'arg ?arg ...?'+ @@ -1944,6 +1963,20 @@ conditional or looping commands, for example: if {![file exists foo]} then {error {bad file name}} else {...} +finalize +~~~~~~~~ ++*finalize* 'reference ?command?'+ + +If *command* is omitted, returns the finalizer command for the given reference. + +Otherwise, sets a new finalizer command for the given reference. *command* may be +the empty string to remove the current finalizer. + +The reference must be a valid reference create with the 'ref' +command. + +See GARBAGE COLLECTION, REFERENCES, LAMBDA for more detail. + flush ~~~~~ +*flush* 'fileId'+ @@ -2039,6 +2072,15 @@ correctly even if the argument is in braces. The return value from 'format' is the formatted string. +getref +~~~~~~ ++*getref* 'reference'+ + +Returns the string associated with *reference*. The reference must +be a valid reference create with the 'ref' command. + +See GARBAGE COLLECTION, REFERENCES, LAMBDA for more detail. + gets ~~~~ +*gets* 'fileId ?varName?'+ @@ -2287,6 +2329,16 @@ If no signal is specified, SIGTERM is used. An error is raised if the signal could not be delivered. +lambda +~~~~~~ ++*lambda* 'args ?statics? body'+ + +The 'lambda' command is identical to 'proc', except rather than +creating a named procedure, it creates an anonymous procedure and returns +the name of the procedure. + +See 'proc' and GARBAGE COLLECTION, REFERENCES, LAMBDA for more detail. + lappend ~~~~~~~ +*lappend* 'varName value ?value value ...?'+ @@ -2849,6 +2901,21 @@ The following switches modify the behaviour of *regsub* sequences are handled for each substitution using the information from the corresponding match. +ref +~~~ ++*ref* 'string tag ?finalizer?'+ + +Create a new reference containing *string* of type *tag*. +If *finalizer* is specified, it is a command which will be invoked +when the a garbage collection cycle runs and this reference is +no longer accessible. + +The finalizer is invoked as: + + +finalizer 'reference string'+ + +See GARBAGE COLLECTION, REFERENCES, LAMBDA for more detail. + rename ~~~~~~ +*rename* 'oldName newName'+ @@ -2948,6 +3015,16 @@ has been invoked to declare *varName* to be global. The '::' prefix may also be used to explicitly reference a variable in the global scope. +setref +~~~~~~ ++*setref* 'reference string'+ + +Store a new string in *reference*, replacing the existing string. +The reference must be a valid reference create with the 'ref' +command. + +See GARBAGE COLLECTION, REFERENCES, LAMBDA for more detail. + signal ~~~~~~ @@ -98,7 +98,7 @@ static void JimAioDelProc(Jim_Interp *interp, void *privData) if (!(af->OpenFlags & AIO_KEEPOPEN)) { fclose(af->fp); } -#ifdef with_jim_ext_eventloop +#ifdef jim_ext_eventloop /* remove existing EventHandlers */ if (af->rEvent) { Jim_DeleteFileHandler(interp,af->fp); @@ -381,7 +381,7 @@ static int aio_cmd_accept(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return JIM_OK; } -#ifdef with_jim_ext_eventloop +#ifdef jim_ext_eventloop static void JimAioFileEventFinalizer(Jim_Interp *interp, void *clientData) { Jim_Obj *objPtr = clientData; @@ -541,7 +541,7 @@ static const jim_subcmd_type command_table[] = { .function = aio_cmd_accept, .description = "Server socket only: Accept a connection and return stream" }, -#ifdef with_jim_ext_eventloop +#ifdef jim_ext_eventloop { .cmd = "readable", .args = "?readable-script ?eof-script??", .minargs = 0, diff --git a/jim-eventloop.c b/jim-eventloop.c index b7520bb..4c30ee5 100644 --- a/jim-eventloop.c +++ b/jim-eventloop.c @@ -51,6 +51,7 @@ /* POSIX includes */ #include <sys/time.h> #include <sys/types.h> +#include <string.h> #include <unistd.h> #include <sys/select.h> #include <errno.h> @@ -478,7 +479,7 @@ static int JimELAfterCommand(Jim_Interp *interp, int argc, int tlen ; jim_wide remain = 0; const char *tok = Jim_GetString(argv[2], &tlen); - if ( sscanf(tok,"after#%lld",&id) == 1) { + if (strncmp(tok, "after#", 6) == 0 && Jim_StringToWide(tok + 6, &id, 10) == JIM_OK) { remain = Jim_DeleteTimeHandler(interp, id); if (remain > -2) { Jim_SetResult(interp, Jim_NewIntObj(interp, remain)); diff --git a/jim-package.c b/jim-package.c index c0020b2..6796cb0 100644 --- a/jim-package.c +++ b/jim-package.c @@ -89,7 +89,7 @@ static int JimLoadPackage(Jim_Interp *interp, const char *name, int flags) if (p && strcmp(p, ".tcl") == 0) { retCode = Jim_EvalFile(interp, path); } -#ifdef with_jim_ext_load +#ifdef jim_ext_load else { retCode = Jim_LoadLibrary(interp, path); } @@ -4038,10 +4038,10 @@ static const Jim_HashTableType JimReferencesHashTableType = { /* The string representation of references has two features in order * to make the GC faster. The first is that every reference starts - * with a non common character '~', in order to make the string matching - * fater. The second is that the reference string rep his 32 characters + * with a non common character '<', in order to make the string matching + * faster. The second is that the reference string rep is 42 characters * in length, this allows to avoid to check every object with a string - * repr < 32, and usually there are many of this objects. */ + * repr < 42, and usually there aren't many of these objects. */ #define JIM_REFERENCE_SPACE (35+JIM_REFERENCE_TAGLEN) @@ -78,23 +78,11 @@ extern "C" { #include <stdarg.h> /* In order to get type va_list */ /* ----------------------------------------------------------------------------- -* Some /very/ old compiler maybe do not know how to -* handle 'const'. They even do not know, how to ignore -* it. For those compiler it may be better to compile with -* define JIM_NO_CONST activated -* ---------------------------------------------------------------------------*/ - -#ifdef JIM_NO_CONST -# define const -#endif - -/* ----------------------------------------------------------------------------- * System configuration - * For most modern systems, you can leave the default. - * For embedded systems some change may be required. + * autoconf (configure) will set these * ---------------------------------------------------------------------------*/ -#define HAVE_LONG_LONG +/* #define HAVE_LONG_LONG */ /* ----------------------------------------------------------------------------- * Compiler specific fixes. |