ADDED .indent.pro Index: .indent.pro ================================================================== --- /dev/null +++ .indent.pro @@ -0,0 +1,34 @@ +-ncs +-npcs +-nut +-bad +-bap +-bbb +-nbc +-nlp +-ci4 +-br +-ncdb +-nce +-cli4 +-d0 +-di1 +-nfc1 +-i4 +-l100 +-npsl +-TJim_Stack +-TJim_HashEntry +-TJim_HashTableType +-TJim_HashTable +-TJim_HashTableIterator +-TJim_Obj +-TJim_ObjType +-TJim_CallFrame +-TJim_Var +-TJim_Cmd +-TJim_PrngState +-TJim_Interp +-TJim_Reference +-TParseToken +-TParseTokenList Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -1,7 +1,6 @@ RANLIB ?= ranlib -SIZE ?= size # Configuration jim_libtype := @JIM_LIBTYPE@ SH_CFLAGS ?= @SH_CFLAGS@ @@ -13,20 +12,18 @@ # Set an initial, default library and auto_path CFLAGS += -DTCL_LIBRARY=\"/lib/tcl6\" CFLAGS += -DJIM_TCL_COMPAT -DJIM_REFERENCES -CFLAGS += -DHAVE_CONFIG_H -Wall -g $(OPTIM) -I@SRCDIR@ -I. @EXTRA_CFLAGS@ +CFLAGS += -Wall -g $(OPTIM) -I@SRCDIR@ -I. @EXTRA_CFLAGS@ VPATH := @SRCDIR@ ifeq ($(jim_libtype),static) # Emulate tinytcl LIBJIM := libtcl6.a else - #LIBJIM := libjim_shared.so LIBJIM := libtcl6.so - #CFLAGS += -fPIC CFLAGS += $(SH_CFLAGS) endif .EXPORT_ALL_VARIABLES: @@ -39,22 +36,20 @@ .PRECIOUS: jim-%.c # Create C extensions from pure Tcl extensions jim-%.c: %.tcl echo $@ >>.clean - sh @SRCDIR@/make-c-ext.sh $@ $< - -OBJS += load_extensions.o - -TARGETS += $(LIBJIM) jimsh - -all: $(TARGETS) - if [ -d doc ]; then $(MAKE) -C doc all; fi + sh @SRCDIR@/make-c-ext.sh $< >$@ + +OBJS += jim-load-static-exts.o + +all: jimsh + +docs: Tcl.html jimsh: $(LIBJIM) jimsh.o $(CC) $(LDFLAGS) -o $@ jimsh.o $(LIBJIM) $(LDLIBS) @LIBDL@ -lm - $(SIZE) $@ ifeq ($(jim_libtype),static) $(LIBJIM): $(OBJS) $(EXTENSIONS_OBJS) $(AR) cr $@ $^ $(RANLIB) $@ @@ -61,17 +56,15 @@ else $(LIBJIM): $(OBJS) $(EXTENSIONS_OBJS) $(CC) $(LDFLAGS) $(SH_LDFLAGS) -o $@ $^ endif -load_extensions.c: @SRCDIR@/make-jim-load-extensions.sh - sh @SRCDIR@/make-jim-load-extensions.sh $@ $(EXTENSIONS) - -install: +Tcl.html: jim_tcl.txt + asciidoc -o $@ -d manpage $^ clean: - rm -f *.o lib*.a $(TARGETS) load_extensions.c doc/Tcl.html + rm -f *.o lib*.a jimsh Tcl.html if [ -f .clean ]; then rm -f `cat .clean` .clean; fi distclean: clean - rm -f jim.h Makefile config.status config.log + rm -f autoconf.h Makefile config.status config.log rm -rf autom4te.cache Index: README ================================================================== --- README +++ README @@ -114,32 +114,12 @@ Jim was tested under Linux, FreeBSD, MacosX, Windows XP (mingw, MVC). To compile jim itself try: - make jim - -On systems other than GNU/Linux, you may have to compile without "-ldl" -because it's not needed, but will cause a compilation error (no configure for -now... applications embedding Jim will probably have one already). - -In order to avoid to link against 'dl' just use: - - make LIBS="" jim - -For instructions about how to compile extensions just try 'make' -and see the available options. Check also the next section of this file. - --------------------------------------------------------------------------------- -HOW TO COMPILE IN SYSTEMS WITH JUST ANSI-C SUPPORT --------------------------------------------------------------------------------- - -Try: - - make LIBS="" DEFS="-DJIM_ANSIC" jim - -This should compile Jim almost everywhere there is a decent ANSI-C compiler. + ./configure + make -------------------------------------------------------------------------------- EXTENSIONS -------------------------------------------------------------------------------- ADDED README.sqlite Index: README.sqlite ================================================================== --- /dev/null +++ README.sqlite @@ -0,0 +1,177 @@ +Jim Sqlite extension documentation. +Copyright 2005 Salvatore Sanfilippo + + +Overview +~~~~~~~~ + +The Sqlite extension makes possible to work with sqlite (http://www.sqlite.org) +databases from Jim. SQLite is a small C library that implements a +self-contained, embeddable, zero-configuration SQL database engine. This +means it is perfect for embedded systems, and for stand-alone applications +that need the power of SQL without to use an external server like Mysql. + +Basic usage +~~~~~~~~~~~ + +The Sqlite extension exports an Object Based interface for databases. In order +to open a database use: + + set f [sqlite.open dbname] + +The [sqlite.open] command returns a db handle, that is a command name that +can be used to perform operations on the database. A real example: + + . set db [sqlite.open test.db] + sqlite.handle0 + . $db query "SELECT * from tbl1" + {one hello! two 10} {one goodbye two 20} + +In the second line the handle is used as a command name, followed +by the 'method' or 'subcommand' ("query" in the example), and the arguments. + +The query method +~~~~~~~~~~~~~~~~ + +The query method has the following signature: + + $db query SqlQuery ?args? + +The sql query may contain occurrences of "%s" that are substituted +in the actual query with the following arguments, quoted in order +to make sure that the query is correct even if this arguments contain +"'" characters. So for example it is possible to write: + + . $db query "SELECT * from tbl1 WHERE one='%s'" hello! + {one hello! two 10} + +Instead of hello! it is possible to use a string with embedded "'": + + . $db query "SELECT * from tbl1 WHERE one='%s'" a'b + (no matches - the empty list is returned) + +This does not work instead using the Tcl variable expansion in the string: + + . $db query "SELECT * from tbl1 WHERE one='$foo'" + Runtime error, file "?", line 1: + near "b": syntax error + +In order to obtain an actual '%' character in the query, there is just +to use two, like in "foo %% bar". This is the same as the [format] argument. + +Specification of query results +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In one of the above examples, the following query was used: + + . $db query "SELECT * from tbl1" + {one hello! two 10} {one goodbye two 20} + +As you can see the result of a query is a list of lists. Every +element of the list represents a row, as a list of key/value pairs, +so actually every row is a Jim dictionary. + +The following example and generated output show how to take advantage +of this representation: + + . set res [$db query "SELECT * from tbl1"] + {one hello! two 10} {one goodbye two 20} + . foreach row $res {puts "One: $row(one), Two: $row(two)"} + One: hello!, Two: 10 + One: goodbye, Two: 20 + +To access every row sequentially is very simple, and field of a row +can be accessed using the $row(field) syntax. + +The close method +~~~~~~~~~~~~~~~~ + +In order to close the db, use the 'close' method that will have as side effect +to close the db and to remove the command associated with the db. +Just use: + + $db close + +Handling NULL values +~~~~~~~~~~~~~~~~~~~~ + +In the SQL language there is a special value NULL that is not the empty +string, so how to represent it in a typeless language like Tcl? +For default this extension will use the empty string, but it is possible +to specify a different string for the NULL value. + +In the above example there were two rows in the 'tbl1' table. Now +we can add usign the "sqlite" command line client another one with +a NULL value: + + sqlite> INSERT INTO tbl1 VALUES(NULL,30); + sqlite> .exit + +That's what the sqlite extension will return for default: + + . $db query "SELECT * from tbl1" + {one hello! two 10} {one goodbye two 20} {one {} two 30} + +As you can see in the last row, the NULL is represented as {}, that's +the empty string. Using the -null option of the 'query' command we +can change this default, and tell the sqlite extension to represent +the NULL value as a different string: + + . $db query -null <> "SELECT * from tbl1" + {one hello! two 10} {one goodbye two 20} {one <> two 30} + +This way if the emtpy string has some semantical value for your +dataset you can change it. + +Finding the ID of the last inserted row +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is as simple as: + + . $db lastid + 10 + +Number of rows changed by the most recent query +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is also very simple, there is just to use the 'changes' method +without arugments. + + . $db changes + 5 + +Note that if you drop an entire table the number of changes will +be reported as zero, because of details of the sqlite implementation. + +That's all, +Enjoy! +Salvatore Sanfilippo + +p.s. this extension is just the work of some hour thanks to the cool +clean C API that sqlite exports. Thanks to the author of sqlite for this +great work. + +In memory databases +~~~~~~~~~~~~~~~~~~~ + +SQLite is able to create in-memory databases instead to use files. +This is of course faster and does not need the ability to write +to the filesystem. Of course this databases are only useful for +temp data. + +In-memory DBs are used just like regular databases, just the name used to +open the database is :memory:. That's an example that does not use the +filesystem at all to create and work with the db. + + package require sqlite + set db [sqlite.open :memory:] + $db query {CREATE TABLE plays (id, author, title)} + $db query {INSERT INTO plays (id, author, title) VALUES (1, 'Goethe', 'Faust');} + $db query {INSERT INTO plays (id, author, title) VALUES (2, 'Shakespeare', 'Hamlet');} + $db query {INSERT INTO plays (id, author, title) VALUES (3, 'Sophocles', 'Oedipus Rex');} + set res [$db query "SELECT * FROM plays"] + $db close + foreach r $res {puts $r(author)} + +Of course once the Jim process is destroyed the database will no longer +exists. Index: STYLE ================================================================== --- STYLE +++ STYLE @@ -60,6 +60,5 @@ C FEATURES ---------- Only C89 ANSI C is allowed. C99 features can't be used currently. GCC extensions are not allowed. - Index: TODO ================================================================== --- TODO +++ TODO @@ -27,16 +27,10 @@ - Experiment with better ways to do literal sharing. * Currently literal sharing is completely removed. Can it be made efficient? What is the cost vs. benefit? -- Organize the 'script' object so that a single data structure is - used for a full command, and interpolation is done using an - 'interpolation token type' like JIM_TT_VAR and so on. - This way there is no need to run the array of integer objects - with the command structure. Also should help for better cache usage. - IMPLEMENTATION ISSUES - Objects lazy free. - Rewrite all the commands accepting a set of options to use Jim_GetEnum(). @@ -48,9 +42,5 @@ the interpreter is freed all this handles should be closed with dlclose(). REFERENCES SYSTEM - Unify ref/getref/setref/collect/finalize under an unique [ref] command. - -RANDOM THINGS TO DO ASAP - -- .jimrc loading, using the ENV variable ADDED autoconf.h.in Index: autoconf.h.in ================================================================== --- /dev/null +++ autoconf.h.in @@ -0,0 +1,100 @@ +/* autoconf.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `backtrace' function. */ +#undef HAVE_BACKTRACE + +/* Have the dlopen function */ +#undef HAVE_DLOPEN + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `geteuid' function. */ +#undef HAVE_GETEUID + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if the system has the type `long long'. */ +#undef HAVE_LONG_LONG + +/* Define to 1 if you have the `lstat' function. */ +#undef HAVE_LSTAT + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mkstemp' function. */ +#undef HAVE_MKSTEMP + +/* Define to 1 if you have the `realpath' function. */ +#undef HAVE_REALPATH + +/* Define to 1 if you have the `regcomp' function. */ +#undef HAVE_REGCOMP + +/* Define to 1 if you have the `sigaction' function. */ +#undef HAVE_SIGACTION + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strptime' function. */ +#undef HAVE_STRPTIME + +/* Define to 1 if you have the `sysinfo' function. */ +#undef HAVE_SYSINFO + +/* Define to 1 if you have the `sys_siglist' function. */ +#undef HAVE_SYS_SIGLIST + +/* Define to 1 if you have the `sys_signame' function. */ +#undef HAVE_SYS_SIGNAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the `ualarm' function. */ +#undef HAVE_UALARM + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the `waitpid' function. */ +#undef HAVE_WAITPID + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS DELETED config.h.in Index: config.h.in ================================================================== --- config.h.in +++ /dev/null @@ -1,92 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the `backtrace' function. */ -#undef HAVE_BACKTRACE - -/* Define to 1 if you have the declaration of `mkdir', and to 0 if you don't. - */ -#undef HAVE_DECL_MKDIR - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the `geteuid' function. */ -#undef HAVE_GETEUID - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if the system has the type `long long'. */ -#undef HAVE_LONG_LONG - -/* Define to 1 if you have the `lstat' function. */ -#undef HAVE_LSTAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mkstemp' function. */ -#undef HAVE_MKSTEMP - -/* Define to 1 if you have the `regcomp' function. */ -#undef HAVE_REGCOMP - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strptime' function. */ -#undef HAVE_STRPTIME - -/* Define to 1 if you have the `sysinfo' function. */ -#undef HAVE_SYSINFO - -/* Define to 1 if you have the `syslog' function. */ -#undef HAVE_SYSLOG - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the `ualarm' function. */ -#undef HAVE_UALARM - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vfork' function. */ -#undef HAVE_VFORK - -/* Define if mkdir(2) takes a single argument (no mode) */ -#undef MKDIR_ONE_ARG - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS Index: configure ================================================================== --- configure +++ configure @@ -1,8 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for jim 0.62. +# Generated by GNU Autoconf 2.65 for jim 0.63. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -550,12 +550,12 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='jim' PACKAGE_TARNAME='jim' -PACKAGE_VERSION='0.62' -PACKAGE_STRING='jim 0.62' +PACKAGE_VERSION='0.63' +PACKAGE_STRING='jim 0.63' PACKAGE_BUGREPORT='steveb@workware.net.au' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ @@ -593,15 +593,15 @@ # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS +LIBDL SRCDIR EXTRA_CFLAGS JIM_LIBTYPE JIM_EXTENSIONS -LIBDL SH_LDFLAGS SH_CFLAGS host_os host_vendor host_cpu @@ -611,11 +611,10 @@ build_cpu build EGREP GREP CPP -HAVE_LONG_LONG SET_MAKE OBJEXT EXEEXT ac_ct_CC CPPFLAGS @@ -663,10 +662,11 @@ ac_subst_files='' ac_user_opts=' enable_option_checking enable_fork enable_math +enable_ipv6 with_jim_ext with_jim_shared ' ac_precious_vars='build_alias host_alias @@ -1216,11 +1216,11 @@ # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures jim 0.62 to adapt to many kinds of systems. +\`configure' configures jim 0.63 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. @@ -1281,20 +1281,21 @@ _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of jim 0.62:";; + short | recursive ) echo "Configuration of jim 0.63:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-fork do not use fork + --disable-fork do not use fork (no exec, etc.) --enable-math include support for math functions + --enable-ipv6 include ipv6 support in the aio extension Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-jim-ext specify jim extensions to build (or all, which is the default) @@ -1374,11 +1375,11 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -jim configure 0.62 +jim configure 0.63 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. @@ -1702,54 +1703,15 @@ { $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_func - -# ac_fn_c_check_decl LINENO SYMBOL VAR -# ------------------------------------ -# Tests whether SYMBOL is declared, setting cache variable VAR accordingly. -ac_fn_c_check_decl () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5 -$as_echo_n "checking whether $2 is declared... " >&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 -int -main () -{ -#ifndef $2 - (void) $2; -#endif - - ; - return 0; -} -_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_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by jim $as_me 0.62, which was +It was created by jim $as_me 0.63, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ _ACEOF @@ -2092,11 +2054,11 @@ 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 -ac_config_headers="$ac_config_headers config.h" +ac_config_headers="$ac_config_headers autoconf.h" # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3326,14 +3288,12 @@ cat >>confdefs.h <<_ACEOF #define HAVE_LONG_LONG 1 _ACEOF -HAVE_LONG_LONG="#define HAVE_LONG_LONG" fi - # Shared library support. Because we don't believe in automake! ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -3446,11 +3406,11 @@ if test "${enable_fork+set}" = set; then : enableval=$enable_fork; if test "x$enableval" = "xno" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: * disabling fork" >&5 $as_echo "* disabling fork" >&6; } - EXTRA_CFLAGS="-DHAVE_NO_FORK" + EXTRA_CFLAGS="-DJIM_NOFORK" fi fi # Check whether --enable-math was given. @@ -3458,10 +3418,20 @@ enableval=$enable_math; if test "x$enableval" = "xyes" ; then EXTRA_CFLAGS="$EXTRA_CFLAGS -DJIM_MATH_FUNCTIONS" fi + +fi + +# Check whether --enable-ipv6 was given. +if test "${enable_ipv6+set}" = set; then : + enableval=$enable_ipv6; + if test "x$enableval" = "xyes" ; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DJIM_IPV6" + fi + fi jim_extensions="stdlib load package readdir glob array clock exec file posix regexp signal tclcompat aio bio eventloop syslog" @@ -3476,157 +3446,10 @@ fi fi - -for ac_func in backtrace geteuid lstat mkstemp fork strptime sysinfo ualarm -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -for ac_func in vfork -do : - ac_fn_c_check_func "$LINENO" "vfork" "ac_cv_func_vfork" -if test "x$ac_cv_func_vfork" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VFORK 1 -_ACEOF - -else - IGNORE="$IGNORE exec posix signal eventloop" -fi -done - -for ac_func in syslog -do : - ac_fn_c_check_func "$LINENO" "syslog" "ac_cv_func_syslog" -if test "x$ac_cv_func_syslog" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYSLOG 1 -_ACEOF - -else - IGNORE="$IGNORE syslog" -fi -done - -for ac_func in regcomp -do : - ac_fn_c_check_func "$LINENO" "regcomp" "ac_cv_func_regcomp" -if test "x$ac_cv_func_regcomp" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_REGCOMP 1 -_ACEOF - -else - IGNORE="$IGNORE regexp" -fi -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : - LIBDL=-ldl - -else - IGNORE="$IGNORE load" -fi - - -# Does mkdir() include a mode_t argument? -ac_fn_c_check_decl "$LINENO" "mkdir" "ac_cv_have_decl_mkdir" "$ac_includes_default" -if test "x$ac_cv_have_decl_mkdir" = x""yes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_MKDIR $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if mkdir takes 2 arguments" >&5 -$as_echo_n "checking if mkdir takes 2 arguments... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -(void)mkdir("dummy"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define MKDIR_ONE_ARG /**/" >>confdefs.h - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi - - -# Remove extensions in $IGNORE from $jim_extensions - -for i in $IGNORE; do - jim_extensions=`echo "$jim_extensions" | sed -e "s/$i//"` -done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabling jim extensions: $jim_extensions" >&5 $as_echo "enabling jim extensions: $jim_extensions" >&6; } JIM_EXTENSIONS=$jim_extensions for i in $jim_extensions; do @@ -3646,20 +3469,119 @@ fi JIM_LIBTYPE=$JIM_LIBTYPE +for ac_func in ualarm sysinfo lstat fork vfork +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in backtrace geteuid mkstemp realpath strptime +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in regcomp waitpid sigaction sys_signame sys_siglist +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + EXTRA_CFLAGS=$EXTRA_CFLAGS SRCDIR=`dirname $0` + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if test "${ac_cv_search_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_dlopen+set}" = set; then : + break +fi +done +if test "${ac_cv_search_dlopen+set}" = set; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + LIBDL=${ac_cv_search_dlopen%none required} + + +$as_echo "#define HAVE_DLOPEN 1" >>confdefs.h + + +fi + ac_config_files="$ac_config_files Makefile" -ac_config_files="$ac_config_files jim.h" - cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't @@ -4161,11 +4083,11 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by jim $as_me 0.62, which was +This file was extended by jim $as_me 0.63, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS @@ -4223,11 +4145,11 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -jim config.status 0.62 +jim config.status 0.63 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation @@ -4338,13 +4260,12 @@ # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "autoconf.h") CONFIG_HEADERS="$CONFIG_HEADERS autoconf.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "jim.h") CONFIG_FILES="$CONFIG_FILES jim.h" ;; *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1,19 +1,18 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) -AC_INIT([jim], [0.62], [steveb@workware.net.au]) -AC_CONFIG_HEADERS([config.h]) +AC_INIT([jim], [0.63], [steveb@workware.net.au]) +AC_CONFIG_HEADER(autoconf.h) # Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET # Checks for types -AC_CHECK_TYPES(long long,AC_SUBST(HAVE_LONG_LONG,["#define HAVE_LONG_LONG"])) - +AC_CHECK_TYPES(long long) # Shared library support. Because we don't believe in automake! AC_CANONICAL_HOST case $host in *-*-darwin*) @@ -23,15 +22,15 @@ AC_SUBST(SH_CFLAGS,-fPIC) AC_SUBST(SH_LDFLAGS,-shared);; esac AC_ARG_ENABLE(fork, - [ --disable-fork do not use fork], + [ --disable-fork do not use fork (no exec, etc.)], [ if test "x$enableval" = "xno" ; then AC_MSG_RESULT(* disabling fork) - EXTRA_CFLAGS="-DHAVE_NO_FORK" + EXTRA_CFLAGS="-DJIM_NOFORK" fi ], ) AC_ARG_ENABLE(math, [ --enable-math include support for math functions], @@ -38,10 +37,18 @@ [ if test "x$enableval" = "xyes" ; then EXTRA_CFLAGS="$EXTRA_CFLAGS -DJIM_MATH_FUNCTIONS" fi ] +) +AC_ARG_ENABLE(ipv6, + [ --enable-ipv6 include ipv6 support in the aio extension], + [ + if test "x$enableval" = "xyes" ; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DJIM_IPV6" + fi + ] ) jim_extensions="stdlib load package readdir glob array clock exec file posix regexp signal tclcompat aio bio eventloop syslog" AC_ARG_WITH(jim-ext, [ --with-jim-ext specify jim extensions to build (or all, which is the default)], @@ -51,39 +58,10 @@ jim_extensions="$withval" fi fi ] ) - -AC_CHECK_FUNCS([backtrace geteuid lstat mkstemp fork strptime sysinfo ualarm]) - -AC_CHECK_FUNCS(vfork,,IGNORE="$IGNORE exec posix signal eventloop") -AC_CHECK_FUNCS(syslog,,IGNORE="$IGNORE syslog") -AC_CHECK_FUNCS(regcomp,,IGNORE="$IGNORE regexp") -AC_CHECK_LIB(dl, dlopen, AC_SUBST(LIBDL,-ldl), IGNORE="$IGNORE load") - -# Does mkdir() include a mode_t argument? -AC_CHECK_DECLS(mkdir, - [AC_MSG_CHECKING(if mkdir takes 2 arguments) - AC_TRY_COMPILE( - [#include - #include - ], - [(void)mkdir("dummy");], - [AC_MSG_RESULT(no) - AC_DEFINE(MKDIR_ONE_ARG,[],[Define if mkdir(2) takes a single argument (no mode)]) - ], - [AC_MSG_RESULT(yes)], - )] -) - -# Remove extensions in $IGNORE from $jim_extensions - -for i in $IGNORE; do - jim_extensions=`echo "$jim_extensions" | sed -e "s/$i//"` -done - AC_MSG_RESULT(enabling jim extensions: $jim_extensions) AC_SUBST(JIM_EXTENSIONS,$jim_extensions) for i in $jim_extensions; do EXTRA_CFLAGS="$EXTRA_CFLAGS -Djim_ext_$i" done @@ -97,12 +75,19 @@ fi ] ) AC_SUBST(JIM_LIBTYPE,$JIM_LIBTYPE) +AC_CHECK_FUNCS([ualarm sysinfo lstat fork vfork]) +AC_CHECK_FUNCS([backtrace geteuid mkstemp realpath strptime]) +AC_CHECK_FUNCS([regcomp waitpid sigaction sys_signame sys_siglist]) AC_SUBST(EXTRA_CFLAGS,$EXTRA_CFLAGS) AC_SUBST(SRCDIR,`dirname $0`) + +AC_SEARCH_LIBS(dlopen, dl, + AC_SUBST(LIBDL,${ac_cv_search_dlopen%none required}) + AC_DEFINE([HAVE_DLOPEN],[1],[Have the dlopen function]) +) AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([jim.h]) AC_OUTPUT DELETED doc/AIO-Extension.txt Index: doc/AIO-Extension.txt ================================================================== --- doc/AIO-Extension.txt +++ /dev/null DELETED doc/Embedder-HOWTO.txt Index: doc/Embedder-HOWTO.txt ================================================================== --- doc/Embedder-HOWTO.txt +++ /dev/null DELETED doc/Makefile Index: doc/Makefile ================================================================== --- doc/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -TCLSH := $(shell which jimsh) -ifeq ($(TCLSH),) -TCLSH := $(shell which tclsh) -endif - -all: Tcl.html - -Tcl.html: jim_tcl.txt make-index - $(TCLSH) make-index < jim_tcl.txt | asciidoc -o $@ -d manpage - DELETED doc/Sqlite-Extension.txt Index: doc/Sqlite-Extension.txt ================================================================== --- doc/Sqlite-Extension.txt +++ /dev/null @@ -1,177 +0,0 @@ -Jim Sqlite extension documentation. -Copyright 2005 Salvatore Sanfilippo - - -Overview -~~~~~~~~ - -The Sqlite extension makes possible to work with sqlite (http://www.sqlite.org) -databases from Jim. SQLite is a small C library that implements a -self-contained, embeddable, zero-configuration SQL database engine. This -means it is perfect for embedded systems, and for stand-alone applications -that need the power of SQL without to use an external server like Mysql. - -Basic usage -~~~~~~~~~~~ - -The Sqlite extension exports an Object Based interface for databases. In order -to open a database use: - - set f [sqlite.open dbname] - -The [sqlite.open] command returns a db handle, that is a command name that -can be used to perform operations on the database. A real example: - - . set db [sqlite.open test.db] - sqlite.handle0 - . $db query "SELECT * from tbl1" - {one hello! two 10} {one goodbye two 20} - -In the second line the handle is used as a command name, followed -by the 'method' or 'subcommand' ("query" in the example), and the arguments. - -The query method -~~~~~~~~~~~~~~~~ - -The query method has the following signature: - - $db query SqlQuery ?args? - -The sql query may contain occurrences of "%s" that are substituted -in the actual query with the following arguments, quoted in order -to make sure that the query is correct even if this arguments contain -"'" characters. So for example it is possible to write: - - . $db query "SELECT * from tbl1 WHERE one='%s'" hello! - {one hello! two 10} - -Instead of hello! it is possible to use a string with embedded "'": - - . $db query "SELECT * from tbl1 WHERE one='%s'" a'b - (no matches - the empty list is returned) - -This does not work instead using the Tcl variable expansion in the string: - - . $db query "SELECT * from tbl1 WHERE one='$foo'" - Runtime error, file "?", line 1: - near "b": syntax error - -In order to obtain an actual '%' character in the query, there is just -to use two, like in "foo %% bar". This is the same as the [format] argument. - -Specification of query results -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In one of the above examples, the following query was used: - - . $db query "SELECT * from tbl1" - {one hello! two 10} {one goodbye two 20} - -As you can see the result of a query is a list of lists. Every -element of the list represents a row, as a list of key/value pairs, -so actually every row is a Jim dictionary. - -The following example and generated output show how to take advantage -of this representation: - - . set res [$db query "SELECT * from tbl1"] - {one hello! two 10} {one goodbye two 20} - . foreach row $res {puts "One: $row(one), Two: $row(two)"} - One: hello!, Two: 10 - One: goodbye, Two: 20 - -To access every row sequentially is very simple, and field of a row -can be accessed using the $row(field) syntax. - -The close method -~~~~~~~~~~~~~~~~ - -In order to close the db, use the 'close' method that will have as side effect -to close the db and to remove the command associated with the db. -Just use: - - $db close - -Handling NULL values -~~~~~~~~~~~~~~~~~~~~ - -In the SQL language there is a special value NULL that is not the empty -string, so how to represent it in a typeless language like Tcl? -For default this extension will use the empty string, but it is possible -to specify a different string for the NULL value. - -In the above example there were two rows in the 'tbl1' table. Now -we can add usign the "sqlite" command line client another one with -a NULL value: - - sqlite> INSERT INTO tbl1 VALUES(NULL,30); - sqlite> .exit - -That's what the sqlite extension will return for default: - - . $db query "SELECT * from tbl1" - {one hello! two 10} {one goodbye two 20} {one {} two 30} - -As you can see in the last row, the NULL is represented as {}, that's -the empty string. Using the -null option of the 'query' command we -can change this default, and tell the sqlite extension to represent -the NULL value as a different string: - - . $db query -null <> "SELECT * from tbl1" - {one hello! two 10} {one goodbye two 20} {one <> two 30} - -This way if the emtpy string has some semantical value for your -dataset you can change it. - -Finding the ID of the last inserted row -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This is as simple as: - - . $db lastid - 10 - -Number of rows changed by the most recent query -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This is also very simple, there is just to use the 'changes' method -without arugments. - - . $db changes - 5 - -Note that if you drop an entire table the number of changes will -be reported as zero, because of details of the sqlite implementation. - -That's all, -Enjoy! -Salvatore Sanfilippo - -p.s. this extension is just the work of some hour thanks to the cool -clean C API that sqlite exports. Thanks to the author of sqlite for this -great work. - -In memory databases -~~~~~~~~~~~~~~~~~~~ - -SQLite is able to create in-memory databases instead to use files. -This is of course faster and does not need the ability to write -to the filesystem. Of course this databases are only useful for -temp data. - -In-memory DBs are used just like regular databases, just the name used to -open the database is :memory:. That's an example that does not use the -filesystem at all to create and work with the db. - - package require sqlite - set db [sqlite.open :memory:] - $db query {CREATE TABLE plays (id, author, title)} - $db query {INSERT INTO plays (id, author, title) VALUES (1, 'Goethe', 'Faust');} - $db query {INSERT INTO plays (id, author, title) VALUES (2, 'Shakespeare', 'Hamlet');} - $db query {INSERT INTO plays (id, author, title) VALUES (3, 'Sophocles', 'Oedipus Rex');} - set res [$db query "SELECT * FROM plays"] - $db close - foreach r $res {puts $r(author)} - -Of course once the Jim process is destroyed the database will no longer -exists. DELETED doc/Tcl.html.supplied Index: doc/Tcl.html.supplied ================================================================== --- doc/Tcl.html.supplied +++ /dev/null DELETED doc/jim_man.txt Index: doc/jim_man.txt ================================================================== --- doc/jim_man.txt +++ /dev/null @@ -1,98 +0,0 @@ -Jim(n) -====== - -NAME ----- -Jim - a better Tcl - -SYNOPSIS --------- - - cc -ltcl6 - -or - - jimsh