Index: xotcl/COMPILE =================================================================== diff -u --- xotcl/COMPILE (revision 0) +++ xotcl/COMPILE (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,134 @@ +$Id: COMPILE,v 1.1 2004/05/23 22:50:39 neumann Exp $ +******************************************************** +XOTcl Compilation Guide (Unix) +******************************************************** + +Note, that there is a file "COMPILE.win" describing Windows compilation. +Read this file, if you plan to build XOTcl under Windows. + +First, you have to get the necessary sources: + - Before you can start, you have to get the full sources of + XOTcl. These are packed in a tar.gz file, like xotcl-XXXXX.tar.gz, + and they are available from: + + http://www.xotcl.org + + - To compile XOTcl the sources of Tcl (and optionally Tk) are + needed. Tcl (and optionally Tk) must be installed properly. You get + the Tcl/tk sources from: + + www.tcl.tk + + The best is to unpack and compile Tcl (and optionally Tk) in the + same directory as XOTcl, so that XOTcl's configure can find it + automatically. For compilation instruction see Tcl's documentation. + + +The following steps have to be performed in order to +build XOTcl: + + 1) untar XOTcl in a directory of your choice by using one of: + + gunzip < xotcl-XXXXX.tar.gz | tar -xvf - + + or on some systems: + + tar xvfz xotcl-XXXXX.tar.gz + + + 2) run configure by issuing in the unix directory: + + cd xotcl*/unix + ./configure + + on some platforms (e.g. under Windows Environment with + CygWin) you may have to type in "sh configure" explicitly. + + If you have Tcl, Tk, and XOTcl built in your home directory + and you want to install in standard locations, a simple configure + without arguments should be sufficient. You + can avoid searching/override the settings with + the follwoing switches: + + --prefix=DIR Place where lib/packages are + to be installed (default: /usr/local) + --exec-prefix=DIR Place where xotclsh/xowish + are to be installed (default: /usr/local) + --with-actiweb Build Actiweb packages as well + (per default deactivated) + --with-xotclsh Build xotclsh (per default deactivated) + --with-xwish Build xowish (per default deactivated) + --with-gdbm=GDBM_INCLUDE_DIR,GDBM_LIB_DIR + absolute path to gdbm.h and optionally + the path to the gdbm library. The directory infos + may be omitted + --with-gdbm Build XOTcl Gdbm + (per default deactivated) + --with-tcl=DIR Where to find a compiled Tcl version, i.e. + where to find tclConfig.sh + Note that you need a source built of + Tcl (including generic/tclInt.h)! + --with-tk=DIR Where to find a Tk version, i.e. + where to find tkConfig.sh. An installed + version is sufficient. It must be the same + Tk version as the version of the used Tcl. + --with-tk-include=DIR directory containing the public Tk header files + --with-all Turns on all options (actiweb, gdbm, + xotclsh, xowish) + + NOTE: the directories specified by DIR should not be addressed relatively: + be sure to use only absolute path names + (those starting with "/") only. + + NOTE: Tcl (and Tk if you build xowish) have to be installed. You + require a Tcl source build (of the same version as installed) + as well. + + Example: + + ./configure --prefix=/usr --exec-prefix=/usr --with-tcl=/home/uzdun/tcl8.3.0 --with-tk=/usr/lib --with-gdbm + + this has the following implications: + - the shells are installed in /usr/bin + - the libs are installed in /usr/lib and /usr/lib/xotcl-. + - Tcl 8.3.0 from /home/uzdun/tcl8.3.0 is used. + - The installed Tk from /usr/lib is used. + - XOTcl is compiled with Gdbm support. + + 3) now you can make XOTcl and the configured packages with + + make + + which should be actually a GNU make (sometimes called gmake). + + There are a couple of compiler options, that can make the compiled + binary faster. On a Pentium 4 PC under Linux, i would recommend + to compile with + + make CFLAGS_DEFAULT='-O3 -mcpu=i686 -Wall -fomit-frame-pointer' + + 4) install with: + + make install + + + If you only want to build/install xotcl/xowish without packages + you can switch to xotcl-XXX directory and do there: + + ./configure + make + make install + + You can test XOTcl by switching to the src directory and by running: + + make test + + +Good Luck! + +Please report bugs and problems to the authors under one of these +mail adresses: + + uwe.zdun@wu-wien.ac.at, zdun@xotcl.org + gustaf.neumann@wu-wien.ac.at, neumann@xotcl.org + Index: xotcl/COMPILE.win =================================================================== diff -u --- xotcl/COMPILE.win (revision 0) +++ xotcl/COMPILE.win (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,77 @@ +$Id: COMPILE.win,v 1.1 2004/05/23 22:50:39 neumann Exp $ +******************************** +XOTcl Windows compilation guide: +******************************** + +- Consider to get a binary distribution of XOTcl from: + + http://www.xotcl.org + +- XOTcl compiles with the Visual CC Compiler + +Visual CC Compilation: +********************** + +In order to compile with VCC the following steps have to be performed: + +1) Get tcl/tk sources, compile tcl and/or tk, and install them properly. + To compile XOTcl the sources of Tcl (and optionally Tk) are + needed. Tcl (and optionally Tk) must be installed properly. You get + the Tcl/tk sources from: + + www.tcl.tk + + For compilation instruction see Tcl's documentation. + +2) Set the PATH environment to the Tcl binary directory. For instance + in the DOS box you may write something like: + SET PATH=c:\Progra~1\Tcl\bin;%PATH% + where "c:\Progra~1\Tcl\bin" is the Tcl binary directory. + +3) Before you can start, you have to get the full sources of + XOTcl. These are packed in a tar.gz file, like xotcl-XXXXX.tar.gz, + and they are available from: + + http://www.xotcl.org + + Untar the xotcl source. You can do it using a program like Winzip + or with the tar command (e.g. in the cygwin distrbution). + + Change into the win directory. + + cd win + + Open the file "configs.vc". Edit the + first lines with the path information for your system, i.e., where + to find tcl and tk sources and where to find the VCC compiler, and + where tcl/tk binaries are installed. + +4) In the 'win' directory, invoke: + + nmake -f makefile.vc + + to compile xotcl.dll, XOTclSdbm, and Expat. + Moreover, package information and XOTcl documentation will be built. + + You can build the xotclsh/xowish (per defaul deactivated), if you + need them: + + nmake -f makefile.vc xotclshells + + +5) Optionally, you may test the XOTcl build: + + nmake -f makefile.vc test + +6) Now you can install XOTcl with: + + tclsh83 installWin.tcl + + More installation notes can be found in the README file. + + +Please report bugs and problems to the authors under one of these +mail adresses: + + uwe.zdun@wu-wien.ac.at, zdun@xotcl.org + gustaf.neumann@wu-wien.ac.at, neumann@xotcl.org Index: xotcl/COPYRIGHT =================================================================== diff -u --- xotcl/COPYRIGHT (revision 0) +++ xotcl/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/ChangeLog =================================================================== diff -u --- xotcl/ChangeLog (revision 0) +++ xotcl/ChangeLog (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,2227 @@ +2004-05-22 Gustaf.Neumann@wu-wien.ac.at + * fixed path for installing files in Makefile.in (many thanks to Jeffrey Hobbs) + * fixed path searching in xotcl.m4 + +2004-05-07 Gustaf.Neumann@wu-wien.ac.at + * fixed compiled problems under HPUX (with the help of Attila Dona') + * fixed some compiler warnings in tcl-expat showing up (some are still missing) + with -Wall -Wconversion -Wno-implicit-int + +2004-04-30 Gustaf.Neumann@wu-wien.ac.at + * removed duplicates from results from [obj info methods] + * fixed GENERIC_HDRS in configure.in and Makefile.in + * fixed documentation bugs for "info children" and + "info classchildren" + * fixed an incorrect error message, when method called + from a mixin was not found. + +2004-04-25 Gustaf.Neumann@wu-wien.ac.at + * alloc returns name of created object + * On an "Object create ::o1 -noinit" the noinit option + deactivates the search for default values (as used in the serializer) + * TEA3 changes: + - re-included xotclConfig.sh file in xotcl dependent libraries + - fixed variable contents in xotclConfig.sh file + - passing of include and spec file for gdbm + +2004-04-10 Gustaf.Neumann@wu-wien.ac.at + * start to move to TEA3 + * moved tcl scripts xotclsh and xowish intp apps/utils + * made minimal build independent from tclsh; + new target libraries-pkgindex, fulldoc, doc removed from default targets + * at least for the time being, no static shells + +2004-03-23 Gustaf.Neumann@wu-wien.ac.at + * added a flag --with-aolserver3 to configure and removed + the checking of the current directory to determine whether + or not to compile an AOLserver 3.* module. Thanks + to Jim Lynch to suggestion it. + +2004-03-03 Gustaf.Neumann@wu-wien.ac.at + * fixed a potential crash in procSearch method (Thanks to + Artur Trzewik for the good error report) + +2004-02-29 Gustaf.Neumann@wu-wien.ac.at + * callMethod* calls DoDispatch instead of ObjDispatch + * adding a callStackPush() for XOTclOEvalMethod() such that + 'o eval self' returns '::o' + +2004-02-21 Gustaf.Neumann@wu-wien.ac.at + * added link to XOTcl wiki to xotcl homepage. + +2004-02-20 Gustaf.Neumann@wu-wien.ac.at, Uwe Zdun + * release of distribution XOTcl 1.2.0 + +2004-02-17 Uwe Zdun + * fixed a Tcl_Obj ref count free that was called too early. + * fixed support for Visual CC debugger + * fixed Win version info + +2004-02-16 Gustaf.Neumann@wu-wien.ac.at + * fixed a reference to a structure of a destoyed object + +2004-02-16 Uwe Zdun + * added self class and self proc context to GuardCall + * removed guardedScope and info guardedlevel completely from the code + -> use parameters instead (see tutorial) + * rewritten the tutorial text for mixin/filter guards completely + * added new files to Win makefile.vc + +2004-02-14 Gustaf.Neumann@wu-wien.ac.at + * experimental new command "self guardedlevel" as replacement + for getGuardedScope + * added documentation for self callinglevel, self activelevel and + the methods upvar and uplevel + * used a bold font for predefined Tcl and XOTcl words in the HTML + version of the tutorial + +2004-02-13 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c more code cleanup: + - some minor performance improvement + - used the same idiom for iterating over a class hierarchy consistently + - simplified the usage of ComputeOrder() and let the optimizer do more work + +2003-02-04 Uwe Zdun + * xotcl: removed MixinRemoveFromMixinStack, MixinRemoveFromCmdPtr, + MixinRemoveOnObjFromCmdPtr, FilterRemoveFromFilterStack, + FilterRemoveFromCmdPtr, FilterRemoveOnObjFromCmdPtr ... and + replaced with simple forward stepping in cmd list. + * made the mem count work with multi, single-threaded interpreters + +2003-02-03 Uwe Zdun + * testx: tests for CmdListReplaceCmd, MixinRemoveFromMixinStack, + MixinRemoveFromCmdPtr, MixinRemoveOnObjFromCmdPtr, + XOTclOGetGuardedScopeMethod, XOTcl_InterpObjCmd, XOTclOVwaitMethod, + * xotcl: removed XOTclAssertionRename, simplified XOTcl_RenameObjCmd + * corrected mistakes in tutorial code for filterguards. + +2004-01-31 Gustaf.Neumann@wu-wien.ac.at + * performed coverage analysis of regression test + * changed unsuccessful branches into asserts + * extended testx.xotcl for better coverage + +2004-01-28 Gustaf.Neumann@wu-wien.ac.at + * Streamlined code; removed mixinChainOn from mixinStack and + filterChainOn from filterStack and use callstack + frameTypes instead. + * some performance improvements + +2004-01-27 Gustaf.Neumann@wu-wien.ac.at + * implemented uplevel method + (uses [self callinglevel] when no level specified) + * fixed a bug in next, when methods on the same object are called + from within a mixin class and filters are defined + * some performance improvements + +2004-01-19 Gustaf.Neumann@wu-wien.ac.at + * added more test cases, + * upvar method fully functional + * simplified CallFrame management on XOTcl stack + (wish, CallFrame had ClientData !!!) + * Reduced size of XOTclCallStackContent + * modularized xotcl more (new file xotclShadow.c; all shadowing + of Tcl commands and access of gobal tcl obj commands is treated there) + * included a fix from Zoran for thread exit handlers. + +2004-01-16 Gustaf.Neumann@wu-wien.ac.at + * defined upvar method (uses [self callinglevel] when no level specified) + * simplified stringIncrement method and added a couple of assert(). + +2004-01-15 Gustaf.Neumann@wu-wien.ac.at + * allow volatile to be called from toplevel + * decrementing refcount of global objects as needed + (some had a high increment) + +2004-01-14 Gustaf.Neumann@wu-wien.ac.at + * method 'new' now uses StringIncr, which replaces the name + generation based on numbers by a name generation based on strings. + The strings are constructed by small and capital letters plus digits + and correspond to a number of a number system with the basis + of 26+26+10=62. These strings can grow up to memory size. + XOTcl can run as a server practically infinitely long generating + objects with 'new'. + + * new package xotcl::upvar-compat + This package provides backward compatibility with + earlier versions of xotcl that redefined upvar/uplevel + such that these commands ignore inactive filter and mixin + frames (upvar behaves the same whether or not a filter is + installed). Newer scripts should use + upvar/uplevel [self callinglevel] var/command + instead. This package can be used via + + package require xotcl::upvar-compat + + * moved resetting of shadowed tcl commands after the deletion + of object (as suggested by Zoran) + +2004-01-11 Gustaf.Neumann@wu-wien.ac.at + * all occurances of uplevel/upvar equipped with [self callinglevel] + such that library works with standard uplevel/upvar + * faster version of new method (more than 20% faster, using c-variable, + faster long to ascii conversion) + * objinst (of oo-bench) about 17% faster + +2004-01-10 Gustaf.Neumann@wu-wien.ac.at + * polished macros XOTcl_FrameDecls, XOTcl_PushFrame, XOTcl_PopFrame + (2 versions, slower version with less dependencies on tclInt.h) + * removed mixinCalls and filterCalls from interpreter state. + * removed unneeded macros + +2004-01-08 Gustaf.Neumann@wu-wien.ac.at + * fixed bug on exit, when no threads are enabled + (different cleanup strategy in threads) + * fixed crash on deleted Tcl_Cmd, when xotcl debugging output + is turned on + * some more code cleanup + +2004-01-07 Gustaf.Neumann@wu-wien.ac.at + * removed varFramePtr from xotcl callstack + * removed unneeded variables from runtime state + * resetting of csc->callsNext after a next call + * added "methods" to info info + +2004-01-06 Gustaf.Neumann@wu-wien.ac.at + * cutting of callframes removed completely + * 2 new subcommands for self: + - self callinglevel: returns the tcl stack level to address + the invocation of the actual method + - self activelevel: returns the topmost active stack entry from the + xotcl stack + Both commands return the absolute level number (syntax #n) if called + from an xotcl method or 1 if called from a tcl proc. These subcommands + are designed to be used in the form of "upvar [self callinglevel] a b" + * Replaced C implementation of uplevel and upvar (with callstack + manipulation) by a simple Tcl proc that uses [self callinglevel] + as default level (if is was not called with an explicit level). + * Extended test suite + * Changed all variables of type "Interp *" to "Tcl_Interp *" + and defined macros Tcl_Interp_XXXX to access component XXXX + * Changed all variables of type "CallFrame *" to "Tcl_CallFrame *" + and defined macros Tcl_CallFrame_XXXX to access component XXXX + +2004-01-04 Gustaf.Neumann@wu-wien.ac.at + * callstack manipulation reduced significantly + * speedup on xoRDF.test about 7% + * self callingobject/callingclass/.... refers always to + last invocation (ignoring next-chain) + * consequence: mixins and filters are transparent on the callstack + * possible extension "self previous ?n?" similar to "self next" + to obtain information about next chain + * possible extension "self level ?n?" similar to "info level ?n?" + to obtain information about call stack + +2004-01-02 Gustaf.Neumann@wu-wien.ac.at + * Changed all variables of type "Namespace *" to "Tcl_Namespace *" + and defined macros Tcl_Namespace_XXXX to access component XXXX + * generalized invocation on callProcCheck and + handling of calldata in new function DoCallProcCheck + * overall code cleanup + * extended test suite with tclmd and insttclcmd + +2004-01-01 Gustaf.Neumann@wu-wien.ac.at + * fixed loop on invocation of methods registered by + the tclcmd method + * allowed to register fully qualified commands via + tclcmd or insttclcmd + * made insttclcmd to work from mixin or instmixclasses + * renamed "next" method to "__next" + * restored old behavior of defaultmethod + +2003-12-31 Gustaf.Neumann@wu-wien.ac.at + * Changed all variables of type "Command *" to "Tcl_Command" + and defined macros Tcl_Command_XXXX to access component XXXX + * new predefined method self: [ self] returns fully + qualified name of object + * potential incompatibility: + calling an object without name does not return fully + qualified name, use "self" method (see above) instead. + To keep backward compatibility, define + Object instproc defaultmethod {} {return [my self]} + * New method " next" can be used to invoke next + on the last recent invocation of a method on . + must be on the callstack, otherwise an error message + is generated + * The new defaultmethod calls next on parent object to + prohibit shadowing of methods through sub-objects + +2003-12-28 Gustaf.Neumann@wu-wien.ac.at + * new functions: CallStackUseActiveFrames()/CallStackRestoreSavedFrames() + to to avoid walking through and modifying the whole stack + when locating an active frame to set variables + (using in -volatile, instvar, info defaults) + callstackcutframes still used in info level, uplevel, upvar, + info callingproc, callingclass, callingobject + +2003-12-25 Gustaf.Neumann@wu-wien.ac.at + * update of various library functions (such as Httpd) to + use sub-objects as methods (avoids calls of [self]::objname) + +2003-12-19 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: allow to call sub-objects as methods via "my" + +2003-12-16 Gustaf.Neumann@wu-wien.ac.at + * added logdir as parameter for Place (HttpPlace) + * fixed handling of content-length == 0 in Httpd.xotcl + to avoid Problem with microsoft explorer's WebDav queries + +2003-11-13 Gustaf.Neumann@wu-wien.ac.at, Uwe Zdun + * release of distribution XOTcl 1.1.1 + +2003-12-13 Gustaf.Neumann@wu-wien.ac.at + * Removed dependency that certain variable references in + tclConfig.sh (such as TCL_SHARED_LIB_SUFFIX='${VERSION}${DBGX}.so'); + There was a problem on freebsd systems that use hardcoded "84" + instead of version in this definition, which leads to a problem + when the SHARED_LIB_SUFFIX is used with different VERSIONs + (such as in XOTcl). We set now the suffixes as follows + + eval "SHARED_LIB_SUFFIX=${VERSION}${TCL_DBGX}${TCL_SHLIB_SUFFIX}" + eval "UNSHARED_LIB_SUFFIX=${VERSION}${TCL_DBGX}.a" + + and pass it through xtoclConfig.sh to the c based c-components + (sdbm, gdbm, expat) + +2003-12-08 Gustaf.Neumann@wu-wien.ac.at + * Some cleanup in tclexpat.c to make it compile on freebsd + * configure: made --with_gdbm configurable such that + include path and library path can be configured + * Httpd.xotcl: added simple redirects, can be used like e.g. + Httpd h2 -port 9086 -root /tmp \ + -redirect {^(mailman|pipermail|cgi-bin) + http://alice.wu-wien.ac.at:80} + +2003-12-07 Gustaf.Neumann@wu-wien.ac.at + * incorporated more fixes for build system suggested by Daniel Steffen + * changed version number to 1.1.1 + * further cleanup in Makefiles, reduced redundancy in distro by using + symbolic links + * used everywhere for SHLIB_LD_LIBS XOTCL_BUILD_STUB_LIB_SPEC instead + of XOTCL_STUB_LIB_SPEC + +2003-12-06 Gustaf.Neumann@wu-wien.ac.at + * httpd.xotcl: fixed return format in HTTP reply header parameters + Allow: and Public: for HTTP OPTIONS method + * library/store/XOTclGdbm/: fixed initialization of + xotcl stubs, usage of ck{free,alloc} vs. {free,malloc}. + * library/store/XOTclSdbm/: fixed handling of O_SYNC on + system that do not have it + * Configure can run now as well from outside of xotcl sources; + One can use now for example the following commands to compile and + install XOTcl + + % mkdir -p /tmp/xotcl/unix + % cd /tmp/xotcl/unix + % ~/xotcl-1.1.1/unix/configure --with-all + % make + % make test + % make install DESTDIR=/tmp + +2003-12-05 Gustaf.Neumann@wu-wien.ac.at + * incoporated changes as suggested by Daniel Steffen + - using consequently DESTDIR for all directory references + - made procs in predefined.xotcl independent + from namespace import ::xotcl::* + - make references relative to $(srcdir) in all Makefile.in + +2003-12-02 Gustaf.Neumann@wu-wien.ac.at + * added "--with-tkinclude" + * fixed "--with-tclinclude" to set TCL_INCLUDES (for all subdirs) + +2003-11-29 Gustaf.Neumann@wu-wien.ac.at, Uwe Zdun + * release of distribution XOTcl 1.1.0 + +2003-11-29 Gustaf.Neumann@wu-wien.ac.at + * moved tcl command hooks into thread local storage + to fix a bug, when xotcl is loaded into a thead + * fixed various documentation bugs, added style files for + XOTcl tutorial, made presentation more uniform, made + distinction between literals and placeholders visible + * fixed a few issues with purify and mt (many thanks to Zoran!) + * some Makefile improvements (removed the need to generate + documentation on each run of make) + * Fixed compilation issues of expat with tcl 8.3 or younger + +2003-11-28 Gustaf.Neumann@wu-wien.ac.at + * fixed include path for actiweb components (sdbm and expat) + * extended transparent mixins for upvar, uplevel + * extended regression test + +2003-11-27 Uwe Zdun + * added new version of Klaus' securePlaceDemo, some minor + corrections for new XOTcl version + * installed XOTcl library into lib directory under + windows instead of bin + +2003-11-26 Gustaf.Neumann@wu-wien.ac.at + * removed ::xotcl::lib from predefined variables and from man page + * added namespace require to xotclsh + * added transparent mixins for instvar + +2003-11-25 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: further generalization of call stack entry + skipping; cutFrames can skip now over filters and/or mixins + * "Class new -volatile" works now through filters and mixins + * regression test updated + * reduced size of xotcl distro + * fixed various typos in language reference + +2003-11-22 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: generalized cutting of call stack entries to + skip either filters or mixins + * "Class new -volatile" works now through mixins for create + * added test to regression test (testx) + * xotcl.c: some cleanup and speedup + * updated aol-xotcl.tcl (for loading xotcl into aolserver 4.0) + +2003-11-20 Uwe Zdun + * updated documentation: + - added a section "Integrating XOTcl Programs with C Extensions + (such as TK)" to the tutorial + - updated tutorial, readme, compile, compile.win + +2003-11-16 Gustaf.Neumann@wu-wien.ac.at + * Httpd.xotcl: forced HTTP/1.1 requests over SSL + to use HTTP/1.0 due to a problem between OpenSSL + and certain incarnations of IE. + * Documenting requireNamespace in more detail. + +2003-11-13 Uwe Zdun + * various changes to support conditional shell building with stubs + * various changes to build libxotcl/xotclsh with tcl 8.0 + (stub dependencies) + * Httpd.xotcl: added parameter to web server to + configure timeout for persistent connections + * eliminated a few compiler warnings from xotcl.c + +2003-11-12 Gustaf.Neumann@wu-wien.ac.at + * removed namespace import/forget in predefined.xotcl + * Makefile cleanup (fixed duplicate dependencies, quoting in loops) + * added tests for xoRDF and Persistence, when actiweb is enabled + * building expat, when actiweb is enabled + * removed needless files from xotcl-distribution. + +2003-11-09 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: fixed calling exit-handler twice for threads + +2003-11-06 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: simplified handling of command substitutions; + starts to work with Zoran's nstrace.tcl for AOLserver + +2003-11-02 MichaelL@frogware.com + * XOTcl Stub lib configure files for C-based extensions. + +2003-11-02 Gustaf.Neumann@wu-wien.ac.at + * XOTcl intercepts a few commands (info, rename, uplevel and + upvar) and assumed that these commands are defined in C. + Command intercepting was fixed such that intercepting + a proc info works as well; before xotcl produced a core. + Example: + % rename ::info ::tcl::info + % proc ::info args {uplevel ::tcl::info $args} + % package req XOTcl + +2003-10-31 Gustaf.Neumann@wu-wien.ac.at + * Substituted config/config.sub and config/config.guess + (many thanks to Zoran) + * unix/Makefile.in fixed target install-aol + +2003-10-23 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: new proc "__unknown" for Class; whenever + XOTcl references a class, which is not defined yet, + "Class __unknown" is called; this mechanism can be + used to autoload classes in a lightweight fashion + * fixes in the built system to avoid two different + "package ifneeded" (seems to cause troubles under + certain circumstances) + +2003-10-20 MichaelL@frogware.com + * Fixed the return value of TclExpatUnknownEncodingHandler + in tclexpat.c. The return value of the handler is now + correctly passed to expat. + +2003-10-14 MichaelL@frogware.com + * Changed library names on Windows to make library names more + similar across platforms. Changed xotcl.c and xotclStubLib.c + to support XOTcl stubs. Changed Windows Makefile.vc's to + build all libraries with XOTcl stubs by default. Changed + Windows Makefile.vc's to specify base load addresses for all + libraries. Fixed compiler warnings in winMain.c. Fixed + compiler warnings in tclexpat.c. + +2003-10-08 Uwe Zdun + * a number of changes to make XOTclSdbm and XOTclGdbm work + with xotcl.h solely ... in particular, introduced new stub + functions and Interface structs for XOTclClass and XOTclObject: + XOTcl_Class and XOTcl_Object. Changed XOTcl's core to expose + these in the extern functions that are exposed via xotcl.decls. + +2003-09-10 Uwe Zdun + * Integrated bug fixes provided by Klaus Kolowratnik + for the secure http server. + +2003-08-27 Uwe Zdun + * moved config.vc, installWin.tcl to win dir and corrected them + * merged /makefile.vc and /win/makefile.vc; everything for win + now works from the win dir + * adapted other makefile.vc's in distro + * corrected stub table decls and auto generated table .h files + that where incorrect due to recent changes in external API + (XOTclRemoveClass, XOTclAddClass) + * corrected README + * added pkgIndex file for win local dir + * win version change to 1.1 + * corrected the wrong local TCLLIBPATH on unix from '$(TOP_DIR)' + to '$(TOP_DIR)/unix $(TOP_DIR)/library' to circumvent the win + dir on the auto_path + * added locale support to xotclAppInit + +2003-08-27 Gustaf.Neumann@wu-wien.ac.at + * went with spell checker over tutorial and + fixed a hundred of typos + * fixed install of shells + * fixed optional built of xowish (TK_LIB_SPEC was not passed correctly) + * removed obsolete check_library_path in predefined.xotcl + * some fixes in ::xotcl::config mkindex for autoloadine files + +2003-08-26 Uwe Zdun + * doc for precedence order and transitive instmixins in tutorial + +2003-08-25 Gustaf.Neumann@wu-wien.ac.at + * Generate library/pkgIndex.tcl from configure + (contains version numbers) + * Fixed script for changing version numbers in xotcl + * Changed version of XOTcl to 1.1.0 + +2003-08-22 Uwe Zdun + * Added support for transitive instmixins in xotcl.c, + added test for transitive instmixins + * Various fixes for new build stuff on Windows + +2003-08-20 Gustaf.Neumann@wu-wien.ac.at + * Fixed configure problem with autoconf coming with RH 9.0 + * Allow for the definition of parameters as objects. + It is now possible to have parameters with properties + (See tutorial, section "Objects as Parameter") + * fixed various bugs in the documentation. + MAKE TODO: make rpm, bin-tar, version-change, install-aol + +2003-07-13 Gustaf.Neumann@wu-wien.ac.at + * Fixed potential crash with shared objects in configure + * First version of object tree creation via parameter + +2003-07-11 Gustaf.Neumann@wu-wien.ac.at + * extended parameter handling code to support the creation + of parameter objects + * fixed a few documentation bugs + +2003-07-05 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: if object is called without method and + arguments, xotcl calls now a method named 'defaultmethod'; + the default behavior (defined as an instproc on + Object) is that the name of the object is returned. + Example: + Object o + puts <[o]> ;# outputs <::o> + puts <[o defaultmethod]> ;# outputs <::o> + +2003-06-28 Gustaf.Neumann@wu-wien.ac.at + * added --with-xotclsh and --with-xowish to create + shell optionally + +2003-05-28 Uwe Zdun + * added "info mixinguard" and "info instmixinguard" + * changed GuardList behavior to tolerate qualified names + * added tests for 'info instmixinguard' and 'info mixinguard' + * made -withGuard and -order work together for "info filter" + on objects. + * checked that guard is deleted, when redefined + with FilterAdd/MixinAdd + * add -guard modifier into filter, mixin definitions and infos + * updated tests + +2003-05-23 Gustaf.Neumann@wu-wien.ac.at + * removed toplevel configure and Makefile for better + TEA compliance + (configure should be called from xotcl*/unix) + * added --with-actiweb to configure; + (use --with-actiweb=yes to enable it) + * standarized tests (using the same Test classes) + +2003-05-16 Gustaf.Neumann@wu-wien.ac.at + * removed binary shells and XOTcl's context depending + auto_path setting; consequences: + - in order to invoke xotcl before installation, use + export TCLLIBPATH=`pwd` + in XOTcl's build directory + - instead of using the environment variable XOTCL + (as described in this Changelog on 2001-01-08, + use TCLLIBPATH + * Two small tcl scripts "xotclsh" and "xowish" are provided + for backward compatibility with xotclsh applications + * For interactive use, adding + package require XOTcl; namespace import -force xotcl::* + into your ~/.tclshrc is recommended + * Various changes and simplifications in configure and Makefiles + * XOTclGdbm: fixed it such it works with enable-threads without + crashing immediately + +2003-05-12 Uwe Zdun + * removed various bugs in new code and added tests for + redefinition and removal of filterguards + * added tests for 'instmixinguard' and 'mixinguard' + +2003-05-11 Uwe Zdun + * added new methods 'instmixinguard' and 'mixinguard' + +2003-05-09 Uwe Zdun + * changed the filter, mixin, and guard code to provide a new + composition strategy for (filter- and mixin-)guards, in + case a guard is defined more than once for the same filter + or mixin... now only the most specific guard counts, all + others are overridden by this guard. Example: + Class B -superclass A + A instfilter {{f2 {[self] == "::b2"}}} + B instfilter {{f2 {[self calledproc] == "set"}}} + Here: for an instance of B only the guard on B counts. + * updated the tests accordingly + * performance improvement: + removed ::xotcl::Object from mixin full list computation + * added new tests for mixinguards to testx.xotcl + +2003-05-03 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: Changed mixinlist creation from quadratic to linear + (both, in XOTclAddClass and CmdListAdd) + +2003-04-29 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: cleanup to avoid potential crashes on error messages + (varargs not terminated by NULL) + * introspection for mixin guards (o|cl info instmixin|mixin -guards) + * new option for info methods to return only those methods where + the guard holds in the current context (info methods -incontext) + +2003-04-25 Gustaf.Neumann@wu-wien.ac.at + * fixed various typos in examples in tutorial + * first implementation of guarded mixins + +2003-04-24 Uwe Zdun + * document "info instdefault" in the language reference + * corrected a problem with move: it did not prevail the subclass + relationships; also added a regression test + +2003-04-22 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: calling the "create" method from + the "new" method through the dispatcher (previous version + used a direct call, now create can be overloaded) + +2003-04-17 Uwe Zdun + * Unified ListObjChildren and ListClassChildren into one method + ListListChildren + +2003-04-16 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: fixed segfault from classchildren + (many thanks to Michael Cleverly for pointing this out) + +2003-04-16 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: Fixed passing of error codes from constructors + (instproc init). In previous releases, errors were + ignored + * xotcl.c: Passing correctly error messages from "set" to the + XOTcl set method. + +2003-03-19 Gustaf.Neumann@wu-wien.ac.at, Uwe Zdun + * release of full distribution XOTcl 1.0.2 + +2003-03-19 Gustaf.Neumann@wu-wien.ac.at, Uwe Zdun + * release of full distribution XOTcl 1.0.2 + +2003-03-19 Uwe Zdun + * changed requireNamespace so that contents of a Tcl Namespace + with the same name as the XOTcl Namespace to be created survive + the requireNamespace invocation & added tests in testx.xotcl. + Example: + namespace eval a {proc o args {puts o}} + Object a -requireNamespace + ### -> a::o survives + * some minor issues to everything work with tcl/tk 8.4.2 + +2003-03-08 Gustaf.Neumann@wu-wien.ac.at, Zoran Vasiljevic + * some more code cleanup (do not abort when my is called outside + the scope of an object) + * Makefile less verbose + +2003-03-07 Gustaf.Neumann@wu-wien.ac.at + * Made output of the serializer more compact (omitting unneccessary + references to ::xotcl::Object + +2003-03-07 Uwe Zdun + * Copy/Move to self had undefined or wrong results; corrected + both methods so that the objects stay untouched when copied or + moved to self. Added test in testx.xotcl. + +2003-03-04 Gustaf.Neumann@wu-wien.ac.at, Zoran Vasiljevic + * Made xotcl capable to be loaded via "package require" into + aolserver-4 + * To build and install XOTcl for the aolserver-4 + the following commands can be used + + # cd /usr/homes/zv/tmp/xotcl-1.0.2 + # CC=gcc;export CC + ./configure --enable-threads --prefix=/var/tmp/aolserver \ + --enable-symbols --without-tk --without-gdbm \ + --with-tcl=/usr/homes/zv/dev/tcl8.4.1/unix + # make + # make install-aol + + This installs libxotcl*.so, the serializer, and the + file xotcl.tcl into aolserver/modules/tcl. The file xotcl.tcl + contains a "package require XOTcl" and "... serializer" + and sources the files aolserver/modules/tcl/*.xotcl + +2003-03-04 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: abort, when a non-threaded xotcl version + is loaded into a threaded environment (e.g. aol-server) + +2003-02-28 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: fixed a bug the lead to a crash in "self x" + +2003-02-20 Gustaf.Neumann@wu-wien.ac.at + * fixes to compile xotcl as a module for aolserver-4 + +2003-02-06 Gustaf.Neumann@wu-wien.ac.at + * made -volatile a method rather than an option of the + new method + +2003-01-18 Gustaf.Neumann@wu-wien.ac.at + * aol-server adjustments (fix the documentation + for new directory strucure, update serializer code, testing) + * provided simple replacements for xotclsh and xowish scripts + in the unix subdir for testing purposes (not yet installed) + +2003-01-17 Uwe Zdun + * new directory structure with no version information + * removed pwd from make.xotcl + * new method "ismixin": Test whether the argument is a + mixin or instmixin of the object. + * new method "hasclass": Test whether the argument is either + a mixin or instmixin of the object or + if it is on the class hierarchy of the object. + This method combines the functionalities of + istype and ismixin. + * documented and tested new methods. + +2003-01-12 Gustaf.Neumann@wu-wien.ac.at + * Changed calls in the form of "[self] method" to "my method" + in 59 files in the xotcl distribution + * changed Serializer to use [list] in configure where necessary + +2003-01-09 Gustaf.Neumann@wu-wien.ac.at + * configure methods can be placed into a list to avoid + ambiguity of "-". This character is used as a metachar to + denote method names, but it has to be used in values as well. + Example: + Class Book -parameter {title author} + Book b1 -title "--the title--" -author a.b.c + has to be written as + Book b1 [list -title "--the title--"] -author a.b.c + Note, that XOTcl allows us to provide multiple arguents + to methodss called via configure + +2003-01-05 Gustaf.Neumann@wu-wien.ac.at + * configure returns now the number of preceding elements + without a "-" in its first place. This is needed + for conveniant processing of argument lists with trailing + options from tcl. + * avoid processing configure list twice in c code. + +2002-12-29 Gustaf.Neumann@wu-wien.ac.at + * some cleanup in c-code (to make -Wall slient) + * fixed a bug in the "all" method of the Serializer, changed + package name to "xotcl::serializer" + +2002-12-27 Gustaf.Neumann@wu-wien.ac.at + * removed deprecated methods "parameters", "applymethods", + "newChild", "newChildOf" + +2002-12-23 Gustaf.Neumann@wu-wien.ac.at + * release of full distribution XoTcl 1.0.1 + +2002-12-22 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: some cleanup + * aol-server: improved namespace.tcl (using Serializer) + +2002-12-19 Gustaf.Neumann@wu-wien.ac.at + * New Serialzer: + - up to 30% faster recreation of objects + - more control of objects or variables to be omitted + - provide mappings for (relative) object names + In general, the Serializer + - is used to generate the blueprint of a workspace + (e.g. in the aolserver) + - can be used migate objects between threads + - to cache objects in the aol-server + For details, see doc. + +2002-12-18 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: new predefined method 'noinit' + can be used to create an object without calling its + constructor (used in the serializer to recreate objects + from a snapshot) + +2002-12-17 Uwe Zdun + * installWin.tcl: correction for patchlevel + * changed version to 1.0.1 + +2002-12-14 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c fixed a bug in "info default arg var" and + "info instdefault arg var" in connection with filters. + The output variable was created in the filter frame. + Many thanks to Oumung Mehrotra for reporting the problem. + * New switch for compilation USE_ASSOC_DATA to use Tcl_AssocData + instead of namespace client data for the runtime state + (without assoc data, 10-15% faster) + +2002-12-06 Uwe Zdun + * changed recreate semantics: recreate now calls the cleanup + method; so that one can preserve object information in the + recreate, call next (and do the cleanup), and finally handle + the correction for recreation. + * tutorial: added example of structure preserving recreate and + updated langRef.xotcl accordingly + +2002-11-22 Gustaf.Neumann@wu-wien.ac.at + * fixes in documentation + * automatic generation of pdf files and make target + for the tutorial and the language reference + +2002-11-19 Gustaf.Neumann@wu-wien.ac.at + * fixes for configure for aolserver 3.5.* + +2002-11-13 Uwe Zdun + * correct check for XOTcl lib on auto_path in predefined.xotcl; + it was checked for xotcl$VERSION, should be xotcl$VERSION + +2002-11-08 Gustaf.Neumann@wu-wien.ac.at +2002-11-08 Uwe Zdun + * Win makefile.vc: let nmake install call the install script + * removed "class" hook from recreate ... + * updateding AOL-server patch and README + * finshing rpm and bin-tar generation + * release of full distribution XoTcl 1.0 + +2002-11-06 Uwe Zdun + * let the Unix Makefile also (try to) cleanup Win->Release dirs + +2002-10-30 Uwe Zdun + * fixes for tcl 8.0.5 + +2002-10-28 Uwe Zdun + * used a proc for exit handler (instead of Object variable), + old interface for exitHandler does still work + * eliminated a mem leak in FilterFindReg as indicated by + Zoran. + +2002-10-26 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: fixed problem with external symbol for + cmdType and reactivated KEEP_TCL_CMD_TYPE for all + tcl versions + +2002-10-25 Zoran Vasiljevic + * xotcl.c: fixed memory leak for new method. + +2002-10-23 Uwe Zdun + * Object instproc extractConfigureArg: get one configure argument + (and possibly cut it) from a given args list. Especially used in + create before init is called with next to get args + before the object is actually created (& documentation). + +2002-10-22 Uwe Zdun + * used Tcl's Assoc structures for runtime state + +2002-10-21 Uwe Zdun + * corrected "abstract" next handling in predefined.xotcl + +2002-09-19 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: prevent duplicate destroy calls during cleanup + * xotcl.c: error in exit handler does not panic anymore, but + writes to stderr (panic can't be used when exit handler + is called by a thread) + * Serializer.xotcl: {Serializer all] return exit handler + as well. + +2002-09-14 Gustaf.Neumann@wu-wien.ac.at + * Trace.xotcl: fixed typos in documentation code, changes + for "my". + +2002-08-29 Uwe Zdun + * corrected findXOTcl.c: it got confused by an toplevel + XOTcl dir, like: ~/xotcl-1.0/x/xotcl-full-1.0 and didn't find + the libs then. + +2002-08-27 Uwe Zdun + * disabled KEEP_TCL_CMD_TYPE for 8.4, as it did not compile for 8.4b1 + +2002-08-04 Gustaf.Neumann@wu-wien.ac.at + * Httpd.xotcl: order directories before files in directory + listings + +2002-07-18 Gustaf.Neumann@wu-wien.ac.at + * Httpd.xotcl: fix for handling broken links + +2002-07-12 Uwe Zdun + * Win fixes for compilation with Tcl 8.4b1 + * fixed mem leak of filter search + +2002-07-10 Gustaf.Neumann@wu-wien.ac.at + * fixes for compilation with Tcl 8.4b1 + +2002-07-06 Gustaf.Neumann@wu-wien.ac.at + * Fixed a compilation bug concerning Tcl 8.2 and younger + +2002-05-30 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: fixed destroy bug, when object was destroyed + during init + * xotcl.c: minor cleanup + +2002-05-16 Uwe Zdun + * xotcl.c: searching filter start commands again, if order is + invalidated. Otherwise filter commands of de-registered mixins + persist to be a filter. If no other filter or instfilter with + the name is found, the filter entry is removed from the filter + list. + +2002-05-15 Uwe Zdun + * COMPILE: an explicit sentence in the beginning that you need + Tcl/Tk sources to compile XOTcl. + * xotcl.c: FilterSearch has only search for object-specific + filters in the object's current order ... that was a bug. It + has to search for filters on mixins and instmixins as they are + specified by filter and instfilter. fixed. + * xotcl.c: Filter application order was: object filters -> mixin + filters -> class filters. Corrected to mixin filters -> object + filters -> class filters. Now it conforms to the order on + normal dispatches. + * xotcl.c: changed fatal abort to error, when self is called + without an active object + +2002-05-05 Gustaf.Neumann@wu-wien.ac.at + * fixed UTF-8 conversion for filenames + +2002-04-30 Gustaf.Neumann@wu-wien.ac.at + * Httpd.xotcl: minor cleanup (removed superfluous instvars) + * xotcl.c: removed incr/decr refcount on cl-names in DoDispatch + +2002-04-21 Gustaf.Neumann@wu-wien.ac.at + * fixed a bug in path settings: + when xotclsh was called from an xotcl source directory where + no libxotcl*.so was located (e.g. before a compile) an error + was produced during load; xotclsh checks now whether it can + locate the .so file before setting the path. + +2002-04-20 Uwe Zdun + * fixed a bug in filter code (recursion blocking) + +2002-04-20 Gustaf.Neumann@wu-wien.ac.at + * Http client code: fixed several small bugs: + - url composition + - error handling + - redirects to different ports + +2002-04-09 Uwe Zdun +2002-04-09 Gustaf.Neumann@wu-wien.ac.at + * finshing rpm and bin-tar generation + * patch release of full distribution (0.9.4) + +2002-04-08 Gustaf.Neumann@wu-wien.ac.at + * fixed a bug in copy/move (the constructor was called during + copying without instvars etc.; now the construcor is not + called here) Many thanks for Artur Trzewik for noting this. + +2002-04-08 Uwe Zdun + * fixed .add files for Windows + +2002-04-07 Gustaf.Neumann@wu-wien.ac.at + * removed persistence dir in actiweb regression test to achieve + same behavior on each run of the test + * Storage.xotcl: fixed a bug when new persistence directories are + created + * fixed a small memory leak in autonames + +2002-04-05 Gustaf.Neumann@wu-wien.ac.at + * defined the following policies for excplicit freeing in the + exit handler: + + NO_CLEANUP for processes, the physical free in the exit handler + is not needed + + CLEANUP for threads, just the xotcl classes/objects with + its instvars are reclaimed, annother + mechanism should take care of the global + procs and vars (automatically choosen, when + compiled with TCL_THREADS) + + FULL_CLEANUP for testing purposes, to check, whether xotcl + has memory leaks; all global procs and vars + are deleted as well. + +2002-04-04 Gustaf.Neumann@wu-wien.ac.at + * fixed a bug with duplicated tcl_objs of XOTclObjectType + that could cause double frees. + +2002-04-02 Gustaf.Neumann@wu-wien.ac.at + * Less agressive converison to tcl_objs of XOTclObjectType. + It will try to keep objects of type tclCmdType when + KEEP_TCL_CMD_TYPE is activated during compilation (default). + +2002-03-28 Gustaf.Neumann@wu-wien.ac.at + * horrible bug fixed, when USE_ALLOCA or USE_MALLOC + was defined (macro substitution lead to wrong arithmetic). + These macros were defined for c-compilers that do not + support variable sized arrays as local variables. Gcc + were always fine, but e.g. under the standard AIX compiler + array boundaries were overwritten... I wonder, why we have + seen no bug reports, this bug was in since ages.... + +2002-03-27 Zoran Vasiljevic + * more code for volatile objects moved to C + +2002-03-26 Gustaf.Neumann@wu-wien.ac.at + * Fixed a few more places, where recounted xotcl-objects + can cause troubles (mem-leaks + invalid pointers) + +2002-03-24 Gustaf.Neumann@wu-wien.ac.at + * auto-deletion of global vars and proc to + get rid of references to xotcl-objects for deletion + +2002-03-20 Uwe Zdun + * added reference counts for xotcl objects to + avoid crashes for recreated objects (thanks for + Artur Trzewik for sending a good bug report) + +2002-03-11 Zoran Vasiljevic + * xotcl.c: fixed XOTclReplaceCommand for AOL-Server + (multi threading bug) + +2002-03-11 Gustaf.Neumann@wu-wien.ac.at + * Httpd.xotcl: fixed relative pathname-bug for basic authentification + +2002-03-02 Gustaf.Neumann@wu-wien.ac.at + * marked newChild as deprecated (use new -childof) + +2002-03-02 Gustaf.Neumann@wu-wien.ac.at + * Changed name of selfdispatch to "my" + +2002-03-01 Gustaf.Neumann@wu-wien.ac.at + * Httpd.xotcl: allow encoded characters in path and resource names + * Httpd.xotcl: use dictionary oder for directory listings + * Mime.xotcl: added some more default mime times + +2002-02-24 Gustaf.Neumann@wu-wien.ac.at + * Httpd.xotcl: added functionality to provide directory listings + * Httpd.xotcl: create specified root directory if it does not + exist + +2002-02-13 Gustaf.Neumann@wu-wien.ac.at + * Makefile.in: fixed a bug in make install + ("package require package" did not work) + +2002-02-12 Gustaf.Neumann@wu-wien.ac.at + * HttpPlace: added Pragma no-cache for dynamic contents + * overworked persistence manager to separate storage + specific concerns (like directory checking) from generic ones + * new storage manager multi-storage to multiplex storage + requests to multiple sinks. + +2002-01-10 Uwe Zdun + * removed duplicated system library in library/system. The correct + one is in xotcl-XXX/library!! + +2002-01-09 Gustaf.Neumann@wu-wien.ac.at + * fixed path determination code during + startup to avoid "cant read 'pf'" messages + +2002-01-08 Uwe Zdun + * introduced bcc (copy) database option for persistent databases and + configuration option for db file names and dirs in actiweb + places + * xotcl.c: found and fixed a small bug in unknown: + Object o; o r + with no unknown defined has looped (not for class -> unknown). + corrected it and added it to testx.xotcl + +2002-01-06 Gustaf.Neumann@wu-wien.ac.at + * further improvement of bytecode compilation + * new bytecode instruction SELFDISPATCH + * methcall benchmar now more than 40% faster than in 0.9.3 + * some cleanup in xotcl dispatch code + * fixing external references for symbols not starting with xotcl + +2002-01-02 Gustaf.Neumann@wu-wien.ac.at + * new xotcl byte codes for XOTcl primitives next, self, + and initProcNS. Speedup for the oo-shootout + + methcall 30% + + objinst 9% + some tests are now twice as fast than before, self is + now 10 times faster (about 1 microsecond on a 600 MHz PIII) + +2001-12-28 Gustaf.Neumann@wu-wien.ac.at + * fixed changeXOTclVersion, made more generic + * fixed Agent migration, made all migrations synchronous + (for the time being) + +2001-12-17 Uwe Zdun +2001-12-17 Gustaf.Neumann@wu-wien.ac.at + * finshing rpm and bin-tar generation + * patch release of full distribution (0.9.3) + +2001-12-10 Uwe Zdun + * removed two "! test" so that configures work with sh on Solaris + * added make bin-tar target + * removed all compiler warnings on windows + +2001-12-09 Gustaf.Neumann@wu-wien.ac.at + * revived configure-code for aolserver, added patchlevel + to log message, updated aolserver README file + * renamed directory "script-creation" to "serialize" + * deactivated create of unneeded installed dirs + (xotclexpat, xotclgdbm, xotclsdbm) + +2001-12-07 Uwe Zdun + * documented recent changes in XOTcl for release + +2001-12-05 Gustaf.Neumann@wu-wien.ac.at + * fixed call to unknown in copy method + +2001-12-01 Uwe Zdun + * xotcl.c: xotcl::interp rewritten + +2001-11/12 Uwe Zdun + * changed xotcl support a (more or less) TEA compliant + build process, use Tcl stub lib, and make shells + only shallow wrappers that load the XOTcl package + on demand + +2001-10-23 Gustaf.Neumann@wu-wien.ac.at + * removed code for calling variable command + +2001-10-22 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: fixed bug for empty superclass list + * fixed stub-install under 8.0.5 + +2001-10-20 Gustaf.Neumann@wu-wien.ac.at +2001-10-20 Uwe Zdun + * patch release of source distribution (0.9.1) + +2001-10-20 Gustaf.Neumann@wu-wien.ac.at + * reimplemented method 'new' of Class in C + * various cleanups for stub handling + * added regression test for stub library + +2001-10-18 Uwe Zdun + * removed linking glitch in 0.9: stub enabled lib was linked + with non-stub enabled obj-files. + * added a stub enabled lib to Windows make procedure + * renamed stub enabled lib to (lib)xotcl-tclstubs.(so|dll) + +2001-10-17 Uwe Zdun + * removed "can't instvar to link" problem during aliasing + to a link var + +2001-10-15 Gustaf.Neumann@wu-wien.ac.at +2001-05-15 Uwe Zdun + * XOTcl 0.9 Release + +2001-10-14 Gustaf.Neumann@wu-wien.ac.at + * new method of Object: parametercmd: + a conveniant way to define a new getter/setter for + individual objects (similar to paramters for classes) + * polishing docu + +2001-10-11 Gustaf.Neumann@wu-wien.ac.at + * improved make clean + * fixed incompatibilities in various + scripts distributed with xotcl + +2001-10-11 Uwe Zdun + * configure.in: fixed that --without-tk functions + ensured that user-defines with --with-tcl/tk + override found settings. + * xotcl.c: + - conditional for different TclIncrVar2 interfaces + in Tcl 8.05 and Tcl 8.3 + - added TCL_PARSE_PART1 to variable lookup in + GetInstVarIntoCurrentScope. TclLookupVar in 8.05 + requires it for looking up arrays with onyl part1 + given. + +2001-10-10 Gustaf.Neumann@wu-wien.ac.at + * fixed autoname method for Tcl 8.0.5 + +2001-10-10 Uwe Zdun + * finished polishing mem leaks (thanks to Zoran Vasiljevic again) + * disallowed "[self] next" ... next is now only a command + * Gdbm,Sdbm,Expat: corrected Makefile.in to rely on + -L$(TCLLIBDIR) (thanks to J�rg Rudnik for the hint) + +2001-10-08 Gustaf.Neumann@wu-wien.ac.at + * configure.in: fixes for AOLSERVER to ease configuration + * aolstub.c: fixes for namespace handling (XOTcl is + now a "well behaved" Tcl extension) + +2001-10-05 Uwe Zdun + * added PRESERVE and RELEASE functions for Tcl_Objs so that + we remember all Tcl_Objs that are temporarily allocated, + otherwise the ExitHandler would not free Tcl_Objs, like: + INCR_REF_COUNT(tclobj); + callaMethodContainingExit(); /* "exit" call */ + DECR_REF_COUNT(tclobj); /* not reached */ + * corrected filtersearch and procsearch to return the new + proc qualifier format: + proc|instproc + as a Tcl list. filtersearch does now operate on objs as well, + procsearch does support mixins now. Added tests for both. + * documented new features in tutorial and langRef + +2001-10-04 Uwe Zdun + * minor fixes to get WIN version to run again + +2001-10-03 Uwe Zdun + * removed some more mem leaks, + * reworked exit handler to destroy metaclasses and operate on a + instance list, instead of namespace cmdTable + * pop remaining callstack entries in ExitHandler to prevent + from false deletion order, if "exit" is called from within a + method + * changed XOTclErrInProc not to rely on obj/class Tcl_Obj* + so that we do not have to preserve them in DoDispatch + (mem problem) + +2001-10-02 Uwe Zdun + * added a optional simple mem counter functionality. DEFINE + XOTCL_MEM_COUNT so that you get a mem count dump after exit. + * removed some mem leaks + +2001-10-01 Uwe Zdun + * new info option "info methods" ... returns all methods (procs + and cmds) defined along the hierarchy for an object. + accepts modifiers: -noprocs, -nocmds, -nomixins + +2001-09-30 Uwe Zdun + * don't allow duplicates in filter/mixin structures (e.g. info + filter has returned "b c b", now the filter appears only + once. Filterguards are merged into one guard. + * new modifier "-order" for info filter and info mixin -> + returns order on a particular object, for filters with + syntax " proc/instproc " for mixins just a + class list + +2001-09-26 Gustaf.Neumann@wu-wien.ac.at + * cleanup, removed a few bugs + * new instproc for Class: insttclcmd + creates an instmethod with the given name + that calls the Tcl command with the given name in the + variable environment of the object + * renamed instproc of Class parameteradd to: instparametercmd + * xotcl.c: more complete set of tracing options for debugging + * some speedups: + - instcommand array, append, lappend trace + are now more than 3 times faster than before + (through insttclcmd) + - condition checking (for pre and post conditions and guards) + is as well more than 3 times faster than before + * configure.in: made -Wall conditional for gcc + +2001-09-25 Uwe Zdun + * merge with Gustaf's version + +2001-09-23 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: new XOTclObject member "flags", which + is a bitmap for various object states + (isClass, isDestroyed, etc.). Defined several + according macros XOTclObjectIsClass(obj), + XOTclObjectToClass(obj), etc. + * revitalized Tcl_Obj of type XOTclObj to speedup + access of Objects and classes by using + GetXOTclObjectFromObj + GetXOTclClassFromObj + (speedup of create by 15%, a few simple commands + are now more than twice as fast (Object isclass)) + +2001-09-20 Uwe Zdun + * xotcl.c: + - made objectData structure optional and moved + functions into file xotclObjectData.c + use XOTCL_OBJECTDATA to compile it in + - moved obj & cl clientDatas into optional memory, new extern + getter/setter functions: XOTclSetObjClientData, + XOTclGetObjClientData, XOTclSetClassClientData, + XOTclGetClassClientData. Used them in persistence store + wrappers xotclSdbm.c & xotclGdbm.c + * testx.xotcl: + - Added some obj filter tests + +2001-09-19 Uwe Zdun + * xotcl.c: + - added "opt" structures to XOTclObject and XOTclClass so that + optional info (filters, mixins, asssertion,...) is only + allocated on demand + - corrected bug ... search for epoched filter cmd in + FilterRemoveOnObjFromCmdPtr also in mixins + - added flags to XOTclObject instead of filterDefined, + mixinDefined, and destroyCalled shorts + +2001-09-18 Uwe Zdun + * xotcl.c: removed object reference code ... I guess we won't do + references this way + +2001-09-17 Uwe Zdun + * xotcl.c: added new instcommand "vwait" on object that mirrors + the behavior of Tcl's vwait, but does not operate on flag + TCL_GLOBAL_ONLY. The new xotcl obj var tables do not operate with + that. E.g.: + Object instproc vwait {varName} { + [self] instvar $varName + ::vwait [list $varName] + } + would wait for a global variable varName ... though: + Object instproc vwait {varName} { + [self] requireNamespace + ::vwait [self]::[list $varName] + } + should work ... + * xotcl.c: info classparent now returns object name of class, not + ::xotcl::classes*** + * xotcl.c: new method "objeval" on Object. It executes an command + in the scope of an object. This is an important convenience + method because something like: + Object instproc lappend {varName args} { + [self] instvar varName + eval ::lappend [list $varName] $args + } + is problematic if the object has a namespace and varName is an + array element ... then Tcl does want to upvar it (was also + present in all earlier xotcl versions ... we have used an + instvar alias then). Now we can do: + + Object instproc lappend {varName args} { + [self] objeval [concat ::lappend [list $varName] $args] + } + This is easier an faster than using an alias ... + +2001-09-16 Uwe Zdun + * predefined.xotcl: + - new method "trace" on Object ... simple forwarder to tcl's trace + - eliminated "cset" on Object and from the distribution, seems to + be nearly unused + * whole distr: + - replaced direct namespace variable accesses with [self] or + instvar accesses. Here's what I did: + (a) grep for <[self]::> + (b) grep for plus <::> together in one line + (c) grep for <}::> to get e.g. ${a}::b + that should find most occurrences of variable namespace access, + except for direct accesses like: set y::x, where y is an object + name and c a variable to be set. + +2001-09-15 Uwe Zdun + * xotcl.c: + - Namespaces of objects are now created only on demand, + that is when: + - obj proc is created + - obj command is created with XOTclAddPMethod + - child is created on the object + Note that this is a prominent change. Especially it saves a + significant amount of memory allocation per object. But you + cannot assume the existence of object namespaces anymore. + That means: + Object o + set o::var 1 + returns TCL_ERROR: parent namespace does not exist. Use + o set var 1 + instead. Same appears for append, lappend, trace, array and + other Tcl variable handling commands. + "info exists" is problematic because it does not return an + error message: + Object o + o set i 1 + info exists o::i + returns 0. + It is save to use all Tcl command together with instvar. + + - new method "requireNamespace" on Object. Creates an object + namespace explicitly. + - new info option "hasNamespace" on Object: returns 1, if the obj + currently has a namespace, otherwise: 0. + - eliminated "returnCode" on RUNTIME_STATE due to several bugs, + why was it there??? + +2001-09-14 Uwe Zdun + * xotcl.c: + - Changed XOTclCInfoMethod to be based on two switch statement + instead of ifs. Let List* functions return the state (such + as TCL_OK). + - introduced code for modifiers in info methods. Modifiers are + "-" options that change the behavior of an info method + - introduced -guard modifier for filter and instfilter (it + prints a filter list with guards) + +2001-09-13 Uwe Zdun + * xotcl.c: + - eliminated some flaws in filterguards + - forbid "new" filtering during checking a filterguard + +2001-09-06 Uwe Zdun + * xotcl.c: + - also allowed instfilters on a mixin class of an object + +2001-09-03 Uwe Zdun + * xotcl.c: + - bug corrected: filter correctly removed from all dependent + classes when filter proc is deleted or superclass is changed + - bug corrected: added cmdEpoch check on computation of full + filter/mixin lists + +2001-09-03 Gustaf.Neumann@wu-wien.ac.at + * various cleanup and fixes due to new features + +2001-09-03 Uwe Zdun + * testx.xotcl: + - filterguard tests + * xotcl.c: + - bug corrected: filter order invalidation upon new proc/instproc + ... for filter inheritance + +2001-08-25 Uwe Zdun + * xotcl.c: + - new filter guards language construct for constraining filter + appliance + - introduced generic Tcl_obj* list instead of + XOTclAssertion*, + +2001-08-24 Uwe Zdun + * xotcl.c: + - CallStackGetFrame: iterate only over INACTIVE filters (was a bug) + - self filter & mixinsinfos: determine info position from + callstack with CallStackGetFrame, so that uplevel functions with + [self calling*,called*] + - NextMethod: passed XOTCL_UNKNOWN through at end of mixin/filter + chain, if no method was found. + * testx: added tests for these corrections. + +2001-08-23 Uwe Zdun + * xotcl.c and tests: added initProcNS command executed at + beginning of all XOTcl procs/instprocs ... it prevents from + jumping to the object's namespace, when a proc is opened. + Now: + namespace eval html { + Object o + o proc t {} {puts ns=[namespace current];li} + o t + } + results in: + li + ns=::html + + Now inside of a namespace, like ::Object, you can call global + methods, like ::set without preceding "::" ... + + => Incompatibility to former versions: direct XOTcl proc + calls, like: + Object rp + rp proc time {cmd time} {...} + rp proc x { + time "set x 3" t + } + are invalid ... you have to write: + rp proc x { + [self] time "set x 3" t + } + +2001-08-20 Uwe Zdun + * xotcl.c and all tests: moved Object, Class, and @ into ::xotcl + namespace, now + namespace import -force xotcl::* + has to be written at the beginning of each script to have + them in the global namespace. + - info options now return ::xotcl::Object, ::xotcl::Class, and + ::xotcl::@ + - direct sets and unsets of variable are not possible anymore: + "Object set a 5" functions, but not "set Object::a 5", + but "set xotcl::Object::a 5" is ok + +2001-08-20 Uwe Zdun + * xotcl.c and all tests: moved xotcl classes from ::XOTclClasses + to ::xotcl::classes + +2001-08-20 Uwe Zdun + * Actiweb -> made it run with new filter code ... what you have to + change on your existing code to make it run: + 1. change all invocations of "filter" to "instfilter" + 2. same for "info filter" to "info instfilter" + 3. same for "filterappend" to "instfilterappend" + 4. for all filters on metaclasses: you must not provide the + metaclass name anymore, the filter finds it + automatically, say, if you have a metaclass C and a + filter f, you had to write: + A filter C::f + now this is + A instfilter f + 5. replace regclass with [lindex [self filterreg] 0] ... + may be changed again + +2001-08-17 Uwe Zdun + * xotcl.c: integrated complete rewrite of filter code with + per-object filters + +2001-08-13 Gustaf.Neumann@wu-wien.ac.at + * patch release of source distribution (0.85.3) + * following naming conventions of Tcl for minor changes + +2001-08-11 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c. predefined.xotcl: fast parameter inst-commands + * xotcl.c: new instcommand for Object: parameteradd + (to register the instcommand for parameters) + * xotcl.c: applymethods renamed to configure + * xotcl.c: small speedup for assertion checking + * xotcl.c: simplified set methods + +2001-08-09 Gustaf.Neumann@wu-wien.ac.at + * fixes for actiweb (agent migration was broken) + * comm/Access.xotcl: a response to an HTTP-PUTS request should + not contain a body. If it does, Httpd complains shortly + and accepts it. + * mos/Agent.xotcl: fixed obsolete code (callcoder) + * mos/AgentManagement.xotcl: fixed broken RDF-interface + +2001-08-04 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c reduced size of XOTclObject structure from + 172 bytes to 68 bytes by allocating assertion + structures on demand and by deactivating per + default the old metadata structures + +2001-08-02 Gustaf.Neumann@wu-wien.ac.at + * integrating AOL-server-changes from Zoran, solution for + threads, stublib and older tcl-versions + * improved stubs support + * generating a stub library src/libxotclstub.so + * AOL_DEFINES in Makefile (automatically activated + when xotcl is compiled within the source tree + of aolserver + * configure.in: using exec_prefix for platform dependent files + * new target: make libs (for AOL-server) + +2001-07-23 Gustaf.Neumann@wu-wien.ac.at + * improved parameter support (see apps/scripts/parameter.xotcl) + * custom setter/getter methods + * xotcl.h: make it usable from C++ + +2001-07-13 Uwe Zdun + * TextFileStorage: bug in opening files with + TextFileStorage eliminated + * MemStorage: fix for Mem Storage to support lazy + persistence (mem store persists object destroy) + * Persistence.test: new test LotsOfObjects + +2001-07-13 Gustaf.Neumann@wu-wien.ac.at + * patch release of source distribution (0.85-p2) + +2001-07-10 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: first draft of new implementation of parameter + see apps/scripts/parameter.xotcl for a list of features + +2001-07-06 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: fix for propagating special return codes through + next calls (e.g. ... return -code continue). + This is needed for Tk integration; + thanks to catherine letondal@pasteur.fr for + pointing out the problem + * Mime.xotcl: handling yet another file format for ~/.mime.types + +2001-06-21 Uwe Zdun + * fix for tclexpat in Tcl 8.2 versions + +2001-06-21 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: more fixes for bug in copy/move for object + names with spaces + * predefined.h: fixes for xotcl methods for spaces in object + names (eval) + +2001-06-20 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: fixes for bug in copy/move for object names + with spaces + * xotcl.c: reporting error codes when copy move does not work + +2001-06-13 Gustaf.Neumann@wu-wien.ac.at + * AIX compatibility fixes (thanks to Adrian Wallaschek) + * improved portability + * easier export from bk + * Httpd.xotcl: added -ipaddr option to configure + IP-address of server + +2001-06-12 Uwe Zdun + * xotcl.c: fixed reference counting for volatile objects + +2001-05-01 Gustaf.Neumann@wu-wien.ac.at + * patch release of source distribution (0.85p1) + +2001-05-30 Gustaf.Neumann@wu-wien.ac.at + * new predefined method: newChildOf + +2001-05-28 Gustaf.Neumann@wu-wien.ac.at + * HttpPlace.xotcl: added call to replyCode in front + of replyErrorMsg + * Httpd.xotcl: made httpd more robust in error cases + (invalid first line) + * ignore attic in tar + * xotclgdbm.c: faster exists test + * lib/xml/TclExpat-1.1/Makefile.in: better make clean + +2001-05-22 Gustaf.Neumann@wu-wien.ac.at +2001-05-22 Uwe Zdun + * XOTcl 0.85 Release + +2001-05-15 Uwe Zdun + * xotcl.c: parameter defaults for (per-class) mixins are + evaluated upon creation + * tutorial: documented how to evaluate parameter defaults for + obj/class mixins + * win-files: adapted to new src directory tree + +2001-05-15 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: fix for colon checking to determine parent namespace + * xotcl.c: Object and Class create returns absolute name (with leading ::) + +2001-05-15 Uwe Zdun + * xotcl.c: fix for checking in parent namespace + +2001-05-10 Gustaf.Neumann@wu-wien.ac.at + * doc update (formatting, info instproc, ismetaclass and isclass) + * xotcl.c: argument for ismetaclass and isclass is now optional + * xotcl.c: checking for namespace parent in object creation to avoid crash + * Httpd.xotcl: fix for ie 5.5 under win98, + POST has not always contentlength set + +2001-04-14 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: don't call unknown for dash-commands on class + objects to avoid errors like "Class C -superClass Object" + that lead to object creation in earlier versions + * first version of xoman + * Httpd.xotcl: new method replyErrorMsg; replyCode + does not produce HTML messages by itself + +2001-04-07 Gustaf.Neumann@wu-wien.ac.at + * Access.xotcl: added :: in front of global objects, more robust + * using namespace for soap, implifying interface + +2001-04-03 Uwe Zdun + * xotcl::comm::httpd: added error code 500 {Server Error}, + errorReply hook in replyCode added to be able to prevent HTML + error response. + +2001-04-03 Gustaf.Neumann@wu-wien.ac.at + * xotcl::comm::httpAccess: user-agent string more generic + +2001-03-27 Uwe Zdun + * xotcl.c: added inheritance feature for instinvars + * xotcl.c: standard cleanup now destroy aggregated children + * testx.xotcl: tests for both new features in xotcl.c + +2001-03-26 Gustaf.Neumann@wu-wien.ac.at + * version number in xotcl references to allow multiple + xotcl-versions to coexist + * various changes to accommodate bitkeeper + * package.xotcl: fixes for argument passing + (thanks to Artur Trzewik) + * Httpd.xotcl: better error messages containing referer for + files which are not found on the server. + +2001-03-22 Uwe Zdun + * xotcl.c: "cleanup" does not receive args anymore + * xoXML.xotcl: used [self class] for parser autoname + +2001-03-19 Gustaf.Neumann@wu-wien.ac.at + * removed dependencies form wafecompat + * Sccs support added to makefiles + * documentation for mixins updated + * decode POST moved before "respond" to ease overloading + +----------------------------------------------------------------------------- +2001-03-09 Gustaf.Neumann@wu-wien.ac.at +2001-03-09 Uwe Zdun + * release of Version 0.84 + +2001-03-09 Gustaf.Neumann@wu-wien.ac.at + * removed "exec date" from tests to ensure win compatibility + * fixed regression tests under win: don't use dependencies on + time-zones, fixed ordering problems and HTML bugs + +2001-03-08 Gustaf.Neumann@wu-wien.ac.at + * fixed a few bugs in xodoc + * documentation for apps/utils/* + * package name xotcl::store::storage changed to xotcl::store + * PCache uses new Storage interface + * new predefined object ::xotcl::rcs to extract + info from RCS strings (methods date and version) + +2001-03-07 Uwe Zdun + * xotcl.c: Mutex patch for exit handlers in MT apps by + Zoran Vasiljevic + * xotcl.c: self next implemented ... enables callstack + information for the "next" method + * Persistent.test: bench test reduced to 272 + * tutorial/langref: documented new functionalities + +2001-03-06 Uwe Zdun + * htmllib.xotcl: integrated new version with HtmlBuilder; + thanks to Antti Salonen. + * package names: changed all package names to convention that + names are starting with lower cases. Separated names with :: + prefixes. For now, these names are just chosen to avoid name + clashes, in 0.85 they will probably be used as basis for a + hierarchical component model. + +2001-03-05 Uwe Zdun + * metadataAnalizer: split into dynamic and static variant (static + is used for xodoc + +2001-03-02 Uwe Zdun + * xotcl.c: moved callstack information (calledproc, calledclass, + callingproc, callingobject, callingclass, regclass) from + info to self; e.g. use in a filter instead of + [[self] info calledproc] + from now on + [self calledproc] + * testx.xotcl: integrated callstack information changes. + +2001-03-01 Uwe Zdun + * complete installation and test suite for Windows, i.e. doc, + packages, all tests, install, etc. now function on Windows + platforms + * XOTclSdbm ported to Windows + * Expat xotcl version running on Windows + * xotclsh.1, xowish.1 man pages added + +2001-02-27 Gustaf.Neumann@wu-wien.ac.at + * new global variables for configuration and logging + ::xotcl::confdir ~/.xotcl + ::xotcl::logdir $::xotcl::confdir/log + * new script daemon.xotcl for starting/stopping + xotcl scripts in the background + +2001-02-22 Uwe Zdun + * xoDoc.xotcl, metadataAnalyzer.xotcl: added documentation and + handling for "abstract" methods, and corrected bugs in html + appearance + +2001-02-22 Gustaf.Neumann@wu-wien.ac.at + * xotkAppInit.c: added static package Tk + +2001-02-22 Uwe Zdun + * splitted xodoc.xotcl into a generic static metadata analyzer + (metadataAnalyzer.xotcl) and the HTML documentation part + (xodoc.xotcl). + * htmllib.xotcl: incorporated fishpool's html lib for use + in xodoc; thanks to Antti Salonen. + +2001-02-17 Gustaf.Neumann@wu-wien.ac.at + * Serializer.xotcl: new package for serialization of workspace + contents (Classes and Objects). Serialization of full + workspace: + Serializer s + s serializeWs ?filename? + Serialization of Object or Class + s serialize ObjectOrClass + * bugfix in mixins + * xotcl.c: tidying up + +2001-02-10 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: some speed improvements + (next without args more than twice as fast due to moving + arguments to the stack, caching of stack pointers) + +2001-02-08 Uwe Zdun + ! xotcl.c: Removed mixin init logic. Mixin & instmixin inits + are only called if the mixin is registered for the object + during initialization. Beforehand "mixin" has called init, + when it wasn't called before. This was inconsistent with + behavior of class and instmixin. + +2001-02-06 Uwe Zdun + * xotcl.c, testx.xotcl, ...: tests for new destroy logic + +2001-02-04 Gustaf.Neumann@wu-wien.ac.at + * xotcl.c: cleanup and various simplifications + ! using xotcl namespace for: + version, lib, check_library_path, + interp, trace, deprecated, mkindex, load, + namespace_copyvars, namespace_copycmd + potential incompatibility: use ::xotcl::version + instead of ::xotcl_version! + +2001-02-01 Uwe Zdun + * xotcl.c: new destroy logic with recreate + +2001-01-26 Uwe Zdun + * Persistence.xotcl: + - persistenceMgr now uses child object as storage + - persistent arrays bug fixed, lazy persistent arrays added + - added persistent arrays to test + +2001-01-25 Uwe Zdun + * xotcl.c: class redefinition logic instead of direct command + destroy added to solve destroy problems identified + by Kristoffer Lawson. + +2001-01-24 Uwe Zdun + * xotcl.c: fixed alias bug identified by Kristoffer Lawson. + +2001-01-22 Gustaf.Neumann@wu-wien.ac.at + * fixed regression test for new path settings + * removed Unix dependencies from regression test (sleep) + +2001-01-18 Uwe Zdun + * all storages: added nextkey + firstkey methods + for traversal of DBs + +2001-01-17 Uwe Zdun + ! all packages: all internal distribution package names now + start with "xotcl::" to avoid name clashes with other + packages + +2001-01-16 Uwe Zdun + * XOTclGdbm: added XOTcl Gdbm wrapper + +2001-01-15 Uwe Zdun + * xotcl.c: alloc now handled as a Class instproc, like + create. Thanks to Kristoffer Lawson for the hint. + +2001-01-15 Gustaf.Neumann@wu-wien.ac.at + * new Interface for persistent storage + + Class Storage + Storage abstract instproc open filename + Storage abstract instproc close {} + Storage abstract instproc exists key + Storage abstract instproc set {key ?value?} + Storage abstract instproc unset key + Storage abstract instproc names {} + +2001-01-12 Uwe Zdun + * Storage test suite added + +2001-01-09 Uwe Zdun + * Makefiles: generic makefile for expat, gdbm, ... in the + style of XOTcl's Makefile + fed by toplevel configure + * packages/store/XOTclSdbm: sdbm wrapper for XOTcl + +2001-01-08 Gustaf.Neumann@wu-wien.ac.at + * The search for the XOTcl library is performed according to the + following rules: + + 1) If the environment variable XOTCL is set and points to a + directory, it is taken as the XOTCL directory. + + 2) If the auto_path (determined in part by the environment + variable TCLLIBPATH) contains a directory named "xotcl" + and it exists, it is taken. + + 3) If no xotcl library is determined yet, check + whether the current directory is in an xotcl source tree. If + yes take it. + + 4) If the auto_path contains a directory, that has a + sub-directory named xotcl, it is taken. + + 5) If the auto_path contains a directory that has a + directory named xotcl as a neighbor, it is taken. + + 6) Take the compiled-in path for the xotcl library. + + After the search for the XOTcl library the global Tcl + variable ::xotcl::lib is set to the determined directory. This + directory is added automatically to the ::auto_path if + necessary. + +2000-12-15 Gustaf.Neumann@wu-wien.ac.at + * packages/make.xotcl: passing target to avoid grep + through Makefile + +2000-12-15 Gustaf.Neumann@wu-wien.ac.at + * packages/make.xotcl: less verbose + * new environment variable XOTCL, points to directory + where the XOTcl library lives + +2000-12-13 Gustaf.Neumann@wu-wien.ac.at + * packages...Httpd.xotcl: close connection after errors + * packages...Httpd.xotcl: elementary support for HTTP method + OPTIONS + +2000-12-04 Gustaf.Neumann@wu-wien.ac.at + * xoXML: fix info vars + instvar method creates variable that is not accessible and + should not be listed in info vars + +2000-12-04 Gustaf.Neumann@wu-wien.ac.at + * version changed to 0.84 + * xoXML: fix for multiple PCDATA calls after one element + +----------------------------------------------------------------------------- +2000-11-30 Gustaf.Neumann@wu-wien.ac.at +2000-11-30 Uwe Zdun + * release of Version 0.83 + +2000-11-30 Uwe Zdun + * xoXML/xoRDF: added the ability to process mixed content PCDATA + (i.e. more than one pcdata in one element) + +2000-11-29 Uwe Zdun + * src/lib/soccerClub.xotcl: simple introductory example for + the tutorial + * xotcl.c: corrected assertion checking: built in commands that + affect assertions are not checked (check, info, proc, instproc, + invar, and instinvar). Otherwise we can not react on a broken + assertion in the error handler (& documented this stuff in the + tutorial). + +2000-11-29 Gustaf.Neumann@wu-wien.ac.at + * tried to improve documentation tool + * work on xotcl homepage, manual section added + +2000-11-28 Gustaf.Neumann@wu-wien.ac.at + * apps/actiweb-apps/univ/ added (example for RDF) + * packages/make.xotcl extended for test in apps directory + * HtmlPlace.xotcl: allowExit method added for HtmlPlace to allow an + actiweb place to terminate via URL (primarily for regression tests, + which require no kill anymore, now platform independent) + * Httpd.xotcl: logging of contains more detailed information + * HttpPlace.xotcl: added HTTP errors (invalid requests + for actiweb are correctly noted in log files) + +2000-11-28 Uwe Zdun + * xotcl.c: Removed theClasses/theObjecs hashtable, because they + caused some problems in exit handling (thanks to + Catherine Letondal for the hint), + * xotcl.c: fixed all remaining memory leaks in tests (thanks to Zoran + Vasiljevic for helping us out with purify) + * tutorial.html: added documentation for @ + +2000-11-27 Gustaf.Neumann@wu-wien.ac.at + * src/Makefile.in: changed logic for building and + installing xowish + * xotcl.c: fixed bug in "info mixins" + +2000-11-24 Gustaf.Neumann@wu-wien.ac.at + * Access.xotcl: overhaul, uses now exits method instead of + 'info exists' + * packages/xml/xml.xotcl: overhaul of the introductory XML-parser + example + * predefined.xotcl: new predefined method of Object: + vwait (Tcl semantics) + * some tuning to avoid speed penalties + * src/Makefile.in: added some dependencies + +2000-11-24 Uwe Zdun + * xotcl.c: removed internal mem leaks reported by dmalloc + * xotcl.c: corrected assertion checking for built-in commands, like set + * xotcl.c, xotclMetaData.c: put metadata into own file + + made them deprecated -> use @ instead + * testx.xotcl, testo.xotcl: used @ instead of metadata + * tutorial.html: reworked the tutorial, added instmixins + +2000-11-22 Gustaf.Neumann@wu-wien.ac.at + * dmalloc defines added to Makefile.in + * xotcl.c: removed some mem leaks + +2000-11-22 Gustaf.Neumann@wu-wien.ac.at + * documented various sample applications + * fixed problems with pipes for xocomm.test (should work now under + windows as well) + * polished output from xodoc + * extended sample webserver to return info about the current + request and provided means for stopping it remote. + +2000-11-22 Uwe Zdun + * configure.in: added ""'s around -z tests and added + --without-gdbm support + (thanks to Catherine Letondal for the hint) + * package/store/persistenceExample.xotcl added as a basic + persistence store example. + +2000-11-21 Uwe Zdun + * xotcl.c: corrected infinite loop in instvar assertions + (thanks to Zoran Vasiljevic for the hint) + +2000-11-20 Uwe Zdun + * xotcl.c/xotclInt.h: moved the global objects and a static + variable to interpreter structure (thanks to Zoran Vasiljevic for + the patches) + * xotcl.c correctes mem leak in "mixin" method + (thanks to Zoran Vasiljevic for the hint) + +2000-11-03 Gustaf.Neumann@wu-wien.ac.at + * MimeTypes can be specified for certain filenames via + Mime set nameTable(ChangeLog$) text/plain + where the index is treated as a regular expression + * rpm target added to Makefile + * rpm files added to www.xotcl.org + * removed file installed to / from binary distribution + +2000-11-15 Uwe Zdun + * xotcl.c: corrected deletion order for aggregated children: + child destructor is called before parent's destructor + * Makefile.in: removed "-full-" from filename + +2000-11-03 Gustaf.Neumann@wu-wien.ac.at + Various changes to HttpPlace.xotcl and Httpd.xotcl + * access control for HttpPlaces + * new instance variable "user" in Worker for authenticated requests + * access to ordinary files (and not only to WebObjects) from + HttpPlaces (if there is no object with the name of the file) + * worker added as a argument to credentialsNotOk + +2000-10-28 Uwe Zdun + * testx.xotcl: added tests for instmixins + +2000-10-26 Uwe Zdun + * xotcl.c: added instmixins + +2000-10-13 Gustaf.Neumann@wu-wien.ac.at + * new global variable xotcl_version in analogy to tcl_version + * fixed parameter passing to init for multiple arguments + (not starting with a "-") + * added regression test + * fix bug for variable name aliasing in the instvar method + +----------------------------------------------------------------------------- +2000-10-09 Uwe Zdun + * prepared Version 0.82 + +2000-10-06 Uwe Zdun + * experimental tests for actiweb apps (invoke + with 'make test' at toplevel) + +2000-10-02 Uwe Zdun + * Documented xotcl.c + src/lib and src/scripts directories + +2000-09-29 Uwe Zdun + * xodoc.xotcl new XOTcl documentation package .. all docs + are now in file docs, with @ object + +2000-09-28 Uwe Zdun + !! xotcl.c removed aggregation short form due to incompatibilities + with unknown. I.e., + [self] Class x + does not function like + Class [self]::x + anymore, but triggers the unknown mechanism. + * removed bug: parameters have tried to call "-1" + default value as method + +2000-09-26 Uwe Zdun + !! src/xotcl.c: short form for creation of nested object and + classes removed. + * new documentation tool + +2000-09-22 Gustaf.Neumann@wu-wien.ac.at + * new configure flags: + --with-gdbm=INCDIR,LIBDIR + --with-tk=INCDIR,LIBDIR + --with-tcl=INCDIR,LIBDIR + +2000-09-19 Gustaf.Neumann@wu-wien.ac.at + * apps/actiweb-apps/FormsWithState.xotcl: + new example script for implementing a multi-page form + which keeps the state in a context object, which + is passed from form to form via hidden form fields + * new toplevel configure file + * toplevel "make install" copies demo apps as well + (should we set the path to xotclsh in first line?) + +2000-09-13 Uwe Zdun + * xotcl.c: added new format functionality to autoname. % + strings are now recognized as in the Tcl "format" + command. E.g.: autoname a%06d --> a000000, a000001, a000002, .. + + * rdf/xoRDF.test, rdf/RDFTriple.xotcl: used new autonames here + in order to make triples sort-able with lsort + +2000-09-12 Gustaf.Neumann@wu-wien.ac.at + * Httpd.xotcl: Fixed a bug for IE5.5 with persistent connections: + (Server blocked); cause: the Tcl command "fcopy" alters the + blocking state of a socket when it finishes (bug in fcopy + of tcl 8.3.2) + +2000-09-12 Uwe Zdun + * xotcl/src: added xotclInt.h as XOTcl internal API + (still incomplete) + * xotcl.c: + - extracted xotclProfile.c, xotclReference.c, xotclTrace.c, + and xotclError.c from xotcl.c, + - started conversion to Tcl-like naming convention for + functions: XOTcl... for internal API, + XOTcl_... for external API + +2000-09-07 Uwe Zdun + * xoXML.xotcl: removed need for empty topNode + * xoRDF.xotcl/RDFTriple.xotcl: Uniform Parse Tree + - abbrev properties and parseType = resource are now parse + into descriptions + - class hierarchy uniformized to resources and properties + ... object names + are either prop.. or res.. + - resource types are stored in rdftypes variable + (as a list of types) + - Typed nodes are parsed into description + type + - namespace definition at RDF tag recognized + - hard coded "rdf:" removed (now rdfNSPrefix is stored on + each node, the parser has a rdfNamespace parameter) + +2000-09-06 Gustaf.Neumann@wu-wien.ac.at + * packages/store/Persistence.xotcl: lazy open for + persistence database added (to avoid creation of not needed + files, when no persistent variables are used, and to reduce + permission problems for creation, opening, etc) + +2000-09-04 Uwe Zdun + * xotcl.c, Makefile.vc: INST_XOLIBPKG, XOTCLVERSION passed to + VC 6.0 preprocessor from Makefile.vc (thanks to David + LeBlanc for the fix) + +2000-09-04 Gustaf.Neumann@wu-wien.ac.at + * xoRDF: trivial fix for make numbering of anonymous resources + easier to comprehend + * predefined.xotcl: methods "append" and "lappend" added + * xotcl/Makefile: keeps track of configure.in and reconfigures + if necessary (eg. version change) + * new -reset option for autoname (does currently not work with + -instance) + +2000-08-31 Uwe Zdun + * xoRDF: added subject ID to anonymous descriptions & fixed bugs + +2000-08-30 Uwe Zdun + * xotcl.c: fixed xotcltrace + * trace.xotcl: "deprecated messages" show* fixed + +2000-08-19 Gustaf.Neumann@wu-wien.ac.at + * toplevel Makfile: target "make test" added + +2000-08-16 Gustaf.Neumann@wu-wien.ac.at + * RDFTriple got a new method "prettyTriples" which uses + indentation to show connections between triples (used in xoRDF.test) + +2000-08-11 Gustaf.Neumann@wu-wien.ac.at + * apps/xocomm/webserver.xotcl listens on port 9086 as well + to test basic access control + * packages/make.xotcl -test added + * Access.xotcl: fixes for credentials, timing for SimpleRequest now optional + (-timing 1, default is -timing 0) + * new files: packages/comm/xocomm.test, packages/rdf/xoRDF.test + * Ftp fixed for now Access methods + * "Class instproc newChild" and "Class instproc new" added + +2000-08-09 Gustaf.Neumann@wu-wien.ac.at + * untested C-API placed between #ifdef + * dead code removed + * all internal calls to destroy handled by a single + function "callDestroyMethod" + * target "xref" added to xotc/src/Makefile + (needs free program xref to be installed) + +2000-08-08 Gustaf.Neumann@wu-wien.ac.at + * new instcommand "exists" to check whether a variable + exists (no need to use namespaces or instvar to check + for the existence of variables) + * xotcl.c: using new macros + VarFrameDecls + VarFrameSwitchToObj(in,obj) + VarFrameRestore(in) + to change VariableFrames + (speedup mand making code more uniform) + * returning int objects instead of string objects + * using new features obove led to more than 20% speedup + on RDF benchmark. + * regression and speed test + xotcl/src/lib/speedtest.xotcl added + +2000-08-07 Gustaf.Neumann@wu-wien.ac.at + * HTML Form interface changed, + form arguments are not longer appended to call + * new methods for WebObj: getWorker and getFormData + to access worker internals and form data + * some minor speed improvements + +2000-08-01 Gustaf.Neumann@wu-wien.ac.at + !! more thorough checks for object names + (no ":", no "::", no ":[^:].+", no ".+:", no ".*NAME::[:]+NAME") + * copy and move methods create no invalid names that must be fixed + by Object creation + !! methods called via "-" syntax must start with an alphanum character + * Object creation 10% faster + * apps/actiweb-apps/MC.xotcl uses POST instead of GET + +2000-07-27 Gustaf.Neumann@wu-wien.ac.at + !!! info children returns fully qualified object names + !!! info classchildren returns fully qualified object names + !!! info filter returns function names without class paths + * fixed composite attributes in RDF + * some speed improvements + * parameter passing from FORMs to WebObjects via parameter objects + * HtmlPlace has a default method that lists all exported objects + * Mime component added + * multipart-form data code added to Httpd + +2000-06-26 Gustaf.Neumann@wu-wien.ac.at + * version number increased to 0.82 + * automated version number management + * test client and server for tls added + * minor changes for TLS + * minor fixes for Tcl 8.4a + * including certificates + +2000-06-20 Uwe Zdun + + * packages/mos/Agent.xotcl: + - migrate bug -- 'self' called after destroy of migrate -- + corrected + - support for synchronous invoke, clone, and migrate added in + addition to async methods + + * AgentClient/Receiver: example enhanced with class cloning and + sync invoke, clone, and migrate + + +----------------------------------------------------------------------------- +2000-06-05 XOTcl 0.81 Release -- Major Changes to Version 0.80 + - changelog started by Uwe Zdun + * xotcl.c: + - deep copy/move with all language features + - renamed "parameters" to "parameter" + - renamed "info filters" and "info mixins" to "info filter"/ + "info mixin" + - added deprecated error message + - added "xotcl_interp" command to start an XOTcl slave interp + - better "package" support and integration + - linearization of per-object mixin hierarchy with ordinary + class hierarchy + - isobject, isclass, and ismetaclass with identical interface: + all have the obj/cls in question as argument + - reference tracing with "info reference", "info referencedby" added + - internal xotcl-lib now in predefined.xotcl -> make file + automatically creates predefined.h + * toplevel-configure added + * Actiweb: + - early alpha preview for code mobility, registry, web objects + added. be careful: the APIs will most likely change in the + future + - SSL Place + * HTTPserver/access: + - Open SSL support + * xoXML/xoRDF: + - RDF Typed Node support + - Parsing of several top nodes at once -> mixing of XML and RDF easier + - Tests integrated and several new tests + - XML/RDF recreation added + * xoStore: + - Support for tclgdbm added -- thanks to Stefan Vogel for + providing the Win version of gdbm Index: xotcl/Makefile =================================================================== diff -u --- xotcl/Makefile (revision 0) +++ xotcl/Makefile (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,622 @@ +# Makefile.in -- +# +# This file is a Makefile for Sample TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# Copyright (c) 2002-2003 ActiveState Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#======================================================================== +# Add additional lines to handle any additional AC_SUBST cases that +# have been added in a customized configure script. +#======================================================================== + +#XOTCL_VERSION = 1.2.1 +XOTCL_VERSION = 1.2 + +src_lib_dir = ${srcdir}/library +src_doc_dir = ${srcdir}/doc +src_test_dir = ${srcdir}/tests +src_app_dir = ${srcdir}/apps +src_generic_dir = ${srcdir}/generic +PLATFORM_DIR = $(srcdir)/unix +TCL_LIB_SPEC = -L/home/neumann/tcl8.4.5/unix -ltcl8.4 +TK_LIB_SPEC = -L/usr/lib -ltk8.4 +subdirs = library/store/XOTclSdbm/ library/store/XOTclGdbm/ library/xml/TclExpat-1.1/ + +libdirs = comm lib serialize actiweb rdf registry store xml patterns +libsrc = COPYRIGHT pkgIndex.tcl +appdirs = comm scripts utils actiweb persistence +appsrc = COPYRIGHT + +DOC_SOURCE = \ + $(src_doc_dir)/langRef.xotcl \ + $(src_lib_dir)/lib/*.xotcl \ + $(src_lib_dir)/store/*.xotcl \ + $(src_lib_dir)/serialize/Serializer.xotcl \ + $(src_test_dir)/*.xotcl \ + $(src_app_dir)/scripts/*.xotcl \ + $(src_app_dir)/comm/[flsw]*.xotcl \ + $(src_app_dir)/actiweb/univ/UNIVERSAL.xotcl \ + $(src_app_dir)/utils/xo-*[a-z0-9] + +export TCLLIBPATH=. +mkinstalldirs= mkdir -p +#======================================================================== +# Nothing of the variables below this line should need to be changed. +# Please check the TARGETS section below to make sure the make targets +# are correct. +#======================================================================== + +#======================================================================== +# The names of the source files is defined in the configure script. +# The object files are used for linking into the final library. +# This will be used when a dist target is added to the Makefile. +# It is not important to specify the directory, as long as it is the +# $(srcdir) or in the generic, win or unix subdirectory. +#======================================================================== + +PKG_SOURCES = xotcl.c xotclError.c xotclMetaData.c xotclObjectData.c xotclProfile.c xotclTrace.c xotclUtil.c xotclShadow.c xotclCompile.c aolstub.c xotclStubInit.c +PKG_OBJECTS = xotcl.o xotclError.o xotclMetaData.o xotclObjectData.o xotclProfile.o xotclTrace.o xotclUtil.o xotclShadow.o xotclCompile.o aolstub.o xotclStubInit.o + +PKG_STUB_SOURCES = xotclStubLib.c +PKG_STUB_OBJECTS = xotclStubLib.o + +#======================================================================== +# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with +# this package that need to be installed, if any. +#======================================================================== + +PKG_TCL_SOURCES = + +#======================================================================== +# This is a list of public header files to be installed, if any. +#======================================================================== + +PKG_HEADERS = generic/xotcl.h generic/xotclInt.h + +#======================================================================== +# "PKG_LIB_FILE" refers to the library (dynamic or static as per +# configuration options) composed of the named objects. +#======================================================================== + +PKG_LIB_FILE = libxotcl1.2.1.so +PKG_STUB_LIB_FILE = libxotclstub1.2.1.a + +lib_BINARIES = $(PKG_LIB_FILE) $(PKG_STUB_LIB_FILE) +BINARIES = $(lib_BINARIES) + +SHELL = /bin/sh + +srcdir = . +prefix = /usr +exec_prefix = /usr + +bindir = ${exec_prefix}/bin +libdir = ${exec_prefix}/lib +datadir = ${prefix}/share +mandir = ${prefix}/man +includedir = ${prefix}/include + +DESTDIR = + +PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) +pkgdatadir = $(datadir)/$(PKG_DIR) +pkglibdir = $(libdir)/$(PKG_DIR) +pkgincludedir = $(includedir)/$(PKG_DIR) + +top_builddir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL} + +PACKAGE_NAME = xotcl +PACKAGE_VERSION = 1.2.1 +CC = gcc -pipe +CFLAGS_DEFAULT = -O +CFLAGS_WARNING = -Wall -Wconversion -Wno-implicit-int +CLEANFILES = *.o *.so *~ core gmon.out config.* +EXEEXT = +LDFLAGS_DEFAULT = -rdynamic +MAKE_LIB = ${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS} +MAKE_SHARED_LIB = ${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS} +MAKE_STATIC_LIB = ${STLIB_LD} $@ $(PKG_OBJECTS) +MAKE_STUB_LIB = ${STLIB_LD} $@ $(PKG_STUB_OBJECTS) +OBJEXT = o +RANLIB = : +RANLIB_STUB = ranlib +SHLIB_CFLAGS = -fPIC +SHLIB_LD = gcc -pipe -shared +SHLIB_LD_FLAGS = +SHLIB_LD_LIBS = ${LIBS} -L/home/neumann/tcl8.4.5/unix -ltclstub8.4 -L/usr/lib -ltkstub8.4 +STLIB_LD = ${AR} cr +TCL_DEFS = -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOLL=1 -DHAVE_STRTOULL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DPEEK_XCLOSEIM=1 -DHAVE_SYS_IOCTL_H=1 +TCL_BIN_DIR = /home/neumann/tcl8.4.5/unix +TCL_SRC_DIR = /home/neumann/tcl8.4.5 +# This is necessary for packages that use private Tcl headers +#TCL_TOP_DIR_NATIVE = $(TCL_SRC_DIR) +# Not used, but retained for reference of what libs Tcl required +TCL_LIBS = ${DL_LIBS} ${LIBS} ${MATH_LIBS} + +#======================================================================== +# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our +# package without installing. The other environment variables allow us +# to test against an uninstalled Tcl. Add special env vars that you +# require for testing here (like TCLX_LIBRARY). +#======================================================================== + +EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR) +TCLSH_ENV = TCL_LIBRARY=`echo $(TCL_SRC_DIR)/library` \ + LD_LIBRARY_PATH="$(EXTRA_PATH):$(LD_LIBRARY_PATH)" \ + PATH="$(EXTRA_PATH):$(PATH)" \ + TCLLIBPATH="$(top_builddir)" +TCLSH_PROG = /home/neumann/tcl8.4.5/unix/tclsh +TCLSH = $(TCLSH_ENV) $(TCLSH_PROG) +SHARED_BUILD = 1 + +INCLUDES = -I$(TCL_SRC_DIR)/generic -I$(TCL_SRC_DIR)/unix +EXTRA_CFLAGS = -DXOTCLVERSION=\"1.2\" -DXOTCLPATCHLEVEL=\".1\" -DHAVE_TCL_COMPILE_H=1 + +# TCL_DEFS is not strictly need here, but if you remove it, then you +# must make sure that configure.in checks for the necessary components +# that your library may use. TCL_DEFS can actually be a problem if +# you do not compile with a similar machine setup as the Tcl core was +# compiled with. +#DEFS = $(TCL_DEFS) -DPACKAGE_NAME=\"xotcl\" -DPACKAGE_TARNAME=\"xotcl\" -DPACKAGE_VERSION=\"1.2.1\" -DPACKAGE_STRING=\"xotcl\ 1.2.1\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS=1 -DCOMPILE_XOTCL_STUBS=1 $(EXTRA_CFLAGS) +DEFS = -DPACKAGE_NAME=\"xotcl\" -DPACKAGE_TARNAME=\"xotcl\" -DPACKAGE_VERSION=\"1.2.1\" -DPACKAGE_STRING=\"xotcl\ 1.2.1\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS=1 -DCOMPILE_XOTCL_STUBS=1 $(EXTRA_CFLAGS) + +CONFIG_CLEAN_FILES = Makefile + +CPPFLAGS = +LIBS = +AR = ar +CFLAGS = ${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: $(BINARIES) xotclsh xowish pkgIndex.tcl + @if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \ + for dir in $$dirs ; do \ + if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \ + done; fi; + +libraries: + @if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \ + for dir in $$dirs ; do \ + if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \ + done; fi; + +libraries-pkgindex: + @$(TCLSH_PROG) $(src_lib_dir)/lib/make.xotcl -dir $(src_lib_dir) -all + +fulldoc: doc pdf +# use language reference as sample file to trigger generation of documentation files +doc: $(src_doc_dir)/langRef-xotcl.html + +$(src_doc_dir)/langRef-xotcl.html: $(src_doc_dir)/langRef.xotcl $(DOC_SOURCE) + @$(TCLSH_PROG) $(src_lib_dir)/lib/makeDoc.xotcl $(src_doc_dir) $(DOC_SOURCE) + +pdf: + -(cd $(src_doc_dir); htmldoc --webpage --format pdf14 --title \ + -f tutorial.pdf tutorial.html ) + -(cd $(src_doc_dir); htmldoc --webpage --format pdf14 \ + -f langRef-xotcl.pdf langRef-xotcl.html ) + +install: install-binaries install-shells install-libraries install-doc + @if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \ + for dir in $$dirs ; do \ + if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \ + done; fi; + +install-binaries: binaries install-lib-binaries install-bin-binaries install-pkgIndex + +install-aol: install-binaries install-libraries + $(INSTALL) $(src_generic_dir)/aol-xotcl.tcl \ + $(DESTDIR)/usr/local/aolserver/modules/tcl/xotcl.tcl + + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== +install-libraries: libraries $(DESTDIR)$(includedir) $(DESTDIR)$(pkglibdir) + @echo "Installing header files in $(DESTDIR)$(includedir)" + @for i in $(PKG_HEADERS) ; do \ + echo "Installing $(srcdir)/$$i" ; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \ + done; + @for i in $(libdirs) ; do \ + echo "Installing $$i" ; \ + rm -rf $(DESTDIR)$(pkglibdir)/$$i ; \ + (cd $(src_lib_dir); $(INSTALL) -d $$i $(DESTDIR)$(pkglibdir)/$$i ; \ + $(INSTALL) $$i/*tcl $(DESTDIR)$(pkglibdir)/$$i/) ; \ + done; + for i in $(libsrc) ; do \ + echo "Installing $$i" ; \ + rm -rf $(DESTDIR)$(pkglibdir)/$$i ; \ + (cd $(src_lib_dir); $(INSTALL) $$i $(DESTDIR)$(pkglibdir)/$$i) ; \ + done; + cat ${srcdir}/unix/pkgIndex.unix >> $(DESTDIR)$(pkglibdir)/pkgIndex.tcl + @for i in $(appdirs) ; do \ + echo "Installing $$i" ; \ + rm -rf $(DESTDIR)$(pkglibdir)/apps/$$i ; \ + (cd $(src_app_dir); $(INSTALL) -d $$i $(DESTDIR)$(pkglibdir)/apps/$$i) ; \ + done; + @for i in $(appsrc) ; do \ + echo "Installing $$i" ; \ + rm -rf $(DESTDIR)$(pkglibdir)/apps/$$i ; \ + $(INSTALL) $(src_app_dir)/$$i $(DESTDIR)$(pkglibdir)/apps ; \ + done; + @rm -rf $(DESTDIR)$(pkglibdir)/store/XOTclGdbm + @rm -rf $(DESTDIR)$(pkglibdir)/store/XOTclSdbm + @rm -rf $(DESTDIR)$(pkglibdir)/xml/TclExpat-1.1 + +#======================================================================== +# Install documentation. Unix manpages should go in the $(DESTDIR)$(mandir) +# directory. +#======================================================================== + +install-doc: doc $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man3 $(DESTDIR)$(mandir)/mann + @if test ! "x$(XOTCLSH)" = "x" ; then \ + (cd $(src_man_dir)/ ; \ + for i in *.1; do \ + echo "Installing $$i"; \ + rm -f $(DESTDIR)$(mandir)/man1/$$i; \ + sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \ + $$i > $(DESTDIR)$(mandir)/man1/$$i; \ + chmod 444 $(DESTDIR)$(mandir)/man1/$$i; \ + done) ; \ + fi + +test: binaries libraries test-core test-actiweb + +#TESTFLAGS = -srcdir $(srcdir) +test-core: $(TCLSH_PROG) + $(TCLSH_PROG) `echo $(src_test_dir)/testx.xotcl` \ + -libdir `echo $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `echo $(src_test_dir)/testo.xotcl` \ + -libdir `echo $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `echo $(src_test_dir)/speedtest.xotcl` \ + -libdir `echo $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `echo $(src_test_dir)/xocomm.test` \ + -libdir `echo $(PLATFORM_DIR)` $(TESTFLAGS) +test-actiweb: $(TCLSH_PROG) + $(TCLSH_PROG) `echo $(src_test_dir)/actiweb.test` \ + -libdir `echo $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `echo $(src_test_dir)/persistence.test` \ + -libdir `echo $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `echo $(src_test_dir)/UNIVERSAL.test` \ + -libdir `echo $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `echo $(src_test_dir)/xoRDF.test` \ + -libdir `echo $(PLATFORM_DIR)` $(TESTFLAGS) + @rm -rf receiver + +depend: + + +#======================================================================== +# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable +# mentioned above. That will ensure that this target is built when you +# run "make binaries". +# +# The $(PKG_OBJECTS) objects are created and linked into the final +# library. In most cases these object files will correspond to the +# source files above. +#======================================================================== + +$(PKG_LIB_FILE): $(PKG_OBJECTS) + -rm -f $(PKG_LIB_FILE) + ${MAKE_LIB} + $(RANLIB) $(PKG_LIB_FILE) + +$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS) + -rm -f $(PKG_STUB_LIB_FILE) + ${MAKE_STUB_LIB} + $(RANLIB_STUB) $(PKG_STUB_LIB_FILE) + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# sample.$(OBJEXT): $(srcdir)/generic/sample.c +# $(COMPILE) -c `echo $(srcdir)/generic/sample.c` -o $@ +# +# Setting the VPATH variable to a list of paths will cause the makefile +# to look into these paths when resolving .c to .obj dependencies. +# As necessary, add $(srcdir):$(srcdir)/compat:.... +#======================================================================== + +VPATH = $(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win + +.c.o: + $(COMPILE) -c `echo $<` -o $@ + +#======================================================================== +# xotcl shells +#======================================================================== + +pkgIndex.tcl: $(PKG_LIB_FILE) + @echo package ifneeded XOTcl $(PACKAGE_VERSION) [list load [file join \$$dir . $(PKG_LIB_FILE)] XOTcl] > pkgIndex.tcl + +install-pkgIndex: +# @echo package ifneeded XOTcl $(PACKAGE_VERSION) [list load [file join \$$dir .. "$(PKG_LIB_FILE)"] XOTcl] > "$(pkglibdir)/pkgIndex.tcl" + +xotclsh: tclAppInit.o $(PKG_OBJECTS) $(CONDITIONAL_STUB_OBJECTS) + $(CC) -rdynamic -o $@ tclAppInit.o \ + $(PKG_OBJECTS) \ + $(CFLAGS) $(TCL_LIB_SPEC) \ + $(DMALLOC_LIB) $(CONDITIONAL_STUB_OBJECTS) + +xowish: tkAppInit.o $(PKG_OBJECTS) $(CONDITIONAL_STUB_OBJECTS) + $(CC) -rdynamic -o $@ tkAppInit.o \ + $(PKG_OBJECTS) \ + $(CFLAGS) $(TCL_LIB_SPEC) $(TK_LIB_SPEC) \ + $(DMALLOC_LIB) $(CONDITIONAL_STUB_OBJECTS) + +install-shells: + @if test -e xotclsh; then \ + $(INSTALL_PROGRAM) xotclsh $(DESTDIR)$(bindir); \ + fi + @if test -e xowish; then \ + $(INSTALL_PROGRAM) xowish $(DESTDIR)$(bindir); \ + fi + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# Unfortunately, there does not seem to be any other way to do this +# in a Makefile-independent way. We can't use VPATH because it picks up +# object files that may be located in the source directory. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# exampleA.$(OBJEXT): $(srcdir)/src/win/exampleA.c +# $(COMPILE) -c `echo $(srcdir)/src/win/exampleA.c` -o $@ +#======================================================================== + +$(src_generic_dir)/predefined.h: $(src_generic_dir)/mk_predefined.xotcl $(src_generic_dir)/predefined.xotcl + (cd $(src_generic_dir); $(TCLSH_PROG) mk_predefined.xotcl > predefined.h) + +xotclStubInit.$(OBJEXT): $(PKG_HEADERS) +xotclStubLib.$(OBJEXT): $(src_generic_dir)/xotclStubLib.c $(PKG_HEADERS) +xotcl.$(OBJEXT): $(src_generic_dir)/xotcl.c $(src_generic_dir)/predefined.h $(PKG_HEADERS) +xotclError.$(OBJEXT): $(src_generic_dir)/xotclError.c $(PKG_HEADERS) +xotclMetaData.$(OBJEXT): $(src_generic_dir)/xotclMetaData.c $(PKG_HEADERS) +xotclObjectData.$(OBJEXT): $(src_generic_dir)/xotclObjectData.c $(PKG_HEADERS) +xotclProfile.$(OBJEXT): $(src_generic_dir)/xotclProfile.c $(PKG_HEADERS) +xotclTrace.$(OBJEXT): $(src_generic_dir)/xotclTrace.c $(PKG_HEADERS) +xotclUtil.$(OBJEXT): $(src_generic_dir)/xotclUtil.c $(PKG_HEADERS) +xotclShadow.$(OBJEXT): $(src_generic_dir)/xotclShadow.c $(PKG_HEADERS) +aolstub.$(OBJEXT): $(src_generic_dir)/aolstub.c $(PKG_HEADERS) + +# +# Target to regenerate header files and stub files from the *.decls tables. +# + +genstubs: + $(TCLSH_PROG) $(TCL_TOOL_DIR_NATIVE)/genStubs.tcl $(src_generic_dir) \ + $(src_generic_dir)/xotcl.decls $(src_generic_dir)/xotclInt.decls + +# +# Target to check that all exported functions have an entry in the stubs +# tables. +# + +checkstubs: + -@for i in `nm -p $(PKG_LIB_FILE) | awk '$$2 ~ /T/ { print $$3 }' \ + | sort -n`; do \ + match=0; \ + for j in $(TCL_DECLS); do \ + if [ `grep -c $$i $$j` -gt 0 ]; then \ + match=1; \ + fi; \ + done; \ + if [ $$match -eq 0 ]; then echo $$i; fi \ + done + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + -rm -rf $(BINARIES) $(CLEANFILES) xotclsh xowish pkgIndex.tcl ./receiver + @if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \ + for dir in $$dirs ; do \ + if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \ + done; fi + +distclean: clean + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Library files go into the lib directory. +# In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: + @mkdir -p $(DESTDIR)$(pkglibdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \ + stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \ + if test "x$$stub" = "xstub"; then \ + echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \ + else \ + echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \ + fi; \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \ + fi; \ + fi; \ + fi; \ + done + @list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + destp=`basename $$p`; \ + echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \ + fi; \ + done + + +#======================================================================== +# Install binary executables (e.g. .exe files and dependent .dll files) +# This is for files that must go in the bin directory (located next to +# wish and tclsh), like dependent .dll files on Windows. +# +# You should not have to modify this target, except to define bin_BINARIES +# above if necessary. +#======================================================================== + +install-bin-binaries: + @mkdir -p $(DESTDIR)$(bindir) + @list='$(bin_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \ + fi; \ + done + +.SUFFIXES: .c .$(OBJEXT) + +#Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status +# cd $(top_builddir) \ +# && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +uninstall-binaries: + list='$(lib_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + p=`basename $$p`; \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(bin_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/$$p; \ + done + +$(DESTDIR)$(includedir): + $(mkinstalldirs) $@ +$(DESTDIR)$(bindir): + $(mkinstalldirs) $@ +$(DESTDIR)$(libdir): + $(mkinstalldirs) $@ +$(DESTDIR)$(pkglibdir): + $(mkinstalldirs) $@ +$(DESTDIR)$(pkglibdir)/apps: $(DESTDIR)$(pkglibdir) + $(mkinstalldirs) $@ +$(DESTDIR)$(mandir)/man1: + $(mkinstalldirs) $@ +$(DESTDIR)$(mandir)/man3: + $(mkinstalldirs) $@ +$(DESTDIR)$(mandir)/mann: + $(mkinstalldirs) $@ + +end: + @echo "" + @echo "************************************************************" + @echo " Make completed. In order to test XOTcl, invoke:" + @echo " make test" + @echo "" + @echo " In order install XOTcl, invoke:" + @echo " make install" + @echo "" + @echo " In order to install XOTcl for AOLserver 4.x, invoke:" + @echo " make install-aol" + @echo "" + @echo " In order to invoke XOTcl interactively (before install), use:" + @echo " export TCLLIBPATH=\"$(TCLLIBPATH)\" or " + @echo " setenv TCLLIBPATH \"$(TCLLIBPATH)\"" + @echo " and" + @if test "x$(XOTCLSH)" = "x" ; then \ + echo " /home/neumann/tcl8.4.5/unix/tclsh" ; \ + echo " package require XOTcl; namespace import -force xotcl::*" ; \ + echo " or" ; \ + echo " put the 'package require' line into your ~/.tclshrc" ; \ + else \ + echo " xotclsh" ; \ + fi + @echo "************************************************************" + +RPMSOURCES=/usr/src/redhat/SOURCES +RPMSPECS=/usr/src/redhat/SPECS + +rpm: tar + @if test ! -d $(RPMSOURCES); then mkdir -p $(RPMSOURCES); fi + @if test ! -d $(RPMSPECS); then mkdir -p $(RPMSPECS); fi + cp ../../xotcl-$(PACKAGE_VERSION).tar.gz $(RPMSOURCES) + cp xotcl.spec $(RPMSPECS)/xotcl-$(PACKAGE_VERSION).spec + rpmbuild -ba $(RPMSPECS)/xotcl-$(PACKAGE_VERSION).spec + +bin-tar: + (cd ../..; tar zcvf xotcl-$(PACKAGE_VERSION)-bin-linux-i686-glibc.tar.gz \ + `find $(exec_prefix)/bin/xotclsh $(exec_prefix)/bin/xowish \ + $(prefix)/include/xotcl*.h \ + $(prefix)/lib/$(PKG_LIB_FILE) \ + $(prefix)/lib/$(PKG_STUB_LIB_FILE) \ + $(DESTDIR)$(pkglibdir) $(prefix)/man/man1/xo* \ + -type f -o -type l | fgrep -v CVS | fgrep -v SCCS | fgrep -v .junk| fgrep -v .db | fgrep -v "~" | fgrep -v "#" | fgrep -v /receiver/` \ + ) + +tar: clean + (cd ..; tar zcvf ./xotcl-$(PACKAGE_VERSION).tar.gz \ + `find ./xotcl-$(PACKAGE_VERSION) -type f -o -type l| fgrep -v CVS | fgrep -v SCCS | fgrep -v Attic | fgrep -v "autom4te"| fgrep -v config\.status | fgrep -v "~"|fgrep -v .db | fgrep -v .junk | fgrep -v "#" | grep -v "/o$$"`) + + +.PHONY: all binaries clean depend distclean doc install libraries \ + test test-core test-actiweb + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: xotcl/Makefile.in =================================================================== diff -u --- xotcl/Makefile.in (revision 0) +++ xotcl/Makefile.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,622 @@ +# Makefile.in -- +# +# This file is a Makefile for Sample TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# Copyright (c) 2002-2003 ActiveState Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile.in,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#======================================================================== +# Add additional lines to handle any additional AC_SUBST cases that +# have been added in a customized configure script. +#======================================================================== + +#XOTCL_VERSION = @PACKAGE_VERSION@ +XOTCL_VERSION = @XOTCL_VERSION@ + +src_lib_dir = ${srcdir}/library +src_doc_dir = ${srcdir}/doc +src_test_dir = ${srcdir}/tests +src_app_dir = ${srcdir}/apps +src_generic_dir = ${srcdir}/generic +PLATFORM_DIR = $(srcdir)/@TEA_PLATFORM@ +TCL_LIB_SPEC = @TCL_LIB_SPEC@ +TK_LIB_SPEC = @TK_LIB_SPEC@ +subdirs = @subdirs@ + +libdirs = comm lib serialize @libdirs_actiweb@ +libsrc = COPYRIGHT pkgIndex.tcl +appdirs = comm scripts utils @apps_actiweb@ +appsrc = COPYRIGHT + +DOC_SOURCE = \ + $(src_doc_dir)/langRef.xotcl \ + $(src_lib_dir)/lib/*.xotcl \ + $(src_lib_dir)/store/*.xotcl \ + $(src_lib_dir)/serialize/Serializer.xotcl \ + $(src_test_dir)/*.xotcl \ + $(src_app_dir)/scripts/*.xotcl \ + $(src_app_dir)/comm/[flsw]*.xotcl \ + $(src_app_dir)/actiweb/univ/UNIVERSAL.xotcl \ + $(src_app_dir)/utils/xo-*[a-z0-9] + +export TCLLIBPATH=. +mkinstalldirs= mkdir -p +#======================================================================== +# Nothing of the variables below this line should need to be changed. +# Please check the TARGETS section below to make sure the make targets +# are correct. +#======================================================================== + +#======================================================================== +# The names of the source files is defined in the configure script. +# The object files are used for linking into the final library. +# This will be used when a dist target is added to the Makefile. +# It is not important to specify the directory, as long as it is the +# $(srcdir) or in the generic, win or unix subdirectory. +#======================================================================== + +PKG_SOURCES = @PKG_SOURCES@ +PKG_OBJECTS = @PKG_OBJECTS@ + +PKG_STUB_SOURCES = @PKG_STUB_SOURCES@ +PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@ + +#======================================================================== +# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with +# this package that need to be installed, if any. +#======================================================================== + +PKG_TCL_SOURCES = @PKG_TCL_SOURCES@ + +#======================================================================== +# This is a list of public header files to be installed, if any. +#======================================================================== + +PKG_HEADERS = @PKG_HEADERS@ + +#======================================================================== +# "PKG_LIB_FILE" refers to the library (dynamic or static as per +# configuration options) composed of the named objects. +#======================================================================== + +PKG_LIB_FILE = @PKG_LIB_FILE@ +PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@ + +lib_BINARIES = $(PKG_LIB_FILE) $(PKG_STUB_LIB_FILE) +BINARIES = $(lib_BINARIES) + +SHELL = @SHELL@ + +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +libdir = @libdir@ +datadir = @datadir@ +mandir = @mandir@ +includedir = @includedir@ + +DESTDIR = + +PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) +pkgdatadir = $(datadir)/$(PKG_DIR) +pkglibdir = $(libdir)/$(PKG_DIR) +pkgincludedir = $(includedir)/$(PKG_DIR) + +top_builddir = . + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ + +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +CC = @CC@ +CFLAGS_DEFAULT = @CFLAGS_DEFAULT@ +CFLAGS_WARNING = @CFLAGS_WARNING@ +CLEANFILES = @CLEANFILES@ +EXEEXT = @EXEEXT@ +LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@ +MAKE_LIB = @MAKE_LIB@ +MAKE_SHARED_LIB = @MAKE_SHARED_LIB@ +MAKE_STATIC_LIB = @MAKE_STATIC_LIB@ +MAKE_STUB_LIB = @MAKE_STUB_LIB@ +OBJEXT = @OBJEXT@ +RANLIB = @RANLIB@ +RANLIB_STUB = @RANLIB_STUB@ +SHLIB_CFLAGS = @SHLIB_CFLAGS@ +SHLIB_LD = @SHLIB_LD@ +SHLIB_LD_FLAGS = @SHLIB_LD_FLAGS@ +SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ +STLIB_LD = @STLIB_LD@ +TCL_DEFS = @TCL_DEFS@ +TCL_BIN_DIR = @TCL_BIN_DIR@ +TCL_SRC_DIR = @TCL_SRC_DIR@ +# This is necessary for packages that use private Tcl headers +#TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@ +# Not used, but retained for reference of what libs Tcl required +TCL_LIBS = @TCL_LIBS@ + +#======================================================================== +# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our +# package without installing. The other environment variables allow us +# to test against an uninstalled Tcl. Add special env vars that you +# require for testing here (like TCLX_LIBRARY). +#======================================================================== + +EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR) +TCLSH_ENV = TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \ + @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \ + PATH="$(EXTRA_PATH):$(PATH)" \ + TCLLIBPATH="$(top_builddir)" +TCLSH_PROG = @TCLSH_PROG@ +TCLSH = $(TCLSH_ENV) $(TCLSH_PROG) +SHARED_BUILD = @SHARED_BUILD@ + +INCLUDES = @PKG_INCLUDES@ @TCL_INCLUDES@ +EXTRA_CFLAGS = @EXTRA_CFLAGS@ @PKG_CFLAGS@ + +# TCL_DEFS is not strictly need here, but if you remove it, then you +# must make sure that configure.in checks for the necessary components +# that your library may use. TCL_DEFS can actually be a problem if +# you do not compile with a similar machine setup as the Tcl core was +# compiled with. +#DEFS = $(TCL_DEFS) @DEFS@ $(EXTRA_CFLAGS) +DEFS = @DEFS@ $(EXTRA_CFLAGS) + +CONFIG_CLEAN_FILES = Makefile + +CPPFLAGS = @CPPFLAGS@ +LIBS = @PKG_LIBS@ @LIBS@ +AR = ar +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: $(BINARIES) @XOTCLSH@ @XOWISH@ pkgIndex.tcl + @if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \ + for dir in $$dirs ; do \ + if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \ + done; fi; + +libraries: + @if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \ + for dir in $$dirs ; do \ + if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \ + done; fi; + +libraries-pkgindex: + @$(TCLSH_PROG) $(src_lib_dir)/lib/make.xotcl -dir $(src_lib_dir) -all + +fulldoc: doc pdf +# use language reference as sample file to trigger generation of documentation files +doc: $(src_doc_dir)/langRef-xotcl.html + +$(src_doc_dir)/langRef-xotcl.html: $(src_doc_dir)/langRef.xotcl $(DOC_SOURCE) + @$(TCLSH_PROG) $(src_lib_dir)/lib/makeDoc.xotcl $(src_doc_dir) $(DOC_SOURCE) + +pdf: + -(cd $(src_doc_dir); htmldoc --webpage --format pdf14 --title \ + -f tutorial.pdf tutorial.html ) + -(cd $(src_doc_dir); htmldoc --webpage --format pdf14 \ + -f langRef-xotcl.pdf langRef-xotcl.html ) + +install: install-binaries install-shells install-libraries install-doc + @if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \ + for dir in $$dirs ; do \ + if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \ + done; fi; + +install-binaries: binaries install-lib-binaries install-bin-binaries install-pkgIndex + +install-aol: install-binaries install-libraries + $(INSTALL) $(src_generic_dir)/aol-xotcl.tcl \ + $(DESTDIR)/usr/local/aolserver/modules/tcl/xotcl.tcl + + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== +install-libraries: libraries $(DESTDIR)$(includedir) $(DESTDIR)$(pkglibdir) + @echo "Installing header files in $(DESTDIR)$(includedir)" + @for i in $(PKG_HEADERS) ; do \ + echo "Installing $(srcdir)/$$i" ; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \ + done; + @for i in $(libdirs) ; do \ + echo "Installing $$i" ; \ + rm -rf $(DESTDIR)$(pkglibdir)/$$i ; \ + (cd $(src_lib_dir); $(INSTALL) -d $$i $(DESTDIR)$(pkglibdir)/$$i ; \ + $(INSTALL) $$i/*tcl $(DESTDIR)$(pkglibdir)/$$i/) ; \ + done; + for i in $(libsrc) ; do \ + echo "Installing $$i" ; \ + rm -rf $(DESTDIR)$(pkglibdir)/$$i ; \ + (cd $(src_lib_dir); $(INSTALL) $$i $(DESTDIR)$(pkglibdir)/$$i) ; \ + done; + cat ${srcdir}/unix/pkgIndex.unix >> $(DESTDIR)$(pkglibdir)/pkgIndex.tcl + @for i in $(appdirs) ; do \ + echo "Installing $$i" ; \ + rm -rf $(DESTDIR)$(pkglibdir)/apps/$$i ; \ + (cd $(src_app_dir); $(INSTALL) -d $$i $(DESTDIR)$(pkglibdir)/apps/$$i) ; \ + done; + @for i in $(appsrc) ; do \ + echo "Installing $$i" ; \ + rm -rf $(DESTDIR)$(pkglibdir)/apps/$$i ; \ + $(INSTALL) $(src_app_dir)/$$i $(DESTDIR)$(pkglibdir)/apps ; \ + done; + @rm -rf $(DESTDIR)$(pkglibdir)/store/XOTclGdbm + @rm -rf $(DESTDIR)$(pkglibdir)/store/XOTclSdbm + @rm -rf $(DESTDIR)$(pkglibdir)/xml/TclExpat-1.1 + +#======================================================================== +# Install documentation. Unix manpages should go in the $(DESTDIR)$(mandir) +# directory. +#======================================================================== + +install-doc: doc $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man3 $(DESTDIR)$(mandir)/mann + @if test ! "x$(XOTCLSH)" = "x" ; then \ + (cd $(src_man_dir)/ ; \ + for i in *.1; do \ + echo "Installing $$i"; \ + rm -f $(DESTDIR)$(mandir)/man1/$$i; \ + sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \ + $$i > $(DESTDIR)$(mandir)/man1/$$i; \ + chmod 444 $(DESTDIR)$(mandir)/man1/$$i; \ + done) ; \ + fi + +test: binaries libraries test-core @test_actiweb@ + +#TESTFLAGS = -srcdir $(srcdir) +test-core: $(TCLSH_PROG) + $(TCLSH_PROG) `@CYGPATH@ $(src_test_dir)/testx.xotcl` \ + -libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `@CYGPATH@ $(src_test_dir)/testo.xotcl` \ + -libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `@CYGPATH@ $(src_test_dir)/speedtest.xotcl` \ + -libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `@CYGPATH@ $(src_test_dir)/xocomm.test` \ + -libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS) +test-actiweb: $(TCLSH_PROG) + $(TCLSH_PROG) `@CYGPATH@ $(src_test_dir)/actiweb.test` \ + -libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `@CYGPATH@ $(src_test_dir)/persistence.test` \ + -libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `@CYGPATH@ $(src_test_dir)/UNIVERSAL.test` \ + -libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS) + $(TCLSH_PROG) `@CYGPATH@ $(src_test_dir)/xoRDF.test` \ + -libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS) + @rm -rf receiver + +depend: + + +#======================================================================== +# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable +# mentioned above. That will ensure that this target is built when you +# run "make binaries". +# +# The $(PKG_OBJECTS) objects are created and linked into the final +# library. In most cases these object files will correspond to the +# source files above. +#======================================================================== + +$(PKG_LIB_FILE): $(PKG_OBJECTS) + -rm -f $(PKG_LIB_FILE) + ${MAKE_LIB} + $(RANLIB) $(PKG_LIB_FILE) + +$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS) + -rm -f $(PKG_STUB_LIB_FILE) + ${MAKE_STUB_LIB} + $(RANLIB_STUB) $(PKG_STUB_LIB_FILE) + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# sample.$(OBJEXT): $(srcdir)/generic/sample.c +# $(COMPILE) -c `@CYGPATH@ $(srcdir)/generic/sample.c` -o $@ +# +# Setting the VPATH variable to a list of paths will cause the makefile +# to look into these paths when resolving .c to .obj dependencies. +# As necessary, add $(srcdir):$(srcdir)/compat:.... +#======================================================================== + +VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win + +.c.@OBJEXT@: + $(COMPILE) -c `@CYGPATH@ $<` -o $@ + +#======================================================================== +# xotcl shells +#======================================================================== + +pkgIndex.tcl: $(PKG_LIB_FILE) + @echo package ifneeded XOTcl $(PACKAGE_VERSION) [list load [file join \$$dir . $(PKG_LIB_FILE)] XOTcl] > pkgIndex.tcl + +install-pkgIndex: +# @echo package ifneeded XOTcl $(PACKAGE_VERSION) [list load [file join \$$dir .. "$(PKG_LIB_FILE)"] XOTcl] > "$(pkglibdir)/pkgIndex.tcl" + +xotclsh: tclAppInit.o $(PKG_OBJECTS) $(CONDITIONAL_STUB_OBJECTS) + $(CC) -rdynamic -o $@ tclAppInit.o \ + $(PKG_OBJECTS) \ + $(CFLAGS) $(TCL_LIB_SPEC) \ + $(DMALLOC_LIB) $(CONDITIONAL_STUB_OBJECTS) + +xowish: tkAppInit.o $(PKG_OBJECTS) $(CONDITIONAL_STUB_OBJECTS) + $(CC) -rdynamic -o $@ tkAppInit.o \ + $(PKG_OBJECTS) \ + $(CFLAGS) $(TCL_LIB_SPEC) $(TK_LIB_SPEC) \ + $(DMALLOC_LIB) $(CONDITIONAL_STUB_OBJECTS) + +install-shells: + @if test -e xotclsh; then \ + $(INSTALL_PROGRAM) xotclsh $(DESTDIR)$(bindir); \ + fi + @if test -e xowish; then \ + $(INSTALL_PROGRAM) xowish $(DESTDIR)$(bindir); \ + fi + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# Unfortunately, there does not seem to be any other way to do this +# in a Makefile-independent way. We can't use VPATH because it picks up +# object files that may be located in the source directory. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# exampleA.$(OBJEXT): $(srcdir)/src/win/exampleA.c +# $(COMPILE) -c `@CYGPATH@ $(srcdir)/src/win/exampleA.c` -o $@ +#======================================================================== + +$(src_generic_dir)/predefined.h: $(src_generic_dir)/mk_predefined.xotcl $(src_generic_dir)/predefined.xotcl + (cd $(src_generic_dir); $(TCLSH_PROG) mk_predefined.xotcl > predefined.h) + +xotclStubInit.$(OBJEXT): $(PKG_HEADERS) +xotclStubLib.$(OBJEXT): $(src_generic_dir)/xotclStubLib.c $(PKG_HEADERS) +xotcl.$(OBJEXT): $(src_generic_dir)/xotcl.c $(src_generic_dir)/predefined.h $(PKG_HEADERS) +xotclError.$(OBJEXT): $(src_generic_dir)/xotclError.c $(PKG_HEADERS) +xotclMetaData.$(OBJEXT): $(src_generic_dir)/xotclMetaData.c $(PKG_HEADERS) +xotclObjectData.$(OBJEXT): $(src_generic_dir)/xotclObjectData.c $(PKG_HEADERS) +xotclProfile.$(OBJEXT): $(src_generic_dir)/xotclProfile.c $(PKG_HEADERS) +xotclTrace.$(OBJEXT): $(src_generic_dir)/xotclTrace.c $(PKG_HEADERS) +xotclUtil.$(OBJEXT): $(src_generic_dir)/xotclUtil.c $(PKG_HEADERS) +xotclShadow.$(OBJEXT): $(src_generic_dir)/xotclShadow.c $(PKG_HEADERS) +aolstub.$(OBJEXT): $(src_generic_dir)/aolstub.c $(PKG_HEADERS) + +# +# Target to regenerate header files and stub files from the *.decls tables. +# + +genstubs: + $(TCLSH_PROG) $(TCL_TOOL_DIR_NATIVE)/genStubs.tcl $(src_generic_dir) \ + $(src_generic_dir)/xotcl.decls $(src_generic_dir)/xotclInt.decls + +# +# Target to check that all exported functions have an entry in the stubs +# tables. +# + +checkstubs: + -@for i in `nm -p $(PKG_LIB_FILE) | awk '$$2 ~ /T/ { print $$3 }' \ + | sort -n`; do \ + match=0; \ + for j in $(TCL_DECLS); do \ + if [ `grep -c $$i $$j` -gt 0 ]; then \ + match=1; \ + fi; \ + done; \ + if [ $$match -eq 0 ]; then echo $$i; fi \ + done + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + -rm -rf $(BINARIES) $(CLEANFILES) @XOTCLSH@ @XOWISH@ pkgIndex.tcl ./receiver + @if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \ + for dir in $$dirs ; do \ + if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \ + done; fi + +distclean: clean + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Library files go into the lib directory. +# In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: + @mkdir -p $(DESTDIR)$(pkglibdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \ + stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \ + if test "x$$stub" = "xstub"; then \ + echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \ + else \ + echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \ + fi; \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \ + fi; \ + fi; \ + fi; \ + done + @list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + destp=`basename $$p`; \ + echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \ + fi; \ + done + + +#======================================================================== +# Install binary executables (e.g. .exe files and dependent .dll files) +# This is for files that must go in the bin directory (located next to +# wish and tclsh), like dependent .dll files on Windows. +# +# You should not have to modify this target, except to define bin_BINARIES +# above if necessary. +#======================================================================== + +install-bin-binaries: + @mkdir -p $(DESTDIR)$(bindir) + @list='$(bin_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \ + fi; \ + done + +.SUFFIXES: .c .$(OBJEXT) + +#Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status +# cd $(top_builddir) \ +# && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +uninstall-binaries: + list='$(lib_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + p=`basename $$p`; \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(bin_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/$$p; \ + done + +$(DESTDIR)$(includedir): + $(mkinstalldirs) $@ +$(DESTDIR)$(bindir): + $(mkinstalldirs) $@ +$(DESTDIR)$(libdir): + $(mkinstalldirs) $@ +$(DESTDIR)$(pkglibdir): + $(mkinstalldirs) $@ +$(DESTDIR)$(pkglibdir)/apps: $(DESTDIR)$(pkglibdir) + $(mkinstalldirs) $@ +$(DESTDIR)$(mandir)/man1: + $(mkinstalldirs) $@ +$(DESTDIR)$(mandir)/man3: + $(mkinstalldirs) $@ +$(DESTDIR)$(mandir)/mann: + $(mkinstalldirs) $@ + +end: + @echo "" + @echo "************************************************************" + @echo " Make completed. In order to test XOTcl, invoke:" + @echo " make test" + @echo "" + @echo " In order install XOTcl, invoke:" + @echo " make install" + @echo "" + @echo " In order to install XOTcl for AOLserver 4.x, invoke:" + @echo " make install-aol" + @echo "" + @echo " In order to invoke XOTcl interactively (before install), use:" + @echo " export TCLLIBPATH=\"$(TCLLIBPATH)\" or " + @echo " setenv TCLLIBPATH \"$(TCLLIBPATH)\"" + @echo " and" + @if test "x$(XOTCLSH)" = "x" ; then \ + echo " @TCLSH_PROG@" ; \ + echo " package require XOTcl; namespace import -force xotcl::*" ; \ + echo " or" ; \ + echo " put the 'package require' line into your ~/.tclshrc" ; \ + else \ + echo " xotclsh" ; \ + fi + @echo "************************************************************" + +RPMSOURCES=/usr/src/redhat/SOURCES +RPMSPECS=/usr/src/redhat/SPECS + +rpm: tar + @if test ! -d $(RPMSOURCES); then mkdir -p $(RPMSOURCES); fi + @if test ! -d $(RPMSPECS); then mkdir -p $(RPMSPECS); fi + cp ../../xotcl-$(PACKAGE_VERSION).tar.gz $(RPMSOURCES) + cp xotcl.spec $(RPMSPECS)/xotcl-$(PACKAGE_VERSION).spec + rpmbuild -ba $(RPMSPECS)/xotcl-$(PACKAGE_VERSION).spec + +bin-tar: + (cd ../..; tar zcvf xotcl-$(PACKAGE_VERSION)-bin-linux-i686-glibc.tar.gz \ + `find $(exec_prefix)/bin/xotclsh $(exec_prefix)/bin/xowish \ + $(prefix)/include/xotcl*.h \ + $(prefix)/lib/$(PKG_LIB_FILE) \ + $(prefix)/lib/$(PKG_STUB_LIB_FILE) \ + $(DESTDIR)$(pkglibdir) $(prefix)/man/man1/xo* \ + -type f -o -type l | fgrep -v CVS | fgrep -v SCCS | fgrep -v .junk| fgrep -v .db | fgrep -v "~" | fgrep -v "#" | fgrep -v /receiver/` \ + ) + +tar: clean + (cd ..; tar zcvf ./xotcl-$(PACKAGE_VERSION).tar.gz \ + `find ./xotcl-$(PACKAGE_VERSION) -type f -o -type l| fgrep -v CVS | fgrep -v SCCS | fgrep -v Attic | fgrep -v "autom4te"| fgrep -v config\.status | fgrep -v "~"|fgrep -v .db | fgrep -v .junk | fgrep -v "#" | grep -v "/o$$"`) + + +.PHONY: all binaries clean depend distclean doc install libraries \ + test test-core test-actiweb + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: xotcl/README =================================================================== diff -u --- xotcl/README (revision 0) +++ xotcl/README (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,148 @@ +***************** $Id: README,v 1.1 2004/05/23 22:50:39 neumann Exp $ +XOTcl README File +***************** + +********************************** +Compilation of Source Distribution +********************************* +Read COMPILE for compilation guidance on UNIX or +COMPILE.win for Windows. + + +************************************ +Installation of Binary Distributions +************************************ + +For all binary distributions firstly Tcl and Tk must be installed +properly. Binary distributions require Tcl/Tk 8.3 (included in +most Linux distributions), which you can find from: + + http://dev.scriptics.com + + +Working with a Shell +-------------------- + +From version 1.1 on XOTcl does not - by default - build xotclsh and +xowish anymore. Instead you should use xotcl from tclsh or wish. The +typical way to do so is to load XOTcl as a packages and then import +the commands from the XOTcl namespace into the current namespace: + + /usr/local/bin/tclsh8.4 + package require XOTcl; namespace import -force xotcl::* + +That means, the XOTcl installed package library needs to be on Tcl's +search path for packages. + +If XOTcl is not installed in the standard Tcl location, you can either +set the environment variable TCLLIBPATH from outside of Tcl to this +location, or use the variable auto_path in Tcl. For instance, to use +the local, extracted tar ball, you can use something like (under +UNIX): + export TCLLIBPATH="./xotcl-1.1.0" or + setenv TCLLIBPATH "./xotcl-1.1.0" +Under Windows: + set TCLLIBPATH=".\xotcl-1.1.0" + + +Linux Binary Distribution +------------------------- + +Per default the Linux version install to usr/local and XOTcl +directories. If you want to install to these directions, just + cd / + tar xvfz xotcl-XXX.tar.gz +otherwise: + mkdir temp-xotcl + cd temp-xotcl + tar xvfz xotcl-XXX.tar.gz +and then copy the file in temp-xotcl/usr/local to your installation +destination and temp-dir/xotcl where you want to have the examples +and documentation. If the packages can not be found, try to +set the TCLLIBPATH. On Unix Systems: + +csh: setenv TCLLIBPATH "/usr/local/lib/xotcl-/ $(TCLLIBPATH)" +bash: export TCLLIBPATH="/usr/local/lib/xotcl-/ $(TCLLIBPATH)" + + +Windows Binary Release +---------------------- + +You need Tcl 8.3.1 installed properly. If necessary, get Tcl +8.3 for your system from + web site: http://dev.scriptics.com/software/tcltk/downloadnow83.tml + installer: http://dev.scriptics.com/download/tcl/tcl8_3/tcl832.exe + +Now check where Tcl is installed and what the name of the tclsh*.exe +is. If you installed Tcl 8.3.1, the name is tclsh83.exe. On my system +Tcl installs tclsh in c:\Programme\Tcl\bin (in English versions this +is most likely under c:\Program Files\Tcl\bin). + +On my system the tcl installer adds this directory automatically +to the search PATH; if this is not the case on your system, add this +directory manually to your PATH (under NT or Win2K, use: Control +Panel/System/.../Environment; MSDOS-class system use autoexec.bat to +add this directory to the PATH variable by a line like + SET PATH=c:\Progra~1\Tcl\bin;%PATH% +) and reboot. + +Now you should be able now to start the Tcl shell by typing "tclsh83". You +will see the % prompt. To exit the shell, type "exit". + +The xotcl*.zip file contains the XOTcl distribution. Unzip the +contents of the XOTcl zip file on c: to a directory "xotcl*." Open a +DOS box window and change to the XOTcl win directory, like: + + c: + cd \xotcl-\win + +Next, you have to invoke the installer: + + tclsh83 installWin.tcl + +The installer tries to install xotcl in the default directory +"\Program~1\Tcl", which should at least work on English and German +platforms (in English Windows distributions the program directory is +called "Program Files", in German versions, it is called "Programme"). + +If you want to install XOTcl at a different you can specify the target +directory as an argument of the installer: + + tclsh83 installWin.tcl /Programme/Tcl + +Now you should be able to use XOTcl by starting Tclsh and using: + + package require XOTcl; namespace import -force xotcl::* + +If XOTcl is not found on your system, you can set the TCLLIBPATH enviornment +variable to the location of xotcl, e.g.: + + set TCLLIBPATH="C:/PROGRA~1/TCL/lib/xotcl" + +Please note the slashes, do not use backslashes here! + +You can test your installation with: + +XOTcl Tests: + tclsh xotcl-/tests/testx.xotcl + tclsh xotcl-/tests/testo.xotcl + tclsh xotcl-/tests/speedtest.xotcl + tclsh xotcl-/tests/xocomm.test + tclsh xotcl-/tests/persistence.test + tclsh xotcl-/tests/xoRDF.test + +More Infos +---------- + +More information can be found at: + + http://www.xotcl.org + +You can find a mailing list about XOTcl there as well. + +Please report bugs and problems to the authors under one of these +email addresses: + + uwe.zdun@wu-wien.ac.at, zdun@xotcl.org + gustaf.neumann@wu-wien.ac.at, neumann@xotcl.org + Index: xotcl/aclocal.m4 =================================================================== diff -u --- xotcl/aclocal.m4 (revision 0) +++ xotcl/aclocal.m4 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1 @@ +builtin(include,tcl.m4) Index: xotcl/apps/COPYRIGHT =================================================================== diff -u --- xotcl/apps/COPYRIGHT (revision 0) +++ xotcl/apps/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/apps/actiweb/AgentClient.xotcl =================================================================== diff -u --- xotcl/apps/actiweb/AgentClient.xotcl (revision 0) +++ xotcl/apps/actiweb/AgentClient.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,152 @@ +#!../../src/xotclsh +#!/usr/local/bin/xotclsh +# $Id: AgentClient.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +#if {![info exists ACTIWEB_HOME]} {source ~/actiweb/paths.xotcl} + +package require xotcl::package +package verbose 1 + +package require xotcl::actiweb::agent +package require xotcl::actiweb::httpPlace + +Place p +set receiverHost localhost:8087 + +# +# if we migrate an object, we cannot send the result to [self] +# in this example we just use a small result printer object to +# print the result to the stderr stream +# +Object resultPrinter +resultPrinter proc printResult {o m code result} { + if {$code == "OK"} { + puts stderr "[self] -- Result -- $m:\n$result" + } else { + puts stderr "[self] -- Error -- $m: \n$result" + } +} + +Class CloneableClass -superclass {Agent Class} + +CloneableClass AgentExample -superclass Agent -parameter { + {invokeAgent hallo.txt} + {invokeMethod content} +} +AgentExample proc test-calls {} { + #showObj [self] + + set host [::set ::receiverHost] + my clone $host "" [list [self] class-cloned] +} +AgentExample proc class-cloned {args} { + my a1 + my a2 + my a3 + my a4 + a1 synchronousInvokeCall + a3 synchronousMigrateCall + a4 synchronousCloneCall + + #a1 asynchronousInvokeCall + #a1 asynchronousCloneCall + #a2 asynchronousMigrateCall + exit +} +AgentExample instproc computeXXX args { + return XXX--[my set var1]--XXXX +} +AgentExample instproc init args { + next + my set var1 xyz + my persistent var1 +} +AgentExample instproc synchronousInvokeCall args { + + set host [::set ::receiverHost] + my instvar invokeAgent invokeMethod + puts stderr "*******************[self]: [self proc]" + puts stderr "Result: [my syncInvoke $host $invokeAgent $invokeMethod]" +} +AgentExample instproc synchronousMigrateCall args { + set host [::set ::receiverHost] + puts stderr "*******************[self]: [self proc]" + set result [my syncMigrate $host computeXXX] + puts stderr "Result: '$result'" +} +AgentExample instproc synchronousCloneCall args { + set host [::set ::receiverHost] + puts stderr "*******************[self]: [self proc]" + set result [my syncClone $host computeXXX] + puts stderr "Result: '$result'" +} +AgentExample instproc asynchronousInvokeCall args { + set host [::set ::receiverHost] + my instvar invokeAgent invokeMethod + puts stderr "*******************[self]: [self proc]" + my invoke [list resultPrinter printResult my INVOKE] $host $invokeAgent $invokeMethod +} +AgentExample instproc asynchronousCloneCall args { + set host [::set ::receiverHost] + puts stderr "*******************[self]: [self proc]" + my clone $host computeXXX [list resultPrinter printResult my CLONE] +} +AgentExample instproc asynchronousMigrateCall args { + set host [::set ::receiverHost] + puts stderr "*******************[self]: [self proc]" + my migrate $host computeXXX [list resultPrinter printResult my MIGRATE] +} + + +#AgentExample instproc callSet args { +# set host localhost:8087 +# set agent welcome +# +# puts stderr INVOKE******************************* +# set r [my invoke $host welcome set+a+1] +# puts stderr result=$r +#} + +AgentExample instproc destroy args { + next +} + +Agent registryTest + +registryTest proc test args { + set host localhost:8087 + my createRequest "[self] testOnPlaceName $host" http://$host/ +} + +registryTest proc testOnPlaceName {host placeName} { + set place [Place getInstance] + set subject "http://[$place host]:[$place port]/[self]" + + RDFdb [self]::db + [self]::db add "http://nestroy.wi-inf.uni-essen.de/schema/service#name" \ + $subject registryTest + [self]::db add "http://nestroy.wi-inf.uni-essen.de/schema/xotcl#class" \ + $subject [my info class] + # + # place info als bag machen ... + # + [self]::db add "http://nestroy.wi-inf.uni-essen.de/schema/agent#place" \ + $subject $place + + set rdfText [${place}::rdfCreator createFromTriples [[self]::db getTriples]] + + [self]::db destroy + + my invoke $host ${placeName}::registry register $rdfText + + set r [my invoke $host ${placeName}::registry query registryTest] + puts "************************Query: $r\n" + set r [my invoke $host ${placeName}::registry queryProperty http://nestroy.wi-inf.uni-essen.de/schema/agent\#place ::p] + puts "************************QueryProperty: $r\n" +} + + +p exportedObjs client +#p startEventLoop "registryTest test" +#p startEventLoop "client callWelcome; registryTest test" +p startEventLoop "AgentExample test-calls" + Index: xotcl/apps/actiweb/Counter.README =================================================================== diff -u --- xotcl/apps/actiweb/Counter.README (revision 0) +++ xotcl/apps/actiweb/Counter.README (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,61 @@ +* $Id: Counter.README,v 1.1 2004/05/23 22:50:39 neumann Exp $ +* +* Variationen des Counter-Themas im ActiWeb: +* (Zeilenangaben ohne Kommentare und Leerzeilen) +* +* + +1) Counter.xotcl (22 Zeilen) + + Die Klasse Counter wird als Spezialisierung von HtmlDocument + definiert ("Ein Dokument mit weiteren Methoden") + + Aufruf: + http://localhost:8090/counter-1.html + http://localhost:8090/counter-2.html + + +2) Counter2.xotcl (32 Zeilen) + + Die Klasse Counter wird als Spezialisierung von WebAgent + definiert, der ein plain/text interface besitzt. Zus�tzlich + wird eine Web-Facade definiert, die fuer die HTML-spezifische + Pr�sentation des WebAgenten sorgt. + + Aufruf: + http://localhost:8091/htmlUI+invoke+c1 + http://localhost:8091/htmlUI+invoke+c2 + + +3) Counter3.xotcl (28 Zeilen) + + Die Klasse Counter wird v�llig unabh�ngig von jeder + Web-Nutzung definiert (Sachmodell). Als Spezialisierung + dieser Counter-Klasse wird die Klasse Web-Counter definiert, + die auch von HTML-Document erbt. Diese Klasse ist fuer + die HTML-Aufbereitung zust�ndig. Es werden Instanzen von + Web-Counter erzeugt. + + Aufruf: + http://localhost:8093/c1 + http://localhost:8093/c2 + + +4) Counter4.xotcl (33 Zeilen) + + Die Klasse Counter wird v�llig unabh�ngig von jeder + Web-Nutzung definiert (Sachmodell). Ebenso unabh�ngig + von der Web-Nutzung wird PersistentCounter als + spezialisierte Counter-Klasse definiert. Von diesen persistenten + Countern werden Instanzen gebildet (web-unabhaengig). + + Als weitere Instanzen werden Proxy-Objekte erzeugt, + die f�r die HTML-Aufbereitung zust�ndig sind, und die + hereinkommende Requests an die im "Hintergrund" existierenden + eigentlichen Objekte weitergeben, und deren Ergebnisse + entsprechend aufbereiten. Es werden nur die Proxy-Objekte + exportiert, nur diese sind ueber den Web-Server ansprechbar. + + Aufruf: + http://localhost:8094/wc1 + http://localhost:8094/wc2 Index: xotcl/apps/actiweb/Counter.xotcl =================================================================== diff -u --- xotcl/apps/actiweb/Counter.xotcl (revision 0) +++ xotcl/apps/actiweb/Counter.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ +#!../../src/xotclsh +# $Id: Counter.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +array set opts {-pkgdir .}; array set opts $argv +lappend auto_path $opts(-pkgdir) + +package require XOTcl; namespace import -force xotcl::* +package require xotcl::actiweb::htmlPlace +package require xotcl::actiweb::webDocument + +### Instantiate an Html place with the name receive and port 8090 +HtmlPlace ::receiver -port 8090 -allowExit exit + +### Define a class Counter as a special Html Document +Class Counter -superclass HtmlDocument -parameter {{count 0}} + +Counter instproc init args { ;### Constructor + next + my persistent count ;### make count variable persistent + ::receiver exportObjs [self] ;### export the counter object + my exportProcs increment ;### export counter's increment method +} +Counter instproc default {} { ;### Method for updating HTML page + set objName [string trimleft [self] :] + return "The value in $objName is now: [my set count].

+ Increment Counter

+


Last Update: [clock format [clock seconds]] + \n" +} +Counter instproc increment {} { ;### exported increment method + my incr count + return [my default] +} + +### Create two counter instances with the names +### counter-1.html and counter-2.html +Counter counter-1.html +Counter counter-2.html + +### Start event loop and handle connections +receiver startEventLoop + Index: xotcl/apps/actiweb/Counter2.xotcl =================================================================== diff -u --- xotcl/apps/actiweb/Counter2.xotcl (revision 0) +++ xotcl/apps/actiweb/Counter2.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,64 @@ +#!../../src/xotclsh +# $Id: Counter2.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +array set opts {-pkgdir .}; array set opts $argv +lappend auto_path $opts(-pkgdir) + +package require XOTcl; namespace import -force xotcl::* +package require xotcl::actiweb::htmlPlace +package require xotcl::actiweb::pageTemplate + +HtmlPlace ::receiver -port 8091 -allowExit exit + +### +### The counter class is an agent implementing the business logic +### +Class Counter -superclass Agent -parameter {{count 1}} + +Counter instproc init args { ;### Constructor + next ;### Call superclass constructor + my persistent count ;### make count variable persistent +} +Counter instproc increment {} { ;### increment method + my incr count +} +### Create two counter instances c1/c2 +Counter c1 +Counter c2 + +### +### Define a specialization of web object as a facade to the counters +### The Page Template Mixin defines the HTML appearance +### + +### Define an HTML Page Template +Class WebCounter -superclass WebObject \ + -instmixin PageTemplateHtml -parameter {counter} + +WebCounter instproc init args { + next + [my set place] exportObjs [self] ;### export the web counter object + my exportProcs increment ;### export counter's increment method +} +WebCounter instproc increment {} { ;### A method that decorates increment with HTML appearence + my instvar counter ;### import var that stores shielded web agent + $counter [self proc] ;### call the actual method on the web agent + my default ;### update HTML page +} +WebCounter instproc default {} { ;### Method for updating HTML page + my instvar count counter ;### importiere var that stores shielded web agent + $counter instvar count ;### importiere count var + # + # and create web-page with counter content + # + my simplePage [self] "Html-Facade for $counter using a page template" \ + "The value in $counter is $count.

+ Increment Counter

" +} +# +# create two web-facade instances; one for each counter +# +WebCounter web-c1 -counter c1 +WebCounter web-c2 -counter c2 + +### Start event loop and handle connections +receiver startEventLoop Index: xotcl/apps/actiweb/Counter3.xotcl =================================================================== diff -u --- xotcl/apps/actiweb/Counter3.xotcl (revision 0) +++ xotcl/apps/actiweb/Counter3.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,44 @@ +#!../../src/xotclsh +# $Id: Counter3.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +array set opts {-pkgdir .}; array set opts $argv +lappend auto_path $opts(-pkgdir) + +package require XOTcl; namespace import -force xotcl::* +package require xotcl::actiweb::htmlPlace +package require xotcl::actiweb::webDocument + +### Instantiate an Html place with the name receiver +HtmlPlace ::receiver -port 8093 -allowExit exit + +### Define a class solely for counting +Class Counter -parameter {{count 1}} +Counter instproc increment {} { ;### counter method + my incr count +} + +### Define a special WebCounter as a specialization of the Counter class +Class WebCounter -superclass {Counter HtmlDocument} +WebCounter instproc init args { ;### Constructor + next + my persistent count ;### make count variable persistent + ::receiver exportObjs [self] ;### export the counter object + my exportProcs increment ;### export increment method +} +WebCounter instproc default {} { ;### Method for updating HTML page + set objName [string trimleft [self] :] + return "The value in $objName is [my set count].

+ Increment Counter

+


Last Update: [clock format [clock seconds] -format %m/%d/%y-%H:%M] + \n" +} +WebCounter instproc increment {} { ;### exported increment method + next ;### call superclasses' increment + my default ;### display the result as HTML +} + +### Create two web counter instances with the names c1 and c2 +WebCounter c1 +WebCounter c2 + +### Start event loop and handle connections +receiver startEventLoop Index: xotcl/apps/actiweb/Counter4.xotcl =================================================================== diff -u --- xotcl/apps/actiweb/Counter4.xotcl (revision 0) +++ xotcl/apps/actiweb/Counter4.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,56 @@ +#!../../src/xotclsh +# $Id: Counter4.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +array set opts {-pkgdir .}; array set opts $argv +lappend auto_path $opts(-pkgdir) + +package require XOTcl; namespace import -force xotcl::* +package require xotcl::actiweb::htmlPlace +package require xotcl::actiweb::webDocument + +### Instantiate an Html place with the name receiver +HtmlPlace ::receiver -port 8094 -allowExit exit + +### Define a class solely for counting +Class Counter -parameter {{count 1}} +Counter instproc increment {} { ;### counter method + my incr count +} + +### Definiere a Counter subclass for persistent counting +Class PersistentCounter -superclass Counter +PersistentCounter instproc init args { ;### Constructor + next ;### call superclasses' init + my mixinStrategy Persistent=Eager + my persistenceMgr [Place getInstance]::agentPersistenceMgr + my persistent count ;### make count variable persistent +} + +### Create two persistent counter instances with the names c1 and c2 +PersistentCounter c1 +PersistentCounter c2 + + +### Definiere a proxy class, that handles HTML decoration +### HtmlProxy forwards all unknown calls to "realSubject" +Class HtmlProxyCounter -superclass HtmlProxy +HtmlProxyCounter instproc init args { ;### Constructor + next + my exportProcs increment ;### export increment method +} +HtmlProxyCounter instproc default {} { + my instvar realSubject + $realSubject instvar count + set objName [string trimleft [self] :] + return "The value in $realSubject is $count.

+ Increment Counter

+


Last Update: [clock format [clock seconds] -format %m/%d/%y-%H:%M] +] + \n" +} + +### Create two proxy instances wc1 und wc2 +HtmlProxyCounter wc1 -realSubject c1 +HtmlProxyCounter wc2 -realSubject c2 + +### Start event loop and handle connections +receiver startEventLoop Index: xotcl/apps/actiweb/FormsWithState.xotcl =================================================================== diff -u --- xotcl/apps/actiweb/FormsWithState.xotcl (revision 0) +++ xotcl/apps/actiweb/FormsWithState.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,205 @@ +#!../../src/xotclsh +# $Id: FormsWithState.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# +# Demo Program for Multi-Page Forms implemented via hidden +# Form Fields -gn +# +package require XOTcl; namespace import -force xotcl::* +package require xotcl::actiweb::htmlPlace +package require xotcl::actiweb::webDocument +HtmlPlace receiver -port 8086 + +# The following class is used to define HTML-pages +Class HTMLPage -superclass HtmlDocument -parameter { + {pageContent ""} + {pageTitle ""} + {pageHeader ""} + endCmd +} + +HTMLPage instproc init args { + receiver exportObjs [self] + next +} + +# instproc default is evoked whenever an HTMLDocument object +# is called without a specific method. +HTMLPage instproc default args { + my instvar content + # creates HTML page content + set content + append content \ + [my set pageTitle] \ + [my set pageHeader] \n \ + [my set pageContent] + # substitutes all embedded commands and variables in content + set content [subst $content] + + # An HTMLPage can provide a command, which is executed after + # the content is computed; this mechanism is used here for deleting + # the context object + if {[my exists endCmd]} { + eval [my set endCmd] + } + # next sends content to the client + next +} + +# The form state is kept in a context object. The method varname +# accesses variables from the context object or returns empty values. +HTMLPage instproc get varname { + my instvar context + if {[$context exists $varname]} { + return [$context set $varname] + } else { + return "" + } +} + +# The final page will contain a table with all the variables in +# the context object +HTMLPage instproc printAll {} { + my instvar context + set result " +
  + + + \n" + # creates a table row for each variable and + # it's value of the current context object + foreach var [$context info vars] { + append result \ + \n + } + return "$result
+ Submission
+ You submitted the following values: +
   
$var:[$context set $var]
\n
" +} + +HTMLPage form1 +form1 proc default {} { + set values {} + # process the form data from post method + foreach a [my getFormData] { + set name [$a set name] + switch -glob $name { + *.html {set nextPage $name} + context {set context [$a set content]} + default {lappend values $name [$a set content]} + } + } + # save the form data in the context object + foreach {name value} $values { + $context set $name $value + } + if {![info exists nextPage]} { + # We assume, we are called the first time... + # Create a new context object and call the first page + set context [Object new] + set nextPage [self]/page1.html + } + $nextPage set context $context + # delegeate to the actual form page + $nextPage default +} + +HTMLPage form1/page1.html -pageTitle "First Page" -pageContent { +
+ + + + + +
  + + + + + + + + + +
+ + Primary Contact information
+ Please supply us with full details of + the person who will act as the + person we will contact about this paper. +
   
+ First Name:
+ +
+
+ Second Name:
+ +

+
+ +
+
+} + + +HTMLPage form1/page2.html -pageTitle "Second Page" -pageContent { + + + +
  + + + + + + + + + + + + + +
+ Title and Autors
+ Please supply full title of the paper and the contributing authors. +
  
+ Title:
+ +

+
+ Authors:
+ +

+
+ + + +
+
+} + +### submit.html ist the final page; the context object is destroyed here +HTMLPage form1/submit.html \ + -endCmd {[my set context] destroy} \ + -pageTitle "Third Page" -pageContent { + [my printAll] +

Many thanks for your submission!

+ } + +### provide a default page for the receiver +receiver proc default args { + return { + +

Welcome to the paper provision page

+ In order to fill out the form, press + here + + } +} + +receiver startEventLoop Index: xotcl/apps/actiweb/MC.xotcl =================================================================== diff -u --- xotcl/apps/actiweb/MC.xotcl (revision 0) +++ xotcl/apps/actiweb/MC.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,212 @@ +#!../../src/xotclsh +# $Id: MC.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# +# A simple multiple choice test application +# +array set opts {-pkgdir .}; array set opts $argv +lappend auto_path $opts(-pkgdir) + +package require XOTcl; namespace import -force xotcl::* +#package require xotcl::package; package verbose 1 +package require xotcl::actiweb::htmlPlace +package require xotcl::actiweb::pageTemplate + +HtmlPlace ::receiver -port 8092 -allowExit exit + +# Define a pool of questions: Question and their alternatives +# are defined as classes and all questions are stored in the pool +# +Class Pool +Class Pool::Question -parameter {text {altcounter 1}} +Class Pool::Question::Alternative -parameter {text correct} + +Pool::Question instproc alternatives {pairs} { + my instvar altcounter + foreach {alt correct} $pairs { + incr altcounter + [self class]::Alternative [self]::$altcounter \ + -text $alt -correct $correct + } +} + + +# +# An Exam has a name and is a selection of questions from a pool. +# "requiredCorrect" defines the minimal number of correct answers +# to pass the test. + +Class Exam -parameter {name requiredCorrect pool questions} + + +# +# For every candidate we create an individual exam. We scramble +# the questions and alternatives and use the studentID as a seed. +# + +Class IndividualExam -superclass Agent -parameter {ID exam} + +IndividualExam instproc random modulo { ;### random number generator + my instvar seed + set seed [expr {($seed*12731+34197) % 21473}] + return [expr {$seed % $modulo}] +} +IndividualExam instproc permute {list} { ;### permute random permutation + set permuted {} + for {set nr [llength $list]} {$nr>0} {incr nr -1} { + set select [my random $nr] + lappend permuted [lindex $list $select] + set list [lreplace $list $select $select] + } + return $permuted +} +IndividualExam instproc init args { + my instvar seed ID exam individualTest alternatives + set questions [$exam set questions] + set seed $ID + ### compute order of individual tests and alternatives + foreach index [my permute [$exam set questions]] { + set questionObj [$exam set pool]::$index + lappend individualTest $index + set alts [my permute [lsort [$questionObj info children]]] + lappend alternatives $alts + } + #puts stderr "Individual test [self] has $individualTest" +} + +# +# Define a web facade using a page template +# "testObject" is the individual test that is shielded by the web facade +# +Class WebExam -superclass WebObject \ + -instmixin PageTemplateHtml -parameter {testObject} +WebExam instproc default {} { ;### This method creates the HTML Test + my instvar testObject ;### import var that stores shielded test object + ### import vars from the test + $testObject instvar individualTest alternatives exam + set action [my selfAction result] + ### create Test page + set htmlText "\n
    \n" + ### iterate over the set of questions/alternatives + ### and add them to the HTML text + foreach question $individualTest alts $alternatives { + append htmlText "
  1. [[$exam pool]::$question text]\n
      \n" + foreach a $alts { + append htmlText "
    • \ + [$a text] ([$a correct])\n" + } + append htmlText "

    \n" + } + ### we have to add a hidden form field, otherwise we get no result, + ### if nothing is tagged + append htmlText "" + ### the submit button lets us send the result back + append htmlText "

\n" + ### create simple HTML Page + my simplePage [$exam name] \ + "Exam [$exam name] for [string trimleft $testObject :] \ + (Exam: $exam)" $htmlText +} +WebExam instproc result {} { ;# This method analyses the results of the test + my instvar testObject ;### import var that stores shielded test + set exam [$testObject exam] + $testObject instvar individualTest alternatives + foreach question $individualTest alts $alternatives { + foreach a $alts {set ca($a) 0} + } + foreach a [my getFormData] {set ca([$a set content]) 1} + set htmlText "You have answered:
    " + array set answerText {0 " -- answered no\n" 1 " -- answered yes\n"} + array set correctText {0 "\n -- Wrong.
    \n" 1 "\n -- Correct.
    \n"} + set correctAnswers 0 + foreach q $individualTest { + set correct 1 + append htmlText "
  • [[$exam pool]::$q text]:
    \n" + foreach alternative [[$exam pool]::$q info children] { + set altCorrect [expr {$ca($alternative) == [$alternative correct]}] + append htmlText [$alternative text]\n \ + $answerText($ca($alternative)) \ + $correctText($altCorrect) + set correct [expr {$correct && $altCorrect}] + } + if {$correct} {incr correctAnswers} + } + append htmlText
\n + if {$correctAnswers < [$exam requiredCorrect]} { + my simplePage [self] "Sorry" "$htmlText\ + Only $correctAnswers question were answered correctly. You have not succeeded :(" + } else { + my simplePage [self] "Congratulations" "$htmlText\ + $correctAnswers questions were answered correctly. You have succeeded :-)" + } +} +WebExam instproc init args { + next + [my place] exportObjs [self] ;# export object + my exportProcs result ;# export methods +} + + + + + +# Create a Pool P with 6 example questions with 3 alternatives for each. + +Pool p +Pool::Question p::1 \ + -text "When was the first XOTcl Version released?" -alternatives { + "1998" 0 + "1999" 1 + "2000" 0 + } +Pool::Question p::2 -text "Who is author of XOTcl?" -alternatives { + "Gustaf Neumann" 1 + "Mika Haekinnen" 0 + "Uwe Zdun" 1 +} +Pool::Question p::3 -text "Which of the systems are other OO extensions of Tcl?" \ + -alternatives { + "XTCL" 0 + "ITCL" 1 + "OTCL" 1 + } +Pool::Question p::4 \ + -text "Which methods are provided by the Object class?" -alternatives { + "set" 1 + "instvar" 0 + "filter" 1 + } +Pool::Question p::5 \ + -text "Which methods are provided by the Object class?" -alternatives { + "unset" 1 + "instproc" 0 + "mixin" 1 + } +Pool::Question p::6 \ + -text "Which methods are provided by the Class class?" -alternatives { + "proc" 0 + "instproc" 1 + "mixin" 0 + } + +### Define an exam + +Exam xotclTest \ + -pool p \ + -name "XOTcl Test" \ + -questions {1 2 3 4 5} \ + -requiredCorrect 4 + + +### Define two Student tests with the XOTcl Test + +foreach {Student ID} { + Uwe 7850247 + Gustaf 7850248 +} { + ## Define the individual exams + IndividualExam $Student -exam xotclTest -ID $ID + ### Define a web facade for each student + WebExam $Student.html -testObject $Student + +} +receiver startEventLoop Index: xotcl/apps/actiweb/Receiver.xotcl =================================================================== diff -u --- xotcl/apps/actiweb/Receiver.xotcl (revision 0) +++ xotcl/apps/actiweb/Receiver.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,23 @@ +#!../../src/xotclsh +#!/usr/local/bin/xotclsh +#if {![info exists ACTIWEB_HOME]} {source ~/actiweb/paths.xotcl} +package require XOTcl; namespace import -force xotcl::* + +package require xotcl::actiweb::htmlPlace +package require xotcl::actiweb::webDocument + +HtmlPlace receiver -port 8087 + +HtmlDocument hallo.txt -content "************ HALLO *************" +receiver exportObjs hallo.txt +hallo.txt exportProcs content +#hallo.txt attachFile ~/public_html/index.html +Class CloneableClass -superclass {Agent Class} + +FileObjectifier do +do objectifyTree receiver ~/public_html + +#GraphicDirectoryObjectifier gdo +#gdo objectifyTree receiver ~www/bilder/Einweihung/disk1/ + +receiver startEventLoop Index: xotcl/apps/actiweb/examples.README =================================================================== diff -u --- xotcl/apps/actiweb/examples.README (revision 0) +++ xotcl/apps/actiweb/examples.README (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,71 @@ +* $Id: examples.README,v 1.1 2004/05/23 22:50:39 neumann Exp $ +* +* This directory contains several simple ActiWeb introductory examples +* + +* +* 4 Variations of the counter theme: +* + +1) Counter.xotcl (22 lines) + + The class counter is a special HtmlDocument that is made active + by adding methods to the document. + + After starting the program, you can call it from your web browser: + http://localhost:8090/counter-1.html + http://localhost:8090/counter-2.html + + +2) Counter2.xotcl (32 lines) + + The Class Counter is a special WebAgent, with a plain/text + interface. Additionally it has an HTML Facade that shields + the sub-system and allows to access the web agent with an + HTML presentation. + + The plain/text interface is: + http://localhost:8091/c1 + http://localhost:8091/c2 + The web facades are: + http://localhost:8091/web-c1 + http://localhost:8091/web-c2 + + +3) Counter3.xotcl (28 lines) + + This example demonstrates how an existing business logic (here: + a small Counter class) can be enhanced with a web representation. + A class WebCounter inherits from Counter and from HtmlDocument. + The two web counter instances are accessible via: + http://localhost:8093/c1 + http://localhost:8093/c2 + + +4) Counter4.xotcl (33 lines) + + The Counter class and a derived persistent counter are + independent of any web usage. Two instances c1 and c2 -- that + are inpendent from the usage as web counters -- are created. + + Two proxy object w1 and w2 handle the HTML decoration and forward + the calls to the persistent counter instances c1/c2 as the real + subjects for handling the calls. Only the proxies are exported, because + c1/c2 can not be reached via the web server. + + Calls: + http://localhost:8094/wc1 + http://localhost:8094/wc2 + +* +* A simple Multiple Choice Test: MC.xotcl +* + + The multiple choice test implements a simple test and evaluation + and a web facade for the test. + + Calls: + http://localhost:8092/Gustaf.html + http://localhost:8092/Uwe.html + + Index: xotcl/apps/actiweb/securePlaceDemo.xotcl =================================================================== diff -u --- xotcl/apps/actiweb/securePlaceDemo.xotcl (revision 0) +++ xotcl/apps/actiweb/securePlaceDemo.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,82 @@ + + +package require XOTcl; namespace import -force xotcl::* + +# DEMO OF USE OF ACTIWEB AND SSL +# 03/09/01 klaus.kolowratnik@wu-wien.ac.at +# version 0.806 + +# USAGE: +# +# For secure http connections under Tcl or XOTcl we need the tls-package. +# The following code was tested with tls-version 1.4 successfully. +# Download the tls1.4-package from the TLS-Homepage +# (http://sourceforge.net/projects/tls/) and install the +# tarball (tls1.4.1-linux-x86.tar.gz) in your local filesystem. +# You have to append the path of the tls-package to the +# Tcl-variable "auto_path" as seen in the example below +# +# lappend auto_path $homeDir/tls1.4 $homeDir/projects/actiweb +# +# Don't forget to add the tls-package to your "pkgIndex.tlc"-file! +# +# package ifneeded tls 1.4 "[list load [file join $dir libtls1.4.so] ] ; \ +# [list source [file join $dir tls.tcl]]" +# +# For secure http connections ("http://...") we need at least the Actiweb/XOTcl- +# package "secureHtmlPlace": +# +# package require xotcl::actiweb::secureHtmlPlace +# package require xotcl::actiweb::webDocument +# +# We have to register the private server-keyfile and the certifcates +# of the local server and the certification authority. +# If you want to create own self-signed certificates, you can use the +# "SimpleCA"-Certification Authority (http://users.skynet.be/ballet/joris/SimpleCA). +# +# This example uses the following certificates and key-files: +# +# server.key private key of the local server which is run by this program +# server.pem certificate of the local server which is run by this program +# in PEM-format +# cacert.pem certificate of the certification authority +# +# +# SecureHtmlPlace ::receiver -port 8443 -keyfile server.key \ +# -certfile server.pem -cafile cacert.pem +# +# With this changes a https-server with XOTcl can be run. +# +# 2003/11/19 Klaus.Kolowratnik@wu-wien.ac.at + +set homeDir ~h9252717; # home-directory of Klaus +lappend auto_path $homeDir/packages + +package require xotcl::actiweb::htmlPlace +package require xotcl::actiweb::secureHtmlPlace +package require xotcl::actiweb::webDocument + +#HtmlPlace ::receiver -port 8445 +SecureHtmlPlace ::receiver -port 8445 -keyfile server.key -certfile server.pem -cafile cacert.pem + +HtmlDocument test-1.txt -content "************ TEST-1 *************" +::receiver exportObjs test-1.txt +test-1.txt exportProcs content +#test-1.txt attachFile ~/public_html/index.html + +HtmlDocument test-2.txt -content "************ TEST-2 *************" +::receiver exportObjs test-2.txt +test-2.txt exportProcs content + +set readme "This Web-Server uses XOTcl (www.xotcl.org) and Actiweb" +HtmlDocument readme.txt -content $readme +::receiver exportObjs readme.txt +readme.txt exportProcs content + +FileObjectifier do +do objectifyTree ::receiver ~/public_html + +#GraphicDirectoryObjectifier gdo +#gdo objectifyTree ::receiver ~www/bilder/Einweihung/disk1/ + +::receiver startEventLoop Index: xotcl/apps/actiweb/univ/UNIVERSAL.css =================================================================== diff -u --- xotcl/apps/actiweb/univ/UNIVERSAL.css (revision 0) +++ xotcl/apps/actiweb/univ/UNIVERSAL.css (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,21 @@ +A {color: yellow; } +A:selected {color: red; } +A:visited {color: #6699FF; } + +BODY {background-color: #000066; color: #FFFFFF; margin-left: 10; shading: no;} + +B.outer { background-color: #000066; color: #FFFFFF; } +B.inner,TD { background-color: #110088; color: #FFFFFF; } + +H1,H2 {font-family:Helvetica,sans-serif; text-align:center; } +H3 {font-family:Helvetica,sans-serif; color: #FFFFFF;} +HR {align:center; shading:no;} +LI,UL,OL {font-family:Helvetica,sans-serif; } + +TABLE {shading: no; border-style: solid; border-color: solid red; background-color: #110088;} + + +TH {font-family:Helvetica,sans-serif;} +DT {font-family:Helvetica,sans-serif; font-weight:bold;} + + Index: xotcl/apps/actiweb/univ/UNIVERSAL.jpg =================================================================== diff -u Binary files differ Index: xotcl/apps/actiweb/univ/UNIVERSAL.rdf =================================================================== diff -u --- xotcl/apps/actiweb/univ/UNIVERSAL.rdf (revision 0) +++ xotcl/apps/actiweb/univ/UNIVERSAL.rdf (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,204 @@ + + + + Object Oriented Design and System Development + + Introduction to the concepts of object-oriented programing ... + + Course + WUW-WI-0012346 + + + object-oriented design + software architecture + + + de + application/pdf + 56000 + http://nm.wu-wien.ac.at/Lehre/oo1/01-handout.pdf + Student + 2 to 4 days + University Second Cycle + Lecture + + Author + Prof. Gustaf Neumann + 01.12.1999 + + 1.0 + -- + 2 + en + + Discipline + Information Systems + + + + + Introduction in the programming language object rexx + + This lecture offers an introduction of the programming language 'object rexx'. + + Course + WUW-WI-0011344 + + + rexx + UML + CORBA + + + de + text/html + 0 + http://wwwi.wu-wien.ac.at/Studium/Abschnitt_2/LVA_allgemein/rexx.html + Student + 3 weeks + University First Cycle + Lecture + + Author + Prof.H. Werthner + 01.11.1999 + + 1.0 + -- + 2 + en + + Discipline + Information Systems + + + + + Object Oriented Development of Web-Based Applications + + This lecture offers the basic knowledge about the Internet and + Internet Protocols from an applied point of view. Half of the + lectures present the theoretical background knowledge, and the other + half exercises this knowledge with practical examples.... + + Course + WUW-WI-0012345 + + + TCP/IP + Web Technolgy + Application Server + Agent Systems + XML + RDF + + + de + application/pdf + 14000 + http://nm.wu-wien.ac.at/Lehre/oo2/01-handout.pdf + Student + 2 to 4 days + University Second Cycle + Lecture + + Author + Prof. Gustaf Neumann + 01.01.2000 + + 1.0 + -- + 2 + en + + Discipline + Information Systems + + + + + Legal aspects of information processing + + Introduction of the occuring legal problems in context of the use of information systems + + Course + WUW-WI-0036589 + + + information systems + legal aspects + data processing + + + de + text/html + 0 + http://wwwi.wu-wien.ac.at/Studium/Abschnitt_2/Wahlfach/recht_vo.html + Student + 1 month + University Second Cycle + Lecture + + Author + Dr. Walter Blocher + 01.01.1999 + + 2.1 + -- + 2 + en + + Discipline + Information Systems + + + + + Electronic cash, payment systems and security + + Introduction to electronic cash systems + + Course + WUW-WI-00352228 + + + electronic cash + security + electronic market place + + + de + application/zip + 230000 + http://wwwi.wu-wien.ac.at/finanz/elekgeld.zip + Student + 6 weeks + University Second Cycle + Lecture + + Author + Prof. G. M�ller + 01.01.1998 + + 2.1 + -- + 2 + en + + Discipline + Information Systems + + + + + + Index: xotcl/apps/actiweb/univ/UNIVERSAL.xotcl =================================================================== diff -u --- xotcl/apps/actiweb/univ/UNIVERSAL.xotcl (revision 0) +++ xotcl/apps/actiweb/univ/UNIVERSAL.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,263 @@ +#!/usr/local/bin/xotclsh +#$Id: UNIVERSAL.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package require XOTcl; namespace import -force xotcl::* +array set opts { + -ssl 0 -instanceFile UNIVERSAL.rdf -cssFile UNIVERSAL.css -root . -pkgdir .} +array set opts $argv + +@ @File { + description { + This is a demo of a Webserver that presents the contents of + an RDF source file in a friendly and easy readable manner. +

+ The RDF file is parsed first into triples which + are added to the resource database RDFdb. This RDFdb used in this + example replaces the standard triple database of xoRDF by an + application specific version, which is easier to process. The triple + database is the source of the Catalog, which displays a short, easy to read + summary of the entries. The database is used as well for the "detailed + view", which presents all the data of the triples through nested HTML tables. +

+ The demo program uses either HTTP or HTTPS (in which case you will require + the SSL/TLS extension of Tcl). + } +} + +lappend auto_path $opts(-pkgdir) +if {$opts(-ssl)} { + package require xotcl::actiweb::secureHtmlPlace + SecureHtmlPlace ::receiver -port 443 -root $opts(-root) +} else { + package require xotcl::actiweb::htmlPlace + HtmlPlace ::receiver -port 8095 -root $opts(-root) -allowExit exit +} +package require xotcl::actiweb::webDocument + +# load RDF processing components +package require xotcl::rdf::parser +package require xotcl::rdf::triple +package require xotcl::xml::printVisitor + +proc loadFile filename { + set F [open $filename r]; set c [read $F]; close $F + return $c +} +# +# instantiate parser and parser an example text into a node tree +# +RDFParser R +R parse [loadFile $opts(-instanceFile)] + + +# +# load the nodetree from the parser into the triple database +# +#section Triples +TripleVisitor tv -parser R +tv proc interprete {} { + my instvar topNode parser + if {![my exists topNode]} {set topNode ${parser}::topNode0} + my reset + my interpretNodeTree $topNode +} + +#### Define a simple Resource Database +Class RDFdb -superclass RDFTripleDB +RDFdb instproc isContainer c { + regexp ^[self]::rdfdoc\# $c +} +RDFdb instproc add {predicate subject object} { + set s [self]::$subject + if {[my info children $s] == ""} { + #puts stderr "create new resource $s" + Resource create $s + } + $s set $predicate $object + next ;# for passing to RDFTripleDB (which provides e.g. prettyTriples) +} +RDFdb instproc reset {} { + foreach c [my info children] { $c destroy } + next +} +RDFdb instproc resources {} { + set result "" + foreach c [my info children] { + if {![my isContainer $c] && + [$c info class] != "::RDFTriple"} {lappend result $c} + } + return $result +} +RDFdb instproc querySubject {subject} { + set s [self]::$subject + set result "" + if {[my info children $s] != ""} { + foreach att [lsort [$s info vars]] { + lappend result $att [$s set $att] + } + } + return $result +} +# create an Instance of the Resource Database +RDFdb tv::db + + +# define Resources with its methods +Class Resource +Resource instproc dump {} { + foreach att [lsort [my info vars]] { puts stderr "\t$att = [my set $att]" } +} +Resource instproc substitute {lines} { + set result "" + foreach line [split $lines \n] { + if {[regexp {^ *http:} $line]} { + set value "" + set o [self] + set line [string trim $line] + foreach step $line { + set value [$o set $step] + set o tv::db::$value + } + append result $value + } else { + append result $line + } + } + return $result +} + +Resource instproc pretty {} { + set q [univ selfAction "details [namespace tail [self]]"] + my substitute " + http://nm.wu-wien.ac.at/universal/rdf-lifecycle#Contribute \ + http://nm.wu-wien.ac.at/universal/rdf-lifecycle#Entity +: + http://nm.wu-wien.ac.at/universal/rdf-general#Title +, + http://nm.wu-wien.ac.at/universal/rdf-education#LearningResourceType +, + http://nm.wu-wien.ac.at/universal/rdf-education#TypicalLearningTime +, + http://nm.wu-wien.ac.at/universal/rdf-lifecycle#Contribute \ + http://nm.wu-wien.ac.at/universal/rdf-lifecycle#Date + ([my pretty-access])" +} +Resource instproc pretty-title {} { + my substitute "http://nm.wu-wien.ac.at/universal/rdf-general#Title" +} +Resource instproc pretty-access {} { + set tech http://nm.wu-wien.ac.at/universal/rdf-technical + set format [my substitute "$tech#Format"] + set location [my substitute "$tech#Location"] + if {$format == "text/html"} { + set label "go" } else { + set label "Download [my substitute $tech#Size] bytes" + } + return "$label" +} + + + +### Definition of the Learning Resource Manager: +Class LrManager -superclass WebDocument -parameter { + {defaultUrl http://nm.wu-wien.ac.at/Lehre/oo2/} +} +LrManager instproc html-title {t} { + my contentType text/html + return "$t\n\n" +} +LrManager instproc html-head {t} { + return "

$t

\n" +} + +LrManager instproc details {subject} { + set result [my html-title "Details about a Learning Resource"] + append result [my html-head "Details about the Learning Resource
'[::tv::db::$subject pretty-title]'"] + #append result "The subject: '$subject' has the following properties:

\n" + append result [my attributeTable $subject outer] "" +} + +LrManager instproc attributeTable {subject cls} { + set result "" + set lastns "" + foreach {attr value} [tv::db querySubject $subject] { + if {[tv::db isContainer $value]} { + #set q [univ selfAction "details $value"]; set value "$value" + set value [my attributeTable $value inner] + } + regexp {^(.*)\#(.*)$} $attr _ ns property + if {$ns != $lastns} { + if {$lastns != ""} { append result

\n } + append result "Attributes from namespace $ns:\n\n" + set lastns $ns + } + append result \ + "" \ + "" \n + } + append result "
$property$value
\n" +} + + +LrManager instproc catalog {} { + set result [my html-title "Universal Resources"] + append result [my html-head "Local Learning Resources:"]

    \n + foreach r [lsort [tv::db resources]] { + append result "
  • [$r pretty]

  • \n" + } + return $result
+} + +LrManager instproc source {file} { + my contentType text/plain + return [loadFile $file] +} + +LrManager instproc nav {} { + set right [my selfAction "catalog"] + set result [my html-title "Universal Navigation Bar"] + set rdfsrc [my selfAction "source $::opts(-instanceFile)"] + set csssrc [my selfAction "source $::opts(-root)/$::opts(-cssFile)"] + set src [my selfAction "source [info script]"] + append result \n \ + "UNIVERSAL HOME \n\ +

All local Resources

+

Search for Title

+

Search for Authors

+
Internal Use only: +

XML:RDF Source

+

CSS Source

+

Source of Meta-Data Application Server

" +} + +LrManager instproc default {} { + set right [my selfAction "catalog"] + set nav [my selfAction "nav"] + set result [my html-title "Universal"] + append result " + + + + <body>\n\<h2>Query UNIVERSAL database for Resource:</h2>\n\ + +" +} + + +LrManager instproc init args { + next + ::receiver exportObjs [self] ;# export object + my exportProcs details catalog nav source ;# export methods +} + + +# create an instance of the Rearning Resource manager +LrManager univ +receiver proc default {} {univ default} ;# call it like index.html as default + +# Invoke Tiple Visitor to feed the database +tv interprete +#puts stderr [tv::db prettyTriples] + +receiver startEventLoop ;# Start event loop + Index: xotcl/apps/actiweb/univ/server.key =================================================================== diff -u --- xotcl/apps/actiweb/univ/server.key (revision 0) +++ xotcl/apps/actiweb/univ/server.key (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQDVg+HdA4RAKyYRaxKRSdAw7mQpephZslIf/ZR7Oe3RKZjxu7Sj +PYG56GSc8y6hiaKuGnDmJcEGXZCXWNtUuACVsNlFrlVbGSEfAbXbz6H4eaaX2d2P +KzrjOc//8+5emaFZRelVTYY4sWNLcCuWV2FIhwMJMblYieXM6iEQg4XzdQIDAQAB +AoGAVdY2OC8QvOdb34bHKSeejf1YwSArHWxF/dxpE/0e8YaimRQYM8QnYgDeagaN +yZ1WjF3O44dsCU4WMfIkAvQSL19RLSgT+jPb3Uu9Aotwmg4x+55BKctRphXKiIfu ++a0IfAFDIt8FMRS08AoSB6eBgOBlhTZM2Y0IuC6QTqaBcwUCQQD5XSiEzh44uMOl +N4FbO0MI2NC3pbPg5u1fEJtIawoYOYxbeGHrlOYO2ZN3ZP6+2g5V0kX5tMMeObhE +qQLlmNETAkEA2zJ/Tk3IE5ByEBcGjG26nJ1zLlY13NaiIg+AoSP+7rHg5TPhoQp1 +VVwcqd4ZWCyqgYDFl2TsiiZwKcEIFJBCVwJBANoLpZSLD04V8a2UXV5C8ZjYzZjo +IeP0yXco9D9cqZUJLTwGhckTiB9QDWyHOWH1FjfhCCMS9tKFMiWHi+rrt1UCQQDC +rlvxURX1gmI8NicjzEVk2la1fe5C4QKJW9lzxUOj/qpvB6BK5r4FfVUb7d32uV0K +vjNAXmvT24XdH8usb9/rAkBR1sqUkqwwm0CSe0Rz9IhSlkwWlmvEzSmEguqrd7Zb +rbYJ9NTnV1uFSAX9vcU7lDRp69il6XmyhOL06FYLRaNa +-----END RSA PRIVATE KEY----- Index: xotcl/apps/actiweb/univ/server.pem =================================================================== diff -u --- xotcl/apps/actiweb/univ/server.pem (revision 0) +++ xotcl/apps/actiweb/univ/server.pem (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,66 @@ +issuer :/C=DE/ST=NRW/L=Essen/O=University of Essen/OU=SWT/CN=Fredj Dridi/Email=Fredj.Dridi@uni-essen.de +subject:/C=DE/ST=NRW/L=Essen/O=University of Essen/OU=SWT/CN=tp600e.wi-inf.uni-essen.de/Email=dridi@tp600e.wi-inf.uni-essen.de +serial :01 + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=DE, ST=NRW, L=Essen, O=University of Essen, OU=SWT, CN=Fredj Dridi/Email=Fredj.Dridi@uni-essen.de + Validity + Not Before: Apr 28 08:21:19 2000 GMT + Not After : Apr 28 08:21:19 2001 GMT + Subject: C=DE, ST=NRW, L=Essen, O=University of Essen, OU=SWT, CN=tp600e.wi-inf.uni-essen.de/Email=dridi@tp600e.wi-inf.uni-essen.de + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d5:83:e1:dd:03:84:40:2b:26:11:6b:12:91:49: + d0:30:ee:64:29:7a:98:59:b2:52:1f:fd:94:7b:39: + ed:d1:29:98:f1:bb:b4:a3:3d:81:b9:e8:64:9c:f3: + 2e:a1:89:a2:ae:1a:70:e6:25:c1:06:5d:90:97:58: + db:54:b8:00:95:b0:d9:45:ae:55:5b:19:21:1f:01: + b5:db:cf:a1:f8:79:a6:97:d9:dd:8f:2b:3a:e3:39: + cf:ff:f3:ee:5e:99:a1:59:45:e9:55:4d:86:38:b1: + 63:4b:70:2b:96:57:61:48:87:03:09:31:b9:58:89: + e5:cc:ea:21:10:83:85:f3:75 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + keyid:D2:B8:E3:2D:A2:5A:22:78:3A:38:F1:1F:F5:7C:AD:8D:A6:C4:41:0F + + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Microsoft Server Gated Crypto, Netscape Server Gated Crypto + X509v3 Basic Constraints: critical + CA:FALSE + Signature Algorithm: md5WithRSAEncryption + 38:b5:a1:1c:93:c4:aa:6e:3f:d6:ea:11:7f:7b:2b:11:db:7b: + 22:b3:d2:a8:b3:f3:20:64:6a:25:b4:fe:0d:ac:12:49:a0:6e: + 6d:ef:fb:99:a2:7c:bc:50:b0:eb:42:ef:0a:32:fa:a9:69:e0: + 11:10:9b:00:05:15:97:59:ac:dc:5f:f2:cd:81:28:3e:e6:96: + 86:f4:d7:99:71:52:c3:ca:0f:4a:48:d8:66:b0:da:e8:d1:45: + 84:c4:12:b2:43:ec:63:b6:25:e8:0a:5a:4c:fb:e2:ec:03:36: + 6f:cd:f9:2a:5c:52:ba:02:29:92:f5:bf:c4:96:ff:9e:ed:a3: + cf:02 + +-----BEGIN CERTIFICATE----- +MIIDIjCCAougAwIBAgIBATANBgkqhkiG9w0BAQQFADCBljELMAkGA1UEBhMCREUx +DDAKBgNVBAgTA05SVzEOMAwGA1UEBxMFRXNzZW4xHDAaBgNVBAoTE1VuaXZlcnNp +dHkgb2YgRXNzZW4xDDAKBgNVBAsTA1NXVDEUMBIGA1UEAxMLRnJlZGogRHJpZGkx +JzAlBgkqhkiG9w0BCQEWGEZyZWRqLkRyaWRpQHVuaS1lc3Nlbi5kZTAeFw0wMDA0 +MjgwODIxMTlaFw0wMTA0MjgwODIxMTlaMIGtMQswCQYDVQQGEwJERTEMMAoGA1UE +CBMDTlJXMQ4wDAYDVQQHEwVFc3NlbjEcMBoGA1UEChMTVW5pdmVyc2l0eSBvZiBF +c3NlbjEMMAoGA1UECxMDU1dUMSMwIQYDVQQDExp0cDYwMGUud2ktaW5mLnVuaS1l +c3Nlbi5kZTEvMC0GCSqGSIb3DQEJARYgZHJpZGlAdHA2MDBlLndpLWluZi51bmkt +ZXNzZW4uZGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANWD4d0DhEArJhFr +EpFJ0DDuZCl6mFmyUh/9lHs57dEpmPG7tKM9gbnoZJzzLqGJoq4acOYlwQZdkJdY +21S4AJWw2UWuVVsZIR8BtdvPofh5ppfZ3Y8rOuM5z//z7l6ZoVlF6VVNhjixY0tw +K5ZXYUiHAwkxuViJ5czqIRCDhfN1AgMBAAGjZzBlMB8GA1UdIwQYMBaAFNK44y2i +WiJ4OjjxH/V8rY2mxEEPMDQGA1UdJQQtMCsGCCsGAQUFBwMBBggrBgEFBQcDAgYK +KwYBBAGCNwoDAwYJYIZIAYb4QgQBMAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEE +BQADgYEAOLWhHJPEqm4/1uoRf3srEdt7IrPSqLPzIGRqJbT+DawSSaBube/7maJ8 +vFCw60LvCjL6qWngERCbAAUVl1ms3F/yzYEoPuaWhvTXmXFSw8oPSkjYZrDa6NFF +hMQSskPsY7Yl6ApaTPvi7AM2b835KlxSugIpkvW/xJb/nu2jzwI= +-----END CERTIFICATE----- + Index: xotcl/apps/comm/client.pem =================================================================== diff -u --- xotcl/apps/comm/client.pem (revision 0) +++ xotcl/apps/comm/client.pem (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,66 @@ +issuer :/C=DE/ST=NRW/L=Essen/O=University of Essen/OU=SWT/CN=Fredj Dridi/Email=Fredj.Dridi@uni-essen.de +subject:/CN=Fredj Dridi/Email=fredj_dridi@yahoo.com +serial :02 + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 2 (0x2) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=DE, ST=NRW, L=Essen, O=University of Essen, OU=SWT, CN=Fredj Dridi/Email=Fredj.Dridi@uni-essen.de + Validity + Not Before: Apr 28 08:24:43 2000 GMT + Not After : Apr 28 08:24:43 2001 GMT + Subject: CN=Fredj Dridi/Email=fredj_dridi@yahoo.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:e4:df:a7:f3:ed:61:df:30:ad:d9:6f:63:f2:d1: + 85:9b:72:b2:c6:e4:fd:50:11:c5:0a:29:59:02:60: + 29:f6:2c:6a:35:08:89:49:ad:d4:44:1d:7f:14:18: + 61:4d:e8:66:87:30:01:52:cd:7d:16:72:0e:24:38: + 19:a5:a7:dc:cf:7a:5d:79:ea:48:c6:c4:ae:52:a6: + 94:36:7f:f3:24:43:b0:21:5a:f2:d5:6d:66:38:4c: + b7:7a:0e:ce:12:01:b0:46:4b:ea:08:b4:e0:aa:b8: + 96:dc:3e:15:e0:24:92:84:1f:77:d0:8d:73:d2:f3: + ac:82:b0:61:60:1a:6a:fc:b9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Alternative Name: + email:fredj_dridi@yahoo.com + X509v3 Basic Constraints: critical + CA:FALSE + X509v3 Authority Key Identifier: + keyid:D2:B8:E3:2D:A2:5A:22:78:3A:38:F1:1F:F5:7C:AD:8D:A6:C4:41:0F + + X509v3 Extended Key Usage: + TLS Web Client Authentication, E-mail Protection + Signature Algorithm: md5WithRSAEncryption + 01:88:26:35:b9:c7:c9:5a:90:ff:b8:9c:37:fa:48:0e:03:82: + b4:18:df:49:e7:5d:42:3a:48:e3:e4:84:c7:b6:ef:cc:91:4c: + 47:9d:34:f9:51:0b:63:d0:35:f9:ad:a5:a9:3d:ef:75:23:0c: + 14:77:59:79:59:58:c8:74:df:01:b8:de:f2:78:47:64:1a:7e: + 4b:09:31:5e:f5:34:e2:ad:5e:e8:81:00:f1:af:fe:48:31:0b: + a9:b1:4d:53:51:9a:15:1f:55:ba:30:e4:0e:02:05:20:4b:de: + 9c:d9:86:f1:e4:d9:18:c4:93:03:19:06:a5:f3:cb:2a:28:a0: + fd:de + +-----BEGIN CERTIFICATE----- +MIICuzCCAiSgAwIBAgIBAjANBgkqhkiG9w0BAQQFADCBljELMAkGA1UEBhMCREUx +DDAKBgNVBAgTA05SVzEOMAwGA1UEBxMFRXNzZW4xHDAaBgNVBAoTE1VuaXZlcnNp +dHkgb2YgRXNzZW4xDDAKBgNVBAsTA1NXVDEUMBIGA1UEAxMLRnJlZGogRHJpZGkx +JzAlBgkqhkiG9w0BCQEWGEZyZWRqLkRyaWRpQHVuaS1lc3Nlbi5kZTAeFw0wMDA0 +MjgwODI0NDNaFw0wMTA0MjgwODI0NDNaMDwxFDASBgNVBAMTC0ZyZWRqIERyaWRp +MSQwIgYJKoZIhvcNAQkBFhVmcmVkal9kcmlkaUB5YWhvby5jb20wgZ8wDQYJKoZI +hvcNAQEBBQADgY0AMIGJAoGBAOTfp/PtYd8wrdlvY/LRhZtyssbk/VARxQopWQJg +KfYsajUIiUmt1EQdfxQYYU3oZocwAVLNfRZyDiQ4GaWn3M96XXnqSMbErlKmlDZ/ +8yRDsCFa8tVtZjhMt3oOzhIBsEZL6gi04Kq4ltw+FeAkkoQfd9CNc9LzrIKwYWAa +avy5AgMBAAGjcjBwMCAGA1UdEQQZMBeBFWZyZWRqX2RyaWRpQHlhaG9vLmNvbTAM +BgNVHRMBAf8EAjAAMB8GA1UdIwQYMBaAFNK44y2iWiJ4OjjxH/V8rY2mxEEPMB0G +A1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDANBgkqhkiG9w0BAQQFAAOBgQAB +iCY1ucfJWpD/uJw3+kgOA4K0GN9J511COkjj5ITHtu/MkUxHnTT5UQtj0DX5raWp +Pe91IwwUd1l5WVjIdN8BuN7yeEdkGn5LCTFe9TTirV7ogQDxr/5IMQupsU1TUZoV +H1W6MOQOAgUgS96c2Ybx5NkYxJMDGQal88sqKKD93g== +-----END CERTIFICATE----- + Index: xotcl/apps/comm/filename.crt =================================================================== diff -u --- xotcl/apps/comm/filename.crt (revision 0) +++ xotcl/apps/comm/filename.crt (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDmDCCAwGgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBlTELMAkGA1UEBhMCYXQx +EDAOBgNVBAgTB0F1c3RyaWExDzANBgNVBAcTBlZpZW5uYTEQMA4GA1UEChMHV1Ut +V2llbjELMAkGA1UECxMCV0kxHjAcBgNVBAMTFW1vaGVnYW4ud3Utd2llbi5hYy5h +dDEkMCIGCSqGSIb3DQEJARYVbmV1bWFubkB3dS13aWVuLmFjLmF0MB4XDTAyMDQw +MjEwNDUwN1oXDTAyMDUwMjEwNDUwN1owgZUxCzAJBgNVBAYTAmF0MRAwDgYDVQQI +EwdBdXN0cmlhMQ8wDQYDVQQHEwZWaWVubmExEDAOBgNVBAoTB1dVLVdpZW4xCzAJ +BgNVBAsTAldJMR4wHAYDVQQDExVtb2hlZ2FuLnd1LXdpZW4uYWMuYXQxJDAiBgkq +hkiG9w0BCQEWFW5ldW1hbm5Ad3Utd2llbi5hYy5hdDCBnzANBgkqhkiG9w0BAQEF +AAOBjQAwgYkCgYEA5iT1aT1zU5mfqabGQWcdLyGVFlJBuiKnD2wCVDBIJFVYk6EJ +FrFadKgUXNa0Sxrav/5BJyG2ObOrS4BH6yAl8f90QbAokFp9HeW5wkkAhjkSe1Rw +vcts9F+R6OhcBxO+tQ6maR9wIGfWoK+vWDyfO7wnHjiL2YZFW73mDBUuHO8CAwEA +AaOB9TCB8jAdBgNVHQ4EFgQUbnmEzLNHBNqySdNmPzLSf+yjEc8wgcIGA1UdIwSB +ujCBt4AUbnmEzLNHBNqySdNmPzLSf+yjEc+hgZukgZgwgZUxCzAJBgNVBAYTAmF0 +MRAwDgYDVQQIEwdBdXN0cmlhMQ8wDQYDVQQHEwZWaWVubmExEDAOBgNVBAoTB1dV +LVdpZW4xCzAJBgNVBAsTAldJMR4wHAYDVQQDExVtb2hlZ2FuLnd1LXdpZW4uYWMu +YXQxJDAiBgkqhkiG9w0BCQEWFW5ldW1hbm5Ad3Utd2llbi5hYy5hdIIBADAMBgNV +HRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4GBANj6u54TmwEJg/Ldvfx+Qrax+66n +zh1EYzxrlYp6eNQVPEyOsF1DJh150Lci1Mm/i71D87yJRVjagTv5dAUdupy9Zf6c +AMMv6KvK5G7q6LC9ArwNiBObsmQUlN7+PzRmG9CerRJ6W8eEYnYB0EHhYVKc8cED +F4mixcF1HGQJI/qN +-----END CERTIFICATE----- Index: xotcl/apps/comm/filename.key =================================================================== diff -u --- xotcl/apps/comm/filename.key (revision 0) +++ xotcl/apps/comm/filename.key (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,075071A5AF5C1D8A + +qmihZRxmNNlGCx9lVC4QQPQS25e4aAg3oHjxDaZ0yyDSKsWz4J04lo2x63QT/88i +z9YUQqyC8ry53D5y3aQKiFuXlDDvX6PtPS+cQANA8g5qOIHsMF3yINfrVEmWkPjx +xOYF2qIGI0ISPTT5AkTN3KVmYE7rbFvqgQMklj/SlNBqeUmKvn1rhUCFAd0jYXa9 +imaKVMj08q4GItLAqPoJNY4K73IHZeaW8GEWAJ5E/KEzYFBnYUiPUN8UPCCQsC+b +ViRF226hCFSu8yDBah8R/u6W9rEa+Vs/T7Cyklnot2FDyCU0EW/lhKBKfEKTmXAe +sBzN7F1hrLFifUD7VzJ2K7zKh7pMy3X+D+0PUjVaIyZWDIH3nOiTzfK6kxksjoE5 +P+fp5IL4okEJgD6MoLJHGWTwfhH9K6QBX01My3s22q5zuiJ3SajRCFlLDn7jTTPV +2OQ9+2FksxJYa5Z5/n63Vslz0+yKv9AVTbrtfrbbRJtmpbElCPrvhzVsuWksRS3A +biZxD5PkWiYDvNm34eOAOARb7n0awTOZ1bqdccT+rhcvo7c+MypIY0/AfZKZK4hN +bWxHR3wZUv+wffx1CBxvsBBomV8XqcqJliVHgdvwDdzl3Z2HbYK3w92RXNY36FYw +C1iqALuxE9nhzyEv0ARfjcXTu0lUmFZOfi4oizzMVj7u2q4mGt0+ZuKBs/fTEEm1 +3L1nLnalGb5ko5OTZ4DMQlP1HCU3UZslImAcc3FFa/WNzhG07/YAlcTS18YUbJYF +19Yx6qrYfrZA2UZq0+8DFa8XgOHCFO0KqQHRfRB/7tGNGxX5md8+9w== +-----END RSA PRIVATE KEY----- Index: xotcl/apps/comm/ftp.xotcl =================================================================== diff -u --- xotcl/apps/comm/ftp.xotcl (revision 0) +++ xotcl/apps/comm/ftp.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,12 @@ +#!/usr/local/bin/xotclsh +package require XOTcl; namespace import -force xotcl::* + +@ @File {description { A tiny FTP client }} + +package require xotcl::comm::ftp + +SimpleRequest r1 -url ftp://prep.ai.mit.edu/README +if {[r1 success]} { + puts "Got:" + puts [r1 getContent] +} Index: xotcl/apps/comm/get-regression-nb.xotcl =================================================================== diff -u --- xotcl/apps/comm/get-regression-nb.xotcl (revision 0) +++ xotcl/apps/comm/get-regression-nb.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,419 @@ +#!/usr/local/bin/xotclsh +package require XOTcl; namespace import -force xotcl::* + +# ./get-regression-nb.xotcl -host swt -parallel 0 +# ./get-regression-nb.xotcl -host swt -sequential 0 +# +# mit ~/wafe/src/cineast/webserver.xotcl (benotigt ~/wafe/test/*) +# ./get-regression-nb.xotcl -port 8086 +# +# Vergleich webserver.xotcl mit Apache: +# 1) installation von Apache auf port 80 +# +# 2) installation vom webserver.xotcl auf port 8086 +# +# 3) von beiden server sollend die files in wafe/test/* unter +# http://SERVER+PORT/test/* +# erreichbar sein. +# +# 4) test der installation +# apache: +# cd wafe/src/cineast +# get-regression-nb.xotcl -sequential 0 +# die ausgabe sollte mit totalbytes=6536120 +# abgeschlossen werden +# +# webserver.xotcl: +# cd wafe/src/cineast +# get-regression-nb.xotcl -port 8086 -sequential 0 +# die ausgabe sollte mit totalbytes=6536120 +# abgeschlossen werden +# +# 5) grosser testlauf: +# rsh muss funktionieren: z.B.: rsh localhost date +# +# apache: +# cd wafe/src/cineast +# time get-regression-nb.xotcl -sequential 0 -clients 1 +# +# webserver.xotcl: +# cd wafe/src/cineast +# time get-regression-nb.xotcl -port 8086 -sequential 0 -clients 1 +# +# Ergebnisse auf meinem Rechner: +# +# der xotcl-webserver ist etwa 20% langsamer als apache. +# das logging (instproc log) aktivieren kostet ein paar weitere prozent.... +# -gn +# +# mohegan:~/wafe/src/cineast> time ./get-regression-nb.xotcl -port 8086 -sequential 0 -clients 1 +# Loading source file ~/wafe/src/cineast/Access.xotcl +# Loading source file ~/wafe/src/cineast/PCache.xotcl +# Loading source file ~/wafe/src/cineast/Connection.xotcl +# Loading source file ~/wafe/src/cineast/trace.xotcl +# 1 clients: 3.07 seconds (per client 3.07 seconds, 2127.31 KB/sec) server: 2127.31 KB/sec +# 2 clients: 6.36 seconds (per client 3.18 seconds, 1028.10 KB/sec) server: 2056.20 KB/sec +# 3 clients: 7.71 seconds (per client 2.57 seconds, 847.74 KB/sec) server: 2543.22 KB/sec +# 4 clients: 11.21 seconds (per client 2.80 seconds, 582.92 KB/sec) server: 2331.66 KB/sec +# 5 clients: 10.57 seconds (per client 2.11 seconds, 618.49 KB/sec) server: 3092.45 KB/sec +# 10 clients: 25.07 seconds (per client 2.51 seconds, 260.68 KB/sec) server: 2606.79 KB/sec +# 20 clients: 45.48 seconds (per client 2.27 seconds, 143.73 KB/sec) server: 2874.58 KB/sec +#0.420u 0.450s 1:49.65 0.7% 0+0k 0+0io 113263310pf+0w +# +# +# +# mohegan:~/wafe/src/cineast> time ./get-regression-nb.xotcl -port 80 -sequential 0 -clients 1 +# Loading source file ~/wafe/src/cineast/Access.xotcl +# Loading source file ~/wafe/src/cineast/PCache.xotcl +# Loading source file ~/wafe/src/cineast/Connection.xotcl +# Loading source file ~/wafe/src/cineast/trace.xotcl +# 1 clients: 1.85 seconds (per client 1.85 seconds, 3542.58 KB/sec) server: 3542.58 KB/sec +# 2 clients: 4.71 seconds (per client 2.36 seconds, 1387.02 KB/sec) server: 2774.03 KB/sec +# 3 clients: 4.09 seconds (per client 1.36 seconds, 1596.58 KB/sec) server: 4789.74 KB/sec +# 4 clients: 7.74 seconds (per client 1.94 seconds, 844.43 KB/sec) server: 3377.71 KB/sec +# 5 clients: 9.46 seconds (per client 1.89 seconds, 690.67 KB/sec) server: 3453.33 KB/sec +# 10 clients: 20.91 seconds (per client 2.09 seconds, 312.52 KB/sec) server: 3125.24 KB/sec +# 20 clients: 39.01 seconds (per client 1.95 seconds, 167.55 KB/sec) server: 3351.08 KB/sec +#0.410u 0.360s 1:27.95 0.8% 0+0k 0+0io 112251994pf+0w +# +# + +set CACHE_DIR /tmp + +package require xotcl::comm::httpAccess +package require xotcl::trace + +set port "" +set host localhost +set cachingopts {0 1 2 2} +set parallel 1 +set sequential 0 +set clients 0 +set local 1 + +foreach {att val} $argv { + switch -exact -- $att { + -port {set port $val} + -host {set host $val} + -memory {set cachingopts 0} + -parallel {set parallel $val} + -sequential {set sequential $val} + -clients {set clients $val} + -local {set local $val} + } +} + +set hosts { + R2H2-11 R2H2-12 R2H2-13 R2H2-21 R2H2-22 R2H2-23 R2H2-31 R2H2-32 + R2H2-33 R2H2-41 R2H2-42 R2H2-43 R2H2-51 R2H2-52 R2H2-53 R2H2-61 + R2H2-62 R2H2-63 R2H2-73 + matush nashawag sagumumpsketuck wawog willimantic wonkituck mashipaug + watuppa +} +#set hosts { +# matush nashawag sagumumpsketuck wawog willimantic wonkituck mashipaug +# R2H2-11 R2H2-12 R2H2-13 R2H2-21 R2H2-22 R2H2-23 R2H2-31 R2H2-32 +# R2H2-33 R2H2-41 R2H2-42 R2H2-43 R2H2-51 R2H2-52 R2H2-53 R2H2-61 +# R2H2-62 R2H2-63 R2H2-73 +# watuppa +#} +set totalbytes 6536120 +set totalbytes 1293240;# ohne 5m request + + +if {$clients} { + proc readable {handle rhost} { + if {[eof $handle]} { + incr ::running -1 + if {[catch {close $handle} output]} { + if {![string match *$::totalbytes $output]} { + puts stderr "invalid output on client on host $rhost" + puts stderr "***********************************" + puts stderr $output + puts stderr "***********************************" + } + } + #puts stderr clients=$::running + if {$::running == 0} { + set ::xxx 1 + } + } else { + gets $handle + } + } + proc clients {clients} { + append cmd "[pwd]/$::argv0 -host $::host " \ + "-parallel $::parallel -sequential $::sequential" + if {$::port != ""} {append cmd " -port $::port"} + set starttime [clock clicks] + set ::running $clients + for {set s 0} {$s < $clients} {incr s} { + if {$::local} { + set rhost localhost + } else { + set rhost [lindex $::hosts $s] + } + #puts stderr "rsh $rhost $cmd" + puts -nonewline stderr "$rhost " + set f($s) [open "| rsh $rhost $cmd"] + fconfigure $f($s) -blocking 0 + fileevent $f($s) readable "readable $f($s) $rhost" + } + puts stderr "" + vwait ::xxx + set secs [expr {([clock clicks] -$starttime)/1000000.0}] + puts stderr "[format %3d $clients] clients: [format %6.2f $secs] seconds \ + (per client [format %6.2f [expr {$secs/$clients}]] seconds,\ + [format %7.2f [expr {$::totalbytes/($secs*1000.0)}]] KB/sec)\ + server: [format %7.2f [expr {$::totalbytes*$clients/($secs*1000.0)}]] KB/sec" + } + clients 1 + clients 2 + clients 3 + clients 4 + clients 5 + clients 10 + clients 20 + exit +} + +persistentCache clear + +proc assert {f r} { + set got [eval $f] + if {[string compare $got $r]} { + puts stderr "assertion failed: \[$f\] == $r (got $got)" + quit + } else { + puts stderr "OK $r = $f" + } +} +proc head msg { + puts stderr "" + puts stderr "---------------------------- $msg" +} + +proc test {msg cmd} { + set r [Object autoname r] + head $msg + if {[catch {eval $cmd} msg]} { + puts stderr "ERROR: $::errorInfo" + quit + } + $r destroy +} + +Object userPwd +userPwd proc user {u} { + my set user $u +} +userPwd proc show {realm userVar pwVar} { + upvar $userVar u $pwVar pw + set u [my set user] + set pw jogl + return 1 +} + + + + +# test "simple request" { +# SimpleRequest $r -caching 0 \ +# -url http://localhost/index.html +# assert "$r getContentLength" 81 +# } +# test "simple request" { +# SimpleRequest $r -caching 1 \ +# -url http://localhost/index.html +# assert "$r getContentLength" 81 +# } +# test "simple request" { +# SimpleRequest $r -caching 1 \ +# -url http://localhost/index.html +# assert "$r getContentLength" 81 +# } +# test "simple request" { +# persistentCache invalidate \ +# http://localhost/index.html +# SimpleRequest $r -caching 1 \ +# -url http://localhost/index.html +# assert "$r getContentLength" 81 +# } + +# test "simple request" { +# SimpleRequest $r -caching 0 \ +# -url http://localhost/muster-d1klausur.ps +# assert "$r getContentLength" 163840 +# } +set total 0 +proc parallelRequests-1.0 {urls} { + ParallelSink psink -httpVersion 1.0 -init -requests $urls + incr ::total [psink set totalbytes] + psink destroy +} +proc parallelRequests-1.1 {urls} { + ParallelSink psink -init -requests $urls + incr ::total [psink set totalbytes] + psink destroy +} +if {$port != ""} {set port :$port} + + +if {$parallel} { + parallelRequests-1.0 [list \ + http://$host$port/test/file500.html \ + http://$host$port/test/file5k.html \ + http://$host$port/test/file50k.html \ + http://$host$port/test/file500k.html \ + http://$host$port/test/file5m.html \ + http://$host$port/test/file500.html \ + http://$host$port/test/file5k.html \ + http://$host$port/test/file5k.html \ + http://$host$port/test/file500.html \ + http://$host$port/test/file500.html \ + http://$host$port/test/file5k.html \ + http://$host$port/test/file5k.html \ + http://$host$port/test/file500.html \ + http://$host$port/test/file5k.html \ + http://$host$port/test/file5k.html \ + http://$host$port/test/file500.html \ + ] + for {set i 1} {$i<10} {incr i} { + parallelRequests-1.1 [list \ + http://$host$port/test/file50k.html \ + http://$host$port/test/file5k1.html \ + http://$host$port/test/file5k2.html \ + http://$host$port/test/file5k3.html \ + http://$host$port/test/file5k4.html \ + http://$host$port/test/file5k5.html + ] + } + puts stderr totalbytes=$::total +} + +if {$sequential} { + set doc http://$host$port/test/suexec.html + set size 20680 + foreach c $cachingopts { + test "caching $c $doc" { + SimpleRequest $r -caching $::c -url $::doc + assert "$r getContentLength" $::size + #puts stderr c=<[$r getContent]> + } + } + + set doc http://$host$port/test/xvdocs.ps + set size 3678303 + foreach c $cachingopts { + test "caching $c" { + SimpleRequest $r -caching $::c -url $::doc + assert "$r getContentLength" $::size + } + } + +} +exit + +test "simple request" { + SimpleRequest $r -caching 0 \ + -url http://nestroy.wi-inf.uni-essen.de/Raumplan.html + assert "$r getContentLength" 662 +} + + +test "simple request, larger file" { + SimpleRequest $r -caching 0 \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 +} + + +test "use cache" { + SimpleRequest $r -caching 1 \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 +} + + +test "specify filename, use cache and validate request" { + persistentCache invalidate \ + http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + exec rm -f test.ps + SimpleRequest $r -caching 1 -fileName test.ps \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 + assert "file size test.ps" 349970 + assert {lindex [exec md5sum test.ps] 0} c6029c987e841430f3ca9bab157da12f +} + + +test "specify filename, and use cache and a validated file" { + exec rm -f test.ps + SimpleRequest $r -caching 1 -fileName test.ps \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 + assert "file size test.ps" 349970 + assert {lindex [exec md5sum test.ps] 0} c6029c987e841430f3ca9bab157da12f +} + +test "specify filename, and do not use cache" { + exec rm -f test.ps + SimpleRequest $r -fileName test.ps -caching 0 \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 + assert "file size test.ps" 349970 + assert {lindex [exec md5sum test.ps] 0} c6029c987e841430f3ca9bab157da12f +} + +test "specify filesink and use cache; no copying neccesary" { + persistentCache invalidate \ + http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + SimpleRequest $r -useFileSink 1 -caching 1 \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 + assert "file size test.ps" 349970 +} + + + +test "load a large file to the cache" { + persistentCache clearEntry http://swt.wi-inf.uni-essen.de/lx2.1.55 + SimpleRequest $r -caching 1 \ + -url http://swt.wi-inf.uni-essen.de/lx2.1.55 + assert "$r getContentLength" 522411 +} + + + +test "load a validated large file" { + SimpleRequest $r -caching 1 \ + -url http://swt.wi-inf.uni-essen.de/lx2.1.55 + assert "$r getContentLength" 522411 +} + +test "pure loading test without cache" { + SimpleRequest $r -caching 0 \ + -url http://swt.wi-inf.uni-essen.de/lx2.1.55 + assert "$r getContentLength" 522411 +} + + +test "redirect" { + SimpleRequest $r -caching 1 \ + -url http://mohegan.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 +} + + +test "authentication" { + SimpleRequest $r -caching 1 \ + -url http://nestroy.wi-inf.uni-essen.de/cgi-bin/w3-msql/Forschung/Publikationen/protected/index.html + assert "$r getContentLength" 1164 +} + +puts stderr after +quit + + +### request joining +### load to file depending on content type Index: xotcl/apps/comm/get-regression.xotcl =================================================================== diff -u --- xotcl/apps/comm/get-regression.xotcl (revision 0) +++ xotcl/apps/comm/get-regression.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,208 @@ +package require XOTcl; namespace import -force xotcl::* + +package require xotcl::comm::httpAccess +package require xotcl::trace + +persistentCache clear + +proc assert {f r} { + set got [eval $f] + if {[string compare $got $r]} { + puts stderr "assertion failed: \[$f\] == $r (got $got)" + quit + } else { + puts stderr "OK $r = $f" + } +} +proc head msg { + puts stderr "" + puts stderr "---------------------------- $msg" +} + +proc test {msg cmd} { + set r [Object autoname r] + head $msg + if {[catch {eval $cmd} msg]} { + puts stderr "ERROR: $::errorInfo" + quit + } + $r destroy +} + +Object userPwd +userPwd proc user {u} { + my set user $u +} +userPwd proc show {realm userVar pwVar} { + upvar $userVar u $pwVar pw + set u [my set user] + set pw jogl + return 1 +} + + + + +# test "simple request" { +# SimpleRequest $r -caching 0 \ +# -url http://localhost/index.html +# assert "$r getContentLength" 81 +# } +# test "simple request" { +# SimpleRequest $r -caching 1 \ +# -url http://localhost/index.html +# assert "$r getContentLength" 81 +# } +# test "simple request" { +# SimpleRequest $r -caching 1 \ +# -url http://localhost/index.html +# assert "$r getContentLength" 81 +# } +# test "simple request" { +# persistentCache invalidate \ +# http://localhost/index.html +# SimpleRequest $r -caching 1 \ +# -url http://localhost/index.html +# assert "$r getContentLength" 81 +# } + +# test "simple request" { +# SimpleRequest $r -caching 0 \ +# -url http://localhost/muster-d1klausur.ps +# assert "$r getContentLength" 163840 +# } + +proc parallelRequests {urls} { + JoinSink joinsink -requests [llength $urls] + set i 0 + foreach url $urls { + TimedMemorySink sink$i + set t$i [Access [Access autoname a] -url $url \ + -informObject [list joinsink sink$i] \ + -caching 0] + incr i + } + set i 0 + foreach url $urls { sink$i reportTimes;incr i} + joinsink destroy +} + +# parallelRequests { +# http://localhost/muster-d1klausur.ps +# http://localhost/muster-d1klausur2.ps +# } +# quit + +foreach c {0 1 2 2} { + test "caching $c" { + SimpleRequest $r -caching $::c \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 + } +} + + + +test "simple request" { + SimpleRequest $r -caching 0 \ + -url http://nestroy.wi-inf.uni-essen.de/Raumplan.html + assert "$r getContentLength" 662 +} + + +test "simple request, larger file" { + SimpleRequest $r -caching 0 \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 +} + + +test "use cache" { + SimpleRequest $r -caching 1 \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 +} + + +test "specify filename, use cache and validate request" { + persistentCache invalidate \ + http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + exec rm -f test.ps + SimpleRequest $r -caching 1 -fileName test.ps \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 + assert "file size test.ps" 349970 + assert {lindex [exec md5sum test.ps] 0} c6029c987e841430f3ca9bab157da12f +} + + +test "specify filename, and use cache and a validated file" { + exec rm -f test.ps + SimpleRequest $r -caching 1 -fileName test.ps \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 + assert "file size test.ps" 349970 + assert {lindex [exec md5sum test.ps] 0} c6029c987e841430f3ca9bab157da12f +} + +test "specify filename, and do not use cache" { + exec rm -f test.ps + SimpleRequest $r -fileName test.ps -caching 0 \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 + assert "file size test.ps" 349970 + assert {lindex [exec md5sum test.ps] 0} c6029c987e841430f3ca9bab157da12f +} + +test "specify filesink and use cache; no copying neccesary" { + persistentCache invalidate \ + http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + SimpleRequest $r -useFileSink 1 -caching 1 \ + -url http://nestroy.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 + assert "file size test.ps" 349970 +} + + + +test "load a large file to the cache" { + persistentCache clearEntry http://swt.wi-inf.uni-essen.de/lx2.1.55 + SimpleRequest $r -caching 1 \ + -url http://swt.wi-inf.uni-essen.de/lx2.1.55 + assert "$r getContentLength" 522411 +} + + + +test "load a validated large file" { + SimpleRequest $r -caching 1 \ + -url http://swt.wi-inf.uni-essen.de/lx2.1.55 + assert "$r getContentLength" 522411 +} + +test "pure loading test without cache" { + SimpleRequest $r -caching 0 \ + -url http://swt.wi-inf.uni-essen.de/lx2.1.55 + assert "$r getContentLength" 522411 +} + + +test "redirect" { + SimpleRequest $r -caching 1 \ + -url http://mohegan.wi-inf.uni-essen.de/Lv/muster-d1klausur.ps + assert "$r getContentLength" 349970 +} + + +test "authentication" { + SimpleRequest $r -caching 1 \ + -url http://nestroy.wi-inf.uni-essen.de/cgi-bin/w3-msql/Forschung/Publikationen/protected/index.html + assert "$r getContentLength" 1164 +} + +puts stderr after +quit + + +### request joining +### load to file depending on content type Index: xotcl/apps/comm/link-checker.xotcl =================================================================== diff -u --- xotcl/apps/comm/link-checker.xotcl (revision 0) +++ xotcl/apps/comm/link-checker.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,147 @@ +#!/usr/local/bin/xotclsh +# $Id: link-checker.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# -gn july 2000 +package require XOTcl; namespace import -force xotcl::* + +@ @File { + description { + A simple link checking program that checks in parallel + pages of a site. +

+ Options:

+ + + + + + +
-url Start-URL
-foreign 0 or 1, specifies, whether foreign links of + local pages should be checked (default 1)
-local A string match pattern to decide + which url should be treated as local + e.g. -local *wu-wien.ac.at/* + Per default the locality filter ist set + to the name of the host followed by '/*'
-restrict 0 or 1, sets the locality filter to the subtree + implied by the URL
-verbose 0 or 1 or 2, verbosity level (default 0)
+ } +} + +if {$tcl_version<8.2} { + puts stderr "This script requires Tcl 8.2 or newer" + exit -1 +} + +set opt(-url) http://localhost:8000/ +set opt(-url) http://nm.wu-wien.ac.at/Lehre/ +set opt(-verbose) 0; # 0, 1 (show check), or 2 (show ignore) +set opt(-foreign) 1; # 0, 1 (check foreign links on local pages) +set opt(-restrict) 0; # 0, 1 + +## per default, lc checks the +array set opt $argv +if {$opt(-restrict)} { + regexp {://(.*)$} $opt(-url) _ opt(-local) + set opt(-local) [string trimright $opt(-local) /]* + puts stderr "locality filter set to '$opt(-local)'" +} +if {![info exists opt(-local)]} { + regexp {http://([^/:]+)} $opt(-url) _ opt(-local) + append opt(-local) /* + puts stderr "locality filter set to '$opt(-local)'" +} + +#package require xotcl::package; package verbose 1 +package require xotcl::comm::httpAccess +package require xotcl::trace + +proc printError {m} {} + +Class Checker -superclass ParallelSink \ + -parameter {verbose foreign local} +Checker array set ref {A HREF IMG SRC} +Checker set ref_re {[[:space:]]*=[[:space:]]*([[:graph:]]+)} +Checker instproc report {msg {level 1}} { + my instvar verbose + if {$verbose>$level} {puts stderr $msg} + return 0 +} +Checker instproc isLocal {url} { + my instvar local + string match *://$local $url +} +Checker instproc isToCheck {url request methodvar} { + my instvar foreign + upvar $methodvar method + if {![regexp -nocase {http://([^/:]+)} $url _ host]} { + return [my report "ignored, no http: $url"] + } + set method GET + if {![my isLocal $url]} { + if {$foreign} { + #puts stderr "parenturl: [$request set parentUrl] -> [my isLocal [$request set parentUrl]]" + if {[$request info vars parentUrl] != "" && + ![my isLocal [$request set parentUrl]]} { + return [my report "ignored, nor local: $url"] + } else { + set method HEAD + } + } else { + return [my report "ignored, nor local: $url"] + } + } + if {[regexp -nocase {[.](gif|jpg|ps|pdf|gz)$} $url]} { + set method HEAD + #return [my report "ignored due to extension: $url"] + } + return 1 +} +Checker instproc checkLink {request link} { + set resolved [resolve $link [$request set url]] + if {[my isToCheck $resolved $request method]} { + my instvar checked + if {![info exists checked($resolved)]} { + my report "checking .......... $resolved" 0 + set checked($resolved) 1 + my scheduleRequest $method $resolved [$request set url] + } else { + #puts stderr "already checked $resolved" + } + } +} +Checker instproc checkText {request} { + if {![my isLocal [$request set url]]} return + [self class] instvar ref ref_re + set content [$request getContent] + set start 0 + while {[regexp -nocase -indices -start $start -- \ + {<(A|IMG)([^>]*?)} $content a b c]} { + set elem [string toupper \ + [string range $content [lindex $b 0] [lindex $b 1]]] + set attribs [string range $content [lindex $c 0] [lindex $c 1]] + #regsub -all {[\n ]+} $attribs " " attribs + if {[regexp -nocase $ref($elem)$ref_re $attribs _ i]} { + my checkLink $request [string trim $i '\"] + } + set start [lindex $c 1] + } +} +Checker instproc endCb r { + #showObj $r + switch [$r set contentType] { + text/html {my checkText $r} + } + next +} +Checker instproc cancelCb r { + #$r showVars + puts stderr "ERROR in page [$r set parentUrl]" + puts stderr " Link: [$r set url]" + puts stderr " cause [$r set errormsg]\n" + next +} + +Checker csink \ + -verbose $opt(-verbose) -foreign $opt(-foreign) -local $opt(-local) \ + -sinkClass MemorySink -httpVersion 1.0 -maxsimultaneous 30 +csink requests $opt(-url) +puts stderr "sumbytes: [csink set sumbytes] requests: [csink set numrequests]" +csink destroy Index: xotcl/apps/comm/secure-webclient.xotcl =================================================================== diff -u --- xotcl/apps/comm/secure-webclient.xotcl (revision 0) +++ xotcl/apps/comm/secure-webclient.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,52 @@ +#!/usr/local/bin/xotclsh +# $Id: secure-webclient.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +package require XOTcl; namespace import -force xotcl::* + +@ @File { + description { + A sample secure web client that queries an secure web-server. + It needs to be adopted with different https URLs for testing... + } +} + +# +package require xotcl::comm::httpAccess +package require xotcl::comm::ftp +package require xotcl::trace + +#set version 1.1 +set hostport localhost:8086 +set http_server http://localhost:8086/ +set https_server https://localhost:8443/ + +set slowURL "http://quote.yahoo.com/q?s=^DJI&d=1d" +set ftpURL "ftp://mohegan.wi-inf.uni-essen.de/welcome.msg" + +set secureURL "https://wawog.wi-inf.uni-essen.de/" +set secureURL "https://test17.wu-wien.ac.at:1234/" + +proc printError msg {puts stderr !!!$msg!!!} + +puts "\nTrying to get a secure page ..... <$https_server>" +SimpleRequest r0 -url $https_server +puts stderr "\n content = {[r0 getContent]}" + +puts -nonewline "\nTrying to load image logo-100.jpg ... (not secure)" +SimpleRequest r2 -url $http_server/logo-100.jpg +if {[r2::sink set contentLength] == 1706} { + puts "suceeded! Loaded 1706 bytes!" +} else { + puts "failed! Loaded [r2::sink set contentLength] (!= 1706) bytes" + exit +} + +puts -nonewline "\nTrying to load image logo-100.jpg secure ... " +SimpleRequest r1 -url $https_server/logo-100.jpg +if {[r1::sink set contentLength] == 1706} { + puts "suceeded! Loaded 1706 bytes!" +} else { + puts "failed! Loaded [r1::sink set contentLength] (!= 1706) bytes" + exit +} +exit Index: xotcl/apps/comm/secure-webserver.xotcl =================================================================== diff -u --- xotcl/apps/comm/secure-webserver.xotcl (revision 0) +++ xotcl/apps/comm/secure-webserver.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,79 @@ +#!/usr/local/bin/xotclsh +# $Id: secure-webserver.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package require XOTcl; namespace import -force xotcl::* + +@ @File { + description { + This small secure web server that provides its documents + via SSL (https, port 8443) and plain http (port 8086). +
+ This file requires TLS. If you experice problems with + versions obtained from the Web, contact gustaf.neumann@wu-wien.ac.at + for a patch. + } +} + +# +# We load the following packages: +# +package require xotcl::trace +package require xotcl::comm::httpd +# +# we set the default for document root to ../../src/doc and port to 8443 +# +set root ../../doc +set port 8443 +set class Httpsd +set cb callback ;# use this for triggering the callbacks +#set cb "" + +foreach {att value} $argv { + switch -- $att { + -root {set root $value} + -port {set port $value} + -class {set class $value} + -cb {set cb $value} + } +} +# +# now we can start the web-server instance with these settings +# +Httpd h0 -port 8086 -root $root +$class h1 -port $port -root $root -infoCb $cb \ + -requestCert 1 -requireValidCert 0 + + +# Start des HTTP-Servers mit port 8086 und dem angegebenen Verzeichnis +#Httpd h2 -port 9086 -root $root \ + -mixin {Responder BasicAccessControl} \ + -addRealmEntry test {test test} -protectDir test "" {} + +Object callback +callback proc error {chan msg} { + puts stderr "+++TLS/$chan: error: $msg" +} +callback proc verify {chan depth cert rc err} { + array set c $cert + if {$rc != "1"} { + puts stderr "+++TLS/$chan: verify/$depth: Bad Cert: $err (rc = $rc)" + } else { + puts stderr "+++TLS/$chan: verify/$depth: $c(subject)" + } + return $rc +} +callback proc info {chan state minor msg} { + # For tracing + #upvar #0 tls::$chan cb + #set cb($major) $minor + #puts stderr "+++TLS/$chan: $major/$minor: $state" + puts stderr "+++TLS/$chan $state $minor: $msg" + +} +callback proc unknown {option args} { + return -code error "bad option \"$option\": must be one of error, info, or verify" +} +# +# and finally call the event loop... +# +vwait forever + Index: xotcl/apps/comm/server.key =================================================================== diff -u --- xotcl/apps/comm/server.key (revision 0) +++ xotcl/apps/comm/server.key (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQDVg+HdA4RAKyYRaxKRSdAw7mQpephZslIf/ZR7Oe3RKZjxu7Sj +PYG56GSc8y6hiaKuGnDmJcEGXZCXWNtUuACVsNlFrlVbGSEfAbXbz6H4eaaX2d2P +KzrjOc//8+5emaFZRelVTYY4sWNLcCuWV2FIhwMJMblYieXM6iEQg4XzdQIDAQAB +AoGAVdY2OC8QvOdb34bHKSeejf1YwSArHWxF/dxpE/0e8YaimRQYM8QnYgDeagaN +yZ1WjF3O44dsCU4WMfIkAvQSL19RLSgT+jPb3Uu9Aotwmg4x+55BKctRphXKiIfu ++a0IfAFDIt8FMRS08AoSB6eBgOBlhTZM2Y0IuC6QTqaBcwUCQQD5XSiEzh44uMOl +N4FbO0MI2NC3pbPg5u1fEJtIawoYOYxbeGHrlOYO2ZN3ZP6+2g5V0kX5tMMeObhE +qQLlmNETAkEA2zJ/Tk3IE5ByEBcGjG26nJ1zLlY13NaiIg+AoSP+7rHg5TPhoQp1 +VVwcqd4ZWCyqgYDFl2TsiiZwKcEIFJBCVwJBANoLpZSLD04V8a2UXV5C8ZjYzZjo +IeP0yXco9D9cqZUJLTwGhckTiB9QDWyHOWH1FjfhCCMS9tKFMiWHi+rrt1UCQQDC +rlvxURX1gmI8NicjzEVk2la1fe5C4QKJW9lzxUOj/qpvB6BK5r4FfVUb7d32uV0K +vjNAXmvT24XdH8usb9/rAkBR1sqUkqwwm0CSe0Rz9IhSlkwWlmvEzSmEguqrd7Zb +rbYJ9NTnV1uFSAX9vcU7lDRp69il6XmyhOL06FYLRaNa +-----END RSA PRIVATE KEY----- Index: xotcl/apps/comm/server.pem =================================================================== diff -u --- xotcl/apps/comm/server.pem (revision 0) +++ xotcl/apps/comm/server.pem (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,66 @@ +issuer :/C=DE/ST=NRW/L=Essen/O=University of Essen/OU=SWT/CN=Fredj Dridi/Email=Fredj.Dridi@uni-essen.de +subject:/C=DE/ST=NRW/L=Essen/O=University of Essen/OU=SWT/CN=tp600e.wi-inf.uni-essen.de/Email=dridi@tp600e.wi-inf.uni-essen.de +serial :01 + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=DE, ST=NRW, L=Essen, O=University of Essen, OU=SWT, CN=Fredj Dridi/Email=Fredj.Dridi@uni-essen.de + Validity + Not Before: Apr 28 08:21:19 2000 GMT + Not After : Apr 28 08:21:19 2001 GMT + Subject: C=DE, ST=NRW, L=Essen, O=University of Essen, OU=SWT, CN=tp600e.wi-inf.uni-essen.de/Email=dridi@tp600e.wi-inf.uni-essen.de + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d5:83:e1:dd:03:84:40:2b:26:11:6b:12:91:49: + d0:30:ee:64:29:7a:98:59:b2:52:1f:fd:94:7b:39: + ed:d1:29:98:f1:bb:b4:a3:3d:81:b9:e8:64:9c:f3: + 2e:a1:89:a2:ae:1a:70:e6:25:c1:06:5d:90:97:58: + db:54:b8:00:95:b0:d9:45:ae:55:5b:19:21:1f:01: + b5:db:cf:a1:f8:79:a6:97:d9:dd:8f:2b:3a:e3:39: + cf:ff:f3:ee:5e:99:a1:59:45:e9:55:4d:86:38:b1: + 63:4b:70:2b:96:57:61:48:87:03:09:31:b9:58:89: + e5:cc:ea:21:10:83:85:f3:75 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + keyid:D2:B8:E3:2D:A2:5A:22:78:3A:38:F1:1F:F5:7C:AD:8D:A6:C4:41:0F + + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Microsoft Server Gated Crypto, Netscape Server Gated Crypto + X509v3 Basic Constraints: critical + CA:FALSE + Signature Algorithm: md5WithRSAEncryption + 38:b5:a1:1c:93:c4:aa:6e:3f:d6:ea:11:7f:7b:2b:11:db:7b: + 22:b3:d2:a8:b3:f3:20:64:6a:25:b4:fe:0d:ac:12:49:a0:6e: + 6d:ef:fb:99:a2:7c:bc:50:b0:eb:42:ef:0a:32:fa:a9:69:e0: + 11:10:9b:00:05:15:97:59:ac:dc:5f:f2:cd:81:28:3e:e6:96: + 86:f4:d7:99:71:52:c3:ca:0f:4a:48:d8:66:b0:da:e8:d1:45: + 84:c4:12:b2:43:ec:63:b6:25:e8:0a:5a:4c:fb:e2:ec:03:36: + 6f:cd:f9:2a:5c:52:ba:02:29:92:f5:bf:c4:96:ff:9e:ed:a3: + cf:02 + +-----BEGIN CERTIFICATE----- +MIIDIjCCAougAwIBAgIBATANBgkqhkiG9w0BAQQFADCBljELMAkGA1UEBhMCREUx +DDAKBgNVBAgTA05SVzEOMAwGA1UEBxMFRXNzZW4xHDAaBgNVBAoTE1VuaXZlcnNp +dHkgb2YgRXNzZW4xDDAKBgNVBAsTA1NXVDEUMBIGA1UEAxMLRnJlZGogRHJpZGkx +JzAlBgkqhkiG9w0BCQEWGEZyZWRqLkRyaWRpQHVuaS1lc3Nlbi5kZTAeFw0wMDA0 +MjgwODIxMTlaFw0wMTA0MjgwODIxMTlaMIGtMQswCQYDVQQGEwJERTEMMAoGA1UE +CBMDTlJXMQ4wDAYDVQQHEwVFc3NlbjEcMBoGA1UEChMTVW5pdmVyc2l0eSBvZiBF +c3NlbjEMMAoGA1UECxMDU1dUMSMwIQYDVQQDExp0cDYwMGUud2ktaW5mLnVuaS1l +c3Nlbi5kZTEvMC0GCSqGSIb3DQEJARYgZHJpZGlAdHA2MDBlLndpLWluZi51bmkt +ZXNzZW4uZGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANWD4d0DhEArJhFr +EpFJ0DDuZCl6mFmyUh/9lHs57dEpmPG7tKM9gbnoZJzzLqGJoq4acOYlwQZdkJdY +21S4AJWw2UWuVVsZIR8BtdvPofh5ppfZ3Y8rOuM5z//z7l6ZoVlF6VVNhjixY0tw +K5ZXYUiHAwkxuViJ5czqIRCDhfN1AgMBAAGjZzBlMB8GA1UdIwQYMBaAFNK44y2i +WiJ4OjjxH/V8rY2mxEEPMDQGA1UdJQQtMCsGCCsGAQUFBwMBBggrBgEFBQcDAgYK +KwYBBAGCNwoDAwYJYIZIAYb4QgQBMAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEE +BQADgYEAOLWhHJPEqm4/1uoRf3srEdt7IrPSqLPzIGRqJbT+DawSSaBube/7maJ8 +vFCw60LvCjL6qWngERCbAAUVl1ms3F/yzYEoPuaWhvTXmXFSw8oPSkjYZrDa6NFF +hMQSskPsY7Yl6ApaTPvi7AM2b835KlxSugIpkvW/xJb/nu2jzwI= +-----END CERTIFICATE----- + Index: xotcl/apps/comm/test-tls-client.xotcl =================================================================== diff -u --- xotcl/apps/comm/test-tls-client.xotcl (revision 0) +++ xotcl/apps/comm/test-tls-client.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,86 @@ +#!/usr/local/bin/xotclsh +# +# $Id: test-tls-client.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +package require tls + +proc bgerror {err} { + global errorInfo + puts stderr "BG Error: $errorInfo" +} + +array set opts { + -port 8443 + -host localhost +} +array set opts $argv + + + + +proc readCB {CHAN} { + #puts stderr "*** CALL: readCB $CHAN" + if {![eof $CHAN]} { + set rData [gets $CHAN] + puts stderr "\nREADING ..." + puts stderr "------------------------------------------------------" + puts stderr <$rData> + puts stderr "------------------------------------------------------" + + #fileevent $CHAN writable [list writeCB $CHAN] + } else { + catch {close $CHAN} + puts stderr "\nSocket ($CHAN) is closed." + exit + } +} +proc writeCB {CHAN} { + #puts stderr "*** CALL: writeCB $CHAN" + #puts stderr "fileevent $CHAN writable {}" + fileevent $CHAN writable {} + set wData "GET / HTTP/1.1\r\nHost: localhost\r\nAccept: */*\r\n\r\n" + #set wData "GET\n" + puts -nonewline $CHAN $wData + flush $CHAN + #puts stderr "\nfileevent $CHAN readable [list readCB $CHAN]" + fileevent $CHAN readable [list readCB $CHAN] +} + +puts stderr "\n\n\n~~~~~~~~~~~~ Trying $opts(-host):$opts(-port)" +# +# Create socket +# +set chan [socket -async $opts(-host) $opts(-port)] + +tls::import $chan -command callback -cafile cacert.pem -certfile client.pem -server 0 -keyfile client.key -request 1 -require 1 + +puts stderr "setting channel to auto binary" +fconfigure $chan -translation {auto binary} +puts stderr "fileevent $chan writable [list writeCB $chan]" +fileevent $chan writable [list writeCB $chan] + + +Object callback +callback proc error {chan msg} { + puts stderr "+++TLS/$chan: error: $msg" +} +callback proc verify {chan depth cert rc err} { + array set c $cert + if {$rc != "1"} { + puts stderr "+++TLS/$chan: verify/$depth: Bad Cert: $err (rc = $rc)" + } else { + puts stderr "+++TLS/$chan: verify/$depth: $c(subject)" + } + return $rc +} +callback proc info {chan state minor msg} { + puts stderr "+++TLS/$chan $state $minor: $msg" + +} +callback proc unknown {option args} { + my showCall + return -code error "bad option \"$option\": must be one of error, info, or verify" +} + + +vwait forever Index: xotcl/apps/comm/test-tls-server.xotcl =================================================================== diff -u --- xotcl/apps/comm/test-tls-server.xotcl (revision 0) +++ xotcl/apps/comm/test-tls-server.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,87 @@ +#!/usr/local/bin/xotclsh +# $Id: test-tls-server.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# +# sample secure server that reflect all incoming data to the client +# It uses tls1.3 package of Matt Newman +# Fredj Dridi + +package require tls + +proc bgerror {err} { + global errorInfo + puts stderr "BG Error: $errorInfo" +} + +# +# Sample callback - just reflect data back to client +# +proc reflectCB {chan {verbose 0}} { + puts stderr "\n*** reflectCB $chan $verbose" + + fconfigure $chan -translation {auto crlf} + + set data {} + if {[catch {set n [::gets $chan data]} msg]} { + set error $msg + puts stderr "\nEOF ($data)" + catch {close $chan} + return 0 + } + puts stderr n=<$n> + if {$verbose && $data != ""} { + puts stderr "data=<$data>" + } + if {[eof $chan]} { ;# client gone or finished + puts stderr "\nEOF" + close $chan ;# release the servers client channel + return + } + #puts -nonewline $chan $data + #flush $chan +} +proc acceptCB { chan ip port } { + puts stderr "\n*** acceptCB $chan $ip $port" + + tls::import $chan -cafile cacert.pem -certfile server.pem \ + -server 1 -request 1 -require 1 -keyfile server.key -command callback + if {![tls::handshake $chan]} { + puts stderr "\nHandshake pending" + return + } + array set cert [tls::status $chan] + puts stderr "\n" + parray cert + + fileevent $chan readable [list reflectCB $chan 1] +} + + +set chan [socket -server acceptCB 8443] +puts stderr "Server waiting connection on $chan (8443)" + + +## Sample Callback that gives SSL information +Object callback +callback proc error {chan msg} { + puts stderr "+++TLS/$chan: error: $msg" +} +callback proc verify {chan depth cert rc err} { + array set c $cert + if {$rc != "1"} { + puts stderr "+++TLS/$chan: verify/$depth: ** Bad Cert **: $err (rc = $rc)" + } else { + puts stderr "+++TLS/$chan: verify/$depth: $c(subject)" + } + return $rc +} +callback proc info {chan state minor msg} { + puts stderr "+++TLS/$chan $state $minor: $msg" + +} +callback proc unknown {option args} { + my showCall + return -code error "bad option \"$option\": must be one of error, info, or verify" +} + +# Go into the eventloop +vwait forever Index: xotcl/apps/comm/webclient.xotcl =================================================================== diff -u --- xotcl/apps/comm/webclient.xotcl (revision 0) +++ xotcl/apps/comm/webclient.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,7 @@ +#!../../src/xotclsh +package require XOTcl; namespace import -force xotcl::* + +@ @File {description {For a sample webclient, see packages/comm/xocomm.test}} +package require xotcl::comm::httpAccess +set hostport localhost:8086 +SimpleRequest r0 -url http://$hostport/logo-100.jpg Index: xotcl/apps/comm/webserver.xotcl =================================================================== diff -u --- xotcl/apps/comm/webserver.xotcl (revision 0) +++ xotcl/apps/comm/webserver.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,104 @@ +#!../../src/xotclsh +# $Id: webserver.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +array set opts {-root ../../doc -port 8086 -protected-port 9096 -pkgdir .} +array set opts $argv +lappend auto_path $opts(-pkgdir) +#if {$::tcl_platform(platform) == "windows"} {lappend auto_path .} +package require XOTcl; namespace import -force xotcl::* + +@ @File { + description { + This small demo program starts two different webservers: +

    +
  • Firstly, it provides a sample web server that povides the documents in + ../../src/doc (or the files specified with -root) at port 8086 + (or at the port specified via the -port option) as unprotected resources. +

    +

  • Secondly, it starts a second webserver with basic access control + (it accepts test/test as user/password) on port 9096 (or on the + port specified via -protected-port). If it receives an request + for an resource named "exit", it terminates. For all other requests + it returns actual information about the user and the issued request. +
+ To see, how it works, contact it e.g. from netscape. + } +} + +# We load the following packages: +# +package require xotcl::comm::httpd + +# now we can start the web-server instance with these settings +# +Httpd h1 -port $opts(-port) -root $opts(-root) +@ Httpd h1 {description "unprotected web server"} + +# specialized worker, which executes tcl commands in web pages +@ Class SpecializedWorker { description { + Specialized worker that can be passed to any webserver +}} +Class SpecializedWorker -superclass Httpd::Wrk +@ SpecializedWorker instproc respond {} { description { + This method handles all responses from the webserver to the client. + We implent here "exit", and we return the information about the actual + request and user in HTML format for all other requests. +

This method is an example, how to access on the server side + request specific infomation. +}} +SpecializedWorker instproc respond {} { + if {[my set resourceName] == "exit"} { + set ::forever 1 + #my showVars + #my set version 1.0;### ???? + #puts stderr HERE + } + # return for all other requests the same response + foreach {a v} [my array get meta] { + append m $a$v\n + } + set content { + +

Request Info

+ + + + + + + +
method:[my set method]
resource:[my set resourceName]
user:[my set user]
version:HTTP/[my set version]
response port:[my set port]
request comes from:[my set ipaddr]
+

Request Header Fields

+ $m
+ + } + set c [subst $content] + my replyCode 200 + my connection puts "Content-Type: text/html" + my connection puts "Content-Length: [string length $c]\n" + my connection puts-nonewline $c + my close +} + +@ Httpd h2 { + description "Web server with basic authentication using the specialied worker"} + +if {[info exists env(USER)]} { + set USER "$env(USER)" +} elseif {[info exists env(USERNAME)]} { + set USER "$env(USERNAME)" +} else { + set USER unknown +} +if {$::tcl_platform(platform) == "windows"} { + set USER unknown +} + +Httpd h2 -port $opts(-protected-port) -root $opts(-root) \ + -httpdWrk SpecializedWorker \ + -mixin BasicAccessControl \ + -addRealmEntry test "u1 test $USER test" -protectDir test "" {} + +# +# and finally call the event loop... +# +vwait forever Index: xotcl/apps/persistence/persistenceTest.xotcl =================================================================== diff -u --- xotcl/apps/persistence/persistenceTest.xotcl (revision 0) +++ xotcl/apps/persistence/persistenceTest.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,44 @@ +#!/usr/local/bin/xotclsh +package require XOTcl; namespace import -force xotcl::* + +package require xotcl::store::persistence +package require xotcl::mixinStrategy + +PersistenceMgr jufpMgr +PersistenceMgr tclpMgr -dbPackage TclGdbm +Class PersistenceTest -parameter {{countVar 0} {appendVar ""} pm} +PersistenceTest instproc init args { + my mixinStrategy Persistent=Eager + my persistenceMgr [my set pm] + my persistent {countVar appendVar} + next +} + +PersistenceTest instproc incrCount {} { + puts "in [self] countVar now is [my countVar]" + my incr countVar +} +PersistenceTest instproc appendV {x} { + my append appendVar $x + puts "append is: [my appendVar]" +} + +PersistenceTest instproc test {} { + # first we increment a counter: + my incrCount + # now we 5x append something to appendVar + for {set i 0} {$i<5} {incr i} { + my appendV a + } + # now we list all keys in the database + puts "Variables stored in [my persistenceMgr].db: [[my persistenceMgr] names]" + # now we delete append var + puts "Deleting append:[[my persistenceMgr] delete [self]::appendVar]" + # now we list the keys again + puts "Variables stored in [my persistenceMgr].db: [[my persistenceMgr] names]" +} + +PersistenceTest persistenceJufTest -pm jufpMgr -init -test +#PersistenceTest persistenceTclTest -pm tclpMgr -init -test + +#PersistenceTest instproc count \ No newline at end of file Index: xotcl/apps/scripts/adapter.xotcl =================================================================== diff -u --- xotcl/apps/scripts/adapter.xotcl (revision 0) +++ xotcl/apps/scripts/adapter.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,30 @@ +# $Id: adapter.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +Class Adapter -superclass Class + +@ @File { + description { + Simple adapter pattern meta-class taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + } +} + +Adapter instproc adapterFilter args { + set r [self calledproc] + my instvar adaptee specificRequest + if {[info exists specificRequest($r)]} { + return [eval $adaptee $specificRequest($r) $args] + } + next +} + +Adapter instproc init args { + my instfilterappend adapterFilter + next + my instproc setRequest {r sr} { + my set specificRequest($r) $sr + } + my instproc setAdaptee {a} { + my set adaptee $a + } +} Index: xotcl/apps/scripts/adapterExample.xotcl =================================================================== diff -u --- xotcl/apps/scripts/adapterExample.xotcl (revision 0) +++ xotcl/apps/scripts/adapterExample.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,36 @@ +# $Id: adapterExample.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# include the adapter pattern +source adapter.xotcl + +@ @File { + description { + Simple adapter pattern example class (FTP requests) taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + } +} + +Class FTPLIB +FTPLIB instproc FTPLIB_connect args { + puts "in ftplib connect" +} + +Class Connection +Connection instproc connect args { + puts "in Connection connect" +} +Connection instproc discard args { + puts "in Connection discard" +} + +Adapter FTP -superclass Connection + +FTP instproc init args { + FTPLIB ftpAdaptee + my setRequest connect FTPLIB_connect + my setAdaptee ftpAdaptee +} +FTP f + +f connect +f discard Index: xotcl/apps/scripts/composite.xotcl =================================================================== diff -u --- xotcl/apps/scripts/composite.xotcl (revision 0) +++ xotcl/apps/scripts/composite.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,53 @@ +#$Id: composite.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +Class Composite -superclass Class +Composite metadata add description +@ @File { + description { + Simple composite pattern meta-class taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + } +} + +Composite instproc addOperations args { + foreach op $args { + if {![my exists operations($op)]} { + my set operations($op) $op + } + } +} + +Composite instproc removeOperations args { + foreach op $args { + if {![my exists operations($op)]} { + my unset operations($op) + } + } +} + +Composite instproc compositeFilter args { + # get the operations class variable from the object's class + set registrationclass [lindex [self filterreg] 0] + $registrationclass instvar operations + # get the request + set r [self calledproc] + puts ***compositeFilter--${r}--[self] + + # check if the request is a registered operation + if {[info exists operations($r)]} { + foreach object [my info children] { + # forward request + eval $object $r $args + } + } + return [next] +} + + +Composite instproc init {args} { + my array set operations {} + next + my instfilterappend compositeFilter +} + + Index: xotcl/apps/scripts/compositeExample.xotcl =================================================================== diff -u --- xotcl/apps/scripts/compositeExample.xotcl (revision 0) +++ xotcl/apps/scripts/compositeExample.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,40 @@ +# $Id: compositeExample.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# include the pattern +source composite.xotcl + +Class Graphic +@ @File { + description { + Simple Graphics example of the composite pattern taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. They demonstrate instfilters, + filter chains and filter inheritance. + } +} + + +Graphic instproc draw {} { + puts "in--- draw SELF: [self] CLASS: [self class]" +} + +Composite Picture -superclass Graphic +Class Line -superclass Graphic +Class Rectangle -superclass Graphic + + +Picture addOperations draw +#Picture removeOperations draw + +Picture aPicture +Picture aPicture::bPicture +Line aPicture::aLine +Rectangle aPicture::aRect +Line aPicture::bPicture::aLine +Rectangle aPicture::bPicture::aRect +Picture aPicture::bPicture::cPicture +Picture aPicture::bPicture::dPicture +Line aPicture::bPicture::cPicture::cLine + +# draw eines Composites +puts "DRAW im Composite: aPicture" +aPicture draw Index: xotcl/apps/scripts/observer.xotcl =================================================================== diff -u --- xotcl/apps/scripts/observer.xotcl (revision 0) +++ xotcl/apps/scripts/observer.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,87 @@ +#$Id: observer.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +Class Observer -superclass Class + +Observer metadata add description +@ @File { + description { + Simple observer pattern meta-class taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + } +} + +Class Observer::Subject -superclass Class + +Observer::Subject instproc notificationFilter {args} { + set procName [self calledproc] + my instvar preObservers postObservers + + if {[info exists preObservers($procName)]} { + foreach obj $preObservers($procName) { $obj update [self] $args } + } + + set result [next] + + if {[info exists postObservers($procName)]} { + foreach obj $postObservers($procName) { $obj update [self] $args } + } + return $result +} + +Class Observer::SubjectMgt +Observer::SubjectMgt instproc attach {hook objs} { + upvar $hook observers + foreach obj $objs { + if {![info exists observers] || [lsearch $observers $obj] == -1} { + lappend observers $obj + } + } +} +Observer::SubjectMgt instproc detach {hook objs} { + upvar $hook observers + if {[info exists observers]} { + foreach obj $objs { + set p [lsearch $observers $obj] + set observers [lreplace $observers $p $p] + } + } +} + +Observer::SubjectMgt instproc attachPre {procName args} { + my instvar preObservers + my attach preObservers($procName) $args +} +Observer::SubjectMgt instproc attachPost {procName args} { + my instvar postObservers + my attach postObservers($procName) $args +} +Observer::SubjectMgt instproc detachPre {procName args} { + my instvar preObservers + my detach preObservers($procName) $args +} +Observer::SubjectMgt instproc detachPost {procName args} { + my instvar postObservers + my detach postObservers($procName) $args +} + +Observer::Subject instproc init args { + next + my superclass [list Observer::SubjectMgt [my info superclass]] + my instfilter notificationFilter +} + +Observer instproc timeout t { + my set timeout $t +} + +Observer instproc update {subject args} { + #addTimeOut [my set timeout] "[self] update $subject $args" + #$subject getResponse + # do something with the response + puts [self]---update +} + +Observer instproc init args { + next +} + Index: xotcl/apps/scripts/parameter.xotcl =================================================================== diff -u --- xotcl/apps/scripts/parameter.xotcl (revision 0) +++ xotcl/apps/scripts/parameter.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,150 @@ +### Sample file for parameter testing.... +### For every class "-parameter" can be specified which accepts +### a list of parameter specifications. +### +### * If a parameter specification consists of a single word, +### the word is considered as the parameter name and +### a standard setter/getter method with this name is created. +### +### * If the parameter specification consists of two words, the +### second word is treated as the default value, which is stored +### in the class object. +### +### * If a default value exists in the class object, a +### corresponding instance variable with the name of the +### parameter is created automatically during initialization +### of the object. +### +### * If the parameter specification consists of more than two words, +### various parameter methods (starting with "-") with arguments +### can be specified. In the following example +### Class C -parameter {{a 1} {b -default 1}} +### C c1 +### both a and b receive 1 as default value. +### +### * In order to call the standard getter method use the method +### with the name of the parameter with one parameter. For example, +### in order to call the standard getter for parameter a, use +### puts [c1 a] +### In order to use the standard setter for b, use the method with +### two parameters. +### c1 b 123 +### +### * There are two ways to specify custom setter/getter methods for +### parameters: (a) the custom setter/getter can be defined within the +### class hierarchy of the object, or (b) the custom getter/setter can +### be specified on a different object. The custom setter/getter +### method are called, from the standard setter/getter methods +### automatically if specified. +### * In order to use approach (a) the parameter methods -getter +### and -setter can be used to specify the custom getter and +### and setter methods: +### Class D -parameter {{a -setter myset -getter myget}} +### The methods myset and myget are called like set with +### one or two arguments. They are responsible for setting and +### retrieving the appropiate values. It is possible to +### specify any one of these parameter methods. +### * In order to use approach (b) a parameter methods -access +### is use to specify an object responsible for setting/getting +### these values. This has the advantage that the custom getter and +### setter methods can be inherited from a separate class hierarchy, +### such they can used for any object without cluttering its +### interface. +### * In order to keep the parameter specification short the access +### object my contain instance variables setter or getter, naming the +### setter/getter methods. If these instance variables are not +### in the access object, "set" is used per default for getter and +### setter. These default values can be still overridden by the +### parameter methods -setter or -getter. +### * If the access object is specified, +### are passed to the setter method and are passed +### to the custom getter method (in approach (a) the object is +### is not needed). + +Object different +different set setter myset +different set getter myget +different proc myset {o var value} { $o set $var $value } +different proc myget {o var} { $o set $var } + + +Object print +print proc set {o args} { + ::set var [lindex $args 0] + if {[llength $args]==1} { + puts "*** $o get $var" + $o set $var + } else { + ::set value [lindex $args 1] + puts "*** $o set $var $value" + $o set $var $value + } +} +print proc myset {o var value} { + puts "*** $o myset $var $value" + $o set $var $value +} + +Class P +P instproc set {o args} { + puts stderr "instance [self] of parameter class P called for $o $args" + if {[llength $args] == 1} { + $o set [lindex $args 0] + } else { + $o set [lindex $args 0] [lindex $args 1] + } +} +P p + +Class M +M instproc mset args { + puts stderr "Mixin [self class] called for [self] $args" + if {[llength $args] == 1} { + my set [lindex $args 0] + } else { + my set [lindex $args 0] [lindex $args 1] + } +} + + +set x different + +Class C -parameter { + {c [self]} + d + {e ""} + {f -default 123 -setter setf -getter getf} + {g -default 1000 -access print} + {h -default 1001 -access print -setter myset} + {i -default 1002 -access different} + {j -default $x -access ::p} + {k {[self class]}} + {l -default {[self class]} } + } +C parameter [list [list z -access [P new -childof C] -default zzz]] + +C instmixin M +C parameter {{x -default 333 -setter mset -getter mset}} + +puts stderr +++[C info parameter] + +C instproc setf {var val} { + puts stderr "... setting $var to $val" + my set $var $val +} +C instproc getf var { + puts stderr "... getting value of $var" + my set $var +} + +#puts stderr "body of f: [C info instbody f]" +puts stderr "body of x: [C info instbody x]" +puts ======================create +C c1 -f 133 -g 101 -h 102 -i 103 +puts ======================readvars +foreach v [lsort [c1 info vars]] { + puts "$v = <[c1 $v]>" +} + +puts "instances of P: [P info instances]" +puts "instances of C: [C info instances]" Index: xotcl/apps/scripts/pinger.xotcl =================================================================== diff -u --- xotcl/apps/scripts/pinger.xotcl (revision 0) +++ xotcl/apps/scripts/pinger.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,64 @@ +#$Id: pinger.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# include the pattern +source observer.xotcl + +Class Pinger +@ @File { + description { + Pinger example for the observer pattern taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + It demonstrates how to observe a network connection. + } +} + +Observer::Subject Pinger::Collector -parameter {hostName {update 1}} +Observer Pinger::Diagram +Observer Pinger::TextOutput + +Pinger::Collector instproc init args { + my instvar update hostName + set f [open "| ping -i $update $hostName" r] + fconfigure $f -blocking false + fileevent $f readable "[self] ping \[gets $f\]" +} + +Pinger::Collector instproc getResponse {} { + puts "in--- [self] [format %-12s [self proc]] ([self class])" +} + +Pinger::Collector instproc ping {string} { + puts "in--- [self] [format %-12s [self proc]] ([self class])" + puts $string +} + +Pinger::Diagram instproc update {subject args} { + puts "in--- [self] [format %-12s [self proc]] ([self class]) -- SUBJECT: $subject" + $subject getResponse + # do something with the response +} + +Pinger::TextOutput instproc update {subject args} { + puts "in--- [self] [format %-12s [self proc]] ([self class]) -- SUBJECT: $subject" + $subject getResponse + # do something with the response +} + +namespace eval ::Pinger { + Collector ::c1 -hostName 132.252.180.231 + Collector ::c2 -hostName 137.208.7.48 + Diagram ::d1 + Diagram ::d2 + Diagram ::d3 + TextOutput ::t1 +} + +c1 attachPre ping d1 d2 +c1 attachPost ping d2 d3 +c1 attachPost ping t1 +c2 attachPost ping t1 d2 + +#c1 detachPre ping d1 +#c1 detachPost ping d2 d3 +vwait forever + Index: xotcl/apps/scripts/simpleFilters.xotcl =================================================================== diff -u --- xotcl/apps/scripts/simpleFilters.xotcl (revision 0) +++ xotcl/apps/scripts/simpleFilters.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,57 @@ +# $Id: simpleFilters.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +@ @File { + description { + Some simple examples of (inst)filters taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. They demonstrate filters, + filter chains and filter inheritance. + } +} + +Class A +A instproc Filter-1 args { + puts " pre-part of [self proc]" ;# pre part + next ;# next call + puts " post-part of [self proc]" ;# post part +} +A instproc printSomething args { + puts " actual called proc: [self proc]" +} +A a1 + +A instfilter Filter-1 +#a1 set x 1 + +puts "A call surrounded by pre/post messages:" +a1 printSomething + +A instfilter {} +A instproc Filter-2 args { + puts " only a pre-part in [self proc]" + next +} +A instproc Filter-3 args { + next + puts " only a post-part in [self proc]" +} +A instfilter {Filter-1 Filter-2 Filter-3} +puts "Now a filter chain:" +a1 printSomething +A instfilter {} + +Class B -superclass A +B instproc Filter-B args { + puts " entering method: [self proc]" + next +} +B b1; B b2 +A instfilter {Filter-1 Filter-2 Filter-3} +B instfilter Filter-B + +puts "And finally inheritance:" + +b1 printSomething + +B instfilter {} +A instfilter {} Index: xotcl/apps/scripts/soccerClub.xotcl =================================================================== diff -u --- xotcl/apps/scripts/soccerClub.xotcl (revision 0) +++ xotcl/apps/scripts/soccerClub.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,210 @@ +# $Id: soccerClub.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# This is a simple introductory example for the language XOTcl. +# It demonstrates the basic language constructs on the example of +# a soccer club. + +package require XOTcl; namespace import -force xotcl::* + +# All the characters in this example are fictitious, and any +# resemblance to actual persons, living or deceased, is coincidental. + +# In XOTcl we do not have to provide the above file description +# as a comment, but we can use the @ object, which is used generally +# to provide any kind of information, metadata, and documentation on +# a running program. Here, we just give a file description. +# Now makeDoc.xotcl will automatically document this file for us. +@ @File { + description { + This is a simple introductory example for the language XOTcl. + It demonstrates the basic language constructs on the example of + a soccer club. + } +} + +# +# All things and entities in XOTcl are objects, a special kind of objects +# are classes. These define common properties for other objects. For a +# soccer club, we firstly require a common class for all kinds of members. +# +# Common to all members is that they have a name. Common properties defined +# across all instances of a class are called "Parameters" in XOTcl. +# +Class ClubMember -parameter {{name ""}} + +# A special club member is a Player. Derived classes can be build with +# inheritance (specified through 'superclass'). Players may have a +# playerRole (defaults to NONE): +Class Player -superclass ClubMember -parameter {{playerRole NONE}} + +# other club member types are trainers, player-trainers, and presidents +Class Trainer -superclass ClubMember +Class President -superclass ClubMember + +# the PlayerTrainer uses multiple inheritance by being both a player +# and a trainer +Class PlayerTrainer -superclass {Player Trainer} + +# +# Now we define the SoccerTeam class. +# +Class SoccerTeam -parameter {name location type} + +# We may add a player. This is done by a method. Instance methods are +# in XOTcl defined with 'instproc'. All club members are aggregated in +# the team (denoted by :: namespace syntax). +SoccerTeam instproc newPlayer args { + # we use a unique autoname for the object to prevent name + # collisions, like ::player01, ::player02, ... + eval Player [self]::[my autoname player%02d] $args +} + +# A player can be transfered to another team. The player object does +# not change internally (e.g. the playerRole stays the same). Therefore we +# 'move' it to the destination team. +SoccerTeam instproc transferPlayer {playername destinationTeam} { + # We use the aggregation introspection option 'children' in order + # to get all club members + foreach player [my info children] { + # But we only remove matching playernames of type "Player". We do + # not want to remove another club member type who has the same + # name. + if {[$player istype Player] && [$player name] == $playername} { + # We simply 'move' the player object to the destination team. + # Again we use a unique autoname in the new scope + $player move [set destinationTeam]::[$destinationTeam autoname player%02d] + } + } +} + +# Finally we define two convenience methods to print the members/players to +# stdout with puts. +SoccerTeam instproc printMembers {} { + puts "Members of [my name]:" + foreach m [my info children] {puts " [$m name]"} +} +SoccerTeam instproc printPlayers {} { + puts "Players of [my name]:" + foreach m [my info children] { + if {[$m istype Player]} {puts " [$m name]"} + } +} + +# Now let us build to example soccer team objects. +SoccerTeam lyon -name "Olympique Lyon" -location "Lyon" +SoccerTeam bayernMunich -name "F.C. Bayern M�nchen" -location "Munich" + +# With 'addPlayer' we can create new aggregated player objects +# +# Let us start some years in the past, when "Franz Beckenbauer" was +# still a player. +set fb [bayernMunich newPlayer -name "Franz Beckenbauer" \ + -playerRole PLAYER] + +# 'playerRole' may not take any value. It may either be NONE, PLAYER, +# or GOALY ... such rules may be given as assertions (here: an instinvar +# gives an invariant covering all instances of a class). In XOTcl +# the rules are syntactically identical to 'if' statements +Player instinvar { + {[my set playerRole] == "NONE" || + [my set playerRole] == "PLAYER" || + [my set playerRole] == "GOALY"} +} + +# If we break the invariant and turn assertions checking on, we should +# get an error message: +$fb check all +if {[catch {$fb set playerRole SINGER} errMsg]} { + puts "CATCHED EXCEPTION: playerRole has either to be NONE, PLAYER, or TRAINER" + # turn assertion checking off again and reset to PLAYER + $fb check {} + $fb set playerRole PLAYER +} + +# But soccer players may play quite different, orthogonal +# roles. E.g. Franz Beckenbauer was also a singer (a remarkably bad +# one). However, we can not simply add such orthogonal, extrinsic +# extensions with multiple inheritance or delegation. Otherwise we +# would have either to build a lot of unnecessary helper classes, like +# PlayerSinger, PlayerTrainerSinger, etc., or we would have to build +# such helper objects. This either leads to an unwanted combinatorial +# explosion of class or object number. +# +# Here we can use a per-object mixin, which is a language construct +# that expresses that a class is used as a role or as an extrinsic +# extension to an object. + +# First we just define the Singer class. +Class Singer +Singer instproc sing text { + puts "[my name] sings: $text, lala." +} + +# Now we register this class as a per-object mixin on the player object: +$fb mixin Singer + +# And now Franz Beckenbauer is able to sing: +$fb sing "lali" + +# But Franz Beckenbauer has already retired. When a player retires, we +# have an intrinsic change of the classification. He *is* not a player +# anymore. But still he has the same name, is club member, and +# is a singer (brrrrrr). + +# Before we perform the class change, we extend the Player class to +# support it. I.e. the playerRole is not valid after class change +# anymore (we unset the instance variable). +Player instproc class args { + my unset playerRole + next +} + +# Now we can re-class the player object to its new class (now Franz +# Beckenbauer is President of Bayern Munich. +$fb class President +# Check that the playerRole isn't there anymore. +if {[catch {$fb set playerRole} errMsg]} { + puts "CATCHED EXCEPTION: The player role doesn't exist anymore (as it should be after the class change)" +} + +# But still Franz Beckenbauer can entertain us with what he believes +# is singing: +$fb sing "lali" + +# Now we define some new players for Bayern Munich: +bayernMunich newPlayer -name "Oliver Kahn" -playerRole GOALY +bayernMunich newPlayer -name "Giovanne Elber" -playerRole PLAYER + +# if we enlist the players of Munich Franz Beckenbauer is not enlisted +# anymore: +bayernMunich printPlayers + +# But as a president he still appears in the list of members: +bayernMunich printMembers + +# Now consider an orthonogal extension of a transfer list. Every +# transfer in the system should be notified. But since the transfer +# list is orthogonal to SoccerTeams we do not want to interfere with +# the existing implementation at all. Moreover, the targeted kind of +# extension has also to work on all subclasses of SoccerTeam. Firstly, we +# just create the extension as an ordinary class: +Class TransferObserver +TransferObserver instproc transferPlayer {pname destinationTeam} { + puts "Player '$pname' is transfered to Team '[$destinationTeam name]'" + next +} + +# Now we can apply the class as a per-class mixin, which functions +# exactly like a per-object mixin, but on all instances of a class and +# its subclasses. The 'next' primitive ensures that the original +# method on 'SoccerTeam' is called after notifying the transfer (with +# puts to stdout) +SoccerTeam instmixin TransferObserver + +# If we perform a transfer of one of the players, he is moved to the new +# club and the transfer is reported to the stdout: + +bayernMunich transferPlayer "Giovanne Elber" lyon + +# Finally we verify the transfer by printing the players: +lyon printPlayers +bayernMunich printPlayers Index: xotcl/apps/utils/xo-daemon =================================================================== diff -u --- xotcl/apps/utils/xo-daemon (revision 0) +++ xotcl/apps/utils/xo-daemon (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,171 @@ +#!/usr/bin/xotclsh +package require XOTcl; namespace import -force xotcl::* + +@ @File { + description { + This script can be used to start/stop/restart xotcl daemons + and maintains the process IDs, log files and means for easy + restart. + <@p> + It receives as first parameter the name of the xotcl script + to be executed followed by the desired action and optional + parameters. The specified action can be + <@UL> + <@LI> <@EM>start: the specified script is started in + the background, an entry to restart is generated in + the run-directory as well as the process id of the started + script. In addition a logfile is created in the log directory. + If the start of the script fails, the error messages are + shown. + <@LI> <@EM>startall: all scripts that were started before + via this script, are started + <@LI> <@EM>stop terminates te specified script. + <@LI> <@EM>stopall terminates all scripts started via this + command + <@LI> <@EM>restart tries to restart the specified script. + + The optional parameters are: + <@UL> + <@LI> <@EM>-logir specifies the directory for logging. + The default is ~/.xotcl/log. + <@LI> <@EM>-rundir specifies the directory where + the information about the running processes is kept. + The default is ~/.xotcl/run. + + } + authors { + Gustaf Neumann, Gustaf.Neumann@wu-wien.ac.at + } + date "[::xotcl::rcs date {$Date: 2004/05/23 22:50:39 $}]" +} + +array set opt [list \ + -rundir $::xotcl::confdir/run \ + -logdir $::xotcl::confdir/log \ +] +if {$argc < 2} { + puts "Usage:\n\t$argv0 \ + ?options?\nOptions:\n\ + \t-logdir dirname (default: $::opt(-logdir))\n\ + \t-rundir dirname (default: $::opt(-rundir))\n" + exit -1 +} +foreach {daemon action} $argv break +array set opt [lreplace $argv 0 1] + +# The daemon scripts should be +# - location independent (if the script assumes to be started from +# a certain directory, it should cd to it) +# - parameter less (required for restart, startall, etc.) +# + +# configuration +set ::kill /bin/kill +set ::ps /bin/ps +set ::ln /bin/ln +set ::sleep /bin/sleep +set ::xotclsh /usr/bin/xotclsh + +Class Daemon -parameter progname +Daemon instproc readfile {n} { + set f [open $n r] + set c [read $f] + close $f + return [string trim $c \n] +} +Daemon instproc init {} { + if {![file isdirectory $::opt(-rundir)]} {file mkdir $::opt(-rundir)} + if {![file isdirectory $::opt(-logdir)]} {file mkdir $::opt(-logdir)} +} +Daemon instproc progname name { + set n [file tail $name] + set n [file rootname $n] + [self] set pidfile $::opt(-rundir)/$n.pid + [self] set logfile $::opt(-logdir)/$n.log + [self] set shortname $n + [self] set progname $name +} +Daemon instproc report string { + puts stderr "[[self] set shortname]: $string" +} +Daemon instproc running pid { + set r [catch {exec $::ps -h $pid} msg] + #if {$r} { [self] report "msg=$msg" } + #[self] report "running returns $r" + return [expr {!$r}] +} +Daemon instproc kill {sig pid} { + #[self] report "kill $sig $pid" + exec $::kill $sig $pid +} +Daemon instproc start {} { + [self] instvar pidfile logfile progname + if {[file exists $pidfile]} { + set pid [[self] readfile $pidfile] + [self] report "seems already running $pid" + if {[[self] running $pid]} { + [self] report "... no need to restart" + return + } else { + [self] report "... but disappeared $pid" + } + } + set linkname $::opt(-rundir)/[file tail $progname] + if {[string match *~* $linkname]} { + # file dirname ~ -> requires env(HOME) + regsub ^~ $linkname [file dirname ~]/$::env(USER) linkname + } + if {$progname != $linkname} { + #puts stderr "exec $::ln -sf $progname $linkname" + exec $::ln -sf $progname $linkname + } + set pid [exec $::xotclsh $progname >>& $logfile &] + set F [open $pidfile w] + puts $F $pid + close $F + exec sleep 1 + if {![[self] running $pid]} { + [self] report "start of $pid failed" + set size [file size $logfile] + set F [open $logfile] + if {$size > 500} {seek $F [expr {$size-500}]} + puts [read $F] + close $F + } else { + [self] report "started $pid" + } +} +Daemon instproc stop {} { + [self] instvar pidfile logfile + if {[file exists $pidfile]} { + set pid [[self] readfile $pidfile] + #[self] report "Got PID $pid" + if {[[self] running $pid]} { + [self] report "stopping $pid" + [self] kill -KILL $pid + #if {[running $pid]} {kill -KILL $pid} + } else { + [self] report "not running $pid" + } + file delete $pidfile + } else { + [self] report "was not started before" + } +} +Daemon instproc restart {} { + [self] stop + [self] start +} +Daemon instproc stopall {} { + foreach pidfile [glob -nocomplain $::opt(-rundir)/*.PID] { + set n [file rootname [file tail $pidfile]] + [self] configure -progname $n -stop + } +} +Daemon instproc startall {} { + foreach file [glob -nocomplain $::opt(-rundir)/*] { + if {[string match *.PID $file]} continue + [self] configure -progname $file -start + } +} +Daemon d -init -progname $daemon -$action Index: xotcl/apps/utils/xo-whichPkg =================================================================== diff -u --- xotcl/apps/utils/xo-whichPkg (revision 0) +++ xotcl/apps/utils/xo-whichPkg (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,24 @@ +#!/usr/local/bin/xotclsh +# $Id: xo-whichPkg,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package require XOTcl; namespace import -force xotcl::* + +@ @File { + description { + A small sample script to show which package is loaded from where + when a target package is loaded. <@p> + Usage: "xo-whichPkg -pkg PACKAGENAME" + } + authors { + Fredj Dridi dridi@nestroy.wi-inf.uni-essen.de + } + date "[::xotcl::rcs date {$Date: 2004/05/23 22:50:39 $}]" +} + +array set opts { + -pkg xotcl::comm::httpd +} +array set opts $argv + +package require xotcl::package +package verbose 1 +puts stderr [package require $opts(-pkg)] Index: xotcl/apps/utils/xotclsh =================================================================== diff -u --- xotcl/apps/utils/xotclsh (revision 0) +++ xotcl/apps/utils/xotclsh (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,13 @@ +#!/home/neumann/tcl8.4.5/unix/tclsh +if {$argc == 0} { + puts "Don't use [info script] as interactive shell! Use instead:" + puts " /home/neumann/tcl8.4.5/unix/tclsh" + puts " package require XOTcl; namespace import ::xotcl::*" +} else { + package require XOTcl + namespace import ::xotcl::* + set argv0 [lindex $argv 0] + set argv [lreplace $argv 0 0] + incr argc -1 + source $argv0 +} Index: xotcl/apps/utils/xotclsh.in =================================================================== diff -u --- xotcl/apps/utils/xotclsh.in (revision 0) +++ xotcl/apps/utils/xotclsh.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,13 @@ +#!@TCLSH_PROG@ +if {$argc == 0} { + puts "Don't use [info script] as interactive shell! Use instead:" + puts " @TCLSH_PROG@" + puts " package require XOTcl; namespace import ::xotcl::*" +} else { + package require XOTcl + namespace import ::xotcl::* + set argv0 [lindex $argv 0] + set argv [lreplace $argv 0 0] + incr argc -1 + source $argv0 +} Index: xotcl/apps/utils/xowish =================================================================== diff -u --- xotcl/apps/utils/xowish (revision 0) +++ xotcl/apps/utils/xowish (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,17 @@ +#!@WISH_PROG@ +###!/home/neumann/tcl8.4.5/unix/tclsh +###package require Tk +if {$argc == 0} { + puts "Don't use [info script] as interactive shell! Use instead:" + puts " @WISH_PROG@" + puts " package require XOTcl; namespace import ::xotcl::*" + exit +} else { + package require XOTcl + namespace import ::xotcl::* + set argv0 [lindex $argv 0] + set argv [lreplace $argv 0 0] + incr argc -1 + source $argv0 +} +###catch {vwait forever} \ No newline at end of file Index: xotcl/apps/utils/xowish.in =================================================================== diff -u --- xotcl/apps/utils/xowish.in (revision 0) +++ xotcl/apps/utils/xowish.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,17 @@ +#!@WISH_PROG@ +###!@TCLSH_PROG@ +###package require Tk +if {$argc == 0} { + puts "Don't use [info script] as interactive shell! Use instead:" + puts " @WISH_PROG@" + puts " package require XOTcl; namespace import ::xotcl::*" + exit +} else { + package require XOTcl + namespace import ::xotcl::* + set argv0 [lindex $argv 0] + set argv [lreplace $argv 0 0] + incr argc -1 + source $argv0 +} +###catch {vwait forever} \ No newline at end of file Index: xotcl/config/config.guess =================================================================== diff -u --- xotcl/config/config.guess (revision 0) +++ xotcl/config/config.guess (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1317 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-09-04' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + sparc*:NetBSD:*) + echo `uname -p`-unknown-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in + big) echo mips-unknown-linux-gnu && exit 0 ;; + little) echo mipsel-unknown-linux-gnu && exit 0 ;; + esac + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_targets=`cd /; ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-pc-linux-gnu\n", argv[1]); +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-pc-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: Index: xotcl/config/config.sub =================================================================== diff -u --- xotcl/config/config.sub (revision 0) +++ xotcl/config/config.sub (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1411 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-09-07' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | s390 | s390x \ + | sh | sh[34] | sh[34]eb | shbe | shle \ + | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ + | stormy16 | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 \ + | we32k \ + | x86 | xscale \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alphapca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cray2-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | s390-* | s390x-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ + | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [cjt]90) + basic_machine=${basic_machine}-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: Index: xotcl/config/install-sh =================================================================== diff -u --- xotcl/config/install-sh (revision 0) +++ xotcl/config/install-sh (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,119 @@ +#!/bin/sh + +# +# install - install a program, script, or datafile +# This comes from X11R5; it is not part of GNU. +# +# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" + +instcmd="$mvprog" +chmodcmd="" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog -f" +src="" +dst="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +fi + +if [ x"$dst" = x ] +then + echo "install: no destination specified" + exit 1 +fi + + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + +if [ -d $dst ] +then + dst="$dst"/`basename $src` +fi + +# Make a temp file name in the proper directory. + +dstdir=`dirname $dst` +dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + +$doit $instcmd $src $dsttmp + +# and set any options; do chmod last to preserve setuid bits + +if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi +if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi +if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi +if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi + +# Now rename the file to the real destination. + +$doit $rmcmd $dst +$doit $mvcmd $dsttmp $dst + + +exit 0 Index: xotcl/configure =================================================================== diff -u --- xotcl/configure (revision 0) +++ xotcl/configure (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,10737 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.57 for xotcl 1.2.1. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='xotcl' +PACKAGE_TARNAME='xotcl' +PACKAGE_VERSION='1.2.1' +PACKAGE_STRING='xotcl 1.2.1' +PACKAGE_BUGREPORT='' + +ac_subdirs_all="$ac_subdirs_all library/store/XOTclSdbm/" +ac_subdirs_all="$ac_subdirs_all library/store/XOTclGdbm/" +ac_subdirs_all="$ac_subdirs_all library/xml/TclExpat-1.1/" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CYGPATH EXEEXT PKG_LIB_FILE PKG_STUB_LIB_FILE PKG_STUB_SOURCES PKG_STUB_OBJECTS PKG_TCL_SOURCES PKG_HEADERS PKG_INCLUDES PKG_LIBS PKG_CFLAGS subdirs XOTCL_VERSION XOTCL_MAJOR_VERSION XOTCL_MINOR_VERSION XOTCL_RELEASE_LEVEL TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_LIBS TCL_DEFS TCL_EXTRA_CFLAGS TCL_LD_FLAGS TCL_SHLIB_LD_LIBS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_LIBS TK_XINCLUDES CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB EGREP MATH_LIBS PKG_SOURCES PKG_OBJECTS TCL_TOP_DIR_NATIVE TCL_GENERIC_DIR_NATIVE TCL_UNIX_DIR_NATIVE TCL_WIN_DIR_NATIVE TCL_BMAP_DIR_NATIVE TCL_TOOL_DIR_NATIVE TCL_PLATFORM_DIR_NATIVE TCL_INCLUDES CLEANFILES TCL_THREADS SHARED_BUILD AR LIBOBJS DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING EXTRA_CFLAGS STLIB_LD SHLIB_LD SHLIB_CFLAGS SHLIB_LD_FLAGS SHLIB_LD_LIBS LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LD_LIBRARY_PATH_VAR TCL_DBGX CFLAGS_DEFAULT LDFLAGS_DEFAULT MAKE_LIB MAKE_SHARED_LIB MAKE_STATIC_LIB MAKE_STUB_LIB RANLIB_STUB TCLSH_PROG SHARED_LIB_SUFFIX UNSHARED_LIB_SUFFIX XOTCL_BUILD_LIB_SPEC XOTCL_LIB_SPEC XOTCL_BUILD_STUB_LIB_SPEC XOTCL_STUB_LIB_SPEC XOTCL_BUILD_STUB_LIB_PATH XOTCL_STUB_LIB_PATH XOTCL_SRC_DIR XOTCLSH XOWISH test_actiweb libdirs_actiweb apps_actiweb TEA_PLATFORM LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +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 xotcl 1.2.1 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. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of xotcl 1.2.1:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-threads build with threads + --enable-shared build and link with shared libraries --enable-shared + --enable-64bit enable 64bit support (where applicable) + --enable-64bit-vis enable 64bit Sparc VIS support + --enable-wince enable Win/CE support (where applicable) + --disable-load disallow dynamic loading and "load" command + --enable-symbols build with debugging symbols --disable-symbols + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gdbm=GDBM_INCLUDE_DIR,GDBM_LIB_DIR + absolute path to gdbm.h and optionally the path to the library, + --without-gdbm disables build of Tcl Gdbm + --with-aolserver3=AOL_SERVER_DIR, (containing include ,...) + --without-aolserver3 disables build of AOLserver 3 module + --with-actiweb=yes|no, + --without-actiweb disables actiweb components + --with-xotclsh=yes|no, + --without-xotclsh disables built of xotclsh + --with-xowish=yes|no, + --without-xowish disables built of xowish + --with-all=yes|no, + --without-all disables built of all + --with-tclinclude directory containing the public Tcl header files. + --with-tcl directory containing tcl configuration (tclConfig.sh) + --with-tk directory containing tk configuration (tkConfig.sh) + --with-celib=DIR use Windows/CE support library from DIR + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + 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. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +xotcl configure 1.2.1 +generated by GNU Autoconf 2.57 + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by xotcl $as_me 1.2.1, which was +generated by GNU Autoconf 2.57. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#-------------------------------------------------------------------- +# Call TEA_INIT as the first TEA_ macro to set up initial vars. +# This will define a ${TEA_PLATFORM} variable == "unix" or "windows". +#-------------------------------------------------------------------- + + + TEA_VERSION="3.0" + + echo "$as_me:$LINENO: checking for correct TEA configuration" >&5 +echo $ECHO_N "checking for correct TEA configuration... $ECHO_C" >&6 + if test x"${PACKAGE_NAME}" = x ; then + { { echo "$as_me:$LINENO: error: +The PACKAGE_NAME variable must be defined by your TEA configure.in" >&5 +echo "$as_me: error: +The PACKAGE_NAME variable must be defined by your TEA configure.in" >&2;} + { (exit 1); exit 1; }; } + fi + if test x"3.0" = x ; then + { { echo "$as_me:$LINENO: error: +TEA version not specified." >&5 +echo "$as_me: error: +TEA version not specified." >&2;} + { (exit 1); exit 1; }; } + elif test "3.0" != "${TEA_VERSION}" ; then + echo "$as_me:$LINENO: result: warning: TEA version \"3.0\" != ${TEA_VERSION}" >&5 +echo "${ECHO_T}warning: TEA version \"3.0\" != ${TEA_VERSION}" >&6 + else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 + fi + case "`uname -s`" in + *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*) + # Extract the first word of "cygpath", so it can be a program name with args. +set dummy cygpath; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CYGPATH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CYGPATH"; then + ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CYGPATH="cygpath -w" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" +fi +fi +CYGPATH=$ac_cv_prog_CYGPATH +if test -n "$CYGPATH"; then + echo "$as_me:$LINENO: result: $CYGPATH" >&5 +echo "${ECHO_T}$CYGPATH" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + EXEEXT=".exe" + TEA_PLATFORM="windows" + ;; + *) + CYGPATH=echo + EXEEXT="" + TEA_PLATFORM="unix" + ;; + esac + + # Check if exec_prefix is set. If not use fall back to prefix + if test x$exec_prefix = xNONE ; then exec_prefix=$prefix ; fi + + + + + # This package name must be replaced statically for AC_SUBST to work + + # Substitute STUB_LIB_FILE in case package creates a stub library too. + + + # We AC_SUBST these here to ensure they are subst'ed, + # in case the user doesn't call TEA_ADD_... + + + + + + + + +ac_aux_dir= +for ac_dir in config $srcdir/config; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config $srcdir/config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + +#-------------------------------------------------------------------- +# specify some extra flags +#-------------------------------------------------------------------- + + +# Check whether --with-gdbm or --without-gdbm was given. +if test "${with_gdbm+set}" = set; then + withval="$with_gdbm" + with_gdbm=$withval +else + with_gdbm=no +fi; + +# Check whether --with-aolserver3 or --without-aolserver3 was given. +if test "${with_aolserver3+set}" = set; then + withval="$with_aolserver3" + with_aol3=$withval +else + with_aol3=no +fi; + +# Check whether --with-actiweb or --without-actiweb was given. +if test "${with_actiweb+set}" = set; then + withval="$with_actiweb" + with_actiweb=$withval +else + with_actiweb=no +fi; + +# Check whether --with-xotclsh or --without-xotclsh was given. +if test "${with_xotclsh+set}" = set; then + withval="$with_xotclsh" + with_xotclsh=$withval +else + with_xotclsh=no +fi; + +# Check whether --with-xowish or --without-xowish was given. +if test "${with_xowish+set}" = set; then + withval="$with_xowish" + with_xowish=$withval +else + with_xowish=no +fi; + +# Check whether --with-all or --without-all was given. +if test "${with_all+set}" = set; then + withval="$with_all" + with_all=$withval +else + with_all=no +fi; + +# Check whether --with-all or --without-all was given. +if test "${with_all+set}" = set; then + withval="$with_all" + with_all=$withval +else + with_all=no +fi; + +# Check whether --with-tclinclude or --without-tclinclude was given. +if test "${with_tclinclude+set}" = set; then + withval="$with_tclinclude" + with_tclinclude=${withval} +fi; + +if test "$with_all" = yes; then + with_actiweb=yes + with_xotclsh=yes + with_xowish=yes + with_gdbm=yes +fi + +if test "$with_actiweb" = yes; then + test_actiweb="test-actiweb" + libdirs_actiweb="actiweb rdf registry store xml patterns" + apps_actiweb="actiweb persistence" + + +subdirs="$subdirs library/store/XOTclSdbm/" + + if ! test "$with_gdbm" = no; then + + +subdirs="$subdirs library/store/XOTclGdbm/" + + fi + + +subdirs="$subdirs library/xml/TclExpat-1.1/" + +else + test_actiweb="" + libdirs_actiweb="" + apps_actiweb="" +fi + +if test "$with_tk" = no; then with_xowish="" ; fi +if test "$with_xotclsh" = yes; then XOTCLSH="xotclsh" ; else XOTCLSH=""; fi +if test "$with_xowish" = yes; then XOWISH="xowish" ; else XOWISH=""; fi + + +#-------------------------------------------------------------------- +# __CHANGE__ +# Set your package name and version numbers here. The NODOT_VERSION is +# required for constructing the library name on systems that don't like +# dots in library names (Windows). The VERSION variable is used on the +# other systems. +#-------------------------------------------------------------------- + +# do not modify the following lines manually, they are generated with changeXOTclVersion +XOTCL_MAJOR_VERSION=1 +XOTCL_MINOR_VERSION=2 +XOTCL_RELEASE_LEVEL=.1 + +XOTCL_VERSION=${XOTCL_MAJOR_VERSION}.${XOTCL_MINOR_VERSION} +NODOT_VERSION=${XOTCL_MAJOR_VERSION}${XOTCL_MINOR_VERSION} + + + + + + +echo "Configuring XOTcl Version $PACKAGE_VERSION" + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + + + + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + + if test x"${no_tcl}" = x ; then + # we reset no_tcl in case something fails here + no_tcl=true + +# Check whether --with-tcl or --without-tcl was given. +if test "${with_tcl+set}" = set; then + withval="$with_tcl" + with_tclconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for Tcl configuration" >&5 +echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6 + if test "${ac_cv_c_tclconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + # First check to see if --with-tcl was specified. + if test x"${with_tclconfig}" != x ; then + if test -f "${with_tclconfig}/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5 +echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ../tcl \ + `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../tcl \ + `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../../tcl \ + `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few other private locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ${srcdir}/../tcl \ + `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + +fi + + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCL_BIN_DIR="# no Tcl configs found" + { echo "$as_me:$LINENO: WARNING: \"Cannot find Tcl configuration definitions\"" >&5 +echo "$as_me: WARNING: \"Cannot find Tcl configuration definitions\"" >&2;} + exit 0 + else + no_tcl= + TCL_BIN_DIR=${ac_cv_c_tclconfig} + echo "$as_me:$LINENO: result: found $TCL_BIN_DIR/tclConfig.sh" >&5 +echo "${ECHO_T}found $TCL_BIN_DIR/tclConfig.sh" >&6 + fi + fi + + + echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 +echo $ECHO_N "checking for existence of $TCL_BIN_DIR/tclConfig.sh... $ECHO_C" >&6 + + if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + echo "$as_me:$LINENO: result: loading" >&5 +echo "${ECHO_T}loading" >&6 + . $TCL_BIN_DIR/tclConfig.sh + else + echo "$as_me:$LINENO: result: file not found" >&5 +echo "${ECHO_T}file not found" >&6 + fi + + # + # If the TCL_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TCL_LIB_SPEC will be set to the value + # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC + # instead of TCL_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + # + + if test -f $TCL_BIN_DIR/Makefile ; then + TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} + TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} + TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} + fi + + # + # eval is required to do the TCL_DBGX substitution + # + + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" + eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" + eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" + + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" + eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" + eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" + + + + + + + + + + + + + + #AC_SUBST(TCL_DBGX) + + + + + + #AC_SUBST(TCL_BUILD_LIB_SPEC) + #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) + + +#-------------------------------------------------------------------- +# check for TK +#-------------------------------------------------------------------- + +if test "$with_xowish" = yes; then + + # + # Ok, lets find the tk configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tk + # + + if test x"${no_tk}" = x ; then + # we reset no_tk in case something fails here + no_tk=true + +# Check whether --with-tk or --without-tk was given. +if test "${with_tk+set}" = set; then + withval="$with_tk" + with_tkconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for Tk configuration" >&5 +echo $ECHO_N "checking for Tk configuration... $ECHO_C" >&6 + if test "${ac_cv_c_tkconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + # First check to see if --with-tkconfig was specified. + if test x"${with_tkconfig}" != x ; then + if test -f "${with_tkconfig}/tkConfig.sh" ; then + ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_tkconfig} directory doesn't contain tkConfig.sh" >&5 +echo "$as_me: error: ${with_tkconfig} directory doesn't contain tkConfig.sh" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a private Tk library + if test x"${ac_cv_c_tkconfig}" = x ; then + for i in \ + ../tk \ + `ls -dr ../tk[8-9].[0-9]* 2>/dev/null` \ + ../../tk \ + `ls -dr ../../tk[8-9].[0-9]* 2>/dev/null` \ + ../../../tk \ + `ls -dr ../../../tk[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tkConfig.sh" ; then + ac_cv_c_tkconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + # check in a few common install locations + if test x"${ac_cv_c_tkconfig}" = x ; then + for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do + if test -f "$i/tkConfig.sh" ; then + ac_cv_c_tkconfig=`(cd $i; pwd)` + break + fi + done + fi + # check in a few other private locations + if test x"${ac_cv_c_tkconfig}" = x ; then + for i in \ + ${srcdir}/../tk \ + `ls -dr ${srcdir}/../tk[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tkConfig.sh" ; then + ac_cv_c_tkconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + +fi + + if test x"${ac_cv_c_tkconfig}" = x ; then + TK_BIN_DIR="# no Tk configs found" + { echo "$as_me:$LINENO: WARNING: \"Cannot find Tk configuration definitions\"" >&5 +echo "$as_me: WARNING: \"Cannot find Tk configuration definitions\"" >&2;} + exit 0 + else + no_tk= + TK_BIN_DIR=${ac_cv_c_tkconfig} + echo "$as_me:$LINENO: result: found $TK_BIN_DIR/tkConfig.sh" >&5 +echo "${ECHO_T}found $TK_BIN_DIR/tkConfig.sh" >&6 + fi + fi + + + + echo "$as_me:$LINENO: checking for existence of ${TK_BIN_DIR}/tkConfig.sh" >&5 +echo $ECHO_N "checking for existence of ${TK_BIN_DIR}/tkConfig.sh... $ECHO_C" >&6 + + if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then + echo "$as_me:$LINENO: result: loading" >&5 +echo "${ECHO_T}loading" >&6 + . $TK_BIN_DIR/tkConfig.sh + else + echo "$as_me:$LINENO: result: could not find ${TK_BIN_DIR}/tkConfig.sh" >&5 +echo "${ECHO_T}could not find ${TK_BIN_DIR}/tkConfig.sh" >&6 + fi + + # + # If the TK_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TK_LIB_SPEC will be set to the value + # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC + # instead of TK_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + # + + if test -f $TK_BIN_DIR/Makefile ; then + TK_LIB_SPEC=${TK_BUILD_LIB_SPEC} + TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC} + TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH} + fi + + # + # eval is required to do the TK_DBGX substitution + # + + eval "TK_LIB_FILE=\"${TK_LIB_FILE}\"" + eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\"" + eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\"" + + eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\"" + eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\"" + eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\"" + + + + + + + + + + + + + + + + +# TEA_PUBLIC_TK_HEADERS +# TEA_PATH_X +fi + +#-------------------------------------------------------------------- +# Handle the --prefix=... option by defaulting to what Tcl gave. +# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. +#----------------------------------------------------------------------- + + + # Should be AC_MSG_NOTICE, but that requires autoconf 2.50 + if test "${prefix}" = "NONE"; then + prefix_default=yes + if test x"${TCL_PREFIX}" != x; then + { echo "$as_me:$LINENO: WARNING: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&5 +echo "$as_me: WARNING: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&2;} + prefix=${TCL_PREFIX} + else + prefix=/usr/local + fi + fi + if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" ; then + if test x"${TCL_EXEC_PREFIX}" != x; then + { echo "$as_me:$LINENO: WARNING: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&5 +echo "$as_me: WARNING: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&2;} + exec_prefix=${TCL_EXEC_PREFIX} + else + exec_prefix=$prefix + fi + fi + + +#----------------------------------------------------------------------- +# Standard compiler checks. +# This sets up CC by using the CC env var, or looks for gcc otherwise. +# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create +# the basic setup necessary to compile executables. +#----------------------------------------------------------------------- + + + # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE) + # in this macro, they need to go into TEA_SETUP_COMPILER instead. + + # If the user did not set CFLAGS, set it now to keep + # the AC_PROG_CC macro from adding "-g -O2". + if test "${CFLAGS+set}" != "set" ; then + CFLAGS="" + 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 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +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 + + 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 +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&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 + echo $ECHO_N "(cached) $ECHO_C" >&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 to if __STDC__ is defined, since + # 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$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 to if __STDC__ is defined, since + # 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +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 + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + #-------------------------------------------------------------------- + # Checks to see if the make program sets the $MAKE variable. + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + + #-------------------------------------------------------------------- + # Find ranlib + #-------------------------------------------------------------------- + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + #-------------------------------------------------------------------- + # Determines the correct binary file extension (.o, .obj, .exe etc.) + #-------------------------------------------------------------------- + + + + + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#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)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here. + + + #------------------------------------------------------------------------ + # If we're using GCC, see if the compiler understands -pipe. If so, use it. + # It makes compiling go faster. (This is only a performance feature.) + #------------------------------------------------------------------------ + + if test -z "$no_pipe" -a -n "$GCC"; then + echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5 +echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6 + OLDCC="$CC" + CC="$CC -pipe" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +CC="$OLDCC" + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + + #-------------------------------------------------------------------- + # Common compiler flag setup + #-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for required early compiler flags" >&5 +echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6 + tcl_flags="" + + if test "${tcl_cv_flag__isoc99_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +char *p = (char *)strtoll; char *q = (char *)strtoull; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__isoc99_source=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _ISOC99_SOURCE 1 +#include +int +main () +{ +char *p = (char *)strtoll; char *q = (char *)strtoull; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__isoc99_source=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_flag__isoc99_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define _ISOC99_SOURCE 1 +_ACEOF + + tcl_flags="$tcl_flags _ISOC99_SOURCE" + fi + + + if test "${tcl_cv_flag__largefile64_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct stat64 buf; int i = stat64("/", &buf); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__largefile64_source=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _LARGEFILE64_SOURCE 1 +#include +int +main () +{ +struct stat64 buf; int i = stat64("/", &buf); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__largefile64_source=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_flag__largefile64_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define _LARGEFILE64_SOURCE 1 +_ACEOF + + tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" + fi + + if test "x${tcl_flags}" = "x" ; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 + else + echo "$as_me:$LINENO: result: ${tcl_flags}" >&5 +echo "${ECHO_T}${tcl_flags}" >&6 + fi + + + echo "$as_me:$LINENO: checking for 64-bit integer type" >&5 +echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6 + if test "${tcl_cv_type_64bit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +__int64 value = (__int64) 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_64bit=__int64 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_type_64bit=none + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + int main() {exit(!(sizeof(long long) > sizeof(long)));} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_64bit="long long" +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "${tcl_cv_type_64bit}" = none ; then + echo "$as_me:$LINENO: result: using long" >&5 +echo "${ECHO_T}using long" >&6 + elif test "${tcl_cv_type_64bit}" = "__int64" ; then + # We actually want to use the default tcl.h checks in this + # case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* + echo "$as_me:$LINENO: result: using Tcl header defaults" >&5 +echo "${ECHO_T}using Tcl header defaults" >&6 + else + cat >>confdefs.h <<_ACEOF +#define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit} +_ACEOF + + echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5 +echo "${ECHO_T}${tcl_cv_type_64bit}" >&6 + + # Now check for auxiliary declarations + echo "$as_me:$LINENO: checking for struct dirent64" >&5 +echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 + if test "${tcl_cv_struct_dirent64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +struct dirent64 p; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_struct_dirent64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_struct_dirent64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_DIRENT64 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_struct_dirent64}" >&5 +echo "${ECHO_T}${tcl_cv_struct_dirent64}" >&6 + + echo "$as_me:$LINENO: checking for struct stat64" >&5 +echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6 + if test "${tcl_cv_struct_stat64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct stat64 p; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_struct_stat64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_struct_stat64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_struct_stat64}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_STAT64 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_struct_stat64}" >&5 +echo "${ECHO_T}${tcl_cv_struct_stat64}" >&6 + + echo "$as_me:$LINENO: checking for off64_t" >&5 +echo $ECHO_N "checking for off64_t... $ECHO_C" >&6 + if test "${tcl_cv_type_off64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +off64_t offset; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_off64_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_type_off64_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_type_off64_t}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_TYPE_OFF64_T 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_type_off64_t}" >&5 +echo "${ECHO_T}${tcl_cv_type_off64_t}" >&6 + fi + + echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + if test "${TEA_PLATFORM}" = "unix" ; then + + #-------------------------------------------------------------------- + # On a few very rare systems, all of the libm.a stuff is + # already in libc.a. Set compiler flags accordingly. + # Also, Linux requires the "ieee" library for math to work + # right (and it must appear before "-lm"). + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking for sin" >&5 +echo $ECHO_N "checking for sin... $ECHO_C" >&6 +if test "${ac_cv_func_sin+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sin (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sin (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_sin) || defined (__stub___sin) +choke me +#else +char (*f) () = sin; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != sin; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_sin=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_sin=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_sin" >&5 +echo "${ECHO_T}$ac_cv_func_sin" >&6 +if test $ac_cv_func_sin = yes; then + MATH_LIBS="" +else + MATH_LIBS="-lm" +fi + + echo "$as_me:$LINENO: checking for main in -lieee" >&5 +echo $ECHO_N "checking for main in -lieee... $ECHO_C" >&6 +if test "${ac_cv_lib_ieee_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lieee $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ieee_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ieee_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ieee_main" >&5 +echo "${ECHO_T}$ac_cv_lib_ieee_main" >&6 +if test $ac_cv_lib_ieee_main = yes; then + MATH_LIBS="-lieee $MATH_LIBS" +fi + + + #-------------------------------------------------------------------- + # Interactive UNIX requires -linet instead of -lsocket, plus it + # needs net/errno.h to define the socket-related error codes. + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking for main in -linet" >&5 +echo $ECHO_N "checking for main in -linet... $ECHO_C" >&6 +if test "${ac_cv_lib_inet_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-linet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_inet_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_inet_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_inet_main" >&5 +echo "${ECHO_T}$ac_cv_lib_inet_main" >&6 +if test $ac_cv_lib_inet_main = yes; then + LIBS="$LIBS -linet" +fi + + if test "${ac_cv_header_net_errno_h+set}" = set; then + echo "$as_me:$LINENO: checking for net/errno.h" >&5 +echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_net_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking net/errno.h usability" >&5 +echo $ECHO_N "checking net/errno.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking net/errno.h presence" >&5 +echo $ECHO_N "checking net/errno.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: net/errno.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: net/errno.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: net/errno.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for net/errno.h" >&5 +echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_net_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_net_errno_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 + +fi +if test $ac_cv_header_net_errno_h = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_NET_ERRNO_H 1 +_ACEOF + +fi + + + + #-------------------------------------------------------------------- + # Check for the existence of the -lsocket and -lnsl libraries. + # The order here is important, so that they end up in the right + # order in the command line generated by make. Here are some + # special considerations: + # 1. Use "connect" and "accept" to check for -lsocket, and + # "gethostbyname" to check for -lnsl. + # 2. Use each function name only once: can't redo a check because + # autoconf caches the results of the last check and won't redo it. + # 3. Use -lnsl and -lsocket only if they supply procedures that + # aren't already present in the normal libraries. This is because + # IRIX 5.2 has libraries, but they aren't needed and they're + # bogus: they goof up name resolution if used. + # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. + # To get around this problem, check for both libraries together + # if -lsocket doesn't work by itself. + #-------------------------------------------------------------------- + + tcl_checkBoth=0 + echo "$as_me:$LINENO: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +choke me +#else +char (*f) () = connect; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != connect; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 +if test $ac_cv_func_connect = yes; then + tcl_checkSocket=0 +else + tcl_checkSocket=1 +fi + + if test "$tcl_checkSocket" = 1; then + echo "$as_me:$LINENO: checking for setsockopt" >&5 +echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 +if test "${ac_cv_func_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char setsockopt (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char setsockopt (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_setsockopt) || defined (__stub___setsockopt) +choke me +#else +char (*f) () = setsockopt; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != setsockopt; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_setsockopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_setsockopt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_func_setsockopt" >&6 +if test $ac_cv_func_setsockopt = yes; then + : +else + echo "$as_me:$LINENO: checking for setsockopt in -lsocket" >&5 +echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char setsockopt (); +int +main () +{ +setsockopt (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_setsockopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_setsockopt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 +if test $ac_cv_lib_socket_setsockopt = yes; then + LIBS="$LIBS -lsocket" +else + tcl_checkBoth=1 +fi + +fi + + fi + if test "$tcl_checkBoth" = 1; then + tk_oldLibs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + echo "$as_me:$LINENO: checking for accept" >&5 +echo $ECHO_N "checking for accept... $ECHO_C" >&6 +if test "${ac_cv_func_accept+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char accept (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char accept (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_accept) || defined (__stub___accept) +choke me +#else +char (*f) () = accept; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != accept; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_accept=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_accept=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_accept" >&5 +echo "${ECHO_T}$ac_cv_func_accept" >&6 +if test $ac_cv_func_accept = yes; then + tcl_checkNsl=0 +else + LIBS=$tk_oldLibs +fi + + fi + echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +char (*f) () = gethostbyname; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gethostbyname; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 +if test $ac_cv_func_gethostbyname = yes; then + : +else + echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + LIBS="$LIBS -lnsl" +fi + +fi + + + # Don't perform the eval of the libraries here because DL_LIBS + # won't be set until we call TEA_CONFIG_CFLAGS + + TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' + + + + + echo "$as_me:$LINENO: checking dirent.h" >&5 +echo $ECHO_N "checking dirent.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ + +#ifndef _POSIX_SOURCE +# ifdef __Lynx__ + /* + * Generate compilation error to make the test fail: Lynx headers + * are only valid if really in the POSIX environment. + */ + + missing_procedure(); +# endif +#endif +DIR *d; +struct dirent *entryPtr; +char *p; +d = opendir("foobar"); +entryPtr = readdir(d); +p = entryPtr->d_name; +closedir(d); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + + if test $tcl_ok = no; then + cat >>confdefs.h <<\_ACEOF +#define NO_DIRENT_H 1 +_ACEOF + + fi + + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test "${ac_cv_header_errno_h+set}" = set; then + echo "$as_me:$LINENO: checking for errno.h" >&5 +echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_errno_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking errno.h usability" >&5 +echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking errno.h presence" >&5 +echo $ECHO_N "checking errno.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: errno.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: errno.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: errno.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for errno.h" >&5 +echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_errno_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_errno_h" >&6 + +fi +if test $ac_cv_header_errno_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_ERRNO_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_float_h+set}" = set; then + echo "$as_me:$LINENO: checking for float.h" >&5 +echo $ECHO_N "checking for float.h... $ECHO_C" >&6 +if test "${ac_cv_header_float_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 +echo "${ECHO_T}$ac_cv_header_float_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking float.h usability" >&5 +echo $ECHO_N "checking float.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking float.h presence" >&5 +echo $ECHO_N "checking float.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: float.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: float.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: float.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for float.h" >&5 +echo $ECHO_N "checking for float.h... $ECHO_C" >&6 +if test "${ac_cv_header_float_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_float_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 +echo "${ECHO_T}$ac_cv_header_float_h" >&6 + +fi +if test $ac_cv_header_float_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_FLOAT_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_values_h+set}" = set; then + echo "$as_me:$LINENO: checking for values.h" >&5 +echo $ECHO_N "checking for values.h... $ECHO_C" >&6 +if test "${ac_cv_header_values_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 +echo "${ECHO_T}$ac_cv_header_values_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking values.h usability" >&5 +echo $ECHO_N "checking values.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking values.h presence" >&5 +echo $ECHO_N "checking values.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: values.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: values.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: values.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for values.h" >&5 +echo $ECHO_N "checking for values.h... $ECHO_C" >&6 +if test "${ac_cv_header_values_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_values_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 +echo "${ECHO_T}$ac_cv_header_values_h" >&6 + +fi +if test $ac_cv_header_values_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_VALUES_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_limits_h+set}" = set; then + echo "$as_me:$LINENO: checking for limits.h" >&5 +echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 +if test "${ac_cv_header_limits_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 +echo "${ECHO_T}$ac_cv_header_limits_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking limits.h usability" >&5 +echo $ECHO_N "checking limits.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking limits.h presence" >&5 +echo $ECHO_N "checking limits.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: limits.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: limits.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: limits.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for limits.h" >&5 +echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 +if test "${ac_cv_header_limits_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_limits_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 +echo "${ECHO_T}$ac_cv_header_limits_h" >&6 + +fi +if test $ac_cv_header_limits_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_LIMITS_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_stdlib_h+set}" = set; then + echo "$as_me:$LINENO: checking for stdlib.h" >&5 +echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_stdlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking stdlib.h usability" >&5 +echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking stdlib.h presence" >&5 +echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for stdlib.h" >&5 +echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_stdlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_stdlib_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 + +fi +if test $ac_cv_header_stdlib_h = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtol" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtoul" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtod" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + if test $tcl_ok = 0; then + cat >>confdefs.h <<\_ACEOF +#define NO_STDLIB_H 1 +_ACEOF + + fi + if test "${ac_cv_header_string_h+set}" = set; then + echo "$as_me:$LINENO: checking for string.h" >&5 +echo $ECHO_N "checking for string.h... $ECHO_C" >&6 +if test "${ac_cv_header_string_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 +echo "${ECHO_T}$ac_cv_header_string_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking string.h usability" >&5 +echo $ECHO_N "checking string.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking string.h presence" >&5 +echo $ECHO_N "checking string.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: string.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: string.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: string.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for string.h" >&5 +echo $ECHO_N "checking for string.h... $ECHO_C" >&6 +if test "${ac_cv_header_string_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_string_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 +echo "${ECHO_T}$ac_cv_header_string_h" >&6 + +fi +if test $ac_cv_header_string_h = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strstr" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strerror" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + + # See also memmove check below for a place where NO_STRING_H can be + # set and why. + + if test $tcl_ok = 0; then + cat >>confdefs.h <<\_ACEOF +#define NO_STRING_H 1 +_ACEOF + + fi + + if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/wait.h" >&5 +echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/wait.h usability" >&5 +echo $ECHO_N "checking sys/wait.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking sys/wait.h presence" >&5 +echo $ECHO_N "checking sys/wait.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: sys/wait.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/wait.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/wait.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for sys/wait.h" >&5 +echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_wait_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 + +fi +if test $ac_cv_header_sys_wait_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_SYS_WAIT_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 +echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 +echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dlfcn_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 + +fi +if test $ac_cv_header_dlfcn_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_DLFCN_H 1 +_ACEOF + +fi + + + + # OS/390 lacks sys/param.h (and doesn't need it, by chance). + # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and + # CHECK on limits.h + + + + +for ac_header in limits.h unistd.h sys/param.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # Let the user call this, because if it triggers, they will + # need a compat/strtod.c that is correct. Users can also + # use Tcl_GetDouble(FromObj) instead. + #TEA_BUGGY_STRTOD + fi + + +#-------------------------------------------------------------------- +# check for extra flags +# +# FORCE_NO_STUBS is deactivated for now +if ! test "$with_aol3" = "no"; then + echo "Pre-configuring AOL-Server (xotcl)" + AOL_DEFINES="-DAOL_SERVER -DUSE_TCL8X -I$with_aol3/include -I$TCL_SRC_DIR/generic" + FORCE_NO_STUBS=1 +else + AOL_DEFINES="" + FORCE_NO_STUBS=0 +fi + +#-------------------------------------------------------------------- +# check for tclCompile.h (needed, when compiled without full source) +if test -f "$TCL_SRC_DIR/generic/tclCompile.h"; then + HAVE_TCL_COMPILE_H="-DHAVE_TCL_COMPILE_H=1" +else + HAVE_TCL_COMPILE_H="" +fi + +#----------------------------------------------------------------------- +# __CHANGE__ +# Specify the C source files to compile in TEA_ADD_SOURCES, +# public headers that need to be installed in TEA_ADD_HEADERS, +# stub library C source files to compile in TEA_ADD_STUB_SOURCES, +# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. +# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS +# and PKG_TCL_SOURCES. +#----------------------------------------------------------------------- + + + + vars="xotcl.c xotclError.c xotclMetaData.c xotclObjectData.c xotclProfile.c \ + xotclTrace.c xotclUtil.c xotclShadow.c xotclCompile.c aolstub.c xotclStubInit.c" + for i in $vars; do + case $i in + \$*) + # allow $-var names + PKG_SOURCES="$PKG_SOURCES $i" + PKG_OBJECTS="$PKG_OBJECTS $i" + ;; + *) + # check for existence - allows for generic/win/unix VPATH + if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ + -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ + ; then + { { echo "$as_me:$LINENO: error: could not find source file '$i'" >&5 +echo "$as_me: error: could not find source file '$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_SOURCES="$PKG_SOURCES $i" + # this assumes it is in a VPATH dir + i=`basename $i` + # handle user calling this before or after TEA_SETUP_COMPILER + if test x"${OBJEXT}" != x ; then + j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" + else + j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" + fi + PKG_OBJECTS="$PKG_OBJECTS $j" + ;; + esac + done + + + + + vars="generic/xotcl.h generic/xotclInt.h" + for i in $vars; do + # check for existence, be strict because it is installed + if test ! -f "${srcdir}/$i" ; then + { { echo "$as_me:$LINENO: error: could not find header file '${srcdir}/$i'" >&5 +echo "$as_me: error: could not find header file '${srcdir}/$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_HEADERS="$PKG_HEADERS $i" + done + + + + vars="" + for i in $vars; do + PKG_INCLUDES="$PKG_INCLUDES $i" + done + + + + vars="" + for i in $vars; do + PKG_LIBS="$PKG_LIBS $i" + done + + + + PKG_CFLAGS="$PKG_CFLAGS -DXOTCLVERSION=\\\"$XOTCL_VERSION\\\" -DXOTCLPATCHLEVEL=\\\"$XOTCL_RELEASE_LEVEL\\\" \ + $AOL_DEFINES $HAVE_TCL_COMPILE_H" + + + + vars="xotclStubLib.c" + for i in $vars; do + # check for existence - allows for generic/win/unix VPATH + if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ + -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ + ; then + { { echo "$as_me:$LINENO: error: could not find stub source file '$i'" >&5 +echo "$as_me: error: could not find stub source file '$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i" + # this assumes it is in a VPATH dir + i=`basename $i` + # handle user calling this before or after TEA_SETUP_COMPILER + if test x"${OBJEXT}" != x ; then + j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" + else + j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" + fi + PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j" + done + + + + + vars="" + for i in $vars; do + # check for existence, be strict because it is installed + if test ! -f "${srcdir}/$i" ; then + { { echo "$as_me:$LINENO: error: could not find tcl source file '${srcdir}/$i'" >&5 +echo "$as_me: error: could not find tcl source file '${srcdir}/$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i" + done + + + + +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This must be done AFTER calling TEa_PATH_TCLCONFIG/TEA_LOAD_TCLCONFIG +# so that we can extract TCL_SRC_DIR from the config file (in the case +# of private headers +#-------------------------------------------------------------------- + +#TEA_PUBLIC_TCL_HEADERS + + echo "$as_me:$LINENO: checking for Tcl private include files" >&5 +echo $ECHO_N "checking for Tcl private include files... $ECHO_C" >&6 + + if test "${TEA_PLATFORM}" = "windows"; then + TCL_TOP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}`\" + TCL_GENERIC_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/generic`\" + TCL_UNIX_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/unix`\" + TCL_WIN_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/win`\" + TCL_BMAP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/bitmaps`\" + TCL_TOOL_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/tools`\" + TCL_COMPAT_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/compat`\" + TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE} + + TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}" + else + TCL_TOP_DIR_NATIVE='$(TCL_SRC_DIR)' + TCL_GENERIC_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/generic' + TCL_UNIX_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/unix' + TCL_WIN_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/win' + TCL_BMAP_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/bitmaps' + TCL_TOOL_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/tools' + TCL_COMPAT_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/compat' + TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE} + + # substitute these in "relaxed" so that TCL_INCLUDES still works + # without requiring the other vars to be defined in the Makefile + eval "TCL_INCLUDES=\"-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}\"" + fi + + + + + + + + + + + echo "$as_me:$LINENO: result: Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}" >&5 +echo "${ECHO_T}Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}" >&6 + + +if test x"${with_tclinclude}" != x ; then + if test -f "${with_tclinclude}/tcl.h" ; then + TCL_INCLUDES="-I${with_tclinclude} ${TCL_INCLUDES}" + else + { { echo "$as_me:$LINENO: error: ${with_tclinclude} directory does not contain Tcl header file tcl.h" >&5 +echo "$as_me: error: ${with_tclinclude} directory does not contain Tcl header file tcl.h" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +#-------------------------------------------------------------------- +# __CHANGE__ +# A few miscellaneous platform-specific items: +# +# Define a special symbol for Windows (BUILD_xotcl in this case) so +# that we create the export library with the dll. See sha1.h on how +# to use this. +# +# Windows creates a few extra files that need to be cleaned up. +# You can add more files to clean if your extension creates any extra +# files. +# +# Define any extra compiler flags in the PACKAGE_CFLAGS variable. +# These will be appended to the current set of compiler flags for +# your system. +#-------------------------------------------------------------------- + +if test "${TEA_PLATFORM}" = "windows" ; then + cat >>confdefs.h <<\_ACEOF +#define BUILD_xotcl 1 +_ACEOF + + CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc50.pch vc60.pch" + #TEA_ADD_SOURCES([win/winFile.c]) + #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/w +else + CLEANFILES="*.o *.so *~ core gmon.out config.*" + #TEA_ADD_SOURCES([unix/unixFile.c]) + #TEA_ADD_LIBS([-lsuperfly]) +fi + + + + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +#-------------------------------------------------------------------- + + + # Check whether --enable-threads or --disable-threads was given. +if test "${enable_threads+set}" = set; then + enableval="$enable_threads" + tcl_ok=$enableval +else + tcl_ok= +fi; + + if test "$tcl_ok" = "yes"; then + TCL_THREADS=1 + + if test "${TEA_PLATFORM}" != "windows" ; then + # We are always OK on Windows, so check what this platform wants. + cat >>confdefs.h <<\_ACEOF +#define USE_THREAD_ALLOC 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _THREAD_SAFE 1 +_ACEOF + + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6 +if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "no"; then + # Check a little harder for __pthread_mutex_init in the + # same library, as some systems hide it there until + # pthread.h is defined. We could alternatively do an + # AC_TRY_COMPILE with pthread.h, but that will work with + # libpthread really doesn't exist, like AIX 4.2. + # [Bug: 4359] + echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5 +echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char __pthread_mutex_init (); +int +main () +{ +__pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread___pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread___pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_init" >&6 +if test $ac_cv_lib_pthread___pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthread" + else + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthreads" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lpthreads... $ECHO_C" >&6 +if test "${ac_cv_lib_pthreads_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthreads $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthreads_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthreads_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_mutex_init" >&6 +if test $ac_cv_lib_pthreads_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthreads" + else + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lc... $ECHO_C" >&6 +if test "${ac_cv_lib_c_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_c_pthread_mutex_init" >&6 +if test $ac_cv_lib_c_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "no"; then + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6 +if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_r_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_r_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_c_r_pthread_mutex_init" >&6 +if test $ac_cv_lib_c_r_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -pthread" + else + TCL_THREADS=0 + { echo "$as_me:$LINENO: WARNING: \"Don t know how to find pthread lib on your system - thread support disabled\"" >&5 +echo "$as_me: WARNING: \"Don t know how to find pthread lib on your system - thread support disabled\"" >&2;} + fi + fi + fi + fi + + # Does the pthread-implementation provide + # 'pthread_attr_setstacksize' ? + + ac_saved_libs=$LIBS + LIBS="$LIBS $THREADS_LIBS" + +for ac_func in pthread_attr_setstacksize +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + LIBS=$ac_saved_libs + +for ac_func in readdir_r +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + fi + else + TCL_THREADS=0 + fi + # Do checking message here to not mess up interleaved configure output + echo "$as_me:$LINENO: checking for building with threads" >&5 +echo $ECHO_N "checking for building with threads... $ECHO_C" >&6 + if test "${TCL_THREADS}" = "1"; then + cat >>confdefs.h <<\_ACEOF +#define TCL_THREADS 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no (default)" >&5 +echo "${ECHO_T}no (default)" >&6 + fi + # TCL_THREADS sanity checking. See if our request for building with + # threads is the same as the way Tcl was built. If not, warn the user. + case ${TCL_DEFS} in + *THREADS=1*) + if test "${TCL_THREADS}" = "0"; then + { echo "$as_me:$LINENO: WARNING: + Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl + that IS thread-enabled." >&5 +echo "$as_me: WARNING: + Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl + that IS thread-enabled." >&2;} + fi + ;; + *) + if test "${TCL_THREADS}" = "1"; then + { echo "$as_me:$LINENO: WARNING: + --enable-threads requested, but attempting building against a Tcl + that is NOT thread-enabled." >&5 +echo "$as_me: WARNING: + --enable-threads requested, but attempting building against a Tcl + that is NOT thread-enabled." >&2;} + fi + ;; + esac + + + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking how to build libraries" >&5 +echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6 + # Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + tcl_ok=$enableval +else + tcl_ok=yes +fi; + + if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + tcl_ok=$enableval + else + tcl_ok=yes + fi + + if test "$tcl_ok" = "yes" ; then + echo "$as_me:$LINENO: result: shared" >&5 +echo "${ECHO_T}shared" >&6 + SHARED_BUILD=1 + else + echo "$as_me:$LINENO: result: static" >&5 +echo "${ECHO_T}static" >&6 + SHARED_BUILD=0 + cat >>confdefs.h <<\_ACEOF +#define STATIC_BUILD 1 +_ACEOF + + fi + + + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# can be taken from the tclConfig.sh file, but this figures it all out. +#-------------------------------------------------------------------- + + + + + # Step 0: Enable 64 bit support? + + echo "$as_me:$LINENO: checking if 64bit support is enabled" >&5 +echo $ECHO_N "checking if 64bit support is enabled... $ECHO_C" >&6 + # Check whether --enable-64bit or --disable-64bit was given. +if test "${enable_64bit+set}" = set; then + enableval="$enable_64bit" + do64bit=$enableval +else + do64bit=no +fi; + echo "$as_me:$LINENO: result: $do64bit" >&5 +echo "${ECHO_T}$do64bit" >&6 + + # Step 0.b: Enable Solaris 64 bit VIS support? + + echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5 +echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6 + # Check whether --enable-64bit-vis or --disable-64bit-vis was given. +if test "${enable_64bit_vis+set}" = set; then + enableval="$enable_64bit_vis" + do64bitVIS=$enableval +else + do64bitVIS=no +fi; + echo "$as_me:$LINENO: result: $do64bitVIS" >&5 +echo "${ECHO_T}$do64bitVIS" >&6 + + if test "$do64bitVIS" = "yes"; then + # Force 64bit on with VIS + do64bit=yes + fi + + # Step 0.c: Cross-compiling options for Windows/CE builds? + + if test "${TEA_PLATFORM}" = "windows" ; then + echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5 +echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6 + # Check whether --enable-wince or --disable-wince was given. +if test "${enable_wince+set}" = set; then + enableval="$enable_wince" + doWince=$enableval +else + doWince=no +fi; + echo "$as_me:$LINENO: result: $doWince" >&5 +echo "${ECHO_T}$doWince" >&6 + fi + + # Step 1: set the variable "system" to hold the name and version number + # for the system. This can usually be done via the "uname" command, but + # there are a few systems, like Next, where this doesn't work. + + echo "$as_me:$LINENO: checking system version (for dynamic loading)" >&5 +echo $ECHO_N "checking system version (for dynamic loading)... $ECHO_C" >&6 + if test -f /usr/lib/NextStep/software_version; then + system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` + else + system=`uname -s`-`uname -r` + if test "$?" -ne 0 ; then + echo "$as_me:$LINENO: result: unknown (can't find uname command)" >&5 +echo "${ECHO_T}unknown (can't find uname command)" >&6 + system=unknown + else + # Special check for weird MP-RAS system (uname returns weird + # results, and the version is kept in special file). + + if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then + system=MP-RAS-`awk '{print }' /etc/.relid'` + fi + if test "`uname -s`" = "AIX" ; then + system=AIX-`uname -v`.`uname -r` + fi + if test "${TEA_PLATFORM}" = "windows" ; then + system=windows + fi + echo "$as_me:$LINENO: result: $system" >&5 +echo "${ECHO_T}$system" >&6 + fi + fi + + # Step 2: check for existence of -ldl library. This is needed because + # Linux can use either -ldl or -ldld for dynamic loading. + + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + have_dl=yes +else + have_dl=no +fi + + + # Step 3: set configuration options based on system name and version. + + do64bit_ok=no + EXTRA_CFLAGS="" + TCL_EXPORT_FILE_SUFFIX="" + UNSHARED_LIB_SUFFIX="" + TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' + ECHO_VERSION='`echo ${PACKAGE_VERSION}`' + TCL_LIB_VERSIONS_OK=ok + CFLAGS_DEBUG=-g + CFLAGS_OPTIMIZE=-O + if test "$GCC" = "yes" ; then + CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int" + else + CFLAGS_WARNING="" + fi + TCL_NEEDS_EXP_FILE=0 + TCL_BUILD_EXP_FILE="" + TCL_EXP_FILE="" + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STLIB_LD='${AR} cr' + LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" + case $system in + windows) + # This is a 2-stage check to make sure we have the 64-bit SDK + # We have to know where the SDK is installed. + if test "$do64bit" = "yes" ; then + if test "x${MSSDK}x" = "xx" ; then + MSSDK="C:/Progra~1/Microsoft SDK" + fi + # In order to work in the tortured autoconf environment, + # we need to ensure that this path has no spaces + MSSDK=`cygpath -w -s "$MSSDK" | sed -e 's!\\\!/!g'` + if test ! -d "${MSSDK}/bin/win64" ; then + { echo "$as_me:$LINENO: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&5 +echo "$as_me: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&2;} + do64bit="no" + else + do64bit_ok="yes" + fi + fi + + if test "$doWince" != "no" ; then + if test "$do64bit" = "yes" ; then + { { echo "$as_me:$LINENO: error: Windows/CE and 64-bit builds incompatible" >&5 +echo "$as_me: error: Windows/CE and 64-bit builds incompatible" >&2;} + { (exit 1); exit 1; }; } + fi + if test "$GCC" = "yes" ; then + { { echo "$as_me:$LINENO: error: Windows/CE and GCC builds incompatible" >&5 +echo "$as_me: error: Windows/CE and GCC builds incompatible" >&2;} + { (exit 1); exit 1; }; } + fi + + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-celib + + if test x"${no_celib}" = x ; then + # we reset no_celib in case something fails here + no_celib=true + +# Check whether --with-celib or --without-celib was given. +if test "${with_celib+set}" = set; then + withval="$with_celib" + with_celibconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5 +echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6 + if test "${ac_cv_c_celibconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + # First check to see if --with-celibconfig was specified. + if test x"${with_celibconfig}" != x ; then + if test -d "${with_celibconfig}/inc" ; then + ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_celibconfig} directory doesn't contain inc directory" >&5 +echo "$as_me: error: ${with_celibconfig} directory doesn't contain inc directory" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a celib library + if test x"${ac_cv_c_celibconfig}" = x ; then + for i in \ + ../celib-palm-3.0 \ + ../celib \ + ../../celib-palm-3.0 \ + ../../celib \ + `ls -dr ../celib-*3.[0-9]* 2>/dev/null` \ + ${srcdir}/../celib-palm-3.0 \ + ${srcdir}/../celib \ + `ls -dr ${srcdir}/../celib-*3.[0-9]* 2>/dev/null` \ + ; do + if test -d "$i/inc" ; then + ac_cv_c_celibconfig=`(cd $i; pwd)` + break + fi + done + fi + +fi + + if test x"${ac_cv_c_celibconfig}" = x ; then + CELIB_DIR="# no Celib configs found" + { { echo "$as_me:$LINENO: error: Cannot find celib support library directory" >&5 +echo "$as_me: error: Cannot find celib support library directory" >&2;} + { (exit 1); exit 1; }; } + else + no_celib= + CELIB_DIR=${ac_cv_c_celibconfig} + echo "$as_me:$LINENO: result: found $CELIB_DIR" >&5 +echo "${ECHO_T}found $CELIB_DIR" >&6 + fi + fi + + # set defaults + # Currently Tcl requires 300+ + CEVERSION=300; # could be 211 300 301 ... + TARGETCPU=ARM; # could be ARM MIPS SH3 X86 ... + PLATFORM="Pocket PC 2002" + if test "$doWince" = "yes"; then + doWince="300,ARM,ARM,Pocket PC 2002" + fi + eval `echo $doWince | awk -F "," '{ \ + if (length($1)) { printf "CEVERSION=%s\n", $1 }; \ + if (length($2)) { printf "TARGETCPU=%s\n", toupper($2) }; \ + if (length($3)) { printf "ARCH=%s\n", toupper($3) }; \ + if (length($4)) { printf "PLATFORM=%s\n", $4 }; \ + }'` + OSVERSION=WCE$CEVERSION; + if test "x${ARCH}" = "x" ; then + ARCH=$TARGETCPU; # could be ARM MIPS SH3 X86 X86EM ... + fi + if test "x${WCEROOT}" = "x" ; then + WCEROOT="C:/Program Files/Microsoft eMbedded Tools" + fi + if test "x${SDKROOT}" = "x" ; then + SDKROOT="C:/Windows CE Tools" + fi + # In order to work in the tortured autoconf environment, + # we need to ensure that this path has no spaces + WCEROOT=`cygpath -w -s "$WCEROOT" | sed -e 's!\\\!/!g'` + SDKROOT=`cygpath -w -s "$SDKROOT" | sed -e 's!\\\!/!g'` + CELIB_DIR=`cygpath -w -s "$CELIB_DIR" | sed -e 's!\\\!/!g'` + if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ + -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then + { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5 +echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;} + { (exit 1); exit 1; }; } + doWince="no" + else + CEINCLUDE=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/include" | sed -e 's!\\\!/!g'` + CELIBPATH=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" | sed -e 's!\\\!/!g'` + fi + fi + + if test "$GCC" != "yes" ; then + if test "${SHARED_BUILD}" = "0" ; then + runtime=-MT + else + runtime=-MD + fi + + if test "$do64bit" = "yes" ; then + # All this magic is necessary for the Win64 SDK RC1 - hobbs + export CC="${MSSDK}/Bin/Win64/cl.exe \ + -I${MSSDK}/Include/prerelease \ + -I${MSSDK}/Include/Win64/crt \ + -I${MSSDK}/Include" + export RC="${MSSDK}/bin/rc.exe" + export lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \ + -LIBPATH:${MSSDK}/Lib/Prerelease/IA64" + export STLIB_LD="${MSSDK}/bin/win64/lib.exe -nologo ${lflags}" + export LINKBIN="${MSSDK}/bin/win64/link.exe ${lflags}" + CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" + CFLAGS_OPTIMIZE="-nologo -O2 -Gs -W2 ${runtime}" + elif test "$doWince" != "no" ; then + if test "${TARGETCPU}" = "X86"; then + CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + else + CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl${TARGETCPU}.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + fi + RC="${WCEROOT}/Common/EVC/bin/rc.exe" + cpulower=`echo ${TARGETCPU} | awk '{print tolower($0)}'` + defs="${TARGETCPU} _${TARGETCPU}_ ${cpulower} _${cpulower}_ POCKET_SIZE PALM_SIZE _MT _DLL _WINDOWS" + for i in $defs ; do + cat >>confdefs.h <<_ACEOF +#define $i 1 +_ACEOF + + done + cat >>confdefs.h <<_ACEOF +#define _WIN32_WCE $CEVERSION +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define UNDER_CE $CEVERSION +_ACEOF + + CFLAGS_DEBUG="-nologo -Zi -Od" + CFLAGS_OPTIMIZE="-nologo -Ox" + lflags="-MACHINE:${TARGETCPU} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,3.00" + STLIB_LD="${WCEROOT}/EVC/${OSVERSION}/bin/lib.exe -nologo ${lflags}" + LINKBIN="${WCEROOT}/EVC/${OSVERSION}/bin/link.exe ${lflags}" + else + RC="rc" + STLIB_LD="lib -nologo" + LINKBIN="link -link50compat" + CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" + CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD -W2 ${runtime}" + fi + fi + + if test "$GCC" = "yes"; then + # mingw gcc mode + RC="windres" + CFLAGS_DEBUG="-g" + CFLAGS_OPTIMIZE="-O2" + SHLIB_LD="$CC -shared" + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" + LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" + else + SHLIB_LD="${LINKBIN} -dll -nologo" + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.lib' + EXTRA_CFLAGS="-YX" + PATHTYPE=-w + # For information on what debugtype is most useful, see: + # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp + # This essentially turns it all on. + LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2" + LDFLAGS_OPTIMIZE="-release" + if test "$doWince" != "no" ; then + LDFLAGS_CONSOLE="-link ${lflags}" + LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} + else + LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" + LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" + fi + fi + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".dll" + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.dll' + + TCL_LIB_VERSIONS_OK=nodots + # Bogus to avoid getting this turned off + DL_OBJS="tclLoadNone.obj" + ;; + AIX-*) + if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then + # AIX requires the _r compiler when gcc isn't being used + if test "${CC}" != "cc_r" ; then + CC=${CC}_r + fi + echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5 +echo "${ECHO_T}Using $CC for compiling with threads" >&6 + fi + LIBS="$LIBS -lc" + SHLIB_CFLAGS="" + SHLIB_SUFFIX=".so" + SHLIB_LD_LIBS='${LIBS}' + + DL_OBJS="tclLoadDl.o" + LDFLAGS="" + LD_LIBRARY_PATH_VAR="LIBPATH" + + # AIX v<=4.1 has some different flags than 4.2+ + if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then + #LIBOBJS="$LIBOBJS tclLoadAix.o" + LIBOBJS="$LIBOBJS tclLoadAix.$ac_objext" + DL_LIBS="-lld" + fi + + # Check to enable 64-bit flags for compiler/linker on AIX 4+ + if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + else + do64bit_ok=yes + EXTRA_CFLAGS="-q64" + LDFLAGS="-q64" + RANLIB="${RANLIB} -X64" + AR="${AR} -X64" + SHLIB_LD_FLAGS="-b64" + fi + fi + + if test "`uname -m`" = "ia64" ; then + # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + # AIX-5 has dl* in libc.so + DL_LIBS="" + if test "$GCC" = "yes" ; then + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' + fi + else + SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}" + DL_LIBS="-ldl" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + TCL_NEEDS_EXP_FILE=1 + TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.exp' + fi + + # On AIX <=v4 systems, libbsd.a has to be linked in to support + # non-blocking file IO. This library has to be linked in after + # the MATH_LIBS or it breaks the pow() function. The way to + # insure proper sequencing, is to add it to the tail of MATH_LIBS. + # This library also supplies gettimeofday. + # + # AIX does not have a timezone field in struct tm. When the AIX + # bsd library is used, the timezone global and the gettimeofday + # methods are to be avoided for timezone deduction instead, we + # deduce the timezone by comparing the localtime result on a + # known GMT value. + + echo "$as_me:$LINENO: checking for gettimeofday in -lbsd" >&5 +echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6 +if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gettimeofday (); +int +main () +{ +gettimeofday (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_bsd_gettimeofday=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_bsd_gettimeofday=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gettimeofday" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6 +if test $ac_cv_lib_bsd_gettimeofday = yes; then + libbsd=yes +else + libbsd=no +fi + + if test $libbsd = yes; then + MATH_LIBS="$MATH_LIBS -lbsd" + cat >>confdefs.h <<\_ACEOF +#define USE_DELTA_FOR_TZ 1 +_ACEOF + + fi + ;; + BSD/OS-2.1*|BSD/OS-3*) + SHLIB_CFLAGS="" + SHLIB_LD="shlicc -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + BSD/OS-4.*) + SHLIB_CFLAGS="-export-dynamic -fPIC" + SHLIB_LD="cc -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-export-dynamic" + LD_SEARCH_FLAGS="" + ;; + dgux*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + HP-UX-*.11.*) + # Use updated header definitions where possible + cat >>confdefs.h <<\_ACEOF +#define _XOPEN_SOURCE_EXTENDED 1 +_ACEOF + + + SHLIB_SUFFIX=".sl" + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + fi + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + + # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc + #EXTRA_CFLAGS="+DAportable" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + hpux_arch=`${CC} -dumpmachine` + case $hpux_arch in + hppa64*) + # 64-bit gcc in use. Fix flags for GNU ld. + do64bit_ok=yes + SHLIB_LD="${CC} -shared" + SHLIB_LD_LIBS="" + LD_SEARCH_FLAGS='' + ;; + *) + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + ;; + esac + else + do64bit_ok=yes + if test "`uname -m`" = "ia64" ; then + EXTRA_CFLAGS="+DD64" + LDFLAGS="+DD64 $LDFLAGS" + else + EXTRA_CFLAGS="+DA2.0W" + LDFLAGS="+DA2.0W $LDFLAGS" + fi + fi + fi + ;; + HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) + SHLIB_SUFFIX=".sl" + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS="" + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + fi + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + ;; + IRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + ;; + IRIX-5.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + EXTRA_CFLAGS="" + LDFLAGS="" + ;; + IRIX-6.*|IRIX64-6.5*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -n32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then + EXTRA_CFLAGS="-mabi=n32" + LDFLAGS="-mabi=n32" + else + case $system in + IRIX-6.3) + # Use to build 6.2 compatible binaries on 6.3. + EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS" + ;; + *) + EXTRA_CFLAGS="-n32" + ;; + esac + LDFLAGS="-n32" + fi + ;; + IRIX64-6.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -n32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + + # Check to enable 64-bit flags for compiler/linker + + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5 +echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} + else + do64bit_ok=yes + SHLIB_LD="ld -64 -shared -rdata_shared" + EXTRA_CFLAGS="-64" + LDFLAGS="-64" + fi + fi + ;; + Linux*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings + # when you inline the string and math operations. Turn this off to + # get rid of the warnings. + + #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + else + if test "${ac_cv_header_dld_h+set}" = set; then + echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dld.h usability" >&5 +echo $ECHO_N "checking dld.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dld.h presence" >&5 +echo $ECHO_N "checking dld.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dld.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dld.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dld.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dld_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 + +fi +if test $ac_cv_header_dld_h = yes; then + + SHLIB_LD="ld -shared" + DL_OBJS="tclLoadDld.o" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS="" +fi + + + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + + # The combo of gcc + glibc has a bug related + # to inlining of functions like strtod(). The + # -fno-builtin flag should address this problem + # but it does not work. The -fno-inline flag + # is kind of overkill but it works. + # Disable inlining only when one of the + # files in compat/*.c is being linked in. + if test x"${USE_COMPAT}" != x ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline" + fi + + ;; + GNU*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + LD_SEARCH_FLAGS="" + else + if test "${ac_cv_header_dld_h+set}" = set; then + echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dld.h usability" >&5 +echo $ECHO_N "checking dld.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dld.h presence" >&5 +echo $ECHO_N "checking dld.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dld.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dld.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dld.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dld_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 + +fi +if test $ac_cv_header_dld_h = yes; then + + SHLIB_LD="ld -shared" + DL_OBJS="" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS="" +fi + + + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + ;; + MP-RAS-02*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + MP-RAS-*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-Wl,-Bexport" + LD_SEARCH_FLAGS="" + ;; + NetBSD-*|FreeBSD-[1-2].*) + # Not available on all versions: check for include file. + if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 +echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 +echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dlfcn_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 + +fi +if test $ac_cv_header_dlfcn_h = yes; then + + # NetBSD/SPARC needs -fPIC, -fpic will not do. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + echo "$as_me:$LINENO: checking for ELF" >&5 +echo $ECHO_N "checking for ELF... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef __ELF__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + +fi +rm -f conftest* + + +else + + SHLIB_CFLAGS="" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + +fi + + + + # FreeBSD doesn't handle version numbers with dots. + + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + OpenBSD-*) + SHLIB_LD="${CC} -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + echo "$as_me:$LINENO: checking for ELF" >&5 +echo $ECHO_N "checking for ELF... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef __ELF__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + +fi +rm -f conftest* + + + # OpenBSD doesn't do version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + FreeBSD-*) + # FreeBSD 3.* and greater have ELF. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="-export-dynamic" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + if test "${TCL_THREADS}" = "1" ; then + # The -pthread needs to go in the CFLAGS, not LIBS + LIBS=`echo $LIBS | sed s/-pthread//` + EXTRA_CFLAGS="-pthread" + LDFLAGS="$LDFLAGS -pthread" + fi + case $system in + FreeBSD-3.*) + # FreeBSD-3 doesn't handle version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' + TCL_LIB_VERSIONS_OK=nodots + ;; + esac + ;; + Rhapsody-*|Darwin-*) + SHLIB_CFLAGS="-fno-common" + SHLIB_LD="cc -dynamiclib \${LDFLAGS}" + TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_MAJOR_VERSION} -current_version \${PACKAGE_VERSION} -install_name \${LIB_RUNTIME_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".dylib" + DL_OBJS="tclLoadDyld.o" + DL_LIBS="" + LDFLAGS="-prebind" + LD_SEARCH_FLAGS="" + LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" + CFLAGS_OPTIMIZE="-O3" + EXTRA_CFLAGS="-arch ppc -pipe" + ;; + NEXTSTEP-*) + SHLIB_CFLAGS="" + SHLIB_LD="cc -nostdlib -r" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadNext.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OS/390-*) + CFLAGS_OPTIMIZE="" # Optimizer is buggy + cat >>confdefs.h <<\_ACEOF +#define _OE_SOCKETS 1 +_ACEOF + # needed in sys/socket.h + ;; + OSF1-1.0|OSF1-1.1|OSF1-1.2) + # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 + SHLIB_CFLAGS="" + # Hack: make package name same as library name + SHLIB_LD='ld -R -export :' + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadOSF.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-1.*) + # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 + SHLIB_CFLAGS="-fPIC" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD="ld -shared" + else + SHLIB_LD="ld -non_shared" + fi + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-V*) + # Digital OSF/1 + SHLIB_CFLAGS="" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD='ld -shared -expect_unresolved "*"' + else + SHLIB_LD='ld -non_shared -expect_unresolved "*"' + fi + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + if test "$GCC" != "yes" ; then + EXTRA_CFLAGS="-DHAVE_TZSET -std1" + fi + # see pthread_intro(3) for pthread support on osf1, k.furukawa + if test "${TCL_THREADS}" = "1" ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" + LIBS=`echo $LIBS | sed s/-lpthreads//` + if test "$GCC" = "yes" ; then + LIBS="$LIBS -lpthread -lmach -lexc" + else + EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread" + LDFLAGS="-pthread" + fi + fi + + ;; + QNX-6*) + # QNX RTP + # This may work for all QNX, but it was only reported for v6. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + # dlopen is in -lc on QNX + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + RISCos-*) + SHLIB_CFLAGS="-G 0" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + ;; + SCO_SV-3.2*) + # Note, dlopen is available only on SCO 3.2.5 and greater. However, + # this test works, since "uname -s" was non-standard in 3.2.4 and + # below. + if test "$GCC" = "yes" ; then + SHLIB_CFLAGS="-fPIC -melf" + LDFLAGS="-melf -Wl,-Bexport" + else + SHLIB_CFLAGS="-Kpic -belf" + LDFLAGS="-belf -Wl,-Bexport" + fi + SHLIB_LD="ld -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS="" + ;; + SINIX*5.4*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + SunOS-4*) + SHLIB_CFLAGS="-PIC" + SHLIB_LD="ld" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + + # SunOS can't handle version numbers with dots in them in library + # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it + # requires an extra version number at the end of .so file names. + # So, the library has to have a name like libtcl75.so.1.0 + + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + SunOS-5.[0-6]*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + + + SHLIB_CFLAGS="-KPIC" + + # Note: need the LIBS below, otherwise Tk won't find Tcl's + # symbols when dynamically loaded into tclsh. + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + ;; + SunOS-5*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + + + SHLIB_CFLAGS="-KPIC" + LDFLAGS="" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + arch=`isainfo` + if test "$arch" = "sparcv9 sparc" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + else + do64bit_ok=yes + if test "$do64bitVIS" = "yes" ; then + EXTRA_CFLAGS="-xarch=v9a" + LDFLAGS="-xarch=v9a" + else + EXTRA_CFLAGS="-xarch=v9" + LDFLAGS="-xarch=v9" + fi + fi + else + { echo "$as_me:$LINENO: WARNING: \"64bit mode only supported sparcv9 system\"" >&5 +echo "$as_me: WARNING: \"64bit mode only supported sparcv9 system\"" >&2;} + fi + fi + + # Note: need the LIBS below, otherwise Tk won't find Tcl's + # symbols when dynamically loaded into tclsh. + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + ;; + ULTRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + if test "$GCC" != "yes" ; then + EXTRA_CFLAGS="-DHAVE_TZSET -std1" + fi + ;; + UNIX_SV* | UnixWare-5*) + SHLIB_CFLAGS="-KPIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers + # that don't grok the -Bexport option. Test that it does. + hold_ldflags=$LDFLAGS + echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5 +echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6 + LDFLAGS="${LDFLAGS} -Wl,-Bexport" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + found=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +found=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$hold_ldflags + echo "$as_me:$LINENO: result: $found" >&5 +echo "${ECHO_T}$found" >&6 + if test $found = yes; then + LDFLAGS="-Wl,-Bexport" + else + LDFLAGS="" + fi + LD_SEARCH_FLAGS="" + ;; + esac + + if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit support being disabled -- don\'t know magic for this platform\"" >&5 +echo "$as_me: WARNING: \"64bit support being disabled -- don\'t know magic for this platform\"" >&2;} + fi + + # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic + # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop, + # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need + # to determine which of several header files defines the a.out file + # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we + # support only a file format that is more or less version-7-compatible. + # In particular, + # - a.out files must begin with `struct exec'. + # - the N_TXTOFF on the `struct exec' must compute the seek address + # of the text segment + # - The `struct exec' must contain a_magic, a_text, a_data, a_bss + # and a_entry fields. + # The following compilation should succeed if and only if either sys/exec.h + # or a.out.h is usable for the purpose. + # + # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the + # `struct exec' includes a second header that contains information that + # duplicates the v7 fields that are needed. + + if test "x$DL_OBJS" = "xtclLoadAout.o" ; then + echo "$as_me:$LINENO: checking sys/exec.h" >&5 +echo $ECHO_N "checking sys/exec.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_SYS_EXEC_H 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking a.out.h" >&5 +echo $ECHO_N "checking a.out.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_A_OUT_H 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking sys/exec_aout.h" >&5 +echo $ECHO_N "checking sys/exec_aout.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_midmag == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_SYS_EXEC_AOUT_H 1 +_ACEOF + + else + DL_OBJS="" + fi + fi + fi + fi + + # Step 5: disable dynamic loading if requested via a command-line switch. + + # Check whether --enable-load or --disable-load was given. +if test "${enable_load+set}" = set; then + enableval="$enable_load" + tcl_ok=$enableval +else + tcl_ok=yes +fi; + if test "$tcl_ok" = "no"; then + DL_OBJS="" + fi + + if test "x$DL_OBJS" != "x" ; then + BUILD_DLTEST="\$(DLTEST_TARGETS)" + else + echo "Can't figure out how to do dynamic loading or shared libraries" + echo "on this system." + SHLIB_CFLAGS="" + SHLIB_LD="" + SHLIB_SUFFIX="" + DL_OBJS="tclLoadNone.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + BUILD_DLTEST="" + fi + + # If we're running gcc, then change the C flags for compiling shared + # libraries to the right flags for gcc, instead of those for the + # standard manufacturer compiler. + + if test "$DL_OBJS" != "tclLoadNone.o" ; then + if test "$GCC" = "yes" ; then + case $system in + AIX-*) + ;; + BSD/OS*) + ;; + IRIX*) + ;; + NetBSD-*|FreeBSD-*) + ;; + Rhapsody-*|Darwin-*) + ;; + RISCos-*) + ;; + SCO_SV-3.2*) + ;; + ULTRIX-4.*) + ;; + windows) + ;; + *) + SHLIB_CFLAGS="-fPIC" + ;; + esac + fi + fi + + if test "$SHARED_LIB_SUFFIX" = "" ; then + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}${SHLIB_SUFFIX}' + fi + if test "$UNSHARED_LIB_SUFFIX" = "" ; then + UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + fi + + + + + + + + + + + + + + + + + +# Without the following two eval statements, XOTCL_SHARED_LIB_SUFFIX +# in xotclConfig.sh has $PACKAGE_VERSION unresolved. When another +# app links against xotcl, the PACKAGE_VERSIONs are confused. +# +# Without the first eval, we get +# XOTCL_SHARED_LIB_SUFFIX=${PACKAGE_VERSION}\$\{DBGX\}${SHLIB_SUFFIX} +# XOTCL_UNSHARED_LIB_SUFFIX=${PACKAGE_VERSION}\$\{DBGX\}.a +# +# after the first eval, we get +# XOTCL_SHARED_LIB_SUFFIX=1.2.1${DBGX}.so +# XOTCL_UNSHARED_LIB_SUFFIX=1.2.1${DBGX}.a +# after the second eval, all variables are resolved. + + +eval "SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" +eval "UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}" + +eval "SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" +eval "UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}" + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols +# option. +#-------------------------------------------------------------------- + + + + + if test "${TEA_PLATFORM}" = "windows" ; then + tcl_dbgx=d + else + tcl_dbgx=g + fi + + echo "$as_me:$LINENO: checking for build with symbols" >&5 +echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6 + # Check whether --enable-symbols or --disable-symbols was given. +if test "${enable_symbols+set}" = set; then + enableval="$enable_symbols" + tcl_ok=$enableval +else + tcl_ok=no +fi; + if test "$tcl_ok" = "no"; then + CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" + LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" + DBGX="" + TCL_DBGX="" + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + else + CFLAGS_DEFAULT="${CFLAGS_DEBUG}" + LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" + DBGX=${tcl_dbgx} + TCL_DBGX=${tcl_dbgx} + if test "$tcl_ok" = "yes"; then + echo "$as_me:$LINENO: result: yes (standard debugging)" >&5 +echo "${ECHO_T}yes (standard debugging)" >&6 + fi + fi + if test "${TEA_PLATFORM}" != "windows" ; then + LDFLAGS_DEFAULT="${LDFLAGS}" + fi + + + + + + if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then + cat >>confdefs.h <<\_ACEOF +#define TCL_MEM_DEBUG 1 +_ACEOF + + fi + + if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then + if test "$tcl_ok" = "all"; then + echo "$as_me:$LINENO: result: enabled symbols mem debugging" >&5 +echo "${ECHO_T}enabled symbols mem debugging" >&6 + else + echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5 +echo "${ECHO_T}enabled $tcl_ok debugging" >&6 + fi + fi + + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. +#-------------------------------------------------------------------- + + +#if test "${TCL_MAJOR_VERSION}" = "8" -a "${TCL_MINOR_VERSION}" = "0"; then +# FORCE_NO_STUBS=1 +#fi + +if test "${FORCE_NO_STUBS}" = "0" ; then + cat >>confdefs.h <<\_ACEOF +#define USE_TCL_STUBS 1 +_ACEOF + +fi + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, +# and TEA_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + + + if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then + MAKE_STATIC_LIB="\${STLIB_LD} -out:\$@ \$(PKG_OBJECTS)" + MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\$@ \$(PKG_OBJECTS)" + MAKE_STUB_LIB="\${STLIB_LD} -out:\$@ \$(PKG_STUB_OBJECTS)" + else + MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)" + MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS}" + MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)" + fi + + if test "${SHARED_BUILD}" = "1" ; then + MAKE_LIB="${MAKE_SHARED_LIB} " + else + MAKE_LIB="${MAKE_STATIC_LIB} " + fi + + #-------------------------------------------------------------------- + # Shared libraries and static libraries have different names. + # Use the double eval to make sure the ${DBGX} in the suffix is + # substituted. + #-------------------------------------------------------------------- + + RANLIB_STUB="${RANLIB}" + if test "${TEA_PLATFORM}" = "windows" ; then + if test "${SHARED_BUILD}" = "1" ; then + # We force the unresolved linking of symbols that are really in + # the private libraries of Tcl and Tk. + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" + if test x"${TK_BIN_DIR}" != x ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" + fi + eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + fi + # Some packages build there own stubs libraries + eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + else + if test "${SHARED_BUILD}" = "1" ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" + if test x"${TK_BIN_DIR}" != x ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}" + fi + eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + fi + # Some packages build there own stubs libraries + eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + fi + + # These are escaped so that only CFLAGS is picked up at configure time. + # The other values will be substituted at make time. + CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" + if test "${SHARED_BUILD}" = "1" ; then + CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}" + fi + + + + + + + + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for tclsh" >&5 +echo $ECHO_N "checking for tclsh... $ECHO_C" >&6 + + if test "${ac_cv_path_tclsh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "x${CELIB_DIR}" != "x" ; then + # If CELIB_DIR is defined, assume Windows/CE target is requested + # which means target tclsh cannot be run (cross-compile) + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + else + search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'` + fi + for dir in $search_path ; do + for j in `ls -r $dir/tclsh[8-9]*${EXEEXT} 2> /dev/null` \ + `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do + if test x"$ac_cv_path_tclsh" = x ; then + if test -f "$j" ; then + ac_cv_path_tclsh=$j + break + fi + fi + done + done + +fi + + + if test -f "$ac_cv_path_tclsh" ; then + TCLSH_PROG=$ac_cv_path_tclsh + echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5 +echo "${ECHO_T}$TCLSH_PROG" >&6 + else + { { echo "$as_me:$LINENO: error: No tclsh found in PATH: $search_path" >&5 +echo "$as_me: error: No tclsh found in PATH: $search_path" >&2;} + { (exit 1); exit 1; }; } + fi + + + +# +# XOTcl specific configs +# +XOTCL_BUILD_LIB_SPEC="-L`pwd` -lxotcl${PACKAGE_VERSION}" +XOTCL_LIB_SPEC="-L${exec_prefix}/lib -lxotcl${PACKAGE_VERSION}" + +# stub libs are not build for 8.0 +if test "${TCL_MAJOR_VERSION}" = "8" -a "${TCL_MINOR_VERSION}" = "0"; then + XOTCL_BUILD_STUB_LIB_SPEC="" + XOTCL_STUB_LIB_SPEC="" + XOTCL_BUILD_STUB_LIB_PATH="" + XOTCL_STUB_LIB_PATH="" +else + XOTCL_BUILD_STUB_LIB_SPEC="-L`pwd` -lxotclstub${PACKAGE_VERSION}" + XOTCL_STUB_LIB_SPEC="-L${exec_prefix}/lib -lxotclstub${PACKAGE_VERSION}" + XOTCL_BUILD_STUB_LIB_PATH="`pwd`/${PKG_STUB_LIB_FILE}" + XOTCL_STUB_LIB_PATH="${exec_prefix}/lib/${PKG_STUB_LIB_FILE}" + cat >>confdefs.h <<\_ACEOF +#define COMPILE_XOTCL_STUBS 1 +_ACEOF + +fi + + + + + + + + + +XOTCL_SRC_DIR=`pwd` + + + + + + + + + +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +#-------------------------------------------------------------------- + + ac_config_files="$ac_config_files Makefile xotclConfig.sh apps/utils/xotclsh apps/utils/xowish unix/xotcl.spec unix/pkgIndex.unix" +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 +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by xotcl $as_me 1.2.1, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +xotcl config.status 1.2.1 +configured by $0, generated by GNU Autoconf 2.57, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "xotclConfig.sh" ) CONFIG_FILES="$CONFIG_FILES xotclConfig.sh" ;; + "apps/utils/xotclsh" ) CONFIG_FILES="$CONFIG_FILES apps/utils/xotclsh" ;; + "apps/utils/xowish" ) CONFIG_FILES="$CONFIG_FILES apps/utils/xowish" ;; + "unix/xotcl.spec" ) CONFIG_FILES="$CONFIG_FILES unix/xotcl.spec" ;; + "unix/pkgIndex.unix" ) CONFIG_FILES="$CONFIG_FILES unix/pkgIndex.unix" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@CYGPATH@,$CYGPATH,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@PKG_LIB_FILE@,$PKG_LIB_FILE,;t t +s,@PKG_STUB_LIB_FILE@,$PKG_STUB_LIB_FILE,;t t +s,@PKG_STUB_SOURCES@,$PKG_STUB_SOURCES,;t t +s,@PKG_STUB_OBJECTS@,$PKG_STUB_OBJECTS,;t t +s,@PKG_TCL_SOURCES@,$PKG_TCL_SOURCES,;t t +s,@PKG_HEADERS@,$PKG_HEADERS,;t t +s,@PKG_INCLUDES@,$PKG_INCLUDES,;t t +s,@PKG_LIBS@,$PKG_LIBS,;t t +s,@PKG_CFLAGS@,$PKG_CFLAGS,;t t +s,@subdirs@,$subdirs,;t t +s,@XOTCL_VERSION@,$XOTCL_VERSION,;t t +s,@XOTCL_MAJOR_VERSION@,$XOTCL_MAJOR_VERSION,;t t +s,@XOTCL_MINOR_VERSION@,$XOTCL_MINOR_VERSION,;t t +s,@XOTCL_RELEASE_LEVEL@,$XOTCL_RELEASE_LEVEL,;t t +s,@TCL_VERSION@,$TCL_VERSION,;t t +s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t +s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t +s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t +s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t +s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t +s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t +s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t +s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t +s,@TCL_LIBS@,$TCL_LIBS,;t t +s,@TCL_DEFS@,$TCL_DEFS,;t t +s,@TCL_EXTRA_CFLAGS@,$TCL_EXTRA_CFLAGS,;t t +s,@TCL_LD_FLAGS@,$TCL_LD_FLAGS,;t t +s,@TCL_SHLIB_LD_LIBS@,$TCL_SHLIB_LD_LIBS,;t t +s,@TK_VERSION@,$TK_VERSION,;t t +s,@TK_BIN_DIR@,$TK_BIN_DIR,;t t +s,@TK_SRC_DIR@,$TK_SRC_DIR,;t t +s,@TK_LIB_FILE@,$TK_LIB_FILE,;t t +s,@TK_LIB_FLAG@,$TK_LIB_FLAG,;t t +s,@TK_LIB_SPEC@,$TK_LIB_SPEC,;t t +s,@TK_STUB_LIB_FILE@,$TK_STUB_LIB_FILE,;t t +s,@TK_STUB_LIB_FLAG@,$TK_STUB_LIB_FLAG,;t t +s,@TK_STUB_LIB_SPEC@,$TK_STUB_LIB_SPEC,;t t +s,@TK_LIBS@,$TK_LIBS,;t t +s,@TK_XINCLUDES@,$TK_XINCLUDES,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@EGREP@,$EGREP,;t t +s,@MATH_LIBS@,$MATH_LIBS,;t t +s,@PKG_SOURCES@,$PKG_SOURCES,;t t +s,@PKG_OBJECTS@,$PKG_OBJECTS,;t t +s,@TCL_TOP_DIR_NATIVE@,$TCL_TOP_DIR_NATIVE,;t t +s,@TCL_GENERIC_DIR_NATIVE@,$TCL_GENERIC_DIR_NATIVE,;t t +s,@TCL_UNIX_DIR_NATIVE@,$TCL_UNIX_DIR_NATIVE,;t t +s,@TCL_WIN_DIR_NATIVE@,$TCL_WIN_DIR_NATIVE,;t t +s,@TCL_BMAP_DIR_NATIVE@,$TCL_BMAP_DIR_NATIVE,;t t +s,@TCL_TOOL_DIR_NATIVE@,$TCL_TOOL_DIR_NATIVE,;t t +s,@TCL_PLATFORM_DIR_NATIVE@,$TCL_PLATFORM_DIR_NATIVE,;t t +s,@TCL_INCLUDES@,$TCL_INCLUDES,;t t +s,@CLEANFILES@,$CLEANFILES,;t t +s,@TCL_THREADS@,$TCL_THREADS,;t t +s,@SHARED_BUILD@,$SHARED_BUILD,;t t +s,@AR@,$AR,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@DL_LIBS@,$DL_LIBS,;t t +s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t +s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t +s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t +s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t +s,@STLIB_LD@,$STLIB_LD,;t t +s,@SHLIB_LD@,$SHLIB_LD,;t t +s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t +s,@SHLIB_LD_FLAGS@,$SHLIB_LD_FLAGS,;t t +s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t +s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t +s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t +s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t +s,@TCL_DBGX@,$TCL_DBGX,;t t +s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t +s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t +s,@MAKE_LIB@,$MAKE_LIB,;t t +s,@MAKE_SHARED_LIB@,$MAKE_SHARED_LIB,;t t +s,@MAKE_STATIC_LIB@,$MAKE_STATIC_LIB,;t t +s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t +s,@RANLIB_STUB@,$RANLIB_STUB,;t t +s,@TCLSH_PROG@,$TCLSH_PROG,;t t +s,@SHARED_LIB_SUFFIX@,$SHARED_LIB_SUFFIX,;t t +s,@UNSHARED_LIB_SUFFIX@,$UNSHARED_LIB_SUFFIX,;t t +s,@XOTCL_BUILD_LIB_SPEC@,$XOTCL_BUILD_LIB_SPEC,;t t +s,@XOTCL_LIB_SPEC@,$XOTCL_LIB_SPEC,;t t +s,@XOTCL_BUILD_STUB_LIB_SPEC@,$XOTCL_BUILD_STUB_LIB_SPEC,;t t +s,@XOTCL_STUB_LIB_SPEC@,$XOTCL_STUB_LIB_SPEC,;t t +s,@XOTCL_BUILD_STUB_LIB_PATH@,$XOTCL_BUILD_STUB_LIB_PATH,;t t +s,@XOTCL_STUB_LIB_PATH@,$XOTCL_STUB_LIB_PATH,;t t +s,@XOTCL_SRC_DIR@,$XOTCL_SRC_DIR,;t t +s,@XOTCLSH@,$XOTCLSH,;t t +s,@XOWISH@,$XOWISH,;t t +s,@test_actiweb@,$test_actiweb,;t t +s,@libdirs_actiweb@,$libdirs_actiweb,;t t +s,@apps_actiweb@,$apps_actiweb,;t t +s,@TEA_PLATFORM@,$TEA_PLATFORM,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args" + + ac_popdir=`pwd` + for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d $srcdir/$ac_dir || continue + + { echo "$as_me:$LINENO: configuring in $ac_dir" >&5 +echo "$as_me: configuring in $ac_dir" >&6;} + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + cd $ac_dir + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'" + elif test -f $ac_srcdir/configure; then + ac_sub_configure="$SHELL '$ac_srcdir/configure'" + elif test -f $ac_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 +echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file=$ac_top_builddir$cache_file ;; + esac + + { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval $ac_sub_configure $ac_sub_configure_args \ + --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir || + { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 +echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} + { (exit 1); exit 1; }; } + fi + + cd $ac_popdir + done +fi + Index: xotcl/configure.in =================================================================== diff -u --- xotcl/configure.in (revision 0) +++ xotcl/configure.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,368 @@ + +#-------------------------------------------------------------------- +# Sample configure.in for Tcl Extensions. The only places you should +# need to modify this file are marked by the string __CHANGE__ +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# __CHANGE__ +# This very first macro is used to verify that the configure script can +# find the sources. The argument to AC_INIT should be a unique filename +# for this package, and can be a relative path, such as: +# +#-------------------------------------------------------------------- +define(XOTclVersion, 1.2.1) +AC_INIT([xotcl], [XOTclVersion]) + +#-------------------------------------------------------------------- +# Call TEA_INIT as the first TEA_ macro to set up initial vars. +# This will define a ${TEA_PLATFORM} variable == "unix" or "windows". +#-------------------------------------------------------------------- + +TEA_INIT([3.0]) +AC_CONFIG_AUX_DIR(config) + +#-------------------------------------------------------------------- +# specify some extra flags +#-------------------------------------------------------------------- + +AC_ARG_WITH(gdbm, + [ --with-gdbm=GDBM_INCLUDE_DIR[,GDBM_LIB_DIR] + absolute path to gdbm.h and optionally the path to the library, + --without-gdbm disables build of Tcl Gdbm], + [with_gdbm=$withval], [with_gdbm=no]) +AC_ARG_WITH(aolserver3, + [ --with-aolserver3=AOL_SERVER_DIR, (containing include ,...) + --without-aolserver3 disables build of AOLserver 3 module], + [with_aol3=$withval], [with_aol3=no]) +AC_ARG_WITH(actiweb, + [ --with-actiweb=yes|no, + --without-actiweb disables actiweb components], + [with_actiweb=$withval], [with_actiweb=no]) +AC_ARG_WITH(xotclsh, + [ --with-xotclsh=yes|no, + --without-xotclsh disables built of xotclsh], + [with_xotclsh=$withval], [with_xotclsh=no]) +AC_ARG_WITH(xowish, + [ --with-xowish=yes|no, + --without-xowish disables built of xowish], + [with_xowish=$withval], [with_xowish=no]) +AC_ARG_WITH(all, + [ --with-all=yes|no, + --without-all disables built of all], + [with_all=$withval], [with_all=no]) +AC_ARG_WITH(all, + [ --with-all=yes|no, + --without-all disables built of all], + [with_all=$withval], [with_all=no]) +AC_ARG_WITH(tclinclude, + [ --with-tclinclude directory containing the public Tcl header files.], + with_tclinclude=${withval}) + +if test "$with_all" = yes; then + with_actiweb=yes + with_xotclsh=yes + with_xowish=yes + with_gdbm=yes +fi + +if test "$with_actiweb" = yes; then + test_actiweb="test-actiweb" + libdirs_actiweb="actiweb rdf registry store xml patterns" + apps_actiweb="actiweb persistence" + AC_CONFIG_SUBDIRS(library/store/XOTclSdbm/) + if ! test "$with_gdbm" = no; then + AC_CONFIG_SUBDIRS(library/store/XOTclGdbm/) + fi + AC_CONFIG_SUBDIRS(library/xml/TclExpat-1.1/) +else + test_actiweb="" + libdirs_actiweb="" + apps_actiweb="" +fi + +if test "$with_tk" = no; then with_xowish="" ; fi +if test "$with_xotclsh" = yes; then XOTCLSH="xotclsh" ; else XOTCLSH=""; fi +if test "$with_xowish" = yes; then XOWISH="xowish" ; else XOWISH=""; fi + + +#-------------------------------------------------------------------- +# __CHANGE__ +# Set your package name and version numbers here. The NODOT_VERSION is +# required for constructing the library name on systems that don't like +# dots in library names (Windows). The VERSION variable is used on the +# other systems. +#-------------------------------------------------------------------- + +# do not modify the following lines manually, they are generated with changeXOTclVersion +XOTCL_MAJOR_VERSION=1 +XOTCL_MINOR_VERSION=2 +XOTCL_RELEASE_LEVEL=.1 + +XOTCL_VERSION=${XOTCL_MAJOR_VERSION}.${XOTCL_MINOR_VERSION} +NODOT_VERSION=${XOTCL_MAJOR_VERSION}${XOTCL_MINOR_VERSION} + +AC_SUBST(XOTCL_VERSION) +AC_SUBST(XOTCL_MAJOR_VERSION) +AC_SUBST(XOTCL_MINOR_VERSION) +AC_SUBST(XOTCL_RELEASE_LEVEL) + +echo "Configuring XOTcl Version $PACKAGE_VERSION" + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + +TEA_PATH_TCLCONFIG +TEA_LOAD_TCLCONFIG + +#-------------------------------------------------------------------- +# check for TK +#-------------------------------------------------------------------- + +if test "$with_xowish" = yes; then + TEA_PATH_TKCONFIG + TEA_LOAD_TKCONFIG +# TEA_PUBLIC_TK_HEADERS +# TEA_PATH_X +fi + +#-------------------------------------------------------------------- +# Handle the --prefix=... option by defaulting to what Tcl gave. +# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. +#----------------------------------------------------------------------- + +TEA_PREFIX + +#----------------------------------------------------------------------- +# Standard compiler checks. +# This sets up CC by using the CC env var, or looks for gcc otherwise. +# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create +# the basic setup necessary to compile executables. +#----------------------------------------------------------------------- + +TEA_SETUP_COMPILER + +#-------------------------------------------------------------------- +# check for extra flags +# +# FORCE_NO_STUBS is deactivated for now +if ! test "$with_aol3" = "no"; then + echo "Pre-configuring AOL-Server (xotcl)" + AOL_DEFINES="-DAOL_SERVER -DUSE_TCL8X -I$with_aol3/include -I$TCL_SRC_DIR/generic" + FORCE_NO_STUBS=1 +else + AOL_DEFINES="" + FORCE_NO_STUBS=0 +fi + +#-------------------------------------------------------------------- +# check for tclCompile.h (needed, when compiled without full source) +if test -f "$TCL_SRC_DIR/generic/tclCompile.h"; then + HAVE_TCL_COMPILE_H="-DHAVE_TCL_COMPILE_H=1" +else + HAVE_TCL_COMPILE_H="" +fi + +#----------------------------------------------------------------------- +# __CHANGE__ +# Specify the C source files to compile in TEA_ADD_SOURCES, +# public headers that need to be installed in TEA_ADD_HEADERS, +# stub library C source files to compile in TEA_ADD_STUB_SOURCES, +# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. +# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS +# and PKG_TCL_SOURCES. +#----------------------------------------------------------------------- + + +TEA_ADD_SOURCES([xotcl.c xotclError.c xotclMetaData.c xotclObjectData.c xotclProfile.c \ + xotclTrace.c xotclUtil.c xotclShadow.c xotclCompile.c aolstub.c xotclStubInit.c]) +TEA_ADD_HEADERS([generic/xotcl.h generic/xotclInt.h]) +TEA_ADD_INCLUDES([]) +TEA_ADD_LIBS([]) +TEA_ADD_CFLAGS([-DXOTCLVERSION=\\\"$XOTCL_VERSION\\\" -DXOTCLPATCHLEVEL=\\\"$XOTCL_RELEASE_LEVEL\\\" \ + $AOL_DEFINES $HAVE_TCL_COMPILE_H]) +TEA_ADD_STUB_SOURCES([xotclStubLib.c]) +TEA_ADD_TCL_SOURCES([]) + + +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This must be done AFTER calling TEa_PATH_TCLCONFIG/TEA_LOAD_TCLCONFIG +# so that we can extract TCL_SRC_DIR from the config file (in the case +# of private headers +#-------------------------------------------------------------------- + +#TEA_PUBLIC_TCL_HEADERS +TEA_PRIVATE_TCL_HEADERS + +if test x"${with_tclinclude}" != x ; then + if test -f "${with_tclinclude}/tcl.h" ; then + TCL_INCLUDES="-I${with_tclinclude} ${TCL_INCLUDES}" + else + AC_MSG_ERROR([${with_tclinclude} directory does not contain Tcl header file tcl.h]) + fi +fi + +#-------------------------------------------------------------------- +# __CHANGE__ +# A few miscellaneous platform-specific items: +# +# Define a special symbol for Windows (BUILD_xotcl in this case) so +# that we create the export library with the dll. See sha1.h on how +# to use this. +# +# Windows creates a few extra files that need to be cleaned up. +# You can add more files to clean if your extension creates any extra +# files. +# +# Define any extra compiler flags in the PACKAGE_CFLAGS variable. +# These will be appended to the current set of compiler flags for +# your system. +#-------------------------------------------------------------------- + +if test "${TEA_PLATFORM}" = "windows" ; then + AC_DEFINE(BUILD_xotcl) + CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc50.pch vc60.pch" + #TEA_ADD_SOURCES([win/winFile.c]) + #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/w +else + CLEANFILES="*.o *.so *~ core gmon.out config.*" + #TEA_ADD_SOURCES([unix/unixFile.c]) + #TEA_ADD_LIBS([-lsuperfly]) +fi + + +AC_SUBST(CLEANFILES) + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +#-------------------------------------------------------------------- + +TEA_ENABLE_THREADS + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + +TEA_ENABLE_SHARED + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# can be taken from the tclConfig.sh file, but this figures it all out. +#-------------------------------------------------------------------- + +TEA_CONFIG_CFLAGS + +# Without the following two eval statements, XOTCL_SHARED_LIB_SUFFIX +# in xotclConfig.sh has $PACKAGE_VERSION unresolved. When another +# app links against xotcl, the PACKAGE_VERSIONs are confused. +# +# Without the first eval, we get +# XOTCL_SHARED_LIB_SUFFIX=${PACKAGE_VERSION}\$\{DBGX\}${SHLIB_SUFFIX} +# XOTCL_UNSHARED_LIB_SUFFIX=${PACKAGE_VERSION}\$\{DBGX\}.a +# +# after the first eval, we get +# XOTCL_SHARED_LIB_SUFFIX=1.2.1${DBGX}.so +# XOTCL_UNSHARED_LIB_SUFFIX=1.2.1${DBGX}.a +# after the second eval, all variables are resolved. + + +eval "SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" +eval "UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}" + +eval "SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" +eval "UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}" + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols +# option. +#-------------------------------------------------------------------- + +TEA_ENABLE_SYMBOLS + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. +#-------------------------------------------------------------------- + + +#if test "${TCL_MAJOR_VERSION}" = "8" -a "${TCL_MINOR_VERSION}" = "0"; then +# FORCE_NO_STUBS=1 +#fi + +if test "${FORCE_NO_STUBS}" = "0" ; then + AC_DEFINE(USE_TCL_STUBS) +fi + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, +# and TEA_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + +TEA_MAKE_LIB + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +#-------------------------------------------------------------------- + +TEA_PROG_TCLSH + +# +# XOTcl specific configs +# +XOTCL_BUILD_LIB_SPEC="-L`pwd` -lxotcl${PACKAGE_VERSION}" +XOTCL_LIB_SPEC="-L${exec_prefix}/lib -lxotcl${PACKAGE_VERSION}" + +# stub libs are not build for 8.0 +if test "${TCL_MAJOR_VERSION}" = "8" -a "${TCL_MINOR_VERSION}" = "0"; then + XOTCL_BUILD_STUB_LIB_SPEC="" + XOTCL_STUB_LIB_SPEC="" + XOTCL_BUILD_STUB_LIB_PATH="" + XOTCL_STUB_LIB_PATH="" +else + XOTCL_BUILD_STUB_LIB_SPEC="-L`pwd` -lxotclstub${PACKAGE_VERSION}" + XOTCL_STUB_LIB_SPEC="-L${exec_prefix}/lib -lxotclstub${PACKAGE_VERSION}" + XOTCL_BUILD_STUB_LIB_PATH="`pwd`/${PKG_STUB_LIB_FILE}" + XOTCL_STUB_LIB_PATH="${exec_prefix}/lib/${PKG_STUB_LIB_FILE}" + AC_DEFINE(COMPILE_XOTCL_STUBS) +fi + +AC_SUBST(SHARED_LIB_SUFFIX) +AC_SUBST(UNSHARED_LIB_SUFFIX) +AC_SUBST(XOTCL_BUILD_LIB_SPEC) +AC_SUBST(XOTCL_LIB_SPEC) +AC_SUBST(XOTCL_BUILD_STUB_LIB_SPEC) +AC_SUBST(XOTCL_STUB_LIB_SPEC) +AC_SUBST(XOTCL_BUILD_STUB_LIB_PATH) +AC_SUBST(XOTCL_STUB_LIB_PATH) +XOTCL_SRC_DIR=`pwd` +AC_SUBST(XOTCL_SRC_DIR) +AC_SUBST(XOTCLSH) +AC_SUBST(XOWISH) + +AC_SUBST(test_actiweb) +AC_SUBST(libdirs_actiweb) +AC_SUBST(apps_actiweb) + +AC_SUBST(TEA_PLATFORM) +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +#-------------------------------------------------------------------- + +AC_OUTPUT([Makefile xotclConfig.sh apps/utils/xotclsh apps/utils/xowish unix/xotcl.spec unix/pkgIndex.unix]) Index: xotcl/doc/Announce-0.9.3 =================================================================== diff -u --- xotcl/doc/Announce-0.9.3 (revision 0) +++ xotcl/doc/Announce-0.9.3 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,57 @@ +Announcing XOTcl 0.9.3 +********************** + +WHAT IS XOTCL? + + XOTcl is an object-oriented extension of Tcl that was derived from + OTcl. In short, XOTcl tries to provide a highly flexible, + reflective, component-based, and object-oriented environment. It + integrates language support for high level concepts which are not + found in other languages, with reasonable performance. It prevails + the Tcl programming style and the dynamic/introspective nature of + the language, rather than introducing other language's styles and + rigidness (such as C++) into Tcl. + + +RECENT CHANGES relative to 0.9 are: + + - A "more or less" TEA compliant build process and its + directory structure (aligend it as far as possible to Tcl, sample + extension and other extensions) + + * We started building an XOTcl stub lib. + + * We separated xotcl from its library/applications + (there is an xotcl- directory in the full distribution + that just builds, installs, etc. the XOTcl libraries ... this + can for instance be used in other distributions using and + shipping XOTcl, but not using the shells). + + * The full distribution still builds shells, but they are using + "package require" to load the XOTcl libraries now. + + * For building xowish (the XOTcl Tk shell) you do only require + an installed Tk version on Unix now. + + - On Windows we still use nmake due to problems with VCC 6.0 in + all TEA compliant extensions we have checked, but we use a + completely new build process (more or less one-to-one the + Unix build process). + + - A few minor bugfixes. + + - We have tested this release on platforms we have access to + (Linux, Win NT, Solaris). Please inform us, if there are some + problems on your platform so that we can eliminate them in future + releases. + +MORE INFO + General and more detailed information about XOTcl and its components + can be found at http://www.xotcl.org + + +Best regards, + +Gustaf Neumann +Uwe Zdun + Index: xotcl/doc/Announce-0.9.4 =================================================================== diff -u --- xotcl/doc/Announce-0.9.4 (revision 0) +++ xotcl/doc/Announce-0.9.4 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,100 @@ +Announcing XOTcl 0.9.4 +********************** + +WHAT IS XOTCL? + + XOTcl is an object-oriented extension of Tcl that was derived from + OTcl. In short, XOTcl tries to provide a highly flexible, + reflective, component-based, and object-oriented environment. It + integrates language support for high level concepts which are not + found in other languages, with reasonable performance. It prevails + the Tcl programming style and the dynamic/introspective nature of + the language, rather than introducing other language's styles and + rigidness (such as C++) into Tcl. + + +CHANGES relative to 0.9.3 are: + + - fixes: + + * separate reference counting for XOTcl objects and classes + to avoid references from tcl_obj's internal representation + to freed memory + + * fixes for AOL-Server (many thanks to Zoran Vasiljevic for + that and for his great help during fixing the problems above) + + * improved portability: horrible macro substitution + bug, when USE_ALLOCA or USE_MALLOC was specified; these + are used for some platforms such as AIX + + * fixing path search for XOTcl library (bug was introduced in + 0.9.3 in connection with TEA compliance) + + * fixed a bug in copy/move (many thanks for Artur Trzewik + for reporting this) in connection with constructors + (constructors are not called automatically in copy/move + operations anymore) + + * various small fixes in libraries (e.g. HTTP support, + generation of pkgIndex-files, using "my", ...) + + - enhancements: + + * new global command "my": + one can use now: + + Class Counter -parameter {{n 0}} + Counter instproc ++ {} { my incr n } + Counter instproc print {} { puts "actual value: [my n]"} + + Counter c1 + c1 ++ + c1 print + + In earlier versions it was neccessary to use "[self]" + instead of "my". This change reduces the number of + special characters in XOTcl programs. + "[self]" will continue to be supported by XOTcl. + + * extended semantics of "new" + + a) Object new ... + b) Object new -childof ... + c) Object new -volatile ... + d) Object new -volatile -childof ... + + where (a) creates now "global" objects not in the global + namespace anymore, but in the ::xotcl namespace, (b) can + be used to create objects as child of other objects + (e.g. as children of the actual object [self]; the objects + are deleted, when the specified object is deleted). (c) + creates are "global" objects as in (a), but they are + deleted, when the scope of the current + tcl-proc/object-proc/instproc is left and (d) is a + combination of (b) and (c). + + - optimizations: + + * XOTcl is trying to keep Tcl_Objs of type tclCmdNameType + instead of converting it to XOTclObjectType agressively. + + * A patch for Tcl 8.4a3 is available from the XOTcl web site + for performance hungry applications to provide special + byte-code-support for xotcl, that yields for classical + benchmark programs up to 40%. This patch is not likely to + be integrated into the general Tcl core in the new or + distant future. + + For more details, please consult the ChangeLog + +MORE INFO + General and more detailed information about XOTcl and its components + can be found at http://www.xotcl.org + + +Best regards, + +Gustaf Neumann +Uwe Zdun + Index: xotcl/doc/Announce-1.0 =================================================================== diff -u --- xotcl/doc/Announce-1.0 (revision 0) +++ xotcl/doc/Announce-1.0 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,51 @@ +Announcing XOTcl 1.0 +******************** + +WHAT IS XOTCL? + + XOTcl is an object-oriented extension of Tcl that was derived from + OTcl. In short, XOTcl tries to provide a highly flexible, + reflective, component-based, and object-oriented environment. It + integrates language support for high level concepts which are not + found in other languages, with reasonable performance. It prevails + the Tcl programming style and the dynamic/introspective nature of + the language, rather than introducing other language's styles and + rigidness (such as C++) into Tcl. + + +CHANGES relative to 0.9.4 are: + + - fixes: + + * various small fixes for compilation with tcl8.4.* + + * fixed some more memory-leaks that showed up in connection + with multi-threading (many thanks to Zoran Vasiljevic for + his great help) + + * removed a few panics() by tcl errors (important for servers) + + * various small fixes in Httpd-code + + * fixes in filter-search mechanism + + * the general cleanup method __exitHandler (called on + interpreter exits and on thread exits) defined now + as a proc of Object + + - optimizations: + + * speedup during recreation of objects + + For more details, please consult the ChangeLog + +MORE INFO + General and more detailed information about XOTcl and its components + can be found at http://www.xotcl.org + + +Best regards, + +Gustaf Neumann +Uwe Zdun + Index: xotcl/doc/Announce-1.0.1 =================================================================== diff -u --- xotcl/doc/Announce-1.0.1 (revision 0) +++ xotcl/doc/Announce-1.0.1 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,57 @@ +Announcing XOTcl 1.0.1 +********************** + +WHAT IS XOTCL? + + XOTcl is an object-oriented extension of Tcl that was derived from + OTcl. In short, XOTcl tries to provide a highly flexible, + reflective, component-based, and object-oriented environment. It + integrates language support for high level concepts which are not + found in other languages, with reasonable performance. It prevails + the Tcl programming style and the dynamic/introspective nature of + the language, rather than introducing other language's styles and + rigidness (such as C++) into Tcl. + + +CHANGES relative to 1.0 are: + + - fixes: + + * fixed installation bug on windows (when installed on + drives different to c:) + + * fixes for aolserver 3.5.* + + * fix for "object info default arg var" in connection + with filters + + * Serializer handles filter guards now + + - new functionality and improvements: + + * improved recreate semantics, makes it easier to + overload recreation logic. + + * new method "noinit" to create objects without + calling the constructor + + - optimizations: + + * general speedup (10 to 15%) by using client data of + namespace instead of Tcl_AssocData for interpreter state + + * faster and more flexible Serializer + + + For more details, please consult the ChangeLog + +MORE INFO + General and more detailed information about XOTcl and its components + can be found at http://www.xotcl.org + + +Best regards, + +Gustaf Neumann +Uwe Zdun + Index: xotcl/doc/Announce-1.0.2 =================================================================== diff -u --- xotcl/doc/Announce-1.0.2 (revision 0) +++ xotcl/doc/Announce-1.0.2 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,76 @@ +Announcing XOTcl 1.0.2 +********************** + +WHAT IS XOTCL? + + XOTcl is an object-oriented extension of Tcl that was derived from + OTcl. In short, XOTcl tries to provide a highly flexible, + reflective, component-based, and object-oriented environment. It + integrates language support for high level concepts which are not + found in other languages, with reasonable performance. It prevails + the Tcl programming style and the dynamic/introspective nature of + the language, rather than introducing other language's styles and + rigidness (such as C++) into Tcl. + + +CHANGES relative to 1.0.1 are: + + - fixes: + + * fixes for copying/moving objects to same name + + * works out of the box with AOL-server 4.0 + (no patch for AOL-server needed) + + * various small fixes and code cleanup + + * new directory structure (no nested version numbers) + + * improved object and class serializer + + - new functionality and improvements: + + * new method "ismixin": Test whether the argument is a + mixin or instmixin of the object. + + * new method "hasclass": Test whether the argument is either + a mixin or instmixin of the object or if it is on the class + hierarchy of the object. This method combines the + functionalities of istype and ismixin. + + * arguments of configure methods can start now + with a leading "-" without ambiguity. In previous versions + + Class C -parameter {name counter} + C c1 -name -x -counter 123 + + the configuration of c1 was interpreted as follows + + method argc + name 0 + x 0 + counter 1 + + Starting with XOTcl 1.0.2 arguments can be protected + by putting it into a list: + + C c1 [list -name -x] -counter 123 + + which is interpreted as follows: + + method argc + name 1 + counter 1 + + For more details, please consult the ChangeLog + +MORE INFO + General and more detailed information about XOTcl and its components + can be found at http://www.xotcl.org + + +Best regards, + +Gustaf Neumann +Uwe Zdun + Index: xotcl/doc/Announce-1.1.0 =================================================================== diff -u --- xotcl/doc/Announce-1.1.0 (revision 0) +++ xotcl/doc/Announce-1.1.0 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,87 @@ +Announcing XOTcl 1.1.0 +********************** + +WHAT IS XOTCL? + + XOTcl is an object-oriented extension of Tcl that was derived from + OTcl. In short, XOTcl tries to provide a highly flexible, + reflective, component-based, and object-oriented environment. It + integrates language support for high level concepts which are not + found in other languages, with reasonable performance. It prevails + the Tcl programming style and the dynamic/introspective nature of + the language, rather than introducing other language's styles and + rigidness (such as C++) into Tcl. + + +CHANGES relative to 1.0.2 are: + + - New functionality and improvements: + + * Transitive instmixins (thanks to a suggestion of Neophytos Demetriou): + The new version supports a tree of mixins (mixins of mixins); + when a mixin-class X has instmixins Y registered, and X is + registered as instmixin for a class C, the mixin classes Y are + applied to C as well. + + * Conditional mixins (thanks to a suggestion of Neophytos Demetriou): + mixins and instmixins can have now guards similar to filters + that define when they should be applied + + * New composition strategy for (filter- and mixin-)guards: + when a guard is defined more than once for the same interceptor + the most specific guard is used, the others are overridden. + + * Creation of sub-objects via parameter: + XOTcl's parameter method supports now a switch named "-Class" + which can be used to create and configure sub-objects (see + tutorial for details) + + * New predefined method: __unknown + This method is called, whenever XOTcl references a class, + which is not defined yet (e.g.: Class C -superclass UNKNOWNCLASS) + This method is used for Zoran's wonderful ttrace package + (for aolserver and tcl-Threads) + + * Improved documentation: + - extended tutorial (Meta-Classes, Tk, ...) + - beautified tutorial (style files, distinction between + literals and placeholders, ...) + - fixed hundreds of typos + + * some speed improvements + + + - fixes: + + * New build system: + - per default no shells are built + - new configure switches eg. --with-xotclsh, -with-actiweb + --with-all + + * Fixes for https in connection with some versions of IE + + * Fixed a few issues with purify and mt (many thanks to Zoran!) + + * Fixes for proc-scoped variable in connections with mixins + + * Fixed passing of error codes from constructors + + * various small fixes and code cleanup + - with newer versions of autoconf + - various fixes for stubs + - improved build under windows + - starkit compliance (many thanks to MichaelL@frogware.com) + + + For more details, please consult the ChangeLog + +MORE INFO + General and more detailed information about XOTcl and its components + can be found at http://www.xotcl.org + + +Best regards, + +Gustaf Neumann +Uwe Zdun + Index: xotcl/doc/Announce-1.1.1 =================================================================== diff -u --- xotcl/doc/Announce-1.1.1 (revision 0) +++ xotcl/doc/Announce-1.1.1 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,52 @@ +Announcing XOTcl 1.1.1 +********************** + +WHAT IS XOTCL? + + XOTcl is an object-oriented extension of Tcl that was derived from + OTcl. In short, XOTcl tries to provide a highly flexible, + reflective, component-based, and object-oriented environment. It + integrates language support for high level concepts which are not + found in other languages, with reasonable performance. It prevails + the Tcl programming style and the dynamic/introspective nature of + the language, rather than introducing other language's styles and + rigidness (such as C++) into Tcl. + + +CHANGES relative to 1.1.0 are: + + - Improved portability + * for Mac OS X (many thanks to Daniel Steffen) + * freebsd 4.9 (many thanks to Marc Spitzer) + + - configure can run outside of xotcl-tree and + can install to a different directory. Example: + + % mkdir -p /tmp/xotcl/unix + % cd /tmp/xotcl/unix + % ~/xotcl-1.1.1/unix/configure --with-all + % make + % make test + % make install DESTDIR=/tmp + + - several fixes and improvements such as + * added option --with-tkinclude for configure + (only needed, when built with optional --with-xowish) + * made gdbm work when compiled with threads enabled + * fix for initialization of stubtables in gdbm + * fixes for HTTP support (return format of values in + HTTP OPTION command made windows explorer hang) + * easy provision for redirects in HTTP server + + For more details, please consult the ChangeLog + +MORE INFO + General and more detailed information about XOTcl and its components + can be found at http://www.xotcl.org + + +Best regards, + +Gustaf Neumann +Uwe Zdun + Index: xotcl/doc/Announce-1.2.0 =================================================================== diff -u --- xotcl/doc/Announce-1.2.0 (revision 0) +++ xotcl/doc/Announce-1.2.0 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,199 @@ +Announcing XOTcl 1.2.0 +********************** + +WHAT IS XOTCL? + + XOTcl is an object-oriented extension of Tcl that was derived from + OTcl. In short, XOTcl tries to provide a highly flexible, + reflective, component-based, and object-oriented environment. It + integrates language support for high level concepts which are not + found in other languages, with reasonable performance. It prevails + the Tcl programming style and the dynamic/introspective nature of + the language, rather than introducing other language's styles and + rigidness (such as C++) into Tcl. + + +CHANGES relative to 1.1.1 are: + + - Qualitative Improvements + * improved performance (up to more than 30% faster) + * reduced dependency on Tcl internals (stack rewritings removed) + * less C-code (code reduction of about 500 lines c code) + * defined macros to access Tcl's internal structures + Due to the speedup, an emulation of an itcl like language + in XOTcl can be faster than itcl itself (see below). + + - Functional Improvements + * new subcommands of self: + self callinglevel: returns the scope of the proc/instproc + calling the current method (ignoring filters and next) + self activelevel: returns the scope of the proc/instproc + preceding the current method (might be a next call, + ignoring filters) + the returned level can be used in uplevel/upvar as first argument + + * new methods upvar/uplevel + "my uplevel set x 1" is a short form of "uplevel [self callinglevel] set x 1" + + * sub-objects can be called like methods (potential incompatibility) + If an object named o has a sub-object q (i.e. o::q) it is now + possible to invoke the sub-object via "o q ?method args?". This change + makes it possible to + + - to redefine tcl sub-commands via procs/instprocs by defining + the command with subcommands as an object (instead of defining + a command as a proc and its subcommands via a large + and hard-to-refine switch statement) + + - to use the same approach for defining subcommands of subcommands + (and so on) in the same way; it would be possible to define e.g. + the xotcl info methods via an object), + + - to use interceptors (filters/mixins) for some or all subcommands (maybe you + are only interested in "file delete") + + - to extend a tcl command on the fly by defining new subcommands + (by defining new procs/instprocs) + + - to use the unknown mechanism to produce dynamic error messages + about valid subcommands (via introspection commands). + + As a simple example, one define the a specialized version of Tcl's + file-command (say ns::file) like the following: + + namespace eval ns { + Object file + file proc tail name { + set tail [file tail $name] + regexp {[^/\\]+$} $tail tail + return $tail + } + file proc unknown {subcmd args} { + return eval ::file $subcmd $args + } + } + + For more details, please consult the ChangeLog + +MORE INFO + General and more detailed information about XOTcl and its components + can be found at http://www.xotcl.org + + +Best regards, + +Gustaf Neumann +Uwe Zdun + +#======================================================================= +# extract from the logfile of oobench (in oo-bench.tar.gz, +# see http://media.wu-wien.ac.at/download.html) + +XOTcl + methcall: 0.470u 0.000s 0:00.41 114.6% 0+0k 0+0io 347pf+0w +ITcl emulation in XOTcl + methcall: 0.590u 0.000s 0:00.62 95.1% 0+0k 0+0io 351pf+0w +itcl + methcall: 0.870u 0.020s 0:00.92 96.7% 0+0k 0+0io 347pf+0w + + +#======================================================================= +package require XOTcl; namespace import -force xotcl::* + +########################################################### +## Small example to emulate a itcl-like language in XOTcl +## -gustaf neumann Jan. 2004 +########################################################### +namespace eval itcl { + Class create class -superclass Class + class instproc instvars {} { + set vars [list]; set c [self] + for {} {[string compare ::xotcl::Object $c]} {set c [$c info superclass]} { + eval lappend vars [$c set __autovars] + } + return "\n\tmy instvar [lsort -unique $vars]" + } + class proc constructor {args} { + if {[llength $args]==2} { + foreach {arglist body} $args break + } else { + foreach {arglist construct body} $args break + set body $construct\n$body + } + my parameter [list {this [self]}] + my proc constructor args {uplevel next $args} + my instproc init $arglist [my instvars]\n$body + } + class proc method {name arglist body} { + my proc $name args {uplevel next $args} + my instproc $name $arglist [my instvars]\n$body + } + class proc inherit {class} { + my superclass $class + } + class proc variable {arglist} { + foreach v $arglist {my lappend __autovars $v} + } + class instproc init {classdef} { + my set __autovars this + namespace eval [self class] $classdef + my class Class + } +} + +########################################################### +# Two Demo classes from oo-bench +########################################################### +itcl::class Toggle { + variable state + constructor {start_state} { + set state $start_state + } + method value {} { + return $state + } + + method activate {} { + set state [expr {!$state}] + return $this + } +} + +itcl::class NthToggle { + inherit Toggle + variable count_max + variable counter + constructor {start_state max_counter} { + Toggle::constructor $start_state + } { + set count_max $max_counter + set counter 0 + } + method activate {} { + if {[incr counter] >= $count_max} { + Toggle::activate + set counter 0 + } + return $this + } +} + + +proc main {} { + set n [lindex $::argv 0] + set val 1 + set toggle [Toggle t1 $val] + for {set i 0} {$i < $n} {incr i} { + set val [[$toggle activate] value] + } + if {$val} {puts "true"} else {puts "false"} + + set val 1 + set ntoggle [NthToggle t2 1 3] + for {set i 0} {$i < $n} {incr i} { + set val [[$ntoggle activate] value] + } + if {$val} {puts "true"} else {puts "false"} +} + +main Index: xotcl/doc/JufGdbmStorage-xotcl.html =================================================================== diff -u --- xotcl/doc/JufGdbmStorage-xotcl.html (revision 0) +++ xotcl/doc/JufGdbmStorage-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,45 @@ + + + + + XOTcl - Documentation -- ./library/store/JufGdbmStorage.xotcl + + + +

+ ./library/store/JufGdbmStorage.xotcl + ./library/store/JufGdbmStorage.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::store::jufgdbm 0.81 +
+ Package required: xotcl::store::juf_gdbm +
+ Package required: xotcl::store +
+
+ Filename: + + ./library/store/JufGdbmStorage.xotcl + +
+
+ +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/MemStorage-xotcl.html =================================================================== diff -u --- xotcl/doc/MemStorage-xotcl.html (revision 0) +++ xotcl/doc/MemStorage-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,43 @@ + + + + + XOTcl - Documentation -- ./library/store/MemStorage.xotcl + + + +

+ ./library/store/MemStorage.xotcl + ./library/store/MemStorage.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::store::mem 0.84 +
+ Package required: xotcl::store 0.84 +
+
+ Filename: + + ./library/store/MemStorage.xotcl + +
+
+ +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/MultiStorage-xotcl.html =================================================================== diff -u --- xotcl/doc/MultiStorage-xotcl.html (revision 0) +++ xotcl/doc/MultiStorage-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,43 @@ + + + + + XOTcl - Documentation -- ./library/store/MultiStorage.xotcl + + + +

+ ./library/store/MultiStorage.xotcl + ./library/store/MultiStorage.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::store::multi 0.9 +
+ Package required: xotcl::store 0.84 +
+
+ Filename: + + ./library/store/MultiStorage.xotcl + +
+
+ +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/Persistence-xotcl.html =================================================================== diff -u --- xotcl/doc/Persistence-xotcl.html (revision 0) +++ xotcl/doc/Persistence-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,365 @@ + + + + + XOTcl - Documentation -- ./library/store/Persistence.xotcl + + + +

+ ./library/store/Persistence.xotcl + ./library/store/Persistence.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::store::persistence 0.8 +
+ Package required: xotcl::trace +
+ Package required: xotcl::package +
+ Package required: xotcl::mixinStrategy +
+ Package required: xotcl::store +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./library/store/Persistence.xotcl + +
+
+ + + + + +
+ Description: + + + Persistent store for XOTcl objects with Eager and Lazy persistence. + Take a look at "persistenceExample.xotcl" for exmaple of usage. + +
+
+
+

+ + + +

Class: PersistenceMgr

+ Class: Class +
+ + + + + + + +
+ Description: + + + A persistent store requires a persistent manager. The persistent + manager implements the Storage interface via storage mixin. With + the parameter "dbPackage" we can specify which storage will be used. + The persistent manager than tries to load the package + "xotcl::${dbPackage}Storage". Default is Sdbm. + + Example: +
+    PersistenceMgr pmgr -persistenceDir . -persistenceFile example-db
+    
+ + +
+

+
+

+ + + +

Class: Persistent

+ Class: Class +
+ Procs/Instprocs: + makeVarScript, persistenceMgr, persistent, persistent+init, persistentVars, unPersistent. + + + + + +
+ Description: + + + Superclass or mixin class for all persistent objects. Normally + subclasses are used as mixins or instmixins on object, like: +
+      o mixin Persistent=Eager
+      p mixin Persistent=Lazy
+    
+ +
+

Instprocs

+
    +
  • + + + + persistenceMgr + args + + + + + + + + + + +
    + Arguments: + + args: persistent manager name +
    + Description: + + + Specify which persistence manager to use for [self] object, like: +
    +      o persistenceMgr pmgr
    +    
    + Each persistent object must have a persistence manager specified, + before vars can be made persistent. + +
    +
  • +
  • + + + + persistentVars + + + + + + +
    + Description: + + + Returns list of persistent vars. + +
    +
  • +
  • + + + + persistent + list + + + + + + + + + + +
    + Arguments: + + list: persistent variables +
    + Description: + + + Make a list of object variables persistent. If a persistent + DB exists, the values are read from this DB, overwriting the current value. + E.g.: +
    +     o persistent {x y}
    +    
    + + +
    +
  • +
  • + + + + persistent+init + list + + + + + + + + + + +
    + Arguments: + + list: persistent variables +
    + Description: + + + Initialize all data in the list as empty strings, + if they do not exist yet, and then make them persistent + using the 'persistent' method + +
    +
  • +
  • + + + + unPersistent + list + + + + + + + + + + +
    + Arguments: + + list: persistent variables +
    + Description: + + + Make a list of object variables not persistent. + +
    +
  • +
  • + + + + makeVarScript + + + + + + +
    + Description: + + + Build a Tcl script of "set ..." statements reflecting the current situation in the database. + +
    +
  • +
+

+
+

+ + + +

Class: Persistent=Eager

+ Class: Class +
+ + + + + + + +
+ Description: + + + Eager persistence strategy. Store everything at the same moment to the database + +
+

+
+

+ + + +

Class: Persistent=Lazy

+ Class: Class +
+ + + + + + + +
+ Description: + + + Lazy persistence strategy. Store everything on object destroy (or program termination. + +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/Script-xotcl.html =================================================================== diff -u --- xotcl/doc/Script-xotcl.html (revision 0) +++ xotcl/doc/Script-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,92 @@ + + + + + XOTcl - Documentation -- ./library/lib/Script.xotcl + + + +

+ ./library/lib/Script.xotcl + ./library/lib/Script.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::script 0.9 +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./library/lib/Script.xotcl + +
+
+ + + + + +
+ Description: + + + A small package to instantiate an object, that + represents a script. + +
+
+
+

+ + + +

Class: Script

+ Class: Class +
+ + + + + + + +
+ Description: + + + An object of type Script becomes automatically the command + line arguments evaluated as "-" method calls during creation, e.g. +
+      Script s -set r 5
+    
+ and a call with cmd-line "-set v 6" of the script, results in an + object s with two vars set: r to 5, and v to 6. + +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/Serializer-xotcl.html =================================================================== diff -u --- xotcl/doc/Serializer-xotcl.html (revision 0) +++ xotcl/doc/Serializer-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,278 @@ + + + + + XOTcl - Documentation -- ./library/serialize/Serializer.xotcl + + + +

+ ./library/serialize/Serializer.xotcl + ./library/serialize/Serializer.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl 1.0 +
+ Package provided: xotcl::serializer 0.3 +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./library/serialize/Serializer.xotcl + +
+
+ + + + + + + + + + + + + +
+ Description: + + + This package provides the class Serializer, which can be used to + generate a snapshot of the current state of the workspace + in the form of XOTcl source code. + +
+ Authors: + + + Gustaf Neumann, Gustaf.Neumann@wu-wien.ac.at + +
+ Date: + + $Date: 2004/05/23 22:50:39 $ +
+
+
+

+ + + +

Class: Serializer

+ Procs/Instprocs: + all, deepSerialize, serialize. + +
+

Instprocs

+
    +
  • + + + + serialize + entity + + + + + + + + + + + + + + +
    + Arguments: + + entity: Object or Class +
    + Description: + + + Serialize the specified object or class. + +
    + Return: + + Object or Class with all currently defined methods, + variables, invariants, filters and mixins +
    +
  • +
+

Procs

+
    +
  • + + + + all + ?-ignoreVarsRE RE? + ?-ignore obj1 obj2 ...? + + + + + + + + + + + + + + + + + + +
    + Arguments: + + ?-ignoreVarsRE RE?: provide regular expression; matching vars are ignored +
    + + + ?-ignore obj1 obj2 ...?: provide a list of objects to be omitted +
    + Description: + + + Serialize all objects and classes that are currently + defined (except the specified omissions and the current + Serializer object). +

    Examples:
    + Serializer all -ignoreVarsRE {::b$}
    + do not serialize any instance variable named b (of any object)

    + Serializer all -ignoreVarsRE {^::o1::.*text.*$|^::o2::x$}
    + do not serialize any variable of c1 whose name contains + the string "text" and do not serialze the variable x of o2

    + Serializer all - ignore obj1 obj2 ...
    + do not serizalze the specified objects + +

    + Return: + + script +
    +
  • +
  • + + + + deepSerialize + objs + ?-ignoreVarsRE RE? + ?-ignore obj1 obj2 ...? + ?-map list? + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Arguments: + + objs: Objects to be serialized +
    + + + ?-ignoreVarsRE RE?: provide regular expression; matching vars are ignored +
    + + + ?-ignore obj1 obj2 ...?: provide a list of objects to be omitted +
    + + + ?-map list?: translate object names in serialized code +
    + Description: + + + Serialize object with all child objects (deep operation) + except the specified omissions. For the description of + ignore and igonoreVarsRE see + Serizalizer all. map can be used + in addition to provide pairs of old-string and new-string + (like in the tcl command string map). This option + can be used to regenerate the serialized object under a different + object or under an different name, or to translate relative + object names in the serialized code.

    + + Examples: + Serializer deepSerialize ::a::b::c -map {::a::b ::x::y}
    + Serialize the object c which is a child of a::b; + the object will be reinitialized as object ::x::y::c, + all references ::a::b will be replaced by ::x::y.

    + + Serializer deepSerialize ::a::b::c -map {::a::b [self]}
    + The serizalized object can be reinstantiated under some current object, + under which the script is evaluated.

    + + Serializer deepSerialize ::a::b::c -map {::a::b::c ${var}}
    + The serizalized object will be reinstantiated under a name specified + by the variable var in the recreation context. + +

    + Return: + + script +
    +
  • +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/Storage-xotcl.html =================================================================== diff -u --- xotcl/doc/Storage-xotcl.html (revision 0) +++ xotcl/doc/Storage-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,397 @@ + + + + + XOTcl - Documentation -- ./library/store/Storage.xotcl + + + +

+ ./library/store/Storage.xotcl + ./library/store/Storage.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::store 0.84 +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./library/store/Storage.xotcl + +
+
+ + + + + + + + + +
+ Description: + + + Simple generic storage interface for hashtable-like (persistent) + storages. There are several different existing stores, including + a memory storage, a GDBM storage, a SDBM storage, and a + TextFile storage. + +
+ Date: + + $Date: 2004/05/23 22:50:39 $ +
+
+
+

+ + + +

Class: Storage

+ Class: Class +
+ Procs/Instprocs: + close, exists, firstkey, names, nextkey, open, set, someNewChildStore, unset. + + + + + +
+ Description: + + + Abstract storage interface class (superclass of all storages). + +
+

Instprocs

+
    +
  • + + + + open + filename + + + + + + + + + + + + + + +
    + Arguments: + + filename: database filename (or filename base, if more + than one file has to be created) +
    + Description: + + + Each storage object represents exactly one database table. The db + has to be opened, before it can it used. If it is not opened all + other methods return errors. + +
    + Return: + + empty string +
    +
  • +
  • + + + + close + + + + + + + + + + +
    + Description: + + + Close associated database. + +
    + Return: + + empty string +
    +
  • +
  • + + + + exists + key + + + + + + + + + + + + + + +
    + Arguments: + + key: Key to be searched for. +
    + Description: + + + Search for a key whether it exists or not. + +
    + Return: + + 1, if key exists in the database, otherwise 0 +
    +
  • +
  • + + + + set + key + ?value? + + + + + + + + + + + + + + + + + + +
    + Arguments: + + key: Key to be set. +
    + + + ?value?: Optional value that might be set +
    + Description: + + + Set or query a database key in the same way as Tcl's set functions. + +
    + Return: + + Key value. +
    +
  • +
  • + + + + unset + key + + + + + + + + + + + + + + +
    + Arguments: + + key: Key to be unset. +
    + Description: + + + Unset a database key in the same way as Tcl's unset functions. + +
    + Return: + + empty string +
    +
  • +
  • + + + + names + + + + + + + + + + +
    + Description: + + + Return a list of keys in the database (functions in the same + way as Tcl's array names) + +
    + Return: + + List of keys in the db. +
    +
  • +
  • + + + + firstkey + + + + + + + + + + +
    + Description: + + + Start a traversal of the database, starting with any key. + +
    + Return: + + Name of first key. +
    +
  • +
  • + + + + nextkey + + + + + + + + + + +
    + Description: + + + Proceed with the db traversal. Requires a firstkey before + first usage, otherwise it returns an error. + +
    + Return: + + Name of next key, if one exists. Otherwise an empty string is returned. +
    +
  • +
+

Procs

+
    +
  • + + + + someNewChildStore + + + + + + + + + + +
    + Description: + + + Create a childStore according to a preference list depending on + which storages are available. Currently the preference list has + the following order: Gdbm, Sdbm and TextFile. + +
    + Return: + + name of the created storage object. +
    +
  • +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/TclGdbmStorage-xotcl.html =================================================================== diff -u --- xotcl/doc/TclGdbmStorage-xotcl.html (revision 0) +++ xotcl/doc/TclGdbmStorage-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,45 @@ + + + + + XOTcl - Documentation -- ./library/store/TclGdbmStorage.xotcl + + + +

+ ./library/store/TclGdbmStorage.xotcl + ./library/store/TclGdbmStorage.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::store::tclgdbm 0.84 +
+ Package required: xotcl::store::gdbm +
+ Package required: xotcl::store +
+
+ Filename: + + ./library/store/TclGdbmStorage.xotcl + +
+
+ +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/TextFileStorage-xotcl.html =================================================================== diff -u --- xotcl/doc/TextFileStorage-xotcl.html (revision 0) +++ xotcl/doc/TextFileStorage-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,43 @@ + + + + + XOTcl - Documentation -- ./library/store/TextFileStorage.xotcl + + + +

+ ./library/store/TextFileStorage.xotcl + ./library/store/TextFileStorage.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::store::textfile 0.84 +
+ Package required: xotcl::store +
+
+ Filename: + + ./library/store/TextFileStorage.xotcl + +
+
+ +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/UNIVERSAL-xotcl.html =================================================================== diff -u --- xotcl/doc/UNIVERSAL-xotcl.html (revision 0) +++ xotcl/doc/UNIVERSAL-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,71 @@ + + + + + XOTcl - Documentation -- ./apps/actiweb/univ/UNIVERSAL.xotcl + + + +

+ ./apps/actiweb/univ/UNIVERSAL.xotcl + ./apps/actiweb/univ/UNIVERSAL.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+ Package required: xotcl::actiweb::webDocument +
+ Package required: xotcl::rdf::parser +
+ Package required: xotcl::rdf::triple +
+ Package required: xotcl::xml::printVisitor +
+
+ Filename: + + ./apps/actiweb/univ/UNIVERSAL.xotcl + +
+
+ + + + + +
+ Description: + + + This is a demo of a Webserver that presents the contents of + an RDF source file in a friendly and easy readable manner. +

+ The RDF file is parsed first into triples which + are added to the resource database RDFdb. This RDFdb used in this + example replaces the standard triple database of xoRDF by an + application specific version, which is easier to process. The triple + database is the source of the Catalog, which displays a short, easy to read + summary of the entries. The database is used as well for the "detailed + view", which presents all the data of the triples through nested HTML tables. +

+ The demo program uses either HTTP or HTTPS (in which case you will require + the SSL/TLS extension of Tcl). + +

+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/adapter-xotcl.html =================================================================== diff -u --- xotcl/doc/adapter-xotcl.html (revision 0) +++ xotcl/doc/adapter-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,53 @@ + + + + + XOTcl - Documentation -- ./apps/scripts/adapter.xotcl + + + +

+ ./apps/scripts/adapter.xotcl + ./apps/scripts/adapter.xotcl

+
+

+

Package/File Information

+ No package provided/required +
+
+ Filename: + + ./apps/scripts/adapter.xotcl + +
+
+ + + + + +
+ Description: + + + Simple adapter pattern meta-class taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/adapterExample-xotcl.html =================================================================== diff -u --- xotcl/doc/adapterExample-xotcl.html (revision 0) +++ xotcl/doc/adapterExample-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,53 @@ + + + + + XOTcl - Documentation -- ./apps/scripts/adapterExample.xotcl + + + +

+ ./apps/scripts/adapterExample.xotcl + ./apps/scripts/adapterExample.xotcl

+
+

+

Package/File Information

+ No package provided/required +
+
+ Filename: + + ./apps/scripts/adapterExample.xotcl + +
+
+ + + + + +
+ Description: + + + Simple adapter pattern example class (FTP requests) taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/cascaded-message-filter.gif =================================================================== diff -u Binary files differ Index: xotcl/doc/changeXOTclVersion-xotcl.html =================================================================== diff -u --- xotcl/doc/changeXOTclVersion-xotcl.html (revision 0) +++ xotcl/doc/changeXOTclVersion-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + + + + + XOTcl - Documentation -- ./library/lib/changeXOTclVersion.xotcl + + + +

+ ./library/lib/changeXOTclVersion.xotcl + ./library/lib/changeXOTclVersion.xotcl

+
+

+

Package/File Information

+ No package provided/required +
+
+ Filename: + + ./library/lib/changeXOTclVersion.xotcl + +
+
+ +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/composite-xotcl.html =================================================================== diff -u --- xotcl/doc/composite-xotcl.html (revision 0) +++ xotcl/doc/composite-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,53 @@ + + + + + XOTcl - Documentation -- ./apps/scripts/composite.xotcl + + + +

+ ./apps/scripts/composite.xotcl + ./apps/scripts/composite.xotcl

+
+

+

Package/File Information

+ No package provided/required +
+
+ Filename: + + ./apps/scripts/composite.xotcl + +
+
+ + + + + +
+ Description: + + + Simple composite pattern meta-class taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/compositeExample-xotcl.html =================================================================== diff -u --- xotcl/doc/compositeExample-xotcl.html (revision 0) +++ xotcl/doc/compositeExample-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,54 @@ + + + + + XOTcl - Documentation -- ./apps/scripts/compositeExample.xotcl + + + +

+ ./apps/scripts/compositeExample.xotcl + ./apps/scripts/compositeExample.xotcl

+
+

+

Package/File Information

+ No package provided/required +
+
+ Filename: + + ./apps/scripts/compositeExample.xotcl + +
+
+ + + + + +
+ Description: + + + Simple Graphics example of the composite pattern taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. They demonstrate instfilters, + filter chains and filter inheritance. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/features.gif =================================================================== diff -u Binary files differ Index: xotcl/doc/filter-inheritance.gif =================================================================== diff -u Binary files differ Index: xotcl/doc/ftp-xotcl.html =================================================================== diff -u --- xotcl/doc/ftp-xotcl.html (revision 0) +++ xotcl/doc/ftp-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,51 @@ + + + + + XOTcl - Documentation -- ./apps/comm/ftp.xotcl + + + +

+ ./apps/comm/ftp.xotcl + ./apps/comm/ftp.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+ Package required: xotcl::comm::ftp +
+
+ Filename: + + ./apps/comm/ftp.xotcl + +
+
+ + + + + +
+ Description: + + A tiny FTP client +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/htmllib-xotcl.html =================================================================== diff -u --- xotcl/doc/htmllib-xotcl.html (revision 0) +++ xotcl/doc/htmllib-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,74 @@ + + + + + XOTcl - Documentation -- ./library/lib/htmllib.xotcl + + + +

+ ./library/lib/htmllib.xotcl + ./library/lib/htmllib.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::htmllib 0.1 +
+ Package required: XOTcl +
+
+ Filename: + + ./library/lib/htmllib.xotcl + +
+
+ + + + + + + + + + + + + +
+ Description: + + + This package provides the class HtmlBuilder, which can be used to + generate HTML documents, or a part of a document. + +
+ Authors: + + + Antti Salonen, as@fishpool.fi + +
+ Date: + + + $Date: 2004/05/23 22:50:39 $ + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/index.html =================================================================== diff -u --- xotcl/doc/index.html (revision 0) +++ xotcl/doc/index.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,35 @@ + + +The Extended Object Tcl (XOTcl) Documentation contains the +following parts: + +

XOTcl Language Documentation

+ + +

Package and Script Documentation

+
+ This section of the documentation is under work... +
+ + +

+ +

Tcl Online Information

+ + + Index: xotcl/doc/langRef-xotcl.html =================================================================== diff -u --- xotcl/doc/langRef-xotcl.html (revision 0) +++ xotcl/doc/langRef-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,3227 @@ + + + + + XOTcl - Documentation -- ./doc/langRef.xotcl + + + +

+ ./doc/langRef.xotcl + ./doc/langRef.xotcl

+
+

+

Package/File Information

+ Package provided: XOTcl-langRef 1.2 +
+ Package required: Tcl +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./doc/langRef.xotcl + +
+
+ + + + + + + + + + + + + +
+ Description: + + + XOTcl language reference. Describes predefined objects and classes. + +
+ Predefined primitives: + + + XOTcl contains three predefined primitives: +

+ self computes callstack related information. + It can be used in the following ways: +

    +
  • self - returns the name + of the object, which is currently in execution. If it is + called from outside of a proc, it returns the + error message ``Can't find self''. +
  • self class - the self + command with a given argument class returns the name of the + class, which holds the currently executing instproc. Note, that this + may be different to the class of the current object. If it is called + from a proc it returns an empty string. +
  • self proc - the self command with a given argument + proc returns the name of the currently executing proc or + instproc. +
  • self callingclass: Returns class name of the + class that has called the executing method. +
  • self callingobject: Returns object name of + the object that has called the executing method. +
  • self callingproc: Returns proc name of + the method that has called the executing method. +
  • self calledclass: Returns class name of the + class that holds the target proc (in mixins and filters). +
  • self calledproc: Returns method + name of the target proc (only applicable + in a filter). +
  • self next: Return the + "next" method on the path as a string. +
  • self filterreg: In a filter: returns the name + of the object/class on which the filter is registered. Returns either + 'objName filter filterName' or 'className instfilter filterName'. + +
  • self callinglevel: Returns the calling level, from where + the actual proc was called from. Intermediary next calls are ignored + in this computation. The level is returned in a form + it can be used as first argument in uplevel or upvar. + +
  • self activelevel: Returns the level, from where + the actual proc was invoked from. This might be the calling level or a next + call, whatsever is higher in the stack. The level is returned in a form + it can be used as first argument in uplevel or upvar. + + +
+

+ my someMethod is a short form for [self] someMethod and can only be + called in a context of an instproc or an method specific proc. It allows certain + optimizations and shorter to write. +

+ next executes the "next" method on the precedence + order and return with the result. +

+ + +
+ Date: + + $Date: 2004/05/23 22:50:39 $ +
+
+
+

+ + + +

Class: Class

+ Class: Class +
+ Heritage: Object +
+ Procs/Instprocs: + __unknown, alloc, create, info, instdestroy, instfilter, instfilterappend, instfilterguard, instinvar, instmixin, instmixinappend, instparametercmd, instproc, insttclcmd, new, parameter, parameterclass, recreate, superclass, unknown, volatile. + + + + + +
+ Description: + + + This meta-class holds the pre-defined methods available for all XOTcl + classes. + +
+

Instprocs

+
    +
  • + + + + alloc + obj + ?args? + + + + + + + + + + + + + + + + + + +
    + Arguments: + + obj: new obj/class name +
    + + + ?args?: arguments passed to the new class after creation +
    + Description: + + + Allocate memory for a new XOTcl object or class. create uses + alloc to allocate memory. But create also + calls init and evaluates '-' arguments as method calls. + In seldom cases the programmer may want to suppress the + create + mechanism and just allocate memory. Then alloc can + be used. + +
    + Return: + + new class name +
    +
  • +
  • + + + + create + objName + ?args? + + + + + + + + + + + + + + + + + + +
    + Arguments: + + objName: name of a new class or object +
    + + + ?args?: arguments passed to the constructor +
    + Description: + + + Create user-defined classes or objects. If the class is a meta-class, + a class is created, otherwise an object. + + Create firstly calls alloc in order to allocate memory for the + new object. Then default values for parameters are searched on + superclasses (an set if found). Then args is searched for args + starting with '-' followed by an alpha character. These arguments + are called as methods. '-' followed by a numerical is interpreted + as a negative number (and not as a method). If a value of a method + called this way starts with a "a", the call can be placed safely + into a list (e.g. "Class c [-strangearg -a-] -simplearg 2"). + + Finally the constructor init is called on the object + with all arguments up to the first '-' arg.

    + + The create method is called implicitly through the + unknown + mechanism when a class (meta-class) is called with an unknown + method. E.g. the following two commands are equivalent + +

     Car herby -color red 
    +           Car create herby -color red 
    + + When a users may want to call the constructor init + before other '-' methods, one can specify '-init' + explicitly in the left to + right order of the '-' method. Init is called always only once. + e.g.:
     Class Car -init -superclass Vehicle 
    + +
    + Return: + + name of the created instance (result of alloc) +
    +
  • +
  • + + + + info + args + + + + + + + + + + + + + + +
    + Arguments: + + args: info options +
    + Description: + + + Introspection of classes. All options available for objects + (see info object) is also available + for classes. + The following options can be specified: +
      +
    • ClassName info classchildren: + Returns the list of nested classes with fully qualified names. + +
    • ClassName info classparent: + Returns the class ClassName is nesting to. + +
    • ClassName info instdefault method arg var: + Returns 1 if the argument arg of the instance method + method has a default value, otherwise 0. If it exists + the default value is stored in var. + +
    • ClassName info instfilter: + Returns the list of registered filters. With -guard modifier + all instfilterguards are integrated + ( ClassName info instfilter -guards). + +
    • objName info instfilterguard name: Returns the guards + for instfilter identified by name. + +
    • ClassName info heritage ?pattern?: + Returns a list of all classes in the precedence order + of the class hierarchy. + If pattern is specified, only matching values are returned. + +
    • ClassName info instances ?pattern?: + Returns a list of the instances of the class. + If pattern is specified, only matching values are returned. + +
    • ClassName info instargs method: + Returns the arguments of the specified method. + +
    • ClassName info instbody method: + Returns the body of the specified method. + +
    • ClassName info instcommands ?pattern?: + Returns all commands defined for the class. If pattern + is specified it returns all commands that match the pattern. + +
    • ClassName info instinvar: + Returns class invariants. + +
    • ClassName info instmixin: + Returns the list of instmixins of this class. + +
    • ClassName info instpost methodName: + Returns post assertions of methodName. + +
    • ClassName info instpre methodName: + Returns pre assertions of methodName. + +
    • ClassName info instprocs ?pattern?: + Returns all instprocs defined for the class. If pattern + is specified it returns all instprocs that match the pattern. + +
    • ClassName info parameter: + Returns parameter list. + +
    • ClassName info subclass ?subclassname?: + Returns a list of all subclasses of the class, if subclassname + was not specified, otherwise it returns 1 if subclassname is a + subclass and 0 if not. + +
    • ClassName info superclass ?superclassname?: + Returns a list of all super-classes of the class, + if superclassname was not specified, otherwise it returns + 1 if superclassname is a superclass and 0 if not. +
    + +
    + Return: + + Value of introspected option as a string. +
    +
  • +
  • + + + + instdestroy + obj + ?args? + + + + + + + + + + + + + + + + + + +
    + Arguments: + + obj: obj/class name +
    + + + ?args?: arguments passed to the destructor +
    + Description: + + + Standard destructor. Destroys XOTcl object physically from the memory. + Can be overloaded for customized destruction process. +

    + In XOTcl objects are not directly destroyed, when a destroy is + encountered in a method. Beforehand, the interpreter looks up whether + the object is still referenced on the method callstack or not. If not, + the object is directly destroyed. Otherwise every occurrence of the + object on the callstack is marked as destroyed. During popping of the + callstack, for each object marked as destroyed, the reference count is + decremented by one. When no more references to the object are on the + callstack the object is physically destroyed. This way we can assure + that objects are not accessed with [self] in running methods after + they are physically destroyed. + +

    + Return: + + empty string +
    +
  • +
  • + + + + instfilter + filterList + + + + + + + + + + + + + + +
    + Arguments: + + filterList: list of methods that should be registered as filters +
    + Description: + + + Specifies the list of filters registered for the class. + instfilter overwrites all previous setting. + Filters must be available on the class or its heritage + order. Filters may also reside on the meta-class of the class. + + Filter list may contain filter guards. Then the + filter is composed of two list elements: {filtername filterguard}. + +
    + Return: + + empty string +
    +
  • +
  • + + + + instfilterappend + filterList + + + + + + + + + + + + + + +
    + Arguments: + + filterList: name of the new instfilter +
    + Description: + + + Convenience method that appends an instfilter to the existing filters of the class. + +
    + Return: + + empty string +
    +
  • +
  • + + + + instfilterguard + filtername + guard + + + + + + + + + + + + + + + + + + +
    + Arguments: + + filtername: filter name of a registered filter +
    + + + guard: set of conditions to execute the filter +
    + Description: + + + Add conditions to guard a filter registration point. The filter + is only executed, if the guards are true. Otherwise we ignore the + filter. If no guards are given, we always execute the filter. + +
    + Return: + + empty string +
    +
  • +
  • + + + + instinvar + invariantList + + + + + + + + + + + + + + +
    + Arguments: + + invariantList: Body of invariants for the class +
    + Description: + + + Specify invariants for the class. These are inherited by + sub-classes. The invariants must hold for all instances. + All assertions are a list of ordinary Tcl conditions. + +
    + Return: + + empty string +
    +
  • +
  • + + + + instmixin + instmixinList + + + + + + + + + + + + + + +
    + Arguments: + + instmixinList: list of classes that should be registered as instmixins +
    + Description: + + + Specifies the list of instmixins (per-class mixins) for the class. + Note that the registration of a per-mixin-class does not invoke + automatically the constructors of the registered class. + The method instmixin overwrites any previous settings. + +
    + Return: + + empty string +
    +
  • +
  • + + + + instmixinappend + mixinList + + + + + + + + + + + + + + +
    + Arguments: + + mixinList: name of the new instmixin +
    + Description: + + + Convenience method that appends an instmixin to the existing mixins of the class. + +
    + Return: + + empty string +
    +
  • +
  • + + + + instparametercmd + name + + + + + + + + + + + + + + +
    + Arguments: + + name: variable to be provided with getter/setter method +
    + Description: + + + Add a getter/setter command for an instance variable with the + specified name. This method is used for example by the + parameter method. + Example:
    + Class C
    + C instparametercmd x
    + C c1 -x 100
    + puts [c1 x]
    + +
    + Return: + + empty string +
    +
  • +
  • + + + + instproc + name + args + body + ?preAssertion? + ?postAssertion? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Arguments: + + name: instance method name +
    + + + args: instance method arguments +
    + + + body: instance method body +
    + + + ?preAssertion?: optional assertions that must hold before the proc executes +
    + + + ?postAssertion?: optional assertions that must hold after the proc executes +
    + Description: + + + Specify an instance method in the same style as Tcl specifies procs. + + Optionally assertions may be given. The number of args is either 3 or 5. + Therefore, to specify only post-assertions an empty pre-assertion list + must be given. All assertions are a list + of ordinary Tcl conditions. + +
    + Return: + + empty string +
    +
  • +
  • + + + + insttclcmd + name + + + + + + + + + + + + + + +
    + Arguments: + + name: cmd to be execute in obj scope +
    + Description: + + + Create a method 'name' that is evaluated as a tcl command in the + scope of the object. E.g. 'Object insttclcmd vwait' creates + an instproc vwait on Object that executes Tcl's vwait in the + scope of the object. That is local vars of the object are accessible + to that vwait. (Used to circumvent, for instance, the TCL_GLOBAL_ONLY + flag of vwait in Tcl.) + +
    + Return: + + empty string +
    +
  • +
  • + + + + new + ?-childof obj? ?args? + + + + + + + + + + + + + + +
    + Arguments: + + ?-childof obj? ?args?: args passed to create +
    + Description: + + + Convenience method to create an autonamed object. E.g.: +
     Http new 
    + creates ::xotcl::__#0, a subsequent call creates ::xotcl::__#1, ...
    + If -childof obj is specified, the new object is + created as a child of the specified object. + +
    + Return: + + new object name +
    +
  • +
  • + + + + parameter + parameterList + + + + + + + + + + + + + + +
    + Arguments: + + parameterList: list of parameter definitions +
    + Description: + + + Specify parameters automatically created for each instance. + Parameters denote instance variables which are available on each class instance + and that have a getter/setter method with their own name. + Parameters are specified in a parameter list of the form + {p1 p2 ... pn}. + p1 ... pn may either be parameter names or definitions of the form + {parameterName defaultValue}. + If a default value is given, that parameter + is created during creation process of the instance object, otherwise + only the getter/setter method is created (and the parameter does not + exist). The getter/setter method has the same name as the + parameter. It gets and returns the parameter, if no + argument is specified. With one argument, the parameter is set + to the argument value. + + Example: +
    +    Class Car -parameter {{doors 4} color}
    +    Car herby -doors 2 -color green
    +    
    + +
    + Return: + + empty string +
    +
  • +
  • + + + + parameterclass + class + + + + + + + + + + + + + + +
    + Arguments: + + class: parameter class name +
    + Description: + + + Set the parameter class. + The parameter class specifies how parameters are stored and + maintained internally. Per default, a method "default" is called, + to set the parameter with a default value. + + I.e., +
    +    Class Car -parameter {
    +      {doors 4}
    +    }
    +    
    + + is a short form for +
    +    Class Car -parameter {
    +      {doors -default 4}
    +    }
    +    
    + + For specialized parameter classes other methods can be called, e.g.
    +
     
    +    {doors -default 3 -updateWidget car}
    +    
    + +
    + Return: + + empty string +
    +
  • +
  • + + + + recreate + obj + ?args? + + + + + + + + + + + + + + + + + + +
    + Arguments: + + obj: obj to be recreated +
    + + + ?args?: arbitrary arguments +
    + Description: + + + Hook called upon recreation of an object. Performs standard object + initialization, per default. May be overloaded/-written. It calls + another method cleanup which handles actual cleanup of the object + during next. That means, if you overload recreate, in the pre-part + the object still contains its old state, after next it is cleaned up. + +
    + Return: + + obj name +
    +
  • +
  • + + + + superclass + classList + + + + + + + + + + + + + + +
    + Arguments: + + classList: list of classes +
    + Description: + + + Specify super-classes for a class. "superclass" changes the list + of superclasses dynamically to classList. + +
    + Return: + + empty string +
    +
  • +
  • + + + + unknown + ?args? + + + + + + + + + + + + + + +
    + Arguments: + + ?args?: arbitrary arguments +
    + Description: + + + Standard unknown mechanism. This mechanism is always triggered when + XOTcl does not know a method called on an object. Supposed that + there is no method with the called name, XOTcl looks up the method + "unknown" (which is found on the Class Object) and executes it. + The standard unknown-mechanism of XOTcl calls create with all + arguments stepping one step to the right; in the general case: + +
    ClassName create ClassName ?args?
    + + Unknown can be overloaded in user-defined subclasses of class. + +
    + Return: + + Standard unknown mechanism returns result of create +
    +
  • +
  • + + + + volatile + + + + + + + + + + + + + + + +
    + Arguments: + + : +
    + Description: + + + This method is used to specify that the object + should be deleted automatically, when the current + tcl-proc/object-proc/instproc is left. Example + set x [Object new -volatile] + +
    + Return: + + empty string +
    +
  • +
+

Procs

+
    +
  • + + + + __unknown + name + + + + + + + + + + + + + + +
    + Arguments: + + name: name of class to be created +
    + Description: + + + This method is called, whenever XOTcl references a class, + which is not defined yet. In the following example: + Class C -superclass D + D is not defined. Therefore Class __unknown D + is called. This callback can be used to perform auto-loading + of classes. After this call, XOTcl tries again to + resolve D. If it succeeds, XOTcl will continue; otherwise, + an error is generated. + +
    + Return: + + empty string +
    +
  • +
+

+
+

+ + + +

Class: Object

+ Class: Class +
+ Procs/Instprocs: + abstract, append, array, autoname, check, class, cleanup, configure, copy, destroy, eval, exists, extractConfigureArg, filter, filterappend, filterguard, filtersearch, getExitHandler, hasclass, incr, info, instvar, invar, isclass, ismetaclass, ismixin, isobject, istype, lappend, mixin, mixinappend, move, noinit, parametercmd, proc, procsearch, requireNamespace, set, setExitHandler, trace, unset, uplevel, upvar, vwait. + + + + + +
+ Description: + + + This class holds the pre-defined methods available for all XOTcl + objects. All these methods are also available on classes. + +
+

Instprocs

+
    +
  • + + + + abstract + methtype + methname + arglist + + + + + + + + + + + + + + + + + + + + + + +
    + Arguments: + + methtype: instproc or proc +
    + + + methname: name of abstract method +
    + + + arglist: arguments +
    + Description: + + + Specify an abstract method for class/object with arguments. + + An abstract method specifies an interface and + returns an error, if it is invoked directly. + Sub-classes or mixins have to override it. + +
    + Return: + + error +
    +
  • +
  • + + + + append + varName + args + + + + + + + + + + + + + + + + + + +
    + Arguments: + + varName: name of variable +
    + + + args: arguments to append +
    + Description: + + + Append all of the value arguments to the current value of variable + varName. Wrapper to the same named Tcl command + (see documentation of Tcl command with the same name for details). + +
    + Return: + + empty string +
    +
  • +
  • + + + + array + opt + array + ?args? + + + + + + + + + + + + + + + + + + + + + + +
    + Arguments: + + opt: array option +
    + + + array: array name +
    + + + ?args?: args of the option +
    + Description: + + + This method performs one of several operations on the variable + given by arrayName. It is a wrapper to the same named Tcl command + (see documentation of Tcl command with the same name for details). + +
    + Return: + + diverse results +
    +
  • +
  • + + + + autoname + ?<-instance>|<-reset>? + name + + + + + + + + + + + + + + + + + + +
    + Arguments: + + ?<-instance>|<-reset>?: Optional modifiers:
    + '-instance' makes the autoname start with a small letter.
    + '-reset' resets the autoname index to 0. +
    + + + name: base name of the autoname +
    + Description: + + + autoname creates an automatically assigned name. It is + constructed from the base name plus an index, that is + incremented for each usage. E.g.: +
    $obj autoname a
    + produces a0, a1, a2, ... + Autonames may have format strings + as in the Tcl 'format' command. + E.g.: +
    $obj autoname a%06d
    + produces a000000, a000001, a000002, ... + +
    + Return: + + newly constructed autoname value +
    +
  • +
  • + + + + check + options + + + + + + + + + + + + + + +
    + Arguments: + + options: none, one or more of: (?all? ?pre? ?post? ?invar? ?instinvar?) +
    + Description: + + + Turn on/off assertion checking. Options argument is the list + of assertions, that should be checked on the object automatically. + Per default assertion checking is turned + off. Examples: +
    +      o check {}; # turn off assertion checking on object o  
    +      o check all; # turn on all assertion checks on object o 
    +      o check {pre post}; # only check pre/post assertions 
    +      
    + info check introspects check options. + +
    + Return: + + empty string +
    +
  • +
  • + + + + class + newClass + + + + + + + + + + + + + + +
    + Arguments: + + newClass: new class name +
    + Description: + + + Changes the class of an object dynamically to newClass. + +
    + Return: + + empty string +
    +
  • +
  • + + + + cleanup + ?args? + + + + + + + + + + + + + + +
    + Arguments: + + ?args?: Arbitrary arguments passed to cleanup +
    + Description: + + + Resets an object or class into an initial state, as after construction. + Called during recreation process by the method 'recreate' + +
    + Return: + + empty string +
    +
  • +
  • + + + + configure + ?args? + + + + + + + + + + + + + + +
    + Arguments: + + ?args?: '-' method calls +
    + Description: + + + Calls the '-' methods. I.e. evaluates arguments and calls + everything starting with '-' (and not having a digit a + second char) as a method. Every list element until the next '-' + is interpreted as a method argument. configure is called + before the constructor during initialization and recreation. + E.g.
    Object o -set x 4
    + here: +
    o configure -set x 4
    + is executed. + + +
    + Return: + + number of the skipped first arguments +
    +
  • +
  • + + + + copy + newName + + + + + + + + + + + + + + +
    + Arguments: + + newName: destination of copy operation +
    + Description: + + + Perform a deep copy of the object/class (with all information, like + class, parameter, filter, ...) + to "newName". + +
    + Return: + + empty string +
    +
  • +
  • + + + + destroy + ?args? + + + + + + + + + + + + + + +
    + Arguments: + + ?args?: Arbitrary arguments passed to the destructor +
    + Description: + + + Standard destructor. + Can be overloaded for customized destruction process. Actual destruction + is done by instdestroy. "destroy" in principal does: +
    +      Object instproc destroy args {
    +        [my info class] instdestroy [self]
    +      }
    +      
    + +
    + Return: + + empty string +
    +
  • +
  • + + + + eval + args + + + + + + + + + + + + + + +
    + Arguments: + + args: cmds to eval +
    + Description: + + + Eval args in the scope of the object. That is local variables + are directly accessible as Tcl vars. + +
    + Return: + + result of cmds evaled +
    +
  • +
  • + + + + extractConfigureArg + al + name + ?cutTheArg? + + + + + + + + + + + + + + + + + + + + + + +
    + Arguments: + + al: Argument List Name +
    + + + name: Name of the Configure Argument to be extracted (should start with '-') +
    + + + ?cutTheArg?: if cutTheArg not 0, it cut from upvar argsList, default is 0 +
    + Description: + + + Check an argument list separated with '-' args, as for instance + configure + arguments, and extract the argument's values. Optionally, cut the + whole argument. + +
    + Return: + + value list of the argument +
    +
  • +
  • + + + + exists + var + + + + + + + + + + + + + + +
    + Arguments: + + var: variable name +
    + Description: + + + Check for existence of the named instance variable on the object. + +
    + Return: + + 1 if variable exists, 0 if not +
    +
  • +
  • + + + + filter + filterList + + + + + + + + + + + + + + +
    + Arguments: + + filterList: list of methods that should be registered as filters +
    + Description: + + + Specifies the list of filters registered for the class. + filter overwrites all previous setting. + Filters must be available on the class or its heritage + order. Filters may also reside on the meta-class of the class. + + Filter list may contain filter guards. Then the + filter is composed of two list elements: {filtername filterguard}. + +
    + Return: + + empty string +
    +
  • +
  • + + + + filterappend + filterList + + + + + + + + + + + + + + +
    + Arguments: + + filterList: name of the new filter +
    + Description: + + + Convenience method that appends a filter to the existing filters of the object. + +
    + Return: + + empty string +
    +
  • +
  • + + + + filterguard + filtername + guard + + + + + + + + + + + + + + + + + + +
    + Arguments: + + filtername: filter name of a registered filter +
    + + + guard: set of conditions to execute the filter +
    + Description: + + + Add conditions to guard a filter registration point. The filter + is only executed, if the guards are true. Otherwise we ignore the + filter. If no guards are given, we always execute the filter. + +
    + Return: + + an empty string +
    +
  • +
  • + + + + filtersearch + methodName + + + + + + + + + + + + + + +
    + Arguments: + + methodName: filter method name +
    + Description: + + + Search a full qualified method name that + is currently registered as a filter. Return a list of the + proc qualifier format: + 'objName|classname proc|instproc methodName'. + +
    + Return: + + full qualified name, if filter is found, otherwise an empty string +
    +
  • +
  • + + + + hasclass + ?className? + + + + + + + + + + + + + + +
    + Arguments: + + ?className?: name of a class to be tested +
    + Description: + + + Test whether the argument is either + a mixin or instmixin of the object or + if it is on the class hierarchy of the object. + This method combines the functionalities of + istype and ismixin. + +
    + Return: + + 1 or 0 +
    +
  • +
  • + + + + incr + varName + ?increment? + + + + + + + + + + + + + + + + + + +
    + Arguments: + + varName: variable name +
    + + + ?increment?: value to increment +
    + Description: + + + Increments the value stored in the variable whose name is varName. + The new value is stored as a decimal string in variable varName and also + returned as result. Wrapper to the same named Tcl command + (see documentation of Tcl command with the same name for details). + +
    + Return: + + new value of varName +
    +
  • +
  • + + + + info + args + + + + + + + + + + + + + + +
    + Arguments: + + args: info options +
    + Description: + + + Introspection of objects. The following options can be specified: +
      +
    • objName info args method: + Returns the arguments of the specified method. + +
    • objName info body method: + Returns the body of the specified method. + +
    • objName info class ?classname?: + Returns the name of the class of the current object, if classname was + not specified, otherwise it returns 1 if classname matches the + object's class and 0 if not. + +
    • objName info children: Returns the list of aggregated + objects with fully qualified names. + +
    • objName info commands ?pattern: Returns all commands + defined for the object if pattern was not specified, otherwise + it returns all commands that match the pattern. + +
    • objName info default method arg var: Returns 1 if the + argument arg of the method method has a default + value, otherwise 0. If it exists the default value is stored in var. + +
    • objName info filter: Returns a list of filters. + With -guard modifier all filterguards are integrated + ( objName info filter -guards). With -order + modifier the order of filters (whole hierarchy) is printed. + +
    • objName info filterguard name: Returns the guards + for filter identified by name. + +
    • objName info hasNamespace: From XOTcl version 0.9 on, + namespaces + of objects are allocated on demand. hasNamespace returns 1, if the + object currently has a namespace, otherwise 0. The method + requireNamespace can + be used to ensure that the object has a namespace. + +
    • objName info info: Returns a list of all available info + options on the object. + +
    • objName info invar: Returns object invariants. + +
    • objName info metadata ?pattern?: + Returns available metadata options. + +
    • objName info methods: Returns the list of all method + currently reachable for objName. Includes procs, instprocs, cmds, + instcommands on object, class hierarchy and mixins. + Modifier -noprocs only returns instcommands, + -nocmds only returns procs. + Modifier -nomixins excludes search on mixins. + +
    • objName info mixin: Returns the list of mixins + of the object. With -order modifier the order of mixins + (whole hierarchy) is printed. + +
    • objName info parent: + Returns parent object name (or "::" for no parent), + in fully qualified form. + +
    • objName info post methodName: + Returns post assertions of methodName. + +
    • objName info pre methodName: + Returns pre assertions of methodName. + +
    • objName info procs ?pattern?: Returns all procs defined + for the object if pattern was not specified, + otherwise it returns all procs that match the pattern. + +
    • objName info vars ?pattern?: Returns all variables defined + for the object if pattern was not specified, otherwise it + returns all variables that match the pattern. +
    + +
    + Return: + + Value of introspected option as a string. +
    +
  • +
  • + + + + instvar + v1 + ?v2...vn? + + + + + + + + + + + + + + + + + + +
    + Arguments: + + v1: instvar variable +
    + + + ?v2...vn?: optional other instvar variables +
    + Description: + + + Binds an variable of the object to the current method's scope. + Example: +
    +      kitchen proc enter {name} {
    +        my instvar persons
    +        set persons($name) [clock seconds]
    +      }
    +      
    + Now persons can be accessed as a local variable of the method.
    + + A special syntax is: {varName aliasName} . + This gives the variable with the name + varName the alias aliasName. + This way the variables can be linked to the methods scope, + even if a variable with that name already exists in the scope. + +
    + Return: + + empty string +
    +
  • +
  • + + + + invar + invariantList + + + + + + + + + + + + + + +
    + Arguments: + + invariantList: Body of invariants for the object +
    + Description: + + + Specify invariants for the objects. All assertions are a list + of ordinary Tcl conditions. + +
    + Return: + + empty string +
    +
  • +
  • + + + + isclass + ?className? + + + + + + + + + + + + + + +
    + Arguments: + + ?className?: name of a class to be tested +
    + Description: + + + Test whether the argument (or the Object, if no argument is specified) + is an existing class or not. + +
    + Return: + + 1 or 0 +
    +
  • +
  • + + + + ismetaclass + ?metaClassName? + + + + + + + + + + + + + + +
    + Arguments: + + ?metaClassName?: name of a metaclass to be tested +
    + Description: + + + Test whether the argument (or the Object, if no argument is specified) + is an existing metaclass or not. + +
    + Return: + + 1 or 0 +
    +
  • +
  • + + + + ismixin + ?className? + + + + + + + + + + + + + + +
    + Arguments: + + ?className?: name of a class to be tested +
    + Description: + + + Test whether the argument is a mixin or instmixin of the object. + +
    + Return: + + 1 or 0 +
    +
  • +
  • + + + + isobject + objName + + + + + + + + + + + + + + +
    + Arguments: + + objName: string that should be tested, whether it is a name of an object or not +
    + Description: + + + Test whether the argument is an existing object or not. Every XOTcl object + has the capability to check the object system. + +
    + Return: + + 1 or 0 +
    +
  • +
  • + + + + istype + className + + + + + + + + + + + + + + +
    + Arguments: + + className: type name +
    + Description: + + + Test whether the argument is a type of the object. I.e., 1 is returned + if className is either the class of the object or one of its + superclasses. + +
    + Return: + + 1 or 0 +
    +
  • +
  • + + + + lappend + varName + args + + + + + + + + + + + + + + + + + + +
    + Arguments: + + varName: name of variable +
    + + + args: elements to append +
    + Description: + + + Append all the specified arguments to the list specified + by varName as separated elements (typically separated by blanks). + If varName doesn't exist, it creates a list with the specified + values + (see documentation of Tcl command with the same name for details). + +
    + Return: + + empty string +
    +
  • +
  • + + + + mixin + mixinList + + + + + + + + + + + + + + +
    + Arguments: + + mixinList: list of classes that should be registered as mixins +
    + Description: + + + Specifies the list of mixins registered for the object. + The method mixin overwrites all previous settings. + +
    + Return: + + empty string +
    +
  • +
  • + + + + mixinappend + mixinList + + + + + + + + + + + + + + +
    + Arguments: + + mixinList: name of the new mixin +
    + Description: + + + Convenience method that appends a mixin to the existing mixins of the object. + +
    + Return: + + empty string +
    +
  • +
  • + + + + move + newName + + + + + + + + + + + + + + +
    + Arguments: + + newName: destination of move operation +
    + Description: + + + Perform a deep move of the object/class (with all information, like + class, parameter, filter, ...) + to "newName". + +
    + Return: + + empty string +
    +
  • +
  • + + + + parametercmd + name + + + + + + + + + + + + + + +
    + Arguments: + + name: variable to be provided with getter/setter method +
    + Description: + + + Add a getter/setter for an instance variable with the + specified name as a command for the obj. + Example:
    + Object o
    + o parametercmd x
    + o x 100
    + puts [o x]
    + +
    + Return: + + empty string +
    +
  • +
  • + + + + noinit + + + + + + + + + + +
    + Description: + + + flag that constructor (method init) should + not be called. + Example:
    + Class C
    + C instproc init {} {puts hu}
    + C c1 -noinit
    + The object c1 will be created without calling + the constructor. This can be used to draw a snapshot of + an existing object (using the serializer) and to recreate + it in some other context in its last state. + +
    + Return: + + empty string +
    +
  • +
  • + + + + proc + name + args + body + ?preAssertion? + ?postAssertion? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Arguments: + + name: method name +
    + + + args: method arguments +
    + + + body: method body +
    + + + ?preAssertion?: optional assertions that must hold before the proc executes +
    + + + ?postAssertion?: optional assertions that must hold after the proc executes +
    + Description: + + + Specify a method in the same style as Tcl specifies procs. + + Optionally assertions may be given. The number of args is either + 3 or 5. + Therefore, to specify only post-assertions an empty pre-assertion + list must be given. All assertions are a list + of ordinary Tcl conditions. + +
    + Return: + + empty string +
    +
  • +
  • + + + + procsearch + procname + + + + + + + + + + + + + + +
    + Arguments: + + procname: simple proc name +
    + Description: + + + Search for a proc or instproc on an object and return the fully + qualified name of the method as a list in + proc qualifier format: + 'objName|classname proc|instproc methodName'. E.g., +
     o procsearch set 
    + returns
    ::xotcl::Object instproc set
    . + +
    + Return: + + fully qualified name of the searched method or empty string if not found +
    +
  • +
  • + + + + requireNamespace + + + + + + + + + + +
    + Description: + + + The method requireNamespace can + be used to ensure that the object has a namespace. + Namespaces are created automatically by XOTcl, when e.g. an object has + child objects (aggregated objects) or procs. The namespace + will be used to keep instance variables, procs and child objects. + To check, whether an object currently has a namespace, + info hasNamespace can be used. + + Hint: In versions prior to XOTcl 0.9 all XOTcl objects + had their own namespaces; it was made on demand to save memory when + e.g. huge numbers of objects are created. + requireNamespace is often needed when e.g. using Tk widgets + when variables are to be referenced via the namespace + (with ... -variable [self]::varname ...). + +
    + Return: + + empty string +
    +
  • +
  • + + + + set + varname + ?value? + + + + + + + + + + + + + + + + + + +
    + Arguments: + + varname: name of the instance variable +
    + + + ?value?: optional new value +
    + Description: + + + Set an instance variable in the same style as Tcl sets a variable. + + With one argument, we retrieve the current value, + with two arguments, we set the instance variable to the new value. + +
    + Return: + + Value of the instance variable +
    +
  • +
  • + + + + trace + varName + + + + + + + + + + + + + + +
    + Arguments: + + varName: name of variable +
    + Description: + + + Trace an object variable + (see documentation of Tcl command with the same name for details). + +
    + Return: + + empty string +
    +
  • +
  • + + + + unset + v1 + ?v2...vn? + + + + + + + + + + + + + + + + + + +
    + Arguments: + + v1: Variable to unset +
    + + + ?v2...vn?: Optional more vars to unset +
    + Description: + + + The unset operation deletes one or optionally a set of variables from an object. + +
    + Return: + + empty string +
    +
  • +
  • + + + + uplevel + ?level? + command ?args? + + + + + + + + + + + + + + + + + + +
    + Arguments: + + ?level?: Level +
    + + + command ?args?: command and arguments to be called +
    + Description: + + + When this method is used without the optional level, it is a short form + of the Tcl command
    + upevel [self callinglevel] command ?args?. + When it is called with the level, it is compatible with the original tcl command. + +
    + Return: + + result of the command +
    +
  • +
  • + + + + upvar + ?level? + othervar localvar + ?othervar localvar? + + + + + + + + + + + + + + + + + + + + + + +
    + Arguments: + + ?level?: Level +
    + + + othervar localvar: referenced variable and variale in the local scope +
    + + + ?othervar localvar?: optional pairs of referenced and local variable names +
    + Description: + + + When this method is used without the optional level, it is a short form + of the Tcl command
    + upvar [self callinglevel] othervar localvar ?...?. + When it is called with the level, it is compatible with the original tcl command. + +
    + Return: + + result of the command +
    +
  • +
  • + + + + vwait + varName + + + + + + + + + + + + + + +
    + Arguments: + + varName: name of variable +
    + Description: + + + Enter event loop until the specified variable is set + (see documentation of Tcl command with the same name for details). + +
    + Return: + + empty string +
    +
  • +
+

Procs

+
    +
  • + + + + getExitHandler + + + + + + + + + + +
    + Description: + + Retrieve the current exit handler procedure body as a string. +
    + Return: + + exit handler proc body +
    +
  • +
  • + + + + setExitHandler + body + + + + + + + + + + + + + + +
    + Arguments: + + body: procedure body +
    + Description: + + + Set body for the exit handler procedure. The exit handler + is executed when XOTcl is existed or aborted. Can be used to call + cleanups that are not associated with objects (otherwise use + destructor). + On exit the object destructors are called after the + user-defined exit-handler. + +
    + Return: + + exit handler proc body +
    +
  • +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/langRef-xotcl.pdf =================================================================== diff -u Binary files differ Index: xotcl/doc/langRef.xotcl =================================================================== diff -u --- xotcl/doc/langRef.xotcl (revision 0) +++ xotcl/doc/langRef.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1143 @@ +# $Id: langRef.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide XOTcl-langRef 1.2 +package require Tcl + +@ @File { + description { + XOTcl language reference. Describes predefined objects and classes. + } + "predefined primitives" { + XOTcl contains three predefined primitives: + <@p> + <@tt>self<@/tt> computes callstack related information. + It can be used in the following ways: + <@UL> + <@LI><@TT>self - returns the name + of the object, which is currently in execution. If it is + called from outside of a proc, it returns the + error message ``<@TT>Can't find self''. + <@LI><@TT>self class - the self + command with a given argument <@TT>class returns the name of the + class, which holds the currently executing instproc. Note, that this + may be different to the class of the current object. If it is called + from a proc it returns an empty string. + <@LI><@TT>self proc - the self command with a given argument + <@TT>proc returns the name of the currently executing proc or + instproc. + <@li><@TT>self callingclass: Returns class name of the + class that has called the executing method. + <@li><@TT>self callingobject: Returns object name of + the object that has called the executing method. + <@li><@TT>self callingproc: Returns proc name of + the method that has called the executing method. + <@li><@TT>self calledclass: Returns class name of the + class that holds the target proc (in mixins and filters). + <@li><@TT>self calledproc: Returns method + name of the target proc (only applicable + in a filter). + <@li><@TT>self next: Return the + "next" method on the path as a string. + <@li><@TT>self filterreg: In a filter: returns the name + of the object/class on which the filter is registered. Returns either + 'objName filter filterName' or 'className instfilter filterName'. + + <@li><@TT>self callinglevel: Returns the calling level, from where + the actual proc was called from. Intermediary next calls are ignored + in this computation. The level is returned in a form + it can be used as first argument in <@TT>uplevel or <@TT>upvar. + + <@li><@TT>self activelevel: Returns the level, from where + the actual proc was invoked from. This might be the calling level or a next + call, whatsever is higher in the stack. The level is returned in a form + it can be used as first argument in <@TT>uplevel or <@TT>upvar. + + + <@/UL> + <@/p><@p> + <@tt>my someMethod<@/tt> is a short form for <@tt>[self] someMethod and can only be + called in a context of an instproc or an method specific proc. It allows certain + optimizations and shorter to write. + <@/p><@p> + <@tt> next <@/tt> executes the "next" method on the precedence + order and return with the result. + <@/p> + + } + date { $Date: 2004/05/23 22:50:39 $ } +} + +## +## Object methods +## +@ Class Object { + description { + This class holds the pre-defined methods available for all XOTcl + objects. All these methods are also available on classes. + } +} + +@ Object instproc abstract { + methtype "instproc or proc" + methname "name of abstract method" + arglist "arguments" +} { + Description { + Specify an abstract method for class/object with arguments. + + An abstract method specifies an interface and + returns an error, if it is invoked directly. + Sub-classes or mixins have to override it. + } + return "error" +} + +@ Object instproc append { + varName "name of variable" + args "arguments to append" +} { + Description { + Append all of the value arguments to the current value of variable + varName. Wrapper to the same named Tcl command + (see documentation of Tcl command with the same name for details). + } + return "empty string" +} + +@ Object instproc array { + opt "array option" + array "array name" + ?args? "args of the option" +} { + Description { + This method performs one of several operations on the variable + given by arrayName. It is a wrapper to the same named Tcl command + (see documentation of Tcl command with the same name for details). + } + return "diverse results" +} + +@ Object instproc autoname { + ?<-instance>|<-reset>? "Optional modifiers: <@br> + '-instance' makes the autoname start with a small letter.<@br> + '-reset' resets the autoname index to 0." + name "base name of the autoname"} { + Description { + autoname creates an automatically assigned name. It is + constructed from the base name plus an index, that is + incremented for each usage. E.g.: + <@pre>$obj autoname a + produces a0, a1, a2, ... + Autonames may have format strings + as in the Tcl 'format' command. + E.g.: + <@pre>$obj autoname a%06d + produces a000000, a000001, a000002, ... + } + return "newly constructed autoname value" +} + +@ Object instproc check { + options "none, one or more of: (?all? ?pre? ?post? ?invar? ?instinvar?)" +} { + Description { + Turn on/off assertion checking. Options argument is the list + of assertions, that should be checked on the object automatically. + Per default assertion checking is turned + off. Examples: + <@pre> + o check {}; # turn off assertion checking on object o + o check all; # turn on all assertion checks on object o + o check {pre post}; # only check pre/post assertions + + <@a href="#Object-info">info check introspects check options. + } + return "empty string" +} + +@ Object instproc class { + newClass "new class name" +} { + Description { + Changes the class of an object dynamically to <@tt>newClass. + } + return "empty string" +} + +@ Object instproc cleanup { + ?args? "Arbitrary arguments passed to cleanup" +} { + Description { + Resets an object or class into an initial state, as after construction. + Called during recreation process by the method 'recreate' + } + return "empty string" +} + +@ Object instproc configure { + ?args? "'-' method calls" +} { + Description { + Calls the '-' methods. I.e. evaluates arguments and calls + everything starting with '-' (and not having a digit a + second char) as a method. Every list element until the next '-' + is interpreted as a method argument. configure is called + before the constructor during initialization and recreation. + E.g.\ + <@pre>Object o -set x 4 + here: + <@pre>o configure -set x 4 + is executed. + + } + return "number of the skipped first arguments" +} + +@ Object instproc copy { + newName "destination of copy operation" +} { + Description { + Perform a deep copy of the object/class (with all information, like + class, parameter, filter, ...) + to "newName". + } + return "empty string" +} + +@ Object instproc destroy { + ?args? "Arbitrary arguments passed to the destructor" +} { + Description { + Standard destructor. + Can be overloaded for customized destruction process. Actual destruction + is done by instdestroy. "destroy" in principal does: + <@pre> + Object instproc destroy args { + [my info class] instdestroy [self] + } + + } + return "empty string" +} + +@ Object instproc eval { + args "cmds to eval" +} { + Description { + Eval args in the scope of the object. That is local variables + are directly accessible as Tcl vars. + } + return "result of cmds evaled" +} + +@ Object instproc extractConfigureArg { + al "Argument List Name" + name "Name of the Configure Argument to be extracted (should start with '-')" + ?cutTheArg? "if cutTheArg not 0, it cut from upvar argsList, default is 0" +} { + Description { + Check an argument list separated with '-' args, as for instance + configure + arguments, and extract the argument's values. Optionally, cut the + whole argument. + } + return "value list of the argument" +} + +@ Object instproc exists { + var "variable name" +} { + Description { + Check for existence of the named instance variable on the object. + } + return "1 if variable exists, 0 if not" +} + +@ Object instproc filter { + filterList "list of methods that should be registered as filters" +} { + Description { + Specifies the list of filters registered for the class. + <@tt>filter overwrites all previous setting. + Filters must be available on the class or its heritage + order. Filters may also reside on the meta-class of the class. + + Filter list may contain filter guards. Then the + filter is composed of two list elements: {filtername filterguard}. + } + return "empty string" +} + +@ Object instproc filterappend { + filterList "name of the new filter" +} { + description { + Convenience method that appends a filter to the existing filters of the object. + } + return "empty string" +} + +@ Object instproc filterguard { + filtername "filter name of a registered filter" + guard "set of conditions to execute the filter" +} { + description { + Add conditions to guard a filter registration point. The filter + is only executed, if the guards are true. Otherwise we ignore the + filter. If no guards are given, we always execute the filter. + } + return "an empty string" +} + +@ Object instproc filtersearch { + methodName "filter method name" +} { + description { + Search a full qualified method name that + is currently registered as a filter. Return a list of the + proc qualifier format: + 'objName|classname proc|instproc methodName'. + } + return "full qualified name, if filter is found, otherwise an empty string" +} + +@ Object instproc hasclass { + ?className? "name of a class to be tested" +} { + Description { + Test whether the argument is either + a mixin or instmixin of the object or + if it is on the class hierarchy of the object. + This method combines the functionalities of + istype and ismixin. + } + return "1 or 0" +} + + +@ Object instproc incr { + varName "variable name" + ?increment? "value to increment" +} { + Description { + Increments the value stored in the variable whose name is varName. + The new value is stored as a decimal string in variable varName and also + returned as result. Wrapper to the same named Tcl command + (see documentation of Tcl command with the same name for details). + } + return "new value of varName" +} + +@ Object instproc info { + args "info options" +} { + Description { + Introspection of objects. The following options can be specified: + <@ul> + <@li><@TT>objName info args method: + Returns the arguments of the specified method. + + <@li><@TT>objName info body method: + Returns the body of the specified method. + + <@li><@TT>objName info class ?classname?: + Returns the name of the class of the current object, if classname was + not specified, otherwise it returns 1 if classname matches the + object's class and 0 if not. + + <@li><@TT>objName info children ?pattern?: Returns the list of aggregated + objects with fully qualified names if <@TT>pattern was not specified, + otherwise it returns all children where the object name matches the pattern. + + <@li><@TT>objName info commands ?pattern: Returns all commands + defined for the object if <@TT>pattern was not specified, otherwise + it returns all commands that match the pattern. + + <@li><@TT>objName info default method arg var: Returns 1 if the + argument <@TT>arg of the method <@TT>method has a default + value, otherwise 0. If it exists the default value is stored in <@TT>var. + + <@li><@TT>objName info filter: Returns a list of filters. + With -guard modifier all filterguards are integrated + (<@TT> objName info filter -guards). With <@TT>-order + modifier the order of filters (whole hierarchy) is printed. + + <@li><@TT>objName info filterguard name: Returns the guards + for filter identified by name. + + <@li><@TT>objName info hasNamespace: From XOTcl version 0.9 on, + namespaces + of objects are allocated on demand. hasNamespace returns 1, if the + object currently has a namespace, otherwise 0. The method + <@TT>requireNamespace can + be used to ensure that the object has a namespace. + + <@li><@TT>objName info info: Returns a list of all available info + options on the object. + + <@li><@TT>objName info invar: Returns object invariants. + + <@li><@TT>objName info metadata ?pattern?: + Returns available metadata options. + + <@li><@TT>objName info methods: Returns the list of all method + currently reachable for objName. Includes procs, instprocs, cmds, + instcommands on object, class hierarchy and mixins. + Modifier <@TT>-noprocs only returns instcommands, + <@TT>-nocmds only returns procs. + Modifier <@TT>-nomixins excludes search on mixins. + + <@li><@TT>objName info mixin: Returns the list of mixins + of the object. With <@TT>-order modifier the order of mixins + (whole hierarchy) is printed. + + <@li><@TT>objName info parent: + Returns parent object name (or "::" for no parent), + in fully qualified form. + + <@li><@TT>objName info post methodName: + Returns post assertions of methodName. + + <@li><@TT>objName info pre methodName: + Returns pre assertions of methodName. + + <@li><@TT>objName info procs ?pattern?: Returns all procs defined + for the object if <@TT>pattern was not specified, + otherwise it returns all procs that match the pattern. + + <@li><@TT>objName info vars ?pattern?: Returns all variables defined + for the object if <@TT>pattern was not specified, otherwise it + returns all variables that match the pattern. + <@/ul> + } + return "Value of introspected option as a string." +} + +@ Object instproc instvar { + v1 "instvar variable" + "?v2...vn?" "optional other instvar variables" +} { + Description { + Binds an variable of the object to the current method's scope. + Example: + <@pre> + kitchen proc enter {name} { + my instvar persons + set persons($name) [clock seconds] + } + + Now persons can be accessed as a local variable of the method.<@br> + + A special syntax is: <@tt> {varName aliasName} . + This gives the variable with the name + <@TT>varName the alias <@TT>aliasName. + This way the variables can be linked to the methods scope, + even if a variable with that name already exists in the scope. + } + return "empty string" +} + +@ Object instproc invar { + invariantList "Body of invariants for the object" +} { + Description { + Specify invariants for the objects. All assertions are a list + of ordinary Tcl conditions. + } + return "empty string" +} + +@ Object instproc isclass { + ?className? "name of a class to be tested" +} { + Description { + Test whether the argument (or the Object, if no argument is specified) + is an existing class or not. + } + return "1 or 0" +} + +@ Object instproc ismetaclass { + ?metaClassName? "name of a metaclass to be tested" +} { + Description { + Test whether the argument (or the Object, if no argument is specified) + is an existing metaclass or not. + } + return "1 or 0" +} + +@ Object instproc ismixin { + ?className? "name of a class to be tested" +} { + Description { + Test whether the argument is a mixin or instmixin of the object. + } + return "1 or 0" +} + +@ Object instproc isobject { + objName "string that should be tested, whether it is a name of an object or not" +} { + Description { + Test whether the argument is an existing object or not. Every XOTcl object + has the capability to check the object system. + } + return "1 or 0" +} + +@ Object instproc istype { + className "type name" +} { + Description { + Test whether the argument is a type of the object. I.e., 1 is returned + if className is either the class of the object or one of its + superclasses. + } + return "1 or 0" +} + +@ Object instproc lappend { + varName "name of variable" + args "elements to append" +} { + Description { + Append all the specified arguments to the list specified + by varName as separated elements (typically separated by blanks). + If varName doesn't exist, it creates a list with the specified + values + (see documentation of Tcl command with the same name for details). + } + return "empty string" +} + +@ Object instproc mixin { + mixinList "list of classes that should be registered as mixins" +} { + Description { + Specifies the list of mixins registered for the object. + The method <@tt>mixin overwrites all previous settings. + } + return "empty string" +} + +@ Object instproc mixinappend { + mixinList "name of the new mixin" +} { + description { + Convenience method that appends a mixin to the existing mixins of the object. + } + return "empty string" +} + +@ Object instproc move { + newName "destination of move operation" +} { + Description { + Perform a deep move of the object/class (with all information, like + class, parameter, filter, ...) + to "newName". + } + return "empty string" +} + +@ Object instproc parametercmd { + name "variable to be provided with getter/setter method" +} { + description { + Add a getter/setter for an instance variable with the + specified name as a command for the obj. + Example: <@br> + <@tt>Object o<@br> + <@tt>o parametercmd x<@br> + <@tt>o x 100<@br> + <@tt>puts [o x]<@br> + } + return "empty string" +} + +@ Object instproc noinit { +} { + description { + flag that constructor (method <@tt>init) should + not be called. + Example: <@br> + <@tt>Class C<@br> + <@tt>C instproc init {} {puts hu}<@br> + <@tt>C c1 -noinit<@br> + The object <@tt>c1 will be created without calling + the constructor. This can be used to draw a snapshot of + an existing object (using the serializer) and to recreate + it in some other context in its last state. + } + return "empty string" +} + + +@ Object instproc proc { + name "method name" + args "method arguments" + body "method body" + "?preAssertion?" "optional assertions that must hold before the proc executes" + "?postAssertion?" "optional assertions that must hold after the proc executes" +} { + Description { + Specify a method in the same style as Tcl specifies procs. + + Optionally assertions may be given. The number of args is either + 3 or 5. + Therefore, to specify only post-assertions an empty pre-assertion + list must be given. All assertions are a list + of ordinary Tcl conditions. + } + return "empty string" +} + +@ Object instproc procsearch { + procname "simple proc name" +} { + Description { + Search for a proc or instproc on an object and return the fully + qualified name of the method as a list in + proc qualifier format: + 'objName|classname proc|instproc methodName'. E.g., + <@pre> o procsearch set + returns <@pre>::xotcl::Object instproc set. + } + return "fully qualified name of the searched method or empty string if not found" +} + +@ Object instproc requireNamespace { +} { + Description { + The method <@TT>requireNamespace can + be used to ensure that the object has a namespace. + Namespaces are created automatically by XOTcl, when e.g. an object has + child objects (aggregated objects) or procs. The namespace + will be used to keep instance variables, procs and child objects. + To check, whether an object currently has a namespace, + <@TT>info hasNamespace can be used. + + Hint: In versions prior to XOTcl 0.9 all XOTcl objects + had their own namespaces; it was made on demand to save memory when + e.g. huge numbers of objects are created. + <@TT>requireNamespace is often needed when e.g. using Tk widgets + when variables are to be referenced via the namespace + (with <@TT>... -variable [self]::varname ...). + } + return "empty string" +} + +@ Object instproc set { + varname "name of the instance variable" + ?value? "optional new value" +} { + Description { + Set an instance variable in the same style as Tcl sets a variable. + + With one argument, we retrieve the current value, + with two arguments, we set the instance variable to the new value. + } + return "Value of the instance variable" +} + +@ Object instproc trace { + varName "name of variable" +} { + Description { + Trace an object variable + (see documentation of Tcl command with the same name for details). + } + return "empty string" +} + +@ Object instproc unset { + v1 "Variable to unset" + "?v2...vn?" "Optional more vars to unset" +} { + Description { + The unset operation deletes one or optionally a set of variables from an object. + } + return "empty string" +} + +@ Object instproc uplevel { + ?level? "Level" + command ?args? "command and arguments to be called" +} { + Description { + When this method is used without the optional level, it is a short form + of the Tcl command
+ <@TT>upevel [self callinglevel] command ?args?<@/TT>. + When it is called with the level, it is compatible with the original tcl command. + } + return "result of the command" +} +@ Object instproc upvar { + ?level? "Level" + othervar localvar "referenced variable and variale in the local scope" + ?othervar localvar? "optional pairs of referenced and local variable names" +} { + Description { + When this method is used without the optional level, it is a short form + of the Tcl command
+ <@TT>upvar [self callinglevel] othervar localvar ?...?<@/TT>. + When it is called with the level, it is compatible with the original tcl command. + } + return "result of the command" +} + +@ Object instproc vwait { + varName "name of variable" +} { + Description { + Enter event loop until the specified variable is set + (see documentation of Tcl command with the same name for details). + } + return "empty string" +} + +# procs of Object +@ Object proc getExitHandler {} { + Description "Retrieve the current exit handler procedure body as a string." + return "exit handler proc body" +} + +@ Object proc setExitHandler {body "procedure body"} { + Description { + Set body for the exit handler procedure. The exit handler + is executed when XOTcl is existed or aborted. Can be used to call + cleanups that are not associated with objects (otherwise use + destructor). + On exit the object destructors are called after the + user-defined exit-handler. + } + return "exit handler proc body" +} + +# class +@ Class Class -superclass Object { + description { + This meta-class holds the pre-defined methods available for all XOTcl + classes. + } +} +@ Class instproc alloc { + obj "new obj/class name" + ?args? "arguments passed to the new class after creation" +} { + description { + Allocate memory for a new XOTcl object or class. <@tt>create<@/tt> uses + <@tt>alloc to allocate memory. But <@tt>create<@/tt> also + calls init and evaluates '-' arguments as method calls. + In seldom cases the programmer may want to suppress the + <@tt>create<@/tt> + mechanism and just allocate memory. Then <@tt>alloc can + be used. + } + return "new class name" +} + +@ Class instproc create { + objName "name of a new class or object" + ?args? "arguments passed to the constructor" +} { + description { + Create user-defined classes or objects. If the class is a meta-class, + a class is created, otherwise an object. + + Create firstly calls <@tt>alloc in order to allocate memory for the + new object. Then default values for parameters are searched on + superclasses (an set if found). Then <@tt>args is searched for args + starting with '-' followed by an alpha character. These arguments + are called as methods. '-' followed by a numerical is interpreted + as a negative number (and not as a method). If a value of a method + called this way starts with a "a", the call can be placed safely + into a list (e.g. "Class c [-strangearg -a-] -simplearg 2"). + + Finally the constructor <@tt>init is called on the object + with all arguments up to the first '-' arg.<@p> + + The <@tt>create method is called implicitly through the + <@tt>unknown + mechanism when a class (meta-class) is called with an unknown + method. E.g. the following two commands are equivalent + + <@pre> Car herby -color red + Car create herby -color red <@/pre> + + When a users may want to call the constructor <@tt>init + before other '-' methods, one can specify '-init' + explicitly in the left to + right order of the '-' method. Init is called always only once. + e.g.: <@pre> Class Car -init -superclass Vehicle <@/pre> + } + return "name of the created instance (result of alloc)" +} + +@ Class instproc info { + args "info options" +} { + Description { + Introspection of classes. All options available for objects + (see <@a href="#Object-info">info object) is also available + for classes. + The following options can be specified: + <@ul> + <@li><@TT>ClassName info classchildren ?pattern?: + Returns the list of nested classes with fully qualified names + if <@TT>pattern was not specified, + otherwise it returns all class children where the class name + matches the pattern. + + <@li><@TT>ClassName info classparent: + Returns the class ClassName is nesting to. + + <@li><@TT>ClassName info instdefault method arg var: + Returns 1 if the argument <@TT>arg of the instance method + <@TT>method has a default value, otherwise 0. If it exists + the default value is stored in <@TT>var. + + <@li><@TT>ClassName info instfilter: + Returns the list of registered filters. With -guard modifier + all instfilterguards are integrated + (<@TT> ClassName info instfilter -guards). + + <@li><@TT>objName info instfilterguard name: Returns the guards + for instfilter identified by name. + + <@li><@TT>ClassName info heritage ?pattern?: + Returns a list of all classes in the precedence order + of the class hierarchy. + If pattern is specified, only matching values are returned. + + <@li><@TT>ClassName info instances ?pattern?: + Returns a list of the instances of the class. + If pattern is specified, only matching values are returned. + + <@li><@TT>ClassName info instargs method: + Returns the arguments of the specified method. + + <@li><@TT>ClassName info instbody method: + Returns the body of the specified method. + + <@li><@TT>ClassName info instcommands ?pattern?: + Returns all commands defined for the class. If pattern + is specified it returns all commands that match the pattern. + + <@li><@TT>ClassName info instinvar: + Returns class invariants. + + <@li><@TT>ClassName info instmixin: + Returns the list of instmixins of this class. + + <@li><@TT>ClassName info instpost methodName: + Returns post assertions of methodName. + + <@li><@TT>ClassName info instpre methodName: + Returns pre assertions of methodName. + + <@li><@TT>ClassName info instprocs ?pattern?: + Returns all instprocs defined for the class. If pattern + is specified it returns all instprocs that match the pattern. + + <@li><@TT>ClassName info parameter: + Returns parameter list. + + <@li><@TT>ClassName info subclass ?subclassname?: + Returns a list of all subclasses of the class, if subclassname + was not specified, otherwise it returns 1 if subclassname is a + subclass and 0 if not. + + <@li><@TT> ClassName info superclass ?superclassname?: + Returns a list of all super-classes of the class, + if superclassname was not specified, otherwise it returns + 1 if superclassname is a superclass and 0 if not. + <@/ul> + } + return "Value of introspected option as a string." +} + +@ Class instproc instdestroy { + obj "obj/class name" + ?args? "arguments passed to the destructor" +} { + Description { + Standard destructor. Destroys XOTcl object physically from the memory. + Can be overloaded for customized destruction process. + <@p> + In XOTcl objects are not directly destroyed, when a destroy is + encountered in a method. Beforehand, the interpreter looks up whether + the object is still referenced on the method callstack or not. If not, + the object is directly destroyed. Otherwise every occurrence of the + object on the callstack is marked as destroyed. During popping of the + callstack, for each object marked as destroyed, the reference count is + decremented by one. When no more references to the object are on the + callstack the object is physically destroyed. This way we can assure + that objects are not accessed with [self] in running methods after + they are physically destroyed. + } + return "empty string" +} + +@ Class instproc instfilter { + filterList "list of methods that should be registered as filters" +} { + Description { + Specifies the list of filters registered for the class. + <@tt>instfilter overwrites all previous setting. + Filters must be available on the class or its heritage + order. Filters may also reside on the meta-class of the class. + + Filter list may contain filter guards. Then the + filter is composed of two list elements: {filtername filterguard}. + } + return "empty string" +} + +@ Class instproc instfilterappend { + filterList "name of the new instfilter" +} { + description { + Convenience method that appends an instfilter to the existing filters of the class. + } + return "empty string" +} + +@ Class instproc instfilterguard { + filtername "filter name of a registered filter" + guard "set of conditions to execute the filter" +} { + description { + Add conditions to guard a filter registration point. The filter + is only executed, if the guards are true. Otherwise we ignore the + filter. If no guards are given, we always execute the filter. + } + return "empty string" +} + + +@ Class instproc instinvar { + invariantList "Body of invariants for the class" +} { + Description { + Specify invariants for the class. These are inherited by + sub-classes. The invariants must hold for all instances. + All assertions are a list of ordinary Tcl conditions. + } + return "empty string" +} + +@ Class instproc instmixin { + instmixinList "list of classes that should be registered as instmixins" +} { + Description { + Specifies the list of instmixins (per-class mixins) for the class. + Note that the registration of a per-mixin-class does not invoke + automatically the constructors of the registered class. + The method <@tt>instmixin overwrites any previous settings. + } + return "empty string" +} + +@ Class instproc instmixinappend { + mixinList "name of the new instmixin" +} { + description { + Convenience method that appends an instmixin to the existing mixins of the class. + } + return "empty string" +} + +@ Class instproc instparametercmd { + name "variable to be provided with getter/setter method" +} { + description { + Add a getter/setter command for an instance variable with the + specified name. This method is used for example by the + <@A href="#Class-parameter">parameter method. + Example: <@br> + <@tt>Class C<@br> + <@tt>C instparametercmd x<@br> + <@tt>C c1 -x 100<@br> + <@tt>puts [c1 x]<@br> + } + return "empty string" +} + +@ Class instproc instproc { + name "instance method name" + args "instance method arguments" + body "instance method body" + "?preAssertion?" "optional assertions that must hold before the proc executes" + "?postAssertion?" "optional assertions that must hold after the proc executes" +} { + Description { + Specify an instance method in the same style as Tcl specifies procs. + + Optionally assertions may be given. The number of args is either 3 or 5. + Therefore, to specify only post-assertions an empty pre-assertion list + must be given. All assertions are a list + of ordinary Tcl conditions. + } + return "empty string" +} + +@ Class instproc insttclcmd { + name "cmd to be execute in obj scope" +} { + description { + Create a method 'name' that is evaluated as a tcl command in the + scope of the object. E.g. 'Object insttclcmd vwait' creates + an instproc vwait on Object that executes Tcl's vwait in the + scope of the object. That is local vars of the object are accessible + to that vwait. (Used to circumvent, for instance, the TCL_GLOBAL_ONLY + flag of vwait in Tcl.) + } + return "empty string" +} + +@ Class instproc new { + "?-childof obj? ?args?" "args passed to create" +} { + description { + Convenience method to create an autonamed object. E.g.: + <@pre> Http new + creates ::xotcl::__#0, a subsequent call creates ::xotcl::__#1, ...<@br> + If <@tt>-childof obj is specified, the new object is + created as a child of the specified object. + } + return "new object name" +} + +@ Class instproc parameter { + parameterList "list of parameter definitions" +} { + description { + Specify parameters automatically created for each instance. + Parameters denote instance variables which are available on each class instance + and that have a getter/setter method with their own name. + Parameters are specified in a parameter list of the form + {p1 p2 ... pn}. + p1 ... pn may either be parameter names or definitions of the form + {parameterName defaultValue}. + If a default value is given, that parameter + is created during creation process of the instance object, otherwise + only the getter/setter method is created (and the parameter does not + exist). The getter/setter method has the same name as the + parameter. It gets and returns the parameter, if no + argument is specified. With one argument, the parameter is set + to the argument value. + + Example: + <@pre> + Class Car -parameter {{doors 4} color} + Car herby -doors 2 -color green + <@/pre> + } + return "empty string" +} +@ Class instproc parameterclass { + class "parameter class name" +} { + description { + Set the parameter class. + The parameter class specifies how parameters are stored and + maintained internally. Per default, a method "default" is called, + to set the parameter with a default value. + + I.e., + <@pre> + Class Car -parameter { + {doors 4} + } + <@/pre> + + is a short form for + <@pre> + Class Car -parameter { + {doors -default 4} + } + <@/pre> + + For specialized parameter classes other methods can be called, e.g.<@br> + <@pre> + {doors -default 3 -updateWidget car} + <@/pre> + } + return "empty string" +} + +@ Class instproc recreate { + obj "obj to be recreated" + ?args? "arbitrary arguments" +} { + description { + Hook called upon recreation of an object. Performs standard object + initialization, per default. May be overloaded/-written. It calls + another method cleanup which handles actual cleanup of the object + during next. That means, if you overload recreate, in the pre-part + the object still contains its old state, after next it is cleaned up. + } + return "obj name" +} + +@ Class instproc superclass { + classList "list of classes" +} { + description { + Specify super-classes for a class. "superclass" changes the list + of superclasses dynamically to <@tt>classList. + } + return "empty string" +} + +@ Class instproc unknown { + ?args? "arbitrary arguments" +} { + description { + Standard unknown mechanism. This mechanism is always triggered when + XOTcl does not know a method called on an object. Supposed that + there is no method with the called name, XOTcl looks up the method + "unknown" (which is found on the Class Object) and executes it. + The standard unknown-mechanism of XOTcl calls create with all + arguments stepping one step to the right; in the general case: + + <@pre>ClassName create ClassName ?args?<@/pre> + + Unknown can be overloaded in user-defined subclasses of class. + } + return "Standard unknown mechanism returns result of create" +} + +@ Class instproc volatile { + "" "" +} { + description { + This method is used to specify that the object + should be deleted automatically, when the current + tcl-proc/object-proc/instproc is left. Example + <@tt>set x [Object new -volatile] + } + return "empty string" +} + +@ Class proc __unknown { + "name" "name of class to be created" +} { + description { + This method is called, whenever XOTcl references a class, + which is not defined yet. In the following example: + <@tt>Class C -superclass D + D is not defined. Therefore <@tt>Class __unknown D + is called. This callback can be used to perform auto-loading + of classes. After this call, XOTcl tries again to + resolve D. If it succeeds, XOTcl will continue; otherwise, + an error is generated. + } + return "empty string" +} + +#Class::Parameter instproc values {param args} + +#proc xotcl_mkindex +#proc xotcl_load Index: xotcl/doc/link-checker-xotcl.html =================================================================== diff -u --- xotcl/doc/link-checker-xotcl.html (revision 0) +++ xotcl/doc/link-checker-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,71 @@ + + + + + XOTcl - Documentation -- ./apps/comm/link-checker.xotcl + + + +

+ ./apps/comm/link-checker.xotcl + ./apps/comm/link-checker.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+ Package required: xotcl::comm::httpAccess +
+ Package required: xotcl::trace +
+
+ Filename: + + ./apps/comm/link-checker.xotcl + +
+
+ + + + + +
+ Description: + + + A simple link checking program that checks in parallel + pages of a site. +

+ Options:

+ + + + + + +
-url Start-URL
-foreign 0 or 1, specifies, whether foreign links of + local pages should be checked (default 1)
-local A string match pattern to decide + which url should be treated as local + e.g. -local *wu-wien.ac.at/* + Per default the locality filter ist set + to the name of the host followed by '/*'
-restrict 0 or 1, sets the locality filter to the subtree + implied by the URL
-verbose 0 or 1 or 2, verbosity level (default 0)
+ +

+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/logo-100.jpg =================================================================== diff -u Binary files differ Index: xotcl/doc/make-xotcl.html =================================================================== diff -u --- xotcl/doc/make-xotcl.html (revision 0) +++ xotcl/doc/make-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + + + + + XOTcl - Documentation -- ./library/lib/make.xotcl + + + +

+ ./library/lib/make.xotcl + ./library/lib/make.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+
+ Filename: + + ./library/lib/make.xotcl + +
+
+ +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/makeDoc-xotcl.html =================================================================== diff -u --- xotcl/doc/makeDoc-xotcl.html (revision 0) +++ xotcl/doc/makeDoc-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,57 @@ + + + + + XOTcl - Documentation -- ./library/lib/makeDoc.xotcl + + + +

+ ./library/lib/makeDoc.xotcl + ./library/lib/makeDoc.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+ Package required: xotcl::package +
+ Package required: xotcl::xodoc +
+
+ Filename: + + ./library/lib/makeDoc.xotcl + +
+
+ + + + + +
+ Description: + + + Documentation tool for the XOTcl distribution.
+ Usage: 'makeDoc docdir filename ?filename ...?'
+ Called by Makefile. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/metadataAnalyzer-xotcl.html =================================================================== diff -u --- xotcl/doc/metadataAnalyzer-xotcl.html (revision 0) +++ xotcl/doc/metadataAnalyzer-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,599 @@ + + + + + XOTcl - Documentation -- ./library/lib/metadataAnalyzer.xotcl + + + +

+ ./library/lib/metadataAnalyzer.xotcl + ./library/lib/metadataAnalyzer.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::metadataAnalyzer 0.84 +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./library/lib/metadataAnalyzer.xotcl + +
+
+ + + + + +
+ Description: + + + XOTcl file analyzer for @ metadata. E.g.\ used for + doumentation with xoDoc (but in the static variant + StaticMetadataAnalyzer which uses the dynamic + variant in this file). +

+ Sample sample usage: +

+    package require xotcl::metadataAnalyzer
+
+    # instantiate metadata analyzer object
+    MetadataAnalyzer @::m
+    # make this object be known to @ and turn @ metadata processing on
+    @ analyzerObj @::m
+    @ onOff 1
+
+    # read in some metadata tags (in sample file) & execute the file
+    source lib/testx.xotcl
+
+    # turn @ metadata processing off again
+    @ onOff 0
+
+    # print out all collected metadata
+    puts [@::m print]
+    
+ +
+
+
+

+ + + +

Object: @

+ Class: AnalyzerCmd +
+ + + + + + + +
+ Description: + + Recreate @ with metadata analyis funtionality. +
+

+
+

+ + + +

Class: AnalyzerCmd

+ Class: Class +
+ + + + + + + +
+ Description: + + Class that overload the unknown mechanism of @ to provide metadata analysis. +
+

+
+

+ + + +

Class: ClassToken

+ Class: Class +
+ Heritage: ObjToken +
+ + + + + + + +
+ Description: + + + Token for Class metadata. Contains additional parameters: + "instprocList" = list of all instproc token. + +
+

+
+

+ + + +

Class: ConstraintToken

+ Class: Class +
+ Heritage: MetadataToken +
+ + + + + + + +
+ Description: + + + Token for @Constraint Metadata. + +
+

+
+

+ + + +

Class: FileToken

+ Class: Class +
+ Heritage: MetadataToken +
+ + + + + + + +
+ Description: + + + Token for @File Metadata. + +
+

+
+

+ + + +

Class: InstprocToken

+ Class: Class +
+ Heritage: MethodToken +
+ + + + + + + +
+ Description: + + + Token for Instproc metadata. + +
+

+
+

+ + + +

Class: MetaClassToken

+ Class: Class +
+ Heritage: ClassToken +
+ + + + + + + +
+ Description: + + + Token for Meta-Class metadata. + +
+

+
+

+ + + +

Class: MetadataAnalyzer

+ Class: Class +
+ Procs/Instprocs: + print. + + + + + +
+ Description: + + Handler class for building a metadata runtime structure +
+

Instprocs

+
    +
  • + + + + print + + + + + + +
    + Description: + + Print all collected token information to stdout. + This method is also an exmaple how the tokens can be used. +
    +
  • +
+

+
+

+ + + +

Class: MetadataToken

+ Class: Class +
+ Procs/Instprocs: + print, printProperties, sortTokenList. + + + + + +
+ Description: + + + Each collected metadata element is stored in a token object. + MetadataToken is superclass of token object classes. Each metadata token + has two interesting parameters: +

+ "properties" contains list of all described metadata properties. E.g. can + be printed with +

+    foreach p [my set properties] { 
+      if {[my exists $p]} {
+        append c "    $p=[my set $p]\n"
+      }
+    }
+    
+ "name" contains the method, object, ... name of the metadata element. +

+ All metadata token are aggregated by @. Therefore, +

+    foreach mdt [@ info children] { 
+      if {[$mdt istype MetadataToken]} {$mdt print}
+    }
+    
+ prints all token. + + +
+

Instprocs

+
    +
  • + + + + printProperties + + + + + + +
    + Description: + + Print metadata properties to stdout. +
    +
  • +
  • + + + + abstract + print + + + + + + +
    + Description: + + + Abstract method for printing a token to stdout. + +
    +
  • +
+

Procs

+
    +
  • + + + + sortTokenList + l + + + + + + + + + + +
    + Arguments: + + l: token list +
    + Description: + + Sort a token list with names. Since names are autonames, + this means order of appearance in the program. +
    +
  • +
+

+
+

+ + + +

Class: MethodToken

+ Class: Class +
+ Heritage: MetadataToken +
+ + + + + + + +
+ Description: + + + Token for Method metadata. Contains additional parameters: + "arguments" of the method, "returnValue" of the method, + "obj" name, "abstract" = 0 or 1 (whether its an abstract method or not). + +
+

+
+

+ + + +

Class: ObjToken

+ Class: Class +
+ Heritage: MetadataToken +
+ + + + + + + +
+ Description: + + + Token for Object metadata. Contains additional parameters: + "procList" = list of all proc token and "cl"= class name. + +
+

+
+

+ + + +

Class: PackageToken

+ Class: Class +
+ Heritage: MetadataToken +
+ + + + + + + +
+ Description: + + + Token for Package metadata. Contains additional parameters: + "version" of the package and "type"= either "require" or "provide". + + +
+

+
+

+ + + +

Class: ProcToken

+ Class: Class +
+ Heritage: MethodToken +
+ + + + + + + +
+ Description: + + + Token for Proc metadata + +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/mixinStrategy-xotcl.html =================================================================== diff -u --- xotcl/doc/mixinStrategy-xotcl.html (revision 0) +++ xotcl/doc/mixinStrategy-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,245 @@ + + + + + XOTcl - Documentation -- ./library/lib/mixinStrategy.xotcl + + + +

+ ./library/lib/mixinStrategy.xotcl + ./library/lib/mixinStrategy.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::mixinStrategy 0.8 +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./library/lib/mixinStrategy.xotcl + +
+
+ + + + + +
+ Description: + + + These methods provide support for managing "strategies", i.e. + mixin-classes, where only one kind of a family of conformant + mixins should be registered. +

+ Naming convertions for strategies: + All strategies must follow the naming convention 'kind=implementation'. + Examples are the persistency strategy 'eager' specfied as + 'persistent=eager' or the persistency strategy 'lazy' (specified as + 'persistent=lazy') + +

+
+
+

+ + + +

Class: Object

+ Procs/Instprocs: + add, mixinQueryStrategy, mixinStrategy, remove. + +
+

Instprocs

+
    +
  • + + + + mixinStrategy + strategy + + + + + + + + + + + + + + +
    + Arguments: + + strategy: Strategy to be added +
    + Description: + + + This method adds or replaces a new strategy from the mixin + list. Strategies are named following the converntion mentioned + above. + +
    + Return: + + old strategy +
    +
  • +
  • + + + + mixinQueryStrategy + kind + + + + + + + + + + + + + + +
    + Arguments: + + kind: strategy kind +
    + Description: + + + This method searches the mixin list for a mixin of this + kind (starting with $kind=) + +
    + Return: + + returns the maching strategy +
    +
  • +
  • + + + + add + construct + args + + + + + + + + + + + + + + + + + + +
    + Arguments: + + construct: (inst) 'filter' or 'mixin' +
    + + + args: to be added +
    + Description: + + add the specified (inst) 'filters' or 'mixins' +
    + Return: + + empty +
    +
  • +
  • + + + + remove + construct + args + + + + + + + + + + + + + + + + + + +
    + Arguments: + + construct: (inst) 'filter' or 'mixin' +
    + + + args: to be removed +
    + Description: + + remove the specified (inst) 'filters' or 'mixins' +
    + Return: + + empty +
    +
  • +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/next-path-mixin-movement.gif =================================================================== diff -u Binary files differ Index: xotcl/doc/next-path.gif =================================================================== diff -u Binary files differ Index: xotcl/doc/obj_class_system.gif =================================================================== diff -u Binary files differ Index: xotcl/doc/observer-xotcl.html =================================================================== diff -u --- xotcl/doc/observer-xotcl.html (revision 0) +++ xotcl/doc/observer-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,53 @@ + + + + + XOTcl - Documentation -- ./apps/scripts/observer.xotcl + + + +

+ ./apps/scripts/observer.xotcl + ./apps/scripts/observer.xotcl

+
+

+

Package/File Information

+ No package provided/required +
+
+ Filename: + + ./apps/scripts/observer.xotcl + +
+
+ + + + + +
+ Description: + + + Simple observer pattern meta-class taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/openacs-4/readme.txt =================================================================== diff -u --- xotcl/doc/openacs-4/readme.txt (revision 0) +++ xotcl/doc/openacs-4/readme.txt (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,51 @@ +This is the OpenACS Community System. + +OpenACS (Open ArsDigita Community System) is an advanced toolkit for +building scalable, community-oriented web applications. + +The original ACS, which formed the foundation of OpenACS is described +in http://photo.net/wtr/thebook/community.html + +The original ACS was Copyright (C) 1995-2000 ArsDigita Corporation +and, in some cases, individual authors. + +OpenACS is a community created and supported software system, visit +http://openacs.org for more information. + +The major change in OpenACS 4.x is its database-independence; it can +use either PostgreSQL (7.1 or later) or Oracle (8.1.6 or later). + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +-------------- + +Documentation for this system is at viewable via your favorite browser +at http://openacs.org/doc + +For installation instructions, please see +http://openacs.org/4/ + +Once your service is up and running, this same documenation is +available at + +http://yourservicename/www/doc/ + +The release notes for this release are available at +packages/acs-core-docs/www/release-notes/. + +This is an early development version of OpenACS 4.x. Production use +is NOT recommended. Please report bugs via http://openacs.org/sdm + + Index: xotcl/doc/package-xotcl.html =================================================================== diff -u --- xotcl/doc/package-xotcl.html (revision 0) +++ xotcl/doc/package-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,150 @@ + + + + + XOTcl - Documentation -- ./library/lib/package.xotcl + + + +

+ ./library/lib/package.xotcl + ./library/lib/package.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::package 0.91 +
+ Package required: xotcl::mixinStrategy +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./library/lib/package.xotcl + +
+
+ + + + + +
+ Description: + + + Represent Tcl package loading command by an XOTcl + object. Enables tracking, tracing, and verbose output + of package loading + +
+
+
+

+ + + +

Object: package

+ Class: Object +
+ Procs + present, verbose. + + + + + +
+ Description: + + + Supports all Tcl package options plus present and verbose. + +
+

Procs

+
    +
  • + + + + present + args + + + + + + + + + + +
    + Arguments: + + args: packageName or -exact packageName +
    + Description: + + + Check whether a package is present or not. Similar to Tcl's + package present, but works with Tcl < 8.3 + +
    +
  • +
  • + + + + verbose + v + + + + + + + + + + +
    + Arguments: + + v: 1 or 0 +
    + Description: + + + Toggle verbose output on/off. If on, package prints the locations + from where packages are loaded to the screen. Default is off. + +
    +
  • +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/parameter-xotcl.html =================================================================== diff -u --- xotcl/doc/parameter-xotcl.html (revision 0) +++ xotcl/doc/parameter-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + + + + + XOTcl - Documentation -- ./apps/scripts/parameter.xotcl + + + +

+ ./apps/scripts/parameter.xotcl + ./apps/scripts/parameter.xotcl

+
+

+

Package/File Information

+ No package provided/required +
+
+ Filename: + + ./apps/scripts/parameter.xotcl + +
+
+ +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/persistenceExample-xotcl.html =================================================================== diff -u --- xotcl/doc/persistenceExample-xotcl.html (revision 0) +++ xotcl/doc/persistenceExample-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + + + + + XOTcl - Documentation -- ./library/store/persistenceExample.xotcl + + + +

+ ./library/store/persistenceExample.xotcl + ./library/store/persistenceExample.xotcl

+
+

+

Package/File Information

+ Package required: xotcl::store::persistence +
+
+ Filename: + + ./library/store/persistenceExample.xotcl + +
+
+ +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/pinger-xotcl.html =================================================================== diff -u --- xotcl/doc/pinger-xotcl.html (revision 0) +++ xotcl/doc/pinger-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,54 @@ + + + + + XOTcl - Documentation -- ./apps/scripts/pinger.xotcl + + + +

+ ./apps/scripts/pinger.xotcl + ./apps/scripts/pinger.xotcl

+
+

+

Package/File Information

+ No package provided/required +
+
+ Filename: + + ./apps/scripts/pinger.xotcl + +
+
+ + + + + +
+ Description: + + + Pinger example for the observer pattern taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + It demonstrates how to observe a network connection. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/pkgIndex.tcl =================================================================== diff -u --- xotcl/doc/pkgIndex.tcl (revision 0) +++ xotcl/doc/pkgIndex.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,11 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex -direct" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded XOTcl-langRef 1.0 [list source [file join $dir langRef.xotcl]] Index: xotcl/doc/secure-webclient-xotcl.html =================================================================== diff -u --- xotcl/doc/secure-webclient-xotcl.html (revision 0) +++ xotcl/doc/secure-webclient-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,58 @@ + + + + + XOTcl - Documentation -- ./apps/comm/secure-webclient.xotcl + + + +

+ ./apps/comm/secure-webclient.xotcl + ./apps/comm/secure-webclient.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+ Package required: xotcl::comm::httpAccess +
+ Package required: xotcl::comm::ftp +
+ Package required: xotcl::trace +
+
+ Filename: + + ./apps/comm/secure-webclient.xotcl + +
+
+ + + + + +
+ Description: + + + A sample secure web client that queries an secure web-server. + It needs to be adopted with different https URLs for testing... + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/secure-webserver-xotcl.html =================================================================== diff -u --- xotcl/doc/secure-webserver-xotcl.html (revision 0) +++ xotcl/doc/secure-webserver-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,60 @@ + + + + + XOTcl - Documentation -- ./apps/comm/secure-webserver.xotcl + + + +

+ ./apps/comm/secure-webserver.xotcl + ./apps/comm/secure-webserver.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+ Package required: xotcl::trace +
+ Package required: xotcl::comm::httpd +
+
+ Filename: + + ./apps/comm/secure-webserver.xotcl + +
+
+ + + + + +
+ Description: + + + This small secure web server that provides its documents + via SSL (https, port 8443) and plain http (port 8086). +
+ This file requires TLS. If you experice problems with + versions obtained from the Web, contact gustaf.neumann@wu-wien.ac.at + for a patch. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/simpleFilters-xotcl.html =================================================================== diff -u --- xotcl/doc/simpleFilters-xotcl.html (revision 0) +++ xotcl/doc/simpleFilters-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,54 @@ + + + + + XOTcl - Documentation -- ./apps/scripts/simpleFilters.xotcl + + + +

+ ./apps/scripts/simpleFilters.xotcl + ./apps/scripts/simpleFilters.xotcl

+
+

+

Package/File Information

+ No package provided/required +
+
+ Filename: + + ./apps/scripts/simpleFilters.xotcl + +
+
+ + + + + +
+ Description: + + + Some simple examples of (inst)filters taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. They demonstrate filters, + filter chains and filter inheritance. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/soccerClub-xotcl.html =================================================================== diff -u --- xotcl/doc/soccerClub-xotcl.html (revision 0) +++ xotcl/doc/soccerClub-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,53 @@ + + + + + XOTcl - Documentation -- ./apps/scripts/soccerClub.xotcl + + + +

+ ./apps/scripts/soccerClub.xotcl + ./apps/scripts/soccerClub.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+
+ Filename: + + ./apps/scripts/soccerClub.xotcl + +
+
+ + + + + +
+ Description: + + + This is a simple introductory example for the language XOTcl. + It demonstrates the basic language constructs on the example of + a soccer club. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/speedtest-xotcl.html =================================================================== diff -u --- xotcl/doc/speedtest-xotcl.html (revision 0) +++ xotcl/doc/speedtest-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,54 @@ + + + + + XOTcl - Documentation -- ./tests/speedtest.xotcl + + + +

+ ./tests/speedtest.xotcl + ./tests/speedtest.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+ Package required: xotcl::test +
+
+ Filename: + + ./tests/speedtest.xotcl + +
+
+ + + + + +
+ Description: + + + Regression and speed test for various ways to achieve a similar + behaviour. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/staticMetadata-xotcl.html =================================================================== diff -u --- xotcl/doc/staticMetadata-xotcl.html (revision 0) +++ xotcl/doc/staticMetadata-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,121 @@ + + + + + XOTcl - Documentation -- ./library/lib/staticMetadata.xotcl + + + +

+ ./library/lib/staticMetadata.xotcl + ./library/lib/staticMetadata.xotcl

+
+

+

Package/File Information

+ Package required: xotcl::metadataAnalyzer +
+ Package provided: xotcl::staticMetadataAnalyzer 0.84 +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./library/lib/staticMetadata.xotcl + +
+
+ + + + + +
+ Description: + + + XOTcl file static analyzer for @ metadata. E.g. used for + doumentation with xoDoc. I.e. allows for reading in a + file and evaluating the metadata-related info only. + +
+
+
+

+ + + +

Class: StaticMetadataAnalyzer

+ Class: Class +
+ Heritage: MetadataAnalyzer +
+ Procs/Instprocs: + analyzeFile. + + + + + +
+ Description: + + + Metadata analyzer class that allows for reading in files + and evaluation of the metadata content in the file. + +
+

Instprocs

+
    +
  • + + + + analyzeFile + name + + + + + + + + + + +
    + Arguments: + + name: File name +
    + Description: + + Analyze a file and build up a token structure for each metadata token in the file. +
    +
  • +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/test-xotcl.html =================================================================== diff -u --- xotcl/doc/test-xotcl.html (revision 0) +++ xotcl/doc/test-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,94 @@ + + + + + XOTcl - Documentation -- ./library/lib/test.xotcl + + + +

+ ./library/lib/test.xotcl + ./library/lib/test.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::test 1.03 +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./library/lib/test.xotcl + +
+
+ + + + + +
+ Description: + + + Simple regression test support. + +
+
+
+

+ + + +

Class: Test

+ Class: Class +
+ + + + + + + +
+ Description: + + + Class Test is used to configure test instances, which can + be configured by the following parameters: +
    +
  • cmd: the command to be executed
  • +
  • expected: the expected result
  • +
  • count: number of executions of cmd
  • +
  • pre: a command to be executed at the begin of the test (before cmd)
  • +
  • post: a command to be executed after the test (after all cmds)
  • +
+ The defined tests can be executed by Test run + +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/testo-xotcl.html =================================================================== diff -u --- xotcl/doc/testo-xotcl.html (revision 0) +++ xotcl/doc/testo-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,108 @@ + + + + + XOTcl - Documentation -- ./tests/testo.xotcl + + + +

+ ./tests/testo.xotcl + ./tests/testo.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./tests/testo.xotcl + +
+
+ + + + + +
+ Description: + + + This is a class which provides regression test objects + for the OTcl derived features of the XOTcl - Language. + This script is based upon the test.tcl script of the OTcl distribution + and adopted for XOTcl. + +
+
+
+

+ + + +

Class: TestClass

+ Class: Class +
+ + + + + + + +
+ Description: + + + A meta-class for test objects. + +
+

+
+

+ + + +

Class: TestSuite

+ Class: Class +
+ + + +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/testx-xotcl.html =================================================================== diff -u --- xotcl/doc/testx-xotcl.html (revision 0) +++ xotcl/doc/testx-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,692 @@ + + + + + XOTcl - Documentation -- ./tests/testx.xotcl + + + +

+ ./tests/testx.xotcl + ./tests/testx.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./tests/testx.xotcl + +
+
+ + + + + +
+ Description: + + + This is a file which provides a regression test + for the features of the XOTcl - Language. + +
+
+
+

+ + + +

Class: TestX

+ Class: Class +
+ + + +
+

+
+

+ + + +

Object: assertions

+ Class: TestX +
+ + + + + + + +
+ Description: + + Regression test object testing the assertions. +
+

+
+

+ + + +

Object: condMixins

+ Class: TestX +
+ + + + + + + +
+ Description: + + + Regression test for conditional mixins + +
+

+
+

+ + + +

Object: copymove

+ Class: TestX +
+ + + + + + + +
+ Description: + + + Regression test for copy/move methods + +
+

+
+

+ + + +

Object: filterAddRemove

+ Class: TestX +
+ + + + + + + +
+ Description: + + Regression test object testing adding/removing of filters. +
+

+
+

+ + + +

Object: filterClassChange

+ Class: TestX +
+ + + + + + + +
+ Description: + + Regression test object testing class changes of filters. +
+

+
+

+ + + +

Object: filterGuards

+ Class: TestX +
+ + + + + + + +
+ Description: + + Regression test object testing filter guards. +
+

+
+

+ + + +

Object: filterInfo

+ Class: TestX +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Description{: + + Regression +
+ Test: + + object +
+ Testing: + + introspection +
+ Of: + + filters. +
+ }: + + +
+

+
+

+ + + +

Object: filterSimpleObserver

+ Class: TestX +
+ + + + + + + +
+ Description: + + Regression test object testing a simple observer using filters. +
+

+
+

+ + + +

Object: init_params

+ Class: TestX +
+ + + + + + + +
+ Description: + + + Regression test object testing the parameter instance method, + the init dash '-' and constructor calling. + +
+

+
+

+ + + +

Object: mixinGuards

+ Class: TestX +
+ + + + + + + +
+ Description: + + Regression test object testing mixin guards. +
+

+
+

+ + + +

Object: mixinInheritanceTest

+ Class: TestX +
+ + + + + + + +
+ Description: + + + Regression test object testing per-object mixin inheritance. + +
+

+
+

+ + + +

Object: mixinTest

+ Class: TestX +
+ + + + + + + +
+ Description: + + + Regression test object testing per-object mixins. + +
+

+
+

+ + + +

Object: nestingClasses

+ Class: TestX +
+ + + + + + + +
+ Description: + + Regression test object testing the class nesting feature. +
+

+
+

+ + + +

Object: nestingObjects

+ Class: TestX +
+ + + + + + + +
+ Description: + + Regression test object testing the object nesting feature. +
+

+
+

+ + + +

Object: nextTest

+ Class: TestX +
+ + + + + + + +
+ Description: + + + Regression test object testing the next primitive. + +
+

+
+

+ + + +

Object: objectReferences

+ Class: TestX +
+ + + + + + + +
+ Description: + + + Regression test for object and class references in tcl_objs + +
+

+
+

+ + + +

Object: recreation

+ Class: TestX +
+ + + + + + + +
+ Description: + + + Regression test for object recreation/cleanup. + +
+

+
+

+ + + +

Object: smallScripts

+ Class: TestX +
+ + + + + + + +
+ Description: + + + Regression test object testing arbitrary features. + +
+

+
+

+ + + +

Object: stdargs

+ Class: TestX +
+ + + + + + + +
+ Description: + + + Regression test object testing the ability of the next primitive to pass + arguments without naming them. + +
+

+
+

+ + + +

Object: volatileObjects

+ Class: TestX +
+ + + + + + + +
+ Description: + + + Regression test for volatile objects + +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/trace-xotcl.html =================================================================== diff -u --- xotcl/doc/trace-xotcl.html (revision 0) +++ xotcl/doc/trace-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,431 @@ + + + + + XOTcl - Documentation -- ./library/lib/trace.xotcl + + + +

+ ./library/lib/trace.xotcl + ./library/lib/trace.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::trace 0.91 +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./library/lib/trace.xotcl + +
+
+ + + + + +
+ Description: + + + Various tracing tools for the XOTcl language. + +
+
+
+

+ + + +

Class: Object

+ Procs/Instprocs: + lintFilter, showCall, showClass, showMsg, showStack, showTimeEnd, showTimeStart, showVars, statFilter, traceFilter. + +
+

Instprocs

+
    +
  • + + + + traceFilter + args + + + + + + + + + + + + + + +
    + Arguments: + + args: arbitrary args +
    + Description: + + + Filter to trace every method call on an object or class hierarchy. + Outputs a message befora and after each call of the traced object. + +
    + Return: + + empty string +
    +
  • +
  • + + + + lintFilter + + + + + + +
    + Description: + + Experimental lint filter +
    +
  • +
  • + + + + statFilter + + + + + + +
    + Description: + + Experimental statistics filter +
    +
  • +
  • + + + + showVars + args + + + + + + + + + + +
    + Arguments: + + args: ist of variables +
    + Description: + + Show the values of the specified variables (or of all variables) + of an object on stderr. +
    +
  • +
  • + + + + showMsg + msg + + + + + + + + + + +
    + Arguments: + + msg: optional output +
    + Description: + + Show a message msg with the form "[self] $cls->$method $msg" on stderr. +
    +
  • +
  • + + + + showClass + + + + + + +
    + Description: + + Show classes and mixins of the object +
    +
  • +
  • + + + + showStack + maxDepth + + + + + + + + + + +
    + Arguments: + + maxDepth: max stack depth, default=100 +
    + Description: + + Show callstack up to the specified calldepth. +
    +
  • +
  • + + + + showCall + + + + + + +
    + Description: + + Show the current call with the form "[self] $cls->$method $args" on stderr. +
    +
  • +
  • + + + + showTimeStart + ?handle? + + + + + + + + + + +
    + Arguments: + + ?handle?: Handle object name, optional +
    + Description: + + start a timer +
    +
  • +
  • + + + + showTimeEnd + ?handle? + + + + + + + + + + +
    + Arguments: + + ?handle?: Handle object name, optional +
    + Description: + + end a timer and show result +
    +
  • +
+

+
+

+ + + +

Object: Trace

+ Class: Object +
+ Procs + closeTraceFile, openTraceFile, puts. + + + + + +
+ Description: + + + Write trace outputs and produce statistics. Variable traceStream + defines where to write trace output (default: stderr). + +
+

Procs

+
    +
  • + + + + puts + line + + + + + + + + + + +
    + Arguments: + + line: output line +
    + Description: + + + Define how traceFilter writes to the output stream. Default: + write to trace stream. + +
    +
  • +
  • + + + + openTraceFile + name + + + + + + + + + + +
    + Arguments: + + name: file name +
    + Description: + + + Redirect trace output to file. + +
    +
  • +
  • + + + + closeTraceFile + name + + + + + + + + + + +
    + Arguments: + + name: file name +
    + Description: + + + Close trace file and redirect output to stderr. + +
    +
  • +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/tutorial.html =================================================================== diff -u --- xotcl/doc/tutorial.html (revision 0) +++ xotcl/doc/tutorial.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,4035 @@ + + + + + XOTcl - Tutorial + + + + + + + + + + + +
+

XOTcl + - Tutorial - Index +

+
+
+

Version: 1.2.0

+ + + + + + + + + + +
+

Introduction + +

+
+
+ + +

 
Language Overview +

+ +

XOTcl [Neumann and Zdun 2000a] is an extension +to the object-oriented scripting language OTcl [Wetherall and Lindblad 1995] which itself extends +Tcl [Ousterhout 1990] (Tool Command Language) with +object-orientation. XOTcl is a value-added replacement for OTcl and +does not require OTcl to compile.

+ +

XOTcl runs in the tclsh and provides a few extension +commands. These are offered in a Tcl namespace ::xotcl, and need to be +imported into the current namespace. All Tcl-commands +remain available (and are also applicable on the extension +constructs). +

+

A central property of Tcl is, that it uses strings solely for the +representation of data. Internally it uses an dynamic type system with +automatic conversion (which enables efficient type handling). For +that reason all components (e.g. written in C) once integrated in Tcl +automatically fit together and the components can be reused in +unpredicted situations without change. The evolving component +frameworks provide a high degree of code reuse, rapid +application development, and ease of use. The application developer +may concentrate on the application task solely, rather than investing +efforts in fitting components together. Therefore, in certain +applications scripting languages like Tcl are very useful for a fast +and high-quality development of software (see [Ousterhout 1998] for more details). +

+

Tcl is equipped with appropriate functionalities for the easy +gluing of components, like dynamic typing, dynamic extensibility, and +read/write introspection. OTcl is an object-oriented extension to Tcl, +which encourages a Tcl-like programming style and is composed of +language constructs with properties similar to Tcl. It offers an +object-orientation with encapsulation of data and operation without +protection mechanisms and single and multiple inheritance. +Furthermore it enables to change the relationships dynamically, offers +read/write introspection, has a three level class system based on +meta-classes and offers method chaining. These abilities are +integrated in XOTcl with only slight changes to OTcl visible to the +programmer. +

+

The XOTcl extension aims at complexity and adaptability issues that +may occur in context of large (object-oriented) software structures +and in the context of component glueing. In particular we added the +following support: +

+
    +
  • Filters as a means of + abstractions over method invocations to implement large program + structures, like design patterns. +

    +
  • Mixin Classes, as a + means to give an object or a classes' instances access to several different supplemental + classes, which may be changed dynamically. +

    +
  • Dynamic Object Aggregations, + to provide dynamic aggregations through nested namespaces. +

    +
  • Nested Classes, to reduce + the interference of independently developed program structures. +

    +
  • Assertions, to reduce the + interface and the reliability problems caused by dynamic typing and, + therefore, to ease the combination of components. +

    +
  • Meta-data and Automatic Documentation, to enhance self-documentation of objects + and classes. +

    +
+ + + +


+

+

+   +

+

Figure 1: +Language Extensions of XOTcl +

+
+ + + + + +
+

+
+
+ + +

 
Introductory Overview Example: Soccer Club +

+

+To give you an impression of the language before we go into the +details of the language construct, we present in this section a +simple, introductory example. It shall demonstrate the basic +language constructs on the example of a soccer club (the full code can +be found in the xotcl/src/scripts/soccerClub.xotcl file. All +the characters in this example are fictitious, and any resemblance to +actual persons, living or deceased, is coincidental. +

+

+In XOTcl we do not have to provide a file description as a comment, +but we can use the @ object, which is used generally to +provide any kind of information, meta-data, and documentation on a +running program. Here, we just give a file description. Then the +makeDoc.xotcl tool can automatically document the program file for +us. +

+
+  @ @File {
+    description {
+      This is a simple introductory example for the language XOTcl. 
+      It demonstrates the basic language constructs on the example of
+      a soccer club.
+    }
+  }
+
+

+ +All things and entities in XOTcl are objects, a special kind of objects +are classes. These define common properties for other objects. For a +soccer club, we firstly require a common class for all kinds of members. +

+

+Common to all members is that they have a name. Common properties +defined across all instances of a class are called 'parameter' in +XOTcl. In this example the instance variable name will be +initialized by default with an empty string. +

+
+  Class ClubMember -parameter {{name ""}}
+
+

+A special club member is a Player. Derived classes can be +build with inheritance (specified through +superclass). Players may have a playerRole (defaults +to NONE). +

+
+  Class Player -superclass ClubMember -parameter {{playerRole NONE}}
+
+

+Other club member types are trainers, player-trainers, and presidents: +

+
+  Class Trainer -superclass ClubMember
+  Class President -superclass ClubMember
+
+

+The PlayerTrainer uses multiple inheritances by being both a player +and a trainer: +

+
+  Class PlayerTrainer -superclass {Player Trainer}
+
+

+Now we define the SoccerTeam class: +

+
+  Class SoccerTeam -parameter {name location type}
+
+

+We may add a player. This is done by a method. Instance methods are +in XOTcl defined with instproc. All club members are aggregated in +the team (denoted by :: namespace syntax). +

+
+  SoccerTeam instproc newPlayer args {
+    # we create a new player who is part of the soccer team
+    # "eval" is needed to pass the provided arguments to the call of new
+    eval Player new -childof [self] $args
+  }
+
+

+A player can be transfered to another team. The player object does +not change internally (e.g. the playerRole stays the same). Therefore we +move it to the destination team. +

+
+  SoccerTeam instproc transferPlayer {playername destinationTeam} {
+    # We use the aggregation introspection option children in order
+    # to get all club members
+    foreach player [my info children] {
+      # But we only remove matching playernames of type "Player". We do
+      # not want to remove another club member type who has the same
+      # name.
+      if {[$player istype Player] && [$player name] == $playername} {
+        # We simply 'move' the player object to the destination team.
+        # Again we use a unique autoname in the new scope
+        $player move [set destinationTeam]::[$destinationTeam autoname player%02d]
+      }
+    }
+  }
+
+

+Finally we define two convenience to print the members/players to +the stdout with puts. +

+
+  SoccerTeam instproc printMembers {} {
+    puts "Members of [my name]:"
+    foreach m [my info children] {puts "  [$m name]"}
+  }
+  SoccerTeam instproc printPlayers {} {
+    puts "Players of [my name]:"
+    foreach m [my info children] {
+      if {[$m istype Player]} {puts "  [$m name]"}
+    }
+  }
+
+

+Now let us build to example soccer team objects. +

+
+  SoccerTeam chelsea -name "Chelsea FC" -location "Chelsea"
+  SoccerTeam bayernMunich -name "F.C. Bayern M�nchen" -location "Munich"
+
+

+ +With addPlayer we can create new aggregated player objects +

+Let us start some years in the past, when "Franz Beckenbauer" was +still a player. +

+
+  set fb [bayernMunich newPlayer -name "Franz Beckenbauer" \
+    -playerRole PLAYER]
+
+

+playerRole may not take any value. It may either be NONE, PLAYER, +or GOALY ... such rules may be given as assertions (here: an instinvar +gives an invariant covering all instances of a class). In XOTcl +the rules are syntactically identical to if statements: +

+
+  Player instinvar {
+      {[my playerRole] == "NONE" ||  
+       [my playerRole] == "PLAYER" || 
+       [my playerRole] == "GOALY"}
+  }
+
+

+If we break the invariant and turn assertions checking on, we should +get an error message: +

+
+  $fb check all
+  if {[catch {$fb set playerRole SINGER} errMsg]} {
+    puts "CATCHED EXCEPTION: playerRole has either to be NONE, PLAYER, or TRAINER"
+    # turn assertion checking off again and reset to PLAYER
+    $fb check {}
+    $fb set playerRole PLAYER
+  }
+
+

+But soccer players may play quite different, orthogonal +roles. E.g. Franz Beckenbauer was also a singer (a remarkably bad +one). However, we can not simply add such orthogonal, extrinsic +extensions with multiple inheritance or delegation. Otherwise we +would have either to build a lot of unnecessary helper classes, like +PlayerSinger, PlayerTrainerSinger, etc., or we would have to build +such helper objects. This either leads to an unwanted combinatorial +explosion of class or object number +

+Here we can use a per-object mixin, which is a language construct +that expresses that a class is used as a role or as an extrinsic +extension to an object. +

+First we just define the Singer class. +

+
+  Class Singer
+  Singer instproc sing text {
+    puts "[my name] sings: $text, lala."
+  }
+
+

+Now we register this class as a per-object mixin on the player object: +

+
+  $fb mixin Singer
+
+

+And now Franz Beckenbauer is able to sing: +

+
+  $fb sing "lali"
+
+

+But Franz Beckenbauer has already retired. When a player retires, we +have an intrinsic change of the classification. He *is* not a player +anymore. But still he has the same name, is club member, and +is a singer (brrrrrr). +

+Before we perform the class change, we extend the Player class to +support it. I.e. the playerRole is not valid after class change +anymore (we unset the instance variable). +

+
+  Player instproc class args {
+    my unset playerRole
+    next
+  }
+
+

+Now we can re-class the player object to its new class (now Franz +Beckenbauer is President of Bayern Munich. +

+
+  $fb class President
+  # Check that the playerRole isn't there anymore.
+  if {[catch {$fb set playerRole} errMsg]} {
+    puts "CATCHED EXCEPTION: The player role doesn't exist anymore \
+         (as it should be after the class change)"
+  }
+
+

+But still Franz Beckenbauer can entertain us with what he believes +is singing: +

+
+  $fb sing "lali"
+
+

+Now we define some new players for Bayern Munich: +

+
+  bayernMunich newPlayer -name "Oliver Kahn" -playerRole GOALY
+  bayernMunich newPlayer -name "Giovanne Elber" -playerRole PLAYER
+
+

+If we enlist the players of Munich Franz Beckenbauer is not enlisted +anymore: +

+
+  bayernMunich printPlayers
+
+

+But as a president he still appears in the list of members: +

+
+  bayernMunich printMembers
+
+

+Now consider an orthonogal extension of a transfer list. Every +transfer in the system should be notified. But since the transfer +list is orthogonal to SoccerTeams we do not want to interfere with +the existing implementation at all. Moreover, the targeted kind of +extension has also to work on all subclasses of SoccerTeam. Firstly, we +just create the extension as an ordinary class: +

+
+  Class TransferObserver
+  TransferObserver instproc transferPlayer {pname destinationTeam} {
+    puts "Player '$pname' is transfered to Team '[$destinationTeam name]'"
+    next
+  }
+
+

+Now we can apply the class as a per-class mixin, which functions +exactly like a per-object mixin, but on all instances of a class and +its subclasses. The next primitive ensures that the original +method on SoccerTeam is called after notifying the transfer (with +puts to stdout): +

+
+  SoccerTeam instmixin TransferObserver
+
+

+If we perform a transfer of one of the players, he is moved to the new +club and the transfer is reported to the stdout: +

+
+  bayernMunich transferPlayer "Giovanne Elber" chelsea
+
+

+Finally we verify the transfer by printing the players: +

+
+  chelsea printPlayers
+  bayernMunich printPlayers
+
+

+ +



+

+ + + + + +
+

Object + and Class System +

+
+
+

In XOTcl every object is associated with a class over the class +relationship. Classes are special objects with the purpose of +managing other objects. ``Managing'' means that a class controls the +creation and destruction of its instances and that it contains a +repository of methods (``instprocs'') accessible for the instances. +Object-specific methods are called ``procs'', instance methods are +called ``instprocs''. +

+

The instance methods common to all objects are defined in the root +class Object (predefined or user-defined). Since a class is a +special (managing) kind of object it is managed itself by a special +class called ``meta-class'' (which manages itself). One interesting +aspect of meta-classes is that by providing a constructor +pre-configured classes can be derived. New user-defined meta-classes +can be derived from the predefined meta-class Class in order +to restrict or enhance the abilities of the classes that they manage. +Therefore meta-classes can be used to instantiate large program +structures, like some design patterns (see [Neumann and Zdun 1999a] for more +details). The meta-class may hold the generic parts of the +structures. Since a meta-class is an entity of the program, it is +possible to collect these in pattern libraries for later reuse easily. +

+

XOTcl supports single and multiple inheritance. Classes are ordered +by the relationship superclass in a directed acyclic +graph. The root of the class hierarchy is the class Object. +A single object can be instantiated directly from this class. An +inherent problem of multiple inheritance is the problem of name +resolution, when for example two super-classes contain an instance +method with the same name. XOTcl provides an intuitive and unambiguous +approach for name resolution by defining the precedence order along a +linear ``next-path'' incorporating the class and mixin +hierarchies, which is modeled after CLOS. A method can invoke +explicitly the shadowed methods by the predefined command +next. When this command is executed a shadowed method is +``mixed into'' the execution of the current method. Method chaining +without explicit naming of the targeted method is very important for +languages supporting a dynamic class system, because one cannot always +predict which classes are currently participating in the inheritance +hierarchy at design time (often necessary in inheritance models, like +C++). +

+

An important feature of all XOTcl +objects is the read/write introspection. The reading introspection +abilities of XOTcl are packed compactly into the info +instance method which is available for objects and classes. All +obtained information can be changed at run-time dynamically with +immediate effect. Unlike languages with a static class concept, XOTcl +supports dynamic class/superclass relationships. At any time the class +graph may be changed entirely using the superclass method, or +an object may change its class through the class method. This +feature can be used for an implementation of a life-cycle or other +intrinsic changes of object properties (in contrast to extrinsic +properties e.g. modeled through roles and implemented through +per-object and per-class mixins [Neumann and +Zdun 1999c] ) . These changes can be achieved without loosing the +object's identity, its inner state, and its per-object behavior (procs +and per-object mixins). +

+

+   +

+

Figure 2: +Object and Class System +

+
+ + + + + +
+

+
+
+ + + + + +
+

Basic + Functionalities +

+
+
+

 
Objects +

+

Initially XOTcl offers two new commands: Object and +Class. They represent hooks to the features of the language. +This section discusses both of them in detail and shows how they +function in the context of XOTcl. Note, that even if most of this is +compatible to OTcl, a few changes occur. For this reason, this +section is no introduction to plain OTcl. The Object command +provides access to the Object class, which holds the common +features of all objects, and allows us to define new objects. Objects +are always instances of classes, therefore, objects defined with the +Object command are (initially) instances of the Object +class. But since they have no user-defined type, they may be referred +to as singular objects. As all other objects they may be +specialized by object-operations and -data. +

+

The object command has the following syntax: +

+
+  Object objName ?args?
+

+A command of this form is a short-cut for a message to the create +instance method (forwarded automatically by the unknown +mechanism, which is invoked every time the message dispatch system +discovers an unknown message): +

+
+  Object create objName ?args?
+

+It creates a new object of type Object with the name objName +(in fact it invokes a create call on the Object class). +objName becomes a new command, which allows us to access the +created object. Similar to the Object command it may be +used like a normal Tcl-command (using sub-commands to access the +object's methods). Therefore, this form of access is called +object-command approach. A simple example is an object which +holds the information of a kitchen. It is created by: +

+
+  Object kitchen
+
+

+An object creation calls the constructor init of the +object's class. The destruction of an object is handled by the +destroy instance method. The general syntax of destroy +is: +

+
+  objName destroy
+

+E.g. the kitchen object is destroyed by: +

+
+  kitchen destroy
+

+To invoke a user-defined destruction process, it is possible to +overload this instance method in every class derived from object. +

+

Data on Objects +

+

The Object class provides a range of operations to manage +objects, including those to manipulate data-structures on the +objects. They are similiar to the same-named Tcl-commands: +

+
+  objName set varname ?value?
+  objName unset v1 ?v2 ... vn?
+
+

+The set instance method with given value option +allows us to manipulate an object-variable's value or to create a new +one, if the variable varname does not exist on the object so +far. Without value option the set operation queries +the variable and returns it's value, if the variable exists, +otherwise it produces an error message. The unset operation +deletes one or optionally a set of variables from an object. For +example the kitchen object can store information on the +color of the wall-paper by: +

+
+  kitchen set wallPaperColor white
+

+Similar to Tcl-variables the object variables are dynamical; they +may be set at run-time when they are needed and unset when they +become obsolete. E.g. the persons in the kitchen may be stored in an +array. If there are no persons in the kitchen the array is deleted: +

+
+  # Peter enters the kitchen to cook
+  kitchen set persons(cook) Peter
+  ...
+  # Marion enters the kitchen to take one of the seats
+  kitchen set persons(seat1) Marion 
+  ...
+  # Both Peter and Marion leave the kitchen
+  # the array is deleted by unset
+  kitchen unset persons
+

+Since XOTcl variables are internally realized through Tcl-variables +they may be treated like all Tcl-variables. For that reason they have +all Tcl-variable abilities, including the possibility to handle them +as lists or arrays (as seen in the last example). The array +command of Tcl is mapped to an XOTcl-command directly. An +object-oriented call to an object of the form +

+
+  objName array option ary args
+

+forwards its arguments to an array Tcl-command for the +object´s instance variable ary. It could be used like +the same-named Tcl-command, e.g. the command +

+
+  kitchen array names persons
+

+returns all indexes currently stored in the persons array. +

+

Similarly Tcl´s incr command is mapped to the +object system. A call with the syntax: +

+
+  objName incr varName ?value?
+

+increments varName with the given value (or without given +value with 1). +

+

Methods for Objects +

+

Methods in XOTcl resemble Tcl-procedures. On objects one can define +object-specific methods, called procs. Instance methods which are +defined on classes are called instprocs. A new proc is defined using +the proc instance method of the class Object: +

+
+  objName proc name args body
+

+The arguments of the proc instance method specify the name, +the arguments as a Tcl-list, and the body of the new proc. All of them +must be given, only one of args and body may be +empty. An example proc would be a method to let persons enter the +kitchen: +

+
+  kitchen proc enter {name} {
+    [self] set persons($name) [clock seconds]
+  }
+

+Here the predefined self command is used in one of three +possible ways, which allow us to access useful information when working +with XOTcl-methods, these are in particular: +

+
    +
  • self: returns the + name of the object, which is currently in execution. This + command is similar to this in C++. It is + automatically generated on each object. If it is called from + outside of an XOTcl method, it produces the error message + "Can't find self". +

    +
  • self class: the self + command with the argument class returns the name of the + class, which holds the currently executing instproc. Note, that this + may be different to the class of the current object. If it is called + from a proc it returns an empty string. +

    +
  • self proc: the self command with the argument + proc returns the name of the currently executing + method (proc or instproc). +

    +
+

The method enter can be written in XOTcl as well with +less syntactic overhead by using the predefined primitive my +instead of [self]:

+
+  kitchen proc enter {name} {
+    my set persons($name) [clock seconds]
+  }
+

+

Note, that there is a difference to the realization of these +object informations to OTcl. XOTcl uses commands in order to make +XOTcl-methods compatible to Tcl-procedures and accessible via +namespace-paths. OTcl uses the three variables self, class +and proc, which are filled automatically with proper values +by the interpreter each time a method is called. To gain backwards +compatibility XOTcl can be compiled with -DAUTOVARS to +provide these variables additionally. By default this option is turned off. +

+

Each XOTcl-method has its own scope for definition of local +variables for the executing method. In most cases when a method uses +object-variables, it is likely that the programmer wants to make one +or more of these variables part of the method's scope. Then the +Tcl-command for variable handling, like set, lindex, +array, ... work also on these variables. The +instvar instance method links a variable to the scope of +an executing method. It has the syntax: +

+
+  objName instvar v1 ?v2 ... vn?
+
+

+It makes the variables v1 ... vn, which must +be variables of the object, part of the current method's scope. A +special syntax is: +

+
+  objName instvar {varName aliasName} ...
+
+

+for one of the variables. This gives the variable with the name +varName the alias aliasName. This way the variables +can be linked to the methods scope, even if a variable with that name +already exists in the scope. Now the enter method can be +adapted slightly and a leave method can be added, which uses +Tcl's info command to check +whether the named person is in the object's persons array. To +demonstrate the alias-syntax this is done with the persons +array and the alias p. +

+
+  kitchen proc enter {name} {
+    my instvar persons
+    set persons($name) [clock seconds]
+  }
+
+  kitchen proc leave {name} {
+    my instvar {persons p}
+    if {[info exists p($name)]} {
+      puts "$name leaves after [expr {[clock seconds]-$p($name)}] seconds" 
+      unset p($name) 
+    } else {
+      puts "$name is not in the room"
+    }
+  }
+
+

+Information about Objects +

+

XOTcl offers reading and writing +introspection. The reading introspection abilities are packed +compactly into the info instance method which is available +for objects and classes (there are special info options for object +aggregations, nested classes, mixins, filters, meta-data and +assertions, which are explained separately in the following +sections). The info instance method's options, from the view +of an object, are summarized in the following table. They are +identically to the OTcl info options on objects. +

+
+

+ Options for the info method on objects

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ objName info args methodName + +

Returns the arguments of the specified method.

+
+ objName info body methodName + +

Returns the body of the specified method.

+
objName info class ?className? + +

Returns the name of the class of the current + object, if className was not specified. Otherwise it + returns 1 if className matches the object's class and 0 if + not. +

+
objName info commands ?pattern? + +

Returns all commands defined on the object + if pattern was not specified. Otherwise it + returns all commands that match the pattern.

+
objName info default methodName arg var

+
+

Returns 1 if the argument arg of + the specified method has a default value, otherwise 0. If + the default value exists it is stored in var.

+
objName info procs ?pattern? + +

Returns all procs defined on the object if + pattern was not specified, otherwise it returns + all procs that match the pattern.

+
objName info vars ?pattern? + +

Returns all variables defined on the object + if pattern was not specified, otherwise it returns + all variables that match the pattern.

+
+ +
+


+

For example on the kitchen object +

+
+  kitchen info procs
+

+returns enter and leave as a Tcl-list since these +are the procs defined on the object. +

+

Classes +

+

Creating Classes and deriving +Instances +

+

There are different ways to create a class in XOTcl. They have in +common that they derive the new class from a meta-class. Initially the +Class command provides access to the meta-class +Class, which holds the features common to all classes. It +also allows one to derive new meta-classes. The common way to create a +new class is: +

+
+  Class className ?args?
+
+ +

+Similar to the object short form, this is a short form of a call to +the create instance method of the meta-class Class, +which is also executed by the standard unknown mechanism. +This mechanism is always triggered when XOTcl does not know a method +called on an object. Supposed that there is no method with the name +className, defined on the class-object of Class, +XOTcl looks up the method unknown (which is found on the +Class Object) and executes it. The standard unknown-mechanism +of XOTcl calls create with all arguments stepping one step +to the right; in the general case: +

+
+  Class create className ?args?
+

+This may also be called directly. Besides the indirection when using +unknown, in most cases there is no difference in the action +performed: Firstly the memory is allocated, using the alloc +instance method; as the next step the constructor init is called +on the creating object, which is in this case the class-object of the +meta-class Class. In seldom cases the programmer may want to +suppress the init call. To do so the alloc instance +method may also be called directly: +

+
+  Class alloc className ?args?
+
+

+As seen in the preceding section objects are created in the same way. +The difference was, that the command Object, which accesses +a class, instead of the command Class, which accesses a +meta-class, was used. The user-defined classes may also be used in +the same way to create new objects: +

+
+  className objName ?args?
+
+

+Resembling the creation of classes this creates an object objName +of type className using the unknown mechanism. That +means the create instance method of the class is called. If +there is no other instance method defined on the class-path so far +(which would mean, an user defined creation process is invoked), the +create instance method of the class Object is +invoked. This method is similar to the create method of the +meta-class Class. It firstly calls the alloc +instance method on its (of the Class class) which allocates +memory for the object, and makes it an instance of it's class. +Afterwards a call to the constructor init is invoked. +

+

Now we can specify the object for the kitchen by the class to +which it belongs. In this case a kitchen is an instance of a room. +

+
+  Class Room
+  Room kitchen
+

+A set call on a class creates an instance variable on the +class-object. This variable is unique for all instances, therefore, +it may be referred to as a class variable. +

+

Methods in Classes +

+

Methods in classes are called "instprocs". Instprocs are reachable +for the class-object and all other instances of the class. The syntax +for defining an instproc is: +

+
+  className instproc procname args body
+
+

+It is similar to the definition of procs on objects, but uses the +keyword instproc to distinguish between the methods defined +on the class-object and those defined on the class. Since all rooms +(in the modeled world) have ceilings, we may want to define a simple +convenience instproc, which is able to set the color: +

+
+  Room instproc setCeilingColor color {
+    my set ceilingColor $color
+  }
+

+A special instproc, the constructor init, was mentioned +already. Now we are able to define such an instproc. Defined on a +class it is responsible for all initialisation tasks, which needed to +be performed, when constructing a new instance object of the class. +The constructor of the Room can initialize a variable for +the color, in which the ceiling is painted, to white as default, +since this is the color of ceilings without painting. +

+
+  Room instproc init args {
+    my setCeilingColor white
+    next
+  }
+
+

+After this definition, all instances derived from the Room +class have an instance variable ceilingColor with the value +white. The args argument used here is a special +argument in Tcl which allows us to use a list of arguments which may +change its length from call to call. +

+

Information about Classes +

+

Resembling to objects, information on +classes may be gained through the info instance method of the +meta-class Class. Note that this instance method does not +only support the class info options, but also the object info options, +since the accessing command refers to the class-object, which itself +is an object and, therefore, offers its informations. The following +table summarizes the additional info options available on classes. +

+
+

Options for the into method on classes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
className info heritage ?pattern? +

Returns a list of all classes in the + precedence order of the class hierarchy matching + pattern or a list of all classes, if + pattern was not specified.

+
className info instances ?pattern? +

Returns a list of the instances of the + class matching pattern or of all instances, if + pattern was not specified. +

+
className info instargs methodName +

Returns the arguments of the specified method.

+
className info instbody methodName +

Returns the body of the specified method.

+
className info instcommands ?pattern? +

Returns all commands defined on the class, if + pattern was not specified, otherwise it returns all + commands that match the pattern.

+
className info subclass ?className2? +

Returns a list of all subclasses of the class, if + className2 was not specified, otherwise it returns 1 if + className2 is a subclass and 0 if not.

+
className info superclass ?className2? +

Returns a list of all super-classes of the class, + if className2 was not specified, otherwise it returns 1 + if className2 is a superclass and 0 if not.

+
+
+


+

Inheritance +

+

Besides encapsulation of operations and state in objects, a second +central ability of object-orientation is inheritance. XOTcl supports +single and multiple inheritance with a directed acyclic class +graph. Automatically each new class created by the instance methods +create and alloc of Class inherits from +Object. Therefore, it is ensured that all instances of the +new class have access to the common features of objects stored in the +class Object. +

+

To specify further inheritance relationships the instance methods +superclass of Class is used: +

+
+  className -superclass classList
+

+E.g. in the example a kitchen may be seen as a +special room: +

+
+  Class Room
+  Class Kitchen -superclass Room
+

+Now all instances of Kitchen are able to access the +operations stored in the Room and in the Kitchen class. +Note the transition the kitchen was going through: firstly it was a +singular object, then it was an object with a user-defined class, +and now it is a class. This is possible (and not senseless) because +of the per-object specialisation ability and the dual shape of a +class, which is at the same time object and class. Both lead to a +seamless connection of the run-time properties (the object features) +and their descriptive properties (the class features). It is possible +to avoid the strict distinction between them, known from static typed +languages, like C++, Java, etc. +

+

Moreover, since the syntaxes of constructs expressing the same +concern are nearly identical, we can refactor a solution with very few +changes to the alternative. We will see similar "ease of refactoring" +throughout the XOTcl language. E.g., we can also easily refactor the +class hierarchies or exchange class hierarchies against mixin +solutions with only slight changes in the code. +

+

Besides single inheritance, as seen, XOTcl provides also multiple +inheritance. This is syntactically solved by giving the superclass +instance method a list of classes instead of a single class as +argument. +

+
+  Class Room
+  Class 4WallsRoom -superclass Room
+  Class CookingPlace
+  Class Kitchen -superclass {4WallsRoom CookingPlace}
+

+Now the kitchen class is specialized a bit more. It is a special room +which has four walls and it is a cooking place. Multiple +inheritance, as seen here, is as simple to apply as single +inheritance. +

+ +Most often when the disadvantages of multiple inheritance are +discussed, the name resolution along the class graph is considered as +the biggest problem. The question is, which method is to be chosen and +which path through class graph is to be taken, if more then one method +of the specified name exist on the class graph. + +

+

In the example such questions +would arise for an object of the Kitchen class, if two +same-named methods are defined on CookingPlace and +4WallsRoom or if a method of the class Object is +called, which is reachable through two paths (along +CookingPlace or Room). +

+ +

Often - e.g. in the +inheritance model of C++ - the path through the graph is not clearly +determined and/or the rules are too complicated to be understood on +the first glance. The programmer often can only determine by trial +which method is found firstly. Than an explicit naming of the class is +necessary, which means storage of non-local information in +sub-classes. Often different compilers of one language behave +differently. All these issues make code reuse difficult. Moreover +understandability and portability are reduced. +

+


+

+

Figure 3: +The example classes and the following next-path

+
+ + + + + +
+
+
+

XOTcl goes an intuitive and unambiguous way to solve this problem. +It resolutes the precedence order along a ``next-path''. +Firstly the class of the object is searched, which is Kitchen +in example. Then the super-classes are searched in definition order, +which means at first 4WallsRoom, then CookingPlace. +Each branch is searched completely, before changing to the next +branch. That means, Room is searched, before the +CookingPlace branch is visited. At last the top of the +hierarchy, the class Object, is searched. +

+ +

The usage of next in XOTcl is different to OTcl: In OTcl +it is always necessary to provide the full argument list for every +invocation explicitly. In XOTcl, a call of next without +arguments can be used to call the shadowed methods with the same +arguments (which is the most common case). When arguments should be +changed for the shadowed methods, they must be provided explicitly in +XOTcl as well. In the rare case that the shadowed method should +receive no argument, the flag --noArgs must be used. +

+ +

Destruction of Classes +

+

Classes are destroyed by the destruction of the class-object using +the destroy method of the Object class. The +destruction of super-classes does not destroy the sub-classes. The +super-class is simply removed from the sub-classes' super-class +lists. All classes have the super-class Object, if no +super-class is specified. Therefore, if all super-classes are +destroyed or removed, the new super-class is Object, not: no +super-class. The destruction of the class of an object does neither +delete the object nor leave it without class. In XOTcl a deleted class +leaves it's instances with the class Object. +

+

So all empty class- and superclass-relationships are automatically +reseted to Object. Note, that this are differences to OTcl, +where the destruction of an class destroys all instances and an empty +super-class list remains empty. +

+

Method Chaining +

+

A special feature of XOTcl is the method chaining without explicit +naming of the ``mix-in''-method. It allows one to mix the same-named +superclass methods into the current method (modeled after CLOS). The +previously described next-path is the basis for this functionality. +At the point marked by a call to the next primitive of XOTcl +the next shadowed method on the next path is searched and, when it is +found, it is mixed into the execution of the current method. When no +method is found, the call of next returns an empty string, +otherwise it returns the result of the called method. Note, that the +realization through a primitive command -- similar to the self +command -- is a difference to OTcl, where next is realized +through an instance method of Object. The syntax is: +

+
+  next ?arguments|--noArgs?
+

+Note, that also the usage of next in XOTcl is different to +OTcl, since the next call without arguments in OTcl means +per default that no arguments are passed. But most often all +arguments are passed through to the shadowed method (since it will +most likely have the same signature like its predecessor). When all +variables should be passed through, in OTcl it is necessary for +correct variable substitution to use: +

+
+  eval $self next $args
+

+To avoid such difficulties, we made the passing of all arguments the +default case; a simple +

+
+  next
+

+performs the task of passing all arguments to the shadowed methods. +These arguments are called the standard arguments. If the +standard argument feature should not be used, optionally arguments +can be given or the flag --noArgs could be set as sole +argument, which means that the shadowed method is called with no +arguments. +

+

+E.g. the following next call ignores the standard arguments +and sends the arguments 1 and 2 instead: +

+
+  next 1 2
+

+ +

As an example all classes involved in the previous example should +get a constructor instance method, which simply sets an instance +variable on the object: +

+
+  Room instproc init args {
+    my set roomNumber 0
+    next
+  }    
+  4WallsRoom instproc init args {
+    my set doorPosition 0
+    next
+  }
+  CookingPlace instproc init args {
+    my set stoveType electric
+    next
+  }
+  Kitchen instproc init args {
+    my set cookName -
+    next
+  }
+

+After creation an object of class Kitchen gets automatically +four instance variables cookName, roomNumber, +doorPosition and stoveType set up with default +values in this order (since this is the order of the classes in the +next-path). Note, that the order is important, because one missing +next call, in one of the init methods, means that succeeding +init methods will not be executed. This mechanism functions +equally on all kinds of instprocs, not only on constructors. +

+

The constructors use the args argument, which allows us to +give a list of variable length as arguments. To ensure reusability of +our classes the constructors should use args in most cases, +since they may pass through arguments for constructors further up the +class hierarchy. +

+

If a proc with the searched name exists on the object it +shadows all instprocs. A next call in a proc leads to +the normal next-paths search, starting with the object's class. +

+

By the way, an observant reader might notice that the example +above can be rewritten without explicit constructors, just by +using paramters with default values. +

+
+  Class Room -parameter {{roomNumber 0}}
+  Class 4WallsRoom -superclass Room -parameter {{doorPosition 0}}
+  Class CookingPlace -parameter {{stoveType electric}}
+  Class Kitchen -superclass {4WallsRoom CookingPlace} -parameter {{cookName -}}
+

+If an instance of a Kitchen is created it will contain instance +variables for doorPosition, cookName, +roomNumber, and stoveType, as the following +statements will show.

+
+  Kitchen k
+  puts [k info vars]
+
+ + +

Dynamic Class and Superclass +Relationships +

+

Another property of XOTcl that distinguishes it from statically typed +languages are dynamics of class relationships. The realization of the +definition of super-classes as seen above with the superclass +method suggests already, that it is not only available at the class +definition time. In the above example its appended to the class +definition with "-superclass" as a short syntax +for method invocation at definition time (all other available methods +can also be called with a preceding dash ("-") appended +to definitions). +

+

At any time the class graph may be changed entirely using the +superclass method. Suppose the rooms and kitchens created in +modeling of a house should be displayed to a screen, but it is not +determined, whether the user of the system has the possibilities for +graphical outputs. Two classes TextOutput and +GraphicalOutput may be defined, which handle the output. Both +have an instproc paint which does the painting of the virtual +world on the chosen display type. The common output requirements are +handled by a derived class VirtualWorldOutput which calls the +paint method of the superclass using next. In +statically typed languages it would need more sophisticated constructs +to change the output class at run-time. E.g. a delegation to another +object handling the intrinsic task of the output object would be +introduced solely for the purpose of configuring the output +form. With a dynamic class system we can use the superclass +method to do so easily: +

+
+  Class TextOutput
+  TextOutput instproc paint args {
+    # do the painting ...
+  }
+  Class GraphicalOutput
+  GraphicalOutput instproc paint args {
+    # do the painting ...
+  }
+
+  # initially we use textual output
+  Class VirtualWorldOutput -superclass TextOutput
+  VirtualWorldOutput instproc paint args {
+    # do the common computations for painting ...
+    next; # and call the actual output
+  }
+
+  # user decides to change to graphical output
+  VirtualWorldOutput superclass GraphicalOutput
+
+

+Sometimes, such a change to new intrinsic properties should not happen +for all instances of a class (or the class hierarchy), but only for +one specific object. Then the usage of a dynamic super-class +relationship is a too coarse-grained means. A second form of such +dynamics is the changing of the relationship between object and +class. This means, objects can also change their class dynamically at +run-time. This feature may be used to model a life-cycle of an object, +without loosing the object's identity, inner state or +per-object-specializations through procs. The class instance +method enables this functionality. +

+

An example would be an agent for the virtual world. Agents may be +placeholders for persons, who interactively travel the world, or +programs, which act automatically. When a person decides at run-time +to give a task it has performed formerly by hand to an automatic +agent, the agents nature changes from interactive agent to automatic +agent, but the identity and the local state (that means the parts of +the task, that are already fulfilled by the person) stay the same. +This is a scenario for changing class relationships, e.g.: +

+
+  Class Agent
+  Class AutomaticAgent -superclass Agent
+  Class InteractiveAgent -superclass Agent
+
+  # create a new agent for a person
+  InteractiveAgent agent1
+
+  # the person does something ...
+  # and decides the change to an automatic agent
+  agent1 class AutomaticAgent
+
+ +

+Meta-Classes +

+

Meta-classes are a special kind of classes. Similar as classes are +managing objects (where managing means: control the creation and +destruction of instances, know what instances exist, provide methods), +meta-classes are managing classes. Since these concepts are sometimes +confusing to people of a background of some other programming +languages, we explain meta-classes slowly with the analogy of classes +and objects. +

+

+When a class Foo is created via the command +

+   Class Foo
+
+ it has no private variables and no special methods. This is + somewhat similar as creating an object via Object: +
+   Object foo
+
+ This plain object foo can be configured directly, or + one can create a class that configures the object. + Instead of writing +
+   Object foo 
+   foo set x 1
+   foo proc hi {} {puts "hello"}
+
+ one can use +
+   Class C -superclass Object
+   C instproc init {} {my set x 1}
+   C instproc hi {} {puts "hello"}
+
+ and create an instance and call the method. +
+   C c1
+   c1 hi
+
+ The same holds for meta-classes and classes as well: Instead of writing +
+   Class Foo
+   Foo set x 1
+   Foo proc hi {} {puts "hello"}
+
+ the following can be used: +
+   Class MC -superclass Class
+   MC instproc init {} {my set x 1}
+   MC instproc hi {} {puts "hello"}
+
+ The instances of meta-classes are classes which can be + defined the usual way: +
+   MC Bar
+   Bar hi
+   Bar b1
+
+ Now we have a class names Bar which has a class-scoped + variable named x with the value of 1 (set via the + constructor); the class Bar has as well a class-method named + hi which prints, when called, the string "hello". The class + Bar can be used to create instances of the class like + b1, b2 and so on. +

+

Note that the command Class is a predefined definition +of the most general meta-class in XOTcl. Each time we are creating +a class, we use this meta-class. +In order to define a specialized meta-class, we can do this the +traditional object-oriented way: we subclass. Therefore, in to define +a specialized meta-class, we can use: +

+
+  Class myMetaClass -superclass Class
+
+

This defines a new meta-class myMetaClass, which has all the +abilities of meta-classes. That means that the programmer is able to +specify new class features or override old ones. Later she/he may +instantiate these into new classes. +

+

This is a very powerful language feature, since it allows one to give +some classes further abilities than the others (or to restrict +classes). This way large program structures, like certain design +pattern parts, may be instantiated. Meta-classes hold the common +abstract parts of the structures. They allow one to form libraries of +such structures very easily. +

+

Example 1: Overloading the info method of classes +

+

+As a simple example we can derive a new meta-class +NoClassInfo from Class. Later we override the +info method of Class. Thus the classes created with +NoClassInfo, have an info option that only produces +an error message. All classes created with NoClassInfo, like +Agent in the example below, are not capable of accessing the class +info method anymore: +

+
+  Class NoClassInfo -superclass Class
+  # redefine info ability
+  NoClassInfo instproc info args {
+    error "No class info avaiable"
+  }
+  # derive agent class from meta-class, which
+  # can not access class info
+  NoClassInfo Agent
+
+Now a call like: +
+  Agent info superclass
+

+triggers the error message. +

+ +

Example 2: Defining Classes that Count Their Instances +

+

Meta-classes are frequently used to define some bookkeeping +about the number of instances on the class level. In the following +example we define a meta-class named CountedClass which +defines classes that count their instances: +

+  Class CountedClass -superclass Class -parameter {{counter 0}}
+  CountedClass instproc create args {
+    my incr counter
+    next
+  }
+  CountedClass instproc instdestroy args {
+    my incr counter -1
+    next
+  }
+  CountedClass Dog
+
+  Dog piffie
+  Dog idefix
+  puts "nr of dogs: [Dog counter]"
+
+  piffie destroy
+  puts "nr of dogs: [Dog counter]"
+
+Note that the behavior introduced by meta-classes +can be orthogonal to the behavior of the classes. One can +define Dog as a specialization of Animal +or defines a special kind of dog such as Poodle using +the method superclass as usual. +

+ +

Example 3: The Singleton Meta-Class +

+

Finally, a small example, which is more practical. Some +applications have the requirement that only one instance of a class +might be defined at a certain time. Such a behavior is frequently +called a "Singleton". In XOTcl we can define a class singleton by +overloading the create method of Class: when +create is called and there exists already an instance of the +singleton it is returned instead of a new instance. +

+  Class Singleton -superclass Class
+  Singleton instproc create args {
+    expr {[my exists instance] ? [my set instance] : [my set instance [next]]}
+  }
+
+ If someone wants to have a class e.g. Manager to be a + singleton, you can create it by e.g. +
+  Singleton Manager -superclass FOO
+
+

+ +

+Create, Destroy, and Recreate Methods +

+

+

+XOTcl allows since version 0.84 for a flexible destroy and recreate scheme. +create and alloc are both Class instprocs +handling creation for their instances. I.e.: +

+
+ className alloc [self]
+
+and +
+ className create [self]
+
+

+are used for creating an instance. A similar method instdestroy +exists on Class that handles physical destruction of an object. The +method destroy on Object which lets an object destroy itself in fact +has the following behavior: +

+
+  Object instproc destroy args {
+   [my info class] instdestroy [self]
+  }
+
+

+However, this behavior is not implemented in XOTcl, but in C. +create distinguishes between the following situations: +

+
    +
  • Create a new object: + create calls alloc and then + doInitializations. +
  • Recreate an existing object: + When the specified object exists, it is recreated through the + recreate method: +
    +  givenClass recreate [self]
    +
    +

    + recreate can be customized e.g. by overloading or interception. + By default it calls cleanup followed by doInitializations. +

+

+In both cases, the method doInitializations +is called automatically from C and has the following default behavior: +

+
    +
  • Search for parameter default values, +
  • Call parameter initialization methods, +
  • Call the constructor init. +
+

+Each step has a method call that can be changed, intercepted, etc. Of +course, cleanup, recreate, instdestroy, +etc. can also be overloaded or intercepted. +

+

+Consider a typical case for overloading recreate: a structure +preserving recreate that cleans up the class but +preserves the existing class hierarchy (subclass and instance relationships): +

+
+  Class StructurePreservingRecreate
+  StructurePreservingRecreate instproc recreate {cl args} {
+    if {[my isclass $cl]} {
+      set subclass [$cl info subclass]
+      set instances [$cl info instances]
+    }
+    next
+    if {[my isclass $cl]} {
+      foreach sc $subclass {
+        $sc superclass $cl
+      }
+      foreach i $instances {
+        $i class $cl
+      }
+    }
+  }
+  Object instmixinappend StructurePreservingRecreate
+
+

+Now the following code does not change the superclass or instance +relationships of C: +

+
+  Class A
+  Class B
+  Class C -superclass {A B}
+  Class D
+  Class E -superclass {C D}
+  C c1
+  C c2
+
+  # recreate -> is structure preserving
+  Class C -superclass {A B}
+  C c2
+
+  # test
+  puts superclass=[C info superclass]
+  puts subclass=[C info subclass]
+  puts instances=[C info instances]
+  puts class=[c1 info class]
+  puts class=[c2 info class]
+
+ + + + + + + + + + +
+

Message +Interception Techniques + +

+
+
+ +

Even though object-orientation orders program structures around +data, objects are characterized primarily by their behavior. +Object-oriented programming style encourages the access of +encapsulated data only through the methods of an object, since this +enables data abstractions. A method invocation can be interpreted as a +message exchange between the calling and the called object. +Therefore, objects are at runtime only traceable through their message +exchanges. At this point the message interceptors can be applied to +catch and manipulate all incoming and outgoing messages of an +object. +

+

Generally interceptors can be applied to attach additional or +extrinsic concerns to an object or a class or a class hierarchy. For +instance roles or aspects can be implemented this way on various +levels of scale. +

+ +

We have already discussed some interception techniques +implicitly. E.g., the unknown mechanism intercepts messages +that have not be found on the object. It can be used as a very useful +programming technique, e.g., the define a default behavior for an +object. The interceptors presented in this section have a different +character: They are applied before/after the original method even +if the method is defined for the target object. Thus these +interception techniques may be applied +

+ +

We will discuss the message interceptors in this section in +detail. The table below gives an impression, when which interceptor +may be applied. + +

Message +Interceptors Overview

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Applied When +

+

Primary Target Structure +

+

Coverage +

+

Per-Object Filter +

+
+

before/after a call +

+
+

object +hierarchies +

+
+

all methods +

+
+

Per-Class Filter +

+
+

before/after a call +

+
+

class and class +hierarchies +

+
+

all methods +

+
+

Per-Object Mixin +

+
+

before/after a call +

+
+

object +

+
+

specific methods +

+
+

Per-Class Mixin +

+
+

before/after a call +

+
+

class and class +hierarchies +

+
+

specific methods +

+
+

Unknown Mechanism +

+
+

after method +was not found +

+
+

object +

+
+

all unknown calls +

+
+
+ +
+ +

Filter +

+ +

The filter (see [Neumann and Zdun +1999a] for more details) is a language construct to implement +broader extensional concerns either for a single object or for several +classes or class hierarchies. This way large program structures at the +scale of several classes or class hierarchies can be managed. It is a +very general interception mechanism which can be used in various +application areas. E.g. a very powerful programming language support +for certain design patterns is easily achievable, but there are also +several other domains which are covered, like tracing of program +structures, self-documentation at run-time, re-interpretation of the +running program, etc. +

+

A per-class filter is a special instance method that is +registered for a class C. A per-object filter is a +special instance method that is registered for a object +o. Every time an object of class, C or the object +o respectively, receives a message, +the filter method is invoked automatically. +

+

Usage of Filters +

+

All messages to a filtered object must go through the filter before +they reach their destination object. A simple example would be a sole +filter on the class of the object. To define such a filter two steps +are necessary. Firstly an filter method has to be defined, then the +filter has to be registered. The filter method consists of three parts +which are all optional. A filter method has the following form: +

+
+  className instproc FilterName args {
+    pre-part
+    next
+    post-part
+  }
+
+

+When a filter comes to execution at first the actions in the pre-part +are processed. The filter is free in what it does with the +message. Especially it can (a) pass the message, which was perhaps +modified in the pre-part, to other filters and finally to +the object. It can (b) redirect it to another destination. Or it can +(c) decide to handle the message on its own. The forward passing of +messages is implemented through the next primitive of XOTcl. +After the filter has passed its pre-part, the actual called method is +invoked through next. +

+

After the call of next is processed, the execution returns +to the point in the filter, where the next call is located +and resumes execution with the actions of the post-part. +These may contain arbitrary statements, but especially may take the +result of the actual called method (which is returned by the +next-call) and modify it. The caller then receives the result of the +filter, instead of the result of the actual called method. +

+

The pre- and post-part may be filled with any ordinary +XOTcl-statements. The distinction between the three parts is just a +naming convention for explanation purposes. +

+

The filter uses the args argument which lets us use a list of +variable length as arguments, since it must filter a lot of different +calls, which may have different argument lists. Furthermore, it may +pass through arguments to other filters and the preceding filters may +change the argument list. +

+

Since any proc/instproc may be a filter, a registration of the +filter is necessary, in order to tell XOTcl, which instprocs are +filters on which classes. The filter and instfilter +instance methods are able to handle this task for per-object filters +and per-class filters respectively. Similar to the XOTcl language +introduced so far, the filter registration is dynamic at run-time. By +supplying a new list of filters to +filter/instfilter, the programmer can change the +filters registered on a class at arbitrary times. The filter instance +method has the syntax: +

+
+  className instfilter filterList
+
+for per-class filters and: +
+  objName filter filterList
+
+for per-object filters. + +

+Now a simple example should show the filter's usage. In the preceding +examples we have defined several rooms. Every time a room action +occurs it is likely that the graphical sub-system has to change +something on the output of that particular room. Therefore, at first +we need a facility to be informed every time an action on a room +happens. This is quite easily done using filters: +

+
+  Class Room
+  Room r1; Room r2;       # just two test objects
+
+  Room instproc roomObservationFilter args {
+    puts "now a room action begins"
+    set result [next]
+    puts "now a room action ends - Result: $result"
+    return $result
+  }
+
+  Room instfilter roomObservationFilter
+

+Now every action performed on room objects is notified with a pre- +and a post-message to the standard output stream. We return the +result of the actual called method, since we don't want to change the +program behavior at all. E.g. we can set an instance variable on both +of the two room objects: +

+
+  r1 set name "room 1"
+  r2 set name "room 2"
+

+The output would be: +

+
+  now a room action begins
+  now a room action ends - Result: room 1
+  now a room action begins
+  now a room action ends - Result: room 2
+

+
+

+

+   +

+

Figure 4: +Cascaded Message Filtering

+
+ + + + + +
+

+
+
+



+

+

All classes may have more than one filter. In fact they may have a +whole filter chain, where the filters are cascaded through next. +The next method is responsible for the forwarding of +messages to the remaining filters in the chain one by one till all +pre-parts are executed. Then the actual method is executed and +then the post-parts come to turn. If one next-call is omitted the +chain ends in this filter method. As an example for an additional +filter we may register a filter that just counts the calls to +rooms. +

+
+  Room set callCounter 0;  # set class variable
+  Room instproc counterFilter args {
+    [self class] instvar callCounter
+    incr callCounter
+    puts "the call number callCounter to a room object"
+    next
+  }
+  Room instfilter {roomObservationFilter counterFilter}
+

+Filters are invoked in registration order. The order may be changed +by removing them and adding them in new order. Filters are inherited +by sub-classes. E.g. in the preceding example for the next path, an +OvalOffice was derived from the Room class. Without +a change to the program each OvalOffice object automatically +produces the same filter output as rooms. +

+


+

+

+   +

+

Figure 5: +Filter Inheritance

+
+ + + + + +
+

+
+
+


Filter chains can also be combined through (multiple) +inheritance using the next method. When the filter chain of +the object's class is passed, the filter chains of the superclasses +are invoked using the same precedence order as for inheritance. Since +on the subclass there may also be a another filter chain, without +sophisticated computing in the pre- and post-parts one can produce +easily a powerful tracing facility. E.g. if we want to distinguish an +OvalOffice from other rooms we may want to add a filter +solely for rooms of the type OvalOffice: +

+
+  Class OvalOffice -superclass Room
+  OvalOffice o1;  # test object
+  OvalOffice instproc ovalOfficeObservationFilter args {
+    puts "actions in an oval office"
+    next
+  }
+  OvalOffice instfilter ovalOfficeObservationFilter
+

+A simple call to the o1 object, like: +

+
+  o1 set location "Washington"
+

+produces the following output: +

+
+  actions in an oval office
+  now a room action begins
+  the call number 3 to a room object
+  now a room action ends - Result: Washington
+

+As seen already, filter registrations can be added dynamically at +runtime. But they may also be removed. Perhaps the counting on rooms +should stop after a while, then a simple call of the instfilter +method is sufficient: +

+
+  Room instfilter roomObservationFilter
+
+

Filters can be removed completely by giving an empty list to the +registration method:

+
+  Room instfilter {}
+
+ + +

Per-object filters operate on a single object. E.g. if we only +want to observe a single Room object room1, we can use the filter +method to register the roomObservationFilter only for this particular +instance:

+
+  room1 filter roomObservationFilter
+
+

As a filter we can register any method in the precedence order of +the class or object. Thus we can also register procs as per-object +filters. Additionally, meta-class methods may be registered as +per-class filters. Filters are linearized so that each filter is only +executed once, even if it is registered multiple times. +

+



+

+

Introspection on Filters +

+In order to gain information about the currently registered filters on +a certain object/class, the object info option filters and +the class info option instfilters may be +queried. It returns a list of the currently registered filters: +

+
+  className info instfilter
+  objName info filter
+
+

+ +A special call-stack info option for filters is self +filterreg. It returns the name of the object or class on which +the filter is registered. Since the filter may be registered on other +objects/classes than the one on which it is defined, this may vary from +self class in the filter. + +The command returns a list of the form: +

+  objName filter filterName
+
+or: +
+  className instfilter filterName
+
+respectively. +

+ +



+

+

Example: A Simple Trace Filter +

+

The trace example primarily demonstrates the inheritance of filter +chains. Since all classes inherit from Object, a filter on +this class is applied on all messages to objects. The Trace +object encapsulates methods for managing the tracing: +

+
+  Object Trace
+  Trace set traceStream stdout
+
+  Trace proc openTraceFile name {
+    my set traceStream [open $name w]
+  }
+
+  Trace proc closeTraceFile {} {
+    close $Trace::traceStream
+    my set traceStream stdout
+  }
+
+  Trace proc puts line {
+    puts $Trace::traceStream $line
+  }
+
+  Trace proc add className {
+    $className instfilter [concat [$className info filter] traceFilter]
+  }
+

+First we define the object and set a variable for the stream to which +we send the trace outputs (here: stdout). With a method for opening +and a method for closing a file we can redirect the trace stream to a +file. puts is helper method for the filter to print an +output to the selected output stream. In add the traceFilter +is appended to the existing filters of a specified class. The actual +filter method (see below) displays the calls and exits of methods +with an according message. The calls are supplied with the arguments, +the exit traces contain the result values. We have to avoid the +tracing of the trace methods explicitly. +

+
+  Object instproc traceFilter args {
+    # don't trace the Trace object
+    if {[string equal [self] ::Trace]} {return [next]}
+    set context "[self class]->[self callingproc]"
+    set method [self calledproc]
+    switch -- $method {
+      proc -
+      instproc {::set dargs [list [lindex $args 0] [lindex $args 1] ...] }
+      default  {::set dargs $args }
+    }
+    Trace::puts "CALL $context>  [self]->$method $dargs"
+    set result [next]
+    Trace::puts "EXIT $context>  [self]->$method ($result)"
+    return $result
+  }
+

+As trace message we write the callee´s context (class and +proc), the invoked method (using calledproc), and the given +arguments. In the switch statement we avoid to print whole method +bodies. +

+

With +

+
+  Trace add Room
+

+messages to all rooms, including all instances of Room´s +sub-classes, are surrounded with a CALL and an EXIT output. With +

+
+  Trace add Object
+

+messages to all objects in an XOTcl environment are surrounded with a +CALL and an EXIT output. In general, it is possible to restrict the +trace to instances of certain classes, or to produce trace output for +only certain methods. This requires registration methods and a more +sophisticated implementation of the filter method. +

+



+

+ +

Mixin Classes +

+ +

Per-object and per-class mixins (see [Neumann and Zdun 1999c] for more details) are +another interception technique of XOTcl to handle complex +data-structures dynamically. Here, we use mixin as a short form for +mixin class. All methods which are mixed into the execution of the +current method, by method chaining or through a mixin class, are +called mixin methods. Mixin classes resembles the filter +presented in the preceding section. While the filters work on all +calls to all methods of an object/class hierarchy, the mixin classes +are applied on specific methods. The filter is defined in a single +method, while the mixin is composes several method in a class. + +

+

Supplemental Classes +

+

Mixin classes cover a problem which is not solvable elegantly just +by the method chaining, introduced so far. To bring in an addition to +a class, the normal XOTcl way is to define a mixin method and chain +the methods through next, e.g.: +

+
+  Class Basic
+  Basic instproc someProc  {
+    # do the basic computations
+  }
+  Class Addition
+  Addition instproc someProc {
+    # do the additional computations
+    next
+  }
+

+In order to mix-in the additional functionality of the supplemental +class Addition a new helper class (sometimes called +intersection class) has to be defined, like: +

+
+  Basic+Addition -superclass Addition Basic
+

+This is even applicable in a dynamical manner, every object of the +class Basic may be changed to class Basic+Addition +at arbitrary times, e.g.: +

+
+  Basic+Addition basicObj
+  ...
+  basicObj class Basic+Addition
+

+Now consider a situation with two addition classes. Then following +set of classes has to be defined to cover all possible combinations: +

+
+  Class Basic
+  Class Addition1
+  Class Addition2
+  Class Basic+Addition1 -superclass Addition1 Basic
+  Class Basic+Addition2 -superclass Addition2 Basic
+  Class Basic+Addition1+Addition2 -superclass Addition2 Addition1 Basic
+

+The number of necessary helper classes rises exponential. For n +additions, 2n-1(or their permutations if order +matters) artificially constructed helper-classes are needed to +provide all combinations of additional mix-in functionality. +Furthermore it is possible that the number of additions is unlimited, +since the additions may produce other additions as side-effects. This +demonstrates clearly that the sub-class mechanism provides only a +poor mechanism for mix-in of orthogonal functionality. Therefore we +provide an extension in the form of object mixin classes, which are +added in front of the search precedence of classes. +

+

Per-Object Mixins +

+

The mix-ins methods extend the next-path of shadowed methods. +Therefore, per-object mix-in methods use the next primitive +to access the next shadowed method. Consider the following example: +

+
+  Class Agent
+  Agent instproc move {x y} { 
+    # do the movement
+  }
+  Class InteractiveAgent -superclass Agent
+  # Addition-Classes
+  Class MovementLog
+  MovementLog instproc move {x y} { 
+    # movement logging
+    next
+  }
+  Class MovementTest
+  MovementTest instproc move {x y} {
+    # movement testing
+    next
+  }
+

+An agent class is defined, which allows agents to move around. Some +of the agents may need logging of the movements, some need a testing +of the movements, and some both (perhaps only for a while). These +functionalities are achieved through the additional classes, which we +will apply through per-object mixins. +

+

Before we can use the per-object mix-ins on a particular object, +we must register the mixins on it with the mixin instance +method. It has the syntax: +

+
+  objName mixin mixinList
+

+For example we may create two interactive agents, where one is logged +and one is tested: +

+
+  InteractiveAgent i1; InteractiveAgent i2
+  i1 mixin MovementLog
+  i2 mixin MovementTest
+

+At arbitrary times the mixins can be changed dynamically. For example +i2's movements can also be logged: +

+
+  i2 mixin MovementTest MovementLog
+

+
+

+

+   +

+

Figure 6: +Per-Object Mix-ins: Next-Path for the Example

+
+ + + + + +
+

+
+
+



+

+

The mixin option of the info instance method +allows us to introspect the per-object mix-ins. It has the syntax: +

+
+  objName info mixin ?className?
+
+

+It returns the list of all mix-ins of the object, if className +is not specified, otherwise it returns 1, if className +is a mixin of the object, or 0 if not. +

+ +

Note, that the constructors (init methods) of per-object mixins (and per-class mixins) +are only called, if the mixin is registered already during object +initialization (when init is called). For per-object mixins, one can +achieve the initialization of a mixin via an idiom like +

+  Object o -mixin M -init
+
+that registers the mixin before init is called. When a mixin is registered +after object creation and it needs initializations, it is necessary to +define special methods for this. Note, that the behavior described +here is introduced in version 0.84 to ensure consistent behavior of +intrinsic classes, per-object and per-class mixins, and to achieve +predictable behavior for dynamic registration for all kind of mixins, +and as well during recreations of objects having mixins +registered. Older versions used heuristics for the initialization of +per-object mixins. +

+ +

Per-Class Mixins +

+ +

Per-class mixins are exactly identical in their behavior to +per-object mixins, but they operate on classes. Thus they are the +class-specific variant of the per-object mixins, like instprocs are a +class-specific variant of procs. Therefore, in the language the +per-class mixins are called instmixins. +

+ +

+In general a per-class mixin is a class which is mixed into the +precedence order of all instances of the class and all its subclasses +it is registered for. It is also searched before the object's class +itself is searched, but after per-object mixins. +

+

+Per-class mixins are linearized according to the +precedence order +like classes on the superclass hierarchy. I.e. from the full +list of per-object mixins, per-class mixins, and intrinsic classes +(and all the superclasses of all these classes) always the last +occurrence is used. +

+ +

+From the point of view of language expressibility instmixins are not +required, because they cannot express anything that per-object mixins +cannot express already (like procs can express any instproc +feature). As alternative to instmixins, we could simply register the +per-object mixins in the constructor of the class. +

+ +

+But there at least the following reasons for instmixins as an +additional language construct: +

    +
  1. we can at runtime determine with info mixin +and info instmixin whether it is a class- or object-specific +mixin. Thus we get a better structuring at runtime. +
  2. We have not to 'pollute' the constructors with per-class mixin +registrations. Therefore, the constructors get more understandable. +
  3. If it is required to add (and remove) dynamically interceptors +to a set of objects, which are instances of a certain type, per-class +mixins are much easier to handle (e.g. add an instmixin to Object +to intercept e.g. all calls to certain predefined methods). +
  4. The language is more 'symmetrical', since any object-specific +feature in XOTcl has a class-specific variant. +
+

+ +

The mix-ins methods of per-class mixins extend the next-path of +shadowed methods in the same way as per-object mixin methods. Before +we can use a per-class mix-in on a particular class, we must +register the mixin on it with the instmixin instance method. It +has the syntax: +

+
+  className instmixin mixinList
+
+

+Now consider that in the given per-object mixin example all +interactive agents should be tested. We could either build a subclass +TestedInteractiveAgent or register the per-object mixin in +the constructor of the interactive agent class. The subclass solution +leads to the same combinatorial explosion of intersection classes as +discussed in the previous section, if more supplemental classes are +added. The per-object mixin solution pollutes the constructor and does +not prevail the structural semantics that the 'tested' property +belongs to the interactive agent class at runtime +

+

+Here, we can use a per-class mixin: +

+
+  Class Agent
+  Agent instproc move {x y} {# do the movement}
+  Class InteractiveAgent -superclass Agent
+  Class MovementTest
+  MovementTest instproc move {x y} {
+    # movement testing
+    next
+  }
+
+  # now register the instmixin
+  InteractiveAgent instmixin MovementTest
+
+
+ +

The per-class mixin now operates on all interactive agent +including the instances of subclasses. E.g. for interactive agents +i1 and i2 we automatically have movement +testing. i2 is also logged, since it has the logging class +as object-specific mixin: +

+
+  InteractiveAgent i1
+  InteractiveAgent i2 -mixin MovementLog
+
+  i1 move 3 4
+  i2 move 1 2 
+
+ +

+At arbitrary times the instmixins can be changed dynamically. +

+

The instmixin option of the class info instance +method allows us to introspect the per-class mixins. It has the +syntax: +

+
+  className info instmixin ?className2?
+
+

+It returns the list of all instmixins of the the class, if className2 +is not specified, otherwise it returns 1, if className2 +is a mixin of the object, or 0 if not. +

+ +

Per-class mixins are applied transitively. That means the per-class +mixin A of a per-class mixin B is also applied for an object in in B's +scope. This is exactly the same as how superclasses are applied for +instances. Consider the following example

+ +
+  Class X11 \
+     -instproc test args {
+	puts [self class]
+	next
+     }
+  Class X12 \
+    -instproc test args {
+	puts [self class]
+	next
+    }
+  Class X \
+    -instmixin {X11 X12} \
+    -instproc test args {
+	puts [self class]
+	next
+    }
+
+  Class Y \
+    -instmixin X
+
+  Y create y -test
+  X create x -test
+
+

Here the application as a superclass (for x) yields the same +result as the application as an instmixin (for y): +

+  ::X11 
+  ::X12 
+  ::X
+
+

+Callstack Information +

+

Since the presented interceptors are +normal XOTcl instprocs they can access all XOTcl introspection +abilities introduced so far. In instprocs all recent information is +accessible within their scope. But the interceptors are mechanisms, +which cover more then their sole scope. The meaningful usage of the +meta-programming abilities often requires to go further and to get +information from the caller's and the callee's scope (e.g for +delegation decisions). Therefore, we introduced rich call-stack +informations for the interceptors. Note, that these are also available +for ordinary methods, but the "called..." info options return empty +strings. +

+

All call-stack information are packed compactly into the +self primitive as additional options. Note, before XOTcl +version 0.84 these were implemented as a part of the info +method. They are part of the self command for conceptual +integrity: introspection options in info can be expected to +produce the same result, when they are not explicitly changed. In +contrast, all information provided by self are +call-stack dependent. +

+ +
+

Querying Call-stack Information via self

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
self activelevel + +

Returns the stack level from where the + current command was invoked from, or where the last next + was called (whatever is closer to the invocation). + If the current command was invoked from + an XOTcl method the absolute level is returned (e.g. #4) + which can be used in the uplevel or + upvar tcl command or XOTcl method. If the current + command was not invoked from an XOTcl method, the value 1 + is returned. +

self calledproc + +

Returns the name of the method which was invoked in + the original call. +

self calledclass + +

Returns the name + of the class which presumably (if no dynamic class change occurs + afterwards) is invoked in + the original call. +

self callingclass + +

Returns the name of the class from which the + call was invoked (if one exists, otherwise an empty + string). +

self callinglevel + +

Returns the stack level from where the + current command was invoked from. In contrary to + activelevel next-calls are ignored in the + computation. If the current command was invoked from an + XOTcl method the absolute level is returned (e.g. #4) + which can be used in the uplevel or + upvar tcl command or XOTcl method. If the current + command was not invoked from an XOTcl method, the value 1 is + returned. +

self callingproc + +

Returns the name of the method from which the + call was invoked (if one exists, otherwise an empty + string). +

self callingobject + +

Returns the name of the object from which the + call was invoked (if one exists, otherwise an empty + string). +

self filterreg + +

In a filter: returns the name + of the object/class on which the filter is registered. Returns either + 'objName filter filterName' or + 'className instfilter filterName'. +

self next + +

Return the + "next" method on the path as a string, i.e. the method which will be + called by [next]. +

+
+

+


+

Note, that three options with the prefix calling +represent the values of self, self proc, and self +class in the scope where the original call was invoked. In the +following section we will show a simple program in which all of the +info options have different values. + +


Filter Call-stack Information Example +

+

Now we discuss a simple example that shows that all filter +introspection options may have different values: +

+
+  Class InfoTrace
+  InfoTrace instproc infoTraceFilter args { 
+    puts "SELF:                [self]"
+    puts "SELF PROC:           [self proc]"
+    puts "SELF CLASS:          [self class]"
+    puts "INFO CLASS:          [my info class]"
+    puts "CALLED PROC:         [self calledproc]"
+    puts "CALLING PROC:        [self callingproc]"
+    puts "CALLING OBJECT:      [self callingobject]"
+    puts "CALLING CLASS:       [self callingclass]"
+    puts "REGISTRATION CLASS:  [self filterreg]"
+    puts "CALLING LEVEL:       [self callinglevel]"
+    puts "ACTIVE LEVEL:        [self activelevel]"
+    next
+  }
+
+  Class CallingObjectsClass
+  CallingObjectsClass callingObject
+
+  Class FilterRegClass -superclass InfoTrace
+  Class FilteredObjectsClass -superclass FilterRegClass 
+  FilteredObjectsClass  filteredObject 
+
+  CallingObjectsClass instproc callingProc args {
+     filteredObject set someVar 0
+  }    
+  FilterRegClass instfilter infoTraceFilter

+The invocation of callingObject callingProc produces the +following output: +

+
+  SELF:                ::filteredObject
+  SELF PROC:           infoTraceFilter
+  SELF CLASS:          ::InfoTrace
+  INFO CLASS:          ::FilteredObjectsClass
+  CALLED PROC:         set
+  CALLING PROC:        callingProc
+  CALLING OBJECT:      ::callingObject
+  CALLING CLASS:       ::CallingObjectsClass
+  REGISTRATION CLASS:  ::FilterRegClass instfilter infoTraceFilter
+  CALLING LEVEL:       #1
+  ACTIVE LEVEL:        #1

+The filter reports for self the value filteredObject, +since this is the object on which the set call is invoked; +infoTraceFilter is the method of the filter, and therefore, +the actual proc, while the actual class is InfoTrace, the +filter's class. The class of the actual object is +FilteredObjectsClass. +

+

The called procedure is set. While the program stays in a +XOTcl-instproc all calling-info-options are set, the calling +procedure is callingProc, the calling class is the class, +where the method is defined (namely CallingObjectsClass), +and the object from which the call invoked is callingObject. +

+

In this example, the calling level is equal to the active level, both +are #1. +

+ +

Precedence Order +

+ +

The precedence order is composed by the precedence order of the +superclass hierarchy (as explained earlier) and the message +interceptors. In general, filters precede mixins and the superclass +hierarchy. They are applied in the order of the next path of the +object. Thus per-object filters are ordered before per-class +filters.

+ +

Mixins are processed after the filters. Again, they are applied in +the order of the next path of the object. Thus per-object mixins are +ordered before per-class mixins.

+ +

Finally, the object's own heritage order comes in the order: object, +class, superclasses.

+ +

The three precedence order lists (filters, mixins, and classes) are +pre-calculated and cached.

+ +

Filters as well as classes (mixins and ordinary classes) are +linearized. That means, each filter and each class can be only once on +a precedence order list. If a filter or class can be reached more than +once, than the last occurrence is used.

+ +

For instance, consider a class A is superclass, per-class mixin, +and per-object mixin. On the precedence order lists only the last +occurrence as a superclass is used after linearization.

+ + +

Guards for Filters and Mixins +

+ +Message interceptors, such as filters and mixins, are applied for +potentially huge number of messages. In many cases it is possible to +reduce the effective number of cases in which interceptors are +applied. Interceptor guards offer this functionality: they are boolean +conditions with which you can specify in which cases a registered +interceptor should be applied. + +

Filter Guards

+

+A filter guard is a set of conditions that determine whether a filter +is to be executed upon a certain invocation or not. Syntactically we can +append a filter guard to the filter registration, or it can be +registered using the methods filterguard for filters and +instfilterguard for instfilters. + +

Each filter guard is an ordinary condition. A filter guard is +executed in the call frame of the filter to be executed, if the filter +guard returns 1. Thus, the callstack information are already set to +the values of the targeted filter - and these values can be used in +the filter guard. + +

+Let us consider a simple program: +

+
+Class Room
+Room instproc enter {name} {puts [self proc]}
+Room instproc leave {name} {puts [self proc]}
+Room instproc loggingFilter args {
+    puts [self calledproc]
+    next
+}
+Room instfilter loggingFilter
+
+ +

+Now consider we only want to apply the logging filter for enter and +leave, not for any other message sent to Room instances. In the +following example, for instance, we do not want to log the set +message: +

+ +
+Room r 
+r enter Uwe
+r leave Uwe
+r set roomName "Office"
+
+ +

+In this example a filterguard can be applied to restrict the +application of the filter to those two methods: +

+ +
+Room instfilterguard loggingFilter {
+  [self calledproc] == "enter" || 
+  [self calledproc] == "leave"}
+
+ +

+Here we limit the filter application of the logging filter on rooms to +calls to enter and leave. All other calls are not filtered at +all. Note that the same syntax can also be applied for +filterguard. Also, there is a short form to register filter +guards directly during filter registration. The following code has the +same semantics as the filter and filter guard definitions above: +

+ +
+Room instfilter {{loggingFilter -guard {
+    [self calledproc] == "enter" || 
+    [self calledproc] == "leave"}}}
+

+ +The filter guard language construct is registration centric. It only +applies for the class or object on which a filter is registered, not +for all applications of the filter method. That is, if we use +loggingFilter on another class we may give no or completely +different filter guards. +

+If no filter guard is given for a filter, we assume that it is to be +applied on all methods (equivalent to the filter guard '1' which is +always true). +

+ +

+There are introspection options for filter guards. In particular, we +can use info filterguard and info instfilterguard +for getting the filter guards for a particular filter or instfilter +respectively. For instance: +

+
+puts [Room info instfilterguard loggingFilter]
+

+This prints out the content of the above guard definition. +We can also append -guard to info filter or +info instfilter to obtain a filter definition with guards: +

+
+puts [Room info instfilter -guards]
+

+ +

+If we call a method from within a filter guard, as for instance +callsMethod, we might require some parameters from the guard's +context, such as calledproc. These parameters can be passed +as references, as in the following example: +

+ +
+  Room instfilter loggingFilter
+  Room instfilterguard loggingFilter {[my callsMethod openURL [self calledproc]]}
+

+This example works because the filterguard is already set to the scope of the guard. Now we can use this dynamic calledproc context in the called method: +

+
+  Room instproc callsMethod {method calledproc} {
+    return[string match $calledproc $method]
+  }
+

+We simply check whether the called method +matches the given method name or not. + +

Mixin Guards

+

+Similar to filters, there are mixin guards, defined with +mixinguard and instmixinguard, or with +-guard during mixin registration. Consider a simple example: +there are a number of birds who have two mixins: Fly and Sing. For Fly +there are limitations: a bird can only fly if it is at least two years +old and is not a Penguin. Such problems are be solved with +mixin guards: +

+ +
+Class Fly
+Fly instproc fly {} {puts "[my signature]: yippee, fly like an eagle!"}
+
+Class Sing
+Sing instproc sing {} {puts "[my signature]: what a difference a day makes"}
+
+Class Animal -parameter age
+Animal instproc unknown args { puts "[my signature]: how should I $args?"}
+Animal instproc signature {} {
+    return "[self] [my info class] ([my age] years)"
+}
+
+Class Bird -superclass Animal
+Class Penguine -superclass Bird
+Class Parrot -superclass Bird
+Class Duck -superclass Bird
+
+Parrot tweedy -age 1
+Penguine pingo -age 5
+Duck donald -age 4
+Parrot lora -age 6
+
+Bird instmixin {{Fly -guard {[my age] > 2 && ![my istype Penguine]}} Sing}
+

+An invocation like: +

+ +
+foreach bird {tweedy pingo donald lora} { $bird fly }
+

+yields the following result: +

+
+::tweedy ::Parrot (1 years): how should I fly?
+::pingo ::Penguine (5 years): how should I fly?
+::donald ::Duck (4 years): yippee, fly like an eagle!
+::lora ::Parrot (6 years): yippee, fly like an eagle!
+
+ +

+There are similar introspection options for mixin guards as those for +filter guards. In particular, we can use info mixinguard and +info instmixinguard for getting the mixin guards for a +particular mixin or instmixin respectively. +

+ + + + + + + + + +
+

Nested Classes + and Dynamic Object Aggregations +

+
+
+

Most object-oriented analysis and design methods are based on the +concepts of generalization and aggregation. Generalization is +achieved through class hierarchies and inheritance, while static +aggregation is provided through embedding. Since version 8.0 Tcl +offers a namespace concept which can be used as a mechanism to +provide dynamic aggregations. +

+

A namespace provides an encapsulation of variable and +procedure names in order to prevent unwanted name collisions with +other system components. Each namespace has a unique identifier which +becomes part of the fully qualified variable and procedure names. +Namespaces are therefore already object-based in the terminology of +Wegner. OTcl is object-oriented since it offers classes and class +inheritance. Its objects are also namespaces, but an object is more +than only a namespace. Therefore, two incompatible namespace concepts +have existed in OTcl in parallel. +

+

Extended OTcl combines the namespace concept of Tcl with the +object concept of OTcl. Every object and every class in XOTcl is +implemented as a separate Tcl namespace. The biggest benefit of this +design decision aside from performance advantages is the ability to +aggregate objects and nest classes. Contrary in OTcl every object has +a global identifier. Through the introspection abilities of +namespaces nested classes are also traceable at runtime and can be +changed dynamically. In XOTcl objects are allowed to contain nested +objects, which are dynamically changeable aggregates of the +containing object. +

+ +

Nested Classes +

+

The notation for nested classes follows the syntax of Tcl +namespaces by using ``::'' as a delimiter. For example the +description of a oval carpet and a desk can nest inside of the +OvalOffice class: +

+
+  Class OvalOffice
+  # general carpet
+  Class Carpet
+  Class OvalOffice::Desk
+  # special oval carpet - no name collision
+  Class OvalOffice::Carpet -superclass ::Carpet
+

+Nested classes can be used exactly like ordinary classes, a user can +sub-class it, derive instances, etc. The information about the +nesting structure of classes is available through the info +instance method: +

+
+  className info classchildren ?pattern?
+  className info classparent
+

+The classchildren option returns a list of children, if one +or more exist, otherwise it returns an empty string. classparent +results in the name of the parent class, if the class is nested. +Since nested classes are realized through namespaces, all +functionality offered by Tcl's namespace command is usable +from XOTcl as well. +

+

Dynamic Object Aggregations +

+

The nested classes only provide an aggregation of the descriptive +not of the runtime properties of an object. We have pointed out the +difference of object and class in XOTcl. Because of the splitting of a +class into class and class-object it is possible to give each object +its own namespace. The internal implementation of objects enable them +to contain nested objects, which are aggregates of the containing +object. In XOTcl these can be changed dynamically and introspected +through the language support of dynamic object aggregations [Neumann and Zdun 2000b]. Suppose an +object of the class Agent should aggregate some property +objects of an agent, such as head and body: +

+
+  ClassAgent
+  Agent myAgent
+
+  Class Agent::Head
+  Class Agent::Body
+
+  Agent::Head ::myAgent::myHead
+  Agent::Body ::myAgent::myBody
+

+Now the objects myHead and myBody are part of the +myAgent object and they are accessible through a +qualification using ``::'' (or through Tcl's namespace command). But +in the common case they will be accessed, as introduced so far: the +explicit full qualification is not necessary when such variables are +being accessed from within XOTcl methods, since the object changes to +its namespace. +

+

The information about the part-of relationship of objects can be +obtained exactly the same way as for classes through the +info interface: +

+
+  objName info children ?pattern?
+  objName info parent
+
+ +

+Relationship between Class Nesting and Object Aggregation +

+ +

The classes Head and Body are children of the +Agent class. It is likely that all agents, interactive or +not, have properties for head and body. This implies a static or +predetermined relationship between class nesting and object +aggregation. Such predetermination do not exist in XOTcl, but are +simply build, when specifying the relationship in the constructor, +e.g.: +

+
+  Agent instproc init args {
+    ::Agent::Head [self]::myHead
+    ::Agent::Body [self]::myBody
+  }
+

+Now all agents derived from the class have the two property objects +aggregated after creation. But still they are changeable in a +dynamical manner, e.g. with: +

+
+  Agent myAgent
+  myAgent::myHead destroy
+

+The agent turns into a headless agent. In companion of the +introspection mechanisms such constructions could be very useful. +Suppose, that in the virtual world the agents heads may be slashed +from their bodies. The graphical system simply needs to ask with info +children on the agent's object, whether it has a head or not and +can choose the appropriate graphical representation. +

+

Note, that the not existing +relationship means a great deal of freedom and dynamics, which goes +together with the ideas behind OTcl, e.g. like the renunciation of +protection mechanisms. This policy in programming language design +means, on the one hand, ease of programming and more expressiveness, +but, on the other hand, it contains no protection against bad +software architectures or programming style. We believe that no such +mechanisms could hinder the programmer to do silly things, so our +policy was, to give the programmer rather more powerful constructs +then to make decisions in his place. +

+ +

Copy/Move +

+ +Often an object has to be copied/moved. This is a very useful +functionality when XOTcl should be used as a prototyping language. +The XOTcl method move provides this functionality. Another +common behavior is implemented by the copy method which +clones the actual object to a destination object. The two methods have +the syntax: + +
+  objName move destination
+  objName copy destination
+

+ +Copy and move operations work with all object/class information, i.e., +information on filters, mixins, parameters, etc. are +automatically copied. Copy and move are integrated with class nesting +and object aggregations. All copy/move operations are deep copy +operations: all nested objects/classes are automatically copied/moved, +too. + +E.g. if we want to reuse an imperial march object of star wars for +star wars 2, we can just copy the object: +

+  starWars::imperialMarch copy starWars2::imperialMarch
+
+ + + + + + + + +
+

Assertions + +

+
+
+

In order to improve reliability and self documentation we added +assertions to XOTcl. The implemented assertions are modeled after the +``design by contract'' concept of Bertrand Meyer. In XOTcl assertions +can be specified in form of formal and informal pre- and +post-conditions for each method. The conditions are defined as a list +of and-combined constraints. The formal conditions have the form of +normal Tcl conditions, while the informal conditions are defined as +comments (specified with a starting ``#''). The lists +containing the pre- and post-conditions are appended to the method +definition (see example below). +

+

Since XOTcl offers per-object specialization it is desirable to +specify conditions within objects as well (this is different to the +concept of Meyer). Furthermore there may be conditions which must be +valid for the whole class or object at any visible state (that means +in every pre- and post-condition). These are called invariants and +may be defined with following syntax for class invariants: +

+
+  className instinvar invariantList
+

+or for objects invariants: +

+
+  objName invar invariantList
+

+Logically all invariants are appended to the pre- and post-conditions +with a logical ``and''. All assertions can be introspected. +

+

Since assertions are contracts they need not to be tested if one +can be sure that the contracts are fulfilled by the partners. But for +example when a component has changed or a new one is developed the +assertions could be checked on demand. For this purpose the check +method can be used either to test the pre- or the post-conditions. +The syntax is: +

+
+  objName check ?all? ?instinvar? ?invar? ?pre? ?post?
+

+Per default all options are turned off. check all turns all +assertion options for an object on, an arbitrary list (maybe empty) +can be used for the selection of certain options. Assertion options +are introspected by the info check option. The following +class is equipped with assertions: +

+
+  Class Sensor -parameter {{value 1}}
+  Sensor instinvar {
+    {[regexp {^[0-9]$} [my value]] == 1}
+  }
+  Sensor instproc incrValue {} {
+    my incr value
+  } {
+    {# pre-condition:} 
+    {[my value] > 0}
+  } {
+    {# post-condition:} 
+    {[my value] > 1}
+  }
+

+The parameter instance method defines an instance variable +value with value 1. The invariant expresses the +condition (using the Tcl command regexp), that the value +must be a single decimal digit. The method definition expresses the +formal contract between the class and its clients that the method +incrValue only gets input-states in which the value of the +variable value is positive. If this contract is fulfilled by +the client, the class commits itself to supply a post-condition where +the variable's value is larger than 1. The formal conditions are +ordinary Tcl conditions. If checking is turned on for sensor s: +

+
+  s check all
+

+the pre-conditions and invariants are tested at the beginning and the +post-condition and invariants are tested at the end of the method +execution automatically. A broken assertion, like calling incrValue +9 times (would break the invariant of being a single digit) results +in an error message. +

+

+In assertions we do not check methods that modify or introspect +assertions. These are +check,info,proc,instproc,invar, +and instinvar. The reason for this is that we want to be able +to recover a malicious action in a catch error handler, like: +

+
+  ...
+  if {[catch {my assertionBreakingAction} errMsg]} {
+    puts "CATCHED ERROR: $errMsg"
+    # remember checking options, for turning them on later again
+    set check [my info check]
+    my check {}
+    # recover from broken assertion
+    ...
+    # turning checking on again 
+    $fb check $check
+  }
+
+ + + + + + + + +
+

Meta-Data +and Automatic Documentation + +

+
+
+

To enhance the understandability and the consistency between +documentation and program it is useful to have a facility to make the +documentation a part of the program. There are several kinds of +meta-data which are interesting for a class, e.g. the author, a +description, the version, etc. +

+

+Older versions of XOTcl have contained a special meta-data command +metadata. This command is now (from version 0.83) deprecated +and replaced by an integrated solution with XOTcl's API documentation +functionality. The object @ is used for documentation and +metadata issues. Per default it is not evaluated at all. Everything +that is send to @ is simply ignored. That way we do not waste +memory/performance at runtime, if we do not require to parse the +metadata/documentation. +

+

+If we have to know the meta-data/documentation, as for instance in the +xoDoc component and the makeDoc tool, that handle +XOTcl's internal documentation, we have to re-define the documentation +object. Alternatively, we can partially parse the source code for +@ commands. +

+

+With @ the meta-data/documentation is handled by first class +XOTcl objects. By defining alternate @ implementations - as in +xoDoc/makeDoc - we can evaluate the +meta-data/documentation arbitrarily. xoDoc/makeDoc +are only an HTML back-end, but the basic idea is to provide support for +several other usages as well (e.g. XML, RDF, on-line help, +documentation of dynamic structures, etc). +

+

+The object@ handles comments via its unknown +method. xoDoc adds the appropriate instprocs to t@ to produce HTML +output. The appropriate command is: +

+
+  tclsh src/lib/makeDoc.xotcl DOCDIR DOCFILES
+

+ +The source of a documentation is structurally very similar to the +XOTcl constructs being commented. E.g. one can copy an instproc and +add comments at the right places, like: +

+
+    Class C
+    C instproc m {a1 a2} {
+       return [expr {$a1+$a2}]
+    }
+

+ + can be commented as follows +

+
+    @ Class C { description { "my sample class"} }
+    @ C instproc m {a1 "first number" a2 "second number"} {
+       description "add two numbers"
+       return "sum of a1 and a2"
+    }
+

+

+ One can do essentially a copy+paste of the source and add the + comments via attribute value pairs. Every basic language construct + can have a "description". If you want to include other properties to + the description, you can add them like: +

+
+    @ C instproc m {a1 "first number" a2 "second number"} {
+       author "GN+UZ"
+       date "Feb 31"
+       description "add two numbers"
+       return "sum of a1 and a2"
+    }
+

+ + This way, author and date are added automatically to the generated + HTML file. + + In addition, there is a @File hook for a per file +description, like: +

+
+@ @File {
+  description {
+    This is a file which provides a regression test
+    for the features of the XOTcl - Language. 
+  }
+}
+

+ + + + + + +
+

Additional + Functionalities +

+
+
+

Abstract Classes +

+

In XOTcl a class is defined abstract if at least one method of +this class is abstract. The instance method abstract defines +an abstract method and specifies its interface. Direct calls to +abstract methods produce an error message. E.g. a Storage class +provides an abstract interface for access to different storage forms: +

+
+  Class Storage
+  Storage abstract instproc open  {name}       
+  Storage abstract instproc store {key value}
+  Storage abstract instproc list  {}         
+  Storage abstract instproc fetch key        
+  Storage abstract instproc close {}         
+  Storage abstract instproc delete {k} 
+

+All kinds of storage have to implement every method from the +interface. E.g. a GNU Database Access, a relational database access, +and several other storage forms may be derived by sub-classing +(therefore, all conform to the same storage access interface). +

+

Parameter

+

Classes may be equipped with parameter definitions which +are automatically created for the convenient setting and querying of +instance variables. Parameters may have a default value, e.g.: +

+
+  Class Car -parameter {
+    owner
+    {doors 4}
+  }
+

+Each instance of class Car gets two instance variables +defined. owner has no default value, and doors +defaults to 4. E.g. the following defines a new person object with +the two parameters set: +

+
+  Car mercedes
+

+Additionally the parameter method automatically creates a +new getter/setter instance method for each parameter -- same named to +the parameter, which queries the parameter if it no argument is given +or sets the parameter if with an given argument. E.g. a car with only +two doors can be created by: +

+
+  Car porsche -doors 2
+

+The owner of the first car is set by: +

+
+  mercedes owner Marion
+

+and the doors of the first car can be queried (and printed to the +screen) by: +

+
+  puts "The mercedes got [mercedes doors] doors and is owned by [mercedes owner]"
+

+parameter are inherited by subclasses. The parameters +specified in the class hierarchy are combined, default values +can be redefined. Example: +

+  Class Car -parameter {{doors 4} owner}
+  Class SportsCar -superclass Car -parameter {{doors 2}}
+  Class Limo -superclass Car
+  Class Porsche -superclass SportsCar
+  Class Mercedes -superclass Limo
+
+  Porsche p1 -owner peter
+  Mercedes m1 -owner marion
+  puts "[p1 owner]'s [p1 info class] has [p1 doors] doors"
+  puts "[m1 owner]'s [m1 info class] has [m1 doors] doors"
+
+

+An entry of the list specified for parameter is either +

    +
  • + a single element denoting the name of the parameter (i.e. a method + to be defined to set (or get) an instance variable with the same + name, or it might be
  • +
  • + a list of two elements denoting the name and a default value, + or it might be
  • +
  • + a list of more than two elements (specification list), where it is + possible to call methods and to specify additional information about + the parameter to be set. For example, the following definition +
    +  Class Car -parameter {{doors 4} owner}
    +
    + is actually a short form for +
    +  Class Car -parameter {{doors -default 4} owner}
    +
    +
  • +
+

Objects as Parameter

+

In the specification list of a parameter it is possible to specify +a Class; Without the -Class given, a parameter denotes solely +to an instance variable; when -Class is given an child object +of the specified class is created, and the corresponding instance +variable keeps the name of the object. The classes to be used for +parameters must be instances of the meta-class +::xotcl::Class::Parameter. +

+

The following example shows how to define and use parameters of +Class Point and Rectangle + +

+  ::xotcl::Class::Parameter Point -parameter {{x 0} {y 0} {z 0}}
+  ::xotcl::Class::Parameter Rectangle -parameter {
+    color
+    {leftCorner -Class "Point -x 0 -y 0" -default 1}
+    {rightCorner -Class "Point -x 10 -y 10" -default 1}
+  }
+  Class Container -parameter {
+    name
+    {startPoint -Class Point}  
+    {endPoint -Class Point}
+    {r -Class "Rectangle -color green" -default 1}
+  }
+  Container create c1 [list -startPoint -x 1 -y 2] [list -endPoint -z 3] 
+
+Similar to parameters without -Class they are created either +when a default value is given or when they are specified during +creation of the object. The default value is passed to the constructor +of the parameter object. Therefore, upon creation of the Container +in the example above, the following objects are created: +
    +
  • the Container c1
  • +
  • the Point startPoint as a child object of c1 + (since it was specified in the creation of c1)
  • +
  • the Point endPoint as a child object of c1 + (since it was specified in the creation of c1)
  • +
  • the Rectangle r as a child object of c1 + (since it has a default value)
  • +
  • the Points leftCorner and rightCorner + as a child object of the rectangle + (since they have default values).
  • +
+As all other parameters, parameters with classes can be +reconfigured as well; the following commands sets the +z coordinate of the endPoint of the container c1 +to 1. +
+  c1 endPoint -z 1
+
+

Note that via someName -Class PC both, an instance of type +PC is created and an instance variable with the name +someName is created (as for all parameters), which will held +in this case the name of the created object. +

+

Setter and Getter Methods for Parameter

+By default, the methods defined to access the parameter values are +instcommands implemented in C. However, it is possible to specify +custom setter and getters that might perform additional tasks. There +are two ways to specify custom setter/getter methods for parameters: +
    +
  • (a) the custom setter/getter methods can be defined as methods + within the class hierarchy of the object, or
  • +
  • (b) the custom getter/setter can + be specified on a different object. The set and get calls + are delegated to that object, which might be e.g. a + database instance.
  • +
+In both cases when the custom getters and/or setter are defined they +will be called automatically from the standard setter/getter methods. +In order to use approach (a) the parameter methods -getter +and -setter can be used to specify the custom getter and +and setter methods: +
+  Class C -parameter {{a -setter myset -getter myget}}
+
+The methods myset and myget are called like set with +one or two arguments. They are responsible for setting and +retrieving the appropriate values. It is possible to +specify any one of these parameter methods. In the following +example "c1 myset a 100" will be called by the +first line to set the value of a, "c1 myget a" +will be called by the second line to obtain the value of a. +
+  C c1 -a 100
+  c1 a
+
+ In order to use approach (b) a parameter method -access is + used to specify an object responsible for setting/getting the + parameter's values. This has the advantage that the custom getter and + setter methods can be inherited from a separate class hierarchy, such + they can used for any object without cluttering its interface. +

+In order to keep the parameter specification short the access +object can contain instance variables setter or getter, naming its +the setter/getter methods. If these instance variables are not +in the access object, "set" is used per default for getter and +setter. These default values can be still overridden by the +parameter methods -setter or -getter. Here is a simple example +showing this mechanism. +

+  Object db
+  db set setter myset
+  db set getter myget
+  db proc myset {o var value} { my set $var $value }
+  db proc myget {o var} { my set $var }
+
+  Class D -parameter {{x -access db}}
+  D d1
+  d1 x 100
+  puts x=[d1 x],vars=[db info vars]
+
+Note that myset and myget obtain the name of the object as well, +such they can set theses instance variables in the object if +desired. + +

Alternative Parameter Classes

+

For further customization, the class Class::Parameter +containing the described behavior can be as well extended (and +sub-classed). +The basic idea is to make the parameter mechanism extensible in a +similar way as the extension mechanisms work for normal object-oriented +methods. One can extend the predefined Class::Parameter +class with someInstproc and use later +

+
+  C c1 {{a -default 1 -someInstproc x} ...}
+
+

+or subclass it like: +

+
+  Class MyParameter -superclass Class::Parameter
+  Class X -parameterclass MyParameter -parameter ...
+
+

+ +Upon object initialization, the parameters are firstly evaluated for +all mixins and then for the class hierarchy. E.g. in the following +example: +

+
+  Class A -parameter {
+    {pcm 1}
+  }
+
+  Class B -instmixin A -parameter {
+    {cl 4}
+  }
+
+  B b
+
+

+at first the mixin parameter 'pcm' is set, then the class parameter +'cl'. However, since parameters are applied before the '-' methods, +the per-object mixin parameter defaults in the following example are +not set by the standard initialization routine: +

+
+  Class C -parameter {
+    {pom 1}
+  }
+  B b -mixin C
+
+

+If this parameter or any other parameter default, which is introduced +later than the standard initialization routine, is required, then we +can evaluate the parameter defaults manually, like: +

+
+  [B info parameterclass] searchDefaults b
+
+

+This searches all default values for the object b which are defined on +mixins or on the class hierarchy. +

+

Checking Commands for being Objects, +Classes, or Meta-Classes +

+

Since XOTcl is a hybrid language containing several Tcl commands, +sometimes its necessary for applications to distinguish between Tcl +commands and object commands for XOTcl. method of the +Object class looks up an objName and returns 1 if it +is an object and 0 if not: + +

+  objName1 isobject objName2
+

+ +If one can be sure that a command represents an +object, it might be unsure if the command is only an object or also +class or even meta-class. The two instance methods isclass +and ismetaclass check in the same manner, whether a class or +meta-class is given (since ever XOTcl class is an object, they also +return 0, when objName is not an XOTcl object). + +

+  objName1 isclass objName2
+  objName1 ismetaclass objName2
+
+ +

+Exit Handler +

+

A task for a programming language, sometimes of similar importance +as object creation, is the object destruction. XOTcl ensures that all +objects are destroyed and their destructors are invoked when XOTcl +applications terminate. For that reason objects and classes are +destroyed in the order objects, classes, meta-classes. Sometimes +further destruction order is of importance. For these cases, the XOTcl +language provides an exit handler, which is a user-defined proc, which +invokes user-defined exit handling just before the destruction of +objects, classes, meta-classes is invoked. For instance, the exit +handler lets the user specify objects which have to be destroyed +before all other objects. +

+

The exit handler is defined as a proc of Object, which is per default empty: +

+  ::xotcl::Object proc __exitHandler {} {
+    # clients should append exit handlers to this proc body
+    ;
+  }
+
+ +

There are some procs of the Object class pre-defined, +which let us specify an exit handler conveniently: +

+
+   Object setExitHandler body
+   Object getExitHandler
+   Object unsetExitHandler
+

+setExitHandler lets us specify +a proc body that actually contains the user-defined exit handling: +

+   Object setExitHandler {
+     aObj destroy
+     puts "exiting"
+   }
+

+destroys the object aObj before +all other objects and prints the message existing to the screen. With +getExitHandler the exit +handler can be introspected. E.g. if we just want to append the +destruction of object bObj to +an existing exit handler, we use getExitHandler: +

+
+   Object setExitHandler "[Object getExitHandler]; bObj destroy"
+
+

+unsetExitHandler deletes the exit handler. +

+
+
+

Automatic Name Creation +

+The XOTcl autoname +instance method provides an simple way to take the task of +automatically creating names out of the responsibility of the +programmer. The example below shows how to create on each invocation +of method new an agent with a fresh name +(prefixed with agent): +

+
+  Agent proc new args {
+    eval my [my autoname agent] $args
+  }
+
+

+Autonames may have format strings as in the Tcl 'format' command. +E.g.: +

+
+  objName autoname a%06d
+
+

+produces +

+  a000000, a000001, a000002, ...
+
+

+ + + + + + + + +
+

Integrating XOTcl Programs with C Extensions (such as TK) + +

+
+
+ +

Because all XOTcl commands are in the ::xotcl namespace, it is +usually no problem to integrate XOTcl with other Tcl extensions. Most +often it works to import the XOTcl commands (like Object, Class) into +the current namespace because there are no name-clashes with the +commands defined by other extensions.

+ +

Consider you want to perform a deeper integration of an other +extension and XOTcl because you want to benefit from XOTcl's object +system. For instance, you might want to introduce composite TK widgets +(sometimes called mega-widgets) as classes and inherit from these +classes. Here, you have two options: you can change or extend the C +code of that other extension to provide XOTcl classes or objects, or +you can write an XOTcl wrapper in Tcl. For the first alternative, +there are some examples provided in the XOTcl distribution. XOTclGdbm +provides an OO Tcl interface to the GDBM database, for +instance. XOTclSdbm does the same for SDBM, and the TclExpat wrapper +provides a class-based interface to the TclExpat XML parser.

+ +

Consider you do not want to change the C code of a Tcl +extension. Then you can write an OO wrapper in XOTcl for the commands +of the other extension. For stateless commands, you can simply write +forwarder methods. If the extension maintains some state, you +typically associate the state handle with an XOTcl parameter, acquire +the state in the XOTcl constructor, and align the XOTcl destructor +with the stateful instance.

+ +

Consider you want to wrap the Tk button widget. You can acquire the +widget in the constructor, and maintain the widget ID in a +parameter. You now can forward invocations to this widget ID +(e.g. when using "pack"), or register command callbacks (like +buttonPressed). Note that we let the "self" command be replaced in the +scope of the current method so that TK receives the correct object ID +for the callback. In the destructor we destroy the widget as well (we +use "catch" because sometimes widgets can destroyed by other means as +well (e.g. by their parent widget, when a widget/object hierarchy is +destroyed at once).

+ +
+  Class MyButton -parameter {button}
+  MyButton instproc buttonPressed args {
+    puts "pressed [my button]"
+  }
+  MyButton instproc init args {
+    set ID [namespace tail [self]]
+    my instvar button
+    set button [button .$ID \
+      -text "My Button $ID" \
+      -command [list [self] buttonPressed]] 
+    pack $button
+    next
+  }
+  MyButton instproc destroy args {
+     catch {destroy [my button]}
+     next
+  }
+
+  # a test -> 3 buttons, destroy one of them
+  foreach b {a b c} {
+    MyButton $b
+  }
+  b destroy
+
+ +

The "trick" to substitute "self" within the current method scope +works for all kinds of command callbacks. Extensions such as TK, +however, often work with bindings to (global) variables as well. Using +global variables is frowned upon in the OO community. Instead you +should use instance variables of objects. As Tcl can only bind to +existing namespace variables (and XOTcl acquires the namespace of an +object on demand), you have to make sure that the namespace of an +object exists before binding a variable. That can be done with +"requireNamespace":

+
+  GUIClass instproc buildEntry win {
+    my requireNamespace
+    entry $win -textvariable [self]::entryValue
+    my set entryValue {Init Value}
+  }
+
+ +

Note that in the above example we have used to tail of the object ID +as ID for the widget. Usually, it is a good idea to the object name, +if possible, for TK (and other extensions) IDs as well. Another option +is to use a autoname to get a unique name for the ID.

+ +

Sometimes you want to simply send all invocations, not implemented by +XOTcl, to the wrapped command. Here, it is tedious to write a wrapper +for each of these methods. Instead you can use "unknown" to handle +automatic forwarding. Consider you want to wrap TK commands like pack +and replace XOTcl object names with their TK widget ID, so that you can +use both IDs synonymously. You can rename the respective TK commands in +the following way: + +

+  foreach tkCommand {bell bind bindtags clipboard event 
+    focus font grid image lower option pack place raise 
+    selection send tk tkwait winfo wm} { 
+    rename ::$tkCommand __tk_$tkCommand
+    TkCommand ::$tkCommand
+    ::$tkCommand set wrapped __tk_$tkCommand
+  }
+
+ +

The XOTcl class handling the ID substitution for the TK command +might look as follows:

+ +
+  Class TkCommand -parameter wrapped
+  TkCommand instproc unknown args {
+      my instvar wrapped
+      set args [Widget replaceWithWidgetIDs $args]
+      # now call the command
+      eval $wrapped $args
+  }
+
+ +

+ + + + + + + + +
+

References + +

+
+
+ +

[Neumann and Zdun 1999a] +G. Neumann and U. Zdun. +Filters as a language support for design patterns in object-oriented + scripting languages. +In Proceedings of COOTS'99, 5th Conference on Object-Oriented + Technologies and Systems, San Diego, May 1999. + +

[Neumann and Zdun 1999b] +G. Neumann and U. Zdun. +Implementing object-specific design patterns using per-object mixins. +In Proc. of NOSA`99, Second Nordic Workshop on Software + Architecture, Ronneby, Sweden, August 1999. + +

[Neumann and Zdun 1999c] +G. Neumann and U. Zdun. +Enhancing object-based system composition through per-object mixins. +In Proceedings of Asia-Pacific Software Engineering Conference + (APSEC), Takamatsu, Japan, December 1999. + +

[Neumann and Zdun 2000a] +G. Neumann and U. Zdun. + XOTCL, an object-oriented scripting language. +In Proceedings of Tcl2k: The 7th USENIX Tcl/Tk Conference, + Austin, Texas, February 2000. + +

[Neumann and Zdun 2000b] +G. Neumann and U. Zdun. Towards the Usage of Dynamic Object + Aggregations as a Form of Composition +In: Proceedings of Symposium of Applied Computing (SAC'00), Como, Italy, Mar 19-21, 2000. + + +

[Ousterhout 1990] +J. K. Ousterhout. +Tcl: An embeddable command language. +In Proc. of the 1990 Winter USENIX Conference, January 1990. + +

[Ousterhout 1998] +J. K. Ousterhout. +Scripting: Higher Level Programming for the 21st Century, IEEE Computer 31(3), March 1998. + +

[Wetherall and Lindblad 1995] +D. Wetherall and C. J. Lindblad. Extending Tcl for Dynamic + Object-Oriented Programming. Proc. of the Tcl/Tk Workshop '95, July 1995. + + + + + + + + Index: xotcl/doc/tutorial.pdf =================================================================== diff -u Binary files differ Index: xotcl/doc/upvarcompat-xotcl.html =================================================================== diff -u --- xotcl/doc/upvarcompat-xotcl.html (revision 0) +++ xotcl/doc/upvarcompat-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,56 @@ + + + + + XOTcl - Documentation -- ./library/lib/upvarcompat.xotcl + + + +

+ ./library/lib/upvarcompat.xotcl + ./library/lib/upvarcompat.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::upvar-compat 1.0 +
+
+ Filename: + + ./library/lib/upvarcompat.xotcl + +
+
+ + + + + +
+ Description: + + + Provide a version of upvar and uplevel that provide + backward compatibility such that these commands + ignore inactive filter and mixin frames (upvar behaves + the same whether or not a filter is installed). Newer + scripts should use upvar/uplevel [self callinglevel] var/command + instead. + +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/webclient-xotcl.html =================================================================== diff -u --- xotcl/doc/webclient-xotcl.html (revision 0) +++ xotcl/doc/webclient-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,51 @@ + + + + + XOTcl - Documentation -- ./apps/comm/webclient.xotcl + + + +

+ ./apps/comm/webclient.xotcl + ./apps/comm/webclient.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+ Package required: xotcl::comm::httpAccess +
+
+ Filename: + + ./apps/comm/webclient.xotcl + +
+
+ + + + + +
+ Description: + + For a sample webclient, see packages/comm/xocomm.test +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/webserver-xotcl.html =================================================================== diff -u --- xotcl/doc/webserver-xotcl.html (revision 0) +++ xotcl/doc/webserver-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,181 @@ + + + + + XOTcl - Documentation -- ./apps/comm/webserver.xotcl + + + +

+ ./apps/comm/webserver.xotcl + ./apps/comm/webserver.xotcl

+
+

+

Package/File Information

+ Package required: XOTcl +
+ Package required: xotcl::comm::httpd +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./apps/comm/webserver.xotcl + +
+
+ + + + + +
+ Description: + + + This small demo program starts two different webservers: +
    +
  • Firstly, it provides a sample web server that povides the documents in + ../../src/doc (or the files specified with -root) at port 8086 + (or at the port specified via the -port option) as unprotected resources. +

    +

  • Secondly, it starts a second webserver with basic access control + (it accepts test/test as user/password) on port 9096 (or on the + port specified via -protected-port). If it receives an request + for an resource named "exit", it terminates. For all other requests + it returns actual information about the user and the issued request. +
+ To see, how it works, contact it e.g. from netscape. + +
+
+
+

+ + + +

Class: SpecializedWorker

+ Class: Class +
+ Procs/Instprocs: + respond. + + + + + +
+ Description: + + + Specialized worker that can be passed to any webserver + +
+

Instprocs

+
    +
  • + + + + respond + + + + + + +
    + Description: + + + This method handles all responses from the webserver to the client. + We implent here "exit", and we return the information about the actual + request and user in HTML format for all other requests. +

    This method is an example, how to access on the server side + request specific infomation. + +

    +
  • +
+

+
+

+ + + +

Object: h1

+ Class: Httpd +
+ + + + + + + +
+ Description: + + unprotected web server +
+

+
+

+ + + +

Object: h2

+ Class: Httpd +
+ + + + + + + +
+ Description: + + Web server with basic authentication using the specialied worker +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/xo-daemon.html =================================================================== diff -u --- xotcl/doc/xo-daemon.html (revision 0) +++ xotcl/doc/xo-daemon.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,97 @@ + + + + + XOTcl - Documentation -- ./apps/utils/xo-daemon + + + +

+ ./apps/utils/xo-daemon + ./apps/utils/xo-daemon

+
+

+

Package/File Information

+ Package required: XOTcl +
+
+ Filename: + + ./apps/utils/xo-daemon + +
+
+ + + + + + + + + + + + + +
+ Description: + + + This script can be used to start/stop/restart xotcl daemons + and maintains the process IDs, log files and means for easy + restart. +

+ It receives as first parameter the name of the xotcl script + to be executed followed by the desired action and optional + parameters. The specified action can be +

    +
  • start: the specified script is started in + the background, an entry to restart is generated in + the run-directory as well as the process id of the started + script. In addition a logfile is created in the log directory. + If the start of the script fails, the error messages are + shown. +
  • startall: all scripts that were started before + via this script, are started +
  • stop terminates te specified script. +
  • stopall terminates all scripts started via this + command +
  • restart tries to restart the specified script. +
+ The optional parameters are: +
    +
  • -logir specifies the directory for logging. + The default is ~/.xotcl/log. +
  • -rundir specifies the directory where + the information about the running processes is kept. + The default is ~/.xotcl/run. +
+ +
+ Authors: + + + Gustaf Neumann, Gustaf.Neumann@wu-wien.ac.at + +
+ Date: + + [::xotcl::rcs date {$Date: 2004/05/23 22:50:39 $}] +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/xo-whichPkg.html =================================================================== diff -u --- xotcl/doc/xo-whichPkg.html (revision 0) +++ xotcl/doc/xo-whichPkg.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,73 @@ + + + + + XOTcl - Documentation -- ./apps/utils/xo-whichPkg + + + +

+ ./apps/utils/xo-whichPkg + ./apps/utils/xo-whichPkg

+
+

+

Package/File Information

+ Package required: XOTcl +
+ Package required: xotcl::package +
+
+ Filename: + + ./apps/utils/xo-whichPkg + +
+
+ + + + + + + + + + + + + +
+ Description: + + + A small sample script to show which package is loaded from where + when a target package is loaded.

+ Usage: "xo-whichPkg -pkg PACKAGENAME" + +

+ Authors: + + + Fredj Dridi dridi@nestroy.wi-inf.uni-essen.de + +
+ Date: + + [::xotcl::rcs date {$Date: 2004/05/23 22:50:39 $}] +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/xocomm-test.html =================================================================== diff -u --- xotcl/doc/xocomm-test.html (revision 0) +++ xotcl/doc/xocomm-test.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,63 @@ + + + + + XOTcl - Documentation -- ../library/comm/xocomm.test + + + +

+ ../library/comm/xocomm.test + ../library/comm/xocomm.test

+
+

+

Package/File Information

+ Package required: XOTcl +
+ Package required: xotcl::comm::httpAccess +
+ Package required: xotcl::comm::ftp +
+ Package required: xotcl::trace +
+
+ Filename: + + ../library/comm/xocomm.test + +
+
+ + + + + +
+ Description: + + + This is a webclient used as a regression test. + When it is started it launches an xotcl-Web server as partner process. + It tests currently the basic functionality of: +
    +
  • GET and PUT requests +
  • Basic Access Control +
+ +
+
+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/doc/xodoc-xotcl.html =================================================================== diff -u --- xotcl/doc/xodoc-xotcl.html (revision 0) +++ xotcl/doc/xodoc-xotcl.html (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,358 @@ + + + + + XOTcl - Documentation -- ./library/lib/xodoc.xotcl + + + +

+ ./library/lib/xodoc.xotcl + ./library/lib/xodoc.xotcl

+
+

+

Package/File Information

+ Package provided: xotcl::xodoc 0.84 +
+ Package required: xotcl::staticMetadataAnalyzer +
+ Package required: xotcl::htmllib +
+
+ Defined Objects/Classes: + +
+ Filename: + + ./library/lib/xodoc.xotcl + +
+
+ + + + + +
+ Description: + + + XOTcl documentation tool. Overloads the command @, which is used + as a documentation token. + +
+
+
+

+ + + +

Class: ConstraintTokenHTML

+ Class: Class +
+ Heritage: MetadataTokenHTML +
+ + + +
+

+
+

+ + + +

Class: FileTokenHTML

+ Class: Class +
+ Heritage: MetadataTokenHTML +
+ + + +
+

+
+

+ + + +

Class: MetadataTokenHTML

+ Class: Class +
+ Procs/Instprocs: + getDocPropertiesHTML, printHTML. + + + + + +
+ Description: + + Instmixin to provide HTML printing. Such instmixins + are registered for all token types. + +
+

Instprocs

+
    +
  • + + + + abstract + printHTML + + + + + + +
    + Description: + + Print token to HTML document object +
    +
  • +
  • + + + + getDocPropertiesHTML + + + + + + +
    + Description: + + + Returns list of properties as HTML. + +
    +
  • +
+

+
+

+ + + +

Class: MethodTokenHTML

+ Class: Class +
+ Heritage: MetadataTokenHTML +
+ + + +
+

+
+

+ + + +

Class: ObjTokenHTML

+ Class: Class +
+ Heritage: MetadataTokenHTML +
+ + + +
+

+
+

+ + + +

Class: XODoc

+ Class: Class +
+ Procs/Instprocs: + documentFileAsHTML, printHTML, writeFile. + + + + + +
+ Description: + + Handler class for building a documentation database +
+

Instprocs

+
    +
  • + + + + printHTML + name + + + + + + + + + + +
    + Arguments: + + name: name of the html document +
    + Description: + + Create HTML documentation object from metadata token +
    +
  • +
  • + + + + writeFile + filename + name + + + + + + + + + + + + + + +
    + Arguments: + + filename: file name destination +
    + + + name: name of the html document +
    + Description: + + Create HTML docuemntation from metadata token and write to file +
    +
  • +
+

Procs

+
    +
  • + + + + documentFileAsHTML + file + docdir + + + + + + + + + + + + + + + + + + +
    + Arguments: + + file: filename of the xotcl file to be documented +
    + + + docdir: directory to which the html file is written +
    + Description: + + Uses the xoDoc package to produce an HTML documentation of + a specified file ***.xotcl. The file is written to ***.html + in docdir +
    + Return: + + file basename without suffix +
    +
  • +
+

+
+

+
+

+

+ + Back to index page. + +
+
+

+

+ + + Index: xotcl/generic/aol-xotcl.tcl =================================================================== diff -u --- xotcl/generic/aol-xotcl.tcl (revision 0) +++ xotcl/generic/aol-xotcl.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,76 @@ +# $Id: aol-xotcl.tcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +# +# Load XOTcl library and some related packages. +# We expect to find them somewhere in standard +# Tcl package search path (the auto_path var) +# The simplest location is to put them under +# the "lib" directory within the AOLserver tree. +# + +package require XOTcl; namespace import ::xotcl::* +package require xotcl::serializer + +# +# Overload procedure defined in bin/init.tcl. +# It is now XOTcl-savvy in how it treats some +# special namespaces. +# + +proc _ns_savenamespaces {} { + set script [_ns_getpackages] + set import "" + set nslist "" + _ns_getnamespaces namespaces + foreach n $namespaces { + if {[string match ::xotcl* $n] == 0 + && ([catch {::xotcl::Object isobject $n} ret] || $ret == 0)} { + lappend nslist $n + } + } + foreach n $nslist { + foreach {ns_script ns_import} [_ns_getscript $n] { + append script [list namespace eval $n $ns_script] \n + if {$ns_import != ""} { + append import [list namespace eval $n $ns_import] \n + } + } + } + if {[catch {::Serializer all} objects]} { + set objects "" + ns_log notice "XOTcl extension not loaded; will not copy objects." + } + ns_ictl save [append script \n $objects \n $import] + if {0} { + set f [open /tmp/__aolserver-blueprint.tcl w] + puts $f $script + close $f + } +} + +# +# Source XOTcl files from shared/private library +# the way AOLserver does for plain Tcl files. +# + +proc _my_sourcefiles {shared private} { + set files "" + foreach file [lsort [glob -nocomplain -directory $shared *.xotcl]] { + if {[file exists [file join $private [file tail $file]]] == 0} { + lappend files $file + } + } + foreach file [lsort [glob -nocomplain -directory $private *.xotcl]] { + lappend files $file + } + foreach file $files { + _ns_sourcefile $file + } +} + +ns_eval { + _my_sourcefiles [ns_library shared] [ns_library private] +} + +# EOF $RCSfile: aol-xotcl.tcl,v $ + Index: xotcl/generic/aolstub.c =================================================================== diff -u --- xotcl/generic/aolstub.c (revision 0) +++ xotcl/generic/aolstub.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,175 @@ +/* $Id: aolstub.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + + This file provides the stubs needed for the AOL_SERVER, + Please note, that you have to have to apply a small patch + to the AOL server as well (available from www.xotcl.org) + in order to get it working. + + Authore: + Zoran Vasiljevic + Archiware Inc. + +*/ +#ifdef AOL_SERVER + + +#include "xotcl.h" +#include + +int Ns_ModuleVersion = 1; + +#if NS_MAJOR_VERSION>=4 +# define AOL4 +#endif + +/* + *---------------------------------------------------------------------------- + * + * NsXotcl_Init -- + * + * Loads the package for the first time, i.e. in the startup thread. + * + * Results: + * Standard Tcl result + * + * Side effects: + * Package initialized. Tcl commands created. + * + *---------------------------------------------------------------------------- + */ + + +static int +NsXotcl_Init (Tcl_Interp *interp, void *context) +{ + static int firsttime = 1; + int ret; + + ret = Xotcl_Init(interp); + + if (firsttime) { + if (ret != TCL_OK) { + Ns_Log(Warning, "can't load module %s: %s", (char *)context, + Tcl_GetStringResult(interp)); + } else { + Ns_Log(Notice, "%s module version %s%s", (char*)context, + XOTCLVERSION,XOTCLPATCHLEVEL); + /* + * Import the XOTcl namespace only for the shell after + * predefined is through + */ + Tcl_Import(interp, Tcl_GetGlobalNamespace(interp), + "xotcl::*", 0); + } + firsttime = 0; + } + + return ret; +} + +/* + *---------------------------------------------------------------------------- + * + * NsXotcl_Init1 -- + * + * Loads the package in each thread-interpreter. + * This is needed since XOTcl Class/Object commands are not copied + * from the startup thread to the connection (or any other) thread. + * during AOLserver initialization and/or thread creation times. + * + * Why ? + * + * Simply because these two commands declare a delete callback which is + * unsafe to call in any other thread but in the one which created them. + * + * To understand this, you may need to get yourself acquainted with the + * mechanics of the AOLserver, more precisely, with the way Tcl interps + * are initialized (dive into nsd/tclinit.c in AOLserver distro). + * + * So, we made sure (by patching the AOLserver code) that no commands with + * delete callbacks declared, are ever copied from the startup thread. + * Additionaly, we also made sure that AOLserver properly invokes any + * AtCreate callbacks. So, instead of activating those callbacks *after* + * running the Tcl-initialization script (which is the standard behaviour) + * we activate them *before*. So we may get a chance to configure the + * interpreter correctly for any commands within the init script. + * + * Proper XOTcl usage would be to declare all resources (classes, objects) + * at server initialization time and let AOLserver machinery to copy them + * (or re-create them, better yet) in each new thread. + * Resources created within a thread are automatically garbage-collected + * on thread-exit time, so don't create any XOTcl resources there. + * Create them in the startup thread and they will automatically be copied + * for you. + * Look in /modules/tcl/xotcl for a simple example. + * + * Results: + * Standard Tcl result. + * + * Side effects: + * Tcl commands created. + * + *---------------------------------------------------------------------------- + */ + +static int +NsXotcl_Init1 (Tcl_Interp *interp, void *notUsed) +{ + int result; + +#ifndef AOL4 + result = Xotcl_Init(interp); +#else + result = TCL_OK; +#endif + + /* + * Import the XOTcl namespace only for the shell after + * predefined is through + */ + Tcl_Import(interp, Tcl_GetGlobalNamespace(interp), "xotcl::*", 1); + + return result; +} + +/* + *---------------------------------------------------------------------------- + * + * Ns_ModuleInit -- + * + * Called by the AOLserver when loading shared object file. + * + * Results: + * Standard AOLserver result + * + * Side effects: + * Many. Depends on the package. + * + *---------------------------------------------------------------------------- + */ + +int +Ns_ModuleInit(char *hServer, char *hModule) +{ + int ret; + + /*Ns_Log(Notice, "+++ ModuleInit","INIT");*/ + ret = Ns_TclInitInterps(hServer, NsXotcl_Init, (void*)hModule); + + if (ret == TCL_OK) { + /* + * See discussion for NsXotcl_Init1 procedure. + * Note that you need to patch AOLserver for this to work! + * The patch basically forbids copying of C-level commands with + * declared delete callbacks. It also runs all AtCreate callbacks + * BEFORE AOLserver runs the Tcl script for initializing new interps. + * These callbacks are then responsible for setting up the stage + * for correct (XOTcl) extension startup (including copying any + * XOTcl resources (classes, objects) created in the startup thread. + */ + Ns_TclRegisterAtCreate((Ns_TclInterpInitProc *)NsXotcl_Init1, NULL); + } + + return ret == TCL_OK ? NS_OK : NS_ERROR; +} +#endif Index: xotcl/generic/mk_predefined.xotcl =================================================================== diff -u --- xotcl/generic/mk_predefined.xotcl (revision 0) +++ xotcl/generic/mk_predefined.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,25 @@ +#!./xotclsh +# $Id: mk_predefined.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# A small script file that creates a static array from a tcl- +# script for inclusion in c programs -gn +set f [open predefined.xotcl] +set content [read $f] +close $f + +regsub -all {\\} $content && content +regsub -all {"} $content {\"} content ;#" +regsub -all "\[ \]+\n" $content \n content ;# remove trailing space +regsub -all "\n\[ \t\]+" $content \n content ;# remove leading space +regsub -all "\n#\[^\n\]*\n" $content \n content ;# remove comment lines +regsub -all "\n#\[^\n\]*\n" $content \n content ;# remove comment lines +regsub -all "\n#\[^\n\]*\n" $content \n content ;# remove comment lines +regsub -all "\n#\[^\n\]*\n" $content \n content ;# remove comment lines +regsub -all "\[\n\]+" $content \n content ;# remove empty lines +regsub -all "\n}" $content "}" content ;# newlines btwn braces +regsub -all "\n" $content "\\n\"\n\"" content + +puts "static char cmd\[\] = " +puts "\"$content\";" +puts "" + + Index: xotcl/generic/predefined.h =================================================================== diff -u --- xotcl/generic/predefined.h (revision 0) +++ xotcl/generic/predefined.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,241 @@ +static char cmd[] = +"# $Id: predefined.h,v 1.1 2004/05/23 22:50:39 neumann Exp $\n" +"::xotcl::Object instproc init args {}\n" +"::xotcl::Object create ::xotcl::@\n" +"::xotcl::@ proc unknown args {}\n" +"namespace eval ::xotcl { namespace export @ }\n" +"foreach cmd {array append lappend trace eval} {\n" +"::xotcl::Object insttclcmd $cmd}\n" +"::xotcl::Object instproc self {} {return [::xotcl::self]}\n" +"::xotcl::Object instproc defaultmethod {} {\n" +"return [::xotcl::self]}\n" +"::xotcl::Object instproc filterappend f {\n" +"::xotcl::my filter [concat [::xotcl::my info filter -guards] $f]}\n" +"::xotcl::Object instproc mixinappend m {\n" +"::xotcl::my mixin [concat [::xotcl::my info mixin] $m]}\n" +"::xotcl::Class instproc instfilterappend f {\n" +"::xotcl::my instfilter [concat [::xotcl::my info instfilter -guards] $f]}\n" +"::xotcl::Class instproc instmixinappend m {\n" +"::xotcl::my instmixin [concat [::xotcl::my info instmixin] $m]}\n" +"::xotcl::Object instproc hasclass cl {\n" +"if {[::xotcl::my ismixin $cl]} {return 1}\n" +"::xotcl::my istype $cl}\n" +"::xotcl::Object proc unsetExitHandler {} {\n" +"::xotcl::Object proc __exitHandler {} {\n" +";}}\n" +"::xotcl::Object unsetExitHandler\n" +"::xotcl::Object proc setExitHandler {newbody} {\n" +"::xotcl::Object proc __exitHandler {} $newbody}\n" +"::xotcl::Object proc getExitHandler {} {\n" +"::xotcl::Object info body __exitHandler}\n" +"::xotcl::Class::Parameter superclass ::xotcl::Class\n" +"::xotcl::Class::Parameter instproc mkParameter {obj name args} {\n" +"if {[$obj exists $name]} {\n" +"eval [$obj set $name] configure $args} else {\n" +"$obj set $name [eval ::xotcl::my new -childof $obj $args]}}\n" +"::xotcl::Class::Parameter instproc getParameter {obj name args} {\n" +"[$obj set $name]}\n" +"::xotcl::Class::Parameter proc Class {param args} {\n" +"::xotcl::my set access [lindex $param 0]\n" +"::xotcl::my set setter mkParameter\n" +"::xotcl::my set getter getParameter\n" +"::xotcl::my set extra {[::xotcl::self]}\n" +"::xotcl::my set defaultParam [lrange $param 1 end]}\n" +"::xotcl::Class::Parameter proc default {val} {\n" +"[::xotcl::my set cl] set __defaults([::xotcl::my set name]) $val}\n" +"::xotcl::Class::Parameter proc setter x {\n" +"::xotcl::my set setter $x}\n" +"::xotcl::Class::Parameter proc getter x {\n" +"::xotcl::my set getter $x}\n" +"::xotcl::Class::Parameter proc access obj {\n" +"::xotcl::my set access $obj\n" +"::xotcl::my set extra \\[::xotcl::self\\]\n" +"foreach v [$obj info vars] {::xotcl::my set $v [$obj set $v]}}\n" +"::xotcl::Class::Parameter proc mkGetterSetter {cl name args} {\n" +"set l [llength $args]\n" +"if {$l == 0} {\n" +"$cl instparametercmd $name} elseif {$l == 1} {\n" +"$cl set __defaults($name) [lindex $args 0]\n" +"$cl instparametercmd $name} else {\n" +"::xotcl::my set name $name\n" +"::xotcl::my set cl $cl\n" +"::eval ::xotcl::my configure $args\n" +"if {[::xotcl::my exists extra] || [::xotcl::my exists setter] ||\n" +"[::xotcl::my exists getter] || [::xotcl::my exists access]} {\n" +"::xotcl::my instvar extra setter getter access defaultParam\n" +"if {![info exists extra]} {set extra \"\"}\n" +"if {![info exists defaultParam]} {set defaultParam \"\"}\n" +"if {![info exists setter]} {set setter set}\n" +"if {![info exists getter]} {set getter set}\n" +"if {![info exists access]} {set access ::xotcl::my}\n" +"$cl instproc $name args \"\n" +"if {\\[llength \\$args] == 0} {\n" +"return \\[$access $getter $extra $name\\]} else {\n" +"return \\[eval $access $setter $extra $name \\$args $defaultParam \\]}\"\n" +"foreach instvar {extra defaultParam setter getter access} {\n" +"if {[::xotcl::my exists $instvar]} {::xotcl::my unset $instvar}}} else {\n" +"$cl instparametercmd $name}}}\n" +"::xotcl::Class::Parameter proc values {param args} {\n" +"set cl [::xotcl::my set cl]\n" +"set ci [$cl info instinvar]\n" +"set valueTest {}\n" +"foreach a $args {\n" +"::lappend valueTest \"\\[\\$cl set $param\\] == [list $a]\"}\n" +"::lappend ci [join $valueTest \" || \"]\n" +"$cl instinvar $ci}\n" +"::xotcl::Object instproc abstract {methtype methname arglist} {\n" +"if {$methtype != \"proc\" && $methtype != \"instproc\"} {\n" +"error \"invalid method type '$methtype', \\\n" +"must be either 'proc' or 'instproc'.\"}\n" +"::xotcl::my $methtype $methname $arglist \"\n" +"if {\\[::xotcl::self callingproc\\] != \\[::xotcl::self proc\\] &&\n" +"\\[::xotcl::self callingobject\\] != \\[::xotcl::self\\]} {\n" +"error \\\"Abstract method $methname $arglist called\\\"} else {::xotcl::next}\n" +"\"}\n" +"::xotcl::Class create ::xotcl::Object::CopyHandler -parameter {\n" +"{targetList \"\"}\n" +"{dest \"\"}\n" +"objLength}\n" +"::xotcl::Object::CopyHandler instproc makeTargetList t {\n" +"::xotcl::my lappend targetList $t\n" +"if {[::xotcl::my isobject $t]} {\n" +"if {[$t info hasNamespace]} {\n" +"set children [$t info children]} else {\n" +"return}}\n" +"foreach c [namespace children $t] {\n" +"if {![::xotcl::my isobject $c]} {\n" +"lappend children [namespace children $t]}}\n" +"foreach c $children {\n" +"::xotcl::my makeTargetList $c}}\n" +"::xotcl::Object::CopyHandler instproc copyNSVarsAndCmds {orig dest} {\n" +"::xotcl::namespace_copyvars $orig $dest\n" +"::xotcl::namespace_copycmds $orig $dest}\n" +"::xotcl::Object::CopyHandler instproc getDest origin {\n" +"set tail [string range $origin [::xotcl::my set objLength] end]\n" +"return ::[string trimleft [::xotcl::my set dest]$tail :]}\n" +"::xotcl::Object::CopyHandler instproc copyTargets {} {\n" +"foreach origin [::xotcl::my set targetList] {\n" +"set dest [::xotcl::my getDest $origin]\n" +"if {[::xotcl::my isobject $origin]} {\n" +"if {[::xotcl::my isclass $origin]} {\n" +"set cl [[$origin info class] create $dest -noinit]\n" +"set obj $cl\n" +"$cl superclass [$origin info superclass]\n" +"$cl parameterclass [$origin info parameterclass]\n" +"$cl parameter [$origin info parameter]\n" +"$cl instinvar [$origin info instinvar]\n" +"$cl instfilter [$origin info instfilter -guards]\n" +"$cl instmixin [$origin info instmixin]\n" +"my copyNSVarsAndCmds ::xotcl::classes::$origin ::xotcl::classes::$dest} else {\n" +"set obj [[$origin info class] create $dest -noinit]}\n" +"$obj invar [$origin info invar]\n" +"$obj check [$origin info check]\n" +"$obj mixin [$origin info mixin]\n" +"$obj filter [$origin info filter -guards]\n" +"if {[$origin info hasNamespace]} {\n" +"$obj requireNamespace}} else {\n" +"namespace eval $dest {}}\n" +"::xotcl::my copyNSVarsAndCmds $origin $dest}}\n" +"::xotcl::Object::CopyHandler instproc copy {obj dest} {\n" +"::xotcl::my set objLength [string length $obj]\n" +"::xotcl::my set dest $dest\n" +"::xotcl::my makeTargetList $obj\n" +"::xotcl::my copyTargets}\n" +"::xotcl::Object instproc copy newName {\n" +"if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} {\n" +"[[::xotcl::self class]::CopyHandler new -volatile] copy [::xotcl::self] $newName}}\n" +"::xotcl::Object instproc move newName {\n" +"if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} {\n" +"if {$newName != \"\"} {\n" +"::xotcl::my copy $newName}\n" +"if {[::xotcl::my isclass [::xotcl::self]] && $newName != \"\"} {\n" +"foreach subclass [::xotcl::my info subclass] {\n" +"set scl [$subclass info superclass]\n" +"if {[set index [lsearch -exact $scl [::xotcl::self]]] != -1} {\n" +"set scl [lreplace $scl $index $index $newName]\n" +"$subclass superclass $scl}} }\n" +"::xotcl::my destroy}}\n" +"::xotcl::Object create ::xotcl::config\n" +"::xotcl::config proc load {obj file} {\n" +"source $file\n" +"foreach i [array names ::auto_index [list $obj *proc *]] {\n" +"set type [lindex $i 1]\n" +"set meth [lindex $i 2]\n" +"if {[$obj info ${type}s $meth] == {}} {\n" +"$obj $type $meth auto $::auto_index($i)}}}\n" +"::xotcl::config proc mkindex {meta dir args} {\n" +"set sp {[ ]+}\n" +"set st {^[ ]*}\n" +"set wd {([^ ;]+)}\n" +"foreach creator $meta {\n" +"::lappend cp $st$creator${sp}create$sp$wd\n" +"::lappend ap $st$creator$sp$wd}\n" +"foreach method {proc instproc} {\n" +"::lappend mp $st$wd${sp}($method)$sp$wd}\n" +"foreach cl [concat ::xotcl::Class [::xotcl::Class info heritage]] {\n" +"eval ::lappend meths [$cl info instcommands]}\n" +"set old [pwd]\n" +"cd $dir\n" +"::append idx \"# Tcl autoload index file, version 2.0\\n\"\n" +"::append idx \"# xotcl additions generated with \"\n" +"::append idx \"\\\"::xotcl::config::mkindex [list $meta] [list $dir] $args\\\"\\n\"\n" +"set oc 0\n" +"set mc 0\n" +"foreach file [eval glob -nocomplain -- $args] {\n" +"if {[catch {set f [open $file]} msg]} then {\n" +"catch {close $f}\n" +"cd $old\n" +"error $msg}\n" +"while {[gets $f line] >= 0} {\n" +"foreach c $cp {\n" +"if {[regexp $c $line x obj]==1 &&\n" +"[string index $obj 0]!={$}} then {\n" +"::incr oc\n" +"::append idx \"set auto_index($obj) \"\n" +"::append idx \"\\\"::xotcl::config::load $obj \\$dir/$file\\\"\\n\"}}\n" +"foreach a $ap {\n" +"if {[regexp $a $line x obj]==1 &&\n" +"[string index $obj 0]!={$} &&\n" +"[lsearch -exact $meths $obj]==-1} {\n" +"::incr oc\n" +"::append idx \"set auto_index($obj) \"\n" +"::append idx \"\\\"::xotcl::config::load $obj \\$dir/$file\\\"\\n\"}}\n" +"foreach m $mp {\n" +"if {[regexp $m $line x obj ty pr]==1 &&\n" +"[string index $obj 0]!={$} &&\n" +"[string index $pr 0]!={$}} then {\n" +"::incr mc\n" +"::append idx \"set \\{auto_index($obj \"\n" +"::append idx \"$ty $pr)\\} \\\"source \\$dir/$file\\\"\\n\"}}}\n" +"close $f}\n" +"set t [open tclIndex a+]\n" +"puts $t $idx nonewline\n" +"close $t\n" +"cd $old\n" +"return \"$oc objects, $mc methods\"}\n" +"xotcl::Object instproc extractConfigureArg {al name {cutTheArg 0}} {\n" +"set value \"\"\n" +"upvar $al argList\n" +"set largs [llength $argList]\n" +"for {set i 0} {$i < $largs} {incr i} {\n" +"if {[lindex $argList $i] == $name && $i + 1 < $largs} {\n" +"set startIndex $i\n" +"set endIndex [expr {$i + 1}]\n" +"while {$endIndex < $largs &&\n" +"[string first - [lindex $argList $endIndex]] != 0} {\n" +"lappend value [lindex $argList $endIndex]\n" +"incr endIndex}}}\n" +"if {[info exists startIndex] && $cutTheArg != 0} {\n" +"set argList [lreplace $argList $startIndex [expr {$endIndex - 1}]]}\n" +"return $value}\n" +"::xotcl::Object create ::xotcl::rcs\n" +"::xotcl::rcs proc date string {\n" +"lreplace [lreplace $string 0 0] end end}\n" +"::xotcl::rcs proc version string {\n" +"lindex $string 2}\n" +"if {![info exists ::env(HOME)]} {set ::env(HOME) /root}\n" +"set ::xotcl::confdir ~/.xotcl\n" +"set ::xotcl::logdir $::xotcl::confdir/log\n" +"::xotcl::Class proc __unknown name {}\n" +""; + Index: xotcl/generic/predefined.xotcl =================================================================== diff -u --- xotcl/generic/predefined.xotcl (revision 0) +++ xotcl/generic/predefined.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,404 @@ +# $Id: predefined.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +# init must exist on Object. per default it is empty. +::xotcl::Object instproc init args {} + +# documentation stub object -> just ignore +# all documentations if xoDoc is not loaded +::xotcl::Object create ::xotcl::@ +::xotcl::@ proc unknown args {} +namespace eval ::xotcl { namespace export @ } + +#::xotcl::Object instproc recreate args { +# ::xotcl::my cleanup +# ::set cl [::xotcl::my info class] +# ::set pcl [$cl info parameterclass] +# $pcl searchDefaults [::xotcl::self] +# if {![eval ::xotcl::my initmethods $args]} { +# eval ::xotcl::my init $args +# } +# return [::xotcl::self] +#} + +# provide some Tcl-commands as methods for Objects +foreach cmd {array append lappend trace eval} { + ::xotcl::Object insttclcmd $cmd +} + +::xotcl::Object instproc self {} {return [::xotcl::self]} +::xotcl::Object instproc defaultmethod {} { + #if {[string compare "::" [::xotcl::my info parent]]} { + # [::xotcl::my info parent] __next + #} + return [::xotcl::self] +} + +# support for XOTcl specifics +::xotcl::Object instproc filterappend f { + ::xotcl::my filter [concat [::xotcl::my info filter -guards] $f] +} +::xotcl::Object instproc mixinappend m { + ::xotcl::my mixin [concat [::xotcl::my info mixin] $m] +} +::xotcl::Class instproc instfilterappend f { + ::xotcl::my instfilter [concat [::xotcl::my info instfilter -guards] $f] +} +::xotcl::Class instproc instmixinappend m { + ::xotcl::my instmixin [concat [::xotcl::my info instmixin] $m] +} +::xotcl::Object instproc hasclass cl { + if {[::xotcl::my ismixin $cl]} {return 1} + ::xotcl::my istype $cl +} + +# Exit Handler +::xotcl::Object proc unsetExitHandler {} { + ::xotcl::Object proc __exitHandler {} { + # clients should append exit handlers to this proc body + ; + } +} +# pre-defined as empty method +::xotcl::Object unsetExitHandler +::xotcl::Object proc setExitHandler {newbody} { + ::xotcl::Object proc __exitHandler {} $newbody +} +::xotcl::Object proc getExitHandler {} { + ::xotcl::Object info body __exitHandler +} +::xotcl::Class::Parameter superclass ::xotcl::Class +::xotcl::Class::Parameter instproc mkParameter {obj name args} { + #puts "[::xotcl::self proc] $obj $name <$args>" + if {[$obj exists $name]} { + eval [$obj set $name] configure $args + } else { + $obj set $name [eval ::xotcl::my new -childof $obj $args] + } +} +::xotcl::Class::Parameter instproc getParameter {obj name args} { + #puts "[::xotcl::self proc] $obj $name <$args>" + [$obj set $name] +} + + +::xotcl::Class::Parameter proc Class {param args} { + #puts "*** [::xotcl::self] parameter: [::xotcl::self proc] '$param' <$args>" + ::xotcl::my set access [lindex $param 0] + ::xotcl::my set setter mkParameter + ::xotcl::my set getter getParameter + ::xotcl::my set extra {[::xotcl::self]} + ::xotcl::my set defaultParam [lrange $param 1 end] +} +::xotcl::Class::Parameter proc default {val} { + [::xotcl::my set cl] set __defaults([::xotcl::my set name]) $val +} +::xotcl::Class::Parameter proc setter x { + ::xotcl::my set setter $x +} +::xotcl::Class::Parameter proc getter x { + ::xotcl::my set getter $x +} +::xotcl::Class::Parameter proc access obj { + ::xotcl::my set access $obj + ::xotcl::my set extra \[::xotcl::self\] + foreach v [$obj info vars] {::xotcl::my set $v [$obj set $v]} +} +::xotcl::Class::Parameter proc mkGetterSetter {cl name args} { + #puts stderr "[::xotcl::self proc] $cl $name <$args> [llength $args]" + set l [llength $args] + if {$l == 0} { + $cl instparametercmd $name + } elseif {$l == 1} { + $cl set __defaults($name) [lindex $args 0] + $cl instparametercmd $name + } else { + ::xotcl::my set name $name + ::xotcl::my set cl $cl + ::eval ::xotcl::my configure $args + if {[::xotcl::my exists extra] || [::xotcl::my exists setter] || + [::xotcl::my exists getter] || [::xotcl::my exists access]} { + ::xotcl::my instvar extra setter getter access defaultParam + if {![info exists extra]} {set extra ""} + if {![info exists defaultParam]} {set defaultParam ""} + if {![info exists setter]} {set setter set} + if {![info exists getter]} {set getter set} + if {![info exists access]} {set access ::xotcl::my} + $cl instproc $name args " + if {\[llength \$args] == 0} { + return \[$access $getter $extra $name\] + } else { + return \[eval $access $setter $extra $name \$args $defaultParam \] + }" + foreach instvar {extra defaultParam setter getter access} { + if {[::xotcl::my exists $instvar]} {::xotcl::my unset $instvar} + } + } else { + $cl instparametercmd $name + } + } +} +::xotcl::Class::Parameter proc values {param args} { + set cl [::xotcl::my set cl] + set ci [$cl info instinvar] + set valueTest {} + foreach a $args { + ::lappend valueTest "\[\$cl set $param\] == [list $a]" + } + ::lappend ci [join $valueTest " || "] + $cl instinvar $ci +} + +::xotcl::Object instproc abstract {methtype methname arglist} { + if {$methtype != "proc" && $methtype != "instproc"} { + error "invalid method type '$methtype', \ + must be either 'proc' or 'instproc'." + } + ::xotcl::my $methtype $methname $arglist " + if {\[::xotcl::self callingproc\] != \[::xotcl::self proc\] && + \[::xotcl::self callingobject\] != \[::xotcl::self\]} { + error \"Abstract method $methname $arglist called\" + } else {::xotcl::next} + " +} + +# +# copy/move implementation +# +::xotcl::Class create ::xotcl::Object::CopyHandler -parameter { + {targetList ""} + {dest ""} + objLength +} + +# targets are all namspaces and objs part-of the copied obj +::xotcl::Object::CopyHandler instproc makeTargetList t { + ::xotcl::my lappend targetList $t + # if it is an object without namespace, it is a leaf + if {[::xotcl::my isobject $t]} { + if {[$t info hasNamespace]} { + # make target list from all children + set children [$t info children] + } else { + # ok, no namespace -> no more children + return + } + } + # now append all namespaces that are in the obj, but that + # are not objects + foreach c [namespace children $t] { + if {![::xotcl::my isobject $c]} { + lappend children [namespace children $t] + } + } + + # a namespace or an obj with namespace may have children + # itself + foreach c $children { + ::xotcl::my makeTargetList $c + } +} + +::xotcl::Object::CopyHandler instproc copyNSVarsAndCmds {orig dest} { + ::xotcl::namespace_copyvars $orig $dest + ::xotcl::namespace_copycmds $orig $dest +} + +# construct destination obj name from old qualified ns name +::xotcl::Object::CopyHandler instproc getDest origin { + set tail [string range $origin [::xotcl::my set objLength] end] + return ::[string trimleft [::xotcl::my set dest]$tail :] +} + +::xotcl::Object::CopyHandler instproc copyTargets {} { + foreach origin [::xotcl::my set targetList] { + set dest [::xotcl::my getDest $origin] + if {[::xotcl::my isobject $origin]} { + # copy class information + if {[::xotcl::my isclass $origin]} { + set cl [[$origin info class] create $dest -noinit] + # class object + set obj $cl + $cl superclass [$origin info superclass] + $cl parameterclass [$origin info parameterclass] + $cl parameter [$origin info parameter] + $cl instinvar [$origin info instinvar] + $cl instfilter [$origin info instfilter -guards] + $cl instmixin [$origin info instmixin] + my copyNSVarsAndCmds ::xotcl::classes::$origin ::xotcl::classes::$dest + } else { + # create obj + set obj [[$origin info class] create $dest -noinit] + } + # copy object -> may be a class obj + $obj invar [$origin info invar] + $obj check [$origin info check] + $obj mixin [$origin info mixin] + $obj filter [$origin info filter -guards] + # set md [$origin info metadata] + # $obj metadata add $md + # foreach m $md { $obj metadata $m [$origin metadata $m] } + if {[$origin info hasNamespace]} { + $obj requireNamespace + } + } else { + namespace eval $dest {} + } + ::xotcl::my copyNSVarsAndCmds $origin $dest + } +} + +::xotcl::Object::CopyHandler instproc copy {obj dest} { + #puts stderr "[::xotcl::self] copy <$obj> <$dest>" + ::xotcl::my set objLength [string length $obj] + ::xotcl::my set dest $dest + ::xotcl::my makeTargetList $obj + ::xotcl::my copyTargets +} + +#Class create ::xotcl::NoInit +#::xotcl::NoInit instproc init args {;} + + +::xotcl::Object instproc copy newName { + if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} { + [[::xotcl::self class]::CopyHandler new -volatile] copy [::xotcl::self] $newName + } +} + +::xotcl::Object instproc move newName { + if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} { + if {$newName != ""} { + ::xotcl::my copy $newName + } + ### let all subclasses get the copied class as superclass + if {[::xotcl::my isclass [::xotcl::self]] && $newName != ""} { + foreach subclass [::xotcl::my info subclass] { + set scl [$subclass info superclass] + if {[set index [lsearch -exact $scl [::xotcl::self]]] != -1} { + set scl [lreplace $scl $index $index $newName] + $subclass superclass $scl + } + } + } + ::xotcl::my destroy + } +} + +::xotcl::Object create ::xotcl::config +::xotcl::config proc load {obj file} { + source $file + foreach i [array names ::auto_index [list $obj *proc *]] { + set type [lindex $i 1] + set meth [lindex $i 2] + if {[$obj info ${type}s $meth] == {}} { + $obj $type $meth auto $::auto_index($i) + } + } +} + +::xotcl::config proc mkindex {meta dir args} { + set sp {[ ]+} + set st {^[ ]*} + set wd {([^ ;]+)} + foreach creator $meta { + ::lappend cp $st$creator${sp}create$sp$wd + ::lappend ap $st$creator$sp$wd + } + foreach method {proc instproc} { + ::lappend mp $st$wd${sp}($method)$sp$wd + } + foreach cl [concat ::xotcl::Class [::xotcl::Class info heritage]] { + eval ::lappend meths [$cl info instcommands] + } + set old [pwd] + cd $dir + ::append idx "# Tcl autoload index file, version 2.0\n" + ::append idx "# xotcl additions generated with " + ::append idx "\"::xotcl::config::mkindex [list $meta] [list $dir] $args\"\n" + set oc 0 + set mc 0 + foreach file [eval glob -nocomplain -- $args] { + if {[catch {set f [open $file]} msg]} then { + catch {close $f} + cd $old + error $msg + } + while {[gets $f line] >= 0} { + foreach c $cp { + if {[regexp $c $line x obj]==1 && + [string index $obj 0]!={$}} then { + ::incr oc + ::append idx "set auto_index($obj) " + ::append idx "\"::xotcl::config::load $obj \$dir/$file\"\n" + } + } + foreach a $ap { + if {[regexp $a $line x obj]==1 && + [string index $obj 0]!={$} && + [lsearch -exact $meths $obj]==-1} { + ::incr oc + ::append idx "set auto_index($obj) " + ::append idx "\"::xotcl::config::load $obj \$dir/$file\"\n" + } + } + foreach m $mp { + if {[regexp $m $line x obj ty pr]==1 && + [string index $obj 0]!={$} && + [string index $pr 0]!={$}} then { + ::incr mc + ::append idx "set \{auto_index($obj " + ::append idx "$ty $pr)\} \"source \$dir/$file\"\n" + } + } + } + close $f + } + set t [open tclIndex a+] + puts $t $idx nonewline + close $t + cd $old + return "$oc objects, $mc methods" +} + +# +# if cutTheArg not 0, it cut from upvar argsList +# +xotcl::Object instproc extractConfigureArg {al name {cutTheArg 0}} { + set value "" + upvar $al argList + set largs [llength $argList] + for {set i 0} {$i < $largs} {incr i} { + if {[lindex $argList $i] == $name && $i + 1 < $largs} { + set startIndex $i + set endIndex [expr {$i + 1}] + while {$endIndex < $largs && + [string first - [lindex $argList $endIndex]] != 0} { + lappend value [lindex $argList $endIndex] + incr endIndex + } + } + } + if {[info exists startIndex] && $cutTheArg != 0} { + set argList [lreplace $argList $startIndex [expr {$endIndex - 1}]] + } + return $value +} + +::xotcl::Object create ::xotcl::rcs +::xotcl::rcs proc date string { + lreplace [lreplace $string 0 0] end end +} +::xotcl::rcs proc version string { + lindex $string 2 +} + +# if HOME is not set, and ~ is resolved, Tcl chokes on that +if {![info exists ::env(HOME)]} {set ::env(HOME) /root} +set ::xotcl::confdir ~/.xotcl +set ::xotcl::logdir $::xotcl::confdir/log + +::xotcl::Class proc __unknown name { + #unknown $name +} + + Index: xotcl/generic/xotcl.c =================================================================== diff -u --- xotcl/generic/xotcl.c (revision 0) +++ xotcl/generic/xotcl.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,9464 @@ +/* + * + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2004 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + * */ + +#define XOTCL_C 1 +#include "xotclInt.h" +#include "xotclAccessInt.h" + +#ifdef KEEP_TCL_CMD_TYPE +# include "tclCompile.h" +#endif + +#ifdef COMPILE_XOTCL_STUBS +extern XotclStubs xotclStubs; +#endif + +#ifdef XOTCL_MEM_COUNT +int xotclMemCountInterpCounter = 0; +#endif + +/* + * Tcl_Obj Types for XOTcl Objects + */ + +#ifdef USE_TCL_STUBS +# define XOTcl_ExprObjCmd(cd,in,objc,objv) \ + XOTclCallCommand(in, EXPR, objc, objv) +# define XOTcl_IncrObjCmd(cd,in,objc,objv) \ + XOTclCallCommand(in, INCR, objc, objv) +# define XOTcl_SubstObjCmd(cd,in,objc,objv) \ + XOTclCallCommand(in, SUBST, objc, objv) +#else +# define XOTcl_ExprObjCmd(cd,in,objc,objv) \ + Tcl_ExprObjCmd(cd, in, objc, objv) +# define XOTcl_IncrObjCmd(cd,in,objc,objv) \ + Tcl_IncrObjCmd(cd, in, objc, objv) +# define XOTcl_SubstObjCmd(cd,in,objc,objv) \ + Tcl_SubstObjCmd(cd, in, objc, objv) +#endif + + +static int SetXOTclObjectFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); +static void UpdateStringOfXOTclObject(Tcl_Obj *objPtr); +static void FreeXOTclObjectInternalRep(Tcl_Obj *objPtr); +static void DupXOTclObjectInternalRep(Tcl_Obj *src, Tcl_Obj *cpy); + +XOTCLINLINE static void GuardAdd(Tcl_Interp *in, XOTclCmdList* filterCL, Tcl_Obj *guard); +static int GuardCheck(Tcl_Interp *in, ClientData guards); +static int GuardCall(XOTclObject *obj, XOTclClass* cl, Tcl_Command cmd, Tcl_Interp *in, ClientData clientData, int push); +static void GuardDel(XOTclCmdList* filterCL); + +static Tcl_ObjType XOTclObjectType = { + "XOTclObject", + FreeXOTclObjectInternalRep, + DupXOTclObjectInternalRep, + UpdateStringOfXOTclObject, + SetXOTclObjectFromAny +}; + + +typedef enum { CALLING_LEVEL, ACTIVE_LEVEL } CallStackLevel; + +typedef struct callFrameContext { + int framesSaved; + Tcl_CallFrame *framePtr; + Tcl_CallFrame *varFramePtr; +} callFrameContext; +typedef struct tclCmdClientData { + XOTcl_Object *obj; + Tcl_Obj *cmdName; +} tclCmdClientData; + +static int ObjDispatch(ClientData cd, Tcl_Interp *in, int objc, + Tcl_Obj *CONST objv[], int flags); +XOTCLINLINE static int DoDispatch(ClientData cd, Tcl_Interp *in, int objc, + Tcl_Obj *CONST objv[], int flags); +static int XOTclNextMethod(XOTclObject *obj, Tcl_Interp *in, XOTclClass *givenCl, + char *givenMethod, int objc, Tcl_Obj *CONST objv[], + int useCSObjs); +static int XOTclOEvalMethod(ClientData cd, Tcl_Interp *in, int objc, + Tcl_Obj * CONST objv[]); +static int callDestroyMethod(ClientData cd, Tcl_Interp *in, XOTclObject *obj, int flags); + +static XOTclObject *GetObject(Tcl_Interp *in, char *name); +static XOTclClass *GetClass(Tcl_Interp *in, char *name); +static XOTclCallStackContent* CallStackGetFrame(Tcl_Interp *in); +#if !defined(NDEBUG) +static void checkAllInstances(Tcl_Interp *in, XOTclClass *startCl, int lvl); +#endif + + + + + + +#ifdef PRE81 +/* for backward compatibility only +*/ +static int +Tcl_EvalObjv(Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[], int flags) { + int i, result; + Tcl_DString ds, *dsp = &ds; + + assert(flags == 0); + DSTRING_INIT(dsp); + for (i = 0; i < objc; i++) { + Tcl_DStringAppendElement(dsp, ObjStr(objv[i])); + } + result = Tcl_Eval(in, Tcl_DStringValue(dsp)); + DSTRING_FREE(dsp); + return result; +} +static int +Tcl_IncrObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + int result; + char *argv[3]; + argv[0] = XOTclGlobalStrings[INCR]; + argv[1] = ObjStr(objv[1]); + if (objc == 3) + argv[2] = ObjStr(objv[2]); + result = Tcl_IncrCmd(cd, in, objc, argv); + return result; +} +static int +Tcl_SubstObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + char *ov[20]; + int i; + assert(objc<19); + for (i=0; icmdName; + tov[1] = method; + if (objc>2) + memcpy(tov+2, objv, sizeof(Tcl_Obj *)*(objc-2)); + + result = DoDispatch(cd, in, objc, tov, flags); + /*fprintf(stderr, " callMethod returns %d\n", result);*/ + FREE_TCL_OBJS_ON_STACK(tov); + return result; +} + +int +XOTclCallMethodWithArg(ClientData cd, Tcl_Interp *in, Tcl_Obj *method, Tcl_Obj *arg, + int objc, Tcl_Obj *CONST objv[], int flags) { + XOTclObject *obj = (XOTclObject*) cd; + int result; + DEFINE_NEW_TCL_OBJS_ON_STACK(objc, tov); + + tov[0] = obj->cmdName; + tov[1] = method; + tov[2] = arg; + if (objc>3) + memcpy(tov+3, objv, sizeof(Tcl_Obj *)*(objc-3)); + + result = DoDispatch(cd, in, objc, tov, flags); + + FREE_TCL_OBJS_ON_STACK(tov); + return result; +} + +/* + * realize self, class, proc through the [self] command + */ + +XOTCLINLINE static CONST84 char* +GetSelfProc(Tcl_Interp *in) { + /*return Tcl_GetCommandName(in, RUNTIME_STATE(in)->cs.top->cmdPtr);*/ + return Tcl_GetCommandName(in, CallStackGetFrame(in)->cmdPtr); + +} + +XOTCLINLINE static XOTclClass* +GetSelfClass(Tcl_Interp *in) { + /*return RUNTIME_STATE(in)->cs.top->cl;*/ + return CallStackGetFrame(in)->cl; +} + +XOTCLINLINE static XOTclObject* +GetSelfObj(Tcl_Interp *in) { + return CallStackGetFrame(in)->self; +} + +XOTCLINLINE static Tcl_Command +GetSelfProcCmdPtr(Tcl_Interp *in) { + /*return RUNTIME_STATE(in)->cs.top->cmdPtr;*/ + return CallStackGetFrame(in)->cmdPtr; +} + +/* + * prints a msg to the screen that oldCmd is deprecated + * optinal: give a new cmd + */ +extern void +XOTclDeprecatedMsg(char *oldCmd, char *newCmd) { + fprintf(stderr, "**\n**\n** The command/method <%s> is deprecated.\n", oldCmd); + if (newCmd) + fprintf(stderr, "** Use <%s> instead.\n", newCmd); + fprintf(stderr, "**\n"); +} + +static int +XOTcl_DeprecatedCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + char *new; + if (objc == 2) + new = 0; + else if (objc == 3) + new = ObjStr(objv[2]); + else + return XOTclObjErrArgCnt(in, NULL, "deprecated oldcmd ?newcmd?"); + XOTclDeprecatedMsg(ObjStr(objv[1]), new); + return TCL_OK; +} +#ifdef DISPATCH_TRACE +static void printObjv(int objc, Tcl_Obj *CONST objv[]) { + int i, j; + if (objc <= 3) j = objc; else j = 3; + for (i=0;i 3) fprintf(stderr," ..."); + fprintf(stderr," (objc=%d)",objc); +} + +static void printCall(Tcl_Interp *in, char *string, int objc, Tcl_Obj *CONST objv[]) { + fprintf(stderr, " (%d) >%s: ", Tcl_Interp_numLevels(in), string); + printObjv(objc, objv); + fprintf(stderr, "\n"); +} +static void printExit(Tcl_Interp *in, char *string, + int objc, Tcl_Obj *CONST objv[], int result) { + fprintf(stderr, " (%d) <%s: ", Tcl_Interp_numLevels(in), string); + /*printObjv(objc, objv);*/ + fprintf(stderr, " result=%d\n", result); +} +#endif + + +/* + * XOTclObject Reference Accounting + */ +#if defined(XOTCLOBJ_TRACE) +# define XOTclObjectRefCountIncr(obj) \ + obj->refCount++; \ + fprintf(stderr, "RefCountIncr %p count=%d %s\n", obj, obj->refCount,obj->cmdName?ObjStr(obj->cmdName):"no name"); \ + MEM_COUNT_ALLOC("XOTclObject RefCount",obj) +# define XOTclObjectRefCountDecr(obj) \ + obj->refCount--; \ + fprintf(stderr, "RefCountDecr %p count=%d\n", obj, obj->refCount); \ + MEM_COUNT_FREE("XOTclObject RefCount", obj) +#else +# define XOTclObjectRefCountIncr(obj) \ + obj->refCount++; \ + MEM_COUNT_ALLOC("XOTclObject RefCount",obj) +# define XOTclObjectRefCountDecr(obj) \ + obj->refCount--; \ + MEM_COUNT_FREE("XOTclObject RefCount",obj) +#endif + +#if defined(XOTCLOBJ_TRACE) +void objTrace(char *string, XOTclObject *obj) { + if(obj) + fprintf(stderr,"--- %s tcl %p (%d) xotcl %p (%d) %s \n", string, + obj->cmdName, obj->cmdName->refCount, obj, obj->refCount, ObjStr(obj->cmdName)); + else + fprintf(stderr,"--- No object: %s\n",string); +} +#else +# define objTrace(a,b) +#endif + + +/* search for tail of name */ +static char* +NSTail(char *string) { + register char *p; + for (p=string+strlen(string); p>=string && *p != ':'; p--); + return (p+1); +} + +XOTCLINLINE static int +isClassName(char *string) { + return (strncmp((string), "::xotcl::classes", 16) == 0); +} + +/* removes preceding ::xotcl::classes from a string */ +XOTCLINLINE static char* +NSCutXOTclClasses(char *string) { + assert(strncmp((string), "::xotcl::classes", 16) == 0); + return string+16; +} + +XOTCLINLINE static char* +NSCmdFullName(Tcl_Command cmd) { + Tcl_Namespace *nsPtr = Tcl_Command_nsPtr(cmd); + return nsPtr ? nsPtr->fullName : ""; +} + +static void +XOTclCleanupObject(XOTclObject *obj) { + XOTclObjectRefCountDecr(obj); +#if REFCOUNT_TRACE + fprintf(stderr,"###CLNO %p refcount = %d\n", obj, obj->refCount); +#endif + if (obj->refCount <= 0) { + assert(obj->refCount == 0); + assert(obj->flags & XOTCL_DESTROYED); +#if REFCOUNT_TRACE + fprintf(stderr,"###CLNO %p flags %x rc %d destr %d dc %d\n", + obj, obj->flags, + (obj->flags & XOTCL_REFCOUNTED) != 0, + (obj->flags & XOTCL_DESTROYED) != 0, + (obj->flags & XOTCL_DESTROY_CALLED) != 0 + ); +#endif + + MEM_COUNT_FREE("XOTclObject/XOTclClass",obj); +#if defined(XOTCLOBJ_TRACE) || defined(REFCOUNT_TRACE) + fprintf(stderr, "CKFREE Object %p refcount=%d\n", obj, obj->refCount); +#endif +#if !defined(NDEBUG) + memset(obj, 0, sizeof(XOTclObject)); +#endif + ckfree((char *) obj); + } +} + + + +/* + * Tcl_Obj functions for objects + */ +static void +RegisterObjTypes() { + Tcl_RegisterObjType(&XOTclObjectType); +} + +static void +FreeXOTclObjectInternalRep(register Tcl_Obj *objPtr) { + XOTclObject *obj = (XOTclObject*) objPtr->internalRep.otherValuePtr; + + /* fprintf(stderr,"FIP objPtr %p obj %p obj->cmd %p '%s', bytes='%s'\n", + objPtr,obj, obj->cmdName, ObjStr(obj->cmdName), objPtr->bytes); + */ +#if defined(XOTCLOBJ_TRACE) + if (obj) + fprintf(stderr,"FIP --- tcl %p (%d)\n",objPtr,objPtr->refCount); +#endif + +#if !defined(REFCOUNTED) + if (obj != NULL) { + XOTclCleanupObject(obj); + } +#else + if (obj != NULL) { +#if REFCOUNT_TRACE + fprintf(stderr, "FIP in %p\n", obj->teardown); + fprintf(stderr, "FIP call is destroy %d\n", RUNTIME_STATE(obj->teardown)->callIsDestroy); + fprintf(stderr,"FIP %p flags %x rc %d destr %d dc %d refcount = %d\n", + obj, obj->flags, + (obj->flags & XOTCL_REFCOUNTED) != 0, + (obj->flags & XOTCL_DESTROYED) != 0, + (obj->flags & XOTCL_DESTROY_CALLED) != 0, + obj->refCount + ); +#endif + if (obj->flags & XOTCL_REFCOUNTED && + !(obj->flags & XOTCL_DESTROY_CALLED)) { + Tcl_Interp *in = obj->teardown; + INCR_REF_COUNT(obj->cmdName); + callDestroyMethod((ClientData)obj, in, obj, 0); + /* the call to cleanup is the counterpart of the + INCR_REF_COUNT(obj->cmdName) above */ + XOTclCleanupObject(obj); + } else { + fprintf(stderr, "BEFORE CLEANUPOBJ %x\n", (obj->flags & XOTCL_REFCOUNTED)); + XOTclCleanupObject(obj); + fprintf(stderr, "AFTER CLEANUPOBJ\n"); + } + } +#endif + objPtr->internalRep.otherValuePtr = NULL; + objPtr->typePtr = NULL; +} + +static void +DupXOTclObjectInternalRep(Tcl_Obj *src, Tcl_Obj *cpy) { + XOTclObject *obj = (XOTclObject*)src->internalRep.otherValuePtr; +#if defined(XOTCLOBJ_TRACE) + if (obj) fprintf(stderr,"DIP --- tcl %p (%d)\n", src, src->refCount); +#endif + XOTclObjectRefCountIncr(obj); + cpy->internalRep.otherValuePtr = src->internalRep.otherValuePtr; + cpy->typePtr = src->typePtr; +} + +static int +SetXOTclObjectFromAny(Tcl_Interp *interp, register Tcl_Obj *objPtr) { + Tcl_ObjType *oldTypePtr = objPtr->typePtr; + char *string = ObjStr(objPtr); + XOTclObject *obj; + int result = TCL_OK; + +#ifdef XOTCLOBJ_TRACE + fprintf(stderr,"SetXOTclObjectFromAny %p '%s' %p\n", + objPtr,string,objPtr->typePtr); + if (oldTypePtr) + fprintf(stderr," convert %s to XOTclObject\n", oldTypePtr->name); +#endif + + obj = GetObject(interp, string); + if (obj) { + if ((oldTypePtr != NULL) && (oldTypePtr->freeIntRepProc != NULL)) { +#ifdef XOTCLOBJ_TRACE + fprintf(stderr," freeing type=%p, xottyp=%p\n", + objPtr->typePtr, &XOTclObjectType); +#endif + oldTypePtr->freeIntRepProc(objPtr); + } + XOTclObjectRefCountIncr(obj); +#if defined(XOTCLOBJ_TRACE) + fprintf(stderr, "SetXOTclObjectFromAny tcl %p (%d) xotcl %p (%d)\n", + objPtr, objPtr->refCount, obj, obj->refCount); +#endif + objPtr->internalRep.otherValuePtr = (XOTclObject*) obj; + objPtr->typePtr = &XOTclObjectType; + } else + result = TCL_ERROR; + + return result; +} + +static void +UpdateStringOfXOTclObject(register Tcl_Obj *objPtr) { + XOTclObject *obj = (XOTclObject *)objPtr->internalRep.otherValuePtr; + char *nsFullName = NULL; + register Tcl_Command cmd; + +#ifdef XOTCLOBJ_TRACE + fprintf(stderr,"UpdateStringOfXOTclObject %p refCount %d\n", + objPtr,objPtr->refCount); + fprintf(stderr," teardown %p id %p destroyCalled %d\n", + obj->teardown, obj->id, (obj->flags & XOTCL_DESTROY_CALLED)); +#endif + + /* Here we use GetCommandName, because it doesnt need + Interp*, but Tcl_GetCommandFullName(in,obj->id,ObjName); does*/ + if (obj && !(obj->flags & XOTCL_DESTROY_CALLED)) { + Tcl_DString ds, *dsp = &ds; + unsigned l; + DSTRING_INIT(dsp); + cmd = obj->id; + nsFullName = NSCmdFullName(cmd); + if (!(*nsFullName==':' && *(nsFullName+1)==':' && + *(nsFullName+2)=='\0')) { + Tcl_DStringAppend(dsp, nsFullName, -1); + } + Tcl_DStringAppend(dsp, "::", 2); + Tcl_DStringAppend(dsp, Tcl_GetCommandName(NULL, obj->id), -1); + + l = (unsigned) Tcl_DStringLength(dsp)+1; + objPtr->bytes = (char*) ckalloc(l); + memcpy(objPtr->bytes, Tcl_DStringValue(dsp), l); + objPtr->length = Tcl_DStringLength(dsp); + DSTRING_FREE(dsp); + } else if (obj) { + fprintf(stderr,"try to read string of deleted command\n"); + FreeXOTclObjectInternalRep(objPtr); + objPtr->bytes = NULL; + objPtr->length = 0; + } else { + objPtr->bytes = NULL; + objPtr->length = 0; + } + /* + fprintf(stderr, "+++UpdateStringOfXOTclObject bytes='%s',length=%d\n", + objPtr->bytes,objPtr->length); + */ +} + +#ifdef NOTUSED +static Tcl_Obj * +NewXOTclObjectObj(register XOTclObject *obj) { + register Tcl_Obj *objPtr = 0; + XOTclNewObj(objPtr); + objPtr->bytes = NULL; + objPtr->internalRep.otherValuePtr = obj; + objPtr->typePtr = &XOTclObjectType; +#ifdef XOTCLOBJ_TRACE + fprintf(stderr,"NewXOTclObjectObj %p\n",objPtr); +#endif + return objPtr; +} +#endif + +static Tcl_Obj * +NewXOTclObjectObjName(register XOTclObject *obj, char *name, unsigned l) +{ + register Tcl_Obj *objPtr = 0; + + XOTclNewObj(objPtr); + + objPtr->length = l; + objPtr->bytes = ckalloc(l+1); + memcpy(objPtr->bytes, name, l); + *(objPtr->bytes+l) = 0; + objPtr->internalRep.otherValuePtr = obj; + objPtr->typePtr = &XOTclObjectType; + +#ifdef XOTCLOBJ_TRACE + fprintf(stderr,"NewXOTclObjectObjName tcl %p (%d) xotcl %p (%d) %s\n", + objPtr, objPtr->refCount, obj, obj->refCount, objPtr->bytes); +#endif + XOTclObjectRefCountIncr(obj); + + return objPtr; +} + +static int +GetXOTclObjectFromObj(Tcl_Interp *interp, register Tcl_Obj *objPtr, XOTclObject **obj) +{ + int result; + register Tcl_ObjType *cmdType = objPtr->typePtr; +#ifdef KEEP_TCL_CMD_TYPE + static Tcl_ObjType *tclCmdNameType = NULL; + + if (tclCmdNameType == NULL) { +# if defined(PRE82) + if (cmdType && cmdType != &XOTclObjectType && !strcmp(cmdType->name,"cmdName")) { + tclCmdNameType = cmdType; + } +# else + static XOTclMutex initMutex = 0; + XOTclMutexLock(&initMutex); + if (tclCmdNameType == NULL) + tclCmdNameType = Tcl_GetObjType("cmdName"); + XOTclMutexUnlock(&initMutex); +# endif + } +#endif + + /* + * Only really share the "::x" Tcl_Objs but not "x" because we so not have + * references upon object kills and then will get dangling + * internalRep references to killed XOTclObjects + */ + if (cmdType == &XOTclObjectType) { + if (obj) { + XOTclObject *o = (XOTclObject*) objPtr->internalRep.otherValuePtr; + int refetch = 0; + if (o->flags & XOTCL_DESTROYED) { + /* fprintf(stderr,"????? calling free by hand\n"); */ + FreeXOTclObjectInternalRep(objPtr); + refetch = 1; + result = SetXOTclObjectFromAny(interp, objPtr); + if (result == TCL_OK) { + o = (XOTclObject*) objPtr->internalRep.otherValuePtr; + assert(o && !(o->flags & XOTCL_DESTROYED)); + } + } else { + result = TCL_OK; + } + + *obj = o; + +#ifdef XOTCLOBJ_TRACE + if (result == TCL_OK) + fprintf(stderr,"GetXOTclObjectFromObj tcl %p (%d) xotcl %p (%d) r=%d %s\n", + objPtr, objPtr->refCount, o, o->refCount, refetch, objPtr->bytes); + else + fprintf(stderr,"GetXOTclObjectFromObj tcl %p (%d) **** rc=%d r=%d %s\n", + objPtr, objPtr->refCount, result,refetch, objPtr->bytes); +#endif + } else { + result = TCL_OK; + } +#ifdef KEEP_TCL_CMD_TYPE + } else if (cmdType == tclCmdNameType) { + Tcl_Command cmd = Tcl_GetCommandFromObj(interp, objPtr); + if (cmd) { + XOTclObject *o = XOTclGetObjectFromCmdPtr(cmd); + + /*fprintf(stderr,"Got Object from '%s' %p\n",objPtr->bytes,o); + fprintf(stderr,"cmd->objProc %p == %p, proc=%p\n", + Tcl_Command_objProc(cmd), XOTclObjDispatch, + Tcl_Command_proc(cmd) );*/ + + if (o) { + if (obj) *obj = o; + result = TCL_OK; + } else { + goto convert_to_xotcl_object; + } + } else goto convert_to_xotcl_object; +#endif + } else { +#ifdef KEEP_TCL_CMD_TYPE + convert_to_xotcl_object: +#endif + result = SetXOTclObjectFromAny(interp, objPtr); + if (result == TCL_OK) { + if (obj) *obj = (XOTclObject*) objPtr->internalRep.otherValuePtr; + } + } + return result; +} + +static int +GetXOTclClassFromObj(Tcl_Interp *in, register Tcl_Obj *objPtr, + XOTclClass **cl, int retry) { + XOTclObject *obj; + XOTclClass *cls; + int result = GetXOTclObjectFromObj(in, objPtr, &obj); + if (result == TCL_OK) { + cls = XOTclObjectToClass(obj); + if (cls) { + if (cl) *cl = cls; + } else + result = TCL_ERROR; + } else if (retry) { + Tcl_Obj *ov[3]; + ov[0] = RUNTIME_STATE(in)->theClass->object.cmdName; + ov[1] = XOTclGlobalObjects[__UNKNOWN]; + ov[2] = objPtr; + INCR_REF_COUNT(objPtr); + /* fprintf(stderr,"+++ calling __unknown for %s\n", ObjStr(objPtr));*/ + result = Tcl_EvalObjv(in, 3, ov, 0); + if (result == TCL_OK) { + result = GetXOTclClassFromObj(in, objPtr, cl, 0); + } + DECR_REF_COUNT(objPtr); + } + return result; +} + +/* + * precedence ordering functions + */ + +enum colors { WHITE, GRAY, BLACK }; + +static int +TopoSort(XOTclClass *cl, XOTclClass *base, XOTclClasses* (*next)(XOTclClass*)) { + XOTclClasses* sl = (*next)(cl); + XOTclClasses* pl; + + /* + * careful to reset the color of unreported classes to + * white in case we unwind with error, and on final exit + * reset color of reported classes to white + */ + + cl->color = GRAY; + for (; sl != 0; sl = sl->next) { + XOTclClass *sc = sl->cl; + if (sc->color == GRAY) { cl->color = WHITE; return 0; } + if (sc->color == WHITE && !TopoSort(sc, base, next)) { + cl->color = WHITE; + if (cl == base) { + XOTclClasses* pc = cl->order; + while (pc != 0) { pc->cl->color = WHITE; pc = pc->next; } + } + return 0; + } + } + cl->color = BLACK; + pl = NEW(XOTclClasses); + pl->cl = cl; + pl->next = base->order; + base->order = pl; + if (cl == base) { + XOTclClasses* pc = cl->order; + while (pc != 0) { pc->cl->color = WHITE; pc = pc->next; } + } + return 1; +} + +extern void +XOTclFreeClasses(XOTclClasses* sl) { + XOTclClasses *n; + for (; sl; sl = n) { + n = sl->next; + FREE(XOTclClasses,sl); + } +} + +extern XOTclClasses** +XOTclAddClass(XOTclClasses **cList, XOTclClass *cl, ClientData cd) { + XOTclClasses *l = *cList, *element = NEW(XOTclClasses); + element->cl = cl; + element->clientData = cd; + element->next = NULL; + if (l) { + while (l->next) l = l->next; + l->next = element; + } else + *cList = element; + return &(element->next); +} + +static XOTclClasses* Super(XOTclClass *cl) { return cl->super; } +static XOTclClasses* Sub(XOTclClass *cl) { return cl->sub; } + +static XOTclClasses* +TopoOrder(XOTclClass *cl, XOTclClasses* (*next)(XOTclClass*)) { + if (TopoSort(cl, cl, next)) + return cl->order; + XOTclFreeClasses(cl->order); + cl->order = 0; + return 0; +} + +XOTCLINLINE static XOTclClasses* +ComputeOrder(register XOTclClass *cl, XOTclClasses* (*direction)(XOTclClass*)) { + if (!cl->order) + cl->order = TopoOrder(cl, direction); + return cl->order; +} + +extern XOTclClasses* +XOTclComputePrecedence(XOTclClass *cl) { + return ComputeOrder(cl, Super); +} + +extern XOTclClasses* +XOTclComputeDependents(XOTclClass *cl) { + return ComputeOrder(cl, Sub); +} + + +static void +FlushPrecedences(XOTclClass *cl) { + XOTclClasses* pc; + XOTclFreeClasses(cl->order); + cl->order = 0; + pc = ComputeOrder(cl, Sub); + + /* + * ordering doesn't matter here - we're just using toposort + * to find all lower classes so we can flush their caches + */ + + if (pc) pc = pc->next; + for (; pc; pc = pc->next) { + XOTclFreeClasses(pc->cl->order); + pc->cl->order = 0; + } + XOTclFreeClasses(cl->order); + cl->order = 0; +} + +static void +AddInstance(XOTclObject *obj, XOTclClass *cl) { + obj->cl = cl; + if (cl != 0) { + int nw; + (void) Tcl_CreateHashEntry(&cl->instances, (char*)obj, &nw); + } +} + +static int +RemoveInstance(XOTclObject *obj, XOTclClass *cl) { + if (cl) { + Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&cl->instances, (char*)obj); + if (hPtr) { + Tcl_DeleteHashEntry(hPtr); + return 1; + } + } + return 0; +} + +/* + * superclass/subclass list maintenance + */ + +static void +AS(XOTclClass *cl, XOTclClass *s, XOTclClasses **sl) { + register XOTclClasses* l = *sl; + while (l && l->cl != s) l = l->next; + if (!l) { + XOTclClasses* sc = NEW(XOTclClasses); + sc->cl = s; + sc->next = *sl; + *sl = sc; + } +} + +static void +AddSuper(XOTclClass *cl, XOTclClass *super) { + if (cl && super) { + /* + * keep corresponding sub in step with super + */ + AS(cl, super, &cl->super); + AS(super, cl, &super->sub); + } +} + +static int +RemoveSuper1(XOTclClass *cl, XOTclClass *s, XOTclClasses **sl) { + XOTclClasses* l = *sl; + if (!l) return 0; + if (l->cl == s) { + *sl = l->next; + FREE(XOTclClasses,l); + return 1; + } + while (l->next && l->next->cl != s) l = l->next; + if (l->next) { + XOTclClasses* n = l->next->next; + FREE(XOTclClasses,l->next); + l->next = n; + return 1; + } + return 0; +} + +static int +RemoveSuper(XOTclClass *cl, XOTclClass *super) { + /* + * keep corresponding sub in step with super + */ + int sp = RemoveSuper1(cl, super, &cl->super); + int sb = RemoveSuper1(super, cl, &super->sub); + + return sp && sb; +} + +/* + * internal type checking + */ + +extern XOTcl_Class* +XOTclIsClass(Tcl_Interp *in, ClientData cd) { + XOTclObject *obj = (XOTclObject*)cd; + if (obj && XOTclObjectIsClass(obj)) + return (XOTcl_Class*) cd; + return 0; +} + +/* + * methods lookup + */ + +XOTCLINLINE static Tcl_Command +FindMethod (char *methodName, Tcl_HashTable *cmdTable) { + Tcl_HashEntry* entryPtr; + Tcl_Command cmd; + + assert(cmdTable); + if ((entryPtr = Tcl_FindHashEntry(cmdTable, methodName))) { + cmd = (Tcl_Command) Tcl_GetHashValue(entryPtr); + } else { + cmd = NULL; + } + return cmd; +} + +XOTCLINLINE static XOTclClass* +SearchPLMethod(register XOTclClasses* pl, char *nm, Tcl_Command *cmd) { + /* Search the class hierarchy */ + for (; pl; pl = pl->next) { + Tcl_Command pi = FindMethod(nm, Tcl_Namespace_cmdTable(pl->cl->nsPtr)); + if (pi) { + *cmd = pi; + return pl->cl; + } + } + return NULL; +} + + +static XOTclClass* +SearchCMethod(XOTclClass *cl, char *nm, Tcl_Command *cmd) { + assert(cl); + return SearchPLMethod(ComputeOrder(cl, Super), nm, cmd); +} + +static int +callDestroyMethod(ClientData cd, Tcl_Interp *in, XOTclObject *obj, int flags) { + int result; + + /* don't call destroy after exit handler started physical + destruction */ + if (RUNTIME_STATE(in)->exitHandlerDestroyRound == + XOTCL_EXITHANDLER_ON_PHYSICAL_DESTROY) + return TCL_OK; + + /* we don't call destroy, if we're in the exit handler + during destruction of Object and Class */ + if (!RUNTIME_STATE(in)->callDestroy) { + obj->flags |= XOTCL_DESTROY_CALLED; + + /* return TCL_ERROR so that clients know we haven't deleted the + associated command yet */ + return TCL_ERROR; + } + /*fprintf(stderr, "+++ calldestroy flags=%d\n",flags);*/ + if (obj->flags & XOTCL_DESTROY_CALLED) + return TCL_OK; + +#if !defined(NDEBUG) + {char *cmdName = ObjStr(obj->cmdName); + assert(cmdName != NULL); + assert(Tcl_FindCommand(in, cmdName, NULL, 0) != NULL); + } +#endif + + +#ifdef OBJDELETION_TRACE + fprintf(stderr, " command found\n"); + PRINTOBJ("callDestroy", obj); +#endif + result = callMethod(cd, in, XOTclGlobalObjects[DESTROY], 2, 0, flags); + if (result != TCL_OK) { + static char cmd[] = + "puts stderr \"[self]: Error in instproc destroy\n\ + $::errorCode $::errorInfo\""; + Tcl_Eval(in, cmd); + if (++RUNTIME_STATE(in)->errorCount > 20) + panic("too many destroy errors occured. Endless loop?", NULL); + } else { + if (RUNTIME_STATE(in)->errorCount > 0) + RUNTIME_STATE(in)->errorCount--; + } + +#ifdef OBJDELETION_TRACE + fprintf(stderr, "callDestroyMethod for %p exit\n", obj); +#endif + return result; +} + +/* + * conditional memory allocations of optional storage + */ + +extern XOTclObjectOpt * +XOTclRequireObjectOpt(XOTclObject *obj) { + if (!obj->opt) { + obj->opt = NEW(XOTclObjectOpt); + memset(obj->opt, 0, sizeof(XOTclObjectOpt)); + } + return obj->opt; +} + +extern XOTclClassOpt* +XOTclRequireClassOpt(XOTclClass *cl) { + assert(cl); + if (!cl->opt) { + cl->opt = NEW(XOTclClassOpt); + memset(cl->opt, 0, sizeof(XOTclClassOpt)); + } + return cl->opt; +} + +#define freeObjectOpt(obj) \ + if (obj->opt) {\ + FREE(XOTclObjectOpt,obj->opt); \ + obj->opt = 0; } + +#define freeClassOpt(cl) \ + if (cl->opt) { \ + FREE(XOTclClassOpt, cl->opt); \ + cl->opt = 0; } + + +static Tcl_Namespace* +NSGetFreshNamespace(Tcl_Interp *in, ClientData cd, char *name); + +static void +makeObjNamespace(Tcl_Interp *in, XOTclObject *obj) { +#ifdef NAMESPACE_TRACE + fprintf(stderr, "+++ Make Namespace for %s\n", ObjStr(obj->cmdName)); +#endif + if (!obj->nsPtr) { + Tcl_Namespace* nsPtr; + char *cmdName = ObjStr(obj->cmdName); + obj->nsPtr = NSGetFreshNamespace(in, (ClientData)obj, cmdName); + if (!obj->nsPtr) + panic("makeObjNamespace: Unable to make namespace",0); + nsPtr = obj->nsPtr; + + /* + * Copy all obj variables to the newly created namespace + */ + if (obj->varTable) { + Tcl_HashSearch search; + Tcl_HashEntry *hPtr, *newHPtr; + register Var *varPtr; + + for (hPtr = Tcl_FirstHashEntry(obj->varTable, &search); hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search)) { + int new = 0; + char *name = Tcl_GetHashKey(obj->varTable, hPtr); + Tcl_HashTable *varTable = Tcl_Namespace_varTable(nsPtr); + + varPtr = (Var *) Tcl_GetHashValue(hPtr); + + if (!name) { + panic("Can't copy: Hash Entry with no name", NULL); + continue; + } + + newHPtr = Tcl_CreateHashEntry(varTable, name, &new); + if (new) { + /* + * put var into new hashtable entry + */ + varPtr->flags |= VAR_IN_HASHTABLE; + Tcl_SetHashValue(newHPtr, varPtr); + varPtr->hPtr = newHPtr; + /* + * Mark the variable as a namespace variable + + if (!(varPtr->flags & VAR_NAMESPACE_VAR)) { + varPtr->flags |= VAR_NAMESPACE_VAR; + varPtr->refCount++; + } + */ + /* + * and correct the namespace information + */ + varPtr->nsPtr = (Namespace *)nsPtr; + } else { + panic("Can't copy varTable variable to new namespace", NULL); + } + } + /* + MEM_COUNT_FREE("obj->varTable",obj->varTable); + */ + Tcl_DeleteHashTable(obj->varTable); + ckfree((char *) obj->varTable); + obj->varTable = 0; + } + } +} + +#define requireObjNamespace(in,obj) \ + if (!obj->nsPtr) makeObjNamespace(in,obj) + +extern void +XOTclRequireObjNamespace(Tcl_Interp *in, XOTcl_Object *obji) { + XOTclObject *obj = (XOTclObject*) obji; + requireObjNamespace(in, obj); +} + + +/* + * Namespace related commands + */ + +static int +NSDeleteCmd(Tcl_Interp *in, Tcl_Namespace* ns, char *name) { + /* a simple deletion would delete a global command with + the same name, if the command is not existing, so + we use the CmdToken */ + Tcl_Command token; + assert(ns); + if ((token = FindMethod(name, Tcl_Namespace_cmdTable(ns)))) { + return Tcl_DeleteCommandFromToken(in, token); + } + return 0; +} + +static void +CallStackDestroyObject(Tcl_Interp *in, XOTclObject *obj); +static void +PrimitiveCDestroy(ClientData cd); +static void +PrimitiveODestroy(ClientData cd); + +static void +NSDeleteChildren(Tcl_Interp *in, Tcl_Namespace* ns) { + /*Tcl_HashTable *childTable = Tcl_Namespace_childTable(ns);*/ + Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(ns); + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr = Tcl_FirstHashEntry(cmdTable, &hSrch); + +#ifdef OBJDELETION_TRACE + fprintf(stderr, "NSDeleteChildren %s\n", ns->fullName); +#endif + for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { + Tcl_Command cmd = (Tcl_Command)Tcl_GetHashValue(hPtr); + if (!Tcl_Command_cmdEpoch(cmd)) { + char *oname = Tcl_GetHashKey(cmdTable, hPtr); + Tcl_DString name; + XOTclObject *obj; + /* fprintf(stderr, " ... child %s\n", oname); + */ + ALLOC_NAME_NS(&name, ns->fullName, oname); + obj = GetObject(in, Tcl_DStringValue(&name)); + + if (obj) { + /* + fprintf(stderr, " ... obj= %s\n", ObjStr(obj->cmdName)); + */ + /* in the exit handler physical destroy --> directly call destroy */ + if (RUNTIME_STATE(in)->exitHandlerDestroyRound + == XOTCL_EXITHANDLER_ON_PHYSICAL_DESTROY) { + if (XOTclObjectIsClass(obj)) + PrimitiveCDestroy((ClientData) obj); + else + PrimitiveODestroy((ClientData) obj); + } else { + if (obj->teardown != 0 && obj->id && + !(obj->flags & XOTCL_DESTROY_CALLED)) { + /* Tcl_Command oid = obj->id;*/ + if (callDestroyMethod((ClientData)obj, in, obj, 0) != TCL_OK) { + /* destroy method failed, but we have to remove the command + anyway. */ + obj->flags |= XOTCL_DESTROY_CALLED; + + if (obj->teardown) { + CallStackDestroyObject(in, obj); + } + /*(void*) Tcl_DeleteCommandFromToken(in, oid);*/ + } + } + } + } + DSTRING_FREE(&name); + } + } +} + +/* + * ensure that a variable exists on object varTable or nsPtr->varTable, + * if necessary create it. Return Var* if successful, otherwise 0 + */ +static Var* +NSRequireVariableOnObj(Tcl_Interp *in, XOTclObject *obj, char *name, int flgs) { + XOTcl_FrameDecls; + Var *varPtr, *arrayPtr; + + XOTcl_PushFrame(in, obj); + varPtr = TclLookupVar(in, name, 0, flgs, "obj vwait", + /*createPart1*/ 1, /*createPart2*/ 0, &arrayPtr); + XOTcl_PopFrame(in, obj); + return varPtr; +} + +/* delete a namespace recursively, but check whether the + namespace is an object or not */ +static void +NSDeleteNamespace(Tcl_Interp *in, Tcl_Namespace* ns) { + Tcl_HashTable *childTable = Tcl_Namespace_childTable(ns); + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr; + + NSDeleteChildren(in, ns); + for (hPtr = Tcl_FirstHashEntry(childTable, &hSrch); hPtr != 0; + hPtr = Tcl_NextHashEntry(&hSrch)) { + Tcl_Namespace *child = ((Tcl_Namespace*)Tcl_GetHashValue(hPtr)); + NSDeleteNamespace(in, child); + } + /* + fprintf(stderr, "NSDeleteNamespace deleting %s\n", ns->fullName); + */ + MEM_COUNT_FREE("TclNamespace",ns); + Tcl_DeleteNamespace(ns); +} + +static int +XOTcl_DeleteCommandFromToken(Tcl_Interp *in, Tcl_Command cmd) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStackContent *csc = cs->top; + + for (; csc > cs->content; csc--) { + if (csc->cmdPtr == cmd) + csc->cmdPtr = NULL; + break; + } + return Tcl_DeleteCommandFromToken(in, cmd); +} + +/* + * delete all vars & procs in a namespace + */ +static void +NSCleanupNamespace(Tcl_Interp *in, Tcl_Namespace* ns) { + Tcl_HashTable *varTable = Tcl_Namespace_varTable(ns); + Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(ns); + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr; + Tcl_Command cmd; + /* + * Delete all variables and initialize var table again + * (deletevars frees the vartable) + */ + TclDeleteVars((Interp *)in, varTable); + Tcl_InitHashTable(varTable, TCL_STRING_KEYS); + + /* + * Delete all user-defined procs in the namespace + */ + for (hPtr = Tcl_FirstHashEntry(cmdTable, &hSrch); hPtr != 0; + hPtr = Tcl_NextHashEntry(&hSrch)) { + cmd = (Tcl_Command) Tcl_GetHashValue(hPtr); + /* objects should not be deleted here to preseve children deletion order*/ + if (!XOTclGetObjectFromCmdPtr(cmd)) { + XOTcl_DeleteCommandFromToken(in, cmd); + } + } +} + + +static void +NSNamespaceDeleteProc(ClientData clientData) { + /* dummy for ns identification by pointer comparison */ +} + +void +XOTcl_DeleteNamespace(Tcl_Interp *in, Tcl_Namespace *nsPtr) { + int activationCount = 0; + Tcl_CallFrame *f = (Tcl_CallFrame *)Tcl_Interp_framePtr(in); + + /* + fprintf(stderr, " ... correcting ActivationCount for %s was %d ", + nsPtr->fullName, nsp->activationCount); + */ + while (f) { + if (f->nsPtr == nsPtr) + activationCount++; + f = Tcl_CallFrame_callerPtr(f); + } + + Tcl_Namespace_activationCount(nsPtr) = activationCount; + /* + fprintf(stderr, "to %d. \n", nsp->activationCount); + */ + MEM_COUNT_FREE("TclNamespace",nsPtr); + Tcl_DeleteNamespace(nsPtr); +} + +static Tcl_Namespace* +NSGetFreshNamespace(Tcl_Interp *in, ClientData cd, char *name) { + Tcl_Namespace *ns = Tcl_FindNamespace(in, name, NULL, 0); + + if (ns) { + if (ns->deleteProc != NULL || ns->clientData != NULL) { + panic("Namespace '%s' exists already with delProc %p and clientData %p; Can only convert a plain Tcl namespace into an XOTcl namespace", + name, ns->deleteProc, ns->clientData); + } + ns->clientData = cd; + ns->deleteProc = (Tcl_NamespaceDeleteProc*) NSNamespaceDeleteProc; + } else { + ns = Tcl_CreateNamespace(in, name, cd, + (Tcl_NamespaceDeleteProc*) NSNamespaceDeleteProc); + } + MEM_COUNT_ALLOC("TclNamespace",ns); + return ns; +} + + +/* + * check colons for illegal object/class names + */ +XOTCLINLINE static int +NSCheckColons(char *name, unsigned l) { + register char *n = name; + if (*n == '\0') return 0; /* empty name */ + if (*(n+l-1) == ':') return 0; /* name ends with : */ + if (*n == ':' && *(n+1) != ':') return 0; /* name begins with single : */ + for (; *n != '\0'; n++) { + if (*n == ':' && *(n+1) == ':' && *(n+2) == ':') + return 0; /* more than 2 colons in series in a name */ + } + return 1; +} + +/* + * check for parent namespace existance (used before commands are created) + */ + +XOTCLINLINE static int +NSCheckForParent(Tcl_Interp *in, char *name, unsigned l) { + register char *n = name+l; + int result = 1; + + /*search for last '::'*/ + while ((*n != ':' || *(n-1) != ':') && n-1 > name) {n--; } + if (*n == ':' && n > name && *(n-1) == ':') {n--;} + + if ((n-name)>0) { + Tcl_DString parentNSName, *dsp = &parentNSName; + char *parentName; + DSTRING_INIT(dsp); + + Tcl_DStringAppend(dsp, name, (n-name)); + parentName = Tcl_DStringValue(dsp); + + if (Tcl_FindNamespace(in, parentName, (Tcl_Namespace *) NULL, TCL_GLOBAL_ONLY) == 0) { + XOTclObject *parentObj = (XOTclObject*) GetObject(in, parentName); + if (parentObj) { + requireObjNamespace(in, parentObj); + } else { + result = 0; + } + } + DSTRING_FREE(dsp); + } + return result; +} + +/* + * Find the "real" command belonging eg. to an XOTcl class or object. + * Do not return cmds produced by Tcl_Import, but the "real" cmd + * to which they point. + */ +XOTCLINLINE static Tcl_Command +NSFindCommand(Tcl_Interp *in, char *name) { + Tcl_Command cmd; + if ((cmd = Tcl_FindCommand(in, name, NULL, 0))) { + Tcl_Command importedCmd; + if ((importedCmd = TclGetOriginalCommand(cmd))) + cmd = importedCmd; + } + return cmd; +} + + + +/* + * C interface routines for manipulating objects and classes + */ + + + +extern XOTcl_Object* +XOTclGetObject(Tcl_Interp *in, char *name) { + return (XOTcl_Object*) GetObject(in, name); +} + +/* + * Find an object using a char *name + */ +static XOTclObject* +GetObject(Tcl_Interp *in, char *name) { + register Tcl_Command cmd; + assert(name); + cmd = NSFindCommand(in, name); + if (cmd && Tcl_Command_objProc(cmd) == XOTclObjDispatch) { + return (XOTclObject*)Tcl_Command_objClientData(cmd); + } + return 0; +} + +/* + * Find a class using a char *name + */ + +extern XOTcl_Class* +XOTclGetClass(Tcl_Interp *in, char *name) { + return (XOTcl_Class*)GetClass(in, name); +} + +static XOTclClass* +GetClass(Tcl_Interp *in, char *name) { + XOTclObject *obj = GetObject(in, name); + return (obj && XOTclObjectIsClass(obj)) ? (XOTclClass*)obj : NULL; +} + +static XOTclClass* +GetClassFromFullName(Tcl_Interp *in, char *fullName) { + XOTclClass *cl; + if (isClassName(fullName)) { + cl = GetClass(in, NSCutXOTclClasses(fullName)); + } else { + cl = NULL; + } + return cl; +} + + +void +XOTclAddPMethod(Tcl_Interp *in, XOTcl_Object *obji, char *nm, Tcl_ObjCmdProc* proc, + ClientData cd, Tcl_CmdDeleteProc* dp) { + XOTclObject *obj = (XOTclObject*) obji; + Tcl_DString newCmd, *cptr = &newCmd; + requireObjNamespace(in, obj); + ALLOC_NAME_NS(cptr, obj->nsPtr->fullName, nm); + Tcl_CreateObjCommand(in, Tcl_DStringValue(cptr), proc, cd, dp); + DSTRING_FREE(cptr); +} + +void +XOTclAddIMethod(Tcl_Interp *in, XOTcl_Class *cli, char *nm, + Tcl_ObjCmdProc* proc, ClientData cd, Tcl_CmdDeleteProc* dp) { + XOTclClass *cl = (XOTclClass*) cli; + Tcl_DString newCmd, *cptr = &newCmd; + ALLOC_NAME_NS(cptr, cl->nsPtr->fullName, nm); + Tcl_CreateObjCommand(in, Tcl_DStringValue(cptr), proc, cd, dp); + DSTRING_FREE(cptr); +} + + +/* + * Generic Tcl_Obj List + */ + +static void +TclObjListFreeList(XOTclTclObjList* list) { + XOTclTclObjList* del; + while (list) { + del = list; + list = list->next; + DECR_REF_COUNT(del->content); + FREE(XOTclTclObjList, del); + } +} + +static Tcl_Obj* +TclObjListNewElement(XOTclTclObjList **list, Tcl_Obj *ov) { + XOTclTclObjList* elt = NEW(XOTclTclObjList); + INCR_REF_COUNT(ov); + elt->content = ov; + elt->next = *list; + *list = elt; + return ov; +} + +/* + * Autonaming + */ + +static Tcl_Obj* +AutonameIncr(Tcl_Interp *in, Tcl_Obj *name, XOTclObject *obj, + int instanceOpt, int resetOpt) { + int valueLength, mustCopy = 1, format = 0; + char *valueString, *c; + Tcl_Obj *valueObject, *result = NULL, *savedResult = NULL; + XOTcl_FrameDecls; + int flgs = TCL_LEAVE_ERR_MSG; + + XOTcl_PushFrame(in, obj); + if (obj->nsPtr) + flgs |= TCL_NAMESPACE_ONLY; + +#ifndef PRE83 + valueObject = TclIncrVar2(in, XOTclGlobalObjects[AUTONAMES], name, 1, flgs); +#else + valueObject = TclIncrVar2(in, XOTclGlobalObjects[AUTONAMES], name, 1, 0); +#endif + + if (resetOpt) { + if (valueObject != NULL) { /* we have an entry */ + Tcl_UnsetVar2(in, XOTclGlobalStrings[AUTONAMES], ObjStr(name), flgs); + } + result = XOTclGlobalObjects[EMPTY]; + INCR_REF_COUNT(result); + } else { + if (valueObject == NULL) { + valueObject = Tcl_ObjSetVar2(in, XOTclGlobalObjects[AUTONAMES], + name, XOTclGlobalObjects[ZERO], flgs); + } + if (instanceOpt) { + char buffer[1], firstChar, *nextChars; + nextChars = ObjStr(name); + firstChar = *(nextChars ++); + if (isupper((int)firstChar)) { + buffer[0] = tolower((int)firstChar); + result = Tcl_NewStringObj(buffer,1); + INCR_REF_COUNT(result); + Tcl_AppendToObj(result, nextChars, -1); + mustCopy = 0; + } + } + if (mustCopy) { + result = Tcl_DuplicateObj(name); + INCR_REF_COUNT(result); + /* + fprintf(stderr,"*** copy %p %s = %p\n", name,ObjStr(name),result); + */ + } + valueString = Tcl_GetStringFromObj(valueObject,&valueLength); + + /* if we find a % in the autoname -> We use Tcl_FormatObjCmd + to let the autoname string be formated, like Tcl "format" + command, with the value. E.g.: + autoname a%06d --> a000000, a000001, a000002, ... + */ + for (c = ObjStr(result); *c != '\0'; c++) { + if (*c == '%') { + if (*(c+1) != '%') { + format = 1; + break; + } else { + /* when we find a %% we format and then append autoname, e.g. + autoname a%% --> a%1, a%2, ... */ + c++; + } + } + } + if (format) { + DEFINE_NEW_TCL_OBJS_ON_STACK(3, ov); + savedResult = Tcl_GetObjResult(in); + INCR_REF_COUNT(savedResult); + ov[0] = XOTclGlobalObjects[FORMAT]; + ov[1] = result; + ov[2] = valueObject; + if (Tcl_EvalObjv(in, 3, ov, 0) != TCL_OK) { + XOTcl_PopFrame(in, obj); + DECR_REF_COUNT(savedResult); + FREE_TCL_OBJS_ON_STACK(ov); + return 0; + } + DECR_REF_COUNT(result); + result = Tcl_DuplicateObj(Tcl_GetObjResult(in)); + INCR_REF_COUNT(result); + Tcl_SetObjResult(in, savedResult); + DECR_REF_COUNT(savedResult); + FREE_TCL_OBJS_ON_STACK(ov); + } else { + /* append the value string, if not + formated or if only %% occurs */ + /*fprintf(stderr,"+++ append to obj %p %s : %s\n", + result,ObjStr(result), valueString);*/ + Tcl_AppendToObj(result, valueString, valueLength); + /*fprintf(stderr,"+++ append to obj done\n");*/ + } + } + + XOTcl_PopFrame(in, obj); + assert((resetOpt && result->refCount>=1) || (result->refCount == 1)); + return result; +} + +/* + * XOTcl CallStack + */ + +XOTclCallStackContent * +XOTclCallStackFindLastInvocation(Tcl_Interp *in, int offset) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + register XOTclCallStackContent *csc = CallStackGetFrame(in); + + /* skip through toplevel inactive filters, do this offset times */ + for (csc=cs->top; csc > cs->content; csc--) { + if (csc->callsNext || (csc->frameType & XOTCL_CSC_INACTIVE_FLAG)) + continue; + if (offset) + offset--; + else + return csc; + } + /* for some reasons, we could not find invocation (topLevel, destroy) */ + return NULL; +} + +static XOTclCallStackContent * +CallStackFindActiveFilter(Tcl_Interp *in) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + register XOTclCallStackContent *csc; + + /* search for first active frame and set tcl frame pointers */ + for (csc=cs->top; csc > cs->content; csc --) { + if (csc->frameType & XOTCL_CSC_INACTIVE_FLAG) continue; + if (csc->frameType & XOTCL_CSC_TYPE_FILTER) return csc; + } + /* for some reasons, we could not find invocation (topLevel, destroy) */ + return NULL; +} + +XOTclCallStackContent * +XOTclCallStackFindActiveFrame(Tcl_Interp *in, int offset) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + register XOTclCallStackContent *csc; + + /* search for first active frame and set tcl frame pointers */ + for (csc=cs->top-offset; csc > cs->content; csc --) { + if (!(csc->frameType & XOTCL_CSC_INACTIVE_FLAG)) { + /* we found the highest active frame */ + return csc; + } + } + /* we could not find an active frame; called from toplevel? */ + return NULL; +} + +static void +CallStackUseActiveFrames(Tcl_Interp *in, callFrameContext *ctx) { + XOTclCallStackContent *active, *top = RUNTIME_STATE(in)->cs.top; + Tcl_CallFrame *inFramePtr = Tcl_Interp_varFramePtr(in); + + active = XOTclCallStackFindActiveFrame(in, 0); + /*fprintf(stderr,"active %p, varFrame(in) %p, topVarFrame %p, active->curr %p\n", + active, inFramePtr, top->currentFramePtr, + active? active->currentFramePtr : NULL);*/ + + if (active == top || inFramePtr == NULL) { + /* top frame is a active frame, or we could not find a calling + frame, call frame pointers are fine */ + ctx->framesSaved = 0; + } else if (active == NULL) { + Tcl_CallFrame *cf = inFramePtr; + /* fprintf(stderr,"active == NULL\n"); */ + /* find a proc frame, which is not equal the top level cmd */ + for (; cf; cf = Tcl_CallFrame_callerPtr(cf)) { + if (Tcl_CallFrame_isProcCallFrame(cf)) { + Proc *procPtr = Tcl_CallFrame_procPtr(cf); + /* fprintf(stderr, " procPtr=%p cmdPtr=%p '%s' top->cmdPtr %p\n", + procPtr,procPtr->cmdPtr, + (char*) Tcl_GetCommandName(in, top->cmdPtr), top->cmdPtr);*/ + if (procPtr && (Tcl_Command)procPtr->cmdPtr != top->cmdPtr) { + break; + } + } + } + ctx->varFramePtr = inFramePtr; + Tcl_Interp_varFramePtr(in) = cf; + ctx->framesSaved = 1; + } else { + Tcl_CallFrame *framePtr; + /*fprintf(stderr,"active == deeper active=%p frame %p, active+1 %p frame %p\n", + active, active->currentFramePtr, + active+1, (active+1)->currentFramePtr);*/ + /* search returned a deeper pointer, use stored tcl frame pointers; + If Tcl is mixed with XOTcl it is needed to use instead of + active->currentFrame the callerPtr of the last inactive frame + unless the last inactive is NULL */ + if ((framePtr = (active+1)->currentFramePtr)) + framePtr = Tcl_CallFrame_callerPtr(framePtr); + else + framePtr = active->currentFramePtr; + ctx->varFramePtr = inFramePtr; + Tcl_Interp_varFramePtr(in) = framePtr; + ctx->framesSaved = 1; + } +} + +static void +CallStackRestoreSavedFrames(Tcl_Interp *in, callFrameContext *ctx) { + if (ctx->framesSaved) { + Tcl_Interp_varFramePtr(in) = ctx->varFramePtr; + /*RUNTIME_STATE(in)->varFramePtr = ctx->varFramePtr;*/ + + } +} + + +XOTCLINLINE static int +CallStackPush(Tcl_Interp *in, XOTclObject *obj, XOTclClass *cl, + Tcl_Command cmd, int objc, Tcl_Obj *CONST objv[], int frameType) { + XOTclCallStack *cs; + register XOTclCallStackContent *csc; + + cs = &RUNTIME_STATE(in)->cs; + if (cs->top >= &cs->content[MAX_NESTING_DEPTH-1]) { + Tcl_SetResult(in, "too many nested calls to Tcl_EvalObj (infinite loop?)", + TCL_STATIC); + return TCL_ERROR; + } + /* + fprintf(stderr, "PUSH obj %s proc %s, self=%p cmd=%p (%s) id=%p (%s)\n", + ObjStr(obj->cmdName), procName, obj, + cmd, (char*) Tcl_GetCommandName(in, cmd), + obj->id, Tcl_GetCommandName(in, obj->id)); + */ + csc = ++cs->top; + csc->self = obj; + csc->cl = cl; + csc->cmdPtr = cmd; + csc->destroyedCmd = 0; + csc->frameType = frameType; + csc->callsNext = 0; + csc->currentFramePtr = NULL; /* this will be set by InitProcNSCmd */ + + if (frameType == XOTCL_CSC_TYPE_ACTIVE_FILTER) + csc->filterStackEntry = obj->filterStack; + else + csc->filterStackEntry = 0; + + MEM_COUNT_ALLOC("CallStack",NULL); + return TCL_OK; +} + +XOTCLINLINE static void +CallStackDoDestroy(Tcl_Interp *in, XOTclObject *obj) { + Tcl_Command oid; + + PRINTOBJ("CallStackDoDestroy", obj); + oid = obj->id; + obj->id = 0; + if (obj->teardown && oid) { + Tcl_DeleteCommandFromToken(in, oid); + } +} + + +static void +CallStackDestroyObject(Tcl_Interp *in, XOTclObject *obj) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStackContent *csc; + int countSelfs = 0; + Tcl_Command oid = obj->id; + + for (csc = &cs->content[1]; csc <= cs->top; csc++) { + if (csc->self == obj) { + csc->destroyedCmd = oid; + if (csc->destroyedCmd) { + Tcl_Command_refCount(csc->destroyedCmd)++; + MEM_COUNT_ALLOC("command refCount",csc->destroyedCmd); + } + countSelfs++; + } + } + /* if the object is not referenced at the callstack anymore + we have to directly destroy it, because CallStackPop won't + find the object destroy */ + if (countSelfs == 0) { + CallStackDoDestroy(in, obj); + } else + /* to prevail the deletion order call delete children now + -> children destructors are called before parent's + destructor */ + if (obj->teardown && obj->nsPtr) { + NSDeleteChildren(in, obj->nsPtr); + } +} + +XOTCLINLINE static int +CallStackIsDestroyed(Tcl_Interp *in) { + return (RUNTIME_STATE(in)->cs.top->destroyedCmd == NULL) ? 0 : 1; +} + +XOTCLINLINE static void +CallStackPop(Tcl_Interp *in) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStackContent *csc; + XOTclCallStackContent *h = cs->top; + + assert(cs->top > cs->content); + csc = cs->top; + if (csc->destroyedCmd != 0) { + int destroy = 1; + TclCleanupCommand((Command *)csc->destroyedCmd); + MEM_COUNT_FREE("command refCount", csc->destroyedCmd); + /* do not physically destroy, when callstack still contains "self" + entries of the object */ + while (--h > cs->content) { + if (h->self == csc->self) { + destroy = 0; + break; + } + } + if (destroy) { + CallStackDoDestroy(in, csc->self); + } + } + + cs->top--; + MEM_COUNT_FREE("CallStack",NULL); +} + + + +XOTCLINLINE static XOTclCallStackContent* +CallStackGetTopFrame(Tcl_Interp *in) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + return cs->top; +} + +static XOTclCallStackContent* +CallStackGetFrame(Tcl_Interp *in) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + register XOTclCallStackContent *top = cs->top; + Tcl_CallFrame *varFramePtr = Tcl_Interp_varFramePtr(in); + + if (Tcl_Interp_framePtr(in) != varFramePtr && top->currentFramePtr) { + XOTclCallStackContent *bot = cs->content + 1; + /* we are in a uplevel */ + while (varFramePtr > top->currentFramePtr && top>bot) { + top--; + } + } + return top; +} + +/* + * cmd list handling + */ + +/* + * Cmd List Add/Remove ... returns the new element + */ +static XOTclCmdList* +CmdListAdd(XOTclCmdList **cList, Tcl_Command c, int noDuplicates) { + XOTclCmdList *l = *cList, *new; + + /* + * check for duplicates, if necessary + */ + if (noDuplicates) { + XOTclCmdList *h = l, **end = NULL; + while (h) { + if (h->cmdPtr == c) + return h; + end = &(h->next); + h = h->next; + } + if (end) { + /* no duplicates, no need to search below, we are at the end of the list */ + cList = end; + l = NULL; + } + } + + /* + * ok, we have no duplicates -> append "new" + * to the end of the list + */ + new = NEW(XOTclCmdList); + new->cmdPtr = c; + Tcl_Command_refCount(new->cmdPtr)++; + MEM_COUNT_ALLOC("command refCount",new->cmdPtr); + new->clientData = NULL; + new->next = NULL; + + if (l) { + while (l->next) + l = l->next; + l->next = new; + } else + *cList = new; + return new; +} + +static void +CmdListReplaceCmd(XOTclCmdList* replace, Tcl_Command cmd) { + Tcl_Command del = replace->cmdPtr; + replace->cmdPtr = cmd; + Tcl_Command_refCount(cmd)++; + MEM_COUNT_ALLOC("command refCount", cmd); + TclCleanupCommand((Command *)del); + MEM_COUNT_FREE("command refCount",cmd); +} + +/* +static void +CmdListPrint(char *title, XOTclCmdList* cmdList) { + if (cmdList) + fprintf(stderr,title); + while (cmdList) { + fprintf(stderr, " CL=%p, cmdPtr=%p, clientData=%p\n", + cmdList, + cmdList->cmdPtr, + cmdList->clientData); + cmdList = cmdList->next; + } +} +*/ + +/* + * physically delete an entry 'del' + */ +static void +CmdListDeleteCmdListEntry(XOTclCmdList* del, XOTclFreeCmdListClientData* freeFct) { + if (freeFct) + (*freeFct)(del); + MEM_COUNT_FREE("command refCount",del->cmdPtr); + TclCleanupCommand((Command *)del->cmdPtr); + FREE(XOTclCmdList, del); +} + +/* + * remove a command 'delCL' from a command list, but do not + * free it ... returns the removed XOTclCmdList* + */ +static XOTclCmdList* +CmdListRemoveFromList(XOTclCmdList **cmdList, XOTclCmdList* delCL) { + register XOTclCmdList* c = *cmdList, *del = 0; + if (c == 0) + return NULL; + if (c == delCL) { + *cmdList = c->next; + del = c; + } else { + while (c->next && c->next != delCL) { + c = c->next; + } + if (c->next == delCL) { + del = delCL; + c->next = delCL->next; + } + } + return del; +} + +/* + * remove all command pointers from a list that have a bumped epoch + */ +static void +CmdListRemoveEpoched(XOTclCmdList **cmdList, XOTclFreeCmdListClientData *freeFct) { + XOTclCmdList *f = *cmdList, *del; + while (f) { + if (Tcl_Command_cmdEpoch(f->cmdPtr)) { + del = f; + f = f->next; + del = CmdListRemoveFromList(cmdList, del); + CmdListDeleteCmdListEntry(del, freeFct); + } else + f = f->next; + } +} + +/* + * delete all entries from a given namespace + */ +static void +CmdListRemoveNSFromList(XOTclCmdList **cmdList, Tcl_Namespace* nsPtr, + XOTclFreeCmdListClientData* freeFct) { + XOTclCmdList* c, *del = 0; + /* + CmdListRemoveEpoched(cmdList, freeFct); + */ + c = *cmdList; + while (c && Tcl_Command_nsPtr(c->cmdPtr) == nsPtr) { + del = c; + *cmdList = c->next; + CmdListDeleteCmdListEntry(del, freeFct); + c = *cmdList; + } + while (c) { + if (Tcl_Command_nsPtr(c->cmdPtr) == nsPtr) { + del = c; + c = *cmdList; + while (c->next && c->next != del) + c = c->next; + if (c->next == del) + c->next = del->next; + CmdListDeleteCmdListEntry(del, freeFct); + } + c = c->next; + } +} + +/* + * free the memory of a whole 'cmdList' + */ +static void +CmdListRemoveList(XOTclCmdList **cmdList, XOTclFreeCmdListClientData* freeFct) { + XOTclCmdList *del; + while (*cmdList) { + del = *cmdList; + *cmdList = (*cmdList)->next; + CmdListDeleteCmdListEntry(del, freeFct); + } +} + +/* + * simple list search proc to search a list of cmds + * for a command ptr + */ +static XOTclCmdList* +CmdListFindCmdInList(Tcl_Command cmd, XOTclCmdList* l) { + register XOTclCmdList* h = l; + while (h != 0) { + if (h->cmdPtr == cmd) + return h; + h = h->next; + } + return 0; +} + +/* + * simple list search proc to search a list of cmds + * for a simple Name + */ +static XOTclCmdList* +CmdListFindNameInList(Tcl_Interp *in, char *name, XOTclCmdList* l) { + register XOTclCmdList* h = l; + while (h != 0) { + CONST84 char *cmdName = Tcl_GetCommandName(in, h->cmdPtr); + if (cmdName[0] == name[0] && !strcmp(cmdName, name)) + return h; + h = h->next; + } + return 0; +} + +/* + * Assertions + */ +static XOTclTclObjList* +AssertionNewList(Tcl_Interp *in, Tcl_Obj *aObj) { + Tcl_Obj **ov; int oc; + XOTclTclObjList *last = NULL; + + if (Tcl_ListObjGetElements(in, aObj, &oc, &ov) == TCL_OK) { + if (oc > 0) { + int i; + for (i=oc-1; i>=0; i--) { + TclObjListNewElement(&last, ov[i]); + } + } + } + return last; +} + +static Tcl_Obj* +AssertionList(Tcl_Interp *in, XOTclTclObjList* alist) { + Tcl_Obj *newAssStr = Tcl_NewStringObj("",0); + for (; alist!=NULL; alist = alist->next) { + Tcl_AppendStringsToObj(newAssStr, "{", ObjStr(alist->content), + "}", (char *) NULL); + if (alist->next != NULL) + Tcl_AppendStringsToObj(newAssStr, " ", (char*) NULL); + } + return newAssStr; +} + +/* append a string of pre and post assertions to a proc + or instproc body */ +static void +AssertionAppendPrePost(Tcl_Interp *in, Tcl_DString *dsPtr, XOTclProcAssertion *procs) { + if (procs) { + Tcl_Obj *preAss = AssertionList(in, procs->pre); + Tcl_Obj *postAss = AssertionList(in, procs->post); + INCR_REF_COUNT(preAss); INCR_REF_COUNT(postAss); + Tcl_DStringAppendElement(dsPtr, ObjStr(preAss)); + Tcl_DStringAppendElement(dsPtr, ObjStr(postAss)); + DECR_REF_COUNT(preAss); DECR_REF_COUNT(postAss); + } +} + +static int +AssertionListCheckOption(Tcl_Interp *in, XOTclObject *obj) { + XOTclObjectOpt *opt = obj->opt; + if (!opt) + return TCL_OK; + if (opt->checkoptions & CHECK_OBJINVAR) + Tcl_AppendElement(in, "invar"); + if (opt->checkoptions & CHECK_CLINVAR) + Tcl_AppendElement(in, "instinvar"); + if (opt->checkoptions & CHECK_PRE) + Tcl_AppendElement(in, "pre"); + if (opt->checkoptions & CHECK_POST) + Tcl_AppendElement(in, "post"); + return TCL_OK; +} + +static XOTclProcAssertion* +AssertionFindProcs(XOTclAssertionStore* aStore, char *name) { + Tcl_HashEntry *hPtr; + if (aStore == NULL) return NULL; + hPtr = Tcl_FindHashEntry(&aStore->procs, name); + if (hPtr == NULL) return NULL; + return (XOTclProcAssertion*) Tcl_GetHashValue(hPtr); +} + +static void +AssertionRemoveProc(XOTclAssertionStore* aStore, char *name) { + Tcl_HashEntry *hPtr; + if (aStore) { + hPtr = Tcl_FindHashEntry(&aStore->procs, name); + if (hPtr) { + XOTclProcAssertion* procAss = + (XOTclProcAssertion*) Tcl_GetHashValue(hPtr); + TclObjListFreeList(procAss->pre); + TclObjListFreeList(procAss->post); + FREE(XOTclProcAssertion, procAss); + Tcl_DeleteHashEntry(hPtr); + } + } +} + +static void +AssertionAddProc(Tcl_Interp *in, char *name, XOTclAssertionStore* aStore, + Tcl_Obj *pre, Tcl_Obj *post) { + int nw = 0; + Tcl_HashEntry* hPtr = NULL; + XOTclProcAssertion *procs = NEW(XOTclProcAssertion); + + AssertionRemoveProc(aStore, name); + procs->pre = AssertionNewList(in, pre); + procs->post = AssertionNewList(in, post); + hPtr = Tcl_CreateHashEntry(&aStore->procs, name, &nw); + if (nw) Tcl_SetHashValue(hPtr, (ClientData)procs); +} + +static XOTclAssertionStore* +AssertionCreateStore() { + XOTclAssertionStore* aStore = NEW(XOTclAssertionStore); + aStore->invariants = NULL; + Tcl_InitHashTable(&aStore->procs, TCL_STRING_KEYS); + MEM_COUNT_ALLOC("Tcl_InitHashTable",&aStore->procs); + return aStore; +} + +static void +AssertionRemoveStore(XOTclAssertionStore* aStore) { + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr; + + if (aStore) { + hPtr = Tcl_FirstHashEntry(&aStore->procs, &hSrch); + while (hPtr) { + /* + * AssertionRemoveProc calls Tcl_DeleteHashEntry(hPtr), thus + * we get the FirstHashEntry afterwards again to proceed + */ + AssertionRemoveProc(aStore, Tcl_GetHashKey(&aStore->procs, hPtr)); + hPtr = Tcl_FirstHashEntry(&aStore->procs, &hSrch); + } + Tcl_DeleteHashTable(&aStore->procs); + MEM_COUNT_FREE("Tcl_InitHashTable",&aStore->procs); + TclObjListFreeList(aStore->invariants); + FREE(XOTclAssertionStore, aStore); + } +} + +/* + * check a given condition in the current callframe's scope + * it's the responsiblity of the caller to push the intended callframe + */ +static int +checkConditionInScope(Tcl_Interp *in, Tcl_Obj *condition) { + int result, success; + Tcl_Obj *ov[2]; + ov [1] = condition; + INCR_REF_COUNT(condition); + /* + fprintf(stderr, "----- evaluating condition '%s'\n", ObjStr(condition)); + */ + result = XOTcl_ExprObjCmd(NULL, in, 2, ov); + DECR_REF_COUNT(condition); + /* + fprintf(stderr, "----- running condition '%s', result=%d '%s'\n", + ObjStr(condition), result, + ObjStr(Tcl_GetObjResult(in))); + */ + if (result == TCL_OK) { + result = Tcl_GetIntFromObj(in,Tcl_GetObjResult(in),&success); + /* + fprintf(stderr, " success=%d\n", success); + */ + if (result == TCL_OK && success == 0) + result = XOTCL_CHECK_FAILED; + } + return result; +} + +static int +AssertionCheckList(Tcl_Interp *in, XOTclObject *obj, + XOTclTclObjList* alist, char *methodName) { + XOTclTclObjList* checkFailed = NULL; + Tcl_Obj *savedObjResult = Tcl_GetObjResult(in); + int savedCheckoptions, acResult = TCL_OK; + + /* + * no obj->opt -> checkoption == CHECK_NONE + */ + if (!obj->opt) + return TCL_OK; + + /* we do not check assertion modifying methods, otherwise + we can not react in catch on a runtime assertion check failure */ + if (isCheckString(methodName) || isInfoString(methodName) || + isInvarString(methodName) || isInstinvarString(methodName) || + isProcString(methodName) || isInstprocString(methodName)) + return TCL_OK; + + INCR_REF_COUNT(savedObjResult); + + Tcl_ResetResult(in); + + while (alist != NULL) { + /* Eval instead of IfObjCmd => the substitutions in the + conditions will be done by Tcl */ + char *assStr = ObjStr(alist->content), *c = assStr; + int comment = 0; + + while (c != 0 && *c != '\0') { + if (*c == '#') { + comment = 1; break; + } + c++; + } + if (!comment) { + XOTcl_FrameDecls; + XOTcl_PushFrame(in, obj); + CallStackPush(in, obj, 0, 0, 0, 0, XOTCL_CSC_TYPE_PLAIN); + + /* don't check assertion during assertion check */ + savedCheckoptions = obj->opt->checkoptions; + obj->opt->checkoptions = CHECK_NONE; + + /*fprintf(stderr, "Checking Assertion %s ", assStr);*/ + + /* + * now check the assertion in the pushed callframe's scope + */ + acResult = checkConditionInScope(in, alist->content); + if (acResult != TCL_OK) + checkFailed = alist; + + obj->opt->checkoptions = savedCheckoptions; + + /*fprintf(stderr, "...%s\n", checkFailed ? "failed" : "ok");*/ + + CallStackPop(in); + XOTcl_PopFrame(in,obj); + } + if (checkFailed) + break; + alist = alist->next; + } + + if (checkFailed != NULL) { + DECR_REF_COUNT(savedObjResult); + if (acResult == TCL_ERROR) { + Tcl_Obj *sr = Tcl_GetObjResult(in); + INCR_REF_COUNT(sr); + XOTclVarErrMsg(in, "Error in Assertion: {", + ObjStr(checkFailed->content), "} in proc '", + GetSelfProc(in), "'\n\n", ObjStr(sr), (char *)NULL); + DECR_REF_COUNT(sr); + return TCL_ERROR; + } + return XOTclVarErrMsg(in, "Assertion failed check: {", + ObjStr(checkFailed->content), "} in proc '", + GetSelfProc(in), "'", (char *)NULL); + } + + Tcl_SetObjResult(in, savedObjResult); + DECR_REF_COUNT(savedObjResult); + return TCL_OK; +} + +static int +AssertionCheckInvars(Tcl_Interp *in, XOTclObject *obj, char *method, + CheckOptions checkoptions) { + int result = TCL_OK; + + if (checkoptions & CHECK_OBJINVAR && obj->opt->assertions) { + result = AssertionCheckList(in, obj, obj->opt->assertions->invariants, + method); + } + + if (result != TCL_ERROR && checkoptions & CHECK_CLINVAR) { + XOTclClasses* clPtr; + clPtr = ComputeOrder(obj->cl, Super); + while (clPtr != 0 && result != TCL_ERROR) { + XOTclAssertionStore* aStore = (clPtr->cl->opt) ? clPtr->cl->opt->assertions : 0; + if (aStore) { + result = AssertionCheckList(in, obj, aStore->invariants, method); + } + clPtr = clPtr->next; + } + } + return result; +} + +static int +AssertionCheck(Tcl_Interp *in, XOTclObject *obj, XOTclClass *cl, + char *method, int checkOption) { + XOTclProcAssertion* procs; + int result = TCL_OK; + XOTclAssertionStore* aStore; + + if (cl) + aStore = cl->opt ? cl->opt->assertions : 0; + else + aStore = obj->opt ? obj->opt->assertions : 0; + + assert(obj->opt); + + if (checkOption & obj->opt->checkoptions) { + procs = AssertionFindProcs(aStore, method); + if (procs) { + switch (checkOption) { + case CHECK_PRE: + result = AssertionCheckList(in, obj, procs->pre, method); + break; + case CHECK_POST: + result = AssertionCheckList(in, obj, procs->post, method); + break; + } + } + if (result != TCL_ERROR) + result = AssertionCheckInvars(in, obj, method, obj->opt->checkoptions); + } + return result; +} + +/* + * Per-Object-Mixins + */ + +/* + * push a mixin stack information on this object + */ +static int +MixinStackPush(XOTclObject *obj) { + register XOTclMixinStack* h = NEW(XOTclMixinStack); + h->currentCmdPtr = 0; + h->next = obj->mixinStack; + obj->mixinStack = h; + return 1; +} + +/* + * pop a mixin stack information on this object + */ +static void +MixinStackPop(XOTclObject *obj) { + register XOTclMixinStack *h = obj->mixinStack; + obj->mixinStack = h->next; + FREE(XOTclMixinStack,h); +} + +/* + * Appends XOTclClasses* containing the mixin classes and their + * superclasses to 'mixinClasses' list from a given mixinList + */ +static void +MixinComputeOrderFullList(Tcl_Interp *in, XOTclCmdList **mixinList, + XOTclClasses **mixinClasses) { + XOTclCmdList *m; + XOTclClasses *pl, **clPtr = mixinClasses; + + CmdListRemoveEpoched(mixinList, GuardDel); + m = *mixinList; + + while (m) { + XOTclClass *mCl = XOTclGetClassFromCmdPtr(m->cmdPtr); + if (mCl) { + for (pl = ComputeOrder(mCl, Super); pl; pl = pl->next) { + /*fprintf(stderr, " %s, ", ObjStr(pl->cl->object.cmdName));*/ + if (!(pl->cl == RUNTIME_STATE(in)->theObject)) { + XOTclClassOpt* opt = pl->cl->opt; + if (opt && opt->instmixins != 0) { + /* compute transitively the instmixin classes of this added + class */ + MixinComputeOrderFullList(in, &opt->instmixins, mixinClasses); + } + clPtr = XOTclAddClass(clPtr, pl->cl, m->clientData); + } + } + } + m = m->next; + } +} + +static void +MixinResetOrder(XOTclObject *obj) { + CmdListRemoveList(&obj->mixinOrder, NULL /*GuardDel*/); + obj->mixinOrder = 0; +} + +/* + * Computes a linearized order of per-object and per-class mixins. Then + * duplicates in the full list and with the class inheritance list of + * 'obj' are eliminated. + * The precendence rule is that the last occurence makes it into the + * final list. + */ +static void +MixinComputeOrder(Tcl_Interp *in, XOTclObject *obj) { + XOTclClasses *fullList, *mixinClasses = 0, *nextCl, *pl, + *checker, *guardChecker; + + if (obj->mixinOrder) MixinResetOrder(obj); + /*fprintf(stderr, "Mixin Order:\n First List: ");*/ + + /* append per-obj mixins */ + if (obj->opt) + MixinComputeOrderFullList(in, &obj->opt->mixins, &mixinClasses); + + /* append per-class mixins */ + for (pl = ComputeOrder(obj->cl, Super); pl; pl = pl->next) { + XOTclClassOpt* opt = pl->cl->opt; + if (opt && opt->instmixins) + MixinComputeOrderFullList(in, &opt->instmixins, &mixinClasses); + } + + fullList = mixinClasses; + + /* use no duplicates & no classes of the precedence order + on the resulting list */ + while (mixinClasses) { + checker = nextCl = mixinClasses->next; + while (checker) { + if (checker->cl == mixinClasses->cl) break; + checker = checker->next; + } + /* if mixinClasses has no duplicate on mixinList -> + check obj->cl hierachy */ + if (checker == 0) { + for (checker = ComputeOrder(obj->cl, Super); checker; checker = checker->next) { + if (checker->cl == mixinClasses->cl) + break; + } + } + /* if class is also not found on precedence order -> + add it to mixinOrder list (otherwise free the memory) */ + if (checker == 0) { + XOTclCmdList* new; + new = CmdListAdd(&obj->mixinOrder, mixinClasses->cl->object.id, + /*noDuplicates*/ 0); + + /* in the client data of the order list, we require the first + matiching guard ... scan the full list for it. */ + for (guardChecker = fullList; guardChecker; guardChecker = guardChecker->next) { + if (guardChecker->cl == mixinClasses->cl) { + new->clientData = guardChecker->clientData; + break; + } + } + + /* + fprintf(stderr, " Adding %s,\n", ObjStr(mixinClasses->cl->object.cmdName)); + */ + } + mixinClasses = nextCl; + } + + /* ... and free the memory of the full list */ + while (fullList) { + nextCl = fullList->next; + FREE(XOTclClasses, fullList); + fullList = nextCl; + } + /*CmdListPrint("mixin order\n", obj->mixinOrder);*/ + +} + +/* + * add a mixin class to 'mixinList' by appending it + */ +static int +MixinAdd(Tcl_Interp *in, XOTclCmdList **mixinList, Tcl_Obj *name) { + XOTclClass *mixin; + Tcl_Obj *guard = NULL; + int ocName; Tcl_Obj **ovName; + XOTclCmdList* new; + + if (Tcl_ListObjGetElements(in, name, &ocName, &ovName) == TCL_OK && ocName > 1) { + if (ocName == 3 && !strcmp(ObjStr(ovName[1]), XOTclGlobalStrings[GUARD_OPTION])) { + name = ovName[0]; + guard = ovName[2]; + /*fprintf(stderr,"mixinadd name = '%s', guard = '%s'\n", ObjStr(name), ObjStr(guard));*/ + } /*else return XOTclVarErrMsg(in, "mixin registration '", ObjStr(name), + "' has too many elements.", (char *)NULL);*/ + } + + if (GetXOTclClassFromObj(in, name, &mixin, 1) != TCL_OK) + return XOTclErrBadVal(in, "a class as mixin", ObjStr(name)); + + + new = CmdListAdd(mixinList, mixin->object.id, /*noDuplicates*/ 1); + + if (guard) { + GuardAdd(in, new, guard); + } else { + if (new->clientData) + GuardDel(new); + } + + return TCL_OK; +} + +/* + * if the class hierarchy or class mixins have changed -> + * invalidate mixin entries in all dependent instances + */ +static void +MixinInvalidateObjOrders(XOTclClass *cl) { + XOTclClasses *saved = cl->order, *clPtr; + cl->order = 0; + + for (clPtr = ComputeOrder(cl, Sub); clPtr; clPtr = clPtr->next) { + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr = &clPtr->cl->instances ? + Tcl_FirstHashEntry(&clPtr->cl->instances, &hSrch) : 0; + + for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { + XOTclObject *obj = (XOTclObject*) + Tcl_GetHashKey(&clPtr->cl->instances, hPtr); + MixinResetOrder(obj); + obj->flags &= ~XOTCL_MIXIN_ORDER_VALID; + } + } + + XOTclFreeClasses(cl->order); + cl->order = saved; +} + +/* + * the mixin order is either + * DEFINED (there are mixins on the instance), + * NONE (there are no mixins for the instance), + * or INVALID (a class re-strucuturing has occured, thus it is not clear + * whether mixins are defined or not). + * If it is INVALID MixinComputeDefined can be used to compute the order + * and set the instance to DEFINE or NONE + */ +static void +MixinComputeDefined(Tcl_Interp *in, XOTclObject *obj) { + MixinComputeOrder(in, obj); + obj->flags |= XOTCL_MIXIN_ORDER_VALID; + if (obj->mixinOrder) + obj->flags |= XOTCL_MIXIN_ORDER_DEFINED; + else + obj->flags &= ~XOTCL_MIXIN_ORDER_DEFINED; +} + +/* + * walk through the mixin order until the current mixin is reached. + * then use the next mixin as current mixin. + * + * precondition: obj->mixinStack is not NULL + */ +static void +MixinSeekCurrent(Tcl_Interp *in, XOTclObject *obj, XOTclCmdList **cmdList) { + Tcl_Command currentCmdPtr; + + /* ensure that the mixin order is not invalid, otherwise compute order */ + assert(obj->flags & XOTCL_MIXIN_ORDER_VALID); + /* otherwise: MixinComputeDefined(in, obj);*/ + + currentCmdPtr = obj->mixinStack->currentCmdPtr; + *cmdList = obj->mixinOrder; + + /* go forward to current class */ + while (*cmdList && currentCmdPtr) { + if ((*cmdList)->cmdPtr == currentCmdPtr) + currentCmdPtr = 0; + *cmdList = (*cmdList)->next; + } +} + +/* + * before we can perform a mixin dispatch, MixinSearchProc seeks the + * current mixin and the relevant calling information + */ +static Tcl_Command +MixinSearchProc(Tcl_Interp *in, XOTclObject *obj, char *methodName, + XOTclClass **cl, Tcl_ObjCmdProc **proc, ClientData* cp, + Tcl_Command* currentCmdPtr) { + Tcl_Command cmd = NULL; + XOTclCmdList *cmdList; + XOTclClass *cls; + + assert(obj); + assert(obj->mixinStack); + + MixinSeekCurrent(in, obj, &cmdList); + + /* + fprintf(stderr, "MixinSearch searching for '%s' %p\n", methodName, cmdList); + CmdListPrint("MixinSearch CL = \n", cmdList); + */ + + while (cmdList) { + if(Tcl_Command_cmdEpoch(cmdList->cmdPtr)) { + cmdList = cmdList->next; + } else { + cls = XOTclGetClassFromCmdPtr(cmdList->cmdPtr); + /* + fprintf(stderr,"+++ MixinSearch %s->%s in %p cmdPtr %p clientData %p\n", + ObjStr(obj->cmdName),methodName, cmdList, + cmdList->cmdPtr, cmdList->clientData); + */ + if (cls) { + int guardOk = TCL_OK; + cmd = FindMethod(methodName, Tcl_Namespace_cmdTable(cls->nsPtr)); + if (cmd && cmdList->clientData) { + if (!RUNTIME_STATE(in)->cs.guardCount) { + guardOk = GuardCall(obj, cls, (Tcl_Command) cmd, in, cmdList->clientData, 1); + } + } + if (cmd && guardOk == TCL_OK) { + /* + * on success: compute mixin call data + */ + *cl = cls; + *proc = Tcl_Command_objProc(cmd); + *cp = Tcl_Command_objClientData(cmd); + *currentCmdPtr = cmdList->cmdPtr; + break; + } else { + cmd = NULL; + cmdList = cmdList->next; + } + } + } + } + + return cmd; +} + +/* + * info option for mixins and instmixins + */ +static int +MixinInfo(Tcl_Interp *in, XOTclCmdList* m, char *pattern, int withGuards) { + Tcl_Obj *list = Tcl_NewListObj(0, NULL); + XOTclClass *mixinClass; + while (m) { + mixinClass = XOTclGetClassFromCmdPtr(m->cmdPtr); + if (mixinClass && + (!pattern || + Tcl_StringMatch(ObjStr(mixinClass->object.cmdName), pattern))) { + if (withGuards && m->clientData) { + Tcl_Obj *l = Tcl_NewListObj(0, NULL); + Tcl_Obj *g = (Tcl_Obj*) m->clientData; + Tcl_ListObjAppendElement(in, l, mixinClass->object.cmdName); + Tcl_ListObjAppendElement(in, l, XOTclGlobalObjects[GUARD_OPTION]); + Tcl_ListObjAppendElement(in, l, g); + Tcl_ListObjAppendElement(in, list, l); + } else + Tcl_ListObjAppendElement(in, list, mixinClass->object.cmdName); + } + m = m->next; + } + Tcl_SetObjResult(in, list); + return TCL_OK; +} + +static Tcl_Command +MixinSearchMethodByName(Tcl_Interp *in, XOTclCmdList* mixinList, char *name) { + Tcl_Command cmd; + while (mixinList) { + XOTclClass *mcl = + GetClass(in, (char*) Tcl_GetCommandName(in, mixinList->cmdPtr)); + if (mcl && SearchCMethod(mcl, name, &cmd)) + return cmd; + + mixinList = mixinList->next; + } + return 0; +} + + +/* + * Filter-Commands + */ + +/* + * The search method implements filter search order for filter + * and instfilter: first a given name is interpreted as fully + * qualified instproc name. If no instproc is found, a proc is + * search with fully name. Otherwise the simple name is searched + * on the heritage order: object (only for + * per-object filters), class, meta-class + */ + +static Tcl_Command +FilterSearch(Tcl_Interp *in, char *name, XOTclObject *startingObj, + XOTclClass *startingCl) { + Tcl_Command cmd = NULL; + + if (startingObj) { + XOTclObjectOpt *opt = startingObj->opt; + /* + * the object-specific filter can also be defined on the object's + * class, its hierarchy, or the respective instmixins; thus use the + * object's class as start point for the class-specific search then ... + */ + startingCl = startingObj->cl; + + /* + * search for filters on object mixins + */ + if (opt && opt->mixins) { + if ((cmd = MixinSearchMethodByName(in, opt->mixins, name))) + return cmd; + } + } + + /* + * search for instfilters on instmixins + */ + if (startingCl) { + XOTclClassOpt* opt = startingCl->opt; + if (opt && opt->instmixins) { + if ((cmd = MixinSearchMethodByName(in, opt->instmixins, name))) + return cmd; + } + } + + /* + * seach for object procs that are used as filters + */ + if (startingObj && startingObj->nsPtr) { + if ((cmd = FindMethod(name, Tcl_Namespace_cmdTable(startingObj->nsPtr)))) + return cmd; + } + + /* + * ok, no filter on obj or mixins -> search class + */ + if (startingCl) { + if (!SearchCMethod(startingCl, name, &cmd)) { + /* + * If no filter is found yet -> search the meta-class + */ + SearchCMethod(startingCl->object.cl, name, &cmd); + } + } + return cmd; +} + +/* + * Filter Guards + */ + +/* check a filter guard, return 1 if ok */ +static int +GuardCheck(Tcl_Interp *in, ClientData clientData) { + Tcl_Obj *guard = (Tcl_Obj*) clientData; + int rc; + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + + if (guard) { + /* + * if there are more than one filter guard for this filter + * (i.e. they are inherited), then they are OR combined + * -> if one check succeeds => return 1 + */ + + /*fprintf(stderr, "checking guard **%s**\n", ObjStr(guard));*/ + + cs->guardCount++; + rc = checkConditionInScope(in, guard); + cs->guardCount--; + + /*fprintf(stderr, "checking guard **%s** returned rc=%d\n", + ObjStr(fr->content), rc);*/ + + if (rc == TCL_OK) { + /* fprintf(stderr, " +++ OK\n"); */ + return TCL_OK; + } else if (rc == TCL_ERROR) { + Tcl_Obj *sr = Tcl_GetObjResult(in); + INCR_REF_COUNT(sr); + + /* fprintf(stderr, " +++ ERROR\n");*/ + + XOTclVarErrMsg(in, "Guard Error: '", ObjStr(guard), "'\n\n", + ObjStr(sr), (char *)NULL); + DECR_REF_COUNT(sr); + return TCL_ERROR; + } + } + /* + fprintf(stderr, " +++ FAILED\n"); + */ + return XOTCL_CHECK_FAILED; +} + +/* +static void +GuardPrint(Tcl_Interp *in, ClientData clientData) { + Tcl_Obj *guard = (TclObj*) clientData; + fprintf(stderr, " +++ \n"); + if (guard) { + fprintf(stderr, " * %s \n", ObjStr(guard)); + } + fprintf(stderr, " +++ \n"); +} +*/ + +static void +GuardDel(XOTclCmdList* CL) { + /*fprintf(stderr, "GuardDel %p cd = %p\n", + CL, CL? CL->clientData : NULL);*/ + if (CL && CL->clientData) { + DECR_REF_COUNT((Tcl_Obj*)CL->clientData); + CL->clientData = NULL; + } +} + +XOTCLINLINE static void +GuardAdd(Tcl_Interp *in, XOTclCmdList* CL, Tcl_Obj *guard) { + if (guard) { + GuardDel(CL); + if (strlen(ObjStr(guard)) != 0) { + INCR_REF_COUNT(guard); + CL->clientData = (ClientData) guard; + /*fprintf(stderr,"guard added to %p cmdPtr=%p, clientData= %p\n", + CL, CL->cmdPtr, CL->clientData); + */ + } + } +} +/* +static void +GuardAddList(Tcl_Interp *in, XOTclCmdList* dest, ClientData source) { + XOTclTclObjList* s = (XOTclTclObjList*) source; + while (s) { + GuardAdd(in, dest, (Tcl_Obj*) s->content); + s = s->next; + } +} */ + +static int +GuardCall(XOTclObject *obj, XOTclClass *cl, Tcl_Command cmd, + Tcl_Interp *in, ClientData clientData, int push) { + int rc = TCL_OK; + + if (clientData) { + Tcl_Obj *res = Tcl_GetObjResult(in); /* save the result */ + INCR_REF_COUNT(res); + + /* GuardPrint(in, cmdList->clientData); */ + /* + * ok, there is a guard ... we have to push a + * fake callframe on the tcl stack so that uplevel + * is in sync with the XOTcl callstack, and we can uplevel + * into the above pushed CallStack entry + */ + if (push) { + CallStackPush(in, obj, cl, cmd, 0, 0, XOTCL_CSC_TYPE_GUARD); + rc = GuardCheck(in, clientData); + CallStackPop(in); + } else { + rc = GuardCheck(in, clientData); + } + Tcl_SetObjResult(in, res); /* restore the result */ + DECR_REF_COUNT(res); + } + + return rc; +} + +static int +GuardAddFromDefinitionList(Tcl_Interp *in, XOTclCmdList* dest, + XOTclObject *obj, Tcl_Command interceptorCmd, + XOTclCmdList* interceptorDefList) { + XOTclCmdList* h; + if (interceptorDefList != 0) { + h = CmdListFindCmdInList(interceptorCmd, interceptorDefList); + if (h) { + GuardAdd(in, dest, (Tcl_Obj*) h->clientData); + /* + * 1 means we have added a guard successfully "interceptorCmd" + */ + return 1; + } + } + /* + * 0 means we have not added a guard successfully "interceptorCmd" + */ + return 0; +} + +static void +GuardAddInheritedGuards(Tcl_Interp *in, XOTclCmdList* dest, + XOTclObject *obj, Tcl_Command filterCmd) { + XOTclClasses* pl; + int guardAdded = 0; + XOTclObjectOpt *opt; + + /* search guards for instfilters registered on mixins */ + if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) + MixinComputeDefined(in, obj); + if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { + XOTclCmdList *ml = obj->mixinOrder; + XOTclClass *mixin; + while (ml && ! guardAdded) { + mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); + if (mixin && mixin->opt) { + guardAdded = GuardAddFromDefinitionList(in, dest, obj, filterCmd, + mixin->opt->instfilters); + } + ml = ml->next; + } + } + + /* search per-object filters */ + opt = obj->opt; + if (!guardAdded && opt && opt->filters) { + guardAdded = GuardAddFromDefinitionList(in, dest, obj, filterCmd, opt->filters); + } + + if (!guardAdded) { + /* search per-class filters */ + for (pl = ComputeOrder(obj->cl, Super); !guardAdded && pl; pl = pl->next) { + XOTclClassOpt* opt = pl->cl->opt; + if (opt) { + guardAdded = GuardAddFromDefinitionList(in, dest, obj, filterCmd, + opt->instfilters); + } + } + + + /* + * if this is not a registered filter, it is an inherited filter, like: + * Class A + * A instproc f ... + * Class B -superclass A + * B instproc {{f {}}} + * B instfilter f + * -> get the guard from the filter that inherits it (here B->f) + */ + if (!guardAdded) { + XOTclCmdList* registeredFilter = + CmdListFindNameInList(in,(char*) Tcl_GetCommandName(in, filterCmd), + obj->filterOrder); + if (registeredFilter) { + GuardAdd(in, dest, (Tcl_Obj*) registeredFilter->clientData); + } + } + } +} + +static int +GuardList(Tcl_Interp *in, XOTclCmdList* frl, char *interceptorName) { + XOTclCmdList* h; + if (frl) { + /* try to find simple name first */ + h = CmdListFindNameInList(in, interceptorName, frl); + if (!h) { + /* maybe it is a qualified name */ + Tcl_Command cmd = NSFindCommand(in, interceptorName); + if (cmd) { + h = CmdListFindCmdInList(cmd, frl); + } + } + if (h) { + Tcl_ResetResult(in); + if (h->clientData) { + Tcl_Obj *g = (Tcl_Obj*) h->clientData; + Tcl_SetObjResult(in, g); + } + return TCL_OK; + } + } + return XOTclVarErrMsg(in, "info (*)guard: can't find filter/mixin ", + interceptorName, (char *)NULL); +} + +/* + * append a filter command to the 'filterList' of an obj/class + */ +static int +FilterAdd(Tcl_Interp *in, XOTclCmdList **filterList, Tcl_Obj *name, + XOTclObject *startingObj, XOTclClass *startingCl) { + Tcl_Command cmd; + int ocName; Tcl_Obj **ovName; + Tcl_Obj *guard = NULL; + XOTclCmdList* new; + + if (Tcl_ListObjGetElements(in, name, &ocName, &ovName) == TCL_OK && ocName > 1) { + if (ocName == 3 && !strcmp(ObjStr(ovName[1]), XOTclGlobalStrings[GUARD_OPTION])) { + name = ovName[0]; + guard = ovName[2]; + } + } + + if (!(cmd = FilterSearch(in, ObjStr(name), startingObj, startingCl))) { + if (startingObj) + return XOTclVarErrMsg(in, "filter: can't find filterproc on: ", + ObjStr(startingObj->cmdName), " - proc: ", + ObjStr(name), (char *)NULL); + else + return XOTclVarErrMsg(in, "instfilter: can't find filterproc on: ", + ObjStr(startingCl->object.cmdName), " - proc: ", + ObjStr(name), (char *)NULL); + } + /* + fprintf(stderr, " +++ adding filter %s \n", ObjStr(name)); + */ + new = CmdListAdd(filterList, cmd, /*noDuplicates*/ 1); + + if (guard) { + GuardAdd(in, new, guard); + } else { + if (new->clientData) + GuardDel(new); + } + + return TCL_OK; +} + +/* + * reset the filter order cached in obj->filterOrder + */ +static void +FilterResetOrder(XOTclObject *obj) { + CmdListRemoveList(&obj->filterOrder, GuardDel); + obj->filterOrder = 0; +} + +/* + * search the filter in the hierarchy again with FilterSearch, e.g. + * upon changes in the class hierarchy or mixins that carry the filter + * command, so that we can be sure it is still reachable. + */ +static void +FilterSearchAgain(Tcl_Interp *in, XOTclCmdList **filters, + XOTclObject *startingObj, XOTclClass *startingCl) { + char *simpleName; + Tcl_Command cmd; + XOTclCmdList* cmdList, *del; + + CmdListRemoveEpoched(filters, GuardDel); + cmdList = *filters; + while (cmdList) { + simpleName = (char*) Tcl_GetCommandName(in, cmdList->cmdPtr); + cmd = FilterSearch(in, simpleName, startingObj, startingCl); + if (cmd == NULL) { + del = cmdList; + cmdList = cmdList->next; + del = CmdListRemoveFromList(filters, del); + CmdListDeleteCmdListEntry(del, GuardDel); + } else { + if (cmd != cmdList->cmdPtr) + CmdListReplaceCmd(cmdList, cmd); + cmdList = cmdList->next; + } + } + /* some entries might be NULL now, if they are not found anymore + -> delete those + CmdListRemoveNulledEntries(filters, GuardDel); + */ + +} + +/* + * if the class hierarchy or class filters have changed -> + * invalidate filter entries in all dependent instances + * + */ +static void +FilterInvalidateObjOrders(Tcl_Interp *in, XOTclClass *cl) { + XOTclClasses *saved = cl->order, *clPtr, *savePtr; + + cl->order = 0; + savePtr = clPtr = ComputeOrder(cl, Sub); + cl->order = saved; + + while (clPtr != 0) { + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr = &clPtr->cl->instances ? + Tcl_FirstHashEntry(&clPtr->cl->instances, &hSrch) : 0; + + /* recalculate the commands of all instfilter registrations */ + if (clPtr->cl->opt) + FilterSearchAgain(in, &clPtr->cl->opt->instfilters, 0, clPtr->cl); + for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { + XOTclObject *obj = (XOTclObject*) + Tcl_GetHashKey(&clPtr->cl->instances, hPtr); + FilterResetOrder(obj); + obj->flags &= ~XOTCL_FILTER_ORDER_VALID; + + /* recalculate the commands of all object filter registrations */ + if (obj->opt) + FilterSearchAgain(in, &obj->opt->filters, obj, 0); + } + clPtr = clPtr->next; + } + XOTclFreeClasses(savePtr); +} + +/* + * from cl on down the hierarchy we remove all filters + * the refer to "removeClass" namespace. E.g. used to + * remove filters defined in superclass list from dependent + * class cl + */ +static void +FilterRemoveDependentFilterCmds(XOTclClass *cl, XOTclClass *removeClass) { + XOTclClasses *saved = cl->order, *clPtr; + cl->order = 0; + + for (clPtr = ComputeOrder(cl, Sub); clPtr; clPtr = clPtr->next) { + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr = &clPtr->cl->instances ? + Tcl_FirstHashEntry(&clPtr->cl->instances, &hSrch) : 0; + XOTclClassOpt* opt = clPtr->cl->opt; + if (opt) + CmdListRemoveNSFromList(&opt->instfilters, removeClass->nsPtr, GuardDel); + + for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { + XOTclObject *obj = (XOTclObject*) Tcl_GetHashKey(&clPtr->cl->instances, hPtr); + if (obj->opt) { + CmdListRemoveNSFromList(&obj->opt->filters, removeClass->nsPtr, GuardDel); + } + } + } + + XOTclFreeClasses(cl->order); + cl->order = saved; +} + +/* + * build up a qualifier of the form proc/instproc + * if cl is not NULL, we build an instproc identifier for cl, else a proc + * with obj + */ +static Tcl_Obj* +getFullProcQualifier(Tcl_Interp *in, CONST84 char *cmdName, + XOTclObject *obj, XOTclClass *cl) { + Tcl_Obj *list = Tcl_NewListObj(0, NULL); + Tcl_Obj *procObj = Tcl_NewStringObj(cmdName, -1); + if (cl) { + Tcl_ListObjAppendElement(in, list, cl->object.cmdName); + Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[INSTPROC]); + } else { + Tcl_ListObjAppendElement(in, list, obj->cmdName); + Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[PROC]); + } + Tcl_ListObjAppendElement(in, list, procObj); + return list; +} + +/* + * info option for filters and instfilters + * withGuards -> if not 0 => append guards + * fullProcQualifiers -> if not 0 => full names with obj/class proc/instproc + */ +static int +FilterInfo(Tcl_Interp *in, XOTclCmdList* f, char *pattern, + int withGuards, int fullProcQualifiers) { + CONST84 char *simpleName; + Tcl_Obj *list = Tcl_NewListObj(0, NULL); + + /* guard lists should only have unqualified filter lists + when withGuards is activated, fullProcQualifiers has not + effect */ + if (withGuards) { + fullProcQualifiers = 0; + } + + while (f) { + simpleName = Tcl_GetCommandName(in, f->cmdPtr); + if (!pattern || Tcl_StringMatch(simpleName, pattern)) { + if (withGuards && f->clientData) { + Tcl_Obj *innerList = Tcl_NewListObj(0, NULL); + Tcl_Obj *g = (Tcl_Obj*) f->clientData; + Tcl_ListObjAppendElement(in, innerList, + Tcl_NewStringObj(simpleName, -1)); + Tcl_ListObjAppendElement(in, innerList, XOTclGlobalObjects[GUARD_OPTION]); + Tcl_ListObjAppendElement(in, innerList, g); + Tcl_ListObjAppendElement(in, list, innerList); + } else { + if (fullProcQualifiers) { + char *fullName = NSCmdFullName(f->cmdPtr); + XOTclClass *fcl = GetClassFromFullName(in,fullName); + XOTclObject *fobj = fcl ? 0 : GetObject(in, fullName); + Tcl_ListObjAppendElement(in, list, + getFullProcQualifier(in, simpleName, fobj, fcl)); + } else { + Tcl_ListObjAppendElement(in, list, Tcl_NewStringObj(simpleName, -1)); + } + } + } + f = f->next; + } + Tcl_SetObjResult(in, list); + return TCL_OK; +} + +/* + * Appends XOTclCmdPtr* containing the filter cmds and their + * superclass specializations to 'filterList' + */ +static void +FilterComputeOrderFullList(Tcl_Interp *in, XOTclCmdList **filters, + XOTclCmdList **filterList) { + XOTclCmdList *f ; + char *simpleName; + XOTclClass *fCl; + XOTclClasses *pl; + + /* + * ensure that no epoched command is in the filters list + */ + CmdListRemoveEpoched(filters, GuardDel); + + for (f = *filters; f; f = f->next) { + char *fullName = NSCmdFullName(f->cmdPtr); + simpleName = (char*) Tcl_GetCommandName(in, f->cmdPtr); + fCl = GetClassFromFullName(in, fullName); + CmdListAdd(filterList, f->cmdPtr, /*noDuplicates*/ 0); + + if (!fCl) { + /* try to find the object for per-object filter */ + XOTclObject *fObj = GetObject(in, fullName); + /* and then seek class/inherited filters */ + if (fObj) + fCl = fObj->cl; + } + + /* if we have a filter class -> search up the inheritance hierarchy*/ + if (fCl) { + pl = ComputeOrder(fCl, Super); + if (pl && pl->next) { + /* don't search on the start class again */ + pl = pl->next; + /* now go up the hierarchy */ + for(; pl; pl = pl->next) { + Tcl_Command pi = FindMethod(simpleName, + Tcl_Namespace_cmdTable(pl->cl->nsPtr)); + if (pi) { + CmdListAdd(filterList, pi, /*noDuplicates*/ 0); + /* + fprintf(stderr, " %s::%s, ", ObjStr(pl->cl->object.cmdName), simpleName); + */ + } + } + } + } + } +} + +/* + * Computes a linearized order of filter and instfilter. Then + * duplicates in the full list and with the class inheritance list of + * 'obj' are eliminated. + * The precendence rule is that the last occurence makes it into the + * final list. + */ +static void +FilterComputeOrder(Tcl_Interp *in, XOTclObject *obj) { + XOTclCmdList *filterList = 0, *next, *checker, *newlist; + XOTclClasses *pl; + + if (obj->filterOrder) FilterResetOrder(obj); + /* + fprintf(stderr, " List: ", ObjStr(obj->cmdName)); + */ + + /* append instfilters registered for mixins */ + if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) + MixinComputeDefined(in, obj); + + if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { + XOTclCmdList *ml = obj->mixinOrder; + XOTclClass *mixin; + while (ml) { + mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); + if (mixin && mixin->opt && mixin->opt->instfilters) + FilterComputeOrderFullList(in, &mixin->opt->instfilters, &filterList); + ml = ml->next; + } + } + + /* append per-obj filters */ + if (obj->opt) + FilterComputeOrderFullList(in, &obj->opt->filters, &filterList); + + /* append per-class filters */ + for (pl = ComputeOrder(obj->cl, Super); pl; pl=pl->next) { + XOTclClassOpt* opt = pl->cl->opt; + if (opt && opt->instfilters) { + FilterComputeOrderFullList(in, &opt->instfilters, &filterList); + } + } + + /* + fprintf(stderr, "\n"); + */ + /* use no duplicates & no classes of the precedence order + on the resulting list */ + while (filterList) { + checker = next = filterList->next; + while (checker) { + if (checker->cmdPtr == filterList->cmdPtr) break; + checker = checker->next; + } + if (checker == 0) { + newlist = CmdListAdd(&obj->filterOrder, filterList->cmdPtr, + /*noDuplicates*/ 0); + GuardAddInheritedGuards(in, newlist, obj, filterList->cmdPtr); + /* + fprintf(stderr, " Adding %s::%s,\n", filterList->cmdPtr->nsPtr->fullName, Tcl_GetCommandName(in, filterList->cmdPtr)); + */ + /* + GuardPrint(in, newlist->clientData); + */ + + } + + CmdListDeleteCmdListEntry(filterList, GuardDel); + + filterList = next; + } + /* + fprintf(stderr, "\n"); + */ +} + +/* + * the filter order is either + * DEFINED (there are filter on the instance), + * NONE (there are no filter for the instance), + * or INVALID (a class re-strucuturing has occured, thus it is not clear + * whether filters are defined or not). + * If it is INVALID FilterComputeDefined can be used to compute the order + * and set the instance to DEFINE or NONE + */ +static void +FilterComputeDefined(Tcl_Interp *in, XOTclObject *obj) { + FilterComputeOrder(in, obj); + obj->flags |= XOTCL_FILTER_ORDER_VALID; + if (obj->filterOrder) + obj->flags |= XOTCL_FILTER_ORDER_DEFINED; + else + obj->flags &= ~XOTCL_FILTER_ORDER_DEFINED; +} + +/* + * push a filter stack information on this object + */ +static int +FilterStackPush(Tcl_Interp *in, XOTclObject *obj, Tcl_Obj *calledProc) { + register XOTclFilterStack* h = NEW(XOTclFilterStack); + + h->currentCmdPtr = 0; + h->calledProc = calledProc; + INCR_REF_COUNT(h->calledProc); + h->next = obj->filterStack; + obj->filterStack = h; + return 1; +} + +/* + * pop a filter stack information on this object + */ +static void +FilterStackPop(XOTclObject *obj) { + register XOTclFilterStack *h = obj->filterStack; + obj->filterStack = h->next; + + /* free stack entry */ + DECR_REF_COUNT(h->calledProc); + FREE(XOTclFilterStack, h); +} + +/* + * walk through the filter order until the current filter is reached. + * then use the next filter as current filter. + * + * precondition: obj->filterStack is not NULL + */ +static void +FilterSeekCurrent(Tcl_Interp *in, XOTclObject *obj, XOTclCmdList **cmdList) { + Tcl_Command currentCmd = obj->filterStack->currentCmdPtr; + + assert(obj->flags & XOTCL_FILTER_ORDER_VALID); + /* ensure that the filter order is not invalid, otherwise compute order + FilterComputeDefined(in, obj); + */ + + *cmdList = obj->filterOrder; + + /* go forward to current class */ + while (*cmdList && currentCmd) { + if ((*cmdList)->cmdPtr == currentCmd) + currentCmd = 0; + *cmdList = (*cmdList)->next; + } +} + +/* + * seek through the filters active for "obj" and check whether cmdPtr + * is among them + */ +XOTCLINLINE static int +FilterActiveOnObj(Tcl_Interp *in, XOTclObject *obj, Tcl_Command cmd) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStackContent *bot = cs->content; + register XOTclCallStackContent *csc = cs->top; + while (csc > bot) { + /* only check the callstack entries for this object && + only check the callstack entries for the given cmd */ + if (obj == csc->self && cmd == csc->cmdPtr && + csc->frameType == XOTCL_CSC_TYPE_ACTIVE_FILTER) { + return 1; + } + csc--; + } + return 0; +} + +/* + * search through the filter list on obj and class hierarchy + * for registration of a command ptr as filter + * + * returns a tcl obj list with the filter registration, like: + * " filter , + * " instfilter , + * or an empty list, if not registered + */ +static Tcl_Obj* +FilterFindReg(Tcl_Interp *in, XOTclObject *obj, Tcl_Command cmd) { + Tcl_Obj *list = Tcl_NewListObj(0, NULL); + XOTclClasses* pl; + + /* search per-object filters */ + if (obj->opt && CmdListFindCmdInList(cmd, obj->opt->filters)) { + Tcl_ListObjAppendElement(in, list, obj->cmdName); + Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[FILTER]); + Tcl_ListObjAppendElement(in, list, + Tcl_NewStringObj(Tcl_GetCommandName(in, cmd), -1)); + return list; + } + + /* search per-class filters */ + for (pl = ComputeOrder(obj->cl, Super); pl; pl = pl->next) { + XOTclClassOpt* opt = pl->cl->opt; + if (opt && opt->instfilters) { + if (CmdListFindCmdInList(cmd, opt->instfilters)) { + Tcl_ListObjAppendElement(in, list, pl->cl->object.cmdName); + Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[INSTFILTER]); + Tcl_ListObjAppendElement(in, list, + Tcl_NewStringObj(Tcl_GetCommandName(in, cmd), -1)); + return list; + } + } + } + return list; +} + +/* + * before we can perform a filter dispatch, FilterSearchProc seeks the + * current filter and the relevant calling information + */ +static Tcl_Command +FilterSearchProc(Tcl_Interp *in, XOTclObject *obj, Tcl_ObjCmdProc **proc, ClientData* cp, + Tcl_Command* currentCmd) { + XOTclCmdList *cmdList; + + assert(obj); + assert(obj->filterStack); + + *currentCmd = 0; + *proc = 0; + *cp = 0; + + FilterSeekCurrent(in, obj, &cmdList); + while (cmdList) { + if(Tcl_Command_cmdEpoch(cmdList->cmdPtr)) { + cmdList = cmdList->next; + } else if (FilterActiveOnObj(in, obj, cmdList->cmdPtr)) { + /* + fprintf(stderr, "Filter <%s> -- Active on: %s\n", + Tcl_GetCommandName(in, (Tcl_Command)cmdList->cmdPtr), ObjStr(obj->cmdName)); + */ + obj->filterStack->currentCmdPtr = cmdList->cmdPtr; + FilterSeekCurrent(in, obj, &cmdList); + } else { + /* ok. we' ve found it */ + *proc = Tcl_Command_objProc(cmdList->cmdPtr); + *cp = Tcl_Command_objClientData(cmdList->cmdPtr); + *currentCmd = cmdList->cmdPtr; + /* + fprintf(stderr, "FilterSearchProc - found: %s, %p\n", + Tcl_GetCommandName(in, (Tcl_Command)cmdList->cmdPtr), cmdList->cmdPtr); + */ + return cmdList->cmdPtr; + } + } + return 0; +} + + +/* + * Search default values specified through 'parameter' on one class + */ +static int +SearchDefaultValuesOnClass(Tcl_Interp *in, XOTclObject *obj, + XOTclClass *cmdCl, XOTclClass *targetClass) { + int result = TCL_OK; + register Tcl_HashEntry* entryPtr = 0; + Var* defaults; + Tcl_Namespace *ns = targetClass->object.nsPtr; + + if (ns) { + Tcl_HashTable *varTable = Tcl_Namespace_varTable(ns); + entryPtr = Tcl_FindHashEntry(varTable, "__defaults"); + } else if (targetClass->object.varTable) { + entryPtr = Tcl_FindHashEntry(targetClass->object.varTable, "__defaults"); + } + if (entryPtr) { + defaults = (Var*) Tcl_GetHashValue(entryPtr); + /* + fprintf(stderr, "+++ we have defaults for <%s>\n", + className(targetClass)); + */ + if (TclIsVarArray(defaults)) { + Tcl_HashTable *table = defaults->value.tablePtr; + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr = table ? Tcl_FirstHashEntry(table, &hSrch) : 0; + + for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { + char *varName = Tcl_GetHashKey(table, hPtr); + Tcl_Obj *varNameObj = Tcl_NewStringObj(varName,-1); + Var *val = (Var*)Tcl_GetHashValue(hPtr); + INCR_REF_COUNT(varNameObj); + if (TclIsVarScalar(val)) { + Tcl_Obj *oldValue; + oldValue = XOTclOGetInstVar2((XOTcl_Object*) obj, in, varNameObj, NULL, + TCL_LEAVE_ERR_MSG|TCL_PARSE_PART1); + /** we check whether the variable is already set. + if so, we do not set it again */ + if (oldValue == NULL) { + char *value = ObjStr(val->value.objPtr), *v; + Tcl_Obj *valueObj = val->value.objPtr; + int doSubst = 0; + for (v=value; *v; v++) { + if (*v == '[' && doSubst == 0) + doSubst = 1; + else if ((doSubst == 1 && *v == ']') || *v == '$') { + doSubst = 2; + break; + } + } + if (doSubst == 2) { /* we have to subst */ + Tcl_Obj *ov[2]; + int rc = CallStackPush(in, obj, cmdCl, 0, 1, + &varNameObj, XOTCL_CSC_TYPE_PLAIN); + if (rc != TCL_OK) { + DECR_REF_COUNT(varNameObj); + return rc; + } + ov[1] = valueObj; + Tcl_ResetResult(in); + rc = XOTcl_SubstObjCmd(NULL, in, 2, ov); + CallStackPop(in); + if (rc == TCL_OK) { + valueObj = Tcl_GetObjResult(in); + } else { + DECR_REF_COUNT(varNameObj); + return rc; + } + } + INCR_REF_COUNT(valueObj); + result = XOTclCallMethodWithArg((ClientData)obj, in, + varNameObj, valueObj, 3, 0, 0); + DECR_REF_COUNT(valueObj); + } + } + DECR_REF_COUNT(varNameObj); + } + } + } + return result; +} + +/* + * Search default values specified through 'parameter' on + * mixin and class hierarchy + */ +static int +SearchDefaultValues(Tcl_Interp *in, XOTclObject *obj, XOTclClass *cmdCl) { + XOTcl_FrameDecls; + XOTclClass *cl = obj->cl, *mixin; + XOTclClasses *pl = 0; + XOTclCmdList *ml = 0; + int result = TCL_OK; + + if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) + MixinComputeDefined(in, obj); + if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) + ml = obj->mixinOrder; + + assert(cl); + + XOTcl_PushFrame(in, obj); + + while (ml) { + mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); + result = SearchDefaultValuesOnClass(in, obj, cmdCl, mixin); + if (result != TCL_OK) + break; + ml = ml->next; + } + for (pl = ComputeOrder(cl, Super); pl; pl = pl->next) { + result = SearchDefaultValuesOnClass(in, obj, cmdCl, pl->cl); + if (result != TCL_OK) + break; + } + + XOTcl_PopFrame(in,obj); + return result; +} + +static int +ParameterSearchDefaultsMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + XOTclObject *defaultObj; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc != 2) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "searchDefaults obj"); + if (GetXOTclObjectFromObj(in, objv[1], &defaultObj) != TCL_OK) + return XOTclVarErrMsg(in, "Can't find default object ", + ObjStr(objv[1]), (char *)NULL); + + /* + * Search for default values for vars on superclasses + */ + return SearchDefaultValues(in, defaultObj, defaultObj->cl); +} + +static int +callParameterMethodWithArg(XOTclObject *obj, Tcl_Interp *in, Tcl_Obj *method, + Tcl_Obj *arg, int objc, Tcl_Obj *CONST objv[], int flags) { + XOTclClassOpt* opt = obj->cl->opt; + Tcl_Obj *pcl = (opt && opt->parameterClass) ? opt->parameterClass : + XOTclGlobalObjects[PARAM_CL]; + XOTclClass *paramCl; + int result; + + if (GetXOTclClassFromObj(in,pcl,¶mCl, 1) == TCL_OK) { + result = XOTclCallMethodWithArg((ClientData)paramCl, in, + method, arg, objc, objv, flags); + } + else + result = XOTclVarErrMsg(in, "create: can't find parameter class", (char *)NULL); + return result; +} + + +/* + * method dispatch + */ + +/* actually call a method (with assertion checking) */ +static int +callProcCheck(ClientData cp, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[], + Tcl_Command cmd, XOTclObject *obj, XOTclClass *cl, char *methodName, + int frameType, int isTclProc) { + int result = TCL_OK, callStackPushed = 0; + CheckOptions co; + +#if defined(PROFILE) + long int startUsec, startSec; + struct timeval trt; + + gettimeofday(&trt, NULL); + startSec = trt.tv_sec; + startUsec = trt.tv_usec; +#endif + assert(obj); + + RUNTIME_STATE(in)->callIsDestroy = 0; + + /* + fprintf(stderr,"*** callProcCheck: cmd = %p\n",cmd); + fprintf(stderr, + "cp=%p, isTclProc=%d %p %s, dispatch=%d %p, eval=%d %p, ov[0]=%p\n", + cp, + isTclProc, cmd, + Tcl_GetCommandName(in, cmd), + Tcl_Command_objProc(cmd) == XOTclObjDispatch, XOTclObjDispatch, + Tcl_Command_objProc(cmd) == XOTclOEvalMethod, XOTclOEvalMethod, + objv[0] + ); + */ + if (isTclProc || (Tcl_Command_objProc(cmd) == XOTclObjDispatch) || + (Tcl_Command_objProc(cmd) == XOTclOEvalMethod) ) { + /* push the xotcl info */ + if ((CallStackPush(in, obj, cl, cmd, objc,objv, frameType)) == TCL_OK) + callStackPushed = 1; + else { + result = TCL_ERROR; goto finish; + } + } + +#ifdef CALLSTACK_TRACE + XOTclCallStackTrace(in); +#endif + + if (!isTclProc) { + co = obj->opt ? obj->opt->checkoptions : 0; + if (obj->teardown && (co & CHECK_INVAR) && + ((result = AssertionCheckInvars(in, obj, methodName, co)) == TCL_ERROR)) { + goto finish; + } + +#ifdef DISPATCH_TRACE + printCall(in,"callProcCheck cmd", objc,objv); + /*fprintf(stderr,"\tproc=%s\n",Tcl_GetCommandName(in,cmd));*/ +#endif + result = (*Tcl_Command_objProc(cmd))(cp, in, objc, objv); + +#ifdef DISPATCH_TRACE + printExit(in,"callProcCheck cmd", objc,objv, result); + /*fprintf(stderr, " returnCode %d xotcl rc %d\n", + Tcl_Interp_returnCode(in), RUNTIME_STATE(in)->returnCode);*/ +#endif + + /* + if (obj && obj->teardown && cl && !(obj->flags & XOTCL_DESTROY_CALLED)) { + fprintf(stderr, "Obj= %s ", ObjStr(obj->cmdName)); + fprintf(stderr, "CL= %s ", ObjStr(cl->object.cmdName)); + fprintf(stderr, "method=%s\n", methodName); + } + */ + co = (!RUNTIME_STATE(in)->callIsDestroy) && obj->opt ? obj->opt->checkoptions : 0; + if ((co & CHECK_INVAR) && + ((result = AssertionCheckInvars(in, obj, methodName, co)) == TCL_ERROR)) { + goto finish; + } + } else { + /* isTclProc == 1 + * if this is a filter, check whether its guard applies, + * if not: just step forward to the next filter + */ + if (frameType & XOTCL_CSC_TYPE_FILTER) { + XOTclCmdList *cmdList; + /* + * seek cmd in obj's filterOrder + */ + assert(obj->flags & XOTCL_FILTER_ORDER_VALID); + /* otherwise: FilterComputeDefined(in, obj);*/ + + cmdList = obj->filterOrder; + while (cmdList && cmdList->cmdPtr != cmd) + cmdList = cmdList->next; + + /* + * when it is found, check whether it has a filter guard + */ + if (cmdList) { + int rc = GuardCall(obj, cl, (Tcl_Command) cmdList->cmdPtr, in, + cmdList->clientData, 0); + if (rc != TCL_OK) { + if (rc != TCL_ERROR) { + /* + * call next, use the given objv's, not the callstack objv + * we may not be in a method, thus there may be wrong or + * no callstackobjs + */ + rc = XOTclNextMethod(obj, in, cl, methodName, + objc, objv, /*useCallStackObjs*/ 0); + } + + if (callStackPushed) { + CallStackPop(in); + } + return rc; + } + } + } + + if (obj->teardown && !(obj->flags & XOTCL_DESTROY_CALLED)) { + co = obj->opt ? obj->opt->checkoptions : 0; + if ((co & CHECK_PRE) && + (result = AssertionCheck(in, obj, cl, methodName, CHECK_PRE)) == TCL_ERROR) { + goto finish; + } + } + + if (Tcl_Interp_numLevels(in) <= 2) + RUNTIME_STATE(in)->returnCode = TCL_OK; +#ifdef DISPATCH_TRACE + printCall(in,"callProcCheck tclCmd", objc,objv); + fprintf(stderr,"\tproc=%s\n",Tcl_GetCommandName(in,cmd)); +#endif + result = (*Tcl_Command_objProc(cmd))(cp, in, objc, objv); + +#ifdef DISPATCH_TRACE + printExit(in,"callProcCheck tclCmd", objc,objv, result); + /* fprintf(stderr, " returnCode %d xotcl rc %d\n", + Tcl_Interp_returnCode(in), RUNTIME_STATE(in)->returnCode);*/ +#endif + if (Tcl_Interp_numLevels(in) <= 2 && RUNTIME_STATE(in)->returnCode == TCL_BREAK) + result = TCL_BREAK; + else if (result == TCL_BREAK && RUNTIME_STATE(in)->returnCode == TCL_OK) + RUNTIME_STATE(in)->returnCode = result; + + /* we give the information whether the call has destroyed the + object back to the caller, because after CallStackPop it + cannot be retrieved via the call stack */ + /* if the object is destroyed -> the assertion structs's are already + destroyed */ + co = obj->opt ? obj->opt->checkoptions : 0; + if (!RUNTIME_STATE(in)->callIsDestroy && obj->teardown && (co & CHECK_POST) && + (result = AssertionCheck(in, obj, cl, methodName, CHECK_POST) == TCL_ERROR)) { + goto finish; + } + } + + finish: + if (callStackPushed) + CallStackPop(in); + +#if defined(PROFILE) + if (RUNTIME_STATE(in)->callIsDestroy == 0) { + XOTclProfileEvaluateData(in, startSec, startUsec, obj, cl, methodName); + } +#endif + + return result; +} + +static int +DoCallProcCheck(ClientData cp, ClientData cd, Tcl_Interp *in, + int objc, Tcl_Obj *CONST objv[], + Tcl_Command cmd, XOTclObject *obj, XOTclClass *cl, char *methodName, + int frameType, int fromNext) { + int isTclProc = (TclIsProc((Command *)cmd) != 0); + int xotclCall = 0; + + if (cp) { + if (Tcl_Command_objProc(cmd) == XOTclOEvalMethod) { + /* fprintf(stderr,"calling oeval obj=%p %s\n", obj, ObjStr(obj->cmdName)); + */ + tclCmdClientData *tcd = (tclCmdClientData *)cp; + tcd->obj = (XOTcl_Object*)obj; + xotclCall = 1; + } else if (Tcl_Command_objProc(cmd) == XOTclObjDispatch) + xotclCall = 1; + } else { + xotclCall = 1; + cp = cd; + } + /* + fprintf(stderr,"*** DoCallProcCheck: cmd = %p\n",cmd); + fprintf(stderr, + "DoCallProcCheck cp=%p, tclProc=%d %p %s, dispatch=%d %p, eval=%d %p, ov[0]=%p %d %d\n", + cp, + TclIsProc((Command*)cmd)!=0, cmd, + Tcl_GetCommandName(in, cmd), + Tcl_Command_objProc(cmd) == XOTclObjDispatch, XOTclObjDispatch, + Tcl_Command_objProc(cmd) == XOTclOEvalMethod, XOTclOEvalMethod, + objv[0], xotclCall, fromNext + ); + */ + if ((xotclCall || isTclProc) && !fromNext) { + objc--; + objv++; + } + return callProcCheck(cp, in, objc, objv, cmd, obj, cl, + methodName, frameType, isTclProc); +} + + +XOTCLINLINE static int +DoDispatch(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[], int flags) { + register XOTclObject *obj = (XOTclObject*)cd; + int result, mixinStackPushed = 0, + filterStackPushed = 0, + frameType = XOTCL_CSC_TYPE_PLAIN; +#ifdef OBJDELETION_TRACE + Tcl_Obj *method = objv[1]; +#endif + char *methodName = ObjStr(objv[1]), + *callMethod = methodName; + XOTclClass *cl = 0; + ClientData cp = 0; + Tcl_ObjCmdProc *proc = 0; + Tcl_Command cmd = 0; + Tcl_Obj *cmdName = obj->cmdName; + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + + +#ifdef AUTOVARS + int isNext = isNextString(methodName); +#endif + +#ifdef DISPATCH_TRACE + printCall(in,"DISPATCH", objc,objv); +#endif + +#ifdef OBJDELETION_TRACE + if (method == XOTclGlobalObjects[CLEANUP] || + method == XOTclGlobalObjects[DESTROY]) { + fprintf(stderr, "%s->%s id=%p destroyCalled=%d\n", + ObjStr(cmdName), methodName, obj, + (obj->flags & XOTCL_DESTROY_CALLED)); + } +#endif + + INCR_REF_COUNT(cmdName); + + if (!(obj->flags & XOTCL_FILTER_ORDER_VALID)) + FilterComputeDefined(in, obj); + + if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) + MixinComputeDefined(in, obj); + +#ifdef AUTOVARS + if(!isNext) { +#endif + /* Only start new filter chain, if + (a) filters are defined and + (b) the toplevel csc entry is not an filter on self + */ + if (!(flags & XOTCL_CM_NO_FILTERS) && !cs->guardCount && + ((obj->flags & XOTCL_FILTER_ORDER_DEFINED_AND_VALID) == + XOTCL_FILTER_ORDER_DEFINED_AND_VALID)) { + XOTclObject *self = GetSelfObj(in); + if (obj != self || + cs->top->frameType != XOTCL_CSC_TYPE_ACTIVE_FILTER) { + + filterStackPushed = FilterStackPush(in, obj, objv[1]); + cmd = FilterSearchProc(in, obj, &proc, &cp, + &obj->filterStack->currentCmdPtr); + if (cmd) { /* 'proc' and the other output vars are set as well */ + frameType = XOTCL_CSC_TYPE_ACTIVE_FILTER; + cl = GetClassFromFullName(in, NSCmdFullName(cmd)); + callMethod = (char*) Tcl_GetCommandName(in, cmd); + /* RUNTIME_STATE(in)->filterCalls++; */ + } else { + FilterStackPop(obj); + filterStackPushed = 0; + } + } + } + + /* check if a mixin is to be called. + don't use mixins on next method calls, since normally it is not + intercepted (it is used as a primitive command). + don't use mixins on init calls, since init is invoked on mixins + during mixin registration (in XOTclOMixinMethod) + */ + + if ((obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) == + XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { + + mixinStackPushed = MixinStackPush(obj); + + if (frameType != XOTCL_CSC_TYPE_ACTIVE_FILTER) { + cmd = MixinSearchProc(in, obj, methodName, &cl, &proc, &cp, + &obj->mixinStack->currentCmdPtr); + if (cmd) { /* 'proc' and the other output vars are set as well */ + frameType = XOTCL_CSC_TYPE_MIXIN; + } else { /* the else branch could be deleted */ + MixinStackPop(obj); + mixinStackPushed = 0; + } + } + } +#ifdef AUTOVARS + } +#endif + + /* if no filter/mixin is found => do ordinary method lookup */ + if (proc == 0) { + if (obj->nsPtr) + cmd = FindMethod(methodName, Tcl_Namespace_cmdTable(obj->nsPtr)); + + if (cmd == NULL) + cl = SearchCMethod(obj->cl, methodName, &cmd); + + if (cmd) { + proc = Tcl_Command_objProc(cmd); + cp = Tcl_Command_objClientData(cmd); + } else { + assert(cp == 0); + } + } + + if (proc && ((result = DoCallProcCheck(cp, cd, in, objc, objv, cmd, obj, cl, + callMethod, frameType, 0 /* fromNext */)) + != XOTCL_UNKNOWN)) { + if (result == TCL_ERROR) + XOTclErrInProc(in, cmdName, cl?cl->object.cmdName:NULL, callMethod); + + } else if (XOTclObjectIsClass(obj) && (flags & XOTCL_CM_NO_UNKNOWN)) { + Tcl_AppendResult(in, ObjStr(objv[0]), ": unable to dispatch method '", + callMethod, "'", 0); + result = TCL_ERROR; + } else if (objv[1] != XOTclGlobalObjects[UNKNOWN]) { + /* + * back off and try unknown; + */ + XOTclObject *obj = (XOTclObject*)cd; + DEFINE_NEW_TCL_OBJS_ON_STACK(objc+1, tov); + /* + fprintf(stderr,"calling unknown for %s %s ... flags=%02x,%02x isClass=%d %p %s\n", + ObjStr(obj->cmdName), ObjStr(objv[1]), flags, XOTCL_CM_NO_UNKNOWN, + XOTclObjectIsClass(obj), obj, ObjStr(obj->cmdName)); + */ + tov[0] = obj->cmdName; + tov[1] = XOTclGlobalObjects[UNKNOWN]; + if (objc>1) + memcpy(tov+2, objv+1, sizeof(Tcl_Obj *)*(objc-1)); + /* + fprintf(stderr,"?? %s unknown %s\n",ObjStr(obj->cmdName), ObjStr(tov[2])); + */ + result = DoDispatch(cd, in, objc+1, tov, flags | XOTCL_CM_NO_UNKNOWN); + FREE_TCL_OBJS_ON_STACK(tov); + + } else { /* unknwon failed */ + Tcl_AppendResult(in, ObjStr(objv[0]), ": unable to dispatch method '", + ObjStr(objv[2]), "'", 0); + result = TCL_ERROR; + } + +#ifdef DISPATCH_TRACE + printExit(in,"DISPATCH", objc,objv, result); + fprintf(stderr,"obj %p mixinStackPushed %d mixinStack %p\n", + obj, mixinStackPushed, obj->mixinStack); +#endif + + if (obj && !(obj->flags & XOTCL_DESTROY_CALLED)/* !isDestroyed*/) { + if (mixinStackPushed && obj->mixinStack) + MixinStackPop(obj); + + if (filterStackPushed && obj->filterStack) + FilterStackPop(obj); + } + + DECR_REF_COUNT(cmdName); /* must be after last dereferencing of obj */ + return result; +} + +static int +ObjDispatch(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[], + int flags) { + int result; + +#ifdef STACK_TRACE + XOTclStackTrace(in); +#endif + +#ifdef CALLSTACK_TRACE + XOTclCallStackTrace(in); +#endif + + if (objc == 1) { + Tcl_Obj *tov[2]; + tov[0] = objv[0]; + tov[1] = XOTclGlobalObjects[DEFAULTMETHOD]; + result = DoDispatch(cd, in, 2, tov, flags); + } else { + /* try normal dispatch */ + result = DoDispatch(cd, in, objc, objv, flags); + } + + assert(result != XOTCL_UNKNOWN); + return result; +} + +#ifdef XOTCL_BYTECODE +int +XOTclDirectSelfDispatch(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + int result; +#ifdef XOTCLOBJ_TRACE + XOTclObject *obj; +#endif + objTrace("BEFORE SELF DISPATCH", obj); + result = ObjDispatch((ClientData)GetSelfObj(in), in, objc, objv, 0); + objTrace("AFTER SELF DISPATCH", obj); + return result; +} +#endif + +int +XOTclObjDispatch(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + return ObjDispatch(cd, in, objc, objv, 0); +} + +/* + * Proc-Creation + */ + +static int +MakeProc(Tcl_Namespace* ns, XOTclAssertionStore* aStore, + Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + int result, oc = objc; + Tcl_CallFrame frame; + Tcl_Obj *oldBody; + char *body; +#ifdef AUTOVARS + char *p; +#endif + oldBody = objv[3]; + body = ObjStr(oldBody); + + objv[3] = Tcl_NewStringObj("", 0); + INCR_REF_COUNT(objv[3]); + + Tcl_AppendStringsToObj(objv[3], "::xotcl::initProcNS\n", NULL); + +#ifdef AUTOVARS + if ((p = strstr(body, "self")) && p != body && *(p-1) != '[') + Tcl_AppendStringsToObj(objv[3], "::set self [self]\n", NULL); + if (strstr(body, "proc")) + Tcl_AppendStringsToObj(objv[3], "::set proc [self proc]\n", NULL); + if (strstr(body, "class")) + Tcl_AppendStringsToObj(objv[3], "::set class [self class]\n", NULL); +#endif + + Tcl_AppendStringsToObj(objv[3], body, NULL); + Tcl_PushCallFrame(in,&frame,ns,0); + + if (objc > 4) oc = 4; + result = Tcl_ProcObjCmd(0, in, oc, objv) != TCL_OK; + Tcl_PopCallFrame(in); + + if (objc == 6) + AssertionAddProc(in, ObjStr(objv[1]), aStore, objv[4], objv[5]); + + DECR_REF_COUNT(objv[3]); + objv[3] = oldBody; + + return result; +} + +/* + * List-Functions for Info + */ +static int +ListInfo(Tcl_Interp *in, int isclass) { + Tcl_ResetResult(in); + Tcl_AppendElement(in, "vars"); Tcl_AppendElement(in, "body"); + Tcl_AppendElement(in, "default"); Tcl_AppendElement(in, "args"); + Tcl_AppendElement(in, "procs"); Tcl_AppendElement(in, "commands"); + Tcl_AppendElement(in, "class"); Tcl_AppendElement(in, "children"); + Tcl_AppendElement(in, "filter"); Tcl_AppendElement(in, "filterguard"); + Tcl_AppendElement(in, "info"); + Tcl_AppendElement(in, "invar"); Tcl_AppendElement(in, "mixin"); + Tcl_AppendElement(in, "methods"); + Tcl_AppendElement(in, "parent"); + Tcl_AppendElement(in, "pre"); Tcl_AppendElement(in, "post"); + if (isclass) { + Tcl_AppendElement(in, "superclass"); Tcl_AppendElement(in, "subclass"); + Tcl_AppendElement(in, "heritage"); Tcl_AppendElement(in, "instances"); + Tcl_AppendElement(in, "instcommands"); Tcl_AppendElement(in, "instprocs"); + Tcl_AppendElement(in, "instdefault"); Tcl_AppendElement(in, "instbody"); + Tcl_AppendElement(in, "instmixin"); + Tcl_AppendElement(in, "classchildren"); Tcl_AppendElement(in, "classparent"); + Tcl_AppendElement(in, "instfilter"); Tcl_AppendElement(in, "instfilterguard"); + Tcl_AppendElement(in, "instinvar"); + Tcl_AppendElement(in, "instpre"); Tcl_AppendElement(in, "instpost"); + Tcl_AppendElement(in, "parameter"); + } + return TCL_OK; +} + +XOTCLINLINE static int +noMetaChars(char *pattern) { + register char c, *p = pattern; + assert(pattern); + for (c=*p; c; c = *++p) { + if (c == '*' || c == '[') { + return 0; + } + } + return 1; +} + +static int +ListKeys(Tcl_Interp *in, Tcl_HashTable *table, char *pattern) { + Tcl_HashEntry* hPtr; + char *key; + + if (pattern && noMetaChars(pattern)) { + hPtr = table ? Tcl_FindHashEntry(table, pattern) : 0; + if (hPtr) { + key = Tcl_GetHashKey(table, hPtr); + Tcl_SetResult(in, key, TCL_VOLATILE); + } else { + Tcl_SetObjResult(in, XOTclGlobalObjects[EMPTY]); + } + } else { + Tcl_Obj *list = Tcl_NewListObj(0, NULL); + Tcl_HashSearch hSrch; + hPtr = table ? Tcl_FirstHashEntry(table, &hSrch) : 0; + for (; hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { + key = Tcl_GetHashKey(table, hPtr); + if (!pattern || Tcl_StringMatch(key, pattern)) { + Tcl_ListObjAppendElement(in, list, Tcl_NewStringObj(key,-1)); + } + } + Tcl_SetObjResult(in, list); + } + return TCL_OK; +} + +static int +varExists(Tcl_Interp *in, XOTclObject *obj, char *varName) { + XOTcl_FrameDecls; + Var *varPtr; + int result; +#if defined(PRE83) + Var *arrayPtr; +#endif + + XOTcl_PushFrame(in, obj); + +#if defined(PRE83) + varPtr = TclLookupVar(in, varName, (char *) NULL, TCL_PARSE_PART1, "access", + /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr); +#else + varPtr = TclVarTraceExists(in, varName); +#endif + result = ((varPtr != NULL) && !TclIsVarUndefined(varPtr)); + + XOTcl_PopFrame(in, obj); + + return result; +} + +static int +ListVars(Tcl_Interp *in, XOTclObject *obj, char *pattern) { + Tcl_Obj *varlist, *okList, *element; + int i, length; + + if (obj->nsPtr) { + Tcl_HashTable *varTable = Tcl_Namespace_varTable(obj->nsPtr); + ListKeys(in, varTable, pattern); + } else { + ListKeys(in, obj->varTable, pattern); + } + varlist = Tcl_GetObjResult(in); + Tcl_ListObjLength(in, varlist, &length); + okList = Tcl_NewListObj(0, NULL); + for (i=0; icmdName); + } else { + Tcl_SetObjResult(in, XOTclGlobalObjects[EMPTY]); + } + } else { + Tcl_Obj *list = Tcl_NewListObj(0, NULL); + Tcl_HashSearch hSrch; + hPtr = table ? Tcl_FirstHashEntry(table, &hSrch) : 0; + for (; hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { + XOTclObject *obj = (XOTclObject*)Tcl_GetHashKey(table, hPtr); + if (!pattern || Tcl_StringMatch(ObjStr(obj->cmdName), pattern)) { + Tcl_ListObjAppendElement(in, list, obj->cmdName); + } + } + Tcl_SetObjResult(in, list); + } + return TCL_OK; +} + +static int +ListMethodKeys(Tcl_Interp *in, Tcl_HashTable *table, char *pattern, + int noProcs, int noCmds, int noDups) { + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr = table ? Tcl_FirstHashEntry(table, &hSrch) : 0; + for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { + char *key = Tcl_GetHashKey(table, hPtr); + Tcl_Command cmd = (Tcl_Command)Tcl_GetHashValue(hPtr); + Tcl_ObjCmdProc* proc = Tcl_Command_objProc(cmd); + + if (pattern && !Tcl_StringMatch(key, pattern)) continue; + if (noCmds && proc != RUNTIME_STATE(in)->objInterpProc) continue; + if (noProcs && proc == RUNTIME_STATE(in)->objInterpProc) continue; + if (noDups) { + int listc, i; + Tcl_Obj **listv; + int result = Tcl_ListObjGetElements(in, Tcl_GetObjResult(in), &listc, &listv); + size_t keylen = strlen(key); + if (result == TCL_OK) { + int found = 0; + for (i=0; insPtr) { + Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(obj->nsPtr); + ListMethodKeys(in, cmdTable, pattern, noProcs, noCmds, 0); + } + + if (!noMixins) { + if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) + MixinComputeDefined(in, obj); + if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { + XOTclCmdList *ml = obj->mixinOrder; + XOTclClass *mixin; + while (ml) { + int guardOk = TCL_OK; + mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); + if (inContext) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + if (!cs->guardCount) { + guardOk = GuardCall(obj, 0, 0, in, ml->clientData, 1); + } + } + if (mixin && guardOk == TCL_OK) { + Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(mixin->nsPtr); + ListMethodKeys(in, cmdTable, pattern, noProcs, noCmds, 1); + } + ml = ml->next; + } + } + } + + /* append per-class filters */ + for (pl = ComputeOrder(obj->cl, Super); pl; pl = pl->next) { + Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(pl->cl->nsPtr); + ListMethodKeys(in, cmdTable, pattern, noProcs, noCmds, 1); + } + return TCL_OK; +} + +static int XOTclCInfoMethod(ClientData d, Tcl_Interp *h, int i, Tcl_Obj *CONST v[]); + +static int +ListClass(Tcl_Interp *in, XOTclObject *obj, char *pattern, + int objc, Tcl_Obj *CONST objv[]) { + if (pattern == 0) { + Tcl_SetObjResult(in, obj->cl->object.cmdName); + return TCL_OK; + } else { + int result; + DEFINE_NEW_TCL_OBJS_ON_STACK(objc, ov); + + memcpy(ov, objv, sizeof(Tcl_Obj *)*objc); + ov[1] = Tcl_NewStringObj("superclass", 10); + INCR_REF_COUNT(ov[1]); + result = XOTclCInfoMethod((ClientData)obj->cl, in, objc, ov); + DECR_REF_COUNT(ov[1]); + FREE_TCL_OBJS_ON_STACK(ov); + return result; + } +} + +static int +ListSuperclasses(Tcl_Interp *in, XOTclClass *cl, char *pattern) { + if (pattern == 0) { + XOTclClasses* sl = cl->super; + XOTclClasses* sc = 0; + + /* + * reverse the list to obtain presentation order + */ + + Tcl_ResetResult(in); + while (sc != sl) { + XOTclClasses* nl = sl; + while (nl->next != sc) nl = nl->next; + Tcl_AppendElement(in, className(nl->cl)); + sc = nl; + } + } else { + XOTclClass *isc = GetClass(in, pattern); + XOTclClasses* pl; + if (isc == 0) return XOTclErrBadVal(in, "a class", pattern); + + /* + * search precedence to see if we're related or not + */ + for (pl = ComputeOrder(cl, Super); pl; pl = pl->next) { + if (pl->cl == isc) { + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + break; + } + } + if (pl == 0) + Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + } + return TCL_OK; +} + +static int +ListSubclasses(Tcl_Interp *in, XOTclClass *cl, char *pattern) { + if (pattern == 0) { + XOTclClasses* sl = cl->sub; + XOTclClasses* sc = 0; + + /* + * order unimportant + */ + Tcl_ResetResult(in); + for (sc = sl; sc != 0; sc = sc->next) + Tcl_AppendElement(in, className(sc->cl)); + } else { + XOTclClass *isc = GetClass(in, pattern); + XOTclClasses* pl; + XOTclClasses* saved; + + if (isc == 0) return XOTclErrBadVal(in, "a class", pattern); + saved = cl->order; + cl->order = 0; + + /* + * search precedence to see if we're related or not + */ + for (pl = ComputeOrder(cl, Sub); pl; pl = pl->next) { + if (pl->cl == isc) { + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + break; + } + } + if (pl == 0) + Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + + XOTclFreeClasses(cl->order); + cl->order = saved; + } + return TCL_OK; +} + + + +static int +ListHeritage(Tcl_Interp *in, XOTclClass *cl, char *pattern) { + XOTclClasses* pl = ComputeOrder(cl, Super); + if (pl) pl = pl->next; + Tcl_ResetResult(in); + for (; pl != 0; pl = pl->next) { + char *name = className(pl->cl); + if (pattern && !Tcl_StringMatch(name, pattern)) continue; + Tcl_AppendElement(in, name); + } + return TCL_OK; +} + +static Proc* +FindProc(Tcl_Interp *in, Tcl_HashTable *table, char *name) { + Tcl_HashEntry* hPtr = table ? Tcl_FindHashEntry(table, name) : 0; + if (hPtr) { + Tcl_Command cmd = (Tcl_Command)Tcl_GetHashValue(hPtr); + Tcl_ObjCmdProc *proc = Tcl_Command_objProc(cmd); + if (proc == RUNTIME_STATE(in)->objInterpProc) + return (Proc*) Tcl_Command_objClientData(cmd); + else if ((Tcl_CmdProc*)proc == RUNTIME_STATE(in)->interpProc) + return (Proc*) Tcl_Command_clientData(cmd); + } + return 0; +} + +static int +ListProcArgs(Tcl_Interp *in, Tcl_HashTable *table, char *name) { + Proc* proc = FindProc(in, table, name); + if (proc) { + CompiledLocal *args = proc->firstLocalPtr; + Tcl_ResetResult(in); + for (;args != NULL; args = args->nextPtr) { + if TclIsVarArgument(args) + Tcl_AppendElement(in, args->name); + + } + return TCL_OK; + } + return XOTclErrBadVal(in, "a tcl method name", name); +} + +static int +GetProcDefault(Tcl_Interp *in, Tcl_HashTable *table, + char *name, char *arg, Tcl_Obj **resultObj) { + Proc* proc = FindProc(in, table, name); + *resultObj = 0; + if (proc) { + CompiledLocal *ap; + for (ap = proc->firstLocalPtr; ap != 0; ap = ap->nextPtr) { + if (!TclIsVarArgument(ap)) continue; + if (strcmp(arg, ap->name) != 0) continue; + + if (ap->defValuePtr != NULL) { + *resultObj = ap->defValuePtr; + return TCL_OK; + } + return TCL_OK; + } + } + return TCL_ERROR; +} + + +static int +ListProcDefault(Tcl_Interp *in, Tcl_HashTable *table, + char *name, char *arg, Tcl_Obj *var) { + Tcl_Obj *defVal; + int result; + if (GetProcDefault(in, table, name, arg, &defVal) == TCL_OK) { + callFrameContext ctx = {0}; + CallStackUseActiveFrames(in,&ctx); + + if (defVal != 0) { + if (Tcl_ObjSetVar2(in, var, 0, defVal, 0) != NULL) { + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + result = TCL_OK; + } else + result = TCL_ERROR; + } else { + if (Tcl_ObjSetVar2(in, var, 0, XOTclGlobalObjects[EMPTY], 0) != NULL) { + Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + return TCL_OK; + } else + result = TCL_ERROR; + } + CallStackRestoreSavedFrames(in, &ctx); + + if (result == TCL_ERROR) { + Tcl_ResetResult(in); + Tcl_AppendResult(in, "couldn't store default value in variable '", + var, "'", (char *) 0); + } + } else { + Tcl_ResetResult(in); + Tcl_AppendResult(in, "procedure '", name, + "' doesn't exist or doesn't have an argument '", + arg, "'", (char *) 0); + result = TCL_ERROR; + } + return result; +} + +static int +ListProcBody(Tcl_Interp *in, Tcl_HashTable *table, char *name) { + Proc* proc = FindProc(in, table, name); + + if (proc) { + char *body = ObjStr(proc->bodyPtr); + if (strncmp(body, "::xotcl::initProcNS\n",20) == 0) + body+=20; + Tcl_SetObjResult(in, Tcl_NewStringObj(body, -1)); + return TCL_OK; + } + return XOTclErrBadVal(in, "a tcl method name", name); +} + +static int +ListChildren(Tcl_Interp *in, XOTclObject *obj, char *pattern, int classesOnly) { + XOTclObject *childobj; + Tcl_HashTable *cmdTable; + XOTcl_FrameDecls; + + if (!obj->nsPtr) return TCL_OK; + cmdTable = Tcl_Namespace_cmdTable(obj->nsPtr); + + if (pattern && noMetaChars(pattern)) { + XOTcl_PushFrame(in, obj); + if ((childobj = GetObject(in, pattern)) && + (!classesOnly || XOTclObjectIsClass(childobj))) { + Tcl_SetObjResult(in, childobj->cmdName); + } else { + Tcl_SetObjResult(in, XOTclGlobalObjects[EMPTY]); + } + XOTcl_PopFrame(in,obj); + } else { + Tcl_Obj *list = Tcl_NewListObj(0, NULL); + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr = Tcl_FirstHashEntry(cmdTable, &hSrch); + XOTcl_PushFrame(in, obj); + for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { + char *key = Tcl_GetHashKey(cmdTable, hPtr); + if (!pattern || Tcl_StringMatch(key, pattern)) { + if ((childobj = GetObject(in, key)) && + (!classesOnly || XOTclObjectIsClass(childobj))) { + Tcl_ListObjAppendElement(in, list, childobj->cmdName); + } + } + } + XOTcl_PopFrame(in,obj); + Tcl_SetObjResult(in, list); + } + return TCL_OK; +} + +static int +ListParent(Tcl_Interp *in, XOTclObject *obj) { + if (obj->id) { + Tcl_SetResult(in, NSCmdFullName(obj->id), TCL_VOLATILE); + } + return TCL_OK; +} + +static XOTclClass* +FindCalledClass(Tcl_Interp *in, XOTclObject *obj) { + char *methodName = 0; + XOTclClass *cl; + Tcl_Command cmd = NULL; + XOTclCallStackContent *csc = CallStackGetTopFrame(in); + + if (csc->frameType == XOTCL_CSC_TYPE_PLAIN) + return GetSelfClass(in); + + if (csc->frameType & XOTCL_CSC_TYPE_FILTER) + methodName = ObjStr(csc->filterStackEntry->calledProc); + else if (csc->frameType == XOTCL_CSC_TYPE_MIXIN && obj->mixinStack) + methodName = (char*) GetSelfProc(in); + + if (!methodName) methodName = ""; + + if (obj->nsPtr) + cmd = FindMethod(methodName, Tcl_Namespace_cmdTable(obj->nsPtr)); + + if (cmd) { + cl = 0; + } else { + cl = SearchCMethod(obj->cl, methodName, &cmd); + } + return cl; +} + +/* + * Next Primitive Handling + */ +XOTCLINLINE static void +NextSearchMethod(XOTclObject *obj, Tcl_Interp *in, XOTclCallStackContent *csc, + XOTclClass **cl, char **method, Tcl_ObjCmdProc **proc, Tcl_Command *cmd, + ClientData *cp, int* isMixinEntry, int* isFilterEntry, + int* endOfFilterChain, Tcl_Command* currentCmd) { + XOTclClasses *pl = 0; + int endOfChain = 0; + *endOfFilterChain = 0; + + /* + * Next in filters + */ + /*assert(obj->flags & XOTCL_FILTER_ORDER_VALID); *** strange, worked before ****/ + FilterComputeDefined(in, obj); + + if ((obj->flags & XOTCL_FILTER_ORDER_VALID) && + obj->filterStack && + obj->filterStack->currentCmdPtr) { + *cmd = FilterSearchProc(in, obj, proc, cp, currentCmd); + if (*proc == 0) { + if (csc->frameType == XOTCL_CSC_TYPE_ACTIVE_FILTER) { + /* reset the information to the values of method, cl + to the values they had before calling the filters */ + *method = ObjStr(obj->filterStack->calledProc); + endOfChain = 1; + *endOfFilterChain = 1; + *cl = 0; + } + } else { + *method = (char*) Tcl_GetCommandName(in, *cmd); + *cl = GetClassFromFullName(in, NSCmdFullName(*cmd)); + *isFilterEntry = 1; + return; + } + } + + /* + * Next in Mixins + */ + assert(obj->flags & XOTCL_MIXIN_ORDER_VALID); + /* otherwise: MixinComputeDefined(in, obj); */ + + if ((obj->flags & XOTCL_MIXIN_ORDER_VALID) && obj->mixinStack) { + *cmd = MixinSearchProc(in, obj, *method, cl, proc, cp, currentCmd); + if (*proc == 0) { + if (csc->frameType == XOTCL_CSC_TYPE_ACTIVE_MIXIN) { + endOfChain = 1; + *cl = 0; + } + } else { + *isMixinEntry = 1; + return; + } + } + + /* + * otherwise: normal method dispatch + * + * if we are already in the precedence ordering, then advance + * past our last point; otherwise (if cl==0) begin from the start + */ + + /* if a mixin or filter chain has ended -> we have to search + the obj-specific methods as well */ + + if (obj->nsPtr && endOfChain) { + *cmd = FindMethod(*method, Tcl_Namespace_cmdTable(obj->nsPtr)); + } else { + *cmd = 0; + } + + + if (!*cmd) { + for (pl = ComputeOrder(obj->cl, Super); pl && *cl; pl = pl->next) { + if (pl->cl == *cl) + *cl = 0; + } + + /* + * search for a further class method + */ + *cl = SearchPLMethod(pl, *method, cmd); + } else { + *cl = 0; + } + + if (*cmd) { + *proc = Tcl_Command_objProc(*cmd); + *cp = Tcl_Command_objClientData(*cmd); + } + + return; +} + +static int +XOTclNextMethod(XOTclObject *obj, Tcl_Interp *in, XOTclClass *givenCl, + char *givenMethod, int objc, Tcl_Obj *CONST objv[], + int useCallstackObjs) { + XOTclCallStackContent *csc = CallStackGetTopFrame(in); + Tcl_ObjCmdProc *proc = 0; + Tcl_Command cmd, currentCmd = NULL; + ClientData cp = 0; + int result = TCL_OK, + frameType = XOTCL_CSC_TYPE_PLAIN, + isMixinEntry = 0, isFilterEntry = 0, + endOfFilterChain = 0; + int nobjc; Tcl_Obj **nobjv; + XOTclClass **cl = &givenCl; + char **method = &givenMethod; + + /* if no args are given => use args from stack */ + if (objc < 2 && useCallstackObjs) { + nobjc = Tcl_CallFrame_objc(csc->currentFramePtr); + nobjv = (Tcl_Obj **)Tcl_CallFrame_objv(csc->currentFramePtr); + } else { + nobjc = objc; + nobjv = (Tcl_Obj **)objv; + } + + /* + * Search the next method & compute its method data + */ + NextSearchMethod(obj, in, csc, cl, method, &proc, &cmd, &cp, + &isMixinEntry, &isFilterEntry, &endOfFilterChain, ¤tCmd); + + /* + fprintf(stderr, "NextSearchMethod -- RETURN: method=%s", *method); + if (obj) + fprintf(stderr, " obj=%s,", ObjStr(obj->cmdName)); + if ((*cl)) + fprintf(stderr, " cl=%s,", (*cl)->nsPtr->fullName); + fprintf(stderr, " mixin=%d, filter=%d, proc=%p\n", + isMixinEntry, isFilterEntry, proc); + */ + + /* + * change mixin state + */ + if (obj->mixinStack) { + if (csc->frameType == XOTCL_CSC_TYPE_ACTIVE_MIXIN) + csc->frameType = XOTCL_CSC_TYPE_INACTIVE_MIXIN; + + /* otherwise move the command pointer forward */ + if (isMixinEntry) { + frameType = XOTCL_CSC_TYPE_MIXIN; + obj->mixinStack->currentCmdPtr = currentCmd; + } + } + /* + * change filter state + */ + if (obj->filterStack) { + if (csc->frameType == XOTCL_CSC_TYPE_ACTIVE_FILTER) + csc->frameType = XOTCL_CSC_TYPE_INACTIVE_FILTER; + + /* otherwise move the command pointer forward */ + if (isFilterEntry) { + frameType = XOTCL_CSC_TYPE_ACTIVE_FILTER; + obj->filterStack->currentCmdPtr = currentCmd; + } + } + + Tcl_ResetResult(in); /* needed for bytecode support */ + + /* + * now actually call the "next" method + */ + if (proc != 0) { + /* cut the flag, that no stdargs should be used, if it is there */ + if (nobjc > 1) { + char *nobjv1 = ObjStr(nobjv[1]); + if (nobjv1[0] == '-' && !strcmp(nobjv1, "--noArgs")) + nobjc = 1; + } + csc->callsNext = 1; + result = DoCallProcCheck(cp, (ClientData)obj, in, nobjc, nobjv, cmd, + obj, *cl, *method, frameType, 1/*fromNext*/); + csc->callsNext = 0; + if (csc->frameType == XOTCL_CSC_TYPE_INACTIVE_FILTER) + csc->frameType = XOTCL_CSC_TYPE_ACTIVE_FILTER; + else if (csc->frameType == XOTCL_CSC_TYPE_INACTIVE_MIXIN) + csc->frameType = XOTCL_CSC_TYPE_ACTIVE_MIXIN; + } else if (result == TCL_OK && endOfFilterChain) { + result = XOTCL_UNKNOWN; + } + + return result; +} + +int +XOTclNextObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclCallStackContent *csc = CallStackGetTopFrame(in); + + if (!csc->self) + return XOTclVarErrMsg(in, "next: can't find self", (char *)NULL); + + if (!csc->cmdPtr) + return XOTclErrMsg(in, "next: no executing proc", TCL_STATIC); + + return XOTclNextMethod(csc->self, in, csc->cl, + (char*)Tcl_GetCommandName(in, csc->cmdPtr), objc, objv, 1); +} + +static int +XOTclONextMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStackContent *csc = CallStackGetTopFrame(in); + char *methodName; + + for (; csc >= cs->content; csc--) { + if (csc->self == obj) break; + } + if (csccontent) + return XOTclVarErrMsg(in, "next: can't find object", ObjStr(obj->cmdName), NULL); + methodName = (char*)Tcl_GetCommandName(in, csc->cmdPtr); + /*fprintf(stderr,"******* next for proc %s\n", methodName);*/ + return XOTclNextMethod(obj, in, csc->cl, methodName, objc-1, &objv[1], 0); +} + + +/* + * "self" object command + */ + +static int +FindSelfNext(Tcl_Interp *in, XOTclObject *obj) { + XOTclCallStackContent *csc = CallStackGetTopFrame(in); + Tcl_ObjCmdProc *proc = 0; + Tcl_Command cmd, currentCmd = 0; + ClientData cp = 0; + int isMixinEntry = 0, + isFilterEntry = 0, + endOfFilterChain = 0; + XOTclClass *cl = csc->cl; + XOTclObject *o = csc->self; + char *methodName; + + Tcl_ResetResult(in); + + methodName = (char*) GetSelfProc(in); + if (!methodName) + return TCL_OK; + + NextSearchMethod(o, in, csc, &cl, &methodName, &proc, &cmd, &cp, + &isMixinEntry, &isFilterEntry, &endOfFilterChain, ¤tCmd); + + if (cmd) { + Tcl_SetObjResult(in, getFullProcQualifier(in, Tcl_GetCommandName(in, cmd), o, cl)); + } + return TCL_OK; +} + +/* +#define checkIsXOTclProcFrame(frame) \ + (((CallFrame*)frame)->isProcCallFrame && ((CallFrame*)frame)->procPtr && \ + ((CallFrame*)frame)->procPtr->cmdPtr && \ + !((CallFrame*)frame)->procPtr->cmdPtr->cmdEpoch && \ + ((CallFrame*)frame)->procPtr->cmdPtr->nsPtr && \ + ((CallFrame*)frame)->procPtr->cmdPtr->nsPtr->deleteProc == NSNamespaceDeleteProc) +*/ + + +static Tcl_Obj * +computeLevelObj(Tcl_Interp *in, CallStackLevel level) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStackContent *csc; + Tcl_Obj *resultObj; + + switch (level) { + case CALLING_LEVEL: csc = XOTclCallStackFindLastInvocation(in, 1); break; + case ACTIVE_LEVEL: csc = XOTclCallStackFindActiveFrame(in, 1); break; + default: csc = NULL; + } + + /*XOTclCallStackTrace(in);*/ + if (cs->top->currentFramePtr == Tcl_Interp_varFramePtr(in) + && csc && csc < cs->top && csc->currentFramePtr) { + /* this was from an xotcl frame, return absolute frame number */ + char buffer[LONG_AS_STRING]; + int l; + buffer[0] = '#'; + XOTcl_ltoa(buffer+1,(long)Tcl_CallFrame_level(csc->currentFramePtr),&l); + resultObj = Tcl_NewStringObj(buffer,l+1); + } else { + /* If not called from an xotcl frame, return 1 as default */ + resultObj = Tcl_NewIntObj(1); + } + return resultObj; +} + +static int +XOTclSelfSubCommand(Tcl_Interp *in, XOTclObject *obj, char *option) { + assert(option); + + if (isProcString(option)) { /* proc subcommand */ + char *procName = (char*) GetSelfProc(in); + if (procName) { + Tcl_SetResult(in, procName, TCL_VOLATILE); + return TCL_OK; + } else + return XOTclVarErrMsg(in, "Can't find proc", (char *)NULL); + } else if (isClassString(option)) { /* class subcommand */ + XOTclClass *cl = GetSelfClass(in); + Tcl_SetObjResult(in, cl ? cl->object.cmdName : XOTclGlobalObjects[EMPTY]); + return TCL_OK; + } else { + XOTclCallStackContent *csc = NULL; + switch (*option) { /* other callstack information */ + case 'a': + if (!strcmp(option, "activelevel")) { + Tcl_SetObjResult(in, computeLevelObj(in, ACTIVE_LEVEL)); + return TCL_OK; + } + case 'c': + if (!strcmp(option, "calledproc")) { + if (!(csc = CallStackFindActiveFilter(in))) + return XOTclVarErrMsg(in, "self calledproc called from outside of a filter", + NULL); + Tcl_SetObjResult(in, csc->filterStackEntry->calledProc); + return TCL_OK; + } else if (!strcmp(option, "calledclass")) { + Tcl_ResetResult(in); + Tcl_AppendResult(in, className(FindCalledClass(in, obj)), (char*) NULL); + return TCL_OK; + } else if (!strcmp(option, "callingproc")) { + csc = XOTclCallStackFindLastInvocation(in, 1); + Tcl_SetResult(in, csc ? (char*)Tcl_GetCommandName(in, csc->cmdPtr) : "", + TCL_VOLATILE); + return TCL_OK; + } else if (!strcmp(option, "callingclass")) { + csc = XOTclCallStackFindLastInvocation(in, 1); + Tcl_SetObjResult(in, csc && csc->cl ? csc->cl->object.cmdName : + XOTclGlobalObjects[EMPTY]); + return TCL_OK; + } else if (!strcmp(option, "callinglevel")) { + Tcl_SetObjResult(in, computeLevelObj(in, CALLING_LEVEL)); + return TCL_OK; + } else if (!strcmp(option, "callingobject")) { + csc = XOTclCallStackFindLastInvocation(in, 1); + Tcl_SetObjResult(in, csc ? csc->self->cmdName : XOTclGlobalObjects[EMPTY]); + return TCL_OK; + } + case 'f': + if (!strcmp(option, "filterreg")) { + if (!(csc = CallStackFindActiveFilter(in))) + return XOTclVarErrMsg(in, "self filterreg called from outside of a filter", + NULL); + Tcl_SetObjResult(in, FilterFindReg(in, obj, GetSelfProcCmdPtr(in))); + return TCL_OK; + case 'n': + if (!strcmp(option, "next")) + return FindSelfNext(in, obj); + default: + return XOTclVarErrMsg(in, "unknown option for ", (char *)NULL); + } + } + } + return TCL_ERROR; +} + +int +XOTclGetSelfObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj; + + if (objc > 2) + return XOTclVarErrMsg(in, "wrong # of args for self", (char *)NULL); + + obj = GetSelfObj(in); + if (!obj) { + if (objc == 2 && !strcmp(ObjStr(objv[1]),"callinglevel")) { + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + return TCL_OK; + } else { + return XOTclVarErrMsg(in, "self: no current object", (char *)NULL); + } + } + + if (objc == 1) { + Tcl_SetObjResult(in, obj->cmdName); + return TCL_OK; + } else { + return XOTclSelfSubCommand(in, obj, ObjStr(objv[1])); + } +} + + +/* + * object creation & destruction + */ + +/* + * mark an obj on the existing callstack, as not destroyed + */ +static void +UndestroyObj(Tcl_Interp *in, XOTclObject *obj) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStackContent *csc; + + /* + * mark the object on the whole callstack as not destroyed + */ + for (csc = &cs->content[1]; csc <= cs->top; csc++) { + if (obj == csc->self && csc->destroyedCmd != 0) { + /* + * The ref count was incremented, when csc->destroyedCmd + * was set. We revert this first before forgetting the + * destroyedCmd. + */ + if (Tcl_Command_refCount(csc->destroyedCmd) > 1) { + Tcl_Command_refCount(csc->destroyedCmd)--; + MEM_COUNT_FREE("command refCount",csc->destroyedCmd); + } + csc->destroyedCmd = 0; + } + } + /* + * mark obj->flags XOTCL_DESTROY_CALLED as NOT CALLED (0) + */ + obj->flags &= ~XOTCL_DESTROY_CALLED; +} + +/* + * bring an object into a state, as after initialization + */ +static void +CleanupDestroyObject(Tcl_Interp *in, XOTclObject *obj) { + XOTclClass *thecls, *theobj; + + thecls = RUNTIME_STATE(in)->theClass; + theobj = RUNTIME_STATE(in)->theObject; + /* remove the instance, but not for ::Class/::Object */ + if (obj != &(thecls->object) && obj != &(theobj->object)) + (void)RemoveInstance(obj, obj->cl); + + if (obj->nsPtr) { + NSCleanupNamespace(in, obj->nsPtr); + NSDeleteChildren(in, obj->nsPtr); + } + + if (obj->varTable) { + TclDeleteVars(((Interp *)in), obj->varTable); + ckfree((char*)obj->varTable); + /* + FREE(obj->varTable, obj->varTable);*/ + obj->varTable = 0; + } + + if (obj->opt) { + XOTclObjectOpt *opt = obj->opt; + AssertionRemoveStore(opt->assertions); + opt->assertions = NULL; + +#ifdef XOTCL_METADATA + XOTclMetaDataDestroy(obj); +#endif + + CmdListRemoveList(&opt->mixins, GuardDel); + CmdListRemoveList(&opt->filters, GuardDel); + freeObjectOpt(obj); + } + + obj->flags &= ~XOTCL_MIXIN_ORDER_VALID; + if (obj->mixinOrder) MixinResetOrder(obj); + obj->flags &= ~XOTCL_FILTER_ORDER_VALID; + if (obj->filterOrder) FilterResetOrder(obj); +} + +/* + * do obj initialization & namespace creation + */ +static void +CleanupInitObject(Tcl_Interp *in, XOTclObject *obj, + XOTclClass *cl, Tcl_Namespace *namespacePtr) { +#ifdef OBJDELETION_TRACE + fprintf(stderr,"+++ CleanupInitObject\n"); +#endif + obj->teardown = in; + obj->nsPtr = namespacePtr; + AddInstance(obj, cl); + if (obj->flags & XOTCL_RECREATE) { + obj->opt = 0; + obj->varTable = 0; + obj->mixinOrder = 0; + obj->filterOrder = 0; + obj->flags = 0; + } +} + +/* + * physical object destroy + */ +static void +PrimitiveODestroy(ClientData cd) { + XOTclObject *obj = (XOTclObject*)cd; + Tcl_Interp *in; + Tcl_Command cmd; + + /*fprintf(stderr, "****** PrimitiveODestroy %p\n",obj);*/ + assert(obj && !(obj->flags & XOTCL_DESTROYED)); + + /* + * check and latch against recurrent calls with obj->teardown + */ + PRINTOBJ("PrimitiveODestroy", obj); + + if (!obj || !obj->teardown) return; + in = obj->teardown; + obj->teardown = 0; + + /* + * Don't destroy, if the interpreter is destroyed already + * e.g. TK calls Tcl_DeleteInterp directly, if the window is killed + */ + if (Tcl_InterpDeleted(in)) return; + /* + * call and latch user destroy with obj->id if we haven't + */ + if (!(obj->flags & XOTCL_DESTROY_CALLED)) { + callDestroyMethod(cd, in, obj, 0); + obj->id = 0; + } + +#ifdef OBJDELETION_TRACE + fprintf(stderr," physical delete of %p id=%p destroyCalled=%d '%s'\n", + obj, obj->id, (obj->flags & XOTCL_DESTROY_CALLED), ObjStr(obj->cmdName)); +#endif + + CleanupDestroyObject(in, obj); + + while (obj->mixinStack != NULL) + MixinStackPop(obj); + while (obj->filterStack != NULL) + FilterStackPop(obj); + + cmd = Tcl_FindCommand(in, ObjStr(obj->cmdName), 0, 0); + + if (cmd != NULL) + Tcl_Command_deleteProc(cmd) = 0; + + if (obj->nsPtr) { + XOTcl_DeleteNamespace(in, obj->nsPtr); + obj->nsPtr = 0; + } + + /*fprintf(stderr, " +++ OBJ/CLS free: %s\n", ObjStr(obj->cmdName));*/ + + obj->flags |= XOTCL_DESTROYED; + objTrace("ODestroy", obj); +#if REFCOUNT_TRACE + fprintf(stderr,"ODestroy %p flags %d rc %d destr %d dc %d\n", + obj, obj->flags, + (obj->flags & XOTCL_REFCOUNTED) != 0, + (obj->flags & XOTCL_DESTROYED) != 0, + (obj->flags & XOTCL_DESTROY_CALLED) != 0 + ); +#endif +#if REFCOUNTED + if (!(obj->flags & XOTCL_REFCOUNTED)) { + DECR_REF_COUNT(obj->cmdName); + } +#else + DECR_REF_COUNT(obj->cmdName); +#endif + + XOTclCleanupObject(obj); + +#if !defined(NDEBUG) + if (obj != (XOTclObject*)RUNTIME_STATE(in)->theClass) + checkAllInstances(in, RUNTIME_STATE(in)->theClass,0); +#endif +} + +static void +PrimitiveOInit(void* mem, Tcl_Interp *in, char *name, XOTclClass *cl) { + XOTclObject *obj = (XOTclObject*)mem; + +#ifdef OBJDELETION_TRACE + fprintf(stderr,"+++ PrimitiveOInit\n"); +#endif + +#ifdef XOTCLOBJ_TRACE + fprintf(stderr, "OINIT %s = %p\n", name, obj); +#endif + XOTclObjectRefCountIncr(obj); + + /* if the command of the obj was used before, we have to clean + * up the callstack from set "destroyedCmd" flags + */ + UndestroyObj(in, obj); + + if (Tcl_FindNamespace(in, name, NULL, 0)) { + CleanupInitObject(in, obj, cl, + NSGetFreshNamespace(in, (ClientData)obj, name)); + } else { + CleanupInitObject(in, obj, cl, NULL); + } + /*obj->flags = XOTCL_MIXIN_ORDER_VALID | XOTCL_FILTER_ORDER_VALID;*/ + obj->mixinStack = 0; + obj->filterStack = 0; +} + +/* + * Object creation: create object name (full name) and Tcl command + */ +static XOTclObject* +PrimitiveOCreate(Tcl_Interp *in, char *name, XOTclClass *cl) { + XOTclObject *obj = (XOTclObject*)ckalloc(sizeof(XOTclObject)); + Tcl_DString fullName, *fullNamePtr = &fullName; + unsigned length; + char *fn; + +#if defined(XOTCLOBJ_TRACE) + fprintf(stderr, "CKALLOC Object %p %s\n", obj, name); +#endif +#ifdef OBJDELETION_TRACE + fprintf(stderr,"+++ PrimitiveOCreate\n"); +#endif + + memset(obj, 0, sizeof(XOTclObject)); + MEM_COUNT_ALLOC("XOTclObject/XOTclClass",obj); + assert(obj); /* ckalloc panics, if malloc fails */ + + if (*name == ':' && *(name+1) == ':') { + fn = name; + length = strlen(name); + } else { + Tcl_Namespace* currNsPtr = Tcl_GetCurrentNamespace(in); + if (currNsPtr != Tcl_GetGlobalNamespace(in) && + !(currNsPtr->deleteProc == NSNamespaceDeleteProc)) { + ALLOC_NAME_NS(fullNamePtr, currNsPtr->fullName, name); + } else { + ALLOC_TOP_NS(fullNamePtr, name); + } + fn = Tcl_DStringValue(fullNamePtr); + length = Tcl_DStringLength(fullNamePtr); + } + + if (!NSCheckForParent(in, fn, length)) { + if (name != fn) { + DSTRING_FREE(fullNamePtr); + } + ckfree((char*) obj); + return 0; + } + obj->id = Tcl_CreateObjCommand(in, fn, XOTclObjDispatch, + (ClientData)obj, PrimitiveODestroy); + + PrimitiveOInit(obj, in, fn, cl); +#if 0 + /*defined(KEEP_TCL_CMD_TYPE)*/ + /*TclNewObj(obj->cmdName);*/ + obj->cmdName = Tcl_NewStringObj(fn,length); + TclSetCmdNameObj(in, obj->cmdName, (Command*)obj->id); + /*fprintf(stderr, "new command has name '%s'\n", ObjStr(obj->cmdName));*/ +#else + obj->cmdName = NewXOTclObjectObjName(obj, fn, length); +#endif + INCR_REF_COUNT(obj->cmdName); + + objTrace("PrimitiveOCreate", obj); + + if (name != fn) { + DSTRING_FREE(fullNamePtr); + } + return obj; +} + +/* + * Cleanup class: remove filters, mixins, assertions, instances ... + * and remove class from class hierarchy + */ +static void +CleanupDestroyClass(Tcl_Interp *in, XOTclClass *cl) { + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr; + XOTclClass *theobj = RUNTIME_STATE(in)->theObject; + XOTclObject *obj = (XOTclObject*)cl; + XOTclClassOpt* opt = cl->opt; + + if (opt) { + CmdListRemoveList(&opt->instmixins, GuardDel); + MixinInvalidateObjOrders(cl); + + CmdListRemoveList(&opt->instfilters, GuardDel); + FilterInvalidateObjOrders(in, cl); + /* remove dependent filters of this class from all subclasses*/ + FilterRemoveDependentFilterCmds(cl, cl); + AssertionRemoveStore(opt->assertions); +#ifdef XOTCL_OBJECTDATA + XOTclFreeObjectData(cl); +#endif + } + + NSCleanupNamespace(in, cl->nsPtr); + NSDeleteChildren(in, cl->nsPtr); + + /* reset all instances to the class ::Object, that makes no sense + for ::Object itself */ + if (cl != theobj) { + hPtr = &cl->instances ? Tcl_FirstHashEntry(&cl->instances, &hSrch) : 0; + for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { + XOTclObject *inst = (XOTclObject*)Tcl_GetHashKey(&cl->instances, hPtr); + if (inst && (inst != (XOTclObject*)cl) && inst->id) { + if (inst != &(theobj->object)) { + (void)RemoveInstance(inst, obj->cl); + AddInstance(inst, theobj); + } + } + } + } + + Tcl_DeleteHashTable(&cl->instances); + MEM_COUNT_FREE("Tcl_InitHashTable",&cl->instances); + + if (cl->parameters) { + DECR_REF_COUNT(cl->parameters); + } + + if (opt) { + if (opt->parameterClass) { + DECR_REF_COUNT(opt->parameterClass); + } + freeClassOpt(cl); + } + + /* + * flush all caches, unlink superclasses + */ + + FlushPrecedences(cl); + while (cl->sub) { + XOTclClass *subClass = cl->sub->cl; + (void)RemoveSuper(subClass, cl); + /* if there are no more super classes add the Object + * class as superclasses + * -> don't do that for Object itself! + */ + if (subClass->super == 0 && cl != theobj) + AddSuper(subClass, theobj); + } + while (cl->super) (void)RemoveSuper(cl, cl->super->cl); +} + +/* + * do class initialization & namespace creation + */ +static void +CleanupInitClass(Tcl_Interp *in, XOTclClass *cl, Tcl_Namespace *namespacePtr) { + XOTclObject *obj = (XOTclObject*)cl; + +#ifdef OBJDELETION_TRACE + fprintf(stderr,"+++ CleanupInitClass\n"); +#endif + + /* + * during init of Object and Class the theClass value is not set + */ + /* + if (RUNTIME_STATE(in)->theClass != 0) + obj->type = RUNTIME_STATE(in)->theClass; + */ + XOTclObjectSetClass(obj); + + cl->nsPtr = namespacePtr; + + cl->super = 0; + cl->sub = 0; + AddSuper(cl, RUNTIME_STATE(in)->theObject); + cl->parent = RUNTIME_STATE(in)->theObject; + cl->color = WHITE; + cl->order = 0; + cl->parameters = 0; + + Tcl_InitHashTable(&cl->instances, TCL_ONE_WORD_KEYS); + MEM_COUNT_ALLOC("Tcl_InitHashTable",&cl->instances); + + cl->opt = 0; +} + +/* + * class physical destruction + */ +static void +PrimitiveCDestroy(ClientData cd) { + XOTclClass *cl = (XOTclClass*)cd; + XOTclObject *obj = (XOTclObject*)cd; + Tcl_Interp *in; + Tcl_Namespace* saved; + + /* + * check and latch against recurrent calls with obj->teardown + */ + if (!obj || !obj->teardown) return; + in = obj->teardown; + obj->teardown = 0; + + /* + * Don't destroy, if the interpreted is destroyed already + * e.g. TK calls Tcl_DeleteInterp directly, if Window is killed + */ + if (Tcl_InterpDeleted(in)) return; + + /* + * call and latch user destroy with obj->id if we haven't + */ + if (!(obj->flags & XOTCL_DESTROY_CALLED)) + callDestroyMethod(cd, in, obj, 0); + + CleanupDestroyClass(in, cl); + + /* + * handoff the primitive teardown + */ + + saved = cl->nsPtr; + obj->teardown = in; + + /* + * class object destroy + physical destroy + */ + PrimitiveODestroy(cd); + + XOTcl_DeleteNamespace(in, saved); + + return; +} + +/* + * class init + */ +static void +PrimitiveCInit(void* mem, Tcl_Interp *in, char *name, XOTclClass *class) { + XOTclClass *cl = (XOTclClass*)mem; + + Tcl_CallFrame frame; + Tcl_Namespace* ns; + char *n = name; + + /* + * ensure that namespace is newly created during CleanupInitClass + * ie. kill it, if it exists already + */ + if (Tcl_PushCallFrame(in, &frame, RUNTIME_STATE(in)->XOTclClassesNS, 0)!= TCL_OK) + return; + ns = NSGetFreshNamespace(in, (ClientData)cl, n); + Tcl_PopCallFrame(in); + + CleanupInitClass(in, cl, ns); + return; +} + +/* + * class create: creation of namespace + class full name + * calls class object creation + */ +static XOTclClass* +PrimitiveCCreate(Tcl_Interp *in, char *name, XOTclClass *class) { + XOTclClass *cl = (XOTclClass*)ckalloc(sizeof(XOTclClass)); + Tcl_DString fullName, *fullNamePtr = &fullName; + char *fn; + unsigned length; + XOTclObject *obj = (XOTclObject*)cl; + + memset(cl, 0, sizeof(XOTclClass)); + + MEM_COUNT_ALLOC("XOTclObject/XOTclClass",cl); + /* + fprintf(stderr, " +++ CLS alloc: %s\n", name); + */ + if (*name == ':' && *(name+1) == ':') { + fn = name; + length = strlen(name); + } else { + Tcl_Namespace *currNs = Tcl_GetCurrentNamespace(in); + if (currNs != Tcl_GetGlobalNamespace(in) + && !(currNs->deleteProc == NSNamespaceDeleteProc)) { + ALLOC_NAME_NS(fullNamePtr, currNs->fullName, name); + } else { + ALLOC_TOP_NS(fullNamePtr, name); + } + fn = Tcl_DStringValue(fullNamePtr); + length = Tcl_DStringLength(fullNamePtr); + } + /* + fprintf(stderr,"Class alloc %p '%s'\n", cl, fn); + */ + /* check whether Object parent NS already exists, + otherwise: error */ + if (!NSCheckForParent(in, fn, length)) { + if (fn != name) { + DSTRING_FREE(fullNamePtr); + } + ckfree((char*) cl); + return 0; + } + obj->id = Tcl_CreateObjCommand(in, fn, XOTclObjDispatch, + (ClientData)cl, PrimitiveCDestroy); + + PrimitiveOInit(obj, in, fn, class); + + obj->cmdName = NewXOTclObjectObjName(obj,fn,length); + INCR_REF_COUNT(obj->cmdName); + PrimitiveCInit(cl, in, fn+2, class); + + objTrace("PrimitiveCCreate", obj); + if (fn != name) { + DSTRING_FREE(fullNamePtr); + } + return cl; +} + +/* change XOTcl class conditionally; obj must not be NULL */ + +XOTCLINLINE static void +changeClass(Tcl_Interp *in, XOTclObject *obj, XOTclClass *cl) { + assert(obj); + + if (cl != obj->cl) { + (void)RemoveInstance(obj, obj->cl); + AddInstance(obj, cl); + + MixinComputeDefined(in, obj); + FilterComputeDefined(in, obj); + } +} + + +/* + * Undestroy the object, reclass it, and call "cleanup" afterwards + */ +static int +doCleanup(Tcl_Interp *in, XOTclObject *newobj, XOTclObject *classobj, + int objc, Tcl_Obj *objv[]) { + int destroyed = 0, result; + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStackContent *csc; + /* + * we check whether the object to be re-created is destroyed or not + */ + for (csc = &cs->content[1]; csc <= cs->top; csc++) { + if (newobj == csc->self && csc->destroyedCmd != 0) { + destroyed = 1; break; + } + } + + if (destroyed) + UndestroyObj(in, newobj); + + /* + * re-create, first ensure correct class for newobj + */ + + changeClass(in, newobj, (XOTclClass*) classobj); + + /* + * dispatch "cleanup" + */ + result = callMethod((ClientData) newobj, in, XOTclGlobalObjects[CLEANUP], 2, 0, 0); + return result; +} + +/* + * Std initialization: + * call parameter default values + * apply "-" methods (call "configure" with given arguments) + * call constructor "init", if it was not called before + */ +static int +doObjInitialization(Tcl_Interp *in, XOTclObject *obj, int objc, Tcl_Obj *objv[]) { + int result, initArgsC = objc; + Tcl_Obj *savedObjResult = Tcl_GetObjResult(in); /* save the result */ + INCR_REF_COUNT(savedObjResult); + + /* + * Search for default values of parameter on superclasses + */ + if (!(obj->flags & XOTCL_INIT_CALLED)) { + result = callParameterMethodWithArg(obj, in, XOTclGlobalObjects[SEARCH_DEFAULTS], + obj->cmdName, 3, 0, 0); + if (result != TCL_OK) + return result; + } + + /* clear INIT_CALLED_FLAG */ + obj->flags &= ~XOTCL_INIT_CALLED; + + /* + * call init methods (starting with '-') + */ + + result = callMethod((ClientData) obj, in, + XOTclGlobalObjects[CONFIGURE], objc, objv+2, 0); + if (result != TCL_OK) + return result; + + /* check, whether init was called already, and determine where the + * configure (with '-') start (we don't send them as args to + * "init"). */ + + if (!(obj->flags & XOTCL_INIT_CALLED)) { + int newargs; + /* + * Call the user-defined constructor 'init' + */ + result = Tcl_GetIntFromObj(in,Tcl_GetObjResult(in),&newargs); + if (result == TCL_OK && newargs+2 < objc) + initArgsC = newargs+2; + result = callMethod((ClientData) obj, in, XOTclGlobalObjects[INIT], + initArgsC, objv+2, 0); + obj->flags |= XOTCL_INIT_CALLED; + } + + Tcl_SetObjResult(in, savedObjResult); + DECR_REF_COUNT(savedObjResult); + + return result; +} + + +/* + * experimental resolver implementation -> not used at the moment + */ +#ifdef NOT_USED +static int +XOTclResolveCmd(Tcl_Interp *in, char *name, Tcl_Namespace *contextNsPtr, + int flags, Tcl_Command *rPtr) { + + Tcl_Namespace *nsPtr[2], *cxtNsPtr; + char *simpleName; + register Tcl_HashEntry *entryPtr; + register Tcl_Command cmd; + register int search; + + /*fprintf(stderr, " ***%s->%s\n", contextNsPtr->fullName, name);*/ + + /* + * Find the namespace(s) that contain the command. + */ + if ((flags & TCL_GLOBAL_ONLY) != 0) { + cxtNsPtr = Tcl_GetGlobalNamespace(in); + } + else if (contextNsPtr != NULL) { + cxtNsPtr = contextNsPtr; + } + else { + cxtNsPtr = Tcl_GetCurrentNamespace(in); + } + + TclGetNamespaceForQualName(in, name, (Namespace *) contextNsPtr, + flags, &nsPtr[0], &nsPtr[1], &cxtNsPtr, &simpleName); + + /*fprintf(stderr, " ***Found %s, %s\n", nsPtr[0]->fullName, nsPtr[0]->fullName);*/ + + /* + * Look for the command in the command table of its namespace. + * Be sure to check both possible search paths: from the specified + * namespace context and from the global namespace. + */ + + cmd = NULL; + for (search = 0; (search < 2) && (cmd == NULL); search++) { + if ((nsPtr[search] != NULL) && (simpleName != NULL)) { + cmdTable = Tcl_Namespace_cmdTable(nsPtr[search]); + entryPtr = Tcl_FindHashEntry(cmdTable, simpleName); + if (entryPtr != NULL) { + cmd = (Tcl_Command) Tcl_GetHashValue(entryPtr); + } + } + } + if (cmd != NULL) { + Tcl_ObjCmdProc* objProc = Tcl_Command_objProc(cmd); + if (cxtNsPtr->deleteProc == NSNamespaceDeleteProc && + objProc != XOTclObjDispatch && + objProc != XOTclNextObjCmd && + objProc != XOTclGetSelfObjCmd) { + + /* + * the cmd is defined in an XOTcl object or class namespace, but + * not an object & not self/next -> redispatch in + * global namespace + */ + cmd = 0; + nsPtr[0] = Tcl_GetGlobalNamespace(in); + if ((nsPtr[0] != NULL) && (simpleName != NULL)) { + cmdTable = Tcl_Namespace_cmdTable(nsPtr[0]); + if ((entryPtr = Tcl_FindHashEntry(cmdTable, simpleName))) { + cmd = (Tcl_Command) Tcl_GetHashValue(entryPtr); + } + } + + /* + XOTclStackTrace(in); + XOTclCallStackTrace(in); + */ + } + *rPtr = cmd; + return TCL_OK; + } + + return TCL_CONTINUE; +} +static int +XOTclResolveVar(Tcl_Interp *interp, char *name, Tcl_Namespace *context, + Tcl_ResolvedVarInfo *rPtr) { + /*fprintf(stderr, "Resolving %s in %s\n", name, context->fullName);*/ + + return TCL_CONTINUE; +} +#endif + +/* + * object method implementations + */ + +static int +XOTclODestroyMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 1) return XOTclObjErrArgCnt(in, obj->cmdName, "destroy"); + PRINTOBJ("XOTclODestroyMethod", obj); + + /* + * call instdestroy for [self] + */ + return XOTclCallMethodWithArg((ClientData)obj->cl, in, + XOTclGlobalObjects[INSTDESTROY], obj->cmdName, + objc+2, objv+1, 0); +} + +static int +XOTclOCleanupMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + XOTclClass *cl = XOTclObjectToClass(obj); + char *fn; + Tcl_Obj *savedNameObj; + +#if defined(OBJDELETION_TRACE) + fprintf(stderr,"+++ XOTclOCleanupMethod\n"); +#endif + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 1) return XOTclObjErrArgCnt(in, obj->cmdName, "cleanup"); + PRINTOBJ("XOTclOCleanupMethod", obj); + + fn = ObjStr(obj->cmdName); + savedNameObj = obj->cmdName; + INCR_REF_COUNT(savedNameObj); + + CleanupDestroyObject(in, obj); + CleanupInitObject(in, obj, obj->cl, obj->nsPtr); + + if (cl) { + CleanupDestroyClass(in, cl); + CleanupInitClass(in, cl, cl->nsPtr); + } + + DECR_REF_COUNT(savedNameObj); + + return TCL_OK; +} + +static int +XOTclOIsClassMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd, *o; + Tcl_Obj *className; + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 1 || objc > 2) return XOTclObjErrArgCnt(in, obj->cmdName, + "isclass ?className?"); + + className = (objc == 2) ? objv[1] : obj->cmdName; + + if (GetXOTclObjectFromObj(in, className, &o) == TCL_OK + && XOTclObjectIsClass(o)) { + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + } else { + Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + } + return TCL_OK; +} + +static int +XOTclOIsObjectMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd, *o;; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 2) return XOTclObjErrArgCnt(in, obj->cmdName, "isobject "); + + if (GetXOTclObjectFromObj(in, objv[1], &o) == TCL_OK) { + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + } else { + Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + } + return TCL_OK; +} + +static int +IsMetaClass(Tcl_Interp *in, XOTclClass *cl) { + /* check if cl is a meta-class by checking is Class is a superclass of cl*/ + XOTclClasses* pl; + if (cl == RUNTIME_STATE(in)->theClass) + return 1; + + for (pl = ComputeOrder(cl, Super); pl; pl = pl->next) { + if (pl->cl == RUNTIME_STATE(in)->theClass) + return 1; + } + return 0; +} + +static int +XOTclOIsMetaClassMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd, *o; + Tcl_Obj *className; + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 1 || objc > 2) return XOTclObjErrArgCnt(in, obj->cmdName, + "ismetaclass ?metaClassName?"); + + className = (objc == 2) ? objv[1] : obj->cmdName; + + if (GetXOTclObjectFromObj(in, className, &o) == TCL_OK + && XOTclObjectIsClass(o) + && IsMetaClass(in, (XOTclClass*)o)) { + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + } else { + Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + } + return TCL_OK; +} + +static int +XOTclOIsTypeMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + XOTclClass *cl; + XOTclClasses *t; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 2) return XOTclObjErrArgCnt(in, obj->cmdName, "istype "); + Tcl_ResetResult(in); + + if (obj->cl && GetXOTclClassFromObj(in,objv[1],&cl, 0) == TCL_OK) { + if (cl == obj->cl) { + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + return TCL_OK; + } + t = ComputeOrder(obj->cl, Super); + while (t && t->cl && t->cl != cl) { + t = t->next; + } + if (t && t->cl == cl) { + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + return TCL_OK; + } + } + Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + return TCL_OK; +} + +static int +XOTclOIsMixinMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + XOTclClass *cl; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 2) return XOTclObjErrArgCnt(in, obj->cmdName, "ismixin "); + + if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) + MixinComputeDefined(in, obj); + + if ((obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) && + GetXOTclClassFromObj(in,objv[1],&cl, 0) == TCL_OK) { + XOTclCmdList *ml = obj->mixinOrder; + XOTclClass *mixin; + while (ml) { + mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); + if (mixin && mixin == cl) { + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + return TCL_OK; + } + ml = ml->next; + } + } + Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + return TCL_OK; +} + +static int +XOTclOClassMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + XOTclClass *cl; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 2) return XOTclObjErrArgCnt(in, obj->cmdName, "class "); + + /* + * allow a change to any class; type system enforces safety later + */ + if (GetXOTclClassFromObj(in, objv[1], &cl, 1) != TCL_OK) + return XOTclErrBadVal(in, "a class", ObjStr(objv[1])); + + changeClass(in, obj, cl); + + return TCL_OK; +} + +static int +XOTclOExistsMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 2) return XOTclObjErrArgCnt(in, obj->cmdName, "exists var"); + + Tcl_SetIntObj(Tcl_GetObjResult(in), varExists(in, obj, ObjStr(objv[1]))); + return TCL_OK; +} + +static int +countModifiers(int objc, Tcl_Obj * CONST objv[]) { + int i, count = 0; + char *to; + for (i = 2; i < objc; i++) { + to = ObjStr(objv[i]); + if (to[0] == '-') { + count++; + /* '--' stops modifiers */ + if (to[1] == '-') break; + } + } + return count; +} + +static int +checkForModifier(Tcl_Obj * CONST objv[], int numberModifiers, char *modifier) { + int i; + if (numberModifiers == 0) return 0; + for (i = 2; i-2 < numberModifiers; i++) { + char *ov = ObjStr(objv[i]); + /* all start with a "-", so there must be a ov[1] */ + if (ov[1] == modifier[1] && !strcmp(ov, modifier)) + return 1; + } + return 0; +} + +static int +XOTclOInfoMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + Tcl_Namespace *nsp = obj->nsPtr; + char *cmd, *pattern; + int modifiers = 0; + XOTclObjectOpt *opt; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 2) + return XOTclObjErrArgCnt(in, obj->cmdName, "info ?args?"); + + opt = obj->opt; + cmd = ObjStr(objv[1]); + pattern = (objc > 2) ? ObjStr(objv[2]) : 0; + + /* + * check for "-" modifiers + */ + if (pattern && *pattern == '-') { + modifiers = countModifiers(objc, objv); + pattern = (objc > 2+modifiers) ? ObjStr(objv[2+modifiers]) : 0; + } + + switch (*cmd) { + case 'a': + if (isArgsString(cmd)) { + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info args "); + if (nsp) + return ListProcArgs(in, Tcl_Namespace_cmdTable(nsp), pattern); + else + return TCL_OK; + } + break; + + case 'b': + if (!strcmp(cmd, "body")) { + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info body "); + if (nsp) + return ListProcBody(in, Tcl_Namespace_cmdTable(nsp), pattern); + else + return TCL_OK; + } + break; + + case 'c': + if (isClassString(cmd)) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info class ?class?"); + return ListClass(in, obj, pattern, objc, objv); + } else if (!strcmp(cmd, "commands")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info commands ?pat?"); + if (nsp) + return ListKeys(in, Tcl_Namespace_cmdTable(nsp), pattern); + else + return TCL_OK; + } else if (!strcmp(cmd, "children")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info children ?pat?"); + return ListChildren(in, obj, pattern, 0); + } else if (!strcmp(cmd, "check")) { + if (objc != 2 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info check"); + return AssertionListCheckOption(in, obj); + } + break; + + case 'd': + if (!strcmp(cmd, "default")) { + if (objc != 5 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info default "); + if (nsp) + return ListProcDefault(in, Tcl_Namespace_cmdTable(nsp), pattern, + ObjStr(objv[3]), objv[4]); + else + return TCL_OK; + } + break; + + case 'f': + if (!strcmp(cmd, "filter")) { + int withGuards = 0, withOrder = 0; + if (objc-modifiers > 3) + return XOTclObjErrArgCnt(in, obj->cmdName, + "info filter ?-guards? ?-order? ?pat?"); + if (modifiers > 0) { + withGuards = checkForModifier(objv, modifiers, "-guards"); + withOrder = checkForModifier(objv, modifiers, "-order"); + + if (withGuards == 0 && withOrder == 0) + return XOTclVarErrMsg(in, "info filter: unknown modifier ", + ObjStr(objv[2]), (char *)NULL); + /* + if (withGuards && withOrder) + return XOTclVarErrMsg(in, "info filter: cannot use -guards and -order together", + ObjStr(objv[2]), (char *)NULL); + */ + } + + if (withOrder) { + if (!(obj->flags & XOTCL_FILTER_ORDER_VALID)) + FilterComputeDefined(in, obj); + return FilterInfo(in, obj->filterOrder, pattern, withGuards, 1); + } + + return opt ? FilterInfo(in, opt->filters, pattern, withGuards, 0) : TCL_OK; + + } else if (!strcmp(cmd, "filterguard")) { + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info filterguard filter"); + return opt ? GuardList(in, opt->filters, pattern) : TCL_OK; + } + break; + + case 'h': + if (!strcmp(cmd, "hasNamespace")) { + Tcl_SetBooleanObj(Tcl_GetObjResult(in), nsp != NULL); + return TCL_OK; + } + break; + + case 'i': + if (!strcmp(cmd, "invar")) { + if (objc != 2 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info invar"); + if (opt && opt->assertions) + Tcl_SetObjResult(in, AssertionList(in, opt->assertions->invariants)); + return TCL_OK; + } else if (!strcmp(cmd, "info")) { + if (objc > 2 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info info"); + return ListInfo(in, GetXOTclClassFromObj(in,obj->cmdName,NULL,0) == TCL_OK); + } + break; + + case 'm': + if (!strcmp(cmd, "mixin")) { + int withOrder = 0, withGuards = 0; + if (objc-modifiers > 3) + return XOTclObjErrArgCnt(in, obj->cmdName, + "info mixin ?-guards? ?-order? ?class?"); + if (modifiers > 0) { + withOrder = checkForModifier(objv, modifiers, "-order"); + withGuards = checkForModifier(objv, modifiers, "-guards"); + + if (withOrder == 0 && withGuards == 0) + return XOTclVarErrMsg(in, "info mixin: unknown modifier . ", + ObjStr(objv[2]), (char *)NULL); + } + + if (withOrder) { + if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) + MixinComputeDefined(in, obj); + return MixinInfo(in, obj->mixinOrder, pattern, withGuards); + } + + return opt ? MixinInfo(in, opt->mixins, pattern, withGuards) : TCL_OK; + + } else if (!strcmp(cmd, "mixinguard")) { + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info mixinguard mixin"); + + return opt ? GuardList(in, opt->mixins, pattern) : TCL_OK; + } else if (!strcmp(cmd, "methods")) { + int noprocs = 0, nocmds = 0, nomixins = 0, inContext = 0; + if (objc-modifiers > 3) + return XOTclObjErrArgCnt(in, obj->cmdName, + "info methods ?-noprocs? ?-nocmds? ?-nomixins? -incontext ?pat?"); + if (modifiers > 0) { + noprocs = checkForModifier(objv, modifiers, "-noprocs"); + nocmds = checkForModifier(objv, modifiers, "-nocmds"); + nomixins = checkForModifier(objv, modifiers, "-nomixins"); + inContext = checkForModifier(objv, modifiers, "-incontext"); + } + return ListMethods(in, obj, pattern, noprocs, nocmds, nomixins, inContext); + } +#ifdef XOTCL_METADATA + else if (!strcmp(cmd, "metadata")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info metadata ?pat?"); + return ListKeys(in, &obj->metaData, pattern); + } +#endif + break; + case 'p': + if (!strcmp(cmd, "procs")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info procs ?pat?"); + if (nsp) + return ListMethodKeys(in, Tcl_Namespace_cmdTable(nsp), pattern, + /*noProcs*/ 0, /*noCmds*/ 1, /* noDups */ 0 ); + else + return TCL_OK; + } else if (!strcmp(cmd, "parent")) { + if (objc > 2 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info parent"); + return ListParent(in, obj); + } else if (!strcmp(cmd, "pre")) { + XOTclProcAssertion* procs; + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info pre "); + if (opt) { + procs = AssertionFindProcs(opt->assertions, ObjStr(objv[2])); + if (procs) Tcl_SetObjResult(in, AssertionList(in, procs->pre)); + } + return TCL_OK; + } else if (!strcmp(cmd, "post")) { + XOTclProcAssertion* procs; + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info post "); + if (opt) { + procs = AssertionFindProcs(opt->assertions, ObjStr(objv[2])); + if (procs) Tcl_SetObjResult(in, AssertionList(in, procs->post)); + } + return TCL_OK; + } + break; + case 'v': + if (!strcmp(cmd, "vars")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, obj->cmdName, "info vars ?pat?"); + return ListVars(in, obj, pattern); + } + break; + } + return XOTclErrBadVal + (in, "an info option (use 'info info' to list all info options)", cmd); + return TCL_OK; +} + + +static int +XOTclOProcMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + char *argStr, *bdyStr, *name; + XOTclObjectOpt *opt; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 4 && objc != 6) + return XOTclObjErrArgCnt(in, obj->cmdName, + "proc name args body ?preAssertion postAssertion?"); + argStr = ObjStr(objv[2]); + bdyStr = ObjStr(objv[3]); + name = ObjStr(objv[1]); + + if (*argStr == 0 && *bdyStr == 0) { + opt = obj->opt; + if (opt) + AssertionRemoveProc(opt->assertions, name); + if (obj->nsPtr) + NSDeleteCmd(in, obj->nsPtr, name); + } else { + opt = XOTclRequireObjectOpt(obj); + if (!opt->assertions) + opt->assertions = AssertionCreateStore(); + requireObjNamespace(in, obj); + MakeProc(obj->nsPtr, opt->assertions, in, objc, (Tcl_Obj **) objv); + } + + /* could be a filter => recompute filter order */ + FilterComputeDefined(in, obj); + + return TCL_OK; +} + +static int +XOTclONoinitMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 1) return XOTclObjErrArgCnt(in, obj->cmdName, "noninit"); + + obj->flags |= XOTCL_INIT_CALLED; + + return TCL_OK; +} + +static int +XOTclOIncrMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + XOTcl_FrameDecls; + int result; + + if (!obj) + return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 2) + return XOTclObjErrArgCnt(in, obj->cmdName, "incr ?increment?"); + + XOTcl_PushFrame(in, obj); + result = XOTcl_IncrObjCmd(cd, in, objc, objv); + XOTcl_PopFrame(in, obj); + + return result; +} + +Tcl_Obj* +XOTclOSetInstVar(XOTcl_Object *obj, Tcl_Interp *in, + Tcl_Obj *name, Tcl_Obj *value, int flgs) { + return XOTclOSetInstVar2(obj, in, name, (Tcl_Obj *)NULL, value, (flgs|TCL_PARSE_PART1)); +} + +Tcl_Obj* +XOTclOGetInstVar(XOTcl_Object *obj, Tcl_Interp *in, Tcl_Obj *name, int flgs) { + return XOTclOGetInstVar2(obj, in, name, (Tcl_Obj *)NULL, (flgs|TCL_PARSE_PART1)); +} + +int +XOTclUnsetInstVar(XOTcl_Object *obj, Tcl_Interp *in, char *name, int flgs) { + return XOTclUnsetInstVar2 (obj, in, name,(char*)NULL, flgs); +} + +extern int +XOTclCreateObject(Tcl_Interp *in, Tcl_Obj *name, XOTcl_Class *cli) { + XOTclClass *cl = (XOTclClass*) cli; + int result; + INCR_REF_COUNT(name); + result = XOTclCallMethodWithArg((ClientData)cl, in, + XOTclGlobalObjects[CREATE], name, 3, 0, 0); + DECR_REF_COUNT(name); + return result; +} + +extern int +XOTclCreateClass(Tcl_Interp *in, Tcl_Obj *name, XOTcl_Class *cli) { + XOTclClass *cl = (XOTclClass*) cli; + int result; + INCR_REF_COUNT(name); + result = XOTclCallMethodWithArg((ClientData)cl, in, + XOTclGlobalObjects[CREATE], name, 3, 0, 0); + DECR_REF_COUNT(name); + return result; +} + +int +XOTclDeleteObject(Tcl_Interp *in, XOTcl_Object *obji) { + XOTclObject *obj = (XOTclObject*) obji; + return callMethod((ClientData)obj, in, XOTclGlobalObjects[DESTROY],2,0,0); +} + +int +XOTclDeleteClass(Tcl_Interp *in, XOTcl_Class *cli) { + XOTclClass *cl = (XOTclClass*) cli; + return callMethod((ClientData)cl, in, XOTclGlobalObjects[DESTROY],2,0,0); +} + +extern Tcl_Obj* +XOTclOSetInstVar2(XOTcl_Object *obji, Tcl_Interp *in, Tcl_Obj *name1, Tcl_Obj *name2, + Tcl_Obj *value, int flgs) { + XOTclObject *obj = (XOTclObject*) obji; + Tcl_Obj *result; + XOTcl_FrameDecls; + + XOTcl_PushFrame(in, obj); + if (obj->nsPtr) + flgs |= TCL_NAMESPACE_ONLY; + + result = Tcl_ObjSetVar2(in, name1, name2, value, flgs); + XOTcl_PopFrame(in, obj); + return result; +} + +extern int +XOTclUnsetInstVar2(XOTcl_Object *obji, Tcl_Interp *in, char *name1, char *name2, + int flgs) { + XOTclObject *obj = (XOTclObject*) obji; + int result; + XOTcl_FrameDecls; + + XOTcl_PushFrame(in, obj); + if (obj->nsPtr) + flgs |= TCL_NAMESPACE_ONLY; + + result = Tcl_UnsetVar2(in, name1, name2, flgs); + XOTcl_PopFrame(in, obj); + return result; +} + +/* + * We need NewVar from tclVar.c ... but its not exported + */ +static Var *NewVar() { + register Var *varPtr; + + varPtr = (Var *) ckalloc(sizeof(Var)); + varPtr->value.objPtr = NULL; + varPtr->name = NULL; + varPtr->nsPtr = NULL; + varPtr->hPtr = NULL; + varPtr->refCount = 0; + varPtr->tracePtr = NULL; + varPtr->searchPtr = NULL; + varPtr->flags = (VAR_SCALAR | VAR_UNDEFINED | VAR_IN_HASHTABLE); + return varPtr; +} + +static void +CleanupVar(Var * varPtr, Var *arrayPtr) { + if (TclIsVarUndefined(varPtr) && (varPtr->refCount == 0) + && (varPtr->tracePtr == NULL) + && (varPtr->flags & VAR_IN_HASHTABLE)) { + if (varPtr->hPtr != NULL) { + Tcl_DeleteHashEntry(varPtr->hPtr); + } + ckfree((char *) varPtr); + } + if (arrayPtr != NULL) { + if (TclIsVarUndefined(arrayPtr) && (arrayPtr->refCount == 0) + && (arrayPtr->tracePtr == NULL) + && (arrayPtr->flags & VAR_IN_HASHTABLE)) { + if (arrayPtr->hPtr != NULL) { + Tcl_DeleteHashEntry(arrayPtr->hPtr); + } + ckfree((char *) arrayPtr); + } + } +} + +static int +GetInstVarIntoCurrentScope(Tcl_Interp *in, XOTclObject *obj, + char *varName, char *newName) { + Var *varPtr, *otherPtr = 0, *arrayPtr; + int new; + Tcl_CallFrame *varFramePtr; + Tcl_HashEntry *hPtr; + Tcl_HashTable *tablePtr; + XOTcl_FrameDecls; + + int flgs = TCL_LEAVE_ERR_MSG | + /* PARSE_PART1 needed for 8.0.5 */ TCL_PARSE_PART1; + + XOTcl_PushFrame(in, obj); + if (obj->nsPtr) { + flgs = flgs|TCL_NAMESPACE_ONLY; + } + + otherPtr = TclLookupVar(in, varName, (char *) NULL, flgs, "define", + /*createPart1*/ 1, /*createPart2*/ 1, &arrayPtr); + XOTcl_PopFrame(in, obj); + + if (otherPtr == NULL) { + return XOTclVarErrMsg(in, "can't make instvar ", varName, + ": can't find variable on ", ObjStr(obj->cmdName), NULL); + } + + /* + * if newName == NULL -> there is no alias, use varName + * as target link name + */ + if (newName == NULL) { + /* + * Variable link into namespace cannot be an element in an array. + * see Tcl_VariableObjCmd ... + */ + if (arrayPtr) { + return XOTclVarErrMsg(in, "can't make instvar ", varName, + " on ", ObjStr(obj->cmdName), + ": variable cannot be an element in an array;", + " use an alias or objeval.", (char *)NULL); + } + + newName = varName; + } + + varFramePtr = Tcl_Interp_varFramePtr(in); + + /* + * If we are executing inside a Tcl procedure, create a local + * variable linked to the new namespace variable "varName". + */ + if (varFramePtr != NULL && Tcl_CallFrame_isProcCallFrame(varFramePtr)) { + Proc *procPtr = Tcl_CallFrame_procPtr(varFramePtr); + int localCt = procPtr->numCompiledLocals; + CompiledLocal *localPtr = procPtr->firstLocalPtr; + Var *localVarPtr = Tcl_CallFrame_compiledLocals(varFramePtr); + int nameLen = strlen(newName); + int i; + + varPtr = NULL; + for (i = 0; i < localCt; i++) { /* look in compiled locals */ + if (!TclIsVarTemporary(localPtr)) { + char *localName = localVarPtr->name; + if ((newName[0] == localName[0]) + && (nameLen == localPtr->nameLength) + && (strcmp(newName, localName) == 0)) { + varPtr = localVarPtr; + new = 0; + break; + } + } + localVarPtr++; + localPtr = localPtr->nextPtr; + } + + if (varPtr == NULL) { /* look in frame's local var hashtable */ + tablePtr = Tcl_CallFrame_varTablePtr(varFramePtr); + if (tablePtr == NULL) { + tablePtr = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable)); + Tcl_InitHashTable(tablePtr, TCL_STRING_KEYS); + Tcl_CallFrame_varTablePtr(varFramePtr) = tablePtr; + } + hPtr = Tcl_CreateHashEntry(tablePtr, newName, &new); + if (new) { + varPtr = NewVar(); + Tcl_SetHashValue(hPtr, varPtr); + varPtr->hPtr = hPtr; + varPtr->nsPtr = (Namespace *)varFramePtr->nsPtr; + } else { + varPtr = (Var *) Tcl_GetHashValue(hPtr); + } + } + /* + * if we define an alias (newName != varName), be sure that + * the target does not exist already + */ + if (!new) { + if (varPtr == otherPtr) + return XOTclVarErrMsg(in, "can't instvar to variable itself", (char *)NULL); + if (TclIsVarLink(varPtr)) { + /* we try to make the same instvar again ... this is ok */ + Var *linkPtr = varPtr->value.linkPtr; + if (linkPtr == otherPtr) { + return TCL_OK; + } + + linkPtr->refCount--; + if (TclIsVarUndefined(linkPtr)) { + CleanupVar(linkPtr, (Var *) NULL); + } + + /* + return XOTclVarErrMsg(in, "can't instvar to link", (char *)NULL); + */ + } else if (!TclIsVarUndefined(varPtr)) { + Tcl_AppendResult(in, "variable \"", newName, + "\" already exists", (char *)NULL); + return TCL_ERROR; + } else if (varPtr->tracePtr != NULL) { + Tcl_AppendResult(in, "variable \"", newName, + "\" has traces: can't use for instvar", (char *) NULL); + return TCL_ERROR; + } + } + TclSetVarLink(varPtr); + TclClearVarUndefined(varPtr); + varPtr->value.linkPtr = otherPtr; + otherPtr->refCount++; + } + return TCL_OK; +} + +static int +XOTclOInstVarMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]); + +extern int +XOTclInstVar(XOTcl_Object *obji, Tcl_Interp *in, char *name, char *destName) { + XOTclObject *obj = (XOTclObject*) obji; + int result; + Tcl_Obj *alias = 0; + DEFINE_NEW_TCL_OBJS_ON_STACK(2, objv); + + objv[0] = XOTclGlobalObjects[INSTVAR]; + objv[1] = Tcl_NewStringObj(name, -1); + INCR_REF_COUNT(objv[1]); + + if (destName != 0) { + alias = Tcl_NewStringObj(destName, -1); + INCR_REF_COUNT(alias); + Tcl_ListObjAppendElement(in, objv[1], alias); + } + + result = XOTclOInstVarMethod((ClientData) obj, in, 2, objv); + + if (destName != 0) { + DECR_REF_COUNT(alias); + } + DECR_REF_COUNT(objv[1]); + FREE_TCL_OBJS_ON_STACK(objv); + return result; +} + +extern void +XOTclRemovePMethod(Tcl_Interp *in, XOTcl_Object *obji, char *nm) { + XOTclObject *obj = (XOTclObject*) obji; + if (obj->nsPtr) + NSDeleteCmd(in, obj->nsPtr, nm); +} + +extern void +XOTclRemoveIMethod(Tcl_Interp *in, XOTcl_Class *cli, char *nm) { + XOTclClass *cl = (XOTclClass*) cli; + NSDeleteCmd(in, cl->nsPtr, nm); +} + +/* + * obj/cl ClientData setter/getter + */ +extern void +XOTclSetObjClientData(XOTcl_Object *obji, ClientData data) { + XOTclObject *obj = (XOTclObject*) obji; + XOTclObjectOpt *opt = XOTclRequireObjectOpt(obj); + opt->clientData = data; +} +extern ClientData +XOTclGetObjClientData(XOTcl_Object *obji) { + XOTclObject *obj = (XOTclObject*) obji; + return (obj && obj->opt) ? obj->opt->clientData : 0; +} +extern void +XOTclSetClassClientData(XOTcl_Class *cli, ClientData data) { + XOTclClass *cl = (XOTclClass*) cli; + XOTclRequireClassOpt(cl); + cl->opt->clientData = data; +} +extern ClientData +XOTclGetClassClientData(XOTcl_Class *cli) { + XOTclClass *cl = (XOTclClass*) cli; + return (cl && cl->opt) ? cl->opt->clientData : 0; +} + +static int +XOTclOSetMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + Tcl_Obj *result; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + + if (objc == 2) { + /*fprintf(stderr,"+++ read var '%s'\n", ObjStr(objv[1]));*/ + result = XOTclOGetInstVar2((XOTcl_Object*)obj, in, objv[1], NULL, + (TCL_LEAVE_ERR_MSG|TCL_PARSE_PART1)); + } else if (objc == 3) { + /*fprintf(stderr,"+++ write var '%s' = '%s'\n", + ObjStr(objv[1]),ObjStr(objv[2]));*/ + result = XOTclOSetInstVar2((XOTcl_Object*)obj, in, objv[1], NULL, objv[2], + (TCL_LEAVE_ERR_MSG|TCL_PARSE_PART1)); + } else + return XOTclObjErrArgCnt(in, obj->cmdName, "set var ?value?"); + + if (result) { + Tcl_SetObjResult(in, result); + return TCL_OK; + } else { + return TCL_ERROR; + } +} + +static int +XOTclSetterMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + Tcl_Obj *result; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + + if (objc == 1) + result = XOTclOGetInstVar2((XOTcl_Object*)obj, in, objv[0], NULL, + (TCL_LEAVE_ERR_MSG|TCL_PARSE_PART1)); + else if (objc == 2) + result = XOTclOSetInstVar2((XOTcl_Object*)obj, in, objv[0], NULL, objv[1], + (TCL_LEAVE_ERR_MSG|TCL_PARSE_PART1)); + else + return XOTclObjErrArgCnt(in, obj->cmdName, " ?value?"); + + if (result) { + Tcl_SetObjResult(in, result); + return TCL_OK; + } else { + return XOTclVarErrMsg(in, "Can't find result of parameter ", + ObjStr(objv[0]), (char *)NULL); + } +} + +static int +XOTclOUnsetMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + int i, result = TCL_ERROR; + XOTcl_FrameDecls; + int flgs = TCL_LEAVE_ERR_MSG | TCL_PARSE_PART1; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 2) return XOTclObjErrArgCnt(in, obj->cmdName, "unset ?vars?"); + + XOTcl_PushFrame(in, obj); + + if (obj->nsPtr) + flgs = flgs|TCL_NAMESPACE_ONLY; + + for (i=1; icmdName, + "?level? otherVar localVar ?otherVar localVar ...?"); + + if (objc % 2 == 0) { + frameInfo = ObjStr(objv[1]); + i = 2; + } else { + frameInfoObj = computeLevelObj(in, CALLING_LEVEL); + INCR_REF_COUNT(frameInfoObj); + frameInfo = ObjStr(frameInfoObj); + i = 1; + } + + if (obj && (obj->filterStack || obj->mixinStack)) { + CallStackUseActiveFrames(in, &ctx); + } + + for ( ; i < objc; i += 2) { + result = Tcl_UpVar2(in, frameInfo, ObjStr(objv[i]), NULL, + ObjStr(objv[i+1]), 0 /*flags*/); + if (result != TCL_OK) + break; + } + + if (frameInfoObj) { + DECR_REF_COUNT(frameInfoObj); + } + CallStackRestoreSavedFrames(in, &ctx); + return result; +} + +static int +XOTclOUplevelMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { + XOTclObject *obj = (XOTclObject *)cd; + int i, result = TCL_ERROR; + char *frameInfo = NULL; + Tcl_CallFrame *framePtr = NULL, *savedVarFramePtr; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 2) { + uplevelSyntax: + return XOTclObjErrArgCnt(in, obj->cmdName, "?level? command ?arg ...?"); + } + /* + * Find the level to use for executing the command. + */ + if (objc>2) { + CallFrame *cf; + frameInfo = ObjStr(objv[1]); + result = TclGetFrame(in, frameInfo, &cf); + if (result == -1) { + return TCL_ERROR; + } + framePtr = (Tcl_CallFrame *)cf; + i = result+1; + } else { + i = 1; + } + + objc -= i; + objv += i; + if (objc == 0) { + goto uplevelSyntax; + } + + if (!framePtr) { + XOTclCallStackContent *csc = XOTclCallStackFindLastInvocation(in, 1); + framePtr = csc->currentFramePtr; + } + + savedVarFramePtr = Tcl_Interp_varFramePtr(in); + Tcl_Interp_varFramePtr(in) = framePtr; + + /* + * Execute the residual arguments as a command. + */ + + if (objc == 1) { + result = Tcl_EvalObjEx(in, objv[0], TCL_EVAL_DIRECT); + } else { + /* + * More than one argument: concatenate them together with spaces + * between, then evaluate the result. Tcl_EvalObjEx will delete + * the object when it decrements its refcount after eval'ing it. + */ + Tcl_Obj *objPtr = Tcl_ConcatObj(objc, objv); + result = Tcl_EvalObjEx(in, objPtr, TCL_EVAL_DIRECT); + } + if (result == TCL_ERROR) { + char msg[32 + TCL_INTEGER_SPACE]; + sprintf(msg, "\n (\"uplevel\" body line %d)", in->errorLine); + Tcl_AddObjErrorInfo(in, msg, -1); + } + + /* + * Restore the variable frame, and return. + */ + + Tcl_Interp_varFramePtr(in) = savedVarFramePtr; + return result; +} + + +static int +XOTclOEvalMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { + tclCmdClientData *tcd = (tclCmdClientData *)cd; + XOTcl_FrameDecls; + int result; + DEFINE_NEW_TCL_OBJS_ON_STACK(objc, ov); + + if (!tcd || !tcd->obj) return XOTclObjErrType(in, objv[0], "Object"); + + RUNTIME_STATE(in)->cs.top->currentFramePtr = Tcl_Interp_varFramePtr(in); + + /*fprintf(stderr, "*** varframe %p top %p\n", Tcl_Interp_varFramePtr(in), + RUNTIME_STATE(in)->cs.top); */ + XOTcl_PushFrame(in, tcd->obj); + /* + fprintf(stderr,"*** ovalmethod oc=%d tcd=%p cmdname=%s obj=%s\n", + objc,tcd,ObjStr(tcd->cmdName), ObjStr(tcd->obj->cmdName));*/ + /*XOTclCallStackTrace(in);*/ + ov[0] = tcd->cmdName; + memcpy(ov+1, objv+1, sizeof(Tcl_Obj *)*(objc-1)); + result = Tcl_EvalObjv(in, objc, ov, 0); + + XOTcl_PopFrame(in, tcd->obj); + FREE_TCL_OBJS_ON_STACK(ov); + return result; +} + +static int +XOTclOInstVarMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + Tcl_Obj **ov; + int i, oc, result = TCL_OK; + callFrameContext ctx = {0}; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 2) return XOTclObjErrArgCnt(in, obj->cmdName, "instvar ?vars?"); + + if (obj && (obj->filterStack || obj->mixinStack) ) { + CallStackUseActiveFrames(in, &ctx); + } + if (!Tcl_Interp_varFramePtr(in)) { + CallStackRestoreSavedFrames(in, &ctx); + return XOTclVarErrMsg(in, "instvar used on ", ObjStr(obj->cmdName), + ", but callstack is not in procedure scope", NULL); + } + + for (i=1; icmdName, "vwait varname"); + + nameString = ObjStr(objv[1]); + + /* + * Make sure the var table exists and the varname is in there + */ + if (NSRequireVariableOnObj(in, obj, nameString, flgs) == 0) + return XOTclVarErrMsg(in, "Can't lookup (and create) variable ", + nameString, " on ", ObjStr(obj->cmdName), NULL); + + XOTcl_PushFrame(in, obj); + /* + * much of this is copied from Tcl, since we must avoid + * access with flag TCL_GLOBAL_ONLY ... doesn't work on + * obj->varTable vars + */ + if (Tcl_TraceVar(in, nameString, flgs, (Tcl_VarTraceProc *)VwaitVarProc, + (ClientData) &done) != TCL_OK) { + return TCL_ERROR; + } + done = 0; + foundEvent = 1; + while (!done && foundEvent) { + foundEvent = Tcl_DoOneEvent(TCL_ALL_EVENTS); + } + Tcl_UntraceVar(in, nameString, flgs, (Tcl_VarTraceProc *)VwaitVarProc, + (ClientData) &done); + XOTcl_PopFrame(in, obj); + /* + * Clear out the interpreter's result, since it may have been set + * by event handlers. + */ + Tcl_ResetResult(in); + + if (!foundEvent) { + Tcl_AppendResult(in, "can't wait for variable \"", nameString, + "\": would wait forever", (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} + +static int +XOTclOInvariantsMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + XOTclObjectOpt *opt; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 2) + return XOTclObjErrArgCnt(in, obj->cmdName, "invar "); + + opt = XOTclRequireObjectOpt(obj); + + if (opt->assertions) + TclObjListFreeList(opt->assertions->invariants); + else + opt->assertions = AssertionCreateStore(); + + opt->assertions->invariants = AssertionNewList(in, objv[1]); + return TCL_OK; +} + +static int +XOTclOAutonameMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + int instanceOpt = 0, resetOpt = 0; + Tcl_Obj *autoname; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc == 3) { + instanceOpt = (strcmp(ObjStr(objv[1]), "-instance") == 0); + resetOpt = (strcmp(ObjStr(objv[1]), "-reset") == 0); + } + if ((objc < 2 || objc > 3) || (objc == 3 && !instanceOpt && !resetOpt)) + return XOTclObjErrArgCnt(in, obj->cmdName, "autoname [-instance | -reset] name"); + + autoname = AutonameIncr(in, objv[objc-1], obj, instanceOpt, resetOpt); + if (autoname) { + Tcl_SetObjResult(in, autoname); + DECR_REF_COUNT(autoname); + } + else + return XOTclVarErrMsg(in, + "Autoname failed. Probably format string (with %) was not well-formed", + NULL); + + return TCL_OK; +} + +static int +XOTclOCheckMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + int ocArgs; Tcl_Obj **ovArgs; + int i; + XOTclObjectOpt *opt; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 2) + return XOTclObjErrArgCnt(in, obj->cmdName, + "check (?all? ?pre? ?post? ?invar? ?instinvar?)"); + + opt = XOTclRequireObjectOpt(obj); + opt->checkoptions = CHECK_NONE; + + if (Tcl_ListObjGetElements(in, objv[1], &ocArgs, &ovArgs) == TCL_OK + && ocArgs > 0) { + for (i = 0; i < ocArgs; i++) { + char *option = ObjStr(ovArgs[i]); + if (option != 0) { + switch (*option) { + case 'i': + if (strcmp(option, "instinvar") == 0) { + opt->checkoptions |= CHECK_CLINVAR; + } else if (strcmp(option, "invar") == 0) { + opt->checkoptions |= CHECK_OBJINVAR; + } + break; + case 'p': + if (strcmp(option, "pre") == 0) { + opt->checkoptions |= CHECK_PRE; + } else if (strcmp(option, "post") == 0) { + opt->checkoptions |= CHECK_POST; + } + break; + case 'a': + if (strcmp(option, "all") == 0) { + opt->checkoptions |= CHECK_ALL; + } + break; + } + } + } + } + if (opt->checkoptions == CHECK_NONE && ocArgs>0) { + return XOTclVarErrMsg(in, "Unknown check option in command '", + ObjStr(obj->cmdName), " ", ObjStr(objv[0]), + " ", ObjStr(objv[1]), + "', valid: all pre post invar instinvar", (char*) NULL); + } + + Tcl_ResetResult(in); + return TCL_OK; +} + +static int +XOTclOMixinMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + int oc; Tcl_Obj **ov; + XOTclObject *obj = (XOTclObject*)cd; + int i, result = TCL_OK; + XOTclObjectOpt *opt; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 2) + return XOTclObjErrArgCnt(in, obj->cmdName, "mixin ?args?"); + + if (Tcl_ListObjGetElements(in, objv[1], &oc, &ov)!= TCL_OK) + return TCL_ERROR; + + if (obj->opt) { + CmdListRemoveList(&obj->opt->mixins, GuardDel); + } + + obj->flags &= ~XOTCL_MIXIN_ORDER_VALID; + opt = XOTclRequireObjectOpt(obj); + + /* + * since mixin procs may be used as filters -> we have to invalidate + */ + obj->flags &= ~XOTCL_FILTER_ORDER_VALID; + + for (i = 0; i < oc; i++) { + result = MixinAdd(in, &opt->mixins, ov[i]); + /*CmdListPrint("object mixins\n", opt->mixins);*/ + if (result != TCL_OK) + return result; + } + + MixinComputeDefined(in, obj); + FilterComputeDefined(in, obj); + + return result; +} + + +static int +XOTclOMixinGuardMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + XOTclCmdList* h; + XOTclObjectOpt *opt; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 3) + return XOTclObjErrArgCnt(in, obj->cmdName, "mixinguard mixin guards"); + + opt = obj->opt; + if (opt && opt->mixins) { + XOTclClass *mixinCl = GetClass(in, ObjStr(objv[1])); + Tcl_Command mixinCmd = NULL; + if (mixinCl) { + mixinCmd = Tcl_GetCommandFromObj(in, mixinCl->object.cmdName); + } + if (mixinCmd) { + h = CmdListFindCmdInList(mixinCmd, opt->mixins); + if (h) { + if (h->clientData) + GuardDel((XOTclCmdList*) h); + GuardAdd(in, h, objv[2]); + obj->flags &= ~XOTCL_MIXIN_ORDER_VALID; + return TCL_OK; + } + } + } + + return XOTclVarErrMsg(in, "Mixinguard: can't find mixin ", + ObjStr(objv[1]), " on ", ObjStr(obj->cmdName), NULL); +} + +static int +XOTclOFilterMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + int oc; Tcl_Obj **ov; + XOTclObject *obj = (XOTclObject*)cd; + int i, result = TCL_OK; + XOTclObjectOpt *opt; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 2) + return XOTclObjErrArgCnt(in, obj->cmdName, "filter filterNameList"); + + if (Tcl_ListObjGetElements(in, objv[1], &oc, &ov) != TCL_OK) + return TCL_ERROR; + + if (obj->opt) { + CmdListRemoveList(&obj->opt->filters, GuardDel); + } + + obj->flags &= ~XOTCL_FILTER_ORDER_VALID; + opt = XOTclRequireObjectOpt(obj); + + for (i = 0; i < oc; i ++) { + result = FilterAdd(in, &opt->filters, ov[i], obj, 0); + if (result != TCL_OK) + return result; + } + /*FilterComputeDefined(in, obj);*/ + return result; +} + +static int +XOTclOFilterGuardMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + XOTclCmdList* h; + XOTclObjectOpt *opt; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 3) + return XOTclObjErrArgCnt(in, obj->cmdName, "filterguard filtername filterGuards"); + + opt = obj->opt; + if (opt && opt->filters) { + h = CmdListFindNameInList(in, ObjStr(objv[1]), opt->filters); + if (h) { + if (h->clientData) + GuardDel((XOTclCmdList*) h); + GuardAdd(in, h, objv[2]); + obj->flags &= ~XOTCL_FILTER_ORDER_VALID; + return TCL_OK; + } + } + + return XOTclVarErrMsg(in, "Filterguard: can't find filter ", + ObjStr(objv[1]), " on ", ObjStr(obj->cmdName), NULL); +} + +/* + * Searches for filter on [self] and returns fully qualified name + * if it is not found it returns an empty string + */ +static int +XOTclOFilterSearchMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + char *methodName, *fullName; + XOTclCmdList *cmdList; + XOTclClass *fcl; + XOTclObject *fobj; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 2) return XOTclObjErrArgCnt(in, obj->cmdName, "filtersearch name"); + Tcl_ResetResult(in); + + if (!(obj->flags & XOTCL_FILTER_ORDER_VALID)) + FilterComputeDefined(in, obj); + if (!(obj->flags & XOTCL_FILTER_ORDER_DEFINED)) + return TCL_OK; + + methodName = ObjStr(objv[1]); + cmdList = obj->filterOrder; + + while (cmdList) { + CONST84 char *filterName = Tcl_GetCommandName(in, cmdList->cmdPtr); + if (filterName[0] == methodName[0] && !strcmp(filterName, methodName)) + break; + cmdList = cmdList->next; + } + + if (!cmdList) + return TCL_OK; + + fullName = NSCmdFullName(cmdList->cmdPtr); + if ((fcl = GetClassFromFullName(in, fullName))) { + fobj = 0; + } else { + fobj = GetObject(in, fullName); + } + + Tcl_SetObjResult(in, getFullProcQualifier(in, methodName, fobj, fcl)); + return TCL_OK; +} + +static int +XOTclOProcSearchMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + XOTclClass *cl = 0; + Tcl_Command cmd = 0; + char *simpleName, *methodName; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 2) return XOTclObjErrArgCnt(in, obj->cmdName, "procsearch name"); + + Tcl_ResetResult(in); + + methodName = ObjStr(objv[1]); + + if (obj->nsPtr) + cmd = FindMethod(methodName, Tcl_Namespace_cmdTable(obj->nsPtr)); + + if (!cmd) { + if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) + MixinComputeDefined(in, obj); + + if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { + XOTclCmdList* mixinList = obj->mixinOrder; + while (mixinList) { + XOTclClass *mcl = GetClass(in, (char *)Tcl_GetCommandName(in, mixinList->cmdPtr)); + if (mcl && SearchCMethod(mcl, methodName, &cmd)) + break; + mixinList = mixinList->next; + } + } + } + + if (!cmd && obj->cl) + cl = SearchCMethod(obj->cl, methodName, &cmd); + + if (cmd) { + char *fullName = NSCmdFullName(cmd); + XOTclClass *pcl = GetClassFromFullName(in, fullName); + XOTclObject *pobj = pcl ? 0 : GetObject(in, fullName); + simpleName = (char*) Tcl_GetCommandName(in, cmd); + Tcl_SetObjResult(in, getFullProcQualifier(in, simpleName, pobj, pcl)); + } + return TCL_OK; +} + +static int +XOTclORequireNamespaceMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc != 1) return XOTclObjErrArgCnt(in, obj->cmdName, "requireNamespace"); + + requireObjNamespace(in, obj); + return TCL_OK; +} + +typedef enum {NO_DASH, SKALAR_DASH, LIST_DASH} dashArgType; + +static dashArgType +isDashArg(Tcl_Interp *in, Tcl_Obj *obj, char **methodName, int *objc, Tcl_Obj **objv[]) { + char *flag; + static Tcl_ObjType *listType = NULL; + + assert(obj); + + /* fetch list type, if not set already; if used on more places, this should + be moved into the interpreter state + */ + if (listType == NULL) { +#if defined(PRE82) + Tcl_Obj *tmp = Tcl_NewListObj(1, &obj); + listType = tmp->typePtr; + DECR_REF_COUNT(tmp); +#else + static XOTclMutex initMutex = 0; + XOTclMutexLock(&initMutex); + if (listType == NULL) { + listType = Tcl_GetObjType("list"); + } + XOTclMutexUnlock(&initMutex); +#endif + } + + if (obj->typePtr == listType) { + if (Tcl_ListObjGetElements(in, obj, objc, objv) == TCL_OK && *objc>0) { + flag = ObjStr(*objv[0]); + if (*flag == '-') { + *methodName = flag+1; + return LIST_DASH; + } + } + } + flag = ObjStr(obj); + if (*flag == '-' && isalpha((int)*((flag)+1))) { + *methodName = flag+1; + *objc = 1; + return SKALAR_DASH; + } + return NO_DASH; +} + +static int +callConfigureMethod(Tcl_Interp *in, XOTclObject *obj, + char *methodName, int argc, Tcl_Obj *argv[]) { + int result; + Tcl_Obj *method = Tcl_NewStringObj(methodName,-1); + + /*fprintf(stderr,"callConfigureMethod method %s->'%s' argc %d\n", + ObjStr(obj->cmdName), methodName, argc);*/ + + if (isInitString(methodName)) + obj->flags |= XOTCL_INIT_CALLED; + + INCR_REF_COUNT(method); + result = callMethod((ClientData)obj, in, method, argc, argv, XOTCL_CM_NO_UNKNOWN); + DECR_REF_COUNT(method); + + /* fprintf(stderr, "method '%s' called args: %d o=%p, result=%d\n", + methodName, argc+1, obj, result); */ + + if (result != TCL_OK) { + Tcl_AppendResult(in, " during '", ObjStr(obj->cmdName), " ", + methodName, "'", 0); + } + return result; +} + + +static int +XOTclOConfigureMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + Tcl_Obj **argv, **nextArgv; + int i, argc, nextArgc, normalArgs, result = TCL_OK, isdasharg = NO_DASH; + char *methodName, *nextMethodName; + + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 1) return XOTclObjErrArgCnt(in, obj->cmdName, + "configure ?args?"); + /* find arguments without leading dash */ + for (i=1; i < objc; i++) { + if ((isdasharg = isDashArg(in, objv[i], &methodName, &argc, &argv))) + break; + } + normalArgs = i-1; + + for( ; i < objc; argc=nextArgc, argv=nextArgv, methodName=nextMethodName) { + Tcl_ResetResult(in); + switch (isdasharg) { + case SKALAR_DASH: /* argument is a skalar with a leading dash */ + { int j; + for (j = i+1; j < objc; j++, argc++) { + if ((isdasharg = isDashArg(in, objv[j], &nextMethodName, &nextArgc, &nextArgv))) + break; + } + result = callConfigureMethod(in, obj, methodName, argc+1, objv+i+1); + if (result != TCL_OK) + return result; + i += argc; + break; + } + case LIST_DASH: /* argument is a list with a leading dash, grouping determined by list */ + { i++; + if (icmdName), + " configure: unexpected argument '", ObjStr(objv[i]), + "' between parameters", 0); + return TCL_ERROR; + } + } + } + Tcl_ResetResult(in); + Tcl_SetIntObj(Tcl_GetObjResult(in), normalArgs); + return result; +} + + +/* + * class method implementations + */ + +static int +XOTclCInstDestroyMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + XOTclObject *delobj; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc < 2) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "instdestroy "); + + if (GetXOTclObjectFromObj(in, objv[1], &delobj) != TCL_OK) + return XOTclVarErrMsg(in, "Can't destroy object ", + ObjStr(objv[1]), " that does not exist.", NULL); + /* + * latch, and call delete command if not already in progress + */ + delobj->flags |= XOTCL_DESTROY_CALLED; + RUNTIME_STATE(in)->callIsDestroy = 1; + + if (RUNTIME_STATE(in)->exitHandlerDestroyRound != + XOTCL_EXITHANDLER_ON_SOFT_DESTROY) { + CallStackDestroyObject(in, delobj); + } + + return TCL_OK; +} + +static int +XOTclCAllocMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + XOTclClass *newcl; + XOTclObject *newobj; + int result; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc < 2) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "alloc ?args?"); + +#if 0 + fprintf(stderr, "type(%s)=%p %s %d\n", + ObjStr(objv[1]), objv[1]->typePtr, objv[1]->typePtr? + objv[1]->typePtr->name:"NULL", + GetXOTclObjectFromObj(in, objv[1], &newobj) + ); + /* + * if the lookup via GetObject for the object succeeds, + * the object exists already, + * and we do not overwrite it, but re-create it + */ + if (GetXOTclObjectFromObj(in, objv[1], &newobj) == TCL_OK) { + fprintf(stderr, "lookup successful\n"); + result = doCleanup(in, newobj, &cl->object, objc, objv); + } else +#endif + { + /* + * create a new object from scratch + */ + if (IsMetaClass(in, cl)) { + /* + * if the base class is a meta-class, we create a class + */ + newcl = PrimitiveCCreate(in, ObjStr(objv[1]), cl); + if (newcl == 0) + result = XOTclVarErrMsg(in, "Class alloc failed for '",ObjStr(objv[1]), + "' (possibly parent namespace does not exist)", NULL); + else { + Tcl_SetObjResult(in, newcl->object.cmdName); + result = TCL_OK; + } + } else { + /* + * if the base class is an ordinary class, we create an object + */ + newobj = PrimitiveOCreate(in, ObjStr(objv[1]), cl); + if (newobj == 0) + result = XOTclVarErrMsg(in, "Object alloc failed for '",ObjStr(objv[1]), + "' (possibly parent namespace does not exist)", NULL); + else { + result = TCL_OK; + Tcl_SetObjResult(in, newobj->cmdName); + } + } + } + + return result; +} + + +static int +XOTclCCreateMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + XOTclObject *obj = &cl->object; + XOTclObject *newobj; + + int result; + unsigned nameLength; + char *objName; + Tcl_Obj *nameObj; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 2) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "create ?args?"); + + /* + * Check whether we have to call recreate (i.e. when the + * object exists already) + */ + /* fprintf(stderr,"+++ create objv[1] = %p (%d) %s\n", + objv[1],objv[1]->refCount,ObjStr(objv[1])); */ + + if (GetXOTclObjectFromObj(in, objv[1], &newobj) == TCL_OK) { + /*fprintf(stderr, "+++ recreate, call recreate method ... %s\n", ObjStr(objv[1]));*/ + /* call recreate --> initialization */ + result = callMethod((ClientData) obj, in, + XOTclGlobalObjects[RECREATE], objc+1, objv+1, 0); + if (result != TCL_OK) + return result; + + Tcl_SetObjResult(in, newobj->cmdName); + nameObj = newobj->cmdName; + objTrace("RECREATE", newobj); + + } else { + objName = Tcl_GetStringFromObj(objv[1],&nameLength); + if (!NSCheckColons(objName, nameLength)) + return XOTclVarErrMsg(in, "Cannot create object -- illegal name '", + objName, "'", (char *)NULL); + /* + * call "alloc" + */ + /* fprintf(stderr, "alloc ... %s\n", ObjStr(objv[1]));*/ + result = callMethod((ClientData) obj, in, + XOTclGlobalObjects[ALLOC], objc+1, objv+1, 0); + if (result != TCL_OK) + return result; + + newobj = GetObject(in, objName); + if (newobj == 0) + return XOTclErrMsg(in, "couldn't find result of alloc", TCL_STATIC); + nameObj = newobj->cmdName; + + (void)RemoveInstance(newobj, newobj->cl); + AddInstance(newobj, cl); + objTrace("CREATE", newobj); + + /* in case, the object is destroyed during initialization, we incr refcount */ + INCR_REF_COUNT(nameObj); + result = doObjInitialization(in, newobj, objc, objv); + DECR_REF_COUNT(nameObj); + } + /* fprintf(stderr, "alloc -- end ... %s\n", ObjStr(objv[1]));*/ + + return result; +} + +static char * +XOTclUnsetTrace(ClientData cd, Tcl_Interp *in, CONST84 char *name, CONST84 char *name2, int flags) +{ + Tcl_Obj *obj = (Tcl_Obj *)cd; + XOTclObject *o; + char *result = NULL; + + if (GetXOTclObjectFromObj(in, obj, &o) == TCL_OK) { + Tcl_Obj *res = Tcl_GetObjResult(in); /* save the result */ + INCR_REF_COUNT(res); + + if (callMethod((ClientData)o, in, XOTclGlobalObjects[DESTROY],2,0,0) != TCL_OK) { + result = "Destroy for volatile object failed"; + } else + result = "No XOTcl Object passed"; + + Tcl_SetObjResult(in, res); /* restore the result */ + DECR_REF_COUNT(res); + } + DECR_REF_COUNT(obj); + return result; +} + + + +static int +XOTclCNewMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + XOTclObject *obj = &cl->object, *child = NULL; + Tcl_Obj *fullname; + int result, offset = 1, +#if REFCOUNTED + isrefcount = 0, +#endif + i; + Tcl_DString dFullname, *dsPtr = &dFullname; + XOTclStringIncrStruct *iss = &RUNTIME_STATE(in)->iss; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 1) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "new [-childof obj] ?args?"); + + for (i=1; icmdName), -1); + Tcl_DStringAppend(dsPtr, "::__#", 5); + } else { + Tcl_DStringAppend(dsPtr, "::xotcl::__#", 12); + } + (void)XOTclStringIncr(iss); + Tcl_DStringAppend(dsPtr, iss->start, iss->length); + + fullname = Tcl_NewStringObj(Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr)); + + INCR_REF_COUNT(fullname); + + objc -= offset; + { + DEFINE_NEW_TCL_OBJS_ON_STACK(objc+3, ov); + + ov[0] = objv[0]; + ov[1] = XOTclGlobalObjects[CREATE]; + ov[2] = fullname; + if (objc >= 1) + memcpy(ov+3, objv+offset, sizeof(Tcl_Obj *)*objc); + + result = DoDispatch(cd, in, objc+3, ov, 0); + FREE_TCL_OBJS_ON_STACK(ov); + } + +#if REFCOUNTED + if (result == TCL_OK) { + if (isrefcount) { + Tcl_Obj *obj = Tcl_GetObjResult(in); + XOTclObject *o = (XOTclObject*) obj->internalRep.otherValuePtr; + o->flags |= XOTCL_REFCOUNTED; + o->teardown = in; + DECR_REF_COUNT(obj); + } + } +#endif + + DECR_REF_COUNT(fullname); + Tcl_DStringFree(dsPtr); + + return result; +} + + +static int +XOTclCRecreateMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + XOTclObject *obj = &cl->object, *newobj; + int result; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (objc < 2) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "recreate ?args?"); + + if (GetXOTclObjectFromObj(in, objv[1], &newobj) != TCL_OK) + return XOTclVarErrMsg(in, "can't recreate not existing obj ", + ObjStr(objv[1]), (char *)NULL); + + INCR_REF_COUNT(objv[1]); + newobj->flags |= XOTCL_RECREATE; + + result = doCleanup(in, newobj, obj, objc, objv); + if (result == TCL_OK) { + result = doObjInitialization(in, newobj, objc, objv); + if (result == TCL_OK) + Tcl_SetObjResult(in, objv[1]); + } + DECR_REF_COUNT(objv[1]); + return result; +} + +static int +XOTclCSuperClassMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + XOTclClasses* osl = 0; + int oc; Tcl_Obj **ov; + XOTclClass **scl = 0; + int reversed = 0; + int i, j; + XOTclClasses* filterCheck = ComputeOrder(cl, Super); + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc != 2) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "superclass "); + + if (Tcl_ListObjGetElements(in, objv[1], &oc, &ov)!= TCL_OK || oc==0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "superclass "); + + + /* + * we have to remove all dependent superclass filter referenced + * by class or one of its subclasses + * + * do not check the class "cl" itself (first entry in + * filterCheck class list) + */ + if (filterCheck) + filterCheck = filterCheck->next; + while (filterCheck) { + FilterRemoveDependentFilterCmds(cl, filterCheck->cl); + filterCheck = filterCheck->next; + } + + /* invalidate all interceptors orders of instances of this + and of all depended classes */ + MixinInvalidateObjOrders(cl); + FilterInvalidateObjOrders(in, cl); + + scl = NEW_ARRAY(XOTclClass*,oc); + for (i = 0; i < oc; i++) { + if (GetXOTclClassFromObj(in, ov[i], &scl[i], 1) != TCL_OK) { + FREE(XOTclClass**, scl); + return XOTclErrBadVal(in, "a list of classes", ObjStr(objv[1])); + } + } + + /* + * check that superclasses don't precede their classes + */ + + for (i = 0; i < oc; i++) { + if (reversed != 0) break; + for (j = i+1; j < oc; j++) { + XOTclClasses* dl = ComputeOrder(scl[j], Super); + if (reversed != 0) break; + while (dl != 0) { + if (dl->cl == scl[i]) break; + dl = dl->next; + } + if (dl != 0) reversed = 1; + } + } + + if (reversed != 0) { + return XOTclErrBadVal(in, "classes in dependence order", ObjStr(objv[1])); + } + + while (cl->super != 0) { + + /* + * build up an old superclass list in case we need to revert + */ + + XOTclClass *sc = cl->super->cl; + XOTclClasses* l = osl; + osl = NEW(XOTclClasses); + osl->cl = sc; + osl->next = l; + (void)RemoveSuper(cl, cl->super->cl); + } + for (i = 0; i < oc; i++) + AddSuper(cl, scl[i]); + FREE(XOTclClass**,scl); + FlushPrecedences(cl); + + if (!ComputeOrder(cl, Super)) { + + /* + * cycle in the superclass graph, backtrack + */ + + XOTclClasses* l; + while (cl->super != 0) (void)RemoveSuper(cl, cl->super->cl); + for (l = osl; l != 0; l = l->next) AddSuper(cl, l->cl); + XOTclFreeClasses(osl); + return XOTclErrBadVal(in, "a cycle-free graph", ObjStr(objv[1])); + } + XOTclFreeClasses(osl); + + /* if there are no more super classes add the Object + class as superclasses */ + if (cl->super == 0) + AddSuper(cl, RUNTIME_STATE(in)->theObject); + + Tcl_ResetResult(in); + return TCL_OK; +} + +static int +XOTclCInfoMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + Tcl_Namespace *nsp = cl->nsPtr; + XOTclClassOpt* opt = cl->opt; + + char *pattern, *cmd; + int modifiers = 0; + + if (!cl) + return XOTclObjErrType(in, objv[0], "Class"); + if (objc < 2) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "info ?args?"); + + cmd = ObjStr(objv[1]); + pattern = (objc > 2) ? ObjStr(objv[2]) : 0; + + /* + * check for "-" modifiers + */ + if (pattern && *pattern == '-') { + modifiers = countModifiers(objc, objv); + pattern = (objc > 2+modifiers) ? ObjStr(objv[2+modifiers]) : 0; + } + + switch (*cmd) { + case 'c': + if (!strcmp(cmd, "classchildren")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "info classchildren ?pat?"); + return ListChildren(in, (XOTclObject*) cl, pattern, 1); + } else if (!strcmp(cmd, "classparent")) { + if (objc > 2 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "info classparent"); + return ListParent(in, &cl->object); + } + break; + + case 'h': + if (!strcmp(cmd, "heritage")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "info heritage ?pat?"); + return ListHeritage(in, cl, pattern); + } + break; + + case 'i': + if (cmd[1] == 'n' && cmd[2] == 's' && cmd[3] == 't') { + char *cmdTail = cmd + 4; + switch (*cmdTail) { + case 'a': + if (!strcmp(cmdTail, "ances")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "info instances ?pat?"); + return ListObjPtrHashTable(in, &cl->instances, pattern); + } else if (!strcmp(cmdTail, "args")) { + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "info instargs "); + return ListProcArgs(in, Tcl_Namespace_cmdTable(nsp), pattern); + } + break; + + case 'b': + if (!strcmp(cmdTail, "body")) { + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "info instbody "); + return ListProcBody(in, Tcl_Namespace_cmdTable(nsp), pattern); + } + break; + + case 'c': + if (!strcmp(cmdTail, "commands")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "info instcommands ?pat?"); + return ListKeys(in, Tcl_Namespace_cmdTable(nsp), pattern); + } + break; + + case 'd': + if (!strcmp(cmdTail, "default")) { + if (objc != 5 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "info instdefault "); + return ListProcDefault(in, Tcl_Namespace_cmdTable(nsp), pattern, + ObjStr(objv[3]), objv[4]); + } + break; + + case 'f': + if (!strcmp(cmdTail, "filter")) { + int withGuards = 0; + if (objc-modifiers > 3) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "info instfilter ?-guards? ?pat?"); + if (modifiers > 0) { + withGuards = checkForModifier(objv, modifiers, "-guards"); + if (withGuards == 0) + return XOTclVarErrMsg(in, "info instfilter: unknown modifier ", + ObjStr(objv[2]), (char *)NULL); + } + return opt ? FilterInfo(in, opt->instfilters, pattern, withGuards, 0) : TCL_OK; + + } else if (!strcmp(cmdTail, "filterguard")) { + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "info instfilterguard filter"); + return opt ? GuardList(in, opt->instfilters, pattern) : TCL_OK; + } + break; + + case 'i': + if (!strcmp(cmdTail, "invar")) { + XOTclAssertionStore *assertions = opt ? opt->assertions : 0; + if (objc != 2 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "info instinvar"); + + if (assertions && assertions->invariants) + Tcl_SetObjResult(in, AssertionList(in, assertions->invariants)); + return TCL_OK; + } + break; + + case 'm': + if (!strcmp(cmdTail, "mixin")) { + int withGuards = 0; + + if (objc-modifiers > 3 || modifiers > 1) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "info instmixin ?-guards? ?class?"); + if (modifiers > 0) { + withGuards = checkForModifier(objv, modifiers, "-guards"); + if (withGuards == 0) + return XOTclVarErrMsg(in, "info instfilter: unknown modifier ", + ObjStr(objv[2]), (char *)NULL); + } + return opt ? MixinInfo(in, opt->instmixins, pattern, withGuards) : TCL_OK; + + } else if (!strcmp(cmdTail, "mixinguard")) { + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "info instmixinguard mixin"); + return opt ? GuardList(in, opt->instmixins, pattern) : TCL_OK; + } + break; + + case 'p': + if (!strcmp(cmdTail, "procs")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "info instprocs ?pat?"); + return ListMethodKeys(in, Tcl_Namespace_cmdTable(nsp), pattern, + /*noProcs*/ 0, /*noCmds*/ 1, /* noDups */ 0); + } else if (!strcmp(cmdTail, "pre")) { + XOTclProcAssertion* procs; + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "info instpre "); + if (opt && opt->assertions) { + procs = AssertionFindProcs(opt->assertions, ObjStr(objv[2])); + if (procs) Tcl_SetObjResult(in, AssertionList(in, procs->pre)); + } + return TCL_OK; + } else if (!strcmp(cmdTail, "post")) { + XOTclProcAssertion* procs; + if (objc != 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "info instpost "); + if (opt && opt->assertions) { + procs = AssertionFindProcs(opt->assertions, ObjStr(objv[2])); + if (procs) Tcl_SetObjResult(in, AssertionList(in, procs->post)); + } + return TCL_OK; + } + break; + } + } + break; + + case 'p': + if (!strcmp(cmd, "parameterclass")) { + if (opt && opt->parameterClass) { + Tcl_SetObjResult(in, opt->parameterClass); + } else { + Tcl_SetObjResult(in, XOTclGlobalObjects[PARAM_CL]); + } + return TCL_OK; + } else if (!strcmp(cmd, "parameter")) { + if (cl->parameters) { + Tcl_SetObjResult(in, cl->parameters); + } else { + Tcl_SetObjResult(in, XOTclGlobalObjects[EMPTY]); + } + return TCL_OK; + } + break; + + case 's': + if (!strcmp(cmd, "superclass")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "info superclass ?class?"); + return ListSuperclasses(in, cl, pattern); + } else if (!strcmp(cmd, "subclass")) { + if (objc > 3 || modifiers > 0) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "info subclass ?class?"); + return ListSubclasses(in, cl, pattern); + } + break; + } + return XOTclOInfoMethod(cd, in, objc, (Tcl_Obj **)objv); +} + +static int +XOTclCParameterMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + XOTclObject *obj = &cl->object; + Tcl_Obj **pv = 0; + Tcl_Obj **ov = 0; + int elts, pc, oc, result; + char * params; + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc != 2) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "parameter ?params?"); + if (cl->parameters) { + DECR_REF_COUNT(cl->parameters); + } + /* did we delete the parameters ? */ + params = ObjStr(objv[1]); + if ((params == NULL) || (*params == '\0')) { + cl->parameters = 0; + return TCL_OK; + } + + /* ok, remember the params */ + cl->parameters = objv[1]; + INCR_REF_COUNT(cl->parameters); + + /* call getter/setter methods in params */ + result = Tcl_ListObjGetElements(in, objv[1], &pc, &pv); + if (result == TCL_OK) { + for (elts = 0; elts < pc; elts++) { + result = Tcl_ListObjGetElements(in, pv[elts], &oc, &ov); + if (result == TCL_OK && oc > 0 ) { + result = callParameterMethodWithArg(obj, in, XOTclGlobalObjects[MKGETTERSETTER], + cl->object.cmdName, 3+oc, ov,0); + } + if (result != TCL_OK) + break; + } + } + return result; +} +static int +XOTclCParameterClassMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + char *paramClStr; + XOTclClassOpt* opt = cl->opt; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc != 2) + return XOTclObjErrArgCnt(in, cl->object.cmdName, "parameterclass cl"); + + paramClStr = ObjStr(objv[1]); + if (opt && opt->parameterClass) { + DECR_REF_COUNT(opt->parameterClass); + } + if ((paramClStr == NULL) || (*paramClStr == '\0')) { + if (opt) + opt->parameterClass = 0; + } else { + opt = XOTclRequireClassOpt(cl); + opt->parameterClass = objv[1]; + INCR_REF_COUNT(opt->parameterClass); + } + return TCL_OK; +} + +static int +XOTclCInstParameterCmdMethod(ClientData cd, Tcl_Interp *in, + int objc, Tcl_Obj * CONST objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc < 2) return XOTclObjErrArgCnt(in, cl->object.cmdName, "instparametercmd name"); + XOTclAddIMethod(in, (XOTcl_Class*) cl, ObjStr(objv[1]), + (Tcl_ObjCmdProc*)XOTclSetterMethod, 0, 0); + return TCL_OK; +} + +static int +XOTclCParameterCmdMethod(ClientData cd, Tcl_Interp *in, + int objc, Tcl_Obj * CONST objv[]) { + XOTclObject *obj = (XOTclObject*) cd; + + if (objc < 2) return XOTclObjErrArgCnt(in, obj->cmdName, "parametercmd name"); + XOTclAddPMethod(in, (XOTcl_Object*) obj, ObjStr(objv[1]), + (Tcl_ObjCmdProc*)XOTclSetterMethod, 0, 0); + return TCL_OK; +} + +static void tclCmdDeleteProc(ClientData cd) { + tclCmdClientData *tcd = (tclCmdClientData *)cd; + DECR_REF_COUNT(tcd->cmdName); + FREE(tclCmdClientData, tcd); +} + +static int +XOTclCInstTclCmdMethod(ClientData cd, Tcl_Interp *in, + int objc, Tcl_Obj * CONST objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + tclCmdClientData *tcd; + char *cmdName; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc < 2) return XOTclObjErrArgCnt(in, cl->object.cmdName, "insttclcmd name"); + cmdName = ObjStr(objv[1]); + tcd = NEW(tclCmdClientData); + tcd->obj = (XOTcl_Object*)cl; + tcd->cmdName = objv[1]; + INCR_REF_COUNT(tcd->cmdName); + + XOTclAddIMethod(in, (XOTcl_Class*) cl, NSTail(cmdName), + (Tcl_ObjCmdProc*)XOTclOEvalMethod, + (ClientData)tcd, tclCmdDeleteProc); + return TCL_OK; +} + +static int +XOTclCTclCmdMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { + XOTcl_Object *obj = (XOTcl_Object*) cd; + char *cmdName; + Tcl_Obj *cmdObj; + tclCmdClientData *tcd; + + if (objc < 2) return XOTclObjErrArgCnt(in, obj->cmdName, "tclcmd name"); + + cmdName = ObjStr(objv[1]); + if (*cmdName != ':') { + cmdObj = Tcl_NewStringObj("::", 2); + Tcl_AppendObjToObj(cmdObj, objv[1]); + } else { + cmdObj = objv[1]; + } + tcd = NEW(tclCmdClientData); + tcd->obj = obj; + tcd->cmdName = cmdObj; + INCR_REF_COUNT(tcd->cmdName); + /* + fprintf(stderr,"tcd?%p, tcd->cmdName=%p, %s\n", + tcd, tcd->cmdName, ObjStr(tcd->cmdName)); + */ + + XOTclAddPMethod(in, obj, NSTail(cmdName), (Tcl_ObjCmdProc*)XOTclOEvalMethod, + (ClientData)tcd, tclCmdDeleteProc); + return TCL_OK; +} + +static int +XOTclCVolatileMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { + XOTclObject *obj = (XOTclObject*) cd; + Tcl_Obj *o = obj->cmdName; + int result = TCL_ERROR; + char *fullName = ObjStr(o); + char *vn; + callFrameContext ctx = {0}; + + if (objc != 1) return XOTclObjErrArgCnt(in, obj->cmdName, "volatile"); + + CallStackUseActiveFrames(in, &ctx); + vn = NSTail(fullName); + if (Tcl_SetVar2(in, vn, 0, fullName, 0) != NULL) { + result = Tcl_TraceVar(in, vn, TCL_TRACE_UNSETS, (Tcl_VarTraceProc*)XOTclUnsetTrace, + (ClientData)o); + } + CallStackRestoreSavedFrames(in, &ctx); + + if (result == TCL_OK) { + INCR_REF_COUNT(o); + } + return result; +} + +static int +XOTclCInstProcMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + char *argStr, *bdyStr, *name; + XOTclClassOpt* opt; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc != 4 && objc != 6) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "instproc name args body ?preAssertion postAssertion?"); + + argStr = ObjStr(objv[2]); + bdyStr = ObjStr(objv[3]); + name = ObjStr(objv[1]); + + if ((cl == RUNTIME_STATE(in)->theObject && isDestroyString(name)) || + (cl == RUNTIME_STATE(in)->theClass && isInstDestroyString(name)) || + (cl == RUNTIME_STATE(in)->theClass && isAllocString(name)) || + (cl == RUNTIME_STATE(in)->theClass && isCreateString(name))) + return XOTclVarErrMsg(in, className(cl), " instproc: '", name, "' of ", + className(cl), " can not be overwritten. Derive a ", + "sub-class", (char*) NULL); + + if (*argStr == 0 && *bdyStr == 0) { + opt = cl->opt; + if (opt && opt->assertions) + AssertionRemoveProc(opt->assertions, name); + NSDeleteCmd(in, cl->nsPtr, name); + } else { + opt = XOTclRequireClassOpt(cl); + if (!opt->assertions) + opt->assertions = AssertionCreateStore(); + MakeProc(cl->nsPtr, opt->assertions, in, objc, (Tcl_Obj **) objv); + } + + /* could be a filter or filter inheritance ... update filter orders */ + FilterInvalidateObjOrders(in, cl); + + return TCL_OK; +} + +static int +XOTclCInstFilterMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + int i, result = TCL_OK; + Tcl_Obj **ov; int oc; + XOTclClassOpt* opt; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc < 2) return XOTclObjErrArgCnt(in, cl->object.cmdName, + "instfilter filterNameList"); + + if (Tcl_ListObjGetElements(in, objv[1], &oc, &ov) != TCL_OK) + return TCL_ERROR; + + opt = cl->opt; + if (opt) + CmdListRemoveList(&opt->instfilters, GuardDel); + + FilterInvalidateObjOrders(in, cl); + opt = XOTclRequireClassOpt(cl); + + for (i = 0; i < oc; i ++) { + result = FilterAdd(in, &opt->instfilters, ov[i], 0, cl); + if (result != TCL_OK) + return result; + } + return result; +} + +static int +XOTclCInstFilterGuardMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + XOTclCmdList* h; + XOTclClassOpt* opt; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc != 3) return XOTclObjErrArgCnt(in, cl->object.cmdName, + "instfilterguard filtername filterGuard"); + + opt = cl->opt; + if (opt && opt->instfilters) { + h = CmdListFindNameInList(in, ObjStr(objv[1]), opt->instfilters); + if (h) { + if (h->clientData) + GuardDel(h); + GuardAdd(in, h, objv[2]); + FilterInvalidateObjOrders(in, cl); + return TCL_OK; + } + } + + return XOTclVarErrMsg(in, "Instfilterguard: can't find filter ", + ObjStr(objv[1]), " on ", ObjStr(cl->object.cmdName), NULL); +} + + +static int +XOTclCInstMixinMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + int oc; Tcl_Obj **ov; + XOTclClass *cl = XOTclObjectToClass(cd); + int i, result = TCL_OK; + XOTclClassOpt* opt; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc < 2) return XOTclObjErrArgCnt(in, cl->object.cmdName, + "instmixin classList"); + + if (Tcl_ListObjGetElements(in, objv[1], &oc, &ov)!= TCL_OK) + return TCL_ERROR; + + if ((opt = cl->opt)) + CmdListRemoveList(&opt->instmixins, GuardDel); + + MixinInvalidateObjOrders(cl); + /* + * since mixin procs may be used as filters -> we have to invalidate + */ + FilterInvalidateObjOrders(in, cl); + + opt = XOTclRequireClassOpt(cl); + for (i = 0; i < oc; i++) { + result = MixinAdd(in, &opt->instmixins, ov[i]); + if (result != TCL_OK) + return result; + } + return result; +} + +static int +XOTclCInstMixinGuardMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + XOTclCmdList* h; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc != 3) return XOTclObjErrArgCnt(in, cl->object.cmdName, + "instmixinguard mixin guard"); + + if (cl->opt && cl->opt->instmixins) { + XOTclClass *mixinCl = GetClass(in, ObjStr(objv[1])); + Tcl_Command mixinCmd = NULL; + if (mixinCl) { + mixinCmd = Tcl_GetCommandFromObj(in, mixinCl->object.cmdName); + } + if (mixinCmd) { + h = CmdListFindCmdInList(mixinCmd, cl->opt->instmixins); + if (h) { + if (h->clientData) + GuardDel((XOTclCmdList*) h); + GuardAdd(in, h, objv[2]); + MixinInvalidateObjOrders(cl); + return TCL_OK; + } + } + } + + return XOTclVarErrMsg(in, "Instmixinguard: can't find mixin ", + ObjStr(objv[1]), " on ", ObjStr(cl->object.cmdName), NULL); +} + +static int +XOTclCInvariantsMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + XOTclClass *cl = XOTclObjectToClass(cd); + XOTclClassOpt* opt; + + if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (objc != 2) + return XOTclObjErrArgCnt(in, cl->object.cmdName, + "instinvar "); + opt = XOTclRequireClassOpt(cl); + + if (opt->assertions) + TclObjListFreeList(opt->assertions->invariants); + else + opt->assertions = AssertionCreateStore(); + + opt->assertions->invariants = AssertionNewList(in, objv[1]); + return TCL_OK; +} + +static int +XOTclCUnknownMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *obj = (XOTclObject*) cd; + char *self = ObjStr(obj->cmdName); + int rc; + + if (objc < 2) return XOTclObjErrArgCnt(in, objv[0], "message ?args .. args?"); + if (isCreateString(self)) + return XOTclVarErrMsg(in, "error ", self, ": unable to dispatch '", + ObjStr(objv[1]), "'", (char*)NULL); + + rc = callMethod(cd, in, XOTclGlobalObjects[CREATE], objc+1, objv+1, 0); + return rc; +} + +/* + * New Tcl Commands + */ +static int +XOTcl_NSCopyCmds(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + Tcl_Command cmd; + Tcl_Obj *newFullCmdName, *oldFullCmdName; + char *newName, *oldName, *name; + Tcl_Namespace *ns, *newNs; + Tcl_HashTable *cmdTable; + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr; + + if (objc != 3) + return XOTclObjErrArgCnt(in, NULL, "namespace_copycmds fromNs toNs"); + + ns = Tcl_FindNamespace(in, ObjStr(objv[1]), (Tcl_Namespace *)NULL, 0); + if (!ns) + return TCL_OK; + + newNs = Tcl_FindNamespace(in, ObjStr(objv[2]), (Tcl_Namespace *)NULL, 0); + if (!newNs) + return XOTclVarErrMsg(in, "CopyCmds: Destination namespace ", + ObjStr(objv[2]), " does not exist", (char *)NULL); + /* + * copy all procs & commands in the ns + */ + cmdTable = Tcl_Namespace_cmdTable(ns); + hPtr = Tcl_FirstHashEntry(cmdTable, &hSrch); + while (hPtr != NULL) { + name = Tcl_GetHashKey(cmdTable, hPtr); + + /* + * construct full cmd names + */ + newFullCmdName = Tcl_NewStringObj(newNs->fullName,-1); + oldFullCmdName = Tcl_NewStringObj(ns->fullName,-1); + + INCR_REF_COUNT(newFullCmdName); INCR_REF_COUNT(oldFullCmdName); + Tcl_AppendStringsToObj(newFullCmdName, "::", name, (char*)NULL); + Tcl_AppendStringsToObj(oldFullCmdName, "::", name, (char*)NULL); + newName = ObjStr(newFullCmdName); + oldName = ObjStr(oldFullCmdName); + + /* + * Make sure that the destination command does not already exist. + * Otherwise: do not copy + */ + cmd = Tcl_FindCommand(in, newName, 0, 0); + + if (cmd != NULL) { + /*fprintf(stderr, "%s already exists\n", newName);*/ + if (!GetObject(in, newName)) { + /* command or instproc will be deleted & than copied */ + Tcl_DeleteCommandFromToken(in, cmd); + } else { + /* don't overwrite objects -> will be recreated */ + hPtr = Tcl_NextHashEntry(&hSrch); + DECR_REF_COUNT(newFullCmdName); DECR_REF_COUNT(oldFullCmdName); + continue; + } + } + + /* + * Find the existing command. An error is returned if simpleName can't + * be found + */ + cmd = Tcl_FindCommand(in, oldName, 0, 0); + + if (cmd == NULL) { + Tcl_AppendStringsToObj(Tcl_GetObjResult(in), "can't copy ", " \"", + oldName, "\": command doesn't exist", (char *) NULL); + DECR_REF_COUNT(newFullCmdName); DECR_REF_COUNT(oldFullCmdName); + return TCL_ERROR; + } + /* + * Do not copy Objects or Classes + */ + if (!GetObject(in, oldName)) { + if (TclIsProc((Command*)cmd)) { + Proc *procPtr = TclFindProc((Interp *)in, oldName); + Tcl_Obj *arglistObj; + CompiledLocal *localPtr; + + /* + * Build a list containing the arguments of the proc + */ + + arglistObj = Tcl_NewListObj(0, NULL); + INCR_REF_COUNT(arglistObj); + for (localPtr = procPtr->firstLocalPtr; localPtr != NULL; + localPtr = localPtr->nextPtr) { + if (TclIsVarArgument(localPtr)) { + Tcl_Obj *defVal, *defStringObj = Tcl_NewStringObj(localPtr->name, -1); + INCR_REF_COUNT(defStringObj); + /* check for default values */ + if ((GetProcDefault(in, cmdTable, name, + localPtr->name, &defVal) == TCL_OK) && + (defVal != 0)) { + Tcl_AppendStringsToObj(defStringObj, " ", ObjStr(defVal), 0); + } + Tcl_ListObjAppendElement(in, arglistObj, defStringObj); + DECR_REF_COUNT(defStringObj); + } + } + + if (Tcl_Command_objProc(cmd) == RUNTIME_STATE(in)->objInterpProc) { + Tcl_DString ds, *dsPtr = &ds; + + if (isClassName(ns->fullName)) { + /* it started with ::xotcl::classes */ + XOTclClass *cl = GetClass(in, NSCutXOTclClasses(ns->fullName)); + XOTclProcAssertion* procs; + + if (cl) { + procs = cl->opt ? + AssertionFindProcs(cl->opt->assertions, name) : 0; + } else { + DECR_REF_COUNT(newFullCmdName); + DECR_REF_COUNT(oldFullCmdName); + DECR_REF_COUNT(arglistObj); + return XOTclVarErrMsg(in, "No class for inst - assertions", (char *)NULL); + } + + /* XOTcl InstProc */ + DSTRING_INIT(dsPtr); + Tcl_DStringAppendElement(dsPtr, NSCutXOTclClasses(newNs->fullName)); + Tcl_DStringAppendElement(dsPtr, "instproc"); + Tcl_DStringAppendElement(dsPtr, name); + Tcl_DStringAppendElement(dsPtr, ObjStr(arglistObj)); + Tcl_DStringAppendElement(dsPtr, ObjStr(procPtr->bodyPtr)); + if (procs) { + XOTclRequireClassOpt(cl); + AssertionAppendPrePost(in, dsPtr, procs); + } + Tcl_Eval(in, Tcl_DStringValue(dsPtr)); + DSTRING_FREE(dsPtr); + } else { + XOTclObject *obj = GetObject(in, ns->fullName); + XOTclProcAssertion* procs; + if (obj) { + procs = obj->opt ? + AssertionFindProcs(obj->opt->assertions, name) : 0; + } else { + DECR_REF_COUNT(newFullCmdName); + DECR_REF_COUNT(oldFullCmdName); + DECR_REF_COUNT(arglistObj); + return XOTclVarErrMsg(in, "No object for assertions", (char *)NULL); + } + + /* XOTcl Proc */ + DSTRING_INIT(dsPtr); + Tcl_DStringAppendElement(dsPtr, newNs->fullName); + Tcl_DStringAppendElement(dsPtr, "proc"); + Tcl_DStringAppendElement(dsPtr, name); + Tcl_DStringAppendElement(dsPtr, ObjStr(arglistObj)); + Tcl_DStringAppendElement(dsPtr, ObjStr(procPtr->bodyPtr)); + if (procs) { + XOTclRequireObjectOpt(obj); + AssertionAppendPrePost(in, dsPtr, procs); + } + Tcl_Eval(in, Tcl_DStringValue(dsPtr)); + DSTRING_FREE(dsPtr); + } + DECR_REF_COUNT(arglistObj); + } else { + /* Tcl Proc */ + Tcl_VarEval(in, "proc ", newName, " {", ObjStr(arglistObj),"} {\n", + ObjStr(procPtr->bodyPtr), "}", 0); + } + } else { + /* + * Otherwise copy command + */ + Tcl_ObjCmdProc* objProc = Tcl_Command_objProc(cmd); + Tcl_CmdDeleteProc *deleteProc = Tcl_Command_deleteProc(cmd); + if (objProc) { + Tcl_CreateObjCommand(in, newName, objProc, + Tcl_Command_objClientData(cmd), deleteProc); + } else { + Tcl_CreateCommand(in, newName, Tcl_Command_proc(cmd), + Tcl_Command_clientData(cmd), deleteProc); + } + } + } + hPtr = Tcl_NextHashEntry(&hSrch); + DECR_REF_COUNT(newFullCmdName); DECR_REF_COUNT(oldFullCmdName); + } + return TCL_OK; +} + +static int +XOTcl_NSCopyVars(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + Tcl_Namespace *ns, *newNs; + Var *varPtr = 0; + Tcl_DString ds, *dsPtr = &ds; + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr; + Tcl_HashTable *varTable; + int rc = TCL_OK; + char *varName; + XOTclObject *obj; + char *destFullName; + + if (objc != 3) + return XOTclObjErrArgCnt(in, NULL, "namespace_copyvars fromNs toNs"); + + ns = Tcl_FindNamespace(in, ObjStr(objv[1]), (Tcl_Namespace *)NULL, 0); + if (ns) { + newNs = Tcl_FindNamespace(in, ObjStr(objv[2]), (Tcl_Namespace *)NULL, 0); + if (!newNs) + return XOTclVarErrMsg(in, "CopyVars: Destination namespace ", + ObjStr(objv[2]), " does not exist", (char *)NULL); + obj = GetObject(in, ns->fullName); + varTable = Tcl_Namespace_varTable(ns); + destFullName = newNs->fullName; + } else { + XOTclObject *newObj; + obj = GetObject(in, ObjStr(objv[1])); + if (!obj) + return XOTclVarErrMsg(in, "CopyVars: Origin object/namespace ", + ObjStr(objv[1]), " does not exist", (char *)NULL); + newObj = GetObject(in, ObjStr(objv[2])); + if (!newObj) + return XOTclVarErrMsg(in, "CopyVars: Destination object/namespace ", + ObjStr(objv[2]), " does not exist", (char *)NULL); + varTable = obj->varTable; + destFullName = ObjStr(newObj->cmdName); + } + + /* copy all vars in the ns */ + hPtr = varTable ? Tcl_FirstHashEntry(varTable, &hSrch) : 0; + while (hPtr != NULL) { + varPtr = (Var *) Tcl_GetHashValue(hPtr); + if (!TclIsVarUndefined(varPtr) && !TclIsVarLink(varPtr)) { + varName = Tcl_GetHashKey(varTable, hPtr); + + if (TclIsVarScalar(varPtr)) { + /* it may seem odd that we do not copy obj vars with the + * same SetVar2 as normal vars, but we want to dispatch it in order to + * be able to intercept the copying */ + if (obj) { + DSTRING_INIT(dsPtr); + Tcl_DStringAppendElement(dsPtr, destFullName); + Tcl_DStringAppendElement(dsPtr, "set"); + Tcl_DStringAppendElement(dsPtr, varName); + Tcl_DStringAppendElement(dsPtr, ObjStr(varPtr->value.objPtr)); + rc = Tcl_Eval(in, Tcl_DStringValue(dsPtr)); + DSTRING_FREE(dsPtr); + } else { + ALLOC_NAME_NS(&ds, destFullName, varName); + Tcl_SetVar2(in, Tcl_DStringValue(&ds), 0, + ObjStr(varPtr->value.objPtr), TCL_GLOBAL_ONLY); + DSTRING_FREE(&ds); + } + } else { + if (TclIsVarArray(varPtr)) { + Tcl_HashTable *aTable = varPtr->value.tablePtr; + Tcl_HashSearch ahSrch; + Tcl_HashEntry* ahPtr = aTable ? Tcl_FirstHashEntry(aTable, &ahSrch) : 0; + + for (; ahPtr != 0; ahPtr = Tcl_NextHashEntry(&ahSrch)) { + char *eltName = Tcl_GetHashKey(aTable, ahPtr); + Var *eltVar = (Var*) Tcl_GetHashValue(ahPtr); + + if (TclIsVarScalar(eltVar)) { + if (obj) { + Tcl_DString ds2, *ds2Ptr = &ds2; + DSTRING_INIT(dsPtr); + Tcl_DStringAppendElement(dsPtr, destFullName); + Tcl_DStringAppendElement(dsPtr, "set"); + DSTRING_INIT(ds2Ptr); + Tcl_DStringAppend(ds2Ptr, varName, -1); + Tcl_DStringAppend(ds2Ptr, "(", 1); + Tcl_DStringAppend(ds2Ptr, eltName, -1); + Tcl_DStringAppend(ds2Ptr, ")", 1); + Tcl_DStringAppendElement(dsPtr, Tcl_DStringValue(ds2Ptr)); + Tcl_DStringAppendElement(dsPtr, ObjStr(eltVar->value.objPtr)); + rc = Tcl_Eval(in, Tcl_DStringValue(dsPtr)); + DSTRING_FREE(dsPtr); + DSTRING_FREE(ds2Ptr); + } else { + ALLOC_NAME_NS(&ds, destFullName, varName); + Tcl_SetVar2(in, Tcl_DStringValue(&ds), eltName, + ObjStr(eltVar->value.objPtr), TCL_GLOBAL_ONLY); + DSTRING_FREE(&ds); + } + } + } + } + } + } + hPtr = Tcl_NextHashEntry(&hSrch); + } + return rc; +} + +int +XOTclSelfDispatchCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclObject *self; + int result; + if ((self = GetSelfObj(in))) { + result = callMethod((ClientData)self, in, objv[1], objc, objv+2, 0); + } else { + result = XOTclVarErrMsg(in, "Cannot resolve 'self', probably called outside the context of an XOTcl Object", + (char*)NULL); + } + return result; +} + +int +XOTclInitProcNSCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + Tcl_CallFrame *varFramePtr = Tcl_Interp_varFramePtr(in); + + /*RUNTIME_STATE(in)->varFramePtr = varFramePtr;*/ + RUNTIME_STATE(in)->cs.top->currentFramePtr = varFramePtr; + if (varFramePtr) { + Tcl_CallFrame *callerVarPtr = Tcl_CallFrame_callerVarPtr(varFramePtr); + if (callerVarPtr) { + varFramePtr->nsPtr = (Tcl_Namespace *)callerVarPtr->nsPtr; + } else { + varFramePtr->nsPtr = Tcl_Interp_globalNsPtr(in); + } + } + return TCL_OK; +} + + + +/* create a slave interp that calls XOTcl Init */ +static int +XOTcl_InterpObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { + Tcl_Interp *slave; + Tcl_Obj *saved; + char *subCmd; + + if (objc < 1) + return XOTclObjErrArgCnt(in, NULL, "::xotcl::interp name ?args?"); + + saved = objv[0]; + objv[0] = XOTclGlobalObjects[INTERP]; + if (Tcl_EvalObjv(in, objc, objv, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) != TCL_OK) { + objv[0] = saved; + return TCL_ERROR; + } + objv[0] = saved; + + subCmd = ObjStr(objv[1]); + if (isCreateString(subCmd)) { + slave = Tcl_GetSlave(in, ObjStr(objv[2])); + if (!slave) + return XOTclVarErrMsg(in, "Creation of slave interpreter failed", (char*)NULL); + if (Xotcl_Init(slave) == TCL_ERROR) { + return TCL_ERROR; + } +#ifdef XOTCL_MEM_COUNT + xotclMemCountInterpCounter++; +#endif + } + + return TCL_OK; +} + + +extern Tcl_Obj* +XOTclOGetInstVar2(XOTcl_Object *obj, Tcl_Interp *in, Tcl_Obj *name1, Tcl_Obj *name2, + int flgs) { + Tcl_Obj *result; + XOTcl_FrameDecls; + + XOTcl_PushFrame(in, obj); + if (obj->nsPtr) + flgs |= TCL_NAMESPACE_ONLY; + + result = Tcl_ObjGetVar2(in, name1, name2, flgs); + XOTcl_PopFrame(in, obj); + + return result; +} + +/* + * get all instances of a class recursively to an initialized + * String key hashtable + */ +static void +getAllInstances(Tcl_HashTable *destTable, XOTclClass *startCl) { + Tcl_HashTable *table = &startCl->instances; + Tcl_HashSearch search; + Tcl_HashEntry *hPtr; + + for (hPtr = Tcl_FirstHashEntry(table, &search); hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search)) { + XOTclObject *inst = (XOTclObject*) Tcl_GetHashKey(table, hPtr); + Tcl_HashEntry *hPtrDest; + int new; + hPtrDest = Tcl_CreateHashEntry(destTable, ObjStr(inst->cmdName), &new); + /* + fprintf (stderr, " -- %s (%s)\n", ObjStr(inst->cmdName), ObjStr(startCl->object.cmdName)); + */ + if (new && XOTclObjectIsClass(inst)) { + getAllInstances(destTable, (XOTclClass*) inst); + } + } +} +#if !defined(NDEBUG) +static void +checkAllInstances(Tcl_Interp *in, XOTclClass *cl, int lvl) { + Tcl_HashSearch search; + Tcl_HashEntry *hPtr; + if (cl && cl->object.refCount>0) { + /*fprintf(stderr,"checkallinstances %d cl=%p '%s'\n", lvl, cl, ObjStr(cl->object.cmdName));*/ + for (hPtr = Tcl_FirstHashEntry(&cl->instances, &search); hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search)) { + XOTclObject *inst = (XOTclObject*) Tcl_GetHashKey(&cl->instances, hPtr); + assert(inst); + assert(inst->refCount>0); + assert(inst->cmdName->refCount>0); + if (XOTclObjectIsClass(inst) && (XOTclClass*)inst != RUNTIME_STATE(in)->theClass) { + checkAllInstances(in, (XOTclClass*) inst, lvl+1); + } + } + } +} +#endif + +#ifdef DO_FULL_CLEANUP +/* delete global variables and procs */ +static void deleteProcsAndVars(Tcl_Interp *in) { + Tcl_Namespace *ns = Tcl_GetGlobalNamespace(in); + Tcl_HashTable *varTable = ns ? Tcl_Namespace_varTable(ns) : NULL; + Tcl_HashTable *cmdTable = ns ? Tcl_Namespace_cmdTable(ns) : NULL; + Tcl_HashSearch search; + Var *varPtr; + Tcl_Command cmd; + register Tcl_HashEntry *entryPtr; + char *varName; + + entryPtr = Tcl_FirstHashEntry(varTable, &search); + while (entryPtr != NULL) { + varPtr = (Var *) Tcl_GetHashValue(entryPtr); + if (!TclIsVarUndefined(varPtr) || (varPtr->flags & VAR_NAMESPACE_VAR)) { + varName = Tcl_GetHashKey(varTable, entryPtr); + /* fprintf(stderr, "unsetting var %s\n", varName);*/ + Tcl_UnsetVar2(in, varName, (char *) NULL, TCL_GLOBAL_ONLY); + } + entryPtr = Tcl_NextHashEntry(&search); + } + + entryPtr = Tcl_FirstHashEntry(cmdTable, &search); + while (entryPtr) { + cmd = (Tcl_Command)Tcl_GetHashValue(entryPtr); + if (Tcl_Command_proc(cmd) == RUNTIME_STATE(in)->interpProc) { + /* + char *key = Tcl_GetHashKey(cmdTable, entryPtr); + fprintf(stderr, "cmdname = %s cmd %p proc %p objProc %p %d\n", + key,cmd,cmd->proc,cmd->objProc, + cmd->proc==RUNTIME_STATE(in)->interpProc); + + */ + Tcl_DeleteCommandFromToken(in, cmd); + } + entryPtr = Tcl_NextHashEntry(&search); + } +} +#endif + + +#ifdef DO_CLEANUP +static int +ClassHasSubclasses(XOTclClass *cl) { + return (cl->sub != NULL); +} + +static int +ClassHasInstances(XOTclClass *cl) { + Tcl_HashSearch hSrch; + return (Tcl_FirstHashEntry(&cl->instances, &hSrch) != NULL); +} + +static int +ObjectHasChildren(Tcl_Interp *in, XOTclObject *obj) { + Tcl_Namespace *ns = obj->nsPtr; + int result = 0; + + if (ns) { + Tcl_HashEntry *hPtr; + Tcl_HashSearch hSrch; + Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(ns); + XOTcl_FrameDecls; + + XOTcl_PushFrame(in, obj); + for (hPtr = Tcl_FirstHashEntry(cmdTable, &hSrch); hPtr; + hPtr = Tcl_NextHashEntry(&hSrch)) { + char *key = Tcl_GetHashKey(cmdTable, hPtr); + if (GetObject(in, key)) { + /*fprintf(stderr,"child = %s\n",key);*/ + result = 1; + break; + } + } + XOTcl_PopFrame(in,obj); + } + return result; +} + +static void freeAllXOTclObjectsAndClasses(Tcl_Interp *in, Tcl_HashTable *commandTable) { + Tcl_HashEntry *hPtr, *hDel; + Tcl_HashSearch hSrch; + XOTclObject *obj; + XOTclClass *thecls, *theobj, *cl; + + /*fprintf(stderr,"??? freeAllXOTclObjectsAndClasses in %p\n", in);*/ + + thecls = RUNTIME_STATE(in)->theClass; + theobj = RUNTIME_STATE(in)->theObject; + /***** PHYSICAL DESTROY *****/ + RUNTIME_STATE(in)->exitHandlerDestroyRound = XOTCL_EXITHANDLER_ON_PHYSICAL_DESTROY; + while (1) { + int deleted = 0; + hPtr = Tcl_FirstHashEntry(commandTable, &hSrch); + while (hPtr) { + char *key = Tcl_GetHashKey(commandTable, hPtr); + obj = GetObject(in, key); + if (obj && !XOTclObjectIsClass(obj) && !ObjectHasChildren(in,obj)) { + /*fprintf(stderr," ... delete object %s %p\n",key,obj);*/ + Tcl_DeleteCommandFromToken(in, obj->id); + hDel = hPtr; + deleted++; + } else { + hDel = NULL; + } + hPtr = Tcl_NextHashEntry(&hSrch); + if (hDel) + Tcl_DeleteHashEntry(hDel); + } + /*fprintf(stderr, "deleted %d Objects\n",deleted);*/ + if (deleted>0) + continue; + + + hPtr = Tcl_FirstHashEntry(commandTable, &hSrch); + while (hPtr) { + char *key = Tcl_GetHashKey(commandTable, hPtr); + cl = GetClass(in, key); + /*fprintf(stderr,"cl key = %s %p\n", key, cl);*/ + if (cl + && !ObjectHasChildren(in, (XOTclObject*)cl) + && !ClassHasInstances(cl) + && !ClassHasSubclasses(cl) + && cl != RUNTIME_STATE(in)->theClass + && cl != RUNTIME_STATE(in)->theObject + ) { + /*fprintf(stderr," ... delete class %s %p\n",key,cl);*/ + Tcl_DeleteCommandFromToken(in, cl->object.id); + hDel = hPtr; + deleted++; + } else { + hDel = NULL; + } + hPtr = Tcl_NextHashEntry(&hSrch); + if (hDel) + Tcl_DeleteHashEntry(hDel); + } + /*fprintf(stderr, "deleted %d Classes\n",deleted);*/ + if (deleted>0) + continue; + + break; + + } + +#ifdef DO_FULL_CLEANUP + deleteProcsAndVars(in); +#endif + + RUNTIME_STATE(in)->callDestroy = 0; + RemoveSuper(thecls, theobj); + RemoveInstance((XOTclObject*)thecls, thecls); + RemoveInstance((XOTclObject*)theobj, thecls); + + Tcl_DeleteCommandFromToken(in, theobj->object.id); + RUNTIME_STATE(in)->theObject = NULL; + + Tcl_DeleteCommandFromToken(in, thecls->object.id); + RUNTIME_STATE(in)->theClass = NULL; + + XOTcl_DeleteNamespace(in, RUNTIME_STATE(in)->fakeNS); + XOTcl_DeleteNamespace(in, RUNTIME_STATE(in)->XOTclClassesNS); + XOTcl_DeleteNamespace(in, RUNTIME_STATE(in)->XOTclNS); + +} +#endif /* DO_CLEANUP */ + + +/* + * Exit Handler + */ +static void +ExitHandler(ClientData cd) { + Tcl_Interp *in = (Tcl_Interp *) cd; + XOTclObject *obj; + XOTclClass *cl; + int result, flags, i; + Tcl_HashSearch hSrch; + Tcl_HashEntry *hPtr; + Tcl_HashTable objTable, *commandTable = &objTable; + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + + /* + * Don't use exit handler, if the interpreted is destroyed already + * Call to exit handler comes after freeing namespaces, commands, etc. + * e.g. TK calls Tcl_DeleteInterp directly, if Window is killed + */ + + /* + * Ahem ... + * + * Since we *must* be sure that our destroy methods will run + * we must *cheat* (I mean CHEAT) here: we flip the interp + * flag, saying, "hey boy, you're not deleted any more". + * After our handlers are done, we restore the old state... + * All this is needed so we can do an eval in the interp which + * is potentially marked for delete when we start working here. + * + * I know, I know, this is not really elegant. But... I'd need a + * standard way of invoking some code at interpreter delete time + * but JUST BEFORE the actual deletion process starts. Sadly, + * there is no such hook in Tcl as of Tcl8.3.2, that I know of. + * + * So, for the rest of procedure, assume the interp is alive ! + */ + + /*fprintf(stderr,"+++ EXIT handler\n"); */ + flags = Tcl_Interp_flags(in); + Tcl_Interp_flags(in) &= ~DELETED; +#if defined(PROFILE) + XOTclProfilePrintData(in); +#endif + /* + * evaluate user-defined exit handler + */ + result = callMethod((ClientData)RUNTIME_STATE(in)->theObject, in, + XOTclGlobalObjects[EXIT_HANDLER], 2, 0, 0); + if (result != TCL_OK) { + fprintf(stderr,"User defined exit handler contains errors!\n" + "Error in line %d: %s\nExecution interrupted.\n", + in->errorLine, ObjStr(Tcl_GetObjResult(in))); + } + /* + * Pop any callstack entry that is still alive (e.g. + * if "exit" is called and we were jumping out of the + * callframe + */ + while (cs->top > cs->content) + CallStackPop(in); + + while (Tcl_Interp_framePtr(in)) + Tcl_PopCallFrame(in); + /* + * deleting in two rounds: + * (a) SOFT DESTROY: call all user-defined destroys + * (b) PHYSICAL DESTROY: delete the commands, user-defined + * destroys are not executed anymore + * + * this is to prevent user-defined destroys from overriding physical + * destroy during exit handler, but still ensure that all + * user-defined destroys are called. + */ + + Tcl_InitHashTable(commandTable, TCL_STRING_KEYS); + MEM_COUNT_ALLOC("Tcl_InitHashTable",commandTable); + getAllInstances(commandTable, RUNTIME_STATE(in)->theClass); + /***** SOFT DESTROY *****/ + RUNTIME_STATE(in)->exitHandlerDestroyRound = XOTCL_EXITHANDLER_ON_SOFT_DESTROY; + + hPtr = Tcl_FirstHashEntry(commandTable, &hSrch); + while (hPtr) { + char *key = Tcl_GetHashKey(commandTable, hPtr); + obj = GetObject(in, key); + /*fprintf(stderr,"key = %s %p %d\n", + key, obj, obj && !XOTclObjectIsClass(obj));*/ + if (obj && !XOTclObjectIsClass(obj) + && !(obj->flags & XOTCL_DESTROY_CALLED)) + callDestroyMethod((ClientData)obj, in, obj, 0); + hPtr = Tcl_NextHashEntry(&hSrch); + } + hPtr = Tcl_FirstHashEntry(commandTable, &hSrch); + while (hPtr) { + char *key = Tcl_GetHashKey(commandTable, hPtr); + cl = GetClass(in, key); + if (cl + && !(cl->object.flags & XOTCL_DESTROY_CALLED)) + callDestroyMethod((ClientData)cl, in, (XOTclObject*)cl, 0); + hPtr = Tcl_NextHashEntry(&hSrch); + } +#ifdef DO_CLEANUP + freeAllXOTclObjectsAndClasses(in, commandTable); +#endif + + /* must be before freeing of XOTclGlobalObjects */ + XOTclShadowTclCommands(in, SHADOW_UNLOAD); + /* free global objects */ + for (i = 0; i < nr_elements(XOTclGlobalStrings); i++) { + DECR_REF_COUNT(XOTclGlobalObjects[i]); + } + XOTclStringIncrFree(&RUNTIME_STATE(in)->iss); + FREE(Tcl_Obj**, XOTclGlobalObjects); + FREE(XOTclRuntimeState, RUNTIME_STATE(in)); + + MEM_COUNT_FREE("Tcl_InitHashTable",commandTable); + Tcl_DeleteHashTable(commandTable); + +#if defined(TCL_MEM_DEBUG) + TclDumpMemoryInfo (stderr); + Tcl_DumpActiveMemory ("./xotclActiveMem"); + /* Tcl_GlobalEval(in, "puts {checkmem to checkmemFile}; + checkmem checkmemFile"); */ +#endif + MEM_COUNT_DUMP(); + + Tcl_Interp_flags(in) = flags; + Tcl_Release((ClientData) in); +} + + +#if defined(TCL_THREADS) +/* + * Gets activated at thread-exit + */ +static void +XOTcl_ThreadExitProc(ClientData cd) { + /*fprintf(stderr,"+++ XOTcl_ThreadExitProc\n");*/ +#if !defined(PRE83) + static void XOTcl_ExitProc(ClientData cd); + Tcl_DeleteExitHandler(XOTcl_ExitProc, cd); +#endif + ExitHandler(cd); +} +#endif + +/* + * Gets activated at application-exit + */ +static void +XOTcl_ExitProc(ClientData cd) { + /*fprintf(stderr,"+++ XOTcl_ExitProc\n");*/ +#if !defined(PRE83) && defined(TCL_THREADS) + Tcl_DeleteThreadExitHandler(XOTcl_ThreadExitProc, cd); +#endif + ExitHandler(cd); +} + + +/* + * Registers thread/appl exit handlers. + */ +static void +RegisterExitHandlers(ClientData cd) { + Tcl_Preserve(cd); +#if !defined(PRE83) && defined(TCL_THREADS) + Tcl_CreateThreadExitHandler(XOTcl_ThreadExitProc, cd); +#endif + Tcl_CreateExitHandler(XOTcl_ExitProc, cd); +} + + + +/* + * Tcl extension initialization routine + */ + +extern int +Xotcl_Init(Tcl_Interp *in) { + XOTclClass *theobj = 0; + XOTclClass *thecls = 0; + XOTclClass *paramCl = 0; + ClientData runtimeState; + int result, i; +#ifdef XOTCL_BYTECODE + XOTclCompEnv *instructions = XOTclGetCompEnv(); +#endif + +#ifndef PRE81 +# ifdef USE_TCL_STUBS + if (Tcl_InitStubs(in, "8.1", 0) == NULL) { + return TCL_ERROR; + } +# endif +#endif + +#if defined(TCL_MEM_DEBUG) + TclDumpMemoryInfo(stderr); +#endif + + MEM_COUNT_INIT(); + + /* + fprintf(stderr, "SIZES: obj=%d, tcl_obj=%d, DString=%d, class=%d, namespace=%d, command=%d, HashTable=%d\n", sizeof(XOTclObject), sizeof(Tcl_Obj), sizeof(Tcl_DString), sizeof(XOTclClass), sizeof(Namespace), sizeof(Command), sizeof(Tcl_HashTable)); + */ + + /* + * Runtime State stored in the client data of the Interp's global + * Namespace in order to avoid global state information + */ + runtimeState = (ClientData) NEW(XOTclRuntimeState); +#if USE_ASSOC_DATA + Tcl_SetAssocData(in, "XOTclRuntimeState", NULL, runtimeState); +#else + Tcl_Interp_globalNsPtr(in)->clientData = runtimeState; +#endif + + /* CallStack initialization */ + memset(RUNTIME_STATE(in), 0, sizeof(XOTclRuntimeState)); + memset(RUNTIME_STATE(in)->cs.content, 0, sizeof(XOTclCallStackContent)); + + RUNTIME_STATE(in)->cs.top = RUNTIME_STATE(in)->cs.content; + RUNTIME_STATE(in)->callDestroy = 1; + + /* create xotcl namespace */ + RUNTIME_STATE(in)->XOTclNS = + Tcl_CreateNamespace(in, "::xotcl", (ClientData)NULL, (Tcl_NamespaceDeleteProc*)NULL); + + MEM_COUNT_ALLOC("TclNamespace",RUNTIME_STATE(in)->XOTclNS); + + /* + * init an empty, faked proc structure in the RUNTIME state + */ + RUNTIME_STATE(in)->fakeProc.iPtr = (Interp *)in; + RUNTIME_STATE(in)->fakeProc.refCount = 1; + RUNTIME_STATE(in)->fakeProc.cmdPtr = NULL; + RUNTIME_STATE(in)->fakeProc.bodyPtr = NULL; + RUNTIME_STATE(in)->fakeProc.numArgs = 0; + RUNTIME_STATE(in)->fakeProc.numCompiledLocals = 0; + RUNTIME_STATE(in)->fakeProc.firstLocalPtr = NULL; + RUNTIME_STATE(in)->fakeProc.lastLocalPtr = NULL; + RUNTIME_STATE(in)->fakeNS = + Tcl_CreateNamespace(in, "::xotcl::fakeNS", (ClientData)NULL, + (Tcl_NamespaceDeleteProc*)NULL); + MEM_COUNT_ALLOC("TclNamespace",RUNTIME_STATE(in)->fakeNS); + + /* XOTclClasses in separate Namespace / Objects */ + RUNTIME_STATE(in)->XOTclClassesNS = + Tcl_CreateNamespace(in, "::xotcl::classes", (ClientData)NULL, + (Tcl_NamespaceDeleteProc*)NULL); + MEM_COUNT_ALLOC("TclNamespace",RUNTIME_STATE(in)->XOTclClassesNS); + + + /* cache interpreters proc interpretation functions */ + RUNTIME_STATE(in)->objInterpProc = TclGetObjInterpProc(); + RUNTIME_STATE(in)->interpProc = TclGetInterpProc(); + RUNTIME_STATE(in)->exitHandlerDestroyRound = XOTCL_EXITHANDLER_OFF; + + RegisterObjTypes(); + RegisterExitHandlers((ClientData)in); + + XOTclStringIncrInit(&RUNTIME_STATE(in)->iss); + + /* initialize global Tcl_Obj*/ + XOTclGlobalObjects = NEW_ARRAY(Tcl_Obj*,nr_elements(XOTclGlobalStrings)); + + for (i = 0; i < nr_elements(XOTclGlobalStrings); i++) { + XOTclGlobalObjects[i] = Tcl_NewStringObj(XOTclGlobalStrings[i],-1); + INCR_REF_COUNT(XOTclGlobalObjects[i]); + } + + /* create Object and Class, and store them in the RUNTIME STATE */ + theobj = PrimitiveCCreate(in, "::xotcl::Object", 0); + RUNTIME_STATE(in)->theObject = theobj; + if (!theobj) panic("Cannot create ::xotcl::Object",0); + + thecls = PrimitiveCCreate(in, "::xotcl::Class", 0); + RUNTIME_STATE(in)->theClass = thecls; + if (!thecls) panic("Cannot create ::xotcl::Class",0); + + theobj->parent = 0; + thecls->parent = theobj; + + Tcl_Export(in, RUNTIME_STATE(in)->XOTclNS, "Object", 0); + Tcl_Export(in, RUNTIME_STATE(in)->XOTclNS, "Class", 0); + /*Tcl_AddInterpResolvers(in, "XOTcl", XOTclResolveCmd, 0, 0);*/ + +#ifdef XOTCL_BYTECODE + instructions[INST_SELF].cmdPtr = (Command *) +#endif + Tcl_CreateObjCommand(in, "::xotcl::self", XOTclGetSelfObjCmd, 0, 0); +#ifdef XOTCL_BYTECODE + instructions[INST_NEXT].cmdPtr = (Command *) +#endif + Tcl_CreateObjCommand(in, "::xotcl::next", (Tcl_ObjCmdProc*) XOTclNextObjCmd, 0, 0); + Tcl_Export(in, RUNTIME_STATE(in)->XOTclNS, "self", 0); + Tcl_Export(in, RUNTIME_STATE(in)->XOTclNS, "next", 0); + Tcl_Export(in, RUNTIME_STATE(in)->XOTclNS, "my", 0); + +#if defined(PROFILE) + XOTclProfileInit(in); +#endif + + /* test Object and Class creation */ + if (!theobj || !thecls) { + RUNTIME_STATE(in)->callDestroy = 0; + + if (thecls) PrimitiveCDestroy((ClientData) thecls); + if (theobj) PrimitiveCDestroy((ClientData) theobj); + + for (i = 0; i < nr_elements(XOTclGlobalStrings); i++) { + DECR_REF_COUNT(XOTclGlobalObjects[i]); + } + FREE(Tcl_Obj**, XOTclGlobalObjects); + FREE(XOTclRuntimeState, RUNTIME_STATE(in)); + + return XOTclErrMsg(in, "Object/Class failed", TCL_STATIC); + } + + AddInstance((XOTclObject*)theobj, thecls); + AddInstance((XOTclObject*)thecls, thecls); + AddSuper(thecls, theobj); + + /* + * and fill them with functionality + */ + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "autoname", XOTclOAutonameMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "check", (Tcl_ObjCmdProc*)XOTclOCheckMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "class", XOTclOClassMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "cleanup", XOTclOCleanupMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "configure", (Tcl_ObjCmdProc*) XOTclOConfigureMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "destroy", XOTclODestroyMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "exists", (Tcl_ObjCmdProc*)XOTclOExistsMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "filter", (Tcl_ObjCmdProc*)XOTclOFilterMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "filterguard", (Tcl_ObjCmdProc*)XOTclOFilterGuardMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "filtersearch", (Tcl_ObjCmdProc*)XOTclOFilterSearchMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "incr", (Tcl_ObjCmdProc*)XOTclOIncrMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "info", XOTclOInfoMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "instvar", (Tcl_ObjCmdProc*)XOTclOInstVarMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "invar", (Tcl_ObjCmdProc*)XOTclOInvariantsMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "isclass", XOTclOIsClassMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "ismetaclass", XOTclOIsMetaClassMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "isobject", XOTclOIsObjectMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "istype", XOTclOIsTypeMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "ismixin", XOTclOIsMixinMethod, 0, 0); +#ifdef XOTCL_METADATA + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "metadata", (Tcl_ObjCmdProc*)XOTclOMetaDataMethod, 0, 0); +#endif + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "mixin", (Tcl_ObjCmdProc*)XOTclOMixinMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "mixinguard", (Tcl_ObjCmdProc*)XOTclOMixinGuardMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "__next", (Tcl_ObjCmdProc*)XOTclONextMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "noinit", (Tcl_ObjCmdProc*)XOTclONoinitMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "parametercmd", (Tcl_ObjCmdProc*)XOTclCParameterCmdMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "proc", XOTclOProcMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "procsearch", (Tcl_ObjCmdProc*)XOTclOProcSearchMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "requireNamespace", (Tcl_ObjCmdProc*)XOTclORequireNamespaceMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "set", (Tcl_ObjCmdProc*)XOTclOSetMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "tclcmd", (Tcl_ObjCmdProc*)XOTclCTclCmdMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "unset", XOTclOUnsetMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "uplevel", XOTclOUplevelMethod, 0,0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "upvar", XOTclOUpvarMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "volatile", (Tcl_ObjCmdProc*)XOTclCVolatileMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) theobj, "vwait", (Tcl_ObjCmdProc*)XOTclOVwaitMethod, 0, 0); + + + + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "alloc", (Tcl_ObjCmdProc*)XOTclCAllocMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "create", (Tcl_ObjCmdProc*)XOTclCCreateMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "new", (Tcl_ObjCmdProc*)XOTclCNewMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "info", XOTclCInfoMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "instdestroy", XOTclCInstDestroyMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "instfilter", (Tcl_ObjCmdProc*)XOTclCInstFilterMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "instfilterguard", (Tcl_ObjCmdProc*)XOTclCInstFilterGuardMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "instinvar", (Tcl_ObjCmdProc*)XOTclCInvariantsMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "instmixin", (Tcl_ObjCmdProc*)XOTclCInstMixinMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "instmixinguard", (Tcl_ObjCmdProc*)XOTclCInstMixinGuardMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "instparametercmd", (Tcl_ObjCmdProc*)XOTclCInstParameterCmdMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "instproc", (Tcl_ObjCmdProc*)XOTclCInstProcMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "insttclcmd", (Tcl_ObjCmdProc*)XOTclCInstTclCmdMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "parameter", (Tcl_ObjCmdProc*)XOTclCParameterMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "parameterclass", (Tcl_ObjCmdProc*)XOTclCParameterClassMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "recreate", (Tcl_ObjCmdProc*) XOTclCRecreateMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "superclass", (Tcl_ObjCmdProc*)XOTclCSuperClassMethod, 0, 0); + XOTclAddIMethod(in, (XOTcl_Class*) thecls, "unknown", (Tcl_ObjCmdProc*) XOTclCUnknownMethod, 0, 0); + + /* + * overwritten tcl objs + */ + result = XOTclShadowTclCommands(in, SHADOW_LOAD); + if (result != TCL_OK) + return result; + + /* + * new tcl cmds + */ + Tcl_CreateObjCommand(in, "::xotcl::interp", (Tcl_ObjCmdProc*)XOTcl_InterpObjCmd, 0, 0); + Tcl_CreateObjCommand(in, "::xotcl::trace", XOTcl_TraceObjCmd, 0, 0); + Tcl_CreateObjCommand(in, "::xotcl::namespace_copyvars", XOTcl_NSCopyVars, 0, 0); + Tcl_CreateObjCommand(in, "::xotcl::namespace_copycmds", XOTcl_NSCopyCmds, 0, 0); + Tcl_CreateObjCommand(in, "::xotcl::deprecated", XOTcl_DeprecatedCmd, 0, 0); +#ifdef XOTCL_BYTECODE + instructions[INST_INITPROC].cmdPtr = (Command *) +#endif + Tcl_CreateObjCommand(in, "::xotcl::initProcNS", XOTclInitProcNSCmd, 0, 0); +#ifdef XOTCL_BYTECODE + instructions[INST_SELF_DISPATCH].cmdPtr = (Command *) +#endif + Tcl_CreateObjCommand(in, "::xotcl::my", XOTclSelfDispatchCmd, 0, 0); + +#ifdef XOTCL_BYTECODE + XOTclBytecodeInit(); +#endif + + /* + * Parameter Class + */ + paramCl = PrimitiveCCreate(in, XOTclGlobalStrings[PARAM_CL], thecls); + XOTclAddPMethod(in, (XOTcl_Object*) ¶mCl->object, + XOTclGlobalStrings[SEARCH_DEFAULTS], + (Tcl_ObjCmdProc*) ParameterSearchDefaultsMethod, 0, 0); + /* + * set runtime version information in Tcl variable + */ + Tcl_SetVar(in, "::xotcl::version", XOTCLVERSION, TCL_GLOBAL_ONLY); + Tcl_SetVar(in, "::xotcl::patchlevel", XOTCLPATCHLEVEL, TCL_GLOBAL_ONLY); + + /* + * with some methods and library procs in tcl - they could go in a + * xotcl.tcl file, but they're embedded here with Tcl_GlobalEval + * to avoid the need to carry around a separate file at runtime. + */ + { + +#include "predefined.h" + + /* fprintf(stderr, "predefined=<<%s>>\n",cmd);*/ + if (Tcl_GlobalEval(in, cmd) != TCL_OK) + return TCL_ERROR; + } + +#ifndef AOL_SERVER + /* the AOL server uses a different package loading mechanism */ +# ifdef COMPILE_XOTCL_STUBS + Tcl_PkgProvideEx(in, "XOTcl", XOTCLVERSION, (ClientData) &xotclStubs); +# else + Tcl_PkgProvide(in, "XOTcl", XOTCLVERSION); +# endif +#endif + +#if !defined(TCL_THREADS) && !defined(PRE81) + if ((Tcl_GetVar2(in, "tcl_platform", "threaded", TCL_GLOBAL_ONLY) != NULL)) { + /* a non threaded XOTcl version is loaded into a threaded environment */ + fprintf(stderr, "\n A non threaded XOTCL version is loaded into threaded environment\n Please reconfigure XOTcl with --enable-threads!\n\n\n"); + } +#endif + + Tcl_ResetResult(in); + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + + return TCL_OK; +} + +#ifdef NEVER +extern int +Xotcl_SafeInit(interp) + Tcl_Interp *interp; +{ + /*** dummy for now **/ + return Xotcl_Init(interp); +} +#endif Index: xotcl/generic/xotcl.decls =================================================================== diff -u --- xotcl/generic/xotcl.decls (revision 0) +++ xotcl/generic/xotcl.decls (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,150 @@ +# xotcl.decls -- +# +# This file contains the declarations for all supported public +# functions that are exported by the XOTcl library via the stubs table. +# This file is used to generate the xotclDecls.h, xotclPlatDecls.h, +# xotclStub.c, and xotclPlatStub.c files. +# +# +# Copyright (c) 1998-1999 by Scriptics Corporation. +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: $Id: xotcl.decls,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +library xotcl + +interface xotcl +hooks {xotclInt} + +# Declare each of the functions in the public Tcl interface. Note that +# the an index should never be reused for a different function in order +# to preserve backwards compatibility. + +declare 0 generic { + int Xotcl_Init(Tcl_Interp *interp) +} +# 1 is reserved for safe init +#declare 1 generic { +# int Xotcl_SafeInit(Tcl_Interp *interp) +#} +declare 2 generic { + struct XOTcl_Class* XOTclIsClass(Tcl_Interp* in, ClientData cd) +} +#declare 3 generic { +# +#} +declare 4 generic { + struct XOTcl_Object* XOTclGetObject(Tcl_Interp* in, char* name) +} +declare 5 generic { + struct XOTcl_Class* XOTclGetClass(Tcl_Interp* in, char* name) +} +declare 6 generic { + int XOTclCreateObject(Tcl_Interp* in, Tcl_Obj* name, struct XOTcl_Class* cl) +} +#declare 7 generic { +# +#} +declare 8 generic { + int XOTclCreateClass(Tcl_Interp* in, Tcl_Obj* name, struct XOTcl_Class* cl) +} +declare 9 generic { + int XOTclDeleteObject(Tcl_Interp* in, struct XOTcl_Object* obj) +} +declare 10 generic { + int XOTclDeleteClass(Tcl_Interp* in, struct XOTcl_Class* cl) +} +declare 11 generic { + void XOTclAddPMethod(Tcl_Interp* in, struct XOTcl_Object* obj, + char* nm, Tcl_ObjCmdProc* proc, + ClientData cd, Tcl_CmdDeleteProc* dp) +} +declare 12 generic { + void XOTclAddIMethod(Tcl_Interp* in, struct XOTcl_Class* cl, + char* nm, Tcl_ObjCmdProc* proc, + ClientData cd, Tcl_CmdDeleteProc* dp) +} +declare 13 generic { + void XOTclRemovePMethod(Tcl_Interp* in,struct XOTcl_Object* obj, char* nm) +} +declare 14 generic { + void XOTclRemoveIMethod(Tcl_Interp* in, struct XOTcl_Class* cl, char* nm) +} +declare 15 generic { + Tcl_Obj* XOTclOSetInstVar(struct XOTcl_Object* obj, Tcl_Interp* in, + Tcl_Obj* name, Tcl_Obj* value, int flgs) +} +declare 16 generic { + Tcl_Obj* XOTclOGetInstVar(struct XOTcl_Object* obj, Tcl_Interp* in, + Tcl_Obj* name, int flgs) +} +declare 17 generic { + int XOTclInstVar(struct XOTcl_Object* obj, Tcl_Interp* in, + char* name, char* destName) +} +#declare 18 generic { +# +#} +declare 19 generic { + Tcl_Obj* XOTclOSetInstVar2(struct XOTcl_Object* obj, + Tcl_Interp* in,Tcl_Obj* name1,Tcl_Obj* name2, + Tcl_Obj* value,int flgs) +} +declare 20 generic { + Tcl_Obj* XOTclOGetInstVar2(struct XOTcl_Object* obj, + Tcl_Interp* in,Tcl_Obj* name1,Tcl_Obj* name2, + int flgs) +} +declare 21 generic { + int XOTclUnsetInstVar2(struct XOTcl_Object* obj, Tcl_Interp* in, + char* name1, char* name2, + int flgs) +} +declare 22 generic { + int XOTcl_TraceObjCmd(ClientData cd, Tcl_Interp *in, + int objc, Tcl_Obj *CONST objv[]) +} +declare 23 generic { + int XOTclErrMsg(Tcl_Interp* in, char* msg, Tcl_FreeProc* type) +} +declare 24 generic { + int XOTclVarErrMsg(Tcl_Interp * in, ...) +} +declare 25 generic { + int XOTclErrInProc (Tcl_Interp *in, Tcl_Obj* objName, + Tcl_Obj* clName, char* procName) +} +declare 26 generic { + int XOTclObjErrArgCnt(Tcl_Interp *in, Tcl_Obj *cmdname, char *arglist) +} +declare 27 generic { + int XOTclErrBadVal(Tcl_Interp *in, char *expected, char *value) +} +declare 28 generic { + int XOTclObjErrType(Tcl_Interp *in, Tcl_Obj *nm, char* wt) +} +declare 29 generic { + void XOTclStackTrace (Tcl_Interp* in) +} +declare 30 generic { + void XOTclCallStackTrace (Tcl_Interp* in) +} +declare 31 generic { + void XOTclDeprecatedMsg(char* oldCmd, char* newCmd) +} +declare 32 generic { + void XOTclSetObjClientData(XOTcl_Object* obj, ClientData data) +} +declare 33 generic { + ClientData XOTclGetObjClientData(XOTcl_Object* obj) +} +declare 34 generic { + void XOTclSetClassClientData(XOTcl_Class* cl, ClientData data) +} +declare 35 generic { + ClientData XOTclGetClassClientData(XOTcl_Class* cl) +} +declare 36 generic { + void XOTclRequireObjNamespace(Tcl_Interp* in, XOTcl_Object* obj) +} Index: xotcl/generic/xotcl.h =================================================================== diff -u --- xotcl/generic/xotcl.h (revision 0) +++ xotcl/generic/xotcl.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,202 @@ +/* -*- Mode: c++ -*- + * + * $Id: xotcl.h,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * + * Extended Object Tcl (XOTcl) + * + * Copyright (C) 1999-2004 Gustaf Neumann, Uwe Zdun + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of + * M.I.T. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. M.I.T. makes no representations about the suitability + * of this software for any purpose. It is provided "as is" without + * express or implied warranty. + * */ + +#ifndef _xotcl_h_ +#define _xotcl_h_ + +#include "tcl.h" + +#undef TCL_STORAGE_CLASS +#ifdef BUILD_xotcl +# define TCL_STORAGE_CLASS DLLEXPORT +#else +# ifdef USE_XOTCL_STUBS +# define TCL_STORAGE_CLASS +# else +# define TCL_STORAGE_CLASS DLLIMPORT +# endif +#endif + +/* activate bytecode support +#define XOTCL_BYTECODE +*/ + +#define KEEP_TCL_CMD_TYPE 1 + +/* activate/deacticate assert +#define NDEBUG +*/ + +/* activate/deacticate memory tracing +#define XOTCL_MEM_TRACE 1 +#define XOTCL_MEM_COUNT 1 +*/ +/*#define REFCOUNTED 1*/ + +/* +#define XOTCLOBJ_TRACE 1 +#define REFCOUNT_TRACE 1 +#define DISPATCH_TRACE 1 +*/ + +/* activate/deacticate profiling information at the end + of running the program +#define PROFILE +*/ + +/* make self, proc and class in instproc and procs +#define AUTOVARS +*/ + +/* turn tracing output on/off +#define CALLSTACK_TRACE 1 +#define DISPATCH_TRACE 1 +#define NAMESPACE_TRACE 1 +#define OBJDELETION_TRACE 1 +#define STACK_TRACE 1 +*/ + +#ifdef XOTCL_MEM_COUNT +# define DO_FULL_CLEANUP 1 +#endif + +#ifdef AOL_SERVER +# ifndef TCL_THREADS +# define TCL_THREADS +# endif +#endif + +#ifdef TCL_THREADS +# define DO_CLEANUP +#endif + +#ifdef DO_FULL_CLEANUP +# define DO_CLEANUP +#endif + +/* + * prevent old TCL-versions + */ + +#if TCL_MAJOR_VERSION < 8 +# error Tcl distribution is TOO OLD, we require at least tcl8.0 +#endif + +#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<1 +# define PRE81 +#else +# if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION==1 +# define V81 +# endif +#endif +#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<2 +# define PRE82 +#endif +#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<3 +# define PRE83 +#endif +#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<4 +# define PRE84 +#endif + +/* + * A special definition used to allow this header file to be included + * in resource files so that they can get obtain version information from + * this file. Resource compilers don't like all the C stuff, like typedefs + * and procedure declarations, that occur below. + */ + +#ifndef RC_INVOKED + +/* +#ifdef __cplusplus +extern "C" { +#endif +*/ + +struct XOTclObject; +struct XOTclClass; + +typedef struct XOTcl_Object { + Tcl_Obj *cmdName; + Tcl_Command id; + Tcl_Interp *teardown; + struct XOTcl_Class *cl; + Tcl_HashTable *varTable; + Tcl_Namespace *nsPtr; +} XOTcl_Object; + +typedef struct XOTcl_Class { + struct XOTcl_Object object; +} XOTcl_Class; + +/* + * Include the public function declarations that are accessible via + * the stubs table. + */ +#include "xotclDecls.h" + +#ifdef XOTCL_OBJECTDATA +extern int +XOTclUnsetInstVar(struct XOTclObject* obj, Tcl_Interp* in, + char* name, int flgs); +extern void +XOTclSetObjectData(struct XOTclObject* obj, struct XOTclClass* cl, + ClientData data); +extern int +XOTclGetObjectData(struct XOTclObject* obj, struct XOTclClass* cl, + ClientData* data); +extern int +XOTclUnsetObjectData(struct XOTclObject* obj, struct XOTclClass* cl); +extern void +XOTclFreeObjectData(XOTclClass* cl); +#endif + +/* + * Xotcl_InitStubs is used by extensions that can be linked + * against the xotcl stubs library. If we are not using stubs + * then this reduces to package require. + */ + +#ifdef USE_XOTCL_STUBS + +# ifdef __cplusplus +extern "C" +# endif +CONST char * +Xotcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, + char *version, int exact)); +#else +# define Xotcl_InitStubs(interp, version, exact) \ + Tcl_PkgRequire(interp, "XOTcl", version, exact) +#endif + +#endif /* RC_INVOKED */ + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#endif /* _xotcl_h_ */ Index: xotcl/generic/xotclAccessInt.h =================================================================== diff -u --- xotcl/generic/xotclAccessInt.h (revision 0) +++ xotcl/generic/xotclAccessInt.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,63 @@ +#define Tcl_Interp_numLevels(in) ((Interp *)in)->numLevels +#define Tcl_Interp_framePtr(in) ((Tcl_CallFrame *)((Interp *)in)->framePtr) +#define Tcl_Interp_varFramePtr(in) ((Tcl_CallFrame *)((Interp *)in)->varFramePtr) +#define Tcl_Interp_globalNsPtr(in) ((Tcl_Namespace *)((Interp *)in)->globalNsPtr) +#define Tcl_Interp_flags(in) ((Interp *)in)->flags +#if DISPATCH_TRACE +#define Tcl_Interp_returnCode(in) ((Interp *)in)->returnCode +#endif +#define Tcl_Interp_threadId(in) ((Interp *)in)->threadId + +#define Tcl_CallFrame_callerPtr(cf) ((Tcl_CallFrame*)((CallFrame *)cf)->callerPtr) +#define Tcl_CallFrame_procPtr(cf) ((CallFrame *)cf)->procPtr +#define Tcl_CallFrame_varTablePtr(cf) ((CallFrame *)cf)->varTablePtr +#define Tcl_CallFrame_level(cf) ((CallFrame *)cf)->level +#define Tcl_CallFrame_isProcCallFrame(cf) ((CallFrame *)cf)->isProcCallFrame +#define Tcl_CallFrame_compiledLocals(cf) ((CallFrame *)cf)->compiledLocals +#define Tcl_CallFrame_callerVarPtr(cf) ((Tcl_CallFrame*)((CallFrame *)cf)->callerVarPtr) +#define Tcl_CallFrame_objc(cf) ((CallFrame *)cf)->objc +#define Tcl_CallFrame_objv(cf) ((CallFrame *)cf)->objv + +#define Tcl_Namespace_cmdTable(nsPtr) &((Namespace *)nsPtr)->cmdTable +#define Tcl_Namespace_varTable(nsPtr) &((Namespace *)nsPtr)->varTable +#define Tcl_Namespace_childTable(nsPtr) &((Namespace *)nsPtr)->childTable +#define Tcl_Namespace_activationCount(nsPtr) ((Namespace *)nsPtr)->activationCount + +#define Tcl_Command_refCount(cmd) ((Command *)cmd)->refCount +#define Tcl_Command_cmdEpoch(cmd) ((Command *)cmd)->cmdEpoch +/* the following items could be obtained from + Tcl_GetCommandInfoFromToken(cmd, infoPtr) */ +#define Tcl_Command_nsPtr(cmd) ((Tcl_Namespace*)(((Command *)cmd)->nsPtr)) +#define Tcl_Command_objProc(cmd) ((Command *)cmd)->objProc +#define Tcl_Command_objClientData(cmd) ((Command *)cmd)->objClientData +#define Tcl_Command_proc(cmd) ((Command *)cmd)->proc +#define Tcl_Command_clientData(cmd) ((Command *)cmd)->clientData +#define Tcl_Command_deleteProc(cmd) ((Command *)cmd)->deleteProc + + +/* + * Conversion from CmdPtr to Class / Object + */ + +static XOTCLINLINE ClientData +XOTclGetCDFromCmdPtr(Tcl_Command cmd) { + assert(cmd); + if (Tcl_Command_objProc(cmd) == XOTclObjDispatch && !Tcl_Command_cmdEpoch(cmd)) + return Tcl_Command_objClientData(cmd); + else + return NULL; +} + +static XOTCLINLINE XOTclClass* +XOTclGetClassFromCmdPtr(Tcl_Command cmd) { + ClientData cd = XOTclGetCDFromCmdPtr(cmd); + if (cd) + return XOTclObjectToClass(cd); + else + return 0; +} + +static XOTCLINLINE XOTclObject* +XOTclGetObjectFromCmdPtr(Tcl_Command cmd) { + return (XOTclObject*) XOTclGetCDFromCmdPtr(cmd); +} Index: xotcl/generic/xotclAppInit.c =================================================================== diff -u --- xotcl/generic/xotclAppInit.c (revision 0) +++ xotcl/generic/xotclAppInit.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,151 @@ +/* + * tclAppInit.c -- + * + * Provides a default version of the main program and Tcl_AppInit + * procedure for Tcl applications (without Tk). + * + * Copyright (c) 1993 The Regents of the University of California. + * Copyright (c) 1994-1997 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * SCCS: @(#) tclAppInit.c 1.20 97/03/24 14:29:43 + */ + +/* include tclInt.h for access to namespace API */ +#include "tclInt.h" + +#include "xotcl.h" + +#if defined(VISUAL_CC) +# include +# include +#endif +#include + +#if TCL_MAJOR_VERSION < 7 + #error Tcl distribution TOO OLD +#endif + +/* + * The following variable is a special hack that is needed in order for + * Sun shared libraries to be used for Tcl. + */ + +#ifdef NEED_MATHERR +extern int matherr(); +int *tclDummyMathPtr = (int *) matherr; +#endif + +/* + *---------------------------------------------------------------------- + * + * main -- + * + * This is the main program for the application. + * + * Results: + * None: Tcl_Main never returns here, so this procedure never + * returns either. + * + * Side effects: + * Whatever the application does. + * + *---------------------------------------------------------------------- + */ + +#if TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION < 4 + +extern int main(); +int *tclDummyMainPtr = (int *) main; + +#else + +int +main(argc, argv) + int argc; /* Number of command-line arguments. */ + char **argv; /* Values of command-line arguments. */ +{ +#if defined(VISUAL_CC) + setlocale(LC_ALL, "C"); +#endif + Tcl_Main(argc, argv, Tcl_AppInit); + return 0; /* Needed only to prevent compiler warning. */ +} + +#endif + + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppInit -- + * + * This procedure performs application-specific initialization. + * Most applications, especially those that incorporate additional + * packages, will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error + * message in interp->result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_AppInit(interp) + Tcl_Interp *interp; /* Interpreter for application. */ +{ + if (Tcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + + /* + * Call the init procedures for included packages. Each call should + * look like this: + * + * if (Mod_Init(interp) == TCL_ERROR) { + * return TCL_ERROR; + * } + * + * where "Mod" is the name of the module. + + if (Xotcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + + Tcl_StaticPackage(interp, "XOTcl", Xotcl_Init, 0); + */ + + if (Tcl_PkgRequire(interp, "XOTcl", XOTCLVERSION, 1) == NULL) { + return TCL_ERROR; + } + + /* + * This is xotclsh, so import all xotcl commands by + * default into the global namespace. + */ + + if (Tcl_Import(interp, Tcl_GetGlobalNamespace(interp), + "::xotcl::*", /* allowOverwrite */ 1) != TCL_OK) { + return TCL_ERROR; + } + /* + * Call Tcl_CreateCommand for application-specific commands, if + * they weren't already created by the init procedures called above. + */ + + /* + * Specify a user-specific startup file to invoke if the application + * is run interactively. Typically the startup file is "~/.apprc" + * where "app" is the name of the application. If this line is deleted + * then no user-specific startup file will be run under any conditions. + */ + + Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY); + return TCL_OK; +} Index: xotcl/generic/xotclCompile.c =================================================================== diff -u --- xotcl/generic/xotclCompile.c (revision 0) +++ xotcl/generic/xotclCompile.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,144 @@ +#include "xotclInt.h" + +#ifdef XOTCL_BYTECODE +#include + +static CompileProc + initProcNsCompile, nextCompile, + selfCompile, selfDispatchCompile; + +static InstructionDesc instructionTable[] = { + {"initProc", 1, 0, {OPERAND_NONE}}, + {"next", 1, 0, {OPERAND_NONE}}, + {"self", 1, 0, {OPERAND_NONE}}, + {"dispatch", 2, 1, {OPERAND_UINT1}}, +}; + +static XOTclCompEnv instructions[] = { + {0, 0, initProcNsCompile, XOTclInitProcNSCmd}, + {0, 0, nextCompile, XOTclNextObjCmd}, + {0, 0, selfCompile, XOTclGetSelfObjCmd}, + {0, 0, selfDispatchCompile, /*XOTclSelfDispatchCmd*/XOTclDirectSelfDispatch}, + 0 +}; + +XOTclCompEnv * +XOTclGetCompEnv() { + return &instructions[0]; +} + + +static int +initProcNsCompile(Tcl_Interp *interp, Tcl_Parse *parsePtr, + CompileEnv *envPtr) { + + if (parsePtr->numWords != 1) { + Tcl_ResetResult(interp); + Tcl_AppendToObj(Tcl_GetObjResult(interp), + "wrong # args: should be '::xotcl::initProcNS'", -1); + envPtr->maxStackDepth = 0; + return TCL_ERROR; + } + + TclEmitOpcode(instructions[INST_INITPROC].bytecode, envPtr); + envPtr->maxStackDepth = 0; + + return TCL_OK; +} + +static int +nextCompile(Tcl_Interp *interp, Tcl_Parse *parsePtr, + CompileEnv *envPtr) { + + if (parsePtr->numWords != 1) + return TCL_OUT_LINE_COMPILE; + + TclEmitOpcode(instructions[INST_NEXT].bytecode, envPtr); + envPtr->maxStackDepth = 0; + + return TCL_OK; +} +static int +selfCompile(Tcl_Interp *interp, Tcl_Parse *parsePtr, + CompileEnv *envPtr) { + + if (parsePtr->numWords != 1) + return TCL_OUT_LINE_COMPILE; + + TclEmitOpcode(instructions[INST_SELF].bytecode, envPtr); + envPtr->maxStackDepth = 0; + + return TCL_OK; +} +static int +selfDispatchCompile(Tcl_Interp *interp, Tcl_Parse *parsePtr, + CompileEnv *envPtr) { + + Tcl_Token *tokenPtr; + int code, wordIdx; + /* + fprintf(stderr, "****** selfDispatchCompile words=%d tokens=%d, avail=%d\n", + parsePtr->numWords,parsePtr->numTokens,parsePtr->tokensAvailable); + */ + + if (parsePtr->numWords > 255) + return TCL_OUT_LINE_COMPILE; + + /*TclEmitOpcode(instructions[INST_SELF].bytecode, envPtr);*/ + + for (wordIdx=0, tokenPtr = parsePtr->tokenPtr + 0; + wordIdx < parsePtr->numWords; + wordIdx++, tokenPtr += (tokenPtr->numComponents + 1)) { + + /* + fprintf(stderr," %d: %p token type=%d size=%d\n", + wordIdx,tokenPtr,tokenPtr->type,tokenPtr->size ); + */ + if (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { + TclEmitPush(TclRegisterLiteral(envPtr, tokenPtr->start, + tokenPtr->size, 0), envPtr); + envPtr->maxStackDepth = 1; + /* + fprintf(stderr," %d: simple '%s' components=%d\n", + wordIdx,tokenPtr->start, tokenPtr->numComponents); + */ + } else { + /* + fprintf(stderr," %d NOT simple '%s' components=%d\n", + wordIdx,tokenPtr->start, tokenPtr->numComponents); + */ + code = TclCompileTokens(interp, tokenPtr+1, + tokenPtr->numComponents, envPtr); + if (code != TCL_OK) { + return code; + } + } + } + + /*fprintf(stderr, "maxdepth=%d, onStack=%d\n",envPtr->maxStackDepth,wordIdx); + */ + TclEmitInstInt1(instructions[INST_SELF_DISPATCH].bytecode, wordIdx, envPtr); + envPtr->maxStackDepth = 0; + + return TCL_OK; +} + + + +void +XOTclBytecodeInit() { + int i; + for(i=0; iobjClientData))) { + instructions[i].cmdPtr->compileProc = instructions[i].compileProc; + } + + } + /*tclTraceCompile = 2;*/ + +} + +#endif Index: xotcl/generic/xotclDecls.h =================================================================== diff -u --- xotcl/generic/xotclDecls.h (revision 0) +++ xotcl/generic/xotclDecls.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,341 @@ +/* + * xotclDecls.h -- + * + * Declarations of functions in the platform independent public XOTcl API. + * + * Copyright (c) 1998-1999 by XXXX + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + */ + +#ifndef _XOTCLDECLS +#define _XOTCLDECLS + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the xotcl.decls script. + */ + +/* !BEGIN!: Do not edit below this line. */ + +/* + * Exported function declarations: + */ + +/* 0 */ +EXTERN int Xotcl_Init _ANSI_ARGS_((Tcl_Interp * interp)); +/* Slot 1 is reserved */ +/* 2 */ +EXTERN struct XOTcl_Class* XOTclIsClass _ANSI_ARGS_((Tcl_Interp* in, + ClientData cd)); +/* Slot 3 is reserved */ +/* 4 */ +EXTERN struct XOTcl_Object* XOTclGetObject _ANSI_ARGS_((Tcl_Interp* in, + char* name)); +/* 5 */ +EXTERN struct XOTcl_Class* XOTclGetClass _ANSI_ARGS_((Tcl_Interp* in, + char* name)); +/* 6 */ +EXTERN int XOTclCreateObject _ANSI_ARGS_((Tcl_Interp* in, + Tcl_Obj* name, struct XOTcl_Class* cl)); +/* Slot 7 is reserved */ +/* 8 */ +EXTERN int XOTclCreateClass _ANSI_ARGS_((Tcl_Interp* in, + Tcl_Obj* name, struct XOTcl_Class* cl)); +/* 9 */ +EXTERN int XOTclDeleteObject _ANSI_ARGS_((Tcl_Interp* in, + struct XOTcl_Object* obj)); +/* 10 */ +EXTERN int XOTclDeleteClass _ANSI_ARGS_((Tcl_Interp* in, + struct XOTcl_Class* cl)); +/* 11 */ +EXTERN void XOTclAddPMethod _ANSI_ARGS_((Tcl_Interp* in, + struct XOTcl_Object* obj, char* nm, + Tcl_ObjCmdProc* proc, ClientData cd, + Tcl_CmdDeleteProc* dp)); +/* 12 */ +EXTERN void XOTclAddIMethod _ANSI_ARGS_((Tcl_Interp* in, + struct XOTcl_Class* cl, char* nm, + Tcl_ObjCmdProc* proc, ClientData cd, + Tcl_CmdDeleteProc* dp)); +/* 13 */ +EXTERN void XOTclRemovePMethod _ANSI_ARGS_((Tcl_Interp* in, + struct XOTcl_Object* obj, char* nm)); +/* 14 */ +EXTERN void XOTclRemoveIMethod _ANSI_ARGS_((Tcl_Interp* in, + struct XOTcl_Class* cl, char* nm)); +/* 15 */ +EXTERN Tcl_Obj* XOTclOSetInstVar _ANSI_ARGS_(( + struct XOTcl_Object* obj, Tcl_Interp* in, + Tcl_Obj* name, Tcl_Obj* value, int flgs)); +/* 16 */ +EXTERN Tcl_Obj* XOTclOGetInstVar _ANSI_ARGS_(( + struct XOTcl_Object* obj, Tcl_Interp* in, + Tcl_Obj* name, int flgs)); +/* 17 */ +EXTERN int XOTclInstVar _ANSI_ARGS_((struct XOTcl_Object* obj, + Tcl_Interp* in, char* name, char* destName)); +/* Slot 18 is reserved */ +/* 19 */ +EXTERN Tcl_Obj* XOTclOSetInstVar2 _ANSI_ARGS_(( + struct XOTcl_Object* obj, Tcl_Interp* in, + Tcl_Obj* name1, Tcl_Obj* name2, + Tcl_Obj* value, int flgs)); +/* 20 */ +EXTERN Tcl_Obj* XOTclOGetInstVar2 _ANSI_ARGS_(( + struct XOTcl_Object* obj, Tcl_Interp* in, + Tcl_Obj* name1, Tcl_Obj* name2, int flgs)); +/* 21 */ +EXTERN int XOTclUnsetInstVar2 _ANSI_ARGS_(( + struct XOTcl_Object* obj, Tcl_Interp* in, + char* name1, char* name2, int flgs)); +/* 22 */ +EXTERN int XOTcl_TraceObjCmd _ANSI_ARGS_((ClientData cd, + Tcl_Interp * in, int objc, + Tcl_Obj *CONST objv[])); +/* 23 */ +EXTERN int XOTclErrMsg _ANSI_ARGS_((Tcl_Interp* in, char* msg, + Tcl_FreeProc* type)); +/* 24 */ +EXTERN int XOTclVarErrMsg _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,in)); +/* 25 */ +EXTERN int XOTclErrInProc _ANSI_ARGS_((Tcl_Interp * in, + Tcl_Obj* objName, Tcl_Obj* clName, + char* procName)); +/* 26 */ +EXTERN int XOTclObjErrArgCnt _ANSI_ARGS_((Tcl_Interp * in, + Tcl_Obj * cmdname, char * arglist)); +/* 27 */ +EXTERN int XOTclErrBadVal _ANSI_ARGS_((Tcl_Interp * in, + char * expected, char * value)); +/* 28 */ +EXTERN int XOTclObjErrType _ANSI_ARGS_((Tcl_Interp * in, + Tcl_Obj * nm, char* wt)); +/* 29 */ +EXTERN void XOTclStackTrace _ANSI_ARGS_((Tcl_Interp* in)); +/* 30 */ +EXTERN void XOTclCallStackTrace _ANSI_ARGS_((Tcl_Interp* in)); +/* 31 */ +EXTERN void XOTclDeprecatedMsg _ANSI_ARGS_((char* oldCmd, + char* newCmd)); +/* 32 */ +EXTERN void XOTclSetObjClientData _ANSI_ARGS_((XOTcl_Object* obj, + ClientData data)); +/* 33 */ +EXTERN ClientData XOTclGetObjClientData _ANSI_ARGS_((XOTcl_Object* obj)); +/* 34 */ +EXTERN void XOTclSetClassClientData _ANSI_ARGS_((XOTcl_Class* cl, + ClientData data)); +/* 35 */ +EXTERN ClientData XOTclGetClassClientData _ANSI_ARGS_((XOTcl_Class* cl)); +/* 36 */ +EXTERN void XOTclRequireObjNamespace _ANSI_ARGS_((Tcl_Interp* in, + XOTcl_Object* obj)); + +typedef struct XotclStubHooks { + struct XotclIntStubs *xotclIntStubs; +} XotclStubHooks; + +typedef struct XotclStubs { + int magic; + struct XotclStubHooks *hooks; + + int (*xotcl_Init) _ANSI_ARGS_((Tcl_Interp * interp)); /* 0 */ + void *reserved1; + struct XOTcl_Class* (*xOTclIsClass) _ANSI_ARGS_((Tcl_Interp* in, ClientData cd)); /* 2 */ + void *reserved3; + struct XOTcl_Object* (*xOTclGetObject) _ANSI_ARGS_((Tcl_Interp* in, char* name)); /* 4 */ + struct XOTcl_Class* (*xOTclGetClass) _ANSI_ARGS_((Tcl_Interp* in, char* name)); /* 5 */ + int (*xOTclCreateObject) _ANSI_ARGS_((Tcl_Interp* in, Tcl_Obj* name, struct XOTcl_Class* cl)); /* 6 */ + void *reserved7; + int (*xOTclCreateClass) _ANSI_ARGS_((Tcl_Interp* in, Tcl_Obj* name, struct XOTcl_Class* cl)); /* 8 */ + int (*xOTclDeleteObject) _ANSI_ARGS_((Tcl_Interp* in, struct XOTcl_Object* obj)); /* 9 */ + int (*xOTclDeleteClass) _ANSI_ARGS_((Tcl_Interp* in, struct XOTcl_Class* cl)); /* 10 */ + void (*xOTclAddPMethod) _ANSI_ARGS_((Tcl_Interp* in, struct XOTcl_Object* obj, char* nm, Tcl_ObjCmdProc* proc, ClientData cd, Tcl_CmdDeleteProc* dp)); /* 11 */ + void (*xOTclAddIMethod) _ANSI_ARGS_((Tcl_Interp* in, struct XOTcl_Class* cl, char* nm, Tcl_ObjCmdProc* proc, ClientData cd, Tcl_CmdDeleteProc* dp)); /* 12 */ + void (*xOTclRemovePMethod) _ANSI_ARGS_((Tcl_Interp* in, struct XOTcl_Object* obj, char* nm)); /* 13 */ + void (*xOTclRemoveIMethod) _ANSI_ARGS_((Tcl_Interp* in, struct XOTcl_Class* cl, char* nm)); /* 14 */ + Tcl_Obj* (*xOTclOSetInstVar) _ANSI_ARGS_((struct XOTcl_Object* obj, Tcl_Interp* in, Tcl_Obj* name, Tcl_Obj* value, int flgs)); /* 15 */ + Tcl_Obj* (*xOTclOGetInstVar) _ANSI_ARGS_((struct XOTcl_Object* obj, Tcl_Interp* in, Tcl_Obj* name, int flgs)); /* 16 */ + int (*xOTclInstVar) _ANSI_ARGS_((struct XOTcl_Object* obj, Tcl_Interp* in, char* name, char* destName)); /* 17 */ + void *reserved18; + Tcl_Obj* (*xOTclOSetInstVar2) _ANSI_ARGS_((struct XOTcl_Object* obj, Tcl_Interp* in, Tcl_Obj* name1, Tcl_Obj* name2, Tcl_Obj* value, int flgs)); /* 19 */ + Tcl_Obj* (*xOTclOGetInstVar2) _ANSI_ARGS_((struct XOTcl_Object* obj, Tcl_Interp* in, Tcl_Obj* name1, Tcl_Obj* name2, int flgs)); /* 20 */ + int (*xOTclUnsetInstVar2) _ANSI_ARGS_((struct XOTcl_Object* obj, Tcl_Interp* in, char* name1, char* name2, int flgs)); /* 21 */ + int (*xOTcl_TraceObjCmd) _ANSI_ARGS_((ClientData cd, Tcl_Interp * in, int objc, Tcl_Obj *CONST objv[])); /* 22 */ + int (*xOTclErrMsg) _ANSI_ARGS_((Tcl_Interp* in, char* msg, Tcl_FreeProc* type)); /* 23 */ + int (*xOTclVarErrMsg) _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,in)); /* 24 */ + int (*xOTclErrInProc) _ANSI_ARGS_((Tcl_Interp * in, Tcl_Obj* objName, Tcl_Obj* clName, char* procName)); /* 25 */ + int (*xOTclObjErrArgCnt) _ANSI_ARGS_((Tcl_Interp * in, Tcl_Obj * cmdname, char * arglist)); /* 26 */ + int (*xOTclErrBadVal) _ANSI_ARGS_((Tcl_Interp * in, char * expected, char * value)); /* 27 */ + int (*xOTclObjErrType) _ANSI_ARGS_((Tcl_Interp * in, Tcl_Obj * nm, char* wt)); /* 28 */ + void (*xOTclStackTrace) _ANSI_ARGS_((Tcl_Interp* in)); /* 29 */ + void (*xOTclCallStackTrace) _ANSI_ARGS_((Tcl_Interp* in)); /* 30 */ + void (*xOTclDeprecatedMsg) _ANSI_ARGS_((char* oldCmd, char* newCmd)); /* 31 */ + void (*xOTclSetObjClientData) _ANSI_ARGS_((XOTcl_Object* obj, ClientData data)); /* 32 */ + ClientData (*xOTclGetObjClientData) _ANSI_ARGS_((XOTcl_Object* obj)); /* 33 */ + void (*xOTclSetClassClientData) _ANSI_ARGS_((XOTcl_Class* cl, ClientData data)); /* 34 */ + ClientData (*xOTclGetClassClientData) _ANSI_ARGS_((XOTcl_Class* cl)); /* 35 */ + void (*xOTclRequireObjNamespace) _ANSI_ARGS_((Tcl_Interp* in, XOTcl_Object* obj)); /* 36 */ +} XotclStubs; + +#ifdef __cplusplus +extern "C" { +#endif +extern XotclStubs *xotclStubsPtr; +#ifdef __cplusplus +} +#endif + +#if defined(USE_XOTCL_STUBS) && !defined(USE_XOTCL_STUB_PROCS) + +/* + * Inline function declarations: + */ + +#ifndef Xotcl_Init +#define Xotcl_Init \ + (xotclStubsPtr->xotcl_Init) /* 0 */ +#endif +/* Slot 1 is reserved */ +#ifndef XOTclIsClass +#define XOTclIsClass \ + (xotclStubsPtr->xOTclIsClass) /* 2 */ +#endif +/* Slot 3 is reserved */ +#ifndef XOTclGetObject +#define XOTclGetObject \ + (xotclStubsPtr->xOTclGetObject) /* 4 */ +#endif +#ifndef XOTclGetClass +#define XOTclGetClass \ + (xotclStubsPtr->xOTclGetClass) /* 5 */ +#endif +#ifndef XOTclCreateObject +#define XOTclCreateObject \ + (xotclStubsPtr->xOTclCreateObject) /* 6 */ +#endif +/* Slot 7 is reserved */ +#ifndef XOTclCreateClass +#define XOTclCreateClass \ + (xotclStubsPtr->xOTclCreateClass) /* 8 */ +#endif +#ifndef XOTclDeleteObject +#define XOTclDeleteObject \ + (xotclStubsPtr->xOTclDeleteObject) /* 9 */ +#endif +#ifndef XOTclDeleteClass +#define XOTclDeleteClass \ + (xotclStubsPtr->xOTclDeleteClass) /* 10 */ +#endif +#ifndef XOTclAddPMethod +#define XOTclAddPMethod \ + (xotclStubsPtr->xOTclAddPMethod) /* 11 */ +#endif +#ifndef XOTclAddIMethod +#define XOTclAddIMethod \ + (xotclStubsPtr->xOTclAddIMethod) /* 12 */ +#endif +#ifndef XOTclRemovePMethod +#define XOTclRemovePMethod \ + (xotclStubsPtr->xOTclRemovePMethod) /* 13 */ +#endif +#ifndef XOTclRemoveIMethod +#define XOTclRemoveIMethod \ + (xotclStubsPtr->xOTclRemoveIMethod) /* 14 */ +#endif +#ifndef XOTclOSetInstVar +#define XOTclOSetInstVar \ + (xotclStubsPtr->xOTclOSetInstVar) /* 15 */ +#endif +#ifndef XOTclOGetInstVar +#define XOTclOGetInstVar \ + (xotclStubsPtr->xOTclOGetInstVar) /* 16 */ +#endif +#ifndef XOTclInstVar +#define XOTclInstVar \ + (xotclStubsPtr->xOTclInstVar) /* 17 */ +#endif +/* Slot 18 is reserved */ +#ifndef XOTclOSetInstVar2 +#define XOTclOSetInstVar2 \ + (xotclStubsPtr->xOTclOSetInstVar2) /* 19 */ +#endif +#ifndef XOTclOGetInstVar2 +#define XOTclOGetInstVar2 \ + (xotclStubsPtr->xOTclOGetInstVar2) /* 20 */ +#endif +#ifndef XOTclUnsetInstVar2 +#define XOTclUnsetInstVar2 \ + (xotclStubsPtr->xOTclUnsetInstVar2) /* 21 */ +#endif +#ifndef XOTcl_TraceObjCmd +#define XOTcl_TraceObjCmd \ + (xotclStubsPtr->xOTcl_TraceObjCmd) /* 22 */ +#endif +#ifndef XOTclErrMsg +#define XOTclErrMsg \ + (xotclStubsPtr->xOTclErrMsg) /* 23 */ +#endif +#ifndef XOTclVarErrMsg +#define XOTclVarErrMsg \ + (xotclStubsPtr->xOTclVarErrMsg) /* 24 */ +#endif +#ifndef XOTclErrInProc +#define XOTclErrInProc \ + (xotclStubsPtr->xOTclErrInProc) /* 25 */ +#endif +#ifndef XOTclObjErrArgCnt +#define XOTclObjErrArgCnt \ + (xotclStubsPtr->xOTclObjErrArgCnt) /* 26 */ +#endif +#ifndef XOTclErrBadVal +#define XOTclErrBadVal \ + (xotclStubsPtr->xOTclErrBadVal) /* 27 */ +#endif +#ifndef XOTclObjErrType +#define XOTclObjErrType \ + (xotclStubsPtr->xOTclObjErrType) /* 28 */ +#endif +#ifndef XOTclStackTrace +#define XOTclStackTrace \ + (xotclStubsPtr->xOTclStackTrace) /* 29 */ +#endif +#ifndef XOTclCallStackTrace +#define XOTclCallStackTrace \ + (xotclStubsPtr->xOTclCallStackTrace) /* 30 */ +#endif +#ifndef XOTclDeprecatedMsg +#define XOTclDeprecatedMsg \ + (xotclStubsPtr->xOTclDeprecatedMsg) /* 31 */ +#endif +#ifndef XOTclSetObjClientData +#define XOTclSetObjClientData \ + (xotclStubsPtr->xOTclSetObjClientData) /* 32 */ +#endif +#ifndef XOTclGetObjClientData +#define XOTclGetObjClientData \ + (xotclStubsPtr->xOTclGetObjClientData) /* 33 */ +#endif +#ifndef XOTclSetClassClientData +#define XOTclSetClassClientData \ + (xotclStubsPtr->xOTclSetClassClientData) /* 34 */ +#endif +#ifndef XOTclGetClassClientData +#define XOTclGetClassClientData \ + (xotclStubsPtr->xOTclGetClassClientData) /* 35 */ +#endif +#ifndef XOTclRequireObjNamespace +#define XOTclRequireObjNamespace \ + (xotclStubsPtr->xOTclRequireObjNamespace) /* 36 */ +#endif + +#endif /* defined(USE_XOTCL_STUBS) && !defined(USE_XOTCL_STUB_PROCS) */ + +/* !END!: Do not edit above this line. */ + +#endif /* _XOTCLDECLS */ + Index: xotcl/generic/xotclError.c =================================================================== diff -u --- xotcl/generic/xotclError.c (revision 0) +++ xotcl/generic/xotclError.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,93 @@ +/* -*- Mode: c++ -*- + * $Id: xotclError.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * + * Extended Object Tcl (XOTcl) + * + * Copyright (C) 1999-2000 Gustaf Neumann, Uwe Zdun + * + * + * xotclError.c -- + * + * error return functions for XOTcl + * + */ + +#include "xotclInt.h" + +int +XOTclErrMsg(Tcl_Interp *in, char* msg, Tcl_FreeProc* type) { + Tcl_SetResult(in, msg, type); + return TCL_ERROR; +} + +int +XOTclVarErrMsg TCL_VARARGS_DEF (Tcl_Interp *,arg1) +{ + va_list argList; + char *string; + Tcl_Interp *in; + + in = TCL_VARARGS_START(Tcl_Interp *,arg1,argList); + Tcl_ResetResult(in); + while (1) { + string = va_arg(argList, char *); + if (string == NULL) { + break; + } + Tcl_AppendResult(in, string, (char*) NULL); + } + va_end(argList); + return TCL_ERROR; +} + + +int +XOTclErrInProc (Tcl_Interp *in, Tcl_Obj* objName, + Tcl_Obj* clName, char* procName) { + Tcl_DString errMsg; + char *cName, *space; + ALLOC_DSTRING(&errMsg, "\n "); + if (clName) { + cName = ObjStr(clName); + space = " "; + } else { + cName = ""; + space =""; + } + Tcl_DStringAppend(&errMsg, ObjStr(objName),-1); + Tcl_DStringAppend(&errMsg, space, -1); + Tcl_DStringAppend(&errMsg, cName, -1); + Tcl_DStringAppend(&errMsg, "->", 2); + Tcl_DStringAppend(&errMsg, procName, -1); + Tcl_AddErrorInfo (in, Tcl_DStringValue(&errMsg)); + DSTRING_FREE(&errMsg); + return TCL_ERROR; +} + +int +XOTclObjErrArgCnt(Tcl_Interp *in, Tcl_Obj *cmdname, char *arglist) { + Tcl_ResetResult(in); + Tcl_AppendResult(in, "wrong # args: should be {", 0); + if (cmdname) { + Tcl_AppendResult(in, ObjStr(cmdname), " ", 0); + } + if (arglist != 0) Tcl_AppendResult(in, arglist, 0); + Tcl_AppendResult(in, "}", 0); + return TCL_ERROR; +} + +int +XOTclErrBadVal(Tcl_Interp *in, char *expected, char *value) { + Tcl_ResetResult(in); + Tcl_AppendResult(in, "expected ", expected, " but got", 0); + Tcl_AppendElement(in, value); + return TCL_ERROR; +} + +extern int +XOTclObjErrType(Tcl_Interp *in, Tcl_Obj *nm, char* wt) { + Tcl_ResetResult(in); + Tcl_AppendResult(in,"'",ObjStr(nm), "' method should be called on '", + wt, "'", 0); + return TCL_ERROR; +} Index: xotcl/generic/xotclInt.decls =================================================================== diff -u --- xotcl/generic/xotclInt.decls (revision 0) +++ xotcl/generic/xotclInt.decls (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,118 @@ +# xotclInt.decls -- +# +# This file contains the declarations for all unsupported +# functions that are exported by the Tcl library. This file +# is used to generate the itclIntDecls.h and itclIntStub.c +# files +# +# Copyright (c) 1998-1999 by Scriptics Corporation. +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: xotclInt.decls,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +library xotcl + +# Define the unsupported generic interfaces. + +interface xotclInt + + +# +# Functions used within the package, but not considered "public" +# + +#declare 0 generic { + +#} +#declare 1 generic { + +#} +# declare 2 generic { +# int XOTclErrInProc (Tcl_Interp *in, Tcl_Obj* objName, +# Tcl_Obj* clName, char* procName) +# } +# declare 3 generic { +# int XOTclObjErrArgCnt(Tcl_Interp *in, Tcl_Obj *cmdname, char *arglist) +# } +# declare 4 generic { +# int XOTclErrBadVal(Tcl_Interp *in, char *expected, char *value) +# } +# declare 5 generic { +# int XOTclObjErrType(Tcl_Interp *in, Tcl_Obj *nm, char* wt) +# } +# declare 6 generic { +# void XOTclStackTrace (Tcl_Interp* in) +# } +# declare 7 generic { +# void XOTclCallStackTrace (Tcl_Interp* in) +# } +#declare 8 generic { +# void XOTclFilterTrace (Tcl_Interp* in) +#} +#declare 9 generic { +# int XOTclIsType(XOTclObject* obj, XOTclClass* type) +#} +#declare 10 generic { +# void XOTclRemoveClasses(XOTclClasses* sl) +#} +# declare 11 generic { +# XOTclClasses** XOTclAddClass(XOTclClasses** cList, XOTclClass* cl, ClientData cd) +# } +# declare 12 generic { +# XOTclClasses* XOTclComputePrecedence(register XOTclClass* cl) +# } +# declare 13 generic { +# XOTclClasses* XOTclComputeDependents(register XOTclClass* cl) +# } +# declare 14 generic { +# void XOTclDeprecatedMsg(char* oldCmd, char* newCmd) +# } +# declare 15 generic { +# void XOTclSetObjClientData(XOTclObject* obj, ClientData data) +# } +# declare 16 generic { +# ClientData XOTclGetObjClientData(XOTclObject* obj) +# } +# declare 17 generic { +# void XOTclSetClassClientData(XOTclClass* cl, ClientData data) +# } +# declare 18 generic { +# ClientData XOTclGetClassClientData(XOTclClass* cl) +# } +# declare 19 generic { +# void XOTclRequireObjectOpt(XOTclObject* obj) +# } +# declare 20 generic { +# void XOTclRequireClassOpt(XOTclClass* cl) +# } +# declare 21 generic { +# void XOTclRequireObjNamespace(Tcl_Interp* in, XOTclObject* obj) +# } +# declare 22 generic { + +# } +# declare 23 generic { + +# } +# declare 24 generic { + +# } +# declare 25 generic { + +# } +# declare 26 generic { + +# } +# declare 27 generic { + +# } +# declare 28 generic { + +# } +# declare 29 generic { + +# } +# declare 30 generic { + +# } Index: xotcl/generic/xotclInt.h =================================================================== diff -u --- xotcl/generic/xotclInt.h (revision 0) +++ xotcl/generic/xotclInt.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,714 @@ +/* -*- Mode: c++ -*- + * $Id: xotclInt.h,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * Extended Object Tcl (XOTcl) + * + * Copyright (C) 1999-2002 Gustaf Neumann, Uwe Zdun + * + * xotclInt.h -- + * + * Mostly internally used API Functions + */ + +#ifndef _xotcl_int_h_ +#define _xotcl_int_h_ + +#include +#include "xotcl.h" + +#include +#include +#include + +#if defined(PROFILE) +# include +#endif + +#ifdef DMALLOC +# include "dmalloc.h" +#endif + +#ifdef BUILD_xotcl +# undef TCL_STORAGE_CLASS +# define TCL_STORAGE_CLASS DLLEXPORT +#endif + +/* +#define XOTCL_METADATA +*/ + +/* + * Makros + */ +#ifdef XOTCL_MEM_COUNT +Tcl_HashTable xotclMemCount; +extern int xotclMemCountInterpCounter; +typedef struct XOTclMemCounter { + int peak; + int count; +} XOTclMemCounter; +# define MEM_COUNT_ALLOC(id,p) XOTclMemCountAlloc(id,p) +# define MEM_COUNT_FREE(id,p) XOTclMemCountFree(id,p) +# define MEM_COUNT_INIT() \ + if (xotclMemCountInterpCounter == 0) { \ + Tcl_InitHashTable(&xotclMemCount, TCL_STRING_KEYS); \ + xotclMemCountInterpCounter = 1; \ + } +# define MEM_COUNT_DUMP() XOTclMemCountDump(in) +# define MEM_COUNT_OPEN_FRAME() +/*if (obj->varTable) noTableBefore = 0*/ +# define MEM_COUNT_CLOSE_FRAME() +/* if (obj->varTable && noTableBefore) \ + XOTclMemCountAlloc("obj->varTable",NULL)*/ +#else +# define MEM_COUNT_ALLOC(id,p) +# define MEM_COUNT_FREE(id,p) +# define MEM_COUNT_INIT() +# define MEM_COUNT_DUMP() +# define MEM_COUNT_OPEN_FRAME() +# define MEM_COUNT_CLOSE_FRAME() +#endif + +#define DSTRING_INIT(D) Tcl_DStringInit(D); MEM_COUNT_ALLOC("DString",D) +#define DSTRING_FREE(D) Tcl_DStringFree(D); MEM_COUNT_FREE("DString",D) + +#if USE_ASSOC_DATA +# define RUNTIME_STATE(in) ((XOTclRuntimeState*) Tcl_GetAssocData(in, "XOTclRuntimeState", NULL)) +#else +# define RUNTIME_STATE(in) \ + ((XOTclRuntimeState*)((Interp*) in)->globalNsPtr->clientData) +#endif + + +#define ALLOC_NAME_NS(DSP, NS, NAME) \ + DSTRING_INIT(DSP);\ + Tcl_DStringAppend(DSP, NS, -1),\ + Tcl_DStringAppend(DSP, "::", 2),\ + Tcl_DStringAppend(DSP, NAME, -1) +#define ALLOC_TOP_NS(DSP, NAME) \ + DSTRING_INIT(DSP);\ + Tcl_DStringAppend(DSP, "::", 2),\ + Tcl_DStringAppend(DSP, NAME, -1) +#define ALLOC_DSTRING(DSP,ENTRY) \ + DSTRING_INIT(DSP);\ + Tcl_DStringAppend(DSP, ENTRY, -1) + +#define nr_elements(arr) ((int) (sizeof(arr) / sizeof(arr[0]))) + +# define NEW(type) \ + (type *)ckalloc(sizeof(type)); MEM_COUNT_ALLOC(#type, NULL) +# define NEW_ARRAY(type,n) \ + (type *)ckalloc(sizeof(type)*(n)); MEM_COUNT_ALLOC(#type "*", NULL) +# define FREE(type, var) \ + ckfree((char*) var); MEM_COUNT_FREE(#type,var) + +#define isArgsString(m) (\ + *m == 'a' && m[1] == 'r' && m[2] == 'g' && m[3] == 's' && \ + m[4] == '\0') +#define isBodyString(m) (\ + *m == 'b' && m[1] == 'o' && m[2] == 'd' && m[3] == 'y' && \ + m[4] == '\0') +#define isClassString(m) (\ + *m == 'c' && m[1] == 'l' && m[2] == 'a' && m[3] == 's' && \ + m[4] == 's' && m[5] == '\0') +#define isCheckString(m) (\ + *m == 'c' && m[1] == 'h' && m[2] == 'e' && m[3] == 'c' && \ + m[4] == 'k' && m[5] == '\0') +#define isCreateString(m) (\ + *m == 'c' && m[1] == 'r' && m[2] == 'e' && m[3] == 'a' && \ + m[4] == 't' && m[5] == 'e' && m[6] == '\0') +#define isAllocString(m) (\ + *m == 'a' && m[1] == 'l' && m[2] == 'l' && m[3] == 'o' && \ + m[4] == 'c' && m[5] == '\0') +#define isDestroyString(m) (\ + *m == 'd' && m[1] == 'e' && m[2] == 's' && m[3] == 't' && \ + m[4] == 'r' && m[5] == 'o' && m[6] == 'y' && m[7] == '\0') +#define isInstDestroyString(m) (\ + *m == 'i' && m[1] == 'n' && m[2] == 's' && m[3] == 't' && \ + m[4] == 'd' && m[5] == 'e' && m[6] == 's' && m[7] == 't' && \ + m[8] == 'r' && m[9] == 'o' && m[10] == 'y' && m[11] == '\0') +#define isInitString(m) (\ + *m == 'i' && m[1] == 'n' && m[2] == 'i' && m[3] == 't' && \ + m[4] == '\0') +#define isInfoString(m) (\ + *m == 'i' && m[1] == 'n' && m[2] == 'f' && m[3] == 'o' && \ + m[4] == '\0') +#define isNextString(m) (\ + *m == 'n' && m[1] == 'e' && m[2] == 'x' && m[3] == 't' && \ + m[4] == '\0') +#define isInstinvarString(m) (\ + *m == 'i' && m[1] == 'n' && m[2] == 's' && m[3] == 't' && \ + m[4] == 'i' && m[5] == 'n' && m[6] == 'v' && m[7] == 'a' && \ + m[8] == 'r' && m[9] == '\0') +#define isInvarString(m) (\ + *m == 'i' && m[1] == 'n' && m[2] == 'v' && m[3] == 'a' && \ + m[4] == 'r' && m[5] == '\0') +#define isInstprocString(m) (\ + *m == 'i' && m[1] == 'n' && m[2] == 's' && m[3] == 't' && \ + m[4] == 'p' && m[5] == 'r' && m[6] == 'o' && m[7] == 'c' && \ + m[8] == '\0') +#define isProcString(m) (\ + *m == 'p' && m[1] == 'r' && m[2] == 'o' && m[3] == 'c' && \ + m[4] == '\0') + +#if defined(sun) /*|| defined(__linux__)*/ +# define USE_ALLOCA +#endif + +#if _IBMC__ >= 0x0306 +# define USE_ALLOCA +#endif + +#if defined(VISUAL_CC) +# define USE_MALLOC +#endif + +#if defined(USE_MALLOC) +# define DEFINE_NEW_TCL_OBJS_ON_STACK(oc,ov) \ + Tcl_Obj** ov = (Tcl_Obj**) ckalloc((oc)*sizeof(Tcl_Obj*)) +# define FREE_TCL_OBJS_ON_STACK(ov) ckfree((char*) ov) +#elif defined(USE_ALLOCA) +# define DEFINE_NEW_TCL_OBJS_ON_STACK(oc,ov) \ + Tcl_Obj** ov = (Tcl_Obj**) alloca((oc)*sizeof(Tcl_Obj*)) +# define FREE_TCL_OBJS_ON_STACK(ov) +#else +# if !defined(NDEBUG) +# define DEFINE_NEW_TCL_OBJS_ON_STACK(oc,ov) \ + int __OC = (oc)+2; Tcl_Obj *__OV[__OC]; Tcl_Obj** ov = __OV+1; \ + __OV[0] = __OV[__OC-1] = (Tcl_Obj*)0xdeadbeaf +# define FREE_TCL_OBJS_ON_STACK(ov) \ + assert(__OV[0] == __OV[__OC-1] && __OV[0] == (Tcl_Obj*)0xdeadbeaf) +# else +# define DEFINE_NEW_TCL_OBJS_ON_STACK(oc,ov) Tcl_Obj* ov[(oc)] +# define FREE_TCL_OBJS_ON_STACK(ov) +# endif +#endif + +#ifdef USE_ALLOCA +# include +#endif + +#ifdef __WIN32__ +# define XOTCLINLINE +# define XOTclNewObj(A) A=Tcl_NewObj() +# define DECR_REF_COUNT(A) \ + MEM_COUNT_FREE("INCR_REF_COUNT",A); Tcl_DecrRefCount(A) +#else +# if defined(sun) || __IBMC__ >= 0x0306 +# define XOTCLINLINE +# else +# define XOTCLINLINE inline +# endif +# ifdef USE_TCL_STUBS +# define XOTclNewObj(A) A=Tcl_NewObj() +# define DECR_REF_COUNT(A) \ + MEM_COUNT_FREE("INCR_REF_COUNT",A); assert((A)->refCount > -1); \ + Tcl_DecrRefCount(A) \ + +# else +# define XOTclNewObj(A) TclNewObj(A) +# define DECR_REF_COUNT(A) \ + MEM_COUNT_FREE("INCR_REF_COUNT",A); TclDecrRefCount(A) +# endif +#endif + +#if !defined(PRE83) && defined(TCL_THREADS) +# define XOTclMutex Tcl_Mutex +# define XOTclMutexLock(a) Tcl_MutexLock(a) +# define XOTclMutexUnlock(a) Tcl_MutexUnlock(a) +#else +# define XOTclMutex int +# define XOTclMutexLock(a) (*(a))++ +# define XOTclMutexUnlock(a) (*(a))-- +#endif + +#if defined(PRE84) +# define CONST84 +#else +# define CONST84 CONST +#endif + +#if defined(PRE81) +# define ObjStr(obj) Tcl_GetStringFromObj(obj, ((int*)NULL)) +#else +# define ObjStr(obj) (obj)->bytes ? (obj)->bytes : Tcl_GetString(obj) +/*# define ObjStr(obj) Tcl_GetString(obj) */ +#endif + +#ifdef V81 +# define EvalObj(in,cmd) Tcl_EvalObj(in,cmd,0) +# define TclIsVarArgument(args) (args->isArg) +# define Tcl_ObjSetVar2(in,p1,p2,newval,flags) \ + Tcl_SetObjVar2(in,ObjStr(p1),p2,newval,flags) +#define Tcl_ObjGetVar2(in,name1,name2,flgs) \ + Tcl_GetObjVar2(in, ObjStr(name1), \ + ((name2==NULL) ? (char*)NULL : ObjStr(name2)), flgs) +#else +# if defined(PRE83) +# define EvalObj(in,cmd) Tcl_EvalObj(in,cmd) +# else +# define EvalObj(in,cmd) Tcl_EvalObjEx(in,cmd,0) +# endif +# if defined(PRE81) && TCL_RELEASE_SERIAL<3 +# define TclIsVarArgument(args) (args->isArg) +# endif +#endif + +#if 1 +#define XOTcl_FrameDecls CallFrame *oldFramePtr = 0, frame, *newFramePtr = &frame +#define XOTcl_PushFrame(in,obj) \ + memset(newFramePtr, 0, sizeof(CallFrame)); \ + oldFramePtr = ((Interp *)in)->varFramePtr; \ + if (obj->nsPtr) { \ + newFramePtr->nsPtr = (Namespace*) obj->nsPtr; \ + } else { \ + newFramePtr->nsPtr = (Namespace*) RUNTIME_STATE(in)->fakeNS; \ + newFramePtr->isProcCallFrame = 1; \ + newFramePtr->procPtr = &RUNTIME_STATE(in)->fakeProc; \ + newFramePtr->varTablePtr = obj->varTable; \ + } \ + ((Interp *)in)->varFramePtr = newFramePtr; \ + MEM_COUNT_OPEN_FRAME() +#define XOTcl_PopFrame(in,obj) \ + if (!obj->nsPtr && obj->varTable == 0) \ + obj->varTable = newFramePtr->varTablePtr; \ + ((Interp *)in)->varFramePtr = oldFramePtr; \ + MEM_COUNT_CLOSE_FRAME() + +#else +/* slightly slower version based on Tcl_PushCallFrame */ +#define XOTcl_FrameDecls Tcl_CallFrame frame +#define XOTcl_PushFrame(in,obj) \ + if (obj->nsPtr) { \ + Tcl_PushCallFrame(in, &frame, obj->nsPtr, 0); \ + } else { \ + Tcl_PushCallFrame(in, &frame, RUNTIME_STATE(in)->fakeNS, 1); \ + Tcl_CallFrame_procPtr(&frame) = &RUNTIME_STATE(in)->fakeProc; \ + Tcl_CallFrame_varTablePtr(&frame) = obj->varTable; \ + } +#define XOTcl_PopFrame(in,obj) \ + if (!obj->nsPtr) { \ + if (obj->varTable == 0) \ + obj->varTable = Tcl_CallFrame_varTablePtr(&frame); \ + Tcl_CallFrame_varTablePtr(&frame) = 0; \ + Tcl_CallFrame_procPtr(&frame) = 0; \ + } \ + Tcl_PopCallFrame(in) +#endif + + +#define INCR_REF_COUNT(A) MEM_COUNT_ALLOC("INCR_REF_COUNT",A); Tcl_IncrRefCount(A) + +#ifdef OBJDELETION_TRACE +# define PRINTOBJ(ctx,obj) \ + fprintf(stderr, " %s %p %s oid=%p teardown=%p destroyCalled=%d\n", \ + ctx,obj,ObjStr(obj->cmdName), obj->id, obj->teardown, \ + (obj->flags & XOTCL_DESTROY_CALLED)) +#else +# define PRINTOBJ(ctx,obj) +#endif + +#define className(cl) (cl ? ObjStr(cl->object.cmdName) : "") + + +#define LONG_AS_STRING 32 + +/* TCL_CONTINUE is defined as 4, from 5 on we can + use app-specific return codes */ +#define XOTCL_UNKNOWN 5 +#define XOTCL_CHECK_FAILED 6 + +/* flags for call method */ +#define XOTCL_CM_NO_FILTERS 1 +#define XOTCL_CM_NO_UNKNOWN 2 + +/* + * + * XOTcl Structures + * + */ + +/* + * Filter structures + */ +typedef struct XOTclFilterStack { + Tcl_Command currentCmdPtr; + Tcl_Obj* calledProc; + struct XOTclFilterStack* next; +} XOTclFilterStack; + +typedef struct XOTclTclObjList { + Tcl_Obj* content; + struct XOTclTclObjList* next; +} XOTclTclObjList; + +/* + * Assertion structures + */ + +typedef struct XOTclProcAssertion { + XOTclTclObjList* pre; + XOTclTclObjList* post; +} XOTclProcAssertion; + +typedef struct XOTclAssertionStore { + XOTclTclObjList* invariants; + Tcl_HashTable procs; +} XOTclAssertionStore; + +typedef enum { /* powers of 2; add to ALL, if default; */ + CHECK_NONE = 0, CHECK_CLINVAR = 1, CHECK_OBJINVAR = 2, + CHECK_PRE = 4, CHECK_POST = 8, + CHECK_INVAR = CHECK_CLINVAR + CHECK_OBJINVAR, + CHECK_ALL = CHECK_INVAR + CHECK_PRE + CHECK_POST +} CheckOptions; + +void XOTclAssertionRename(Tcl_Interp* in, Tcl_Command cmd, + XOTclAssertionStore *as, + char *oldSimpleCmdName, char *newName); +/* + * mixins + */ +typedef struct XOTclMixinStack { + Tcl_Command currentCmdPtr; + struct XOTclMixinStack* next; +} XOTclMixinStack; + +/* + * Generic command pointer list + */ +typedef struct XOTclCmdList { + Tcl_Command cmdPtr; + ClientData clientData; + struct XOTclCmdList* next; +} XOTclCmdList; + +typedef void (XOTclFreeCmdListClientData) _ANSI_ARGS_((XOTclCmdList*)); + +/* for incr string */ +typedef struct XOTclStringIncrStruct { + char *buffer; + char *start; + int bufSize; + int length; +} XOTclStringIncrStruct; + +/* + * object flags ... + */ + +/* DESTROY_CALLED indicates that destroy was called on obj */ +#define XOTCL_DESTROY_CALLED 0x0001 +/* INIT_CALLED indicates that init was called on obj */ +#define XOTCL_INIT_CALLED 0x0002 +/* MIXIN_ORDER_VALID set when mixin order is valid */ +#define XOTCL_MIXIN_ORDER_VALID 0x0004 +/* MIXIN_ORDER_DEFINED set, when mixins are defined for obj */ +#define XOTCL_MIXIN_ORDER_DEFINED 0x0008 +#define XOTCL_MIXIN_ORDER_DEFINED_AND_VALID 0x000c +/* FILTER_ORDER_VALID set, when filter order is valid */ +#define XOTCL_FILTER_ORDER_VALID 0x0010 +/* FILTER_ORDER_DEFINED set, when filters are defined for obj */ +#define XOTCL_FILTER_ORDER_DEFINED 0x0020 +#define XOTCL_FILTER_ORDER_DEFINED_AND_VALID 0x0030 +/* IS_CLASS set, when object is a class */ +#define XOTCL_IS_CLASS 0x0040 +/* DESTROYED set, when object is physically destroyed with PrimitiveODestroy */ +#define XOTCL_DESTROYED 0x0080 +#define XOTCL_REFCOUNTED 0x0100 +#define XOTCL_RECREATE 0x0200 + +#define XOTclObjectSetClass(obj) \ + (obj)->flags |= XOTCL_IS_CLASS +#define XOTclObjectIsClass(obj) \ + ((obj)->flags & XOTCL_IS_CLASS) +#define XOTclObjectToClass(obj) \ + (XOTclClass*)((((XOTclObject*)obj)->flags & XOTCL_IS_CLASS)?obj:0) + + + +/* + * object and class internals + */ +typedef struct XOTclObjectOpt { + XOTclAssertionStore *assertions; + XOTclCmdList* filters; + XOTclCmdList* mixins; +#ifdef XOTCL_METADATA + Tcl_HashTable metaData; +#endif + ClientData clientData; + short checkoptions; +} XOTclObjectOpt; + +typedef struct XOTclObject { + Tcl_Obj *cmdName; + Tcl_Command id; + Tcl_Interp *teardown; + struct XOTclClass *cl; + Tcl_HashTable *varTable; + Tcl_Namespace *nsPtr; + XOTclObjectOpt *opt; + struct XOTclCmdList *filterOrder; + struct XOTclCmdList *mixinOrder; + XOTclFilterStack *filterStack; + XOTclMixinStack *mixinStack; + int refCount; + short flags; +} XOTclObject; + +typedef struct XOTclClassOpt { + XOTclCmdList* instfilters; + XOTclCmdList* instmixins; + XOTclAssertionStore *assertions; + Tcl_Obj* parameterClass; +#ifdef XOTCL_OBJECTDATA + Tcl_HashTable* objectdata; +#endif + ClientData clientData; +} XOTclClassOpt; + +typedef struct XOTclClass { + struct XOTclObject object; + struct XOTclClasses* super; + struct XOTclClasses* sub; + short color; + struct XOTclClasses* order; + struct XOTclClass* parent; + Tcl_HashTable instances; + Tcl_Namespace *nsPtr; + Tcl_Obj* parameters; + XOTclClassOpt* opt; +} XOTclClass; + +typedef struct XOTclClasses { + struct XOTclClass* cl; + ClientData clientData; + struct XOTclClasses* next; +} XOTclClasses; + +/* XOTcl global names and strings */ +/* these are names and contents for global (corresponding) Tcl_Objs + and Strings - otherwise these "constants" would have to be built + every time they are used; now they are built once in XOTcl_Init */ +typedef enum { + EMPTY, UNKNOWN, CREATE, DESTROY, INSTDESTROY, ALLOC, + INIT, INSTVAR, INTERP, AUTONAMES, + ZERO, MOVE, SELF, CLASS, RECREATE, + SELF_CLASS, SELF_PROC, PARAM_CL, + SEARCH_DEFAULTS, EXIT_HANDLER, + CLEANUP, CONFIGURE, FILTER, INSTFILTER, + INSTPROC, PROC, MKGETTERSETTER, FORMAT, + NEWOBJ, GUARD_OPTION, DEFAULTMETHOD, + __UNKNOWN, + /** these are the redefined tcl commands; leave them + together at the end */ + EXPR, INCR, INFO, RENAME, SUBST, +} XOTclGlobalNames; +#if !defined(XOTCL_C) +extern char *XOTclGlobalStrings[]; +#else +char *XOTclGlobalStrings[] = { + "", "unknown", "create", "destroy", "instdestroy", "alloc", + "init", "instvar", "interp", "__autonames", + "0", "move", "self", "class", "recreate", + "self class", "self proc", "::xotcl::Class::Parameter", + "searchDefaults", "__exitHandler", + "cleanup", "configure", "filter", "instfilter", + "instproc", "proc", "mkGetterSetter", "format", + "__#", "-guard", "defaultmethod", + "__unknown", + "expr", "incr", "info", "rename", "subst", +}; +#endif + +#define XOTclGlobalObjects RUNTIME_STATE(in)->methodObjNames + +/* XOTcl ShadowTclCommands */ +typedef struct XOTclShadowTclCommandInfo { + TclObjCmdProcType proc; + ClientData cd; +} XOTclShadowTclCommandInfo; +typedef enum {SHADOW_LOAD=1, SHADOW_UNLOAD=0, SHADOW_REFETCH=2} XOTclShadowOperations; + +int XOTclCallCommand(Tcl_Interp* in, XOTclGlobalNames name, + int objc, Tcl_Obj *CONST objv[]); +int XOTclShadowTclCommands(Tcl_Interp* in, XOTclShadowOperations load); + + +/* + * XOTcl CallStack + */ +typedef struct XOTclCallStackContent { + XOTclObject *self; + XOTclClass *cl; + Tcl_Command cmdPtr; + Tcl_Command destroyedCmd; + Tcl_CallFrame *currentFramePtr; + unsigned short frameType; + unsigned short callsNext; + XOTclFilterStack *filterStackEntry; +} XOTclCallStackContent; + +#define XOTCL_CSC_TYPE_PLAIN 0 +#define XOTCL_CSC_TYPE_MIXIN 1 +#define XOTCL_CSC_TYPE_FILTER 2 +#define XOTCL_CSC_INACTIVE_FLAG 4 +#define XOTCL_CSC_TYPE_ACTIVE_MIXIN 1 +#define XOTCL_CSC_TYPE_ACTIVE_FILTER 2 +#define XOTCL_CSC_TYPE_INACTIVE_MIXIN 5 +#define XOTCL_CSC_TYPE_INACTIVE_FILTER 6 +#define XOTCL_CSC_TYPE_GUARD 8 + +typedef struct XOTclCallStack { + XOTclCallStackContent content[MAX_NESTING_DEPTH]; + XOTclCallStackContent *top; + short guardCount; +} XOTclCallStack; + +#if defined(PROFILE) +typedef struct XOTclProfile { + long int overallTime; + Tcl_HashTable objectData; + Tcl_HashTable methodData; +} XOTclProfile; +#endif + +typedef struct XOTclRuntimeState { + XOTclCallStack cs; + Tcl_Namespace *XOTclClassesNS; + Tcl_Namespace *XOTclNS; + /* + * definitions of the main xotcl objects + */ + XOTclClass *theObject; + XOTclClass *theClass; + Tcl_CmdProc *interpProc; + Tcl_ObjCmdProc *objInterpProc; + Tcl_Obj **methodObjNames; + struct XOTclShadowTclCommandInfo *tclCommands; + int errorCount; + int callDestroy; + int callIsDestroy; + int exitHandlerDestroyRound; + int returnCode; + long newCounter; + XOTclStringIncrStruct iss; + Proc fakeProc; + Tcl_Namespace *fakeNS; + XotclStubs *xotclStubs; + Tcl_CallFrame *varFramePtr; +#if defined(PROFILE) + XOTclProfile profile; +#endif + ClientData clientData; +} XOTclRuntimeState; + +#define XOTCL_EXITHANDLER_OFF 0 +#define XOTCL_EXITHANDLER_ON_SOFT_DESTROY 1 +#define XOTCL_EXITHANDLER_ON_PHYSICAL_DESTROY 2 + +/* + * + * Mostly internally used API functions + * + */ + +#include "xotclIntDecls.h" + +/* + * Profiling functions + */ + +#if defined(PROFILE) +extern void +XOTclProfileFillTable(Tcl_HashTable* table, Tcl_DString* key, + double totalMicroSec); +extern void +XOTclProfileEvaluateData(Tcl_Interp* in, long int startSec, long int startUsec, + XOTclObject* obj, XOTclClass *cl, char *methodName); +extern void +XOTclProfilePrintTable(Tcl_HashTable* table); + +extern void +XOTclProfilePrintData(Tcl_Interp* in); + +extern void +XOTclProfileInit(Tcl_Interp* in); +#endif + +/* + * MEM Counting + */ +#ifdef XOTCL_MEM_COUNT +void XOTclMemCountAlloc(char* id, void *); +void XOTclMemCountFree(char* id, void *); +void XOTclMemCountDump(); +#endif /* XOTCL_MEM_COUNT */ +/* + * old, deprecated meta-data command + */ +#if defined(XOTCL_METADATA) +extern void +XOTclMetaDataDestroy(XOTclObject* obj); +extern void +XOTclMetaDataInit(XOTclObject* obj); +extern int +XOTclOMetaDataMethod (ClientData cd, Tcl_Interp* in, + int objc, Tcl_Obj *objv[]); +#endif /* XOTCL_METADATA */ + + +/* + * bytecode support + */ +#ifdef XOTCL_BYTECODE +typedef struct XOTclCompEnv { + int bytecode; + Command *cmdPtr; + CompileProc *compileProc; + Tcl_ObjCmdProc *callProc; +} XOTclCompEnv; + +typedef enum {INST_INITPROC, INST_NEXT, INST_SELF, INST_SELF_DISPATCH, + LAST_INSTRUCTION} XOTclByteCodeInstructions; + + +extern XOTclCompEnv *XOTclGetCompEnv(); + +Tcl_ObjCmdProc XOTclInitProcNSCmd, XOTclSelfDispatchCmd, + XOTclNextObjCmd, XOTclGetSelfObjCmd; +#endif + +int XOTclCorrectAutoPath(Tcl_Interp* in); +int XOTclDirectSelfDispatch(ClientData cd, Tcl_Interp* in, + int objc, Tcl_Obj *CONST objv[]); +int XOTclObjDispatch(ClientData cd, Tcl_Interp* in, + int objc, Tcl_Obj *CONST objv[]); + + +XOTclCallStackContent * +XOTclCallStackFindActiveFrame(Tcl_Interp* in, int offset); +XOTclCallStackContent * +XOTclCallStackFindLastInvocation(Tcl_Interp* in, int offset); + +int XOTclCallMethodWithArg(ClientData cd, Tcl_Interp* in, + Tcl_Obj* method, Tcl_Obj* arg, + int objc, Tcl_Obj *CONST objv[], int flags); + +/* functions from xotclUtil.c */ +char *XOTcl_ltoa(char *buf, long i, int *len); +char *XOTclStringIncr(XOTclStringIncrStruct *iss); +void XOTclStringIncrInit(XOTclStringIncrStruct *iss); +void XOTclStringIncrFree(XOTclStringIncrStruct *iss); + + +#if !defined(NDEBUG) +/*# define XOTCLINLINE*/ +#endif + + +/*** common win sermon ***/ +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#endif /* _xotcl_int_h_ */ Index: xotcl/generic/xotclIntDecls.h =================================================================== diff -u --- xotcl/generic/xotclIntDecls.h (revision 0) +++ xotcl/generic/xotclIntDecls.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,57 @@ +/* + * xotclIntDecls.h -- + * + * This file contains the declarations for all unsupported + * functions that are exported by the Tcl library. These + * interfaces are not guaranteed to remain the same between + * versions. Use at your own risk. + * + * Copyright (c) 1998-1999 by XXXX + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + */ + +#ifndef _XOTCLINTDECLS +#define _XOTCLINTDECLS + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the xotclInt.decls script. + */ + +/* !BEGIN!: Do not edit below this line. */ + +/* + * Exported function declarations: + */ + + +typedef struct XotclIntStubs { + int magic; + struct XotclIntStubHooks *hooks; + +} XotclIntStubs; + +#ifdef __cplusplus +extern "C" { +#endif +extern XotclIntStubs *xotclIntStubsPtr; +#ifdef __cplusplus +} +#endif + +#if defined(USE_XOTCL_STUBS) && !defined(USE_XOTCL_STUB_PROCS) + +/* + * Inline function declarations: + */ + + +#endif /* defined(USE_XOTCL_STUBS) && !defined(USE_XOTCL_STUB_PROCS) */ + +/* !END!: Do not edit above this line. */ + +#endif /* _XOTCLINTDECLS */ Index: xotcl/generic/xotclMetaData.c =================================================================== diff -u --- xotcl/generic/xotclMetaData.c (revision 0) +++ xotcl/generic/xotclMetaData.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,176 @@ +/* -*- Mode: c++ -*- + * $Id: xotclMetaData.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * + * Extended Object Tcl (XOTcl) + * + * Copyright (C) 1999-2000 Gustaf Neumann, Uwe Zdun + * + * + * xotclReference.c -- + * + * XOTcl Object References + * + */ + +#include "xotclInt.h" + +#ifdef XOTCL_METADATA +/* + * Meta Data + */ + +void +XOTclMetaDataRemoveDepending(XOTclClass* cl, char* name) { + XOTclClasses *saved = cl->order, *clPtr; + cl->order = 0; + + clPtr = XOTclComputeDependents(cl); + + while (clPtr != 0) { + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr = &clPtr->cl->instances ? + Tcl_FirstHashEntry(&clPtr->cl->instances, &hSrch) : 0; + for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { + XOTclObject* obj = (XOTclObject*) + Tcl_GetHashKey(&clPtr->cl->instances, hPtr); + Tcl_HashEntry* h1Ptr = 0; + if (obj->opt) + h1Ptr = Tcl_FindHashEntry(&obj->opt->metaData, name); + if (h1Ptr) { + Tcl_DeleteHashEntry(h1Ptr); + } + } + clPtr = clPtr->next; + } + + XOTclRemoveClasses(cl->order); + cl->order = saved; +} + +int +XOTclMetaDataInheritance (XOTclObject* obj, char* name) { + XOTclClasses *clPtr; + assert(obj); + + if (!obj->cl->order) + obj->cl->order = XOTclComputePrecedence(obj->cl); + clPtr = obj->cl->order; + if (clPtr) { + while (clPtr != 0) { + if (clPtr->cl->object.opt) { + if (Tcl_FindHashEntry(&clPtr->cl->object.opt->metaData, name)) { + return 1; + } + } + clPtr = clPtr->next; + } + } + return 0; +} + +void +XOTclMetaDataDestroy(XOTclObject* obj) { + if (obj->opt) + Tcl_DeleteHashTable(&obj->opt->metaData); +} + +void +XOTclMetaDataInit(XOTclObject* obj) { + XOTclRequireObjectOpt(obj); + Tcl_InitHashTable(&obj->opt->metaData, TCL_STRING_KEYS); +} + +int +XOTclOMetaDataMethod (ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj *objv[]) { + XOTclObject *obj = (XOTclObject*)cd; + XOTclClass *cl = XOTclObjectToClass(cd); + char* option; int add = -1; + int result = TCL_OK; + int oc; Tcl_Obj** ov; int i; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc < 2) + return XOTclObjErrArgCnt(in,obj->cmdName, + "metadata ?(add|remove)? metaDataList"); + + option = ObjStr(objv[1]); + switch (*option) { + case 'a': + if (strcmp(option,"add") == 0) add = 1; break; + case 'r': + if (strcmp(option,"remove") == 0) add = 0; break; + } + if (add == -1) { + if (objc == 2) { + if (obj->opt) { + Tcl_HashEntry* hPtr = Tcl_FindHashEntry(&obj->opt->metaData, option); + if (hPtr) { + Tcl_Obj* entry = (Tcl_Obj *) Tcl_GetHashValue(hPtr); + if (entry) { + Tcl_SetObjResult(in, (Tcl_Obj *) Tcl_GetHashValue(hPtr)); + } else { + Tcl_ResetResult(in); + } + } + return TCL_OK; + } + } + if (objc == 3) { + if (obj->opt) { + Tcl_HashEntry* hPtr = Tcl_FindHashEntry(&obj->opt->metaData, option); + if (!hPtr) { + int nw; + if (XOTclMetaDataInheritance(obj, option)) { + hPtr = Tcl_CreateHashEntry(&obj->opt->metaData, option, &nw); + if (!nw) + return XOTclVarErrMsg(in, + "MetaData: Can't create MetaData Entry: ", + option, (char*) NULL); + } + } + if (hPtr) { + Tcl_Obj* entry = (Tcl_Obj *) Tcl_GetHashValue(hPtr); + if (entry) + DECR_REF_COUNT(entry); + INCR_REF_COUNT(objv[2]); + Tcl_SetHashValue(hPtr, (ClientData) objv[2]); + return TCL_OK; + } + } + } + return XOTclVarErrMsg(in,"MetaData: Unknown option; given Option: ", + option, (char*) NULL); + } + + if (Tcl_ListObjGetElements(in, objv[2], &oc, &ov) == TCL_OK) { + for (i = 0; i < oc; i ++) { + char* value = ObjStr (ov[i]); + if (obj->opt) { + if (add) { + int nw; + Tcl_HashEntry* hPtr = Tcl_FindHashEntry(&obj->opt->metaData, value); + if (hPtr) + return XOTclVarErrMsg(in, + "Can't add MetaData, MetaData exists: ", + value, + (char*) NULL); + hPtr = Tcl_CreateHashEntry(&obj->opt->metaData, value, &nw); + if (!nw) + return XOTclVarErrMsg(in, + "MetaData: Can't create MetaData Entry: ", + value,(char*) NULL); + } else { + Tcl_HashEntry* hPtr = Tcl_FindHashEntry(&obj->opt->metaData, value); + if (hPtr) { + Tcl_DeleteHashEntry(hPtr); + if (cl) { + XOTclMetaDataRemoveDepending(cl, value); + } + } + } + } + } + } + return result; +} +#endif Index: xotcl/generic/xotclObjectData.c =================================================================== diff -u --- xotcl/generic/xotclObjectData.c (revision 0) +++ xotcl/generic/xotclObjectData.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,61 @@ +/* -*- Mode: c++ -*- + * xotclObjectData.c + * + * Extended Object Tcl (XOTcl) + * + * Copyright (C) 1999-2002 Gustaf Neumann, Uwe Zdun + * + * + * xotclObjectData.c -- + * + * XOTcl Object Data, needs XOTCL_OBJECTDATA to be compiled in + * + */ + +#include "xotclInt.h" + +#ifdef XOTCL_OBJECTDATA +extern void +XOTclFreeObjectData(XOTclClass* cl) { + if (cl->opt && cl->opt->objectdata) { + Tcl_DeleteHashTable(cl->opt->objectdata); + ckfree((char*)cl->opt->objectdata); + cl->opt->objectdata = 0; + } +} +extern void +XOTclSetObjectData(XOTclObject* obj, XOTclClass* cl, ClientData data) { + Tcl_HashEntry *hPtr; + int nw; + + XOTclRequireClassOpt(cl); + + if (!cl->opt->objectdata) { + cl->opt->objectdata = (Tcl_HashTable*)ckalloc(sizeof(Tcl_HashTable)); + Tcl_InitHashTable(cl->opt->objectdata, TCL_ONE_WORD_KEYS); + } + hPtr = Tcl_CreateHashEntry(cl->opt->objectdata, (char*)obj, &nw); + Tcl_SetHashValue(hPtr, data); +} + +extern int +XOTclGetObjectData(XOTclObject* obj, XOTclClass* cl, ClientData* data) { + Tcl_HashEntry *hPtr; + if (!cl->opt || !cl->opt->objectdata) + return 0; + hPtr = Tcl_FindHashEntry(cl->opt->objectdata, (char*)obj); + if (data) *data = hPtr ? Tcl_GetHashValue(hPtr) : 0; + return hPtr != 0; +} + +extern int +XOTclUnsetObjectData(XOTclObject* obj, XOTclClass* cl) { + Tcl_HashEntry *hPtr; + + if (!cl->opt || !cl->opt->objectdata) + return 0; + hPtr = Tcl_FindHashEntry(cl->opt->objectdata, (char*)obj); + if (hPtr) Tcl_DeleteHashEntry(hPtr); + return hPtr != 0; +} +#endif Index: xotcl/generic/xotclProfile.c =================================================================== diff -u --- xotcl/generic/xotclProfile.c (revision 0) +++ xotcl/generic/xotclProfile.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,145 @@ +/* -*- Mode: c++ -*- + * $Id: xotclProfile.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * + * Extended Object Tcl (XOTcl) + * + * Copyright (C) 1999-2000 Gustaf Neumann, Uwe Zdun + * + * + * xotclProfile.c -- + * + * Profiling information printout for XOTcl + * + * For profiling infos PROFILE (xotcl.h) flag must be activated + * + */ + +#include "xotclInt.h" + +#if defined(PROFILE) +void +XOTclProfileFillTable(Tcl_HashTable* table, Tcl_DString* key, + double totalMicroSec) { + Tcl_HashEntry* hPtr; + char* keyStr = Tcl_DStringValue(key); + long int* value; + + hPtr = Tcl_FindHashEntry(table, keyStr); + if (!hPtr) { + int nw; + hPtr = Tcl_CreateHashEntry(table, keyStr, &nw); + if (!nw) + return; + value = (long int*) ckalloc (sizeof(long int)); + *value = 0; + Tcl_SetHashValue(hPtr, (ClientData) value); + } else + value = (long int*) Tcl_GetHashValue (hPtr); + + *value += totalMicroSec; + + + /* { + long int* d = (long int*) Tcl_GetHashValue (hPtr); + fprintf(stderr, "Entered %s ... %ld\n", Tcl_GetHashKey(table, hPtr), *d); + }*/ + +} + +void +XOTclProfileEvaluateData(Tcl_Interp* in, long int startSec, long int startUsec, + XOTclObject* obj, XOTclClass *cl, char *methodName) { + double totalMicroSec; + struct timeval trt; + Tcl_DString objectKey, methodKey; + + XOTclProfile* profile = &RUNTIME_STATE(in)->profile; + + gettimeofday(&trt, NULL); + + totalMicroSec = (trt.tv_sec - startSec) * 1000000 + + (trt.tv_usec - startUsec); + + profile->overallTime += totalMicroSec; + + if (obj->teardown == 0 || !obj->id || obj->destroyCalled) + return; + + ALLOC_DSTRING(&objectKey, ObjStr(obj->cmdName)); + + if (cl) + ALLOC_DSTRING(&methodKey, ObjStr(cl->object.cmdName)); + else + ALLOC_DSTRING(&methodKey, ObjStr(obj->cmdName)); + Tcl_DStringAppend(&methodKey, "->", 2); + Tcl_DStringAppend(&methodKey, methodName, -1); + if (cl) + Tcl_DStringAppend(&methodKey, " (instproc)", 11); + else + Tcl_DStringAppend(&methodKey, " (proc)", 7); + + XOTclProfileFillTable(&profile->objectData, &objectKey, totalMicroSec); + XOTclProfileFillTable(&profile->methodData, &methodKey, totalMicroSec); + DSTRING_FREE(&objectKey); + DSTRING_FREE(&methodKey); +} + +void +XOTclProfilePrintTable(Tcl_HashTable* table) { + Tcl_HashEntry* topValueHPtr; + long int* topValue; + + do { + Tcl_HashSearch hSrch; + Tcl_HashEntry* hPtr = table ? + Tcl_FirstHashEntry(table, &hSrch) : 0; + char* topKey = 0; + + topValueHPtr = 0; + topValue = 0; + + for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { + long int *val = (long int*) Tcl_GetHashValue(hPtr); + if (val && (!topValue || (topValue && *val >= *topValue))) { + topValue = val; + topValueHPtr = hPtr; + topKey = Tcl_GetHashKey(table, hPtr); + } + } + + if (topValueHPtr) { + fprintf(stderr, " %15ld %s\n", *topValue, topKey); + ckfree((char*) topValue); + Tcl_DeleteHashEntry(topValueHPtr); + } + } while (topValueHPtr); +} + +void +XOTclProfilePrintData(Tcl_Interp* in) { + XOTclProfile* profile = &RUNTIME_STATE(in)->profile; + + fprintf(stderr, "------------------------------------------------------------------\n"); + fprintf(stderr, "\nXOTcl Profile Information\n\n"); + fprintf(stderr, "------------------------------------------------------------------\n"); + fprintf(stderr, "Overall Elapsed Time %ld\n", + profile->overallTime); + fprintf(stderr, "------------------------------------------------------------------\n"); + fprintf(stderr, " MICROSECONDS OBJECT-NAME\n"); + XOTclProfilePrintTable(&profile->objectData); + fprintf(stderr, "------------------------------------------------------------------\n"); + fprintf(stderr, " MICROSECONDS (CL/OBJ)->METHOD-NAME\n"); + XOTclProfilePrintTable(&profile->methodData); + fprintf(stderr, "------------------------------------------------------------------\n"); +} + +void +XOTclProfileInit(Tcl_Interp* in) { + RUNTIME_STATE(in)->profile.overallTime = 0; + Tcl_InitHashTable(&RUNTIME_STATE(in)->profile.objectData, + TCL_STRING_KEYS); + Tcl_InitHashTable(&RUNTIME_STATE(in)->profile.methodData, + TCL_STRING_KEYS); +} + +#endif Index: xotcl/generic/xotclShadow.c =================================================================== diff -u --- xotcl/generic/xotclShadow.c (revision 0) +++ xotcl/generic/xotclShadow.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,194 @@ +/* -*- Mode: c++ -*- + * $Id: xotclShadow.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * + * Extended Object Tcl (XOTcl) + * + * Copyright (C) 1999-2004 Gustaf Neumann, Uwe Zdun + * + * + * xotclShadow.c -- + * + * Shadowing (overloading) and accessing global tcl obj commands + * + */ + +#include "xotclInt.h" +#include "xotclAccessInt.h" + +static int +XOTclReplaceCommandCleanup(Tcl_Interp *in, XOTclGlobalNames name) { + Tcl_Command cmd; + int result = TCL_OK; + XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(in)->tclCommands[name-EXPR]; + + /*fprintf(stderr," cleanup for %s ti=%p in %p\n", XOTclGlobalStrings[name], ti, in);*/ + cmd = Tcl_GetCommandFromObj(in, XOTclGlobalObjects[name]); + if (cmd != NULL) { + Tcl_Command_objProc(cmd) = ti->proc; + ti->proc = NULL; + } else { + result = TCL_ERROR; + } + + return result; +} + +static void +XOTclReplaceCommandCheck(Tcl_Interp *in, XOTclGlobalNames name, Tcl_ObjCmdProc *proc) { + Tcl_Command cmd; + XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(in)->tclCommands[name-EXPR]; + cmd = Tcl_GetCommandFromObj(in, XOTclGlobalObjects[name]); + + if (cmd != NULL && ti->proc && Tcl_Command_objProc(cmd) != proc) { + /* + fprintf(stderr, "we have to do something about %s %p %p\n", + XOTclGlobalStrings[name], Tcl_Command_objProc(cmd), proc); + */ + ti->proc = Tcl_Command_objProc(cmd); + ti->cd = Tcl_Command_objClientData(cmd); + Tcl_Command_objProc(cmd) = proc; + } +} + +static int +XOTclReplaceCommand(Tcl_Interp *in, XOTclGlobalNames name, + Tcl_ObjCmdProc *xotclReplacementProc, int pass) { + Tcl_Command cmd; + XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(in)->tclCommands[name-EXPR]; + int result = TCL_OK; + + /*fprintf(stderr,"XOTclReplaceCommand %d\n",name);*/ + cmd = Tcl_GetCommandFromObj(in, XOTclGlobalObjects[name]); + + if (cmd == NULL) { + result = TCL_ERROR; + } else { + Tcl_ObjCmdProc *objProc = Tcl_Command_objProc(cmd); + if (xotclReplacementProc != objProc) { + if (pass == 0) { /* setting values on first pass (must be locked here) */ + ti->proc = objProc; + ti->cd = Tcl_Command_objClientData(cmd); + } else if (ti->proc != objProc) { + /*fprintf(stderr, "we have to refetch command for %s\n",XOTclGlobalStrings[name]);*/ + ti->proc = objProc; + ti->cd = Tcl_Command_objClientData(cmd); + } + if (xotclReplacementProc) { + Tcl_Command_objProc(cmd) = xotclReplacementProc; + /*Tcl_CreateObjCommand(in, XOTclGlobalStrings[name], xotclReplacementProc, 0, 0);*/ + } + } + } + return result; +} + +static int +XOTcl_RenameObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + /* this call the Tcl_RenameObjCmd, but it ensures before that + the renamed obj, functions, etc. are not part of XOTcl */ + XOTclObject *obj = NULL; + Tcl_Command cmd; + + /* wrong # args => normal Tcl ErrMsg*/ + if (objc != 3) + return XOTclCallCommand(in, RENAME, objc, objv); + + /* if an obj/cl should be renamed => call the XOTcl move method */ + cmd = Tcl_FindCommand(in, ObjStr(objv[1]), (Tcl_Namespace *)NULL,0); + + if (cmd != NULL) { + obj = XOTclGetObjectFromCmdPtr(cmd); + if (obj) { + return XOTclCallMethodWithArg((ClientData)obj, in, + XOTclGlobalObjects[MOVE], objv[2], 3, 0, 0); + } + } + + /* Actually rename the cmd using Tcl's rename*/ + return XOTclCallCommand(in, RENAME, objc, objv); +} + +static int +XOTcl_InfoObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + int result, isBody = 0; + + if (objc > 1) { + char *opt = ObjStr(objv[1]); + if (isBodyString(opt) && objc > 2) + isBody = 1; + } + result = XOTclCallCommand(in, INFO, objc, objv); + + if (isBody && result == TCL_OK) { + char *body = ObjStr(Tcl_GetObjResult(in)); + if (strncmp(body, "::xotcl::initProcNS\n",20) == 0) + body+=20; + Tcl_SetObjResult(in, Tcl_NewStringObj(body, -1)); + } + return result; +} + + +/* + * Obtain the names of the tcl commands + * not available through the stub interface and overload some global commands + */ +int +XOTclShadowTclCommands(Tcl_Interp *in, XOTclShadowOperations load) { + int rc = TCL_OK; + if (load == SHADOW_LOAD) { + int initialized = (int) RUNTIME_STATE(in)->tclCommands; + assert(initialized == 0); + RUNTIME_STATE(in)->tclCommands = + NEW_ARRAY(XOTclShadowTclCommandInfo, SUBST-EXPR+1); + + /*fprintf(stderr, "+++ load tcl commands %d %d\n", load, initialized);*/ + +#ifdef USE_TCL_STUBS + /* no commands are overloeaded, these are only used for calling + e.g. Tcl_ExprObjCmd(), Tcl_IncrObjCmd() and Tcl_SubstObjCmd(), + which are not avalailable in though the stub table */ + rc|= XOTclReplaceCommand(in, EXPR, 0, initialized); + rc|= XOTclReplaceCommand(in, INCR, 0, initialized); + rc|= XOTclReplaceCommand(in, SUBST, 0, initialized); +#endif + /* for the following commands, we have to add our own semantics */ + rc|= XOTclReplaceCommand(in, INFO, XOTcl_InfoObjCmd, initialized); + rc|= XOTclReplaceCommand(in, RENAME, XOTcl_RenameObjCmd, initialized); + + } else if (load == SHADOW_REFETCH) { + XOTclReplaceCommandCheck(in, INFO, XOTcl_InfoObjCmd); + XOTclReplaceCommandCheck(in, RENAME, XOTcl_RenameObjCmd); + } else { + XOTclReplaceCommandCleanup(in, INFO); + XOTclReplaceCommandCleanup(in, RENAME); + FREE(XOTclShadowTclCommandInfo*, RUNTIME_STATE(in)->tclCommands); + RUNTIME_STATE(in)->tclCommands = NULL; + } + return rc; +} + +/* + * call a Tcl command with given objv's ... replace objv[0] + * with the given command name + */ +int XOTclCallCommand(Tcl_Interp *in, XOTclGlobalNames name, + int objc, Tcl_Obj *CONST objv[]) { + int result; + XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(in)->tclCommands[name-EXPR]; + DEFINE_NEW_TCL_OBJS_ON_STACK(objc, ov); + + /* {int i; + fprintf(stderr,"calling %s (%p %p) in %p, objc=%d ", + XOTclGlobalStrings[name],ti,ti->proc, in, objc); + for(i=0;i 1) + memcpy(ov+1, objv+1, sizeof(Tcl_Obj *)*(objc-1)); + result = (*ti->proc)(ti->cd, in, objc, ov); + FREE_TCL_OBJS_ON_STACK(ov); + return result; +} Index: xotcl/generic/xotclStubInit.c =================================================================== diff -u --- xotcl/generic/xotclStubInit.c (revision 0) +++ xotcl/generic/xotclStubInit.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,78 @@ +/* + * xotclStubInit.c -- + * + * This file contains the initializers for the XOTcl stub vectors. + * + * Copyright (c) 1998-1999 by XXX + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + */ + +#include "xotclInt.h" + +/* + * Remove macros that will interfere with the definitions below. + */ + +/* + * WARNING: The contents of this file is automatically generated by the + * tools/genStubs.tcl script. Any modifications to the function declarations + * below should be made in the generic/tcl.decls script. + */ + +/* !BEGIN!: Do not edit below this line. */ + +XotclIntStubs xotclIntStubs = { + TCL_STUB_MAGIC, + NULL, +}; + +static XotclStubHooks xotclStubHooks = { + &xotclIntStubs +}; + +XotclStubs xotclStubs = { + TCL_STUB_MAGIC, + &xotclStubHooks, + Xotcl_Init, /* 0 */ + NULL, /* 1 */ + XOTclIsClass, /* 2 */ + NULL, /* 3 */ + XOTclGetObject, /* 4 */ + XOTclGetClass, /* 5 */ + XOTclCreateObject, /* 6 */ + NULL, /* 7 */ + XOTclCreateClass, /* 8 */ + XOTclDeleteObject, /* 9 */ + XOTclDeleteClass, /* 10 */ + XOTclAddPMethod, /* 11 */ + XOTclAddIMethod, /* 12 */ + XOTclRemovePMethod, /* 13 */ + XOTclRemoveIMethod, /* 14 */ + XOTclOSetInstVar, /* 15 */ + XOTclOGetInstVar, /* 16 */ + XOTclInstVar, /* 17 */ + NULL, /* 18 */ + XOTclOSetInstVar2, /* 19 */ + XOTclOGetInstVar2, /* 20 */ + XOTclUnsetInstVar2, /* 21 */ + XOTcl_TraceObjCmd, /* 22 */ + XOTclErrMsg, /* 23 */ + XOTclVarErrMsg, /* 24 */ + XOTclErrInProc, /* 25 */ + XOTclObjErrArgCnt, /* 26 */ + XOTclErrBadVal, /* 27 */ + XOTclObjErrType, /* 28 */ + XOTclStackTrace, /* 29 */ + XOTclCallStackTrace, /* 30 */ + XOTclDeprecatedMsg, /* 31 */ + XOTclSetObjClientData, /* 32 */ + XOTclGetObjClientData, /* 33 */ + XOTclSetClassClientData, /* 34 */ + XOTclGetClassClientData, /* 35 */ + XOTclRequireObjNamespace, /* 36 */ +}; + +/* !END!: Do not edit above this line. */ Index: xotcl/generic/xotclStubLib.c =================================================================== diff -u --- xotcl/generic/xotclStubLib.c (revision 0) +++ xotcl/generic/xotclStubLib.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,85 @@ +/* + * xotclStubLib.c -- + * + * Stub object that will be statically linked into extensions of XOTcl + * + * Copyright (c) 2001 UZ + * Copyright (c) 1998 Paul Duffin. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + */ + +/* + * We need to ensure that we use the stub macros so that this file contains + * no references to any of the stub functions. This will make it possible + * to build an extension that references Tcl_InitStubs but doesn't end up + * including the rest of the stub functions. + */ + +#ifndef USE_TCL_STUBS +#define USE_TCL_STUBS +#endif +#undef USE_TCL_STUB_PROCS + +/* + * This ensures that the Xotcl_InitStubs has a prototype in + * xotcl.h and is not the macro that turns it into Tcl_PkgRequire + */ + +#ifndef USE_XOTCL_STUBS +#define USE_XOTCL_STUBS +#endif + +#include "xotclInt.h" + +XotclStubs *xotclStubsPtr = NULL; +XotclIntStubs *xotclIntStubsPtr = NULL; + +/* + *---------------------------------------------------------------------- + * + * Xotcl_InitStubs -- + * + * Tries to initialise the stub table pointers and ensures that + * the correct version of XOTcl is loaded. + * + * Results: + * The actual version of XOTcl that satisfies the request, or + * NULL to indicate that an error occurred. + * + * Side effects: + * Sets the stub table pointers. + * + *---------------------------------------------------------------------- + */ + +CONST char * +Xotcl_InitStubs (interp, version, exact) + Tcl_Interp *interp; + char *version; + int exact; +{ + CONST char *actualVersion; + + actualVersion = Tcl_PkgRequireEx(interp, "XOTcl", version, exact, + (ClientData *) &xotclStubsPtr); + + if (actualVersion == NULL) { + xotclStubsPtr = NULL; + return NULL; + } + + if (xotclStubsPtr == NULL) { + return NULL; + } + + if (xotclStubsPtr->hooks) { + xotclIntStubsPtr = xotclStubsPtr->hooks->xotclIntStubs; + } else { + xotclIntStubsPtr = NULL; + } + + return actualVersion; +} Index: xotcl/generic/xotclTrace.c =================================================================== diff -u --- xotcl/generic/xotclTrace.c (revision 0) +++ xotcl/generic/xotclTrace.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,217 @@ +/* -*- Mode: c++ -*- + * $Id: xotclTrace.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * + * Extended Object Tcl (XOTcl) + * + * Copyright (C) 1999-2000 Gustaf Neumann, Uwe Zdun + * + * + * xotclTrace.c -- + * + * Tracing facilities for XOTcl + * + */ + +#include "xotclInt.h" +#include "xotclAccessInt.h" + +void +XOTclStackTrace(Tcl_Interp *in) { + Interp *iPtr = (Interp *) in; + CallFrame *f = iPtr->framePtr, *v = iPtr->varFramePtr; + Tcl_Obj *varCmdObj; + + XOTclNewObj(varCmdObj); + fprintf (stderr, " TCL STACK: "); + if (f == 0) fprintf(stderr, "- "); + while (f) { + Tcl_Obj *cmdObj; + XOTclNewObj(cmdObj); + if (f && f->isProcCallFrame && f->procPtr && f->procPtr->cmdPtr) { + Tcl_GetCommandFullName(in, (Tcl_Command) f->procPtr->cmdPtr, cmdObj); + if (cmdObj) { + fprintf(stderr, " %s (%d)", ObjStr(cmdObj), f->level); + } + DECR_REF_COUNT(cmdObj); + } else fprintf(stderr, "- "); + + f = f->callerPtr; + if (f) fprintf(stderr, ","); + } + + fprintf (stderr, " VARFRAME: "); + if (v && v->isProcCallFrame && v->procPtr && v->procPtr->cmdPtr) { + Tcl_GetCommandFullName(in, (Tcl_Command) v->procPtr->cmdPtr, varCmdObj); + if (varCmdObj) { + fprintf(stderr, " %s (%d)\n", ObjStr(varCmdObj), v->level); + } + } else fprintf(stderr, "- \n"); + DECR_REF_COUNT(varCmdObj); +} + +void +XOTclCallStackTrace(Tcl_Interp *in) { + XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStackContent *csc; + int i=1, entries = cs->top - cs->content; + + fprintf (stderr, " XOTCL CALLSTACK: (%d entries, top: %p) \n", entries, cs->top); + for (csc = &cs->content[1]; csc <= cs->top; csc++) { + fprintf(stderr, " %d: %p ",i++,csc); + if (csc->self) + fprintf(stderr, "OBJ %s, ", ObjStr(csc->self->cmdName)); + if (csc->cl) + fprintf(stderr, "INSTPROC %s->", className(csc->cl)); + else + fprintf(stderr, "PROC "); + + /*fprintf(stderr, " cmd %p, obj %p, ",csc->cmdPtr, csc->self);*/ + + if (csc->cmdPtr && !csc->destroyedCmd) + fprintf(stderr, "%s, ", Tcl_GetCommandName(in, (Tcl_Command)csc->cmdPtr)); + else + fprintf(stderr, "NULL, "); + + fprintf(stderr, "frameType: %d, ", csc->frameType); + fprintf(stderr, "next: %d ", csc->callsNext); + fprintf(stderr, "cframe %p ", csc->currentFramePtr); + + if (csc->currentFramePtr) + fprintf(stderr,"l=%d ",Tcl_CallFrame_level(csc->currentFramePtr)); + + if (csc->destroyedCmd) + fprintf(stderr, "--destroyed cmd set (%p) ", csc->destroyedCmd); + + fprintf(stderr, "\n"); + } + /* + if (entries > 0) { + XOTclCallStackContent *c; + c = XOTclCallStackFindLastInvocation(in); + fprintf(stderr," --- findLastInvocation %p ",c); + if (c) { + if (c <= cs->top && c->currentFramePtr) + fprintf(stderr," l=%d", Tcl_CallFrame_level(c->currentFramePtr)); + } + c = XOTclCallStackFindActiveFrame(in, 1); + fprintf(stderr," findActiveFrame %p ",c); + if (c) { + if (c <= cs->top && c->currentFramePtr) + fprintf(stderr," l=%d", Tcl_CallFrame_level(c->currentFramePtr)); + } + fprintf(stderr," --- \n"); + } + */ +} + +/* helper function to print the vars dynamically created on a + callframe +static void printLocalTable (CallFrame* c) { + Tcl_HashEntry *entryPtr; + Tcl_HashTable *localVarTablePtr = c->varTablePtr; + Tcl_HashSearch search; + + fprintf(stderr, "LocalVars:"); + + if (localVarTablePtr != NULL) { + for (entryPtr = Tcl_FirstHashEntry(localVarTablePtr, &search); + entryPtr != NULL; + entryPtr = Tcl_NextHashEntry(&search)) { + char *varName = Tcl_GetHashKey(localVarTablePtr, entryPtr); + fprintf(stderr, " %s,", varName); + } + } + fprintf(stderr,"\n"); +} +*/ + +int +XOTcl_TraceObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + char *option; + if (objc != 2) + return XOTclObjErrArgCnt(in, NULL, "::xotcl::trace"); + + option = ObjStr(objv[1]); + if (strcmp(option,"stack") == 0) { + XOTclStackTrace(in); + return TCL_OK; + } + if (strcmp(option,"callstack") == 0) { + XOTclCallStackTrace(in); + return TCL_OK; + } + return XOTclVarErrMsg(in, "xotcltrace: unknown option", (char*) NULL); +} + +#ifdef XOTCL_MEM_COUNT +void +XOTclMemCountAlloc(char *id, void *p) { + int new; + XOTclMemCounter *entry; + Tcl_HashTable *table = &xotclMemCount; + Tcl_HashEntry *hPtr; + hPtr = Tcl_CreateHashEntry(table, id, &new); +#ifdef XOTCL_MEM_TRACE + fprintf(stderr, "+++ alloc %s %p\n",id,p); +#endif + /*fprintf(stderr,"+++alloc '%s'\n",id);*/ + if (new) { + entry = (XOTclMemCounter*)ckalloc(sizeof(XOTclMemCounter)); + entry->count = 1; + entry->peak = 1; + Tcl_SetHashValue(hPtr, entry); + } else { + entry = (XOTclMemCounter*) Tcl_GetHashValue(hPtr); + entry->count++; + if (entry->count > entry->peak) + entry->peak = entry->count; + } +} + +void +XOTclMemCountFree(char *id, void *p) { + XOTclMemCounter *entry; + Tcl_HashTable *table = &xotclMemCount; + Tcl_HashEntry *hPtr; +#ifdef XOTCL_MEM_TRACE + fprintf(stderr, "+++ free %s %p\n",id,p); +#endif + + hPtr = Tcl_FindHashEntry(table, id); + if (!hPtr) { + fprintf(stderr, "******** MEM COUNT ALERT: Trying to free <%s>, but was not allocated\n", id); + return; + } + entry = (XOTclMemCounter*) Tcl_GetHashValue(hPtr); + entry->count--; +} + +void +XOTclMemCountDump() { + Tcl_HashTable *table = &xotclMemCount; + Tcl_HashSearch search; + Tcl_HashEntry *hPtr; + int count = 0; + + xotclMemCountInterpCounter--; + if (xotclMemCountInterpCounter != 0) { + return; + } + + fprintf(stderr, "******** XOTcl MEM Count *********\n* count peak\n"); + + for (hPtr = Tcl_FirstHashEntry(table, &search); hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search)) { + char *id = Tcl_GetHashKey(table, hPtr); + XOTclMemCounter *entry = (XOTclMemCounter*) Tcl_GetHashValue(hPtr); + count += entry->count; + fprintf(stderr, "* %4d %6d %s\n", entry->count, entry->peak, id); + ckfree ((char*) entry); + } + + Tcl_DeleteHashTable(table); + + fprintf(stderr, "******** Count Overall = %d\n", count); +} + +#endif Index: xotcl/generic/xotclUtil.c =================================================================== diff -u --- xotcl/generic/xotclUtil.c (revision 0) +++ xotcl/generic/xotclUtil.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,125 @@ +/* -*- Mode: c++ -*- + * $Id: xotclUtil.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * + * Extended Object Tcl (XOTcl) + * + * Copyright (C) 1999-2004 Gustaf Neumann, Uwe Zdun + * + * + * xotclUtil.c -- + * + * Utility functions + * + */ + +#include "xotclInt.h" + +char * +XOTcl_ltoa(char *buf, long i, int *len) /* fast version of sprintf(buf,"%ld",l); */ { + int nr_written, negative; + char tmp[LONG_AS_STRING], *pointer = &tmp[1], *string, *p; + *tmp = 0; + + if (i<0) { + i = -i; + negative = nr_written = 1; + } else + nr_written = negative = 0; + + do { + nr_written++; + *pointer++ = i%10 + '0'; + i/=10; + } while (i); + + p = string = buf; + if (negative) + *p++ = '-'; + + while ((*p++ = *--pointer)); /* copy number (reversed) from tmp to buf */ + if (len) *len = nr_written; + return string; +} + + +static char *alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +static int blockIncrement = 8; +/* +static char *alphabet = "ab"; +static int blockIncrement = 2; +*/ +static unsigned char chartable[255] = {0}; + + +char * +XOTclStringIncr(XOTclStringIncrStruct *iss) { + char newch, *currentChar; + + currentChar = iss->buffer + iss->bufSize - 2; + newch = *(alphabet + chartable[(unsigned)*currentChar]); + + while (1) { + if (newch) { /* no overflow */ + *currentChar = newch; + break; + } else { /* overflow */ + *currentChar = *alphabet; /* use first char from alphabet */ + currentChar--; + assert(currentChar >= iss->buffer); + + newch = *(alphabet + chartable[(unsigned)*currentChar]); + if (currentChar < iss->start) { + iss->length++; + if (currentChar == iss->buffer) { + int newBufSize = iss->bufSize + blockIncrement; + char *newBuffer = ckalloc(newBufSize); + currentChar = newBuffer+blockIncrement; + /*memset(newBuffer, 0, blockIncrement);*/ + memcpy(currentChar, iss->buffer, iss->bufSize); + *currentChar = newch; + iss->start = currentChar; + ckfree(iss->buffer); + iss->buffer = newBuffer; + iss->bufSize = newBufSize; + } else { + iss->start = currentChar; + } + } + } + } + assert(iss->buffer[iss->bufSize-1] == 0); + assert(iss->buffer[iss->bufSize-2] != 0); + assert(iss->length < iss->bufSize); + assert(iss->start + iss->length + 1 == iss->buffer + iss->bufSize); + + return iss->start; +} + + +void +XOTclStringIncrInit(XOTclStringIncrStruct *iss) { + char *p; + int i = 0; + const int bufSize = blockIncrement>2 ? blockIncrement : 2; + + for (p=alphabet; *p; p++) { + chartable[(int)*p] = ++i; + } + + iss->buffer = ckalloc(bufSize); + memset(iss->buffer, 0, bufSize); + iss->start = iss->buffer + bufSize-2; + iss->bufSize = bufSize; + iss->length = 1; + /* + for (i=1; i<50; i++) { + XOTclStringIncr(iss); + fprintf(stderr, "string '%s' (%d)\n", iss->start, iss->length); + } + */ +} + +void +XOTclStringIncrFree(XOTclStringIncrStruct *iss) { + ckfree(iss->buffer); +} Index: xotcl/library/COPYRIGHT =================================================================== diff -u --- xotcl/library/COPYRIGHT (revision 0) +++ xotcl/library/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/library/actiweb/Agent.xotcl =================================================================== diff -u --- xotcl/library/actiweb/Agent.xotcl (revision 0) +++ xotcl/library/actiweb/Agent.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,224 @@ +# $Id: Agent.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::agent 0.8 + +package require xotcl::trace +package require xotcl::comm::httpAccess +package require xotcl::actiweb::webObject +package require xotcl::store::persistence + +# +# current response codes for agent requests: +# +# OK -- content arrived (can be retrieved with sinks content method) +# ERROR -- error on the place invocation +# FAILED -- call itself failed, e.g. cancel +# +Class AgentMemSink \ + -superclass MemorySink \ + -parameter {{agent ""} responseCode} + +AgentMemSink instproc startCb {r} { + my set d "" + next +} +AgentMemSink instproc notifyCb {r} {next} +AgentMemSink instproc incCb {r t c} {next} +AgentMemSink instproc endCb {r} { + if {[Agent exists responseCodes([$r set responseCode])]} { + my set responseCode OK + } else { + my set responseCode ERROR + } + next +} +AgentMemSink instproc cancelCb {r} { + my set responseCode FAILED + next +} +AgentMemSink instproc endReq {r} { + my instvar agent + if {[Object isobject $agent]} { + if {[$agent exists sinks($r)]} { + $agent unset sinks($r) + } + } +} + +# sink class that calls the agent's endcmd in async calls +# the sink is destroyed automatically after endCmd is called +Class AgentAsyncSink -superclass AgentMemSink +AgentAsyncSink instproc endCb {r} { + next + my instvar endCmd responseCode + set result [my content] + if {[info exists endCmd]} { + eval [concat $endCmd $responseCode \"$result\"] + } + my endReq $r +} +AgentAsyncSink instproc cancelCb {r} { + my instvar endCmd responseCode + if {[info exists endCmd]} { + eval [concat $endCmd $responseCode ""] + } + next + my endReq $r +} + +# sink type for sync request +# has to be destroyed with endReq when content is +# read (see createSyncRequest) +Class AgentSyncSink -superclass AgentMemSink + + +Class Agent -superclass WebObject +Agent array set responseCodes { + 200 {OK} +} + +Agent instproc init args { + #my showCall + #my exportProcs invoke + my array set endCmds {} + my array set sinks {} + next +} + +# +# method to create async requests +# +# endCmd specifies the command (or object method or proc ...) that +# is to be called, when the request has ended, empty for sync requests +# +# args are to be given in the form -name value, like: +# -contentType text/xml +# -method PUT +# -data XXX +# +# returns the request object name +# +Agent instproc createRequest {endCmd url args} { + #my showCall + puts stderr "[self] [self proc]" + my instvar place + set s [AgentAsyncSink create [$place autoname agentmemsink] \ + -agent [self]] + set cmd [list Access createRequest -caching 0 -url $url \ + -informObject $s] + foreach {n v} $args {lappend cmd $n $v} + $s set endCmd $endCmd + set t ::[string trimleft [::eval $cmd $args] :] + my set sinks($t) $s + return $t +} +# +# method to create sync reqs ... url and args identical to +# async req +# +# returns the result of sync request, if "OK" +# otherwise: Raises an error +# +Agent instproc createSyncRequest {url args} { + #my showCall + puts stderr "[self] [self proc]" + my instvar place + set s [AgentSyncSink [$place autoname agentmemsink] -agent [self]] + set cmd [list Access createRequest \ + -httpVersion 1.0 \ + -caching 0 -url $url -informObject $s -blocking 1] + foreach {n v} $args {lappend cmd $n $v} + set t ::[string trimleft [::eval $cmd] :] + #puts stderr "After SyncRequest t=$t [$s responseCode]" + if {[$s responseCode] == "OK"} { + set content [$s content] + # kill the sink + $s endReq $t + return $content + } + $s endReq $t + error "[self] -- Sync request failed: url=$url, responseCode=[$s responseCode]" +} +# +# invoke a remote method directly along the places' dispatcher +# +Agent instproc invoke {endCmd host receiver args} { + puts stderr [self proc]----host=$host + #my showCall + set url http://$host/${receiver}+[url encode $args] + my createRequest $endCmd $url +} +Agent instproc syncInvoke {host receiver args} { + puts stderr [self proc]----host=$host + #[self] showCall + set url http://$host/${receiver}+[url encode $args] + my createSyncRequest $url +} + +# +# invoke a cloning migration +# +Agent instproc cloneImpl {async host startcmd {endCmd ""}} { + #my showCall + set ai [my agentInfo] + set place [Place getInstance] + + # get the full name of the agent ns from the places's agent mgr + #set ns [${place}::agentMgr::rdfNS searchPrefix agent] + + $ai set agentData(script) [${place}::scriptCreator makeScript [self]] + $ai append agentData(script) [my makeVarScript] + $ai set agentData(startcmd) $startcmd + + set data [$ai getXMLScript [$ai name]] + ###puts $data + + #set data [[Place getInstance]::rdfCreator createFromTriples [$ai getTriples]] + if {$async} { + return [my createRequest $endCmd http://$host/[my selfName] \ + -contentType text/xml \ + -method PUT \ + -data $data] + } else { + return [my createSyncRequest http://$host/[my selfName] \ + -contentType text/xml \ + -method PUT \ + -data $data] + } +} +Agent instproc clone {host startCmd endCmd} { + my cloneImpl 1 $host $startCmd $endCmd +} +Agent instproc syncClone {host startCmd} { + my cloneImpl 0 $host $startCmd +} + +# +# invoke a migration that destroys the object in the current place +# +Agent instproc migrateImpl {async host startcmd {endCmd ""}} { + ### GN ??? + puts stderr "--- async=$async" + if {$async} { + set r [my clone $host $startcmd $endCmd] + } else { + set r [my syncClone $host $startcmd] + } + puts stderr "--- [self] destroy +++ " + my destroy ;### FIXME: this does not work in the asynchronous case + return $r +} +Agent instproc migrate {host startCmd endCmd} { + #my migrateImpl 1 $host $startCmd $endCmd + my migrateImpl 0 $host $startCmd $endCmd +} +Agent instproc syncMigrate {host startCmd} { + my migrateImpl 0 $host $startCmd +} +# +# query a place with its hostname for its name +# +Agent instproc getPlaceFromHostName {endCb host} { + set r [my autoname __result] + my createRequest "[self]::$r set" http://$host/ + return [set [self]::$r] +} Index: xotcl/library/actiweb/AgentManagement.xotcl =================================================================== diff -u --- xotcl/library/actiweb/AgentManagement.xotcl (revision 0) +++ xotcl/library/actiweb/AgentManagement.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,207 @@ +# $Id: AgentManagement.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::agentManagement 0.8 + +package require xotcl::rdf::parser +package require xotcl::rdf::triple +package require xotcl::actiweb::agent + +Class AgentInfo -parameter { + {name ""} + {changed 1} +} + +AgentInfo instproc init args { + next + # + # array providing info on a (migrated) agent + # + my array set agentData {} + RDFTripleDB [self]::db + my trace variable agentData w [list [self] changeOccured] + my trace variable name w [list [self] changeOccured] +} + +AgentInfo instproc getXMLScript {name} { + #my showCall + set s { + + } + set s [subst -nobackslashes $s] + foreach n [my array name agentData] { + append s " + [my set agentData($n)] " + } + append s " + +" +} + +AgentInfo instproc changeOccured args {my set changed 1} + +AgentInfo instproc getTriples {} { + #my showCall + if {[my set changed]} { + # build up the triple-db + [self]::db reset + set place [Place getInstance] + set subject "http://[$place set host]:[$place set port]/[my name]" + foreach n [my array names agentData] { + [self]::db add $n $subject [my set agentData($n)] + } + } + return [[self]::db getTriples] +} + +AgentInfo instproc print {} { + puts "AGENT-INFO:" + puts "Name == [my set name]" + foreach a [my array names agentData] { + puts "$a == [my set agentData($a)]" + } +} + +Class AgentVisitor -superclass NodeTreeVisitor -parameter { + {openProperty ""} + {agentInfo ""} + {rdfNS {[my info parent]::rdfNS}} +} + +AgentVisitor instproc fullName {obj n} { + set ns [$obj resolveNS] + return [$ns getFullName $n] +} + +AgentVisitor instproc visit {objName} { + #puts stderr "AgentVisitor visit -- $objName" + set ai [my set agentInfo] + set cl [$objName info class] + #puts stderr "AgentVisitor visit -- $objName cl=$cl <[$ai name]>" + if {[$ai name] == ""} { + #### not fixed yet + puts stderr "my fixme (AgentManagement)" + if {$cl == "::About" && + [string first "::Description" [[$objName info parent] info class]] == 0} { + $ai name [$objName set content] + } + } else { + #puts stderr C=<[$objName content]> + #$cl showVars + switch -exact $cl { + ::RDFProperty { + set c [$objName content] + #$objName showVars + if {[$objName exists pcdata]} { + $ai set agentData($c) [lindex [$objName getPCdataList] 0] + } else { + #puts stderr "empty PCDATA" + } + } + } + } +} + +AgentVisitor instproc interpretNodeTree node { + if {[my set agentInfo] == "" } { + error "Agent Visitor: no agent info provided." + } + $node accept [self] +} + +Class AgentMgr -superclass Agent \ + -parameter { + {acceptedData [list script startcmd senderPlace senderPort senderHost]} + } + +AgentMgr instproc init args { + next + my array set agents {} + # + # this ns class holds the prefix/Rdf-ns pairs used by this + # agent mgr (with default values) + # + XMLNamespace [self]::rdfNS + [self]::rdfNS add agent {http://www.xotcl.org/schema/agent#} + [self]::rdfNS add service {http://www.xotcl.org/schema/service#} + [self]::rdfNS add xotcl {http://www.xotcl.org/schema/xotcl#} + RDFParser [self]::rdfParser + AgentVisitor [self]::agentVisitor + + #package require xotcl::xml::printVisitor + #PrintVisitor [self]::pv +} + +AgentMgr instproc register {name} { + set ai [AgentInfo [self]::[my autoname agentInfo]] + my set agents($name) $ai + $ai name $name + return $ai +} + +AgentMgr instproc deregister {name} { + if {[my info agents $name]} { + # destroy the agents info objects + #my showMsg "calling destroy on [my set agents($name)]" + [my set agents($name)] destroy + # unset the var + my unset agents($name) + } +} + +AgentMgr instproc info args { + if {[lindex $args 0] == "agents"} { + if {[llength $args] > 1} { + return [my exists agents([lindex $args 1])] + } else { + return [my array names agents] + } + } + next +} + +# +# parses the data of a migration request into a new agent +# info object +# +# name must be stringleft : !! +AgentMgr instproc parseData {name data} { + set ai [my register $name] + next + + [self]::rdfParser reset + [self]::rdfParser parse $data + + #puts stderr =========================================================== + #[self]::pv interpretAll [self]::rdfParser + #puts stderr =========================================================== + + [self]::agentVisitor agentInfo $ai + #foreach tn [[self]::rdfParser info children topNode*] { + # [self]::agentVisitor interpretNodeTree $tn + #} + + [self]::agentVisitor interpretAll [self]::rdfParser + + #puts "************** Received Agent:" + #$ai print + + return $ai +} + +AgentMgr instproc immigrate {AI} { + #set ns [[self]::rdfNS searchPrefix agent] + #::eval [$AI set agentData(${ns}script)] + + #puts stderr "immigrate call showVars" + #$AI showVars + #puts stderr "immigrate showVars done" + + ::eval [$AI set agentData(agent:script)] + #puts stderr "immigrate persistentVars = '[[$AI name] persistentVars]'" + #foreach v [[$AI name] info vars] { $n persistent $v } + + if {[$AI exists agentData(agent:startcmd)]} { + ::after 10 [list [$AI name] [$AI set agentData(agent:startcmd)]] + } + return "" +} Index: xotcl/library/actiweb/COPYRIGHT =================================================================== diff -u --- xotcl/library/actiweb/COPYRIGHT (revision 0) +++ xotcl/library/actiweb/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/library/actiweb/HtmlPlace.xotcl =================================================================== diff -u --- xotcl/library/actiweb/HtmlPlace.xotcl (revision 0) +++ xotcl/library/actiweb/HtmlPlace.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,36 @@ +# $Id: HtmlPlace.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::htmlPlace 0.8 + +package require xotcl::trace +package require xotcl::actiweb::httpPlace +package require xotcl::store::persistence +package require xotcl::actiweb::agent +package require xotcl::actiweb::pageTemplate + +Class HtmlPlace -superclass Place -parameter {allowExit} + +HtmlPlace instproc init args { + next + # + # just define a minimal object that can react + # with HTML decoration, if the called object + # doesn't exist + PageTemplateHtml create [self]::start.html + + my startingObj [self]::start.html + if {[my exists allowExit]} { + set exitObj [WebObject create [self]::[my set allowExit]] + [Place getInstance] exportObjs $exitObj + $exitObj proc default {} {after 500 ::exit; return "Server terminates"} + } +} +HtmlPlace instproc default {} { + set place [string trimleft [self] :] + set msg "Place $place +

Place $place

Try one of the following links:
    " + foreach o [my exportedObjs] { + set o [string trimleft $o :] + append msg "
  • $o
  • " + } + append msg "
\n" +} Index: xotcl/library/actiweb/HttpPlace.xotcl =================================================================== diff -u --- xotcl/library/actiweb/HttpPlace.xotcl (revision 0) +++ xotcl/library/actiweb/HttpPlace.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,247 @@ +# $Id: HttpPlace.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::httpPlace 0.8 + +package require xotcl::trace +package require xotcl::actiweb::invoker +package require xotcl::actiweb::webObject +package require xotcl::comm::httpd +package require xotcl::scriptCreation::scriptCreator +package require xotcl::store::persistence +package require xotcl::pattern::singleton +package require xotcl::registry::registry +package require xotcl::actiweb::agentManagement +package require xotcl::rdf::tripleRecreator + +Singleton Place -superclass Invoker -parameter { + {exportedObjs ""} + {startingObj ""} + {startCommand ""} + {root $::env(HOME)/public_html} + {port 8086} + {redirect [list]} + {logdir $::xotcl::logdir} + {host localhost} + {allowImmigrationHosts ""} + persistenceFile persistenceDir bccFile bccDir dbPackage + {startHTTPServer 1} +} + +# Giving a bccFile (and possibly bccDir) as optional parameter means +# that an identical copy database will be created in that +# location (e.g. for creating a backup on a second hard drive. + +Place instproc exportObjs args { + foreach obj $args { + my lappend exportedObjs [string trimleft $obj :] + puts stderr "*** exporting $obj, self=[self], objs=[my set exportedObjs]" + } +} +Place instproc isExportedObj obj { + expr {[lsearch [my exportedObjs] [string trimleft $obj :]] != -1} +} +Place instproc default {} { + [self] +} +Place instproc init args { + if {[my set startHTTPServer]} { + Httpd [self]::httpd \ + -port [my port] \ + -root [my root] \ + -redirect [my redirect] \ + -logdir [my logdir] \ + -httpdWrk Place::HttpdWrk + } + # + # PersistenceMgr object for web entities + # + ##### so ist das nicht toll ... init args sollten anders konfigurierbar sein + PersistenceMgr [self]::agentPersistenceMgr -dbPackage multi + + if {[my exists dbPackage]} { + set dbp [my set dbPackage] + } else { + set dbp "" + } + + + if {![my exists persistenceDir]} { + my persistenceDir [string trimleft [self] :] + } + if {![my exists persistenceFile]} { + my persistenceFile persistentObjs-[my port] + } + + [self]::agentPersistenceMgr store add $dbp \ + -dirName [my persistenceDir] \ + -fileName [my persistenceFile] + + if {[my exists bccDir] || [my exists bccFile]} { + if {![my exists bccDir]} { + my bccDir [my set persistenceDir] + } + if {![my exists bccFile]} { + my bccFile [my persistenceFile] + } + [self]::agentPersistenceMgr store add $dbp \ + -dirName [my bccDir] \ + -fileName [my bccFile] + } + + AgentMgr create [self]::agentMgr + RDFCreator create [self]::rdfCreator + + # + # minimal obj for default behavior of the place -> calls go + # to web entities default (customize through a redirecting proc + # as in HtmlPlace or changing startingObj) + # + WebObject create [self]::start + my startingObj [self]::start + Registry [self]::registry + ErrorMgr [self]::error + + ScriptCreator [self]::scriptCreator -dependencyChecking 0 + + my exportObjs [self]::start [self]::agentMgr [self]::registry + next +} + +Place instproc startEventLoop args { + if {[llength $args] > 0} { + set startCommand [lindex $args 0] + ::eval $startCommand + } + + vwait forever ;# if we are in xotclsh call the event loop... +} + +### +### Mixin-Classes for Http/Wrk that restricts the usable HTTP methods +### +Class RestrictHTTPMethods -parameter { + {allowedHTTPMethods "GET PUT HEAD POST CGI"} +} +RestrictHTTPMethods instproc init args { + next + my lappend workerMixins RestrictHTTPMethods::Wrk +} +Class RestrictHTTPMethods::Wrk +RestrictHTTPMethods::Wrk instproc respond {} { + my instvar method + [my info parent] instvar allowedHTTPMethods + if {[lsearch $allowedHTTPMethods $method] != -1} { + return [next] + } else { + my log Error "Restricted Method $method called" + my replyCode 405 + my replyErrorMsg + } +} + +Class Place::HttpdWrk -superclass Httpd::Wrk + +Place::HttpdWrk instproc init args { + my set place [Place getInstance] + next + #puts "New Http-Worker: [self class]->[self] on [my set place]" +} + +Place::HttpdWrk instproc parseParams {o m a call} { + upvar [self callinglevel] $o obj $m method $a args + ### + set decodedCall [url decodeItem $call] + #my showMsg decodedCall=$decodedCall + if {[regexp {^([^ ]*) ?([^ ]*) ?(.*)$} $decodedCall _ \ + obj method args]} { + #foreach a [my set formData] {lappend args [$a set content]} + #puts stderr "Parsed -- Obj: $obj, Method: $method, Args: $args" + return 1 + } else { + puts stderr "could not parse <$decodedCall>" + return 0 + } +} +Place::HttpdWrk instproc respond-HEAD {} { + my respond-GET; ### sendMsg inhibits content for method HEAD +} +Place::HttpdWrk instproc respond-GET {} { + my instvar fileName resourceName place + if {$resourceName == ""} { + my sendMsg [$place default] text/html ;# kind of index.html + } elseif {[my parseParams obj method arguments $resourceName]} { + if {![my isobject $obj] && [file readable $fileName]} { + next ;# let Httpd handle this + } else { + set response [$place invokeCall obj status $method $arguments] + #puts stderr "RESPONSE: $response" + # + # let the object's sending strategy mixin choose + # the appropriate sending mode + # + # $obj showClass + if {[info exists status] && $status >= 300} { + my replyCode $status + my replyErrorMsg $response + } else { + #my lappend replyHeaderFields Cache-Control maxage=0 + my lappend replyHeaderFields Pragma no-cache + $obj send [self] $response + } + } + } else { + my set version 1.0 + my replyCode 400 + my replyErrorMsg [my callError "Could not parse: " $resourceName] + } +} +Place::HttpdWrk instproc respond-POST {} { + my instvar resourceName place + my respond-GET +} + + +Place::HttpdWrk instproc respond-PUT {} { + my instvar resourceName place data + #my showCall + + if {$resourceName != ""} { + if {[my parseParams obj m a $resourceName]} { + set obj [string trimleft $obj :] + set AMgr ${place}::agentMgr + + if {[info commands $obj] == "" && + ![$AMgr info agents $obj]} { + #puts stderr "Receiving to put --------------------------------$obj $data" + set AI [$AMgr parseData $obj $data] + #puts stderr "parray --${AI}::agentData------------------------" + #parray ${AI}::agentData + #puts stderr "parray --${AI}::agentData----------------DONE--------" + #$AI showVars + #puts stderr "----[$AI exists agentData(agent:script)]----" + if {[$AI exists agentData(agent:script)]} { + set immigrateResult [$AMgr immigrate $AI] + #puts stderr "immigrateResult=<$immigrateResult>" + my replyCode 200 + my sendMsg $immigrateResult text/plain + } else { + my set version 1.0 + my replyCode 400 + my replyErrorMsg "Migration failed" + } + } else { + my set version 1.0 + my replyCode 400 + my replyErrorMsg "Migration: object name already in use." + } + } else { + my set version 1.0 + my replyCode 400 + my replyErrorMsg "Migration call must provide object name" + } + } else { + # return the own place name -> any client can call the place via + # placename::start ! + my sendMsg $place text/plain + } +} + Index: xotcl/library/actiweb/Invoker.xotcl =================================================================== diff -u --- xotcl/library/actiweb/Invoker.xotcl (revision 0) +++ xotcl/library/actiweb/Invoker.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,152 @@ +# $Id: Invoker.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::invoker 0.8 + +Class AbstractInvoker +AbstractInvoker abstract instproc invokeCall {o method arguments} +AbstractInvoker abstract instproc eval {obj method arguments} +# +# error types are: tclError, invocationError +# +AbstractInvoker abstract instproc callError {type msg obj arguments} + +Class Invoker -superclass AbstractInvoker -parameter {{place [self]}} + +Invoker instproc handleException {response} { + if {[my isExceptionObject $response]} { + set exceptionObj $response + switch [$exceptionObj info class] { + ::RedirectException { + set obj [$exceptionObj obj] + set method [$exceptionObj method] + set arguments [$exceptionObj arguments] + set response [my eval $obj $method $arguments] + } + ::ErrorException { + set response [$exceptionObj set errorText] + } + } + $exceptionObj destroy + } + return $response +} + +Invoker instproc invokeCall {o s method arguments} { + upvar [self callinglevel] $o obj $s status + my instvar place + set response "" + if {[$place isExportedObj $obj]} { + # if method is not given -> call default on the object + if {$method == ""} { + set method default + } + if {[$obj isExportedProc $method]} { + #puts stderr "ExportedProcs of $obj: [$obj exportedProcs]" + #puts stderr "Call: $obj -- $method -- $arguments" + set response [my eval $obj $method $arguments] + } else { + #puts stderr "ExportedProcs of $obj: [$obj exportedProcs]" + set response [my callError invocationError [$place startingObj] \ + "Method not found or not exported" \ + "$obj $method $arguments"] + set status 405 + } + } else { + set called $obj + set obj [$place startingObj] + set response [my callError invocationError $obj \ + "Object '$called' unknown" ""] + set status 404 + } + + return [my handleException $response] +} + +# +# tests whether "name" is an exception object or not +# +Invoker instproc isExceptionObject name { + if {[Object isobject $name] && [$name istype Exception]} { + return 1 + } + return 0 +} + +# +# central eval -- all remote call +# are invoked through this method +# +Invoker instproc eval {obj method arguments} { + puts stderr "[clock format [clock seconds] \ + -format %Y/%m/%d@%H:%M:%S] \ + Eval Call: $obj $method $arguments" + if {[catch { + set r [::eval $obj $method $arguments] + } ei]} { + set r [my callError tclError $obj $ei "$obj $method $::errorInfo"] + } + return $r +} + +Invoker instproc callError {type obj msg arguments} { + [my set place]::error $type $obj $msg $arguments +} + +Class ErrorMgr +ErrorMgr instproc isHtml o { + if {[my isobject $o]} { + if {[$o exists contentType]} { + if {[$o set contentType] == "text/html"} { + return 1 + } + } + } + return 0 +} + +ErrorMgr instproc invocationError {obj msg arguments} { + my showCall + set ee [ErrorException [self]::[my autoname ee]] + $ee instvar errorText + if {[my isHtml $obj]} { + set errorText "

invocation error: $msg" + if {[llength $arguments] > 0} { + append errorText ":\n

object: '[lindex $arguments 0]' \n" + } else { + append errorText \n + } + if {[llength $arguments] > 1} { + append errorText "

call: '[lrange $arguments 1 end]' \n" + } + } else { + set errorText "invocation error: $msg $arguments" + } + return $ee +} + +ErrorMgr instproc tclError {obj msg arguments} { + set ee [ErrorException [self]::[my autoname ee]] + if {[my isHtml $obj]} { + $ee errorText "

tcl error: '$msg' \n

$arguments
" + } else { + $ee errorText "tcl error: '$msg'\n$::errorInfo" + } + return $ee +} + +# +# exceptions in invocation behavior +# +Class Exception +# +# Execpetion that tells the invoker to redirect the call to +# parameters +# +Class RedirectException -superclass Exception -parameter { + {obj ""} + {method ""} + {arguments ""} +} + +Class ErrorException -superclass Exception -parameter { + {errorText ""} +} Index: xotcl/library/actiweb/PlaceAccessControl.xotcl =================================================================== diff -u --- xotcl/library/actiweb/PlaceAccessControl.xotcl (revision 0) +++ xotcl/library/actiweb/PlaceAccessControl.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,80 @@ +# $Id: PlaceAccessControl.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::placeAccessControl 0.8 + +package require xotcl::comm::httpd +package require xotcl::actiweb::httpPlace + +# +# Simple Object Pwd Protection with BasicAccessControl +# +#Usage example: +#ConferenceOrgPlace confPlace -port $placeport -root [pwd] \ +# -mixin PlaceAccessControl +# +#confPlace protect conference.html [confData set password] +# +#confPlace setPasswd conference.html xxx + +Class ObjectAccessControl -superclass BasicAccessControl + +ObjectAccessControl instproc protectedResource {fn method varAuthMethod varRealm} { + # check whether access to $fn via $method is protected + upvar [self callinglevel] $varAuthMethod authMethod $varRealm realm + my instvar root + # we check only the current directory, not the parent directories + set call [url decodeItem $fn] + regsub "^$root" $call "" call + set call [string trimleft $call /] + set call [string trimleft $call :] + regexp {^([^ ]*)} $call _ call + set call "$root/$call" + + foreach i [list $call $call:$method] { + #puts stderr "check <$i>" + if {[my exists protected($i)]} { + set realm [my set protected($i)] + set authMethod Basic + return 1 + } + } + return 0 +} + +Class PlaceAccessControl +PlaceAccessControl instproc init args { + next + [self]::httpd mixinappend ObjectAccessControl + [self]::httpd initWorkerMixins +} + +PlaceAccessControl instproc protect {objName id pwd} { + set objName [string trimleft $objName :] + [self]::httpd protectDir $objName $objName {} + if {$pwd != ""} { + my setPassword $objName $id $pwd + } +} + +PlaceAccessControl instproc credentialsNotOk {credentials authMethod realm} { + #my instvar passwd + #parray passwd + next +} + +PlaceAccessControl instproc setPassword {realm id pwd} { + set httpd [self]::httpd + if {[$httpd exists passwd($realm:$id)]} { + $httpd unset passwd($realm:$id) + $httpd set passwd($realm:$id) $pwd + } else { + $httpd addRealmEntry $realm "$id $pwd" + } + #$httpd set passwd($realm:admin) nimda +} +PlaceAccessControl instproc removeID {realm id} { + set httpd [self]::httpd + if {[$httpd exists passwd($realm:$id)]} { + $httpd unset passwd($realm:$id) + } +} + Index: xotcl/library/actiweb/SecureHtmlPlace.xotcl =================================================================== diff -u --- xotcl/library/actiweb/SecureHtmlPlace.xotcl (revision 0) +++ xotcl/library/actiweb/SecureHtmlPlace.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,7 @@ +# $Id: SecureHtmlPlace.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::secureHtmlPlace 0.8 + +package require xotcl::actiweb::secureHttpPlace +package require xotcl::actiweb::htmlPlace + +Class SecureHtmlPlace -superclass {SecurePlace HtmlPlace} Index: xotcl/library/actiweb/SecureHttpPlace.xotcl =================================================================== diff -u --- xotcl/library/actiweb/SecureHttpPlace.xotcl (revision 0) +++ xotcl/library/actiweb/SecureHttpPlace.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,35 @@ +# $Id: SecureHttpPlace.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::secureHttpPlace 0.8 + +package require xotcl::actiweb::httpPlace + +Class SecurePlace -superclass Place -parameter { + {port 443} + {requestCert 0} + {requireValidCert 0} + {certfile server.pem} + {keyfile server.key} + {cafile cacert.pem} + {infoCb {}} +} + +SecurePlace instproc startHttpd {} { + my instvar port root requestCert requireValidCert \ + certfile cafile infoCb keyfile + Httpsd h1 -port $port \ + -root $root \ + -httpdWrk SecurePlace::HttpsdWrk \ + -infoCb $infoCb \ + -requestCert $requestCert \ + -requireValidCert $requireValidCert \ + -certfile $certfile -cafile $cafile \ + -keyfile $keyfile +} + +SecurePlace instproc init args { + my set startHTTPServer 0 + next + [self] startHttpd +} + +Class SecurePlace::HttpsdWrk -superclass {Httpsd::Wrk Place::HttpdWrk} Index: xotcl/library/actiweb/SendStrategy.xotcl =================================================================== diff -u --- xotcl/library/actiweb/SendStrategy.xotcl (revision 0) +++ xotcl/library/actiweb/SendStrategy.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,38 @@ +# $Id: SendStrategy.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::sendStrategy 0.8 +# +# some simple sending strategy classes -- to be used as mixins +# for web objects +# + +Class SendStrategy +SendStrategy abstract instproc send {httpWrk string} + +# +# send the response given from the place as plain text +# +Class Send=PlainString -superclass SendStrategy +Send=PlainString instproc send {httpWrk string} { + $httpWrk sendMsg $string text/plain +} + +# +# send the response given from the place with content +# type of the obj, if it exists +# +Class Send=TypedString -superclass SendStrategy +Send=TypedString instproc send {httpWrk string} { + $httpWrk sendMsg $string [my set contentType] +} + +# +# send file specified in obj's instvar filename +# +Class Send=File -superclass SendStrategy +Send=File instproc send {httpWrk {response ""}} { + if {[my exists contentType]} { + $httpWrk sendFile [my set filename] [my set contentType] + } else { + $httpWrk sendFile [my set filename] "" + } +} Index: xotcl/library/actiweb/UserMgt.xotcl =================================================================== diff -u --- xotcl/library/actiweb/UserMgt.xotcl (revision 0) +++ xotcl/library/actiweb/UserMgt.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,89 @@ +# $Id: UserMgt.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::userMgt 0.8 + +Class UserMgt +Class UserMgt::User -parameter {name password} + +UserMgt instproc addUser {name password} { + [self class]::User [self]::$name -name $name -password $password +} + +UserMgt set exportedInstprocs [list \ + addUser \ + listUsers \ + deleteUser \ + userMgtOptions\ +] + +UserMgt instproc init args { + next + my exportedProcs [concat [my exportedProcs] [[self class] set exportedInstprocs]] +} + +UserMgt instproc listUsers {} { + #showCall + set users "" + foreach u [my info children] { + lappend users [namespace tail $u] + } + return $users +} + +UserMgt instproc deleteUser {name} { + if {[[self class]::User info instances [self]::$name] != ""} { + [self]::$name destroy + } +} +UserMgt instproc userMgtOptions {} { + return [[self class] set exportedInstprocs] +} + +Class UserMgtHtml -superclass HtmlRep + +UserMgtHtml instproc addUser args { + set place [HtmlPlace getInstance] + if {$args == ""} { + set action [url encodeItem "[my htmlCall] [my repObj] [self proc]"] + set c { +
+

Name: + +

Password: + +

+ + + } + set c [subst -nobackslashes -nocommands $c] + + return [my simplePage $place "New User" $c] + } else { + if {[llength $args] > 1} { + set name [lindex $args 0] + set password [lindex $args 1] + set user [[my repObj] [self proc] $name $password] + set c "\n$name entered $place successfully\n" + return [my simplePage "New User" "New User" $c] + } else { + # + # error !!! + } + return [my [self proc]] + } +} + +UserMgtHtml instproc listUsers {} { + set c "" + foreach u [[my repObj] [self proc]] { + append c "

$u \n" + } + return [my simplePage "User List" "User List" $c] +} + +UserMgtHtml instproc userMgtOptions {} { + set c "" + foreach u [[my repObj] [self proc]] { + append c "

$u \n" + } + return [my simplePage "User Management Options" "User Management Options" $c] +} \ No newline at end of file Index: xotcl/library/actiweb/WebAgent.xotcl =================================================================== diff -u --- xotcl/library/actiweb/WebAgent.xotcl (revision 0) +++ xotcl/library/actiweb/WebAgent.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,51 @@ +# $Id: WebAgent.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::webAgent 0.8 + +package require xotcl::actiweb::agent +package require xotcl::actiweb::invoker +package require xotcl::mixinStrategy + +# +# Web Agent are special agents that allow us to define another +# object in the paramter webfacade as a facade for the web agent +# itself and the sub-system shielded by the web agent with an interface +# for agents +# +Class WebAgent -superclass Agent + +WebAgent instproc init args { + next +} + +# +# let the web agents facade handle the call -> interprete args +# as "method args" +# return result of the invoker +# +#WebAgent instproc invokeFacade {args} { +# set a "" +# set m "" +# set l [llength $args] +# set o [my webfacade] +# if {$l > 0} { +# set m [lindex $args 0] +# } +# if {$l > 1} { +# set a [lrange $args 1 end] +# } +# +# #puts stderr "Web Agent [self]->invoke: OBJ: $o PROC: $m ARGS: $a" +# +# # +# # tell the invoker to redirect the call to the webfacade object +# # +# set re [RedirectException [self]::[my autoname re] \ +\# -obj $o -method $m -arguments $a] +# +# return $re +#} + + +#WebAgent instproc default args { +# return [next] +#} Index: xotcl/library/actiweb/WebDocument.xotcl =================================================================== diff -u --- xotcl/library/actiweb/WebDocument.xotcl (revision 0) +++ xotcl/library/actiweb/WebDocument.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,210 @@ +# $Id: WebDocument.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::webDocument 0.8 + +package require xotcl::actiweb::webObject +package require xotcl::comm::httpAccess +package require xotcl::mixinStrategy +package require xotcl::actiweb::sendStrategy + +Class WebDocument -superclass WebObject \ + -parameter { + {content ""} + filename + } + + +WebDocument instproc init args { + my exportProcs content contentType + next + my mixinStrategy Send=TypedString +} + +WebDocument instproc attachFile filename { + my filename $filename + my set oldSendStrategy [my mixinStrategy Send=File] + my contentType [Mime guessContentType $filename] +} + +WebDocument instproc detachFile {} { + my mixinStrategy [my set oldSendStrategy] + my unset contentType + my unset filename +} + +WebDocument instproc default args { + if {[my exists content]} { + return [my content] + } + return "" +} +#WebDocument instproc contentLength {} { +# my showCall +# return [expr {[string length [my content]] + 1}] +#} + + +Class TextDocument -superclass WebDocument +TextDocument instproc init args { + next + my contentType text/plain +} + + +Class HtmlDocument -superclass TextDocument +HtmlDocument instproc init args { + next + my contentType text/html +} + +Class FileDocument -superclass WebDocument + +# +# class factory creates classes on the fly if they do not exist +# already, otherwise return exisiting class +# +# auch flyweigth +Class DocumentClassFactory +DocumentClassFactory abstract instproc getClass contentType + +Class FileDocumentClassFactory -superclass DocumentClassFactory +FileDocumentClassFactory instproc getClass contentType { + if {[FileDocument info classchildren $contentType] == ""} { + Class ::FileDocument::${contentType} -superclass FileDocument + } + return ::FileDocument::${contentType} +} + +Class DocumentFactory +DocumentFactory abstract instproc create {name args} + +Class FileDocumentFactory -superclass DocumentFactory +FileDocumentFactory instproc create {name class filename} { + $class $name + #$name contentType [$class set contentType] + $name attachFile $filename + return $name +} + +Class FileObjectifier + +FileObjectifier instproc init args { + next + FileDocumentClassFactory [self]::clFactory + FileDocumentFactory [self]::objFactory +} + +# +# filename must be given with full path -> +# create objects with filename's tail (prefix can be used to +# give object name a preceding dir) +# +FileObjectifier instproc objectifyFile {place filename {prefix ""}} { + set obj "" + if {[file isfile $filename]} { + set type [Mime guessContentType $filename] + #if {$type != "unknown/unknown"} { + set fn [string trimleft $prefix/[file tail $filename] /] + set class [[self]::clFactory getClass $type] + set obj [[self]::objFactory create $fn $class $filename] + $place exportObjs $obj + #puts stderr "...objectified: $obj of class $class" + #} + } + return $obj +} + +# +# objectify a whole directory tree +# +FileObjectifier instproc objectifyTree {place dir {prefix ""}} { + if {[file isdirectory $dir]} { + foreach f [glob -nocomplain $dir/*] { + if {[file isfile $f]} { + my objectifyFile $place $f $prefix + } elseif {[file isdirectory $f]} { + my objectifyTree $place $f $prefix/[file tail $f] + } + } + } +} + + +Class GraphicDirectoryObjectifier -superclass FileObjectifier \ + -parameter {{thumbnaildir /tmp}} +GraphicDirectoryObjectifier instproc objectifyTree {place dir {prefix ""}} { + if {[file isdirectory $dir]} { + set indexpage "" + set title "" + set date "" + foreach f [lsort [glob -nocomplain $dir/* $dir/{.date,.title}]] { + set exportedfn [string trimleft $prefix/[file tail $f] /] + if {[file isfile $f]} { + set type [Mime guessContentType $f] + if {[string match image/* $type]} { + set class [[self]::clFactory getClass $type] + $class $exportedfn -init -attachFile $f + $place exportObjs $exportedfn + #puts stderr "...objectified: FN=$exportedfn cl=$class d=$dir o=$exportedfn" + ###### + set expThumbnaildir [file dirname $exportedfn]/.thumbnail + set thumbnaildir [file dirname $f]/.thumbnail + if {![file isdirectory $thumbnaildir]} { + file mkdir $thumbnaildir + } + set thumbnail $thumbnaildir/[file tail $f] + set expThumbnail $expThumbnaildir/[file tail $f] + if {![file exists $thumbnail]} { + catch {exec djpeg -pnm $f | \ + pnmscale -xscale .2 -yscale .2 | ppmquant 256 | \ + ppmtogif > $thumbnail} + } + $class $expThumbnail -init -attachFile $thumbnail + $place exportObjs $expThumbnail + #### + append indexpage "" \ + "$exportedfn
\n" + } elseif {[string match *.title $exportedfn]} { + set title [my fileContent $f] + } elseif {[string match *.date $exportedfn]} { + set date

[my fileContent $f]

+ } + } elseif {[file isdirectory $f]} { + if {[file exists $f/.title]} { + set desc ": [my fileContent $f/.title]" + } else { + set desc "" + } + append indexpage "" \ + "$exportedfn$desc
\n" + my objectifyTree $place $f $exportedfn + } + set gindex [string trimleft $prefix/gindex.html /] + HtmlDocument $gindex -content \ + "$title

$title

\ + $date$indexpage" + #puts stderr "mixins of HtmlDocument=<[$gindex info mixins]>" + $gindex mixinStrategy Send=TypedString + #$gindex showVars + receiver exportObjs $gindex + } + } +} +GraphicDirectoryObjectifier instproc fileContent {f} { + set FILE [open $f r] + set content [read $FILE] + close $FILE + return $content +} + + + +Class HtmlProxy -superclass HtmlDocument -parameter realSubject +HtmlProxy instproc init args { + next + [Place getInstance] exportObjs [self] +} +HtmlProxy instproc unknown {m args} { + my instvar realSubject + ::eval $realSubject $m $args + return [my default] +} Index: xotcl/library/actiweb/WebObject.xotcl =================================================================== diff -u --- xotcl/library/actiweb/WebObject.xotcl (revision 0) +++ xotcl/library/actiweb/WebObject.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,119 @@ +# $Id: WebObject.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::actiweb::webObject 0.8 + +package require xotcl::actiweb::sendStrategy +package require xotcl::mixinStrategy +package require xotcl::store::persistence + +# +# base interface for all web-entitites +# +Class WebObject -parameter { + {exportedProcs {echo default}} + agentInfo + {contentType ""} + {place ""} +} + +# +# default send strategy == send the response from the place +# +WebObject instproc init args { + #my showCall + my mixinStrategy Send=PlainString + my registerPlace + my mixinStrategy Persistent=Eager + my persistenceMgr [my place]::agentPersistenceMgr + next +} + +WebObject instproc registerPlace {} { + my set place [Place getInstance] + my set agentInfo [[my place]::agentMgr register [my selfName]] +} + +WebObject instproc deregisterPlace {} { + [my place]::agentMgr deregister [my selfName] +} + +# +# seek for the HTTP worker object that has invoked +# the current call +# +WebObject instproc getWorker {} { + for {set level 1} {1} {incr level} { + if {[catch {set worker [uplevel $level self]}]} { + return "" + } elseif {[$worker istype Place::HttpdWrk]} { + return $worker + } + } +} +WebObject instproc getFormData {} { + [my getWorker] formData +} + +# +# code a call for an action on self; +# action is "proc args" +# +WebObject instproc selfAction {action} { + return [url encodeItem "[string trimleft [self] :] $action"] +} +WebObject instproc action {o action} { + return [url encodeItem "[string trimleft $o :] $action"] +} +WebObject instproc echo {} { + return [self] +} + +WebObject instproc error args { + return "Error on [self]: Invocation '$args' failed." +} + +WebObject instproc default {} { + return "No default behaviour on [self]." +} + +WebObject instproc exportProcs args { + my instvar exportedProcs + foreach a $args { + if {[lsearch $exportedProcs $a] == -1} { + lappend exportedProcs $a + } + } +} + +WebObject instproc isExportedProc p { + expr {[lsearch [my set exportedProcs] $p] != -1} +} + +WebObject instproc selfName {} { + return [string trimleft [self] :] +} + +WebObject instproc objName {obj} { + return [string trimleft $obj :] +} + +WebObject instproc buildAdress {} { + my instvar place + set a http://[$place host] + if {[set p [$place port]]} { + append a :$p + } +} + +WebObject instproc destroy args { + my deregisterPlace + next +} + +# +# simple class, to be inherited before WebObject, if +# every remote method should reach the object +# +Class ExportAll +ExportAll instproc isExportedProc p { + return 1 +} \ No newline at end of file Index: xotcl/library/actiweb/cacert.pem =================================================================== diff -u --- xotcl/library/actiweb/cacert.pem (revision 0) +++ xotcl/library/actiweb/cacert.pem (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDKjCCApOgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBwDELMAkGA1UEBhMCQVQx +DzANBgNVBAgTBlZpZW5uYTEPMA0GA1UEBxMGVmllbm5hMR0wGwYDVQQKExRNeSBU +ZXN0IE9yZ2FuaXphdGlvbjETMBEGA1UECxMKTXkgRGVtbyBDQTErMCkGA1UEAxMi +TXkgRGVtbyBDQSBhdCBNeSBUZXN0IE9yZ2FuaXphdGlvbjEuMCwGCSqGSIb3DQEJ +ARYfa2xhdXMua29sb3dyYXRuaWtAd3Utd2llbi5hYy5hdDAeFw0wMzA5MDUxMTEw +MDFaFw0xMzA5MDIxMTEwMDFaMIHAMQswCQYDVQQGEwJBVDEPMA0GA1UECBMGVmll +bm5hMQ8wDQYDVQQHEwZWaWVubmExHTAbBgNVBAoTFE15IFRlc3QgT3JnYW5pemF0 +aW9uMRMwEQYDVQQLEwpNeSBEZW1vIENBMSswKQYDVQQDEyJNeSBEZW1vIENBIGF0 +IE15IFRlc3QgT3JnYW5pemF0aW9uMS4wLAYJKoZIhvcNAQkBFh9rbGF1cy5rb2xv +d3JhdG5pa0B3dS13aWVuLmFjLmF0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB +gQDIKhCgkG/rSDc8NjDGtJBKW1+fQsoPoBSnMeWOjRQ0YiYomHLZo2XHxsfHsDHj +xXE69GkY9SuwYX/UiF7C0H5LhVew5GTACZsZTbqUWR3D0+R4RQTNJRhQzHq4HE0o +cWjKRiQWWMqNE6S/M4Eri4SJyoaXzhkXjkboYTf/+Dks1wIDAQABozIwMDAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBT5lsU8wZ72pP5lB5ezzqxi5mk4KTANBgkq +hkiG9w0BAQQFAAOBgQA8pZPqoSDBduMtKzNP5A6TerIc7Whm/mwBmiMq0sRHFPWe +sCHJkBxF+ryJT6WDsm1RuCdueHgoppnJ6epdqxmtOAcNcn+OQDU5lzSATBu60B5m +bH4zRsxwn4L9ts+Q1IbjWXc0P1G+2oQSNfvduS7esrs1RM64h6gUJErzxU5cfg== +-----END CERTIFICATE----- Index: xotcl/library/actiweb/pageTemplate.xotcl =================================================================== diff -u --- xotcl/library/actiweb/pageTemplate.xotcl (revision 0) +++ xotcl/library/actiweb/pageTemplate.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,94 @@ +package provide xotcl::actiweb::pageTemplate 0.8 + +package require xotcl::actiweb::webObject +package require xotcl::actiweb::invoker +package require xotcl::mixinStrategy + +Class PageTemplate -superclass WebObject +PageTemplate instproc init args { + next + my mixinStrategy Send=TypedString +} + +PageTemplate abstract instproc listExportedProcs args +PageTemplate abstract instproc simplePage args + +Class PageTemplateHtml -superclass PageTemplate + +PageTemplateHtml instproc init args { + my contentType text/html + next +} + +PageTemplateHtml instproc listExportedProcs args { + # + # place must be a Html place! + # + set place [HtmlPlace getInstance] + set c " + The following options are avaiable on $n: + " + + foreach i [my exportedProcs] { + set href [my selfAction "[self] $i"] + set app { +

$i + } + append c [subst -nobackslashes $app] + } + return [my simplePage $place [self] $c] +} + +PageTemplateHtml instproc simplePage {title heading content {closing ""}} { + set place [Place getInstance] + set c { + + + $title + + +

$heading

+
+

+ + $content + +

$closing + +


+ + + } + return [subst -nobackslashes -nocommands $c] +} + +# +# builds a simple Form -- args are tupels of the form +# {text, name, type, default, size} +# +# +PageTemplateHtml instproc simpleForm {action args} { + set action [my selfAction $action] + set c { + + + } + foreach {text name type def size} $args { + append c " + + + + + " + } + append c { + + + + +
$text:
+ +

+ } + return [subst -nobackslashes -nocommands $c] +} \ No newline at end of file Index: xotcl/library/actiweb/pkgIndex.tcl =================================================================== diff -u --- xotcl/library/actiweb/pkgIndex.tcl (revision 0) +++ xotcl/library/actiweb/pkgIndex.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,24 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex -direct" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded xotcl::actiweb::agent 0.8 [list source [file join $dir Agent.xotcl]] +package ifneeded xotcl::actiweb::agentManagement 0.8 [list source [file join $dir AgentManagement.xotcl]] +package ifneeded xotcl::actiweb::htmlPlace 0.8 [list source [file join $dir HtmlPlace.xotcl]] +package ifneeded xotcl::actiweb::httpPlace 0.8 [list source [file join $dir HttpPlace.xotcl]] +package ifneeded xotcl::actiweb::invoker 0.8 [list source [file join $dir Invoker.xotcl]] +package ifneeded xotcl::actiweb::pageTemplate 0.8 [list source [file join $dir pageTemplate.xotcl]] +package ifneeded xotcl::actiweb::placeAccessControl 0.8 [list source [file join $dir PlaceAccessControl.xotcl]] +package ifneeded xotcl::actiweb::secureHtmlPlace 0.8 [list source [file join $dir SecureHtmlPlace.xotcl]] +package ifneeded xotcl::actiweb::secureHttpPlace 0.8 [list source [file join $dir SecureHttpPlace.xotcl]] +package ifneeded xotcl::actiweb::sendStrategy 0.8 [list source [file join $dir SendStrategy.xotcl]] +package ifneeded xotcl::actiweb::userMgt 0.8 [list source [file join $dir UserMgt.xotcl]] +package ifneeded xotcl::actiweb::webAgent 0.8 [list source [file join $dir WebAgent.xotcl]] +package ifneeded xotcl::actiweb::webDocument 0.8 [list source [file join $dir WebDocument.xotcl]] +package ifneeded xotcl::actiweb::webObject 0.8 [list source [file join $dir WebObject.xotcl]] Index: xotcl/library/comm/Access.xotcl =================================================================== diff -u --- xotcl/library/comm/Access.xotcl (revision 0) +++ xotcl/library/comm/Access.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1683 @@ +# -*- tcl -*- $Id: Access.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +set httpAccessVersion 0.91 +package provide xotcl::comm::httpAccess $httpAccessVersion + +package require xotcl::comm::pcache +package require xotcl::comm::mime +package require xotcl::comm::connection +package require xotcl::trace + +if {[catch {set os [exec uname -sr]}]} { + if {[catch {set os [exec uname -a]}]} { set os unknownOS } +} +if {![info exists VERSION]} { set VERSION 1.0 } + + +# assert is used only for invariants in the source +proc assert {f r} { + set got [eval $f] + if {$got != $r} { + puts stderr "assertion failed: \[$f\] == $r (got $got)" + } +} + + +# resolve and checkUrl implement URL handling (primarily completion) +proc checkUrl {url} { + #puts stderr "checkUrl: <$url>" + if {![regexp {^([^:]+:/)/([^/]+)(/.*)?$} $url _ scheme network path]} { + regexp {^([^:]+:)(/.*)?$} $url _ scheme path + } + if {![info exists path]} { + # no access scheme provided, try some heuristics... + if {[regexp {^[./]} $url]} { + # expand leading "." to pwd + if {[regexp {^\.(.*)$} $url _ url]} { set url [pwd]$url } + return file:$url + } else { + set url http://$url + regsub {///$} $url // url + return $url + } + } + if {$path == ""} {set path /} + return [expr {[info exists network] ? + "$scheme/$network$path" : "$scheme$path"}] +} + +# resolving a relative url with respect to a base url (based on rfc 1808) +proc resolve {rel base {childTagName ""}} { + if {$base == ""} { return [checkUrl $rel] } + if {$rel == ""} { return $base } + if {[regexp {^[^:]+:/} $rel _]} { return [checkUrl $rel] } + if {![regexp {^([^:]+:/)/([^/]+)(/.*)$} $base _ baseScheme baseNetwork basePath]} { + regexp {^([^:]+:)(/.*)$} $base _ baseScheme basePath + } elseif {[regexp {^[^:/]+:} $rel]} { + return $rel + } + regexp {^(.*)\#.*$} $basePath _ basePath + regexp {^(.*)[?].*$} $basePath _ basePath + if {[regexp {^//([^/]+)/(.*)$} $rel _ relNetwork relPath]} { + return $baseScheme/$relNetwork/$relPath + } + if {[info exists baseNetwork]} { + append baseScheme /$baseNetwork + } + #puts stderr rel=<$rel> + if {![string match /* $rel]} { + #puts stderr rel<$rel>base<$basePath> + if {[string match \#* $rel]} { + set r $basePath$rel + } elseif {![regsub {/([^/]*)$} $basePath /$rel r]} { + set r /$rel + } + while {[regsub -all {/\./} $r / r]} {} + regsub {/\.$} $r / r + while {[regsub -all {/[^/.]+/\.\./} $r / r]} {} + # remove leading /../ (netscapes navigator does this) + while {[regsub {^/\.\./} $r / r]} {} + set rel $r + #puts stderr finalrel<$r> + } + #if {$childTagName != ""} + if {1} { + upvar 1 $childTagName childTag + catch {unset childTag} + if {[regexp {^(.+)\#(.+)$} $rel _ rel childTag]} { + #puts stderr childTag=$childTag,url=$baseScheme$rel. + } + } + return $baseScheme$rel +} + +assert {resolve "" http://mohegan/} http://mohegan/ +assert {resolve http://mohegan/ ""} http://mohegan/ +assert {resolve http://mohegan ""} http://mohegan/ +assert {resolve http://mohegan/ http://nestroy} http://mohegan/ +assert {resolve test.html http://127.0.0.1/} http://127.0.0.1/test.html +assert {resolve test http://nestroy/} http://nestroy/test +assert {resolve test file:/u/neumann/old} file:/u/neumann/test +assert {resolve /test http://nestroy/} http://nestroy/test +assert {resolve //mohegan/index.html http://nestroy/} http://mohegan/index.html +assert {resolve //mohegan/index.html http://nestroy/} http://mohegan/index.html +assert {resolve index.html http://nestroy/dir/} http://nestroy/dir/index.html +assert {resolve ./index.html http://nestroy/dir/} http://nestroy/dir/index.html +assert {resolve ././index.html http://nestroy/dir/} http://nestroy/dir/index.html +assert {resolve ../index.html http://nestroy/dir/} http://nestroy/index.html +assert {resolve ../../index.html http://nestroy/dir/} http://nestroy/index.html +assert {resolve ../../../test file:/u/neumann/old} file:/test +assert {resolve newdir/ http://nestroy/dir/} http://nestroy/dir/newdir/ +assert {resolve /newdir/ http://nestroy/dir/} http://nestroy/newdir/ +assert {resolve file:/u/neumann/ice.html ""} file:/u/neumann/ice.html +assert {resolve \#label http://nestroy/h.html} http://nestroy/h.html +assert {resolve mailto:user@host http://nestroy/h.html} mailto:user@host +assert {resolve ../../../../mis2001/folien/081101.ppt http://wwwi.wu-wien.ac.at/Studium/Abschnitt_2/LVA_ws01/IT/index.html} http://wwwi.wu-wien.ac.at/mis2001/folien/081101.ppt + + +############################################################## +# Every object of class Access informs the (possibly empty) list of +# informObjects during its lifecycle with the following messages +# +# startCb: when the request for the object is created +# and was classified and initialized +# +# notifyCb: when the type of the incming data is dertermined +# (typically after parsing the http header) +# +# incCb: when new data is available +# +# endCb: when the request is finished sucessfully and the object +# is going to be destroyed +# +# cancelCb: when the request is finished nonsucessfully and the object +# is going to be destroyed +# +# All these messages receive the name of the Access object +# as first parameter, incCb has two more arguments (totalsize +# and currentsize) + +# caching: +# 0 no caching +# 1 volatile cache (does not check cache, keeps spool file for back button) +# 2 persistent cache + +Class Access -parameter { + {method GET} {blocking 0} {httpVersion 1.1} {headers {}} + url query data contentType path caching sinkClass parentUrl +} +Access instproc informObject x { + foreach i $x { my lappend informObjects $i } +} +Access instproc method x { + my set method [string toupper $x] +} +Access instproc unknown {m args} { + error "Method '$m' with args '$args' is unknown for [self class]" +} + +Access proc checkRunning {} { + foreach u [my array names running] { + puts stderr "... running: $u" + } + puts stderr "... -----------" +} +Access proc createRequest args { + #my showCall + set informobject {} + set allowJoin 1 + set nargs {} + foreach {a v} $args { + switch -exact -- $a { + -url {set url $v; lappend nargs $a $v} + -informObject {set informobject $v; lappend nargs $a $v} + -parentRequest {set parentRequest $v} + -allowJoin {set allowJoin $v} + default {lappend nargs $a $v} + } + } + #if {[my array exists running]} {parray [self]::running} + if {[my exists running($url)] && $allowJoin} { + my showMsg "we can join running($url)=[my set running($url)]" + # we can join the request. + # requests are joined by adding the informobjects to + # the existing request + set token [my set running($url)] + # delegation to a different request works only so easy + # when loading to a file... + $token informObject $informobject + return $token + } else { + set token [my autoname ::req] + if {[info exists parentRequest]} { + set token ${parentRequest}$token + } + #my showMsg "TOKEN = $token $url" + return [eval my create $token $nargs] + } +} +Access instproc running {} { + #my showCall + [self class] set running([my url]) [self] +} +Access instproc stop {} { + #showCall + my instvar url + if {[[self class] exists running($url)]} { + #puts stderr "my unset [[self class] set running($url)] + [self class] unset running($url) + #if {[my array exists running]} { parray [self class]::running } + } else { + #puts stderr "not running($url)" + #if {[my array exists running]} { parray [self class]::running } + } +} +#Access instproc destroy args { +# my showCall +# next +#} +Access instproc init args { + #my showCall + my instvar method url + if {![my exists informObjects]} { + my set informObjects {} + } + next + if {![my exists caching]} { + if {$method == "GET"} { + set defaultCaching 2 + } else { + set defaultCaching 1 + } + my caching $defaultCaching + } + #my showVars + + set url [string trim $url] + my initialize + if {[my classify $url]} { + #my showVars + # now inform all interested objects that we have the object + my doCallbacks startCb + #my showVars blocking + # trigger the transfer... (might be blocking or not) + my $method + if {![my exists finished]} { + # the request is not finished + if {[my blocking]} { + #my showMsg "waiting" + my vwait finished + #my showMsg "waiting DONE" + } + } + } +} +Access instproc getContent {} { + [my set sink] content +} + +######################################### +Access instproc timeout t { + my set timeout [::after $t [self] timeoutOccured] +} +Access instproc timeoutOccured {} { + #my showCall + my unset timeout + my abort "timeout exceeded" +} +Access instproc timeoutFinish {} { + if {[my exists timeout]} { + after cancel [my set timeout] + my unset timeout + } +} +######################################### + +Access instproc initialize {} { + #my showCall + my set state 0 + my set meta {} + my set currentsize 0 + my set totalsize 0 +} +Access instproc classify {url} { + my instvar host path port method + #my showVars caching + if {[my caching] > 1 && [persistentCache isValidated $url]} { + #puts stderr "*** cacheable && validated" + #showVars + #persistentCache dump + set access CacheAccess + } elseif {[regexp -nocase {^http://([^/:]+)(:([0-9]+))?(/.*)?$} $url \ + _ host y givenPort path]} { + if {[string compare "" $givenPort]} {set port $givenPort } {set port 80} + switch -exact $method { + PROPFIND - + PROPPATCH - + COPY - + MKCOL - + MOVE - + LOCK - + UNLOCK { + package require xotcl::comm::dav + set access Dav + } + default {set access Http} + } + } elseif {[regexp -nocase {^https://([^/:]+)(:([0-9]+))?(/.*)$} $url \ + _ host y givenPort path]} { + if {[string compare "" $givenPort]} {set port $givenPort } {set port 443} + set access Https + } elseif {[regexp -nocase {^file:(.*)$} $url _ path]} { + set access File + } elseif {[regexp -nocase {^ftp://([^/]+)/(.*)$} $url _ host path]} { + package require xotcl::comm::ftp + set access Ftp + } elseif {[regexp -nocase {^imap://([^/]+)/(.*)$} $url _ host path]} { + package require xotcl::comm::imap + set access Imap + } elseif {[regexp -nocase {^cmd:/(.*)$} $url _ path]} { + set access xotcl::Cmd + } elseif {[regexp -nocase {^ldap://([^/:]+)?(:([0-9]+))?(/.*)$} \ + $url _ host y givenPort path]} { + if {$givenPort != ""} { set port $givenPort } + my showMsg "*** ldap://<$host>:<$port>/<$path>" + package require xotcl::comm::ldap + set access Ldap + } else { + #my set state 0 + my abort "Unsupported URL: '$url'" + return 0 + } + my class $access + #my showMsg "class of request = $access" + return 1 +} +Access instproc revisit {} { + my class ReAccess + my initialize + my [my set method] +} +### dummy stubs for 'close' and 'GET' for error cases +Access instproc close {} { +} +Access instproc GET {} { + if {[my exists errormsg]} { ;# the error was already reportet + my finish + } else { + my abort "unknown error" + } +} + +Access instproc headerDone {} { + my instvar caching sink + if {[my exists ignoreBody]} return + if {[my exists sinkClass] && $caching>0 } { + error "can�t set both sinkclass and caching" + } + switch $caching { + 2 { + set sink [CacheFileSink create [self]::cfs] + #my showMsg "[self class] result goes to cache" + $sink notifyCb [self] + } + 1 { + set sink [CacheFileSink create [self]::cfs -persistent 0] + #my showMsg "result goes to volatile cache" + $sink notifyCb [self] + } + 0 { + if {[my exists sinkClass]} { + set sink [[my sinkClass] create [self]::s] + } + } + } + my doCallbacks notifyCb +} +Access instproc mkSpoolFile {{name ""}} { + if {![my exists fileName]} { + my set fileName [persistentCache newEntry [my url] [self] [my caching] $name] + } +} +Access instproc block {} { + my set block +} +Access instproc kill {} { + my showCall + my set state -1; #interrupted + my finish +} +Access instproc abort {msg} { + #my showCall + #my showVars + my instvar state errormsg + if {[catch {::printError "[self] ($state): $msg"} err]} { + puts stderr "\n$err\nERROR [self] ($state): $msg\n" + } + #my set error [list $msg $::errorInfo $::errorCode] + my caching 0 + if {[my exists ignoreBody]} { + my unset ignoreBody + } + set state -2 ;# error + set errormsg $msg + my finish +} +Access instproc finish {} { + #my showCall + my timeoutFinish + my close + #my showVars state ignoreBody + # state is "interrupted" or "error" + if {[my set state] < 0} { + set action cancelCb + set success 0 + } else { + set action endCb + #set state ok + set success 1 + } + if {[my exists ignoreBody]} { + my stop + #my set finished $success + set cmd [my set ignoreBody] + my unset ignoreBody + #my showMsg "executing... <$cmd>" + eval my $cmd + } else { + if {[my exists sink]} { + [my set sink] $action [self] + } + #catch {after cancel $after} ;# ???? + my doCallbacks $action + my stop + my set finished $success + } +} +Access instproc eof {} { + #my showCall + #my showMsg "c [my set currentsize]== t [[self set totalsize]]" + #my set state eof + my finish +} +Access instproc doCallbacks {cb} { + #my showCall + if {[my exists ignoreBody]} { + my showMsg "ignoring callback" + } else { + foreach obj [my set informObjects] { + #my showMsg "*** $obj $cb [self]" + #puts stderr "------------ calling: $obj $cb [self]" + if {[catch {$obj $cb [self]} errormsg]} { + puts stderr "--------------$cb:errormsg=$errormsg, \ + errorInfo=$::errorInfo, \ + errorCode=$::errorCode." + } + #puts stderr "------------ calling DONE: $obj $cb [self]" + } + } +} +Access instproc shutdown {} { + #my showMsg "state=[my set state] > 3" + if {[my set state] > 3} { + my set mustDestroy 1 + } else { + #my showVars + #my showStack + #my showMsg "DESTROY !!!" + if {[my set state] > -2} { + my destroy + } + } +} + + +Class FileAccess -superclass Access +FileAccess instproc initialize args { + my caching 0 + next +} +FileAccess instproc close {} { +} +FileAccess instproc block {} { + my showTimeStart + set S [open [my set fileName] r] + fconfigure $S -translation binary + set block [::read $S] + ::close $S + my showTimeEnd + return $block +} +FileAccess instproc GET {} { + my instvar path response totalsize currentsize \ + fileName informObjects + set fileName $path + set totalsize [file size $path] + set response "file 200 OK" + my headerDone + my set state 4 + set currentsize $totalsize + #my showVars informObjects + foreach obj $informObjects { + $obj incCb [self] $totalsize $currentsize + } + my eof +} + + +Class File -superclass FileAccess +File instproc GET {} { + my instvar path + #puts stderr path=$path,exists=[file exists $path] + if {![file exists $path]} { + my abort "No such file '$path'" + return + } + if {![my exists contentType]} { + my contentType [Mime guessContentType $path] + } + my set sink [FileSink create [self]::fas -fileName $path] + #puts stderr ****sink=$sink,[$sink info class] + #puts stderr "*** before next ([self class])" + next + #puts stderr "*** after next ([self class])" +} + +Class CacheAccess -superclass File +CacheAccess instproc GET {} { + my instvar url + my path [persistentCache cacheFileName $url] + my contentType [persistentCache contentType $url] + my set meta [persistentCache meta $url] + next +} + +Class ReAccess -superclass File +ReAccess instproc GET {} { + my instvar fileName sink + my set block "" + my set currentsize 0 + my caching 0 + if {![info exists fileName]} { + set fileName [$sink set fileName] + } + my set path $fileName + next +} + + + +Class Cmd -superclass Access +Cmd instproc init args { + if {![my exists caching]} { + my caching 0 + } + next +} +Cmd instproc GET {} { + my instvar path block totalsize currentsize \ + response informObjects state + if {[catch {set block [eval $path]} error]} { + my contentType text/plain + set block $error + } else { + my contentType text/html + } + set totalsize [string length $block] + set response "cmd 200 OK" + my headerDone + my set state 4 + set currentsize $totalsize + foreach obj $informObjects { + $obj incCb [self] $totalsize $currentsize + #$obj endCb [self] + } + #set state eof + my finish +} +Cmd instproc block args { + my instvar block + return $block +} + + +#Class NetAccess -superclass Access -parameter {host port} +Class NetAccess -superclass Access +NetAccess instproc initialize args { + if {![my exists blocksize]} {my set blocksize 512} + my set readMethod read + next +} +NetAccess instproc read {} { + #my instvar S blocksize block + #set block [::read $S $blocksize] + my instvar S block blocksize + set block [::read $S $blocksize] +} +NetAccess instproc gzread {} { + my instvar S Z blocksize block + puts -nonewline $Z [::read $S $blocksize] + set block [::read $Z] + #puts stderr len=[string length $block],block=<$block> +} +NetAccess instproc gzopen {} { + my instvar Z S readMethod + requireModules {zipchan libzipchan.so} + fconfigure $S -translation binary + set Z [zipchan] + set readMethod gzread +} +NetAccess instproc close {} { + #my showMsg "**** close persistent=[my exists persistent]" + if {![my exists persistent]} { + foreach stream {S Z} { + if {[my exists $stream]} { + ::close [my set $stream] + my unset $stream + } + } + } + my stop +} +NetAccess instproc hold {} { + my instvar S + $S hold +} +NetAccess instproc resume {} { + my instvar S + $S resume +} +NetAccess instproc readData {} { + #my showCall + if {[catch { + #puts stderr "??????????????readMethod=[my set readMethod]" + my [my set readMethod] + my pushBlock + } err]} { + puts stderr ERR=$err + my set block "" + my abort $err + } +} +NetAccess instproc pushBlock {} { + #my showCall + my instvar block + if {[set n [string length $block]]} { + my instvar currentsize totalsize informObjects sink + #my showVars n currentsize totalsize + incr currentsize $n + if {$currentsize > $totalsize} { + set totalsize $currentsize + } + #my showMsg "total=$totalsize current=$currentsize" + if {[my exists ignoreBody]} { + #puts stderr "ignoring: <$block>" + } else { + if {[info exists sink]} { + $sink incCb [self] $totalsize $currentsize + } + foreach obj $informObjects { + #my showMsg "call incbCb $totalsize $currentsize $obj [$obj info class]" + $obj incCb [self] $totalsize $currentsize + #my showMsg "done incbCb $totalsize $currentsize" + } + } + } else { + #my showVars n + return [my eof] + } +} + +Class Http -superclass NetAccess ;### -parameter {query {httpVersion 1.0}} +Http set proxyfilter httpProxyRequired +Http set proxyhost {} +Http set proxyport {} +Http set accept */* +if {[info exists argv0]} { + Http set useragent "[file tail $argv0] httpAccess/$httpAccessVersion xotcl/$::xotcl::version ($os)" +} +Http proc proxyfilter {host phostv pportv} { + my instvar proxyfilter proxyhost proxyport + upvar \#1 $phostv phost $pportv pport + switch -- $proxyfilter { + httpProxyRequired { + if {[string length $proxyhost]} { + if {![string length $proxyport]} { set proxyport 8080 } + set phost $proxyhost + set pport $proxyport + } + } + } +} + +Http instproc initialize args { + if {![my exists port]} {my set port 80} + if {![my exists httpVersion]} {my set httpVersion 1.1} + next + #my showMsg "result queried from net" +} +Http instproc GET {} { + #my showCall + if {[my exists query]} { + my instvar query caching + my append url ?$query + my append path ?$query + if {$caching == 2} {set caching 1} + my showVars caching $query + } + my open +} +Http instproc HEAD {} { + my open +} +Http instproc POST {} { + # we have query and data only for a uniform interface for + # forms that cann pass the attribute value pairs always via + # query. + if {[my exists query]} { + my data [my query] + } + my open +} +Http instproc PUT {} { + my open +} +# Http1.1 +Http instproc OPTIONS {} { + my showCall + my open +} +# Http1.1 +Http instproc TRACE {} { + my showCall +} +# Http1.1 +Http instproc DELETE {} { + #my showCall + my open +} +Http instproc openConnection {host port reuse} { + return [Connection make [self] $host $port $reuse _] +} +Http instproc open {} { + #my showCall + my instvar url S state host port path + if {$state > 0} { + puts stderr "... [self]:$proc ignoring request in state $state" + return + } + Http proxyfilter $host phost pport + if {[info exists phost] && [string length $phost]} { + set usePort $pport + set useHost $phost + set path $url + } else { + set usePort $port + set useHost $host + } + + set S [my openConnection $useHost $usePort [expr {[my httpVersion]>1.0}]] + if {[$S exists error]} { + my abort [$S set error] + return + } + set state 2 + my running + $S event writable [self] ask +} + +Http instproc ask {} { + my instvar url S state host port path \ + method headers data caching + + $S event writable [self] {} + + if {[pwdManager checkAvailableCredentials $url credentials]} { + eval lappend headers $credentials + #my showMsg "*** new headers = <$headers>" + } + if {$caching==2 && [persistentCache ifModifiedHeader $url ifModified]} { + eval lappend headers $ifModified + #puts stderr "new headers = <$headers>" + } + # Send data in cr-lf format, but accept any line terminators + $S translation {auto crlf} + + #my showMsg "'$method $path HTTP/[my httpVersion]' headers {$headers}" + $S puts "$method $path HTTP/[my httpVersion]" + if {[$S exists error]} { + my abort "Connection refused by host '$host' port '$port'\n\ + [$S set error]" + return + } + + $S puts "Accept: [Http set accept]" + $S puts "Host: $host" + $S puts "User-Agent: [Http set useragent]" + foreach {tag value} $headers { + regsub -all \[\n\r\] $value {} value + set tag [string trim $tag] + if {[string length $tag]} { + #my showMsg "+++ <$tag: $value>" + $S puts "$tag: $value" + } + } + if {[my exists data]} { + $S puts "Content-Length: [string length $data]" + $S puts "Content-Type: [my contentType]" + $S puts "" + $S translation {auto binary} + $S puts-nonewline $data + } else { + $S puts "" + } + $S flush + if {[$S exists error]} { + my instvar host port + my abort "Connection refused by host '$host' port '$port'\n\ + [$S set error]" + } else { + set state 3 + $S event readable [self] headerStart + } +} + +Http instproc headerStart {} { + #my showCall + my instvar S response + set n [$S gets response] + #my showVars n response + if {[$S exists error]} { + my instvar host port + my abort "Error on connection to host '$host' port '$port'\n\ + [$S set error]" + return + } + #my showMsg "n=$n, eof=[$S eof]" + if {$n == -1 && ![$S eof]} { + #my showMsg "******************************input pending, no full line" + return + } + my instvar responseCode responseHttpVersion + if {[regexp {^HTTP/([0-9.]+) +([0-9]+) *} $response _ \ + responseHttpVersion responseCode]} { + #my showMsg "response valid: '$response'" + $S event readable [self] header + } else { + my instvar host port + my abort "Unexpected response from $host:$port\n $n: '$response'" + } +} +Http instproc header {} { + my instvar S meta totalsize + if {[$S gets line]} { + #my showMsg "line=$line" + if {[regexp -nocase {^content-type:(.+)$} $line _ type]} { + my contentType [string trim $type] + } elseif {[regexp -nocase {^content-length:(.+)$} $line _ length]} { + set totalsize [string trim $length] + } + if {[regexp -nocase {^([^:]+): *(.+)$} $line _ key value]} { + lappend meta [string tolower $key] $value + } + } else { + my headerDone + } +} +Http array set expectsBody \ + {GET 1 HEAD 0 POST 1 PUT 0 DELETE 1 OPTIONS 0 TRACE 1} +Http instproc headerDone {} { + #my showVars meta + my instvar S meta method responseCode responseHttpVersion + [self class] instvar expectsBody + set expectBody $expectsBody($method) + + array set v [my set meta] + if {([info exists v(connection)] && $v(connection) == "close") || \ + $responseHttpVersion < 1.1} { + $S makePersistent 0 + } else { + $S makePersistent 1 + } + + switch $responseCode { + 200 {} + 204 { + #set state empty + my finish + set block "" + set expectBody 0 + return + } + 301 - + 302 { + # the request is redirected to another server + my set ignoreBody [list redirect $v(location)] + + # RFC2068 Note: When automatically redirecting a POST request after + # receiving a 302 status code, some existing HTTP/1.0 user agents + # will erroneously change it into a GET request. + #my method GET + + my showMsg "redirect '[my url]' --> '$v(location)'" + } + 304 { ;# Not Modified, use cached version + my set ignoreBody cacheAccess + set expectBody 1 + #my showMsg "result comes from cache" + } + 401 { + my set ignoreBody \ + [list resubmitAuthenticated $v(www-authenticate)] + #my showMsg "resubmitAuthenticated $v(www-authenticate)" + if {[my exists resubmitAuthenticated]} { + if {[my set resubmitAuthenticated] > 5} { + my abort "Too many wrong passwords given" + } else { + my incr resubmitAuthenticated + } + } else { + my set resubmitAuthenticated 1 + } + set expectBody 1 + } + 404 { + my instvar url + #my showVars + my set ignoreBody [list abort "File Not Found on Server '$url'"] + set expectBody 1 + } + default { + #my showVars responseCode + } + } + next + if {![my exists S]} {;# this request was already canceled + return + } + if {[info exists v(transfer-encoding)]} { + if {$v(transfer-encoding) == "chunked"} { + $S translation {auto binary} + my set state 4 + $S event readable [self] readChunkedLength + } else { + my abort "Unexpected Transfer encoding '$v(transfer-encoding)'" + } + } else { + # yahoo does not send a content length for a get request + #if {$totalsize == 0 && ($responseCode > 300 || !$expectsBody($method) )} + #my showVars method totalsize expectsBody($method) expectBody + # the following is used currently for Actiweb-Agents: + # the reponse of a PUTS contains a BODY! + if {!$expectBody && + [::info exists v(content-length)] && + $v(content-length) > 0} { + set expectBody 1 + #my showMsg "setting expectBody 1" + } + + if {!$expectBody} { + #$S event readable [self] "" + #set state eof + my finish + set block "" + } else { + ### To avoid CRLF problmes we set the translation for + ### the body entity to binary + $S translation binary + my set state 4 + $S event readable [self] readData + } + } +} + +Http instproc cacheAccess {} { + # there is an actual version of the document in the cache + #showCall + persistentCache validated [my url] + #my close + my class CacheAccess + #my showMsg "result comes from cache [persistentCache cacheFileName $url]" + my caching 0 ;# should be really: toCache 0 + my GET +} + +Http instproc redirect location { + # the request is redirected to another server + if {[string compare $location [my url]]} { + #my showVars + my url $location + my initialize + my classify $location + my [my set method] + } +} +Http instproc resubmitAuthenticated headerField { + #my showCall + # the server requires authentification + my instvar path method + if {[pwdManager checkRequestedAuthentification $method $path $headerField \ + type realm]} { + my instvar url caching method headers + array set v $headers + #my showVars + catch {unset v(Authorization)} + set headers [array get v] + pwdManager removePasswd $realm + my close + if {[pwdManager requireCredentials $realm $url]} { + my initialize + if {$caching == 2} {set caching 1} + my $method + } + } else { + my abort "unknown authentication method '$headerField'" + } +} +Http instproc readChunkedLength {} { + #my showCall + my instvar S chunkLength totalsize + set length [$S gets lengthString] + if {$length > 0} { + set chunkLength [expr 0x$lengthString] + #my showVars lengthString chunkLength + if {$chunkLength == 0} { + $S event readable [self] readChunkedTrailer + } else { + incr totalsize $chunkLength + $S translation {binary} + $S event readable [self] readChunkedData + } + } +} +Http instproc readChunkedTrailer {} { + #my showCall + my instvar S state block + set size [$S gets line] + if {$size != 0} { + showObj [self] + my abort "expected trailer size 0, got size $size" + } else { + #set state eof + my finish + set block "" + #showObj [self] + } +} +Http instproc readChunkedData {} { + #my showCall + my instvar S block totalsize currentsize chunkLength + set block [$S readSize $chunkLength] + set received [string length $block] + #my showVars block + #my showVars currentsize totalsize chunkLength received + if {$chunkLength == $received} { + $S translation {auto binary} + $S event readable [self] readChunkedLength + } else { + incr chunkLength -$received + } + my pushBlock +} + +Http instproc readData {} { + #my showCall + my instvar S block totalsize currentsize + set block [$S read] + #puts stderr "????? bl=[string length $block]" + if {[$S exists error]} { + set block "" + my abort [$S set error] + return + } + my pushBlock + #my showMsg "c [my set currentsize]== t [[self set totalsize]]" + if {$currentsize == $totalsize && + [my exists S] && [$S exists persistent]} { + #my showMsg "PERSITENT, end of entity reached" + #my set state eof + my finish + set block "" + #showObj [self] + } + if {[my exists mustDestroy]} { + #my showMsg "mustDestroy was set" + my destroy + } +} +Http instproc close {} { + #my showCall + if {[my exists S]} { + [my set S] close + #unset S + } + #next +} +Http instproc freeConnection {} { + #showCall + my instvar S + #::puts stderr "[self] freeing $S !!!!!!!!!!!!!!!!!!!!!!!" + unset S +} + + +#Access instproc makeZombie {} { +# my showMsg "procs= [my info procs], i [Object info instcommands]" +# my class Zombie +#} +#Class Zombie +#Zombie instproc unknown {m args} { +# my showMsg "+++ zombie method '$m' called" +#} + + +Class Https -superclass Http +Https instproc initialize args { + #my showCall + package require tls + if {![my exists port]} { my set port 443} + next + ### temporary solution, FIXME: + ### zur zeit muss man den secure-webserver.xotcl und + ### secure-webclient.xotcl jedenfalls aus dem xotcl/apps/xocomm-apps + ### verzeichnis starten, da haben wir mal die cfg files in unserem + ### baum.... + source .ssl/ssl-configuration.xotcl + ### +} +Https instproc openConnection {host port reuse} { + set S [Connection make [self] $host $port $reuse reused] + if {$reused} { + #my showMsg "reusing $S" + } else { + my showMsg "make the socket ([$S socket]) secure ..." + set cmd [list $S importSSL] + foreach attr {cafile cadir certfile cipher command keyfile \ + model request require ssl2 ssl3 tls1} { + if {[sslClientConfig exists $attr]} { + lappend cmd -$attr [sslClientConfig set $attr] + } + } + my showMsg "the assembled command is... �$cmd�" + eval $cmd + puts stderr "CHANNELS= [file channels]" + } + return $S +} + + + +####################################################################### +Object pwdManager +pwdManager proc requirePasswd {realm username password} { + # used by ftp and imap + my instvar user area + upvar [self callinglevel] $password passwd + if {[my exists pwd($realm)]} { + #my showMsg "*** reusing password for $realm" + set passwd [my set pwd($realm)] + return 1 + } else { + userPwd user $username + if {[userPwd show $realm user($realm) passwd]} { + set area($realm/$username) $realm + return 1 + } + } + return 0 +} +pwdManager proc storePasswd {realm username password} { + # used by ftp and imap + my instvar pwd user + set pwd($realm) $password + set user($realm) $username +} +pwdManager proc removePasswd {realm} { + if {[my exists pwd($realm)]} { + my unset pwd($realm) + my unset user($realm) + } +} +pwdManager proc requireCredentials {realm url} { + regexp {^(.*/)[^/]*$} $url _ path + if {[my exists pwd($realm)]} { + #my showMsg "*** register url=$url for ther realm=$realm" + my set area($path) $realm + return 1 + } else { + my instvar pwd user + if {[info exists ::env(USER)]} { + set USER $::env(USER) + } elseif {[info exists ::env(USERNAME)]} { + set USER $::env(USERNAME) + } else { + set USER unknown + } + + userPwd user $USER + if {[userPwd show $realm user($realm) pwd($realm)]} { + #my showMsg "*** setting password for realm '$realm' url=$path" + my set area($path) $realm + return 1 + } + } + return 0 +} +pwdManager proc encodeCredentials {authMethod realm} { + #my showCall + switch $authMethod { + basic {set credential [my encodeCredentialsBasic $realm]} + digest {set credential [my encodeCredentialsDigest $realm]} + } + return $credential +} +pwdManager proc encodeCredentialsBasic {realm} { + my instvar pwd user + return [list Authorization \ + "Basic [base64 encode $user($realm):$pwd($realm)]"] +} +pwdManager proc encodeCredentialsDigest {realm} { + #my showCall + package require tcu; #FIXME: noch nicht in distribution + my instvar digestResponseData + my mkDigestResponseData $realm + set digestResponse {} + foreach {t v} [array get digestResponseData] { + append digestResponse " $t = \"$v\"," + } + return [list Authorization "Digest [string trimright $digestResponse ,]"] +} +pwdManager proc mkDigestResponseData {realm} { + #my showCall + my instvar pwd user digestResponseData requestUri + # RFC 2617 + # credentials = "Digest" digest-response + # digest-response = 1#( username | realm | nonce | digest-uri + # | response | [ algorithm ] | [cnonce] | + # [opaque] | [message-qop] | + # [nonce-count] | [auth-param] ) + # username = "username" "=" username-value + # username-value = quoted-string + # digest-uri = "uri" "=" digest-uri-value + # digest-uri-value = request-uri ; As specified by HTTP/1.1 + # message-qop = "qop" "=" qop-value + # cnonce = "cnonce" "=" cnonce-value + # cnonce-value = nonce-value + # nonce-count = "nc" "=" nc-value + # nc-value = 8LHEX + # response = "response" "=" request-digest + # request-digest = <"> 32LHEX <"> + # LHEX = "0" | "1"| ...| "e" | "f" + set digestResponseData(username) $user($realm) + set digestResponseData(uri) $requestUri + set digestResponseData(cnonce) "TEST" + set digestResponseData(nc) 00000001 + set digestResponseData(response) [my mkRequestDigest] + #parray digestResponseData +} +pwdManager proc mkRequestDigest {} { + # returns a string of 32 hex digits, which proves that the user + # knows a password + + #A1 = unq(username-value) ":" unq(realm-value) ":" passwd + my instvar digestResponseData pwd requestMethod requestUri + append A1 $digestResponseData(username)\ + : $digestResponseData(realm) : $pwd($digestResponseData(realm)) + if {![my exists digestResponseData(qop)] || + $digestResponseData(qop) == "auth"} { + append A2 $requestMethod : $requestUri + } elseif {$digestResponseData(qop) == "auth-int"} { + #A2 = Method ":" digest-uri-value ":" H(entity-body) + append A2 $requestMethod : $requestUri: "" + } + if {[my exists digestResponseData(qop)]} { + append reqDigest $digestResponseData(nonce) : \ + $digestResponseData(nc) : \ + $digestResponseData(cnonce): \ + $digestResponseData(qop) + set reqDigest [md5 [md5 $A1]:$reqDigest:[md5 $A2]] + } else { + set reqDigest [md5 [md5 $A1]:$digestResponseData(nonce):[md5 $A2]] + } + return $reqDigest +} + +pwdManager proc checkAvailableCredentials {url returnCredentials} { + # we start a fresh request and check, whether we have sent for this url + # (directory) already some credentials in an earlier reqhest. + my instvar authMethod + regexp {^(.*/)[^/]*$} $url _ path + if {[my exists area($path)]} { + set realm [my set area($path)] + upvar [self callinglevel] $returnCredentials credentials + #my showMsg "*** adding credentials for realm=$realm and $path" + set credentials [my encodeCredentials $authMethod $realm] + return 1 + } + return 0 +} +pwdManager proc checkRequestedAuthentification {reqMethod path headerField + typeVar realmVar} { + # check for which realm with which authentification method the + # server wants an authentification + #my showCall + upvar [self callinglevel] $typeVar type $realmVar realm + my instvar authMethod digestResponseData requestUri requestMethod + set requestUri $path + set requestMethod $reqMethod + if {[regexp {^Basic realm="(.*)"$} $headerField _ realm]} { + set type basic;# FD: musste da lassen wg. call by reference + set authMethod $type + return 1 + } elseif {[regsub {^Digest } $headerField _ headerField]} { + set type digest ;# FD: musste da lassen wg. call by reference + set authMethod $type + foreach pair [split $headerField ,] { + if {[regexp {^(.*) *= *(".*")$} $pair _ n v]} { + set digestResponseData([string trim $n]) [string trim [string trim $v] \"] + } + } + set realm $digestResponseData(realm) + return 1 + } + return 0 +} + +####################################################################### +# test classes +Class Sink +Sink instproc startCb {r} { + my set contentLength 0 + next +} +Sink instproc notifyCb {r} { + next +} +Sink instproc incCb {r t c} { + my set contentLength $t + next +} +Sink instproc endCb {r} { + next + #showCall +} +Sink instproc cancelCb {r} { + next + #showCall +} +Sink instproc content {} { + next + #showCall +} +Sink instproc contentLength {} { + my set contentLength + #showCall +} + + +Class TimeSink -superclass Sink +TimeSink instproc startCb {r} { + my set startTime [clock clicks] + next +} +TimeSink instproc notifyCb {r} { + my set notifyTime [clock clicks] + next +} +TimeSink instproc endCb {r} { + my set endTime [clock clicks] + next + my reportTimes +} +TimeSink instproc cancelCb {r} { + my set endTime [clock clicks] + next +} +TimeSink instproc reportTimes {} { + my instvar startTime endTime notifyTime + set bytes [my contentLength] + set grossSecs [expr {($endTime-$startTime)/1000000.0}] + set grossKbps [expr {($bytes/1000.0)/$grossSecs}] + set netSecs [expr {($endTime-$notifyTime)/1000000.0}] + set netKbps [expr {($bytes/1000.0)/$netSecs}] + #if {[catch {set netKbps [expr {($bytes/1000.0)/$netSecs}]}]} { + # set netKbps 0 + #} + set headSecs [expr {$grossSecs-$netSecs}] + foreach v {grossSecs grossKbps netSecs netKbps headSecs} { + set $v [format %.2f [set $v]] + } + my showMsg "got $bytes bytes in $grossSecs ($headSecs+$netSecs) seconds,\ + $grossKbps ($netKbps) KB/S" +} + + +Class ParallelSink -superclass Sink -parameter { + {httpVersion 1.1} + {sinkClass TimeSink} + {maxsimultaneous 20} +} +ParallelSink instproc init args { + next + my set running 1 + my set numrequests 0 + my set sumbytes 0 + my set blocked {} +} +ParallelSink instproc startCb r { + #my showCall + my incr running + my incr numrequests + #puts stderr "... running++ [my set running]" +} +ParallelSink instproc endCb r { + #my showCall + my incr sumbytes [$r set currentsize] + my done $r +} +ParallelSink instproc cancelCb r { + #my showCall + my done $r +} +ParallelSink instproc done r { + #my showCall + my instvar blocked + $r shutdown + my incr running -1 + #puts stderr "... running-- [my set running] [llength [Http info instances]]" + #puts stderr [Http info instances] + #foreach i [Http info instances] {puts stderr "\t$i: [$i set method] [$i set url]"} + #puts stderr RUNNING=[my set running] + if {[llength $blocked] > 0} { + set newreq [lindex $blocked 0] + set blocked [lrange $blocked 1 end] + my scheduleRequest [lindex $newreq 0] [lindex $newreq 1] [lindex $newreq 2] + } elseif {[my set running] < 1} { + my set done 1 + } +} + + +ParallelSink instproc scheduleRequest {method url {parentUrl ""}} { + my instvar requests blocked running maxsimultaneous + if {$running > $maxsimultaneous} { + lappend blocked [list $method $url $parentUrl] + } else { + set cmd [list Access createRequest -url $url \ + -sinkClass [my sinkClass] \ + -informObject [self] \ + -method $method \ + -timeout 25000 \ + -caching 0 -allowJoin 0 -httpVersion [my httpVersion]] + if {$parentUrl != ""} { + lappend cmd -parentUrl $parentUrl + } + set r [eval $cmd] + } +} + +ParallelSink instproc requests {urls} { + my showTimeStart + foreach url $urls { my scheduleRequest GET $url } + my wait + my showTimeEnd +} + +ParallelSink instproc wait {} { + my instvar running + if {$running > 0} { + set savedValue $running + #my showMsg ".......... waiting for initially $running requests" + if {[catch {my vwait done} err]} { + my showMsg "vwait returned: $err " + } + #my showMsg "$savedValue requests FINISHED " + } +} + +Class MemorySink -superclass Sink +MemorySink instproc incCb {r t c} { + my append d [$r block] + next +} +MemorySink instproc content {} { + return [my set d] +} +MemorySink instproc contentLength {} { + if {[my exists d]} { + return [string length [my set d]] + } else { + return 0 + } +} + +Class FileSink -superclass Sink -parameter fileName +### write methods +#FileSink instproc startCb {r} { +# next +#} +FileSink instproc notifyCb {r} { + #my showVars + next + my instvar file fileName + if {[info exists fileName]} { + set file [::open $fileName w] + fconfigure $file -translation binary + } else { + # we have no filename; we assume the sink must be a dummy sink + # that deletgates its work to some other FileSink + my class ShadowFileSink + my notifyCb $r + } +} +FileSink instproc incCb {r t c} { + next + if {[my exists file]} { + if {$r == "req0"} { + puts stderr "*******************************************************" + puts stderr [$r block] + puts stderr "*******************************************************" + } + puts -nonewline [my set file] [$r block] + } +} +FileSink instproc endCb {r} { + #my showCall + next + my close +} +FileSink instproc cancelCb {r} { + next + my close +} +FileSink instproc close {} { + if {[my exists file]} { + ::close [my set file] + my unset file + } +} +### read methods +FileSink instproc content {} { + next + my instvar file fileName + set file [::open $fileName r] + fconfigure $file -translation binary + set d [read [my set file]] + my close + return $d +} +FileSink instproc contentLength {} { + next + if {[my exists fileName]} { + return [file size [my set fileName]] + } else { + return 0 + } +} + + +Class ShadowFileSink -superclass Sink +ShadowFileSink instproc notifyCb {r} { + next + my set token $r +} +ShadowFileSink instproc content {} { + my instvar token + next + return [[$token set sink] content] +} +ShadowFileSink instproc contentLength {} { + my instvar token + next + return [[$token set sink] contentLength] +} + + +Class CacheFileSink -superclass FileSink -parameter {{persistent 1}} +CacheFileSink instproc notifyCb req { + #my showCall + if {![my exists fileName]} { + my instvar persistent + set url [$req set url] + my set fileName [persistentCache newEntry $url $req $persistent ""] + } + # it is important to execute next after setting the fileName... + next +} +CacheFileSink instproc endCb req { + #my showCall + my instvar persistent + next + if {$persistent} { + persistentCache entryDone [$req set url] + } +} +CacheFileSink instproc cancelCb req { + next + if {[my exists fileName]} { + file delete [my set fileName] + my unset fileName + } +} +CacheFileSink instproc destroy {} { + #my showCall + if {[my exists fileName] && ![my set persistent]} { + #my showMsg "file delete $fileName" + file delete [my set fileName] + my unset fileName + } + next +} + + +#=========================================================== + +Class SimpleRequest -parameter { + {caching 0} + {useFileSink 0} + {blocking 1} + {timing 0} + url fileName + timeout httpVersion method headers data query contentType informObject +} +SimpleRequest instproc fileName x { + my set fileName $x + my set useFileSink 1 +} +SimpleRequest instproc init args { + my instvar useFileSink fileName sink caching token + #my showMsg "Starting Request" + next + if {[info exists fileName]} { + set sink [FileSink create [self]::sink -fileName $fileName] + } elseif {$useFileSink || $caching > 0} { + set sink [FileSink create [self]::sink] + } else { + set sink [MemorySink create [self]::sink] + } + #my showMsg "class of sink = [$sink info class]" + if {[my set timing]} { + $sink mixin TimeSink + } + set cmd [list Access createRequest \ + -url [my url] \ + -informObject $sink \ + -blocking [my blocking] \ + -caching $caching] + foreach optionalParameter { + timeout httpVersion method headers data query + contentType informObject + } { + if {[my exists $optionalParameter]} { + lappend cmd -$optionalParameter [my set $optionalParameter] + } + } + #my showMsg "cmd=$cmd" + set token [eval $cmd] + #if {[my success]} { + # $sink reportTimes + # #puts stderr <[$sink content]> + #} +} +SimpleRequest instproc success {} { + if {[my exists token]} { + return [expr {[[my set token] set finished] == 1}] + } + return 0 +} +SimpleRequest instproc destroy {} { + if {[my exists token]} { + [my set token] destroy + } + next +} +SimpleRequest instproc getContent {} { + [my set sink] content +} +SimpleRequest instproc getContentLength {} { + [my set sink] contentLength +} +#SimpleRequest instproc destroy args { next } + +####################################################################### + + Index: xotcl/library/comm/COPYRIGHT =================================================================== diff -u --- xotcl/library/comm/COPYRIGHT (revision 0) +++ xotcl/library/comm/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/library/comm/Connection.xotcl =================================================================== diff -u --- xotcl/library/comm/Connection.xotcl (revision 0) +++ xotcl/library/comm/Connection.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,249 @@ +# -*- tcl -*- $Id: Connection.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::comm::connection 1.0 + +Class Connection -parameter {host port req socket handle} + +Connection proc make {r host port reuse reusedVar} { + #my showCall + my instvar openConnections + upvar [self callinglevel] $reusedVar reused + if {$reuse} { + set handle $host:$port-[$r set blocking] + #if {[array exists openConnections]} {parray openConnections} + if {![info exists openConnections($handle)]} { + # there is no persistent connection, we create a new one + set reused 0 + set openConnections($handle) \ + [Connection new -host $host -port $port -req $r -handle $handle] + #my showMsg "$openConnections($handle) CONNECTION add for $handle added" + } else { + # there is a persistent connection + set reused 1 + set c $openConnections($handle) + $c instvar req + #::puts stderr "$c CONNECTION reuse for $handle ($c) new req=$r" + if {[info exists req]} { + # the persistent connection is active with some request $req + #::puts stderr "$c CONNECTION req $req already active" + } else { + # the persistent connection is currently not active + $c set req $r + } + } + return $openConnections($handle) + } else { + set reused 0 + return [Connection new -host $host -port $port -req $r] + } +} +Connection proc removeHandle handle { + #my showVars + #puts stderr "***************** unsetting $handle ***************" + if {[my exists openConnections($handle)]} { + my unset openConnections($handle) + } +} +Connection instproc init args { ;# the constructor creates the socket + my set blocked {} + next + if {[my exists socket]} { + my set keepOpen 1 + } else { + my set keepOpen 0 + if {[catch {my socket [socket -async [my host] [my port]]} msg]} { + my set error $msg + return + } + } + ::fconfigure [my socket] -blocking false -buffersize 16384 +} +#Connection instproc STATUS {ctx} { +# my instvar socket +# ::puts stderr "*** $ctx: $socket blocking=[::fconfigure $socket -blocking]" +#} +Connection instproc destroy {} { ;# the destructor closes the socket + #my showCall + if {[my exists handle]} { + #my showVars handle + # the connection was created via make + [self class] removeHandle [my handle] + #::puts stderr "my CONNECTION close and destroy [my handle]" + } else { + #::puts stderr "my CONNECTION close and destroy" + } + # in cases of errors we might not have a socket yet + if {[my exists socket]} { + close [my socket] + } + next +} +Connection instproc translation {translation} { + #showCall + ::fconfigure [my socket] -translation $translation +} +Connection instproc importSSL args { + #my showCall + package require tls + eval tls::import [my socket] $args +} +Connection instproc fconfigure args { + #my showCall + eval ::fconfigure [my socket] $args +} +Connection instproc event {type r method} { + #my showCall + my instvar req blocked + # is the request in the argument list the currently active request? + if {[info exists req] && $r == $req} { + # a request can overwrite its active request + if {$method == ""} { + ::fileevent [my socket] $type "" + #my showMsg "CONNECTION clear for [my socket]" + } else { + #my showMsg "CONNECTION register for [my socket]" + ::fileevent [my socket] $type [list $r $method] + } + } else { + #my showMsg "event BLOCKING current request=$req, new=$r $method" + #my showMsg "event BLOCKING rd=[::fileevent [my socket] readable]" + #my showMsg "event BLOCKING wr=[::fileevent [my socket] writable]" + #my showMsg "event BLOCKING bl=$blocked" + ::lappend blocked $r $type $method + } +} +Connection instproc hold {} { + my set continueCmd [list ::fileevent [my socket] readable \ + [::fileevent [my socket] readable]] + ::fileevent $socket readable {} + #my showVars continueCmd +} +Connection instproc resume {} { + #my showCall + if {[my exists continueCmd]} { + eval [my set continueCmd] + my unset continueCmd + } +} + + + +Connection instproc puts {string} { + #my showCall + if {[catch {::puts [my socket] $string} msg]} { + ::puts stderr message=$msg + } +} +Connection instproc puts-nonewline {string} { + #my showCall + if {[catch {::puts -nonewline [my socket] $string} msg]} { + ::puts stderr message=$msg + } +} +Connection instproc gets {var} { + #my showCall + upvar [self callinglevel] $var result + if {[catch {set n [::gets [my socket] result]} msg]} { + my set error $msg + #my showMsg "CONNECTION error" + return 0 + } + #my showMsg "n=$n, result=<$result>" + return $n +} +Connection instproc read {} { + #my showCall + my instvar socket + if {[catch {set result [::read $socket [::fconfigure $socket -buffersize]]} msg]} { + my set error $msg + return "" + } + #my showMsg Done + return $result +} +Connection instproc readSize {length} { + if {[catch {set result [::read [my socket] $length]} msg]} { + my set error $msg + return 0 + } + return $result +} +Connection instproc flush {} { + #my showCall + if {[catch {::flush [my socket]} msg]} { + my set error $msg + } +} +Connection instproc eof {} { + #my showCall + if {[my exists error]} { + return 1 + } else { + return [::eof [my socket]] + } +} +Connection instproc close {} { + #my showCall + my instvar req socket blocked + if {![info exists socket]} return ;# error during connection open + ::fileevent $socket readable "" + ::fileevent $socket writable "" + $req freeConnection + if {[my exists persistent]} { + my flush + #::puts stderr "[self] PERSISTENT CONNECTION wanna close" + if {$blocked == ""} { + ::fileevent $socket readable [list [self] destroy] + unset req + } else { + #my showVars blocked + set req [lindex $blocked 0] + set type [lindex $blocked 1] + set method [lindex $blocked 2] + set blocked [lrange $blocked 3 end] + #my showMsg "in persistent connection unblock $type [list $req $method]" + ::fileevent $socket $type [list $req $method] + } + } else { + #my showMsg "in nonpersistent connection blocked=$blocked" + if {$blocked != ""} { + set req [lindex $blocked 0] + set type [lindex $blocked 1] + set method [lindex $blocked 2] + set nblocked [lrange $blocked 3 end] + close $socket + unset socket + if {[my exists handle]} { + [self class] removeHandle [my handle] + } + if {[my exists error]} { + #my showMsg "UNSETTING ERROR -----------" + my unset error + } + my init + set blocked $nblocked + ::fileevent $socket $type [list $req $method] + #my showMsg "REANIMATE $socket $type [list $req $method]" + #my showVars + } else { + #my showMsg "Nothing blocked: readable=[::fileevent $socket readable]" + + my destroy + } + } +} +Connection instproc makePersistent {p} { + if {$p} { + my set persistent 1 + } else { + if {[my exists persistent]} { + my unset persistent + #my showMsg "no longer persistent" + } + } +} + + +if {[info command bgerror] == ""} { + proc bgerror {msg} { puts stderr "******* bgerror $msg $::errorInfo*****"} +} + Index: xotcl/library/comm/Dav.xotcl =================================================================== diff -u --- xotcl/library/comm/Dav.xotcl (revision 0) +++ xotcl/library/comm/Dav.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,162 @@ +# $Id: Dav.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::comm::dav 0.9 + +Class Dav -superclass Http +Dav instproc initialize args { + my instvar contentType + #showCall + set contentType text/xml + next +} + +Dav instproc PROPFIND {} { + #showCall + # extra dav headers + # Depth: ("0" | "1" | "infinity") [infinity is the default] + + # body is a propfind XML-Element + # + # + # + # + + # this should be set by the clients + # + # + # + # + my open +} +Dav instproc PROPPATCH {} { + #showCall + # body is a propertyupdate XML-Element + # + # + # + + # set xmlReqBody($method) " + # + # + # + # + # + # + # " + my open +} +Dav instproc MKCOL {} { + #showCall + # invoked without a request body (may contain a message body?) + my open +} +Dav instproc GET {} { + #showCall + # invoked without a request body and without extra header + # back to HTTP class + next +} +Dav instproc HEAD {} { + #showCall + # invoked without a request bodyand without extra header + # back to HTTP class + next +} +Dav instproc POST {} { + #showCall + # the same as in RFC2068 + # back to HTTP class + next +} +Dav instproc DELETE {} { + #showCall + # extra dav headers + # Depth: ("0" | "1" | "infinity") + + # invoked without a request body + my open +} +Dav instproc PUT {} { + #showCall + # PUT for Non-Collection Resources --> RFC2068 + # PUT for Collections --> MKCOL + # next +} +Dav instproc COPY {} { + #showCall + # extra dav headers + # If: [see 9.4 WebDAV] + # Destination: [see RFC2396 for the definition of absolutURI] + # Depth: ("0" | "1" | "infinity") + # Overwrite: ("T" | "F") + + + # body is a propertybehavior XML-Element + # + # + # + # + my open +} +Dav instproc MOVE {} { + #showCall + # extra dav headers + # If: [see 9.4 WebDAV] + # Destination: [see RFC2396 for the definition of absolutURI] + # Depth: "infinity" [see 8.9.2] + # Overwrite: ("T" | "F") + + # body is a propertybehavior XML-Element + # see COPY + my open +} +Dav instproc LOCK {} { + #showCall + # extra dav headers + # If: [see 9.4 WebDAV] + # Destination: [see RFC2396 for the definition of absolutURI] + # Depth: ("0" | "1" | "infinity") + # Timeout: [see 9.8 WebDAV] + # Authorization: (defined in HTTP1.1 in 14.8) + + # body is a lockinfo XML-Element + # + # + # + # + # + # + # + my open +} + +# The Lock-Token request header is used with the UNLOCK method to +# identify the lock to be removed. +Dav instproc UNLOCK {} { + my instvar headers + #showCall + # extra dav headers + # Lock-Token: [see 8.11 in WebDAV] + + # invoked without a request body + my open +} + +#--------------------- +# Utility # +#--------------------- + +#? +Object xmlReqBodyManager +xmlReqBodyManager proc requireXmlReqBody {request} { +} + +#? +Object davHeaderManager +davHeaderManager proc requireDavHeader {request} { +} + + + +#LOCK /DAV/welcome.html HTTP/1.1 +#Host: wawog +#Connection: close Index: xotcl/library/comm/Ftp.xotcl =================================================================== diff -u --- xotcl/library/comm/Ftp.xotcl (revision 0) +++ xotcl/library/comm/Ftp.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,164 @@ +# $Id: Ftp.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::comm::ftp 0.9 +package require xotcl::comm::httpAccess + +Class Ftp -superclass NetAccess -parameter {user passwd} +Ftp instproc initialize args { + #my showCall + my instvar port caching user passwd loginMsg resp blocksize + set port 21 + set blocksize 1024 + set caching 0 + set user ftp + set passwd cineast@ + set loginMsg {} + set resp(connect) {220 provideUser} + set resp(provideUser) {331 providePasswd} + set resp(providePasswd) {230 loginFinished} + set resp(loginFinished) {227 pasv} + set resp(pasv) {200 type} + set resp(type-list) {150 list} + set resp(type-retr) {150 retr 550 retry-retrieve} + set resp(transfer) {226 transferDone} + next +} +Ftp instproc err {state reply} { + my abort "Error in $state: $reply" +} +Ftp instproc queryServer {query state} { + my instvar S + puts $S $query + flush $S + fileevent $S readable [::list [self] response $state] +} +Ftp instproc response {state} { + #my showCall + my instvar S code msg + set reply [gets $S] + #my showVars reply + if {[regexp {^([0-9]+)[-](.*)$} $reply _ code msg]} { + fileevent $S readable [::list [self] responseMulti $state] + } else { + regexp {^([0-9]+) (.*)$} $reply _ code msg + my responseEnd $state + } +} +Ftp instproc responseMulti {state} { + # multi line response + my instvar S code msg + set m [gets $S] + if {[regexp "^$code " $m]} { + my responseEnd $state + } else { + # try to strip code and dash + regexp "^$code-(.*)\$" $m _ m + append msg \n$m + } +} +Ftp instproc responseEnd {state} { + my instvar S code msg resp + fileevent $S readable {} + #puts stderr "code=$code, msg=<$msg>" + foreach {c newState} $resp($state) { + if {$c == $code} { return [my $newState] } + } + my err $state "expected=$resp($state), got $code $msg" +} +Ftp instproc GET {} { + my instvar S host port url + regexp {^(.*):([0-9]+)$} $host _ host port + my running + # rb running my $url ;# ??? + # proxy ? + set S [socket -async $host $port] + fconfigure $S -blocking false -translation {auto crlf} + fileevent $S readable [::list [self] response connect] +} +Ftp instproc provideUser {} { + my instvar user msg loginMsg + set loginMsg $msg + my queryServer "USER $user" provideUser +} +Ftp instproc providePasswd {} { + my instvar passwd +# if {[pwdManager requirePasswd "Ftp $user\@$host" $user password]} { +# my queryServer "PASS $password" providePasswd +# } + my queryServer "PASS $passwd" providePasswd +} +Ftp instproc loginFinished {} { + my instvar msg loginMsg + append loginMsg \n$msg + my queryServer "PASV" loginFinished +} +Ftp instproc pasv {} { + my instvar S D msg + set d {([0-9]+)} + if {[regexp "\[(]$d,$d,$d,$d,$d,$d" $msg _ 1 2 3 4 p1 p2]} { + if {[catch {set D [socket -async $1.$2.$3.$4 [expr {$p1*256 + $p2}]]} err + ]} { + return [my err $proc $err] + } + fconfigure $D -blocking no -translation binary + } else { + return [my err $proc $msg] + } + my queryServer "TYPE I" pasv +} +Ftp instproc type {} { + my instvar path + if {$path=={}} { + my queryServer "LIST" type-list + } elseif {[regexp /$ $path]} { + my queryServer "LIST $path" type-list + } else { + my queryServer "RETR $path" type-retr + } +} +Ftp instproc retry-retrieve {} { + my instvar path url + append url / + my queryServer "LIST $path/" type-list +} +Ftp instproc list {} { + my instvar S D contentType + set contentType text/dirlist + my headerDone + fileevent $S readable [::list [self] response transfer] + fileevent $D readable [::list [self] readData] +} +Ftp instproc read {} { + # the method read is called by the more general method readData + my instvar D block blocksize + if {[::eof $D]} { + set block "" + close $D + unset D + } else { + #puts stderr blocksize=$blocksize + set block [::read $D $blocksize] + #puts stderr read:[string length $block]bytes + } +} +Ftp instproc transferDone {} { + my instvar D S + if {[info exists D]} { + fileevent $S readable {} + set block "" + close $D + unset D + } + my finish +} +Ftp instproc retr {} { + my instvar S D msg totalsize contentType path + regexp {[(]([0-9]+)[ ]+[Bb]ytes} $msg _ totalsize + set contentType [Mime guessContentType $path] + my headerDone + if {[info exists S]} { + # file dialog was not canceled + fileevent $S readable [::list [self] response transfer] + fileevent $D readable [::list [self] readData] + fconfigure $D -translation binary + } +} Index: xotcl/library/comm/Httpd.xotcl =================================================================== diff -u --- xotcl/library/comm/Httpd.xotcl (revision 0) +++ xotcl/library/comm/Httpd.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,798 @@ +# -*- tcl -*- $Id: Httpd.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# +# The XOTcl class Httpd implements an HTTP/1.0 and HTTP/1.1 server with +# basic functionality. +# +# Gustaf Neumann (neumann@wu-wien.ac.at) + +set VERSION 1.1 +package provide xotcl::comm::httpd $VERSION + +#package require xotcl::comm::httpAccess +package require xotcl::comm::mime +package require xotcl::comm::connection +package require xotcl::trace + +Class Httpd -parameter { + {port 80} + ipaddr + {root ./} + {logdir $::xotcl::logdir} + {httpdWrk Httpd::Wrk} + {redirects [list]} + {workerTimeout 10000} +} +Httpd proc Date seconds {clock format $seconds -format {%a, %d %b %Y %T %Z}} +Httpd instproc checkRoot {} { + my instvar root + set root [string trimright $root /] + if {![file isdir $root]} { + puts stderr "Warning: create root directory '$root'" + file mkdir $root + } + # make directory absolute + set currentdir [pwd] + cd $root + set root [pwd] + #puts stderr "[self] root=$root" + cd $currentdir +} +Httpd instproc init args { + my instvar port logdir logfile redirects + if {![my exists workerMixins]} { + my set workerMixins {} + #puts stderr "resetting workermixins of [self]" + } + next + set proto [string trim [my info class] :d] + puts stderr "Starting XOTcl [string toupper $proto] server $::VERSION\ + [string tolower $proto]://[info hostname]:$port/" + + # Start a server by listening on the port + if {[my exists ipaddr]} {set ip "-myaddr [my set ipaddr]"} {set ip ""} + my set listen [eval [list socket -server [list [self] accept]] $ip $port] + #my set listen [socket -server [list [self] accept] $port] + + my checkRoot + if {![file isdir $logdir]} {file mkdir $logdir} + set logfile [open $logdir/serverlog-$port a+] + my array set requiresBody \ + {GET 0 HEAD 0 POST 1 PUT 1 DELETE 0 OPTIONS 0 TRACE 0} +} +Httpd instproc destroy {} { # destructor + catch {close [my set listen]} + catch {close [my set logfile]} + next +} +Httpd instproc accept {socket ipaddr port} { # Accept a new connection and set up a handler + #puts stderr "using workermixins of [self] {[my set workerMixins]}" + [my set httpdWrk] new -childof [self] -socket $socket -ipaddr $ipaddr \ + -port $port -mixin [my set workerMixins] +} +Httpd instproc redirect list { + foreach {pattern hostport} $list { + my lappend redirects $pattern $hostport + } +} + + +Class Httpd::Wrk -parameter {socket port ipaddr} +Httpd::Wrk array set codes { + 200 {Data follows} 201 {Created} 204 {No Content} + 302 {Moved Temporarily} 304 {Not Modified} + 400 {Bad Request} 401 {Unauthorized} 402 {Payment Required} + 403 {Forbidden} 404 {Not Found} 405 {Method Not Allowed} + 406 {Not Acceptable} 408 {Request Timeout} 411 {Length Required} + 500 {Internal Server Error} 503 {Service Unavailable} 504 {Service Temporarily Unavailable} +} +Httpd::Wrk instproc formData {} {my set formData} +Httpd::Wrk instproc init args { # Constructor + my instvar socket port ipaddr + my set formData [list] + my set replyHeaderFields [list] + next + my makeConnection $socket + my log Connect "$ipaddr $port" + my connection translation {auto crlf} + my connection event readable [self] firstLine +} +Httpd::Wrk instproc makeConnection {socket} { + Connection create [self]::connection -socket $socket -req [self] +} +Httpd::Wrk instproc close {} { # logical close of a single request + #my showCall + my instvar version timeout meta + set eof [my connection eof] + if {$version > 1.0 && !$eof} { + #my showMsg "!EOF in http/$version" + my connection flush + set timeout [after [[my info parent] workerTimeout] [self] destroy] + ### reset parameters, worker will be potentially reused + if {[array exists meta]} { + unset meta + array set meta {} + } + unset version + if {[my exists user]} { + my unset user + my unset realm + } + foreach c [my set formData] { $c destroy } + my set replyHeaderFields [list] + my set formData {} + #my showVars + my connection translation {auto crlf} + my connection event readable [self] firstLine + } elseif {$eof} { + #my showMsg "Destroy in http/$version" + # the client side has closed the connection + my destroy + } else { + #my showMsg "!EOF in http/$version ???" + # we close the conneciton actively (e.g. forced by an error) + my connection flush + #puts stderr "DESTROY----this line should never show up" + my destroy + } +} +Httpd::Wrk instproc destroy {} { + #my showCall + if {[my isobject [self]::connection]} { + my connection close + } + next +} +Httpd::Wrk instproc freeConnection {} { +} +Httpd::Wrk instproc firstLine {} { # Read the first line of the request + #my showCall + my instvar method resourceName hasFormData query fileName \ + version timeout + if {[info exists timeout]} { + after cancel $timeout + unset timeout + } + my lappend replyHeaderFields Date [Httpd Date [clock seconds]] + set n [my connection gets firstLine] + if {$n > 0} { + #::puts stderr "[self] firstline=<$firstLine>" + # parse request line, ignore HTTP version for now + if {[regexp {^(POST|GET|PUT|HEAD|OPTIONS) ([^?]+)(\??)([^ ]*) *HTTP/(.*)$} \ + $firstLine _ method resourceName hasFormData query version]} { + set resourceName [string trimright [string trimleft $resourceName ./] " "] + # construct filename + [my info parent] instvar root + set fileName $root/[url decodeName $resourceName] + #puts stderr ---[encoding convertfrom utf-8 $fileName]---- + set fileName [encoding convertfrom utf-8 $fileName] + # + my decode-formData $query + my log Query $firstLine + if {[my exists forceVersion1.0]} { + set version 1.0 + } + my connection makePersistent [expr {$version > 1.0}] + my connection event readable [self] header + } else { + set version 1.0 + set resourceName ??? + set method ??? + my log Error "bad first line:$firstLine" + my replyCode 400 + my replyErrorMsg + } + } elseif {![my connection eof]} { + #my showMsg "+++ not completed EOF=[my connection eof]" + } else { + set version 1.0 + #my showMsg "+++ n=negative ($n) EOF=[my connection eof] version set to 1.0" + my close + } +} +Httpd::Wrk instproc header {} { # Read the header + #my showCall + my instvar method data + if {[my connection gets line] > 0} { + #puts stderr line=$line + if {[regexp -nocase {^([^:]+): *(.+)$} $line _ key value]} { + my set meta([string tolower $key]) $value + } + } else { + #puts stderr line-EMPTY + if {[my exists meta(content-length)] && [my set meta(content-length)]>0} { + #puts stderr "we have content-length [my set meta(content-length)]" + set data "" + my connection translation binary + my connection event readable [self] receive-body + } elseif {[my exists meta(content-type)] && + [regexp -nocase {multipart/form-data; *boundary=} \ + [my set meta(content-type)]]} { + #puts stderr "formdata" + set data "" + my connection event readable [self] receive-body + } else { + #puts stderr "no-content-length, triggering respond" + my connection event readable [self] "" + [my info parent] instvar requiresBody + if {$requiresBody($method)} { + my replyCode 411 + my replyErrorMsg + } else { + my check-redirect + } + } + } +} +Httpd::Wrk instproc receive-body {} { ;# ... now we have to read the body + #my showCall + my instvar method data meta + set d [my connection read] + if {[string length $d] > 0} { + append data $d + #my showMsg "datal=[string length $data], cl=$meta(content-length)" + if {[string length $data] >= $meta(content-length)} { + my connection event readable [self] "" + if {$method == "POST"} { my decode-POST-query } + my check-redirect + } + } else { ;# 0 byte, must be eof... + my showMsg "received 0 bytes" + my connection event readable [self] "" + if {[string length $data] < $meta(content-length)} { + my replyCode 404 + my replyErrorMsg + } else { + my check-redirect + } + } +} +Httpd::Wrk instproc unmodified mtime { + my instvar meta + if {[info exists meta(if-modified-since)]} { + set ms $meta(if-modified-since) + regexp {^([^;]+);(.*)$} $ms _ ms options + if {[catch {set mss [clock scan $ms]}]} { + regsub -all -- {-} $ms " " ms + if {[catch {set mss [clock scan $ms]}]} { + set ms [lreplace $ms end end] + set mss [clock scan $ms] + } + } + return [expr {$mtime <= $mss}] + } + return 0 +} +Httpd::Wrk instproc check-redirect {} { + [my info parent] instvar redirects + my instvar resourceName hasFormData query + set resource $resourceName$hasFormData$query + foreach {pattern hostport} $redirects { + #puts stderr "match <$pattern> <$resource> [regexp $pattern $resource]" + if {[regexp $pattern $resource]} { + #puts stderr "do redirect to $hostport/$resource" + my replyCode 302 location $hostport/$resource + my replyErrorMsg + return + } + } + my respond +} +Httpd::Wrk instproc respond {} { # Respond to the query + # the request was read completely... This method is wellsuited for mixins! + my respond-[my set method] +} + +Httpd::Wrk instproc respond-GET {} { + #my showCall + my instvar fileName + my sendFile $fileName +} +Httpd::Wrk instproc respond-HEAD {} { # Respond to the query + my instvar fileName + if {[file readable $fileName]} { + my replyCode 200 \ + Last-Modified [Httpd Date [file mtime $fileName]] \ + Content-Type [Mime guessContentType $fileName] \ + Content-Length [file size $fileName] + my connection puts "" + #my log Done "$fileName [Mime guessContentType $fileName]" + my close + } else { + my replyCode 404 + my replyErrorMsg + } +} +Httpd::Wrk instproc respond-OPTIONS {} { # Respond to the query + my replyCode 200 \ + Allow "OPTIONS, GET, HEAD, POST" \ + Public "OPTIONS, GET, HEAD, POST" + my connection puts "" + my close +} +Httpd::Wrk instproc respond-PUT {} { + my instvar data method fileName + my replyCode [expr {[file writable $fileName] ? 200 : 201}] + my connection puts "" + set out [open $fileName w] + fconfigure $out -translation binary + puts -nonewline $out $data + my log Done "$fileName [Mime guessContentType $fileName]" + close $out + my close +} +Httpd::Wrk instproc respond-CGI {} { + my instvar fileName + if {[file executable $fileName]} { + my replyCode 200 + my connection puts [exec $fileName] ;# no parameter handling yet + my close + } else { + my replyCode 403 + my replyErrorMsg + } +} +Httpd::Wrk instproc new-formData {} { + set arg [Object create [self]::[my autoname formData]] + my lappend formData $arg + return $arg +} +Httpd::Wrk instproc decode-formData {query} { + #my showCall + foreach pair [split [string trimleft $query \n] &] { + set arg [my new-formData] + if {[regexp {^(.+)=(.*)$} $pair _ name content]} { + $arg set name [url decodeItem $name] + $arg set content [url decodeItem $content] + } else { + $arg set content [url decodeItem $pair] + } + } +} +Httpd::Wrk instproc decode-POST-query {} { + if {[my exists meta(content-type)]} { + set ct [my set meta(content-type)] + if {[regexp -nocase {application/x-www-form-urlencoded} $ct]} { + #my showMsg "ordinary FORM" + my decode-formData [my set data] + return + } elseif {[regexp -nocase {multipart/form-data; *boundary=(.*)$} $ct \ + _ boundary]} { + #my showMsg "multipart FORM" + set parts [my set data] + set bl [expr {[string length $boundary]+2}] + while {[set endIDX [string first --$boundary $parts]] > -1} { + set part [string range $parts $bl [expr {$endIDX-1}]] + if {[set endHD [string first \r\n\r\n $part]] > -1} { + set arg [my new-formData] + if {[catch {Mime multipart-decode-header \ + [string range $part 0 [expr {$endHD-1}]] \ + $arg} msg]} { + my replyCode 406 + my replyErrorMsg $msg + return 0 + } + $arg set content [string range $part \ + [expr {$endHD + 4}] \ + [expr {[string length $part] -3}]] + #$arg showVars + } + set parts [string range $parts [expr {$endIDX+2}] end] + } + } + } +} +Httpd::Wrk instproc respond-POST {} { + my replyCode 405 + my replyErrorMsg + #my respond-CGI +} + +Httpd::Wrk instproc replyErrorMsg {{msg ""} args} { + my instvar replyCode + [self class] instvar codes + foreach {tag value} $args {my connection puts "$tag: $value"} + my sendText "\nStatus Code: $replyCode\n\ + $msg

\n\ + Status Code $replyCode: $codes($replyCode)
\n\ + Resource Name: [my set resourceName]\n" + my close ;# close must be last call +} +Httpd::Wrk instproc replyCode {code args} { + #my showCall + my instvar version + [self class] instvar codes + my set replyCode $code + my connection puts "HTTP/$version $code $codes($code)" + foreach {tag value} [my set replyHeaderFields] {my connection puts "$tag: $value"} + foreach {tag value} $args {my connection puts "$tag: $value"} + if {$code >= 400} { + my log Error "$code $codes($code)\tmeta: [my array get meta]" + } else { + my log Done "$code $codes($code)" + } +} +Httpd::Wrk instproc sendText {response {type text/html}} { + #my showCall + my connection puts "Content-Type: $type" + # bei einer leeren Responses blockieren Klienten und melden Fehler + if {$response == ""} { set response " " } + my connection puts "Content-Length: [string length $response]\n" + if {[my set method] != "HEAD"} { + my connection fconfigure -translation {auto binary} + my connection puts-nonewline $response + } else { + my showMsg HEAD! + } +} +Httpd::Wrk instproc sendMsg {response {type text/html}} { + # my showCall + my replyCode 200 + my sendText $response $type + my close +} +Httpd::Wrk instproc sendDir {dirName} { + [my info parent] instvar root + set title "Directory listing" + set reply "$title

$title

\n\n" + set oldpwd [pwd] + cd $root + set dirs ""; set files "" + foreach f [lsort -dictionary [glob -nocomplain ./$dirName/*]] { + set full [file join $root $f] + set pname [string trimleft $f ./] + if {[file isdir $full]} { + append pname / + } + if {![catch {set size [file size $full]}]} { + # it is not a broken link + set entry "" + append entry \ + \ + " \ + " \ + \n + if {[string match */ $pname]} {append dirs $entry} else {append files $entry} + } + } + append reply $dirs $files "
"$pname" " $size " [clock format [file mtime $full]]
\n" + cd $oldpwd + my sendMsg $reply + return +} + +Httpd::Wrk instproc sendFile {fn {type ""}} { + #my showCall + if {[file isdirectory $fn]} { + set full [file join $fn index.html] + if {[file readable $full]} { + set fn $full + } else { + my sendDir [my set resourceName] + return + } + } + #puts stderr "readable '$fn' [file readable $fn]" + if {[file readable $fn]} { + set mtime [file mtime $fn] + if {[my unmodified $mtime]} { + my replyCode 304 + my replyErrorMsg + return + } + if {$type == ""} {set type [Mime guessContentType $fn]} + my replyCode 200 \ + Last-Modified [Httpd Date $mtime] \ + Content-Type $type \ + Content-Length [file size $fn] + my connection puts "" + my connection fconfigure -translation binary ;#-buffersize 65536 + set localFile [open $fn] + fconfigure $localFile -translation binary -buffersize 65536 + fcopy $localFile [my connection set socket] \ + -command [list [self] fcopy-end $localFile] + } else { + my replyCode 404 + my replyErrorMsg + } +} +Httpd::Wrk instproc fcopy-end {localFile args} { # End of fcopy + close $localFile + my connection fconfigure -blocking false ;# fconfigure changes blocking in 8.3.2! + my close +} +Httpd::Wrk instproc log {reason arg} { # trivial logging + my instvar port ipaddr + if {[my exists user]} { + set user [my set user]/[my set realm] + } {set user -} + [my info parent] instvar logfile + puts $logfile "[clock format [clock seconds]] $user $ipaddr:$port\t$reason\t$arg" + flush $logfile +} + + +######################################################################### +Class Httpsd -superclass Httpd -parameter { + {port 443} + {httpdWrk Httpsd::Wrk} + {requestCert 0} + {requireValidCert 0} + {certfile filename.crt} + {keyfile filename.key} + {cafile cacert.pem} + {infoCb {}} +} +Httpsd instproc init args { + package require tls + proc tls::password {} { + puts stderr "getting passwd" + return pemp + } + next +} + +Class Httpsd::Wrk -superclass Httpd::Wrk +Httpsd::Wrk instproc firstLine {} { + my set forceVersion1.0 1 + my lappend replyHeaderFields Connection close + next +} +Httpsd::Wrk instproc makeConnection {socket} { + Connection create [self]::connection -socket $socket -req [self] + [my info parent] instvar \ + keyfile certfile cafile infoCb requestCert requireValidCert + # SSL-enable a regular Tcl channel - it need not be a socket, but + # must provide bi-directional flow. Also setting session parameters + # for SSL handshake. www.sensus.org/tcl/tls.htm + + # -request bool --> Request a certificate from peer during SSL + # handshake. (default: true) + + # -require bool --> Require a valid certificate from peer during SSL + # handshake. If this is set to true then -request must also be set + # to true. (default: false) + + # -server bool --> Handshake as server if true, else handshake as + # client.(default: false) + my connection importSSL -server 1 \ + -certfile $certfile \ + -keyfile $keyfile \ + -cafile $cafile \ + -request $requestCert \ + -require $requireValidCert \ + -command $infoCb +} +######################################################################### + + + +### +### Mixin-Classes for respond patterns +### mixes into Http and Httpd::Wrk +### +Class Responder +Responder instproc init args { + next + my lappend workerMixins Responder::Wrk + my set respondpatterns {} + # Example how to register new methods: regexp is matched with the triple + # (HTTP-METHOD URL HASFORMDATA) where HASFORMDATA is empty when no + # parameters are given. The parsed components of the url etc. are + # available as instvars + my actions {^GET cgi[-]bin [?]} respond-CGI +} +Responder instproc actions {regexp method} { + my lappend respondpatterns $regexp $method +} +Class Responder::Wrk +Responder::Wrk instproc respond {} { + my instvar fileName method resourceName hasFormData + [my info parent] instvar respondpatterns + ### auch das ist ein kandidat fuer eine chain of responsibility + foreach {pattern action} $respondpatterns { + if {[regexp $pattern "$method $resourceName $hasFormData"]} { + my $action + return + } + } + next +} + +### +### Mixin-Classes for Access Control +### mixes into Http and Httpd::Wrk +### +Class AccessControl +AccessControl abstract instproc protectedResource {fn method varAuthMethod varRealm} +AccessControl abstract instproc credentialsNotOk {wrk credentials authMethod realm} +AccessControl abstract instproc addRealmFile {realm authFile} +AccessControl abstract instproc addRealmEntry {realm passwds} +AccessControl abstract instproc protectDir {realm path methods} + +Class AccessControl::Wrk +AccessControl::Wrk instproc respond {} { + my instvar fileName method digestChallengeData + set controller [my info parent] + if {[$controller protectedResource $fileName $method authMethod realm]} { + #my showMsg "*** Protected resource: $fileName $method" + if {![my exists meta(authorization)] || + [$controller credentialsNotOk [self] \ + [my set meta(authorization)] $authMethod $realm]} { + my unauthorizedAccess $realm + return + } + } + next +} + +########################################################################### +## Basic Access Control +########################################################################### +Class BasicAccessControl -superclass AccessControl + +BasicAccessControl instproc initWorkerMixins {} { + my lappend workerMixins [self class]::Wrk +} + +BasicAccessControl instproc init args { + next + my initWorkerMixins +} + +BasicAccessControl instproc protectedResource {fn method varAuthMethod varRealm} { + #my showCall + # check whether access to $fn via $method is protected + upvar [self callinglevel] $varAuthMethod authMethod $varRealm realm + # we check only the current directory, not the parent directories + if {[string match */ $fn]} { + set path $fn + } else { + set path [file dirname $fn]/ + } + foreach i [list $path $path:$method] { + if {[my exists protected($i)]} { + set realm [my set protected($i)] + set authMethod Basic + return 1 + } + } + return 0 +} + +BasicAccessControl instproc credentialsNotOk {wrk credentials authMethod realm} { + # check whether $credentials are sufficient for $realm + regexp {^(.*):(.*)$} [base64 decode [lindex $credentials 1]] _ user pwd + #puts stderr "passwd($realm:$user)=[my exists passwd($realm:$user)]" + $wrk set user $user + $wrk set realm $realm + if {[my exists passwd($realm:$user)]} { + return [expr {[my set passwd($realm:$user)] != $pwd}] + } + return 1 +} + +BasicAccessControl instproc addRealmEntry {realm passwds} { + if {[llength $passwds] == 1} { + my addRealmFile [lindex $passwds 0] + } else { + foreach {name pwd} $passwds { + #puts stderr "realm='$realm' adding user: $name pw: $pwd" + my set passwd($realm:$name) $pwd + } + } +} +BasicAccessControl instproc addRealmFile {realm authFile} { + set FILE [open $authFile r] + while {![eof $FILE]} { + foreach {name pwd} [split [gets $FILE] :] { + my addRealmEntry $realm [list $name $pwd] + } + } + close $FILE +} + +BasicAccessControl instproc protectDir {realm path methods} { + my instvar root + my checkRoot + set resource $root/$path ;# resources are currently directories + if {$methods == {}} { + my set protected($resource) $realm ;#for every method + } else { + foreach m $methods { + my set protected($resource:$m) $realm ;#for selected methods + } + } +} +Class BasicAccessControl::Wrk -superclass AccessControl::Wrk +BasicAccessControl::Wrk instproc unauthorizedAccess {realm} { + my set digestChallengeData(realm) $realm + my replyCode 401 www-authenticate "Basic realm=\"$realm\"" + my replyErrorMsg "Unauthorized request for realm '$realm'" +} + + + +########################################################################### +## Digest Access Control +########################################################################### +Class DigestAccessControl -superclass BasicAccessControl +DigestAccessControl instproc init args { + package require tcu + next + my lappend workerMixins [self class]::Wrk +} +DigestAccessControl instproc credentialsNotOk {wrk credentials authMethod realm} { + # check whether $credentials are sufficient for $realm + my showMsg "Digest Authentication ..." + # HELP FD: hier muss ich noch �berpr�fen, ob die digest-header + # (credentials) ok sind. Hier habe ich probleme auf die sachen, + # die der worker gesendet (bspw. nonce) hat zu kommen. Ich + # wei�, man kann mit [my info children] daran kommen. Aber, + # was ist, wenn man mehrere Worker hat? + + ## Fredj, das sollte kein Problem sein: das credentialsNotOk wird + ## vom aktuellen worker (respond) aufgerufen. man kann dem *NotOk + ## den worker mitgeben, oder die beiden Methoden etwas umorganisieren. + return +} +Class DigestAccessControl::Wrk -superclass BasicAccessControl::Wrk +DigestAccessControl::Wrk instproc unauthorizedAccess {realm} { + my set digestChallengeData(realm) $realm + my replyCode 401 www-authenticate "Digest [my digestChallenge]" + my replyErrorMsg "Unauthorized request for realm '$realm'" +} +DigestAccessControl::Wrk instproc digestChallenge {} { + my showCall + my instvar digestChallengeData + my mkDigestChallengeData + set digestResponse {} + foreach {t v} [array get digestChallengeData] { + append digestResponse "$t = \"$v\", " + } + regsub {, $} $digestResponse {} digestResponse + return $digestResponse +} +DigestAccessControl::Wrk instproc mkDigestChallengeData {} { + my showCall + my instvar digestChallengeData + + # RFC 2617 + # challenge = "Digest" digest-challenge + # digest-challenge = 1#( realm | [ domain ] | nonce | + # [ opaque ] |[ stale ] | [ algorithm ] | + # [ qop-options ] | [auth-param] ) + # domain = "domain" "=" <"> URI ( 1*SP URI ) <"> + # URI = absoluteURI | abs_path + # nonce = "nonce" "=" nonce-value + # nonce-value = quoted-string + # opaque = "opaque" "=" quoted-string + # stale = "stale" "=" ( "true" | "false" ) + # algorithm = "algorithm" "=" ( "MD5" | "MD5-sess" | token ) + # qop-options = "qop" "=" <"> 1#qop-value <"> + # qop-value = "auth" | "auth-int" | token + + # FD: hier w�rde man die n�tigen parametern (nonce,domain,opaque, + # etc.) berechnen und in dem asso. Array speichern. + # FD: minimale Anforderung + set digestChallengeData(nonce) [my genNonce] + set digestChallengeData(opaque) [base64 encode [self]:my-self-spcified-string] + set digestChallengeData(algorithm) "MD5" ;#default + set digestChallengeData(qop) "auth" + set digestChallengeData(domain) [array names [my info parent]::protected] +} + +DigestAccessControl::Wrk instproc genNonce {} { + my showCall + my instvar digestChallengeData + set timeStamp [clock seconds] + set nonce [base64 encode [md5 $timeStamp:[self]]] + return $nonce +} + +#Httpd h1 -port 8081 -root [glob ~/wafe] +#Httpd h2 -port 9086 -root $root \ + -mixin {Responder BasicAccessControl} \ + -addRealmEntry test {test test} -protectDir test "" {} \ + -redirect {^(mailman|pipermail|cgi-bin) http://alice.wu-wien.ac.at:80} + + Index: xotcl/library/comm/Imap.xotcl =================================================================== diff -u --- xotcl/library/comm/Imap.xotcl (revision 0) +++ xotcl/library/comm/Imap.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,163 @@ +# $Id: Imap.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::comm::imap 0.9 + +Class Imap -superclass NetAccess -parameter {user} +Imap instproc initialize args { + my instvar port caching tokenCounter resp token + set port 143 + set caching 1 + set resp(connect) {"[*] OK" login} + set resp(login) {"A[0-9]+ OK" loginFinished "A[0-9]+ NO" login} + set resp(loginFinished) {"[*] [0-9]+" inboxSize "[*] OK" inboxSelected} + set resp(mailSelected) {"[*] [0-9]+ FETCH" fetchBody + "A[0-9]+ OK " ignoreLine + "[*] " ignoreLine} + set resp(heads) {"[*] [0-9]+ FETCH" fetchHeaders + "A[0-9]+ OK " ignoreLine + "[*] " ignoreLine} + set tokenCounter 0 + next + set token NONE +} +Imap instproc err {state reply} { + my abort "Error in $state: $reply" +} +Imap instproc token {} { + my instvar tokenCounter + return [format {A%.4d} [incr tokenCounter]] +} +Imap instproc imapString {input} { + regsub -all {(["\])} $input {\\\1} output ;#" + return \"$output\" +} +Imap instproc queryServer {query state} { + #my showCall + my instvar S token + set token [my token] + puts $S "$token $query" + #puts stderr "$token $query" + flush $S + fileevent $S readable [list [self] response $state] +} +Imap instproc response {state} { + my instvar S resp msg token + set msg [gets $S] + #my showVars msg token + foreach {c newState} $resp($state) { + if {![regexp {^[*]} $msg] && ![regexp ^$token $msg]} { + my showMsg "$state: token=$token IGNORING $msg" + return + } + if {[regexp ^$c $msg]} { + #my showMsg "$state NEWSTATE $newState" + return [my $newState] + } + } + my err $state "expected=$resp($state), got $msg" +} +Imap instproc GET {} { + my instvar state S path host port user inbox mailNr + # number at end of path is the message number in the mailbox + if {[regexp {^([^/]+)/([^/]+)/([0-9]+)$} $path _ user inbox mailNr]} { + } elseif {[regexp {^([^/]+)/([^/]+)/?$} $path _ user inbox]} { + } else { + my abort "invalid imap path $path" + } + regexp {^(.*):([0-9]+)$} $host _ host port + # proxy ? + if {[catch {set S [socket -async $host $port]} err]} { + my abort "Could not open connection to host '$host:$port'\n $err" + } else { + fconfigure $S -blocking false + fileevent $S readable [list [self] response connect] + } +} +Imap instproc login {} { + my instvar user host password + if {[pwdManager requirePasswd "Imap $user\@$host" $user password]} { + my queryServer "login $user [my imapString $password]" login + } else { + what now? + } +} +Imap instproc loginFinished {} { + my instvar user host password inbox + pwdManager storePasswd "Imap $user\@$host" $user $password + my queryServer "select $inbox" loginFinished +} +Imap instproc inboxSize {} { + my instvar msg nrMails + regexp {^[*] ([0-9]+) EXISTS} $msg _ nrMails +} +Imap instproc inboxSelected {} { + my instvar msg contentType nrMails mailNr + if {[info exists mailNr]} { + set contentType text/plain + my body-state + my queryServer "fetch $mailNr rfc822" mailSelected + } else { + my instvar header inbox block host user block + set contentType text/html + my body-state + set what "Mailbox $inbox of $user@$host" + set block "$what\n" + append block "

$what

\n" \ + "The following $nrMails messages are in this mailbox:" \ + "

\n

\n" + my pushBlock + my set state 4 + my finish + } + } +} Index: xotcl/library/comm/Ldap.xotcl =================================================================== diff -u --- xotcl/library/comm/Ldap.xotcl (revision 0) +++ xotcl/library/comm/Ldap.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,131 @@ +package provide xotcl::comm::ldap 0.9 + +requireModules { ldapOpen ldaplibGen.so } + +Class Ldap -superclass NetAccess -parameter {host port dn attributes scope filter} +Ldap instproc initialize args { + my instvar port mapToC useCache + my set port 389 + my set useCache 0 + set mapToC(one) onelevel + set mapToC(sub) subtree + set mapToC(base) base + next +} +Ldap proc urlDecode string { + set toParse $string + set parsed "" + while {1} { + if {[regexp {^([^%]*)%(..)(.*)$} $toParse _ front hex toParse]} { + append parsed $front [binary format c 0x$hex] + } else { + append parsed $toParse + break + } + } + return $parsed +} +Ldap instproc getUrlcomponents {} { + showCall + my instvar path dn attributes scope filter url + set path [Ldap urlDecode $path] + puts stderr "___ path=<$path>" + if {[regexp -nocase {^/([^?]*)(\?([^?]*)(\?([^?]*)(\?([^?]*))?)?)?$} \ + $path _ dn a attributes s scope f filter]} { + if {![string compare "" $scope]} { set scope "base" } + if {![string compare "" $filter]} { set filter "(objectClass=*)" } + } else { + set errmsg "*** Ldap Url trail=<$path> does not match!\n" + append errmsg "___ RFC 1959 says:\n" + append errmsg " ldap://:/\[?\[??\]\]\n" + append errmsg "___ Cineast and Netscape uses:\n" + append errmsg " ldap://:/\[?\[?\[?\]\]\]" + my abort "Unsupported URL: '$url' \n $errmsg" + } +} +Ldap instproc GET {} { + my instvar contentType totalsize state currentsize informObjects block + showCall + set contentType text/html + my getUrlcomponents + if {[string compare start $state]} { + puts stderr "... [self]:$proc ignoring request in state $state" + return + } + my open + my search + my body-state + set totalsize [string length $block] + set currentsize $totalsize + foreach obj $informObjects { + $obj incCb [self] $totalsize $currentsize + } + my eof +} +Ldap instproc open {} { + showCall + my instvar port host ldapHandle + set ldapHandle [ldapOpen $host $port] +} +Ldap instproc bind {} { + my instvar ldapHandle + showCall +} +Ldap instproc search {} { + showVars + my instvar url ldapHandle searchHandle dn attributes scope filter results mapToC path + set searchHandle [ldapSearch $ldapHandle $dn \ + $mapToC($scope) $filter [split $attributes ,] false results] + set nentries [ldapCountEntries $ldapHandle $searchHandle] + puts stderr "*** nentries = $nentries" + if {!$nentries} {set results ""} + my response +} +Ldap instproc getAttrs {dn} { +} +Ldap instproc makeUrl {dn} { + showCall + my instvar port host scope filter attributes + set tmpUrl ldap://$host:$port/$dn?$attributes?$scope?$filter + return "$dn" +} +Ldap instproc response {} { + showCall + my instvar block results attrsVals ldapHandle searchHandle + set block " + + LDAP searching result!! + +

Result

\n
    \n" + foreach {resDN} $results { + append block "
  • [my makeUrl $resDN]

    \n

      \n" + ldapAttributes $ldapHandle $searchHandle $resDN attrsVals + foreach {a v} [array get attrsVals] { + append block "
    • $a = $v

      \n" + } + append block "

    \n" + } + append block "
\n \n" +} + +# destructor: Close Connection to LDAP-Server and unbind +Ldap instproc destroy {} { + showCall + my instvar ldapHandle + if {[catch {ldapUnbind $ldapHandle} error]} { + return $error + } + my freeSearchHandle +} +Ldap instproc close {} { + showCall + my destroy + next +} +Ldap instproc freeSearchHandle {} { + showCall + my instvar searchHandle + if {[info exists searchHandle]} { + ldapFreeSearch $searchHandle + } +} Index: xotcl/library/comm/Mime.xotcl =================================================================== diff -u --- xotcl/library/comm/Mime.xotcl (revision 0) +++ xotcl/library/comm/Mime.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,262 @@ +# $Id: Mime.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::comm::mime 0.9 + +####################################################################### +Class MimeTypeLoader +MimeTypeLoader instproc loadMimeTypes {file} { + if {![file exists $file]} return + + puts stderr "Loading Mime types from $file" + set f [open $file r] + set content [read $f] + close $f + regsub -all "\\\\ *\n" $content " " content + foreach line [split $content \n] { + set line [string trim $line] + if {[regexp ^\# $line]} continue + if {$line == ""} continue + regsub -all " +" $line " " line + #puts stderr <$line> + while {$line != ""} { + if {[regexp {^ *([^ ]+)=\"([^\"]+)\" *(.*)$} $line _ key value line]} { + set v([string tolower $key]) $value + } elseif {[regexp {^ *([^ ]+)=([^ ]+) *(.*)$} $line _ key value line]} { + set v([string tolower $key]) $value + } else { + set tokens [split $line] + if {![regexp / [lindex $line 0]]} { + puts stderr "Mime: cannot parse line '$line' in $file" + } else { + set v(exts) [join [lrange $tokens 1 end] ,] + set v(type) [lindex $tokens 0] + } + break + } + } + if {[info exists v(exts)] && [info exists v(type)]} { + set v(exts) [string tolower $v(exts)] + set v(type) [string tolower $v(type)] + foreach ext [split $v(exts) ,] { + set ext [string trimleft $ext .] + #puts stderr "ext '$ext', contentType = '$v(type)'" + my set extTable($ext) $v(type) + } + unset v(exts) v(type) + } else { + puts stderr "invalid mime entry in $file" + } + } +} +MimeTypeLoader instproc guessContentType {name} { + my loadMimeTypes ~/.mime.types + my mixin {} + return [next] +} + +Class MIME +MIME instproc guessContentType {name} { + my instvar extTable nameTable + if {[regexp {\.([a-zA-Z0-9]+)$} $name _ ext]} { + catch {set contentType $extTable([string tolower $ext])} + } + if {![info exists contentType]} { + foreach namePattern [array names nameTable] { + if {[regexp $namePattern $name]} { + set contentType text/plain + break + } + } + } + if {![info exists contentType]} { + set contentType unknown/unknown + } + return $contentType +} +MIME instproc multipart-decode-header {header obj} { + $obj instvar name filename contentType + foreach line [split $header \r] { + set line [string trim $line \n] + #puts stderr line=$line + if {[regexp -nocase {^Content-Disposition: *([^;]+);(.*)$} $line _ \ + dispo detail]} { + if {$dispo != "form-data"} { + error "Unknown Content Disposition '$line'" + } + if {![regexp -nocase { name *= *"([^\"]+)"} $line _ name]} { + error "can't parse form-data name '$line'" + } + regexp -nocase {filename *= *"([^\"]+)"} $line _ filename + } elseif {[regexp -nocase {^Content-Type: *([^; ]+)} $line _ contentType]} { + } else { + my showMsg "ignoring '$line'" + } + } +} + +MIME Mime -mixin MimeTypeLoader +Mime array set nameTable { + README text/plain +} +Mime array set extTable { + gif image/gif + xpm image/x-xpixmap + xbm image/x-xbitmap + jpg image/jpeg + png image/x-png + html text/html + htm text/html + xml text/xml + css text/css + ps application/postscript + pdf application/pdf + doc application/msword + xls application/msexel +} + + +################################################################## +Class FormData +FormData instproc encode list {;#RFC 1867 + my showCall +} +FormData formData +################################################################## +Class Base64 +Base64 instproc init args { + my instvar base64 base64_en + # Emit base64 encoding for a string + set i 0 + foreach char {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \ + a b c d e f g h i j k l m n o p q r s t u v w x y z \ + 0 1 2 3 4 5 6 7 8 9 + /} { + set base64($char) $i + set base64_en($i) $char + incr i + } + next +} +Base64 instproc encode string { + my instvar base64_en + set result {} + set length 0 + foreach {a b c} [split $string {}] { + scan $a %c x + if {$c != ""} { + scan $b %c y + scan $c %c z + append result \ + $base64_en([expr {($x>>2) & 0x3F}]) \ + $base64_en([expr {(($x<<4) & 0x30) | (($y>>4) & 0xF)}]) \ + $base64_en([expr {(($y<<2) & 0x3C) | (($z>>6) & 0x3)}]) \ + $base64_en([expr {$z & 0x3F}]) + } elseif {$b != ""} { + scan $b %c y + append result \ + $base64_en([expr {($x>>2) & 0x3F}]) \ + $base64_en([expr {(($x<<4) & 0x30) | (($y>>4) & 0xF)}]) \ + $base64_en([expr {($y<<2) & 0x3C}]) \ + = + } else { + append result \ + $base64_en([expr {($x>>2) & 0x3F}]) \ + $base64_en([expr {($x<<4) & 0x30}]) \ + == + } + if {[incr length 4] >= 72} { + append result \n + set length 0 + } + } + return $result +} +Base64 instproc decode string { + my instvar base64 + set output {} + set group 0 + set j 18 + foreach char [split $string {}] { + if {$char != "="} { + set group [expr {$group | ($base64($char) << $j)}] + if {[incr j -6] < 0} { + scan [format %06x $group] %2x%2x%2x a b c + append output [format %c%c%c $a $b $c] + set group 0 + set j 18 + } + } else { + scan [format %04x $group] %2x%2x a b + if {$j==6} { + append output [format %c $a] + } else { + append output [format %c%c $a $b] + } + break + } + } + return $output +} +Base64 base64 +################################################################## +Class Url +Url instproc encode list { + set result "" + set sep "" + foreach i $list { + append result $sep [my encodeItem $i] + if {$sep != "="} { + set sep = + } else { + set sep & + } + } + return $result +} +Url instproc encodeItem string { + my instvar httpFormMap + set alphanumeric a-zA-Z0-9. + if {![info exists httpFormMap]} { + for {set i 1} {$i <= 256} {incr i} { + set c [format %c $i] + if {![string match \[$alphanumeric\] $c]} { + set httpFormMap($c) %[format %.2x $i] + } + } + # these are handled specially + array set httpFormMap { " " + \n %0d%0a } + } + regsub -all \[^$alphanumeric\] $string {$httpFormMap(&)} string + regsub -all \n $string {\\n} string + regsub -all \t $string {\\t} string + regsub -all {[][{})\\]\)} $string {\\&} string + return [subst $string] +} +Url instproc hexToChar hex { + ::scan $hex %x h + #my showMsg "::scan $hex %x h -> $h" + format %c $h +} +Url instproc decodeItem string { + #my showCall + set result "" + regsub -all {\+} $string " " string + regsub -all {%0d%0a} $string "\n" string + regsub -all {%([a-fA-F0-9][a-fA-F0-9])} $string {[my hexToChar \1]} string + return [subst -novariables -nobackslashes $string] +} +Url instproc decodeName string { + #my showCall + set result "" + regsub -all {%0d%0a} $string "\n" string + regsub -all {%([a-fA-F0-9][a-fA-F0-9])} $string {[my hexToChar \1]} string + return [subst -novariables -nobackslashes $string] +} +Url instproc decode string { + #my showCall + set result "" + foreach i [split $string &=] { + lappend result [decodeItem $i] + } + #my showVars result + return $result +} +Url url Index: xotcl/library/comm/PCache.xotcl =================================================================== diff -u --- xotcl/library/comm/PCache.xotcl (revision 0) +++ xotcl/library/comm/PCache.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,246 @@ +# -*- Tcl -*- $Id: PCache.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# Persistent Cache object, using gdbm + +# Configuration: +# The persistent cache is kept in a directory which is determined by +# the following three rules. +# +# 1) the global variable "CACHE_DIR", which has to be set, +# before this file is loaded +# 2) If "CACHE_DIR" is not set, the global variable "homedir" +# is checked, which is assumed to be the home directory +# of the Cineast browser +# 3) As a last resource the /tmp directory is used as the cache directory +# +# Additionally, the cache directory can be specified after loading of this +# file (before the first open) through the instance variable "dir" +# in the object persistentCache. + +package provide xotcl::comm::pcache 0.9 +#package require xotcl::package + +if {![info exists CACHE_DIR]} { + if {![info exists homeDir]} { + set homeDir /tmp + } + set CACHE_DIR $homeDir/cache2 +} + +Object persistentCache +persistentCache set dir $CACHE_DIR +persistentCache proc flush { {cmd {}} } { + my instvar DBID + if {[info exists DBID]} { $DBID close } + if {[string compare {} $cmd]} { + if {[catch {eval $cmd} err]} {puts stderr err=$err} + } + my open ;# UZ: wenn hier das self weggenommen wird, crashed das lintFilter + #open ;# UZ: wenn hier das self weggenommen wird, crashed das lintFilter + +} +# the open method for the first invocation +persistentCache proc open {} { + my instvar dir DBID + package require xotcl::store + set DBID [Storage someNewChildStore] + if {![file isdirectory $dir]} { + # if the cache directory does not exist, create it.. + file mkdir $dir + } + # the open method for later invocations, doing the real work + my proc open {} { + my instvar dir DBID + $DBID open $dir/index + } + # invoke the method + open +} +persistentCache proc clear {} { + my instvar cacheFileName contentType meta entry validated dir + my flush [list eval file delete -force $dir/index \ + [glob -nocomplain $dir/\[0-9\]*::*]] + foreach var {cacheFileName contentType meta entry validated} { + catch {unset $var} + } +} +persistentCache proc clearEntry {url} { + my instvar DBID cacheFileName contentType meta entry validated + my inCache $url + if {[info exists cacheFileName($url)]} { + my flush [list eval file delete -force $cacheFileName($url)] + foreach var {cacheFileName contentType meta entry validated} { + my showMsg "unset ${var}($url)" + catch {unset ${var}($url)} + } + catch {$DBID unset $url} + } +} +persistentCache proc lazyFlush {} { + my instvar flushPending + if {[info exists flushPending]} { after cancel $flushPending } + set flushPending [after 100 [self] flush] +} +persistentCache proc newEntry {url access doCache name} { + my instvar cacheFileName contentType meta dir + if {$name != ""} { + #$access set caching 0 + return $name + } elseif {$doCache} { + set cacheFileName($url) $dir/[pid]-$access + set contentType($url) [$access set contentType] + set meta($url) [$access set meta] + return $cacheFileName($url) + } else { + # we use the Memory cache only for non-persistent cache entries + # which are deleted when the program terminates + set fileName $dir/v[pid]-$access + MemoryCache + $url $fileName + return $fileName + } +} +persistentCache proc entryDone {url} { + my instvar entry cacheFileName contentType DBID meta + if {![info exists DBID]} { open } + $DBID set $url [list \ + cacheFileName $cacheFileName($url) \ + contentType $contentType($url) \ + meta $meta($url) ] + my lazyFlush + #my showMsg "size=[file size $cacheFileName($url)]" + set entry($url) 1 + my set validated($url) 1 +} +persistentCache proc inCache {url} { + my instvar entry + if {[info exists entry($url)]} { + set result 1 + } else { + my instvar cacheFileName contentType meta DBID + if {![info exists DBID]} { open } + set result [$DBID set $url] + my lazyFlush + if {[string compare "" $result]} { + set entry($url) 1 + array set r $result + set cacheFileName($url) $r(cacheFileName) + set contentType($url) $r(contentType) + set meta($url) $r(meta) + set result 1 + } else { + set result 0 + } + } + return $result +} +persistentCache proc validated {url} { + my set validated($url) 1 +} +persistentCache proc invalidate {url} { + if {[my exists validated($url)]} { + my unset validated($url) + } +} +persistentCache proc isValidated {url} { + if {[my exists validated($url)]} { + return 1 + } + return 0 +} +persistentCache proc ifModifiedHeader {url ifModVar} { + set result 0 + if {[my inCache $url]} { + #puts stderr inCache:$url + upvar [self callinglevel] $ifModVar ifModifiedHeader + my instvar meta + array set m $meta($url) + if {[info exists m(last-modified)]} { + set ifModifiedHeader [list If-Modified-Since $m(last-modified)] + set result 1 + } + } else { + #puts stderr "url=$url is not in cache" + } + return $result +} +persistentCache proc dump {} { + my instvar DBID + puts stderr DUMP: + foreach k [$DBID names] { + puts stderr $k + puts stderr " [$DBID set $k]" + } +} +persistentCache proc cacheFileName {url} { + my instvar cacheFileName + return $cacheFileName($url) +} +persistentCache proc contentType {url} { + my instvar contentType + return $contentType($url) +} +persistentCache proc meta {url} { + my instvar meta + return $meta($url) +} +persistentCache proc destroy {} { + #my showCall + next +} +#persistentCache flush + + + +########################################################### Cache +Object MemoryCache +MemoryCache proc query {url entry} { + my instvar cache + if {[info exists cache($url)]} { + upvar [self callinglevel] $entry e + #puts stderr "-->[self] [self proc] finds: $url" + set e $cache($url) + return 1 + } + return 0 +} +MemoryCache proc + {url entry} { + #puts stderr "-->[self class]:[self] [self proc] $url" + my set cache($url) $entry +} +MemoryCache proc - {url} { + #puts stderr "-->[self class]:[self] [self proc] $url" + catch {my unset cache($url)} +} +MemoryCache proc destroy {} { + my instvar cache + foreach url [array names cache] { + set f $cache($url) + if {[regexp ^/ $f]} { + #my showMsg "trying to remove $f [file exists $f]" + file delete -force $f + } + } + next +} + + +Object instproc allInstances {} { + # Diese Methode ermittelt rekursiv alle direkten und indirekten + # Instanzen einer Klasse + ::set inst [my info instances] + foreach s [my info subclass] { + foreach i [$s allInstances] { ::lappend inst $i } + } + return $inst +} + +# onExit is automatically called when wafe terminates +proc onExit {} { + #puts stderr "allinstances of Access: [Access allInstances]" + #foreach i [Access allInstances] { + # if {[info command $i] == ""} continue + # $i destroy + #} + #MemoryCache clear + persistentCache flush + #Trace statReport +} Index: xotcl/library/comm/pkgIndex.tcl =================================================================== diff -u --- xotcl/library/comm/pkgIndex.tcl (revision 0) +++ xotcl/library/comm/pkgIndex.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,19 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex -direct" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded xotcl::comm::connection 1.0 [list source [file join $dir Connection.xotcl]] +package ifneeded xotcl::comm::dav 0.9 [list source [file join $dir Dav.xotcl]] +package ifneeded xotcl::comm::ftp 0.9 [list source [file join $dir Ftp.xotcl]] +package ifneeded xotcl::comm::httpAccess 0.91 [list source [file join $dir Access.xotcl]] +package ifneeded xotcl::comm::httpd 1.1 [list source [file join $dir Httpd.xotcl]] +package ifneeded xotcl::comm::imap 0.9 [list source [file join $dir Imap.xotcl]] +package ifneeded xotcl::comm::ldap 0.9 [list source [file join $dir Ldap.xotcl]] +package ifneeded xotcl::comm::mime 0.9 [list source [file join $dir Mime.xotcl]] +package ifneeded xotcl::comm::pcache 0.9 [list source [file join $dir PCache.xotcl]] Index: xotcl/library/lib/COPYRIGHT =================================================================== diff -u --- xotcl/library/lib/COPYRIGHT (revision 0) +++ xotcl/library/lib/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/library/lib/Script.xotcl =================================================================== diff -u --- xotcl/library/lib/Script.xotcl (revision 0) +++ xotcl/library/lib/Script.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,30 @@ +#$Id: Script.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::script 0.9 + +@ @File {description { + A small package to instantiate an object, that + represents a script. + } +} +@ Class Script { + description { + An object of type Script becomes automatically the command + line arguments evaluated as "-" method calls during creation, e.g. + <@pre> + Script s -set r 5 + + and a call with cmd-line "-set v 6" of the script, results in an + object s with two vars set: r to 5, and v to 6. + } +} + + + +Class Script +Script proc create args { + eval lappend args $::argv + eval next $args +} +Script instproc unknown args { + puts stderr "$::argv0: Unknown option �-$args� provided" +} Index: xotcl/library/lib/changeXOTclVersion.xotcl =================================================================== diff -u --- xotcl/library/lib/changeXOTclVersion.xotcl (revision 0) +++ xotcl/library/lib/changeXOTclVersion.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,95 @@ +# +# this is a maintenance program for XOTcl that allows us to change the +# version information across the whole distribution automatically. +# +# this program assumes that pwd is in xotcl-full-X.X* directory or subdir +# +set XOTCL_MAJOR_VERSION 1 +set XOTCL_MINOR_VERSION 2 +set XOTCL_RELEASE_LEVEL .1 + +# example settings: +# 1.0 +#set XOTCL_MAJOR_VERSION 1 +#set XOTCL_MINOR_VERSION 0 +#set XOTCL_RELEASE_LEVEL .3 +# +# 0.9.3 +#set XOTCL_MAJOR_VERSION 0 +#set XOTCL_MINOR_VERSION 9 +#set XOTCL_RELEASE_LEVEL .3 + +#set XOTCL_MAJOR_VERSION 0 +#set XOTCL_MINOR_VERSION 9 +#set XOTCL_RELEASE_LEVEL .3 +#set XOTCL_RELEASE_LEVEL .4 +#set XOTCL_RELEASE_LEVEL .5 + + +set XOTCL_VERSION $XOTCL_MAJOR_VERSION.$XOTCL_MINOR_VERSION +set FULL_VERSION $XOTCL_VERSION$XOTCL_RELEASE_LEVEL + +if {![regexp {((^.*/xotcl-)([0-9.]*))/?} [pwd] _ topdirname topdirprefix oldversion]} { + error "this program assumes that pwd is in xotcl-X.X* directory" +} + +puts "Prior version is: $oldversion" +puts "New version is: $FULL_VERSION" +puts "Working in: $topdirname" + +cd $topdirname + +puts "... make clean first" +if {[file exists Makefile]} { + exec make clean +} + +foreach file [exec find . -name configure.in] { + puts "... updating $file" + set F [open $file]; set c [read $F]; close $F + set newFile "" + foreach line [split $c \n] { + set newLine $line + if {[regexp {^XOTCL_MAJOR_VERSION=[0-9]} $line]} { + set line "XOTCL_MAJOR_VERSION=$XOTCL_MAJOR_VERSION" + } elseif {[regexp {^XOTCL_MINOR_VERSION=[0-9]} $line]} { + set line "XOTCL_MINOR_VERSION=$XOTCL_MINOR_VERSION" + } elseif {[regexp {^XOTCL_RELEASE_LEVEL=} $line]} { + set line "XOTCL_RELEASE_LEVEL=$XOTCL_RELEASE_LEVEL" + } elseif {[regexp {^define\(XOTclVersion, .*$} $line]} { + set line "define(XOTclVersion, $XOTCL_MAJOR_VERSION.$XOTCL_MINOR_VERSION$XOTCL_RELEASE_LEVEL)" + } + append newFile $line\n + } + set F [open $file w]; puts $F $newFile; close $F +} + +set newtopdirname $topdirprefix$FULL_VERSION +if {$oldversion != $FULL_VERSION} { + puts "topdir: $topdirname->$newtopdirname" + file rename -force $topdirname $newtopdirname +} +cd $newtopdirname + +foreach file [exec find . -name configure.in] { + set dir [file dirname $file] + set oldpwd [pwd] + cd $dir + exec autoconf + cd $oldpwd +} + +# determine last configure command +cd $newtopdirname +if {[catch {set configurecmd [exec fgrep {$ ./configure} unix/config.log]}]} { + set configurecmd "./configure" +} else { + regsub {^ +\$ } $configurecmd "" configurecmd +} +#puts $configurecmd + +cd $newtopdirname/unix +puts "Configuring in [pwd]" +eval exec $configurecmd + +puts "ok ... version is now $FULL_VERSION" Index: xotcl/library/lib/htmllib.xotcl =================================================================== diff -u --- xotcl/library/lib/htmllib.xotcl (revision 0) +++ xotcl/library/lib/htmllib.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,671 @@ +## $Header: /home/neumann/cvs/xotcl/xotcl/library/lib/htmllib.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +# +# htmllib.xotcl +# +# Author: Antti Salonen, as@fishpool.fi +# +# Copyright: +# +# This software is copyrighted by Fishpool Creations Oy Ltd. The following +# terms apply to all files associated with the software unless explicitly +# disclaimed in individual files. +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# +# IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY +# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +# ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY +# DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE +# IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE +# NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +# MODIFICATIONS. +# + +package provide xotcl::htmllib 0.1 + +package require XOTcl + + +@ @File { + description { + This package provides the class HtmlBuilder, which can be used to + generate HTML documents, or a part of a document. + } + authors { + Antti Salonen, as@fishpool.fi + } + date { + $Date: 2004/05/23 22:50:39 $ + } +} + +# +# the compressed parameter means that minimal HTML page are created +# i.e. that space indentation is turned off +# +Class HtmlBuilder -parameter { + {compressed 0} +} + +## The constructor. +## +## The HtmlBuilder object has two instance variables. The document Tcl list +## contains the document as a list of strings. The document is stored as a list +## rather than a single string to allow further indentation of the whole +## document when necessary. +## The indentLevel variable is the level of indentation, which is generally +## increased for the contents of any HTML element that may contain block-level +## elements. Typical examples would be
    ,
  • , and so forth. + +HtmlBuilder instproc init {} { + my instvar document indentLevel + set document [list] + set indentLevel 0 + return +} + + +HtmlBuilder instproc clear {} { + my instvar document indentLevel + + set document [list] + set indentLevel 0 + return +} + + +HtmlBuilder instproc getDocument {} { + my instvar document + return $document +} + + +HtmlBuilder instproc toString {} { + my instvar document compressed + set rvalue "" + foreach line $document { + if {$compressed == "0"} { + append rvalue "$line\n" + } else { + ## only new line for closing tags at the beginnig + ## of a document element + if {[string equal -length 2 ", for +## example, is not required by the HTML specification, using the closing method +## is necessary to have the document properly indented. + + +# Add a string to the document within ... + +HtmlBuilder instproc addStringStrong {str} { + my addString "$str" + return +} + +# Add a string to the document within ... + +HtmlBuilder instproc addStringEmphasized {str} { + my addString "$str" + return +} + +# Add a comment to the document + +HtmlBuilder instproc addComment {str} { + my addString "" + return +} + +HtmlBuilder instproc addLineBreak {} { + my addString "
    " + return +} + +## startDocument - Start an HTML document. Currently all documents are HTML 4.0 +## Transitional. HTML, BODY, HEAD and TITLE elements are added/started here. +## Optional arguments: +## -title documentTitle (empty if not given) +## -stylesheet externalStyleSheet +## -bgcolor backgroundColour (deprecated in HTML 4.0) + +HtmlBuilder instproc startDocument {args} { + set title "" + foreach {name value} $args { + switch -- $name { + -title { + set title $value + } + -stylesheet { + set stylesheet $value + } + -bgcolor { + set bgcolor $value + } + } + } + my addString {} + my addWhiteSpace + my addString {} + my addStringIncr {} + my addString "$title" + if {[info exists stylesheet]} { + my addString "" + } + my addStringDecr {} + my addWhiteSpace + if {[info exists bgcolor]} { + my addStringIncr "" + } else { + my addStringIncr {} + } + return +} + +## endDocument - end an HTML document + +HtmlBuilder instproc endDocument {} { + my addStringDecr {} + my addString {} + return +} + +## startParagraph - start a P element +## Optional arguments: +## Common HTML arguments + +HtmlBuilder instproc startParagraph {args} { + set attributes [HtmlBuilder parseArguments $args [list] [list]] + my addStringIncr "" + return +} + +## endParagraph - end a P element + +HtmlBuilder instproc endParagraph {} { + my addStringDecr {

    } + return +} + +## startAnchor - start an A element +## Optional arguments: +## -href URI +## -name cdata +## -target frameTarget +## Common HTML arguments + +HtmlBuilder instproc startAnchor {args} { + set attributes [HtmlBuilder parseArguments $args \ + [list "HREF" "NAME" "TARGET"] [list]] + my addStringIncr "" + return +} + +## endAnchor - end an A element + +HtmlBuilder instproc endAnchor {args} { + my addStringDecr {} + return +} + +## addAnchor - add an A element, using content as the visible link. +## Optional arguments: +## -href URI +## -name cdata +## -target frameTarget +## Common HTML arguments + +HtmlBuilder instproc addAnchor {content args} { + eval my startAnchor $args + my addString $content + my endAnchor + return +} + +## startUnorderedList - start a UL element +## Optional arguments: +## Commmon HTML arguments + +HtmlBuilder instproc startUnorderedList {args} { + set attributes [HtmlBuilder parseArguments $args [list] [list]] + my addStringIncr "" + return +} + +## endUnorderedList - end a UL element + +HtmlBuilder instproc endUnorderedList {} { + my addStringDecr {
} + return +} + +## startListItem - start an LI element +## Optional arguments: +## Common HTML arguments + +HtmlBuilder instproc startListItem {args} { + set attributes [HtmlBuilder parseArguments $args [list] [list]] + my addStringIncr "" + return +} + +## endListItem - end an LI element + +HtmlBuilder instproc endListItem {} { + my addStringDecr {} + return +} + +## add a simple list item +HtmlBuilder instproc addListItem {content} { + my startListItem + my addString $content + my endListItem +} + +## startTable - start a TABLE element. Note that if the -border argument isn't +## used, by default the table are created with borders (). + +## Optional arguments: +## -border pixels +## -cellpadding length +## -cellspacing length +## -summary text +## -width length +## -bgcolor color spec +## Common HTML arguments + +HtmlBuilder instproc startTable {args} { + set attributes [HtmlBuilder parseArguments $args \ + [list "BORDER" "CELLPADDING" "CELLSPACING" "SUMMARY" \ + "WIDTH" "BGCOLOR"] [list]] + if {[lsearch $args "-border"] == -1} { + append attributes " BORDER" + } + my addStringIncr "" + return +} + +## endTable - end a TABLE element + +HtmlBuilder instproc endTable {} { + my addStringDecr {
} + return +} + +## startTableRow - start a TR element +## Optional arguments: +## Common HTML arguments +HtmlBuilder instproc startTableRow {args} { + set attributes [HtmlBuilder parseArguments $args [list "VALIGN"] [list]] + my addStringIncr "" + return +} + +## endTableRow - end a TR element + +HtmlBuilder instproc endTableRow {} { + my addStringDecr {} + return +} + +## startTableCell - start a TD element +## Optional arguments: +## -colspan number +## -rowspan number +## -align left|center|right|justify|char +## -valign top|middle|bottom|baseline +## -bgcolor +## -width +## Common HTML arguments + +HtmlBuilder instproc startTableCell {args} { + set attributes [HtmlBuilder parseArguments $args \ + [list "COLSPAN" "ROWSPAN" "ALIGN" "VALIGN" \ + "BGCOLOR" "WIDTH"] [list]] + my addStringIncr "" + return +} + +## endTableCell - end a TD element + +HtmlBuilder instproc endTableCell {} { + my addStringDecr {} + return +} + +# +# add a simple table cell which just contains a string +# +HtmlBuilder instproc addTableCell {{string ""} args} { + eval my startTableCell $args + my addString $string + my endTableCell +} + +## startTableHeaderCell - start a TH element +## Optional arguments: +## -colspan number +## -rowspan number +## -align left|center|right|justify|char +## -valign top|middle|bottom|baseline +## Common HTML arguments + +HtmlBuilder instproc startTableHeaderCell {args} { + set attributes [HtmlBuilder parseArguments $args \ + [list "COLSPAN" "ROWSPAN" "ALIGN" "VALIGN"] [list]] + my addStringIncr "" + return +} + +## endTableHeaderCell - end a TH element + +HtmlBuilder instproc endTableHeaderCell {} { + my addStringDecr {} + return +} + +## startForm - start a FORM element +## Required arguments: +## -action URI +## Optional arguments: +## -method get|post +## Common HTML arguments + +HtmlBuilder instproc startForm {args} { + set attributes [HtmlBuilder parseArguments $args \ + [list "ACTION" "METHOD" "ENCTYPE"] [list]] + my addStringIncr "" + return +} + +## endForm - end a FORM element + +HtmlBuilder instproc endForm {} { + my addStringDecr {} + return +} + +## addInput - add in INPUT element +## Required arguments: +## -type +## -name +## Optional arguments: +## -value +## -size +## -maxlength +## -checked +## Common HTML arguments + +HtmlBuilder instproc addInput {args} { + set attributes [HtmlBuilder parseArguments $args \ + [list "TYPE" "NAME" "VALUE" "SIZE" "MAXLENGTH"] \ + [list "CHECKED"]] + my addString "" + return +} + +## addTextArea - start a TEXTAREA element +## First parameter: value - Default value of the text area +## Required arguments: +## -rows +## -cols +## Optional arguments: +## -name +## Common HTML Arguments + +HtmlBuilder instproc addTextArea {value args} { + set attributes [HtmlBuilder parseArguments $args \ + [list "ROWS" "COLS" "NAME"] [list]] + my addString "$value" + return +} + +## startOptionSelector - start a SELECT element +## Optional arguments: +## -name +## -size +## -multiple +## Common HTML arguments + +HtmlBuilder instproc startOptionSelector {args} { + set attributes [HtmlBuilder parseArguments $args \ + [list "NAME" "SIZE"] [list "MULTIPLE"]] + my addStringIncr "" + return +} + +## endOptionSelector - end a SELECT element + +HtmlBuilder instproc endOptionSelector {} { + my addStringDecr "" + return +} + +## startOption - start an OPTION element +## Optional arguments: +## -value +## -selected +## Common HTML arguments + +HtmlBuilder instproc startOption {args} { + set attributes [HtmlBuilder parseArguments $args \ + [list "VALUE"] [list "SELECTED"]] + my addStringIncr "" + return +} + +## endOption - end an OPTION element + +HtmlBuilder instproc endOption {} { + my addStringDecr "" + return +} + +## addImage - add an IMG element +## Required arguments: +## -src +## -alt +## -align (deprecated in HTML 4.0) +## Optional arguments: +## Common HTML arguments + +HtmlBuilder instproc addImage {args} { + set attributes [HtmlBuilder parseArguments $args \ + [list "SRC" "ALT" "ALIGN"] [list]] + my addString "" + return +} + +## startBlock - start a DIV element (a generic block-level container) +## Optional arguments: +## Common HTML attributes + +HtmlBuilder instproc startBlock {args} { + set attributes [HtmlBuilder parseArguments $args [list] [list]] + my addStringIncr "" + return +} + +## endBlock - end a DIV element + +HtmlBuilder instproc endBlock {} { + my addStringDecr "" + return +} + +## addHorizontalRule - add an HR element +## Optional arguments: +## Common HTML arguments + +HtmlBuilder instproc addHorizontalRule {args} { + set attributes [HtmlBuilder parseArguments $args [list] [list]] + my addString "" + return +} Index: xotcl/library/lib/make.xotcl =================================================================== diff -u --- xotcl/library/lib/make.xotcl (revision 0) +++ xotcl/library/lib/make.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,156 @@ +# $Id: make.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +### inEachDir changes now to each directory +### install clears tgarget directory before installing +### Object file added (for better -n processing) +lappend auto_path .. + +package require XOTcl +namespace import -force ::xotcl::* + +### +Object make +# +# shared lib add files for pkgIndex.tcl +# +make proc mkIndex {name} { + #puts stderr "+++ mkIndex in [pwd]" + set fls {} + foreach f [glob -nocomplain *tcl] { + if {![file isdirectory $f]} { + set F [open $f]; set c [read $F]; close $F + if {[string match "*package provide*" $c]} { lappend fls $f } + } + } + + set so [glob -nocomplain *[info sharedlibextension]] + # loading libxotcl into xotclsh crashes on some systems + foreach lib [list libxotcl$::xotcl::version[info sharedlibextension] \ + xotcl$::xotcl::version.dll] { + set p [lsearch -exact $so $lib] + if {$p != -1} { + set so [lreplace $so $p $p] + #puts stderr "new so=<$so>" + } + } + #puts stderr "[pwd]: call so=<$so>" + set fls [concat $fls $so] + + if {$fls != ""} { + if {[file exists pkgIndex.tcl]} { + file delete -force pkgIndex.tcl + } + #puts stderr "callinglevel <[self callinglevel]> $fls" + #puts stderr "[pwd]:\n\tcall eval pkg_mkIndex -direct . $fls" + if {[catch {eval pkg_mkIndex -direct . $fls} errs]} { + puts stderr "!!! $errs" + } + #puts stderr "[pwd] done" + } + + foreach addFile [glob -nocomplain *.add] { + if {[file exists $addFile]} { + puts stderr "Appending $addFile to pkgIndex.tcl in [pwd]" + set OUT [file open pkgIndex.tcl a] + set IN [file open $addFile] + puts -nonewline $OUT [read $IN] + close $IN; close $OUT + } + } + #puts stderr "+++ mkIndex name=$name, pwd=[pwd] DONE" +} +make proc inEachDir {path cmd} { + #puts stderr "[pwd] inEachDir $path [file isdirectory $path]" + if { [file isdirectory $path] + && ![string match *CVS $path] + && ![string match *SCCS $path] + && ![string match *Attic $path] + && ![string match *dbm* $path] + } { + set olddir [pwd] + cd $path + eval make $cmd $path + set files [glob -nocomplain *] + cd $olddir + foreach p $files { my inEachDir $path/$p $cmd } + #puts stderr "+++ change back to $olddir" + } +} +make proc in {path cmd} { + if {[file isdirectory $path] && ![string match *CVS $path]} { + set olddir [pwd] + cd $path + eval make $cmd $path + cd $olddir + } +} +### tcl file-command +rename file tcl_file +Object file -requireNamespace + +rename open file::open +proc open {f {mode r}} { file open $f $mode } +#file proc open {f {mode r}} { ::open $f $mode } + + +file array set destructive { + atime 0 attributes 0 copy 1 delete 1 dirname 0 + executable 0 exists 0 extension 0 isdirectory 0 isfile 0 + join 0 lstat 0 mkdir 1 mtime 0 nativename 0 + owned 0 pathtype 0 readable 0 readlink 0 rename 1 + rootname 0 size 0 split 0 stat 0 tail 0 + type 0 volumes 0 writable 0 +} +foreach subcmd [file array names destructive] { + file proc $subcmd args { + #puts stderr " [pwd] call: '::tcl_file [self proc] $args'" + eval ::tcl_file [self proc] $args + } +} +### minus n option +Class make::-n +foreach f [file info commands] { + if {$f == "unknown" || $f == "next" || $f == "self"} continue + if {![file exists destructive($f)] || [file set destructive($f)]} { + #puts stderr destruct=$f + make::-n instproc $f args { + puts "--- [pwd]:\t[self proc] $args" + } + } else { + #puts stderr nondestruct=$f + make::-n instproc $f args { + set r [next] + #puts "??? [self proc] $args -> {$r}" + return $r + } + } +} + +### command line parameters +if {![info exists argv] || $argv == ""} {set argv -all} +if {$argv == "-n"} {set argv "-n -all"} + +Class Script +Script proc create args { + eval lappend args $::argv + eval next $args +} +Script instproc unknown args { + puts stderr "$::argv0: Unknown option �-$args� provided" +} + +Script instproc n {} {file mixin make::-n} +Script instproc all {} { + make inEachDir . mkIndex +} +Script instproc dir {dirName} { + cd $dirName +} +Script instproc target {path} { + make set target $path +} +Script create main + +#puts stderr "+++ make.xotcl finished." +#if {[set ::tcl_platform(platform)] == "windows"} { +# exit +#} Index: xotcl/library/lib/makeDoc.xotcl =================================================================== diff -u --- xotcl/library/lib/makeDoc.xotcl (revision 0) +++ xotcl/library/lib/makeDoc.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,106 @@ +#$Id: makeDoc.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package require XOTcl +namespace import ::xotcl::* +@ @File { + description { + Documentation tool for the XOTcl distribution.
+ Usage: 'makeDoc docdir filename ?filename ...?'
+ Called by Makefile. + } +} +lappend auto_path [file dirname [info script]] + +package require xotcl::package +package verbose 1 +package require xotcl::xodoc +set fileList "" + +puts "XOTcl Documentation Tool" +puts "------------------------" +if {$argc > 1} { + set DOCDIR [lindex $argv 0] + puts "Documenting to directory $DOCDIR:" + if {$::tcl_platform(platform) == "windows"} { + set files "" + foreach f [lrange $argv 1 end] { + eval lappend files [glob -nocomplain $f] + } + } else { + set files [lrange $argv 1 end] + } + foreach file $files { + puts "...$file" + set fb [XODoc documentFileAsHTML $file $DOCDIR] + lappend fileList $file $fb + } +} else { + error "usage: xodoc docdir filename ?filename ...?" +} + +set filesHtml "" +set filesDir "" +## write index page +foreach {f fb} $fileList { + set dir . + regexp {^(.*)/[^/]*$} $f _ dir + if {$fb != "langRef-xotcl"} { + set tail ", " + if {$dir != $filesDir} { + append filesHtml "
  • Directory '$dir':
    " + set filesDir $dir + set tail "" + } + append filesHtml "$tail[file tail $f]" + } +} + +# +# +# XOTcl - Documentation +# +# +#

    Lanuage Reference - Index

    + +set content { + +The Extended Object Tcl (XOTcl) Documentation contains the +following parts: + +

    XOTcl Language Documentation

    + + +

    Package and Script Documentation

    +
    + This section of the documentation is under work... +
    + +
      + $filesHtml +
    +

    + +

    Tcl Online Information

    + + +} + + +set content [subst -nobackslashes -nocommands $content] +set f [open $DOCDIR/index.html w] +puts $f $content +close $f + +puts "Documentation finished" Index: xotcl/library/lib/metadataAnalyzer.xotcl =================================================================== diff -u --- xotcl/library/lib/metadataAnalyzer.xotcl (revision 0) +++ xotcl/library/lib/metadataAnalyzer.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,493 @@ +package provide xotcl::metadataAnalyzer 0.84 + +@ @File { + description { + XOTcl file analyzer for @ metadata. E.g.\ used for + doumentation with xoDoc (but in the static variant + StaticMetadataAnalyzer which uses the dynamic + variant in this file). + <@p> + Sample sample usage: + <@pre> + package require xotcl::metadataAnalyzer + + # instantiate metadata analyzer object + MetadataAnalyzer @::m + # make this object be known to @ and turn @ metadata processing on + @ analyzerObj @::m + @ onOff 1 + + # read in some metadata tags (in sample file) & execute the file + source lib/testx.xotcl + + # turn @ metadata processing off again + @ onOff 0 + + # print out all collected metadata + puts [@::m print] + + } +} + +@ Class MetadataToken { + description { + Each collected metadata element is stored in a token object. + MetadataToken is superclass of token object classes. Each metadata token + has two interesting parameters: + <@p> + "properties" contains list of all described metadata properties. E.g. can + be printed with + <@pre> + foreach p [my set properties] { + if {[my exists $p]} { + append c " $p=[my set $p]\n" + } + } + + "name" contains the method, object, ... name of the metadata element. + <@p> + All metadata token are aggregated by @. Therefore, + <@pre> + foreach mdt [@ info children] { + if {[$mdt istype MetadataToken]} {$mdt print} + } + + prints all token. + + } +} +Class MetadataToken -parameter { + {name ""} + {properties ""} +} + +@ MetadataToken proc sortTokenList {l "token list"} { + description {Sort a token list with names. Since names are autonames, + this means order of appearance in the program.} +} +MetadataToken proc sortTokenList l { + foreach t $l { + set names([$t set name]) $t + } + set sortedNames [lsort [array names names]] + set sortedList "" + foreach n $sortedNames { + lappend sortedList $names($n) + } + return $sortedList +} + +MetadataToken instproc evaluateMetadata md { + my instvar properties + foreach {p v} $md { + # only append property, if its not already there + # otherwise just overwrite the value + if {[lsearch $properties $p] == -1} { + my lappend properties $p + } + my set $p $v + } +} + +@ MetadataToken instproc printProperties {} { + description {Print metadata properties to stdout.} +} +MetadataToken instproc printProperties {} { + set c "" + foreach p [my set properties] { + if {[my exists $p]} { + append c " [my capitalize $p]=[my set $p]\n" + } + } + return $c +} + +MetadataToken instproc capitalize string { + if {$::tcl_version >= 8.3} { + string toupper $string 0 0 + } else { + return "[string toupper [string range $string 0 0]][string range $string 1 end]" + } +} + +@ MetadataToken abstract instproc print {} { + description { + Abstract method for printing a token to stdout. + } +} +MetadataToken abstract instproc print {} + +@ Class FileToken -superclass MetadataToken { + description { + Token for @File Metadata. + } +} +Class FileToken -superclass MetadataToken +FileToken instproc print {} { + set c "FILE=[my set name]\n" + append c [my printProperties] + return $c +} + +@ Class ConstraintToken -superclass MetadataToken { + description { + Token for @Constraint Metadata. + } +} +Class ConstraintToken -superclass MetadataToken +ConstraintToken instproc print {} { + set c "CONSTRAINT=[my set name]\n" + append c [my printProperties] + return $c +} + +@ Class PackageToken -superclass MetadataToken { + description { + Token for Package metadata. Contains additional parameters: + "version" of the package and "type"= either "require" or "provide". + + } +} +Class PackageToken -superclass MetadataToken -parameter { + {version ""} + {type ""} +} + +@ Class ObjToken -superclass MetadataToken { + description { + Token for Object metadata. Contains additional parameters: + "procList" = list of all proc token and "cl"= class name. + } +} +Class ObjToken -superclass MetadataToken -parameter { + {procList ""} + cl +} + +ObjToken instproc printProcs {} { + set c " PROCS:\n" + set pl [MetadataToken sortTokenList [my procList]] + if {[my istype ClassToken]} { + set pl [concat [MetadataToken sortTokenList [my instprocList]] $pl] + } + foreach p $pl { + append c " [$p set name]\n" + } + return $c +} + +ObjToken instproc print {} { + set c "OBJECT=[my set name]\n" + if {[my exists cl]} {append c " CLASS=[my set cl]\n"} + if {[my exists heritage]} {append c " HERITAGE=[my set heritage]\n"} + append c [my printProperties] + + set pl [MetadataToken sortTokenList [my procList]] + if {[my istype ClassToken]} { + set pl [concat [MetadataToken sortTokenList [my instprocList]] $pl] + } + foreach p $pl { + append c [$p print] + } + + return $c +} + +@ Class ClassToken -superclass ObjToken { + description { + Token for Class metadata. Contains additional parameters: + "instprocList" = list of all instproc token. + } +} +Class ClassToken -superclass ObjToken -parameter { + {instprocList ""} +} +ClassToken instproc print {} { + regsub "^OBJECT=" [next] "CLASS=" r + return $r +} + +@ Class MetaClassToken -superclass ClassToken { + description { + Token for Meta-Class metadata. + } +} +Class MetaClassToken -superclass ClassToken +MetaClassToken instproc print {} { + regsub "^CLASS=" [next] "META-CLASS=" r + return $r +} + +@ Class MethodToken -superclass MetadataToken { + description { + Token for Method metadata. Contains additional parameters: + "arguments" of the method, "returnValue" of the method, + "obj" name, "abstract" = 0 or 1 (whether its an abstract method or not). + } +} +Class MethodToken -superclass MetadataToken -parameter { + arguments + returnValue + obj + {abstract 0} +} + +# Prints out method information +MethodToken instproc print {} { + set c " METHOD=[my set name], ARGUMENTS= " + + if {[my exists arguments]} { + foreach {arg argDescription} [my set arguments] { + # ignore argDescription and default values + if {[llength $arg] > 1} {set arg [lindex $arg 0]} + append c $arg " " + } + } + append c "\n [my printProperties]" + return $c +} + +@ Class ProcToken -superclass MethodToken { + description { + Token for Proc metadata + } +} +Class ProcToken -superclass MethodToken +ProcToken instproc print {} { + regsub "^ METHOD=" [next] " PROC=" r + return $r +} + +@ Class InstprocToken -superclass MethodToken { + description { + Token for Instproc metadata. + } +} +Class InstprocToken -superclass MethodToken +InstprocToken instproc print {} { + regsub "^ METHOD=" [next] " INSTPROC=" r + return $r +} + +@ Class MetadataAnalyzer { + description "Handler class for building a metadata runtime structure" +} + +Class MetadataAnalyzer -parameter { + {objList ""} + {packageList ""} + {knownMetaclasses "Class"} + {ns ""} + fileToken + {constraintList ""} +} + +MetadataAnalyzer instproc init args { + next +} + +MetadataAnalyzer instproc handleMethod {obj type name {argList ""} {doc ""}} { + #puts stderr "+++Method $type $name $argList $doc" + set procClass ProcToken + set objCl ObjToken + if {$type == "instproc"} { + set procCl InstprocToken + set objCl ClassToken + } + set t [$procClass create [my autoname ::xotcl::@::t]] + + set n [$t set name [string trimleft $name :]] + $t set obj $obj + + set objFound 0 + foreach o [my set objList] { + if {[$o set name] == $obj} { + set objFound 1 + if {$type == "instproc" && ![$o istype ClassToken]} { + $o class ClassToken + } + break + } + } + if {$objFound == 0} { + set o [$objCl create [my autoname ::xotcl::@::t]] + $o set name $obj + my lappend objList $o + } + $o lappend ${type}List $t + + $t set arguments $argList + + $t evaluateMetadata $doc + return $t +} + +MetadataAnalyzer instproc handleObj {class name args} { + my instvar knownMetaclasses objList extensions + set objCl ObjToken + if {[lsearch $class $knownMetaclasses] != -1} { + set objCl ClassToken + } + # if an instproc/proc has created an entry for this obj/class + # -> use it and overwrite it with new info + if {[set idx [lsearch $name $objList]] != -1} { + set t [lindex $objList $idx] + $t class $objCl + } else { + set t [$objCl create [my autoname ::xotcl::@::t]] + my lappend objList $t + } + + $t set name $name + + set la [llength $args] + + # evaluate -superclass argument + if {($la == 3 || $la == 2) && [lindex $args 0] == "-superclass"} { + set heritage [$t set heritage [lindex $args 1]] + foreach h $heritage { + if {[lsearch $h $knownMetaclasses] != -1} { + # A new metaclass was defined + lappend knownMetaclasses $name + $t class MetaClassToken + } + } + } + + # evaluate documentation + set doc "" + if {$la == 1} { + set doc [lindex $args 0] + } elseif {$la == 3} { + set doc [lindex $args 2] + } + $t evaluateMetadata $doc + $t set cl $class + + #puts stderr "+++Obj $name $args" +} + +MetadataAnalyzer instproc handleFile doc { + if {[my exists fileToken]} { + [my set fileToken] evaluateMetadata $doc + } +} + +MetadataAnalyzer instproc handleConstraint {constraint name args} { + set t [ConstraintToken create [my autoname ::xotcl::@::t]] + my lappend constraintList $t + $t set name $name + set doc [lindex $args 0] + $t evaluateMetadata $doc +} + +MetadataAnalyzer instproc handlePackage args { + #puts "$args" + if {[llength $args] > 2} { + set type [lindex $args 1] + if {$type == "provide" || $type == "require"} { + set t [PackageToken create [my autoname ::xotcl::@::t]] + my lappend packageList $t + $t set name [lindex $args 2] + $t set type $type + if {[llength $args] > 3} { + $t set version [lindex $args 3] + } + } + } +} + +@ MetadataAnalyzer instproc print {} { + description "Print all collected token information to stdout. + This method is also an exmaple how the tokens can be used." +} +MetadataAnalyzer instproc print {} { + my instvar extensions packageList + set c "" + if {[llength $packageList] > 0} { + append c "PACKAGES:" + foreach t $packageList { + if {[$t type] == "provide"} { + append c " Package provided: [$t name] [$t version]\n" + } elseif {[$t type] == "require"} { + append c " Package required: [$t name] [$t version]\n" + } + } + } + + if {[my exists fileToken]} { + append c [[my set fileToken] print] + } + + if {[my exists constraintToken]} { + append c [[my set constraintToken] print] + } + + if {[info exists extensions]} { + # Add list of extensions. + foreach extension $extensions { + append c "\nExtensions: [$extension name], " \ + "Description: [$extension description]" + } + } + + set objList [MetadataToken sortTokenList [my objList]] + + if {[llength $objList]>0} { + foreach obj $objList {append c [$obj print]} + } + return $c +} + +@ Class AnalyzerCmd { + description {Class that overload the unknown mechanism of @ to provide metadata analysis.} +} +Class AnalyzerCmd -parameter { + {analyzerObj ""} + {onOff 0} +} +AnalyzerCmd instproc unknown args { + my instvar analyzerObj onOff + + if {!$onOff} {return [next]} + + if {[llength $args] > 1} { + set abstract 0 + if {[lindex $args 1] == "abstract"} { + if {[llength $args] > 2} { + set p [lindex $args 2] + if {$p == "proc" || $p == "instproc"} { + set args [lreplace $args 1 1] + set abstract 1 + } + } + } + switch [lindex $args 1] { + proc - instproc { + set r [eval $analyzerObj handleMethod $args] + if {$abstract} {$r abstract 1} + return $r + } + default { + switch [lindex $args 0] { + @File { + return [$analyzerObj handleFile [lindex $args 1]] + } + @Constraint { + return [eval $analyzerObj handleConstraint $args] + } + default { + return [eval $analyzerObj handleObj $args] + } + } + } + } + } + puts stderr "Unknown @ metadata: '$args'" +} +@ AnalyzerCmd @ { + description {Recreate @ with metadata analyis funtionality.} +} +AnalyzerCmd @ + + Index: xotcl/library/lib/mixinStrategy.xotcl =================================================================== diff -u --- xotcl/library/lib/mixinStrategy.xotcl (revision 0) +++ xotcl/library/lib/mixinStrategy.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,92 @@ +#$Id: mixinStrategy.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::mixinStrategy 0.8 + +@ @File { description { + These methods provide support for managing "strategies", i.e. + mixin-classes, where only one kind of a family of conformant + mixins should be registered. + <@p> + Naming convertions for strategies: + All strategies must follow the naming convention 'kind=implementation'. + Examples are the persistency strategy 'eager' specfied as + 'persistent=eager' or the persistency strategy 'lazy' (specified as + 'persistent=lazy') +}} + +@ Object instproc mixinStrategy {strategy "Strategy to be added" } { + description { + This method adds or replaces a new strategy from the mixin + list. Strategies are named following the converntion mentioned + above. + } + return "old strategy" +} + +Object instproc mixinStrategy {strategy} { + ::regexp {^([^:]+)=} $strategy _ kind + ::set mixins "" + ::set oldStrategy "" + foreach mixin [my info mixin] { + if {[::string match ::$kind=* $mixin]} { + ::lappend mixins $strategy + ::set oldStrategy $mixin + } else { + ::lappend mixins $mixin + } + } + if {$oldStrategy == ""} { + ::lappend mixins $strategy + } + my mixin $mixins + return $oldStrategy +} + +@ Object instproc mixinQueryStrategy {kind "strategy kind"} { + description { + This method searches the mixin list for a mixin of this + kind (starting with $kind=) + } + return "returns the maching strategy" +} + +Object instproc mixinQueryStrategy {kind} { + set m [my info mixin] + return [::lindex $m [::lsearch -glob $m $kind=*]] +} + +@ Object instproc add {construct "(inst) 'filter' or 'mixin'" args "to be added"} { + description "add the specified (inst) 'filters' or 'mixins'" + return "empty" +} + +Object instproc add {kind args} { + if {$kind != {instfilter} && $kind != {instmixin} && + $kind != {filter} && $kind != {mixin}} { + error "Usage: [self proc] ..." + } + ::set classes [my info $kind] + eval ::lappend classes $args + my $kind $classes + #puts stderr "$kind of [self] are now: �[my info $kind]�" +} +@ Object instproc remove {construct "(inst) 'filter' or 'mixin'" args "to be removed"} { + description "remove the specified (inst) 'filters' or 'mixins'" + return "empty" +} +Object instproc remove {kind args} { + if {$kind != {instfilter} && $kind != {instmixin} && + $kind != {filter} && $kind != {mixin}} { + error "Usage: [self proc] ..." + } + ::set classes [my info $kind] + foreach c $args { + ::set pos [::lsearch $classes $c] + if {$pos == -1} { + error "$kind �$c� could not be removed" + } else { + set $classes [::lreplace $classes $pos $pos] + } + } + my $kind $classes + # puts stderr "$kind of [self] are now: �[my info $kind]�" +} Index: xotcl/library/lib/package.xotcl =================================================================== diff -u --- xotcl/library/lib/package.xotcl (revision 0) +++ xotcl/library/lib/package.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,135 @@ +#$Id: package.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::package 0.91 + +package require xotcl::mixinStrategy + +rename package tcl_package + +@ @File {description { + Represent Tcl package loading command by an XOTcl + object. Enables tracking, tracing, and verbose output + of package loading + } +} +@ Object package { + description { + Supports all Tcl package options plus present and verbose. + } +} +@ package proc present {args "packageName or -exact packageName"} { + description { + Check whether a package is present or not. Similar to Tcl's + package present, but works with Tcl < 8.3 + } +} +@ package proc verbose {v "1 or 0"} { + description { + Toggle verbose output on/off. If on, package prints the locations + from where packages are loaded to the screen. Default is off. + } +} + +Object package +package set component . +package set verbose 0 +package proc unknown args { + #puts stderr "unknown: package $args" + eval tcl_package $args +} +package proc verbose value { + my set verbose $value +} +package proc present args { + if {$::tcl_version<8.3} { + my instvar loaded + switch -exact -- [lindex $args 0] { + -exact {set pkg [lindex $args 1]} + default {set pkg [lindex $args 0]} + } + if {[info exists loaded($pkg)]} { + return $loaded($pkg) + } else { + error "not found" + } + } else { + eval tcl_package present $args + } +} + +package proc require args { + my instvar component verbose uses loaded + set prevComponent $component + if {[catch {set v [eval package present $args]} msg]} { + #puts stderr "we have to load $msg" + switch -exact -- [lindex $args 0] { + -exact {set pkg [lindex $args 1]} + default {set pkg [lindex $args 0]} + } + set component $pkg + lappend uses($prevComponent) $component + set v [eval tcl_package require $args] + if {$v != "" && $verbose} { + set path [lindex [tcl_package ifneeded $pkg $v] 1] + puts "... $pkg $v loaded from �$path�" + set loaded($pkg) $v ;# loaded stuff needed for Tcl 8.0 + } + } + set component $prevComponent + return $v +} + +Object package::tracker +package::tracker set verbose 0 +package::tracker proc storeEntry {table index} { + my instvar verbose $table + set ${table}($index) "[package set component] [info script]" + if {$verbose} { + puts "... $table $index loaded from [info script]" + } +} +package::tracker proc dump {} { + my instvar class object instproc proc + if {[info exist class]} { parray class } + if {[info exist object]} { parray object } + if {[info exist instproc]} { parray instproc } + if {[info exist proc]} { parray proc } +} +package::tracker proc start {} { + ::Class add mixin [self]::M + ::Object add mixin [self]::M +} + +Class package::tracker::M +package::tracker::M instproc create {cls args} { + set table [string tolower [string trimleft [self] :]] + package::tracker storeEntry $table [lindex $args 0] + next + $cls add mixin [self class] +} +package::tracker::M instproc instproc args { + package::tracker storeEntry instproc [self]->[lindex $args 0] + next +} +package::tracker::M instproc proc args { + package::tracker storeEntry proc [self]->[lindex $args 0] + next +} + +#package::tracker set verbose 1 +#package::tracker start +# +#Class A +#A instproc p args { +# puts A +#} +#A proc pp args { +# a call +#} +#Object o +#o proc ppp args { +# another call +#} +#puts stderr ==================================================== +#package::tracker dump + +#puts stderr AUTO_PATH=$auto_path. Index: xotcl/library/lib/pkgIndex-package.add =================================================================== diff -u --- xotcl/library/lib/pkgIndex-package.add (revision 0) +++ xotcl/library/lib/pkgIndex-package.add (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1 @@ +package ifneeded xotcl::package 0.9 [list source [file join $dir package.xotcl]] Index: xotcl/library/lib/pkgIndex.tcl =================================================================== diff -u --- xotcl/library/lib/pkgIndex.tcl (revision 0) +++ xotcl/library/lib/pkgIndex.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,21 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex -direct" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded xotcl::htmllib 0.1 [list source [file join $dir htmllib.xotcl]] +package ifneeded xotcl::metadataAnalyzer 0.84 [list source [file join $dir metadataAnalyzer.xotcl]] +package ifneeded xotcl::mixinStrategy 0.8 [list source [file join $dir mixinStrategy.xotcl]] +package ifneeded xotcl::script 0.9 [list source [file join $dir Script.xotcl]] +package ifneeded xotcl::staticMetadataAnalyzer 0.84 [list source [file join $dir staticMetadata.xotcl]] +package ifneeded xotcl::test 1.03 [list source [file join $dir test.xotcl]] +package ifneeded xotcl::trace 0.91 [list source [file join $dir trace.xotcl]] +package ifneeded xotcl::upvar-compat 1.0 [list source [file join $dir upvarcompat.xotcl]] +package ifneeded xotcl::wafecompat 0.9 [list source [file join $dir wafecompat.tcl]] +package ifneeded xotcl::xodoc 0.84 [list source [file join $dir xodoc.xotcl]] +package ifneeded xotcl::package 0.9 [list source [file join $dir package.xotcl]] Index: xotcl/library/lib/staticMetadata.xotcl =================================================================== diff -u --- xotcl/library/lib/staticMetadata.xotcl (revision 0) +++ xotcl/library/lib/staticMetadata.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,84 @@ +package require xotcl::metadataAnalyzer +package provide xotcl::staticMetadataAnalyzer 0.84 + +@ @File { + description { + XOTcl file static analyzer for @ metadata. E.g. used for + doumentation with xoDoc. I.e. allows for reading in a + file and evaluating the metadata-related info only. + } +} + +@ Class StaticMetadataAnalyzer -superclass MetadataAnalyzer { + description { + Metadata analyzer class that allows for reading in files + and evaluation of the metadata content in the file. + } +} + +Class StaticMetadataAnalyzer -superclass MetadataAnalyzer + +StaticMetadataAnalyzer instproc getCommand {content} { + upvar [self callinglevel] $content c + my instvar cmd + if {[set line [string first "\n" $c]] != -1} { + append cmd [string range $c 0 $line] + set c [string range $c [expr $line + 1] end] + if {[info complete $cmd]} { + set r $cmd; set cmd "" + return $r + } + } elseif {[string length [string trim $c]] >0} { + # We have some data left which doesn't end with a "\n". This happens + # if an EOF marks the end of a line instead of a newline. + append cmd $c + set c "" + if {[info complete $cmd]} { + set r $cmd + set cmd "" + return $r + } + } else { + return "" + } + my getCommand c +} + + +StaticMetadataAnalyzer instproc evaluateCommands {c} { + while 1 { + set command [my getCommand c] + if {$command == ""} { + break + } + #puts stderr "$command===========================" + if {[regexp "^ *:*@ " $command]} { + #puts stderr "$command===========================" + eval $command + } elseif {[regexp "^ *package " $command]} { + #puts stderr "$command===========================" + eval my handlePackage $command + } elseif {[regexp "^ *namespace *eval *(\[^\{\]*) *\{(.*)\}\[^\}\]*$" $command _ namespace nsc]} { + #puts stderr "$command===========================" + my evaluateCommands $nsc + } + } +} + +@ StaticMetadataAnalyzer instproc analyzeFile {name "File name"} { + description "Analyze a file and build up a token structure for each metadata token in the file." +} +StaticMetadataAnalyzer instproc analyzeFile name { + my set cmd "" + + set t [FileToken create [my autoname t]] + $t set name $name + my set fileToken $t + + set f [open $name r] + set c [read $f] + close $f + ::@ onOff 1 + my evaluateCommands $c + ::@ onOff 0 +} Index: xotcl/library/lib/test.xotcl =================================================================== diff -u --- xotcl/library/lib/test.xotcl (revision 0) +++ xotcl/library/lib/test.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,77 @@ +package provide xotcl::test 1.03 +@ @File {description { + Simple regression test support. + } +} + +@ Class Test { + description { + Class Test is used to configure test instances, which can + be configured by the following parameters: + <@ul> + <@li>cmd: the command to be executed + <@li>expected: the expected result + <@li>count: number of executions of cmd + <@li>pre: a command to be executed at the begin of the test (before cmd) + <@li>post: a command to be executed after the test (after all cmds) + + The defined tests can be executed by <@tt>Test run + } +} + +Class Test -parameter { + cmd + {expected 1} + {count 1000} + msg setResult errorReport + pre post +} +Test set count 0 +Test proc new args { + eval my create t[format %.3d [my incr count]] $args +} +Test proc run {} { + set startTime [clock clicks -milliseconds] + foreach example [lsort [my allInstances]] { + $example run + } + puts stderr "Total Time: [expr {[clock clicks -milliseconds]-$startTime}] ms" +} +Test proc _allInstances {C} { + set set [$C info instances] + foreach sc [$C info subclass] { + eval lappend set [my _allInstances $sc] + } + return $set +} +Test proc allInstances {} { + return [my _allInstances Test] +} + +Test instproc run args { + my instvar cmd expected pre post count msg + if {[info exists pre]} {eval $pre} + if {![info exists msg]} {set msg $cmd} + set r [eval $cmd] + if {[my exists setResult]} {set r [eval [my set setResult]]} + if {$r == $expected} { + if {[info exists count]} {set c $count} {set c 1000} + if {$c > 1} { + #set r0 [time $cmd $c] + #puts stderr "time {time $cmd $c}" + set r1 [time {time $cmd $c}] + #regexp {^(-?[0-9]+) +} $r0 _ mS0 + regexp {^(-?[0-9]+) +} $r1 _ mS1 + set ms [expr {$mS1*1.0/$c}] + puts stderr "[self]:\t[format %6.1f $ms] mms, $msg" + } else { + puts stderr "[self]: $msg ok" + } + } else { + puts stderr "[self]:\tincorrect result for '$msg'" + puts stderr "\texpected: '$expected', got '$r' [my exists errorReport]" + if {[my exists errorReport]} {eval [my set errorReport]} + exit -1 + } + if {[info exists post]} {eval $post} +} Index: xotcl/library/lib/trace.xotcl =================================================================== diff -u --- xotcl/library/lib/trace.xotcl (revision 0) +++ xotcl/library/lib/trace.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,264 @@ +# -*- Tcl -*- $Id: trace.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::trace 0.91 +@ @File {description { + Various tracing tools for the XOTcl language. + } +} +@ Object instproc traceFilter { + args "arbitrary args" +} { + Description { + Filter to trace every method call on an object or class hierarchy. + Outputs a message befora and after each call of the traced object. + } + return "empty string" +} +@ Object Trace { + Description { + Write trace outputs and produce statistics. Variable traceStream + defines where to write trace output (default: stderr). + } +} +@ Trace proc puts {line "output line"} { + Description { + Define how traceFilter writes to the output stream. Default: + write to trace stream. + } +} +@ Trace proc openTraceFile {name "file name"} { + Description { + Redirect trace output to file. + } +} +@ Trace proc closeTraceFile {name "file name"} { + Description { + Close trace file and redirect output to stderr. + } +} +@ Object instproc lintFilter {} { + Description {Experimental lint filter} +} +@ Object instproc statFilter {} { + Description {Experimental statistics filter} +} +@ Object instproc showVars {args "ist of variables"} { + Description {Show the values of the specified variables (or of all variables) + of an object on stderr.} +} +@ Object instproc showMsg {msg "optional output"} { + Description {Show a message msg with the form "[self] $cls->$method $msg" on stderr.} +} +@ Object instproc showClass {} { Description {Show classes and mixins of the object}} +@ Object instproc showStack {maxDepth "max stack depth, default=100"} { + Description {Show callstack up to the specified calldepth.}} +@ Object instproc showCall {} { Description {Show the current call with the form "[self] $cls->$method $args" on stderr.}} +@ Object instproc showTimeStart {"?handle?" "Handle object name, optional"} {Description {start a timer}} +@ Object instproc showTimeEnd {"?handle?" "Handle object name, optional"} {Description {end a timer and show result}} + +########################################################################## + +proc showCall {} { Trace deprecated-function showCall} +proc showVars {} { Trace deprecated-function showVars} +proc showObj {o {printObjectName 1}} { Trace deprecated-function showObj} +proc showStack {{m 100}} { Trace deprecated-function showStack} + + +Object Trace +Trace set traceStream stderr +Trace proc openTraceFile name { + my set traceStream [open $name w] +} +Trace proc closeTraceFile {} { + close $Trace::traceStream + my set traceStream stderr +} +Trace proc puts line { + puts $Trace::traceStream $line +} +Trace proc add {type classname} { + $classname instfilter [concat [$classname info instfilter] ${type}Filter] +} + +Trace proc statReset {} { + catch {my unset stat} +} +Trace proc statReportClass c { + if {[my exists stat($c)]} { + puts "\nClass $c: [my set stat($c)] references" + foreach method [$c info instprocs] { + set key $c->$method + if {[info exists stat($key)]} { + puts "\t$key: [my set stat($key)] references" + } else { + puts "\t$key: not used" + } + } + } else { + puts "\nClass $c: not used" + } + foreach subclass [lsort [$c info subclass]] { + my [self proc] $subclass + } +} +Trace proc statReport {} { + my statReportClass Object +} +Trace proc statCount key { + if {[my exists stat($key)]} { + my incr stat($key) + } else { + my incr set stat($key) 1 + } +} +Trace proc deprecated-function {name} { + puts stderr "Function <$name> is deprecated. Use method with same name instead." +} + + + +Object instproc traceFilter args { + # don't trace the Trace object + if {[self] == "::Trace"} {return [next]} + set context "[self callingclass]->[self callingproc]" + set method [self calledproc] + switch -- $method { + proc - + instproc {set dargs [list [lindex $args 0] [lindex $args 1] ...] } + default {set dargs $args } + } + Trace::puts "CALL $context> [self]->$method $dargs" + set result [next] + Trace::puts "EXIT $context> [self]->$method ($result)" + return $result +} + +Object instproc lintFilter args { + #puts stderr c=[self class],ic[my info class],p=[self calledproc] + #puts stderr " =====================METHOD='[self calledproc]'" + my instvar __reported + switch -exact -- [self calledproc] { + instvar { + set ccls [self callingclass] + set method [self callingproc] + + #puts stderr ccls=$ccls. + if {$ccls == ""} { ;## instvar in proc + set bod [my info body $method] + set context "proc [self]->$method" + } else { ;## instvar in instproc + set bod [$ccls info instbody $method] + set context "instproc $ccls->$method" + } + foreach v $args { + set vpattern "$v\[^a-zA-Z0-9\]" + if {[regexp "\[\$\]$vpattern" $bod]} continue + if {[regexp " *$vpattern" $bod]} continue + #if {[regexp "info *exists *$vpattern" $bod]} continue + #if {[regexp "append *$vpattern" $bod]} continue + #if {[regexp "array.*$vpattern" $bod]} continue + if {[info exists __reported($v,$context)]} continue + set __reported($v,$context) 1 + puts stderr "'$v' of 'instvar $args' is NOT used in\n\ + $context ... {$bod}" + } + } + } + next +} +Object instproc statFilter args { + # don't return statistics from the Trace object + #puts stderr "self=[self]" + if {[self] == "::Trace"} {return [next]} + set ccls [self callingclass] + set cmet [self callingproc] + set met [self calledproc] + #::puts stderr "cls=$ccls->$cmet, [self]->$met" + Trace statCount $ccls + Trace statCount $ccls->$cmet + next +} + + + +###################################################################### +# show**** methods +# +Object instproc showVars args { + set msg {} + if {$args == {}} { + foreach var [lsort [my info vars]] { + if {[my array exists $var]} { + append msg "\n\t$var: " + #puts stderr "ARRAY $var" + #puts stderr "ARRAY names <[[self]array names $var]>" + foreach i [lsort [my array names $var]] { + append msg $i=[my set ${var}($i)] ", " + } + } elseif {[my exists $var]} { + append msg "\n\t$var: " [list [my set $var]] + } else { + append msg "\n\t$var: " UNKNOWN + } + } + } else { + foreach var $args { + if {[my array exists $var]} { + lappend msg $var: ARRAY + } elseif {[my exists $var]} { + lappend msg $var: [my set $var] + } else { + lappend msg $var: UNKNOWN + } + } + } + set method [self callingproc] + set cls [self callingclass] + puts stderr "[self] $cls->$method $msg" + #puts stderr " MIXINS: [my info mixin]" +} +Object instproc showMsg msg { + set method [self callingproc] + set cls [self callingclass] + puts stderr "[self] $cls->$method $msg" +} +Object instproc showClass {} { + set method [self callingproc] + set cls [self callingclass] + puts stderr "[self] $cls->$method class [my info class]\ + mixins {[my info mixin]}" +} +Object instproc showStack {{m 100}} { + set max [info level] + if {$m<$max} {set max $m} + puts stderr "Call Stack (level: command)" + for {set i 0} {$i < $max} {incr i} { + if {[catch {set s [uplevel $i self]} msg]} { + set s "" + } + puts stderr "[format %5d -$i]:\t$s [info level [expr {-$i}]]" + } +} +Object instproc showCall {} { + set method [self callingproc] + set cls [self callingclass] + set args [lreplace [info level -1] 0 0] + puts stderr "[self] $cls->$method $args" +} +Object instproc showTimeStart {{handle __h}} { + upvar [self callinglevel] $handle obj + set obj [Object [self]::[my autoname __time]] + $obj set clicks [clock clicks] + return +} +Object instproc showTimeEnd {{handle __h}} { + upvar [self callinglevel] $handle obj + set method [self callingproc] + set cls [self callingclass] + set elapsed [expr {([clock clicks]-[$obj set clicks])/1000000.0}] + puts stderr "[self] $cls->$method: elapsed [format %.2f $elapsed]secs" + $obj destroy +} + + +###################################################################### + Index: xotcl/library/lib/upvarcompat.xotcl =================================================================== diff -u --- xotcl/library/lib/upvarcompat.xotcl (revision 0) +++ xotcl/library/lib/upvarcompat.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,35 @@ +#$Id: upvarcompat.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::upvar-compat 1.0 + +@ @File {description { + Provide a version of upvar and uplevel that provide + backward compatibility such that these commands + ignore inactive filter and mixin frames (upvar behaves + the same whether or not a filter is installed). Newer + scripts should use <@TT>upvar/uplevel [self callinglevel] var/command + instead. +} } + +# Define upvar and uplevel; use the level, if given explizitely: +# otherwise point to the callinglevel from XOTcl +rename uplevel ::xotcl::tcl_uplevel +proc uplevel {lvl args} { + # the outer uplevel is needed to leave the scope of this proc + if {[regexp {^\#?[0-9]+$} $lvl]} { + ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_uplevel $lvl $args] + } else { + set cl [::xotcl::tcl_uplevel 1 ::xotcl::self callinglevel] + ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_uplevel $cl [list $lvl] $args] + } +} + +rename upvar ::xotcl::tcl_upvar +proc upvar {lvl args} { + # the outer uplevel is needed to leave the scope of this proc + if {[regexp {^\#?[0-9]+$} $lvl]} { + ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_upvar $lvl $args] + } else { + set cl [::xotcl::tcl_uplevel 1 ::xotcl::self callinglevel] + ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_upvar $cl [list $lvl] $args] + } +} Index: xotcl/library/lib/wafecompat.tcl =================================================================== diff -u --- xotcl/library/lib/wafecompat.tcl (revision 0) +++ xotcl/library/lib/wafecompat.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,51 @@ +# $Id: wafecompat.tcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::wafecompat 0.9 + +set WAFELIB /usr/lib/X11/wafe/ +set MODULE_PATH "$WAFELIB $auto_path" +set COMPONENT_PATH $WAFELIB/otcl-classes +proc MOTIFPREFIX {} {return {}} +proc requireModules modules { + global MODULE_PATH + foreach {cmd module} $modules { + if {[string compare {} [info command $cmd]]} continue + if {[regexp {([A-Za-z1-9]+)Gen} $module _ n] || + [regexp {lib([a-z]+)} $module _ n] || + [regexp {^(.+)[.]so} $module _ n] + } { + set name [string toupper $n] + } + foreach path $MODULE_PATH { + set f $path/tcllib/bin/$module + if {[set found [file exists $f]]} { + puts stderr "Loading module $name from $f" + load $f $name + break + } + } + if {!$found} { error "Could not find module $module in {$MODULE_PATH}"} +}} +proc requireTclComponents {files} { + global COMPONENT_PATH _componentLoaded + foreach component $files { + if {[info exists _componentLoaded($component)]} continue + foreach path $COMPONENT_PATH { + set f $path/$component + if {[file exists $f]} { + puts stderr "Loading source file $f" + uplevel \#0 source $f + set _componentLoaded($component) $f + break + } + } + if {![info exists _componentLoaded($component)]} { + error "Could not find component $component in {$COMPONENT_PATH}" + } +}} +proc addTimeOut {n cmd} { + after $n $cmd +} +proc removeTimeOut {n} { + after cancel $n +} +proc quit {} { exit } Index: xotcl/library/lib/xodoc.xotcl =================================================================== diff -u --- xotcl/library/lib/xodoc.xotcl (revision 0) +++ xotcl/library/lib/xodoc.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,401 @@ +# $Id: xodoc.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::xodoc 0.84 +package require xotcl::staticMetadataAnalyzer +package require xotcl::htmllib +#package require xotcl::trace + +@ @File { + description { + XOTcl documentation tool. Overloads the command @, which is used + as a documentation token. + } +} + +@ Class MetadataTokenHTML { + description {Instmixin to provide HTML printing. Such instmixins + are registered for all token types. + } +} +Class MetadataTokenHTML +@ MetadataTokenHTML abstract instproc printHTML {} { + description {Print token to HTML document object} +} +MetadataTokenHTML abstract instproc printHTML {} + +@ MetadataTokenHTML instproc getDocPropertiesHTML {} { + description { + Returns list of properties as HTML. + } +} + +MetadataTokenHTML instproc getDocPropertiesHTML {htmlDoc} { + foreach p [my set properties] { + $htmlDoc startTableRow -valign top + if {[my exists $p]} { + $htmlDoc startTableCell -valign top + $htmlDoc addString " [my capitalize $p]:" + $htmlDoc endTableCell + + $htmlDoc startTableCell -valign top + if {$p == "errorCodes"} { + # Build table cell with list of error codes. + foreach {code desc} [my set $p] { + set code [string map [list < <\; > >\;] $code] + set desc [string map [list < <\; > >\;] $desc] + $htmlDoc addString "$code: $desc\n

    " + } + } else { + $htmlDoc addString [my set $p] + } + $htmlDoc endTableCell + } + $htmlDoc endTableRow + } +} + +MetadataTokenHTML instproc reflowHTML {left paragraph} { + #set result "" + #foreach line [split $paragraph \n] { + # if {![regexp {^ *$} $line]} { + # append result "$left$line
    \n" + # } + #} + #return $result + return $paragraph +} + +MetadataToken instmixin [concat [MetadataToken info instmixin] MetadataTokenHTML] + +@ Class FileTokenHTML -superclass MetadataTokenHTML +Class FileTokenHTML -superclass MetadataTokenHTML +FileTokenHTML instproc printHTML {htmlDoc} { + $htmlDoc addLineBreak + $htmlDoc addString " Filename: " + $htmlDoc addAnchor [my set name] -href [my set name] + $htmlDoc addLineBreak + $htmlDoc addLineBreak + $htmlDoc startTable -border 0 + my getDocPropertiesHTML $htmlDoc + $htmlDoc endTable +} + +FileToken instmixin [concat [FileToken info instmixin] FileTokenHTML] + +@ Class ConstraintTokenHTML -superclass MetadataTokenHTML +Class ConstraintTokenHTML -superclass MetadataTokenHTML +ConstraintTokenHTML instproc printHTML {htmlDoc} { + $htmlDoc addAnchor "" -name [my set name] + $htmlDoc addString "

    Constraint: [my set name]

    " + $htmlDoc addLineBreak + $htmlDoc startTable -border 0 + my getDocPropertiesHTML $htmlDoc + $htmlDoc endTable +} + +ConstraintToken instmixin [concat [ConstraintToken info instmixin] ConstraintTokenHTML] + +@ Class ObjTokenHTML -superclass MetadataTokenHTML +Class ObjTokenHTML -superclass MetadataTokenHTML +ObjTokenHTML instproc getProcsHTML {htmlDoc} { + set c "" + set pl [MetadataToken sortTokenList [my procList]] + if {[my istype ClassToken]} { + set pl [concat [MetadataToken sortTokenList [my instprocList]] $pl] + } + foreach p $pl { + set pn [$p set name] + set label($pn) "$pn" + } + foreach l [lsort [array names label]] { + if {$c != ""} {append c ", "} + append c $label($l) + } + if {$c != ""} {append c "."} + $htmlDoc addString "$c" +} + +ObjTokenHTML instproc printHTML {htmlDoc} { + $htmlDoc addAnchor "" -name [my set name] + if {[my istype MetaClassToken]} { + set start "

    MetaClass:" + } elseif {[my istype ClassToken]} { + set start "

    Class:" + } else { + set start "

    Object:" + } + $htmlDoc addString "$start [my set name]

    " + if {[my exists cl]} { + $htmlDoc addString "Class: [my set cl]" + $htmlDoc addLineBreak + } + if {[my exists heritage]} { + $htmlDoc addString "Heritage: [my set heritage]" + $htmlDoc addLineBreak + } + + set head "" + if {[my procList] != ""} {set head " Procs "} + if {[my istype ClassToken]} { + if {[my instprocList] != ""} {set head " Procs/Instprocs: "} + } + $htmlDoc addString $head + my getProcsHTML $htmlDoc + + $htmlDoc startTable -border 0 + my getDocPropertiesHTML $htmlDoc + $htmlDoc endTable +} + +ObjToken instmixin [concat [ObjToken info instmixin] ObjTokenHTML] + +@ Class MethodTokenHTML -superclass MetadataTokenHTML +Class MethodTokenHTML -superclass MetadataTokenHTML + +# Prints out method information as HTML. +MethodTokenHTML instproc printHTML {htmlDoc} { + #my showVars + set argText "\n" + + HtmlBuilder args + + set a "Arguments:" + + set anchor [my set obj]-[my set name] + $htmlDoc addAnchor "" -name $anchor + + if {[my abstract]} {$htmlDoc addString "abstract"} + $htmlDoc addString "[my set name] " + + args set indentLevel [$htmlDoc set indentLevel] + + if {[my exists arguments]} { + #set argText "\n" + foreach {arg argDescription} [my set arguments] { + if {[llength $arg] > 1} { + # A default value was given to the argument. + $htmlDoc addString "?[lindex $arg 0]?" + set at "?[lindex $arg 0]?:$argDescription Default: \"[lindex $arg 1]\"." + } else { + $htmlDoc addString "$arg" + set at "$arg: $argDescription" + } + args startTableRow -valign top + args startTableCell -valign top + args addString $a + set a "" + args endTableCell + args startTableCell -valign top + args addString $at + args endTableCell + args endTableRow + } + } + $htmlDoc startTable -border 0 + + $htmlDoc addString [args toString] + args destroy + + my getDocPropertiesHTML $htmlDoc + + $htmlDoc endTable + + #$htmlDoc endListItem +} + +MethodToken instmixin [concat [MethodToken info instmixin] MethodTokenHTML] + +@ Class XODoc { description "Handler class for building a documentation database" } + +Class XODoc -superclass StaticMetadataAnalyzer + +@ XODoc proc documentFileAsHTML { + file "filename of the xotcl file to be documented" + docdir "directory to which the html file is written" +} { + description "Uses the xoDoc package to produce an HTML documentation of + a specified file ***.xotcl. The file is written to ***.html + in docdir" + return "file basename without suffix" +} + +XODoc proc documentFileAsHTML {file docdir} { + set docdb [XODoc [XODoc autoname docdb]] + ::@ set analyzerObj $docdb + $docdb analyzeFile $file + set ext [file extension $file] + if {$ext != ""} {set ext -[string trimleft $ext .]} + set docfilename [file rootname [file tail $file]]$ext + $docdb writeFile ${docdir}/$docfilename.html $file + $docdb destroy + return $docfilename +} + +XODoc instproc printPackages {htmlDoc} { + my instvar packageList + $htmlDoc addString "

    Package/File Information

    " + if {[llength $packageList] > 0} { + foreach t $packageList { + if {[$t type] == "provide"} { + $htmlDoc addString " Package provided: [$t name] [$t version]" + } elseif {[$t type] == "require"} { + $htmlDoc addString " Package required: [$t name] [$t version]" + } + $htmlDoc addLineBreak + } + } else { + $htmlDoc addString " No package provided/required " + $htmlDoc addLineBreak + } +} + +XODoc instproc printExtensions {htmlDoc} { + my instvar extensions + if {[info exists extensions]} { + # Add list of extensions. + foreach extension $extensions { + $htmlDoc addLineBreak + $htmlDoc addString "

    Document extension: [$extension name]" + $htmlDoc addString "Description: [$extension description]" + $htmlDoc addLineBreak + } + } +} + +XODoc instproc printObjList {htmlDoc} { + set objList [MetadataToken sortTokenList [my objList]] + + if {[llength $objList]>0} { + $htmlDoc addLineBreak + $htmlDoc addString "Defined Objects/Classes: " + $htmlDoc startUnorderedList + foreach obj $objList { + set on [$obj set name] + $htmlDoc startListItem + $htmlDoc addAnchor "$on:" -href "#$on" + $obj getProcsHTML $htmlDoc + $htmlDoc addLineBreak + $htmlDoc endListItem + } + $htmlDoc endUnorderedList + } +} + +XODoc instproc printFileToken {htmlDoc} { + if {[my exists fileToken]} { + [my set fileToken] printHTML $htmlDoc + } else { + $htmlDoc addString " No file information. \n" + } + $htmlDoc addLineBreak +} + +XODoc instproc printConstraintsList {htmlDoc} { + set constraintList [MetadataToken sortTokenList [my constraintList]] + + if {[llength $constraintList]>0} { + $htmlDoc addLineBreak + $htmlDoc addString "Defined Constraints: " + $htmlDoc startUnorderedList + foreach c $constraintList { + set cn [$c set name] + $htmlDoc startListItem + $htmlDoc addAnchor "$cn:" -href "#$cn" + $htmlDoc addLineBreak + $htmlDoc endListItem + } + $htmlDoc endUnorderedList + } +} + +XODoc instproc printConstraints {htmlDoc} { + foreach c [my set constraintList] { + $htmlDoc addHorizontalRule + $htmlDoc startParagraph + $c printHTML $htmlDoc + $htmlDoc endParagraph + } + $htmlDoc addLineBreak +} + +XODoc instproc printProcsList {htmlDoc list string} { + if {[llength $list] > 0} { + $htmlDoc addString "

    $string

    " + $htmlDoc startUnorderedList + foreach s $list { + $htmlDoc startListItem + $s printHTML $htmlDoc + $htmlDoc endListItem + } + $htmlDoc endUnorderedList + } +} +XODoc instproc printObjs {htmlDoc} { + set objList [MetadataToken sortTokenList [my objList]] + + foreach t $objList { + $htmlDoc addHorizontalRule + $htmlDoc startParagraph + $t printHTML $htmlDoc + if {[$t istype ClassToken]} { + my printProcsList $htmlDoc [$t set instprocList] Instprocs + } + my printProcsList $htmlDoc [$t set procList] Procs + $htmlDoc endParagraph + } +} + +XODoc instproc replaceFormatTags {fc} { + regsub -all <@ $fc < fc + regsub -all " + htmlDoc addImage -src "./logo-100.jpg" -alt "$name" -align MIDDLE + htmlDoc addStringDecr "$name" + htmlDoc addHorizontalRule + htmlDoc startParagraph + + my printPackages htmlDoc + my printExtensions htmlDoc + my printObjList htmlDoc + my printConstraintsList htmlDoc + my printFileToken htmlDoc + my printObjs htmlDoc + my printConstraints htmlDoc + htmlDoc endParagraph + htmlDoc addHorizontalRule + htmlDoc startParagraph + htmlDoc endParagraph + htmlDoc addAnchor "Back to index page." -href "./index.html" + htmlDoc addLineBreak + htmlDoc addHorizontalRule + htmlDoc startParagraph + htmlDoc endParagraph + htmlDoc endDocument + set r [my replaceFormatTags [htmlDoc toString]] + htmlDoc destroy + return $r +} + +@ XODoc instproc writeFile { + filename "file name destination" name "name of the html document" +} { + description "Create HTML docuemntation from metadata token and write to file " +} +XODoc instproc writeFile {filename name} { + set content [my printHTML $name] + set f [open $filename w] + puts $f $content + close $f +} + + Index: xotcl/library/patterns/COPYRIGHT =================================================================== diff -u --- xotcl/library/patterns/COPYRIGHT (revision 0) +++ xotcl/library/patterns/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/library/patterns/ChainOfResponsibility.xotcl =================================================================== diff -u --- xotcl/library/patterns/ChainOfResponsibility.xotcl (revision 0) +++ xotcl/library/patterns/ChainOfResponsibility.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,43 @@ +# $Id: ChainOfResponsibility.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::pattern::chainOfResponsibility 0.9 + +Class ChainOfResponsibility -superclass Class + +ChainOfResponsibility instproc chainingFilter args { + set cp [self calledproc] + set registrationclass [lindex [self filterreg] 0] + $registrationclass instvar operations + #puts stderr "CHAIN [array names [self regclass]::chainedOperations ]---$cp" + if {[$registrationclass exists chainedOperations($cp)]} { + # + # a value is found on the chain, if it differs from the failure value ! + # + set failureValue [$registrationclass set chainedOperations($cp)] + set r [my $cp $args] + if {$r == $failureValue} { + if {[my exists successor] && + [set s [my set successor]] != ""} { + #puts stderr "CHAIN: forwarding to $s" + set r [$s $cp $args] + } + } + set r ;# return $r + } else { + next ;# return [next] + } +} + +ChainOfResponsibility instproc init args { + my instfilterappend chainingFilter + my parameter {successor} + # chained operations hold their value of failure + my array set chainedOperations {} +} + +ChainOfResponsibility instproc addChainedOperation {name {failureValue ""}} { + my set chainedOperations($name) $failureValue +} + +ChainOfResponsibility instproc removeChainedOperation {name} { + my unset chainedOperations($name) +} \ No newline at end of file Index: xotcl/library/patterns/OnCalleeProxy.xotcl =================================================================== diff -u --- xotcl/library/patterns/OnCalleeProxy.xotcl (revision 0) +++ xotcl/library/patterns/OnCalleeProxy.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,31 @@ +# $Id: OnCalleeProxy.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::pattern::onCalleeProxy 0.8 + +Class OnCalleeProxy -superclass Class + +@ @File { + description { + Simple proxy pattern implementation enhanced with the ability to adapt + calls solely for specified calling objects + for each calling obj there may be a different delegator obj + } +} + +OnCalleeProxy instproc onCalleeProxyFilter args { + set o [string trimleft [self callingobject] :] + my instvar callee + #puts stderr "[self class]: checking $o -- [self] -- [self calledproc] " + if {[info exists callee($o)]} { + return [::eval [set callee($o)] [self calledproc] $args] + } else { + next + } +} + +OnCalleeProxy instproc init args { + my instfilterappend onCalleeProxyFilter + next + my instproc setCallee {callingObj a} { + my set callee([string trimleft $callingObj :]) $a + } +} Index: xotcl/library/patterns/Singleton.xotcl =================================================================== diff -u --- xotcl/library/patterns/Singleton.xotcl (revision 0) +++ xotcl/library/patterns/Singleton.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,76 @@ +# $Id: Singleton.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::pattern::singleton 0.8 + +Class SingletonBase +SingletonBase instproc getInstance args { + my instvar _instance + if {[info exists _instance]} { + return $_instance + } + return "" +} + + +# +# A simple pattern mixin that makes a class to a non-specializable singleton +# +Class NonSpecializableSingleton -superclass SingletonBase + +NonSpecializableSingleton instproc create args { + my instvar _instance + if {![info exists _instance]} { + set _instance [self] + next + } + return $_instance +} + +NonSpecializableSingleton instproc getInstance {} { + if {[info exists _instance]} { + my instvar _instance + return $_instance + } + return "" +} + +# +# Specializable Singleton +# +Class Singleton -superclass {SingletonBase Class} +Singleton instproc singletonFilter args { + switch -exact [self calledproc] { + init { + set registrationclass [lindex [self filterreg] 0] + $registrationclass instvar _instance + if {![info exists _instance]} { + set _instance [self] + next + } else { + my destroy + } + return $_instance + } + default { + return [next] + } + } +} + +Singleton instproc init args { + my instfilterappend singletonFilter + # + # specialized singletons have to look up the singleton class + # first + Class instproc getInstance {} { + foreach sc [my info superclass] { + if {[$sc info class] == "::Singleton"} { + return [$sc getInstance] + } else { + return "" + } + } + } + next +} + + \ No newline at end of file Index: xotcl/library/patterns/SortedComposite.xotcl =================================================================== diff -u --- xotcl/library/patterns/SortedComposite.xotcl (revision 0) +++ xotcl/library/patterns/SortedComposite.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,70 @@ +# $Id: SortedComposite.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::pattern::sortedCompositeWithAfter 0.9 + +Class SortedComposite -superclass Class + +@ @File { + description { + Composite pattern enhanced with sorting + } +} + +SortedComposite instproc remove {array element} { + if {my exists ${array}($element)]} { + my unset ${array}($element)} +} + +SortedComposite instproc addOperations args { + foreach pair $args { + foreach {proc op} $pair {my set operations($proc) $op} + } +} + +SortedComposite instproc removeOperations args { + foreach op $args {my remove operations $op} +} + +SortedComposite instproc addAfterOperations args { + foreach pair $args { + foreach {proc op} $pair {my set afterOperations($proc) $op} + } +} +SortedComposite instproc removeAfterOperations args { + foreach op $args {my remove afterOperations $op} +} + +SortedComposite instproc compositeFilter args { + set registrationclass [lindex [self filterreg] 0] + set r [self calledproc] + set result [next] + if {[$registrationclass exists operations($r)] && [my exists children]} { + set method [$registrationclass set operations($r)] + foreach object [my set children] { + eval [self]::$object $method $args + } + } + if {[$registrationclass exists afterOperations($r)]} { + eval my [$registrationclass set afterOperations($r)] $args + } + set result +} + +SortedComposite instproc init args { + my array set operations {} + my array set afterOperations {} + + my instproc setChildren args { + switch [llength $args] { + 0 { return [my set children] } + 1 { return [my set children [lindex $args 0]] } + default {error "wrong # args: [self] setChildren ?children?"} + } + } + my instproc appendChildren args { + eval my lappend children $args + } + + next + my instfilterappend compositeFilter +} + Index: xotcl/library/patterns/adapter.xotcl =================================================================== diff -u --- xotcl/library/patterns/adapter.xotcl (revision 0) +++ xotcl/library/patterns/adapter.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,33 @@ +# $Id: adapter.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::pattern::adapter 0.9 + +Class Adapter -superclass Class + +@ @File { + description { + Simple adapter pattern meta-class taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + } +} + +Adapter instproc adapterFilter args { + set r [self calledproc] + my instvar specificRequest adaptee \ + [list specificRequest($r) sr] + if {[info exists sr]} { + return [eval $adaptee $sr $args] + } + next +} + +Adapter instproc init args { + my instfilterappend adapterFilter + next + my instproc setRequest {r sr} { + my set specificRequest($r) $sr + } + my instproc setAdaptee {a} { + my set adaptee $a + } +} Index: xotcl/library/patterns/composite.xotcl =================================================================== diff -u --- xotcl/library/patterns/composite.xotcl (revision 0) +++ xotcl/library/patterns/composite.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,54 @@ +# $Id: composite.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::pattern::composite 0.9 + +Class Composite -superclass Class + +@ @File { + description { + Simple composite pattern meta-class taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + } +} + +Composite instproc addOperations args { + foreach op $args { + if {![my exists operations($op)]} { + my set operations($op) $op + } + } +} + +Composite instproc removeOperations args { + foreach op $args { + if {![my exists operations($op)]} { + my unset operations($op) + } + } +} + +Composite instproc compositeFilter args { + # get the operations class variable from the object's class + set registrationclass [lindex [self filterreg] 0] + $registrationclass instvar operations + # get the request + set r [self calledproc] + + # check if the request is a registered operation + if {[info exists operations($r)]} { + foreach object [my info children] { + # forward request + eval $object $r $args + } + } + return [next] +} + + +Composite instproc init {args} { + my array set operations {} + next + my instfilterappend compositeFilter +} + + Index: xotcl/library/patterns/link.xotcl =================================================================== diff -u --- xotcl/library/patterns/link.xotcl (revision 0) +++ xotcl/library/patterns/link.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,48 @@ +# $Id: link.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::pattern::link 0.9 +# +# establish/introspect 'link' through link-instproc +# +Class Link -parameter { + {link ""} +} + +Link instproc adapterFilter args { + set l [my set link] + set m [self calledproc] + + # let link/destroy requests go through to the link + if {$m == "link" || $m == "destroy"} { + return [next] + } + + if {[Object isobject $l]} { + puts stderr "adapting $m on link [self] -> $l" + eval $l $m $args + } else { + # if there is currently no link establish -> return + if {$l == ""} {return} + error "Link: object $l is no xotcl object" + } +} + +Link instfilter adapterFilter + +# Link L +# Class A + +# L link A + +# L w + +# w set a 45 + +# puts [w set a] + +# puts [L link] + +# #A destroy +# puts ----1 +# L set r 45 +# puts ----2 + Index: xotcl/library/patterns/manager.xotcl =================================================================== diff -u --- xotcl/library/patterns/manager.xotcl (revision 0) +++ xotcl/library/patterns/manager.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,31 @@ +# $Id: manager.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::pattern::manager 0.8 + +# +# a simle manager pattern following buschmann (164) +# based on dynamic object aggregation and using dynamic code +# for supplier creation (instead of loading) +# +# it shares the suppliers ! +# + +# +# abstract supplier, init starts dynamic code creation +# +Class Supplier +Supplier abstract instproc init args +Supplier abstract instproc m args + + +Class Manager -parameter { + {supplierClass Supplier} +} + +Manager instproc getSupplier {name} { + if {[my info children [namespace tail $name]] != ""} { + return [self]::[namespace tail $name] + } else { + return [my [my supplierClass] [namespace tail $name]] + } +} + Index: xotcl/library/patterns/observer.xotcl =================================================================== diff -u --- xotcl/library/patterns/observer.xotcl (revision 0) +++ xotcl/library/patterns/observer.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,85 @@ +# $Id: observer.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::pattern::observer 0.8 + +Class Observer -superclass Class + +@ @File { + description { + Simple observer pattern meta-class taken from the paper + 'Filters as a Language Support for Design Patterns in + Object-Oriented Scripting Languages'. + } +} + +Class Observer::Subject -superclass Class + +Observer::Subject instproc notificationFilter {args} { + set procName [self calledproc] + my instvar \ + preObservers [list preObservers($procName) preObs] \ + postObservers [list postObservers($procName) postObs] + + if {[info exists preObs]} { + foreach obj $preObs { $obj update [self] $args } + } + set result [next] + + if {[info exists postObs]} { + foreach obj $postObs { $obj update [self] $args } + } + return $result +} + +Class Observer::SubjectMgt +Observer::SubjectMgt instproc attach {hook objs} { + upvar [self callinglevel] $hook observers + foreach obj $objs { + if {![info exists observers] || [lsearch $observers $obj] == -1} { + lappend observers $obj + } + } +} +Observer::SubjectMgt instproc detach {hook objs} { + upvar [self callinglevel] $hook observers + if {[info exists observers]} { + foreach obj $objs { + set p [lsearch $observers $obj] + set observers [lreplace $observers $p $p] + } + } +} + +Observer::SubjectMgt instproc attachPre {procName args} { + my instvar preObservers + my attach preObservers($procName) $args +} +Observer::SubjectMgt instproc attachPost {procName args} { + my instvar postObservers + my attach postObservers($procName) $args +} +Observer::SubjectMgt instproc detachPre {procName args} { + my instvar preObservers + my detach preObservers($procName) $args +} +Observer::SubjectMgt instproc detachPost {procName args} { + my instvar postObservers + my detach postObservers($procName) $args +} + +Observer::Subject instproc init args { + next + my superclass [list Observer::SubjectMgt [my info superclass]] + my instfilter notificationFilter +} + +Observer instproc timeout t { + my set timeout $t +} + +Observer instproc update {subject args} { + #addTimeOut [my set timeout] "my update $subject $args" + #$subject getResponse + # do something with the response + puts [self]---update +} + Index: xotcl/library/patterns/pkgIndex.tcl =================================================================== diff -u --- xotcl/library/patterns/pkgIndex.tcl (revision 0) +++ xotcl/library/patterns/pkgIndex.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,19 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex -direct" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded xotcl::pattern::adapter 0.9 [list source [file join $dir adapter.xotcl]] +package ifneeded xotcl::pattern::chainOfResponsibility 0.9 [list source [file join $dir ChainOfResponsibility.xotcl]] +package ifneeded xotcl::pattern::composite 0.9 [list source [file join $dir composite.xotcl]] +package ifneeded xotcl::pattern::link 0.9 [list source [file join $dir link.xotcl]] +package ifneeded xotcl::pattern::manager 0.8 [list source [file join $dir manager.xotcl]] +package ifneeded xotcl::pattern::observer 0.8 [list source [file join $dir observer.xotcl]] +package ifneeded xotcl::pattern::onCalleeProxy 0.8 [list source [file join $dir OnCalleeProxy.xotcl]] +package ifneeded xotcl::pattern::singleton 0.8 [list source [file join $dir Singleton.xotcl]] +package ifneeded xotcl::pattern::sortedCompositeWithAfter 0.9 [list source [file join $dir SortedComposite.xotcl]] Index: xotcl/library/pkgIndex.tcl =================================================================== diff -u --- xotcl/library/pkgIndex.tcl (revision 0) +++ xotcl/library/pkgIndex.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,8 @@ +set __dir__ $dir +foreach index [glob -nocomplain [file join $dir * pkgIndex.tcl]] { + set dir [file dirname $index] + source $index +} +set dir $__dir__ +unset __dir__ + Index: xotcl/library/rdf/COPYRIGHT =================================================================== diff -u --- xotcl/library/rdf/COPYRIGHT (revision 0) +++ xotcl/library/rdf/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/library/rdf/RDFCreator.xotcl =================================================================== diff -u --- xotcl/library/rdf/RDFCreator.xotcl (revision 0) +++ xotcl/library/rdf/RDFCreator.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,133 @@ +# $Id: RDFCreator.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::rdf::tripleRecreator 0.9 + +package require xotcl::rdf::parser + +Class RDFCreator -parameter { + {rdfNS "http://www.w3.org/1999/02/22-rdf-syntax-ns#"} + {openExprs ""} +} + +Class OpenExpr -parameter { + {type ""} + {subject ""} + {closing ""} +} + +RDFCreator instproc init args { + next +} + +RDFCreator instproc free {} { + my instvar openExprs + while {$openExprs != ""} { + set o [lindex $openExprs 0] + set openExprs [lrange $openExprs 1 end] + $o destroy + } +} + +RDFCreator instproc sort {tl} { + # + # this assumes that the triples are created and named in node tree order, e.g. + # through autonames like triple0, triple1, ... (as in rdfTripleCreator) + # + # => bag types defs are before bag's _1, _2 -- etc. + # + # otherwise overload sorting method ! + # + return [lsort $tl] +} + +RDFCreator instproc createFromTriples {tripleList} { + my instvar openExprs + set heading "\n" + set closing "\n" + } + } + } + + if {[set nsPrefix [[self]::ns searchFullName $ns]] == ""} { + [self]::ns add [set nsPrefix [my autoname $prefix]] $ns + append heading "\n xmlns:${nsPrefix}=\"$ns\"" + } + + set oe [lindex [my set openExprs] 0] + + if {$oe == "" || [$oe subject] != $s} { + if {$oe != ""} { + append body [$oe closing] + [lindex [set openExprs] 0] destroy + set openExprs [lrange $openExprs 1 end] + } + if {$opening == ""} { + append body "\n" + set closing "\n" + set type "Description" + } else { + append body $opening + } + set noe [my OpenExpr [my autoname oe]] + set openExprs [concat $noe $openExprs] + + $noe subject $s + $noe closing $closing + $noe type $type + set oe $noe + } + set tn ${nsPrefix}:$name + + switch -exact [$oe type] { + RDFDescription { + #puts DESCRIPTION + append body "\n<$tn> [$t object] " + } + RDFAlt - RDFSeq { + #puts ALT---$tn + if {[regexp {rdf:_([0-9]*)} $tn _ __]} { + append body "\n" + } + } + RDFBag { + if {[regexp {rdf:_([0-9]*)} $tn _ __]} { + append body "\n<$tn resource=\"[$t object]\"/>" + } + } + } + } else { + puts "Predicate '$p' not matched" + # hier als xmlns behandeln ... + } + } + append heading ">" + set r $heading + while {$openExprs != ""} { + set oe [lindex $openExprs 0] + set openExprs [lrange $openExprs 1 end] + append body [$oe closing] + $oe destroy + } + append r $body + append r "\n" + return $r +} Index: xotcl/library/rdf/RDFTriple.xotcl =================================================================== diff -u --- xotcl/library/rdf/RDFTriple.xotcl (revision 0) +++ xotcl/library/rdf/RDFTriple.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,535 @@ +# $Id: RDFTriple.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::rdf::triple 0.9 + +package require xotcl::rdf::parser + +Class RDFTriple -parameter { + predicate + subject + object +} + +RDFTriple instproc dump {} { + #set o [my object]; if {[info command $o] != ""} { $o showVars } + #return "P: [my predicate] S: [my subject] O: [my object]\n" + return "[my subject] -[my predicate]-> '[my object]'\n" +} + +Class NodeInfo -parameter { + lastCurrentNode + {aboutEach 0} + {aboutEachPrefix 0} + topID + {statements ""} +} + +Class DescriptionInfo -superclass NodeInfo -parameter { + {bagID 0} +} + +Class PropertyInfo -superclass NodeInfo -parameter { + {reify 0} + generatedParentID +} + +Class AboutEachMgr + +AboutEachMgr instproc init args { + my array set entries {} + next +} + +AboutEachMgr instproc reset {} { + foreach c [my info children] {$c destroy} + my init +} + +AboutEachMgr instproc addEntry {name} { + my set entries($name) "" +} + +AboutEachMgr instproc isEntry {name} { + my exists entries($name) +} + +AboutEachMgr instproc addTriple {name p s o} { + if {[my exists entries($name)]} { + set r [RDFTriple create [self]::[my autoname name%08d]] + $r set predicate $p + $r set subject $s + $r set object $o + my lappend entries($name) $r + return $r + } + return "" +} + +AboutEachMgr instproc getTriples {name} { + if {[my exists entries($name)]} { + my set entries($name) + } else {return ""} +} + +Class RDFTripleDB +RDFTripleDB instproc add {p s o} { + #my showCall + set r [RDFTriple create [self]::[my autoname triple%08d]] + $r set predicate $p + $r set subject $s + $r set object $o + return $r +} +RDFTripleDB instproc dump {} { + #my showCall + set r "" + foreach fact [my info children] {append r [$fact dump]} + return $r +} +RDFTripleDB instproc getTriples {} { + # for the time being: return only children of type RDFTriple + set ch {} + foreach c [my info children] {if {[$c info class] == "::RDFTriple"} {lappend ch $c}} + return $ch + #my info children +} +RDFTripleDB instproc reset {} { + #my showCall + foreach c [my info children] {$c destroy} + my autoname -reset triple + #my showMsg "children after reset: <[my info children]>'" +} +# return all triples that match the subject +RDFTripleDB instproc querySubject {s} { + #my showCall + set r "" + foreach t [my info children] { + if {[string match $s [$t subject]]} { + lappend r $t + } + } + return $r +} + +RDFTripleDB instproc queryPredicate {p} { + #my showCall + set r "" + foreach t [my info children] { + if {[string match $p [$t predicate]]} { + lappend r $t + } + } + return $r +} + +RDFTripleDB instproc queryPredicateOnSubject {p s} { + #my showCall + foreach t [my querySubject $s] { + if {[string match $p [$t predicate]]} { + # there may be only one matching P on a S + # return the triple + return $t + } + } + return "" +} +RDFTripleDB instproc prettyTriples {} { + my instvar result + if {[my exists table]} {my unset table} + if {[my exists subjectPrinted]} {my unset subjectPrinted} + set result "" + + foreach triple [lsort [my getTriples]] { + set subject [$triple set subject] + set predicate [$triple set predicate] + set object [$triple set object] + + regexp {^http.*w3[.]org.*(\#.*)$} $predicate _ predicate + regexp {^http.*w3[.]org.*(\#.*)$} $object _ object + my lappend table($subject) $predicate $object + } + foreach subject [lsort [my array names table]] { + if {![regexp {^rdfdoc\#} $subject]} { my prettyStatements "" $subject } + } + set r $result; set result "" + foreach subject [lsort [my array names table]] { + if {![my exists subjectPrinted($subject)]} { + my prettyStatements "" $subject + } + } + if {$result != ""} { + append r "\n=================== unreferenced:\n$result" + + } + return $r +} +RDFTripleDB instproc prettyStatement {space subject predicate object} { + my append result "$space [format %-35s $subject] [format %-25s $predicate] $object\n" +} +RDFTripleDB instproc prettyStatements {space subject} { + if {![my exists table($subject)]} { + my append result "$space NO VALUE FOR $subject\n" + } else { + if {![my exists subjectPrinted($subject)]} { + my set subjectPrinted($subject) 1 + foreach {predicate object} [my set table($subject)] { + my prettyStatement $space $subject $predicate $object + if {[regexp {^rdfdoc\#} $object]} { + my prettyStatements "$space " $object + } + } + } + } +} + + +Class TripleVisitor -superclass NodeTreeVisitor -parameter { + {descriptionAsBag 0} + {currentNode ""} + parser + rdfNS +} + +TripleVisitor instproc getInfo {} { + my set openNode([my set currentNode]) +} + +TripleVisitor instproc getLastInfo {info} { + my set openNode([$info set lastCurrentNode]) +} + +TripleVisitor instproc popInfo {objName} { + set i [my getInfo] + my set currentNode [$i set lastCurrentNode] + my unset openNode($objName) + return $i +} + +TripleVisitor instproc pushInfo {objName ei} { + set lce [$ei set lastCurrentNode [my set currentNode]] + if {$lce != ""} { + set lastInfo [my set openNode($lce)] + $ei aboutEach [$lastInfo aboutEach] + $ei aboutEachPrefix [$lastInfo aboutEachPrefix] + } + my set openNode($objName) $ei + my set currentNode $objName +} + +TripleVisitor instproc qualify {obj var} { + [$obj resolveNS] getFullName $var +} + +TripleVisitor instproc init args { + my array set openNode {{} {}} + RDFTripleDB create [self]::db + AboutEachMgr create [self]::aboutEach + AboutEachMgr create [self]::aboutEachPrefix + next +} + +TripleVisitor instproc resetWithoutDB args { + [self]::aboutEach reset + [self]::aboutEachPrefix reset + next +} + +TripleVisitor instproc reset args { + [self]::db reset + my resetWithoutDB + next +} + +TripleVisitor instproc addDB {p s o} { + #puts "ADDDB: P<$p> S<$s> O<$o>" + set info [my getInfo] + if {$info != ""} { + set topID [$info set topID] + if {[$info aboutEach]} { + return [[self]::aboutEach addTriple $topID $p $s $o] + } elseif {[$info aboutEachPrefix]} { + return [[self]::aboutEachPrefix addTriple $topID $p $s $o] + } + } + return [[self]::db add $p $s $o] +} + +TripleVisitor instproc checkReification {triple node} { + # for statements that nest inside a description/property, we remember + # the statement to be able to reify them + # (e.g., bag created for description) + if {$triple != "" && $node != ""} { + set info [my set openNode($node)] + if {[my isobject $info] && [$info istype NodeInfo]} { + ${info} lappend statements $triple + } + } +} + +TripleVisitor instproc qualifyWithBaseURL v { + if {[string match "\#*" $v]} { + return [[my set parser] baseURL]$v + } + return $v +} + +TripleVisitor instproc RDFTag {objName} { + set ns [$objName resolveNS] + set rdfNS [$ns searchNamespaceByPrefix rdf] + if {$rdfNS == ""} { + set rdfNS [$ns searchNamespaceByPrefix xmlns] + } + my set rdfNS $rdfNS +} +TripleVisitor instproc DescriptionNode objName { + set di [DescriptionInfo create [self]::[my autoname di]] + $di topID [my qualifyWithBaseURL [$objName getSubject]] + my pushInfo $objName $di + # + # if a description nests inside a Member, we need a triple + # for the member index (connected to the Description topId) + # + if {[[set member [$objName info parent]] info class] == "::RDFMember"} { + set bag_ID [[$member info parent] set ID] + my addDB [my qualify $objName [$member set memberIndex]] \ + $bag_ID [$di set topID] + } +} + +TripleVisitor instproc handlePCData {objName pcdata} { + set info [my getInfo] + + if {[set lcn [$info set lastCurrentNode]] == ""} { + #puts stderr "cannot determine lastCurrentNode from $info" + #$info showVars + set selector "" + } else { + set selector [$lcn info class] + } + + switch -exact $selector { + ::RDFDescription { + set triple [my addDB \ + [my qualify $objName [$objName set content]] \ + [$info set topID] $pcdata] + my checkReification $triple $lcn + } + ::RDFProperty { + if {[set rAttr [$lcn getRDFAttribute resource]] != ""} { + set triple [my addDB \ + [my qualify $objName [$objName set content]] \ + [$lcn set $rAttr] $pcdata] + #$lcn showVars + } else { + set lastInfo [my getLastInfo $info] + if {[$lastInfo exists generatedParentID]} { + set parentID [$lastInfo set generatedParentID] + } else { + set parentID [[$objName info parent] set ID] + } + #set parentID [$lastInfo set generatedParentID] + set triple [my addDB \ + [my qualify $objName [$objName set content]] \ + $parentID $pcdata] + } + } + default { + #puts stderr "create a generatedParentID for reification" + $info set generatedParentID [[my set parser] makeID] + set triple [my addDB \ + [my qualify $objName [$objName set content]] \ + [$info set generatedParentID] $pcdata] + my checkReification $triple [my set currentNode] + } + } + $info set tripleWritten 1 +} + +TripleVisitor instproc Property objName { + set info [PropertyInfo create [self]::[my autoname pi]] + ## if we find no subject and are in Container -> + ## reifiy over generatedParentID + set propSubject [$objName getSubject] + + $info topID [my qualifyWithBaseURL $propSubject] + my pushInfo $objName $info + + if {[$objName exists pcdata]} { + my handlePCData $objName [$objName getFirstPCData] + } +} + +TripleVisitor instproc ContainerNode objName { + set ID [my qualifyWithBaseURL [$objName set ID]] + foreach t [$objName array names rdfTypes] { + my addDB [my qualify $objName \ + [$objName qualifyWithRdfNsPrefix type]] $ID $t + } +} + +TripleVisitor instproc Member objName { + set container [$objName info parent] + set resource [$objName qualifyWithRdfNsPrefix resource] + set parseType [$objName qualifyWithRdfNsPrefix parseType] + if {[$objName exists pcdata]} { + set co [$objName getFirstPCData] + } elseif {[$objName exists attributes(resource)]} { + set co [$objName set attributes(resource)] + } elseif {[$objName exists attributes($resource)]} { + set co [$objName set attributes($resource)] + } + #puts stderr "CONTAINER = [info exists co]" + if {[info exists co]} { + my addDB \ + [my qualify $container [$objName set memberIndex]] \ + [$container set ID] $co + } else { + #$objName showVars + } +} + +TripleVisitor instproc visit objName { + set cl [$objName info class] + $objName instvar attributes + set triple "" + + #puts "********Visit $objName -- $cl" + + switch -exact $cl { + {::RDFTag} {my RDFTag $objName} + {::RDFDescription} {my DescriptionNode $objName} + {::RDFProperty} {my Property $objName} + {::RDFBag} - {::RDFSeq} - {::RDFAlt} {my ContainerNode $objName} + {::RDFMember} {my Member $objName} + } + + foreach a [array names attributes] { + regexp "^([$objName set rdfNSPrefix]:|)(.*)" $a _ __ an + switch -exact $an { + bagID { + set info [my getInfo] + $info set bagID 1 + } + aboutEach { + set info [my getInfo] + if {[DescriptionInfo info instances $info] == ""} { + error "AboutEach not in description" + } + $info aboutEach 1 + [self]::aboutEach addEntry [my qualifyWithBaseURL [$objName getSubject]] + } + aboutEachPrefix { + set info [my getInfo] + if {[DescriptionInfo info instances $info] == ""} { + error "AboutEachPrefix not in description" + } + $info aboutEachPrefix 1 + [self]::aboutEachPrefix addEntry [my qualifyWithBaseURL [$objName getSubject]] + } + resource { + if {$cl == "::RDFProperty"} { + my handlePCData $objName [set attributes($a)] + } + } + } + } +} + +TripleVisitor instproc reificate {objName p s o} { + set memberID [[my set parser] makeID] + my addDB [my qualify $objName \ + [$objName qualifyWithRdfNsPrefix predicate]] $memberID $p + my addDB [my qualify $objName \ + [$objName qualifyWithRdfNsPrefix subject]] $memberID $s + my addDB [my qualify $objName \ + [$objName qualifyWithRdfNsPrefix object]] $memberID $o + my addDB [my qualify $objName \ + [$objName qualifyWithRdfNsPrefix type]] $memberID \ + [my qualify $objName [$objName qualifyWithRdfNsPrefix Statement]] + return $memberID +} + +TripleVisitor instproc visitEnd objName { + switch -exact [$objName info class] { + {::RDFDescription} { + set di [my popInfo $objName] + if {[my descriptionAsBag] || [$di set bagID]} { + set bagID [$objName set bagID] + my addDB [my qualify $objName [$objName qualifyWithRdfNsPrefix type]] \ + $bagID [my qualify $objName [$objName qualifyWithRdfNsPrefix Bag]] + + set bagCount 0 + + foreach s [$di set statements] { + set memberID [my reificate $objName \ + [$s set predicate] [$s set subject] [$s set object]] + my addDB [my qualify $objName \ + [$objName qualifyWithRdfNsPrefix _[incr bagCount]]] \ + $bagID $memberID + } + } + foreach t [$objName array names rdfTypes] { + my addDB [my qualify $objName [$objName qualifyWithRdfNsPrefix "type"]] \ + [$objName getSubject] $t + } + $di destroy + } + {::RDFProperty} { + set info [my popInfo $objName] + if {![$info exists tripleWritten]} { + set triple "" + foreach fc [$objName info children] { + switch -exact [$fc info class] { + {::RDFDescription} { + set triple [my addDB \ + [my qualify $objName [$objName set content]] \ + [my qualifyWithBaseURL [$objName getSubject]] [$fc getSubject]] + break + } + {::RDFBag} - {::RDFSeq} - {::RDFAlt} { + set triple [my addDB \ + [my qualify $objName [$objName set content]] \ + [my qualifyWithBaseURL [$objName getSubject]] [$fc set ID]] + break + } + } + } + if {$triple != ""} { + my checkReification $triple [my set currentNode] + } + } + $info destroy + } + } +} + +TripleVisitor instproc evaluateAboutEach {} { + set triplesWritten "" + set rdfNSFullName [[my rdfNS] searchPrefix rdf] + + foreach entry [[self]::aboutEach array names entries] { + # matching entry triples should be bag types and their + # members -> duplication of aboutEach statements for the + # members + foreach entryTriple [lsort [[self]::db querySubject $entry]] { + if {[regexp "^${rdfNSFullName}_\[0-9\]*$" [$entryTriple predicate]]} { + foreach t [[self]::aboutEach getTriples $entry] { + set subject [$t subject] + # if this is a toplevel elt of an about each tree -> its + # subject is the object of the container member + if {$subject == $entry} { + [self]::db add [$t predicate] [$entryTriple object] [$t object] + } elseif {[lsearch $triplesWritten $t] == -1} { + [self]::db add [$t predicate] $subject [$t object] + lappend triplesWritten $t + } + } + } + } + } +} + +TripleVisitor instproc interpretNodeTree {node} { + my set parser [$node set parser] + $node accept [self] + my evaluateAboutEach +} Index: xotcl/library/rdf/pkgIndex.tcl =================================================================== diff -u --- xotcl/library/rdf/pkgIndex.tcl (revision 0) +++ xotcl/library/rdf/pkgIndex.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,14 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex -direct" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded xotcl::rdf::parser 0.9 [list source [file join $dir xoRDF.xotcl]] +package ifneeded xotcl::rdf::recreatorVisitor 0.9 [list source [file join $dir rdfRecreatorVisitor.xotcl]] +package ifneeded xotcl::rdf::triple 0.9 [list source [file join $dir RDFTriple.xotcl]] +package ifneeded xotcl::rdf::tripleRecreator 0.9 [list source [file join $dir RDFCreator.xotcl]] Index: xotcl/library/rdf/rdfExample.xotcl =================================================================== diff -u --- xotcl/library/rdf/rdfExample.xotcl (revision 0) +++ xotcl/library/rdf/rdfExample.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,76 @@ +#!../../src/xotclsh +#!/usr/local/bin/xotclsh +# $Id: rdfExample.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# +# small Example for usage of xoXML +# +package require xotcl::package +package require xotcl::trace +package require xotcl::rdf::parser +package require xotcl::rdf::recreatorVisitor +package require xotcl::xml::printVisitor + +# +# instantiate parser and parser an example text into a node tree +# +RDFParser x +x parse { + + + + + Mary Andrew + Jacky Crystal + + + + + + + + + + + + + The Coolest Web Page + Il Pagio di Web Fuba + + + + + some text + + + + +} + +proc run {} { + # + # print the node treee to the std output + # + puts ************************************************************************ + puts "Node Tree:" + puts ************************************************************************ + PrintVisitor pv + foreach tn [x info children topNode*] { + pv interpretNodeTree $tn + } + + # + # recreate xml text and print it to the std output + # + puts \n + puts ************************************************************************ + puts "Recreated RDF Text:" + puts ************************************************************************ + RDFRecreatorVisitor rv + foreach tn [x info children topNode*] { + set result [rv interpretNodeTree $tn] + puts $result + } +} +run Index: xotcl/library/rdf/rdfRecreatorVisitor.xotcl =================================================================== diff -u --- xotcl/library/rdf/rdfRecreatorVisitor.xotcl (revision 0) +++ xotcl/library/rdf/rdfRecreatorVisitor.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,35 @@ +#$Id: rdfRecreatorVisitor.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::rdf::recreatorVisitor 0.9 +package require xotcl::rdf::parser +package require xotcl::xml::recreatorVisitor + +############################################################################## +# +# a visitor that recreates an RDF representation from a +# node tree +# +############################################################################# +Class RDFRecreatorVisitor -superclass XMLRecreatorVisitor + +RDFRecreatorVisitor instproc appendLineFeed obj { + if {[set parseType [$obj getRDFAttribute parseType]] != ""} { + if {$parseType != "Resource"} { + # we have parseType == Literal + # -> don't append "\n" + return "" + } + } + return "\n" +} + +RDFRecreatorVisitor instproc visit objName { + next + my instvar result + if {[$objName istype RDFResource]} { + foreach t [$objName array names rdfTypes] { + set ts [$objName prependRDFPrefix type] + append result " [my insertIndent $objName]<$ts resource=\"$t\"/>\n" + } + } + return $result +} \ No newline at end of file Index: xotcl/library/rdf/xoRDF.xotcl =================================================================== diff -u --- xotcl/library/rdf/xoRDF.xotcl (revision 0) +++ xotcl/library/rdf/xoRDF.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,769 @@ +# $Id: xoRDF.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::rdf::parser 0.9 + +package require xotcl::xml::parser +#package require xotcl::pattern::link +package require xotcl::trace + +############################################################################## +# +# RDF Parse Type Handling for RDF Node Class and RDF Parser class +# to be used as mixin. Here, we have decomposed the parse type handling +# +############################################################################## + +# +# Nodes just call "isParseLiteral", "isParseResource", and "handleParseType" +# by their template methods -> mixins concretizes implementation +# +Class RDFNodeParseTypeHandling + +# +# parseType=literal nodes are not parsed, but handled as literals +# -> the XML parser should parse these nodes -> we have cut them off +# if we encounter "parseType = literal" nextParsedLiterals searches the +# parseLiterals array and returns the content +# +RDFNodeParseTypeHandling instproc nextParsedLiterals {} { + set parser [my set parser] + $parser set parseLiterals([$parser incr parseLiteralsCount]) +} + +# +# handle attributes that determine the parse type +# +RDFNodeParseTypeHandling instproc handleParseType value { + if {$value == "Resource"} { + my set parseResource 1 + } else { + # with RDF 1.0 all values other than Resource are treated + # as parseType = literal + my set pcdata [list "" [my nextParsedLiterals]] + my set parseLiteral 1 + } +} + +# +# two convinience methods that tell us whether the parse type is literal/resource +# +RDFNodeParseTypeHandling instproc isParseLiteral {} { + # + # if the parse literal var is set -> one child + # is of type ParseTypeLiteral ! + # + my exists parseLiteral +} +RDFNodeParseTypeHandling instproc isParseResource {} { + # + # if the parseResource var is set -> one child + # is of type ParseTypeResource ! + # + my exists parseResource +} + +# +# and we overload the Parser's parse method in order to cut off +# all parseType = "Literal", because we have to hinder the XML +# parser to parse RDF text that is marked as parseType = literal +# we store the result in an array "parseLiterals" that is used +# by the RDFNodeParseTypeHandling Mixin +# +Class RDFParserParseTypeHandling +RDFParserParseTypeHandling instproc parse data { + my array set parseLiterals {} + my set parseLiteralsCount 0 + set count 0 + + set dt $data + + while {[set pt [string first "parseType" $dt]] != -1} { + # we cut the string off manually, because a regexp is slower + if {$::tcl_version > 8.0} { + set last [string first "=" $dt $pt] + } else { + set last [string first "=" [string range $dt $pt end]] + incr last $pt + } + set ptStart [expr {[string last "<" [string range $dt 0 $pt]] + 1}] + set propName [string range $dt $ptStart $pt] + set blank [string first " " $propName] + if {$blank != -1} { + set propName [string range $propName 0 [expr {$blank -1}]] + } + set dt [string range $dt $last end] + # All parse types != Resource treated as literals + if {![regexp {^= *[\"']Resource} $dt]} { + regexp -indices ">" $dt idx + set start [lindex $idx 1] + if {[regexp -indices "" $dt idx]} { + set endTagLeft [lindex $idx 0] + set literal [string range $dt [expr {$start + 1}] [expr {$endTagLeft - 1}]] + set dt [string range $dt $endTagLeft end] + my set parseLiterals([incr count]) $literal + } else { + error "end tag for $propName missing" + } + } + } + next $data +} + +############################################################################## +# +# RDFNode Node Class +# +############################################################################## + +Class RDFNode -superclass XMLNode -parameter { + subject + {rdfNSPrefix ""} +} +@ Class RDFNode -superclass XMLNode { + description { + general superclass for RDF nodes + common properties + } +} + +# +# add mixins for parse type handling +# +RDFNode instproc init args { + next + my mixinappend RDFNodeParseTypeHandling + set p [my info parent] + if {[$p exists rdfNSPrefix]} { + my set rdfNSPrefix [$p set rdfNSPrefix] + #puts stderr "RDF Prefix defined in [self]->init to [$p set rdfNSPrefix]" + } +} + +RDFNode instproc parseData {text} { + if {[my isParseLiteral]} {return} + next +} + +# +# try to find the "subject" of the RDF statement -> +# if it not found on the actual node search the parents +# +# per default subject is ""; subclasses add subjects, +# when they encounter ID, about, ... attrs +# +RDFNode instproc getSubject {} { + for {set o [self]} {![$o istype RDFTag]} {set o [$o info parent]} { + if {[$o exists subject]} {return [$o set subject]} + } + return "" +} + + +# +# lets the parser construct an unique ID in the parser +# +RDFNode instproc makeID {} { + [my set parser] makeID +} + +# +# abstract methods that have to be concretized with parse type handling +# by a parse type mixin (or in subclass) +# +RDFNode abstract instproc isParseLiteral {} +RDFNode abstract instproc isParseResource {} +RDFNode abstract instproc handleParseType value + +RDFNode instproc appendRDFType t { + set t [[my resolveNS] getFullName $t] + my set rdfTypes($t) 1 +} + +# +# get a typed node abbreviation -> convert it to +# a description + a nested rdf:type property +# +RDFNode instproc getTypedNode {name attrList} { + set r [my getNestingNode RDFDescription \ + [my qualifyWithRdfNsPrefix Description] $attrList] + $r appendRDFType $name + set r +} + +# +# try to parse children corresponding to parse type or if none is given +# try to parse a child of type obj -> Description or Container +# +RDFNode instproc parseNestedChild {name attrList} { + if {[my isParseResource]} { + if {![my exists resourceDescription]} { + my set resourceDescription \ + [my getNestingNode RDFDescription \ + [my qualifyWithRdfNsPrefix Description] {}] + # we have resolved parseType="resource" with a description + # -> remove parse type attribute info ... it is not correct anymore, + # but remember parseResource flag + if {[my exists attributes(parseType)]} { + my unset attributes(parseType) + } + if {[my exists attributes([set parseType [my qualifyWithRdfNsPrefix parseType]])]} { + my unset attributes($parseType) + } + } + + set r [[my set resourceDescription] getPropertyNodeChild $name $attrList] + } elseif {[my isParseLiteral]} { + set r [self] + # literal -> do nothing + } else { + if {[set node [my isNestingNode $name]] != ""} { + set r [my getNestingNode $node $name $attrList] + } else { + set r [my getTypedNode $name $attrList] + } + } + return $r +} + +# +# step forward in the attrList +# +RDFNode instproc nextAttrNode {node attrList index} { + upvar [self callinglevel] $index i $attrList a + if {$node != ""} { + set a [lreplace $a $i [expr {$i + 1}]] + } else { + incr i 2 + } +} + +# +# create a child node of Property type and return it +# +# don't build a node for "type" properties, but append them to +# the list +# +RDFNode instproc getPropertyNodeChild {name attrList} { + regexp "^[my set rdfNSPrefix]:(.*)" $name _ name + set parser [my set parser] + if {$name == "type" && [my istype RDFResource]} { + # seek for resource attribute and append type to list + set rp [my prependRDFPrefix resource] + set rdfns [$parser set rdfNamespace] + foreach {n v} $attrList { + if {![my istype RDFContainerNodeClass]} { + if {$n == $rp || $n == "resource"} { + foreach c {Bag Alt Seq} { + if {$v == "$rdfns$c"} { + my class ::RDF$c + my set memberNr 0 + my set ID [my set bagID] + my unset bagID + my set content [my prependRDFPrefix $c] + # reclass existing li props to member + set li [my prependRDFPrefix li] + foreach child [lsort [my info children]] { + if {[$child info class] == "::RDFProperty"} { + if {[$child set content] == $li || + [$child set content] == "li"} { + $child class RDFMember + my giveMemberNr $child + $child set content $li + } + } + } + } + } + } + } + my appendRDFType $v + } + return [self] + } else { + set nf [$parser set nodeFactory] + set r [$nf getNode RDFProperty [self]::[my nextChild prop] $parser] + $r set content $name + $r parseAttributes $name $attrList + set r + } +} + +# +# property in abbr syntax (as attribute) +# +RDFNode instproc propertyAttribute {n v} { + set r [my getPropertyNodeChild $n ""] + $r parseData $v + set r +} + +# +# check whether an attribute name matches an attributed RDFNode +# of this class or not +# return the corresponding node class +# +RDFNode instproc isAttribute {n} { + regexp "^[my set rdfNSPrefix]:(.*)" $n _ n + if {[lsearch [[my info class] set attributeList] $n] != -1} { + return $n + } elseif {$n == "xml:lang"} { + # we create attribute for xml_lang (for recreation purposes) + return $n + } + return "" +} + +# +# check if name matches an node class that may be nested in [self] +# +RDFNode instproc isNestingNode {n} { + regexp "^[my set rdfNSPrefix]:(.*)" $n _ n + set cl [my info class] + if {[$cl exists nestingList($n)]} { + return [$cl set nestingList($n)] + } + return "" +} + +RDFNode instproc getNestingNode {node name attrList} { + set parser [my set parser] + set nf [$parser set nodeFactory] + switch $node { + "RDFMember" - "RDFProperty" {set objName prop} + default {set objName res} + } + set r [$nf getNode $node [self]::[my nextChild $objName] $parser] + $r set content $name + $r parseAttributes $name $attrList + set r +} + +# +# check whether the RDF namespace is redefined to another prefix +# +RDFNode instproc makeIndividualNSEntry {prefix entry} { + if {$entry == [[my set parser] rdfNamespace]} { + if {[my set rdfNSPrefix] == "" || $prefix != "xmlns"} { + my set rdfNSPrefix $prefix + } + #puts stderr "RDF Prefix redefined in [self] to $prefix" + } + next +} + +RDFNode instproc qualifyWithRdfNsPrefix t { + set ns [my set rdfNSPrefix] + if {$ns == "xmlns"} {return $t} + return $ns:$t +} + +# +# checks whether a given attribute is part of the attributes array +# and returns the varname, otherwise "" +# +RDFNode instproc getAttribute {n nsFullName} { + set ns [my resolveNS] + set xmlns [$ns searchPrefix xmlns] + if {$xmlns == $nsFullName && [my exists attributes($n)]} { + return attributes($n) + } + set prefix [$ns searchFullName $nsFullName] + if {$prefix != "" && + [my exists attributes($prefix:$n)]} { + return attributes($prefix:$n) + } + return "" +} + +# +# searches for attribute "n" with rdf namespace prefix +# +RDFNode instproc getRDFAttribute {n} { + if {[my exists attributes($n)]} { + return [my set attributes($n)] + } + set rdfNSPrefix [my set rdfNSPrefix] + if {$rdfNSPrefix != "xmlns"} { + set n $rdfNSPrefix:$n + if {[my exists attributes($n)]} { + return [my set attributes($n)] + } + } + return "" +} + +RDFNode instproc prependRDFPrefix ts { + set rdfNSPrefix [my set rdfNSPrefix] + if {$rdfNSPrefix != "xmlns"} {set ts $rdfNSPrefix:$ts} + return $ts +} + +############################################################################## +# +# superclass for all resources (like Description, Alt, Seq, Beg) +# used directly in the parse tree ... resource nodes are mixed in +# +############################################################################## + +Class RDFResource -superclass RDFNode + +RDFResource instproc print {} { + set t [my array names rdfTypes] + if {$t == ""} {return [next]} else {return "[next]\nTYPES: $t"} +} + + +############################################################################## +# +# superclasses for container node classes (alt seq bag) +# +############################################################################## +Class RDFContainerNodeClass -superclass RDFResource + +RDFContainerNodeClass instproc init args { + # cache the member number + # 0 inidicates, there is currently no member + next + + my set memberNr 0 + my set ID [my makeID] + my appendRDFType [my qualifyWithRdfNsPrefix \ + [[my info class] set content]] +} + +RDFContainerNodeClass instproc parseAttributes {name attrList} { + #set index 0 + foreach {n v} $attrList { + if {[set an [my isAttribute $n]] != ""} { + my set attributes($n) $v + if {$an == "ID"} { + my set subject $v + my set ID [[my set parser] set baseURL]\#$v + } + } + #set attrList [my nextAttrNode $an attrList index] + } +} + +RDFContainerNodeClass instproc giveMemberNr {member} { + set pf [my getContentPrefix] + if {$pf != ""} {append pf ":"} + $member set memberIndex "${pf}_[my incr memberNr]" +} + +RDFContainerNodeClass instproc parseStart {name attrList} { + set r [self] + next + if {[set node [my isNestingNode $name]] != ""} { + set r [my getNestingNode $node $name $attrList] + if {[$r info class] == "::RDFMember"} { + my giveMemberNr $r + } + } else { + set r [my getPropertyNodeChild $name $attrList] + } + return $r +} + +############################################################################## +# +# Concrete Factory for creating RDF-style nodes +# +############################################################################## +Class RDFNodeClassFactory -superclass XMLNodeClassFactory +RDFNodeClassFactory instproc content content { + my set content $content +} +RDFNodeClassFactory instproc attributeList attributeList { + my set attributeList $attributeList +} +RDFNodeClassFactory instproc nestingTo nestingTo { + set name [string trimleft [self] :] + foreach cl $nestingTo { + $cl set nestingList([my set content]) $name + } +} + +RDFNodeClassFactory proc create args { + # create the class + set name [next] + switch -exact $name { + RDFDescription - RDFProperty - RDFMember { + my array set attributeList {} + } + RDFMember - RDFProperty { + my array set nestingList {} + } + } +} +########################################################################## +# +# now create a factory and build all the node classes +# needed for the RDF Parser/Interpreter +# +########################################################################## +RDFNodeClassFactory proc createFactories {} { + foreach {name superclasses content attributeList} { + RDFTag RDFNode RDF {} + RDFBag RDFContainerNodeClass Bag {ID} + RDFSeq RDFContainerNodeClass Seq {ID} + RDFAlt RDFContainerNodeClass Alt {ID} + RDFProperty RDFNode "" {bagID ID resource parseType} + RDFMember RDFProperty li {resource parseType} + RDFDescription RDFResource Description {ID bagID about type aboutEach aboutEachPrefix} + } { + #puts "Create class: $name -superclass $superclasses" + RDFNodeClassFactory create $name -superclass $superclasses \ + -content $content \ + -attributeList $attributeList + } +} +RDFNodeClassFactory createFactories + +# +# define nesting constraints +# +RDFTag nestingTo {} +RDFBag nestingTo {RDFTag RDFProperty} +RDFSeq nestingTo {RDFTag RDFProperty} +RDFAlt nestingTo {RDFTag RDFProperty} +RDFMember nestingTo {RDFContainerNodeClass RDFBag RDFSeq RDFAlt} +RDFProperty nestingTo {} +RDFDescription nestingTo {RDFTag RDFMember RDFProperty} + +############################################################################## +# +# add some methods to the property node class +# +############################################################################## + +RDFProperty instproc parseAttributes {name attrList} { + set r [self] + #set index 0 + foreach {n v} $attrList { + if {[my checkForXmlNS $n $v]} {continue} + if {[set an [my isAttribute $n]] != ""} { + my set attributes($n) $v + if {$an == "parseType"} {my handleParseType $v} + } else { + if {![info exists abbrvPropResource]} { + set abbrvPropResource \ + [my getNestingNode RDFDescription \ + [my qualifyWithRdfNsPrefix Description] {}] + } + $abbrvPropResource propertyAttribute $n $v + } + #set attrList [my nextAttrNode $an attrList index] + } + + if {[info exists abbrvPropResource]} { + # if resource attribute is given -> use it for abbr property + # description as about attr + if {[my exists attributes(resource)]} { + set about [my set attributes(resource)] + my unset attributes(resource) + } + if {[my exists attributes([set resource [my qualifyWithRdfNsPrefix resource]])]} { + set about [my set attributes($resource)] + my unset attributes($resource) + } + if {[info exists about]} { + $abbrvPropResource set attributes(about) $about + $abbrvPropResource set subject $about + } + } +} +RDFProperty instproc parseStart {name attrList} { + if {[my isParseLiteral]} {return [self]} + next + return [my parseNestedChild $name $attrList] +} + +############################################################################## +# +# add methods to the member class +# +############################################################################## + +RDFMember parameter { + memberIndex +} + +RDFMember instproc parseAttributes {name attrList} { + #set index 0 + foreach {n v} $attrList { + if {[set an [my isAttribute $n]] != ""} { + my set attributes($n) $v + if {$an == "parseType"} {my handleParseType $v} + } + #set attrList [my nextAttrNode $an attrList index] + } +} + +RDFMember instproc print {} { + return "[next]\nMEMBER-INDEX: [my set memberIndex]" +} + +############################################################################## +# +# add methods to the description node class +# +############################################################################## + +RDFDescription instproc init {args} { + next + set ID [my makeID] + my set subject $ID + my set bagID $ID +} + +RDFDescription instproc parseAttributes {name attrList} { + set r [self] + + # if the parent is a property with an ID -> use it + # as description subject + set ID [my qualifyWithRdfNsPrefix ID] + set parent [my info parent] + if {[$parent exists attributes(ID)]} { + my set subject [$parent set attributes(ID)] + } elseif {[$parent exists attributes($ID)]} { + my set subject [$parent set attributes($ID)] + } + + foreach {n v} $attrList { + if {[my checkForXmlNS $n $v]} {continue} + if {[set an [my isAttribute $n]] != ""} { + my set attributes($n) $v + switch -exact $an { + about - + ID - + aboutEach - + aboutEachPrefix { + my set subject $v + } + bagID { + my set bagID [[my set parser] set baseURL]\#$v + } + type { + my appendRDFType $v + } + } + } else { + set r [my propertyAttribute $n $v] + } + } + return $r +} + +RDFDescription instproc parseStart {name attrList} { + next + return [my getPropertyNodeChild $name $attrList] +} + +############################################################################## +# +# add some methods to the node class +# +############################################################################## + +RDFTag parameter {{startTagOn 0}} + +RDFTag instproc match {c} { + # the prefix of the topnode determines initially how the RDF + # namespace is named ... since several examples don't have a + # namespace definition for this ns, we set here a default, which + # may be overridden by ns definitions in the XML text + if {[regexp {^([^:]*):(.*)} $c _ pre c]} { + my makeIndividualNSEntry $pre [[my set parser] rdfNamespace] + #puts stderr "Making RDF namespace entry for <$pre>" + } + #puts "Match for $c --- Content: [[my info class] set content]" + expr {$c == [[my info class] set content]} +} + +RDFTag instproc parseStart {name attrList} { + set parsed 0 + if {[set node [my isNestingNode $name]] != ""} { + set r [my getNestingNode $node $name $attrList] + } else { + set r [my getTypedNode $name $attrList] + } + next + return $r +} + +RDFTag instproc parseEnd content { + if {!([my startTagOn] && [my match $content])} { + [my errorChild $content] + } + next + self ;# return [self] +} + +############################################################################## +# +# RDF Factory for creating node objects +# +############################################################################## +Class RDFNodeFactory -superclass XMLNodeFactory +#RDFNodeFactory instproc getNode {key objName} { +# set r [next] +# return $r +#} +RDFNodeFactory rdfNodeFactory -sharedNodes {RDFDescription RDFTag} + + +############################################################################## +# +# RDF �arser class used to access the xml parser and produce the +# rdf node tree +# +############################################################################## +Class RDFParser -superclass XMLParser -parameter { + {baseURL "rdfdoc"} + {rdfNamespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#"} +} + +RDFParser instproc init args { + my mixinappend RDFParserParseTypeHandling + + ### this special parser handles rdf:RDF tags + my topLevelHandlerPattern {^([^:]*):RDF|RDF} RDFTag + + next + my set nodeFactory "rdfNodeFactory" +} + +RDFParser instproc makeID {} { + my autoname [my baseURL]\#id +} + +RDFParser instproc reset {} { + next + set id [my baseURL]\#id + my autoname -reset $id +} + +RDFParser instproc createTopLevelNode {name attrList} { + set tn [next] + #$tn makeIndividualNSEntry xmlns [my set rdfNamespace] + ### toplevel node must be of type RDFTag + if {![$tn istype RDFTag]} { + error "Top level node must be of type RDFTag" + } + if {[$tn match $name]} { + $tn set content $name + $tn startTagOn 1 + + ### use default values for rdf/default (xmlns) namespace + #my makeIndividualNSEntry rdfs "http://www.w3.org/TR/1999/PR-rdf-schema-19990303#" + + foreach {n v} $attrList { + if {[$tn checkForXmlNS $n $v]} {continue} + } + } + return $tn +} + +#RDFParser instproc parse data { +# next +#} Index: xotcl/library/registry/COPYRIGHT =================================================================== diff -u --- xotcl/library/registry/COPYRIGHT (revision 0) +++ xotcl/library/registry/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/library/registry/Registry.xotcl =================================================================== diff -u --- xotcl/library/registry/Registry.xotcl (revision 0) +++ xotcl/library/registry/Registry.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,66 @@ +package provide xotcl::registry::registry 0.8 + +package require xotcl::trace +package require xotcl::rdf::triple +package require xotcl::rdf::tripleRecreator +package require xotcl::actiweb::agent + +Class Registry -superclass Agent + +Registry instproc init args { + next + my exportProcs register query queryProperty + RDFParser [self]::parser + TripleVisitor [self]::tripleVisitor -parser [self]::parser + [self]::tripleVisitor descriptionAsBag 0 + my array set services {} +} + +Registry instproc register {rdfScript} { + #my showCall + [[self]::tripleVisitor set parser] parse $rdfScript + [self]::tripleVisitor interpretNodeTree [self]::parser::topNode + [self]::tripleVisitor resetWithoutDB + foreach serviceTriple [[self]::tripleVisitor::db queryPredicate \ + "http://nestroy.wi-inf.uni-essen.de/schema/service#name"] { + set service [$serviceTriple object] + if {[info exists services($service)]} { + puts stderr "we have already such a service '$service'" + # hier koennte man ueberlegen, den service zu loeschen oder nicht + # zZT: loesche altes service + } + puts stderr "REGISTRY: registering $service with [$serviceTriple subject]" + my set services($service) [$serviceTriple subject]; + } +} + +Registry instproc query {service} { + my showCall + if {[info exists services($service)]} { + set s [my set services($service)] + return [[Place getInstance]::rdfCreator createFromTriples [[self]::tripleVisitor::db querySubject $s]] + } +} + +Registry instproc queryProperty {args} { + # returns first service with matching properties + my showCall + foreach s [my array names services] { + set success 1 + foreach {att value} $args { + set t [[self]::tripleVisitor::db queryPredicateOnSubject $att [my set services($s)]] + if {$t == "" || [$t object] != $value} { + set success 0 + break + } + } + if {$success} { + set r [my query $s] + return $r + } else { + return "" + } + } +} + + Index: xotcl/library/registry/pkgIndex.tcl =================================================================== diff -u --- xotcl/library/registry/pkgIndex.tcl (revision 0) +++ xotcl/library/registry/pkgIndex.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,11 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex -direct" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded xotcl::registry::registry 0.8 [list source [file join $dir Registry.xotcl]] Index: xotcl/library/serialize/COPYRIGHT =================================================================== diff -u --- xotcl/library/serialize/COPYRIGHT (revision 0) +++ xotcl/library/serialize/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/library/serialize/RecoveryPoint.xotcl =================================================================== diff -u --- xotcl/library/serialize/RecoveryPoint.xotcl (revision 0) +++ xotcl/library/serialize/RecoveryPoint.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,430 @@ +# $Id: RecoveryPoint.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::scriptCreation::recoveryPoint 0.8 + +## fehlt noch: filter, mixins, metadata, ass, assoption, etc +## beim recover Class's,Object's proc instproc vars nicht ueberschreiben +## filter dann anhaengen etc ... +## der Recovery Filter darf durch Object filter "" nicht gel�scht werden + +# +# filter to ensure that recovering doesn't overwrite +# existing objs/classes +# + +Object instproc recoveryFilter args { + ::set method [self calledproc] + + switch -- $method { + create { + # don't overwrite objects + if {![::Object isobject [lindex $args 0]]} { + next + } else { + # puts stderr "Recovery Filter: omitting [lindex $args 0]" + } + } + proc { + if {[lsearch [my info procs] [lindex $args 0]] == -1} { + next + } else { + # puts stderr "Recovery Filter: omitting proc [self]::[lindex $args 0]" + } + } + instproc { + if {[lsearch [my info instprocs] [lindex $args 0]] == -1} { + next + } else { + # puts stderr "Recovery Filter: omitting instproc [self]::[lindex $args 0]" + } + } + set { + if {[lsearch [my info vars] [lindex $args 0]] == -1} { + next + } else { + # puts stderr "Recovery Filter: omitting var [self]::[lindex $args 0]" + } + } + default {next} + } +} + +# +# remove filter from object +# +Object instproc filterremove f { + ::set fl [my info filter] + puts stderr "filterremove on [self] with $f; fullName: [my filtersearch $f]" + while {[::set index [lsearch $fl [my filtersearch $f]]] != -1} { + ::set fl [lreplace $fl $index $index] + } + my filter $fl +} + +# +# remove mixin from object +# +Object instproc mixinremove m { + puts stderr "mixinremove on [self] with $m" + ::set ml [my info mixins] + while {[::set index [lsearch $ml $m]] != -1} { + ::set ml [lreplace $ml $index $index] + } + my mixin $ml +} + +Class RecoveryPoint \ + -parameter { + {appendedObjs ""} + {appendedCls ""} + {appendedNamespaces ""} + {withState 0} + {appendToFile 0} + {definedObjs [list Object \ + Class \ + Class::Parameter]} + {excludeNames ""} + } + +# +# queries the definedObjs variable whether a given object +# is already defined/predefined or not +# -> a way to exclude classes/objs from saving +# +RecoveryPoint instproc isDefined {n} { + my instvar definedObjs + puts stderr "Checking Defined: $n in $definedObjs" + if {[lsearch $definedObjs [string trimleft $n :]] == -1} { + return 0 + } else { + return 1 + } +} + +RecoveryPoint instproc appendDefined {n} { + my instvar definedObjs + lappend definedObjs [string trimleft $n :] +} + +# +# check whether an obj/cls/namespace is appended already +# append obj/cls/namespace +# +foreach method {Obj Cl Namespace} { + set r { + my instvar {appended${method}s name}} + set r [subst -nocommands -nobackslash $r] + + set s $r + append s { + if {[lsearch $name [string trimleft $n :]] == -1} { + return 0 + } else { + return 1 + } + } + + RecoveryPoint instproc isAppended$method {n} $s + + append r { + lappend name [string trimleft $n :] + } + RecoveryPoint instproc append$method {n} $r +} + + +# +# compare command for lsort +# +RecoveryPoint instproc namespaceDepth {a b} { + set aCount 0 + set bCount 0 + for {set i 0} {$i < [string length $a]} {incr i} { + if {[string index $a $i] == ":"} { + incr aCount + } + } + for {set i 0} {$i < [string length $b]} {incr i} { + if {[string index $b $i] == ":"} { + incr bCount + } + } + if {$aCount == $bCount} { + return 0 + } elseif {$aCount > $bCount} { + return 1 + } + + return -1 +} + +# +# produces a script containing the current state of +# the given obj +# +RecoveryPoint instproc stateScript {obj} { + set script "" + foreach v [$obj info vars] { + if {[lsearch [my set excludeNames] $v] == -1} { + $obj instvar $v + if {[array exists $v]} { + foreach name [array names $v] { + set arr ${v}($name) + set value [$obj set $arr] + append script "$obj set $arr \"$value\"\n" + } + } else { + set value [set $v] + append script "$obj set $v \"$value\"\n" + } + } + } + return $script +} + +# +# produces a script containing the procs of the given obj +# +RecoveryPoint instproc procScript {obj} { + set script "" + foreach p [$obj info procs] { + if {[lsearch [my set excludeNames] $v] == -1} { + append script \ + "$obj proc $p \{[$obj info args $p]\} \{[$obj info body $p]\}\n" + } + } + return $script +} + +# +# produces a script containing the instprocs of the given class +# +RecoveryPoint instproc instprocScript {cl} { + set script "" + foreach p [$cl info instprocs] { + if {[lsearch [my set excludeNames] $v] == -1} { + append script \ + "$cl instproc $p \{[$cl info instargs $p]\} \{[$cl info instbody $p]\}\n" + } + } + return $script +} + +# +# append parent obj/classes/namespaces of an object completly +# + +RecoveryPoint instproc appendParents {name} { + # puts stderr "Recovery -- appendParents $name " + set p "" + set script "" + + set n $name + while {[set np [namespace parent ::$n]] != "::"} { + lappend p $np + set n $np + } + set p [lsort -command {[self] namespaceDepth} $p] + + foreach n $p { + if {[Object isobject $n]} { + if {[$n isclass]} { + append script [my classScript $n] + } else { + append script [my objectScript $n] + } + } else { + if {![my isAppendedNamespace $n]} { + append script "namespace eval $n \{\}\n" + # puts stderr "Recovery -- Appending Namespace: $n" + my appendedNamespace $n + } + } + } + return $script +} + + +# +# produces a script recovering the given obj with all children +# without state +# +RecoveryPoint instproc objectScript {obj} { + # puts stderr "Recovery -- Object Script $obj" + my instvar withState + set script "" + if {![my isDefined $obj] && + ![my isAppendedObj $obj]} { + # if the object's class is not yet appended => do it now + set objClass [$obj info class] + append script [my classScript $objClass] + + # append all parent namespaces + append script [my appendParents $obj] + + # append the obj + append script "$objClass $obj\n" + append script [my procScript $obj] + if {$withState == 1} { + append script [my stateScript $obj] + } + # puts stderr "Recovery -- Appending Object: $obj" + my appendObj $obj + + # append its children + foreach o [$obj info children] { + append script [my objectScript $o] + } + } + return $script +} + +# +# produces a script recovering the given class with all children +# without state +# +RecoveryPoint instproc classScript {cl} { + # puts stderr "Recovery -- Class Script $cl" + my instvar withState + set script "" + if {![my isDefined $cl] && + ![my isAppendedCl $cl]} { + # if the class's meta-class is not yet appended => do it now + set metaClass [$cl info class] + append script [my classScript $metaClass] + + # append all parent namespaces + append script [my appendParents $cl] + + # append the class + append script "$metaClass $cl" + + set sl [$cl info superclass] + if {$sl != ""} { + append script " -superclass \{$sl\}\n" + } else { + append script "\n" + } + + append script [my instprocScript $cl] + append script [my procScript $cl] + + if {$withState == 1} { + append script [my stateScript $cl] + } + + # puts stderr "Recovery -- Appending Class: $cl \n $script" + my appendCl $cl + + # append children + set children [$cl info children] + set classChildren [$cl info classchildren] + + foreach c $children { + if {[lsearch $classChildren $c] != -1} { + append script [my classScript $c] + } else { + append script [my objectScript $c] + } + } + } + return $script +} + +# +# produces a script recovering the given class and all subclasses +# with all their children and all instances +# +# +RecoveryPoint instproc hierarchyScript {cl} { + set script [my classScript $cl] + set sortedInstances \ + [lsort -command {[self] namespaceDepth} [$cl info instances]] + + foreach o $sortedInstances { + append script [my objectScript $o] + } + + foreach c [$cl info subclass] { + append script [my hierarchyScript $c] + } + + return $script +} + +# +# saves a script to a file +# +RecoveryPoint instproc saveScript {filename script} { + my instvar appendToFile + if {$appendToFile} { + set mode a + } else { + set mode w + } + set f [open $filename $mode] + puts $f $script + close $f +} + +# +# load a script from a file +# +RecoveryPoint instproc loadScript {filename} { + set f [open $filename r] + set r [read $f] + close $f + return $r +} + +# +# produce methods to save/recover an object script to/from a file +# with/without state/only state +# + +foreach method {Object ObjectState ObjectWithState Class ClassWithState \ + Hierarchy HierarchyWithState} { + + set s { + my set withState + } + + if {[regexp {(.*)WithState} $method _ m]} { + set call $m + append s "1" + } else { + set call $method + append s "0" + } + + scan $call %c l + set ::low "[format %c [expr {$l + 32}]][string range $call 1 end]" + + append s { + my appendedObjs "" + my appendedCls "" + my appendedNamespaces "" + } + append s " + foreach a \$args \{" + set r { + set script [my ${low}Script } + set r [subst -nocommands -nobackslash $r] + append s $r + append s {$a] + my saveScript $filename $script} + append s " + \} + " + + RecoveryPoint instproc save$method {filename args} $s +} + +RecoveryPoint instproc recover {filename} { + set r [my loadScript $filename] + Object filterappend recoveryFilter + # puts stderr "RecoveryFilter appended for $filename" + eval $r + Object filterremove recoveryFilter + # puts stderr "RecoveryFilter removed for $filename" + return +} \ No newline at end of file Index: xotcl/library/serialize/ScriptCreator.xotcl =================================================================== diff -u --- xotcl/library/serialize/ScriptCreator.xotcl (revision 0) +++ xotcl/library/serialize/ScriptCreator.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,218 @@ +# $Id: ScriptCreator.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::scriptCreation::scriptCreator 0.8 + +Class ScriptCreator \ + -parameter { + {excludedObjs {Object Class Class::Parameter}} + {excludeNames ""} + {dependencyChecking 1} + } + + +# +# queries the excludedObjs variable whether a given object +# is already defined/predefined or not +# -> a way to exclude classes/objs from saving +# +ScriptCreator instproc isExcluded {n} { + my instvar excludedObjs + #puts stderr "Checking Excluded: $n in $excludedObjs" + if {[lsearch $excludedObjs [string trimleft $n :]] == -1} { + return 0 + } else { + return 1 + } +} + +ScriptCreator instproc appendExcluded {n} { + my instvar excludedObjs + lappend excludedObjs [string trimleft $n :] +} + +# +# compare command for lsort +# +ScriptCreator instproc namespaceDepth {a b} { + set aCount 0 + set bCount 0 + for {set i 0} {$i < [string length $a]} {incr i} { + if {[string index $a $i] == ":"} { + incr aCount + } + } + for {set i 0} {$i < [string length $b]} {incr i} { + if {[string index $b $i] == ":"} { + incr bCount + } + } + if {$aCount == $bCount} { + return 0 + } elseif {$aCount > $bCount} { + return 1 + } + + return -1 +} + +# +# produces a script containing the current state of +# the given obj +# +ScriptCreator instproc stateScript {obj} { + set script "" + foreach v [$obj info vars] { + if {[lsearch [my set excludeNames] $v] == -1} { + if {[$obj array exists $v]} { + foreach name [$obj array names $v] { + set arr ${v}($name) + set value [$obj set $arr] + append script "$obj set $arr \"$value\"\n" + } + } else { + set value [$obj set $v] + append script "$obj set $v \"$value\"\n" + } + } + } + return $script +} + +# +# produces a script containing the procs of the given obj +# +ScriptCreator instproc procScript {obj} { + set script "" + foreach p [$obj info procs] { + if {[lsearch [my set excludeNames] $p] == -1} { + append script \ + "$obj proc $p \{[$obj info args $p]\} \{[$obj info body $p]\}\n" + } + } + return $script +} + +# +# produces a script containing the instprocs of the given class +# +ScriptCreator instproc instprocScript {cl} { + set script "" + foreach p [$cl info instprocs] { + if {[lsearch [my set excludeNames] $p] == -1} { + append script \ + "$cl instproc $p \{[$cl info instargs $p]\} \{[$cl info instbody $p]\}\n" + } + } + return $script +} + + + +# +# saves a script to a file +# +ScriptCreator instproc saveScript {filename script} { + set f [open $filename w] + puts $f $script + close $f +} + +# +# load a script from a file +# +ScriptCreator instproc loadScript {filename} { + set f [open $filename r] + set r [read $f] + close $f + return $r +} + +# +# check parent obj/classes/namespaces of an object completly +# +ScriptCreator instproc checkParents {name} { + set p "" + + set n $name + while {[set np [namespace parent ::$n]] != "::"} { + lappend p $np + set n $np + } + set p [lsort -command {my namespaceDepth} $p] + + foreach n $p { + if {![my isExcluded $n] && + ![my isAppended $n]} { + error "ScriptCreator: $name needs parent $n, neither appended nor excluded yet." + } + } +} + +ScriptCreator instproc checkClass {obj class} { + if {![my isExcluded $class] && + ![my isAppended $class]} { + error "ScriptCreator: $obj depends on $class, neither appended nor excluded yet." + } +} + +ScriptCreator instproc isAppended name { + set n [string trimleft $name :] + if {[lsearch [my set appendedNames] $n]!=-1} { + return 1 + } else { + return 0 + } +} + +ScriptCreator instproc appendName name { + set n [string trimleft $name :] + my lappend appendedNames $n +} + +ScriptCreator instproc makeScript args { + my instvar dependencyChecking + my set appendedNames "" + set script "" + foreach name $args { + #puts stderr "Script Creator -- $name" + if {![my isExcluded $name] && + ![my isAppended $name]} { + + if {$dependencyChecking} { + my checkParents $name + } + if {[Object isobject $name]} { + set class [$name info class] + if {$dependencyChecking} { + my checkClass $name $class + } + if {[Object isclass $name]} { + # append the class + #puts stderr "Appending Class: $name" + append script "[$name info class] $name" + set sl [$name info superclass] + if {$dependencyChecking} { + foreach c $sl { + my checkClass $name $c + } + } + if {$sl != ""} { + append script " -superclass \{$sl\}\n" + } else { + append script "\n" + } + append script [my instprocScript $name] + } else { + # append the obj + #puts stderr "Appending Object: $name" + append script "[$name info class] $name\n" + } + append script [my procScript $name] + } else { + append script "namespace eval $name \{\}\n" + #puts stderr "Appending Namespace: $name" + } + my appendName $name + } + } + return $script +} Index: xotcl/library/serialize/Serializer.xotcl =================================================================== diff -u --- xotcl/library/serialize/Serializer.xotcl (revision 0) +++ xotcl/library/serialize/Serializer.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,285 @@ +# $Id: Serializer.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package require XOTcl 1.0 +package provide xotcl::serializer 0.3 + +@ @File { + description { + This package provides the class Serializer, which can be used to + generate a snapshot of the current state of the workspace + in the form of XOTcl source code. + } + authors { + Gustaf Neumann, Gustaf.Neumann@wu-wien.ac.at + } + date { $Date: 2004/05/23 22:50:39 $ } +} + +@ Serializer proc all { + ?-ignoreVarsRE RE? + "provide regular expression; matching vars are ignored" + ?-ignore obj1 obj2 ...? + "provide a list of objects to be omitted"} { + Description { + Serialize all objects and classes that are currently + defined (except the specified omissions and the current + Serializer object). +

    Examples:<@br> + <@tt>Serializer all -ignoreVarsRE {::b$}<@br> + do not serialize any instance variable named b (of any object)

    + <@tt>Serializer all -ignoreVarsRE {^::o1::.*text.*$|^::o2::x$}<@br> + do not serialize any variable of c1 whose name contains + the string "text" and do not serialze the variable x of o2

    + <@tt>Serializer all - ignore obj1 obj2 ... <@br> + do not serizalze the specified objects + } + return "script" +} + +@ Serializer proc deepSerialize { + objs "Objects to be serialized" + ?-ignoreVarsRE RE? + "provide regular expression; matching vars are ignored" + ?-ignore obj1 obj2 ...? + "provide a list of objects to be omitted" + ?-map list? "translate object names in serialized code" +} { + Description { + Serialize object with all child objects (deep operation) + except the specified omissions. For the description of + <@tt>ignore and <@tt>igonoreVarsRE see + <@tt>Serizalizer all. <@tt>map can be used + in addition to provide pairs of old-string and new-string + (like in the tcl command <@tt>string map). This option + can be used to regenerate the serialized object under a different + object or under an different name, or to translate relative + object names in the serialized code.

    + + Examples: + <@tt>Serializer deepSerialize ::a::b::c -map {::a::b ::x::y}<@br> + Serialize the object <@tt>c which is a child of <@tt>a::b; + the object will be reinitialized as object <@tt>::x::y::c, + all references <@tt>::a::b will be replaced by <@tt>::x::y.

    + + <@tt>Serializer deepSerialize ::a::b::c -map {::a::b [self]}<@br> + The serizalized object can be reinstantiated under some current object, + under which the script is evaluated.

    + + <@tt>Serializer deepSerialize ::a::b::c -map {::a::b::c ${var}}<@br> + The serizalized object will be reinstantiated under a name specified + by the variable <@tt>var<@tt> in the recreation context. + } + return "script" +} + +@ Serializer instproc serialize {entity "Object or Class"} { + Description { + Serialize the specified object or class. + } + return {Object or Class with all currently defined methods, + variables, invariants, filters and mixins} +} + +######################################################################################## +Class Serializer -parameter {ignoreVarsRE map} +Serializer proc ignore args { + my set skip $args +} +Serializer instproc ignore args { + foreach i $args { my set skip($i) 1 } +} +Serializer instproc init {} { + my ignore [self] + if {[[self class] exists skip]} { + eval my ignore [[self class] set skip] + } +} +Serializer instproc method-serialize {o m prefix} { + set arglist "" + foreach v [$o info ${prefix}args $m] { + if {[$o info ${prefix}default $m $v x]} { + lappend arglist [list $v $x] } { + lappend arglist $v } + } + lappend r ${prefix}proc $m $arglist [$o info ${prefix}body $m] + foreach p {pre post} { + if {[$o info ${prefix}$p $m]!=""} {lappend r [$o info ${prefix}$p $m]} + } + return [my pcmd $r] +} +Serializer instproc pcmd list { + foreach a $list { + if {[regexp -- {^-[[:alpha:]]} $a]} { + set mustEscape 1 + break + } + } + if {[info exists mustEscape]} { + return "\[list -$list\]" + } else { + return -$list + } +} +Serializer instproc Object-serialize o { + append cmd [list [$o info class] create $o -noinit] " \\\n" + foreach i [$o info procs] { + append cmd " " [my method-serialize $o $i ""] " \\\n" + } + set vset {} + set nrVars 0 + foreach v [$o info vars] { + set setcmd [list] + if {![my exists ignoreVarsRE] || + ![regexp [my set ignoreVarsRE] ${o}::$v]} { + if {[$o array exists $v]} { + lappend setcmd array set $v [$o array get $v] + } else { + lappend setcmd set $v [$o set $v] + } + incr nrVars + append cmd \t [my pcmd $setcmd] " \\\n" + } + } + foreach x {mixin invar} { + set v [$o info $x] + if {[string compare "" $v]} {append cmd [my pcmd [list $x $v]] " \\\n"} + } + set v [$o info filter -guards] + if {[string compare "" $v]} {append cmd [my pcmd [list filter $v]] " \\\n"} + return $cmd +} +Serializer instproc Class-serialize o { + set cmd [my Object-serialize $o] + set p [$o info parameter] + if {[string compare "" $p]} { + append cmd " " [my pcmd [list parameter $p]] " \\\n" + } + foreach i [$o info instprocs] { + append cmd " " [my method-serialize $o $i inst] " \\\n" + } + foreach x {superclass instmixin instinvar} { + set v [$o info $x] + if {[string compare "" $v] && [string compare "::xotcl::Object" $v]} { + append cmd " " [my pcmd [list $x $v]] " \\\n" + } + } + set v [$o info instfilter -guards] + if {[string compare "" $v]} {append cmd [my pcmd [list instfilter $v]] " \\\n"} + return $cmd\n +} + +Serializer instproc args {o prefix m} { + foreach v [$o info ${prefix}args $m] { + if {[$o info ${prefix}default $m $v x]} { + lappend arglist [list $v $x] } { + lappend arglist $v } + } + return $arglist +} +Serializer instproc category c { + if {[$c istype ::Class]} {return Class} {return Object} +} +Serializer instproc allChildren o { + set set $o + foreach c [$o info children] { + eval lappend set [my allChildren $c] + } + return $set +} +Serializer instproc allInstances C { + set set [$C info instances] + foreach sc [$C info subclass] { + eval lappend set [my allInstances $sc] + } + return $set +} + +Serializer instproc topoSort {set} { + if {[my array exists s]} {my array unset s} + if {[my array exists level]} {my array unset level} + foreach c $set { + if {[regexp ^::xotcl:: $c]} continue + if {[my exists skip($c)]} continue + my set s($c) 1 + } + set stratum 0 + while {1} { + set set [my array names s] + if {[llength $set] == 0} break + incr stratum + #puts "$stratum set=$set" + my set level($stratum) {} + foreach c $set { + if {[my [my category $c]-needsNothing $c]} { + my lappend level($stratum) $c + } + } + if {[string equal "" [my set level($stratum)]]} { + my set level($stratum) $set + my warn "Cyclic dependency in $set" + } + foreach i [my set level($stratum)] {my unset s($i)} + } +} +Serializer instproc warn msg { + if {[string compare "" [info command ns_log]]} { + ns_log Notice $msg + } else { + puts stderr "!!! Warning: $msg" + } +} + +Serializer instproc Class-needsNothing x { + if {![my Object-needsNothing $x]} {return 0} + if {[my needsOneOf [$x info superclass]]} {return 0} + if {[my needsOneOf [$x info instmixin ]]} {return 0} + return 1 +} +Serializer instproc Object-needsNothing x { + set p [$x info parent] + if {[string compare $p "::"] && [my needsOneOf $p]} {return 0} + if {[my needsOneOf [$x info class]]} {return 0} + if {[my needsOneOf [$x info mixin ]]} {return 0} + return 1 +} +Serializer instproc needsOneOf list { + foreach e $list {if {[my exists s($e)]} {return 1}} + return 0 +} +Serializer instproc serialize {objectOrClass} { + my [my category $objectOrClass]-serialize $objectOrClass +} +Serializer instproc serializeList {list} { + my topoSort $list + #foreach i [lsort [my array names level]] {puts "$i: [my set level($i)]"} + set result "" + foreach l [lsort [my array names level]] { + foreach i [my set level($l)] { + append result [string trimright [my serialize $i] "\\\n"] \n + } + } + return $result +} +Serializer instproc deepSerialize o { + # assumes $o to be fully qualified + my serializeList [my allChildren $o] +} + +Serializer proc all {args} { + set s [eval my new -childof [self] -volatile $args] + set r [$s serializeList [$s allInstances ::Object]] + if {[string compare [::xotcl::Object info body __exitHandler] "\n;"]} { + append r \n "::xotcl::Object configure " \ + [$s method-serialize ::xotcl::Object __exitHandler ""] \n + } + return $r +} +Serializer proc deepSerialize args { + set s [my new -childof [self] -volatile] + set nr [eval $s configure $args] + foreach o [lrange $args 0 [incr nr -1]] { + append r [$s deepSerialize [$o]] + } + if {[$s exists map]} {return [string map [$s map] $r]} + return $r +} + Index: xotcl/library/serialize/Serializer2.xotcl =================================================================== diff -u --- xotcl/library/serialize/Serializer2.xotcl (revision 0) +++ xotcl/library/serialize/Serializer2.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,290 @@ +# $Id: Serializer2.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package require XOTcl 1.0 +package provide xotcl::serializer 0.4 + +@ @File { + description { + This package provides the class Serializer, which can be used to + generate a snapshot of the current state of the workspace + in the form of XOTcl source code. + } + authors { + Gustaf Neumann, Gustaf.Neumann@wu-wien.ac.at + } + date { $Date: 2004/05/23 22:50:39 $ } +} + +@ Serializer proc all { + ?-ignoreVarsRE RE? + "provide regular expression; matching vars are ignored" + ?-ignore obj1 obj2 ...? + "provide a list of objects to be omitted"} { + Description { + Serialize all objects and classes that are currently + defined (except the specified omissions and the current + Serializer object). +

    Examples:<@br> + <@tt>Serializer all -ignoreVarsRE {::b$}<@br> + do not serialize any instance variable named b (of any object)

    + <@tt>Serializer all -ignoreVarsRE {^::o1::.*text.*$|^::o2::x$}<@br> + do not serialize any variable of c1 whose name contains + the string "text" and do not serialze the variable x of o2

    + <@tt>Serializer all - ignore obj1 obj2 ... <@br> + do not serizalze the specified objects + } + return "script" +} + +@ Serializer proc deepSerialize { + objs "Objects to be serialized" + ?-ignoreVarsRE RE? + "provide regular expression; matching vars are ignored" + ?-ignore obj1 obj2 ...? + "provide a list of objects to be omitted" + ?-map list? "translate object names in serialized code" +} { + Description { + Serialize object with all child objects (deep operation) + except the specified omissions. For the description of + <@tt>ignore and <@tt>igonoreVarsRE see + <@tt>Serizalizer all. <@tt>map can be used + in addition to provide pairs of old-string and new-string + (like in the tcl command <@tt>string map). This option + can be used to regenerate the serialized object under a different + object or under an different name, or to translate relative + object names in the serialized code.

    + + Examples: + <@tt>Serializer deepSerialize ::a::b::c -map {::a::b ::x::y}<@br> + Serialize the object <@tt>c which is a child of <@tt>a::b; + the object will be reinitialized as object <@tt>::x::y::c, + all references <@tt>::a::b will be replaced by <@tt>::x::y.

    + + <@tt>Serializer deepSerialize ::a::b::c -map {::a::b [self]}<@br> + The serizalized object can be reinstantiated under some current object, + under which the script is evaluated.

    + + <@tt>Serializer deepSerialize ::a::b::c -map {::a::b::c ${var}}<@br> + The serizalized object will be reinstantiated under a name specified + by the variable <@tt>var<@tt> in the recreation context. + } + return "script" +} + +@ Serializer instproc serialize {entity "Object or Class"} { + Description { + Serialize the specified object or class. + } + return {Object or Class with all currently defined methods, + variables, invariants, filters and mixins} +} + +######################################################################################## +Class Serializer -parameter {ignoreVarsRE map} +Serializer proc ignore args { + my set skip $args +} +Serializer instproc ignore args { + foreach i $args { my set skip($i) 1 } +} +Serializer instproc init {} { + my ignore [self] + if {[[self class] exists skip]} { + eval my ignore [[self class] set skip] + } +} +Serializer instproc method-serialize {o m prefix} { + set arglist "" + foreach v [$o info ${prefix}args $m] { + if {[$o info ${prefix}default $m $v x]} { + lappend arglist [list $v $x] } { + lappend arglist $v } + } + lappend r ${prefix}proc $m $arglist [$o info ${prefix}body $m] + foreach p {pre post} { + if {[$o info ${prefix}$p $m]!=""} {lappend r [$o info ${prefix}$p $m]} + } + return [my pcmd $r] +} +Serializer instproc pcmd list { + foreach a $list { + if {[regexp -- {^-[[:alpha:]]} $a]} { + set mustEscape 1 + break + } + } + if {[info exists mustEscape]} { + return "\[list -$list\]" + } else { + return -$list + } +} +Serializer instproc Object-serialize o { + append alloc [list [$o info class] alloc $o] + foreach i [$o info procs] { + append cmd " " [my method-serialize $o $i ""] " \\\n" + } + set vset {} + set nrVars 0 + foreach v [$o info vars] { + set setcmd [list] + if {![my exists ignoreVarsRE] || + ![regexp [my set ignoreVarsRE] ${o}::$v]} { + if {[$o array exists $v]} { + lappend setcmd array set $v [$o array get $v] + } else { + lappend setcmd set $v [$o set $v] + } + incr nrVars + append cmd \t [my pcmd $setcmd] " \\\n" + } + } + foreach x {mixin invar} { + set v [$o info $x] + if {[string compare "" $v]} {append cmd [my pcmd [list $x $v]] " \\\n"} + } + set v [$o info filter -guards] + if {[string compare "" $v]} {append cmd [my pcmd [list filter $v]] " \\\n"} + if {[info exists cmd]} { + return "\[$alloc\] configure $cmd\\\n" + } else { + return $alloc + } + return $cmd +} +Serializer instproc Class-serialize o { + set cmd [my Object-serialize $o] + set p [$o info parameter] + if {[string compare "" $p]} { + append cmd " " [my pcmd [list parameter $p]] " \\\n" + } + foreach i [$o info instprocs] { + append cmd " " [my method-serialize $o $i inst] " \\\n" + } + foreach x {superclass instmixin instinvar} { + set v [$o info $x] + if {[string compare "" $v] && [string compare "::xotcl::Object" $v]} { + append cmd " " [my pcmd [list $x $v]] " \\\n" + } + } + set v [$o info instfilter -guards] + if {[string compare "" $v]} {append cmd [my pcmd [list instfilter $v]] " \\\n"} + return $cmd\n +} + +Serializer instproc args {o prefix m} { + foreach v [$o info ${prefix}args $m] { + if {[$o info ${prefix}default $m $v x]} { + lappend arglist [list $v $x] } { + lappend arglist $v } + } + return $arglist +} +Serializer instproc category c { + if {[$c istype ::Class]} {return Class} {return Object} +} +Serializer instproc allChildren o { + set set $o + foreach c [$o info children] { + eval lappend set [my allChildren $c] + } + return $set +} +Serializer instproc allInstances C { + set set [$C info instances] + foreach sc [$C info subclass] { + eval lappend set [my allInstances $sc] + } + return $set +} + +Serializer instproc topoSort {set} { + if {[my array exists s]} {my array unset s} + if {[my array exists level]} {my array unset level} + foreach c $set { + if {[regexp ^::xotcl:: $c]} continue + if {[my exists skip($c)]} continue + my set s($c) 1 + } + set stratum 0 + while {1} { + set set [my array names s] + if {[llength $set] == 0} break + incr stratum + #puts "$stratum set=$set" + my set level($stratum) {} + foreach c $set { + if {[my [my category $c]-needsNothing $c]} { + my lappend level($stratum) $c + } + } + if {[string equal "" [my set level($stratum)]]} { + my set level($stratum) $set + my warn "Cyclic dependency in $set" + } + foreach i [my set level($stratum)] {my unset s($i)} + } +} +Serializer instproc warn msg { + if {[string compare "" [info command ns_log]]} { + ns_log Notice $msg + } else { + puts stderr "!!! Warning: $msg" + } +} + +Serializer instproc Class-needsNothing x { + if {![my Object-needsNothing $x]} {return 0} + if {[my needsOneOf [$x info superclass]]} {return 0} + if {[my needsOneOf [$x info instmixin ]]} {return 0} + return 1 +} +Serializer instproc Object-needsNothing x { + set p [$x info parent] + if {[string compare $p "::"] && [my needsOneOf $p]} {return 0} + if {[my needsOneOf [$x info class]]} {return 0} + if {[my needsOneOf [$x info mixin ]]} {return 0} + return 1 +} +Serializer instproc needsOneOf list { + foreach e $list {if {[my exists s($e)]} {return 1}} + return 0 +} +Serializer instproc serialize {objectOrClass} { + my [my category $objectOrClass]-serialize $objectOrClass +} +Serializer instproc serializeList {list} { + my topoSort $list + #foreach i [lsort [my array names level]] {puts "$i: [my set level($i)]"} + set result "" + foreach l [lsort [my array names level]] { + foreach i [my set level($l)] { + append result [string trimright [my serialize $i] "\\\n"] \n + } + } + return $result +} +Serializer instproc deepSerialize o { + # assumes $o to be fully qualified + my serializeList [my allChildren $o] +} + +Serializer proc all {args} { + set s [eval my new -childof [self] -volatile $args] + set r [$s serializeList [$s allInstances ::Object]] + if {[string compare [::xotcl::Object info body __exitHandler] "\n;"]} { + append r \n "::xotcl::Object configure " \ + [$s method-serialize ::xotcl::Object __exitHandler ""] \n + } + return $r +} +Serializer proc deepSerialize args { + set s [my new -childof [self] -volatile] + set nr [eval $s configure $args] + foreach o [lrange $args 0 [incr nr -1]] { + append r [$s deepSerialize [$o]] + } + if {[$s exists map]} {return [string map [$s map] $r]} + return $r +} + Index: xotcl/library/serialize/pkgIndex.tcl =================================================================== diff -u --- xotcl/library/serialize/pkgIndex.tcl (revision 0) +++ xotcl/library/serialize/pkgIndex.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,13 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex -direct" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded xotcl::scriptCreation::recoveryPoint 0.8 [list source [file join $dir RecoveryPoint.xotcl]] +package ifneeded xotcl::scriptCreation::scriptCreator 0.8 [list source [file join $dir ScriptCreator.xotcl]] +package ifneeded xotcl::serializer 0.3 [list source [file join $dir Serializer.xotcl]] Index: xotcl/library/store/COPYRIGHT =================================================================== diff -u --- xotcl/library/store/COPYRIGHT (revision 0) +++ xotcl/library/store/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/library/store/JufGdbmStorage.xotcl =================================================================== diff -u --- xotcl/library/store/JufGdbmStorage.xotcl (revision 0) +++ xotcl/library/store/JufGdbmStorage.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,40 @@ +# $Id: JufGdbmStorage.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::store::jufgdbm 0.81 + +package require xotcl::store::juf_gdbm +package require xotcl::store + +# +# a simple GNU Gdbm DB Store Access +# +Class Storage=JufGdbm -superclass Storage +Storage=JufGdbm instproc open f { + my set persistenceDB [juf_gdbm open $f rwc] +} + +Storage=JufGdbm instproc store {k v} { + #my showCall + juf_gdbm store [my set persistenceDB] $k $v +} + +Storage=JufGdbm instproc list {} { + juf_gdbm list [my set persistenceDB] +} + +Storage=JufGdbm instproc fetch {k var} { + my instvar persistenceDB + if {[juf_gdbm exists $persistenceDB $k]} { + upvar [self callinglevel] $var value + set value [juf_gdbm fetch $persistenceDB $k] + return 1 + } + return 0 +} + +Storage=JufGdbm instproc close args { + juf_gdbm close [my set persistenceDB] +} + +Storage=JufGdbm instproc delete k { + juf_gdbm delete [my set persistenceDB] $k +} Index: xotcl/library/store/MemStorage.xotcl =================================================================== diff -u --- xotcl/library/store/MemStorage.xotcl (revision 0) +++ xotcl/library/store/MemStorage.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,93 @@ +# $Id: MemStorage.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::store::mem 0.84 +package require xotcl::store 0.84 + +Object xotcl::memStoragePool +xotcl::memStoragePool proc add {filename} { + my set memStores($filename) [Object new -childof [self]] +} +xotcl::memStoragePool proc get {filename} { + if {[my exists memStores($filename)]} { + return [my set memStores($filename)] + } + return "" +} +xotcl::memStoragePool proc remove {filename} { + catch { + set store [my set memStores($filename)] + $store destroy + my unset memStores($filename) + } +} + +# +# a class using an XOTcl Object for memory storage +#the following line worked due to a bug in parameter before... +#Class Storage=Mem -parameter {{searchID ""}} +Class Storage=Mem -superclass Storage +Storage=Mem instproc init args { + my instvar searchID + ::set searchID "" +} +Storage=Mem instproc names {} { + my instvar store + $store array names v +} +Storage=Mem instproc exists name { + my instvar store + $store exists v($name) +} +Storage=Mem instproc unset name { + my instvar store + $store unset v($name) +} +Storage=Mem instproc set args { + my instvar store + ::set l [llength $args] + if {$l == 1} { + $store set v([lindex $args 0]) + } elseif {$l == 2} { + $store set v([lindex $args 0]) [lindex $args 1] + } else { + eval $store set $args + } +} +Storage=Mem instproc close {} { + my instvar store + ::unset store +} +Storage=Mem instproc open filename { + my instvar store + if {[::set store [xotcl::memStoragePool get $filename]] == ""} { + ::set store [xotcl::memStoragePool add $filename] + } +} +Storage=Mem instproc firstkey {} { + my instvar store + $store instvar v + my instvar searchID + if {$searchID != ""} { + array donesearch v $searchID + } + ::set searchID [array startsearch v] + return [array nextelement v $searchID] +} +Storage=Mem instproc nextkey {} { + my instvar store + $store instvar v + my instvar searchID + if {$searchID == ""} { + error "[self class]: firstkey was not invoked on storage search" + } + + ::set elt [array nextelement v $searchID] + if {$elt == ""} { + # if array end is reach search is terminated automatically!! + ::set searchID "" + } + return $elt +} + +### warum geht eigentlich folgendes nicht: +## Object o; o set a::b::c 1 +### dann koennte man sich das set und exists schenken... Index: xotcl/library/store/MultiStorage.xotcl =================================================================== diff -u --- xotcl/library/store/MultiStorage.xotcl (revision 0) +++ xotcl/library/store/MultiStorage.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,64 @@ +package provide xotcl::store::multi 0.9 +package require xotcl::store 0.84 + +Class Storage=multi -superclass Storage +Storage=multi instproc add {dbPackage args} { + my instvar storages names + if {[string length $dbPackage] == 0} { + set dbPackage [Storage defaultPackage] + } + package require xotcl::store::[string tolower $dbPackage] + lappend storages [eval Storage=$dbPackage new -childof [self] $args] +} +Storage=multi instproc init args { + my instvar storages + set storages {} +} +Storage=multi instproc names {} { + my instvar storages + [lindex $storages 0] $names +} +Storage=multi instproc exists name { + my instvar storages + [lindex $storages 0] exists $name +} +Storage=multi instproc unset name { + my instvar storages + foreach s $storages {$s [self proc] $name} +} +Storage=multi instproc set args { + my instvar storages + set l [llength $args] + set name [lindex $args 0] + if {$l == 1} { + [lindex $storages 0] set $name + } elseif {$l == 2} { + foreach s $storages { $s set $name [lindex $args 1]} + } else { + eval set $args + } +} +Storage=multi instproc close {} { + my instvar storages + foreach s $storages {$s [self proc]} +} +Storage=multi instproc dbOpen {} { + my instvar storages + foreach s $storages {$s [self proc]} +} +Storage=multi instproc firstkey {} { + my instvar storages + [lindex $storages 0] firstkey +} +Storage=multi instproc nextkey {} { + my instvar storages + [lindex $storages 0] nextkey +} +Storage=multi instproc checkdir {} { + my instvar storages + foreach s $storages {$s [self proc]} +} +Storage=multi instproc dbOpen {} { + my instvar storages + foreach s $storages {$s [self proc]} +} Index: xotcl/library/store/Persistence.xotcl =================================================================== diff -u --- xotcl/library/store/Persistence.xotcl (revision 0) +++ xotcl/library/store/Persistence.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,355 @@ +# $Id: Persistence.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::store::persistence 0.8 + +package require xotcl::trace +package require xotcl::package +package require xotcl::mixinStrategy +package require xotcl::store + +@ @File { + description { + Persistent store for XOTcl objects with Eager and Lazy persistence. + Take a look at "persistenceExample.xotcl" for exmaple of usage. + } +} + +@ Class PersistenceMgr { + description { + A persistent store requires a persistent manager. The persistent + manager implements the Storage interface via storage mixin. With + the parameter "dbPackage" we can specify which storage will be used. + The persistent manager than tries to load the package + "xotcl::${dbPackage}Storage". Default is Sdbm. + + Example: + <@pre> + PersistenceMgr pmgr -persistenceDir . -persistenceFile example-db + + + } +} + +# +# base class for persistent managers -- just register corresponding +# storage mixin and open DB +# +Class PersistenceMgr -parameter { + {fileName {[string trimleft [self] :]}} + {dbPackage Sdbm} + trace + dirName +} + +PersistenceMgr instproc init args { + my instvar dbPackage + package require xotcl::store::[string tolower $dbPackage] + + Storage=$dbPackage [self]::store $args + foreach v {dirName fileName} { + if {[my exists $v]} { + [self]::store $v [my set $v] + } + } + + if {[my exists trace]} { + [self]::store filter traceFilter + } + my array set persistentObjs {} + next +} +# delegate methods to the store object +PersistenceMgr instproc store args { + eval [self]::store $args +} + + +PersistenceMgr instproc destroy args { + foreach obj [my array names persistentObjs] { + $obj storeall + $obj persistenceMgr "" + } + [self]::store close + next +} +PersistenceMgr instproc assureOpenDb {} { + if {![my exists dbOpen]} { + [self]::store dbOpen + my set dbOpen 1 + } +} +PersistenceMgr instproc addPersistentObj {obj} { + my set persistentObjs($obj) "" +} +PersistenceMgr instproc removePersistentObj {obj} { + if {[my exists persistentObjs($obj)]} { + my unset persistentObjs($obj) + } +} + +@ Class Persistent { + description { + Superclass or mixin class for all persistent objects. Normally + subclasses are used as mixins or instmixins on object, like: + <@pre> + o mixin Persistent=Eager + p mixin Persistent=Lazy + + } +} +# +# Persistence (mixin) classes# +Class Persistent -parameter { + persistenceMgr +} + +# can be overloaded by subclasses, that need a cleanup on +# persistenceMgr->destroy (like Lazy) +Persistent instproc storeall {} {;} + +@ Persistent instproc persistenceMgr {args "persistent manager name"} { + description { + Specify which persistence manager to use for [self] object, like: + <@pre> + o persistenceMgr pmgr + + Each persistent object must have a persistence manager specified, + before vars can be made persistent. + } +} + +# +# turn off persistence with ... persistenceMgr "", but +# persistent vars stay persistent +# +Persistent instproc persistenceMgr args { + if {[llength $args] == 0} { + return [my set [self proc]] + } elseif {[llength $args] == 1} { + set pmgr [lindex $args 0] + if {$pmgr == "" && [my exists persistenceMgr]} { + [my set persistenceMgr] removePersistentObj [self] + my unset persistenceMgr + return "" + } + $pmgr addPersistentObj [self] + return [my set [self proc] $pmgr] + } else { + error "wrong # args: [self] [self proc] ?value?" + } +} + +@ Persistent instproc persistentVars {} { + description { + Returns list of persistent vars. + } +} + +Persistent instproc persistentVars {} { + if {[my exists __persistentVars]} { + return [my set __persistentVars] + } + return "" +} + +@ Persistent instproc persistent {list "persistent variables" } { + description { + Make a list of object variables persistent. If a persistent + DB exists, the values are read from this DB, overwriting the current value. + E.g.: + <@pre> + o persistent {x y} + + + } +} + +Persistent instproc persistent {list} { + my instvar persistenceMgr + if {![info exists persistenceMgr]} {return} + set store ${persistenceMgr}::store + + $persistenceMgr assureOpenDb + foreach var $list { + my lappend __persistentVars $var + # try to refetch vars from db + if {[$store exists [self]::${var}(_____arraynames)]} { + #puts stderr array=[self]::${var} + foreach i [$store set [self]::${var}(_____arraynames)] { + my set ${var}($i) [$store set [self]::${var}($i)] + } + } elseif {[$store exists [self]::$var]} { + #puts stderr "---store=$store exists [self]::$var" + #puts stderr "---set [self]::$var <[$store set [self]::$var]>" + my instvar $var + #set name [$store set [self]::$var] + #puts ***name*[set name]--$var + set $var [$store set [self]::$var] + } elseif {[my exists $var]} { + # + # first store of the variable in persistent store + if {[my array exists $var]} { + # this variable is an array + #puts stderr array=[self]::$var + set anames [my array names $var] + foreach n $anames { + $store set [self]::${var}($n) [my set ${var}($n)] + } + $store set [self]::${var}(_____arraynames) $anames + } else { + #puts stderr "+++set [self]::$var [$store set [self]::$var]" + $store set [self]::$var [my set $var] + } + } else { + error "persistent: $var is not a variable on [self]" + } + } +} + +@ Persistent instproc persistent+init {list "persistent variables" } { + description { + Initialize all data in the list as empty strings, + if they do not exist yet, and then make them persistent + using the 'persistent' method + } +} + +Persistent instproc persistent+init {list} { + foreach pd $list { + if {![my exists $pd]} { + my set $pd "" + } + } + my persistent $list +} + + +@ Persistent instproc unPersistent {list "persistent variables" } { + description { + Make a list of object variables not persistent. + } +} + +Persistent instproc unPersistent {list} { + my instvar __persistentVars + set pMgr [my set persistenceMgr] + foreach v $list { + set i [lsearch -exact $__persistentVars $v] + catch { + set __persistentVars [lreplace $__persistentVars $i $i] + ${pMgr}::store unset [self]::$v + } + } +} + +@ Persistent instproc makeVarScript {} { + description { + Build a Tcl script of "set ..." statements reflecting the current situation in the database. + } +} +Persistent instproc makeVarScript {} { + set script "" + foreach v [my persistentVars] { + set vt [namespace tail $v] + append script [list my set $vt [my set $vt]]\n + } + #set script [concat [next] $script] + return $script +} + +Persistent instproc destroy args { + if {[my exists persistenceMgr]} { + [my set persistenceMgr] removePersistentObj [self] + my unset persistenceMgr + } + next + #my showMsg "Persistent object [self] destroyed." +} + +@ Class Persistent=Eager { + description { + Eager persistence strategy. Store everything at the same moment to the database + } +} +Class Persistent=Eager -superclass Persistent + +# +# we use 'strange' argument names to avoid name clashes with given +# variable names, when we have to instvar "[self] instvar $nametail" +# +Persistent=Eager instproc vartrace {__name_vartrace __sub_vartrace __op_vartrace} { + #my showCall + if {$__op_vartrace == "w"} { + my instvar persistenceMgr + if {![info exists persistenceMgr]} {return} + set store ${persistenceMgr}::store + + set nametail [namespace tail $__name_vartrace] + set key [self]::$nametail + if {$__sub_vartrace == ""} { + my instvar $nametail + #puts stderr "+++VT: $store set $key [set $nametail]" + $store set $key [set $nametail] + } else { + if {$__sub_vartrace != "_____arraynames"} { + my instvar "${nametail}($__sub_vartrace) subname" + $store set ${key}($__sub_vartrace) $subname + $store set ${key}(_____arraynames) [my array names $nametail] + } else { + error "With persistent arrays you may not use '_____arraynames' as index" + } + } + } +} + +Persistent=Eager instproc persistent {list} { + #my showCall + next + foreach v $list { + #puts stderr "***trace variable [self]::$v w [list my vartrace]" + my trace variable $v w [list [self] vartrace] + } +} + +Persistent=Eager instproc unPersistent {list} { + foreach v $list { + my trace vdelete $v w [list [self] vartrace] + } + next +} + +@ Class Persistent=Lazy { + description { + Lazy persistence strategy. Store everything on object destroy (or program termination. + } +} + +Class Persistent=Lazy -superclass Persistent +Persistent=Lazy instproc storeall {} { + my instvar persistenceMgr + if {![info exists persistenceMgr]} {return} + set store ${persistenceMgr}::store + + foreach v [my persistentVars] { + if {[my array exists $v]} { + set anames "" + foreach sub [my array names $v] { + if {[my exists ${v}($sub)]} { + set key [self]::${v}($sub) + $store set $key [my set ${v}($sub)] + lappend anames $sub + } + } + $store set [self]::${v}(_____arraynames) $anames + } else { + if {[my exists $v]} { + set key [self]::$v + $store set $key [my set $v] + } + } + } +} + +Persistent=Lazy instproc destroy args { + my storeall + next +} Index: xotcl/library/store/Storage.xotcl =================================================================== diff -u --- xotcl/library/store/Storage.xotcl (revision 0) +++ xotcl/library/store/Storage.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,165 @@ +# $Id: Storage.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::store 0.84 + +@ @File { + description { + Simple generic storage interface for hashtable-like (persistent) + storages. There are several different existing stores, including + a memory storage, a GDBM storage, a SDBM storage, and a + TextFile storage. + } + date { $Date: 2004/05/23 22:50:39 $ } +} + +# +# abstract interface for storage access +# +@ Class Storage { + description { + Abstract storage interface class (superclass of all storages). + } +} +Class Storage -parameter {{dirName .} fileName} + +### +@ Storage instproc open { + filename "database filename (or filename base, if more + than one file has to be created)" +} { + Description { + Each storage object represents exactly one database table. The db + has to be opened, before it can it used. If it is not opened all + other methods return errors. + } + return "empty string" +} +Storage abstract instproc open filename + +### +@ Storage instproc close {} { + Description { + Close associated database. + } + return "empty string" +} +Storage abstract instproc close {} + +### +@ Storage instproc exists { + key {Key to be searched for.} +} { + Description { + Search for a key whether it exists or not. + } + return {1, if key exists in the database, otherwise 0} +} +Storage abstract instproc exists key + +### +@ Storage instproc set { + key {Key to be set.} + ?value? {Optional value that might be set} +} { + Description { + Set or query a database key in the same way as Tcl's set functions. + } + return {Key value.} +} +Storage abstract instproc set {key ?value?} + +### +@ Storage instproc unset { + key {Key to be unset.} +} { + Description { + Unset a database key in the same way as Tcl's unset functions. + } + return {empty string} +} +Storage abstract instproc unset key + +### +@ Storage instproc names {} { + Description { + Return a list of keys in the database (functions in the same + way as Tcl's array names) + } + return {List of keys in the db.} +} +Storage abstract instproc names {} + +### +@ Storage instproc firstkey {} { + Description { + Start a traversal of the database, starting with any key. + } + return {Name of first key.} +} +Storage abstract instproc firstkey {} + +### +@ Storage instproc nextkey {} { + Description { + Proceed with the db traversal. Requires a firstkey before + first usage, otherwise it returns an error. + } + return {Name of next key, if one exists. Otherwise an empty string is returned.} +} +Storage abstract instproc nextkey {} + +Storage instproc traceFilter args { + set context "[self callingclass]->[self callingproc]" + set method [self calledproc] + set dargs $args + puts "CALL $context> [self]->$method $dargs" + set result [next] + puts "EXIT $context> [self]->$method ($result)" + return $result +} + +### +@ Storage proc someNewChildStore {} { + Description { + Create a childStore according to a preference list depending on + which storages are available. Currently the preference list has + the following order: Gdbm, Sdbm and TextFile. + } + return {name of the created storage object.} +} +Storage proc someNewChildStore {} { + foreach store {Gdbm Sdbm TextFile} { + if {![catch {package require xotcl::store::[string tolower $store]}]} { + set s [Storage=$store new -childof [self]] + break + } + } + return $s +} + +Storage instproc checkDir {} { + my instvar dirName + if {[info exists dirName]} { + if {![file exists $dirName]} { + file mkdir $dirName + } elseif {![file isdirectory $dirName]} { + error "specified directory $dirName is no directory!" + } + } +} +Storage instproc mkFileName {} { + my instvar dirName fileName + if {[info exists dirName]} { + return [file join $dirName $fileName] + } else { + return $fileName + } +} +Storage instproc dbOpen {} { + my checkDir + my open [my mkFileName] +} + + +Storage proc defaultPackage {} { + return Sdbm +} Index: xotcl/library/store/TclGdbmStorage.xotcl =================================================================== diff -u --- xotcl/library/store/TclGdbmStorage.xotcl (revision 0) +++ xotcl/library/store/TclGdbmStorage.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,51 @@ +# $Id: TclGdbmStorage.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::store::tclgdbm 0.84 + +package require xotcl::store::gdbm +package require xotcl::store + +# +# a simple GNU Gdbm DB Store Access based on TclGdbm +# +Class Storage=TclGdbm -superclass Storage +Storage=TclGdbm instproc open f { + my instvar persistenceDB + ::set persistenceDB [gdbm_open -wrcreat $f] +} + +Storage=TclGdbm instproc set args { + my instvar persistenceDB + ::set l [llength $args] + if {$l == 1} {[::set persistenceDB] fetch [lindex $args 0] + } elseif {$l == 2} {[::set persistenceDB] -replace store \ + [lindex $args 0] [lindex $args 1] + } else { next } +} + +Storage=TclGdbm instproc exists k { + my instvar persistenceDB + $persistenceDB exists $k +} + +Storage=TclGdbm instproc names {} { + my instvar persistenceDB + ::set list "" + if {[::set key [$persistenceDB firstkey]] != ""} { + lappend list $key + while {[::set key [$persistenceDB nextkey $key]] != ""} { + lappend list $key + } + } + return $list +} + + +Storage=TclGdbm instproc close args { + my instvar persistenceDB + $persistenceDB close +} + +Storage=TclGdbm instproc unset k { + my instvar persistenceDB + $persistenceDB delete $k +} Index: xotcl/library/store/TextFileStorage.xotcl =================================================================== diff -u --- xotcl/library/store/TextFileStorage.xotcl (revision 0) +++ xotcl/library/store/TextFileStorage.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,151 @@ +package provide xotcl::store::textfile 0.84 +package require xotcl::store + +Class Storage=TextFile -superclass Storage -parameter { + filename + reorgCounter + reorgMaxValue +} + +Storage=TextFile instproc init args { + my instvar reorgCounter reorgMaxValue searchID + ::set reorgCounter 0 + ::set reorgMaxValue 1000 + ::set searchID "" + next +} +Storage=TextFile instproc reorganizeDB {} { + my instvar noreorg reorgCounter reorgMaxValue filename keys + ::set reorgCounter -1 + #puts "***reorganizeDB" + if {[::info exists filename]} { + ::set noreorg 1 + ::array set bkeys [::array get keys] + ::array set keys {} + # parray bkeys + + ::set bak $filename.orig + file rename -force $filename $bak + foreach k [::array names bkeys] { + ::set bf [::open $bak r] + seek $bf [lindex $bkeys($k) 0] + ::set c [read $bf [lindex $bkeys($k) 1]] + ::close $bf + #puts "***STORING $k [lindex $c 1]" + my set $k [lindex $c 1] + } + file delete -force $bak + ::unset noreorg + } +} +Storage=TextFile instproc open fn { + my instvar keys filename + ::array set keys {} + ::set position 0 + ::set filename $fn + if {[file exists $filename]} { + ::set f [::open $filename r] + ::set c [read $f] + ::close $f + foreach {k v} $c { + lappend keyList $k + } + ::set f [::open $filename r] + while {1} { + set position [tell $f] + if {!([gets $f line] >= 0)} { + break + } + + set k [lindex $keyList 0] + if {[string match $k* $line]} { + set lastLength [string length $line] + set keys($k) [concat $position $lastLength] + set lastKey $k + set lastPosition $position + set keyList [lreplace $keyList 0 0] + } elseif {[info exists lastKey]} { + set lastLength [expr $lastLength + [string length $line] + 1] + set keys($lastKey) [concat $lastPosition $lastLength] + } + } + ::close $f + + #parray keys + } +} +Storage=TextFile instproc exists key { + my instvar keys + info exists keys($key) +} + +Storage=TextFile instproc set args { + my instvar keys noreorg reorgCounter reorgMaxValue filename + ::set key [lindex $args 0] + ::set l [llength $args] + if {$l == 1} { ;# fetch + if {[::info exists keys($key)]} { + ::set f [::open $filename r] + #puts "***fetch -- $keys($key)" + seek $f [lindex $keys($key) 0] + ::set c [read $f [lindex $keys($key) 1]] + ::close $f + return [lindex $c 1] + } else { + error "no such variable '$key'" + } + } elseif {$l == 2} { ;# store + if {![::info exists noreorg] && [::info exists keys($key)]} { + ::incr reorgCounter + } + ::set f [::open $filename a+] + ::set position [tell $f] + #puts "***store -- putting [::list $key [lindex $args 1]] at $position" + ::set c [::list $key [lindex $args 1]] + puts $f $c + ::close $f + ::set keys($key) [::list $position [expr {[string length $c] + 1}]] + # parray keys + if {$reorgCounter > $reorgMaxValue} { + my reorganizeDB + } + } else { next } +} + +Storage=TextFile instproc names {} { + my array names keys +} +Storage=TextFile instproc close {} { + my instvar filename keys + my reorganizeDB + ::unset filename + ::unset keys +} +Storage=TextFile instproc unset key { + my instvar keys + if {[::info exists keys($key)]} { + ::unset keys($key) + } + my reorganizeDB +} + +Storage=TextFile instproc firstkey {} { + my instvar keys searchID + if {$searchID != ""} { + array donesearch keys $searchID + } + ::set searchID [array startsearch keys] + return [array nextelement keys $searchID] +} +Storage=TextFile instproc nextkey {} { + my instvar keys searchID + if {$searchID == ""} { + error "[self class]: firstkey was not invoked on storage search" + } + ::set elt [array nextelement keys $searchID] + if {$elt == ""} { + # if array end is reach search is terminated automatically!! + ::set searchID "" + } + return $elt +} \ No newline at end of file Index: xotcl/library/store/XOTclGdbm/Makefile =================================================================== diff -u --- xotcl/library/store/XOTclGdbm/Makefile (revision 0) +++ xotcl/library/store/XOTclGdbm/Makefile (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,431 @@ +# Makefile.in -- +# +# This file is a Makefile for Sample TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# Copyright (c) 2002-2003 ActiveState Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#======================================================================== +# Add additional lines to handle any additional AC_SUBST cases that +# have been added in a customized configure script. +#======================================================================== + +#SAMPLE_NEW_VAR = @SAMPLE_NEW_VAR@ + +#======================================================================== +# Nothing of the variables below this line should need to be changed. +# Please check the TARGETS section below to make sure the make targets +# are correct. +#======================================================================== + +#======================================================================== +# The names of the source files is defined in the configure script. +# The object files are used for linking into the final library. +# This will be used when a dist target is added to the Makefile. +# It is not important to specify the directory, as long as it is the +# $(srcdir) or in the generic, win or unix subdirectory. +#======================================================================== + +PKG_SOURCES = xotclgdbm.c +PKG_OBJECTS = xotclgdbm.o + +PKG_STUB_SOURCES = +PKG_STUB_OBJECTS = + +#======================================================================== +# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with +# this package that need to be installed, if any. +#======================================================================== + +PKG_TCL_SOURCES = + +#======================================================================== +# This is a list of public header files to be installed, if any. +#======================================================================== + +PKG_HEADERS = + +#======================================================================== +# "PKG_LIB_FILE" refers to the library (dynamic or static as per +# configuration options) composed of the named objects. +#======================================================================== + +PKG_LIB_FILE = libxotclgdbm1.2.so +PKG_STUB_LIB_FILE = libxotclgdbmstub1.2.a + +lib_BINARIES = $(PKG_LIB_FILE) +BINARIES = $(lib_BINARIES) + +SHELL = /bin/sh + +srcdir = . +prefix = /usr +exec_prefix = /usr + +bindir = ${exec_prefix}/bin +libdir = ${exec_prefix}/lib +datadir = ${prefix}/share +mandir = ${prefix}/man +includedir = ${prefix}/include + +DESTDIR = + +PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) +pkgdatadir = $(datadir)/$(PKG_DIR) +pkglibdir = $(libdir)/$(PKG_DIR) +pkgincludedir = $(includedir)/$(PKG_DIR) + +top_builddir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL} + +PACKAGE_NAME = xotclgdbm +PACKAGE_VERSION = 1.2 +CC = gcc -pipe +CFLAGS_DEFAULT = -O +CFLAGS_WARNING = -Wall -Wconversion -Wno-implicit-int +CLEANFILES = pkgIndex.tcl +EXEEXT = +LDFLAGS_DEFAULT = -rdynamic +MAKE_LIB = ${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS} +MAKE_SHARED_LIB = ${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS} +MAKE_STATIC_LIB = ${STLIB_LD} $@ $(PKG_OBJECTS) +MAKE_STUB_LIB = ${STLIB_LD} $@ $(PKG_STUB_OBJECTS) +OBJEXT = o +RANLIB = : +RANLIB_STUB = ranlib +SHLIB_CFLAGS = -fPIC +SHLIB_LD = gcc -pipe -shared +SHLIB_LD_FLAGS = +SHLIB_LD_LIBS = ${LIBS} -L/usr/lib -ltclstub8.4 +STLIB_LD = ${AR} cr +TCL_DEFS = -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOLL=1 -DHAVE_STRTOULL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DPEEK_XCLOSEIM=1 -DHAVE_SYS_IOCTL_H=1 +TCL_BIN_DIR = /usr/lib +TCL_SRC_DIR = /home/neumann/tcl8.4.5 +# This is necessary for packages that use private Tcl headers +#TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@ +# Not used, but retained for reference of what libs Tcl required +TCL_LIBS = ${DL_LIBS} ${LIBS} ${MATH_LIBS} + +#======================================================================== +# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our +# package without installing. The other environment variables allow us +# to test against an uninstalled Tcl. Add special env vars that you +# require for testing here (like TCLX_LIBRARY). +#======================================================================== + +EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR) +TCLSH_ENV = TCL_LIBRARY=`echo $(TCL_SRC_DIR)/library` \ + LD_LIBRARY_PATH="$(EXTRA_PATH):$(LD_LIBRARY_PATH)" \ + PATH="$(EXTRA_PATH):$(PATH)" \ + TCLLIBPATH="$(top_builddir)" +TCLSH_PROG = /usr/lib/../bin/tclsh8.4 +TCLSH = $(TCLSH_ENV) $(TCLSH_PROG) +SHARED_BUILD = 1 + +INCLUDES = -I/home/neumann/xotcl-1.2.1/generic -I"/usr/include" + +EXTRA_CFLAGS = + +# TCL_DEFS is not strictly need here, but if you remove it, then you +# must make sure that configure.in checks for the necessary components +# that your library may use. TCL_DEFS can actually be a problem if +# you do not compile with a similar machine setup as the Tcl core was +# compiled with. +#DEFS = $(TCL_DEFS) -DPACKAGE_NAME=\"xotclgdbm\" -DPACKAGE_TARNAME=\"xotclgdbm\" -DPACKAGE_VERSION=\"1.2\" -DPACKAGE_STRING=\"xotclgdbm\ 1.2\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS=1 $(EXTRA_CFLAGS) +DEFS = -DPACKAGE_NAME=\"xotclgdbm\" -DPACKAGE_TARNAME=\"xotclgdbm\" -DPACKAGE_VERSION=\"1.2\" -DPACKAGE_STRING=\"xotclgdbm\ 1.2\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS=1 $(EXTRA_CFLAGS) + +CONFIG_CLEAN_FILES = Makefile + +CPPFLAGS = +LIBS = -L/home/neumann/xotcl-1.2.1 -lxotclstub1.2.1 -lgdbm +AR = ar +CFLAGS = ${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries doc + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: $(BINARIES) pkgIndex.tcl + +libraries: + +doc: + @echo "If you have documentation to create, place the commands to" + @echo "build the docs in the 'doc:' target. For example:" + @echo " xml2nroff sample.xml > sample.n" + @echo " xml2html sample.xml > sample.html" + +install: all install-binaries install-libraries install-doc + +install-binaries: binaries install-lib-binaries install-bin-binaries + if test "x$(SHARED_BUILD)" = "x1"; then \ + $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir); \ + fi + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== + +install-libraries: libraries + @mkdir -p $(DESTDIR)$(includedir) + @echo "Installing header files in $(DESTDIR)$(includedir)" + @for i in $(PKG_HEADERS) ; do \ + echo "Installing $(srcdir)/$$i" ; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \ + done; + +#======================================================================== +# Install documentation. Unix manpages should go in the $(mandir) +# directory. +#======================================================================== + +install-doc: doc +#install-doc: doc +# @mkdir -p $(DESTDIR)$(mandir)/mann +# @echo "Installing documentation in $(DESTDIR)$(mandir)" +# @for i in $(srcdir)/doc/*.n; do \ +# echo "Installing $$i"; \ +# rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \ +# $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \ +# done + +test: binaries libraries + $(TCLSH) `echo $(srcdir)/tests/all.tcl` $(TESTFLAGS) + +shell: binaries libraries + @$(TCLSH) $(SCRIPT) + +gdb: + $(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT) + +depend: + +#======================================================================== +# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable +# mentioned above. That will ensure that this target is built when you +# run "make binaries". +# +# The $(PKG_OBJECTS) objects are created and linked into the final +# library. In most cases these object files will correspond to the +# source files above. +#======================================================================== + +$(PKG_LIB_FILE): $(PKG_OBJECTS) + -rm -f $(PKG_LIB_FILE) + ${MAKE_LIB} + $(RANLIB) $(PKG_LIB_FILE) + +$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS) + -rm -f $(PKG_STUB_LIB_FILE) + ${MAKE_STUB_LIB} + $(RANLIB_STUB) $(PKG_STUB_LIB_FILE) + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# sample.$(OBJEXT): $(srcdir)/generic/sample.c +# $(COMPILE) -c `echo $(srcdir)/generic/sample.c` -o $@ +# +# Setting the VPATH variable to a list of paths will cause the makefile +# to look into these paths when resolving .c to .obj dependencies. +# As necessary, add $(srcdir):$(srcdir)/compat:.... +#======================================================================== + +VPATH = $(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win + +.c.o: + $(COMPILE) -c `echo $<` -o $@ + +#======================================================================== +# Create the pkgIndex.tcl file. +# It is usually easiest to let Tcl do this for you with pkg_mkIndex, but +# you may find that you need to customize the package. If so, either +# modify the -hand version, or create a pkgIndex.tcl.in file and have +# the configure script output the pkgIndex.tcl by editing configure.in. +#======================================================================== + +#pkgIndex.tcl: +# ( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(TCLSH) + +pkgIndex.tcl: + (echo 'package ifneeded xotcl::store::gdbm $(PACKAGE_VERSION) \ + [list load [file join $$dir $(PKG_LIB_FILE)]]'\ + ) > pkgIndex.tcl + +#======================================================================== +# Distribution creation +# You may need to tweak this target to make it work correctly. +#======================================================================== + +#COMPRESS = tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar +COMPRESS = gtar zcvf $(PKG_DIR).tar.gz $(PKG_DIR) +DIST_ROOT = /tmp/dist +DIST_DIR = $(DIST_ROOT)/$(PKG_DIR) + +dist-clean: + rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.* + +dist: dist-clean + mkdir -p $(DIST_DIR) + cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license* \ + $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/*.in \ + $(DIST_DIR)/ + chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4 + chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in + + cp -p $(srcdir)/*.[ch] $(DIST_DIR)/ + + mkdir $(DIST_DIR)/tclconfig + cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \ + $(DIST_DIR)/tclconfig/ + chmod 664 $(DIST_DIR)/tclconfig/tcl.m4 + chmod +x $(DIST_DIR)/tclconfig/install-sh + + list='demos doc generic library mac tests unix win'; \ + for p in $$list; do \ + if test -d $(srcdir)/$$p ; then \ + mkdir $(DIST_DIR)/$$p; \ + cp -p $(srcdir)/$$p/*.* $(DIST_DIR)/$$p/; \ + fi; \ + done + + (cd $(DIST_ROOT); $(COMPRESS);) + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + -test -z "$(BINARIES)" || rm -f $(BINARIES) + -rm -f *.$(OBJEXT) core *.core + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean: clean + -rm -f *.tab.c + -rm -f $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log config.status + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Library files go into the lib directory. +# In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: + @mkdir -p $(DESTDIR)$(pkglibdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \ + stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \ + if test "x$$stub" = "xstub"; then \ + echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \ + else \ + echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \ + fi; \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \ + fi; \ + fi; \ + fi; \ + done + @list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + destp=`basename $$p`; \ + echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \ + fi; \ + done + +#======================================================================== +# Install binary executables (e.g. .exe files and dependent .dll files) +# This is for files that must go in the bin directory (located next to +# wish and tclsh), like dependent .dll files on Windows. +# +# You should not have to modify this target, except to define bin_BINARIES +# above if necessary. +#======================================================================== + +install-bin-binaries: + @mkdir -p $(DESTDIR)$(bindir) + @list='$(bin_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \ + fi; \ + done + +.SUFFIXES: .c .$(OBJEXT) + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +uninstall-binaries: + list='$(lib_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + p=`basename $$p`; \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(bin_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/$$p; \ + done + +.PHONY: all binaries clean depend distclean doc install libraries test + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: xotcl/library/store/XOTclGdbm/Makefile.in =================================================================== diff -u --- xotcl/library/store/XOTclGdbm/Makefile.in (revision 0) +++ xotcl/library/store/XOTclGdbm/Makefile.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,431 @@ +# Makefile.in -- +# +# This file is a Makefile for Sample TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# Copyright (c) 2002-2003 ActiveState Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile.in,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#======================================================================== +# Add additional lines to handle any additional AC_SUBST cases that +# have been added in a customized configure script. +#======================================================================== + +#SAMPLE_NEW_VAR = @SAMPLE_NEW_VAR@ + +#======================================================================== +# Nothing of the variables below this line should need to be changed. +# Please check the TARGETS section below to make sure the make targets +# are correct. +#======================================================================== + +#======================================================================== +# The names of the source files is defined in the configure script. +# The object files are used for linking into the final library. +# This will be used when a dist target is added to the Makefile. +# It is not important to specify the directory, as long as it is the +# $(srcdir) or in the generic, win or unix subdirectory. +#======================================================================== + +PKG_SOURCES = @PKG_SOURCES@ +PKG_OBJECTS = @PKG_OBJECTS@ + +PKG_STUB_SOURCES = @PKG_STUB_SOURCES@ +PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@ + +#======================================================================== +# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with +# this package that need to be installed, if any. +#======================================================================== + +PKG_TCL_SOURCES = @PKG_TCL_SOURCES@ + +#======================================================================== +# This is a list of public header files to be installed, if any. +#======================================================================== + +PKG_HEADERS = @PKG_HEADERS@ + +#======================================================================== +# "PKG_LIB_FILE" refers to the library (dynamic or static as per +# configuration options) composed of the named objects. +#======================================================================== + +PKG_LIB_FILE = @PKG_LIB_FILE@ +PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@ + +lib_BINARIES = $(PKG_LIB_FILE) +BINARIES = $(lib_BINARIES) + +SHELL = @SHELL@ + +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +libdir = @libdir@ +datadir = @datadir@ +mandir = @mandir@ +includedir = @includedir@ + +DESTDIR = + +PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) +pkgdatadir = $(datadir)/$(PKG_DIR) +pkglibdir = $(libdir)/$(PKG_DIR) +pkgincludedir = $(includedir)/$(PKG_DIR) + +top_builddir = . + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ + +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +CC = @CC@ +CFLAGS_DEFAULT = @CFLAGS_DEFAULT@ +CFLAGS_WARNING = @CFLAGS_WARNING@ +CLEANFILES = @CLEANFILES@ +EXEEXT = @EXEEXT@ +LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@ +MAKE_LIB = @MAKE_LIB@ +MAKE_SHARED_LIB = @MAKE_SHARED_LIB@ +MAKE_STATIC_LIB = @MAKE_STATIC_LIB@ +MAKE_STUB_LIB = @MAKE_STUB_LIB@ +OBJEXT = @OBJEXT@ +RANLIB = @RANLIB@ +RANLIB_STUB = @RANLIB_STUB@ +SHLIB_CFLAGS = @SHLIB_CFLAGS@ +SHLIB_LD = @SHLIB_LD@ +SHLIB_LD_FLAGS = @SHLIB_LD_FLAGS@ +SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ +STLIB_LD = @STLIB_LD@ +TCL_DEFS = @TCL_DEFS@ +TCL_BIN_DIR = @TCL_BIN_DIR@ +TCL_SRC_DIR = @TCL_SRC_DIR@ +# This is necessary for packages that use private Tcl headers +#TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@ +# Not used, but retained for reference of what libs Tcl required +TCL_LIBS = @TCL_LIBS@ + +#======================================================================== +# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our +# package without installing. The other environment variables allow us +# to test against an uninstalled Tcl. Add special env vars that you +# require for testing here (like TCLX_LIBRARY). +#======================================================================== + +EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR) +TCLSH_ENV = TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \ + @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \ + PATH="$(EXTRA_PATH):$(PATH)" \ + TCLLIBPATH="$(top_builddir)" +TCLSH_PROG = @TCLSH_PROG@ +TCLSH = $(TCLSH_ENV) $(TCLSH_PROG) +SHARED_BUILD = @SHARED_BUILD@ + +INCLUDES = @PKG_INCLUDES@ @TCL_INCLUDES@ + +EXTRA_CFLAGS = @EXTRA_CFLAGS@ @PKG_CFLAGS@ + +# TCL_DEFS is not strictly need here, but if you remove it, then you +# must make sure that configure.in checks for the necessary components +# that your library may use. TCL_DEFS can actually be a problem if +# you do not compile with a similar machine setup as the Tcl core was +# compiled with. +#DEFS = $(TCL_DEFS) @DEFS@ $(EXTRA_CFLAGS) +DEFS = @DEFS@ $(EXTRA_CFLAGS) + +CONFIG_CLEAN_FILES = Makefile + +CPPFLAGS = @CPPFLAGS@ +LIBS = @PKG_LIBS@ @LIBS@ +AR = ar +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries doc + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: $(BINARIES) pkgIndex.tcl + +libraries: + +doc: + @echo "If you have documentation to create, place the commands to" + @echo "build the docs in the 'doc:' target. For example:" + @echo " xml2nroff sample.xml > sample.n" + @echo " xml2html sample.xml > sample.html" + +install: all install-binaries install-libraries install-doc + +install-binaries: binaries install-lib-binaries install-bin-binaries + if test "x$(SHARED_BUILD)" = "x1"; then \ + $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir); \ + fi + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== + +install-libraries: libraries + @mkdir -p $(DESTDIR)$(includedir) + @echo "Installing header files in $(DESTDIR)$(includedir)" + @for i in $(PKG_HEADERS) ; do \ + echo "Installing $(srcdir)/$$i" ; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \ + done; + +#======================================================================== +# Install documentation. Unix manpages should go in the $(mandir) +# directory. +#======================================================================== + +install-doc: doc +#install-doc: doc +# @mkdir -p $(DESTDIR)$(mandir)/mann +# @echo "Installing documentation in $(DESTDIR)$(mandir)" +# @for i in $(srcdir)/doc/*.n; do \ +# echo "Installing $$i"; \ +# rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \ +# $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \ +# done + +test: binaries libraries + $(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS) + +shell: binaries libraries + @$(TCLSH) $(SCRIPT) + +gdb: + $(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT) + +depend: + +#======================================================================== +# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable +# mentioned above. That will ensure that this target is built when you +# run "make binaries". +# +# The $(PKG_OBJECTS) objects are created and linked into the final +# library. In most cases these object files will correspond to the +# source files above. +#======================================================================== + +$(PKG_LIB_FILE): $(PKG_OBJECTS) + -rm -f $(PKG_LIB_FILE) + ${MAKE_LIB} + $(RANLIB) $(PKG_LIB_FILE) + +$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS) + -rm -f $(PKG_STUB_LIB_FILE) + ${MAKE_STUB_LIB} + $(RANLIB_STUB) $(PKG_STUB_LIB_FILE) + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# sample.$(OBJEXT): $(srcdir)/generic/sample.c +# $(COMPILE) -c `@CYGPATH@ $(srcdir)/generic/sample.c` -o $@ +# +# Setting the VPATH variable to a list of paths will cause the makefile +# to look into these paths when resolving .c to .obj dependencies. +# As necessary, add $(srcdir):$(srcdir)/compat:.... +#======================================================================== + +VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win + +.c.@OBJEXT@: + $(COMPILE) -c `@CYGPATH@ $<` -o $@ + +#======================================================================== +# Create the pkgIndex.tcl file. +# It is usually easiest to let Tcl do this for you with pkg_mkIndex, but +# you may find that you need to customize the package. If so, either +# modify the -hand version, or create a pkgIndex.tcl.in file and have +# the configure script output the pkgIndex.tcl by editing configure.in. +#======================================================================== + +#pkgIndex.tcl: +# ( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(TCLSH) + +pkgIndex.tcl: + (echo 'package ifneeded xotcl::store::gdbm $(PACKAGE_VERSION) \ + [list load [file join $$dir $(PKG_LIB_FILE)]]'\ + ) > pkgIndex.tcl + +#======================================================================== +# Distribution creation +# You may need to tweak this target to make it work correctly. +#======================================================================== + +#COMPRESS = tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar +COMPRESS = gtar zcvf $(PKG_DIR).tar.gz $(PKG_DIR) +DIST_ROOT = /tmp/dist +DIST_DIR = $(DIST_ROOT)/$(PKG_DIR) + +dist-clean: + rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.* + +dist: dist-clean + mkdir -p $(DIST_DIR) + cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license* \ + $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/*.in \ + $(DIST_DIR)/ + chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4 + chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in + + cp -p $(srcdir)/*.[ch] $(DIST_DIR)/ + + mkdir $(DIST_DIR)/tclconfig + cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \ + $(DIST_DIR)/tclconfig/ + chmod 664 $(DIST_DIR)/tclconfig/tcl.m4 + chmod +x $(DIST_DIR)/tclconfig/install-sh + + list='demos doc generic library mac tests unix win'; \ + for p in $$list; do \ + if test -d $(srcdir)/$$p ; then \ + mkdir $(DIST_DIR)/$$p; \ + cp -p $(srcdir)/$$p/*.* $(DIST_DIR)/$$p/; \ + fi; \ + done + + (cd $(DIST_ROOT); $(COMPRESS);) + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + -test -z "$(BINARIES)" || rm -f $(BINARIES) + -rm -f *.$(OBJEXT) core *.core + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean: clean + -rm -f *.tab.c + -rm -f $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log config.status + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Library files go into the lib directory. +# In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: + @mkdir -p $(DESTDIR)$(pkglibdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \ + stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \ + if test "x$$stub" = "xstub"; then \ + echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \ + else \ + echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \ + fi; \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \ + fi; \ + fi; \ + fi; \ + done + @list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + destp=`basename $$p`; \ + echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \ + fi; \ + done + +#======================================================================== +# Install binary executables (e.g. .exe files and dependent .dll files) +# This is for files that must go in the bin directory (located next to +# wish and tclsh), like dependent .dll files on Windows. +# +# You should not have to modify this target, except to define bin_BINARIES +# above if necessary. +#======================================================================== + +install-bin-binaries: + @mkdir -p $(DESTDIR)$(bindir) + @list='$(bin_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \ + fi; \ + done + +.SUFFIXES: .c .$(OBJEXT) + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +uninstall-binaries: + list='$(lib_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + p=`basename $$p`; \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(bin_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/$$p; \ + done + +.PHONY: all binaries clean depend distclean doc install libraries test + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: xotcl/library/store/XOTclGdbm/Makefile.in--ok =================================================================== diff -u --- xotcl/library/store/XOTclGdbm/Makefile.in--ok (revision 0) +++ xotcl/library/store/XOTclGdbm/Makefile.in--ok (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,379 @@ +# Makefile.in -- +# +# This file is a Makefile for Sample TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile.in--ok,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#======================================================================== +# Edit the following few lines when writing a new extension +#======================================================================== + +configdir=$(srcdir)/../../../config + +#======================================================================== +# Change the name of the variable "exampleA_LIB_FILE" to match the one +# used in the configure script. This is the parameterized name of the +# library that we are building. +#======================================================================== + +lib_BINARIES= +BINARIES= + +#======================================================================== +# Enumerate the names of the source files included in this package. +# This will be used when a dist target is added to the Makefile. +#======================================================================== + +xotclgdbm_SOURCES = $(srcdir)/xotclgdbm.c +SOURCES = $(xotclgdbm_SOURCES) + +#======================================================================== +# Enumerate the names of the object files included in this package. +# These objects are created and linked into the final library. In +# most cases these object files will correspond to the source files +# above. +# +#======================================================================== + +xotclgdbm_OBJECTS = xotclgdbm.$(OBJEXT) +OBJECTS = $(xotclgdbm_OBJECTS) + +#======================================================================== +# The substitution of "exampleA_LIB_FILE" into the variable name below +# let's us refer to the objects for the library without knowing the name +# of the library in advance. It also lets us use the "$@" variable in +# the rule for building the library, so we can refer to both the list of +# objects and the library itself in a platform-independent manner. +#======================================================================== + +xotclgdbm_LIB_FILE = @xotclgdbm_LIB_FILE@ +$(xotclgdbm_LIB_FILE)_OBJECTS = $(xotclgdbm_OBJECTS) + +#======================================================================== +# This is a list of header files to be installed +#======================================================================== + +GENERIC_HDRS= + +#======================================================================== +# Add additional lines to handle any additional AC_SUBST cases that +# have been added to the configure script. +#======================================================================== + +SAMPLE_NEW_VAR=@SAMPLE_NEW_VAR@ + +#======================================================================== +# Nothing of the variables below this line need to be changed. Please +# check the TARGETS section below to make sure the make targets are +# correct. +#======================================================================== + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_FLAG = +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +CC = @CC@ +CFLAGS_DEBUG = @CFLAGS_DEBUG@ +CFLAGS_DEFAULT = @CFLAGS_DEFAULT@ +CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ +CLEANFILES = @CLEANFILES@ +EXEEXT = @EXEEXT@ +LDFLAGS_DEBUG = @LDFLAGS_DEBUG@ +LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@ +LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ +MAKE_LIB = @MAKE_LIB@ +MAKE_SHARED_LIB = @MAKE_SHARED_LIB@ +MAKE_STATIC_LIB = @MAKE_STATIC_LIB@ +OBJEXT = @OBJEXT@ +RANLIB = @RANLIB@ +SHLIB_CFLAGS = @SHLIB_CFLAGS@ +SHLIB_LD = @SHLIB_LD@ +SHLIB_LDFLAGS = @SHLIB_LDFLAGS@ +SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ +STLIB_LD = @STLIB_LD@ +TCL_BIN_DIR = @TCL_BIN_DIR@ +TCL_DEFS = @TCL_DEFS@ +TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@ +TCL_LD_FLAGS = @TCL_LD_FLAGS@ +TCL_LIBS = @TCL_LIBS@ +TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ +TCL_SRC_DIR = @TCL_SRC_DIR@ +TCL_DBGX = @TCL_DBGX@ +TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ +TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ +TCL_TOOL_DIR_NATIVE = @TCL_TOOL_DIR_NATIVE@ +TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@ +TCL_UNIX_DIR_NATIVE = @TCL_UNIX_DIR_NATIVE@ +TCL_WIN_DIR_NATIVE = @TCL_WIN_DIR_NATIVE@ +INCLUDE_DIR_NATIVE = @INCLUDE_DIR_NATIVE@ +TCL_BMAP_DIR_NATIVE = @TCL_BMAP_DIR_NATIVE@ +TCL_PLATFORM_DIR_NATIVE = @TCL_PLATFORM_DIR_NATIVE@ +TCL_GENERIC_DIR_NATIVE = @TCL_GENERIC_DIR_NATIVE@ +TCLSH_PROG = @TCLSH_PROG@ + +AUTOCONF = autoconf + +LDFLAGS = $(LDFLAGS_DEFAULT) + +INCLUDES = @TCL_INCLUDES@ + +EXTRA_CFLAGS = $(TCL_DEFS) $(PROTO_FLAGS) $(SECURITY_FLAGS) $(MEM_DEBUG_FLAGS) $(KEYSYM_FLAGS) $(NO_DEPRECATED_FLAGS) + +DEFS = @DEFS@ $(EXTRA_CFLAGS) + +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(configdir)/mkinstalldirs +CONFIG_CLEAN_FILES = $(configdir)/mkIndex.tcl + +CPPFLAGS = @CPPFLAGS@ +LIBS = @LIBS@ +AR = ar +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -I@XOTCL_SRC_DIR@/generic +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries doc + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: + +libraries: $(srcdir)/../$(xotclgdbm_LIB_FILE) + +doc: + +install: all install-binaries install-libraries install-doc + +install-binaries: binaries install-lib-binaries install-bin-binaries + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== + +install-libraries: libraries $(DESTDIR)$(includedir) + @if test ! -z $(GENERIC_HDRS) ; then \ + echo "Installing header files in $(DESTDIR)$(includedir)" ; \ + fi + @for i in $(GENERIC_HDRS) ; do \ + echo "Installing $$i" ; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(includedir) ; \ + done; + +#======================================================================== +# Install documentation. Unix manpages should go in the $(mandir) +# directory. +#======================================================================== + +install-doc: + +test: + +depend: + +#======================================================================== +# Enumerate the names of the object files included in this package. +# These objects are created and linked into the final library. In +# most cases these object files will correspond to the source files +# above. +# +# $(exampleA_LIB_FILE) should be listed as part of the BINARIES variable +# at the top of the Makefile. That will ensure that this target is built +# when you run "make binaries". +# +# You shouldn't need to modify this target, except to change the package +# name from "exampleA" to your package's name. +#======================================================================== + +$(xotclgdbm_LIB_FILE): $(xotclgdbm_OBJECTS) + -rm -f $@ + @MAKE_LIB@ -lgdbm + $(RANLIB) $@ + +$(srcdir)/../$(xotclgdbm_LIB_FILE): $(xotclgdbm_LIB_FILE) + cp $< $@ + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# Unfortunately, there does not seem to be any other way to do this +# in a Makefile-independent way. We can't use VPATH because it picks up +# object files that may be located in the source directory. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# exampleA.$(OBJEXT): $(srcdir)/src/win/exampleA.c +# $(COMPILE) -c `@CYGPATH@ $(srcdir)/src/win/exampleA.c` -o $@ +#======================================================================== + +%.o: $(srcdir)/%.c + $(COMPILE) -c `@CYGPATH@ $<` -o $@ + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + @rm -f $(xotclgdbm_LIB_FILE) $(srcdir)/../$(xotclgdbm_LIB_FILE) \ + *.o core *.core *.$(OBJEXT) $(CLEANFILES) config.log + +distclean: clean + -rm -f *.tab.c + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -rm -f config.status + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Additionally, the .dll files go into the bin directory, but the .lib +# files go into the lib directory. On Unix platforms, all library files +# go into the lib directory. In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh8.2 shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p; \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(libdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(libdir)/$$lib; \ + fi; \ + else \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ + fi; \ + else :; fi; \ + done + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(RANLIB) $(DESTDIR)$(bindir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(bindir)/$$p; \ + else :; fi; \ + done +# $(TCLSH_PROG) $(configdir)/mkIndex.tcl + +#======================================================================== +# Install binary executables (e.g. .exe files) +# +# You should not have to modify this target. +#======================================================================== + +install-bin-binaries: $(DESTDIR)$(bindir) + @list='$(BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p; \ + else :; fi; \ + done + +.SUFFIXES: .c .o .obj + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + + +uninstall-binaries: + @$(NORMAL_UNINSTALL) + list='$(BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +$(DESTDIR)$(includedir): + $(mkinstalldirs) $@ +$(DESTDIR)$(libdir): + $(mkinstalldirs) $@ +$(DESTDIR)$(bindir): + $(mkinstalldirs) $@ + +.PHONY: all binaries clean depend distclean doc install libraries test + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: xotcl/library/store/XOTclGdbm/aclocal.m4 =================================================================== diff -u --- xotcl/library/store/XOTclGdbm/aclocal.m4 (revision 0) +++ xotcl/library/store/XOTclGdbm/aclocal.m4 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,3 @@ +builtin(include,xotcl.m4) +builtin(include,tcl.m4) + Index: xotcl/library/store/XOTclGdbm/config.log =================================================================== diff -u --- xotcl/library/store/XOTclGdbm/config.log (revision 0) +++ xotcl/library/store/XOTclGdbm/config.log (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1026 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by xotclgdbm configure 1.2, which was +generated by GNU Autoconf 2.57. Invocation command line was + + $ ./configure --prefix=/usr --enable-threads --prefix=/usr --with-all --cache-file=/dev/null --srcdir=. + +## --------- ## +## Platform. ## +## --------- ## + +hostname = localhost.localdomain +uname -m = i686 +uname -r = 2.4.22-1.2188.nptl +uname -s = Linux +uname -v = #1 Wed Apr 21 20:36:05 EDT 2004 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = i686 +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: . +PATH: /home/neumann/bin +PATH: . +PATH: /home/neumann/bin +PATH: /usr/local/bin +PATH: /usr/bin +PATH: /bin +PATH: /usr/X11R6/bin +PATH: /usr/X11R6/bin +PATH: /sbin +PATH: /usr/sbin +PATH: /opt/bin +PATH: /usr/X11R6/bin +PATH: /sbin +PATH: /usr/sbin +PATH: /opt/bin + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:1294: checking for correct TEA configuration +configure:1313: result: ok +configure:1433: checking for Tcl configuration +configure:1505: result: found /usr/lib/tclConfig.sh +configure:1511: checking for existence of /usr/lib/tclConfig.sh +configure:1515: result: loading +configure:1670: checking for gcc +configure:1686: found /usr/bin/gcc +configure:1696: result: gcc +configure:1940: checking for C compiler version +configure:1943: gcc --version &5 +gcc (GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1) +Copyright (C) 2003 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:1946: $? = 0 +configure:1948: gcc -v &5 +Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/specs +Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux +Thread model: posix +gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1) +configure:1951: $? = 0 +configure:1953: gcc -V &5 +gcc: `-V' option must have argument +configure:1956: $? = 1 +configure:1980: checking for C compiler default output +configure:1983: gcc conftest.c >&5 +configure:1986: $? = 0 +configure:2032: result: a.out +configure:2037: checking whether the C compiler works +configure:2043: ./a.out +configure:2046: $? = 0 +configure:2063: result: yes +configure:2070: checking whether we are cross compiling +configure:2072: result: no +configure:2075: checking for suffix of executables +configure:2077: gcc -o conftest conftest.c >&5 +configure:2080: $? = 0 +configure:2105: result: +configure:2111: checking for suffix of object files +configure:2133: gcc -c conftest.c >&5 +configure:2136: $? = 0 +configure:2158: result: o +configure:2162: checking whether we are using the GNU C compiler +configure:2187: gcc -c conftest.c >&5 +configure:2190: $? = 0 +configure:2193: test -s conftest.o +configure:2196: $? = 0 +configure:2209: result: yes +configure:2215: checking whether gcc accepts -g +configure:2237: gcc -c -g conftest.c >&5 +configure:2240: $? = 0 +configure:2243: test -s conftest.o +configure:2246: $? = 0 +configure:2257: result: yes +configure:2274: checking for gcc option to accept ANSI C +configure:2335: gcc -c conftest.c >&5 +configure:2338: $? = 0 +configure:2341: test -s conftest.o +configure:2344: $? = 0 +configure:2362: result: none needed +configure:2380: gcc -c conftest.c >&5 +conftest.c:2: error: syntax error before "me" +configure:2383: $? = 1 +configure: failed program was: +| #ifndef __cplusplus +| choke me +| #endif +configure:2497: checking how to run the C preprocessor +configure:2533: gcc -E conftest.c +configure:2539: $? = 0 +configure:2571: gcc -E conftest.c +configure:2570:28: ac_nonexistent.h: No such file or directory +configure:2577: $? = 1 +configure: failed program was: +| #line 2562 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclgdbm" +| #define PACKAGE_TARNAME "xotclgdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclgdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| /* end confdefs.h. */ +| #include +configure:2615: result: gcc -E +configure:2640: gcc -E conftest.c +configure:2646: $? = 0 +configure:2678: gcc -E conftest.c +configure:2677:28: ac_nonexistent.h: No such file or directory +configure:2684: $? = 1 +configure: failed program was: +| #line 2669 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclgdbm" +| #define PACKAGE_TARNAME "xotclgdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclgdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| /* end confdefs.h. */ +| #include +configure:2739: checking for a BSD-compatible install +configure:2793: result: /usr/bin/install -c +configure:2809: checking whether make sets $(MAKE) +configure:2829: result: yes +configure:2884: checking for ranlib +configure:2900: found /usr/bin/ranlib +configure:2911: result: ranlib +configure:2933: checking for egrep +configure:2943: result: grep -E +configure:2948: checking for ANSI C header files +configure:2974: gcc -c conftest.c >&5 +configure:2977: $? = 0 +configure:2980: test -s conftest.o +configure:2983: $? = 0 +configure:3072: gcc -o conftest conftest.c >&5 +configure:3075: $? = 0 +configure:3077: ./conftest +configure:3080: $? = 0 +configure:3095: result: yes +configure:3119: checking for sys/types.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for sys/stat.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for stdlib.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for string.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for memory.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for strings.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for inttypes.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for stdint.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for unistd.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3178: checking if the compiler understands -pipe +configure:3199: gcc -pipe -c conftest.c >&5 +configure:3202: $? = 0 +configure:3205: test -s conftest.o +configure:3208: $? = 0 +configure:3210: result: yes +configure:3228: checking for required early compiler flags +configure:3252: gcc -pipe -c conftest.c >&5 +configure:3255: $? = 0 +configure:3258: test -s conftest.o +configure:3261: $? = 0 +configure:3338: gcc -pipe -c conftest.c >&5 +configure: In function `main': +configure:3343: error: storage size of `buf' isn't known +configure:3341: $? = 1 +configure: failed program was: +| #line 3321 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclgdbm" +| #define PACKAGE_TARNAME "xotclgdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclgdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| /* end confdefs.h. */ +| #include +| int +| main () +| { +| struct stat64 buf; int i = stat64("/", &buf); +| ; +| return 0; +| } +configure:3372: gcc -pipe -c conftest.c >&5 +configure:3375: $? = 0 +configure:3378: test -s conftest.o +configure:3381: $? = 0 +configure:3407: result: _LARGEFILE64_SOURCE +configure:3412: checking for 64-bit integer type +configure:3435: gcc -pipe -c conftest.c >&5 +configure: In function `main': +configure:3441: error: `__int64' undeclared (first use in this function) +configure:3441: error: (Each undeclared identifier is reported only once +configure:3441: error: for each function it appears in.) +configure:3441: error: syntax error before "value" +configure:3438: $? = 1 +configure: failed program was: +| #line 3418 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclgdbm" +| #define PACKAGE_TARNAME "xotclgdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclgdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| /* end confdefs.h. */ +| +| int +| main () +| { +| __int64 value = (__int64) 0; +| ; +| return 0; +| } +configure:3471: gcc -pipe -o conftest conftest.c >&5 +configure:3474: $? = 0 +configure:3476: ./conftest +configure:3479: $? = 0 +configure:3507: result: long long +configure:3511: checking for struct dirent64 +configure:3535: gcc -pipe -c conftest.c >&5 +configure:3538:24: sys/dirent.h: No such file or directory +configure: In function `main': +configure:3542: error: storage size of `p' isn't known +configure:3538: $? = 1 +configure: failed program was: +| #line 3517 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclgdbm" +| #define PACKAGE_TARNAME "xotclgdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclgdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| /* end confdefs.h. */ +| #include +| #include +| int +| main () +| { +| struct dirent64 p; +| ; +| return 0; +| } +configure:3562: result: no +configure:3565: checking for struct stat64 +configure:3589: gcc -pipe -c conftest.c >&5 +configure:3592: $? = 0 +configure:3595: test -s conftest.o +configure:3598: $? = 0 +configure:3616: result: yes +configure:3619: checking for off64_t +configure:3643: gcc -pipe -c conftest.c >&5 +configure:3646: $? = 0 +configure:3649: test -s conftest.o +configure:3652: $? = 0 +configure:3670: result: yes +configure:3674: checking whether byte ordering is bigendian +configure:3702: gcc -pipe -c conftest.c >&5 +configure:3705: $? = 0 +configure:3708: test -s conftest.o +configure:3711: $? = 0 +configure:3736: gcc -pipe -c conftest.c >&5 +configure: In function `main': +configure:3743: error: `not' undeclared (first use in this function) +configure:3743: error: (Each undeclared identifier is reported only once +configure:3743: error: for each function it appears in.) +configure:3743: error: syntax error before "big" +configure:3739: $? = 1 +configure: failed program was: +| #line 3714 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclgdbm" +| #define PACKAGE_TARNAME "xotclgdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclgdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| #include +| #include +| +| int +| main () +| { +| #if BYTE_ORDER != BIG_ENDIAN +| not big endian +| #endif +| +| ; +| return 0; +| } +configure:3859: result: no +configure:3887: checking for sin +configure:3937: gcc -pipe -o conftest conftest.c >&5 +configure:3930: warning: conflicting types for built-in function `sin' +/tmp/ccNx6b7V.o(.text+0x16): In function `main': +: undefined reference to `sin' +/tmp/ccNx6b7V.o(.data+0x0): undefined reference to `sin' +collect2: ld returned 1 exit status +configure:3940: $? = 1 +configure: failed program was: +| #line 3892 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclgdbm" +| #define PACKAGE_TARNAME "xotclgdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclgdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| /* System header to define __stub macros and hopefully few prototypes, +| which can conflict with char sin (); below. +| Prefer to if __STDC__ is defined, since +| exists even on freestanding compilers. */ +| #ifdef __STDC__ +| # include +| #else +| # include +| #endif +| /* Override any gcc2 internal prototype to avoid an error. */ +| #ifdef __cplusplus +| extern "C" +| { +| #endif +| /* We use char because int might match the return type of a gcc2 +| builtin and then its argument prototype would still apply. */ +| char sin (); +| /* The GNU C library defines this for functions which it implements +| to always fail with ENOSYS. Some functions are actually named +| something starting with __ and the normal name is an alias. */ +| #if defined (__stub_sin) || defined (__stub___sin) +| choke me +| #else +| char (*f) () = sin; +| #endif +| #ifdef __cplusplus +| } +| #endif +| +| int +| main () +| { +| return f != sin; +| ; +| return 0; +| } +configure:3957: result: no +configure:3965: checking for main in -lieee +configure:3990: gcc -pipe -o conftest conftest.c -lieee >&5 +configure:3993: $? = 0 +configure:3996: test -s conftest +configure:3999: $? = 0 +configure:4011: result: yes +configure:4023: checking for main in -linet +configure:4048: gcc -pipe -o conftest conftest.c -linet >&5 +/usr/bin/ld: cannot find -linet +collect2: ld returned 1 exit status +configure:4051: $? = 1 +configure: failed program was: +| #line 4030 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclgdbm" +| #define PACKAGE_TARNAME "xotclgdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclgdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| +| +| int +| main () +| { +| main (); +| ; +| return 0; +| } +configure:4069: result: no +configure:4085: checking net/errno.h usability +configure:4098: gcc -pipe -c conftest.c >&5 +configure:4143:23: net/errno.h: No such file or directory +configure:4101: $? = 1 +configure: failed program was: +| #line 4087 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclgdbm" +| #define PACKAGE_TARNAME "xotclgdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclgdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| #include +| #if HAVE_SYS_TYPES_H +| # include +| #endif +| #if HAVE_SYS_STAT_H +| # include +| #endif +| #if STDC_HEADERS +| # include +| # include +| #else +| # if HAVE_STDLIB_H +| # include +| # endif +| #endif +| #if HAVE_STRING_H +| # if !STDC_HEADERS && HAVE_MEMORY_H +| # include +| # endif +| # include +| #endif +| #if HAVE_STRINGS_H +| # include +| #endif +| #if HAVE_INTTYPES_H +| # include +| #else +| # if HAVE_STDINT_H +| # include +| # endif +| #endif +| #if HAVE_UNISTD_H +| # include +| #endif +| #include +configure:4117: result: no +configure:4121: checking net/errno.h presence +configure:4132: gcc -E conftest.c +configure:4145:23: net/errno.h: No such file or directory +configure:4138: $? = 1 +configure: failed program was: +| #line 4123 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclgdbm" +| #define PACKAGE_TARNAME "xotclgdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclgdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| #include +configure:4157: result: no +configure:4193: checking for net/errno.h +configure:4200: result: no +configure:4232: checking for connect +configure:4282: gcc -pipe -o conftest conftest.c >&5 +configure:4285: $? = 0 +configure:4288: test -s conftest +configure:4291: $? = 0 +configure:4302: result: yes +configure:4531: checking for gethostbyname +configure:4581: gcc -pipe -o conftest conftest.c >&5 +configure:4584: $? = 0 +configure:4587: test -s conftest +configure:4590: $? = 0 +configure:4601: result: yes +configure:4675: checking dirent.h +configure:4713: gcc -pipe -o conftest conftest.c >&5 +configure:4716: $? = 0 +configure:4719: test -s conftest +configure:4722: $? = 0 +configure:4740: result: yes +configure:4752: checking errno.h usability +configure:4765: gcc -pipe -c conftest.c >&5 +configure:4768: $? = 0 +configure:4771: test -s conftest.o +configure:4774: $? = 0 +configure:4784: result: yes +configure:4788: checking errno.h presence +configure:4799: gcc -E conftest.c +configure:4805: $? = 0 +configure:4824: result: yes +configure:4860: checking for errno.h +configure:4867: result: yes +configure:4891: checking float.h usability +configure:4904: gcc -pipe -c conftest.c >&5 +configure:4907: $? = 0 +configure:4910: test -s conftest.o +configure:4913: $? = 0 +configure:4923: result: yes +configure:4927: checking float.h presence +configure:4938: gcc -E conftest.c +configure:4944: $? = 0 +configure:4963: result: yes +configure:4999: checking for float.h +configure:5006: result: yes +configure:5030: checking values.h usability +configure:5043: gcc -pipe -c conftest.c >&5 +configure:5046: $? = 0 +configure:5049: test -s conftest.o +configure:5052: $? = 0 +configure:5062: result: yes +configure:5066: checking values.h presence +configure:5077: gcc -E conftest.c +configure:5083: $? = 0 +configure:5102: result: yes +configure:5138: checking for values.h +configure:5145: result: yes +configure:5169: checking limits.h usability +configure:5182: gcc -pipe -c conftest.c >&5 +configure:5185: $? = 0 +configure:5188: test -s conftest.o +configure:5191: $? = 0 +configure:5201: result: yes +configure:5205: checking limits.h presence +configure:5216: gcc -E conftest.c +configure:5222: $? = 0 +configure:5241: result: yes +configure:5277: checking for limits.h +configure:5284: result: yes +configure:5299: checking for stdlib.h +configure:5304: result: yes +configure:5495: checking for string.h +configure:5500: result: yes +configure:5687: checking sys/wait.h usability +configure:5700: gcc -pipe -c conftest.c >&5 +configure:5703: $? = 0 +configure:5706: test -s conftest.o +configure:5709: $? = 0 +configure:5719: result: yes +configure:5723: checking sys/wait.h presence +configure:5734: gcc -E conftest.c +configure:5740: $? = 0 +configure:5759: result: yes +configure:5795: checking for sys/wait.h +configure:5802: result: yes +configure:5826: checking dlfcn.h usability +configure:5839: gcc -pipe -c conftest.c >&5 +configure:5842: $? = 0 +configure:5845: test -s conftest.o +configure:5848: $? = 0 +configure:5858: result: yes +configure:5862: checking dlfcn.h presence +configure:5873: gcc -E conftest.c +configure:5879: $? = 0 +configure:5898: result: yes +configure:5934: checking for dlfcn.h +configure:5941: result: yes +configure:5967: checking for limits.h +configure:5972: result: yes +configure:5967: checking for unistd.h +configure:5972: result: yes +configure:5976: checking sys/param.h usability +configure:5989: gcc -pipe -c conftest.c >&5 +configure:5992: $? = 0 +configure:5995: test -s conftest.o +configure:5998: $? = 0 +configure:6008: result: yes +configure:6012: checking sys/param.h presence +configure:6023: gcc -E conftest.c +configure:6029: $? = 0 +configure:6048: result: yes +configure:6084: checking for sys/param.h +configure:6091: result: yes +configure:6181: checking for XOTcl configuration +configure:6242: result: found /home/neumann/xotcl-1.2.1/xotclConfig.sh +configure:6248: checking for existence of /home/neumann/xotcl-1.2.1/xotclConfig.sh +configure:6252: result: loading +configure:6421: checking for Tcl public headers +configure:6476: result: /usr/include +configure:6524: checking for pthread_mutex_init in -lpthread +configure:6555: gcc -pipe -o conftest conftest.c -lpthread >&5 +configure:6558: $? = 0 +configure:6561: test -s conftest +configure:6564: $? = 0 +configure:6576: result: yes +configure:6863: checking for pthread_attr_setstacksize +configure:6913: gcc -pipe -o conftest conftest.c -lpthread >&5 +configure:6916: $? = 0 +configure:6919: test -s conftest +configure:6922: $? = 0 +configure:6933: result: yes +configure:6948: checking for readdir_r +configure:6998: gcc -pipe -o conftest conftest.c >&5 +configure:7001: $? = 0 +configure:7004: test -s conftest +configure:7007: $? = 0 +configure:7018: result: yes +configure:7033: checking for building with threads +configure:7040: result: yes +configure:7079: checking how to build libraries +configure:7097: result: shared +configure:7123: checking if 64bit support is enabled +configure:7132: result: no +configure:7137: checking if 64bit Sparc VIS support is requested +configure:7146: result: no +configure:7174: checking system version (for dynamic loading) +configure:7197: result: Linux-2.4.22-1.2188.nptl +configure:7205: checking for dlopen in -ldl +configure:7236: gcc -pipe -o conftest conftest.c -ldl >&5 +configure:7239: $? = 0 +configure:7242: test -s conftest +configure:7245: $? = 0 +configure:7257: result: yes +configure:7287: checking for ar +configure:7303: found /usr/bin/ar +configure:7313: result: ar +configure:9199: checking for build with symbols +configure:9213: result: no +configure:9348: checking for tclsh +configure:9379: result: /usr/lib/../bin/tclsh8.4 +configure:9523: creating ./config.status + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by xotclgdbm config.status 1.2, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on localhost.localdomain + +config.status:675: creating Makefile + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_c_bigendian=no +ac_cv_c_compiler_gnu=yes +ac_cv_c_tclconfig=/usr/lib +ac_cv_c_tclh=/usr/include +ac_cv_c_xotclconfig=/home/neumann/xotcl-1.2.1 +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_exeext= +ac_cv_func_connect=yes +ac_cv_func_gethostbyname=yes +ac_cv_func_pthread_attr_setstacksize=yes +ac_cv_func_readdir_r=yes +ac_cv_func_sin=no +ac_cv_header_dlfcn_h=yes +ac_cv_header_errno_h=yes +ac_cv_header_float_h=yes +ac_cv_header_inttypes_h=yes +ac_cv_header_limits_h=yes +ac_cv_header_memory_h=yes +ac_cv_header_net_errno_h=no +ac_cv_header_stdc=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_sys_param_h=yes +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_sys_wait_h=yes +ac_cv_header_unistd_h=yes +ac_cv_header_values_h=yes +ac_cv_lib_dl_dlopen=yes +ac_cv_lib_ieee_main=yes +ac_cv_lib_inet_main=no +ac_cv_lib_pthread_pthread_mutex_init=yes +ac_cv_objext=o +ac_cv_path_install='/usr/bin/install -c' +ac_cv_path_tclsh=/usr/lib/../bin/tclsh8.4 +ac_cv_prog_AR=ar +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_ac_ct_RANLIB=ranlib +ac_cv_prog_cc_g=yes +ac_cv_prog_cc_stdc= +ac_cv_prog_egrep='grep -E' +ac_cv_prog_make_make_set=yes +tcl_cv_flag__isoc99_source=no +tcl_cv_flag__largefile64_source=yes +tcl_cv_struct_dirent64=no +tcl_cv_struct_stat64=yes +tcl_cv_type_64bit='long long' +tcl_cv_type_off64_t=yes + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +AR='ar' +CC='gcc -pipe' +CFLAGS=' ${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}' +CFLAGS_DEBUG='-g' +CFLAGS_DEFAULT='-O' +CFLAGS_OPTIMIZE='-O' +CFLAGS_WARNING='-Wall -Wconversion -Wno-implicit-int' +CLEANFILES='pkgIndex.tcl' +CPP='gcc -E' +CPPFLAGS='' +CYGPATH='echo' +DEFS='-DPACKAGE_NAME=\"xotclgdbm\" -DPACKAGE_TARNAME=\"xotclgdbm\" -DPACKAGE_VERSION=\"1.2\" -DPACKAGE_STRING=\"xotclgdbm\ 1.2\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS=1 ' +DL_LIBS='-ldl' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='grep -E' +EXEEXT='' +EXTRA_CFLAGS='' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +LDFLAGS='-rdynamic' +LDFLAGS_DEBUG='' +LDFLAGS_DEFAULT='-rdynamic' +LDFLAGS_OPTIMIZE='' +LD_LIBRARY_PATH_VAR='LD_LIBRARY_PATH' +LIBOBJS='' +LIBS='' +LTLIBOBJS='' +MAKE_LIB='${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS} ' +MAKE_SHARED_LIB='${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS}' +MAKE_STATIC_LIB='${STLIB_LD} $@ $(PKG_OBJECTS)' +MAKE_STUB_LIB='${STLIB_LD} $@ $(PKG_STUB_OBJECTS)' +MATH_LIBS='-lieee -lm' +OBJEXT='o' +PACKAGE_BUGREPORT='' +PACKAGE_NAME='xotclgdbm' +PACKAGE_STRING='xotclgdbm 1.2' +PACKAGE_TARNAME='xotclgdbm' +PACKAGE_VERSION='1.2' +PATH_SEPARATOR=':' +PKG_CFLAGS=' ' +PKG_HEADERS='' +PKG_INCLUDES=' -I/home/neumann/xotcl-1.2.1/generic' +PKG_LIBS=' -L/home/neumann/xotcl-1.2.1 -lxotclstub1.2.1 -lgdbm' +PKG_LIB_FILE='libxotclgdbm1.2.so' +PKG_OBJECTS=' xotclgdbm.o' +PKG_SOURCES=' xotclgdbm.c' +PKG_STUB_LIB_FILE='libxotclgdbmstub1.2.a' +PKG_STUB_OBJECTS='' +PKG_STUB_SOURCES='' +PKG_TCL_SOURCES='' +RANLIB=':' +RANLIB_STUB='ranlib' +SET_MAKE='' +SHARED_BUILD='1' +SHELL='/bin/sh' +SHLIB_CFLAGS='-fPIC' +SHLIB_LD='gcc -pipe -shared' +SHLIB_LD_FLAGS='' +SHLIB_LD_LIBS='${LIBS} -L/usr/lib -ltclstub8.4' +STLIB_LD='${AR} cr' +TCLSH_PROG='/usr/lib/../bin/tclsh8.4' +TCL_BIN_DIR='/usr/lib' +TCL_DBGX='' +TCL_DEFS=' -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOLL=1 -DHAVE_STRTOULL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DPEEK_XCLOSEIM=1 -DHAVE_SYS_IOCTL_H=1 ' +TCL_EXTRA_CFLAGS='' +TCL_INCLUDES='-I"/usr/include"' +TCL_LD_FLAGS='-rdynamic' +TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' +TCL_LIB_FILE='libtcl8.4.so' +TCL_LIB_FLAG='-ltcl8.4' +TCL_LIB_SPEC='-L/usr/lib -ltcl8.4' +TCL_SHLIB_LD_LIBS='${LIBS}' +TCL_SRC_DIR='/home/neumann/tcl8.4.5' +TCL_STUB_LIB_FILE='libtclstub8.4.a' +TCL_STUB_LIB_FLAG='-ltclstub8.4' +TCL_STUB_LIB_SPEC='-L/usr/lib -ltclstub8.4' +TCL_THREADS='1' +TCL_VERSION='8.4' +XOTCL_BUILD_LIB_SPEC='-L/home/neumann/xotcl-1.2.1 -lxotcl1.2.1' +XOTCL_BUILD_STUB_LIB_SPEC='-L/home/neumann/xotcl-1.2.1 -lxotclstub1.2.1' +XOTCL_LIB_FILE='libxotcl1.2.1.so' +XOTCL_LIB_SPEC='-L/usr/lib -lxotcl1.2.1' +XOTCL_MAJOR_VERSION='1' +XOTCL_MINOR_VERSION='2' +XOTCL_RELEASE_LEVEL='.1' +XOTCL_SRC_DIR='/home/neumann/xotcl-1.2.1' +XOTCL_STUB_LIB_FILE='' +XOTCL_STUB_LIB_SPEC='-L/usr/lib -lxotclstub1.2.1' +XOTCL_VERSION='1.2' +ac_ct_CC='gcc' +ac_ct_RANLIB='ranlib' +bindir='${exec_prefix}/bin' +build_alias='' +datadir='${prefix}/share' +exec_prefix='/usr' +host_alias='' +includedir='${prefix}/include' +infodir='${prefix}/info' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localstatedir='${prefix}/var' +mandir='${prefix}/man' +oldincludedir='/usr/include' +prefix='/usr' +program_transform_name='s,x,x,' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 +#define HAVE_READDIR_R 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRUCT_STAT64 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_TYPE_OFF64_T 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UNISTD_H 1 +#define PACKAGE_BUGREPORT "" +#define PACKAGE_NAME "xotclgdbm" +#define PACKAGE_STRING "xotclgdbm 1.2" +#define PACKAGE_TARNAME "xotclgdbm" +#define PACKAGE_VERSION "1.2" +#define STDC_HEADERS 1 +#define TCL_THREADS 1 +#define TCL_WIDE_INT_TYPE long long +#define USE_TCL_STUBS 1 +#define USE_THREAD_ALLOC 1 +#define _LARGEFILE64_SOURCE 1 +#define _REENTRANT 1 +#define _THREAD_SAFE 1 + +configure: exit 0 Index: xotcl/library/store/XOTclGdbm/configure =================================================================== diff -u --- xotcl/library/store/XOTclGdbm/configure (revision 0) +++ xotcl/library/store/XOTclGdbm/configure (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,10350 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.57 for xotclgdbm 1.2. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='xotclgdbm' +PACKAGE_TARNAME='xotclgdbm' +PACKAGE_VERSION='1.2' +PACKAGE_STRING='xotclgdbm 1.2' +PACKAGE_BUGREPORT='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CYGPATH EXEEXT PKG_LIB_FILE PKG_STUB_LIB_FILE PKG_STUB_SOURCES PKG_STUB_OBJECTS PKG_TCL_SOURCES PKG_HEADERS PKG_INCLUDES PKG_LIBS PKG_CFLAGS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_LIBS TCL_DEFS TCL_EXTRA_CFLAGS TCL_LD_FLAGS TCL_SHLIB_LD_LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB EGREP MATH_LIBS XOTCL_VERSION XOTCL_MAJOR_VERSION XOTCL_MINOR_VERSION XOTCL_RELEASE_LEVEL XOTCL_LIB_FILE XOTCL_BUILD_LIB_SPEC XOTCL_LIB_SPEC XOTCL_STUB_LIB_FILE XOTCL_BUILD_STUB_LIB_SPEC XOTCL_STUB_LIB_SPEC XOTCL_SRC_DIR PKG_SOURCES PKG_OBJECTS CLEANFILES TCL_INCLUDES TCL_THREADS SHARED_BUILD AR LIBOBJS DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING EXTRA_CFLAGS STLIB_LD SHLIB_LD SHLIB_CFLAGS SHLIB_LD_FLAGS SHLIB_LD_LIBS LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LD_LIBRARY_PATH_VAR TCL_DBGX CFLAGS_DEFAULT LDFLAGS_DEFAULT MAKE_LIB MAKE_SHARED_LIB MAKE_STATIC_LIB MAKE_STUB_LIB RANLIB_STUB TCLSH_PROG LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +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 xotclgdbm 1.2 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. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of xotclgdbm 1.2:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-threads build with threads + --enable-shared build and link with shared libraries --enable-shared + --enable-64bit enable 64bit support (where applicable) + --enable-64bit-vis enable 64bit Sparc VIS support + --enable-wince enable Win/CE support (where applicable) + --disable-load disallow dynamic loading and "load" command + --enable-symbols build with debugging symbols --disable-symbols + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-tcl directory containing tcl configuration (tclConfig.sh) + --with-xotcl directory containing xotcl configuration (xotclConfig.sh) + --with-tclinclude directory containing the public Tcl header files + --with-celib=DIR use Windows/CE support library from DIR + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + 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. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +xotclgdbm configure 1.2 +generated by GNU Autoconf 2.57 + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by xotclgdbm $as_me 1.2, which was +generated by GNU Autoconf 2.57. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#-------------------------------------------------------------------- +# Call TEA_INIT as the first TEA_ macro to set up initial vars. +# This will define a ${TEA_PLATFORM} variable == "unix" or "windows" +# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. +#-------------------------------------------------------------------- + + + TEA_VERSION="3.0" + + echo "$as_me:$LINENO: checking for correct TEA configuration" >&5 +echo $ECHO_N "checking for correct TEA configuration... $ECHO_C" >&6 + if test x"${PACKAGE_NAME}" = x ; then + { { echo "$as_me:$LINENO: error: +The PACKAGE_NAME variable must be defined by your TEA configure.in" >&5 +echo "$as_me: error: +The PACKAGE_NAME variable must be defined by your TEA configure.in" >&2;} + { (exit 1); exit 1; }; } + fi + if test x"3.0" = x ; then + { { echo "$as_me:$LINENO: error: +TEA version not specified." >&5 +echo "$as_me: error: +TEA version not specified." >&2;} + { (exit 1); exit 1; }; } + elif test "3.0" != "${TEA_VERSION}" ; then + echo "$as_me:$LINENO: result: warning: TEA version \"3.0\" != ${TEA_VERSION}" >&5 +echo "${ECHO_T}warning: TEA version \"3.0\" != ${TEA_VERSION}" >&6 + else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 + fi + case "`uname -s`" in + *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*) + # Extract the first word of "cygpath", so it can be a program name with args. +set dummy cygpath; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CYGPATH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CYGPATH"; then + ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CYGPATH="cygpath -w" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" +fi +fi +CYGPATH=$ac_cv_prog_CYGPATH +if test -n "$CYGPATH"; then + echo "$as_me:$LINENO: result: $CYGPATH" >&5 +echo "${ECHO_T}$CYGPATH" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + EXEEXT=".exe" + TEA_PLATFORM="windows" + ;; + *) + CYGPATH=echo + EXEEXT="" + TEA_PLATFORM="unix" + ;; + esac + + # Check if exec_prefix is set. If not use fall back to prefix + if test x$exec_prefix = xNONE ; then exec_prefix=$prefix ; fi + + + + + # This package name must be replaced statically for AC_SUBST to work + + # Substitute STUB_LIB_FILE in case package creates a stub library too. + + + # We AC_SUBST these here to ensure they are subst'ed, + # in case the user doesn't call TEA_ADD_... + + + + + + + + + +ac_aux_dir= +for ac_dir in ../../../config $srcdir/../../../config; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../../config $srcdir/../../../config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in ../../../config $srcdir/../../../config" >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + + + + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + + if test x"${no_tcl}" = x ; then + # we reset no_tcl in case something fails here + no_tcl=true + +# Check whether --with-tcl or --without-tcl was given. +if test "${with_tcl+set}" = set; then + withval="$with_tcl" + with_tclconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for Tcl configuration" >&5 +echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6 + if test "${ac_cv_c_tclconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + # First check to see if --with-tcl was specified. + if test x"${with_tclconfig}" != x ; then + if test -f "${with_tclconfig}/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5 +echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ../tcl \ + `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../tcl \ + `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../../tcl \ + `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few other private locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ${srcdir}/../tcl \ + `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + +fi + + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCL_BIN_DIR="# no Tcl configs found" + { echo "$as_me:$LINENO: WARNING: \"Cannot find Tcl configuration definitions\"" >&5 +echo "$as_me: WARNING: \"Cannot find Tcl configuration definitions\"" >&2;} + exit 0 + else + no_tcl= + TCL_BIN_DIR=${ac_cv_c_tclconfig} + echo "$as_me:$LINENO: result: found $TCL_BIN_DIR/tclConfig.sh" >&5 +echo "${ECHO_T}found $TCL_BIN_DIR/tclConfig.sh" >&6 + fi + fi + + + echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 +echo $ECHO_N "checking for existence of $TCL_BIN_DIR/tclConfig.sh... $ECHO_C" >&6 + + if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + echo "$as_me:$LINENO: result: loading" >&5 +echo "${ECHO_T}loading" >&6 + . $TCL_BIN_DIR/tclConfig.sh + else + echo "$as_me:$LINENO: result: file not found" >&5 +echo "${ECHO_T}file not found" >&6 + fi + + # + # If the TCL_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TCL_LIB_SPEC will be set to the value + # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC + # instead of TCL_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + # + + if test -f $TCL_BIN_DIR/Makefile ; then + TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} + TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} + TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} + fi + + # + # eval is required to do the TCL_DBGX substitution + # + + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" + eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" + eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" + + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" + eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" + eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" + + + + + + + + + + + + + + #AC_SUBST(TCL_DBGX) + + + + + + #AC_SUBST(TCL_BUILD_LIB_SPEC) + #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) + + +#-------------------------------------------------------------------- +# Load the tkConfig.sh file if necessary (Tk extension) +#-------------------------------------------------------------------- + +#TEA_PATH_TKCONFIG +#TEA_LOAD_TKCONFIG + +#----------------------------------------------------------------------- +# Handle the --prefix=... option by defaulting to what Tcl gave. +# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. +#----------------------------------------------------------------------- + + + # Should be AC_MSG_NOTICE, but that requires autoconf 2.50 + if test "${prefix}" = "NONE"; then + prefix_default=yes + if test x"${TCL_PREFIX}" != x; then + { echo "$as_me:$LINENO: WARNING: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&5 +echo "$as_me: WARNING: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&2;} + prefix=${TCL_PREFIX} + else + prefix=/usr/local + fi + fi + if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" ; then + if test x"${TCL_EXEC_PREFIX}" != x; then + { echo "$as_me:$LINENO: WARNING: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&5 +echo "$as_me: WARNING: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&2;} + exec_prefix=${TCL_EXEC_PREFIX} + else + exec_prefix=$prefix + fi + fi + + +#----------------------------------------------------------------------- +# Standard compiler checks. +# This sets up CC by using the CC env var, or looks for gcc otherwise. +# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create +# the basic setup necessary to compile executables. +#----------------------------------------------------------------------- + + + # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE) + # in this macro, they need to go into TEA_SETUP_COMPILER instead. + + # If the user did not set CFLAGS, set it now to keep + # the AC_PROG_CC macro from adding "-g -O2". + if test "${CFLAGS+set}" != "set" ; then + CFLAGS="" + 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 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +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 + + 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 +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&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 + echo $ECHO_N "(cached) $ECHO_C" >&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 to if __STDC__ is defined, since + # 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$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 to if __STDC__ is defined, since + # 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +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 + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + #-------------------------------------------------------------------- + # Checks to see if the make program sets the $MAKE variable. + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + + #-------------------------------------------------------------------- + # Find ranlib + #-------------------------------------------------------------------- + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + #-------------------------------------------------------------------- + # Determines the correct binary file extension (.o, .obj, .exe etc.) + #-------------------------------------------------------------------- + + + + + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#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)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here. + + + #------------------------------------------------------------------------ + # If we're using GCC, see if the compiler understands -pipe. If so, use it. + # It makes compiling go faster. (This is only a performance feature.) + #------------------------------------------------------------------------ + + if test -z "$no_pipe" -a -n "$GCC"; then + echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5 +echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6 + OLDCC="$CC" + CC="$CC -pipe" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +CC="$OLDCC" + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + + #-------------------------------------------------------------------- + # Common compiler flag setup + #-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for required early compiler flags" >&5 +echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6 + tcl_flags="" + + if test "${tcl_cv_flag__isoc99_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +char *p = (char *)strtoll; char *q = (char *)strtoull; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__isoc99_source=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _ISOC99_SOURCE 1 +#include +int +main () +{ +char *p = (char *)strtoll; char *q = (char *)strtoull; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__isoc99_source=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_flag__isoc99_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define _ISOC99_SOURCE 1 +_ACEOF + + tcl_flags="$tcl_flags _ISOC99_SOURCE" + fi + + + if test "${tcl_cv_flag__largefile64_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct stat64 buf; int i = stat64("/", &buf); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__largefile64_source=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _LARGEFILE64_SOURCE 1 +#include +int +main () +{ +struct stat64 buf; int i = stat64("/", &buf); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__largefile64_source=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_flag__largefile64_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define _LARGEFILE64_SOURCE 1 +_ACEOF + + tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" + fi + + if test "x${tcl_flags}" = "x" ; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 + else + echo "$as_me:$LINENO: result: ${tcl_flags}" >&5 +echo "${ECHO_T}${tcl_flags}" >&6 + fi + + + echo "$as_me:$LINENO: checking for 64-bit integer type" >&5 +echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6 + if test "${tcl_cv_type_64bit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +__int64 value = (__int64) 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_64bit=__int64 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_type_64bit=none + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + int main() {exit(!(sizeof(long long) > sizeof(long)));} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_64bit="long long" +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "${tcl_cv_type_64bit}" = none ; then + echo "$as_me:$LINENO: result: using long" >&5 +echo "${ECHO_T}using long" >&6 + elif test "${tcl_cv_type_64bit}" = "__int64" ; then + # We actually want to use the default tcl.h checks in this + # case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* + echo "$as_me:$LINENO: result: using Tcl header defaults" >&5 +echo "${ECHO_T}using Tcl header defaults" >&6 + else + cat >>confdefs.h <<_ACEOF +#define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit} +_ACEOF + + echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5 +echo "${ECHO_T}${tcl_cv_type_64bit}" >&6 + + # Now check for auxiliary declarations + echo "$as_me:$LINENO: checking for struct dirent64" >&5 +echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 + if test "${tcl_cv_struct_dirent64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +struct dirent64 p; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_struct_dirent64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_struct_dirent64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_DIRENT64 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_struct_dirent64}" >&5 +echo "${ECHO_T}${tcl_cv_struct_dirent64}" >&6 + + echo "$as_me:$LINENO: checking for struct stat64" >&5 +echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6 + if test "${tcl_cv_struct_stat64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct stat64 p; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_struct_stat64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_struct_stat64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_struct_stat64}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_STAT64 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_struct_stat64}" >&5 +echo "${ECHO_T}${tcl_cv_struct_stat64}" >&6 + + echo "$as_me:$LINENO: checking for off64_t" >&5 +echo $ECHO_N "checking for off64_t... $ECHO_C" >&6 + if test "${tcl_cv_type_off64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +off64_t offset; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_off64_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_type_off64_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_type_off64_t}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_TYPE_OFF64_T 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_type_off64_t}" >&5 +echo "${ECHO_T}${tcl_cv_type_off64_t}" >&6 + fi + + echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + if test "${TEA_PLATFORM}" = "unix" ; then + + #-------------------------------------------------------------------- + # On a few very rare systems, all of the libm.a stuff is + # already in libc.a. Set compiler flags accordingly. + # Also, Linux requires the "ieee" library for math to work + # right (and it must appear before "-lm"). + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking for sin" >&5 +echo $ECHO_N "checking for sin... $ECHO_C" >&6 +if test "${ac_cv_func_sin+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sin (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sin (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_sin) || defined (__stub___sin) +choke me +#else +char (*f) () = sin; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != sin; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_sin=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_sin=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_sin" >&5 +echo "${ECHO_T}$ac_cv_func_sin" >&6 +if test $ac_cv_func_sin = yes; then + MATH_LIBS="" +else + MATH_LIBS="-lm" +fi + + echo "$as_me:$LINENO: checking for main in -lieee" >&5 +echo $ECHO_N "checking for main in -lieee... $ECHO_C" >&6 +if test "${ac_cv_lib_ieee_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lieee $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ieee_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ieee_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ieee_main" >&5 +echo "${ECHO_T}$ac_cv_lib_ieee_main" >&6 +if test $ac_cv_lib_ieee_main = yes; then + MATH_LIBS="-lieee $MATH_LIBS" +fi + + + #-------------------------------------------------------------------- + # Interactive UNIX requires -linet instead of -lsocket, plus it + # needs net/errno.h to define the socket-related error codes. + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking for main in -linet" >&5 +echo $ECHO_N "checking for main in -linet... $ECHO_C" >&6 +if test "${ac_cv_lib_inet_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-linet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_inet_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_inet_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_inet_main" >&5 +echo "${ECHO_T}$ac_cv_lib_inet_main" >&6 +if test $ac_cv_lib_inet_main = yes; then + LIBS="$LIBS -linet" +fi + + if test "${ac_cv_header_net_errno_h+set}" = set; then + echo "$as_me:$LINENO: checking for net/errno.h" >&5 +echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_net_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking net/errno.h usability" >&5 +echo $ECHO_N "checking net/errno.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking net/errno.h presence" >&5 +echo $ECHO_N "checking net/errno.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: net/errno.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: net/errno.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: net/errno.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for net/errno.h" >&5 +echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_net_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_net_errno_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 + +fi +if test $ac_cv_header_net_errno_h = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_NET_ERRNO_H 1 +_ACEOF + +fi + + + + #-------------------------------------------------------------------- + # Check for the existence of the -lsocket and -lnsl libraries. + # The order here is important, so that they end up in the right + # order in the command line generated by make. Here are some + # special considerations: + # 1. Use "connect" and "accept" to check for -lsocket, and + # "gethostbyname" to check for -lnsl. + # 2. Use each function name only once: can't redo a check because + # autoconf caches the results of the last check and won't redo it. + # 3. Use -lnsl and -lsocket only if they supply procedures that + # aren't already present in the normal libraries. This is because + # IRIX 5.2 has libraries, but they aren't needed and they're + # bogus: they goof up name resolution if used. + # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. + # To get around this problem, check for both libraries together + # if -lsocket doesn't work by itself. + #-------------------------------------------------------------------- + + tcl_checkBoth=0 + echo "$as_me:$LINENO: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +choke me +#else +char (*f) () = connect; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != connect; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 +if test $ac_cv_func_connect = yes; then + tcl_checkSocket=0 +else + tcl_checkSocket=1 +fi + + if test "$tcl_checkSocket" = 1; then + echo "$as_me:$LINENO: checking for setsockopt" >&5 +echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 +if test "${ac_cv_func_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char setsockopt (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char setsockopt (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_setsockopt) || defined (__stub___setsockopt) +choke me +#else +char (*f) () = setsockopt; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != setsockopt; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_setsockopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_setsockopt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_func_setsockopt" >&6 +if test $ac_cv_func_setsockopt = yes; then + : +else + echo "$as_me:$LINENO: checking for setsockopt in -lsocket" >&5 +echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char setsockopt (); +int +main () +{ +setsockopt (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_setsockopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_setsockopt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 +if test $ac_cv_lib_socket_setsockopt = yes; then + LIBS="$LIBS -lsocket" +else + tcl_checkBoth=1 +fi + +fi + + fi + if test "$tcl_checkBoth" = 1; then + tk_oldLibs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + echo "$as_me:$LINENO: checking for accept" >&5 +echo $ECHO_N "checking for accept... $ECHO_C" >&6 +if test "${ac_cv_func_accept+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char accept (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char accept (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_accept) || defined (__stub___accept) +choke me +#else +char (*f) () = accept; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != accept; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_accept=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_accept=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_accept" >&5 +echo "${ECHO_T}$ac_cv_func_accept" >&6 +if test $ac_cv_func_accept = yes; then + tcl_checkNsl=0 +else + LIBS=$tk_oldLibs +fi + + fi + echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +char (*f) () = gethostbyname; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gethostbyname; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 +if test $ac_cv_func_gethostbyname = yes; then + : +else + echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + LIBS="$LIBS -lnsl" +fi + +fi + + + # Don't perform the eval of the libraries here because DL_LIBS + # won't be set until we call TEA_CONFIG_CFLAGS + + TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' + + + + + echo "$as_me:$LINENO: checking dirent.h" >&5 +echo $ECHO_N "checking dirent.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ + +#ifndef _POSIX_SOURCE +# ifdef __Lynx__ + /* + * Generate compilation error to make the test fail: Lynx headers + * are only valid if really in the POSIX environment. + */ + + missing_procedure(); +# endif +#endif +DIR *d; +struct dirent *entryPtr; +char *p; +d = opendir("foobar"); +entryPtr = readdir(d); +p = entryPtr->d_name; +closedir(d); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + + if test $tcl_ok = no; then + cat >>confdefs.h <<\_ACEOF +#define NO_DIRENT_H 1 +_ACEOF + + fi + + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test "${ac_cv_header_errno_h+set}" = set; then + echo "$as_me:$LINENO: checking for errno.h" >&5 +echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_errno_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking errno.h usability" >&5 +echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking errno.h presence" >&5 +echo $ECHO_N "checking errno.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: errno.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: errno.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: errno.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for errno.h" >&5 +echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_errno_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_errno_h" >&6 + +fi +if test $ac_cv_header_errno_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_ERRNO_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_float_h+set}" = set; then + echo "$as_me:$LINENO: checking for float.h" >&5 +echo $ECHO_N "checking for float.h... $ECHO_C" >&6 +if test "${ac_cv_header_float_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 +echo "${ECHO_T}$ac_cv_header_float_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking float.h usability" >&5 +echo $ECHO_N "checking float.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking float.h presence" >&5 +echo $ECHO_N "checking float.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: float.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: float.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: float.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for float.h" >&5 +echo $ECHO_N "checking for float.h... $ECHO_C" >&6 +if test "${ac_cv_header_float_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_float_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 +echo "${ECHO_T}$ac_cv_header_float_h" >&6 + +fi +if test $ac_cv_header_float_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_FLOAT_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_values_h+set}" = set; then + echo "$as_me:$LINENO: checking for values.h" >&5 +echo $ECHO_N "checking for values.h... $ECHO_C" >&6 +if test "${ac_cv_header_values_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 +echo "${ECHO_T}$ac_cv_header_values_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking values.h usability" >&5 +echo $ECHO_N "checking values.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking values.h presence" >&5 +echo $ECHO_N "checking values.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: values.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: values.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: values.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for values.h" >&5 +echo $ECHO_N "checking for values.h... $ECHO_C" >&6 +if test "${ac_cv_header_values_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_values_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 +echo "${ECHO_T}$ac_cv_header_values_h" >&6 + +fi +if test $ac_cv_header_values_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_VALUES_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_limits_h+set}" = set; then + echo "$as_me:$LINENO: checking for limits.h" >&5 +echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 +if test "${ac_cv_header_limits_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 +echo "${ECHO_T}$ac_cv_header_limits_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking limits.h usability" >&5 +echo $ECHO_N "checking limits.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking limits.h presence" >&5 +echo $ECHO_N "checking limits.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: limits.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: limits.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: limits.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for limits.h" >&5 +echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 +if test "${ac_cv_header_limits_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_limits_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 +echo "${ECHO_T}$ac_cv_header_limits_h" >&6 + +fi +if test $ac_cv_header_limits_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_LIMITS_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_stdlib_h+set}" = set; then + echo "$as_me:$LINENO: checking for stdlib.h" >&5 +echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_stdlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking stdlib.h usability" >&5 +echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking stdlib.h presence" >&5 +echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for stdlib.h" >&5 +echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_stdlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_stdlib_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 + +fi +if test $ac_cv_header_stdlib_h = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtol" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtoul" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtod" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + if test $tcl_ok = 0; then + cat >>confdefs.h <<\_ACEOF +#define NO_STDLIB_H 1 +_ACEOF + + fi + if test "${ac_cv_header_string_h+set}" = set; then + echo "$as_me:$LINENO: checking for string.h" >&5 +echo $ECHO_N "checking for string.h... $ECHO_C" >&6 +if test "${ac_cv_header_string_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 +echo "${ECHO_T}$ac_cv_header_string_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking string.h usability" >&5 +echo $ECHO_N "checking string.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking string.h presence" >&5 +echo $ECHO_N "checking string.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: string.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: string.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: string.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for string.h" >&5 +echo $ECHO_N "checking for string.h... $ECHO_C" >&6 +if test "${ac_cv_header_string_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_string_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 +echo "${ECHO_T}$ac_cv_header_string_h" >&6 + +fi +if test $ac_cv_header_string_h = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strstr" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strerror" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + + # See also memmove check below for a place where NO_STRING_H can be + # set and why. + + if test $tcl_ok = 0; then + cat >>confdefs.h <<\_ACEOF +#define NO_STRING_H 1 +_ACEOF + + fi + + if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/wait.h" >&5 +echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/wait.h usability" >&5 +echo $ECHO_N "checking sys/wait.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking sys/wait.h presence" >&5 +echo $ECHO_N "checking sys/wait.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: sys/wait.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/wait.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/wait.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for sys/wait.h" >&5 +echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_wait_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 + +fi +if test $ac_cv_header_sys_wait_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_SYS_WAIT_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 +echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 +echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dlfcn_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 + +fi +if test $ac_cv_header_dlfcn_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_DLFCN_H 1 +_ACEOF + +fi + + + + # OS/390 lacks sys/param.h (and doesn't need it, by chance). + # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and + # CHECK on limits.h + + + + +for ac_header in limits.h unistd.h sys/param.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # Let the user call this, because if it triggers, they will + # need a compat/strtod.c that is correct. Users can also + # use Tcl_GetDouble(FromObj) instead. + #TEA_BUGGY_STRTOD + fi + + +#----------------------------------------------------------------------- +# __CHANGE__ +# Specify the C source files to compile in TEA_ADD_SOURCES, +# public headers that need to be installed in TEA_ADD_HEADERS, +# stub library C source files to compile in TEA_ADD_STUB_SOURCES, +# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. +# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS +# and PKG_TCL_SOURCES. +#----------------------------------------------------------------------- + +if test ! "${with_gdbm}" == yes; then + GDBM_INC_DIR="`echo $with_gdbm |cut -f1 -d,`" + GDBM_LIB_DIR="`echo $with_gdbm |cut -f2 -d, -s`" +fi +if test -z "$GDBM_INC_DIR" ; then + gdbm_h_ok=1 + GDBM_INC_SPEC="" +else + GDBM_INC_SPEC="-I${GDBM_INC_DIR}" + echo "Checking ${GDBM_INC_DIR}/gdbm.h" + if test -f "${GDBM_INC_DIR}/gdbm.h" ; then + gdbm_h_ok=1 + else + gdbm_h_ok=0 + fi +fi + +if test "${gdbm_h_ok}" == "0" ; then + { { echo "$as_me:$LINENO: error: + Could not locate gdbm.h on your machine to build XOTclGdbm. + You can download a precompiled lib 'libgdbm' + and the header file 'gdbm.h' from http://www.gnu.org/software/gdbm/ + and compile again. Alternatively, you can compile XOTcl without gdbm. + " >&5 +echo "$as_me: error: + Could not locate gdbm.h on your machine to build XOTclGdbm. + You can download a precompiled lib 'libgdbm' + and the header file 'gdbm.h' from http://www.gnu.org/software/gdbm/ + and compile again. Alternatively, you can compile XOTcl without gdbm. + " >&2;} + { (exit 1); exit 1; }; } +fi + +if test -z "${GDBM_LIB_DIR}" ; then + GDBM_LIB_SPEC="" +else + GDBM_LIB_SPEC="-L${GDBM_LIB_DIR}" +fi + +#echo "Gdbm include spec = '${GDBM_INC_SPEC}'" +#echo "Gdbm lib spec = '${GDBM_LIB_SPEC}'" + +# ------- load xotclConfig.sh ---------- + + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + if test x"${no_xotcl}" = x ; then + # we reset no_xotcl in case something fails here + no_xotcl=true + +# Check whether --with-xotcl or --without-xotcl was given. +if test "${with_xotcl+set}" = set; then + withval="$with_xotcl" + with_xotclconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for XOTcl configuration" >&5 +echo $ECHO_N "checking for XOTcl configuration... $ECHO_C" >&6 + if test "${ac_cv_c_xotclconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + # First check to see if --with-xotcl was specified. + if test x"${with_xotclconfig}" != x ; then + if test -f "${with_xotclconfig}/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd ${with_xotclconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_xotclconfig} directory doesn't contain xotclConfig.sh" >&5 +echo "$as_me: error: ${with_xotclconfig} directory doesn't contain xotclConfig.sh" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_xotclconfig}" = x ; then + for i in \ + ${srcdir}/../xotcl \ + `ls -dr ${srcdir}/../xotcl-* 2>/dev/null` \ + ${srcdir}/../../xotcl \ + `ls -dr ${srcdir}/../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../xotcl \ + `ls -dr ${srcdir}/../../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../../xotcl \ + `ls -dr ${srcdir}/../../../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../../../xotcl \ + `ls -dr ${srcdir}/../../../../../xotcl-* 2>/dev/null` ; do + if test -f "$i/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_xotclconfig}" = x ; then + for i in `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` ; do + if test -f "$i/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd $i; pwd)` + break + fi + done + fi + + +fi + + + if test x"${ac_cv_c_xotclconfig}" = x ; then + XOTCL_BIN_DIR="# no XOTcl configs found" + { echo "$as_me:$LINENO: WARNING: Can't find XOTcl configuration definitions" >&5 +echo "$as_me: WARNING: Can't find XOTcl configuration definitions" >&2;} + exit 0 + else + no_xotcl= + XOTCL_BIN_DIR=${ac_cv_c_xotclconfig} + echo "$as_me:$LINENO: result: found $XOTCL_BIN_DIR/xotclConfig.sh" >&5 +echo "${ECHO_T}found $XOTCL_BIN_DIR/xotclConfig.sh" >&6 + fi + fi + + + echo "$as_me:$LINENO: checking for existence of $XOTCL_BIN_DIR/xotclConfig.sh" >&5 +echo $ECHO_N "checking for existence of $XOTCL_BIN_DIR/xotclConfig.sh... $ECHO_C" >&6 + + if test -f "$XOTCL_BIN_DIR/xotclConfig.sh" ; then + echo "$as_me:$LINENO: result: loading" >&5 +echo "${ECHO_T}loading" >&6 + . $XOTCL_BIN_DIR/xotclConfig.sh + else + echo "$as_me:$LINENO: result: file not found" >&5 +echo "${ECHO_T}file not found" >&6 + fi + + # + # The eval is required to do the TCL_DBGX substitution in the + # TCL_LIB_FILE variable + # + + + + + + + + + + + + +# ------- + + + vars="xotclgdbm.c" + for i in $vars; do + case $i in + \$*) + # allow $-var names + PKG_SOURCES="$PKG_SOURCES $i" + PKG_OBJECTS="$PKG_OBJECTS $i" + ;; + *) + # check for existence - allows for generic/win/unix VPATH + if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ + -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ + ; then + { { echo "$as_me:$LINENO: error: could not find source file '$i'" >&5 +echo "$as_me: error: could not find source file '$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_SOURCES="$PKG_SOURCES $i" + # this assumes it is in a VPATH dir + i=`basename $i` + # handle user calling this before or after TEA_SETUP_COMPILER + if test x"${OBJEXT}" != x ; then + j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" + else + j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" + fi + PKG_OBJECTS="$PKG_OBJECTS $j" + ;; + esac + done + + + + + vars="" + for i in $vars; do + # check for existence, be strict because it is installed + if test ! -f "${srcdir}/$i" ; then + { { echo "$as_me:$LINENO: error: could not find header file '${srcdir}/$i'" >&5 +echo "$as_me: error: could not find header file '${srcdir}/$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_HEADERS="$PKG_HEADERS $i" + done + + + + vars="-I$XOTCL_SRC_DIR/generic $GDBM_INC_SPEC" + for i in $vars; do + PKG_INCLUDES="$PKG_INCLUDES $i" + done + + + + vars="$XOTCL_BUILD_STUB_LIB_SPEC $GDBM_LIB_SPEC -lgdbm" + for i in $vars; do + PKG_LIBS="$PKG_LIBS $i" + done + + + + PKG_CFLAGS="$PKG_CFLAGS " + + + + vars="" + for i in $vars; do + # check for existence - allows for generic/win/unix VPATH + if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ + -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ + ; then + { { echo "$as_me:$LINENO: error: could not find stub source file '$i'" >&5 +echo "$as_me: error: could not find stub source file '$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i" + # this assumes it is in a VPATH dir + i=`basename $i` + # handle user calling this before or after TEA_SETUP_COMPILER + if test x"${OBJEXT}" != x ; then + j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" + else + j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" + fi + PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j" + done + + + + + vars="" + for i in $vars; do + # check for existence, be strict because it is installed + if test ! -f "${srcdir}/$i" ; then + { { echo "$as_me:$LINENO: error: could not find tcl source file '${srcdir}/$i'" >&5 +echo "$as_me: error: could not find tcl source file '${srcdir}/$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i" + done + + + +#-------------------------------------------------------------------- +# __CHANGE__ +# A few miscellaneous platform-specific items: +# +# Define a special symbol for Windows (BUILD_sample in this case) so +# that we create the export library with the dll. +# +# Windows creates a few extra files that need to be cleaned up. +# You can add more files to clean if your extension creates any extra +# files. +# +# TEA_ADD_* any platform specific compiler/build info here. +#-------------------------------------------------------------------- + +if test "${TEA_PLATFORM}" = "windows" ; then + cat >>confdefs.h <<\_ACEOF +#define BUILD_sample 1 +_ACEOF + + CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" + #TEA_ADD_SOURCES([win/winFile.c]) + #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) +else + CLEANFILES="pkgIndex.tcl" + #TEA_ADD_SOURCES([unix/unixFile.c]) + #TEA_ADD_LIBS([-lsuperfly]) +fi + + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for Tcl public headers" >&5 +echo $ECHO_N "checking for Tcl public headers... $ECHO_C" >&6 + + +# Check whether --with-tclinclude or --without-tclinclude was given. +if test "${with_tclinclude+set}" = set; then + withval="$with_tclinclude" + with_tclinclude=${withval} +fi; + + if test "${ac_cv_c_tclh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + # Use the value from --with-tclinclude, if it was given + + if test x"${with_tclinclude}" != x ; then + if test -f "${with_tclinclude}/tcl.h" ; then + ac_cv_c_tclh=${with_tclinclude} + else + { { echo "$as_me:$LINENO: error: ${with_tclinclude} directory does not contain tcl.h" >&5 +echo "$as_me: error: ${with_tclinclude} directory does not contain tcl.h" >&2;} + { (exit 1); exit 1; }; } + fi + else + # Check order: pkg --prefix location, Tcl's --prefix location, + # directory of tclConfig.sh, and Tcl source directory. + # Looking in the source dir is not ideal, but OK. + + eval "temp_includedir=${includedir}" + list="`ls -d ${temp_includedir} 2>/dev/null` \ + `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ + `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \ + `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`" + if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then + list="$list /usr/local/include /usr/include" + fi + for i in $list ; do + if test -f "$i/tcl.h" ; then + ac_cv_c_tclh=$i + break + fi + done + fi + +fi + + + # Print a message based on how we determined the include path + + if test x"${ac_cv_c_tclh}" = x ; then + { { echo "$as_me:$LINENO: error: tcl.h not found. Please specify its location with --with-tclinclude" >&5 +echo "$as_me: error: tcl.h not found. Please specify its location with --with-tclinclude" >&2;} + { (exit 1); exit 1; }; } + else + echo "$as_me:$LINENO: result: ${ac_cv_c_tclh}" >&5 +echo "${ECHO_T}${ac_cv_c_tclh}" >&6 + fi + + # Convert to a native path and substitute into the output files. + + INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}` + + TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" + + + +#TEA_PRIVATE_TCL_HEADERS + +#TEA_PUBLIC_TK_HEADERS +#TEA_PRIVATE_TK_HEADERS +#TEA_PATH_X + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +#-------------------------------------------------------------------- + + + # Check whether --enable-threads or --disable-threads was given. +if test "${enable_threads+set}" = set; then + enableval="$enable_threads" + tcl_ok=$enableval +else + tcl_ok= +fi; + + if test "$tcl_ok" = "yes"; then + TCL_THREADS=1 + + if test "${TEA_PLATFORM}" != "windows" ; then + # We are always OK on Windows, so check what this platform wants. + cat >>confdefs.h <<\_ACEOF +#define USE_THREAD_ALLOC 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _THREAD_SAFE 1 +_ACEOF + + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6 +if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "no"; then + # Check a little harder for __pthread_mutex_init in the + # same library, as some systems hide it there until + # pthread.h is defined. We could alternatively do an + # AC_TRY_COMPILE with pthread.h, but that will work with + # libpthread really doesn't exist, like AIX 4.2. + # [Bug: 4359] + echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5 +echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char __pthread_mutex_init (); +int +main () +{ +__pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread___pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread___pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_init" >&6 +if test $ac_cv_lib_pthread___pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthread" + else + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthreads" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lpthreads... $ECHO_C" >&6 +if test "${ac_cv_lib_pthreads_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthreads $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthreads_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthreads_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_mutex_init" >&6 +if test $ac_cv_lib_pthreads_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthreads" + else + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lc... $ECHO_C" >&6 +if test "${ac_cv_lib_c_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_c_pthread_mutex_init" >&6 +if test $ac_cv_lib_c_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "no"; then + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6 +if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_r_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_r_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_c_r_pthread_mutex_init" >&6 +if test $ac_cv_lib_c_r_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -pthread" + else + TCL_THREADS=0 + { echo "$as_me:$LINENO: WARNING: \"Don t know how to find pthread lib on your system - thread support disabled\"" >&5 +echo "$as_me: WARNING: \"Don t know how to find pthread lib on your system - thread support disabled\"" >&2;} + fi + fi + fi + fi + + # Does the pthread-implementation provide + # 'pthread_attr_setstacksize' ? + + ac_saved_libs=$LIBS + LIBS="$LIBS $THREADS_LIBS" + +for ac_func in pthread_attr_setstacksize +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + LIBS=$ac_saved_libs + +for ac_func in readdir_r +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + fi + else + TCL_THREADS=0 + fi + # Do checking message here to not mess up interleaved configure output + echo "$as_me:$LINENO: checking for building with threads" >&5 +echo $ECHO_N "checking for building with threads... $ECHO_C" >&6 + if test "${TCL_THREADS}" = "1"; then + cat >>confdefs.h <<\_ACEOF +#define TCL_THREADS 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no (default)" >&5 +echo "${ECHO_T}no (default)" >&6 + fi + # TCL_THREADS sanity checking. See if our request for building with + # threads is the same as the way Tcl was built. If not, warn the user. + case ${TCL_DEFS} in + *THREADS=1*) + if test "${TCL_THREADS}" = "0"; then + { echo "$as_me:$LINENO: WARNING: + Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl + that IS thread-enabled." >&5 +echo "$as_me: WARNING: + Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl + that IS thread-enabled." >&2;} + fi + ;; + *) + if test "${TCL_THREADS}" = "1"; then + { echo "$as_me:$LINENO: WARNING: + --enable-threads requested, but attempting building against a Tcl + that is NOT thread-enabled." >&5 +echo "$as_me: WARNING: + --enable-threads requested, but attempting building against a Tcl + that is NOT thread-enabled." >&2;} + fi + ;; + esac + + + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking how to build libraries" >&5 +echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6 + # Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + tcl_ok=$enableval +else + tcl_ok=yes +fi; + + if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + tcl_ok=$enableval + else + tcl_ok=yes + fi + + if test "$tcl_ok" = "yes" ; then + echo "$as_me:$LINENO: result: shared" >&5 +echo "${ECHO_T}shared" >&6 + SHARED_BUILD=1 + else + echo "$as_me:$LINENO: result: static" >&5 +echo "${ECHO_T}static" >&6 + SHARED_BUILD=0 + cat >>confdefs.h <<\_ACEOF +#define STATIC_BUILD 1 +_ACEOF + + fi + + + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# can be taken from the tclConfig.sh file, but this figures it all out. +#-------------------------------------------------------------------- + + + + + # Step 0: Enable 64 bit support? + + echo "$as_me:$LINENO: checking if 64bit support is enabled" >&5 +echo $ECHO_N "checking if 64bit support is enabled... $ECHO_C" >&6 + # Check whether --enable-64bit or --disable-64bit was given. +if test "${enable_64bit+set}" = set; then + enableval="$enable_64bit" + do64bit=$enableval +else + do64bit=no +fi; + echo "$as_me:$LINENO: result: $do64bit" >&5 +echo "${ECHO_T}$do64bit" >&6 + + # Step 0.b: Enable Solaris 64 bit VIS support? + + echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5 +echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6 + # Check whether --enable-64bit-vis or --disable-64bit-vis was given. +if test "${enable_64bit_vis+set}" = set; then + enableval="$enable_64bit_vis" + do64bitVIS=$enableval +else + do64bitVIS=no +fi; + echo "$as_me:$LINENO: result: $do64bitVIS" >&5 +echo "${ECHO_T}$do64bitVIS" >&6 + + if test "$do64bitVIS" = "yes"; then + # Force 64bit on with VIS + do64bit=yes + fi + + # Step 0.c: Cross-compiling options for Windows/CE builds? + + if test "${TEA_PLATFORM}" = "windows" ; then + echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5 +echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6 + # Check whether --enable-wince or --disable-wince was given. +if test "${enable_wince+set}" = set; then + enableval="$enable_wince" + doWince=$enableval +else + doWince=no +fi; + echo "$as_me:$LINENO: result: $doWince" >&5 +echo "${ECHO_T}$doWince" >&6 + fi + + # Step 1: set the variable "system" to hold the name and version number + # for the system. This can usually be done via the "uname" command, but + # there are a few systems, like Next, where this doesn't work. + + echo "$as_me:$LINENO: checking system version (for dynamic loading)" >&5 +echo $ECHO_N "checking system version (for dynamic loading)... $ECHO_C" >&6 + if test -f /usr/lib/NextStep/software_version; then + system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` + else + system=`uname -s`-`uname -r` + if test "$?" -ne 0 ; then + echo "$as_me:$LINENO: result: unknown (can't find uname command)" >&5 +echo "${ECHO_T}unknown (can't find uname command)" >&6 + system=unknown + else + # Special check for weird MP-RAS system (uname returns weird + # results, and the version is kept in special file). + + if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then + system=MP-RAS-`awk '{print }' /etc/.relid'` + fi + if test "`uname -s`" = "AIX" ; then + system=AIX-`uname -v`.`uname -r` + fi + if test "${TEA_PLATFORM}" = "windows" ; then + system=windows + fi + echo "$as_me:$LINENO: result: $system" >&5 +echo "${ECHO_T}$system" >&6 + fi + fi + + # Step 2: check for existence of -ldl library. This is needed because + # Linux can use either -ldl or -ldld for dynamic loading. + + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + have_dl=yes +else + have_dl=no +fi + + + # Step 3: set configuration options based on system name and version. + + do64bit_ok=no + EXTRA_CFLAGS="" + TCL_EXPORT_FILE_SUFFIX="" + UNSHARED_LIB_SUFFIX="" + TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' + ECHO_VERSION='`echo ${PACKAGE_VERSION}`' + TCL_LIB_VERSIONS_OK=ok + CFLAGS_DEBUG=-g + CFLAGS_OPTIMIZE=-O + if test "$GCC" = "yes" ; then + CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int" + else + CFLAGS_WARNING="" + fi + TCL_NEEDS_EXP_FILE=0 + TCL_BUILD_EXP_FILE="" + TCL_EXP_FILE="" + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STLIB_LD='${AR} cr' + LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" + case $system in + windows) + # This is a 2-stage check to make sure we have the 64-bit SDK + # We have to know where the SDK is installed. + if test "$do64bit" = "yes" ; then + if test "x${MSSDK}x" = "xx" ; then + MSSDK="C:/Progra~1/Microsoft SDK" + fi + # In order to work in the tortured autoconf environment, + # we need to ensure that this path has no spaces + MSSDK=`cygpath -w -s "$MSSDK" | sed -e 's!\\\!/!g'` + if test ! -d "${MSSDK}/bin/win64" ; then + { echo "$as_me:$LINENO: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&5 +echo "$as_me: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&2;} + do64bit="no" + else + do64bit_ok="yes" + fi + fi + + if test "$doWince" != "no" ; then + if test "$do64bit" = "yes" ; then + { { echo "$as_me:$LINENO: error: Windows/CE and 64-bit builds incompatible" >&5 +echo "$as_me: error: Windows/CE and 64-bit builds incompatible" >&2;} + { (exit 1); exit 1; }; } + fi + if test "$GCC" = "yes" ; then + { { echo "$as_me:$LINENO: error: Windows/CE and GCC builds incompatible" >&5 +echo "$as_me: error: Windows/CE and GCC builds incompatible" >&2;} + { (exit 1); exit 1; }; } + fi + + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-celib + + if test x"${no_celib}" = x ; then + # we reset no_celib in case something fails here + no_celib=true + +# Check whether --with-celib or --without-celib was given. +if test "${with_celib+set}" = set; then + withval="$with_celib" + with_celibconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5 +echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6 + if test "${ac_cv_c_celibconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + # First check to see if --with-celibconfig was specified. + if test x"${with_celibconfig}" != x ; then + if test -d "${with_celibconfig}/inc" ; then + ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_celibconfig} directory doesn't contain inc directory" >&5 +echo "$as_me: error: ${with_celibconfig} directory doesn't contain inc directory" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a celib library + if test x"${ac_cv_c_celibconfig}" = x ; then + for i in \ + ../celib-palm-3.0 \ + ../celib \ + ../../celib-palm-3.0 \ + ../../celib \ + `ls -dr ../celib-*3.[0-9]* 2>/dev/null` \ + ${srcdir}/../celib-palm-3.0 \ + ${srcdir}/../celib \ + `ls -dr ${srcdir}/../celib-*3.[0-9]* 2>/dev/null` \ + ; do + if test -d "$i/inc" ; then + ac_cv_c_celibconfig=`(cd $i; pwd)` + break + fi + done + fi + +fi + + if test x"${ac_cv_c_celibconfig}" = x ; then + CELIB_DIR="# no Celib configs found" + { { echo "$as_me:$LINENO: error: Cannot find celib support library directory" >&5 +echo "$as_me: error: Cannot find celib support library directory" >&2;} + { (exit 1); exit 1; }; } + else + no_celib= + CELIB_DIR=${ac_cv_c_celibconfig} + echo "$as_me:$LINENO: result: found $CELIB_DIR" >&5 +echo "${ECHO_T}found $CELIB_DIR" >&6 + fi + fi + + # set defaults + # Currently Tcl requires 300+ + CEVERSION=300; # could be 211 300 301 ... + TARGETCPU=ARM; # could be ARM MIPS SH3 X86 ... + PLATFORM="Pocket PC 2002" + if test "$doWince" = "yes"; then + doWince="300,ARM,ARM,Pocket PC 2002" + fi + eval `echo $doWince | awk -F "," '{ \ + if (length($1)) { printf "CEVERSION=%s\n", $1 }; \ + if (length($2)) { printf "TARGETCPU=%s\n", toupper($2) }; \ + if (length($3)) { printf "ARCH=%s\n", toupper($3) }; \ + if (length($4)) { printf "PLATFORM=%s\n", $4 }; \ + }'` + OSVERSION=WCE$CEVERSION; + if test "x${ARCH}" = "x" ; then + ARCH=$TARGETCPU; # could be ARM MIPS SH3 X86 X86EM ... + fi + if test "x${WCEROOT}" = "x" ; then + WCEROOT="C:/Program Files/Microsoft eMbedded Tools" + fi + if test "x${SDKROOT}" = "x" ; then + SDKROOT="C:/Windows CE Tools" + fi + # In order to work in the tortured autoconf environment, + # we need to ensure that this path has no spaces + WCEROOT=`cygpath -w -s "$WCEROOT" | sed -e 's!\\\!/!g'` + SDKROOT=`cygpath -w -s "$SDKROOT" | sed -e 's!\\\!/!g'` + CELIB_DIR=`cygpath -w -s "$CELIB_DIR" | sed -e 's!\\\!/!g'` + if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ + -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then + { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5 +echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;} + { (exit 1); exit 1; }; } + doWince="no" + else + CEINCLUDE=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/include" | sed -e 's!\\\!/!g'` + CELIBPATH=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" | sed -e 's!\\\!/!g'` + fi + fi + + if test "$GCC" != "yes" ; then + if test "${SHARED_BUILD}" = "0" ; then + runtime=-MT + else + runtime=-MD + fi + + if test "$do64bit" = "yes" ; then + # All this magic is necessary for the Win64 SDK RC1 - hobbs + export CC="${MSSDK}/Bin/Win64/cl.exe \ + -I${MSSDK}/Include/prerelease \ + -I${MSSDK}/Include/Win64/crt \ + -I${MSSDK}/Include" + export RC="${MSSDK}/bin/rc.exe" + export lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \ + -LIBPATH:${MSSDK}/Lib/Prerelease/IA64" + export STLIB_LD="${MSSDK}/bin/win64/lib.exe -nologo ${lflags}" + export LINKBIN="${MSSDK}/bin/win64/link.exe ${lflags}" + CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" + CFLAGS_OPTIMIZE="-nologo -O2 -Gs -W2 ${runtime}" + elif test "$doWince" != "no" ; then + if test "${TARGETCPU}" = "X86"; then + CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + else + CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl${TARGETCPU}.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + fi + RC="${WCEROOT}/Common/EVC/bin/rc.exe" + cpulower=`echo ${TARGETCPU} | awk '{print tolower($0)}'` + defs="${TARGETCPU} _${TARGETCPU}_ ${cpulower} _${cpulower}_ POCKET_SIZE PALM_SIZE _MT _DLL _WINDOWS" + for i in $defs ; do + cat >>confdefs.h <<_ACEOF +#define $i 1 +_ACEOF + + done + cat >>confdefs.h <<_ACEOF +#define _WIN32_WCE $CEVERSION +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define UNDER_CE $CEVERSION +_ACEOF + + CFLAGS_DEBUG="-nologo -Zi -Od" + CFLAGS_OPTIMIZE="-nologo -Ox" + lflags="-MACHINE:${TARGETCPU} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,3.00" + STLIB_LD="${WCEROOT}/EVC/${OSVERSION}/bin/lib.exe -nologo ${lflags}" + LINKBIN="${WCEROOT}/EVC/${OSVERSION}/bin/link.exe ${lflags}" + else + RC="rc" + STLIB_LD="lib -nologo" + LINKBIN="link -link50compat" + CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" + CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD -W2 ${runtime}" + fi + fi + + if test "$GCC" = "yes"; then + # mingw gcc mode + RC="windres" + CFLAGS_DEBUG="-g" + CFLAGS_OPTIMIZE="-O2" + SHLIB_LD="$CC -shared" + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" + LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" + else + SHLIB_LD="${LINKBIN} -dll -nologo" + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.lib' + EXTRA_CFLAGS="-YX" + PATHTYPE=-w + # For information on what debugtype is most useful, see: + # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp + # This essentially turns it all on. + LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2" + LDFLAGS_OPTIMIZE="-release" + if test "$doWince" != "no" ; then + LDFLAGS_CONSOLE="-link ${lflags}" + LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} + else + LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" + LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" + fi + fi + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".dll" + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.dll' + + TCL_LIB_VERSIONS_OK=nodots + # Bogus to avoid getting this turned off + DL_OBJS="tclLoadNone.obj" + ;; + AIX-*) + if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then + # AIX requires the _r compiler when gcc isn't being used + if test "${CC}" != "cc_r" ; then + CC=${CC}_r + fi + echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5 +echo "${ECHO_T}Using $CC for compiling with threads" >&6 + fi + LIBS="$LIBS -lc" + SHLIB_CFLAGS="" + SHLIB_SUFFIX=".so" + SHLIB_LD_LIBS='${LIBS}' + + DL_OBJS="tclLoadDl.o" + LDFLAGS="" + LD_LIBRARY_PATH_VAR="LIBPATH" + + # AIX v<=4.1 has some different flags than 4.2+ + if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then + #LIBOBJS="$LIBOBJS tclLoadAix.o" + LIBOBJS="$LIBOBJS tclLoadAix.$ac_objext" + DL_LIBS="-lld" + fi + + # Check to enable 64-bit flags for compiler/linker on AIX 4+ + if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + else + do64bit_ok=yes + EXTRA_CFLAGS="-q64" + LDFLAGS="-q64" + RANLIB="${RANLIB} -X64" + AR="${AR} -X64" + SHLIB_LD_FLAGS="-b64" + fi + fi + + if test "`uname -m`" = "ia64" ; then + # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + # AIX-5 has dl* in libc.so + DL_LIBS="" + if test "$GCC" = "yes" ; then + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' + fi + else + SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}" + DL_LIBS="-ldl" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + TCL_NEEDS_EXP_FILE=1 + TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.exp' + fi + + # On AIX <=v4 systems, libbsd.a has to be linked in to support + # non-blocking file IO. This library has to be linked in after + # the MATH_LIBS or it breaks the pow() function. The way to + # insure proper sequencing, is to add it to the tail of MATH_LIBS. + # This library also supplies gettimeofday. + # + # AIX does not have a timezone field in struct tm. When the AIX + # bsd library is used, the timezone global and the gettimeofday + # methods are to be avoided for timezone deduction instead, we + # deduce the timezone by comparing the localtime result on a + # known GMT value. + + echo "$as_me:$LINENO: checking for gettimeofday in -lbsd" >&5 +echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6 +if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gettimeofday (); +int +main () +{ +gettimeofday (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_bsd_gettimeofday=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_bsd_gettimeofday=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gettimeofday" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6 +if test $ac_cv_lib_bsd_gettimeofday = yes; then + libbsd=yes +else + libbsd=no +fi + + if test $libbsd = yes; then + MATH_LIBS="$MATH_LIBS -lbsd" + cat >>confdefs.h <<\_ACEOF +#define USE_DELTA_FOR_TZ 1 +_ACEOF + + fi + ;; + BSD/OS-2.1*|BSD/OS-3*) + SHLIB_CFLAGS="" + SHLIB_LD="shlicc -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + BSD/OS-4.*) + SHLIB_CFLAGS="-export-dynamic -fPIC" + SHLIB_LD="cc -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-export-dynamic" + LD_SEARCH_FLAGS="" + ;; + dgux*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + HP-UX-*.11.*) + # Use updated header definitions where possible + cat >>confdefs.h <<\_ACEOF +#define _XOPEN_SOURCE_EXTENDED 1 +_ACEOF + + + SHLIB_SUFFIX=".sl" + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + fi + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + + # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc + #EXTRA_CFLAGS="+DAportable" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + hpux_arch=`${CC} -dumpmachine` + case $hpux_arch in + hppa64*) + # 64-bit gcc in use. Fix flags for GNU ld. + do64bit_ok=yes + SHLIB_LD="${CC} -shared" + SHLIB_LD_LIBS="" + LD_SEARCH_FLAGS='' + ;; + *) + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + ;; + esac + else + do64bit_ok=yes + if test "`uname -m`" = "ia64" ; then + EXTRA_CFLAGS="+DD64" + LDFLAGS="+DD64 $LDFLAGS" + else + EXTRA_CFLAGS="+DA2.0W" + LDFLAGS="+DA2.0W $LDFLAGS" + fi + fi + fi + ;; + HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) + SHLIB_SUFFIX=".sl" + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS="" + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + fi + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + ;; + IRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + ;; + IRIX-5.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + EXTRA_CFLAGS="" + LDFLAGS="" + ;; + IRIX-6.*|IRIX64-6.5*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -n32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then + EXTRA_CFLAGS="-mabi=n32" + LDFLAGS="-mabi=n32" + else + case $system in + IRIX-6.3) + # Use to build 6.2 compatible binaries on 6.3. + EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS" + ;; + *) + EXTRA_CFLAGS="-n32" + ;; + esac + LDFLAGS="-n32" + fi + ;; + IRIX64-6.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -n32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + + # Check to enable 64-bit flags for compiler/linker + + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5 +echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} + else + do64bit_ok=yes + SHLIB_LD="ld -64 -shared -rdata_shared" + EXTRA_CFLAGS="-64" + LDFLAGS="-64" + fi + fi + ;; + Linux*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings + # when you inline the string and math operations. Turn this off to + # get rid of the warnings. + + #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + else + if test "${ac_cv_header_dld_h+set}" = set; then + echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dld.h usability" >&5 +echo $ECHO_N "checking dld.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dld.h presence" >&5 +echo $ECHO_N "checking dld.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dld.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dld.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dld.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dld_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 + +fi +if test $ac_cv_header_dld_h = yes; then + + SHLIB_LD="ld -shared" + DL_OBJS="tclLoadDld.o" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS="" +fi + + + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + + # The combo of gcc + glibc has a bug related + # to inlining of functions like strtod(). The + # -fno-builtin flag should address this problem + # but it does not work. The -fno-inline flag + # is kind of overkill but it works. + # Disable inlining only when one of the + # files in compat/*.c is being linked in. + if test x"${USE_COMPAT}" != x ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline" + fi + + ;; + GNU*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + LD_SEARCH_FLAGS="" + else + if test "${ac_cv_header_dld_h+set}" = set; then + echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dld.h usability" >&5 +echo $ECHO_N "checking dld.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dld.h presence" >&5 +echo $ECHO_N "checking dld.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dld.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dld.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dld.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dld_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 + +fi +if test $ac_cv_header_dld_h = yes; then + + SHLIB_LD="ld -shared" + DL_OBJS="" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS="" +fi + + + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + ;; + MP-RAS-02*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + MP-RAS-*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-Wl,-Bexport" + LD_SEARCH_FLAGS="" + ;; + NetBSD-*|FreeBSD-[1-2].*) + # Not available on all versions: check for include file. + if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 +echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 +echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dlfcn_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 + +fi +if test $ac_cv_header_dlfcn_h = yes; then + + # NetBSD/SPARC needs -fPIC, -fpic will not do. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + echo "$as_me:$LINENO: checking for ELF" >&5 +echo $ECHO_N "checking for ELF... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef __ELF__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + +fi +rm -f conftest* + + +else + + SHLIB_CFLAGS="" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + +fi + + + + # FreeBSD doesn't handle version numbers with dots. + + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + OpenBSD-*) + SHLIB_LD="${CC} -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + echo "$as_me:$LINENO: checking for ELF" >&5 +echo $ECHO_N "checking for ELF... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef __ELF__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + +fi +rm -f conftest* + + + # OpenBSD doesn't do version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + FreeBSD-*) + # FreeBSD 3.* and greater have ELF. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="-export-dynamic" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + if test "${TCL_THREADS}" = "1" ; then + # The -pthread needs to go in the CFLAGS, not LIBS + LIBS=`echo $LIBS | sed s/-pthread//` + EXTRA_CFLAGS="-pthread" + LDFLAGS="$LDFLAGS -pthread" + fi + case $system in + FreeBSD-3.*) + # FreeBSD-3 doesn't handle version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' + TCL_LIB_VERSIONS_OK=nodots + ;; + esac + ;; + Rhapsody-*|Darwin-*) + SHLIB_CFLAGS="-fno-common" + SHLIB_LD="cc -dynamiclib \${LDFLAGS}" + TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_MAJOR_VERSION} -current_version \${PACKAGE_VERSION} -install_name \${LIB_RUNTIME_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".dylib" + DL_OBJS="tclLoadDyld.o" + DL_LIBS="" + LDFLAGS="-prebind" + LD_SEARCH_FLAGS="" + LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" + CFLAGS_OPTIMIZE="-O3" + EXTRA_CFLAGS="-arch ppc -pipe" + ;; + NEXTSTEP-*) + SHLIB_CFLAGS="" + SHLIB_LD="cc -nostdlib -r" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadNext.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OS/390-*) + CFLAGS_OPTIMIZE="" # Optimizer is buggy + cat >>confdefs.h <<\_ACEOF +#define _OE_SOCKETS 1 +_ACEOF + # needed in sys/socket.h + ;; + OSF1-1.0|OSF1-1.1|OSF1-1.2) + # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 + SHLIB_CFLAGS="" + # Hack: make package name same as library name + SHLIB_LD='ld -R -export :' + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadOSF.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-1.*) + # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 + SHLIB_CFLAGS="-fPIC" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD="ld -shared" + else + SHLIB_LD="ld -non_shared" + fi + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-V*) + # Digital OSF/1 + SHLIB_CFLAGS="" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD='ld -shared -expect_unresolved "*"' + else + SHLIB_LD='ld -non_shared -expect_unresolved "*"' + fi + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + if test "$GCC" != "yes" ; then + EXTRA_CFLAGS="-DHAVE_TZSET -std1" + fi + # see pthread_intro(3) for pthread support on osf1, k.furukawa + if test "${TCL_THREADS}" = "1" ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" + LIBS=`echo $LIBS | sed s/-lpthreads//` + if test "$GCC" = "yes" ; then + LIBS="$LIBS -lpthread -lmach -lexc" + else + EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread" + LDFLAGS="-pthread" + fi + fi + + ;; + QNX-6*) + # QNX RTP + # This may work for all QNX, but it was only reported for v6. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + # dlopen is in -lc on QNX + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + RISCos-*) + SHLIB_CFLAGS="-G 0" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + ;; + SCO_SV-3.2*) + # Note, dlopen is available only on SCO 3.2.5 and greater. However, + # this test works, since "uname -s" was non-standard in 3.2.4 and + # below. + if test "$GCC" = "yes" ; then + SHLIB_CFLAGS="-fPIC -melf" + LDFLAGS="-melf -Wl,-Bexport" + else + SHLIB_CFLAGS="-Kpic -belf" + LDFLAGS="-belf -Wl,-Bexport" + fi + SHLIB_LD="ld -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS="" + ;; + SINIX*5.4*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + SunOS-4*) + SHLIB_CFLAGS="-PIC" + SHLIB_LD="ld" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + + # SunOS can't handle version numbers with dots in them in library + # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it + # requires an extra version number at the end of .so file names. + # So, the library has to have a name like libtcl75.so.1.0 + + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + SunOS-5.[0-6]*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + + + SHLIB_CFLAGS="-KPIC" + + # Note: need the LIBS below, otherwise Tk won't find Tcl's + # symbols when dynamically loaded into tclsh. + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + ;; + SunOS-5*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + + + SHLIB_CFLAGS="-KPIC" + LDFLAGS="" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + arch=`isainfo` + if test "$arch" = "sparcv9 sparc" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + else + do64bit_ok=yes + if test "$do64bitVIS" = "yes" ; then + EXTRA_CFLAGS="-xarch=v9a" + LDFLAGS="-xarch=v9a" + else + EXTRA_CFLAGS="-xarch=v9" + LDFLAGS="-xarch=v9" + fi + fi + else + { echo "$as_me:$LINENO: WARNING: \"64bit mode only supported sparcv9 system\"" >&5 +echo "$as_me: WARNING: \"64bit mode only supported sparcv9 system\"" >&2;} + fi + fi + + # Note: need the LIBS below, otherwise Tk won't find Tcl's + # symbols when dynamically loaded into tclsh. + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + ;; + ULTRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + if test "$GCC" != "yes" ; then + EXTRA_CFLAGS="-DHAVE_TZSET -std1" + fi + ;; + UNIX_SV* | UnixWare-5*) + SHLIB_CFLAGS="-KPIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers + # that don't grok the -Bexport option. Test that it does. + hold_ldflags=$LDFLAGS + echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5 +echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6 + LDFLAGS="${LDFLAGS} -Wl,-Bexport" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + found=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +found=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$hold_ldflags + echo "$as_me:$LINENO: result: $found" >&5 +echo "${ECHO_T}$found" >&6 + if test $found = yes; then + LDFLAGS="-Wl,-Bexport" + else + LDFLAGS="" + fi + LD_SEARCH_FLAGS="" + ;; + esac + + if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit support being disabled -- don\'t know magic for this platform\"" >&5 +echo "$as_me: WARNING: \"64bit support being disabled -- don\'t know magic for this platform\"" >&2;} + fi + + # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic + # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop, + # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need + # to determine which of several header files defines the a.out file + # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we + # support only a file format that is more or less version-7-compatible. + # In particular, + # - a.out files must begin with `struct exec'. + # - the N_TXTOFF on the `struct exec' must compute the seek address + # of the text segment + # - The `struct exec' must contain a_magic, a_text, a_data, a_bss + # and a_entry fields. + # The following compilation should succeed if and only if either sys/exec.h + # or a.out.h is usable for the purpose. + # + # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the + # `struct exec' includes a second header that contains information that + # duplicates the v7 fields that are needed. + + if test "x$DL_OBJS" = "xtclLoadAout.o" ; then + echo "$as_me:$LINENO: checking sys/exec.h" >&5 +echo $ECHO_N "checking sys/exec.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_SYS_EXEC_H 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking a.out.h" >&5 +echo $ECHO_N "checking a.out.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_A_OUT_H 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking sys/exec_aout.h" >&5 +echo $ECHO_N "checking sys/exec_aout.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_midmag == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_SYS_EXEC_AOUT_H 1 +_ACEOF + + else + DL_OBJS="" + fi + fi + fi + fi + + # Step 5: disable dynamic loading if requested via a command-line switch. + + # Check whether --enable-load or --disable-load was given. +if test "${enable_load+set}" = set; then + enableval="$enable_load" + tcl_ok=$enableval +else + tcl_ok=yes +fi; + if test "$tcl_ok" = "no"; then + DL_OBJS="" + fi + + if test "x$DL_OBJS" != "x" ; then + BUILD_DLTEST="\$(DLTEST_TARGETS)" + else + echo "Can't figure out how to do dynamic loading or shared libraries" + echo "on this system." + SHLIB_CFLAGS="" + SHLIB_LD="" + SHLIB_SUFFIX="" + DL_OBJS="tclLoadNone.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + BUILD_DLTEST="" + fi + + # If we're running gcc, then change the C flags for compiling shared + # libraries to the right flags for gcc, instead of those for the + # standard manufacturer compiler. + + if test "$DL_OBJS" != "tclLoadNone.o" ; then + if test "$GCC" = "yes" ; then + case $system in + AIX-*) + ;; + BSD/OS*) + ;; + IRIX*) + ;; + NetBSD-*|FreeBSD-*) + ;; + Rhapsody-*|Darwin-*) + ;; + RISCos-*) + ;; + SCO_SV-3.2*) + ;; + ULTRIX-4.*) + ;; + windows) + ;; + *) + SHLIB_CFLAGS="-fPIC" + ;; + esac + fi + fi + + if test "$SHARED_LIB_SUFFIX" = "" ; then + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}${SHLIB_SUFFIX}' + fi + if test "$UNSHARED_LIB_SUFFIX" = "" ; then + UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + fi + + + + + + + + + + + + + + + + + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols option. +#-------------------------------------------------------------------- + + + + + if test "${TEA_PLATFORM}" = "windows" ; then + tcl_dbgx=d + else + tcl_dbgx=g + fi + + echo "$as_me:$LINENO: checking for build with symbols" >&5 +echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6 + # Check whether --enable-symbols or --disable-symbols was given. +if test "${enable_symbols+set}" = set; then + enableval="$enable_symbols" + tcl_ok=$enableval +else + tcl_ok=no +fi; + if test "$tcl_ok" = "no"; then + CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" + LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" + DBGX="" + TCL_DBGX="" + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + else + CFLAGS_DEFAULT="${CFLAGS_DEBUG}" + LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" + DBGX=${tcl_dbgx} + TCL_DBGX=${tcl_dbgx} + if test "$tcl_ok" = "yes"; then + echo "$as_me:$LINENO: result: yes (standard debugging)" >&5 +echo "${ECHO_T}yes (standard debugging)" >&6 + fi + fi + if test "${TEA_PLATFORM}" != "windows" ; then + LDFLAGS_DEFAULT="${LDFLAGS}" + fi + + + + + + if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then + cat >>confdefs.h <<\_ACEOF +#define TCL_MEM_DEBUG 1 +_ACEOF + + fi + + if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then + if test "$tcl_ok" = "all"; then + echo "$as_me:$LINENO: result: enabled symbols mem debugging" >&5 +echo "${ECHO_T}enabled symbols mem debugging" >&6 + else + echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5 +echo "${ECHO_T}enabled $tcl_ok debugging" >&6 + fi + fi + + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. Add Tk too if necessary. +#-------------------------------------------------------------------- + +cat >>confdefs.h <<\_ACEOF +#define USE_TCL_STUBS 1 +_ACEOF + +#AC_DEFINE(USE_TK_STUBS) + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, +# and TEA_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + + + if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then + MAKE_STATIC_LIB="\${STLIB_LD} -out:\$@ \$(PKG_OBJECTS)" + MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\$@ \$(PKG_OBJECTS)" + MAKE_STUB_LIB="\${STLIB_LD} -out:\$@ \$(PKG_STUB_OBJECTS)" + else + MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)" + MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS}" + MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)" + fi + + if test "${SHARED_BUILD}" = "1" ; then + MAKE_LIB="${MAKE_SHARED_LIB} " + else + MAKE_LIB="${MAKE_STATIC_LIB} " + fi + + #-------------------------------------------------------------------- + # Shared libraries and static libraries have different names. + # Use the double eval to make sure the ${DBGX} in the suffix is + # substituted. + #-------------------------------------------------------------------- + + RANLIB_STUB="${RANLIB}" + if test "${TEA_PLATFORM}" = "windows" ; then + if test "${SHARED_BUILD}" = "1" ; then + # We force the unresolved linking of symbols that are really in + # the private libraries of Tcl and Tk. + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" + if test x"${TK_BIN_DIR}" != x ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" + fi + eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + fi + # Some packages build there own stubs libraries + eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + else + if test "${SHARED_BUILD}" = "1" ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" + if test x"${TK_BIN_DIR}" != x ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}" + fi + eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + fi + # Some packages build there own stubs libraries + eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + fi + + # These are escaped so that only CFLAGS is picked up at configure time. + # The other values will be substituted at make time. + CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" + if test "${SHARED_BUILD}" = "1" ; then + CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}" + fi + + + + + + + + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +# Add WISH as well if this is a Tk extension. +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for tclsh" >&5 +echo $ECHO_N "checking for tclsh... $ECHO_C" >&6 + + if test "${ac_cv_path_tclsh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "x${CELIB_DIR}" != "x" ; then + # If CELIB_DIR is defined, assume Windows/CE target is requested + # which means target tclsh cannot be run (cross-compile) + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + else + search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'` + fi + for dir in $search_path ; do + for j in `ls -r $dir/tclsh[8-9]*${EXEEXT} 2> /dev/null` \ + `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do + if test x"$ac_cv_path_tclsh" = x ; then + if test -f "$j" ; then + ac_cv_path_tclsh=$j + break + fi + fi + done + done + +fi + + + if test -f "$ac_cv_path_tclsh" ; then + TCLSH_PROG=$ac_cv_path_tclsh + echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5 +echo "${ECHO_T}$TCLSH_PROG" >&6 + else + { { echo "$as_me:$LINENO: error: No tclsh found in PATH: $search_path" >&5 +echo "$as_me: error: No tclsh found in PATH: $search_path" >&2;} + { (exit 1); exit 1; }; } + fi + + +#TEA_PROG_WISH + +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +# You may alternatively have a special pkgIndex.tcl.in or other files +# which require substituting th AC variables in. Include these here. +#-------------------------------------------------------------------- + + ac_config_files="$ac_config_files Makefile" +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 +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by xotclgdbm $as_me 1.2, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +xotclgdbm config.status 1.2 +configured by $0, generated by GNU Autoconf 2.57, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@CYGPATH@,$CYGPATH,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@PKG_LIB_FILE@,$PKG_LIB_FILE,;t t +s,@PKG_STUB_LIB_FILE@,$PKG_STUB_LIB_FILE,;t t +s,@PKG_STUB_SOURCES@,$PKG_STUB_SOURCES,;t t +s,@PKG_STUB_OBJECTS@,$PKG_STUB_OBJECTS,;t t +s,@PKG_TCL_SOURCES@,$PKG_TCL_SOURCES,;t t +s,@PKG_HEADERS@,$PKG_HEADERS,;t t +s,@PKG_INCLUDES@,$PKG_INCLUDES,;t t +s,@PKG_LIBS@,$PKG_LIBS,;t t +s,@PKG_CFLAGS@,$PKG_CFLAGS,;t t +s,@TCL_VERSION@,$TCL_VERSION,;t t +s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t +s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t +s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t +s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t +s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t +s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t +s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t +s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t +s,@TCL_LIBS@,$TCL_LIBS,;t t +s,@TCL_DEFS@,$TCL_DEFS,;t t +s,@TCL_EXTRA_CFLAGS@,$TCL_EXTRA_CFLAGS,;t t +s,@TCL_LD_FLAGS@,$TCL_LD_FLAGS,;t t +s,@TCL_SHLIB_LD_LIBS@,$TCL_SHLIB_LD_LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@EGREP@,$EGREP,;t t +s,@MATH_LIBS@,$MATH_LIBS,;t t +s,@XOTCL_VERSION@,$XOTCL_VERSION,;t t +s,@XOTCL_MAJOR_VERSION@,$XOTCL_MAJOR_VERSION,;t t +s,@XOTCL_MINOR_VERSION@,$XOTCL_MINOR_VERSION,;t t +s,@XOTCL_RELEASE_LEVEL@,$XOTCL_RELEASE_LEVEL,;t t +s,@XOTCL_LIB_FILE@,$XOTCL_LIB_FILE,;t t +s,@XOTCL_BUILD_LIB_SPEC@,$XOTCL_BUILD_LIB_SPEC,;t t +s,@XOTCL_LIB_SPEC@,$XOTCL_LIB_SPEC,;t t +s,@XOTCL_STUB_LIB_FILE@,$XOTCL_STUB_LIB_FILE,;t t +s,@XOTCL_BUILD_STUB_LIB_SPEC@,$XOTCL_BUILD_STUB_LIB_SPEC,;t t +s,@XOTCL_STUB_LIB_SPEC@,$XOTCL_STUB_LIB_SPEC,;t t +s,@XOTCL_SRC_DIR@,$XOTCL_SRC_DIR,;t t +s,@PKG_SOURCES@,$PKG_SOURCES,;t t +s,@PKG_OBJECTS@,$PKG_OBJECTS,;t t +s,@CLEANFILES@,$CLEANFILES,;t t +s,@TCL_INCLUDES@,$TCL_INCLUDES,;t t +s,@TCL_THREADS@,$TCL_THREADS,;t t +s,@SHARED_BUILD@,$SHARED_BUILD,;t t +s,@AR@,$AR,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@DL_LIBS@,$DL_LIBS,;t t +s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t +s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t +s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t +s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t +s,@STLIB_LD@,$STLIB_LD,;t t +s,@SHLIB_LD@,$SHLIB_LD,;t t +s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t +s,@SHLIB_LD_FLAGS@,$SHLIB_LD_FLAGS,;t t +s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t +s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t +s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t +s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t +s,@TCL_DBGX@,$TCL_DBGX,;t t +s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t +s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t +s,@MAKE_LIB@,$MAKE_LIB,;t t +s,@MAKE_SHARED_LIB@,$MAKE_SHARED_LIB,;t t +s,@MAKE_STATIC_LIB@,$MAKE_STATIC_LIB,;t t +s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t +s,@RANLIB_STUB@,$RANLIB_STUB,;t t +s,@TCLSH_PROG@,$TCLSH_PROG,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + Index: xotcl/library/store/XOTclGdbm/configure.in =================================================================== diff -u --- xotcl/library/store/XOTclGdbm/configure.in (revision 0) +++ xotcl/library/store/XOTclGdbm/configure.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,229 @@ +#!/bin/bash -norc +dnl This file is an input file used by the GNU "autoconf" program to +dnl generate the file "configure", which is run during Tcl installation +dnl to configure the system for the local environment. +# +# RCS: @(#) $Id: configure.in,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#----------------------------------------------------------------------- +# Sample configure.in for Tcl Extensions. The only places you should +# need to modify this file are marked by the string __CHANGE__ +#----------------------------------------------------------------------- + +configdir=$(srcdir)/../../../config + +#----------------------------------------------------------------------- +# __CHANGE__ +# Set your package name and version numbers here. +# +# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION +# set as provided. These will also be added as -D defs in your Makefile +# so you can encode the package version directly into the source files. +#----------------------------------------------------------------------- + +AC_INIT([xotclgdbm], [1.2]) + +#-------------------------------------------------------------------- +# Call TEA_INIT as the first TEA_ macro to set up initial vars. +# This will define a ${TEA_PLATFORM} variable == "unix" or "windows" +# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. +#-------------------------------------------------------------------- + +TEA_INIT([3.0]) + +AC_CONFIG_AUX_DIR(../../../config) + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + +TEA_PATH_TCLCONFIG +TEA_LOAD_TCLCONFIG + +#-------------------------------------------------------------------- +# Load the tkConfig.sh file if necessary (Tk extension) +#-------------------------------------------------------------------- + +#TEA_PATH_TKCONFIG +#TEA_LOAD_TKCONFIG + +#----------------------------------------------------------------------- +# Handle the --prefix=... option by defaulting to what Tcl gave. +# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. +#----------------------------------------------------------------------- + +TEA_PREFIX + +#----------------------------------------------------------------------- +# Standard compiler checks. +# This sets up CC by using the CC env var, or looks for gcc otherwise. +# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create +# the basic setup necessary to compile executables. +#----------------------------------------------------------------------- + +TEA_SETUP_COMPILER + +#----------------------------------------------------------------------- +# __CHANGE__ +# Specify the C source files to compile in TEA_ADD_SOURCES, +# public headers that need to be installed in TEA_ADD_HEADERS, +# stub library C source files to compile in TEA_ADD_STUB_SOURCES, +# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. +# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS +# and PKG_TCL_SOURCES. +#----------------------------------------------------------------------- + +if test ! "${with_gdbm}" == yes; then + GDBM_INC_DIR="`echo $with_gdbm |cut -f1 -d,`" + GDBM_LIB_DIR="`echo $with_gdbm |cut -f2 -d, -s`" +fi +if test -z "$GDBM_INC_DIR" ; then + gdbm_h_ok=1 + GDBM_INC_SPEC="" +else + GDBM_INC_SPEC="-I${GDBM_INC_DIR}" + echo "Checking ${GDBM_INC_DIR}/gdbm.h" + if test -f "${GDBM_INC_DIR}/gdbm.h" ; then + gdbm_h_ok=1 + else + gdbm_h_ok=0 + fi +fi + +if test "${gdbm_h_ok}" == "0" ; then + AC_MSG_ERROR([ + Could not locate gdbm.h on your machine to build XOTclGdbm. + You can download a precompiled lib 'libgdbm' + and the header file 'gdbm.h' from http://www.gnu.org/software/gdbm/ + and compile again. Alternatively, you can compile XOTcl without gdbm. + ]) +fi + +if test -z "${GDBM_LIB_DIR}" ; then + GDBM_LIB_SPEC="" +else + GDBM_LIB_SPEC="-L${GDBM_LIB_DIR}" +fi + +#echo "Gdbm include spec = '${GDBM_INC_SPEC}'" +#echo "Gdbm lib spec = '${GDBM_LIB_SPEC}'" + +# ------- load xotclConfig.sh ---------- +SC_PATH_XOTCLCONFIG +SC_LOAD_XOTCLCONFIG +# ------- + +TEA_ADD_SOURCES([xotclgdbm.c]) +TEA_ADD_HEADERS([]) +TEA_ADD_INCLUDES([-I$XOTCL_SRC_DIR/generic $GDBM_INC_SPEC]) +TEA_ADD_LIBS([$XOTCL_BUILD_STUB_LIB_SPEC $GDBM_LIB_SPEC -lgdbm]) +TEA_ADD_CFLAGS([]) +TEA_ADD_STUB_SOURCES([]) +TEA_ADD_TCL_SOURCES([]) + +#-------------------------------------------------------------------- +# __CHANGE__ +# A few miscellaneous platform-specific items: +# +# Define a special symbol for Windows (BUILD_sample in this case) so +# that we create the export library with the dll. +# +# Windows creates a few extra files that need to be cleaned up. +# You can add more files to clean if your extension creates any extra +# files. +# +# TEA_ADD_* any platform specific compiler/build info here. +#-------------------------------------------------------------------- + +if test "${TEA_PLATFORM}" = "windows" ; then + AC_DEFINE(BUILD_sample) + CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" + #TEA_ADD_SOURCES([win/winFile.c]) + #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) +else + CLEANFILES="pkgIndex.tcl" + #TEA_ADD_SOURCES([unix/unixFile.c]) + #TEA_ADD_LIBS([-lsuperfly]) +fi +AC_SUBST(CLEANFILES) + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG +#-------------------------------------------------------------------- + +TEA_PUBLIC_TCL_HEADERS +#TEA_PRIVATE_TCL_HEADERS + +#TEA_PUBLIC_TK_HEADERS +#TEA_PRIVATE_TK_HEADERS +#TEA_PATH_X + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +#-------------------------------------------------------------------- + +TEA_ENABLE_THREADS + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + +TEA_ENABLE_SHARED + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# can be taken from the tclConfig.sh file, but this figures it all out. +#-------------------------------------------------------------------- + +TEA_CONFIG_CFLAGS + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols option. +#-------------------------------------------------------------------- + +TEA_ENABLE_SYMBOLS + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. Add Tk too if necessary. +#-------------------------------------------------------------------- + +AC_DEFINE(USE_TCL_STUBS) +#AC_DEFINE(USE_TK_STUBS) + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, +# and TEA_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + +TEA_MAKE_LIB + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +# Add WISH as well if this is a Tk extension. +#-------------------------------------------------------------------- + +TEA_PROG_TCLSH +#TEA_PROG_WISH + +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +# You may alternatively have a special pkgIndex.tcl.in or other files +# which require substituting th AC variables in. Include these here. +#-------------------------------------------------------------------- + +AC_OUTPUT([Makefile]) Index: xotcl/library/store/XOTclGdbm/xotclgdbm.c =================================================================== diff -u --- xotcl/library/store/XOTclGdbm/xotclgdbm.c (revision 0) +++ xotcl/library/store/XOTclGdbm/xotclgdbm.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,368 @@ +/* + * xotclgdbm.c + * + * based on Tclndbm 0.5 by John Ellson (ellson@lucent.com) + */ + +#include +#include +#include +#include +#include + +#if (TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<1) +# define TclObjStr(obj) Tcl_GetStringFromObj(obj, ((int*)NULL)) +#else +# define TclObjStr(obj) Tcl_GetString(obj) +#endif + +typedef struct db_s { + datum* lastSearchKey; + GDBM_FILE db; +} db_t; + +void +gdbmFatalFunc(char* message) { + fprintf(stderr, "GDBM FATAL:\n%s\n", message); + exit(1); +} + +static int +XOTclGdbmOpenMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + db_t *db; + XOTcl_Object* obj = (XOTcl_Object*) cd; + int flags, block_size, mode; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 2) + return XOTclObjErrArgCnt(in, obj->cmdName, "open filename"); + + /* name not in hashtab - create new db */ + if (XOTclGetObjClientData(obj)) + return XOTclVarErrMsg(in, "Called open on '", TclObjStr(obj->cmdName), + "', but open database was not closed before.", 0); + + db = (db_t*) ckalloc (sizeof(db_t)); + db->lastSearchKey = NULL; + + flags = GDBM_WRCREAT; + block_size = 0; + mode = 0644; + + db->db = gdbm_open(TclObjStr(objv[1]), block_size, flags, mode, gdbmFatalFunc); + + if (db->db == NULL) { + ckfree ((char*) db); + db = (db_t*) NULL ; + return XOTclVarErrMsg(in, "Open on '", TclObjStr(obj->cmdName), + "' failed with '", TclObjStr(objv[1]),"': ", + gdbm_strerror(gdbm_errno), 0); + } + /* + * success + */ + XOTclSetObjClientData(obj, (ClientData) db); + return TCL_OK; +} + +static int +XOTclGdbmCloseMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + db_t *db; + XOTcl_Object* obj = (XOTcl_Object *) cd; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 1) + return XOTclObjErrArgCnt(in, obj->cmdName, "close"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called close on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + gdbm_close(db->db); + ckfree ((char*)db); + XOTclSetObjClientData(obj, 0); + + return TCL_OK; +} + +static int +XOTclGdbmNamesMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *) cd; + Tcl_Obj *list; + db_t *db; + Tcl_DString result; + datum del, key; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 1) + return XOTclObjErrArgCnt(in, obj->cmdName, "names"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called names on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + Tcl_DStringInit(&result); + + key = gdbm_firstkey(db->db); + if (!key.dptr) { + /* empty db */ + return TCL_OK ; + } + + /* + * copy key to result and go to next key + */ + list = Tcl_NewListObj(0, NULL); + do { + Tcl_ListObjAppendElement(in,list,Tcl_NewStringObj(key.dptr,key.dsize-1)); + del.dptr = key.dptr; + key = gdbm_nextkey(db->db, key); + free(del.dptr); + } while (key.dptr); + Tcl_SetObjResult(in, list); + + return TCL_OK; +} + +static int +XOTclGdbmSetMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *)cd; + db_t *db; + datum key, content; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc <2 || objc > 3) + return XOTclObjErrArgCnt(in, obj->cmdName, "set key ?value?"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called set on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + + key.dptr = TclObjStr(objv[1]); + key.dsize = objv[1]->length + 1; + + if (objc == 2) { + /* get value */ + content = gdbm_fetch(db->db, key); + if (content.dptr) { + /* found */ + Tcl_Obj *r = Tcl_NewStringObj(content.dptr, content.dsize-1); + Tcl_SetObjResult(in, r); + free(content.dptr); + } else { + /* key not found */ + return XOTclVarErrMsg(in, "no such variable '", key.dptr, + "'", 0); + } + } else { + /* set value */ + content.dptr = TclObjStr(objv[2]); + content.dsize = objv[2]->length + 1; + if (gdbm_store(db->db, key, content, GDBM_REPLACE) == 0) { + /*fprintf(stderr,"setting %s to '%s'\n",key.dptr,content.dptr);*/ + Tcl_SetObjResult(in, objv[2]); + } else { + return XOTclVarErrMsg(in, "set of variable '", TclObjStr(obj->cmdName), + "' failed.", 0); + } + } + return TCL_OK; +} + +static int +XOTclGdbmExistsMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *) cd; + db_t *db; + datum key; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 2) + return XOTclObjErrArgCnt(in, obj->cmdName, "exists variable"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called exists on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + + key.dptr = TclObjStr(objv[1]); + key.dsize = objv[1]->length + 1; + + if (gdbm_exists(db->db, key)) + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + else + Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + + return TCL_OK; +} + +static int +XOTclGdbmUnsetMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *) cd; + db_t *db; + datum key; + int ret; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 2) + return XOTclObjErrArgCnt(in, obj->cmdName, "unset key"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called unset on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + + key.dptr = TclObjStr(objv[1]); + key.dsize = objv[1]->length + 1; + + ret = gdbm_delete(db->db, key); + + if (ret == 0) { + return TCL_OK; + } else { + return XOTclVarErrMsg(in, "Tried to unset '", TclObjStr(objv[1]), + "' but key does not exist.", 0); + } +} + +static int +XOTclGdbmFirstKeyMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *) cd; + db_t *db; + datum key; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 1) + return XOTclObjErrArgCnt(in, obj->cmdName, "firstkey"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called unset on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + + if (db->lastSearchKey != 0) { + ckfree((char*) db->lastSearchKey->dptr); + ckfree((char*) db->lastSearchKey); + db->lastSearchKey = 0; + } + + key = gdbm_firstkey(db->db); + if (!key.dptr) { + /* + * empty db + */ + return TCL_OK; + } + + Tcl_AppendResult (in, key.dptr, (char*)0); + + db->lastSearchKey = (datum*) ckalloc(sizeof(datum)); + db->lastSearchKey->dptr = key.dptr; + db->lastSearchKey->dsize = key.dsize; + + return TCL_OK; +} + +static int +XOTclGdbmNextKeyMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *) cd; + db_t *db; + datum newkey; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 1) + return XOTclObjErrArgCnt(in, obj->cmdName, "nextkey"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called unset on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + if (db->lastSearchKey == 0) + return XOTclVarErrMsg(in, + "nextkey invoked, but no search was started on '", + TclObjStr(obj->cmdName), "'", 0); + + newkey = gdbm_nextkey(db->db, *db->lastSearchKey); + + if (!newkey.dptr) { + /* + * end of search + */ + if (db->lastSearchKey != 0) { + free((char*) db->lastSearchKey->dptr); + ckfree((char*) db->lastSearchKey); + db->lastSearchKey = 0; + } + return TCL_OK ; + } + + Tcl_AppendResult (in, newkey.dptr, (char*)0); + if (db->lastSearchKey != 0) { + free((char*) db->lastSearchKey->dptr); + } + db->lastSearchKey->dptr = newkey.dptr; + db->lastSearchKey->dsize = newkey.dsize; + return TCL_OK; +} + + +/* + * Xotclgdbm_Init + * register commands, init data structures + */ + +extern int +Xotclgdbm_Init(Tcl_Interp * in) { + XOTcl_Class* cl; + int result; + +#ifdef USE_TCL_STUBS + if (Tcl_InitStubs(in, TCL_VERSION, 0) == NULL) { + return TCL_ERROR; + } +# ifdef USE_XOTCL_STUBS + if (Xotcl_InitStubs(in, "1.1", 0) == NULL) { + return TCL_ERROR; + } +# endif +#else + if (Tcl_PkgRequire(in, "Tcl", TCL_VERSION, 0) == NULL) { + return TCL_ERROR; + } +#endif + Tcl_PkgProvide(in, "xotcl::store::gdbm", PACKAGE_VERSION); + +#ifdef PACKAGE_REQUIRE_XOTL_FROM_SLAVE_INTERP_WORKS_NOW + if (Tcl_PkgRequire(in, "XOTcl", XOTCLVERSION, 0) == NULL) { + return TCL_ERROR; + } +#endif + if (Tcl_PkgRequire(in, "xotcl::store", 0, 0) == NULL) { + return TCL_ERROR; + } + result = Tcl_VarEval (in, + "Class Storage=Gdbm -superclass Storage", + (char*) 0); + if (result != TCL_OK) + return result; + + cl = XOTclGetClass(in, "Storage=Gdbm"); + XOTclAddIMethod(in, cl, "open", XOTclGdbmOpenMethod, 0, 0); + XOTclAddIMethod(in, cl, "close", XOTclGdbmCloseMethod, 0, 0); + XOTclAddIMethod(in, cl, "set", XOTclGdbmSetMethod, 0, 0); + XOTclAddIMethod(in, cl, "exists", XOTclGdbmExistsMethod, 0, 0); + XOTclAddIMethod(in, cl, "names", XOTclGdbmNamesMethod, 0, 0); + XOTclAddIMethod(in, cl, "unset", XOTclGdbmUnsetMethod, 0, 0); + XOTclAddIMethod(in, cl, "firstkey", XOTclGdbmFirstKeyMethod, 0, 0); + XOTclAddIMethod(in, cl, "nextkey", XOTclGdbmNextKeyMethod, 0, 0); + + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + return TCL_OK; +} + +extern int +Xotclgdbm_SafeInit(interp) + Tcl_Interp *interp; +{ + return Xotclgdbm_Init(interp); +} Index: xotcl/library/store/XOTclSdbm/Makefile =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/Makefile (revision 0) +++ xotcl/library/store/XOTclSdbm/Makefile (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,431 @@ +# Makefile.in -- +# +# This file is a Makefile for Sample TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# Copyright (c) 2002-2003 ActiveState Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#======================================================================== +# Add additional lines to handle any additional AC_SUBST cases that +# have been added in a customized configure script. +#======================================================================== + +#SAMPLE_NEW_VAR = @SAMPLE_NEW_VAR@ + +#======================================================================== +# Nothing of the variables below this line should need to be changed. +# Please check the TARGETS section below to make sure the make targets +# are correct. +#======================================================================== + +#======================================================================== +# The names of the source files is defined in the configure script. +# The object files are used for linking into the final library. +# This will be used when a dist target is added to the Makefile. +# It is not important to specify the directory, as long as it is the +# $(srcdir) or in the generic, win or unix subdirectory. +#======================================================================== + +PKG_SOURCES = hash.c pair.c sdbm.c xotclsdbm.c +PKG_OBJECTS = hash.o pair.o sdbm.o xotclsdbm.o + +PKG_STUB_SOURCES = +PKG_STUB_OBJECTS = + +#======================================================================== +# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with +# this package that need to be installed, if any. +#======================================================================== + +PKG_TCL_SOURCES = + +#======================================================================== +# This is a list of public header files to be installed, if any. +#======================================================================== + +PKG_HEADERS = + +#======================================================================== +# "PKG_LIB_FILE" refers to the library (dynamic or static as per +# configuration options) composed of the named objects. +#======================================================================== + +PKG_LIB_FILE = libxotclsdbm1.2.so +PKG_STUB_LIB_FILE = libxotclsdbmstub1.2.a + +lib_BINARIES = $(PKG_LIB_FILE) +BINARIES = $(lib_BINARIES) + +SHELL = /bin/sh + +srcdir = . +prefix = /usr +exec_prefix = /usr + +bindir = ${exec_prefix}/bin +libdir = ${exec_prefix}/lib +datadir = ${prefix}/share +mandir = ${prefix}/man +includedir = ${prefix}/include + +DESTDIR = + +PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) +pkgdatadir = $(datadir)/$(PKG_DIR) +pkglibdir = $(libdir)/$(PKG_DIR) +pkgincludedir = $(includedir)/$(PKG_DIR) + +top_builddir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL} + +PACKAGE_NAME = xotclsdbm +PACKAGE_VERSION = 1.2 +CC = gcc -pipe +CFLAGS_DEFAULT = -O +CFLAGS_WARNING = -Wall -Wconversion -Wno-implicit-int +CLEANFILES = pkgIndex.tcl +EXEEXT = +LDFLAGS_DEFAULT = -rdynamic +MAKE_LIB = ${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS} +MAKE_SHARED_LIB = ${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS} +MAKE_STATIC_LIB = ${STLIB_LD} $@ $(PKG_OBJECTS) +MAKE_STUB_LIB = ${STLIB_LD} $@ $(PKG_STUB_OBJECTS) +OBJEXT = o +RANLIB = : +RANLIB_STUB = ranlib +SHLIB_CFLAGS = -fPIC +SHLIB_LD = gcc -pipe -shared +SHLIB_LD_FLAGS = +SHLIB_LD_LIBS = ${LIBS} -L/usr/lib -ltclstub8.4 +STLIB_LD = ${AR} cr +TCL_DEFS = -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOLL=1 -DHAVE_STRTOULL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DPEEK_XCLOSEIM=1 -DHAVE_SYS_IOCTL_H=1 +TCL_BIN_DIR = /usr/lib +TCL_SRC_DIR = /home/neumann/tcl8.4.5 +# This is necessary for packages that use private Tcl headers +#TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@ +# Not used, but retained for reference of what libs Tcl required +TCL_LIBS = ${DL_LIBS} ${LIBS} ${MATH_LIBS} + +#======================================================================== +# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our +# package without installing. The other environment variables allow us +# to test against an uninstalled Tcl. Add special env vars that you +# require for testing here (like TCLX_LIBRARY). +#======================================================================== + +EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR) +TCLSH_ENV = TCL_LIBRARY=`echo $(TCL_SRC_DIR)/library` \ + LD_LIBRARY_PATH="$(EXTRA_PATH):$(LD_LIBRARY_PATH)" \ + PATH="$(EXTRA_PATH):$(PATH)" \ + TCLLIBPATH="$(top_builddir)" +TCLSH_PROG = /usr/lib/../bin/tclsh8.4 +TCLSH = $(TCLSH_ENV) $(TCLSH_PROG) +SHARED_BUILD = 1 + +INCLUDES = -I/home/neumann/xotcl-1.2.1/generic -I"/usr/include" + +EXTRA_CFLAGS = + +# TCL_DEFS is not strictly need here, but if you remove it, then you +# must make sure that configure.in checks for the necessary components +# that your library may use. TCL_DEFS can actually be a problem if +# you do not compile with a similar machine setup as the Tcl core was +# compiled with. +#DEFS = $(TCL_DEFS) -DPACKAGE_NAME=\"xotclsdbm\" -DPACKAGE_TARNAME=\"xotclsdbm\" -DPACKAGE_VERSION=\"1.2\" -DPACKAGE_STRING=\"xotclsdbm\ 1.2\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS=1 $(EXTRA_CFLAGS) +DEFS = -DPACKAGE_NAME=\"xotclsdbm\" -DPACKAGE_TARNAME=\"xotclsdbm\" -DPACKAGE_VERSION=\"1.2\" -DPACKAGE_STRING=\"xotclsdbm\ 1.2\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS=1 $(EXTRA_CFLAGS) + +CONFIG_CLEAN_FILES = Makefile + +CPPFLAGS = +LIBS = -L/home/neumann/xotcl-1.2.1 -lxotclstub1.2.1 +AR = ar +CFLAGS = ${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries doc + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: $(BINARIES) pkgIndex.tcl + +libraries: + +doc: + @echo "If you have documentation to create, place the commands to" + @echo "build the docs in the 'doc:' target. For example:" + @echo " xml2nroff sample.xml > sample.n" + @echo " xml2html sample.xml > sample.html" + +install: all install-binaries install-libraries install-doc + +install-binaries: binaries install-lib-binaries install-bin-binaries + if test "x$(SHARED_BUILD)" = "x1"; then \ + $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir); \ + fi + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== + +install-libraries: libraries + @mkdir -p $(DESTDIR)$(includedir) + @echo "Installing header files in $(DESTDIR)$(includedir)" + @for i in $(PKG_HEADERS) ; do \ + echo "Installing $(srcdir)/$$i" ; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \ + done; + +#======================================================================== +# Install documentation. Unix manpages should go in the $(mandir) +# directory. +#======================================================================== + +install-doc: doc +#install-doc: doc +# @mkdir -p $(DESTDIR)$(mandir)/mann +# @echo "Installing documentation in $(DESTDIR)$(mandir)" +# @for i in $(srcdir)/doc/*.n; do \ +# echo "Installing $$i"; \ +# rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \ +# $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \ +# done + +test: binaries libraries + $(TCLSH) `echo $(srcdir)/tests/all.tcl` $(TESTFLAGS) + +shell: binaries libraries + @$(TCLSH) $(SCRIPT) + +gdb: + $(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT) + +depend: + +#======================================================================== +# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable +# mentioned above. That will ensure that this target is built when you +# run "make binaries". +# +# The $(PKG_OBJECTS) objects are created and linked into the final +# library. In most cases these object files will correspond to the +# source files above. +#======================================================================== + +$(PKG_LIB_FILE): $(PKG_OBJECTS) + -rm -f $(PKG_LIB_FILE) + ${MAKE_LIB} + $(RANLIB) $(PKG_LIB_FILE) + +$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS) + -rm -f $(PKG_STUB_LIB_FILE) + ${MAKE_STUB_LIB} + $(RANLIB_STUB) $(PKG_STUB_LIB_FILE) + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# sample.$(OBJEXT): $(srcdir)/generic/sample.c +# $(COMPILE) -c `echo $(srcdir)/generic/sample.c` -o $@ +# +# Setting the VPATH variable to a list of paths will cause the makefile +# to look into these paths when resolving .c to .obj dependencies. +# As necessary, add $(srcdir):$(srcdir)/compat:.... +#======================================================================== + +VPATH = $(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win + +.c.o: + $(COMPILE) -c `echo $<` -o $@ + +#======================================================================== +# Create the pkgIndex.tcl file. +# It is usually easiest to let Tcl do this for you with pkg_mkIndex, but +# you may find that you need to customize the package. If so, either +# modify the -hand version, or create a pkgIndex.tcl.in file and have +# the configure script output the pkgIndex.tcl by editing configure.in. +#======================================================================== + +#pkgIndex.tcl: +# ( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(TCLSH) + +pkgIndex.tcl: + (echo 'package ifneeded xotcl::store::sdbm $(PACKAGE_VERSION) \ + [list load [file join $$dir $(PKG_LIB_FILE)]]'\ + ) > pkgIndex.tcl + +#======================================================================== +# Distribution creation +# You may need to tweak this target to make it work correctly. +#======================================================================== + +#COMPRESS = tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar +COMPRESS = gtar zcvf $(PKG_DIR).tar.gz $(PKG_DIR) +DIST_ROOT = /tmp/dist +DIST_DIR = $(DIST_ROOT)/$(PKG_DIR) + +dist-clean: + rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.* + +dist: dist-clean + mkdir -p $(DIST_DIR) + cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license* \ + $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/*.in \ + $(DIST_DIR)/ + chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4 + chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in + + cp -p $(srcdir)/*.[ch] $(DIST_DIR)/ + + mkdir $(DIST_DIR)/tclconfig + cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \ + $(DIST_DIR)/tclconfig/ + chmod 664 $(DIST_DIR)/tclconfig/tcl.m4 + chmod +x $(DIST_DIR)/tclconfig/install-sh + + list='demos doc generic library mac tests unix win'; \ + for p in $$list; do \ + if test -d $(srcdir)/$$p ; then \ + mkdir $(DIST_DIR)/$$p; \ + cp -p $(srcdir)/$$p/*.* $(DIST_DIR)/$$p/; \ + fi; \ + done + + (cd $(DIST_ROOT); $(COMPRESS);) + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + -test -z "$(BINARIES)" || rm -f $(BINARIES) + -rm -f *.$(OBJEXT) core *.core + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean: clean + -rm -f *.tab.c + -rm -f $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log config.status + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Library files go into the lib directory. +# In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: + @mkdir -p $(DESTDIR)$(pkglibdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \ + stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \ + if test "x$$stub" = "xstub"; then \ + echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \ + else \ + echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \ + fi; \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \ + fi; \ + fi; \ + fi; \ + done + @list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + destp=`basename $$p`; \ + echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \ + fi; \ + done + +#======================================================================== +# Install binary executables (e.g. .exe files and dependent .dll files) +# This is for files that must go in the bin directory (located next to +# wish and tclsh), like dependent .dll files on Windows. +# +# You should not have to modify this target, except to define bin_BINARIES +# above if necessary. +#======================================================================== + +install-bin-binaries: + @mkdir -p $(DESTDIR)$(bindir) + @list='$(bin_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \ + fi; \ + done + +.SUFFIXES: .c .$(OBJEXT) + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +uninstall-binaries: + list='$(lib_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + p=`basename $$p`; \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(bin_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/$$p; \ + done + +.PHONY: all binaries clean depend distclean doc install libraries test + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: xotcl/library/store/XOTclSdbm/Makefile.in =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/Makefile.in (revision 0) +++ xotcl/library/store/XOTclSdbm/Makefile.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,431 @@ +# Makefile.in -- +# +# This file is a Makefile for Sample TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# Copyright (c) 2002-2003 ActiveState Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile.in,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#======================================================================== +# Add additional lines to handle any additional AC_SUBST cases that +# have been added in a customized configure script. +#======================================================================== + +#SAMPLE_NEW_VAR = @SAMPLE_NEW_VAR@ + +#======================================================================== +# Nothing of the variables below this line should need to be changed. +# Please check the TARGETS section below to make sure the make targets +# are correct. +#======================================================================== + +#======================================================================== +# The names of the source files is defined in the configure script. +# The object files are used for linking into the final library. +# This will be used when a dist target is added to the Makefile. +# It is not important to specify the directory, as long as it is the +# $(srcdir) or in the generic, win or unix subdirectory. +#======================================================================== + +PKG_SOURCES = @PKG_SOURCES@ +PKG_OBJECTS = @PKG_OBJECTS@ + +PKG_STUB_SOURCES = @PKG_STUB_SOURCES@ +PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@ + +#======================================================================== +# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with +# this package that need to be installed, if any. +#======================================================================== + +PKG_TCL_SOURCES = @PKG_TCL_SOURCES@ + +#======================================================================== +# This is a list of public header files to be installed, if any. +#======================================================================== + +PKG_HEADERS = @PKG_HEADERS@ + +#======================================================================== +# "PKG_LIB_FILE" refers to the library (dynamic or static as per +# configuration options) composed of the named objects. +#======================================================================== + +PKG_LIB_FILE = @PKG_LIB_FILE@ +PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@ + +lib_BINARIES = $(PKG_LIB_FILE) +BINARIES = $(lib_BINARIES) + +SHELL = @SHELL@ + +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +libdir = @libdir@ +datadir = @datadir@ +mandir = @mandir@ +includedir = @includedir@ + +DESTDIR = + +PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) +pkgdatadir = $(datadir)/$(PKG_DIR) +pkglibdir = $(libdir)/$(PKG_DIR) +pkgincludedir = $(includedir)/$(PKG_DIR) + +top_builddir = . + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ + +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +CC = @CC@ +CFLAGS_DEFAULT = @CFLAGS_DEFAULT@ +CFLAGS_WARNING = @CFLAGS_WARNING@ +CLEANFILES = @CLEANFILES@ +EXEEXT = @EXEEXT@ +LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@ +MAKE_LIB = @MAKE_LIB@ +MAKE_SHARED_LIB = @MAKE_SHARED_LIB@ +MAKE_STATIC_LIB = @MAKE_STATIC_LIB@ +MAKE_STUB_LIB = @MAKE_STUB_LIB@ +OBJEXT = @OBJEXT@ +RANLIB = @RANLIB@ +RANLIB_STUB = @RANLIB_STUB@ +SHLIB_CFLAGS = @SHLIB_CFLAGS@ +SHLIB_LD = @SHLIB_LD@ +SHLIB_LD_FLAGS = @SHLIB_LD_FLAGS@ +SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ +STLIB_LD = @STLIB_LD@ +TCL_DEFS = @TCL_DEFS@ +TCL_BIN_DIR = @TCL_BIN_DIR@ +TCL_SRC_DIR = @TCL_SRC_DIR@ +# This is necessary for packages that use private Tcl headers +#TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@ +# Not used, but retained for reference of what libs Tcl required +TCL_LIBS = @TCL_LIBS@ + +#======================================================================== +# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our +# package without installing. The other environment variables allow us +# to test against an uninstalled Tcl. Add special env vars that you +# require for testing here (like TCLX_LIBRARY). +#======================================================================== + +EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR) +TCLSH_ENV = TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \ + @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \ + PATH="$(EXTRA_PATH):$(PATH)" \ + TCLLIBPATH="$(top_builddir)" +TCLSH_PROG = @TCLSH_PROG@ +TCLSH = $(TCLSH_ENV) $(TCLSH_PROG) +SHARED_BUILD = @SHARED_BUILD@ + +INCLUDES = @PKG_INCLUDES@ @TCL_INCLUDES@ + +EXTRA_CFLAGS = @EXTRA_CFLAGS@ @PKG_CFLAGS@ + +# TCL_DEFS is not strictly need here, but if you remove it, then you +# must make sure that configure.in checks for the necessary components +# that your library may use. TCL_DEFS can actually be a problem if +# you do not compile with a similar machine setup as the Tcl core was +# compiled with. +#DEFS = $(TCL_DEFS) @DEFS@ $(EXTRA_CFLAGS) +DEFS = @DEFS@ $(EXTRA_CFLAGS) + +CONFIG_CLEAN_FILES = Makefile + +CPPFLAGS = @CPPFLAGS@ +LIBS = @PKG_LIBS@ @LIBS@ +AR = ar +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries doc + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: $(BINARIES) pkgIndex.tcl + +libraries: + +doc: + @echo "If you have documentation to create, place the commands to" + @echo "build the docs in the 'doc:' target. For example:" + @echo " xml2nroff sample.xml > sample.n" + @echo " xml2html sample.xml > sample.html" + +install: all install-binaries install-libraries install-doc + +install-binaries: binaries install-lib-binaries install-bin-binaries + if test "x$(SHARED_BUILD)" = "x1"; then \ + $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir); \ + fi + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== + +install-libraries: libraries + @mkdir -p $(DESTDIR)$(includedir) + @echo "Installing header files in $(DESTDIR)$(includedir)" + @for i in $(PKG_HEADERS) ; do \ + echo "Installing $(srcdir)/$$i" ; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \ + done; + +#======================================================================== +# Install documentation. Unix manpages should go in the $(mandir) +# directory. +#======================================================================== + +install-doc: doc +#install-doc: doc +# @mkdir -p $(DESTDIR)$(mandir)/mann +# @echo "Installing documentation in $(DESTDIR)$(mandir)" +# @for i in $(srcdir)/doc/*.n; do \ +# echo "Installing $$i"; \ +# rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \ +# $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \ +# done + +test: binaries libraries + $(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS) + +shell: binaries libraries + @$(TCLSH) $(SCRIPT) + +gdb: + $(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT) + +depend: + +#======================================================================== +# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable +# mentioned above. That will ensure that this target is built when you +# run "make binaries". +# +# The $(PKG_OBJECTS) objects are created and linked into the final +# library. In most cases these object files will correspond to the +# source files above. +#======================================================================== + +$(PKG_LIB_FILE): $(PKG_OBJECTS) + -rm -f $(PKG_LIB_FILE) + ${MAKE_LIB} + $(RANLIB) $(PKG_LIB_FILE) + +$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS) + -rm -f $(PKG_STUB_LIB_FILE) + ${MAKE_STUB_LIB} + $(RANLIB_STUB) $(PKG_STUB_LIB_FILE) + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# sample.$(OBJEXT): $(srcdir)/generic/sample.c +# $(COMPILE) -c `@CYGPATH@ $(srcdir)/generic/sample.c` -o $@ +# +# Setting the VPATH variable to a list of paths will cause the makefile +# to look into these paths when resolving .c to .obj dependencies. +# As necessary, add $(srcdir):$(srcdir)/compat:.... +#======================================================================== + +VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win + +.c.@OBJEXT@: + $(COMPILE) -c `@CYGPATH@ $<` -o $@ + +#======================================================================== +# Create the pkgIndex.tcl file. +# It is usually easiest to let Tcl do this for you with pkg_mkIndex, but +# you may find that you need to customize the package. If so, either +# modify the -hand version, or create a pkgIndex.tcl.in file and have +# the configure script output the pkgIndex.tcl by editing configure.in. +#======================================================================== + +#pkgIndex.tcl: +# ( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(TCLSH) + +pkgIndex.tcl: + (echo 'package ifneeded xotcl::store::sdbm $(PACKAGE_VERSION) \ + [list load [file join $$dir $(PKG_LIB_FILE)]]'\ + ) > pkgIndex.tcl + +#======================================================================== +# Distribution creation +# You may need to tweak this target to make it work correctly. +#======================================================================== + +#COMPRESS = tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar +COMPRESS = gtar zcvf $(PKG_DIR).tar.gz $(PKG_DIR) +DIST_ROOT = /tmp/dist +DIST_DIR = $(DIST_ROOT)/$(PKG_DIR) + +dist-clean: + rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.* + +dist: dist-clean + mkdir -p $(DIST_DIR) + cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license* \ + $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/*.in \ + $(DIST_DIR)/ + chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4 + chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in + + cp -p $(srcdir)/*.[ch] $(DIST_DIR)/ + + mkdir $(DIST_DIR)/tclconfig + cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \ + $(DIST_DIR)/tclconfig/ + chmod 664 $(DIST_DIR)/tclconfig/tcl.m4 + chmod +x $(DIST_DIR)/tclconfig/install-sh + + list='demos doc generic library mac tests unix win'; \ + for p in $$list; do \ + if test -d $(srcdir)/$$p ; then \ + mkdir $(DIST_DIR)/$$p; \ + cp -p $(srcdir)/$$p/*.* $(DIST_DIR)/$$p/; \ + fi; \ + done + + (cd $(DIST_ROOT); $(COMPRESS);) + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + -test -z "$(BINARIES)" || rm -f $(BINARIES) + -rm -f *.$(OBJEXT) core *.core + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean: clean + -rm -f *.tab.c + -rm -f $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log config.status + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Library files go into the lib directory. +# In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: + @mkdir -p $(DESTDIR)$(pkglibdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \ + stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \ + if test "x$$stub" = "xstub"; then \ + echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \ + else \ + echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \ + fi; \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \ + fi; \ + fi; \ + fi; \ + done + @list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + destp=`basename $$p`; \ + echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \ + fi; \ + done + +#======================================================================== +# Install binary executables (e.g. .exe files and dependent .dll files) +# This is for files that must go in the bin directory (located next to +# wish and tclsh), like dependent .dll files on Windows. +# +# You should not have to modify this target, except to define bin_BINARIES +# above if necessary. +#======================================================================== + +install-bin-binaries: + @mkdir -p $(DESTDIR)$(bindir) + @list='$(bin_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \ + fi; \ + done + +.SUFFIXES: .c .$(OBJEXT) + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +uninstall-binaries: + list='$(lib_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + p=`basename $$p`; \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(bin_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/$$p; \ + done + +.PHONY: all binaries clean depend distclean doc install libraries test + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: xotcl/library/store/XOTclSdbm/Makefile.in-ok =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/Makefile.in-ok (revision 0) +++ xotcl/library/store/XOTclSdbm/Makefile.in-ok (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,389 @@ +# Makefile.in -- +# +# This file is a Makefile for Sample TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile.in-ok,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#======================================================================== +# Edit the following few lines when writing a new extension +#======================================================================== + +configdir=$(srcdir)/../../../config + +#======================================================================== +# Change the name of the variable "exampleA_LIB_FILE" to match the one +# used in the configure script. This is the parameterized name of the +# library that we are building. +#======================================================================== + +lib_BINARIES= +BINARIES= + +#======================================================================== +# Enumerate the names of the source files included in this package. +# This will be used when a dist target is added to the Makefile. +#======================================================================== + +xotclsdbm_SOURCES = \ + $(srcdir)/hash.c \ + $(srcdir)/pair.c \ + $(srcdir)/sdbm.c \ + $(srcdir)/xotclsdbm.c +SOURCES = $(xotclsdbm_SOURCES) + +#======================================================================== +# Enumerate the names of the object files included in this package. +# These objects are created and linked into the final library. In +# most cases these object files will correspond to the source files +# above. +# +#======================================================================== + +xotclsdbm_OBJECTS = \ + ./hash.$(OBJEXT) \ + ./pair.$(OBJEXT) \ + ./sdbm.$(OBJEXT) \ + ./xotclsdbm.$(OBJEXT) +OBJECTS = $(xotclsdbm_OBJECTS) + +#======================================================================== +# The substitution of "exampleA_LIB_FILE" into the variable name below +# let's us refer to the objects for the library without knowing the name +# of the library in advance. It also lets us use the "$@" variable in +# the rule for building the library, so we can refer to both the list of +# objects and the library itself in a platform-independent manner. +#======================================================================== + +xotclsdbm_LIB_FILE = @xotclsdbm_LIB_FILE@ +$(xotclsdbm_LIB_FILE)_OBJECTS = $(xotclsdbm_OBJECTS) + +#======================================================================== +# This is a list of header files to be installed +#======================================================================== + +#GENERIC_HDRS= pair.h sdbm.h tune.h +GENERIC_HDRS= + +#======================================================================== +# Add additional lines to handle any additional AC_SUBST cases that +# have been added to the configure script. +#======================================================================== + +SAMPLE_NEW_VAR=@SAMPLE_NEW_VAR@ + +#======================================================================== +# Nothing of the variables below this line need to be changed. Please +# check the TARGETS section below to make sure the make targets are +# correct. +#======================================================================== + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_FLAG = +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +CC = @CC@ +CFLAGS_DEBUG = @CFLAGS_DEBUG@ +CFLAGS_DEFAULT = @CFLAGS_DEFAULT@ +CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ +CLEANFILES = @CLEANFILES@ +EXEEXT = @EXEEXT@ +LDFLAGS_DEBUG = @LDFLAGS_DEBUG@ +LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@ +LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ +MAKE_LIB = @MAKE_LIB@ +MAKE_SHARED_LIB = @MAKE_SHARED_LIB@ +MAKE_STATIC_LIB = @MAKE_STATIC_LIB@ +OBJEXT = @OBJEXT@ +RANLIB = @RANLIB@ +SHLIB_CFLAGS = @SHLIB_CFLAGS@ +SHLIB_LD = @SHLIB_LD@ +SHLIB_LDFLAGS = @SHLIB_LDFLAGS@ +SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ +STLIB_LD = @STLIB_LD@ +TCL_BIN_DIR = @TCL_BIN_DIR@ +TCL_DEFS = @TCL_DEFS@ +TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@ +TCL_LD_FLAGS = @TCL_LD_FLAGS@ +TCL_LIBS = @TCL_LIBS@ +TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ +TCL_SRC_DIR = @TCL_SRC_DIR@ +TCL_DBGX = @TCL_DBGX@ +TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ +TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ +TCL_TOOL_DIR_NATIVE = @TCL_TOOL_DIR_NATIVE@ +TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@ +TCL_UNIX_DIR_NATIVE = @TCL_UNIX_DIR_NATIVE@ +TCL_WIN_DIR_NATIVE = @TCL_WIN_DIR_NATIVE@ +INCLUDE_DIR_NATIVE = @INCLUDE_DIR_NATIVE@ +TCL_BMAP_DIR_NATIVE = @TCL_BMAP_DIR_NATIVE@ +TCL_PLATFORM_DIR_NATIVE = @TCL_PLATFORM_DIR_NATIVE@ +TCL_GENERIC_DIR_NATIVE = @TCL_GENERIC_DIR_NATIVE@ +TCLSH_PROG = @TCLSH_PROG@ + +AUTOCONF = autoconf + +LDFLAGS = $(LDFLAGS_DEFAULT) + +INCLUDES = @TCL_INCLUDES@ + +EXTRA_CFLAGS = $(TCL_DEFS) $(PROTO_FLAGS) $(SECURITY_FLAGS) $(MEM_DEBUG_FLAGS) $(KEYSYM_FLAGS) $(NO_DEPRECATED_FLAGS) + +DEFS = @DEFS@ $(EXTRA_CFLAGS) + +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(configdir)/mkinstalldirs +CONFIG_CLEAN_FILES = $(configdir)/mkIndex.tcl + +CPPFLAGS = @CPPFLAGS@ +LIBS = @LIBS@ +AR = ar +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -I@XOTCL_SRC_DIR@/generic +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries doc + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: + +libraries: $(srcdir)/../$(xotclsdbm_LIB_FILE) + +doc: + +install: all install-binaries install-libraries install-doc + +install-binaries: binaries install-lib-binaries install-bin-binaries + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== + +install-libraries: libraries $(DESTDIR)$(includedir) + @if test ! -z $(GENERIC_HDRS) ; then \ + echo "Installing header files in $(DESTDIR)$(includedir)" ; \ + fi + @for i in $(GENERIC_HDRS) ; do \ + echo "Installing $$i" ; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(includedir) ; \ + done; + +#======================================================================== +# Install documentation. Unix manpages should go in the $(mandir) +# directory. +#======================================================================== + +install-doc: + +test: + +depend: + +#======================================================================== +# Enumerate the names of the object files included in this package. +# These objects are created and linked into the final library. In +# most cases these object files will correspond to the source files +# above. +# +# $(exampleA_LIB_FILE) should be listed as part of the BINARIES variable +# at the top of the Makefile. That will ensure that this target is built +# when you run "make binaries". +# +# You shouldn't need to modify this target, except to change the package +# name from "exampleA" to your package's name. +#======================================================================== + +$(xotclsdbm_LIB_FILE): $(xotclsdbm_OBJECTS) + rm -f $@ + @MAKE_LIB@ + $(RANLIB) $@ + +$(srcdir)/../$(xotclsdbm_LIB_FILE): $(xotclsdbm_LIB_FILE) + cp $< $@ + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# Unfortunately, there does not seem to be any other way to do this +# in a Makefile-independent way. We can't use VPATH because it picks up +# object files that may be located in the source directory. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# exampleA.$(OBJEXT): $(srcdir)/src/win/exampleA.c +# $(COMPILE) -c `@CYGPATH@ $(srcdir)/src/win/exampleA.c` -o $@ +#======================================================================== + +%.o: $(srcdir)/%.c + $(COMPILE) -c `@CYGPATH@ $<` -o $@ + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + @rm -f $(xotclsdbm_LIB_FILE) $(srcdir)/../$(xotclsdbm_LIB_FILE) \ + *.o core *.core *.$(OBJEXT) $(CLEANFILES) config.log + +distclean: clean + -rm -f *.tab.c + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -rm -f config.status + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Additionally, the .dll files go into the bin directory, but the .lib +# files go into the lib directory. On Unix platforms, all library files +# go into the lib directory. In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh8.2 shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p; \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(libdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(libdir)/$$lib; \ + fi; \ + else \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ + fi; \ + else :; fi; \ + done + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(RANLIB) $(DESTDIR)$(bindir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(bindir)/$$p; \ + else :; fi; \ + done +# $(TCLSH_PROG) $(configdir)/mkIndex.tcl + +#======================================================================== +# Install binary executables (e.g. .exe files) +# +# You should not have to modify this target. +#======================================================================== + +install-bin-binaries: $(DESTDIR)$(bindir) + @list='$(BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p; \ + else :; fi; \ + done + +.SUFFIXES: .c .o .obj + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + + +uninstall-binaries: + @$(NORMAL_UNINSTALL) + list='$(BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +$(DESTDIR)$(includedir): + $(mkinstalldirs) $@ +$(DESTDIR)$(libdir): + $(mkinstalldirs) $@ +$(DESTDIR)$(bindir): + $(mkinstalldirs) $@ + +.PHONY: all binaries clean depend distclean doc install libraries test \ + install-binaries install-bin-binaries install-lib-binaries + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: xotcl/library/store/XOTclSdbm/Makefile.vc =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/Makefile.vc (revision 0) +++ xotcl/library/store/XOTclSdbm/Makefile.vc (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,220 @@ +###################################################################### +# +# XOTclSdbm Makefile for Visual C++ +# +###################################################################### + +# Be sure to adapt the "configs.vc" file in the toplevel directory +# to your system settings. +!include "..\..\..\win\configs.vc" + +BINROOT = . +ROOT = .. +NAMEPREFIX = lib +NAME = xotclsdbm +XOTCL_DIR = ..\..\.. +GENERICDIR = . +WINDIR = . + +###################################################################### + +!if $(DEBUG) +TMPNAME = Debug +DBGX = d +!else +TMPNAME = Release +DBGX = +!endif + +TMP_DIR = $(BINROOT)\$(TMPNAME) +OUT_DIR = $(TMP_DIR) + +!if $(STATIC_BUILD) +OUTNAME = $(NAMEPREFIX)$(NAME)$(XOTCL_VERSION)$(DBGX) +TARGET = "$(OUT_DIR)\$(OUTNAME).lib" +!else +OUTNAME = $(NAMEPREFIX)$(NAME)$(XOTCL_VERSION)$(DBGX) +IMPLIB = "$(OUT_DIR)\$(OUTNAME).lib" +TARGET = "$(OUT_DIR)\$(OUTNAME).dll" +!endif + +TCLSTUBLIB = "$(TCLROOT)\win\Release\tclstub$(TCL_VERSION).lib" +TCLIMPLIB = "$(TCLROOT)\win\$(OUT_DIR)\tcl$(TCL_VERSION)$(DBGX).lib" +TCLSH = "$(TCLROOT)\win\$(OUT_DIR)\tclsh$(TCL_VERSION)$(DBGX).exe" + +XOTCLSTUBLIB = "$(XOTCL_DIR)\win\Release\libxotclstub$(XOTCL_VERSION).lib" +XOTCLIMPLIB = "$(XOTCL_DIR)\win\$(OUT_DIR)\libxotcl$(XOTCL_VERSION)$(DBGX).lib" + +LIB_INSTALL_DIR = $(INSTALLDIR)\lib +BIN_INSTALL_DIR = $(INSTALLDIR)\bin +SCRIPT_INSTALL_DIR = $(INSTALLDIR)\lib\xotcl$(XOTCL_VERSION) +INCLUDE_INSTALL_DIR = $(INSTALLDIR)\include + +OBJS = $(TMP_DIR)\hash.obj \ + $(TMP_DIR)\pair.obj \ + $(TMP_DIR)\sdbm.obj \ + $(TMP_DIR)\xotclsdbm.obj \ +!if $(STATIC_BUILD) == 0 + $(TMP_DIR)\dllEntryPoint.obj +!endif + +###################################################################### +# Link flags +###################################################################### + +!if $(DEBUG) +ldebug = -debug:full -debugtype:cv -pdb:none +!else +ldebug = -release -opt:ref +!endif + +# declarations common to all linker options +lcommon = -nologo -link50compat -machine:$(MACHINE) + +LFLAGS = $(lcommon) -subsystem:windows -dll + +!if $(USE_TCL_STUBS) == 0 +LLIBS = $(TCLIMPLIB) $(XOTCLIMPLIB) +!else +### should be: +### LLIBS = $(TCLSTUBLIB) $(XOTCLSTUBLIB) when xotcl stub lib is mature +### LLIBS = $(TCLSTUBLIB) $(XOTCLIMPLIB) +LLIBS = $(TCLSTUBLIB) $(XOTCLSTUBLIB) +!endif + +###################################################################### +# Compile flags +###################################################################### + +!IF $(DEBUG) == 0 +!IF "$(MACHINE)" == "ALPHA" +# MSVC on Alpha doesn't understand -Ot +cdebug = -O2i +!ELSE +cdebug = -Ox +!ENDIF +!ELSE +!if $(MSDEV_VER) < 6 +cdebug = -Zi -Od -WX +!else +cdebug = -ZI -Od -WX +!endif +!ENDIF + +!if $(STATIC_BUILD) +cdll = +!else +cdll = -GD +!endif + +# declarations common to all compiler options +ccommon = -nologo -c -W3 -YX \ + + +!if $(STATIC_BUILD) && $(NOMSVCRT) +crt = -MT$(DBGX) +!else +crt = -MD$(DBGX) +!endif + +INCLUDES = -I"$(TCLROOT)\generic" -I"$(XOTCL_DIR)\generic" + +DEFINES = -DBUILD_$(NAME) -DTCL_THREADS=1 \ + -DXOLIBPKG=$(INST_XOLIBPKG) \ + -DXOTCLVERSION=$(XOTCLVERSION) \ + -DVERSION=$(XOTCLVERSION) \ + -DXOTCLPATCHLEVEL=$(XOTCLPATCHLEVEL) \ + -D__WIN32__ -DVISUAL_CC + +EXE_CFLAGS = $(ccommon) $(cdebug) $(crt) $(cdll) $(INCLUDES) $(DEFINES) + +!if $(USE_TCL_STUBS) +#CFLAGS = $(EXE_CFLAGS) -DUSE_TCL_STUBS +CFLAGS = $(EXE_CFLAGS) -DUSE_TCL_STUBS -DUSE_XOTCL_STUBS +!else +CFLAGS = $(EXE_CFLAGS) +!endif + +###################################################################### +# Project specific targets +###################################################################### + +all : libs + +libs : setup $(TARGET) + copy $(TARGET) .. + +setup : + @$(vcvars) > nul + @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) &\ + echo Created directory '$(TMP_DIR)' + @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) &\ + echo Created directory '$(OUT_DIR)' + +$(TARGET) : $(OBJS) +!if $(STATIC_BUILD) + $(lib32) -nologo -machine:$(MACHINE) -out:$@ @<< +!else + $(link32) $(LFLAGS) -base:@$(XOTCL_DIR)\win\dllBase.txt,$@ -out:$@ $(LLIBS) @<< +!endif + $(OBJS) +<< + + +install : all + if not exist "$(INSTALLDIR)" mkdir "$(INSTALLDIR)" + if not exist "$(BIN_INSTALL_DIR)" mkdir "$(BIN_INSTALL_DIR)" + if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" + if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" + if not exist "$(INCLUDE_INSTALL_DIR)" mkdir "$(INCLUDE_INSTALL_DIR)" + copy $(TARGET) "$(SCRIPT_INSTALL_DIR)" + +###################################################################### +# Inference rules. Use batch-mode when supported. +###################################################################### + +!if $(_NMAKE_VER) < 162 +{$(WINDIR)}.c{$(TMP_DIR)}.obj : +!else +{$(WINDIR)}.c{$(TMP_DIR)}.obj :: +!endif + $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$(TMP_DIR)\ @<< +$< +<< + +!if $(_NMAKE_VER) < 162 +{$(GENERICDIR)}.c{$(TMP_DIR)}.obj : +!else +{$(GENERICDIR)}.c{$(TMP_DIR)}.obj :: +!endif + $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$(TMP_DIR)\ @<< +$< +<< + +#{$(RCDIR)}.rc{$(TMP_DIR)}.res : +# $(rc32) -fo $@ -DDEBUG=$(DEBUG) $(XOTCL_VERSION_DEFINES) $(XOTCL_INCLUDES) $(TCL_INCLUDES) $(XOTCL_DEFINES) $< + +###################################################################### +# Clean up +###################################################################### + +tidy : + -del $(TMP_DIR)\*.pch + -del $(TMP_DIR)\*.obj + -del $(TMP_DIR)\*.res + -del .\*.pch + -del .\*.pdb + +clean : tidy + -del $(OUT_DIR)\*.exp + -del $(OUT_DIR)\*.lib + -del $(OUT_DIR)\*.dll + -del $(OUT_DIR)\*.tcl + -del ..\*.exp + -del ..\*.lib + -del ..\*.dll + +distclean : clean + -rmdir $(OUT_DIR) + -rmdir $(TMP_DIR) + Index: xotcl/library/store/XOTclSdbm/aclocal.m4 =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/aclocal.m4 (revision 0) +++ xotcl/library/store/XOTclSdbm/aclocal.m4 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,3 @@ +builtin(include,xotcl.m4) +builtin(include,tcl.m4) + Index: xotcl/library/store/XOTclSdbm/config.log =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/config.log (revision 0) +++ xotcl/library/store/XOTclSdbm/config.log (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1026 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by xotclsdbm configure 1.2, which was +generated by GNU Autoconf 2.57. Invocation command line was + + $ ./configure --prefix=/usr --enable-threads --prefix=/usr --with-all --cache-file=/dev/null --srcdir=. + +## --------- ## +## Platform. ## +## --------- ## + +hostname = localhost.localdomain +uname -m = i686 +uname -r = 2.4.22-1.2188.nptl +uname -s = Linux +uname -v = #1 Wed Apr 21 20:36:05 EDT 2004 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = i686 +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: . +PATH: /home/neumann/bin +PATH: . +PATH: /home/neumann/bin +PATH: /usr/local/bin +PATH: /usr/bin +PATH: /bin +PATH: /usr/X11R6/bin +PATH: /usr/X11R6/bin +PATH: /sbin +PATH: /usr/sbin +PATH: /opt/bin +PATH: /usr/X11R6/bin +PATH: /sbin +PATH: /usr/sbin +PATH: /opt/bin + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:1294: checking for correct TEA configuration +configure:1313: result: ok +configure:1433: checking for Tcl configuration +configure:1505: result: found /usr/lib/tclConfig.sh +configure:1511: checking for existence of /usr/lib/tclConfig.sh +configure:1515: result: loading +configure:1670: checking for gcc +configure:1686: found /usr/bin/gcc +configure:1696: result: gcc +configure:1940: checking for C compiler version +configure:1943: gcc --version &5 +gcc (GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1) +Copyright (C) 2003 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:1946: $? = 0 +configure:1948: gcc -v &5 +Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/specs +Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux +Thread model: posix +gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1) +configure:1951: $? = 0 +configure:1953: gcc -V &5 +gcc: `-V' option must have argument +configure:1956: $? = 1 +configure:1980: checking for C compiler default output +configure:1983: gcc conftest.c >&5 +configure:1986: $? = 0 +configure:2032: result: a.out +configure:2037: checking whether the C compiler works +configure:2043: ./a.out +configure:2046: $? = 0 +configure:2063: result: yes +configure:2070: checking whether we are cross compiling +configure:2072: result: no +configure:2075: checking for suffix of executables +configure:2077: gcc -o conftest conftest.c >&5 +configure:2080: $? = 0 +configure:2105: result: +configure:2111: checking for suffix of object files +configure:2133: gcc -c conftest.c >&5 +configure:2136: $? = 0 +configure:2158: result: o +configure:2162: checking whether we are using the GNU C compiler +configure:2187: gcc -c conftest.c >&5 +configure:2190: $? = 0 +configure:2193: test -s conftest.o +configure:2196: $? = 0 +configure:2209: result: yes +configure:2215: checking whether gcc accepts -g +configure:2237: gcc -c -g conftest.c >&5 +configure:2240: $? = 0 +configure:2243: test -s conftest.o +configure:2246: $? = 0 +configure:2257: result: yes +configure:2274: checking for gcc option to accept ANSI C +configure:2335: gcc -c conftest.c >&5 +configure:2338: $? = 0 +configure:2341: test -s conftest.o +configure:2344: $? = 0 +configure:2362: result: none needed +configure:2380: gcc -c conftest.c >&5 +conftest.c:2: error: syntax error before "me" +configure:2383: $? = 1 +configure: failed program was: +| #ifndef __cplusplus +| choke me +| #endif +configure:2497: checking how to run the C preprocessor +configure:2533: gcc -E conftest.c +configure:2539: $? = 0 +configure:2571: gcc -E conftest.c +configure:2570:28: ac_nonexistent.h: No such file or directory +configure:2577: $? = 1 +configure: failed program was: +| #line 2562 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclsdbm" +| #define PACKAGE_TARNAME "xotclsdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclsdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| /* end confdefs.h. */ +| #include +configure:2615: result: gcc -E +configure:2640: gcc -E conftest.c +configure:2646: $? = 0 +configure:2678: gcc -E conftest.c +configure:2677:28: ac_nonexistent.h: No such file or directory +configure:2684: $? = 1 +configure: failed program was: +| #line 2669 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclsdbm" +| #define PACKAGE_TARNAME "xotclsdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclsdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| /* end confdefs.h. */ +| #include +configure:2739: checking for a BSD-compatible install +configure:2793: result: /usr/bin/install -c +configure:2809: checking whether make sets $(MAKE) +configure:2829: result: yes +configure:2884: checking for ranlib +configure:2900: found /usr/bin/ranlib +configure:2911: result: ranlib +configure:2933: checking for egrep +configure:2943: result: grep -E +configure:2948: checking for ANSI C header files +configure:2974: gcc -c conftest.c >&5 +configure:2977: $? = 0 +configure:2980: test -s conftest.o +configure:2983: $? = 0 +configure:3072: gcc -o conftest conftest.c >&5 +configure:3075: $? = 0 +configure:3077: ./conftest +configure:3080: $? = 0 +configure:3095: result: yes +configure:3119: checking for sys/types.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for sys/stat.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for stdlib.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for string.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for memory.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for strings.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for inttypes.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for stdint.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for unistd.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3178: checking if the compiler understands -pipe +configure:3199: gcc -pipe -c conftest.c >&5 +configure:3202: $? = 0 +configure:3205: test -s conftest.o +configure:3208: $? = 0 +configure:3210: result: yes +configure:3228: checking for required early compiler flags +configure:3252: gcc -pipe -c conftest.c >&5 +configure:3255: $? = 0 +configure:3258: test -s conftest.o +configure:3261: $? = 0 +configure:3338: gcc -pipe -c conftest.c >&5 +configure: In function `main': +configure:3343: error: storage size of `buf' isn't known +configure:3341: $? = 1 +configure: failed program was: +| #line 3321 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclsdbm" +| #define PACKAGE_TARNAME "xotclsdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclsdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| /* end confdefs.h. */ +| #include +| int +| main () +| { +| struct stat64 buf; int i = stat64("/", &buf); +| ; +| return 0; +| } +configure:3372: gcc -pipe -c conftest.c >&5 +configure:3375: $? = 0 +configure:3378: test -s conftest.o +configure:3381: $? = 0 +configure:3407: result: _LARGEFILE64_SOURCE +configure:3412: checking for 64-bit integer type +configure:3435: gcc -pipe -c conftest.c >&5 +configure: In function `main': +configure:3441: error: `__int64' undeclared (first use in this function) +configure:3441: error: (Each undeclared identifier is reported only once +configure:3441: error: for each function it appears in.) +configure:3441: error: syntax error before "value" +configure:3438: $? = 1 +configure: failed program was: +| #line 3418 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclsdbm" +| #define PACKAGE_TARNAME "xotclsdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclsdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| /* end confdefs.h. */ +| +| int +| main () +| { +| __int64 value = (__int64) 0; +| ; +| return 0; +| } +configure:3471: gcc -pipe -o conftest conftest.c >&5 +configure:3474: $? = 0 +configure:3476: ./conftest +configure:3479: $? = 0 +configure:3507: result: long long +configure:3511: checking for struct dirent64 +configure:3535: gcc -pipe -c conftest.c >&5 +configure:3538:24: sys/dirent.h: No such file or directory +configure: In function `main': +configure:3542: error: storage size of `p' isn't known +configure:3538: $? = 1 +configure: failed program was: +| #line 3517 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclsdbm" +| #define PACKAGE_TARNAME "xotclsdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclsdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| /* end confdefs.h. */ +| #include +| #include +| int +| main () +| { +| struct dirent64 p; +| ; +| return 0; +| } +configure:3562: result: no +configure:3565: checking for struct stat64 +configure:3589: gcc -pipe -c conftest.c >&5 +configure:3592: $? = 0 +configure:3595: test -s conftest.o +configure:3598: $? = 0 +configure:3616: result: yes +configure:3619: checking for off64_t +configure:3643: gcc -pipe -c conftest.c >&5 +configure:3646: $? = 0 +configure:3649: test -s conftest.o +configure:3652: $? = 0 +configure:3670: result: yes +configure:3674: checking whether byte ordering is bigendian +configure:3702: gcc -pipe -c conftest.c >&5 +configure:3705: $? = 0 +configure:3708: test -s conftest.o +configure:3711: $? = 0 +configure:3736: gcc -pipe -c conftest.c >&5 +configure: In function `main': +configure:3743: error: `not' undeclared (first use in this function) +configure:3743: error: (Each undeclared identifier is reported only once +configure:3743: error: for each function it appears in.) +configure:3743: error: syntax error before "big" +configure:3739: $? = 1 +configure: failed program was: +| #line 3714 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclsdbm" +| #define PACKAGE_TARNAME "xotclsdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclsdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| #include +| #include +| +| int +| main () +| { +| #if BYTE_ORDER != BIG_ENDIAN +| not big endian +| #endif +| +| ; +| return 0; +| } +configure:3859: result: no +configure:3887: checking for sin +configure:3937: gcc -pipe -o conftest conftest.c >&5 +configure:3930: warning: conflicting types for built-in function `sin' +/tmp/ccK1sUVc.o(.text+0x16): In function `main': +: undefined reference to `sin' +/tmp/ccK1sUVc.o(.data+0x0): undefined reference to `sin' +collect2: ld returned 1 exit status +configure:3940: $? = 1 +configure: failed program was: +| #line 3892 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclsdbm" +| #define PACKAGE_TARNAME "xotclsdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclsdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| /* System header to define __stub macros and hopefully few prototypes, +| which can conflict with char sin (); below. +| Prefer to if __STDC__ is defined, since +| exists even on freestanding compilers. */ +| #ifdef __STDC__ +| # include +| #else +| # include +| #endif +| /* Override any gcc2 internal prototype to avoid an error. */ +| #ifdef __cplusplus +| extern "C" +| { +| #endif +| /* We use char because int might match the return type of a gcc2 +| builtin and then its argument prototype would still apply. */ +| char sin (); +| /* The GNU C library defines this for functions which it implements +| to always fail with ENOSYS. Some functions are actually named +| something starting with __ and the normal name is an alias. */ +| #if defined (__stub_sin) || defined (__stub___sin) +| choke me +| #else +| char (*f) () = sin; +| #endif +| #ifdef __cplusplus +| } +| #endif +| +| int +| main () +| { +| return f != sin; +| ; +| return 0; +| } +configure:3957: result: no +configure:3965: checking for main in -lieee +configure:3990: gcc -pipe -o conftest conftest.c -lieee >&5 +configure:3993: $? = 0 +configure:3996: test -s conftest +configure:3999: $? = 0 +configure:4011: result: yes +configure:4023: checking for main in -linet +configure:4048: gcc -pipe -o conftest conftest.c -linet >&5 +/usr/bin/ld: cannot find -linet +collect2: ld returned 1 exit status +configure:4051: $? = 1 +configure: failed program was: +| #line 4030 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclsdbm" +| #define PACKAGE_TARNAME "xotclsdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclsdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| +| +| int +| main () +| { +| main (); +| ; +| return 0; +| } +configure:4069: result: no +configure:4085: checking net/errno.h usability +configure:4098: gcc -pipe -c conftest.c >&5 +configure:4143:23: net/errno.h: No such file or directory +configure:4101: $? = 1 +configure: failed program was: +| #line 4087 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclsdbm" +| #define PACKAGE_TARNAME "xotclsdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclsdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| #include +| #if HAVE_SYS_TYPES_H +| # include +| #endif +| #if HAVE_SYS_STAT_H +| # include +| #endif +| #if STDC_HEADERS +| # include +| # include +| #else +| # if HAVE_STDLIB_H +| # include +| # endif +| #endif +| #if HAVE_STRING_H +| # if !STDC_HEADERS && HAVE_MEMORY_H +| # include +| # endif +| # include +| #endif +| #if HAVE_STRINGS_H +| # include +| #endif +| #if HAVE_INTTYPES_H +| # include +| #else +| # if HAVE_STDINT_H +| # include +| # endif +| #endif +| #if HAVE_UNISTD_H +| # include +| #endif +| #include +configure:4117: result: no +configure:4121: checking net/errno.h presence +configure:4132: gcc -E conftest.c +configure:4145:23: net/errno.h: No such file or directory +configure:4138: $? = 1 +configure: failed program was: +| #line 4123 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclsdbm" +| #define PACKAGE_TARNAME "xotclsdbm" +| #define PACKAGE_VERSION "1.2" +| #define PACKAGE_STRING "xotclsdbm 1.2" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| #include +configure:4157: result: no +configure:4193: checking for net/errno.h +configure:4200: result: no +configure:4232: checking for connect +configure:4282: gcc -pipe -o conftest conftest.c >&5 +configure:4285: $? = 0 +configure:4288: test -s conftest +configure:4291: $? = 0 +configure:4302: result: yes +configure:4531: checking for gethostbyname +configure:4581: gcc -pipe -o conftest conftest.c >&5 +configure:4584: $? = 0 +configure:4587: test -s conftest +configure:4590: $? = 0 +configure:4601: result: yes +configure:4675: checking dirent.h +configure:4713: gcc -pipe -o conftest conftest.c >&5 +configure:4716: $? = 0 +configure:4719: test -s conftest +configure:4722: $? = 0 +configure:4740: result: yes +configure:4752: checking errno.h usability +configure:4765: gcc -pipe -c conftest.c >&5 +configure:4768: $? = 0 +configure:4771: test -s conftest.o +configure:4774: $? = 0 +configure:4784: result: yes +configure:4788: checking errno.h presence +configure:4799: gcc -E conftest.c +configure:4805: $? = 0 +configure:4824: result: yes +configure:4860: checking for errno.h +configure:4867: result: yes +configure:4891: checking float.h usability +configure:4904: gcc -pipe -c conftest.c >&5 +configure:4907: $? = 0 +configure:4910: test -s conftest.o +configure:4913: $? = 0 +configure:4923: result: yes +configure:4927: checking float.h presence +configure:4938: gcc -E conftest.c +configure:4944: $? = 0 +configure:4963: result: yes +configure:4999: checking for float.h +configure:5006: result: yes +configure:5030: checking values.h usability +configure:5043: gcc -pipe -c conftest.c >&5 +configure:5046: $? = 0 +configure:5049: test -s conftest.o +configure:5052: $? = 0 +configure:5062: result: yes +configure:5066: checking values.h presence +configure:5077: gcc -E conftest.c +configure:5083: $? = 0 +configure:5102: result: yes +configure:5138: checking for values.h +configure:5145: result: yes +configure:5169: checking limits.h usability +configure:5182: gcc -pipe -c conftest.c >&5 +configure:5185: $? = 0 +configure:5188: test -s conftest.o +configure:5191: $? = 0 +configure:5201: result: yes +configure:5205: checking limits.h presence +configure:5216: gcc -E conftest.c +configure:5222: $? = 0 +configure:5241: result: yes +configure:5277: checking for limits.h +configure:5284: result: yes +configure:5299: checking for stdlib.h +configure:5304: result: yes +configure:5495: checking for string.h +configure:5500: result: yes +configure:5687: checking sys/wait.h usability +configure:5700: gcc -pipe -c conftest.c >&5 +configure:5703: $? = 0 +configure:5706: test -s conftest.o +configure:5709: $? = 0 +configure:5719: result: yes +configure:5723: checking sys/wait.h presence +configure:5734: gcc -E conftest.c +configure:5740: $? = 0 +configure:5759: result: yes +configure:5795: checking for sys/wait.h +configure:5802: result: yes +configure:5826: checking dlfcn.h usability +configure:5839: gcc -pipe -c conftest.c >&5 +configure:5842: $? = 0 +configure:5845: test -s conftest.o +configure:5848: $? = 0 +configure:5858: result: yes +configure:5862: checking dlfcn.h presence +configure:5873: gcc -E conftest.c +configure:5879: $? = 0 +configure:5898: result: yes +configure:5934: checking for dlfcn.h +configure:5941: result: yes +configure:5967: checking for limits.h +configure:5972: result: yes +configure:5967: checking for unistd.h +configure:5972: result: yes +configure:5976: checking sys/param.h usability +configure:5989: gcc -pipe -c conftest.c >&5 +configure:5992: $? = 0 +configure:5995: test -s conftest.o +configure:5998: $? = 0 +configure:6008: result: yes +configure:6012: checking sys/param.h presence +configure:6023: gcc -E conftest.c +configure:6029: $? = 0 +configure:6048: result: yes +configure:6084: checking for sys/param.h +configure:6091: result: yes +configure:6139: checking for XOTcl configuration +configure:6200: result: found /home/neumann/xotcl-1.2.1/xotclConfig.sh +configure:6206: checking for existence of /home/neumann/xotcl-1.2.1/xotclConfig.sh +configure:6210: result: loading +configure:6379: checking for Tcl public headers +configure:6434: result: /usr/include +configure:6482: checking for pthread_mutex_init in -lpthread +configure:6513: gcc -pipe -o conftest conftest.c -lpthread >&5 +configure:6516: $? = 0 +configure:6519: test -s conftest +configure:6522: $? = 0 +configure:6534: result: yes +configure:6821: checking for pthread_attr_setstacksize +configure:6871: gcc -pipe -o conftest conftest.c -lpthread >&5 +configure:6874: $? = 0 +configure:6877: test -s conftest +configure:6880: $? = 0 +configure:6891: result: yes +configure:6906: checking for readdir_r +configure:6956: gcc -pipe -o conftest conftest.c >&5 +configure:6959: $? = 0 +configure:6962: test -s conftest +configure:6965: $? = 0 +configure:6976: result: yes +configure:6991: checking for building with threads +configure:6998: result: yes +configure:7037: checking how to build libraries +configure:7055: result: shared +configure:7081: checking if 64bit support is enabled +configure:7090: result: no +configure:7095: checking if 64bit Sparc VIS support is requested +configure:7104: result: no +configure:7132: checking system version (for dynamic loading) +configure:7155: result: Linux-2.4.22-1.2188.nptl +configure:7163: checking for dlopen in -ldl +configure:7194: gcc -pipe -o conftest conftest.c -ldl >&5 +configure:7197: $? = 0 +configure:7200: test -s conftest +configure:7203: $? = 0 +configure:7215: result: yes +configure:7245: checking for ar +configure:7261: found /usr/bin/ar +configure:7271: result: ar +configure:9157: checking for build with symbols +configure:9171: result: no +configure:9306: checking for tclsh +configure:9337: result: /usr/lib/../bin/tclsh8.4 +configure:9481: creating ./config.status + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by xotclsdbm config.status 1.2, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on localhost.localdomain + +config.status:675: creating Makefile + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_c_bigendian=no +ac_cv_c_compiler_gnu=yes +ac_cv_c_tclconfig=/usr/lib +ac_cv_c_tclh=/usr/include +ac_cv_c_xotclconfig=/home/neumann/xotcl-1.2.1 +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_exeext= +ac_cv_func_connect=yes +ac_cv_func_gethostbyname=yes +ac_cv_func_pthread_attr_setstacksize=yes +ac_cv_func_readdir_r=yes +ac_cv_func_sin=no +ac_cv_header_dlfcn_h=yes +ac_cv_header_errno_h=yes +ac_cv_header_float_h=yes +ac_cv_header_inttypes_h=yes +ac_cv_header_limits_h=yes +ac_cv_header_memory_h=yes +ac_cv_header_net_errno_h=no +ac_cv_header_stdc=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_sys_param_h=yes +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_sys_wait_h=yes +ac_cv_header_unistd_h=yes +ac_cv_header_values_h=yes +ac_cv_lib_dl_dlopen=yes +ac_cv_lib_ieee_main=yes +ac_cv_lib_inet_main=no +ac_cv_lib_pthread_pthread_mutex_init=yes +ac_cv_objext=o +ac_cv_path_install='/usr/bin/install -c' +ac_cv_path_tclsh=/usr/lib/../bin/tclsh8.4 +ac_cv_prog_AR=ar +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_ac_ct_RANLIB=ranlib +ac_cv_prog_cc_g=yes +ac_cv_prog_cc_stdc= +ac_cv_prog_egrep='grep -E' +ac_cv_prog_make_make_set=yes +tcl_cv_flag__isoc99_source=no +tcl_cv_flag__largefile64_source=yes +tcl_cv_struct_dirent64=no +tcl_cv_struct_stat64=yes +tcl_cv_type_64bit='long long' +tcl_cv_type_off64_t=yes + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +AR='ar' +CC='gcc -pipe' +CFLAGS=' ${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}' +CFLAGS_DEBUG='-g' +CFLAGS_DEFAULT='-O' +CFLAGS_OPTIMIZE='-O' +CFLAGS_WARNING='-Wall -Wconversion -Wno-implicit-int' +CLEANFILES='pkgIndex.tcl' +CPP='gcc -E' +CPPFLAGS='' +CYGPATH='echo' +DEFS='-DPACKAGE_NAME=\"xotclsdbm\" -DPACKAGE_TARNAME=\"xotclsdbm\" -DPACKAGE_VERSION=\"1.2\" -DPACKAGE_STRING=\"xotclsdbm\ 1.2\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS=1 ' +DL_LIBS='-ldl' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='grep -E' +EXEEXT='' +EXTRA_CFLAGS='' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +LDFLAGS='-rdynamic' +LDFLAGS_DEBUG='' +LDFLAGS_DEFAULT='-rdynamic' +LDFLAGS_OPTIMIZE='' +LD_LIBRARY_PATH_VAR='LD_LIBRARY_PATH' +LIBOBJS='' +LIBS='' +LTLIBOBJS='' +MAKE_LIB='${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS} ' +MAKE_SHARED_LIB='${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS}' +MAKE_STATIC_LIB='${STLIB_LD} $@ $(PKG_OBJECTS)' +MAKE_STUB_LIB='${STLIB_LD} $@ $(PKG_STUB_OBJECTS)' +MATH_LIBS='-lieee -lm' +OBJEXT='o' +PACKAGE_BUGREPORT='' +PACKAGE_NAME='xotclsdbm' +PACKAGE_STRING='xotclsdbm 1.2' +PACKAGE_TARNAME='xotclsdbm' +PACKAGE_VERSION='1.2' +PATH_SEPARATOR=':' +PKG_CFLAGS=' ' +PKG_HEADERS='' +PKG_INCLUDES=' -I/home/neumann/xotcl-1.2.1/generic' +PKG_LIBS=' -L/home/neumann/xotcl-1.2.1 -lxotclstub1.2.1' +PKG_LIB_FILE='libxotclsdbm1.2.so' +PKG_OBJECTS=' hash.o pair.o sdbm.o xotclsdbm.o' +PKG_SOURCES=' hash.c pair.c sdbm.c xotclsdbm.c' +PKG_STUB_LIB_FILE='libxotclsdbmstub1.2.a' +PKG_STUB_OBJECTS='' +PKG_STUB_SOURCES='' +PKG_TCL_SOURCES='' +RANLIB=':' +RANLIB_STUB='ranlib' +SET_MAKE='' +SHARED_BUILD='1' +SHELL='/bin/sh' +SHLIB_CFLAGS='-fPIC' +SHLIB_LD='gcc -pipe -shared' +SHLIB_LD_FLAGS='' +SHLIB_LD_LIBS='${LIBS} -L/usr/lib -ltclstub8.4' +STLIB_LD='${AR} cr' +TCLSH_PROG='/usr/lib/../bin/tclsh8.4' +TCL_BIN_DIR='/usr/lib' +TCL_DBGX='' +TCL_DEFS=' -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOLL=1 -DHAVE_STRTOULL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DPEEK_XCLOSEIM=1 -DHAVE_SYS_IOCTL_H=1 ' +TCL_EXTRA_CFLAGS='' +TCL_INCLUDES='-I"/usr/include"' +TCL_LD_FLAGS='-rdynamic' +TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' +TCL_LIB_FILE='libtcl8.4.so' +TCL_LIB_FLAG='-ltcl8.4' +TCL_LIB_SPEC='-L/usr/lib -ltcl8.4' +TCL_SHLIB_LD_LIBS='${LIBS}' +TCL_SRC_DIR='/home/neumann/tcl8.4.5' +TCL_STUB_LIB_FILE='libtclstub8.4.a' +TCL_STUB_LIB_FLAG='-ltclstub8.4' +TCL_STUB_LIB_SPEC='-L/usr/lib -ltclstub8.4' +TCL_THREADS='1' +TCL_VERSION='8.4' +XOTCL_BUILD_LIB_SPEC='-L/home/neumann/xotcl-1.2.1 -lxotcl1.2.1' +XOTCL_BUILD_STUB_LIB_SPEC='-L/home/neumann/xotcl-1.2.1 -lxotclstub1.2.1' +XOTCL_LIB_FILE='libxotcl1.2.1.so' +XOTCL_LIB_SPEC='-L/usr/lib -lxotcl1.2.1' +XOTCL_MAJOR_VERSION='1' +XOTCL_MINOR_VERSION='2' +XOTCL_RELEASE_LEVEL='.1' +XOTCL_SRC_DIR='/home/neumann/xotcl-1.2.1' +XOTCL_STUB_LIB_FILE='' +XOTCL_STUB_LIB_SPEC='-L/usr/lib -lxotclstub1.2.1' +XOTCL_VERSION='1.2' +ac_ct_CC='gcc' +ac_ct_RANLIB='ranlib' +bindir='${exec_prefix}/bin' +build_alias='' +datadir='${prefix}/share' +exec_prefix='/usr' +host_alias='' +includedir='${prefix}/include' +infodir='${prefix}/info' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localstatedir='${prefix}/var' +mandir='${prefix}/man' +oldincludedir='/usr/include' +prefix='/usr' +program_transform_name='s,x,x,' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 +#define HAVE_READDIR_R 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRUCT_STAT64 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_TYPE_OFF64_T 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UNISTD_H 1 +#define PACKAGE_BUGREPORT "" +#define PACKAGE_NAME "xotclsdbm" +#define PACKAGE_STRING "xotclsdbm 1.2" +#define PACKAGE_TARNAME "xotclsdbm" +#define PACKAGE_VERSION "1.2" +#define STDC_HEADERS 1 +#define TCL_THREADS 1 +#define TCL_WIDE_INT_TYPE long long +#define USE_TCL_STUBS 1 +#define USE_THREAD_ALLOC 1 +#define _LARGEFILE64_SOURCE 1 +#define _REENTRANT 1 +#define _THREAD_SAFE 1 + +configure: exit 0 Index: xotcl/library/store/XOTclSdbm/configure =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/configure (revision 0) +++ xotcl/library/store/XOTclSdbm/configure (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,10308 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.57 for xotclsdbm 1.2. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='xotclsdbm' +PACKAGE_TARNAME='xotclsdbm' +PACKAGE_VERSION='1.2' +PACKAGE_STRING='xotclsdbm 1.2' +PACKAGE_BUGREPORT='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CYGPATH EXEEXT PKG_LIB_FILE PKG_STUB_LIB_FILE PKG_STUB_SOURCES PKG_STUB_OBJECTS PKG_TCL_SOURCES PKG_HEADERS PKG_INCLUDES PKG_LIBS PKG_CFLAGS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_LIBS TCL_DEFS TCL_EXTRA_CFLAGS TCL_LD_FLAGS TCL_SHLIB_LD_LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB EGREP MATH_LIBS XOTCL_VERSION XOTCL_MAJOR_VERSION XOTCL_MINOR_VERSION XOTCL_RELEASE_LEVEL XOTCL_LIB_FILE XOTCL_BUILD_LIB_SPEC XOTCL_LIB_SPEC XOTCL_STUB_LIB_FILE XOTCL_BUILD_STUB_LIB_SPEC XOTCL_STUB_LIB_SPEC XOTCL_SRC_DIR PKG_SOURCES PKG_OBJECTS CLEANFILES TCL_INCLUDES TCL_THREADS SHARED_BUILD AR LIBOBJS DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING EXTRA_CFLAGS STLIB_LD SHLIB_LD SHLIB_CFLAGS SHLIB_LD_FLAGS SHLIB_LD_LIBS LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LD_LIBRARY_PATH_VAR TCL_DBGX CFLAGS_DEFAULT LDFLAGS_DEFAULT MAKE_LIB MAKE_SHARED_LIB MAKE_STATIC_LIB MAKE_STUB_LIB RANLIB_STUB TCLSH_PROG LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +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 xotclsdbm 1.2 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. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of xotclsdbm 1.2:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-threads build with threads + --enable-shared build and link with shared libraries --enable-shared + --enable-64bit enable 64bit support (where applicable) + --enable-64bit-vis enable 64bit Sparc VIS support + --enable-wince enable Win/CE support (where applicable) + --disable-load disallow dynamic loading and "load" command + --enable-symbols build with debugging symbols --disable-symbols + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-tcl directory containing tcl configuration (tclConfig.sh) + --with-xotcl directory containing xotcl configuration (xotclConfig.sh) + --with-tclinclude directory containing the public Tcl header files + --with-celib=DIR use Windows/CE support library from DIR + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + 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. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +xotclsdbm configure 1.2 +generated by GNU Autoconf 2.57 + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by xotclsdbm $as_me 1.2, which was +generated by GNU Autoconf 2.57. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#-------------------------------------------------------------------- +# Call TEA_INIT as the first TEA_ macro to set up initial vars. +# This will define a ${TEA_PLATFORM} variable == "unix" or "windows" +# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. +#-------------------------------------------------------------------- + + + TEA_VERSION="3.0" + + echo "$as_me:$LINENO: checking for correct TEA configuration" >&5 +echo $ECHO_N "checking for correct TEA configuration... $ECHO_C" >&6 + if test x"${PACKAGE_NAME}" = x ; then + { { echo "$as_me:$LINENO: error: +The PACKAGE_NAME variable must be defined by your TEA configure.in" >&5 +echo "$as_me: error: +The PACKAGE_NAME variable must be defined by your TEA configure.in" >&2;} + { (exit 1); exit 1; }; } + fi + if test x"3.0" = x ; then + { { echo "$as_me:$LINENO: error: +TEA version not specified." >&5 +echo "$as_me: error: +TEA version not specified." >&2;} + { (exit 1); exit 1; }; } + elif test "3.0" != "${TEA_VERSION}" ; then + echo "$as_me:$LINENO: result: warning: TEA version \"3.0\" != ${TEA_VERSION}" >&5 +echo "${ECHO_T}warning: TEA version \"3.0\" != ${TEA_VERSION}" >&6 + else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 + fi + case "`uname -s`" in + *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*) + # Extract the first word of "cygpath", so it can be a program name with args. +set dummy cygpath; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CYGPATH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CYGPATH"; then + ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CYGPATH="cygpath -w" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" +fi +fi +CYGPATH=$ac_cv_prog_CYGPATH +if test -n "$CYGPATH"; then + echo "$as_me:$LINENO: result: $CYGPATH" >&5 +echo "${ECHO_T}$CYGPATH" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + EXEEXT=".exe" + TEA_PLATFORM="windows" + ;; + *) + CYGPATH=echo + EXEEXT="" + TEA_PLATFORM="unix" + ;; + esac + + # Check if exec_prefix is set. If not use fall back to prefix + if test x$exec_prefix = xNONE ; then exec_prefix=$prefix ; fi + + + + + # This package name must be replaced statically for AC_SUBST to work + + # Substitute STUB_LIB_FILE in case package creates a stub library too. + + + # We AC_SUBST these here to ensure they are subst'ed, + # in case the user doesn't call TEA_ADD_... + + + + + + + + + +ac_aux_dir= +for ac_dir in ../../../config $srcdir/../../../config; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../../config $srcdir/../../../config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in ../../../config $srcdir/../../../config" >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + + + + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + + if test x"${no_tcl}" = x ; then + # we reset no_tcl in case something fails here + no_tcl=true + +# Check whether --with-tcl or --without-tcl was given. +if test "${with_tcl+set}" = set; then + withval="$with_tcl" + with_tclconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for Tcl configuration" >&5 +echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6 + if test "${ac_cv_c_tclconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + # First check to see if --with-tcl was specified. + if test x"${with_tclconfig}" != x ; then + if test -f "${with_tclconfig}/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5 +echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ../tcl \ + `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../tcl \ + `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../../tcl \ + `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few other private locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ${srcdir}/../tcl \ + `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + +fi + + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCL_BIN_DIR="# no Tcl configs found" + { echo "$as_me:$LINENO: WARNING: \"Cannot find Tcl configuration definitions\"" >&5 +echo "$as_me: WARNING: \"Cannot find Tcl configuration definitions\"" >&2;} + exit 0 + else + no_tcl= + TCL_BIN_DIR=${ac_cv_c_tclconfig} + echo "$as_me:$LINENO: result: found $TCL_BIN_DIR/tclConfig.sh" >&5 +echo "${ECHO_T}found $TCL_BIN_DIR/tclConfig.sh" >&6 + fi + fi + + + echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 +echo $ECHO_N "checking for existence of $TCL_BIN_DIR/tclConfig.sh... $ECHO_C" >&6 + + if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + echo "$as_me:$LINENO: result: loading" >&5 +echo "${ECHO_T}loading" >&6 + . $TCL_BIN_DIR/tclConfig.sh + else + echo "$as_me:$LINENO: result: file not found" >&5 +echo "${ECHO_T}file not found" >&6 + fi + + # + # If the TCL_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TCL_LIB_SPEC will be set to the value + # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC + # instead of TCL_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + # + + if test -f $TCL_BIN_DIR/Makefile ; then + TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} + TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} + TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} + fi + + # + # eval is required to do the TCL_DBGX substitution + # + + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" + eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" + eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" + + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" + eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" + eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" + + + + + + + + + + + + + + #AC_SUBST(TCL_DBGX) + + + + + + #AC_SUBST(TCL_BUILD_LIB_SPEC) + #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) + + +#-------------------------------------------------------------------- +# Load the tkConfig.sh file if necessary (Tk extension) +#-------------------------------------------------------------------- + +#TEA_PATH_TKCONFIG +#TEA_LOAD_TKCONFIG + +#----------------------------------------------------------------------- +# Handle the --prefix=... option by defaulting to what Tcl gave. +# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. +#----------------------------------------------------------------------- + + + # Should be AC_MSG_NOTICE, but that requires autoconf 2.50 + if test "${prefix}" = "NONE"; then + prefix_default=yes + if test x"${TCL_PREFIX}" != x; then + { echo "$as_me:$LINENO: WARNING: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&5 +echo "$as_me: WARNING: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&2;} + prefix=${TCL_PREFIX} + else + prefix=/usr/local + fi + fi + if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" ; then + if test x"${TCL_EXEC_PREFIX}" != x; then + { echo "$as_me:$LINENO: WARNING: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&5 +echo "$as_me: WARNING: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&2;} + exec_prefix=${TCL_EXEC_PREFIX} + else + exec_prefix=$prefix + fi + fi + + +#----------------------------------------------------------------------- +# Standard compiler checks. +# This sets up CC by using the CC env var, or looks for gcc otherwise. +# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create +# the basic setup necessary to compile executables. +#----------------------------------------------------------------------- + + + # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE) + # in this macro, they need to go into TEA_SETUP_COMPILER instead. + + # If the user did not set CFLAGS, set it now to keep + # the AC_PROG_CC macro from adding "-g -O2". + if test "${CFLAGS+set}" != "set" ; then + CFLAGS="" + 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 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +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 + + 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 +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&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 + echo $ECHO_N "(cached) $ECHO_C" >&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 to if __STDC__ is defined, since + # 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$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 to if __STDC__ is defined, since + # 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +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 + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + #-------------------------------------------------------------------- + # Checks to see if the make program sets the $MAKE variable. + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + + #-------------------------------------------------------------------- + # Find ranlib + #-------------------------------------------------------------------- + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + #-------------------------------------------------------------------- + # Determines the correct binary file extension (.o, .obj, .exe etc.) + #-------------------------------------------------------------------- + + + + + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#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)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here. + + + #------------------------------------------------------------------------ + # If we're using GCC, see if the compiler understands -pipe. If so, use it. + # It makes compiling go faster. (This is only a performance feature.) + #------------------------------------------------------------------------ + + if test -z "$no_pipe" -a -n "$GCC"; then + echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5 +echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6 + OLDCC="$CC" + CC="$CC -pipe" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +CC="$OLDCC" + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + + #-------------------------------------------------------------------- + # Common compiler flag setup + #-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for required early compiler flags" >&5 +echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6 + tcl_flags="" + + if test "${tcl_cv_flag__isoc99_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +char *p = (char *)strtoll; char *q = (char *)strtoull; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__isoc99_source=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _ISOC99_SOURCE 1 +#include +int +main () +{ +char *p = (char *)strtoll; char *q = (char *)strtoull; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__isoc99_source=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_flag__isoc99_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define _ISOC99_SOURCE 1 +_ACEOF + + tcl_flags="$tcl_flags _ISOC99_SOURCE" + fi + + + if test "${tcl_cv_flag__largefile64_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct stat64 buf; int i = stat64("/", &buf); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__largefile64_source=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _LARGEFILE64_SOURCE 1 +#include +int +main () +{ +struct stat64 buf; int i = stat64("/", &buf); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__largefile64_source=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_flag__largefile64_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define _LARGEFILE64_SOURCE 1 +_ACEOF + + tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" + fi + + if test "x${tcl_flags}" = "x" ; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 + else + echo "$as_me:$LINENO: result: ${tcl_flags}" >&5 +echo "${ECHO_T}${tcl_flags}" >&6 + fi + + + echo "$as_me:$LINENO: checking for 64-bit integer type" >&5 +echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6 + if test "${tcl_cv_type_64bit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +__int64 value = (__int64) 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_64bit=__int64 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_type_64bit=none + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + int main() {exit(!(sizeof(long long) > sizeof(long)));} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_64bit="long long" +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "${tcl_cv_type_64bit}" = none ; then + echo "$as_me:$LINENO: result: using long" >&5 +echo "${ECHO_T}using long" >&6 + elif test "${tcl_cv_type_64bit}" = "__int64" ; then + # We actually want to use the default tcl.h checks in this + # case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* + echo "$as_me:$LINENO: result: using Tcl header defaults" >&5 +echo "${ECHO_T}using Tcl header defaults" >&6 + else + cat >>confdefs.h <<_ACEOF +#define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit} +_ACEOF + + echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5 +echo "${ECHO_T}${tcl_cv_type_64bit}" >&6 + + # Now check for auxiliary declarations + echo "$as_me:$LINENO: checking for struct dirent64" >&5 +echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 + if test "${tcl_cv_struct_dirent64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +struct dirent64 p; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_struct_dirent64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_struct_dirent64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_DIRENT64 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_struct_dirent64}" >&5 +echo "${ECHO_T}${tcl_cv_struct_dirent64}" >&6 + + echo "$as_me:$LINENO: checking for struct stat64" >&5 +echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6 + if test "${tcl_cv_struct_stat64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct stat64 p; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_struct_stat64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_struct_stat64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_struct_stat64}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_STAT64 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_struct_stat64}" >&5 +echo "${ECHO_T}${tcl_cv_struct_stat64}" >&6 + + echo "$as_me:$LINENO: checking for off64_t" >&5 +echo $ECHO_N "checking for off64_t... $ECHO_C" >&6 + if test "${tcl_cv_type_off64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +off64_t offset; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_off64_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_type_off64_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_type_off64_t}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_TYPE_OFF64_T 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_type_off64_t}" >&5 +echo "${ECHO_T}${tcl_cv_type_off64_t}" >&6 + fi + + echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + if test "${TEA_PLATFORM}" = "unix" ; then + + #-------------------------------------------------------------------- + # On a few very rare systems, all of the libm.a stuff is + # already in libc.a. Set compiler flags accordingly. + # Also, Linux requires the "ieee" library for math to work + # right (and it must appear before "-lm"). + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking for sin" >&5 +echo $ECHO_N "checking for sin... $ECHO_C" >&6 +if test "${ac_cv_func_sin+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sin (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sin (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_sin) || defined (__stub___sin) +choke me +#else +char (*f) () = sin; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != sin; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_sin=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_sin=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_sin" >&5 +echo "${ECHO_T}$ac_cv_func_sin" >&6 +if test $ac_cv_func_sin = yes; then + MATH_LIBS="" +else + MATH_LIBS="-lm" +fi + + echo "$as_me:$LINENO: checking for main in -lieee" >&5 +echo $ECHO_N "checking for main in -lieee... $ECHO_C" >&6 +if test "${ac_cv_lib_ieee_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lieee $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ieee_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ieee_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ieee_main" >&5 +echo "${ECHO_T}$ac_cv_lib_ieee_main" >&6 +if test $ac_cv_lib_ieee_main = yes; then + MATH_LIBS="-lieee $MATH_LIBS" +fi + + + #-------------------------------------------------------------------- + # Interactive UNIX requires -linet instead of -lsocket, plus it + # needs net/errno.h to define the socket-related error codes. + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking for main in -linet" >&5 +echo $ECHO_N "checking for main in -linet... $ECHO_C" >&6 +if test "${ac_cv_lib_inet_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-linet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_inet_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_inet_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_inet_main" >&5 +echo "${ECHO_T}$ac_cv_lib_inet_main" >&6 +if test $ac_cv_lib_inet_main = yes; then + LIBS="$LIBS -linet" +fi + + if test "${ac_cv_header_net_errno_h+set}" = set; then + echo "$as_me:$LINENO: checking for net/errno.h" >&5 +echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_net_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking net/errno.h usability" >&5 +echo $ECHO_N "checking net/errno.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking net/errno.h presence" >&5 +echo $ECHO_N "checking net/errno.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: net/errno.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: net/errno.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: net/errno.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for net/errno.h" >&5 +echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_net_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_net_errno_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 + +fi +if test $ac_cv_header_net_errno_h = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_NET_ERRNO_H 1 +_ACEOF + +fi + + + + #-------------------------------------------------------------------- + # Check for the existence of the -lsocket and -lnsl libraries. + # The order here is important, so that they end up in the right + # order in the command line generated by make. Here are some + # special considerations: + # 1. Use "connect" and "accept" to check for -lsocket, and + # "gethostbyname" to check for -lnsl. + # 2. Use each function name only once: can't redo a check because + # autoconf caches the results of the last check and won't redo it. + # 3. Use -lnsl and -lsocket only if they supply procedures that + # aren't already present in the normal libraries. This is because + # IRIX 5.2 has libraries, but they aren't needed and they're + # bogus: they goof up name resolution if used. + # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. + # To get around this problem, check for both libraries together + # if -lsocket doesn't work by itself. + #-------------------------------------------------------------------- + + tcl_checkBoth=0 + echo "$as_me:$LINENO: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +choke me +#else +char (*f) () = connect; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != connect; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 +if test $ac_cv_func_connect = yes; then + tcl_checkSocket=0 +else + tcl_checkSocket=1 +fi + + if test "$tcl_checkSocket" = 1; then + echo "$as_me:$LINENO: checking for setsockopt" >&5 +echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 +if test "${ac_cv_func_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char setsockopt (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char setsockopt (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_setsockopt) || defined (__stub___setsockopt) +choke me +#else +char (*f) () = setsockopt; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != setsockopt; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_setsockopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_setsockopt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_func_setsockopt" >&6 +if test $ac_cv_func_setsockopt = yes; then + : +else + echo "$as_me:$LINENO: checking for setsockopt in -lsocket" >&5 +echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char setsockopt (); +int +main () +{ +setsockopt (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_setsockopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_setsockopt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 +if test $ac_cv_lib_socket_setsockopt = yes; then + LIBS="$LIBS -lsocket" +else + tcl_checkBoth=1 +fi + +fi + + fi + if test "$tcl_checkBoth" = 1; then + tk_oldLibs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + echo "$as_me:$LINENO: checking for accept" >&5 +echo $ECHO_N "checking for accept... $ECHO_C" >&6 +if test "${ac_cv_func_accept+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char accept (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char accept (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_accept) || defined (__stub___accept) +choke me +#else +char (*f) () = accept; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != accept; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_accept=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_accept=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_accept" >&5 +echo "${ECHO_T}$ac_cv_func_accept" >&6 +if test $ac_cv_func_accept = yes; then + tcl_checkNsl=0 +else + LIBS=$tk_oldLibs +fi + + fi + echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +char (*f) () = gethostbyname; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gethostbyname; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 +if test $ac_cv_func_gethostbyname = yes; then + : +else + echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + LIBS="$LIBS -lnsl" +fi + +fi + + + # Don't perform the eval of the libraries here because DL_LIBS + # won't be set until we call TEA_CONFIG_CFLAGS + + TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' + + + + + echo "$as_me:$LINENO: checking dirent.h" >&5 +echo $ECHO_N "checking dirent.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ + +#ifndef _POSIX_SOURCE +# ifdef __Lynx__ + /* + * Generate compilation error to make the test fail: Lynx headers + * are only valid if really in the POSIX environment. + */ + + missing_procedure(); +# endif +#endif +DIR *d; +struct dirent *entryPtr; +char *p; +d = opendir("foobar"); +entryPtr = readdir(d); +p = entryPtr->d_name; +closedir(d); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + + if test $tcl_ok = no; then + cat >>confdefs.h <<\_ACEOF +#define NO_DIRENT_H 1 +_ACEOF + + fi + + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test "${ac_cv_header_errno_h+set}" = set; then + echo "$as_me:$LINENO: checking for errno.h" >&5 +echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_errno_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking errno.h usability" >&5 +echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking errno.h presence" >&5 +echo $ECHO_N "checking errno.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: errno.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: errno.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: errno.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for errno.h" >&5 +echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_errno_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_errno_h" >&6 + +fi +if test $ac_cv_header_errno_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_ERRNO_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_float_h+set}" = set; then + echo "$as_me:$LINENO: checking for float.h" >&5 +echo $ECHO_N "checking for float.h... $ECHO_C" >&6 +if test "${ac_cv_header_float_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 +echo "${ECHO_T}$ac_cv_header_float_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking float.h usability" >&5 +echo $ECHO_N "checking float.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking float.h presence" >&5 +echo $ECHO_N "checking float.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: float.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: float.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: float.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for float.h" >&5 +echo $ECHO_N "checking for float.h... $ECHO_C" >&6 +if test "${ac_cv_header_float_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_float_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 +echo "${ECHO_T}$ac_cv_header_float_h" >&6 + +fi +if test $ac_cv_header_float_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_FLOAT_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_values_h+set}" = set; then + echo "$as_me:$LINENO: checking for values.h" >&5 +echo $ECHO_N "checking for values.h... $ECHO_C" >&6 +if test "${ac_cv_header_values_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 +echo "${ECHO_T}$ac_cv_header_values_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking values.h usability" >&5 +echo $ECHO_N "checking values.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking values.h presence" >&5 +echo $ECHO_N "checking values.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: values.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: values.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: values.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for values.h" >&5 +echo $ECHO_N "checking for values.h... $ECHO_C" >&6 +if test "${ac_cv_header_values_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_values_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 +echo "${ECHO_T}$ac_cv_header_values_h" >&6 + +fi +if test $ac_cv_header_values_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_VALUES_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_limits_h+set}" = set; then + echo "$as_me:$LINENO: checking for limits.h" >&5 +echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 +if test "${ac_cv_header_limits_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 +echo "${ECHO_T}$ac_cv_header_limits_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking limits.h usability" >&5 +echo $ECHO_N "checking limits.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking limits.h presence" >&5 +echo $ECHO_N "checking limits.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: limits.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: limits.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: limits.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for limits.h" >&5 +echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 +if test "${ac_cv_header_limits_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_limits_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 +echo "${ECHO_T}$ac_cv_header_limits_h" >&6 + +fi +if test $ac_cv_header_limits_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_LIMITS_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_stdlib_h+set}" = set; then + echo "$as_me:$LINENO: checking for stdlib.h" >&5 +echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_stdlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking stdlib.h usability" >&5 +echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking stdlib.h presence" >&5 +echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for stdlib.h" >&5 +echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_stdlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_stdlib_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 + +fi +if test $ac_cv_header_stdlib_h = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtol" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtoul" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtod" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + if test $tcl_ok = 0; then + cat >>confdefs.h <<\_ACEOF +#define NO_STDLIB_H 1 +_ACEOF + + fi + if test "${ac_cv_header_string_h+set}" = set; then + echo "$as_me:$LINENO: checking for string.h" >&5 +echo $ECHO_N "checking for string.h... $ECHO_C" >&6 +if test "${ac_cv_header_string_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 +echo "${ECHO_T}$ac_cv_header_string_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking string.h usability" >&5 +echo $ECHO_N "checking string.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking string.h presence" >&5 +echo $ECHO_N "checking string.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: string.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: string.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: string.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for string.h" >&5 +echo $ECHO_N "checking for string.h... $ECHO_C" >&6 +if test "${ac_cv_header_string_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_string_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 +echo "${ECHO_T}$ac_cv_header_string_h" >&6 + +fi +if test $ac_cv_header_string_h = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strstr" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strerror" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + + # See also memmove check below for a place where NO_STRING_H can be + # set and why. + + if test $tcl_ok = 0; then + cat >>confdefs.h <<\_ACEOF +#define NO_STRING_H 1 +_ACEOF + + fi + + if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/wait.h" >&5 +echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/wait.h usability" >&5 +echo $ECHO_N "checking sys/wait.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking sys/wait.h presence" >&5 +echo $ECHO_N "checking sys/wait.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: sys/wait.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/wait.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/wait.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for sys/wait.h" >&5 +echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_wait_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 + +fi +if test $ac_cv_header_sys_wait_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_SYS_WAIT_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 +echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 +echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dlfcn_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 + +fi +if test $ac_cv_header_dlfcn_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_DLFCN_H 1 +_ACEOF + +fi + + + + # OS/390 lacks sys/param.h (and doesn't need it, by chance). + # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and + # CHECK on limits.h + + + + +for ac_header in limits.h unistd.h sys/param.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # Let the user call this, because if it triggers, they will + # need a compat/strtod.c that is correct. Users can also + # use Tcl_GetDouble(FromObj) instead. + #TEA_BUGGY_STRTOD + fi + + +#----------------------------------------------------------------------- +# __CHANGE__ +# Specify the C source files to compile in TEA_ADD_SOURCES, +# public headers that need to be installed in TEA_ADD_HEADERS, +# stub library C source files to compile in TEA_ADD_STUB_SOURCES, +# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. +# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS +# and PKG_TCL_SOURCES. +#----------------------------------------------------------------------- + +# ------- load xotclConfig.sh ---------- + + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + if test x"${no_xotcl}" = x ; then + # we reset no_xotcl in case something fails here + no_xotcl=true + +# Check whether --with-xotcl or --without-xotcl was given. +if test "${with_xotcl+set}" = set; then + withval="$with_xotcl" + with_xotclconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for XOTcl configuration" >&5 +echo $ECHO_N "checking for XOTcl configuration... $ECHO_C" >&6 + if test "${ac_cv_c_xotclconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + # First check to see if --with-xotcl was specified. + if test x"${with_xotclconfig}" != x ; then + if test -f "${with_xotclconfig}/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd ${with_xotclconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_xotclconfig} directory doesn't contain xotclConfig.sh" >&5 +echo "$as_me: error: ${with_xotclconfig} directory doesn't contain xotclConfig.sh" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_xotclconfig}" = x ; then + for i in \ + ${srcdir}/../xotcl \ + `ls -dr ${srcdir}/../xotcl-* 2>/dev/null` \ + ${srcdir}/../../xotcl \ + `ls -dr ${srcdir}/../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../xotcl \ + `ls -dr ${srcdir}/../../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../../xotcl \ + `ls -dr ${srcdir}/../../../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../../../xotcl \ + `ls -dr ${srcdir}/../../../../../xotcl-* 2>/dev/null` ; do + if test -f "$i/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_xotclconfig}" = x ; then + for i in `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` ; do + if test -f "$i/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd $i; pwd)` + break + fi + done + fi + + +fi + + + if test x"${ac_cv_c_xotclconfig}" = x ; then + XOTCL_BIN_DIR="# no XOTcl configs found" + { echo "$as_me:$LINENO: WARNING: Can't find XOTcl configuration definitions" >&5 +echo "$as_me: WARNING: Can't find XOTcl configuration definitions" >&2;} + exit 0 + else + no_xotcl= + XOTCL_BIN_DIR=${ac_cv_c_xotclconfig} + echo "$as_me:$LINENO: result: found $XOTCL_BIN_DIR/xotclConfig.sh" >&5 +echo "${ECHO_T}found $XOTCL_BIN_DIR/xotclConfig.sh" >&6 + fi + fi + + + echo "$as_me:$LINENO: checking for existence of $XOTCL_BIN_DIR/xotclConfig.sh" >&5 +echo $ECHO_N "checking for existence of $XOTCL_BIN_DIR/xotclConfig.sh... $ECHO_C" >&6 + + if test -f "$XOTCL_BIN_DIR/xotclConfig.sh" ; then + echo "$as_me:$LINENO: result: loading" >&5 +echo "${ECHO_T}loading" >&6 + . $XOTCL_BIN_DIR/xotclConfig.sh + else + echo "$as_me:$LINENO: result: file not found" >&5 +echo "${ECHO_T}file not found" >&6 + fi + + # + # The eval is required to do the TCL_DBGX substitution in the + # TCL_LIB_FILE variable + # + + + + + + + + + + + + +# ------- + + + vars="hash.c pair.c sdbm.c xotclsdbm.c" + for i in $vars; do + case $i in + \$*) + # allow $-var names + PKG_SOURCES="$PKG_SOURCES $i" + PKG_OBJECTS="$PKG_OBJECTS $i" + ;; + *) + # check for existence - allows for generic/win/unix VPATH + if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ + -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ + ; then + { { echo "$as_me:$LINENO: error: could not find source file '$i'" >&5 +echo "$as_me: error: could not find source file '$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_SOURCES="$PKG_SOURCES $i" + # this assumes it is in a VPATH dir + i=`basename $i` + # handle user calling this before or after TEA_SETUP_COMPILER + if test x"${OBJEXT}" != x ; then + j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" + else + j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" + fi + PKG_OBJECTS="$PKG_OBJECTS $j" + ;; + esac + done + + + + + vars="" + for i in $vars; do + # check for existence, be strict because it is installed + if test ! -f "${srcdir}/$i" ; then + { { echo "$as_me:$LINENO: error: could not find header file '${srcdir}/$i'" >&5 +echo "$as_me: error: could not find header file '${srcdir}/$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_HEADERS="$PKG_HEADERS $i" + done + + + + vars="-I$XOTCL_SRC_DIR/generic" + for i in $vars; do + PKG_INCLUDES="$PKG_INCLUDES $i" + done + + + + vars="$XOTCL_BUILD_STUB_LIB_SPEC" + for i in $vars; do + PKG_LIBS="$PKG_LIBS $i" + done + + + + PKG_CFLAGS="$PKG_CFLAGS " + + + + vars="" + for i in $vars; do + # check for existence - allows for generic/win/unix VPATH + if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ + -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ + ; then + { { echo "$as_me:$LINENO: error: could not find stub source file '$i'" >&5 +echo "$as_me: error: could not find stub source file '$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i" + # this assumes it is in a VPATH dir + i=`basename $i` + # handle user calling this before or after TEA_SETUP_COMPILER + if test x"${OBJEXT}" != x ; then + j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" + else + j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" + fi + PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j" + done + + + + + vars="" + for i in $vars; do + # check for existence, be strict because it is installed + if test ! -f "${srcdir}/$i" ; then + { { echo "$as_me:$LINENO: error: could not find tcl source file '${srcdir}/$i'" >&5 +echo "$as_me: error: could not find tcl source file '${srcdir}/$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i" + done + + + +#-------------------------------------------------------------------- +# __CHANGE__ +# A few miscellaneous platform-specific items: +# +# Define a special symbol for Windows (BUILD_sample in this case) so +# that we create the export library with the dll. +# +# Windows creates a few extra files that need to be cleaned up. +# You can add more files to clean if your extension creates any extra +# files. +# +# TEA_ADD_* any platform specific compiler/build info here. +#-------------------------------------------------------------------- + +if test "${TEA_PLATFORM}" = "windows" ; then + cat >>confdefs.h <<\_ACEOF +#define BUILD_sample 1 +_ACEOF + + CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" + #TEA_ADD_SOURCES([win/winFile.c]) + #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) +else + CLEANFILES="pkgIndex.tcl" + #TEA_ADD_SOURCES([unix/unixFile.c]) + #TEA_ADD_LIBS([-lsuperfly]) +fi + + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for Tcl public headers" >&5 +echo $ECHO_N "checking for Tcl public headers... $ECHO_C" >&6 + + +# Check whether --with-tclinclude or --without-tclinclude was given. +if test "${with_tclinclude+set}" = set; then + withval="$with_tclinclude" + with_tclinclude=${withval} +fi; + + if test "${ac_cv_c_tclh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + # Use the value from --with-tclinclude, if it was given + + if test x"${with_tclinclude}" != x ; then + if test -f "${with_tclinclude}/tcl.h" ; then + ac_cv_c_tclh=${with_tclinclude} + else + { { echo "$as_me:$LINENO: error: ${with_tclinclude} directory does not contain tcl.h" >&5 +echo "$as_me: error: ${with_tclinclude} directory does not contain tcl.h" >&2;} + { (exit 1); exit 1; }; } + fi + else + # Check order: pkg --prefix location, Tcl's --prefix location, + # directory of tclConfig.sh, and Tcl source directory. + # Looking in the source dir is not ideal, but OK. + + eval "temp_includedir=${includedir}" + list="`ls -d ${temp_includedir} 2>/dev/null` \ + `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ + `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \ + `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`" + if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then + list="$list /usr/local/include /usr/include" + fi + for i in $list ; do + if test -f "$i/tcl.h" ; then + ac_cv_c_tclh=$i + break + fi + done + fi + +fi + + + # Print a message based on how we determined the include path + + if test x"${ac_cv_c_tclh}" = x ; then + { { echo "$as_me:$LINENO: error: tcl.h not found. Please specify its location with --with-tclinclude" >&5 +echo "$as_me: error: tcl.h not found. Please specify its location with --with-tclinclude" >&2;} + { (exit 1); exit 1; }; } + else + echo "$as_me:$LINENO: result: ${ac_cv_c_tclh}" >&5 +echo "${ECHO_T}${ac_cv_c_tclh}" >&6 + fi + + # Convert to a native path and substitute into the output files. + + INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}` + + TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" + + + +#TEA_PRIVATE_TCL_HEADERS + +#TEA_PUBLIC_TK_HEADERS +#TEA_PRIVATE_TK_HEADERS +#TEA_PATH_X + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +#-------------------------------------------------------------------- + + + # Check whether --enable-threads or --disable-threads was given. +if test "${enable_threads+set}" = set; then + enableval="$enable_threads" + tcl_ok=$enableval +else + tcl_ok= +fi; + + if test "$tcl_ok" = "yes"; then + TCL_THREADS=1 + + if test "${TEA_PLATFORM}" != "windows" ; then + # We are always OK on Windows, so check what this platform wants. + cat >>confdefs.h <<\_ACEOF +#define USE_THREAD_ALLOC 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _THREAD_SAFE 1 +_ACEOF + + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6 +if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "no"; then + # Check a little harder for __pthread_mutex_init in the + # same library, as some systems hide it there until + # pthread.h is defined. We could alternatively do an + # AC_TRY_COMPILE with pthread.h, but that will work with + # libpthread really doesn't exist, like AIX 4.2. + # [Bug: 4359] + echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5 +echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char __pthread_mutex_init (); +int +main () +{ +__pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread___pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread___pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_init" >&6 +if test $ac_cv_lib_pthread___pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthread" + else + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthreads" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lpthreads... $ECHO_C" >&6 +if test "${ac_cv_lib_pthreads_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthreads $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthreads_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthreads_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_mutex_init" >&6 +if test $ac_cv_lib_pthreads_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthreads" + else + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lc... $ECHO_C" >&6 +if test "${ac_cv_lib_c_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_c_pthread_mutex_init" >&6 +if test $ac_cv_lib_c_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "no"; then + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6 +if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_r_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_r_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_c_r_pthread_mutex_init" >&6 +if test $ac_cv_lib_c_r_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -pthread" + else + TCL_THREADS=0 + { echo "$as_me:$LINENO: WARNING: \"Don t know how to find pthread lib on your system - thread support disabled\"" >&5 +echo "$as_me: WARNING: \"Don t know how to find pthread lib on your system - thread support disabled\"" >&2;} + fi + fi + fi + fi + + # Does the pthread-implementation provide + # 'pthread_attr_setstacksize' ? + + ac_saved_libs=$LIBS + LIBS="$LIBS $THREADS_LIBS" + +for ac_func in pthread_attr_setstacksize +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + LIBS=$ac_saved_libs + +for ac_func in readdir_r +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + fi + else + TCL_THREADS=0 + fi + # Do checking message here to not mess up interleaved configure output + echo "$as_me:$LINENO: checking for building with threads" >&5 +echo $ECHO_N "checking for building with threads... $ECHO_C" >&6 + if test "${TCL_THREADS}" = "1"; then + cat >>confdefs.h <<\_ACEOF +#define TCL_THREADS 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no (default)" >&5 +echo "${ECHO_T}no (default)" >&6 + fi + # TCL_THREADS sanity checking. See if our request for building with + # threads is the same as the way Tcl was built. If not, warn the user. + case ${TCL_DEFS} in + *THREADS=1*) + if test "${TCL_THREADS}" = "0"; then + { echo "$as_me:$LINENO: WARNING: + Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl + that IS thread-enabled." >&5 +echo "$as_me: WARNING: + Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl + that IS thread-enabled." >&2;} + fi + ;; + *) + if test "${TCL_THREADS}" = "1"; then + { echo "$as_me:$LINENO: WARNING: + --enable-threads requested, but attempting building against a Tcl + that is NOT thread-enabled." >&5 +echo "$as_me: WARNING: + --enable-threads requested, but attempting building against a Tcl + that is NOT thread-enabled." >&2;} + fi + ;; + esac + + + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking how to build libraries" >&5 +echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6 + # Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + tcl_ok=$enableval +else + tcl_ok=yes +fi; + + if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + tcl_ok=$enableval + else + tcl_ok=yes + fi + + if test "$tcl_ok" = "yes" ; then + echo "$as_me:$LINENO: result: shared" >&5 +echo "${ECHO_T}shared" >&6 + SHARED_BUILD=1 + else + echo "$as_me:$LINENO: result: static" >&5 +echo "${ECHO_T}static" >&6 + SHARED_BUILD=0 + cat >>confdefs.h <<\_ACEOF +#define STATIC_BUILD 1 +_ACEOF + + fi + + + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# can be taken from the tclConfig.sh file, but this figures it all out. +#-------------------------------------------------------------------- + + + + + # Step 0: Enable 64 bit support? + + echo "$as_me:$LINENO: checking if 64bit support is enabled" >&5 +echo $ECHO_N "checking if 64bit support is enabled... $ECHO_C" >&6 + # Check whether --enable-64bit or --disable-64bit was given. +if test "${enable_64bit+set}" = set; then + enableval="$enable_64bit" + do64bit=$enableval +else + do64bit=no +fi; + echo "$as_me:$LINENO: result: $do64bit" >&5 +echo "${ECHO_T}$do64bit" >&6 + + # Step 0.b: Enable Solaris 64 bit VIS support? + + echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5 +echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6 + # Check whether --enable-64bit-vis or --disable-64bit-vis was given. +if test "${enable_64bit_vis+set}" = set; then + enableval="$enable_64bit_vis" + do64bitVIS=$enableval +else + do64bitVIS=no +fi; + echo "$as_me:$LINENO: result: $do64bitVIS" >&5 +echo "${ECHO_T}$do64bitVIS" >&6 + + if test "$do64bitVIS" = "yes"; then + # Force 64bit on with VIS + do64bit=yes + fi + + # Step 0.c: Cross-compiling options for Windows/CE builds? + + if test "${TEA_PLATFORM}" = "windows" ; then + echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5 +echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6 + # Check whether --enable-wince or --disable-wince was given. +if test "${enable_wince+set}" = set; then + enableval="$enable_wince" + doWince=$enableval +else + doWince=no +fi; + echo "$as_me:$LINENO: result: $doWince" >&5 +echo "${ECHO_T}$doWince" >&6 + fi + + # Step 1: set the variable "system" to hold the name and version number + # for the system. This can usually be done via the "uname" command, but + # there are a few systems, like Next, where this doesn't work. + + echo "$as_me:$LINENO: checking system version (for dynamic loading)" >&5 +echo $ECHO_N "checking system version (for dynamic loading)... $ECHO_C" >&6 + if test -f /usr/lib/NextStep/software_version; then + system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` + else + system=`uname -s`-`uname -r` + if test "$?" -ne 0 ; then + echo "$as_me:$LINENO: result: unknown (can't find uname command)" >&5 +echo "${ECHO_T}unknown (can't find uname command)" >&6 + system=unknown + else + # Special check for weird MP-RAS system (uname returns weird + # results, and the version is kept in special file). + + if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then + system=MP-RAS-`awk '{print }' /etc/.relid'` + fi + if test "`uname -s`" = "AIX" ; then + system=AIX-`uname -v`.`uname -r` + fi + if test "${TEA_PLATFORM}" = "windows" ; then + system=windows + fi + echo "$as_me:$LINENO: result: $system" >&5 +echo "${ECHO_T}$system" >&6 + fi + fi + + # Step 2: check for existence of -ldl library. This is needed because + # Linux can use either -ldl or -ldld for dynamic loading. + + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + have_dl=yes +else + have_dl=no +fi + + + # Step 3: set configuration options based on system name and version. + + do64bit_ok=no + EXTRA_CFLAGS="" + TCL_EXPORT_FILE_SUFFIX="" + UNSHARED_LIB_SUFFIX="" + TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' + ECHO_VERSION='`echo ${PACKAGE_VERSION}`' + TCL_LIB_VERSIONS_OK=ok + CFLAGS_DEBUG=-g + CFLAGS_OPTIMIZE=-O + if test "$GCC" = "yes" ; then + CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int" + else + CFLAGS_WARNING="" + fi + TCL_NEEDS_EXP_FILE=0 + TCL_BUILD_EXP_FILE="" + TCL_EXP_FILE="" + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STLIB_LD='${AR} cr' + LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" + case $system in + windows) + # This is a 2-stage check to make sure we have the 64-bit SDK + # We have to know where the SDK is installed. + if test "$do64bit" = "yes" ; then + if test "x${MSSDK}x" = "xx" ; then + MSSDK="C:/Progra~1/Microsoft SDK" + fi + # In order to work in the tortured autoconf environment, + # we need to ensure that this path has no spaces + MSSDK=`cygpath -w -s "$MSSDK" | sed -e 's!\\\!/!g'` + if test ! -d "${MSSDK}/bin/win64" ; then + { echo "$as_me:$LINENO: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&5 +echo "$as_me: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&2;} + do64bit="no" + else + do64bit_ok="yes" + fi + fi + + if test "$doWince" != "no" ; then + if test "$do64bit" = "yes" ; then + { { echo "$as_me:$LINENO: error: Windows/CE and 64-bit builds incompatible" >&5 +echo "$as_me: error: Windows/CE and 64-bit builds incompatible" >&2;} + { (exit 1); exit 1; }; } + fi + if test "$GCC" = "yes" ; then + { { echo "$as_me:$LINENO: error: Windows/CE and GCC builds incompatible" >&5 +echo "$as_me: error: Windows/CE and GCC builds incompatible" >&2;} + { (exit 1); exit 1; }; } + fi + + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-celib + + if test x"${no_celib}" = x ; then + # we reset no_celib in case something fails here + no_celib=true + +# Check whether --with-celib or --without-celib was given. +if test "${with_celib+set}" = set; then + withval="$with_celib" + with_celibconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5 +echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6 + if test "${ac_cv_c_celibconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + # First check to see if --with-celibconfig was specified. + if test x"${with_celibconfig}" != x ; then + if test -d "${with_celibconfig}/inc" ; then + ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_celibconfig} directory doesn't contain inc directory" >&5 +echo "$as_me: error: ${with_celibconfig} directory doesn't contain inc directory" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a celib library + if test x"${ac_cv_c_celibconfig}" = x ; then + for i in \ + ../celib-palm-3.0 \ + ../celib \ + ../../celib-palm-3.0 \ + ../../celib \ + `ls -dr ../celib-*3.[0-9]* 2>/dev/null` \ + ${srcdir}/../celib-palm-3.0 \ + ${srcdir}/../celib \ + `ls -dr ${srcdir}/../celib-*3.[0-9]* 2>/dev/null` \ + ; do + if test -d "$i/inc" ; then + ac_cv_c_celibconfig=`(cd $i; pwd)` + break + fi + done + fi + +fi + + if test x"${ac_cv_c_celibconfig}" = x ; then + CELIB_DIR="# no Celib configs found" + { { echo "$as_me:$LINENO: error: Cannot find celib support library directory" >&5 +echo "$as_me: error: Cannot find celib support library directory" >&2;} + { (exit 1); exit 1; }; } + else + no_celib= + CELIB_DIR=${ac_cv_c_celibconfig} + echo "$as_me:$LINENO: result: found $CELIB_DIR" >&5 +echo "${ECHO_T}found $CELIB_DIR" >&6 + fi + fi + + # set defaults + # Currently Tcl requires 300+ + CEVERSION=300; # could be 211 300 301 ... + TARGETCPU=ARM; # could be ARM MIPS SH3 X86 ... + PLATFORM="Pocket PC 2002" + if test "$doWince" = "yes"; then + doWince="300,ARM,ARM,Pocket PC 2002" + fi + eval `echo $doWince | awk -F "," '{ \ + if (length($1)) { printf "CEVERSION=%s\n", $1 }; \ + if (length($2)) { printf "TARGETCPU=%s\n", toupper($2) }; \ + if (length($3)) { printf "ARCH=%s\n", toupper($3) }; \ + if (length($4)) { printf "PLATFORM=%s\n", $4 }; \ + }'` + OSVERSION=WCE$CEVERSION; + if test "x${ARCH}" = "x" ; then + ARCH=$TARGETCPU; # could be ARM MIPS SH3 X86 X86EM ... + fi + if test "x${WCEROOT}" = "x" ; then + WCEROOT="C:/Program Files/Microsoft eMbedded Tools" + fi + if test "x${SDKROOT}" = "x" ; then + SDKROOT="C:/Windows CE Tools" + fi + # In order to work in the tortured autoconf environment, + # we need to ensure that this path has no spaces + WCEROOT=`cygpath -w -s "$WCEROOT" | sed -e 's!\\\!/!g'` + SDKROOT=`cygpath -w -s "$SDKROOT" | sed -e 's!\\\!/!g'` + CELIB_DIR=`cygpath -w -s "$CELIB_DIR" | sed -e 's!\\\!/!g'` + if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ + -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then + { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5 +echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;} + { (exit 1); exit 1; }; } + doWince="no" + else + CEINCLUDE=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/include" | sed -e 's!\\\!/!g'` + CELIBPATH=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" | sed -e 's!\\\!/!g'` + fi + fi + + if test "$GCC" != "yes" ; then + if test "${SHARED_BUILD}" = "0" ; then + runtime=-MT + else + runtime=-MD + fi + + if test "$do64bit" = "yes" ; then + # All this magic is necessary for the Win64 SDK RC1 - hobbs + export CC="${MSSDK}/Bin/Win64/cl.exe \ + -I${MSSDK}/Include/prerelease \ + -I${MSSDK}/Include/Win64/crt \ + -I${MSSDK}/Include" + export RC="${MSSDK}/bin/rc.exe" + export lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \ + -LIBPATH:${MSSDK}/Lib/Prerelease/IA64" + export STLIB_LD="${MSSDK}/bin/win64/lib.exe -nologo ${lflags}" + export LINKBIN="${MSSDK}/bin/win64/link.exe ${lflags}" + CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" + CFLAGS_OPTIMIZE="-nologo -O2 -Gs -W2 ${runtime}" + elif test "$doWince" != "no" ; then + if test "${TARGETCPU}" = "X86"; then + CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + else + CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl${TARGETCPU}.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + fi + RC="${WCEROOT}/Common/EVC/bin/rc.exe" + cpulower=`echo ${TARGETCPU} | awk '{print tolower($0)}'` + defs="${TARGETCPU} _${TARGETCPU}_ ${cpulower} _${cpulower}_ POCKET_SIZE PALM_SIZE _MT _DLL _WINDOWS" + for i in $defs ; do + cat >>confdefs.h <<_ACEOF +#define $i 1 +_ACEOF + + done + cat >>confdefs.h <<_ACEOF +#define _WIN32_WCE $CEVERSION +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define UNDER_CE $CEVERSION +_ACEOF + + CFLAGS_DEBUG="-nologo -Zi -Od" + CFLAGS_OPTIMIZE="-nologo -Ox" + lflags="-MACHINE:${TARGETCPU} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,3.00" + STLIB_LD="${WCEROOT}/EVC/${OSVERSION}/bin/lib.exe -nologo ${lflags}" + LINKBIN="${WCEROOT}/EVC/${OSVERSION}/bin/link.exe ${lflags}" + else + RC="rc" + STLIB_LD="lib -nologo" + LINKBIN="link -link50compat" + CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" + CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD -W2 ${runtime}" + fi + fi + + if test "$GCC" = "yes"; then + # mingw gcc mode + RC="windres" + CFLAGS_DEBUG="-g" + CFLAGS_OPTIMIZE="-O2" + SHLIB_LD="$CC -shared" + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" + LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" + else + SHLIB_LD="${LINKBIN} -dll -nologo" + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.lib' + EXTRA_CFLAGS="-YX" + PATHTYPE=-w + # For information on what debugtype is most useful, see: + # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp + # This essentially turns it all on. + LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2" + LDFLAGS_OPTIMIZE="-release" + if test "$doWince" != "no" ; then + LDFLAGS_CONSOLE="-link ${lflags}" + LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} + else + LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" + LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" + fi + fi + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".dll" + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.dll' + + TCL_LIB_VERSIONS_OK=nodots + # Bogus to avoid getting this turned off + DL_OBJS="tclLoadNone.obj" + ;; + AIX-*) + if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then + # AIX requires the _r compiler when gcc isn't being used + if test "${CC}" != "cc_r" ; then + CC=${CC}_r + fi + echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5 +echo "${ECHO_T}Using $CC for compiling with threads" >&6 + fi + LIBS="$LIBS -lc" + SHLIB_CFLAGS="" + SHLIB_SUFFIX=".so" + SHLIB_LD_LIBS='${LIBS}' + + DL_OBJS="tclLoadDl.o" + LDFLAGS="" + LD_LIBRARY_PATH_VAR="LIBPATH" + + # AIX v<=4.1 has some different flags than 4.2+ + if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then + #LIBOBJS="$LIBOBJS tclLoadAix.o" + LIBOBJS="$LIBOBJS tclLoadAix.$ac_objext" + DL_LIBS="-lld" + fi + + # Check to enable 64-bit flags for compiler/linker on AIX 4+ + if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + else + do64bit_ok=yes + EXTRA_CFLAGS="-q64" + LDFLAGS="-q64" + RANLIB="${RANLIB} -X64" + AR="${AR} -X64" + SHLIB_LD_FLAGS="-b64" + fi + fi + + if test "`uname -m`" = "ia64" ; then + # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + # AIX-5 has dl* in libc.so + DL_LIBS="" + if test "$GCC" = "yes" ; then + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' + fi + else + SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}" + DL_LIBS="-ldl" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + TCL_NEEDS_EXP_FILE=1 + TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.exp' + fi + + # On AIX <=v4 systems, libbsd.a has to be linked in to support + # non-blocking file IO. This library has to be linked in after + # the MATH_LIBS or it breaks the pow() function. The way to + # insure proper sequencing, is to add it to the tail of MATH_LIBS. + # This library also supplies gettimeofday. + # + # AIX does not have a timezone field in struct tm. When the AIX + # bsd library is used, the timezone global and the gettimeofday + # methods are to be avoided for timezone deduction instead, we + # deduce the timezone by comparing the localtime result on a + # known GMT value. + + echo "$as_me:$LINENO: checking for gettimeofday in -lbsd" >&5 +echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6 +if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gettimeofday (); +int +main () +{ +gettimeofday (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_bsd_gettimeofday=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_bsd_gettimeofday=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gettimeofday" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6 +if test $ac_cv_lib_bsd_gettimeofday = yes; then + libbsd=yes +else + libbsd=no +fi + + if test $libbsd = yes; then + MATH_LIBS="$MATH_LIBS -lbsd" + cat >>confdefs.h <<\_ACEOF +#define USE_DELTA_FOR_TZ 1 +_ACEOF + + fi + ;; + BSD/OS-2.1*|BSD/OS-3*) + SHLIB_CFLAGS="" + SHLIB_LD="shlicc -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + BSD/OS-4.*) + SHLIB_CFLAGS="-export-dynamic -fPIC" + SHLIB_LD="cc -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-export-dynamic" + LD_SEARCH_FLAGS="" + ;; + dgux*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + HP-UX-*.11.*) + # Use updated header definitions where possible + cat >>confdefs.h <<\_ACEOF +#define _XOPEN_SOURCE_EXTENDED 1 +_ACEOF + + + SHLIB_SUFFIX=".sl" + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + fi + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + + # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc + #EXTRA_CFLAGS="+DAportable" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + hpux_arch=`${CC} -dumpmachine` + case $hpux_arch in + hppa64*) + # 64-bit gcc in use. Fix flags for GNU ld. + do64bit_ok=yes + SHLIB_LD="${CC} -shared" + SHLIB_LD_LIBS="" + LD_SEARCH_FLAGS='' + ;; + *) + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + ;; + esac + else + do64bit_ok=yes + if test "`uname -m`" = "ia64" ; then + EXTRA_CFLAGS="+DD64" + LDFLAGS="+DD64 $LDFLAGS" + else + EXTRA_CFLAGS="+DA2.0W" + LDFLAGS="+DA2.0W $LDFLAGS" + fi + fi + fi + ;; + HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) + SHLIB_SUFFIX=".sl" + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS="" + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + fi + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + ;; + IRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + ;; + IRIX-5.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + EXTRA_CFLAGS="" + LDFLAGS="" + ;; + IRIX-6.*|IRIX64-6.5*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -n32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then + EXTRA_CFLAGS="-mabi=n32" + LDFLAGS="-mabi=n32" + else + case $system in + IRIX-6.3) + # Use to build 6.2 compatible binaries on 6.3. + EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS" + ;; + *) + EXTRA_CFLAGS="-n32" + ;; + esac + LDFLAGS="-n32" + fi + ;; + IRIX64-6.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -n32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + + # Check to enable 64-bit flags for compiler/linker + + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5 +echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} + else + do64bit_ok=yes + SHLIB_LD="ld -64 -shared -rdata_shared" + EXTRA_CFLAGS="-64" + LDFLAGS="-64" + fi + fi + ;; + Linux*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings + # when you inline the string and math operations. Turn this off to + # get rid of the warnings. + + #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + else + if test "${ac_cv_header_dld_h+set}" = set; then + echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dld.h usability" >&5 +echo $ECHO_N "checking dld.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dld.h presence" >&5 +echo $ECHO_N "checking dld.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dld.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dld.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dld.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dld_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 + +fi +if test $ac_cv_header_dld_h = yes; then + + SHLIB_LD="ld -shared" + DL_OBJS="tclLoadDld.o" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS="" +fi + + + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + + # The combo of gcc + glibc has a bug related + # to inlining of functions like strtod(). The + # -fno-builtin flag should address this problem + # but it does not work. The -fno-inline flag + # is kind of overkill but it works. + # Disable inlining only when one of the + # files in compat/*.c is being linked in. + if test x"${USE_COMPAT}" != x ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline" + fi + + ;; + GNU*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + LD_SEARCH_FLAGS="" + else + if test "${ac_cv_header_dld_h+set}" = set; then + echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dld.h usability" >&5 +echo $ECHO_N "checking dld.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dld.h presence" >&5 +echo $ECHO_N "checking dld.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dld.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dld.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dld.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dld_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 + +fi +if test $ac_cv_header_dld_h = yes; then + + SHLIB_LD="ld -shared" + DL_OBJS="" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS="" +fi + + + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + ;; + MP-RAS-02*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + MP-RAS-*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-Wl,-Bexport" + LD_SEARCH_FLAGS="" + ;; + NetBSD-*|FreeBSD-[1-2].*) + # Not available on all versions: check for include file. + if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 +echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 +echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dlfcn_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 + +fi +if test $ac_cv_header_dlfcn_h = yes; then + + # NetBSD/SPARC needs -fPIC, -fpic will not do. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + echo "$as_me:$LINENO: checking for ELF" >&5 +echo $ECHO_N "checking for ELF... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef __ELF__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + +fi +rm -f conftest* + + +else + + SHLIB_CFLAGS="" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + +fi + + + + # FreeBSD doesn't handle version numbers with dots. + + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + OpenBSD-*) + SHLIB_LD="${CC} -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + echo "$as_me:$LINENO: checking for ELF" >&5 +echo $ECHO_N "checking for ELF... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef __ELF__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + +fi +rm -f conftest* + + + # OpenBSD doesn't do version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + FreeBSD-*) + # FreeBSD 3.* and greater have ELF. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="-export-dynamic" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + if test "${TCL_THREADS}" = "1" ; then + # The -pthread needs to go in the CFLAGS, not LIBS + LIBS=`echo $LIBS | sed s/-pthread//` + EXTRA_CFLAGS="-pthread" + LDFLAGS="$LDFLAGS -pthread" + fi + case $system in + FreeBSD-3.*) + # FreeBSD-3 doesn't handle version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' + TCL_LIB_VERSIONS_OK=nodots + ;; + esac + ;; + Rhapsody-*|Darwin-*) + SHLIB_CFLAGS="-fno-common" + SHLIB_LD="cc -dynamiclib \${LDFLAGS}" + TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_MAJOR_VERSION} -current_version \${PACKAGE_VERSION} -install_name \${LIB_RUNTIME_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".dylib" + DL_OBJS="tclLoadDyld.o" + DL_LIBS="" + LDFLAGS="-prebind" + LD_SEARCH_FLAGS="" + LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" + CFLAGS_OPTIMIZE="-O3" + EXTRA_CFLAGS="-arch ppc -pipe" + ;; + NEXTSTEP-*) + SHLIB_CFLAGS="" + SHLIB_LD="cc -nostdlib -r" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadNext.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OS/390-*) + CFLAGS_OPTIMIZE="" # Optimizer is buggy + cat >>confdefs.h <<\_ACEOF +#define _OE_SOCKETS 1 +_ACEOF + # needed in sys/socket.h + ;; + OSF1-1.0|OSF1-1.1|OSF1-1.2) + # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 + SHLIB_CFLAGS="" + # Hack: make package name same as library name + SHLIB_LD='ld -R -export :' + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadOSF.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-1.*) + # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 + SHLIB_CFLAGS="-fPIC" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD="ld -shared" + else + SHLIB_LD="ld -non_shared" + fi + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-V*) + # Digital OSF/1 + SHLIB_CFLAGS="" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD='ld -shared -expect_unresolved "*"' + else + SHLIB_LD='ld -non_shared -expect_unresolved "*"' + fi + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + if test "$GCC" != "yes" ; then + EXTRA_CFLAGS="-DHAVE_TZSET -std1" + fi + # see pthread_intro(3) for pthread support on osf1, k.furukawa + if test "${TCL_THREADS}" = "1" ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" + LIBS=`echo $LIBS | sed s/-lpthreads//` + if test "$GCC" = "yes" ; then + LIBS="$LIBS -lpthread -lmach -lexc" + else + EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread" + LDFLAGS="-pthread" + fi + fi + + ;; + QNX-6*) + # QNX RTP + # This may work for all QNX, but it was only reported for v6. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + # dlopen is in -lc on QNX + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + RISCos-*) + SHLIB_CFLAGS="-G 0" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + ;; + SCO_SV-3.2*) + # Note, dlopen is available only on SCO 3.2.5 and greater. However, + # this test works, since "uname -s" was non-standard in 3.2.4 and + # below. + if test "$GCC" = "yes" ; then + SHLIB_CFLAGS="-fPIC -melf" + LDFLAGS="-melf -Wl,-Bexport" + else + SHLIB_CFLAGS="-Kpic -belf" + LDFLAGS="-belf -Wl,-Bexport" + fi + SHLIB_LD="ld -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS="" + ;; + SINIX*5.4*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + SunOS-4*) + SHLIB_CFLAGS="-PIC" + SHLIB_LD="ld" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + + # SunOS can't handle version numbers with dots in them in library + # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it + # requires an extra version number at the end of .so file names. + # So, the library has to have a name like libtcl75.so.1.0 + + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + SunOS-5.[0-6]*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + + + SHLIB_CFLAGS="-KPIC" + + # Note: need the LIBS below, otherwise Tk won't find Tcl's + # symbols when dynamically loaded into tclsh. + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + ;; + SunOS-5*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + + + SHLIB_CFLAGS="-KPIC" + LDFLAGS="" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + arch=`isainfo` + if test "$arch" = "sparcv9 sparc" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + else + do64bit_ok=yes + if test "$do64bitVIS" = "yes" ; then + EXTRA_CFLAGS="-xarch=v9a" + LDFLAGS="-xarch=v9a" + else + EXTRA_CFLAGS="-xarch=v9" + LDFLAGS="-xarch=v9" + fi + fi + else + { echo "$as_me:$LINENO: WARNING: \"64bit mode only supported sparcv9 system\"" >&5 +echo "$as_me: WARNING: \"64bit mode only supported sparcv9 system\"" >&2;} + fi + fi + + # Note: need the LIBS below, otherwise Tk won't find Tcl's + # symbols when dynamically loaded into tclsh. + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + ;; + ULTRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + if test "$GCC" != "yes" ; then + EXTRA_CFLAGS="-DHAVE_TZSET -std1" + fi + ;; + UNIX_SV* | UnixWare-5*) + SHLIB_CFLAGS="-KPIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers + # that don't grok the -Bexport option. Test that it does. + hold_ldflags=$LDFLAGS + echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5 +echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6 + LDFLAGS="${LDFLAGS} -Wl,-Bexport" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + found=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +found=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$hold_ldflags + echo "$as_me:$LINENO: result: $found" >&5 +echo "${ECHO_T}$found" >&6 + if test $found = yes; then + LDFLAGS="-Wl,-Bexport" + else + LDFLAGS="" + fi + LD_SEARCH_FLAGS="" + ;; + esac + + if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit support being disabled -- don\'t know magic for this platform\"" >&5 +echo "$as_me: WARNING: \"64bit support being disabled -- don\'t know magic for this platform\"" >&2;} + fi + + # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic + # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop, + # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need + # to determine which of several header files defines the a.out file + # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we + # support only a file format that is more or less version-7-compatible. + # In particular, + # - a.out files must begin with `struct exec'. + # - the N_TXTOFF on the `struct exec' must compute the seek address + # of the text segment + # - The `struct exec' must contain a_magic, a_text, a_data, a_bss + # and a_entry fields. + # The following compilation should succeed if and only if either sys/exec.h + # or a.out.h is usable for the purpose. + # + # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the + # `struct exec' includes a second header that contains information that + # duplicates the v7 fields that are needed. + + if test "x$DL_OBJS" = "xtclLoadAout.o" ; then + echo "$as_me:$LINENO: checking sys/exec.h" >&5 +echo $ECHO_N "checking sys/exec.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_SYS_EXEC_H 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking a.out.h" >&5 +echo $ECHO_N "checking a.out.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_A_OUT_H 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking sys/exec_aout.h" >&5 +echo $ECHO_N "checking sys/exec_aout.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_midmag == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_SYS_EXEC_AOUT_H 1 +_ACEOF + + else + DL_OBJS="" + fi + fi + fi + fi + + # Step 5: disable dynamic loading if requested via a command-line switch. + + # Check whether --enable-load or --disable-load was given. +if test "${enable_load+set}" = set; then + enableval="$enable_load" + tcl_ok=$enableval +else + tcl_ok=yes +fi; + if test "$tcl_ok" = "no"; then + DL_OBJS="" + fi + + if test "x$DL_OBJS" != "x" ; then + BUILD_DLTEST="\$(DLTEST_TARGETS)" + else + echo "Can't figure out how to do dynamic loading or shared libraries" + echo "on this system." + SHLIB_CFLAGS="" + SHLIB_LD="" + SHLIB_SUFFIX="" + DL_OBJS="tclLoadNone.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + BUILD_DLTEST="" + fi + + # If we're running gcc, then change the C flags for compiling shared + # libraries to the right flags for gcc, instead of those for the + # standard manufacturer compiler. + + if test "$DL_OBJS" != "tclLoadNone.o" ; then + if test "$GCC" = "yes" ; then + case $system in + AIX-*) + ;; + BSD/OS*) + ;; + IRIX*) + ;; + NetBSD-*|FreeBSD-*) + ;; + Rhapsody-*|Darwin-*) + ;; + RISCos-*) + ;; + SCO_SV-3.2*) + ;; + ULTRIX-4.*) + ;; + windows) + ;; + *) + SHLIB_CFLAGS="-fPIC" + ;; + esac + fi + fi + + if test "$SHARED_LIB_SUFFIX" = "" ; then + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}${SHLIB_SUFFIX}' + fi + if test "$UNSHARED_LIB_SUFFIX" = "" ; then + UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + fi + + + + + + + + + + + + + + + + + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols option. +#-------------------------------------------------------------------- + + + + + if test "${TEA_PLATFORM}" = "windows" ; then + tcl_dbgx=d + else + tcl_dbgx=g + fi + + echo "$as_me:$LINENO: checking for build with symbols" >&5 +echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6 + # Check whether --enable-symbols or --disable-symbols was given. +if test "${enable_symbols+set}" = set; then + enableval="$enable_symbols" + tcl_ok=$enableval +else + tcl_ok=no +fi; + if test "$tcl_ok" = "no"; then + CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" + LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" + DBGX="" + TCL_DBGX="" + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + else + CFLAGS_DEFAULT="${CFLAGS_DEBUG}" + LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" + DBGX=${tcl_dbgx} + TCL_DBGX=${tcl_dbgx} + if test "$tcl_ok" = "yes"; then + echo "$as_me:$LINENO: result: yes (standard debugging)" >&5 +echo "${ECHO_T}yes (standard debugging)" >&6 + fi + fi + if test "${TEA_PLATFORM}" != "windows" ; then + LDFLAGS_DEFAULT="${LDFLAGS}" + fi + + + + + + if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then + cat >>confdefs.h <<\_ACEOF +#define TCL_MEM_DEBUG 1 +_ACEOF + + fi + + if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then + if test "$tcl_ok" = "all"; then + echo "$as_me:$LINENO: result: enabled symbols mem debugging" >&5 +echo "${ECHO_T}enabled symbols mem debugging" >&6 + else + echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5 +echo "${ECHO_T}enabled $tcl_ok debugging" >&6 + fi + fi + + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. Add Tk too if necessary. +#-------------------------------------------------------------------- + +cat >>confdefs.h <<\_ACEOF +#define USE_TCL_STUBS 1 +_ACEOF + +#AC_DEFINE(USE_TK_STUBS) + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, +# and TEA_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + + + if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then + MAKE_STATIC_LIB="\${STLIB_LD} -out:\$@ \$(PKG_OBJECTS)" + MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\$@ \$(PKG_OBJECTS)" + MAKE_STUB_LIB="\${STLIB_LD} -out:\$@ \$(PKG_STUB_OBJECTS)" + else + MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)" + MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS}" + MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)" + fi + + if test "${SHARED_BUILD}" = "1" ; then + MAKE_LIB="${MAKE_SHARED_LIB} " + else + MAKE_LIB="${MAKE_STATIC_LIB} " + fi + + #-------------------------------------------------------------------- + # Shared libraries and static libraries have different names. + # Use the double eval to make sure the ${DBGX} in the suffix is + # substituted. + #-------------------------------------------------------------------- + + RANLIB_STUB="${RANLIB}" + if test "${TEA_PLATFORM}" = "windows" ; then + if test "${SHARED_BUILD}" = "1" ; then + # We force the unresolved linking of symbols that are really in + # the private libraries of Tcl and Tk. + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" + if test x"${TK_BIN_DIR}" != x ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" + fi + eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + fi + # Some packages build there own stubs libraries + eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + else + if test "${SHARED_BUILD}" = "1" ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" + if test x"${TK_BIN_DIR}" != x ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}" + fi + eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + fi + # Some packages build there own stubs libraries + eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + fi + + # These are escaped so that only CFLAGS is picked up at configure time. + # The other values will be substituted at make time. + CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" + if test "${SHARED_BUILD}" = "1" ; then + CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}" + fi + + + + + + + + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +# Add WISH as well if this is a Tk extension. +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for tclsh" >&5 +echo $ECHO_N "checking for tclsh... $ECHO_C" >&6 + + if test "${ac_cv_path_tclsh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "x${CELIB_DIR}" != "x" ; then + # If CELIB_DIR is defined, assume Windows/CE target is requested + # which means target tclsh cannot be run (cross-compile) + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + else + search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'` + fi + for dir in $search_path ; do + for j in `ls -r $dir/tclsh[8-9]*${EXEEXT} 2> /dev/null` \ + `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do + if test x"$ac_cv_path_tclsh" = x ; then + if test -f "$j" ; then + ac_cv_path_tclsh=$j + break + fi + fi + done + done + +fi + + + if test -f "$ac_cv_path_tclsh" ; then + TCLSH_PROG=$ac_cv_path_tclsh + echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5 +echo "${ECHO_T}$TCLSH_PROG" >&6 + else + { { echo "$as_me:$LINENO: error: No tclsh found in PATH: $search_path" >&5 +echo "$as_me: error: No tclsh found in PATH: $search_path" >&2;} + { (exit 1); exit 1; }; } + fi + + +#TEA_PROG_WISH + +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +# You may alternatively have a special pkgIndex.tcl.in or other files +# which require substituting th AC variables in. Include these here. +#-------------------------------------------------------------------- + + ac_config_files="$ac_config_files Makefile" +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 +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by xotclsdbm $as_me 1.2, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +xotclsdbm config.status 1.2 +configured by $0, generated by GNU Autoconf 2.57, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@CYGPATH@,$CYGPATH,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@PKG_LIB_FILE@,$PKG_LIB_FILE,;t t +s,@PKG_STUB_LIB_FILE@,$PKG_STUB_LIB_FILE,;t t +s,@PKG_STUB_SOURCES@,$PKG_STUB_SOURCES,;t t +s,@PKG_STUB_OBJECTS@,$PKG_STUB_OBJECTS,;t t +s,@PKG_TCL_SOURCES@,$PKG_TCL_SOURCES,;t t +s,@PKG_HEADERS@,$PKG_HEADERS,;t t +s,@PKG_INCLUDES@,$PKG_INCLUDES,;t t +s,@PKG_LIBS@,$PKG_LIBS,;t t +s,@PKG_CFLAGS@,$PKG_CFLAGS,;t t +s,@TCL_VERSION@,$TCL_VERSION,;t t +s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t +s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t +s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t +s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t +s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t +s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t +s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t +s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t +s,@TCL_LIBS@,$TCL_LIBS,;t t +s,@TCL_DEFS@,$TCL_DEFS,;t t +s,@TCL_EXTRA_CFLAGS@,$TCL_EXTRA_CFLAGS,;t t +s,@TCL_LD_FLAGS@,$TCL_LD_FLAGS,;t t +s,@TCL_SHLIB_LD_LIBS@,$TCL_SHLIB_LD_LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@EGREP@,$EGREP,;t t +s,@MATH_LIBS@,$MATH_LIBS,;t t +s,@XOTCL_VERSION@,$XOTCL_VERSION,;t t +s,@XOTCL_MAJOR_VERSION@,$XOTCL_MAJOR_VERSION,;t t +s,@XOTCL_MINOR_VERSION@,$XOTCL_MINOR_VERSION,;t t +s,@XOTCL_RELEASE_LEVEL@,$XOTCL_RELEASE_LEVEL,;t t +s,@XOTCL_LIB_FILE@,$XOTCL_LIB_FILE,;t t +s,@XOTCL_BUILD_LIB_SPEC@,$XOTCL_BUILD_LIB_SPEC,;t t +s,@XOTCL_LIB_SPEC@,$XOTCL_LIB_SPEC,;t t +s,@XOTCL_STUB_LIB_FILE@,$XOTCL_STUB_LIB_FILE,;t t +s,@XOTCL_BUILD_STUB_LIB_SPEC@,$XOTCL_BUILD_STUB_LIB_SPEC,;t t +s,@XOTCL_STUB_LIB_SPEC@,$XOTCL_STUB_LIB_SPEC,;t t +s,@XOTCL_SRC_DIR@,$XOTCL_SRC_DIR,;t t +s,@PKG_SOURCES@,$PKG_SOURCES,;t t +s,@PKG_OBJECTS@,$PKG_OBJECTS,;t t +s,@CLEANFILES@,$CLEANFILES,;t t +s,@TCL_INCLUDES@,$TCL_INCLUDES,;t t +s,@TCL_THREADS@,$TCL_THREADS,;t t +s,@SHARED_BUILD@,$SHARED_BUILD,;t t +s,@AR@,$AR,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@DL_LIBS@,$DL_LIBS,;t t +s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t +s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t +s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t +s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t +s,@STLIB_LD@,$STLIB_LD,;t t +s,@SHLIB_LD@,$SHLIB_LD,;t t +s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t +s,@SHLIB_LD_FLAGS@,$SHLIB_LD_FLAGS,;t t +s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t +s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t +s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t +s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t +s,@TCL_DBGX@,$TCL_DBGX,;t t +s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t +s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t +s,@MAKE_LIB@,$MAKE_LIB,;t t +s,@MAKE_SHARED_LIB@,$MAKE_SHARED_LIB,;t t +s,@MAKE_STATIC_LIB@,$MAKE_STATIC_LIB,;t t +s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t +s,@RANLIB_STUB@,$RANLIB_STUB,;t t +s,@TCLSH_PROG@,$TCLSH_PROG,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + Index: xotcl/library/store/XOTclSdbm/configure.in =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/configure.in (revision 0) +++ xotcl/library/store/XOTclSdbm/configure.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,194 @@ +#!/bin/bash -norc +dnl This file is an input file used by the GNU "autoconf" program to +dnl generate the file "configure", which is run during Tcl installation +dnl to configure the system for the local environment. +# +# RCS: @(#) $Id: configure.in,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#----------------------------------------------------------------------- +# Sample configure.in for Tcl Extensions. The only places you should +# need to modify this file are marked by the string __CHANGE__ +#----------------------------------------------------------------------- + +configdir=$(srcdir)/../../../config + +#----------------------------------------------------------------------- +# __CHANGE__ +# Set your package name and version numbers here. +# +# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION +# set as provided. These will also be added as -D defs in your Makefile +# so you can encode the package version directly into the source files. +#----------------------------------------------------------------------- + +AC_INIT([xotclsdbm], [1.2]) + +#-------------------------------------------------------------------- +# Call TEA_INIT as the first TEA_ macro to set up initial vars. +# This will define a ${TEA_PLATFORM} variable == "unix" or "windows" +# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. +#-------------------------------------------------------------------- + +TEA_INIT([3.0]) + +AC_CONFIG_AUX_DIR(../../../config) + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + +TEA_PATH_TCLCONFIG +TEA_LOAD_TCLCONFIG + +#-------------------------------------------------------------------- +# Load the tkConfig.sh file if necessary (Tk extension) +#-------------------------------------------------------------------- + +#TEA_PATH_TKCONFIG +#TEA_LOAD_TKCONFIG + +#----------------------------------------------------------------------- +# Handle the --prefix=... option by defaulting to what Tcl gave. +# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. +#----------------------------------------------------------------------- + +TEA_PREFIX + +#----------------------------------------------------------------------- +# Standard compiler checks. +# This sets up CC by using the CC env var, or looks for gcc otherwise. +# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create +# the basic setup necessary to compile executables. +#----------------------------------------------------------------------- + +TEA_SETUP_COMPILER + +#----------------------------------------------------------------------- +# __CHANGE__ +# Specify the C source files to compile in TEA_ADD_SOURCES, +# public headers that need to be installed in TEA_ADD_HEADERS, +# stub library C source files to compile in TEA_ADD_STUB_SOURCES, +# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. +# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS +# and PKG_TCL_SOURCES. +#----------------------------------------------------------------------- + +# ------- load xotclConfig.sh ---------- +SC_PATH_XOTCLCONFIG +SC_LOAD_XOTCLCONFIG +# ------- + +TEA_ADD_SOURCES([hash.c pair.c sdbm.c xotclsdbm.c]) +TEA_ADD_HEADERS([]) +TEA_ADD_INCLUDES([-I$XOTCL_SRC_DIR/generic]) +TEA_ADD_LIBS([$XOTCL_BUILD_STUB_LIB_SPEC]) +TEA_ADD_CFLAGS([]) +TEA_ADD_STUB_SOURCES([]) +TEA_ADD_TCL_SOURCES([]) + +#-------------------------------------------------------------------- +# __CHANGE__ +# A few miscellaneous platform-specific items: +# +# Define a special symbol for Windows (BUILD_sample in this case) so +# that we create the export library with the dll. +# +# Windows creates a few extra files that need to be cleaned up. +# You can add more files to clean if your extension creates any extra +# files. +# +# TEA_ADD_* any platform specific compiler/build info here. +#-------------------------------------------------------------------- + +if test "${TEA_PLATFORM}" = "windows" ; then + AC_DEFINE(BUILD_sample) + CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" + #TEA_ADD_SOURCES([win/winFile.c]) + #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) +else + CLEANFILES="pkgIndex.tcl" + #TEA_ADD_SOURCES([unix/unixFile.c]) + #TEA_ADD_LIBS([-lsuperfly]) +fi +AC_SUBST(CLEANFILES) + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG +#-------------------------------------------------------------------- + +TEA_PUBLIC_TCL_HEADERS +#TEA_PRIVATE_TCL_HEADERS + +#TEA_PUBLIC_TK_HEADERS +#TEA_PRIVATE_TK_HEADERS +#TEA_PATH_X + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +#-------------------------------------------------------------------- + +TEA_ENABLE_THREADS + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + +TEA_ENABLE_SHARED + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# can be taken from the tclConfig.sh file, but this figures it all out. +#-------------------------------------------------------------------- + +TEA_CONFIG_CFLAGS + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols option. +#-------------------------------------------------------------------- + +TEA_ENABLE_SYMBOLS + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. Add Tk too if necessary. +#-------------------------------------------------------------------- + +AC_DEFINE(USE_TCL_STUBS) +#AC_DEFINE(USE_TK_STUBS) + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, +# and TEA_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + +TEA_MAKE_LIB + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +# Add WISH as well if this is a Tk extension. +#-------------------------------------------------------------------- + +TEA_PROG_TCLSH +#TEA_PROG_WISH + +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +# You may alternatively have a special pkgIndex.tcl.in or other files +# which require substituting th AC variables in. Include these here. +#-------------------------------------------------------------------- + +AC_OUTPUT([Makefile]) Index: xotcl/library/store/XOTclSdbm/configure.in-ok =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/configure.in-ok (revision 0) +++ xotcl/library/store/XOTclSdbm/configure.in-ok (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,312 @@ +#-------------------------------------------------------------------- +# Sample configure.in for Tcl Extensions. The only places you should +# need to modify this file are marked by the string __CHANGE__ +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# __CHANGE__ +# This very first macro is used to verify that the configure script can +# find the sources. The argument to AC_INIT should be a unique filename +# for this package, and can be a relative path, such as: +# +# AC_INIT(../generic/tcl.h) +#-------------------------------------------------------------------- + +AC_INIT(./xotclsdbm.c) +AC_CONFIG_AUX_DIR(../../../config) + +#-------------------------------------------------------------------- +# __CHANGE__ +# Set your package name and version numbers here. The NODOT_VERSION is +# required for constructing the library name on systems that don't like +# dots in library names (Windows). The VERSION variable is used on the +# other systems. +#-------------------------------------------------------------------- + +PACKAGE=xotclsdbm + +# do not modify the following lines manually, they are generated with changeXOTclVersion +XOTCL_MAJOR_VERSION=1 +XOTCL_MINOR_VERSION=2 +XOTCL_RELEASE_LEVEL=.1 + +MAJOR_VERSION=${XOTCL_MAJOR_VERSION} +MINOR_VERSION=${XOTCL_MINOR_VERSION} +PATCHLEVEL=${XOTCL_RELEASE_LEVEL} + +VERSION=${MAJOR_VERSION}.${MINOR_VERSION} +NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION} + +AC_SUBST(PATCHLEVEL) +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) + +#-------------------------------------------------------------------- +# We put this here so that you can compile with -DVERSION="1.2" to +# encode the package version directly into the source files. +#-------------------------------------------------------------------- + +eval AC_DEFINE_UNQUOTED(VERSION, "${VERSION}") + +#-------------------------------------------------------------------- +# Check whether --enable-gcc or --disable-gcc was given. Do this +# before AC_CYGWIN is called so the compiler can +# be fully tested by built-in autoconf tools. +# This macro also calls AC_PROG_CC to set the compiler if --enable-gcc +# was not used. +#-------------------------------------------------------------------- + +SC_ENABLE_GCC +AC_PROG_INSTALL + +#-------------------------------------------------------------------- +# Checks to see if the make program sets the $MAKE variable. +#-------------------------------------------------------------------- + +AC_PROG_MAKE_SET + +#-------------------------------------------------------------------- +# Find ranlib +#-------------------------------------------------------------------- + +AC_PROG_RANLIB + +#-------------------------------------------------------------------- +# This macro performs additional compiler tests. +#-------------------------------------------------------------------- + +AC_CYGWIN + +#-------------------------------------------------------------------- +# Determines the correct binary file extension (.o, .obj, .exe etc.) +#-------------------------------------------------------------------- + +AC_OBJEXT +AC_EXEEXT + +#-------------------------------------------------------------------- +# "cygpath" is used on windows to generate native path names for include +# files. +# These variables should only be used with the compiler and linker since +# they generate native path names. +# +# Unix tclConfig.sh points SRC_DIR at the top-level directory of +# the Tcl sources, while the Windows tclConfig.sh points SRC_DIR at +# the win subdirectory. Hence the different usages of SRC_DIR below. +# +# This must be done before calling SC_PUBLIC_TCL_HEADERS +#-------------------------------------------------------------------- + +case "`uname -s`" in + *win32* | *WIN32* | *CYGWIN_NT*) + CYGPATH="cygpath -w" + ;; + *) + CYGPATH=echo + ;; +esac + +AC_SUBST(CYGPATH) + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This MUST be called before SC_PATH_TCLCONFIG/SC_LOAD_TCLCONFIG +#-------------------------------------------------------------------- + +#SC_PUBLIC_TCL_HEADERS +SC_PRIVATE_TCL_HEADERS + +if test x"${with_tclinclude}" != x ; then + if test -f "${with_tclinclude}/tcl.h" ; then + TCL_INCLUDES="-I${with_tclinclude} ${TCL_INCLUDES}" + else + AC_MSG_ERROR([${with_tclinclude} directory does not contain Tcl header file tcl.h]) + fi +fi + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + +SC_PATH_TCLCONFIG +SC_LOAD_TCLCONFIG + +#-------------------------------------------------------------------- +# Load the xotclConfig.sh file +#-------------------------------------------------------------------- + +SC_PATH_XOTCLCONFIG +SC_LOAD_XOTCLCONFIG + +#-------------------------------------------------------------------- +# __CHANGE__ +# A few miscellaneous platform-specific items: +# +# Define a special symbol for Windows (BUILD_exampleA in this case) so +# that we create the export library with the dll. See sha1.h on how +# to use this. +# +# Windows creates a few extra files that need to be cleaned up. +# You can add more files to clean if your extension creates any extra +# files. +# +# Define any extra compiler flags in the PACKAGE_CFLAGS variable. +# These will be appended to the current set of compiler flags for +# your system. +#-------------------------------------------------------------------- + +case "`uname -s`" in + *win32* | *WIN32* | *CYGWIN_NT*) + AC_DEFINE(BUILD_xotclsdbm) + CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc50.pch vc60.pch" + AC_SUBST(CLEANFILES) + ;; + *) + CLEANFILES= + ;; +esac + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +# So far only Tcl responds to this one. +#-------------------------------------------------------------------- + +SC_ENABLE_THREADS + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + +SC_ENABLE_SHARED + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# is all taken from the tclConfig.sh file. +#-------------------------------------------------------------------- + +CFLAGS_DEBUG=${TCL_CFLAGS_DEBUG} +CFLAGS_OPTIMIZE=${TCL_CFLAGS_OPTIMIZE} +LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG} +LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE} +SHLIB_LD=${TCL_SHLIB_LD} +STLIB_LD=${TCL_STLIB_LD} +SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS} + +AC_SUBST(CFLAGS_DEBUG) +AC_SUBST(CFLAGS_OPTIMIZE) +AC_SUBST(STLIB_LD) +AC_SUBST(SHLIB_LD) +AC_SUBST(SHLIB_CFLAGS) +AC_SUBST(SHLIB_LDFLAGS) + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols +# option. +#-------------------------------------------------------------------- + +SC_ENABLE_SYMBOLS + +if test "${SHARED_BUILD}" = "1" ; then + CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}' +else + CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING}' +fi + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. +#-------------------------------------------------------------------- + +if test "${TCL_MAJOR_VERSION}" = "8" -a "${TCL_MINOR_VERSION}" = "0"; then + echo "Tcl 8.0, no stubs used" + USE_TCL_STUBS="" +else + AC_DEFINE(USE_TCL_STUBS) + AC_DEFINE(USE_XOTCL_STUBS) +fi + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the SC_ENABLE_SHARED, SC_ENABLE_SYMBOLS, +# and SC_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + +SC_MAKE_LIB + +#-------------------------------------------------------------------- +# eval these two values to dereference the ${DBGX} variable. +#-------------------------------------------------------------------- + +#eval "SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}" +#eval "UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}" + +SHARED_LIB_SUFFIX=${XOTCL_SHARED_LIB_SUFFIX} +UNSHARED_LIB_SUFFIX=${XOTCL_UNSHARED_LIB_SUFFIX} + +#-------------------------------------------------------------------- +# Shared libraries and static libraries have different names. +#-------------------------------------------------------------------- + +case "`uname -s`" in + *win32* | *WIN32* | *CYGWIN_NT*) + if test "${SHARED_BUILD}" = "1" ; then + SHLIB_LD_LIBS="\"`cygpath -w ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\" \"`cygpath -w ${XOTCL_BUILD_STUB_LIB_PATH}`\" ${TCL_SHLIB_LD_LIBS}" + eval "${PACKAGE}_LIB_FILE=${PACKAGE}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval "${PACKAGE}_LIB_FILE=${PACKAGE}${UNSHARED_LIB_SUFFIX}" + fi + ;; + *) + if test "${SHARED_BUILD}" = "1" ; then + #SHLIB_LD_LIBS="${TCL_BUILD_STUB_LIB_SPEC} ${XOTCL_BUILD_STUB_LIB_SPEC}" + SHLIB_LD_LIBS="${TCL_STUB_LIB_SPEC} ${XOTCL_BUILD_STUB_LIB_SPEC}" + eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${UNSHARED_LIB_SUFFIX}" + fi + ;; +esac + +#-------------------------------------------------------------------- +# __CHANGE__ +# Change the name from exampeA_LIB_FILE to match your package name. +#-------------------------------------------------------------------- + +AC_SUBST(xotclsdbm_LIB_FILE) +AC_SUBST(SHLIB_LD_LIBS) + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +#-------------------------------------------------------------------- + +SC_PROG_TCLSH + +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +#-------------------------------------------------------------------- + +AC_OUTPUT(Makefile ../pkgIndex-sdbm.add) + + + + + + + + + + Index: xotcl/library/store/XOTclSdbm/dllEntryPoint.c =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/dllEntryPoint.c (revision 0) +++ xotcl/library/store/XOTclSdbm/dllEntryPoint.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,39 @@ +/* + * dllEntryPoint.c -- + * $Id: dllEntryPoint.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * + * This file implements the Dll entry point as needed by Windows. + */ + +#define WIN32_LEAN_AND_MEAN +#include +#if defined(_MSC_VER) +# define DllEntryPoint DllMain +#endif + +/* + *---------------------------------------------------------------------- + * + * DllEntryPoint -- + * + * This wrapper function is used by Windows to invoke the + * initialization code for the DLL. If we are compiling + * with Visual C++, this routine will be renamed to DllMain. + * + * Results: + * Returns TRUE; + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +BOOL APIENTRY +DllEntryPoint(hInst, reason, reserved) + HINSTANCE hInst; /* Library instance handle. */ + DWORD reason; /* Reason this function is being called. */ + LPVOID reserved; /* Not used. */ +{ + return TRUE; +} Index: xotcl/library/store/XOTclSdbm/hash.c =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/hash.c (revision 0) +++ xotcl/library/store/XOTclSdbm/hash.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,47 @@ +/* + * sdbm - ndbm work-alike hashed database library + * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978). + * author: oz@nexus.yorku.ca + * status: public domain. keep it that way. + * + * hashing routine + */ + +#include "sdbm.h" +/* + * polynomial conversion ignoring overflows + * [this seems to work remarkably well, in fact better + * then the ndbm hash function. Replace at your own risk] + * use: 65599 nice. + * 65587 even better. + */ +long +sdbm_hash(str, len) +register char *str; +register int len; +{ + register unsigned long n = 0; + +#ifdef HAVE_DUFF + +#define HASHC n = *str++ + 65599 * n + + if (len > 0) { + register int loop = (len + 8 - 1) >> 3; + + switch(len & (8 - 1)) { + case 0: do { + HASHC; case 7: HASHC; + case 6: HASHC; case 5: HASHC; + case 4: HASHC; case 3: HASHC; + case 2: HASHC; case 1: HASHC; + } while (--loop); + } + + } +#else + while (len--) + n = *str++ + 65599 * n; +#endif + return n; +} Index: xotcl/library/store/XOTclSdbm/pair.c =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/pair.c (revision 0) +++ xotcl/library/store/XOTclSdbm/pair.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,308 @@ +/* + * sdbm - ndbm work-alike hashed database library + * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978). + * author: oz@nexus.yorku.ca + * status: public domain. + * + * page-level routines + */ + +#ifndef lint +static char rcsid[] = "$Id: pair.c,v 1.1 2004/05/23 22:50:39 neumann Exp $"; +#endif + +#include "sdbm.h" +#include "tune.h" +#include "pair.h" + +#include +#include + +#define exhash(item) sdbm_hash((item).dptr, (item).dsize) + +/* + * forward + */ +static int seepair proto((char *, int, char *, int)); + +/* + * page format: + * +------------------------------+ + * ino | n | keyoff | datoff | keyoff | + * +------------+--------+--------+ + * | datoff | - - - ----> | + * +--------+---------------------+ + * | F R E E A R E A | + * +--------------+---------------+ + * | <---- - - - | data | + * +--------+-----+----+----------+ + * | key | data | key | + * +--------+----------+----------+ + * + * calculating the offsets for free area: if the number + * of entries (ino[0]) is zero, the offset to the END of + * the free area is the block size. Otherwise, it is the + * nth (ino[ino[0]]) entry's offset. + */ + +int +fitpair(pag, need) +char *pag; +int need; +{ + register int n; + register int off; + register int free_space; + /* this cast "increases the alignment". Its not the only one, though.*/ + register short *ino = (short *) pag; + + off = ((n = ino[0]) > 0) ? ino[n] : PBLKSIZ; + free_space = off - (n + 1) * sizeof(short); + need += 2 * sizeof(short); + + debug(("free %d need %d\n", free_space, need)); + + return need <= free_space; +} + +void +putpair(pag, key, val) +char *pag; +datum key; +datum val; +{ + register int n; + register int off; + register short *ino = (short *) pag; + + off = ((n = ino[0]) > 0) ? ino[n] : PBLKSIZ; +/* + * enter the key first + */ + off -= key.dsize; + (void) memcpy(pag + off, key.dptr, key.dsize); + ino[n + 1] = off; +/* + * now the data + */ + off -= val.dsize; + (void) memcpy(pag + off, val.dptr, val.dsize); + ino[n + 2] = off; +/* + * adjust item count + */ + ino[0] += 2; +} + +datum +getpair(pag, key) +char *pag; +datum key; +{ + register int i; + register int n; + datum val; + register short *ino = (short *) pag; + + if ((n = ino[0]) == 0) + return nullitem; + + if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0) + return nullitem; + + val.dptr = pag + ino[i + 1]; + val.dsize = ino[i] - ino[i + 1]; + return val; +} + +#ifdef SEEDUPS +int +duppair(pag, key) +char *pag; +datum key; +{ + register short *ino = (short *) pag; + return ino[0] > 0 && seepair(pag, ino[0], key.dptr, key.dsize) > 0; +} +#endif + +datum +getnkey(pag, num) +char *pag; +int num; +{ + datum key; + register int off; + register short *ino = (short *) pag; + + num = num * 2 - 1; + if (ino[0] == 0 || num > ino[0]) + return nullitem; + + off = (num > 1) ? ino[num - 1] : PBLKSIZ; + + key.dptr = pag + ino[num]; + key.dsize = off - ino[num]; + + return key; +} + +int +delpair(pag, key) +char *pag; +datum key; +{ + register int n; + register int i; + register short *ino = (short *) pag; + + if ((n = ino[0]) == 0) + return 0; + + if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0) + return 0; +/* + * found the key. if it is the last entry + * [i.e. i == n - 1] we just adjust the entry count. + * hard case: move all data down onto the deleted pair, + * shift offsets onto deleted offsets, and adjust them. + * [note: 0 < i < n] + */ + if (i < n - 1) { + register int m; + register char *dst = pag + (i == 1 ? PBLKSIZ : ino[i - 1]); + register char *src = pag + ino[i + 1]; + register int zoo = dst - src; + + debug(("free-up %d ", zoo)); +/* + * shift data/keys down + */ + m = ino[i + 1] - ino[n]; +#ifdef DUFF +#define MOVB *--dst = *--src + + if (m > 0) { + register int loop = (m + 8 - 1) >> 3; + + switch (m & (8 - 1)) { + case 0: do { + MOVB; case 7: MOVB; + case 6: MOVB; case 5: MOVB; + case 4: MOVB; case 3: MOVB; + case 2: MOVB; case 1: MOVB; + } while (--loop); + } + } +#else +#ifdef MEMMOVE + memmove(dst, src, m); +#else + while (m--) + *--dst = *--src; +#endif +#endif +/* + * adjust offset index up + */ + while (i < n - 1) { + ino[i] = ino[i + 2] + zoo; + i++; + } + } + ino[0] -= 2; + return 1; +} + +/* + * search for the key in the page. + * return offset index in the range 0 < i < n. + * return 0 if not found. + */ +static int +seepair(pag, n, key, siz) +char *pag; +register int n; +register char *key; +register int siz; +{ + register int i; + register int off = PBLKSIZ; + register short *ino = (short *) pag; + + for (i = 1; i < n; i += 2) { + if (siz == off - ino[i] && + memcmp(key, pag + ino[i], siz) == 0) + return i; + off = ino[i + 1]; + } + return 0; +} + +void +splpage(pag, new, sbit) +char *pag; +char *new; +long sbit; +{ + datum key; + datum val; + + register int n; + register int off = PBLKSIZ; + char cur[PBLKSIZ]; + register short *ino = (short *) cur; + + (void) memcpy(cur, pag, PBLKSIZ); + (void) memset(pag, 0, PBLKSIZ); + (void) memset(new, 0, PBLKSIZ); + + n = ino[0]; + for (ino++; n > 0; ino += 2) { + key.dptr = cur + ino[0]; + key.dsize = off - ino[0]; + val.dptr = cur + ino[1]; + val.dsize = ino[0] - ino[1]; +/* + * select the page pointer (by looking at sbit) and insert + */ + (void) putpair((exhash(key) & sbit) ? new : pag, key, val); + + off = ino[1]; + n -= 2; + } + + debug(("%d split %d/%d\n", ((short *) cur)[0] / 2, + ((short *) new)[0] / 2, + ((short *) pag)[0] / 2)); +} + +/* + * check page sanity: + * number of entries should be something + * reasonable, and all offsets in the index should be in order. + * this could be made more rigorous. + */ +int +chkpage(pag) +char *pag; +{ + register int n; + register int off; + register short *ino = (short *) pag; + + if ((n = ino[0]) < 0 || n > PBLKSIZ / sizeof(short)) + return 0; + + if (n > 0) { + off = PBLKSIZ; + for (ino++; n > 0; ino += 2) { + if (ino[0] > off || ino[1] > off || + ino[1] > ino[0]) + return 0; + off = ino[1]; + n -= 2; + } + } + return 1; +} Index: xotcl/library/store/XOTclSdbm/pair.h =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/pair.h (revision 0) +++ xotcl/library/store/XOTclSdbm/pair.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,10 @@ +extern int fitpair proto((char *, int)); +extern void putpair proto((char *, datum, datum)); +extern datum getpair proto((char *, datum)); +extern int delpair proto((char *, datum)); +extern int chkpage proto((char *)); +extern datum getnkey proto((char *, int)); +extern void splpage proto((char *, char *, long)); +#ifdef SEEDUPS +extern int duppair proto((char *, datum)); +#endif Index: xotcl/library/store/XOTclSdbm/sdbm.c =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/sdbm.c (revision 0) +++ xotcl/library/store/XOTclSdbm/sdbm.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,544 @@ +/* + * sdbm - ndbm work-alike hashed database library + * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978). + * author: oz@nexus.yorku.ca + * status: public domain. + * + * core routines + */ + +#ifndef lint +static char rcsid[] = "$Id: sdbm.c,v 1.1 2004/05/23 22:50:39 neumann Exp $"; +#endif + +/*#include "config.h"*/ +#include "sdbm.h" +#include "tune.h" +#include "pair.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#ifdef HAVE_MEMORY_H +#include +#endif +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_FILE_H +# include +#endif +#ifdef _WIN32 +# define HAVE_FCNTL_H +# include +#endif +/* +#ifdef HAVE_FCNTL_H +*/ +# include +/* +#endif +*/ +#ifdef __STDC__ +#include +#endif + +#ifndef NULL +#define NULL 0 +#endif + +/* + * externals + */ +#ifndef _WIN32 +#ifndef HAVE_UNISTD_H +extern long lseek(); +#endif +#endif + +/* + * forward + */ +static int getdbit proto((DBM *, long)); +static int setdbit proto((DBM *, long)); +static int getpage proto((DBM *, long)); +static datum getnext proto((DBM *)); +static int makroom proto((DBM *, long, int)); + +/* + * useful macros + */ +#define bad(x) ((x).dptr == NULL || (x).dsize <= 0) +#define exhash(item) sdbm_hash((item).dptr, (item).dsize) +#define ioerr(db) ((db)->flags |= SDBM_IOERR) + +#define OFF_PAG(off) (long) (off) * PBLKSIZ +#define OFF_DIR(off) (long) (off) * DBLKSIZ + +static long masks[] = { + 000000000000, 000000000001, 000000000003, 000000000007, + 000000000017, 000000000037, 000000000077, 000000000177, + 000000000377, 000000000777, 000000001777, 000000003777, + 000000007777, 000000017777, 000000037777, 000000077777, + 000000177777, 000000377777, 000000777777, 000001777777, + 000003777777, 000007777777, 000017777777, 000037777777, + 000077777777, 000177777777, 000377777777, 000777777777, + 001777777777, 003777777777, 007777777777, 017777777777 +}; + +datum nullitem = {NULL, 0}; + +DBM * +sdbm_open(file, flags, mode) +register char *file; +register int flags; +register int mode; +{ + register DBM *db; + register char *dirname; + register char *pagname; + register int n; + + if (file == NULL || !*file) + return errno = EINVAL, (DBM *) NULL; +/* + * need space for two seperate filenames + */ + n = strlen(file) * 2 + strlen(DIRFEXT) + strlen(PAGFEXT) + 2; + + if ((dirname = malloc((unsigned) n)) == NULL) + return errno = ENOMEM, (DBM *) NULL; +/* + * build the file names + */ + dirname = strcat(strcpy(dirname, file), DIRFEXT); + pagname = strcpy(dirname + strlen(dirname) + 1, file); + pagname = strcat(pagname, PAGFEXT); + + db = sdbm_prep(dirname, pagname, flags, mode); + free((char *) dirname); + return db; +} + +DBM * +sdbm_prep(dirname, pagname, flags, mode) +char *dirname; +char *pagname; +int flags; +int mode; +{ + register DBM *db; + struct stat dstat; + + if ((db = (DBM *) malloc(sizeof(DBM))) == NULL) + return errno = ENOMEM, (DBM *) NULL; + + db->flags = 0; + db->hmask = 0; + db->blkptr = 0; + db->keyptr = 0; +/* + * adjust user flags so that WRONLY becomes RDWR, + * as required by this package. Also set our internal + * flag for RDONLY if needed. + */ + if (flags & O_WRONLY) + flags = (flags & ~O_WRONLY) | O_RDWR; + + else if ((flags & 03) == O_RDONLY) + db->flags = SDBM_RDONLY; + +#ifdef O_BINARY + /* GO32 / DOS-Braindamage */ + flags |= O_BINARY; +#endif + +/* + * open the files in sequence, and stat the dirfile. + * If we fail anywhere, undo everything, return NULL. + */ + if ((db->pagf = open(pagname, flags, mode)) > -1) { + if ((db->dirf = open(dirname, flags, mode)) > -1) { +/* + * need the dirfile size to establish max bit number. + */ + if (fstat(db->dirf, &dstat) == 0) { +/* + * zero size: either a fresh database, or one with a single, + * unsplit data page: dirpage is all zeros. + */ + db->dirbno = (!dstat.st_size) ? 0 : -1; + db->pagbno = -1; + db->maxbno = dstat.st_size * BYTESIZ; + + (void) memset(db->pagbuf, 0, PBLKSIZ); + (void) memset(db->dirbuf, 0, DBLKSIZ); + /* + * success + */ + return db; + } + (void) close(db->dirf); + } + (void) close(db->pagf); + } + free((char *) db); + return (DBM *) NULL; +} + +void +sdbm_close(db) +register DBM *db; +{ + if (db == NULL) + errno = EINVAL; + else { + (void) close(db->dirf); + (void) close(db->pagf); + free((char *) db); + } +} + +datum +sdbm_fetch(db, key) +register DBM *db; +datum key; +{ + if (db == NULL || bad(key)) + return errno = EINVAL, nullitem; + + if (getpage(db, exhash(key))) + return getpair(db->pagbuf, key); + + return ioerr(db), nullitem; +} + +int +sdbm_delete(db, key) +register DBM *db; +datum key; +{ + if (db == NULL || bad(key)) + return errno = EINVAL, -1; + if (sdbm_rdonly(db)) + return errno = EPERM, -1; + + if (getpage(db, exhash(key))) { + if (!delpair(db->pagbuf, key)) + return -1; +/* + * update the page file + */ + if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0 + || write(db->pagf, db->pagbuf, PBLKSIZ) < 0) + return ioerr(db), -1; + + return 0; + } + + return ioerr(db), -1; +} + +int +sdbm_store(db, key, val, flags) +register DBM *db; +datum key; +datum val; +int flags; +{ + int need; + register long hash; + + if (db == NULL || bad(key)) + return errno = EINVAL, -1; + if (sdbm_rdonly(db)) + return errno = EPERM, -1; + + need = key.dsize + val.dsize; +/* + * is the pair too big (or too small) for this database ?? + */ + if (need < 0 || need > PAIRMAX) + return errno = EINVAL, -1; + + if (getpage(db, (hash = exhash(key)))) { +/* + * if we need to replace, delete the key/data pair + * first. If it is not there, ignore. + */ + if (flags == SDBM_REPLACE) + (void) delpair(db->pagbuf, key); +#ifdef SEEDUPS + else if (duppair(db->pagbuf, key)) + return 1; +#endif +/* + * if we do not have enough room, we have to split. + */ + if (!fitpair(db->pagbuf, need)) + if (!makroom(db, hash, need)) + return ioerr(db), -1; +/* + * we have enough room or split is successful. insert the key, + * and update the page file. + */ + (void) putpair(db->pagbuf, key, val); + + if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0 + || write(db->pagf, db->pagbuf, PBLKSIZ) < 0) + return ioerr(db), -1; + /* + * success + */ + return 0; + } + + return ioerr(db), -1; +} + +/* + * makroom - make room by splitting the overfull page + * this routine will attempt to make room for SPLTMAX times before + * giving up. + */ +static int +makroom(db, hash, need) +register DBM *db; +long hash; +int need; +{ + long newp; + char twin[PBLKSIZ]; + char *pag = db->pagbuf; + char *new = twin; + register int smax = SPLTMAX; + + do { +/* + * split the current page + */ + (void) splpage(pag, new, db->hmask + 1); +/* + * address of the new page + */ + newp = (hash & db->hmask) | (db->hmask + 1); + +/* + * write delay, read avoidence/cache shuffle: + * select the page for incoming pair: if key is to go to the new page, + * write out the previous one, and copy the new one over, thus making + * it the current page. If not, simply write the new page, and we are + * still looking at the page of interest. current page is not updated + * here, as sdbm_store will do so, after it inserts the incoming pair. + */ + if (hash & (db->hmask + 1)) { + if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0 + || write(db->pagf, db->pagbuf, PBLKSIZ) < 0) + return 0; + db->pagbno = newp; + (void) memcpy(pag, new, PBLKSIZ); + } + else if (lseek(db->pagf, OFF_PAG(newp), SEEK_SET) < 0 + || write(db->pagf, new, PBLKSIZ) < 0) + return 0; + + if (!setdbit(db, db->curbit)) + return 0; +/* + * see if we have enough room now + */ + if (fitpair(pag, need)) + return 1; +/* + * try again... update curbit and hmask as getpage would have + * done. because of our update of the current page, we do not + * need to read in anything. BUT we have to write the current + * [deferred] page out, as the window of failure is too great. + */ + db->curbit = 2 * db->curbit + + ((hash & (db->hmask + 1)) ? 2 : 1); + db->hmask |= db->hmask + 1; + + if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0 + || write(db->pagf, db->pagbuf, PBLKSIZ) < 0) + return 0; + + } while (--smax); +/* + * if we are here, this is real bad news. After SPLTMAX splits, + * we still cannot fit the key. say goodnight. + */ +#ifdef BADMESS + (void) write(2, "sdbm: cannot insert after SPLTMAX attempts.\n", 44); +#endif + return 0; + +} + +/* + * the following two routines will break if + * deletions aren't taken into account. (ndbm bug) + */ +datum +sdbm_firstkey(db) +register DBM *db; +{ + if (db == NULL) + return errno = EINVAL, nullitem; +/* + * start at page 0 + */ + if (lseek(db->pagf, OFF_PAG(0), SEEK_SET) < 0 + || read(db->pagf, db->pagbuf, PBLKSIZ) < 0) + return ioerr(db), nullitem; + db->pagbno = 0; + db->blkptr = 0; + db->keyptr = 0; + + return getnext(db); +} + +datum +sdbm_nextkey(db) +register DBM *db; +{ + if (db == NULL) + return errno = EINVAL, nullitem; + return getnext(db); +} + +/* + * all important binary trie traversal + */ +static int +getpage(db, hash) +register DBM *db; +register long hash; +{ + register int hbit; + register long dbit; + register long pagb; + + dbit = 0; + hbit = 0; + while (dbit < db->maxbno && getdbit(db, dbit)) + dbit = 2 * dbit + ((hash & (1 << hbit++)) ? 2 : 1); + + debug(("dbit: %d...", dbit)); + + db->curbit = dbit; + db->hmask = masks[hbit]; + + pagb = hash & db->hmask; +/* + * see if the block we need is already in memory. + * note: this lookaside cache has about 10% hit rate. + */ + if (pagb != db->pagbno) { +/* + * note: here, we assume a "hole" is read as 0s. + * if not, must zero pagbuf first. + */ + if (lseek(db->pagf, OFF_PAG(pagb), SEEK_SET) < 0 + || read(db->pagf, db->pagbuf, PBLKSIZ) < 0) + return 0; + if (!chkpage(db->pagbuf)) + return 0; + db->pagbno = pagb; + + debug(("pag read: %d\n", pagb)); + } + return 1; +} + +static int +getdbit(db, dbit) +register DBM *db; +register long dbit; +{ + register long c; + register long dirb; + + c = dbit / BYTESIZ; + dirb = c / DBLKSIZ; + + if (dirb != db->dirbno) { + if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0 + || read(db->dirf, db->dirbuf, DBLKSIZ) < 0) + return 0; + db->dirbno = dirb; + + debug(("dir read: %d\n", dirb)); + } + + return db->dirbuf[c % DBLKSIZ] & (1 << dbit % BYTESIZ); +} + +static int +setdbit(db, dbit) +register DBM *db; +register long dbit; +{ + register long c; + register long dirb; + + c = dbit / BYTESIZ; + dirb = c / DBLKSIZ; + + if (dirb != db->dirbno) { + if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0 + || read(db->dirf, db->dirbuf, DBLKSIZ) < 0) + return 0; + db->dirbno = dirb; + + debug(("dir read: %d\n", dirb)); + } + + db->dirbuf[c % DBLKSIZ] |= (1 << dbit % BYTESIZ); + + if (dbit >= db->maxbno) + db->maxbno += DBLKSIZ * BYTESIZ; + + if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0 + || write(db->dirf, db->dirbuf, DBLKSIZ) < 0) + return 0; + + return 1; +} + +/* + * getnext - get the next key in the page, and if done with + * the page, try the next page in sequence + */ +static datum +getnext(db) +register DBM *db; +{ + datum key; + + for (;;) { + db->keyptr++; + key = getnkey(db->pagbuf, db->keyptr); + if (key.dptr != NULL) + return key; +/* + * we either run out, or there is nothing on this page.. + * try the next one... If we lost our position on the + * file, we will have to seek. + */ + db->keyptr = 0; + if (db->pagbno != db->blkptr++) + if (lseek(db->pagf, OFF_PAG(db->blkptr), SEEK_SET) < 0) + break; + db->pagbno = db->blkptr; + if (read(db->pagf, db->pagbuf, PBLKSIZ) <= 0) + break; + if (!chkpage(db->pagbuf)) + break; + } + + return ioerr(db), nullitem; +} Index: xotcl/library/store/XOTclSdbm/sdbm.h =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/sdbm.h (revision 0) +++ xotcl/library/store/XOTclSdbm/sdbm.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,79 @@ +/* + * sdbm - ndbm work-alike hashed database library + * based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978). + * author: oz@nexus.yorku.ca + * status: public domain. + */ +#define DBLKSIZ 4096 +#define PBLKSIZ 1024 +#define PAIRMAX 1008 /* arbitrary on PBLKSIZ-N */ +#define SPLTMAX 10 /* maximum allowed splits */ + /* for a single insertion */ +#define DIRFEXT ".dir" +#define PAGFEXT ".pag" + +typedef struct { + int dirf; /* directory file descriptor */ + int pagf; /* page file descriptor */ + int flags; /* status/error flags, see below */ + long maxbno; /* size of dirfile in bits */ + long curbit; /* current bit number */ + long hmask; /* current hash mask */ + long blkptr; /* current block for nextkey */ + int keyptr; /* current key for nextkey */ + long blkno; /* current page to read/write */ + long pagbno; /* current page in pagbuf */ + char pagbuf[PBLKSIZ]; /* page file block buffer */ + long dirbno; /* current block in dirbuf */ + char dirbuf[DBLKSIZ]; /* directory file block buffer */ +} DBM; + +#define SDBM_RDONLY 0x1 /* data base open read-only */ +#define SDBM_IOERR 0x2 /* data base I/O error */ + +/* + * utility macros + */ +#define sdbm_rdonly(db) ((db)->flags & SDBM_RDONLY) +#define sdbm_error(db) ((db)->flags & SDBM_IOERR) + +#define sdbm_clearerr(db) ((db)->flags &= ~SDBM_IOERR) /* ouch */ + +#define sdbm_dirfno(db) ((db)->dirf) +#define sdbm_pagfno(db) ((db)->pagf) + +typedef struct { + char *dptr; + int dsize; +} datum; + +extern datum nullitem; + +#ifdef __STDC__ +#define proto(p) p +#else +#define proto(p) () +#endif + +/* + * flags to sdbm_store + */ +#define SDBM_INSERT 0 +#define SDBM_REPLACE 1 + +/* + * ndbm interface + */ +extern DBM *sdbm_open proto((char *, int, int)); +extern void sdbm_close proto((DBM *)); +extern datum sdbm_fetch proto((DBM *, datum)); +extern int sdbm_delete proto((DBM *, datum)); +extern int sdbm_store proto((DBM *, datum, datum, int)); +extern datum sdbm_firstkey proto((DBM *)); +extern datum sdbm_nextkey proto((DBM *)); + +/* + * other + */ +extern DBM *sdbm_prep proto((char *, char *, int, int)); +extern long sdbm_hash proto((char *, int)); Index: xotcl/library/store/XOTclSdbm/tune.h =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/tune.h (revision 0) +++ xotcl/library/store/XOTclSdbm/tune.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,34 @@ +/* + * sdbm - ndbm work-alike hashed database library + * tuning and portability constructs [not nearly enough] + * author: oz@nexus.yorku.ca + */ + +#define BYTESIZ 8 + +#ifdef SVID +#include +#endif + +#ifdef BSD42 +#define SEEK_SET L_SET +#define memset(s,c,n) bzero(s, n) /* only when c is zero */ +#define memcpy(s1,s2,n) bcopy(s2, s1, n) +#define memcmp(s1,s2,n) bcmp(s1,s2,n) +#endif + +/* + * important tuning parms (hah) + */ + +#define SEEDUPS /* always detect duplicates */ +#define BADMESS /* generate a message for worst case: + cannot make room after SPLTMAX splits */ +/* + * misc + */ +#ifdef DEBUG +#define debug(x) printf x +#else +#define debug(x) +#endif Index: xotcl/library/store/XOTclSdbm/util.c =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/util.c (revision 0) +++ xotcl/library/store/XOTclSdbm/util.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,189 @@ +#include "config.h" +#include +#include +#include "sdbm.h" + +#ifdef HAVE_SYS_FILE_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif +#include +extern int errno; + +void +oops(s1, s2) +register char *s1; +register char *s2; +{ +#ifndef HAVE_STRERROR + extern int sys_nerr; + extern char *sys_errlist[]; +#endif + extern char *progname; + + if (progname) + fprintf(stderr, "%s: ", progname); + fprintf(stderr, s1, s2); +#ifndef HAVE_STRERROR + if (errno > 0 && errno < sys_nerr) + fprintf(stderr, " (%s)", sys_errlist[errno]); +#else + if (errno > 0) + fprintf(stderr, " (%s)", strerror(errno)); +#endif + fprintf(stderr, "\n"); + exit(1); +} + +int +okpage(char *pag) +{ + register unsigned n; + register off; + register short *ino = (short *) pag; + + if ((n = ino[0]) > PBLKSIZ / sizeof(short)) + return 0; + + if (!n) + return 1; + + off = PBLKSIZ; + for (ino++; n; ino += 2) { + if (ino[0] > off || ino[1] > off || + ino[1] > ino[0]) + return 0; + off = ino[1]; + n -= 2; + } + + return 1; +} + + + +/***************************************************************************\ +** ** +** Function name: getopt() ** +** Author: Henry Spencer, UofT ** +** Coding date: 84/04/28 ** +** ** +** Description: ** +** ** +** Parses argv[] for arguments. ** +** Works with Whitesmith's C compiler. ** +** ** +** Inputs - The number of arguments ** +** - The base address of the array of arguments ** +** - A string listing the valid options (':' indicates an ** +** argument to the preceding option is required, a ';' ** +** indicates an argument to the preceding option is optional) ** +** ** +** Outputs - Returns the next option character, ** +** '?' for non '-' arguments ** +** or ':' when there is no more arguments. ** +** ** +** Side Effects + The argument to an option is pointed to by 'optarg' ** +** ** +***************************************************************************** +** ** +** REVISION HISTORY: ** +** ** +** DATE NAME DESCRIPTION ** +** YY/MM/DD ------------------ ------------------------------------ ** +** 88/10/20 Janick Bergeron Returns '?' on unamed arguments ** +** returns '!' on unknown options ** +** and 'EOF' only when exhausted. ** +** 88/11/18 Janick Bergeron Return ':' when no more arguments ** +** 89/08/11 Janick Bergeron Optional optarg when ';' in optstring ** +** ** +\***************************************************************************/ + +char *optarg; /* Global argument pointer. */ + +#ifdef VMS +#define index strchr +#endif + +#ifndef HAVE_GETOPT +char +getopt(argc, argv, optstring) +int argc; +char **argv; +char *optstring; +{ + register int c; + register char *place; + extern char *index(); + static int optind = 0; + static char *scan = NULL; + + optarg = NULL; + + if (scan == NULL || *scan == '\0') { + + if (optind == 0) + optind++; + if (optind >= argc) + return ':'; + + optarg = place = argv[optind++]; + if (place[0] != '-' || place[1] == '\0') + return '?'; + if (place[1] == '-' && place[2] == '\0') + return '?'; + scan = place + 1; + } + + c = *scan++; + place = index(optstring, c); + if (place == NULL || c == ':' || c == ';') { + + (void) fprintf(stderr, "%s: unknown option %c\n", argv[0], c); + scan = NULL; + return '!'; + } + if (*++place == ':') { + + if (*scan != '\0') { + + optarg = scan; + scan = NULL; + + } + else { + + if (optind >= argc) { + + (void) fprintf(stderr, "%s: %c requires an argument\n", + argv[0], c); + return '!'; + } + optarg = argv[optind]; + optind++; + } + } + else if (*place == ';') { + + if (*scan != '\0') { + + optarg = scan; + scan = NULL; + + } + else { + + if (optind >= argc || *argv[optind] == '-') + optarg = NULL; + else { + optarg = argv[optind]; + optind++; + } + } + } + return c; +} +#endif Index: xotcl/library/store/XOTclSdbm/xotclsdbm.c =================================================================== diff -u --- xotcl/library/store/XOTclSdbm/xotclsdbm.c (revision 0) +++ xotcl/library/store/XOTclSdbm/xotclsdbm.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,405 @@ +/* + * xotclsdbm.c + * + * based on Tclndbm 0.5 by John Ellson (ellson@lucent.com) + */ + +#include +#include +#include "sdbm.h" +#include +#include + +#if (TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<1) +# define TclObjStr(obj) Tcl_GetStringFromObj(obj, ((int*)NULL)) +#else +# define TclObjStr(obj) Tcl_GetString(obj) +#endif + +/* + * a database .. + */ + +typedef struct db_s { + int mode; + DBM *db; +} db_t ; + +static int +XOTclSdbmOpenMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + int mode; + db_t *db; + XOTcl_Object* obj = (XOTcl_Object *) cd; +/* + int i; + fprintf(stderr, "Method=XOTclSdbmOpenMethod\n"); + for (i=0; i< objc; i++) + fprintf(stderr, " objv[%d]=%s\n",i,TclObjStr(objv[i])); +*/ + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 2) + return XOTclObjErrArgCnt(in, obj->cmdName, "open filename"); + + /* + * check mode string if given + * + mode = O_RDONLY ; + if (argc == 3) { + + if (strcmp(argv[2],"r")==0) + mode = O_RDONLY ; + else if (strcmp(argv[2],"rw")==0) + mode = O_RDWR | O_SYNC ; + else if (strcmp(argv[2],"rwc")==0) + mode = O_CREAT | O_RDWR | O_SYNC ; + else if (strcmp(argv[2],"rwn")==0) + mode = O_CREAT | O_EXCL | O_RDWR | O_SYNC ; + else { + sprintf(buf, BAD_MODE, argv[0], argv[2]); + Tcl_AppendResult (interp,buf,(char *)0); + return (TCL_ERROR); + } + } + */ + /* Storage interface at the moment assumes mode=rwc */ +#ifdef O_SYNC + mode = O_CREAT | O_RDWR | O_SYNC; +#else + mode = O_CREAT | O_RDWR; +#endif + + /* name not in hashtab - create new db */ + if (XOTclGetObjClientData(obj)) + return XOTclVarErrMsg(in, "Called open on '", TclObjStr(obj->cmdName), + "', but open database was not closed before.", 0); + + db = (db_t*) ckalloc (sizeof(db_t)); + + /* + * create new name and malloc space for it + * malloc extra space for name + db->name = (char *) malloc (strlen(buf)+1) ; + if (!db->name) { + perror ("malloc for name in db_open"); + exit (-1); + } + strcpy(db->name,buf); + */ + + db->mode = mode; + db->db = sdbm_open(TclObjStr(objv[1]), mode, 0644); + + if (!db->db) { + /* + * error occurred + * free previously allocated memory + */ + /*ckfree ((char*) db->name);*/ + ckfree ((char*) db); + db = (db_t*) NULL ; + + return XOTclVarErrMsg(in, "Open on '", TclObjStr(obj->cmdName), + "' failed with '", TclObjStr(objv[1]),"'.", 0); + } else { + /* + * success + */ + XOTclSetObjClientData(obj, (ClientData) db); + return TCL_OK; + } +} + +static int +XOTclSdbmCloseMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + db_t *db; + XOTcl_Object* obj = (XOTcl_Object *) cd; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 1) + return XOTclObjErrArgCnt(in, obj->cmdName, "close"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called close on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + sdbm_close (db->db); + + /*ckfree((char*)db->name);*/ + ckfree ((char*)db); + XOTclSetObjClientData(obj, 0); + + return TCL_OK; +} + +static int +XOTclSdbmNamesMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *) cd; + Tcl_Obj *list; + db_t *db; + Tcl_DString result; + datum key; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 1) + return XOTclObjErrArgCnt(in, obj->cmdName, "names"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called names on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + Tcl_DStringInit(&result); + + key = sdbm_firstkey(db->db); + if (!key.dptr) { + /* empty db */ + return TCL_OK ; + } + + /* + * copy key to result and go to next key + */ + list = Tcl_NewListObj(0, NULL); + do { + Tcl_ListObjAppendElement(in,list,Tcl_NewStringObj(key.dptr,key.dsize-1)); + key = sdbm_nextkey(db->db); + } while (key.dptr); + Tcl_SetObjResult(in, list); + + return TCL_OK; +} + +static int +XOTclSdbmSetMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *) cd; + db_t *db; + datum key, content; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc <2 || objc > 3) + return XOTclObjErrArgCnt(in, obj->cmdName, "set key ?value?"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called set on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + + key.dptr = TclObjStr(objv[1]); + key.dsize = objv[1]->length + 1; + + if (objc == 2) { + /* get value */ + content = sdbm_fetch(db->db,key); + if (content.dptr) { + /* found */ + Tcl_Obj *r = Tcl_NewStringObj(content.dptr, content.dsize-1); + Tcl_SetObjResult(in, r); + } else { + /* key not found */ + return XOTclVarErrMsg(in, "no such variable '", key.dptr, + "'", 0); + } + } else { + /* set value */ + if (db->mode == O_RDONLY) { + return XOTclVarErrMsg(in, "Trying to set '", TclObjStr(obj->cmdName), + "', but database is in read mode.", 0); + } + content.dptr = TclObjStr(objv[2]); + content.dsize = objv[2]->length + 1; + if (sdbm_store(db->db, key, content, SDBM_REPLACE) == 0) { + /*fprintf(stderr,"setting %s to '%s'\n",key.dptr,content.dptr);*/ + Tcl_SetObjResult(in, objv[2]); + } else { + return XOTclVarErrMsg(in, "set of variable '", TclObjStr(obj->cmdName), + "' failed.", 0); + } + } + return TCL_OK; +} + +static int +XOTclSdbmExistsMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *) cd; + db_t *db; + datum key, content; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 2) + return XOTclObjErrArgCnt(in, obj->cmdName, "exists variable"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called exists on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + + key.dptr = TclObjStr(objv[1]); + key.dsize = objv[1]->length + 1; + + content = sdbm_fetch(db->db,key); + Tcl_SetIntObj(Tcl_GetObjResult(in), content.dptr != NULL); + + return TCL_OK; +} + + + +static int +XOTclSdbmUnsetMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *) cd; + db_t *db; + datum key; + int ret; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 2) + return XOTclObjErrArgCnt(in, obj->cmdName, "unset key"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called unset on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + /* check for read mode */ + if (db->mode == O_RDONLY) { + return XOTclVarErrMsg(in, "Called unset on '", TclObjStr(obj->cmdName), + "', but database is in read mode.", 0); + } + + key.dptr = TclObjStr(objv[1]); + key.dsize = objv[1]->length + 1; + + ret = sdbm_delete(db->db, key); + + if (ret == 0) { + return TCL_OK; + } else { + return XOTclVarErrMsg(in, "Tried to unset '", TclObjStr(objv[1]), + "' but key does not exist.", 0); + } +} + +/* + * ndbm_firstkey + */ + +static int +XOTclSdbmFirstKeyMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *) cd; + db_t *db; + datum key; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 1) + return XOTclObjErrArgCnt(in, obj->cmdName, "firstkey"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called unset on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + + + key = sdbm_firstkey(db->db); + if (!key.dptr) { + /* + * empty db + */ + return TCL_OK; + } + + Tcl_AppendResult (in, key.dptr, (char*)0); + return TCL_OK; +} + +static int +XOTclSdbmNextKeyMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj* CONST objv[]) { + XOTcl_Object* obj = (XOTcl_Object *) cd; + db_t *db; + datum newkey; + + if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (objc != 1) + return XOTclObjErrArgCnt(in, obj->cmdName, "nextkey"); + + db = (db_t*) XOTclGetObjClientData(obj); + if (!db) + return XOTclVarErrMsg(in, "Called unset on '", TclObjStr(obj->cmdName), + "', but database was not opened yet.", 0); + + newkey = sdbm_nextkey(db->db); + + if (!newkey.dptr) { + /* + * empty db + */ + return TCL_OK ; + } + + Tcl_AppendResult (in, newkey.dptr, (char*)0); + return TCL_OK ; +} + +/* + * Xotclsdbm_Init + * register commands, init data structures + */ + +/* this should be done via the stubs ... for the time being + simply export */ +#ifdef VISUAL_CC +DLLEXPORT extern int Xotclsdbm_Init(Tcl_Interp * in); +#endif + +extern int +Xotclsdbm_Init(Tcl_Interp * in) { + XOTcl_Class* cl; + int result; + +#ifdef USE_TCL_STUBS + if (Tcl_InitStubs(in, "8.1", 0) == NULL) { + return TCL_ERROR; + } +# ifdef USE_XOTCL_STUBS + if (Xotcl_InitStubs(in, "1.1", 0) == NULL) { + return TCL_ERROR; + } +# endif +#else + if (Tcl_PkgRequire(in, "Tcl", TCL_VERSION, 0) == NULL) { + return TCL_ERROR; + } +#endif + Tcl_PkgProvide(in, "xotcl::store::sdbm", PACKAGE_VERSION); + +#ifdef PACKAGE_REQUIRE_XOTCL_FROM_SLAVE_INTERP_WORKS_NOW + if (Tcl_PkgRequire(in, "XOTcl", XOTCLVERSION, 0) == NULL) { + return TCL_ERROR; + } +#endif + if (Tcl_PkgRequire(in, "xotcl::store", 0, 0) == NULL) { + return TCL_ERROR; + } + result = Tcl_VarEval (in, + "Class Storage=Sdbm -superclass Storage", + (char*) 0); + if (result != TCL_OK) + return result; + + cl = XOTclGetClass(in, "Storage=Sdbm"); + XOTclAddIMethod(in, cl, "open", XOTclSdbmOpenMethod, 0, 0); + XOTclAddIMethod(in, cl, "close", XOTclSdbmCloseMethod, 0, 0); + XOTclAddIMethod(in, cl, "set", XOTclSdbmSetMethod, 0, 0); + XOTclAddIMethod(in, cl, "exists", XOTclSdbmExistsMethod, 0, 0); + XOTclAddIMethod(in, cl, "names", XOTclSdbmNamesMethod, 0, 0); + XOTclAddIMethod(in, cl, "unset", XOTclSdbmUnsetMethod, 0, 0); + XOTclAddIMethod(in, cl, "firstkey", XOTclSdbmFirstKeyMethod, 0, 0); + XOTclAddIMethod(in, cl, "nextkey", XOTclSdbmNextKeyMethod, 0, 0); + + Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + return TCL_OK; +} + +extern int +Xotclsdbm_SafeInit(interp) + Tcl_Interp *interp; +{ + return Xotclsdbm_Init(interp); +} Index: xotcl/library/store/persistenceExample.xotcl =================================================================== diff -u --- xotcl/library/store/persistenceExample.xotcl (revision 0) +++ xotcl/library/store/persistenceExample.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,63 @@ +#!/usr/local/bin/xotclsh +# $Id: persistenceExample.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# +# load the persistence component +package require xotcl::store::persistence + +# Two example objects +Object o +# set two variables to default values +o set x 1 +o set y 1 + +Object p +# set two variables to default values +p set x 1 +p set y 1 + +#################################### +# now we make these vars persistent +#################################### + + +# 1. we need the PersistenceMgr (for gdbm we have to specify a file +# name). If we want to get rid of the current setting and start again +# we default values, we have to delete this file +PersistenceMgr pmgr -dirName . -fileName example-db + +# 2. we have to make the objects persistent. We register the +# persistence strategy as per-object mixin on the two objects +# +# one uses the lazy, one the eager strategy + +o mixin Persistent=Eager +p mixin Persistent=Lazy + +# 3. tell the objects, which PersistenceMgr to use + +o persistenceMgr pmgr +p persistenceMgr pmgr + +# 4. make the vars persistent + +o persistent {x y} +p persistent {x y} + +##################################### + +# now the vars are loaded from the persistence store +# +# we incr them to demonstrate the persistency; and print the results + +o incr x 2 +o append y 1 +p incr x 3 +p append y 2 + +puts "Values:" +puts " o->x: [o set x]" +puts " o->y: [o set y]" +puts " p->x: [p set x]" +puts " p->y: [p set y]" + +# now run the program several times to see the results \ No newline at end of file Index: xotcl/library/store/pkgIndex-subdir.add =================================================================== diff -u --- xotcl/library/store/pkgIndex-subdir.add (revision 0) +++ xotcl/library/store/pkgIndex-subdir.add (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,10 @@ +set __dir__ $dir +foreach index [glob -nocomplain [file join $dir * pkgIndex.tcl]] { + set dir [file dirname $index] + #puts subdir=$dir,index=$index + source $index +} +set dir $__dir__ +if {[info exists __dir]} {unset __dir__} + + Index: xotcl/library/store/pkgIndex.tcl =================================================================== diff -u --- xotcl/library/store/pkgIndex.tcl (revision 0) +++ xotcl/library/store/pkgIndex.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,28 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex -direct" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded xotcl::store 0.84 [list source [file join $dir Storage.xotcl]] +package ifneeded xotcl::store::jufgdbm 0.81 [list source [file join $dir JufGdbmStorage.xotcl]] +package ifneeded xotcl::store::mem 0.84 [list source [file join $dir MemStorage.xotcl]] +package ifneeded xotcl::store::multi 0.9 [list source [file join $dir MultiStorage.xotcl]] +package ifneeded xotcl::store::persistence 0.8 [list source [file join $dir Persistence.xotcl]] +package ifneeded xotcl::store::tclgdbm 0.84 [list source [file join $dir TclGdbmStorage.xotcl]] +package ifneeded xotcl::store::textfile 0.84 [list source [file join $dir TextFileStorage.xotcl]] + +set __dir__ $dir +foreach index [glob -nocomplain [file join $dir * pkgIndex.tcl]] { + set dir [file dirname $index] + #puts subdir=$dir,index=$index + source $index +} +set dir $__dir__ +if {[info exists __dir]} {unset __dir__} + + Index: xotcl/library/xml/COPYRIGHT =================================================================== diff -u --- xotcl/library/xml/COPYRIGHT (revision 0) +++ xotcl/library/xml/COPYRIGHT (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,41 @@ + * XOTcl - Extended OTcl + * + * Copyright (C) 1999-2001 Gustaf Neumann (a), Uwe Zdun (b) + * + * (a) Vienna University of Economics and Business Administration + * Dept. of Information Systems / New Media + * A-1090, Augasse 2-6 + * Vienna, Austria + * + * (b) University of Essen + * Specification of Software Systems + * Altendorferstra�e 97-101 + * D-45143 Essen, Germany + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation. We make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * + * This software is based upon MIT Object Tcl by David Wetherall and + * Christopher J. Lindblad, that contains the following copyright + * message: + * + * "Copyright 1993 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty." + Index: xotcl/library/xml/TclExpat-1.1/Makefile =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/Makefile (revision 0) +++ xotcl/library/xml/TclExpat-1.1/Makefile (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,431 @@ +# Makefile.in -- +# +# This file is a Makefile for Sample TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# Copyright (c) 2002-2003 ActiveState Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#======================================================================== +# Add additional lines to handle any additional AC_SUBST cases that +# have been added in a customized configure script. +#======================================================================== + +#SAMPLE_NEW_VAR = @SAMPLE_NEW_VAR@ + +#======================================================================== +# Nothing of the variables below this line should need to be changed. +# Please check the TARGETS section below to make sure the make targets +# are correct. +#======================================================================== + +#======================================================================== +# The names of the source files is defined in the configure script. +# The object files are used for linking into the final library. +# This will be used when a dist target is added to the Makefile. +# It is not important to specify the directory, as long as it is the +# $(srcdir) or in the generic, win or unix subdirectory. +#======================================================================== + +PKG_SOURCES = xmltok.c unixfilemap.c xmlrole.c xmlwf.c codepage.c xmlparse.c hashtable.c tclexpat.c +PKG_OBJECTS = xmltok.o unixfilemap.o xmlrole.o xmlwf.o codepage.o xmlparse.o hashtable.o tclexpat.o + +PKG_STUB_SOURCES = +PKG_STUB_OBJECTS = + +#======================================================================== +# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with +# this package that need to be installed, if any. +#======================================================================== + +PKG_TCL_SOURCES = + +#======================================================================== +# This is a list of public header files to be installed, if any. +#======================================================================== + +PKG_HEADERS = + +#======================================================================== +# "PKG_LIB_FILE" refers to the library (dynamic or static as per +# configuration options) composed of the named objects. +#======================================================================== + +PKG_LIB_FILE = libxotclexpat0.9.so +PKG_STUB_LIB_FILE = libxotclexpatstub0.9.a + +lib_BINARIES = $(PKG_LIB_FILE) +BINARIES = $(lib_BINARIES) + +SHELL = /bin/sh + +srcdir = . +prefix = /usr +exec_prefix = /usr + +bindir = ${exec_prefix}/bin +libdir = ${exec_prefix}/lib +datadir = ${prefix}/share +mandir = ${prefix}/man +includedir = ${prefix}/include + +DESTDIR = + +PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) +pkgdatadir = $(datadir)/$(PKG_DIR) +pkglibdir = $(libdir)/$(PKG_DIR) +pkgincludedir = $(includedir)/$(PKG_DIR) + +top_builddir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL} + +PACKAGE_NAME = xotclexpat +PACKAGE_VERSION = 0.9 +CC = gcc -pipe +CFLAGS_DEFAULT = -O +CFLAGS_WARNING = -Wall -Wconversion -Wno-implicit-int +CLEANFILES = pkgIndex.tcl +EXEEXT = +LDFLAGS_DEFAULT = -rdynamic +MAKE_LIB = ${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS} +MAKE_SHARED_LIB = ${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS} +MAKE_STATIC_LIB = ${STLIB_LD} $@ $(PKG_OBJECTS) +MAKE_STUB_LIB = ${STLIB_LD} $@ $(PKG_STUB_OBJECTS) +OBJEXT = o +RANLIB = : +RANLIB_STUB = ranlib +SHLIB_CFLAGS = -fPIC +SHLIB_LD = gcc -pipe -shared +SHLIB_LD_FLAGS = +SHLIB_LD_LIBS = ${LIBS} -L/usr/lib -ltclstub8.4 +STLIB_LD = ${AR} cr +TCL_DEFS = -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOLL=1 -DHAVE_STRTOULL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DPEEK_XCLOSEIM=1 -DHAVE_SYS_IOCTL_H=1 +TCL_BIN_DIR = /usr/lib +TCL_SRC_DIR = /home/neumann/tcl8.4.5 +# This is necessary for packages that use private Tcl headers +#TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@ +# Not used, but retained for reference of what libs Tcl required +TCL_LIBS = ${DL_LIBS} ${LIBS} ${MATH_LIBS} + +#======================================================================== +# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our +# package without installing. The other environment variables allow us +# to test against an uninstalled Tcl. Add special env vars that you +# require for testing here (like TCLX_LIBRARY). +#======================================================================== + +EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR) +TCLSH_ENV = TCL_LIBRARY=`echo $(TCL_SRC_DIR)/library` \ + LD_LIBRARY_PATH="$(EXTRA_PATH):$(LD_LIBRARY_PATH)" \ + PATH="$(EXTRA_PATH):$(PATH)" \ + TCLLIBPATH="$(top_builddir)" +TCLSH_PROG = /usr/lib/../bin/tclsh8.4 +TCLSH = $(TCLSH_ENV) $(TCLSH_PROG) +SHARED_BUILD = 1 + +INCLUDES = -I/home/neumann/xotcl-1.2.1/generic -I"/usr/include" + +EXTRA_CFLAGS = + +# TCL_DEFS is not strictly need here, but if you remove it, then you +# must make sure that configure.in checks for the necessary components +# that your library may use. TCL_DEFS can actually be a problem if +# you do not compile with a similar machine setup as the Tcl core was +# compiled with. +#DEFS = $(TCL_DEFS) -DPACKAGE_NAME=\"xotclexpat\" -DPACKAGE_TARNAME=\"xotclexpat\" -DPACKAGE_VERSION=\"0.9\" -DPACKAGE_STRING=\"xotclexpat\ 0.9\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS=1 $(EXTRA_CFLAGS) +DEFS = -DPACKAGE_NAME=\"xotclexpat\" -DPACKAGE_TARNAME=\"xotclexpat\" -DPACKAGE_VERSION=\"0.9\" -DPACKAGE_STRING=\"xotclexpat\ 0.9\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS=1 $(EXTRA_CFLAGS) + +CONFIG_CLEAN_FILES = Makefile + +CPPFLAGS = +LIBS = -L/home/neumann/xotcl-1.2.1 -lxotclstub1.2.1 +AR = ar +CFLAGS = ${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries doc + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: $(BINARIES) pkgIndex.tcl + +libraries: + +doc: + @echo "If you have documentation to create, place the commands to" + @echo "build the docs in the 'doc:' target. For example:" + @echo " xml2nroff sample.xml > sample.n" + @echo " xml2html sample.xml > sample.html" + +install: all install-binaries install-libraries install-doc + +install-binaries: binaries install-lib-binaries install-bin-binaries + if test "x$(SHARED_BUILD)" = "x1"; then \ + $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir); \ + fi + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== + +install-libraries: libraries + @mkdir -p $(DESTDIR)$(includedir) + @echo "Installing header files in $(DESTDIR)$(includedir)" + @for i in $(PKG_HEADERS) ; do \ + echo "Installing $(srcdir)/$$i" ; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \ + done; + +#======================================================================== +# Install documentation. Unix manpages should go in the $(mandir) +# directory. +#======================================================================== + +install-doc: doc +#install-doc: doc +# @mkdir -p $(DESTDIR)$(mandir)/mann +# @echo "Installing documentation in $(DESTDIR)$(mandir)" +# @for i in $(srcdir)/doc/*.n; do \ +# echo "Installing $$i"; \ +# rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \ +# $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \ +# done + +test: binaries libraries + $(TCLSH) `echo $(srcdir)/tests/all.tcl` $(TESTFLAGS) + +shell: binaries libraries + @$(TCLSH) $(SCRIPT) + +gdb: + $(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT) + +depend: + +#======================================================================== +# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable +# mentioned above. That will ensure that this target is built when you +# run "make binaries". +# +# The $(PKG_OBJECTS) objects are created and linked into the final +# library. In most cases these object files will correspond to the +# source files above. +#======================================================================== + +$(PKG_LIB_FILE): $(PKG_OBJECTS) + -rm -f $(PKG_LIB_FILE) + ${MAKE_LIB} + $(RANLIB) $(PKG_LIB_FILE) + +$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS) + -rm -f $(PKG_STUB_LIB_FILE) + ${MAKE_STUB_LIB} + $(RANLIB_STUB) $(PKG_STUB_LIB_FILE) + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# sample.$(OBJEXT): $(srcdir)/generic/sample.c +# $(COMPILE) -c `echo $(srcdir)/generic/sample.c` -o $@ +# +# Setting the VPATH variable to a list of paths will cause the makefile +# to look into these paths when resolving .c to .obj dependencies. +# As necessary, add $(srcdir):$(srcdir)/compat:.... +#======================================================================== + +VPATH = $(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win + +.c.o: + $(COMPILE) -c `echo $<` -o $@ + +#======================================================================== +# Create the pkgIndex.tcl file. +# It is usually easiest to let Tcl do this for you with pkg_mkIndex, but +# you may find that you need to customize the package. If so, either +# modify the -hand version, or create a pkgIndex.tcl.in file and have +# the configure script output the pkgIndex.tcl by editing configure.in. +#======================================================================== + +pkgIndex.tcl: + ( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(TCLSH) + +pkgIndex.tcl-hand: + (echo 'package ifneeded xotcl::xml::expat $(PACKAGE_VERSION) \ + [list load [file join $$dir $(PKG_LIB_FILE)]]'\ + ) > pkgIndex.tcl + +#======================================================================== +# Distribution creation +# You may need to tweak this target to make it work correctly. +#======================================================================== + +#COMPRESS = tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar +COMPRESS = gtar zcvf $(PKG_DIR).tar.gz $(PKG_DIR) +DIST_ROOT = /tmp/dist +DIST_DIR = $(DIST_ROOT)/$(PKG_DIR) + +dist-clean: + rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.* + +dist: dist-clean + mkdir -p $(DIST_DIR) + cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license* \ + $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/*.in \ + $(DIST_DIR)/ + chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4 + chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in + + cp -p $(srcdir)/*.[ch] $(DIST_DIR)/ + + mkdir $(DIST_DIR)/tclconfig + cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \ + $(DIST_DIR)/tclconfig/ + chmod 664 $(DIST_DIR)/tclconfig/tcl.m4 + chmod +x $(DIST_DIR)/tclconfig/install-sh + + list='demos doc generic library mac tests unix win'; \ + for p in $$list; do \ + if test -d $(srcdir)/$$p ; then \ + mkdir $(DIST_DIR)/$$p; \ + cp -p $(srcdir)/$$p/*.* $(DIST_DIR)/$$p/; \ + fi; \ + done + + (cd $(DIST_ROOT); $(COMPRESS);) + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + -test -z "$(BINARIES)" || rm -f $(BINARIES) + -rm -f *.$(OBJEXT) core *.core + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean: clean + -rm -f *.tab.c + -rm -f $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log config.status + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Library files go into the lib directory. +# In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: + @mkdir -p $(DESTDIR)$(pkglibdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \ + stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \ + if test "x$$stub" = "xstub"; then \ + echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \ + else \ + echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \ + fi; \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \ + fi; \ + fi; \ + fi; \ + done + @list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + destp=`basename $$p`; \ + echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \ + fi; \ + done + +#======================================================================== +# Install binary executables (e.g. .exe files and dependent .dll files) +# This is for files that must go in the bin directory (located next to +# wish and tclsh), like dependent .dll files on Windows. +# +# You should not have to modify this target, except to define bin_BINARIES +# above if necessary. +#======================================================================== + +install-bin-binaries: + @mkdir -p $(DESTDIR)$(bindir) + @list='$(bin_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \ + fi; \ + done + +.SUFFIXES: .c .$(OBJEXT) + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +uninstall-binaries: + list='$(lib_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + p=`basename $$p`; \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(bin_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/$$p; \ + done + +.PHONY: all binaries clean depend distclean doc install libraries test + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: xotcl/library/xml/TclExpat-1.1/Makefile.in =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/Makefile.in (revision 0) +++ xotcl/library/xml/TclExpat-1.1/Makefile.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,431 @@ +# Makefile.in -- +# +# This file is a Makefile for Sample TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# Copyright (c) 2002-2003 ActiveState Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile.in,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#======================================================================== +# Add additional lines to handle any additional AC_SUBST cases that +# have been added in a customized configure script. +#======================================================================== + +#SAMPLE_NEW_VAR = @SAMPLE_NEW_VAR@ + +#======================================================================== +# Nothing of the variables below this line should need to be changed. +# Please check the TARGETS section below to make sure the make targets +# are correct. +#======================================================================== + +#======================================================================== +# The names of the source files is defined in the configure script. +# The object files are used for linking into the final library. +# This will be used when a dist target is added to the Makefile. +# It is not important to specify the directory, as long as it is the +# $(srcdir) or in the generic, win or unix subdirectory. +#======================================================================== + +PKG_SOURCES = @PKG_SOURCES@ +PKG_OBJECTS = @PKG_OBJECTS@ + +PKG_STUB_SOURCES = @PKG_STUB_SOURCES@ +PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@ + +#======================================================================== +# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with +# this package that need to be installed, if any. +#======================================================================== + +PKG_TCL_SOURCES = @PKG_TCL_SOURCES@ + +#======================================================================== +# This is a list of public header files to be installed, if any. +#======================================================================== + +PKG_HEADERS = @PKG_HEADERS@ + +#======================================================================== +# "PKG_LIB_FILE" refers to the library (dynamic or static as per +# configuration options) composed of the named objects. +#======================================================================== + +PKG_LIB_FILE = @PKG_LIB_FILE@ +PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@ + +lib_BINARIES = $(PKG_LIB_FILE) +BINARIES = $(lib_BINARIES) + +SHELL = @SHELL@ + +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +libdir = @libdir@ +datadir = @datadir@ +mandir = @mandir@ +includedir = @includedir@ + +DESTDIR = + +PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) +pkgdatadir = $(datadir)/$(PKG_DIR) +pkglibdir = $(libdir)/$(PKG_DIR) +pkgincludedir = $(includedir)/$(PKG_DIR) + +top_builddir = . + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ + +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +CC = @CC@ +CFLAGS_DEFAULT = @CFLAGS_DEFAULT@ +CFLAGS_WARNING = @CFLAGS_WARNING@ +CLEANFILES = @CLEANFILES@ +EXEEXT = @EXEEXT@ +LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@ +MAKE_LIB = @MAKE_LIB@ +MAKE_SHARED_LIB = @MAKE_SHARED_LIB@ +MAKE_STATIC_LIB = @MAKE_STATIC_LIB@ +MAKE_STUB_LIB = @MAKE_STUB_LIB@ +OBJEXT = @OBJEXT@ +RANLIB = @RANLIB@ +RANLIB_STUB = @RANLIB_STUB@ +SHLIB_CFLAGS = @SHLIB_CFLAGS@ +SHLIB_LD = @SHLIB_LD@ +SHLIB_LD_FLAGS = @SHLIB_LD_FLAGS@ +SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ +STLIB_LD = @STLIB_LD@ +TCL_DEFS = @TCL_DEFS@ +TCL_BIN_DIR = @TCL_BIN_DIR@ +TCL_SRC_DIR = @TCL_SRC_DIR@ +# This is necessary for packages that use private Tcl headers +#TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@ +# Not used, but retained for reference of what libs Tcl required +TCL_LIBS = @TCL_LIBS@ + +#======================================================================== +# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our +# package without installing. The other environment variables allow us +# to test against an uninstalled Tcl. Add special env vars that you +# require for testing here (like TCLX_LIBRARY). +#======================================================================== + +EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR) +TCLSH_ENV = TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \ + @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \ + PATH="$(EXTRA_PATH):$(PATH)" \ + TCLLIBPATH="$(top_builddir)" +TCLSH_PROG = @TCLSH_PROG@ +TCLSH = $(TCLSH_ENV) $(TCLSH_PROG) +SHARED_BUILD = @SHARED_BUILD@ + +INCLUDES = @PKG_INCLUDES@ @TCL_INCLUDES@ + +EXTRA_CFLAGS = @EXTRA_CFLAGS@ @PKG_CFLAGS@ + +# TCL_DEFS is not strictly need here, but if you remove it, then you +# must make sure that configure.in checks for the necessary components +# that your library may use. TCL_DEFS can actually be a problem if +# you do not compile with a similar machine setup as the Tcl core was +# compiled with. +#DEFS = $(TCL_DEFS) @DEFS@ $(EXTRA_CFLAGS) +DEFS = @DEFS@ $(EXTRA_CFLAGS) + +CONFIG_CLEAN_FILES = Makefile + +CPPFLAGS = @CPPFLAGS@ +LIBS = @PKG_LIBS@ @LIBS@ +AR = ar +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries doc + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: $(BINARIES) pkgIndex.tcl + +libraries: + +doc: + @echo "If you have documentation to create, place the commands to" + @echo "build the docs in the 'doc:' target. For example:" + @echo " xml2nroff sample.xml > sample.n" + @echo " xml2html sample.xml > sample.html" + +install: all install-binaries install-libraries install-doc + +install-binaries: binaries install-lib-binaries install-bin-binaries + if test "x$(SHARED_BUILD)" = "x1"; then \ + $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir); \ + fi + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== + +install-libraries: libraries + @mkdir -p $(DESTDIR)$(includedir) + @echo "Installing header files in $(DESTDIR)$(includedir)" + @for i in $(PKG_HEADERS) ; do \ + echo "Installing $(srcdir)/$$i" ; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \ + done; + +#======================================================================== +# Install documentation. Unix manpages should go in the $(mandir) +# directory. +#======================================================================== + +install-doc: doc +#install-doc: doc +# @mkdir -p $(DESTDIR)$(mandir)/mann +# @echo "Installing documentation in $(DESTDIR)$(mandir)" +# @for i in $(srcdir)/doc/*.n; do \ +# echo "Installing $$i"; \ +# rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \ +# $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \ +# done + +test: binaries libraries + $(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS) + +shell: binaries libraries + @$(TCLSH) $(SCRIPT) + +gdb: + $(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT) + +depend: + +#======================================================================== +# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable +# mentioned above. That will ensure that this target is built when you +# run "make binaries". +# +# The $(PKG_OBJECTS) objects are created and linked into the final +# library. In most cases these object files will correspond to the +# source files above. +#======================================================================== + +$(PKG_LIB_FILE): $(PKG_OBJECTS) + -rm -f $(PKG_LIB_FILE) + ${MAKE_LIB} + $(RANLIB) $(PKG_LIB_FILE) + +$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS) + -rm -f $(PKG_STUB_LIB_FILE) + ${MAKE_STUB_LIB} + $(RANLIB_STUB) $(PKG_STUB_LIB_FILE) + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# sample.$(OBJEXT): $(srcdir)/generic/sample.c +# $(COMPILE) -c `@CYGPATH@ $(srcdir)/generic/sample.c` -o $@ +# +# Setting the VPATH variable to a list of paths will cause the makefile +# to look into these paths when resolving .c to .obj dependencies. +# As necessary, add $(srcdir):$(srcdir)/compat:.... +#======================================================================== + +VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win + +.c.@OBJEXT@: + $(COMPILE) -c `@CYGPATH@ $<` -o $@ + +#======================================================================== +# Create the pkgIndex.tcl file. +# It is usually easiest to let Tcl do this for you with pkg_mkIndex, but +# you may find that you need to customize the package. If so, either +# modify the -hand version, or create a pkgIndex.tcl.in file and have +# the configure script output the pkgIndex.tcl by editing configure.in. +#======================================================================== + +pkgIndex.tcl: + ( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(TCLSH) + +pkgIndex.tcl-hand: + (echo 'package ifneeded xotcl::xml::expat $(PACKAGE_VERSION) \ + [list load [file join $$dir $(PKG_LIB_FILE)]]'\ + ) > pkgIndex.tcl + +#======================================================================== +# Distribution creation +# You may need to tweak this target to make it work correctly. +#======================================================================== + +#COMPRESS = tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar +COMPRESS = gtar zcvf $(PKG_DIR).tar.gz $(PKG_DIR) +DIST_ROOT = /tmp/dist +DIST_DIR = $(DIST_ROOT)/$(PKG_DIR) + +dist-clean: + rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.* + +dist: dist-clean + mkdir -p $(DIST_DIR) + cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license* \ + $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/*.in \ + $(DIST_DIR)/ + chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4 + chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in + + cp -p $(srcdir)/*.[ch] $(DIST_DIR)/ + + mkdir $(DIST_DIR)/tclconfig + cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \ + $(DIST_DIR)/tclconfig/ + chmod 664 $(DIST_DIR)/tclconfig/tcl.m4 + chmod +x $(DIST_DIR)/tclconfig/install-sh + + list='demos doc generic library mac tests unix win'; \ + for p in $$list; do \ + if test -d $(srcdir)/$$p ; then \ + mkdir $(DIST_DIR)/$$p; \ + cp -p $(srcdir)/$$p/*.* $(DIST_DIR)/$$p/; \ + fi; \ + done + + (cd $(DIST_ROOT); $(COMPRESS);) + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + -test -z "$(BINARIES)" || rm -f $(BINARIES) + -rm -f *.$(OBJEXT) core *.core + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean: clean + -rm -f *.tab.c + -rm -f $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log config.status + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Library files go into the lib directory. +# In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: + @mkdir -p $(DESTDIR)$(pkglibdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \ + stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \ + if test "x$$stub" = "xstub"; then \ + echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \ + else \ + echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \ + fi; \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \ + fi; \ + fi; \ + fi; \ + done + @list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + destp=`basename $$p`; \ + echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \ + fi; \ + done + +#======================================================================== +# Install binary executables (e.g. .exe files and dependent .dll files) +# This is for files that must go in the bin directory (located next to +# wish and tclsh), like dependent .dll files on Windows. +# +# You should not have to modify this target, except to define bin_BINARIES +# above if necessary. +#======================================================================== + +install-bin-binaries: + @mkdir -p $(DESTDIR)$(bindir) + @list='$(bin_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \ + fi; \ + done + +.SUFFIXES: .c .$(OBJEXT) + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +uninstall-binaries: + list='$(lib_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + p=`basename $$p`; \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(bin_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/$$p; \ + done + +.PHONY: all binaries clean depend distclean doc install libraries test + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: xotcl/library/xml/TclExpat-1.1/Makefile.in-ok =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/Makefile.in-ok (revision 0) +++ xotcl/library/xml/TclExpat-1.1/Makefile.in-ok (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,390 @@ +# Makefile.in -- +# +# This file is a Makefile for Sample TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile.in-ok,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#======================================================================== +# Edit the following few lines when writing a new extension +#======================================================================== + +configdir=$(srcdir)/../../../config + +#======================================================================== +# Change the name of the variable "exampleA_LIB_FILE" to match the one +# used in the configure script. This is the parameterized name of the +# library that we are building. +#======================================================================== + +lib_BINARIES= +BINARIES= + +#======================================================================== +# Enumerate the names of the source files included in this package. +# This will be used when a dist target is added to the Makefile. +#======================================================================== + +#xotclexpat_SOURCES = +#SOURCES = $(xotclexpat_SOURCES) + +#======================================================================== +# Enumerate the names of the object files included in this package. +# These objects are created and linked into the final library. In +# most cases these object files will correspond to the source files +# above. +# +#======================================================================== + +FILEMAP_OBJ=unixfilemap.$(OBJEXT) +#FILEMAP_OBJ=readfilemap.$(OBJEXT) + +xotclexpat_OBJECTS = xmltok.$(OBJEXT) \ + xmlrole.$(OBJEXT) \ + xmlwf.$(OBJEXT) \ + codepage.$(OBJEXT) \ + xmlparse.$(OBJEXT) \ + hashtable.$(OBJEXT) \ + $(FILEMAP_OBJ) \ + tclexpat.$(OBJEXT) +OBJECTS = $(xotclexpat_OBJECTS) + +#======================================================================== +# The substitution of "exampleA_LIB_FILE" into the variable name below +# let's us refer to the objects for the library without knowing the name +# of the library in advance. It also lets us use the "$@" variable in +# the rule for building the library, so we can refer to both the list of +# objects and the library itself in a platform-independent manner. +#======================================================================== + +xotclexpat_LIB_FILE = @xotclexpat_LIB_FILE@ +$(xotclexpat_LIB_FILE)_OBJECTS = $(xotclexpat_OBJECTS) + +#======================================================================== +# This is a list of header files to be installed +#======================================================================== + +GENERIC_HDRS= + +#======================================================================== +# Add additional lines to handle any additional AC_SUBST cases that +# have been added to the configure script. +#======================================================================== + +SAMPLE_NEW_VAR=@SAMPLE_NEW_VAR@ + +#======================================================================== +# Nothing of the variables below this line need to be changed. Please +# check the TARGETS section below to make sure the make targets are +# correct. +#======================================================================== + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_FLAG = +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +CC = @CC@ +CFLAGS_DEBUG = @CFLAGS_DEBUG@ +CFLAGS_DEFAULT = @CFLAGS_DEFAULT@ +CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ +CLEANFILES = @CLEANFILES@ +EXEEXT = @EXEEXT@ +LDFLAGS_DEBUG = @LDFLAGS_DEBUG@ +LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@ +LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ +MAKE_LIB = @MAKE_LIB@ +MAKE_SHARED_LIB = @MAKE_SHARED_LIB@ +MAKE_STATIC_LIB = @MAKE_STATIC_LIB@ +OBJEXT = @OBJEXT@ +RANLIB = @RANLIB@ +SHLIB_CFLAGS = @SHLIB_CFLAGS@ +SHLIB_LD = @SHLIB_LD@ +SHLIB_LDFLAGS = @SHLIB_LDFLAGS@ +SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ +STLIB_LD = @STLIB_LD@ +TCL_BIN_DIR = @TCL_BIN_DIR@ +TCL_DEFS = @TCL_DEFS@ +TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@ +TCL_LD_FLAGS = @TCL_LD_FLAGS@ +TCL_LIBS = @TCL_LIBS@ +TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ +TCL_SRC_DIR = @TCL_SRC_DIR@ +TCL_DBGX = @TCL_DBGX@ +TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ +TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ +TCL_TOOL_DIR_NATIVE = @TCL_TOOL_DIR_NATIVE@ +TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@ +TCL_UNIX_DIR_NATIVE = @TCL_UNIX_DIR_NATIVE@ +TCL_WIN_DIR_NATIVE = @TCL_WIN_DIR_NATIVE@ +INCLUDE_DIR_NATIVE = @INCLUDE_DIR_NATIVE@ +TCL_BMAP_DIR_NATIVE = @TCL_BMAP_DIR_NATIVE@ +TCL_PLATFORM_DIR_NATIVE = @TCL_PLATFORM_DIR_NATIVE@ +TCL_GENERIC_DIR_NATIVE = @TCL_GENERIC_DIR_NATIVE@ +TCLSH_PROG = @TCLSH_PROG@ + +AUTOCONF = autoconf + +LDFLAGS = $(LDFLAGS_DEFAULT) + +INCLUDES = @TCL_INCLUDES@ + +EXTRA_CFLAGS = $(TCL_DEFS) $(PROTO_FLAGS) $(SECURITY_FLAGS) $(MEM_DEBUG_FLAGS) $(KEYSYM_FLAGS) $(NO_DEPRECATED_FLAGS) + +DEFS = @DEFS@ $(EXTRA_CFLAGS) + +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(configdir)/mkinstalldirs +CONFIG_CLEAN_FILES = $(configdir)/mkIndex.tcl + +CPPFLAGS = @CPPFLAGS@ +LIBS = @LIBS@ +AR = ar +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -I. -I@XOTCL_SRC_DIR@/generic + +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries doc + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: + +libraries: $(srcdir)/../$(xotclexpat_LIB_FILE) + +doc: + +install: install-binaries install-libraries install-doc + +install-binaries: binaries install-lib-binaries install-bin-binaries + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== + +install-libraries: libraries $(DESTDIR)$(includedir) + @if test ! -z $(GENERIC_HDRS) ; then \ + echo "Installing header files in $(DESTDIR)$(includedir)" ; \ + fi + @for i in $(GENERIC_HDRS) ; do \ + echo "Installing $$i" ; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(includedir) ; \ + done; + +#======================================================================== +# Install documentation. Unix manpages should go in the $(mandir) +# directory. +#======================================================================== + +install-doc: + +test: + +depend: + +#======================================================================== +# Enumerate the names of the object files included in this package. +# These objects are created and linked into the final library. In +# most cases these object files will correspond to the source files +# above. +# +# $(exampleA_LIB_FILE) should be listed as part of the BINARIES variable +# at the top of the Makefile. That will ensure that this target is built +# when you run "make binaries". +# +# You shouldn't need to modify this target, except to change the package +# name from "exampleA" to your package's name. +#======================================================================== + +$(xotclexpat_LIB_FILE): $(xotclexpat_OBJECTS) + rm -f $@ + @MAKE_LIB@ + $(RANLIB) $@ + +$(srcdir)/../$(xotclexpat_LIB_FILE): $(xotclexpat_LIB_FILE) + cp $< $@ +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# Unfortunately, there does not seem to be any other way to do this +# in a Makefile-independent way. We can't use VPATH because it picks up +# object files that may be located in the source directory. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# exampleA.$(OBJEXT): $(srcdir)/src/win/exampleA.c +# $(COMPILE) -c `@CYGPATH@ $(srcdir)/src/win/exampleA.c` -o $@ +#======================================================================== + +%.o: $(srcdir)/%.c + $(COMPILE) -c `@CYGPATH@ $<` -o $@ + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + @rm -f $(xotclexpat_LIB_FILE) $(srcdir)/../$(xotclexpat_LIB_FILE) \ + *.o core *.core *.$(OBJEXT) $(CLEANFILES) expat/*/*.o expat/*/*.so \ + core so_locations gmon.out *~ \#* config.log + +distclean: clean + -rm -f *.tab.c + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -rm -f config.status + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Additionally, the .dll files go into the bin directory, but the .lib +# files go into the lib directory. On Unix platforms, all library files +# go into the lib directory. In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh8.2 shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p; \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(libdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(libdir)/$$lib; \ + fi; \ + else \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ + fi; \ + else :; fi; \ + done + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(RANLIB) $(DESTDIR)$(bindir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(bindir)/$$p; \ + else :; fi; \ + done +# $(TCLSH_PROG) $(configdir)/mkIndex.tcl + +#======================================================================== +# Install binary executables (e.g. .exe files) +# +# You should not have to modify this target. +#======================================================================== + +install-bin-binaries: $(DESTDIR)$(bindir) + @list='$(BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(bindir)/$$p; \ + else :; fi; \ + done + +.SUFFIXES: .c .o .obj + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + + +uninstall-binaries: + @$(NORMAL_UNINSTALL) + list='$(BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +$(DESTDIR)$(includedir): + $(mkinstalldirs) $@ +$(DESTDIR)$(libdir): + $(mkinstalldirs) $@ +$(DESTDIR)$(bindir): + $(mkinstalldirs) $@ + +.PHONY: all binaries clean depend distclean doc install libraries test + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: xotcl/library/xml/TclExpat-1.1/Makefile.vc =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/Makefile.vc (revision 0) +++ xotcl/library/xml/TclExpat-1.1/Makefile.vc (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,238 @@ +###################################################################### +# +# XOTclExpat Makefile for Visual C++ +# +###################################################################### + +# Be sure to adapt the "configs.vc" file in the toplevel directory +# to your system settings. +!include "..\..\..\win\configs.vc" + +BINROOT = . +ROOT = .. +NAMEPREFIX = lib +NAME = xotclexpat +XOTCL_DIR = ..\..\.. +GENERICDIR = . +WINDIR = . + +###################################################################### + +!if $(DEBUG) +TMPNAME = Debug +DBGX = d +!else +TMPNAME = Release +DBGX = +!endif + +TMP_DIR = $(BINROOT)\$(TMPNAME) +OUT_DIR = $(TMP_DIR) + +!if $(STATIC_BUILD) +OUTNAME = $(NAMEPREFIX)$(NAME)$(XOTCL_VERSION)$(DBGX) +TARGET = "$(OUT_DIR)\$(OUTNAME).lib" +!else +OUTNAME = $(NAMEPREFIX)$(NAME)$(XOTCL_VERSION)$(DBGX) +IMPLIB = "$(OUT_DIR)\$(OUTNAME).lib" +TARGET = "$(OUT_DIR)\$(OUTNAME).dll" +!endif + +TCLSTUBLIB = "$(TCLROOT)\win\Release\tclstub$(TCL_VERSION).lib" +TCLIMPLIB = "$(TCLROOT)\win\$(OUT_DIR)\tcl$(TCL_VERSION)$(DBGX).lib" +TCLSH = "$(TCLROOT)\win\$(OUT_DIR)\tclsh$(TCL_VERSION)$(DBGX).exe" + +XOTCLSTUBLIB = "$(XOTCL_DIR)\win\Release\libxotclstub$(XOTCL_VERSION).lib" +XOTCLIMPLIB = "$(XOTCL_DIR)\win\$(OUT_DIR)\libxotcl$(XOTCL_VERSION)$(DBGX).lib" + +LIB_INSTALL_DIR = $(INSTALLDIR)\lib +BIN_INSTALL_DIR = $(INSTALLDIR)\bin +SCRIPT_INSTALL_DIR = $(INSTALLDIR)\lib\xotcl$(XOTCL_VERSION) +INCLUDE_INSTALL_DIR = $(INSTALLDIR)\include + +OBJS = $(TMP_DIR)\xmltok.obj \ + $(TMP_DIR)\xmlrole.obj \ + $(TMP_DIR)\xmlwf.obj \ + $(TMP_DIR)\codepage.obj \ + $(TMP_DIR)\xmlparse.obj \ + $(TMP_DIR)\hashtable.obj \ + $(TMP_DIR)\win32filemap.obj \ + $(TMP_DIR)\tclexpat.obj \ +!if $(STATIC_BUILD) == 0 + $(TMP_DIR)\dllEntryPoint.obj +!endif + +###################################################################### +# Link flags +###################################################################### + +!if $(DEBUG) +ldebug = -debug:full -debugtype:cv -pdb:none +!else +ldebug = -release -opt:ref +!endif + +# declarations common to all linker options +lcommon = -nologo -link50compat -machine:$(MACHINE) + +LFLAGS = $(lcommon) -subsystem:windows -dll + +!if $(USE_TCL_STUBS) == 0 +LLIBS = $(TCLIMPLIB) $(XOTCLIMPLIB) +!else +### should be: +### LLIBS = $(TCLSTUBLIB) $(XOTCLSTUBLIB) when xotcl stub lib is mature +### LLIBS = $(TCLSTUBLIB) $(XOTCLIMPLIB) +LLIBS = $(TCLSTUBLIB) $(XOTCLSTUBLIB) +!endif + +###################################################################### +# Compile flags +###################################################################### + +!IF $(DEBUG) == 0 +!IF "$(MACHINE)" == "ALPHA" +# MSVC on Alpha doesn't understand -Ot +cdebug = -O2i +!ELSE +cdebug = -Ox +!ENDIF +!ELSE +!if $(MSDEV_VER) < 6 +cdebug = -Zi -Od -WX +!else +cdebug = -ZI -Od -WX +!endif +!ENDIF + +!if $(STATIC_BUILD) +cdll = +!else +cdll = -GD +!endif + +# declarations common to all compiler options +ccommon = -nologo -c -W3 -YX \ + + +!if $(STATIC_BUILD) && $(NOMSVCRT) +crt = -MT$(DBGX) +!else +crt = -MD$(DBGX) +!endif + +INCLUDES = -I"$(TCLROOT)\generic" -I"$(XOTCL_DIR)\generic" -I"." + +DEFINES = -DBUILD_$(NAME) -DTCL_THREADS=1 \ + -DXOLIBPKG=$(INST_XOLIBPKG) \ + -DXOTCLVERSION=$(XOTCLVERSION) \ + -DVERSION=$(XOTCLVERSION) \ + -DXOTCLPATCHLEVEL=$(XOTCLPATCHLEVEL) \ + -D__WIN32__ -DVISUAL_CC + +EXE_CFLAGS = $(ccommon) $(cdebug) $(crt) $(cdll) $(INCLUDES) $(DEFINES) + +!if $(USE_TCL_STUBS) +#CFLAGS = $(EXE_CFLAGS) -DUSE_TCL_STUBS +CFLAGS = $(EXE_CFLAGS) -DUSE_TCL_STUBS -DUSE_XOTCL_STUBS +!else +CFLAGS = $(EXE_CFLAGS) +!endif + +###################################################################### +# Project specific targets +###################################################################### + +all : libs + +libs : setup $(TARGET) + copy $(TARGET) .. + +setup : + @$(vcvars) > nul + @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) &\ + echo Created directory '$(TMP_DIR)' + @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) &\ + echo Created directory '$(OUT_DIR)' + +$(TARGET) : $(OBJS) +!if $(STATIC_BUILD) + $(lib32) -nologo -machine:$(MACHINE) -out:$@ @<< +!else + $(link32) $(LFLAGS) -base:@$(XOTCL_DIR)\win\dllBase.txt,$@ -out:$@ $(LLIBS) @<< +!endif + $(OBJS) +<< + + +install : all + if not exist "$(INSTALLDIR)" mkdir "$(INSTALLDIR)" + if not exist "$(BIN_INSTALL_DIR)" mkdir "$(BIN_INSTALL_DIR)" + if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" + if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" + if not exist "$(INCLUDE_INSTALL_DIR)" mkdir "$(INCLUDE_INSTALL_DIR)" + copy $(TARGET) "$(SCRIPT_INSTALL_DIR)" + +###################################################################### +# Inference rules. Use batch-mode when supported. +###################################################################### + +!if $(_NMAKE_VER) < 162 +{$(WINDIR)}.c{$(TMP_DIR)}.obj : +!else +{$(WINDIR)}.c{$(TMP_DIR)}.obj :: +!endif + $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$(TMP_DIR)\ @<< +$< +<< + +!if $(_NMAKE_VER) < 162 +{$(GENERICDIR)}.c{$(TMP_DIR)}.obj : +!else +{$(GENERICDIR)}.c{$(TMP_DIR)}.obj :: +!endif + $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$(TMP_DIR)\ @<< +$< +<< + +#$(TMP_DIR)\xmltok.obj : expat\xmltok\xmltok.c +# $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$@ $? +#$(TMP_DIR)\xmlrole.obj : expat\xmltok\xmlrole.c +# $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$@ $? +#$(TMP_DIR)\xmlwf.obj : expat\xmlwf\xmlwf.c +# $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$@ $? +#$(TMP_DIR)\readfilemap.obj : expat\xmlwf\readfilemap.c +# $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$@ $? +#$(TMP_DIR)\codepage.obj : expat\xmlwf\codepage.c +# $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$@ $? +#$(TMP_DIR)\xmlparse.obj : expat\xmlparse\xmlparse.c +# $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$@ $? +#$(TMP_DIR)\hashtable.obj : expat\xmlparse\hashtable.c +# $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$@ $? + +#{$(RCDIR)}.rc{$(TMP_DIR)}.res : +# $(rc32) -fo $@ -DDEBUG=$(DEBUG) $(XOTCL_VERSION_DEFINES) $(XOTCL_INCLUDES) $(TCL_INCLUDES) $(XOTCL_DEFINES) $< + +###################################################################### +# Clean up +###################################################################### + +tidy : + -del $(TMP_DIR)\*.pch + -del $(TMP_DIR)\*.obj + -del $(TMP_DIR)\*.res + -del .\*.pch + -del .\*.pdb + +clean : tidy + -del $(OUT_DIR)\*.exp + -del $(OUT_DIR)\*.lib + -del $(OUT_DIR)\*.dll + -del ..\*.exp + -del ..\*.lib + -del ..\*.dll + +distclean : clean + -rmdir $(OUT_DIR) + -rmdir $(TMP_DIR) + Index: xotcl/library/xml/TclExpat-1.1/aclocal.m4 =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/aclocal.m4 (revision 0) +++ xotcl/library/xml/TclExpat-1.1/aclocal.m4 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,3 @@ +builtin(include,xotcl.m4) +builtin(include,tcl.m4) + Index: xotcl/library/xml/TclExpat-1.1/asciitab.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/asciitab.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/asciitab.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,52 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, +/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, +/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, +/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, +/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, +/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, +/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, +/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, +/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_NMSTRT, BT_SEMI, +/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, +/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, +/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, +/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, +/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, +/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, +/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, +/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, +/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, Index: xotcl/library/xml/TclExpat-1.1/codepage.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/codepage.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/codepage.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,77 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#include "codepage.h" + +#ifdef WIN32 +#include + +int codepageMap(int cp, int *map) +{ + int i; + CPINFO info; + if (!GetCPInfo(cp, &info) || info.MaxCharSize > 2) + return 0; + for (i = 0; i < 256; i++) + map[i] = -1; + if (info.MaxCharSize > 1) { + for (i = 0; i < MAX_LEADBYTES; i++) { + int j, lim; + if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0) + break; + lim = info.LeadByte[i + 1]; + for (j = info.LeadByte[i]; j < lim; j++) + map[j] = -2; + } + } + for (i = 0; i < 256; i++) { + if (map[i] == -1) { + char c = i; + unsigned short n; + if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, + &c, 1, &n, 1) == 1) + map[i] = n; + } + } + return 1; +} + +int codepageConvert(int cp, const char *p) +{ + unsigned short c; + if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, + p, 2, &c, 1) == 1) + return c; + return -1; +} + +#else /* not WIN32 */ + +int codepageMap(int cp, int *map) +{ + return 0; +} + +int codepageConvert(int cp, const char *p) +{ + return -1; +} + +#endif /* not WIN32 */ Index: xotcl/library/xml/TclExpat-1.1/codepage.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/codepage.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/codepage.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,22 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +int codepageMap(int cp, int *map); +int codepageConvert(int cp, const char *p); Index: xotcl/library/xml/TclExpat-1.1/config.log =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/config.log (revision 0) +++ xotcl/library/xml/TclExpat-1.1/config.log (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1026 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by xotclexpat configure 0.9, which was +generated by GNU Autoconf 2.57. Invocation command line was + + $ ./configure --prefix=/usr --enable-threads --prefix=/usr --with-all --cache-file=/dev/null --srcdir=. + +## --------- ## +## Platform. ## +## --------- ## + +hostname = localhost.localdomain +uname -m = i686 +uname -r = 2.4.22-1.2188.nptl +uname -s = Linux +uname -v = #1 Wed Apr 21 20:36:05 EDT 2004 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = i686 +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: . +PATH: /home/neumann/bin +PATH: . +PATH: /home/neumann/bin +PATH: /usr/local/bin +PATH: /usr/bin +PATH: /bin +PATH: /usr/X11R6/bin +PATH: /usr/X11R6/bin +PATH: /sbin +PATH: /usr/sbin +PATH: /opt/bin +PATH: /usr/X11R6/bin +PATH: /sbin +PATH: /usr/sbin +PATH: /opt/bin + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:1294: checking for correct TEA configuration +configure:1313: result: ok +configure:1433: checking for Tcl configuration +configure:1505: result: found /usr/lib/tclConfig.sh +configure:1511: checking for existence of /usr/lib/tclConfig.sh +configure:1515: result: loading +configure:1670: checking for gcc +configure:1686: found /usr/bin/gcc +configure:1696: result: gcc +configure:1940: checking for C compiler version +configure:1943: gcc --version &5 +gcc (GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1) +Copyright (C) 2003 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:1946: $? = 0 +configure:1948: gcc -v &5 +Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/specs +Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux +Thread model: posix +gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1) +configure:1951: $? = 0 +configure:1953: gcc -V &5 +gcc: `-V' option must have argument +configure:1956: $? = 1 +configure:1980: checking for C compiler default output +configure:1983: gcc conftest.c >&5 +configure:1986: $? = 0 +configure:2032: result: a.out +configure:2037: checking whether the C compiler works +configure:2043: ./a.out +configure:2046: $? = 0 +configure:2063: result: yes +configure:2070: checking whether we are cross compiling +configure:2072: result: no +configure:2075: checking for suffix of executables +configure:2077: gcc -o conftest conftest.c >&5 +configure:2080: $? = 0 +configure:2105: result: +configure:2111: checking for suffix of object files +configure:2133: gcc -c conftest.c >&5 +configure:2136: $? = 0 +configure:2158: result: o +configure:2162: checking whether we are using the GNU C compiler +configure:2187: gcc -c conftest.c >&5 +configure:2190: $? = 0 +configure:2193: test -s conftest.o +configure:2196: $? = 0 +configure:2209: result: yes +configure:2215: checking whether gcc accepts -g +configure:2237: gcc -c -g conftest.c >&5 +configure:2240: $? = 0 +configure:2243: test -s conftest.o +configure:2246: $? = 0 +configure:2257: result: yes +configure:2274: checking for gcc option to accept ANSI C +configure:2335: gcc -c conftest.c >&5 +configure:2338: $? = 0 +configure:2341: test -s conftest.o +configure:2344: $? = 0 +configure:2362: result: none needed +configure:2380: gcc -c conftest.c >&5 +conftest.c:2: error: syntax error before "me" +configure:2383: $? = 1 +configure: failed program was: +| #ifndef __cplusplus +| choke me +| #endif +configure:2497: checking how to run the C preprocessor +configure:2533: gcc -E conftest.c +configure:2539: $? = 0 +configure:2571: gcc -E conftest.c +configure:2570:28: ac_nonexistent.h: No such file or directory +configure:2577: $? = 1 +configure: failed program was: +| #line 2562 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclexpat" +| #define PACKAGE_TARNAME "xotclexpat" +| #define PACKAGE_VERSION "0.9" +| #define PACKAGE_STRING "xotclexpat 0.9" +| #define PACKAGE_BUGREPORT "" +| /* end confdefs.h. */ +| #include +configure:2615: result: gcc -E +configure:2640: gcc -E conftest.c +configure:2646: $? = 0 +configure:2678: gcc -E conftest.c +configure:2677:28: ac_nonexistent.h: No such file or directory +configure:2684: $? = 1 +configure: failed program was: +| #line 2669 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclexpat" +| #define PACKAGE_TARNAME "xotclexpat" +| #define PACKAGE_VERSION "0.9" +| #define PACKAGE_STRING "xotclexpat 0.9" +| #define PACKAGE_BUGREPORT "" +| /* end confdefs.h. */ +| #include +configure:2739: checking for a BSD-compatible install +configure:2793: result: /usr/bin/install -c +configure:2809: checking whether make sets $(MAKE) +configure:2829: result: yes +configure:2884: checking for ranlib +configure:2900: found /usr/bin/ranlib +configure:2911: result: ranlib +configure:2933: checking for egrep +configure:2943: result: grep -E +configure:2948: checking for ANSI C header files +configure:2974: gcc -c conftest.c >&5 +configure:2977: $? = 0 +configure:2980: test -s conftest.o +configure:2983: $? = 0 +configure:3072: gcc -o conftest conftest.c >&5 +configure:3075: $? = 0 +configure:3077: ./conftest +configure:3080: $? = 0 +configure:3095: result: yes +configure:3119: checking for sys/types.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for sys/stat.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for stdlib.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for string.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for memory.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for strings.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for inttypes.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for stdint.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3119: checking for unistd.h +configure:3136: gcc -c conftest.c >&5 +configure:3139: $? = 0 +configure:3142: test -s conftest.o +configure:3145: $? = 0 +configure:3156: result: yes +configure:3178: checking if the compiler understands -pipe +configure:3199: gcc -pipe -c conftest.c >&5 +configure:3202: $? = 0 +configure:3205: test -s conftest.o +configure:3208: $? = 0 +configure:3210: result: yes +configure:3228: checking for required early compiler flags +configure:3252: gcc -pipe -c conftest.c >&5 +configure:3255: $? = 0 +configure:3258: test -s conftest.o +configure:3261: $? = 0 +configure:3338: gcc -pipe -c conftest.c >&5 +configure: In function `main': +configure:3343: error: storage size of `buf' isn't known +configure:3341: $? = 1 +configure: failed program was: +| #line 3321 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclexpat" +| #define PACKAGE_TARNAME "xotclexpat" +| #define PACKAGE_VERSION "0.9" +| #define PACKAGE_STRING "xotclexpat 0.9" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| /* end confdefs.h. */ +| #include +| int +| main () +| { +| struct stat64 buf; int i = stat64("/", &buf); +| ; +| return 0; +| } +configure:3372: gcc -pipe -c conftest.c >&5 +configure:3375: $? = 0 +configure:3378: test -s conftest.o +configure:3381: $? = 0 +configure:3407: result: _LARGEFILE64_SOURCE +configure:3412: checking for 64-bit integer type +configure:3435: gcc -pipe -c conftest.c >&5 +configure: In function `main': +configure:3441: error: `__int64' undeclared (first use in this function) +configure:3441: error: (Each undeclared identifier is reported only once +configure:3441: error: for each function it appears in.) +configure:3441: error: syntax error before "value" +configure:3438: $? = 1 +configure: failed program was: +| #line 3418 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclexpat" +| #define PACKAGE_TARNAME "xotclexpat" +| #define PACKAGE_VERSION "0.9" +| #define PACKAGE_STRING "xotclexpat 0.9" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| /* end confdefs.h. */ +| +| int +| main () +| { +| __int64 value = (__int64) 0; +| ; +| return 0; +| } +configure:3471: gcc -pipe -o conftest conftest.c >&5 +configure:3474: $? = 0 +configure:3476: ./conftest +configure:3479: $? = 0 +configure:3507: result: long long +configure:3511: checking for struct dirent64 +configure:3535: gcc -pipe -c conftest.c >&5 +configure:3538:24: sys/dirent.h: No such file or directory +configure: In function `main': +configure:3542: error: storage size of `p' isn't known +configure:3538: $? = 1 +configure: failed program was: +| #line 3517 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclexpat" +| #define PACKAGE_TARNAME "xotclexpat" +| #define PACKAGE_VERSION "0.9" +| #define PACKAGE_STRING "xotclexpat 0.9" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| /* end confdefs.h. */ +| #include +| #include +| int +| main () +| { +| struct dirent64 p; +| ; +| return 0; +| } +configure:3562: result: no +configure:3565: checking for struct stat64 +configure:3589: gcc -pipe -c conftest.c >&5 +configure:3592: $? = 0 +configure:3595: test -s conftest.o +configure:3598: $? = 0 +configure:3616: result: yes +configure:3619: checking for off64_t +configure:3643: gcc -pipe -c conftest.c >&5 +configure:3646: $? = 0 +configure:3649: test -s conftest.o +configure:3652: $? = 0 +configure:3670: result: yes +configure:3674: checking whether byte ordering is bigendian +configure:3702: gcc -pipe -c conftest.c >&5 +configure:3705: $? = 0 +configure:3708: test -s conftest.o +configure:3711: $? = 0 +configure:3736: gcc -pipe -c conftest.c >&5 +configure: In function `main': +configure:3743: error: `not' undeclared (first use in this function) +configure:3743: error: (Each undeclared identifier is reported only once +configure:3743: error: for each function it appears in.) +configure:3743: error: syntax error before "big" +configure:3739: $? = 1 +configure: failed program was: +| #line 3714 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclexpat" +| #define PACKAGE_TARNAME "xotclexpat" +| #define PACKAGE_VERSION "0.9" +| #define PACKAGE_STRING "xotclexpat 0.9" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| #include +| #include +| +| int +| main () +| { +| #if BYTE_ORDER != BIG_ENDIAN +| not big endian +| #endif +| +| ; +| return 0; +| } +configure:3859: result: no +configure:3887: checking for sin +configure:3937: gcc -pipe -o conftest conftest.c >&5 +configure:3930: warning: conflicting types for built-in function `sin' +/tmp/ccY0yOcH.o(.text+0x16): In function `main': +: undefined reference to `sin' +/tmp/ccY0yOcH.o(.data+0x0): undefined reference to `sin' +collect2: ld returned 1 exit status +configure:3940: $? = 1 +configure: failed program was: +| #line 3892 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclexpat" +| #define PACKAGE_TARNAME "xotclexpat" +| #define PACKAGE_VERSION "0.9" +| #define PACKAGE_STRING "xotclexpat 0.9" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| /* System header to define __stub macros and hopefully few prototypes, +| which can conflict with char sin (); below. +| Prefer to if __STDC__ is defined, since +| exists even on freestanding compilers. */ +| #ifdef __STDC__ +| # include +| #else +| # include +| #endif +| /* Override any gcc2 internal prototype to avoid an error. */ +| #ifdef __cplusplus +| extern "C" +| { +| #endif +| /* We use char because int might match the return type of a gcc2 +| builtin and then its argument prototype would still apply. */ +| char sin (); +| /* The GNU C library defines this for functions which it implements +| to always fail with ENOSYS. Some functions are actually named +| something starting with __ and the normal name is an alias. */ +| #if defined (__stub_sin) || defined (__stub___sin) +| choke me +| #else +| char (*f) () = sin; +| #endif +| #ifdef __cplusplus +| } +| #endif +| +| int +| main () +| { +| return f != sin; +| ; +| return 0; +| } +configure:3957: result: no +configure:3965: checking for main in -lieee +configure:3990: gcc -pipe -o conftest conftest.c -lieee >&5 +configure:3993: $? = 0 +configure:3996: test -s conftest +configure:3999: $? = 0 +configure:4011: result: yes +configure:4023: checking for main in -linet +configure:4048: gcc -pipe -o conftest conftest.c -linet >&5 +/usr/bin/ld: cannot find -linet +collect2: ld returned 1 exit status +configure:4051: $? = 1 +configure: failed program was: +| #line 4030 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclexpat" +| #define PACKAGE_TARNAME "xotclexpat" +| #define PACKAGE_VERSION "0.9" +| #define PACKAGE_STRING "xotclexpat 0.9" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| +| +| int +| main () +| { +| main (); +| ; +| return 0; +| } +configure:4069: result: no +configure:4085: checking net/errno.h usability +configure:4098: gcc -pipe -c conftest.c >&5 +configure:4143:23: net/errno.h: No such file or directory +configure:4101: $? = 1 +configure: failed program was: +| #line 4087 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclexpat" +| #define PACKAGE_TARNAME "xotclexpat" +| #define PACKAGE_VERSION "0.9" +| #define PACKAGE_STRING "xotclexpat 0.9" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| #include +| #if HAVE_SYS_TYPES_H +| # include +| #endif +| #if HAVE_SYS_STAT_H +| # include +| #endif +| #if STDC_HEADERS +| # include +| # include +| #else +| # if HAVE_STDLIB_H +| # include +| # endif +| #endif +| #if HAVE_STRING_H +| # if !STDC_HEADERS && HAVE_MEMORY_H +| # include +| # endif +| # include +| #endif +| #if HAVE_STRINGS_H +| # include +| #endif +| #if HAVE_INTTYPES_H +| # include +| #else +| # if HAVE_STDINT_H +| # include +| # endif +| #endif +| #if HAVE_UNISTD_H +| # include +| #endif +| #include +configure:4117: result: no +configure:4121: checking net/errno.h presence +configure:4132: gcc -E conftest.c +configure:4145:23: net/errno.h: No such file or directory +configure:4138: $? = 1 +configure: failed program was: +| #line 4123 "configure" +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "xotclexpat" +| #define PACKAGE_TARNAME "xotclexpat" +| #define PACKAGE_VERSION "0.9" +| #define PACKAGE_STRING "xotclexpat 0.9" +| #define PACKAGE_BUGREPORT "" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define _LARGEFILE64_SOURCE 1 +| #define TCL_WIDE_INT_TYPE long long +| #define HAVE_STRUCT_STAT64 1 +| #define HAVE_TYPE_OFF64_T 1 +| /* end confdefs.h. */ +| #include +configure:4157: result: no +configure:4193: checking for net/errno.h +configure:4200: result: no +configure:4232: checking for connect +configure:4282: gcc -pipe -o conftest conftest.c >&5 +configure:4285: $? = 0 +configure:4288: test -s conftest +configure:4291: $? = 0 +configure:4302: result: yes +configure:4531: checking for gethostbyname +configure:4581: gcc -pipe -o conftest conftest.c >&5 +configure:4584: $? = 0 +configure:4587: test -s conftest +configure:4590: $? = 0 +configure:4601: result: yes +configure:4675: checking dirent.h +configure:4713: gcc -pipe -o conftest conftest.c >&5 +configure:4716: $? = 0 +configure:4719: test -s conftest +configure:4722: $? = 0 +configure:4740: result: yes +configure:4752: checking errno.h usability +configure:4765: gcc -pipe -c conftest.c >&5 +configure:4768: $? = 0 +configure:4771: test -s conftest.o +configure:4774: $? = 0 +configure:4784: result: yes +configure:4788: checking errno.h presence +configure:4799: gcc -E conftest.c +configure:4805: $? = 0 +configure:4824: result: yes +configure:4860: checking for errno.h +configure:4867: result: yes +configure:4891: checking float.h usability +configure:4904: gcc -pipe -c conftest.c >&5 +configure:4907: $? = 0 +configure:4910: test -s conftest.o +configure:4913: $? = 0 +configure:4923: result: yes +configure:4927: checking float.h presence +configure:4938: gcc -E conftest.c +configure:4944: $? = 0 +configure:4963: result: yes +configure:4999: checking for float.h +configure:5006: result: yes +configure:5030: checking values.h usability +configure:5043: gcc -pipe -c conftest.c >&5 +configure:5046: $? = 0 +configure:5049: test -s conftest.o +configure:5052: $? = 0 +configure:5062: result: yes +configure:5066: checking values.h presence +configure:5077: gcc -E conftest.c +configure:5083: $? = 0 +configure:5102: result: yes +configure:5138: checking for values.h +configure:5145: result: yes +configure:5169: checking limits.h usability +configure:5182: gcc -pipe -c conftest.c >&5 +configure:5185: $? = 0 +configure:5188: test -s conftest.o +configure:5191: $? = 0 +configure:5201: result: yes +configure:5205: checking limits.h presence +configure:5216: gcc -E conftest.c +configure:5222: $? = 0 +configure:5241: result: yes +configure:5277: checking for limits.h +configure:5284: result: yes +configure:5299: checking for stdlib.h +configure:5304: result: yes +configure:5495: checking for string.h +configure:5500: result: yes +configure:5687: checking sys/wait.h usability +configure:5700: gcc -pipe -c conftest.c >&5 +configure:5703: $? = 0 +configure:5706: test -s conftest.o +configure:5709: $? = 0 +configure:5719: result: yes +configure:5723: checking sys/wait.h presence +configure:5734: gcc -E conftest.c +configure:5740: $? = 0 +configure:5759: result: yes +configure:5795: checking for sys/wait.h +configure:5802: result: yes +configure:5826: checking dlfcn.h usability +configure:5839: gcc -pipe -c conftest.c >&5 +configure:5842: $? = 0 +configure:5845: test -s conftest.o +configure:5848: $? = 0 +configure:5858: result: yes +configure:5862: checking dlfcn.h presence +configure:5873: gcc -E conftest.c +configure:5879: $? = 0 +configure:5898: result: yes +configure:5934: checking for dlfcn.h +configure:5941: result: yes +configure:5967: checking for limits.h +configure:5972: result: yes +configure:5967: checking for unistd.h +configure:5972: result: yes +configure:5976: checking sys/param.h usability +configure:5989: gcc -pipe -c conftest.c >&5 +configure:5992: $? = 0 +configure:5995: test -s conftest.o +configure:5998: $? = 0 +configure:6008: result: yes +configure:6012: checking sys/param.h presence +configure:6023: gcc -E conftest.c +configure:6029: $? = 0 +configure:6048: result: yes +configure:6084: checking for sys/param.h +configure:6091: result: yes +configure:6139: checking for XOTcl configuration +configure:6200: result: found /home/neumann/xotcl-1.2.1/xotclConfig.sh +configure:6206: checking for existence of /home/neumann/xotcl-1.2.1/xotclConfig.sh +configure:6210: result: loading +configure:6379: checking for Tcl public headers +configure:6434: result: /usr/include +configure:6482: checking for pthread_mutex_init in -lpthread +configure:6513: gcc -pipe -o conftest conftest.c -lpthread >&5 +configure:6516: $? = 0 +configure:6519: test -s conftest +configure:6522: $? = 0 +configure:6534: result: yes +configure:6821: checking for pthread_attr_setstacksize +configure:6871: gcc -pipe -o conftest conftest.c -lpthread >&5 +configure:6874: $? = 0 +configure:6877: test -s conftest +configure:6880: $? = 0 +configure:6891: result: yes +configure:6906: checking for readdir_r +configure:6956: gcc -pipe -o conftest conftest.c >&5 +configure:6959: $? = 0 +configure:6962: test -s conftest +configure:6965: $? = 0 +configure:6976: result: yes +configure:6991: checking for building with threads +configure:6998: result: yes +configure:7037: checking how to build libraries +configure:7055: result: shared +configure:7081: checking if 64bit support is enabled +configure:7090: result: no +configure:7095: checking if 64bit Sparc VIS support is requested +configure:7104: result: no +configure:7132: checking system version (for dynamic loading) +configure:7155: result: Linux-2.4.22-1.2188.nptl +configure:7163: checking for dlopen in -ldl +configure:7194: gcc -pipe -o conftest conftest.c -ldl >&5 +configure:7197: $? = 0 +configure:7200: test -s conftest +configure:7203: $? = 0 +configure:7215: result: yes +configure:7245: checking for ar +configure:7261: found /usr/bin/ar +configure:7271: result: ar +configure:9157: checking for build with symbols +configure:9171: result: no +configure:9306: checking for tclsh +configure:9337: result: /usr/lib/../bin/tclsh8.4 +configure:9481: creating ./config.status + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by xotclexpat config.status 0.9, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on localhost.localdomain + +config.status:675: creating Makefile + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_c_bigendian=no +ac_cv_c_compiler_gnu=yes +ac_cv_c_tclconfig=/usr/lib +ac_cv_c_tclh=/usr/include +ac_cv_c_xotclconfig=/home/neumann/xotcl-1.2.1 +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_exeext= +ac_cv_func_connect=yes +ac_cv_func_gethostbyname=yes +ac_cv_func_pthread_attr_setstacksize=yes +ac_cv_func_readdir_r=yes +ac_cv_func_sin=no +ac_cv_header_dlfcn_h=yes +ac_cv_header_errno_h=yes +ac_cv_header_float_h=yes +ac_cv_header_inttypes_h=yes +ac_cv_header_limits_h=yes +ac_cv_header_memory_h=yes +ac_cv_header_net_errno_h=no +ac_cv_header_stdc=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_sys_param_h=yes +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_sys_wait_h=yes +ac_cv_header_unistd_h=yes +ac_cv_header_values_h=yes +ac_cv_lib_dl_dlopen=yes +ac_cv_lib_ieee_main=yes +ac_cv_lib_inet_main=no +ac_cv_lib_pthread_pthread_mutex_init=yes +ac_cv_objext=o +ac_cv_path_install='/usr/bin/install -c' +ac_cv_path_tclsh=/usr/lib/../bin/tclsh8.4 +ac_cv_prog_AR=ar +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_ac_ct_RANLIB=ranlib +ac_cv_prog_cc_g=yes +ac_cv_prog_cc_stdc= +ac_cv_prog_egrep='grep -E' +ac_cv_prog_make_make_set=yes +tcl_cv_flag__isoc99_source=no +tcl_cv_flag__largefile64_source=yes +tcl_cv_struct_dirent64=no +tcl_cv_struct_stat64=yes +tcl_cv_type_64bit='long long' +tcl_cv_type_off64_t=yes + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +AR='ar' +CC='gcc -pipe' +CFLAGS=' ${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}' +CFLAGS_DEBUG='-g' +CFLAGS_DEFAULT='-O' +CFLAGS_OPTIMIZE='-O' +CFLAGS_WARNING='-Wall -Wconversion -Wno-implicit-int' +CLEANFILES='pkgIndex.tcl' +CPP='gcc -E' +CPPFLAGS='' +CYGPATH='echo' +DEFS='-DPACKAGE_NAME=\"xotclexpat\" -DPACKAGE_TARNAME=\"xotclexpat\" -DPACKAGE_VERSION=\"0.9\" -DPACKAGE_STRING=\"xotclexpat\ 0.9\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS=1 ' +DL_LIBS='-ldl' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='grep -E' +EXEEXT='' +EXTRA_CFLAGS='' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +LDFLAGS='-rdynamic' +LDFLAGS_DEBUG='' +LDFLAGS_DEFAULT='-rdynamic' +LDFLAGS_OPTIMIZE='' +LD_LIBRARY_PATH_VAR='LD_LIBRARY_PATH' +LIBOBJS='' +LIBS='' +LTLIBOBJS='' +MAKE_LIB='${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS} ' +MAKE_SHARED_LIB='${SHLIB_LD} -o $@ $(PKG_OBJECTS) ${SHLIB_LD_FLAGS} ${SHLIB_LD_LIBS}' +MAKE_STATIC_LIB='${STLIB_LD} $@ $(PKG_OBJECTS)' +MAKE_STUB_LIB='${STLIB_LD} $@ $(PKG_STUB_OBJECTS)' +MATH_LIBS='-lieee -lm' +OBJEXT='o' +PACKAGE_BUGREPORT='' +PACKAGE_NAME='xotclexpat' +PACKAGE_STRING='xotclexpat 0.9' +PACKAGE_TARNAME='xotclexpat' +PACKAGE_VERSION='0.9' +PATH_SEPARATOR=':' +PKG_CFLAGS=' ' +PKG_HEADERS='' +PKG_INCLUDES=' -I/home/neumann/xotcl-1.2.1/generic' +PKG_LIBS=' -L/home/neumann/xotcl-1.2.1 -lxotclstub1.2.1' +PKG_LIB_FILE='libxotclexpat0.9.so' +PKG_OBJECTS=' xmltok.o unixfilemap.o xmlrole.o xmlwf.o codepage.o xmlparse.o hashtable.o tclexpat.o' +PKG_SOURCES=' xmltok.c unixfilemap.c xmlrole.c xmlwf.c codepage.c xmlparse.c hashtable.c tclexpat.c' +PKG_STUB_LIB_FILE='libxotclexpatstub0.9.a' +PKG_STUB_OBJECTS='' +PKG_STUB_SOURCES='' +PKG_TCL_SOURCES='' +RANLIB=':' +RANLIB_STUB='ranlib' +SET_MAKE='' +SHARED_BUILD='1' +SHELL='/bin/sh' +SHLIB_CFLAGS='-fPIC' +SHLIB_LD='gcc -pipe -shared' +SHLIB_LD_FLAGS='' +SHLIB_LD_LIBS='${LIBS} -L/usr/lib -ltclstub8.4' +STLIB_LD='${AR} cr' +TCLSH_PROG='/usr/lib/../bin/tclsh8.4' +TCL_BIN_DIR='/usr/lib' +TCL_DBGX='' +TCL_DEFS=' -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOLL=1 -DHAVE_STRTOULL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DPEEK_XCLOSEIM=1 -DHAVE_SYS_IOCTL_H=1 ' +TCL_EXTRA_CFLAGS='' +TCL_INCLUDES='-I"/usr/include"' +TCL_LD_FLAGS='-rdynamic' +TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' +TCL_LIB_FILE='libtcl8.4.so' +TCL_LIB_FLAG='-ltcl8.4' +TCL_LIB_SPEC='-L/usr/lib -ltcl8.4' +TCL_SHLIB_LD_LIBS='${LIBS}' +TCL_SRC_DIR='/home/neumann/tcl8.4.5' +TCL_STUB_LIB_FILE='libtclstub8.4.a' +TCL_STUB_LIB_FLAG='-ltclstub8.4' +TCL_STUB_LIB_SPEC='-L/usr/lib -ltclstub8.4' +TCL_THREADS='1' +TCL_VERSION='8.4' +XOTCL_BUILD_LIB_SPEC='-L/home/neumann/xotcl-1.2.1 -lxotcl1.2.1' +XOTCL_BUILD_STUB_LIB_SPEC='-L/home/neumann/xotcl-1.2.1 -lxotclstub1.2.1' +XOTCL_LIB_FILE='libxotcl1.2.1.so' +XOTCL_LIB_SPEC='-L/usr/lib -lxotcl1.2.1' +XOTCL_MAJOR_VERSION='1' +XOTCL_MINOR_VERSION='2' +XOTCL_RELEASE_LEVEL='.1' +XOTCL_SRC_DIR='/home/neumann/xotcl-1.2.1' +XOTCL_STUB_LIB_FILE='' +XOTCL_STUB_LIB_SPEC='-L/usr/lib -lxotclstub1.2.1' +XOTCL_VERSION='1.2' +ac_ct_CC='gcc' +ac_ct_RANLIB='ranlib' +bindir='${exec_prefix}/bin' +build_alias='' +datadir='${prefix}/share' +exec_prefix='/usr' +host_alias='' +includedir='${prefix}/include' +infodir='${prefix}/info' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localstatedir='${prefix}/var' +mandir='${prefix}/man' +oldincludedir='/usr/include' +prefix='/usr' +program_transform_name='s,x,x,' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 +#define HAVE_READDIR_R 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRUCT_STAT64 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_TYPE_OFF64_T 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UNISTD_H 1 +#define PACKAGE_BUGREPORT "" +#define PACKAGE_NAME "xotclexpat" +#define PACKAGE_STRING "xotclexpat 0.9" +#define PACKAGE_TARNAME "xotclexpat" +#define PACKAGE_VERSION "0.9" +#define STDC_HEADERS 1 +#define TCL_THREADS 1 +#define TCL_WIDE_INT_TYPE long long +#define USE_TCL_STUBS 1 +#define USE_THREAD_ALLOC 1 +#define _LARGEFILE64_SOURCE 1 +#define _REENTRANT 1 +#define _THREAD_SAFE 1 + +configure: exit 0 Index: xotcl/library/xml/TclExpat-1.1/configure =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/configure (revision 0) +++ xotcl/library/xml/TclExpat-1.1/configure (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,10308 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.57 for xotclexpat 0.9. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='xotclexpat' +PACKAGE_TARNAME='xotclexpat' +PACKAGE_VERSION='0.9' +PACKAGE_STRING='xotclexpat 0.9' +PACKAGE_BUGREPORT='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CYGPATH EXEEXT PKG_LIB_FILE PKG_STUB_LIB_FILE PKG_STUB_SOURCES PKG_STUB_OBJECTS PKG_TCL_SOURCES PKG_HEADERS PKG_INCLUDES PKG_LIBS PKG_CFLAGS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_LIBS TCL_DEFS TCL_EXTRA_CFLAGS TCL_LD_FLAGS TCL_SHLIB_LD_LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB EGREP MATH_LIBS XOTCL_VERSION XOTCL_MAJOR_VERSION XOTCL_MINOR_VERSION XOTCL_RELEASE_LEVEL XOTCL_LIB_FILE XOTCL_BUILD_LIB_SPEC XOTCL_LIB_SPEC XOTCL_STUB_LIB_FILE XOTCL_BUILD_STUB_LIB_SPEC XOTCL_STUB_LIB_SPEC XOTCL_SRC_DIR PKG_SOURCES PKG_OBJECTS CLEANFILES TCL_INCLUDES TCL_THREADS SHARED_BUILD AR LIBOBJS DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING EXTRA_CFLAGS STLIB_LD SHLIB_LD SHLIB_CFLAGS SHLIB_LD_FLAGS SHLIB_LD_LIBS LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LD_LIBRARY_PATH_VAR TCL_DBGX CFLAGS_DEFAULT LDFLAGS_DEFAULT MAKE_LIB MAKE_SHARED_LIB MAKE_STATIC_LIB MAKE_STUB_LIB RANLIB_STUB TCLSH_PROG LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +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 xotclexpat 0.9 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. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of xotclexpat 0.9:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-threads build with threads + --enable-shared build and link with shared libraries --enable-shared + --enable-64bit enable 64bit support (where applicable) + --enable-64bit-vis enable 64bit Sparc VIS support + --enable-wince enable Win/CE support (where applicable) + --disable-load disallow dynamic loading and "load" command + --enable-symbols build with debugging symbols --disable-symbols + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-tcl directory containing tcl configuration (tclConfig.sh) + --with-xotcl directory containing xotcl configuration (xotclConfig.sh) + --with-tclinclude directory containing the public Tcl header files + --with-celib=DIR use Windows/CE support library from DIR + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + 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. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +xotclexpat configure 0.9 +generated by GNU Autoconf 2.57 + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by xotclexpat $as_me 0.9, which was +generated by GNU Autoconf 2.57. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#-------------------------------------------------------------------- +# Call TEA_INIT as the first TEA_ macro to set up initial vars. +# This will define a ${TEA_PLATFORM} variable == "unix" or "windows" +# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. +#-------------------------------------------------------------------- + + + TEA_VERSION="3.0" + + echo "$as_me:$LINENO: checking for correct TEA configuration" >&5 +echo $ECHO_N "checking for correct TEA configuration... $ECHO_C" >&6 + if test x"${PACKAGE_NAME}" = x ; then + { { echo "$as_me:$LINENO: error: +The PACKAGE_NAME variable must be defined by your TEA configure.in" >&5 +echo "$as_me: error: +The PACKAGE_NAME variable must be defined by your TEA configure.in" >&2;} + { (exit 1); exit 1; }; } + fi + if test x"3.0" = x ; then + { { echo "$as_me:$LINENO: error: +TEA version not specified." >&5 +echo "$as_me: error: +TEA version not specified." >&2;} + { (exit 1); exit 1; }; } + elif test "3.0" != "${TEA_VERSION}" ; then + echo "$as_me:$LINENO: result: warning: TEA version \"3.0\" != ${TEA_VERSION}" >&5 +echo "${ECHO_T}warning: TEA version \"3.0\" != ${TEA_VERSION}" >&6 + else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 + fi + case "`uname -s`" in + *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*) + # Extract the first word of "cygpath", so it can be a program name with args. +set dummy cygpath; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CYGPATH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CYGPATH"; then + ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CYGPATH="cygpath -w" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" +fi +fi +CYGPATH=$ac_cv_prog_CYGPATH +if test -n "$CYGPATH"; then + echo "$as_me:$LINENO: result: $CYGPATH" >&5 +echo "${ECHO_T}$CYGPATH" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + EXEEXT=".exe" + TEA_PLATFORM="windows" + ;; + *) + CYGPATH=echo + EXEEXT="" + TEA_PLATFORM="unix" + ;; + esac + + # Check if exec_prefix is set. If not use fall back to prefix + if test x$exec_prefix = xNONE ; then exec_prefix=$prefix ; fi + + + + + # This package name must be replaced statically for AC_SUBST to work + + # Substitute STUB_LIB_FILE in case package creates a stub library too. + + + # We AC_SUBST these here to ensure they are subst'ed, + # in case the user doesn't call TEA_ADD_... + + + + + + + + + +ac_aux_dir= +for ac_dir in ../../../config $srcdir/../../../config; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../../config $srcdir/../../../config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in ../../../config $srcdir/../../../config" >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + + + + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + + if test x"${no_tcl}" = x ; then + # we reset no_tcl in case something fails here + no_tcl=true + +# Check whether --with-tcl or --without-tcl was given. +if test "${with_tcl+set}" = set; then + withval="$with_tcl" + with_tclconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for Tcl configuration" >&5 +echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6 + if test "${ac_cv_c_tclconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + # First check to see if --with-tcl was specified. + if test x"${with_tclconfig}" != x ; then + if test -f "${with_tclconfig}/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5 +echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ../tcl \ + `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../tcl \ + `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../../tcl \ + `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few other private locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ${srcdir}/../tcl \ + `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + +fi + + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCL_BIN_DIR="# no Tcl configs found" + { echo "$as_me:$LINENO: WARNING: \"Cannot find Tcl configuration definitions\"" >&5 +echo "$as_me: WARNING: \"Cannot find Tcl configuration definitions\"" >&2;} + exit 0 + else + no_tcl= + TCL_BIN_DIR=${ac_cv_c_tclconfig} + echo "$as_me:$LINENO: result: found $TCL_BIN_DIR/tclConfig.sh" >&5 +echo "${ECHO_T}found $TCL_BIN_DIR/tclConfig.sh" >&6 + fi + fi + + + echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 +echo $ECHO_N "checking for existence of $TCL_BIN_DIR/tclConfig.sh... $ECHO_C" >&6 + + if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + echo "$as_me:$LINENO: result: loading" >&5 +echo "${ECHO_T}loading" >&6 + . $TCL_BIN_DIR/tclConfig.sh + else + echo "$as_me:$LINENO: result: file not found" >&5 +echo "${ECHO_T}file not found" >&6 + fi + + # + # If the TCL_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TCL_LIB_SPEC will be set to the value + # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC + # instead of TCL_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + # + + if test -f $TCL_BIN_DIR/Makefile ; then + TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} + TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} + TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} + fi + + # + # eval is required to do the TCL_DBGX substitution + # + + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" + eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" + eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" + + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" + eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" + eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" + + + + + + + + + + + + + + #AC_SUBST(TCL_DBGX) + + + + + + #AC_SUBST(TCL_BUILD_LIB_SPEC) + #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) + + +#-------------------------------------------------------------------- +# Load the tkConfig.sh file if necessary (Tk extension) +#-------------------------------------------------------------------- + +#TEA_PATH_TKCONFIG +#TEA_LOAD_TKCONFIG + +#----------------------------------------------------------------------- +# Handle the --prefix=... option by defaulting to what Tcl gave. +# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. +#----------------------------------------------------------------------- + + + # Should be AC_MSG_NOTICE, but that requires autoconf 2.50 + if test "${prefix}" = "NONE"; then + prefix_default=yes + if test x"${TCL_PREFIX}" != x; then + { echo "$as_me:$LINENO: WARNING: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&5 +echo "$as_me: WARNING: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&2;} + prefix=${TCL_PREFIX} + else + prefix=/usr/local + fi + fi + if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" ; then + if test x"${TCL_EXEC_PREFIX}" != x; then + { echo "$as_me:$LINENO: WARNING: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&5 +echo "$as_me: WARNING: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&2;} + exec_prefix=${TCL_EXEC_PREFIX} + else + exec_prefix=$prefix + fi + fi + + +#----------------------------------------------------------------------- +# Standard compiler checks. +# This sets up CC by using the CC env var, or looks for gcc otherwise. +# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create +# the basic setup necessary to compile executables. +#----------------------------------------------------------------------- + + + # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE) + # in this macro, they need to go into TEA_SETUP_COMPILER instead. + + # If the user did not set CFLAGS, set it now to keep + # the AC_PROG_CC macro from adding "-g -O2". + if test "${CFLAGS+set}" != "set" ; then + CFLAGS="" + 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 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +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 + + 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 +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&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 + echo $ECHO_N "(cached) $ECHO_C" >&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 to if __STDC__ is defined, since + # 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$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 to if __STDC__ is defined, since + # 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +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 + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + #-------------------------------------------------------------------- + # Checks to see if the make program sets the $MAKE variable. + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + + #-------------------------------------------------------------------- + # Find ranlib + #-------------------------------------------------------------------- + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + #-------------------------------------------------------------------- + # Determines the correct binary file extension (.o, .obj, .exe etc.) + #-------------------------------------------------------------------- + + + + + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f 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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#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)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here. + + + #------------------------------------------------------------------------ + # If we're using GCC, see if the compiler understands -pipe. If so, use it. + # It makes compiling go faster. (This is only a performance feature.) + #------------------------------------------------------------------------ + + if test -z "$no_pipe" -a -n "$GCC"; then + echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5 +echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6 + OLDCC="$CC" + CC="$CC -pipe" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +CC="$OLDCC" + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + + #-------------------------------------------------------------------- + # Common compiler flag setup + #-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for required early compiler flags" >&5 +echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6 + tcl_flags="" + + if test "${tcl_cv_flag__isoc99_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +char *p = (char *)strtoll; char *q = (char *)strtoull; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__isoc99_source=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _ISOC99_SOURCE 1 +#include +int +main () +{ +char *p = (char *)strtoll; char *q = (char *)strtoull; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__isoc99_source=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_flag__isoc99_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define _ISOC99_SOURCE 1 +_ACEOF + + tcl_flags="$tcl_flags _ISOC99_SOURCE" + fi + + + if test "${tcl_cv_flag__largefile64_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct stat64 buf; int i = stat64("/", &buf); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__largefile64_source=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _LARGEFILE64_SOURCE 1 +#include +int +main () +{ +struct stat64 buf; int i = stat64("/", &buf); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_flag__largefile64_source=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_flag__largefile64_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define _LARGEFILE64_SOURCE 1 +_ACEOF + + tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" + fi + + if test "x${tcl_flags}" = "x" ; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 + else + echo "$as_me:$LINENO: result: ${tcl_flags}" >&5 +echo "${ECHO_T}${tcl_flags}" >&6 + fi + + + echo "$as_me:$LINENO: checking for 64-bit integer type" >&5 +echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6 + if test "${tcl_cv_type_64bit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +__int64 value = (__int64) 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_64bit=__int64 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_type_64bit=none + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + int main() {exit(!(sizeof(long long) > sizeof(long)));} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_64bit="long long" +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "${tcl_cv_type_64bit}" = none ; then + echo "$as_me:$LINENO: result: using long" >&5 +echo "${ECHO_T}using long" >&6 + elif test "${tcl_cv_type_64bit}" = "__int64" ; then + # We actually want to use the default tcl.h checks in this + # case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* + echo "$as_me:$LINENO: result: using Tcl header defaults" >&5 +echo "${ECHO_T}using Tcl header defaults" >&6 + else + cat >>confdefs.h <<_ACEOF +#define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit} +_ACEOF + + echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5 +echo "${ECHO_T}${tcl_cv_type_64bit}" >&6 + + # Now check for auxiliary declarations + echo "$as_me:$LINENO: checking for struct dirent64" >&5 +echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 + if test "${tcl_cv_struct_dirent64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +struct dirent64 p; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_struct_dirent64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_struct_dirent64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_DIRENT64 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_struct_dirent64}" >&5 +echo "${ECHO_T}${tcl_cv_struct_dirent64}" >&6 + + echo "$as_me:$LINENO: checking for struct stat64" >&5 +echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6 + if test "${tcl_cv_struct_stat64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct stat64 p; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_struct_stat64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_struct_stat64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_struct_stat64}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_STAT64 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_struct_stat64}" >&5 +echo "${ECHO_T}${tcl_cv_struct_stat64}" >&6 + + echo "$as_me:$LINENO: checking for off64_t" >&5 +echo $ECHO_N "checking for off64_t... $ECHO_C" >&6 + if test "${tcl_cv_type_off64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +off64_t offset; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_type_off64_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_type_off64_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + + if test "x${tcl_cv_type_off64_t}" = "xyes" ; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_TYPE_OFF64_T 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: ${tcl_cv_type_off64_t}" >&5 +echo "${ECHO_T}${tcl_cv_type_off64_t}" >&6 + fi + + echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + if test "${TEA_PLATFORM}" = "unix" ; then + + #-------------------------------------------------------------------- + # On a few very rare systems, all of the libm.a stuff is + # already in libc.a. Set compiler flags accordingly. + # Also, Linux requires the "ieee" library for math to work + # right (and it must appear before "-lm"). + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking for sin" >&5 +echo $ECHO_N "checking for sin... $ECHO_C" >&6 +if test "${ac_cv_func_sin+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sin (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sin (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_sin) || defined (__stub___sin) +choke me +#else +char (*f) () = sin; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != sin; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_sin=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_sin=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_sin" >&5 +echo "${ECHO_T}$ac_cv_func_sin" >&6 +if test $ac_cv_func_sin = yes; then + MATH_LIBS="" +else + MATH_LIBS="-lm" +fi + + echo "$as_me:$LINENO: checking for main in -lieee" >&5 +echo $ECHO_N "checking for main in -lieee... $ECHO_C" >&6 +if test "${ac_cv_lib_ieee_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lieee $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ieee_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ieee_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ieee_main" >&5 +echo "${ECHO_T}$ac_cv_lib_ieee_main" >&6 +if test $ac_cv_lib_ieee_main = yes; then + MATH_LIBS="-lieee $MATH_LIBS" +fi + + + #-------------------------------------------------------------------- + # Interactive UNIX requires -linet instead of -lsocket, plus it + # needs net/errno.h to define the socket-related error codes. + #-------------------------------------------------------------------- + + echo "$as_me:$LINENO: checking for main in -linet" >&5 +echo $ECHO_N "checking for main in -linet... $ECHO_C" >&6 +if test "${ac_cv_lib_inet_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-linet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_inet_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_inet_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_inet_main" >&5 +echo "${ECHO_T}$ac_cv_lib_inet_main" >&6 +if test $ac_cv_lib_inet_main = yes; then + LIBS="$LIBS -linet" +fi + + if test "${ac_cv_header_net_errno_h+set}" = set; then + echo "$as_me:$LINENO: checking for net/errno.h" >&5 +echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_net_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking net/errno.h usability" >&5 +echo $ECHO_N "checking net/errno.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking net/errno.h presence" >&5 +echo $ECHO_N "checking net/errno.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: net/errno.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: net/errno.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: net/errno.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for net/errno.h" >&5 +echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_net_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_net_errno_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 + +fi +if test $ac_cv_header_net_errno_h = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_NET_ERRNO_H 1 +_ACEOF + +fi + + + + #-------------------------------------------------------------------- + # Check for the existence of the -lsocket and -lnsl libraries. + # The order here is important, so that they end up in the right + # order in the command line generated by make. Here are some + # special considerations: + # 1. Use "connect" and "accept" to check for -lsocket, and + # "gethostbyname" to check for -lnsl. + # 2. Use each function name only once: can't redo a check because + # autoconf caches the results of the last check and won't redo it. + # 3. Use -lnsl and -lsocket only if they supply procedures that + # aren't already present in the normal libraries. This is because + # IRIX 5.2 has libraries, but they aren't needed and they're + # bogus: they goof up name resolution if used. + # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. + # To get around this problem, check for both libraries together + # if -lsocket doesn't work by itself. + #-------------------------------------------------------------------- + + tcl_checkBoth=0 + echo "$as_me:$LINENO: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +choke me +#else +char (*f) () = connect; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != connect; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 +if test $ac_cv_func_connect = yes; then + tcl_checkSocket=0 +else + tcl_checkSocket=1 +fi + + if test "$tcl_checkSocket" = 1; then + echo "$as_me:$LINENO: checking for setsockopt" >&5 +echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 +if test "${ac_cv_func_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char setsockopt (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char setsockopt (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_setsockopt) || defined (__stub___setsockopt) +choke me +#else +char (*f) () = setsockopt; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != setsockopt; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_setsockopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_setsockopt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_func_setsockopt" >&6 +if test $ac_cv_func_setsockopt = yes; then + : +else + echo "$as_me:$LINENO: checking for setsockopt in -lsocket" >&5 +echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char setsockopt (); +int +main () +{ +setsockopt (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_setsockopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_setsockopt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 +if test $ac_cv_lib_socket_setsockopt = yes; then + LIBS="$LIBS -lsocket" +else + tcl_checkBoth=1 +fi + +fi + + fi + if test "$tcl_checkBoth" = 1; then + tk_oldLibs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + echo "$as_me:$LINENO: checking for accept" >&5 +echo $ECHO_N "checking for accept... $ECHO_C" >&6 +if test "${ac_cv_func_accept+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char accept (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char accept (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_accept) || defined (__stub___accept) +choke me +#else +char (*f) () = accept; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != accept; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_accept=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_accept=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_accept" >&5 +echo "${ECHO_T}$ac_cv_func_accept" >&6 +if test $ac_cv_func_accept = yes; then + tcl_checkNsl=0 +else + LIBS=$tk_oldLibs +fi + + fi + echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +char (*f) () = gethostbyname; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gethostbyname; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 +if test $ac_cv_func_gethostbyname = yes; then + : +else + echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + LIBS="$LIBS -lnsl" +fi + +fi + + + # Don't perform the eval of the libraries here because DL_LIBS + # won't be set until we call TEA_CONFIG_CFLAGS + + TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' + + + + + echo "$as_me:$LINENO: checking dirent.h" >&5 +echo $ECHO_N "checking dirent.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ + +#ifndef _POSIX_SOURCE +# ifdef __Lynx__ + /* + * Generate compilation error to make the test fail: Lynx headers + * are only valid if really in the POSIX environment. + */ + + missing_procedure(); +# endif +#endif +DIR *d; +struct dirent *entryPtr; +char *p; +d = opendir("foobar"); +entryPtr = readdir(d); +p = entryPtr->d_name; +closedir(d); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + + if test $tcl_ok = no; then + cat >>confdefs.h <<\_ACEOF +#define NO_DIRENT_H 1 +_ACEOF + + fi + + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test "${ac_cv_header_errno_h+set}" = set; then + echo "$as_me:$LINENO: checking for errno.h" >&5 +echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_errno_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking errno.h usability" >&5 +echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking errno.h presence" >&5 +echo $ECHO_N "checking errno.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: errno.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: errno.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: errno.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for errno.h" >&5 +echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_errno_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_errno_h" >&6 + +fi +if test $ac_cv_header_errno_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_ERRNO_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_float_h+set}" = set; then + echo "$as_me:$LINENO: checking for float.h" >&5 +echo $ECHO_N "checking for float.h... $ECHO_C" >&6 +if test "${ac_cv_header_float_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 +echo "${ECHO_T}$ac_cv_header_float_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking float.h usability" >&5 +echo $ECHO_N "checking float.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking float.h presence" >&5 +echo $ECHO_N "checking float.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: float.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: float.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: float.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for float.h" >&5 +echo $ECHO_N "checking for float.h... $ECHO_C" >&6 +if test "${ac_cv_header_float_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_float_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 +echo "${ECHO_T}$ac_cv_header_float_h" >&6 + +fi +if test $ac_cv_header_float_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_FLOAT_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_values_h+set}" = set; then + echo "$as_me:$LINENO: checking for values.h" >&5 +echo $ECHO_N "checking for values.h... $ECHO_C" >&6 +if test "${ac_cv_header_values_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 +echo "${ECHO_T}$ac_cv_header_values_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking values.h usability" >&5 +echo $ECHO_N "checking values.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking values.h presence" >&5 +echo $ECHO_N "checking values.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: values.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: values.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: values.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for values.h" >&5 +echo $ECHO_N "checking for values.h... $ECHO_C" >&6 +if test "${ac_cv_header_values_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_values_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 +echo "${ECHO_T}$ac_cv_header_values_h" >&6 + +fi +if test $ac_cv_header_values_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_VALUES_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_limits_h+set}" = set; then + echo "$as_me:$LINENO: checking for limits.h" >&5 +echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 +if test "${ac_cv_header_limits_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 +echo "${ECHO_T}$ac_cv_header_limits_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking limits.h usability" >&5 +echo $ECHO_N "checking limits.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking limits.h presence" >&5 +echo $ECHO_N "checking limits.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: limits.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: limits.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: limits.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for limits.h" >&5 +echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 +if test "${ac_cv_header_limits_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_limits_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 +echo "${ECHO_T}$ac_cv_header_limits_h" >&6 + +fi +if test $ac_cv_header_limits_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_LIMITS_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_stdlib_h+set}" = set; then + echo "$as_me:$LINENO: checking for stdlib.h" >&5 +echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_stdlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking stdlib.h usability" >&5 +echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking stdlib.h presence" >&5 +echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for stdlib.h" >&5 +echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_stdlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_stdlib_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 + +fi +if test $ac_cv_header_stdlib_h = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtol" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtoul" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtod" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + if test $tcl_ok = 0; then + cat >>confdefs.h <<\_ACEOF +#define NO_STDLIB_H 1 +_ACEOF + + fi + if test "${ac_cv_header_string_h+set}" = set; then + echo "$as_me:$LINENO: checking for string.h" >&5 +echo $ECHO_N "checking for string.h... $ECHO_C" >&6 +if test "${ac_cv_header_string_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 +echo "${ECHO_T}$ac_cv_header_string_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking string.h usability" >&5 +echo $ECHO_N "checking string.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking string.h presence" >&5 +echo $ECHO_N "checking string.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: string.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: string.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: string.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for string.h" >&5 +echo $ECHO_N "checking for string.h... $ECHO_C" >&6 +if test "${ac_cv_header_string_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_string_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 +echo "${ECHO_T}$ac_cv_header_string_h" >&6 + +fi +if test $ac_cv_header_string_h = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strstr" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strerror" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + + + # See also memmove check below for a place where NO_STRING_H can be + # set and why. + + if test $tcl_ok = 0; then + cat >>confdefs.h <<\_ACEOF +#define NO_STRING_H 1 +_ACEOF + + fi + + if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/wait.h" >&5 +echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/wait.h usability" >&5 +echo $ECHO_N "checking sys/wait.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking sys/wait.h presence" >&5 +echo $ECHO_N "checking sys/wait.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: sys/wait.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/wait.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/wait.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for sys/wait.h" >&5 +echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_wait_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 + +fi +if test $ac_cv_header_sys_wait_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_SYS_WAIT_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 +echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 +echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dlfcn_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 + +fi +if test $ac_cv_header_dlfcn_h = yes; then + : +else + cat >>confdefs.h <<\_ACEOF +#define NO_DLFCN_H 1 +_ACEOF + +fi + + + + # OS/390 lacks sys/param.h (and doesn't need it, by chance). + # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and + # CHECK on limits.h + + + + +for ac_header in limits.h unistd.h sys/param.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # Let the user call this, because if it triggers, they will + # need a compat/strtod.c that is correct. Users can also + # use Tcl_GetDouble(FromObj) instead. + #TEA_BUGGY_STRTOD + fi + + +#----------------------------------------------------------------------- +# __CHANGE__ +# Specify the C source files to compile in TEA_ADD_SOURCES, +# public headers that need to be installed in TEA_ADD_HEADERS, +# stub library C source files to compile in TEA_ADD_STUB_SOURCES, +# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. +# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS +# and PKG_TCL_SOURCES. +#----------------------------------------------------------------------- + +# ------- load xotclConfig.sh ---------- + + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + if test x"${no_xotcl}" = x ; then + # we reset no_xotcl in case something fails here + no_xotcl=true + +# Check whether --with-xotcl or --without-xotcl was given. +if test "${with_xotcl+set}" = set; then + withval="$with_xotcl" + with_xotclconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for XOTcl configuration" >&5 +echo $ECHO_N "checking for XOTcl configuration... $ECHO_C" >&6 + if test "${ac_cv_c_xotclconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + # First check to see if --with-xotcl was specified. + if test x"${with_xotclconfig}" != x ; then + if test -f "${with_xotclconfig}/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd ${with_xotclconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_xotclconfig} directory doesn't contain xotclConfig.sh" >&5 +echo "$as_me: error: ${with_xotclconfig} directory doesn't contain xotclConfig.sh" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_xotclconfig}" = x ; then + for i in \ + ${srcdir}/../xotcl \ + `ls -dr ${srcdir}/../xotcl-* 2>/dev/null` \ + ${srcdir}/../../xotcl \ + `ls -dr ${srcdir}/../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../xotcl \ + `ls -dr ${srcdir}/../../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../../xotcl \ + `ls -dr ${srcdir}/../../../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../../../xotcl \ + `ls -dr ${srcdir}/../../../../../xotcl-* 2>/dev/null` ; do + if test -f "$i/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_xotclconfig}" = x ; then + for i in `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` ; do + if test -f "$i/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd $i; pwd)` + break + fi + done + fi + + +fi + + + if test x"${ac_cv_c_xotclconfig}" = x ; then + XOTCL_BIN_DIR="# no XOTcl configs found" + { echo "$as_me:$LINENO: WARNING: Can't find XOTcl configuration definitions" >&5 +echo "$as_me: WARNING: Can't find XOTcl configuration definitions" >&2;} + exit 0 + else + no_xotcl= + XOTCL_BIN_DIR=${ac_cv_c_xotclconfig} + echo "$as_me:$LINENO: result: found $XOTCL_BIN_DIR/xotclConfig.sh" >&5 +echo "${ECHO_T}found $XOTCL_BIN_DIR/xotclConfig.sh" >&6 + fi + fi + + + echo "$as_me:$LINENO: checking for existence of $XOTCL_BIN_DIR/xotclConfig.sh" >&5 +echo $ECHO_N "checking for existence of $XOTCL_BIN_DIR/xotclConfig.sh... $ECHO_C" >&6 + + if test -f "$XOTCL_BIN_DIR/xotclConfig.sh" ; then + echo "$as_me:$LINENO: result: loading" >&5 +echo "${ECHO_T}loading" >&6 + . $XOTCL_BIN_DIR/xotclConfig.sh + else + echo "$as_me:$LINENO: result: file not found" >&5 +echo "${ECHO_T}file not found" >&6 + fi + + # + # The eval is required to do the TCL_DBGX substitution in the + # TCL_LIB_FILE variable + # + + + + + + + + + + + + +# ------- + + + vars="xmltok.c unixfilemap.c xmlrole.c xmlwf.c codepage.c xmlparse.c hashtable.c tclexpat.c" + for i in $vars; do + case $i in + \$*) + # allow $-var names + PKG_SOURCES="$PKG_SOURCES $i" + PKG_OBJECTS="$PKG_OBJECTS $i" + ;; + *) + # check for existence - allows for generic/win/unix VPATH + if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ + -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ + ; then + { { echo "$as_me:$LINENO: error: could not find source file '$i'" >&5 +echo "$as_me: error: could not find source file '$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_SOURCES="$PKG_SOURCES $i" + # this assumes it is in a VPATH dir + i=`basename $i` + # handle user calling this before or after TEA_SETUP_COMPILER + if test x"${OBJEXT}" != x ; then + j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" + else + j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" + fi + PKG_OBJECTS="$PKG_OBJECTS $j" + ;; + esac + done + + + + + vars="" + for i in $vars; do + # check for existence, be strict because it is installed + if test ! -f "${srcdir}/$i" ; then + { { echo "$as_me:$LINENO: error: could not find header file '${srcdir}/$i'" >&5 +echo "$as_me: error: could not find header file '${srcdir}/$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_HEADERS="$PKG_HEADERS $i" + done + + + + vars="-I$XOTCL_SRC_DIR/generic" + for i in $vars; do + PKG_INCLUDES="$PKG_INCLUDES $i" + done + + + + vars="$XOTCL_BUILD_STUB_LIB_SPEC" + for i in $vars; do + PKG_LIBS="$PKG_LIBS $i" + done + + + + PKG_CFLAGS="$PKG_CFLAGS " + + + + vars="" + for i in $vars; do + # check for existence - allows for generic/win/unix VPATH + if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ + -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ + ; then + { { echo "$as_me:$LINENO: error: could not find stub source file '$i'" >&5 +echo "$as_me: error: could not find stub source file '$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i" + # this assumes it is in a VPATH dir + i=`basename $i` + # handle user calling this before or after TEA_SETUP_COMPILER + if test x"${OBJEXT}" != x ; then + j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" + else + j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" + fi + PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j" + done + + + + + vars="" + for i in $vars; do + # check for existence, be strict because it is installed + if test ! -f "${srcdir}/$i" ; then + { { echo "$as_me:$LINENO: error: could not find tcl source file '${srcdir}/$i'" >&5 +echo "$as_me: error: could not find tcl source file '${srcdir}/$i'" >&2;} + { (exit 1); exit 1; }; } + fi + PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i" + done + + + +#-------------------------------------------------------------------- +# __CHANGE__ +# A few miscellaneous platform-specific items: +# +# Define a special symbol for Windows (BUILD_sample in this case) so +# that we create the export library with the dll. +# +# Windows creates a few extra files that need to be cleaned up. +# You can add more files to clean if your extension creates any extra +# files. +# +# TEA_ADD_* any platform specific compiler/build info here. +#-------------------------------------------------------------------- + +if test "${TEA_PLATFORM}" = "windows" ; then + cat >>confdefs.h <<\_ACEOF +#define BUILD_sample 1 +_ACEOF + + CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" + #TEA_ADD_SOURCES([win/winFile.c]) + #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) +else + CLEANFILES="pkgIndex.tcl" + #TEA_ADD_SOURCES([unix/unixFile.c]) + #TEA_ADD_LIBS([-lsuperfly]) +fi + + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for Tcl public headers" >&5 +echo $ECHO_N "checking for Tcl public headers... $ECHO_C" >&6 + + +# Check whether --with-tclinclude or --without-tclinclude was given. +if test "${with_tclinclude+set}" = set; then + withval="$with_tclinclude" + with_tclinclude=${withval} +fi; + + if test "${ac_cv_c_tclh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + # Use the value from --with-tclinclude, if it was given + + if test x"${with_tclinclude}" != x ; then + if test -f "${with_tclinclude}/tcl.h" ; then + ac_cv_c_tclh=${with_tclinclude} + else + { { echo "$as_me:$LINENO: error: ${with_tclinclude} directory does not contain tcl.h" >&5 +echo "$as_me: error: ${with_tclinclude} directory does not contain tcl.h" >&2;} + { (exit 1); exit 1; }; } + fi + else + # Check order: pkg --prefix location, Tcl's --prefix location, + # directory of tclConfig.sh, and Tcl source directory. + # Looking in the source dir is not ideal, but OK. + + eval "temp_includedir=${includedir}" + list="`ls -d ${temp_includedir} 2>/dev/null` \ + `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ + `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \ + `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`" + if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then + list="$list /usr/local/include /usr/include" + fi + for i in $list ; do + if test -f "$i/tcl.h" ; then + ac_cv_c_tclh=$i + break + fi + done + fi + +fi + + + # Print a message based on how we determined the include path + + if test x"${ac_cv_c_tclh}" = x ; then + { { echo "$as_me:$LINENO: error: tcl.h not found. Please specify its location with --with-tclinclude" >&5 +echo "$as_me: error: tcl.h not found. Please specify its location with --with-tclinclude" >&2;} + { (exit 1); exit 1; }; } + else + echo "$as_me:$LINENO: result: ${ac_cv_c_tclh}" >&5 +echo "${ECHO_T}${ac_cv_c_tclh}" >&6 + fi + + # Convert to a native path and substitute into the output files. + + INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}` + + TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" + + + +#TEA_PRIVATE_TCL_HEADERS + +#TEA_PUBLIC_TK_HEADERS +#TEA_PRIVATE_TK_HEADERS +#TEA_PATH_X + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +#-------------------------------------------------------------------- + + + # Check whether --enable-threads or --disable-threads was given. +if test "${enable_threads+set}" = set; then + enableval="$enable_threads" + tcl_ok=$enableval +else + tcl_ok= +fi; + + if test "$tcl_ok" = "yes"; then + TCL_THREADS=1 + + if test "${TEA_PLATFORM}" != "windows" ; then + # We are always OK on Windows, so check what this platform wants. + cat >>confdefs.h <<\_ACEOF +#define USE_THREAD_ALLOC 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _THREAD_SAFE 1 +_ACEOF + + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6 +if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "no"; then + # Check a little harder for __pthread_mutex_init in the + # same library, as some systems hide it there until + # pthread.h is defined. We could alternatively do an + # AC_TRY_COMPILE with pthread.h, but that will work with + # libpthread really doesn't exist, like AIX 4.2. + # [Bug: 4359] + echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5 +echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char __pthread_mutex_init (); +int +main () +{ +__pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread___pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread___pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_init" >&6 +if test $ac_cv_lib_pthread___pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthread" + else + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthreads" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lpthreads... $ECHO_C" >&6 +if test "${ac_cv_lib_pthreads_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthreads $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthreads_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthreads_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_mutex_init" >&6 +if test $ac_cv_lib_pthreads_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthreads" + else + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lc... $ECHO_C" >&6 +if test "${ac_cv_lib_c_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_c_pthread_mutex_init" >&6 +if test $ac_cv_lib_c_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "no"; then + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6 +if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_r_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_r_pthread_mutex_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_c_r_pthread_mutex_init" >&6 +if test $ac_cv_lib_c_r_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -pthread" + else + TCL_THREADS=0 + { echo "$as_me:$LINENO: WARNING: \"Don t know how to find pthread lib on your system - thread support disabled\"" >&5 +echo "$as_me: WARNING: \"Don t know how to find pthread lib on your system - thread support disabled\"" >&2;} + fi + fi + fi + fi + + # Does the pthread-implementation provide + # 'pthread_attr_setstacksize' ? + + ac_saved_libs=$LIBS + LIBS="$LIBS $THREADS_LIBS" + +for ac_func in pthread_attr_setstacksize +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + LIBS=$ac_saved_libs + +for ac_func in readdir_r +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + fi + else + TCL_THREADS=0 + fi + # Do checking message here to not mess up interleaved configure output + echo "$as_me:$LINENO: checking for building with threads" >&5 +echo $ECHO_N "checking for building with threads... $ECHO_C" >&6 + if test "${TCL_THREADS}" = "1"; then + cat >>confdefs.h <<\_ACEOF +#define TCL_THREADS 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no (default)" >&5 +echo "${ECHO_T}no (default)" >&6 + fi + # TCL_THREADS sanity checking. See if our request for building with + # threads is the same as the way Tcl was built. If not, warn the user. + case ${TCL_DEFS} in + *THREADS=1*) + if test "${TCL_THREADS}" = "0"; then + { echo "$as_me:$LINENO: WARNING: + Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl + that IS thread-enabled." >&5 +echo "$as_me: WARNING: + Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl + that IS thread-enabled." >&2;} + fi + ;; + *) + if test "${TCL_THREADS}" = "1"; then + { echo "$as_me:$LINENO: WARNING: + --enable-threads requested, but attempting building against a Tcl + that is NOT thread-enabled." >&5 +echo "$as_me: WARNING: + --enable-threads requested, but attempting building against a Tcl + that is NOT thread-enabled." >&2;} + fi + ;; + esac + + + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking how to build libraries" >&5 +echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6 + # Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + tcl_ok=$enableval +else + tcl_ok=yes +fi; + + if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + tcl_ok=$enableval + else + tcl_ok=yes + fi + + if test "$tcl_ok" = "yes" ; then + echo "$as_me:$LINENO: result: shared" >&5 +echo "${ECHO_T}shared" >&6 + SHARED_BUILD=1 + else + echo "$as_me:$LINENO: result: static" >&5 +echo "${ECHO_T}static" >&6 + SHARED_BUILD=0 + cat >>confdefs.h <<\_ACEOF +#define STATIC_BUILD 1 +_ACEOF + + fi + + + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# can be taken from the tclConfig.sh file, but this figures it all out. +#-------------------------------------------------------------------- + + + + + # Step 0: Enable 64 bit support? + + echo "$as_me:$LINENO: checking if 64bit support is enabled" >&5 +echo $ECHO_N "checking if 64bit support is enabled... $ECHO_C" >&6 + # Check whether --enable-64bit or --disable-64bit was given. +if test "${enable_64bit+set}" = set; then + enableval="$enable_64bit" + do64bit=$enableval +else + do64bit=no +fi; + echo "$as_me:$LINENO: result: $do64bit" >&5 +echo "${ECHO_T}$do64bit" >&6 + + # Step 0.b: Enable Solaris 64 bit VIS support? + + echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5 +echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6 + # Check whether --enable-64bit-vis or --disable-64bit-vis was given. +if test "${enable_64bit_vis+set}" = set; then + enableval="$enable_64bit_vis" + do64bitVIS=$enableval +else + do64bitVIS=no +fi; + echo "$as_me:$LINENO: result: $do64bitVIS" >&5 +echo "${ECHO_T}$do64bitVIS" >&6 + + if test "$do64bitVIS" = "yes"; then + # Force 64bit on with VIS + do64bit=yes + fi + + # Step 0.c: Cross-compiling options for Windows/CE builds? + + if test "${TEA_PLATFORM}" = "windows" ; then + echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5 +echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6 + # Check whether --enable-wince or --disable-wince was given. +if test "${enable_wince+set}" = set; then + enableval="$enable_wince" + doWince=$enableval +else + doWince=no +fi; + echo "$as_me:$LINENO: result: $doWince" >&5 +echo "${ECHO_T}$doWince" >&6 + fi + + # Step 1: set the variable "system" to hold the name and version number + # for the system. This can usually be done via the "uname" command, but + # there are a few systems, like Next, where this doesn't work. + + echo "$as_me:$LINENO: checking system version (for dynamic loading)" >&5 +echo $ECHO_N "checking system version (for dynamic loading)... $ECHO_C" >&6 + if test -f /usr/lib/NextStep/software_version; then + system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` + else + system=`uname -s`-`uname -r` + if test "$?" -ne 0 ; then + echo "$as_me:$LINENO: result: unknown (can't find uname command)" >&5 +echo "${ECHO_T}unknown (can't find uname command)" >&6 + system=unknown + else + # Special check for weird MP-RAS system (uname returns weird + # results, and the version is kept in special file). + + if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then + system=MP-RAS-`awk '{print }' /etc/.relid'` + fi + if test "`uname -s`" = "AIX" ; then + system=AIX-`uname -v`.`uname -r` + fi + if test "${TEA_PLATFORM}" = "windows" ; then + system=windows + fi + echo "$as_me:$LINENO: result: $system" >&5 +echo "${ECHO_T}$system" >&6 + fi + fi + + # Step 2: check for existence of -ldl library. This is needed because + # Linux can use either -ldl or -ldld for dynamic loading. + + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + have_dl=yes +else + have_dl=no +fi + + + # Step 3: set configuration options based on system name and version. + + do64bit_ok=no + EXTRA_CFLAGS="" + TCL_EXPORT_FILE_SUFFIX="" + UNSHARED_LIB_SUFFIX="" + TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' + ECHO_VERSION='`echo ${PACKAGE_VERSION}`' + TCL_LIB_VERSIONS_OK=ok + CFLAGS_DEBUG=-g + CFLAGS_OPTIMIZE=-O + if test "$GCC" = "yes" ; then + CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int" + else + CFLAGS_WARNING="" + fi + TCL_NEEDS_EXP_FILE=0 + TCL_BUILD_EXP_FILE="" + TCL_EXP_FILE="" + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STLIB_LD='${AR} cr' + LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" + case $system in + windows) + # This is a 2-stage check to make sure we have the 64-bit SDK + # We have to know where the SDK is installed. + if test "$do64bit" = "yes" ; then + if test "x${MSSDK}x" = "xx" ; then + MSSDK="C:/Progra~1/Microsoft SDK" + fi + # In order to work in the tortured autoconf environment, + # we need to ensure that this path has no spaces + MSSDK=`cygpath -w -s "$MSSDK" | sed -e 's!\\\!/!g'` + if test ! -d "${MSSDK}/bin/win64" ; then + { echo "$as_me:$LINENO: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&5 +echo "$as_me: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&2;} + do64bit="no" + else + do64bit_ok="yes" + fi + fi + + if test "$doWince" != "no" ; then + if test "$do64bit" = "yes" ; then + { { echo "$as_me:$LINENO: error: Windows/CE and 64-bit builds incompatible" >&5 +echo "$as_me: error: Windows/CE and 64-bit builds incompatible" >&2;} + { (exit 1); exit 1; }; } + fi + if test "$GCC" = "yes" ; then + { { echo "$as_me:$LINENO: error: Windows/CE and GCC builds incompatible" >&5 +echo "$as_me: error: Windows/CE and GCC builds incompatible" >&2;} + { (exit 1); exit 1; }; } + fi + + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-celib + + if test x"${no_celib}" = x ; then + # we reset no_celib in case something fails here + no_celib=true + +# Check whether --with-celib or --without-celib was given. +if test "${with_celib+set}" = set; then + withval="$with_celib" + with_celibconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5 +echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6 + if test "${ac_cv_c_celibconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + # First check to see if --with-celibconfig was specified. + if test x"${with_celibconfig}" != x ; then + if test -d "${with_celibconfig}/inc" ; then + ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_celibconfig} directory doesn't contain inc directory" >&5 +echo "$as_me: error: ${with_celibconfig} directory doesn't contain inc directory" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # then check for a celib library + if test x"${ac_cv_c_celibconfig}" = x ; then + for i in \ + ../celib-palm-3.0 \ + ../celib \ + ../../celib-palm-3.0 \ + ../../celib \ + `ls -dr ../celib-*3.[0-9]* 2>/dev/null` \ + ${srcdir}/../celib-palm-3.0 \ + ${srcdir}/../celib \ + `ls -dr ${srcdir}/../celib-*3.[0-9]* 2>/dev/null` \ + ; do + if test -d "$i/inc" ; then + ac_cv_c_celibconfig=`(cd $i; pwd)` + break + fi + done + fi + +fi + + if test x"${ac_cv_c_celibconfig}" = x ; then + CELIB_DIR="# no Celib configs found" + { { echo "$as_me:$LINENO: error: Cannot find celib support library directory" >&5 +echo "$as_me: error: Cannot find celib support library directory" >&2;} + { (exit 1); exit 1; }; } + else + no_celib= + CELIB_DIR=${ac_cv_c_celibconfig} + echo "$as_me:$LINENO: result: found $CELIB_DIR" >&5 +echo "${ECHO_T}found $CELIB_DIR" >&6 + fi + fi + + # set defaults + # Currently Tcl requires 300+ + CEVERSION=300; # could be 211 300 301 ... + TARGETCPU=ARM; # could be ARM MIPS SH3 X86 ... + PLATFORM="Pocket PC 2002" + if test "$doWince" = "yes"; then + doWince="300,ARM,ARM,Pocket PC 2002" + fi + eval `echo $doWince | awk -F "," '{ \ + if (length($1)) { printf "CEVERSION=%s\n", $1 }; \ + if (length($2)) { printf "TARGETCPU=%s\n", toupper($2) }; \ + if (length($3)) { printf "ARCH=%s\n", toupper($3) }; \ + if (length($4)) { printf "PLATFORM=%s\n", $4 }; \ + }'` + OSVERSION=WCE$CEVERSION; + if test "x${ARCH}" = "x" ; then + ARCH=$TARGETCPU; # could be ARM MIPS SH3 X86 X86EM ... + fi + if test "x${WCEROOT}" = "x" ; then + WCEROOT="C:/Program Files/Microsoft eMbedded Tools" + fi + if test "x${SDKROOT}" = "x" ; then + SDKROOT="C:/Windows CE Tools" + fi + # In order to work in the tortured autoconf environment, + # we need to ensure that this path has no spaces + WCEROOT=`cygpath -w -s "$WCEROOT" | sed -e 's!\\\!/!g'` + SDKROOT=`cygpath -w -s "$SDKROOT" | sed -e 's!\\\!/!g'` + CELIB_DIR=`cygpath -w -s "$CELIB_DIR" | sed -e 's!\\\!/!g'` + if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ + -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then + { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5 +echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;} + { (exit 1); exit 1; }; } + doWince="no" + else + CEINCLUDE=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/include" | sed -e 's!\\\!/!g'` + CELIBPATH=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" | sed -e 's!\\\!/!g'` + fi + fi + + if test "$GCC" != "yes" ; then + if test "${SHARED_BUILD}" = "0" ; then + runtime=-MT + else + runtime=-MD + fi + + if test "$do64bit" = "yes" ; then + # All this magic is necessary for the Win64 SDK RC1 - hobbs + export CC="${MSSDK}/Bin/Win64/cl.exe \ + -I${MSSDK}/Include/prerelease \ + -I${MSSDK}/Include/Win64/crt \ + -I${MSSDK}/Include" + export RC="${MSSDK}/bin/rc.exe" + export lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \ + -LIBPATH:${MSSDK}/Lib/Prerelease/IA64" + export STLIB_LD="${MSSDK}/bin/win64/lib.exe -nologo ${lflags}" + export LINKBIN="${MSSDK}/bin/win64/link.exe ${lflags}" + CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" + CFLAGS_OPTIMIZE="-nologo -O2 -Gs -W2 ${runtime}" + elif test "$doWince" != "no" ; then + if test "${TARGETCPU}" = "X86"; then + CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + else + CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl${TARGETCPU}.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + fi + RC="${WCEROOT}/Common/EVC/bin/rc.exe" + cpulower=`echo ${TARGETCPU} | awk '{print tolower($0)}'` + defs="${TARGETCPU} _${TARGETCPU}_ ${cpulower} _${cpulower}_ POCKET_SIZE PALM_SIZE _MT _DLL _WINDOWS" + for i in $defs ; do + cat >>confdefs.h <<_ACEOF +#define $i 1 +_ACEOF + + done + cat >>confdefs.h <<_ACEOF +#define _WIN32_WCE $CEVERSION +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define UNDER_CE $CEVERSION +_ACEOF + + CFLAGS_DEBUG="-nologo -Zi -Od" + CFLAGS_OPTIMIZE="-nologo -Ox" + lflags="-MACHINE:${TARGETCPU} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,3.00" + STLIB_LD="${WCEROOT}/EVC/${OSVERSION}/bin/lib.exe -nologo ${lflags}" + LINKBIN="${WCEROOT}/EVC/${OSVERSION}/bin/link.exe ${lflags}" + else + RC="rc" + STLIB_LD="lib -nologo" + LINKBIN="link -link50compat" + CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" + CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD -W2 ${runtime}" + fi + fi + + if test "$GCC" = "yes"; then + # mingw gcc mode + RC="windres" + CFLAGS_DEBUG="-g" + CFLAGS_OPTIMIZE="-O2" + SHLIB_LD="$CC -shared" + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" + LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" + else + SHLIB_LD="${LINKBIN} -dll -nologo" + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.lib' + EXTRA_CFLAGS="-YX" + PATHTYPE=-w + # For information on what debugtype is most useful, see: + # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp + # This essentially turns it all on. + LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2" + LDFLAGS_OPTIMIZE="-release" + if test "$doWince" != "no" ; then + LDFLAGS_CONSOLE="-link ${lflags}" + LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} + else + LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" + LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" + fi + fi + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".dll" + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.dll' + + TCL_LIB_VERSIONS_OK=nodots + # Bogus to avoid getting this turned off + DL_OBJS="tclLoadNone.obj" + ;; + AIX-*) + if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then + # AIX requires the _r compiler when gcc isn't being used + if test "${CC}" != "cc_r" ; then + CC=${CC}_r + fi + echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5 +echo "${ECHO_T}Using $CC for compiling with threads" >&6 + fi + LIBS="$LIBS -lc" + SHLIB_CFLAGS="" + SHLIB_SUFFIX=".so" + SHLIB_LD_LIBS='${LIBS}' + + DL_OBJS="tclLoadDl.o" + LDFLAGS="" + LD_LIBRARY_PATH_VAR="LIBPATH" + + # AIX v<=4.1 has some different flags than 4.2+ + if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then + #LIBOBJS="$LIBOBJS tclLoadAix.o" + LIBOBJS="$LIBOBJS tclLoadAix.$ac_objext" + DL_LIBS="-lld" + fi + + # Check to enable 64-bit flags for compiler/linker on AIX 4+ + if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + else + do64bit_ok=yes + EXTRA_CFLAGS="-q64" + LDFLAGS="-q64" + RANLIB="${RANLIB} -X64" + AR="${AR} -X64" + SHLIB_LD_FLAGS="-b64" + fi + fi + + if test "`uname -m`" = "ia64" ; then + # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + # AIX-5 has dl* in libc.so + DL_LIBS="" + if test "$GCC" = "yes" ; then + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' + fi + else + SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}" + DL_LIBS="-ldl" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + TCL_NEEDS_EXP_FILE=1 + TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.exp' + fi + + # On AIX <=v4 systems, libbsd.a has to be linked in to support + # non-blocking file IO. This library has to be linked in after + # the MATH_LIBS or it breaks the pow() function. The way to + # insure proper sequencing, is to add it to the tail of MATH_LIBS. + # This library also supplies gettimeofday. + # + # AIX does not have a timezone field in struct tm. When the AIX + # bsd library is used, the timezone global and the gettimeofday + # methods are to be avoided for timezone deduction instead, we + # deduce the timezone by comparing the localtime result on a + # known GMT value. + + echo "$as_me:$LINENO: checking for gettimeofday in -lbsd" >&5 +echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6 +if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gettimeofday (); +int +main () +{ +gettimeofday (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_bsd_gettimeofday=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_bsd_gettimeofday=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gettimeofday" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6 +if test $ac_cv_lib_bsd_gettimeofday = yes; then + libbsd=yes +else + libbsd=no +fi + + if test $libbsd = yes; then + MATH_LIBS="$MATH_LIBS -lbsd" + cat >>confdefs.h <<\_ACEOF +#define USE_DELTA_FOR_TZ 1 +_ACEOF + + fi + ;; + BSD/OS-2.1*|BSD/OS-3*) + SHLIB_CFLAGS="" + SHLIB_LD="shlicc -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + BSD/OS-4.*) + SHLIB_CFLAGS="-export-dynamic -fPIC" + SHLIB_LD="cc -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-export-dynamic" + LD_SEARCH_FLAGS="" + ;; + dgux*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + HP-UX-*.11.*) + # Use updated header definitions where possible + cat >>confdefs.h <<\_ACEOF +#define _XOPEN_SOURCE_EXTENDED 1 +_ACEOF + + + SHLIB_SUFFIX=".sl" + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + fi + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + + # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc + #EXTRA_CFLAGS="+DAportable" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + hpux_arch=`${CC} -dumpmachine` + case $hpux_arch in + hppa64*) + # 64-bit gcc in use. Fix flags for GNU ld. + do64bit_ok=yes + SHLIB_LD="${CC} -shared" + SHLIB_LD_LIBS="" + LD_SEARCH_FLAGS='' + ;; + *) + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + ;; + esac + else + do64bit_ok=yes + if test "`uname -m`" = "ia64" ; then + EXTRA_CFLAGS="+DD64" + LDFLAGS="+DD64 $LDFLAGS" + else + EXTRA_CFLAGS="+DA2.0W" + LDFLAGS="+DA2.0W $LDFLAGS" + fi + fi + fi + ;; + HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) + SHLIB_SUFFIX=".sl" + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS="" + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + fi + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + ;; + IRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + ;; + IRIX-5.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + EXTRA_CFLAGS="" + LDFLAGS="" + ;; + IRIX-6.*|IRIX64-6.5*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -n32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then + EXTRA_CFLAGS="-mabi=n32" + LDFLAGS="-mabi=n32" + else + case $system in + IRIX-6.3) + # Use to build 6.2 compatible binaries on 6.3. + EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS" + ;; + *) + EXTRA_CFLAGS="-n32" + ;; + esac + LDFLAGS="-n32" + fi + ;; + IRIX64-6.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -n32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + + # Check to enable 64-bit flags for compiler/linker + + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5 +echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} + else + do64bit_ok=yes + SHLIB_LD="ld -64 -shared -rdata_shared" + EXTRA_CFLAGS="-64" + LDFLAGS="-64" + fi + fi + ;; + Linux*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings + # when you inline the string and math operations. Turn this off to + # get rid of the warnings. + + #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + else + if test "${ac_cv_header_dld_h+set}" = set; then + echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dld.h usability" >&5 +echo $ECHO_N "checking dld.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dld.h presence" >&5 +echo $ECHO_N "checking dld.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dld.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dld.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dld.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dld_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 + +fi +if test $ac_cv_header_dld_h = yes; then + + SHLIB_LD="ld -shared" + DL_OBJS="tclLoadDld.o" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS="" +fi + + + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + + # The combo of gcc + glibc has a bug related + # to inlining of functions like strtod(). The + # -fno-builtin flag should address this problem + # but it does not work. The -fno-inline flag + # is kind of overkill but it works. + # Disable inlining only when one of the + # files in compat/*.c is being linked in. + if test x"${USE_COMPAT}" != x ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline" + fi + + ;; + GNU*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + LD_SEARCH_FLAGS="" + else + if test "${ac_cv_header_dld_h+set}" = set; then + echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dld.h usability" >&5 +echo $ECHO_N "checking dld.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dld.h presence" >&5 +echo $ECHO_N "checking dld.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dld.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dld.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dld.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dld.h" >&5 +echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 +if test "${ac_cv_header_dld_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dld_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 +echo "${ECHO_T}$ac_cv_header_dld_h" >&6 + +fi +if test $ac_cv_header_dld_h = yes; then + + SHLIB_LD="ld -shared" + DL_OBJS="" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS="" +fi + + + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + ;; + MP-RAS-02*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + MP-RAS-*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-Wl,-Bexport" + LD_SEARCH_FLAGS="" + ;; + NetBSD-*|FreeBSD-[1-2].*) + # Not available on all versions: check for include file. + if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 +echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 +echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dlfcn_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 + +fi +if test $ac_cv_header_dlfcn_h = yes; then + + # NetBSD/SPARC needs -fPIC, -fpic will not do. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + echo "$as_me:$LINENO: checking for ELF" >&5 +echo $ECHO_N "checking for ELF... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef __ELF__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + +fi +rm -f conftest* + + +else + + SHLIB_CFLAGS="" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + +fi + + + + # FreeBSD doesn't handle version numbers with dots. + + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + OpenBSD-*) + SHLIB_LD="${CC} -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + echo "$as_me:$LINENO: checking for ELF" >&5 +echo $ECHO_N "checking for ELF... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef __ELF__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + +fi +rm -f conftest* + + + # OpenBSD doesn't do version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + FreeBSD-*) + # FreeBSD 3.* and greater have ELF. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="-export-dynamic" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + if test "${TCL_THREADS}" = "1" ; then + # The -pthread needs to go in the CFLAGS, not LIBS + LIBS=`echo $LIBS | sed s/-pthread//` + EXTRA_CFLAGS="-pthread" + LDFLAGS="$LDFLAGS -pthread" + fi + case $system in + FreeBSD-3.*) + # FreeBSD-3 doesn't handle version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' + TCL_LIB_VERSIONS_OK=nodots + ;; + esac + ;; + Rhapsody-*|Darwin-*) + SHLIB_CFLAGS="-fno-common" + SHLIB_LD="cc -dynamiclib \${LDFLAGS}" + TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_MAJOR_VERSION} -current_version \${PACKAGE_VERSION} -install_name \${LIB_RUNTIME_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".dylib" + DL_OBJS="tclLoadDyld.o" + DL_LIBS="" + LDFLAGS="-prebind" + LD_SEARCH_FLAGS="" + LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" + CFLAGS_OPTIMIZE="-O3" + EXTRA_CFLAGS="-arch ppc -pipe" + ;; + NEXTSTEP-*) + SHLIB_CFLAGS="" + SHLIB_LD="cc -nostdlib -r" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadNext.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OS/390-*) + CFLAGS_OPTIMIZE="" # Optimizer is buggy + cat >>confdefs.h <<\_ACEOF +#define _OE_SOCKETS 1 +_ACEOF + # needed in sys/socket.h + ;; + OSF1-1.0|OSF1-1.1|OSF1-1.2) + # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 + SHLIB_CFLAGS="" + # Hack: make package name same as library name + SHLIB_LD='ld -R -export :' + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadOSF.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-1.*) + # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 + SHLIB_CFLAGS="-fPIC" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD="ld -shared" + else + SHLIB_LD="ld -non_shared" + fi + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-V*) + # Digital OSF/1 + SHLIB_CFLAGS="" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD='ld -shared -expect_unresolved "*"' + else + SHLIB_LD='ld -non_shared -expect_unresolved "*"' + fi + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + if test "$GCC" != "yes" ; then + EXTRA_CFLAGS="-DHAVE_TZSET -std1" + fi + # see pthread_intro(3) for pthread support on osf1, k.furukawa + if test "${TCL_THREADS}" = "1" ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" + LIBS=`echo $LIBS | sed s/-lpthreads//` + if test "$GCC" = "yes" ; then + LIBS="$LIBS -lpthread -lmach -lexc" + else + EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread" + LDFLAGS="-pthread" + fi + fi + + ;; + QNX-6*) + # QNX RTP + # This may work for all QNX, but it was only reported for v6. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + # dlopen is in -lc on QNX + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + RISCos-*) + SHLIB_CFLAGS="-G 0" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + ;; + SCO_SV-3.2*) + # Note, dlopen is available only on SCO 3.2.5 and greater. However, + # this test works, since "uname -s" was non-standard in 3.2.4 and + # below. + if test "$GCC" = "yes" ; then + SHLIB_CFLAGS="-fPIC -melf" + LDFLAGS="-melf -Wl,-Bexport" + else + SHLIB_CFLAGS="-Kpic -belf" + LDFLAGS="-belf -Wl,-Bexport" + fi + SHLIB_LD="ld -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS="" + ;; + SINIX*5.4*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + SunOS-4*) + SHLIB_CFLAGS="-PIC" + SHLIB_LD="ld" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + + # SunOS can't handle version numbers with dots in them in library + # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it + # requires an extra version number at the end of .so file names. + # So, the library has to have a name like libtcl75.so.1.0 + + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + SunOS-5.[0-6]*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + + + SHLIB_CFLAGS="-KPIC" + + # Note: need the LIBS below, otherwise Tk won't find Tcl's + # symbols when dynamically loaded into tclsh. + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + ;; + SunOS-5*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + + + SHLIB_CFLAGS="-KPIC" + LDFLAGS="" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + arch=`isainfo` + if test "$arch" = "sparcv9 sparc" ; then + if test "$GCC" = "yes" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5 +echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;} + else + do64bit_ok=yes + if test "$do64bitVIS" = "yes" ; then + EXTRA_CFLAGS="-xarch=v9a" + LDFLAGS="-xarch=v9a" + else + EXTRA_CFLAGS="-xarch=v9" + LDFLAGS="-xarch=v9" + fi + fi + else + { echo "$as_me:$LINENO: WARNING: \"64bit mode only supported sparcv9 system\"" >&5 +echo "$as_me: WARNING: \"64bit mode only supported sparcv9 system\"" >&2;} + fi + fi + + # Note: need the LIBS below, otherwise Tk won't find Tcl's + # symbols when dynamically loaded into tclsh. + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + ;; + ULTRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + if test "$GCC" != "yes" ; then + EXTRA_CFLAGS="-DHAVE_TZSET -std1" + fi + ;; + UNIX_SV* | UnixWare-5*) + SHLIB_CFLAGS="-KPIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers + # that don't grok the -Bexport option. Test that it does. + hold_ldflags=$LDFLAGS + echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5 +echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6 + LDFLAGS="${LDFLAGS} -Wl,-Bexport" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + found=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +found=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$hold_ldflags + echo "$as_me:$LINENO: result: $found" >&5 +echo "${ECHO_T}$found" >&6 + if test $found = yes; then + LDFLAGS="-Wl,-Bexport" + else + LDFLAGS="" + fi + LD_SEARCH_FLAGS="" + ;; + esac + + if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then + { echo "$as_me:$LINENO: WARNING: \"64bit support being disabled -- don\'t know magic for this platform\"" >&5 +echo "$as_me: WARNING: \"64bit support being disabled -- don\'t know magic for this platform\"" >&2;} + fi + + # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic + # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop, + # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need + # to determine which of several header files defines the a.out file + # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we + # support only a file format that is more or less version-7-compatible. + # In particular, + # - a.out files must begin with `struct exec'. + # - the N_TXTOFF on the `struct exec' must compute the seek address + # of the text segment + # - The `struct exec' must contain a_magic, a_text, a_data, a_bss + # and a_entry fields. + # The following compilation should succeed if and only if either sys/exec.h + # or a.out.h is usable for the purpose. + # + # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the + # `struct exec' includes a second header that contains information that + # duplicates the v7 fields that are needed. + + if test "x$DL_OBJS" = "xtclLoadAout.o" ; then + echo "$as_me:$LINENO: checking sys/exec.h" >&5 +echo $ECHO_N "checking sys/exec.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_SYS_EXEC_H 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking a.out.h" >&5 +echo $ECHO_N "checking a.out.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_A_OUT_H 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking sys/exec_aout.h" >&5 +echo $ECHO_N "checking sys/exec_aout.h... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_midmag == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_ok=usable +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=unusable +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 + if test $tcl_ok = usable; then + cat >>confdefs.h <<\_ACEOF +#define USE_SYS_EXEC_AOUT_H 1 +_ACEOF + + else + DL_OBJS="" + fi + fi + fi + fi + + # Step 5: disable dynamic loading if requested via a command-line switch. + + # Check whether --enable-load or --disable-load was given. +if test "${enable_load+set}" = set; then + enableval="$enable_load" + tcl_ok=$enableval +else + tcl_ok=yes +fi; + if test "$tcl_ok" = "no"; then + DL_OBJS="" + fi + + if test "x$DL_OBJS" != "x" ; then + BUILD_DLTEST="\$(DLTEST_TARGETS)" + else + echo "Can't figure out how to do dynamic loading or shared libraries" + echo "on this system." + SHLIB_CFLAGS="" + SHLIB_LD="" + SHLIB_SUFFIX="" + DL_OBJS="tclLoadNone.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + BUILD_DLTEST="" + fi + + # If we're running gcc, then change the C flags for compiling shared + # libraries to the right flags for gcc, instead of those for the + # standard manufacturer compiler. + + if test "$DL_OBJS" != "tclLoadNone.o" ; then + if test "$GCC" = "yes" ; then + case $system in + AIX-*) + ;; + BSD/OS*) + ;; + IRIX*) + ;; + NetBSD-*|FreeBSD-*) + ;; + Rhapsody-*|Darwin-*) + ;; + RISCos-*) + ;; + SCO_SV-3.2*) + ;; + ULTRIX-4.*) + ;; + windows) + ;; + *) + SHLIB_CFLAGS="-fPIC" + ;; + esac + fi + fi + + if test "$SHARED_LIB_SUFFIX" = "" ; then + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}${SHLIB_SUFFIX}' + fi + if test "$UNSHARED_LIB_SUFFIX" = "" ; then + UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + fi + + + + + + + + + + + + + + + + + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols option. +#-------------------------------------------------------------------- + + + + + if test "${TEA_PLATFORM}" = "windows" ; then + tcl_dbgx=d + else + tcl_dbgx=g + fi + + echo "$as_me:$LINENO: checking for build with symbols" >&5 +echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6 + # Check whether --enable-symbols or --disable-symbols was given. +if test "${enable_symbols+set}" = set; then + enableval="$enable_symbols" + tcl_ok=$enableval +else + tcl_ok=no +fi; + if test "$tcl_ok" = "no"; then + CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" + LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" + DBGX="" + TCL_DBGX="" + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + else + CFLAGS_DEFAULT="${CFLAGS_DEBUG}" + LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" + DBGX=${tcl_dbgx} + TCL_DBGX=${tcl_dbgx} + if test "$tcl_ok" = "yes"; then + echo "$as_me:$LINENO: result: yes (standard debugging)" >&5 +echo "${ECHO_T}yes (standard debugging)" >&6 + fi + fi + if test "${TEA_PLATFORM}" != "windows" ; then + LDFLAGS_DEFAULT="${LDFLAGS}" + fi + + + + + + if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then + cat >>confdefs.h <<\_ACEOF +#define TCL_MEM_DEBUG 1 +_ACEOF + + fi + + if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then + if test "$tcl_ok" = "all"; then + echo "$as_me:$LINENO: result: enabled symbols mem debugging" >&5 +echo "${ECHO_T}enabled symbols mem debugging" >&6 + else + echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5 +echo "${ECHO_T}enabled $tcl_ok debugging" >&6 + fi + fi + + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. Add Tk too if necessary. +#-------------------------------------------------------------------- + +cat >>confdefs.h <<\_ACEOF +#define USE_TCL_STUBS 1 +_ACEOF + +#AC_DEFINE(USE_TK_STUBS) + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, +# and TEA_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + + + if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then + MAKE_STATIC_LIB="\${STLIB_LD} -out:\$@ \$(PKG_OBJECTS)" + MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\$@ \$(PKG_OBJECTS)" + MAKE_STUB_LIB="\${STLIB_LD} -out:\$@ \$(PKG_STUB_OBJECTS)" + else + MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)" + MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS}" + MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)" + fi + + if test "${SHARED_BUILD}" = "1" ; then + MAKE_LIB="${MAKE_SHARED_LIB} " + else + MAKE_LIB="${MAKE_STATIC_LIB} " + fi + + #-------------------------------------------------------------------- + # Shared libraries and static libraries have different names. + # Use the double eval to make sure the ${DBGX} in the suffix is + # substituted. + #-------------------------------------------------------------------- + + RANLIB_STUB="${RANLIB}" + if test "${TEA_PLATFORM}" = "windows" ; then + if test "${SHARED_BUILD}" = "1" ; then + # We force the unresolved linking of symbols that are really in + # the private libraries of Tcl and Tk. + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" + if test x"${TK_BIN_DIR}" != x ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" + fi + eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + fi + # Some packages build there own stubs libraries + eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + else + if test "${SHARED_BUILD}" = "1" ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" + if test x"${TK_BIN_DIR}" != x ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}" + fi + eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + fi + # Some packages build there own stubs libraries + eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + fi + + # These are escaped so that only CFLAGS is picked up at configure time. + # The other values will be substituted at make time. + CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" + if test "${SHARED_BUILD}" = "1" ; then + CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}" + fi + + + + + + + + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +# Add WISH as well if this is a Tk extension. +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for tclsh" >&5 +echo $ECHO_N "checking for tclsh... $ECHO_C" >&6 + + if test "${ac_cv_path_tclsh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "x${CELIB_DIR}" != "x" ; then + # If CELIB_DIR is defined, assume Windows/CE target is requested + # which means target tclsh cannot be run (cross-compile) + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + else + search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'` + fi + for dir in $search_path ; do + for j in `ls -r $dir/tclsh[8-9]*${EXEEXT} 2> /dev/null` \ + `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do + if test x"$ac_cv_path_tclsh" = x ; then + if test -f "$j" ; then + ac_cv_path_tclsh=$j + break + fi + fi + done + done + +fi + + + if test -f "$ac_cv_path_tclsh" ; then + TCLSH_PROG=$ac_cv_path_tclsh + echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5 +echo "${ECHO_T}$TCLSH_PROG" >&6 + else + { { echo "$as_me:$LINENO: error: No tclsh found in PATH: $search_path" >&5 +echo "$as_me: error: No tclsh found in PATH: $search_path" >&2;} + { (exit 1); exit 1; }; } + fi + + +#TEA_PROG_WISH + +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +# You may alternatively have a special pkgIndex.tcl.in or other files +# which require substituting th AC variables in. Include these here. +#-------------------------------------------------------------------- + + ac_config_files="$ac_config_files Makefile" +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 +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by xotclexpat $as_me 0.9, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +xotclexpat config.status 0.9 +configured by $0, generated by GNU Autoconf 2.57, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@CYGPATH@,$CYGPATH,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@PKG_LIB_FILE@,$PKG_LIB_FILE,;t t +s,@PKG_STUB_LIB_FILE@,$PKG_STUB_LIB_FILE,;t t +s,@PKG_STUB_SOURCES@,$PKG_STUB_SOURCES,;t t +s,@PKG_STUB_OBJECTS@,$PKG_STUB_OBJECTS,;t t +s,@PKG_TCL_SOURCES@,$PKG_TCL_SOURCES,;t t +s,@PKG_HEADERS@,$PKG_HEADERS,;t t +s,@PKG_INCLUDES@,$PKG_INCLUDES,;t t +s,@PKG_LIBS@,$PKG_LIBS,;t t +s,@PKG_CFLAGS@,$PKG_CFLAGS,;t t +s,@TCL_VERSION@,$TCL_VERSION,;t t +s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t +s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t +s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t +s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t +s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t +s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t +s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t +s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t +s,@TCL_LIBS@,$TCL_LIBS,;t t +s,@TCL_DEFS@,$TCL_DEFS,;t t +s,@TCL_EXTRA_CFLAGS@,$TCL_EXTRA_CFLAGS,;t t +s,@TCL_LD_FLAGS@,$TCL_LD_FLAGS,;t t +s,@TCL_SHLIB_LD_LIBS@,$TCL_SHLIB_LD_LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@EGREP@,$EGREP,;t t +s,@MATH_LIBS@,$MATH_LIBS,;t t +s,@XOTCL_VERSION@,$XOTCL_VERSION,;t t +s,@XOTCL_MAJOR_VERSION@,$XOTCL_MAJOR_VERSION,;t t +s,@XOTCL_MINOR_VERSION@,$XOTCL_MINOR_VERSION,;t t +s,@XOTCL_RELEASE_LEVEL@,$XOTCL_RELEASE_LEVEL,;t t +s,@XOTCL_LIB_FILE@,$XOTCL_LIB_FILE,;t t +s,@XOTCL_BUILD_LIB_SPEC@,$XOTCL_BUILD_LIB_SPEC,;t t +s,@XOTCL_LIB_SPEC@,$XOTCL_LIB_SPEC,;t t +s,@XOTCL_STUB_LIB_FILE@,$XOTCL_STUB_LIB_FILE,;t t +s,@XOTCL_BUILD_STUB_LIB_SPEC@,$XOTCL_BUILD_STUB_LIB_SPEC,;t t +s,@XOTCL_STUB_LIB_SPEC@,$XOTCL_STUB_LIB_SPEC,;t t +s,@XOTCL_SRC_DIR@,$XOTCL_SRC_DIR,;t t +s,@PKG_SOURCES@,$PKG_SOURCES,;t t +s,@PKG_OBJECTS@,$PKG_OBJECTS,;t t +s,@CLEANFILES@,$CLEANFILES,;t t +s,@TCL_INCLUDES@,$TCL_INCLUDES,;t t +s,@TCL_THREADS@,$TCL_THREADS,;t t +s,@SHARED_BUILD@,$SHARED_BUILD,;t t +s,@AR@,$AR,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@DL_LIBS@,$DL_LIBS,;t t +s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t +s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t +s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t +s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t +s,@STLIB_LD@,$STLIB_LD,;t t +s,@SHLIB_LD@,$SHLIB_LD,;t t +s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t +s,@SHLIB_LD_FLAGS@,$SHLIB_LD_FLAGS,;t t +s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t +s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t +s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t +s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t +s,@TCL_DBGX@,$TCL_DBGX,;t t +s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t +s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t +s,@MAKE_LIB@,$MAKE_LIB,;t t +s,@MAKE_SHARED_LIB@,$MAKE_SHARED_LIB,;t t +s,@MAKE_STATIC_LIB@,$MAKE_STATIC_LIB,;t t +s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t +s,@RANLIB_STUB@,$RANLIB_STUB,;t t +s,@TCLSH_PROG@,$TCLSH_PROG,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + Index: xotcl/library/xml/TclExpat-1.1/configure.in =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/configure.in (revision 0) +++ xotcl/library/xml/TclExpat-1.1/configure.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,194 @@ +#!/bin/bash -norc +dnl This file is an input file used by the GNU "autoconf" program to +dnl generate the file "configure", which is run during Tcl installation +dnl to configure the system for the local environment. +# +# RCS: @(#) $Id: configure.in,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +#----------------------------------------------------------------------- +# Sample configure.in for Tcl Extensions. The only places you should +# need to modify this file are marked by the string __CHANGE__ +#----------------------------------------------------------------------- + +configdir=$(srcdir)/../../../config + +#----------------------------------------------------------------------- +# __CHANGE__ +# Set your package name and version numbers here. +# +# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION +# set as provided. These will also be added as -D defs in your Makefile +# so you can encode the package version directly into the source files. +#----------------------------------------------------------------------- + +AC_INIT([xotclexpat], [0.9]) + +#-------------------------------------------------------------------- +# Call TEA_INIT as the first TEA_ macro to set up initial vars. +# This will define a ${TEA_PLATFORM} variable == "unix" or "windows" +# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. +#-------------------------------------------------------------------- + +TEA_INIT([3.0]) + +AC_CONFIG_AUX_DIR(../../../config) + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + +TEA_PATH_TCLCONFIG +TEA_LOAD_TCLCONFIG + +#-------------------------------------------------------------------- +# Load the tkConfig.sh file if necessary (Tk extension) +#-------------------------------------------------------------------- + +#TEA_PATH_TKCONFIG +#TEA_LOAD_TKCONFIG + +#----------------------------------------------------------------------- +# Handle the --prefix=... option by defaulting to what Tcl gave. +# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. +#----------------------------------------------------------------------- + +TEA_PREFIX + +#----------------------------------------------------------------------- +# Standard compiler checks. +# This sets up CC by using the CC env var, or looks for gcc otherwise. +# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create +# the basic setup necessary to compile executables. +#----------------------------------------------------------------------- + +TEA_SETUP_COMPILER + +#----------------------------------------------------------------------- +# __CHANGE__ +# Specify the C source files to compile in TEA_ADD_SOURCES, +# public headers that need to be installed in TEA_ADD_HEADERS, +# stub library C source files to compile in TEA_ADD_STUB_SOURCES, +# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. +# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS +# and PKG_TCL_SOURCES. +#----------------------------------------------------------------------- + +# ------- load xotclConfig.sh ---------- +SC_PATH_XOTCLCONFIG +SC_LOAD_XOTCLCONFIG +# ------- + +TEA_ADD_SOURCES([xmltok.c unixfilemap.c xmlrole.c xmlwf.c codepage.c xmlparse.c hashtable.c tclexpat.c]) +TEA_ADD_HEADERS([]) +TEA_ADD_INCLUDES([-I$XOTCL_SRC_DIR/generic]) +TEA_ADD_LIBS([$XOTCL_BUILD_STUB_LIB_SPEC]) +TEA_ADD_CFLAGS([]) +TEA_ADD_STUB_SOURCES([]) +TEA_ADD_TCL_SOURCES([]) + +#-------------------------------------------------------------------- +# __CHANGE__ +# A few miscellaneous platform-specific items: +# +# Define a special symbol for Windows (BUILD_sample in this case) so +# that we create the export library with the dll. +# +# Windows creates a few extra files that need to be cleaned up. +# You can add more files to clean if your extension creates any extra +# files. +# +# TEA_ADD_* any platform specific compiler/build info here. +#-------------------------------------------------------------------- + +if test "${TEA_PLATFORM}" = "windows" ; then + AC_DEFINE(BUILD_sample) + CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" + #TEA_ADD_SOURCES([win/winFile.c]) + #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) +else + CLEANFILES="pkgIndex.tcl" + #TEA_ADD_SOURCES([unix/unixFile.c]) + #TEA_ADD_LIBS([-lsuperfly]) +fi +AC_SUBST(CLEANFILES) + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG +#-------------------------------------------------------------------- + +TEA_PUBLIC_TCL_HEADERS +#TEA_PRIVATE_TCL_HEADERS + +#TEA_PUBLIC_TK_HEADERS +#TEA_PRIVATE_TK_HEADERS +#TEA_PATH_X + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +#-------------------------------------------------------------------- + +TEA_ENABLE_THREADS + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + +TEA_ENABLE_SHARED + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# can be taken from the tclConfig.sh file, but this figures it all out. +#-------------------------------------------------------------------- + +TEA_CONFIG_CFLAGS + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols option. +#-------------------------------------------------------------------- + +TEA_ENABLE_SYMBOLS + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. Add Tk too if necessary. +#-------------------------------------------------------------------- + +AC_DEFINE(USE_TCL_STUBS) +#AC_DEFINE(USE_TK_STUBS) + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, +# and TEA_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + +TEA_MAKE_LIB + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +# Add WISH as well if this is a Tk extension. +#-------------------------------------------------------------------- + +TEA_PROG_TCLSH +#TEA_PROG_WISH + +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +# You may alternatively have a special pkgIndex.tcl.in or other files +# which require substituting th AC variables in. Include these here. +#-------------------------------------------------------------------- + +AC_OUTPUT([Makefile]) Index: xotcl/library/xml/TclExpat-1.1/configure.in-ok =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/configure.in-ok (revision 0) +++ xotcl/library/xml/TclExpat-1.1/configure.in-ok (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,312 @@ +#-------------------------------------------------------------------- +# Sample configure.in for Tcl Extensions. The only places you should +# need to modify this file are marked by the string __CHANGE__ +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# __CHANGE__ +# This very first macro is used to verify that the configure script can +# find the sources. The argument to AC_INIT should be a unique filename +# for this package, and can be a relative path, such as: +# +# AC_INIT(../generic/tcl.h) +#-------------------------------------------------------------------- + +AC_INIT(./tclexpat.c) +AC_CONFIG_AUX_DIR(../../../config) + +#-------------------------------------------------------------------- +# __CHANGE__ +# Set your package name and version numbers here. The NODOT_VERSION is +# required for constructing the library name on systems that don't like +# dots in library names (Windows). The VERSION variable is used on the +# other systems. +#-------------------------------------------------------------------- + +PACKAGE=xotclexpat + +# do not modify the following lines manually, they are generated with changeXOTclVersion +XOTCL_MAJOR_VERSION=1 +XOTCL_MINOR_VERSION=2 +XOTCL_RELEASE_LEVEL=.1 + +MAJOR_VERSION=${XOTCL_MAJOR_VERSION} +MINOR_VERSION=${XOTCL_MINOR_VERSION} +PATCHLEVEL=${XOTCL_RELEASE_LEVEL} + +VERSION=${MAJOR_VERSION}.${MINOR_VERSION} +NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION} + +AC_SUBST(PATCHLEVEL) +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) + +#-------------------------------------------------------------------- +# We put this here so that you can compile with -DVERSION="1.2" to +# encode the package version directly into the source files. +#-------------------------------------------------------------------- + +eval AC_DEFINE_UNQUOTED(VERSION, "${VERSION}") + +#-------------------------------------------------------------------- +# Check whether --enable-gcc or --disable-gcc was given. Do this +# before AC_CYGWIN is called so the compiler can +# be fully tested by built-in autoconf tools. +# This macro also calls AC_PROG_CC to set the compiler if --enable-gcc +# was not used. +#-------------------------------------------------------------------- + +SC_ENABLE_GCC +AC_PROG_INSTALL + +#-------------------------------------------------------------------- +# Checks to see if the make program sets the $MAKE variable. +#-------------------------------------------------------------------- + +AC_PROG_MAKE_SET + +#-------------------------------------------------------------------- +# Find ranlib +#-------------------------------------------------------------------- + +AC_PROG_RANLIB + +#-------------------------------------------------------------------- +# This macro performs additional compiler tests. +#-------------------------------------------------------------------- + +AC_CYGWIN + +#-------------------------------------------------------------------- +# Determines the correct binary file extension (.o, .obj, .exe etc.) +#-------------------------------------------------------------------- + +AC_OBJEXT +AC_EXEEXT + +#-------------------------------------------------------------------- +# "cygpath" is used on windows to generate native path names for include +# files. +# These variables should only be used with the compiler and linker since +# they generate native path names. +# +# Unix tclConfig.sh points SRC_DIR at the top-level directory of +# the Tcl sources, while the Windows tclConfig.sh points SRC_DIR at +# the win subdirectory. Hence the different usages of SRC_DIR below. +# +# This must be done before calling SC_PUBLIC_TCL_HEADERS +#-------------------------------------------------------------------- + +case "`uname -s`" in + *win32* | *WIN32* | *CYGWIN_NT*) + CYGPATH="cygpath -w" + ;; + *) + CYGPATH=echo + ;; +esac + +AC_SUBST(CYGPATH) + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This MUST be called before SC_PATH_TCLCONFIG/SC_LOAD_TCLCONFIG +#-------------------------------------------------------------------- + +#SC_PUBLIC_TCL_HEADERS +SC_PRIVATE_TCL_HEADERS + +if test x"${with_tclinclude}" != x ; then + if test -f "${with_tclinclude}/tcl.h" ; then + TCL_INCLUDES="-I${with_tclinclude} ${TCL_INCLUDES}" + else + AC_MSG_ERROR([${with_tclinclude} directory does not contain Tcl header file tcl.h]) + fi +fi + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + +SC_PATH_TCLCONFIG +SC_LOAD_TCLCONFIG + +#-------------------------------------------------------------------- +# Load the xotclConfig.sh file +#-------------------------------------------------------------------- + +SC_PATH_XOTCLCONFIG +SC_LOAD_XOTCLCONFIG + +#-------------------------------------------------------------------- +# __CHANGE__ +# A few miscellaneous platform-specific items: +# +# Define a special symbol for Windows (BUILD_exampleA in this case) so +# that we create the export library with the dll. See sha1.h on how +# to use this. +# +# Windows creates a few extra files that need to be cleaned up. +# You can add more files to clean if your extension creates any extra +# files. +# +# Define any extra compiler flags in the PACKAGE_CFLAGS variable. +# These will be appended to the current set of compiler flags for +# your system. +#-------------------------------------------------------------------- + +case "`uname -s`" in + *win32* | *WIN32* | *CYGWIN_NT*) + AC_DEFINE(BUILD_xotclexpat) + CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc50.pch vc60.pch" + AC_SUBST(CLEANFILES) + ;; + *) + CLEANFILES= + ;; +esac + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +# So far only Tcl responds to this one. +#-------------------------------------------------------------------- + +SC_ENABLE_THREADS + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + +SC_ENABLE_SHARED + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# is all taken from the tclConfig.sh file. +#-------------------------------------------------------------------- + +CFLAGS_DEBUG=${TCL_CFLAGS_DEBUG} +CFLAGS_OPTIMIZE=${TCL_CFLAGS_OPTIMIZE} +LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG} +LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE} +SHLIB_LD=${TCL_SHLIB_LD} +STLIB_LD=${TCL_STLIB_LD} +SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS} + +AC_SUBST(CFLAGS_DEBUG) +AC_SUBST(CFLAGS_OPTIMIZE) +AC_SUBST(STLIB_LD) +AC_SUBST(SHLIB_LD) +AC_SUBST(SHLIB_CFLAGS) +AC_SUBST(SHLIB_LDFLAGS) + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols +# option. +#-------------------------------------------------------------------- + +SC_ENABLE_SYMBOLS + +if test "${SHARED_BUILD}" = "1" ; then + CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}' +else + CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING}' +fi + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. +#-------------------------------------------------------------------- + +if test "${TCL_MAJOR_VERSION}" = "8" -a "${TCL_MINOR_VERSION}" = "0"; then + echo "Tcl 8.0, no stubs used" + USE_TCL_STUBS="" +else + AC_DEFINE(USE_TCL_STUBS) + AC_DEFINE(USE_XOTCL_STUBS) +fi + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the SC_ENABLE_SHARED, SC_ENABLE_SYMBOLS, +# and SC_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + +SC_MAKE_LIB + +#-------------------------------------------------------------------- +# eval these two values to dereference the ${DBGX} variable. +#-------------------------------------------------------------------- + +#eval "SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}" +#eval "UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}" + +SHARED_LIB_SUFFIX=${XOTCL_SHARED_LIB_SUFFIX} +UNSHARED_LIB_SUFFIX=${XOTCL_UNSHARED_LIB_SUFFIX} + +#-------------------------------------------------------------------- +# Shared libraries and static libraries have different names. +#-------------------------------------------------------------------- + +case "`uname -s`" in + *win32* | *WIN32* | *CYGWIN_NT*) + if test "${SHARED_BUILD}" = "1" ; then + SHLIB_LD_LIBS="\"`cygpath -w ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\" \"`cygpath -w ${XOTCL_BUILD_STUB_LIB_PATH}`\" ${TCL_SHLIB_LD_LIBS}" + eval "${PACKAGE}_LIB_FILE=${PACKAGE}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval "${PACKAGE}_LIB_FILE=${PACKAGE}${UNSHARED_LIB_SUFFIX}" + fi + ;; + *) + if test "${SHARED_BUILD}" = "1" ; then + #SHLIB_LD_LIBS="${TCL_BUILD_STUB_LIB_SPEC} ${XOTCL_BUILD_STUB_LIB_SPEC}" + SHLIB_LD_LIBS="${TCL_STUB_LIB_SPEC} ${XOTCL_BUILD_STUB_LIB_SPEC}" + eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${UNSHARED_LIB_SUFFIX}" + fi + ;; +esac + +#-------------------------------------------------------------------- +# __CHANGE__ +# Change the name from exampeA_LIB_FILE to match your package name. +#-------------------------------------------------------------------- + +AC_SUBST(xotclexpat_LIB_FILE) +AC_SUBST(SHLIB_LD_LIBS) + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +#-------------------------------------------------------------------- + +SC_PROG_TCLSH + +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +#-------------------------------------------------------------------- + +AC_OUTPUT(Makefile) + + + + + + + + + + Index: xotcl/library/xml/TclExpat-1.1/dllEntryPoint.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/dllEntryPoint.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/dllEntryPoint.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,39 @@ +/* + * dllEntryPoint.c -- + * $Id: dllEntryPoint.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * + * This file implements the Dll entry point as needed by Windows. + */ + +#define WIN32_LEAN_AND_MEAN +#include +#if defined(_MSC_VER) +# define DllEntryPoint DllMain +#endif + +/* + *---------------------------------------------------------------------- + * + * DllEntryPoint -- + * + * This wrapper function is used by Windows to invoke the + * initialization code for the DLL. If we are compiling + * with Visual C++, this routine will be renamed to DllMain. + * + * Results: + * Returns TRUE; + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +BOOL APIENTRY +DllEntryPoint(hInst, reason, reserved) + HINSTANCE hInst; /* Library instance handle. */ + DWORD reason; /* Reason this function is being called. */ + LPVOID reserved; /* Not used. */ +{ + return TRUE; +} Index: xotcl/library/xml/TclExpat-1.1/dllmain.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/dllmain.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/dllmain.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,27 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#include + +BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) +{ + return TRUE; +} + Index: xotcl/library/xml/TclExpat-1.1/filemap.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/filemap.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/filemap.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,32 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + + +#include + +#ifdef XML_UNICODE +int filemap(const wchar_t *name, + void (*processor)(const void *, size_t, const wchar_t *, void *arg), + void *arg); +#else +int filemap(const char *name, + void (*processor)(const void *, size_t, const char *, void *arg), + void *arg); +#endif Index: xotcl/library/xml/TclExpat-1.1/hashtable.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/hashtable.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/hashtable.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,134 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +csompliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#include +#include + +#include "xmldef.h" +#include "hashtable.h" + +#ifdef XML_UNICODE +#define keycmp wcscmp +#else +#define keycmp strcmp +#endif + +#define INIT_SIZE 64 + +static +unsigned long hash(KEY s) +{ + unsigned long h = 0; + while (*s) + h = (h << 5) + h + (unsigned char)*s++; + return h; +} + +NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize) +{ + size_t i; + if (table->size == 0) { + if (!createSize) + return 0; + table->v = calloc(INIT_SIZE, sizeof(NAMED *)); + if (!table->v) + return 0; + table->size = INIT_SIZE; + table->usedLim = INIT_SIZE / 2; + i = hash(name) & (table->size - 1); + } + else { + unsigned long h = hash(name); + for (i = h & (table->size - 1); + table->v[i]; + i == 0 ? i = table->size - 1 : --i) { + if (keycmp(name, table->v[i]->name) == 0) + return table->v[i]; + } + if (!createSize) + return 0; + if (table->used == table->usedLim) { + /* check for overflow */ + size_t newSize = table->size * 2; + NAMED **newV = calloc(newSize, sizeof(NAMED *)); + if (!newV) + return 0; + for (i = 0; i < table->size; i++) + if (table->v[i]) { + size_t j; + for (j = hash(table->v[i]->name) & (newSize - 1); + newV[j]; + j == 0 ? j = newSize - 1 : --j) + ; + newV[j] = table->v[i]; + } + free(table->v); + table->v = newV; + table->size = newSize; + table->usedLim = newSize/2; + for (i = h & (table->size - 1); + table->v[i]; + i == 0 ? i = table->size - 1 : --i) + ; + } + } + table->v[i] = calloc(1, createSize); + if (!table->v[i]) + return 0; + table->v[i]->name = name; + (table->used)++; + return table->v[i]; +} + +void hashTableDestroy(HASH_TABLE *table) +{ + size_t i; + for (i = 0; i < table->size; i++) { + NAMED *p = table->v[i]; + if (p) + free(p); + } + free(table->v); +} + +void hashTableInit(HASH_TABLE *p) +{ + p->size = 0; + p->usedLim = 0; + p->used = 0; + p->v = 0; +} + +void hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) +{ + iter->p = table->v; + iter->end = iter->p + table->size; +} + +NAMED *hashTableIterNext(HASH_TABLE_ITER *iter) +{ + while (iter->p != iter->end) { + NAMED *tem = *(iter->p)++; + if (tem) + return tem; + } + return 0; +} + Index: xotcl/library/xml/TclExpat-1.1/hashtable.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/hashtable.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/hashtable.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,51 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + + +#include + +#ifdef XML_UNICODE +typedef const wchar_t *KEY; +#else +typedef const char *KEY; +#endif + +typedef struct { + KEY name; +} NAMED; + +typedef struct { + NAMED **v; + size_t size; + size_t used; + size_t usedLim; +} HASH_TABLE; + +NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize); +void hashTableInit(HASH_TABLE *); +void hashTableDestroy(HASH_TABLE *); + +typedef struct { + NAMED **p; + NAMED **end; +} HASH_TABLE_ITER; + +void hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); +NAMED *hashTableIterNext(HASH_TABLE_ITER *); Index: xotcl/library/xml/TclExpat-1.1/iasciitab.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/iasciitab.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/iasciitab.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,53 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ +/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, +/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, +/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, +/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, +/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, +/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, +/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, +/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, +/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_NMSTRT, BT_SEMI, +/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, +/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, +/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, +/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, +/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, +/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, +/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, +/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, +/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, Index: xotcl/library/xml/TclExpat-1.1/latin1tab.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/latin1tab.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/latin1tab.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,52 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, +/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, +/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, +/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, +/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, +/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, Index: xotcl/library/xml/TclExpat-1.1/nametab.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/nametab.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/nametab.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,150 @@ +static const unsigned namingBitmap[] = { +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, +0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, +0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, +0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, +0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, +0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, +0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, +0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, +0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, +0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, +0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, +0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, +0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, +0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, +0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, +0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, +0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, +0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, +0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, +0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, +0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, +0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, +0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, +0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, +0x40000000, 0xF580C900, 0x00000007, 0x02010800, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, +0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, +0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, +0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, +0x00000000, 0x00004C40, 0x00000000, 0x00000000, +0x00000007, 0x00000000, 0x00000000, 0x00000000, +0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, +0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, +0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, +0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, +0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, +0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, +0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, +0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, +0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, +0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, +0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, +0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, +0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, +0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, +0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, +0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, +0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, +0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, +0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, +0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, +0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, +0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, +0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, +0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, +0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, +0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, +0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, +0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, +0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, +0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, +0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, +}; +static const unsigned char nmstrtPages[] = { +0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, +0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, +0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, +0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +static const unsigned char namePages[] = { +0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, +0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, +0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, +0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; Index: xotcl/library/xml/TclExpat-1.1/readfilemap.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/readfilemap.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/readfilemap.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,89 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#include +#include +#include +#include +#include + +#ifndef S_ISREG +#ifndef S_IFREG +#define S_IFREG _S_IFREG +#endif +#ifndef S_IFMT +#define S_IFMT _S_IFMT +#endif +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#endif /* not S_ISREG */ + +#ifndef O_BINARY +#ifdef _O_BINARY +#define O_BINARY _O_BINARY +#else +#define O_BINARY 0 +#endif +#endif + +int filemap(const char *name, + void (*processor)(const void *, size_t, const char *, void *arg), + void *arg) +{ + size_t nbytes; + int fd; + int n; + struct stat sb; + void *p; + + fd = open(name, O_RDONLY|O_BINARY); + if (fd < 0) { + perror(name); + return 0; + } + if (fstat(fd, &sb) < 0) { + perror(name); + return 0; + } + if (!S_ISREG(sb.st_mode)) { + fprintf(stderr, "%s: not a regular file\n", name); + return 0; + } + nbytes = sb.st_size; + p = malloc(nbytes); + if (!p) { + fprintf(stderr, "%s: out of memory\n", name); + return 0; + } + n = read(fd, p, nbytes); + if (n < 0) { + perror(name); + close(fd); + return 0; + } + if (n != nbytes) { + fprintf(stderr, "%s: read unexpected number of bytes\n", name); + close(fd); + return 0; + } + processor(p, nbytes, name, arg); + free(p); + close(fd); + return 1; +} Index: xotcl/library/xml/TclExpat-1.1/readme =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/readme (revision 0) +++ xotcl/library/xml/TclExpat-1.1/readme (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,174 @@ + A Tcl interface to expat. + + Steve Ball, Zveno Pty Ltd. + +This package provides a Tcl interface to James Clark's expat library. +It creates a Tcl package, called "expat", which defines a single +new Tcl command "expat". + +See for more information +on XML support for Tcl. + +INSTALLATION +============ + +Unix/Linux +---------- + +You must have Tcl/Tk version 8.0p2 or 8.1a2 installed on your system. +TclExpat has been setup to use Tcl's configuration to make compilation +easy. Simply point TclExpat's Makefile at the Tcl configuration file: + + /bin/sh '. /usr/local/tcl/lib/tclConfig.sh ; make -e' + +where "/usr/local/tcl" is the installation path for Tcl. + +To install the package in the first available directory in the Tcl package +path use the command below. You may need to be root to do this. + + /bin/sh '. /usr/local/tcl/lib/tclConfig.sh ; make -e install' + +Macintosh +--------- + +The source must be compiled against the Tcl/Tk version 8.0p2 release. +A pre-compiled shareware distribution is available from Zveno, see below. + +Windows +------- + +The source must be compiled against the Tcl/Tk version 8.0p2 release. +A pre-compiled shareware distribution is available from Zveno, see below. + +SHAREWARE +========= + +Binary distributions for the Macintosh and Windows platforms are available +from Zveno. See + +USAGE +===== + +The package is loaded using: + + package require expat 1.0 + +This package defines the "expat" command which is used to create a +parser. It accepts the following arguments: + + expat parserName ?option value...? + +If no "parserName" argument is given then a unique name is chosen. +The name of the newly created parser is returned and a new Tcl command +of the same name is created to manipulate the parser. + +The parser command accepts the following methods: + + $parser cget -option + Returns the current value of an option. + + $parser configure -option value ?-option value...? + Sets configuration options. + + $parser parse xml + Parses the XML data given by "xml". This will + cause Tcl callback scripts to be invoked, if they + have been configured. + + If the document is not well-formed then the command + returns an error. + + $parser reset + Resets the parser. Call this method before parsing + a new document. + +The following options are accepted: + + -elementstartcommand command + Defines a callback script which is invoked + when the start of an element is found in the + document. The following arguments are appended + to the string before it is evaluated: + + command name attributelist + + "name" is the name of the element. + "attributelist" is the attribute list for the element. + + -elementendcommand command + Defines a callback script which is invoked + whenever an element is closed in the document. + The following arguments are appended to the string + before it is evaluated: + + command name + + "name" is the name of the element. + + -characterdatacommand command + Defines a callback script which is invoked whenever + character data is encountered in the document. + The following arguments are appended to the string + before it is evaluated: + + command data + + "data" is the character data found in the document. + + -processinginstructioncommand command + Defines a callback script which is invoked whenever + a processing instruction is encountered in the document. + The following arguments are appended to the string + before it is evaluated: + + command target data + + "target" is the target of the PI. + "data" is additional data found in the PI. + + -externalentitycommand command + Defines a callback script which is invoked whenever + an externally parsed general entity is encountered + in the document. The following arguments are appended + to the string before it is evaluated: + + command names base systemid publicid + + "names" is a list of the open entity names. + "base" is a URL to be used for resolving relative URLs. + "systemid" is the system identifier specified in the entity declaration + "publicid" is the public identifier specified in the entity declaration + + -defaultcommand command + Invoked when no other callback has been defined for a + document feature which has been encountered. + + -unparsedentitydeclcommand command + Invoked when an unparsed entity declaration is encountered. + + -notationdeclcommand command + Invoked when a notation declaration is encountered. + + -unknownencodingcommand command + Invoked when a character is encountered which has an + unknown encoding. + + -baseurl URL + Specifies a base URL to use for resolving relative URLs. + + -final boolean + Specifies whether more data is to be parsed. + +Callback scripts + +Tcl callback scripts may use the "break", "continue" and "error" commands +to alter the flow of control. + + break + Suppresses invocation of further callback scripts. + continue + Suppresses invocation of further callback scripts + until the current element has finished. + error + Suppresses invocation of further callback scripts. + The parser also returns an error condition. \ No newline at end of file Index: xotcl/library/xml/TclExpat-1.1/tclexpat.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/tclexpat.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/tclexpat.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1478 @@ +/* + * tclexpat.c -- + * + * A Tcl interface to James Clark's expat XML parser + * + * Copyright (c) 1998 Steve Ball, Zveno Pty Ltd + * + * Zveno Pty Ltd makes this software and associated documentation + * available free of charge for any purpose. You may make copies + * of the software but you must include all of this notice on any copy. + * + * Zveno Pty Ltd does not warrant that this software is error free + * or fit for any purpose. Zveno Pty Ltd disclaims any liability for + * all claims, expenses, losses, damages and costs any user may incur + * as a result of using, copying or modifying the software. + * + * $Id: tclexpat.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * + */ + +#include +#include +#include +#include "xmlparse.h" + + +/* + * The structure below is used to refer to an expat parser object. + */ + +typedef struct TclExpatInfo { + XML_Parser parser; /* The expat parser structure */ + Tcl_Interp *interp; /* Interpreter for this instance */ + Tcl_Obj *name; /* name of this instance */ + + int final; /* input data complete? */ + + int status; /* application status */ + Tcl_Obj *result; /* application return result */ + + int continueCount; /* reference count for continue */ + + Tcl_Obj *elementstartcommand; /* Script for element start */ + Tcl_Obj *elementendcommand; /* Script for element end */ + Tcl_Obj *datacommand; /* Script for character data */ + Tcl_Obj *picommand; /* Script for processing instruction */ + Tcl_Obj *defaultcommand; /* Script for default data */ + Tcl_Obj *unparsedcommand; /* Script for unparsed entity declaration */ + Tcl_Obj *notationcommand; /* Script for notation declaration */ + Tcl_Obj *externalentitycommand; /* Script for external entity */ + Tcl_Obj *unknownencodingcommand; /* Script for unknown character encoding */ + +} TclExpatInfo; + +/* + * Prototypes for procedures defined later in this file: + */ + +static Tcl_ObjCmdProc TclExpatObjCmd; +static Tcl_ObjCmdProc TclExpatInstanceCmd; +static Tcl_CmdDeleteProc TclExpatDeleteCmd; +static int (TclExpatCreateParser) _ANSI_ARGS_((Tcl_Interp *interp, + TclExpatInfo *expat)); +static void (TclExpatFreeParser) _ANSI_ARGS_((TclExpatInfo *expat)); +static int (TclExpatParse) _ANSI_ARGS_((Tcl_Interp *interp, + TclExpatInfo *expat, + char *data, + size_t len)); +static int (TclExpatConfigure) _ANSI_ARGS_((Tcl_Interp *interp, + TclExpatInfo *expat, + int objc, + Tcl_Obj *CONST objv[])); +static int (TclExpatCget) _ANSI_ARGS_((Tcl_Interp *interp, + TclExpatInfo *expat, + int objc, + Tcl_Obj *CONST objv[])); + +static void * (TclExpatElementStartHandler) _ANSI_ARGS_((void *userdata, + const XML_Char *name, + const XML_Char **atts)); +static void * (TclExpatElementEndHandler) _ANSI_ARGS_((void *userData, + const XML_Char *name)); +static void * (TclExpatCharacterDataHandler) _ANSI_ARGS_((void *userData, + const XML_Char *s, + int len)); +static void * (TclExpatProcessingInstructionHandler) _ANSI_ARGS_((void *userData, + const XML_Char *target, + const XML_Char *data)); +static void * (TclExpatExternalEntityRefHandler) _ANSI_ARGS_((XML_Parser parser, + const XML_Char *openEntityNames, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId)); +static void * (TclExpatDefaultHandler) _ANSI_ARGS_ ((void *userData, + const XML_Char *s, + int len)); +static void * (TclExpatUnparsedDeclHandler) _ANSI_ARGS_ ((void *userData, + const XML_Char *entityname, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName)); +static void * (TclExpatNotationDeclHandler) _ANSI_ARGS_ ((void *userData, + const XML_Char *notationName, + const XML_Char *base, + const XML_Char *systemId, const XML_Char *publicId)); +static int (TclExpatUnknownEncodingHandler) _ANSI_ARGS_ ((void *encodingHandlerData, + const XML_Char *name, + XML_Encoding *info)); + +#if defined(PRE81) + +/* + *---------------------------------------------------------------------------- + * + * Tcl_GetString -- + * + * Compatibility routine for Tcl 8.0 + * + * Results: + * String representation of object.. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------------- + */ + +char * +Tcl_GetString (obj) + Tcl_Obj *obj; /* Object to retrieve string from. */ +{ + char *s; + int i; + + s = Tcl_GetStringFromObj(obj, &i); + return s; +} +#endif + +/* + *---------------------------------------------------------------------------- + * + * TclExpat_Init -- + * + * Initialisation routine for loadable module + * + * Results: + * None. + * + * Side effects: + * Defines "expat" command in the interpreter. + * + *---------------------------------------------------------------------------- + */ + +/* this should be done via the stubs ... for the time being + simply export */ +#ifdef VISUAL_CC +DLLEXPORT extern int Xotclexpat_Init(Tcl_Interp * interp); +# define CONST_XOTCL_EXPAT +#else +# if defined(PRE84) +# define CONST_XOTCL_EXPAT +# else +# define CONST_XOTCL_EXPAT CONST84 +# endif +#endif + +extern int +Xotclexpat_Init (interp) + Tcl_Interp *interp; /* Interpreter to initialise. */ +{ +#ifdef USE_TCL_STUBS + if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { + return TCL_ERROR; + } +#ifdef USE_XOTCL_STUBS + if (Xotcl_InitStubs(interp, "1.1", 0) == NULL) { + return TCL_ERROR; + } +#endif +#else + if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL) { + return TCL_ERROR; + } +#endif + + + Tcl_PkgProvide(interp, "xotcl::xml::expat", PACKAGE_VERSION); + + Tcl_CreateObjCommand(interp, "expat", TclExpatObjCmd, NULL, NULL); + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatObjCmd -- + * + * Creation command for expat class. + * + * Results: + * The name of the newly created parser instance. + * + * Side effects: + * This creates an expat parser. + * + *---------------------------------------------------------------------------- + */ + +int +TclExpatObjCmd(dummy, interp, objc, objv) + ClientData dummy; + Tcl_Interp *interp; + int objc; + Tcl_Obj *CONST objv[]; +{ + TclExpatInfo *expat; + + if (objc < 2) { + Tcl_WrongNumArgs(interp, 1, objv, "name ?args?"); + return TCL_ERROR; + } + + /* + * Create the data structures for this parser. + */ + + if (!(expat = (TclExpatInfo *) ckalloc(sizeof(TclExpatInfo)))) { + ckfree((char*)expat); + Tcl_SetResult(interp, "unable to create parser", NULL); + return TCL_ERROR; + } + expat->interp = interp; + Tcl_IncrRefCount(objv[1]); + expat->name = objv[1]; + + expat->elementstartcommand = NULL; + expat->elementendcommand = NULL; + expat->datacommand = NULL; + expat->picommand = NULL; + expat->defaultcommand = NULL; + expat->unparsedcommand = NULL; + expat->notationcommand = NULL; + expat->externalentitycommand = NULL; + expat->unknownencodingcommand = NULL; + + if (TclExpatCreateParser(interp, expat) != TCL_OK) { + ckfree((char*)expat); + return TCL_ERROR; + } + + /* + * Register a Tcl command for this parser instance. + */ + + Tcl_CreateObjCommand(interp, Tcl_GetString(expat->name), TclExpatInstanceCmd, (ClientData) expat, TclExpatDeleteCmd); + + /* + * Handle configuration options + */ + + if (objc > 2) { + TclExpatConfigure(interp, expat, objc - 2, objv + 2); + } + + Tcl_SetObjResult(interp, expat->name); + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatCreateParser -- + * + * Create the expat parser and initialise (some of) the TclExpatInfo + * structure. + * + * Note that callback commands are not affected by this routine, + * to allow a reset to leave these intact. + * + * Results: + * New parser instance created and initialised. + * + * Side effects: + * Creates an expat parser. + * Modifies TclExpatInfo fields. + * + *---------------------------------------------------------------------------- + */ + +int +TclExpatCreateParser(interp, expat) + Tcl_Interp *interp; + TclExpatInfo *expat; +{ + if (!(expat->parser = XML_ParserCreate(NULL))) { + Tcl_SetResult(interp, "unable to create expat parser", NULL); + return TCL_ERROR; + } + + expat->final = 1; + expat->status = TCL_OK; + expat->result = NULL; + expat->continueCount = 0; + + /* + * Set handlers for the parser to routines in this module. + */ + + XML_SetElementHandler(expat->parser, + (XML_StartElementHandler) TclExpatElementStartHandler, + (XML_EndElementHandler) TclExpatElementEndHandler); + XML_SetCharacterDataHandler(expat->parser, + (XML_CharacterDataHandler) TclExpatCharacterDataHandler); + XML_SetProcessingInstructionHandler(expat->parser, + (XML_ProcessingInstructionHandler) TclExpatProcessingInstructionHandler); + XML_SetDefaultHandler(expat->parser, + (XML_DefaultHandler) TclExpatDefaultHandler); + XML_SetUnparsedEntityDeclHandler(expat->parser, + (XML_UnparsedEntityDeclHandler) TclExpatUnparsedDeclHandler); + XML_SetNotationDeclHandler(expat->parser, + (XML_NotationDeclHandler) TclExpatNotationDeclHandler); + XML_SetExternalEntityRefHandler(expat->parser, + (XML_ExternalEntityRefHandler) TclExpatExternalEntityRefHandler); + XML_SetUnknownEncodingHandler(expat->parser, + (XML_UnknownEncodingHandler) TclExpatUnknownEncodingHandler, + (void *) expat); + XML_SetUserData(expat->parser, + (void *) expat); + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatFreeParser -- + * + * Destroy the expat parser structure. + * + * Results: + * None. + * + * Side effects: + * Frees any memory allocated for the XML parser. + * + *---------------------------------------------------------------------------- + */ + +void +TclExpatFreeParser(expat) + TclExpatInfo *expat; +{ + XML_ParserFree(expat->parser); + expat->parser = NULL; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatInstanceCmd -- + * + * Implements instance command for expat class objects. + * + * Results: + * Depends on the method. + * + * Side effects: + * Depends on the method. + * + *---------------------------------------------------------------------------- + */ + +int +TclExpatInstanceCmd (clientData, interp, objc, objv) + ClientData clientData; + Tcl_Interp *interp; + int objc; + Tcl_Obj *CONST objv[]; +{ + TclExpatInfo *expat = (TclExpatInfo *) clientData; + char *data; + size_t len; + int index, result = TCL_OK; + static char CONST_XOTCL_EXPAT *options[] = { + "configure", "cget", "parse", "reset", NULL + }; + enum options { + EXPAT_CONFIGURE, EXPAT_CGET, EXPAT_PARSE, EXPAT_RESET + }; + + if (objc < 2) { + Tcl_WrongNumArgs(interp, 1, objv, "method ?args?"); + return TCL_ERROR; + } + + if (Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0, + &index) != TCL_OK) { + return TCL_ERROR; + } + + switch ((enum options) index) { + case EXPAT_CONFIGURE: + + result = TclExpatConfigure(interp, (TclExpatInfo *) clientData, objc - 2, objv + 2); + break; + + case EXPAT_CGET: + + result = TclExpatCget(interp, (TclExpatInfo *) clientData, objc - 2, objv + 2); + break; + + case EXPAT_PARSE: + + if (objc != 3) { + Tcl_WrongNumArgs(interp, 2, objv, "data"); + return TCL_ERROR; + } + + data = Tcl_GetStringFromObj(objv[2], &len); + + result = TclExpatParse(interp, expat, data, len); + + break; + + case EXPAT_RESET: + + if (objc > 2) { + Tcl_WrongNumArgs(interp, 1, objv, ""); + return TCL_ERROR; + } + + /* + * Destroy the parser and create a fresh one. + */ + + TclExpatFreeParser(expat); + TclExpatCreateParser(interp, expat); + + break; + + default: + + Tcl_SetResult(interp, "unknown method", NULL); + return TCL_ERROR; + + } + + return result; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatParse -- + * + * Wrapper to invoke expat parser and check return result. + * + * Results: + * TCL_OK if no errors, TCL_ERROR otherwise. + * + * Side effects: + * Sets interpreter result as appropriate. + * + *---------------------------------------------------------------------------- + */ + +int +TclExpatParse (interp, expat, data, len) + Tcl_Interp *interp; + TclExpatInfo *expat; + char *data; + size_t len; +{ + int result; + char s[255]; + + expat->status = TCL_OK; + if (expat->result != NULL) { + Tcl_DecrRefCount(expat->result); + } + expat->result = NULL; + + result = XML_Parse(expat->parser, + data, len, + expat->final); + + if (!result) { + Tcl_ResetResult(interp); + sprintf(s, "%d", XML_GetCurrentLineNumber(expat->parser)); + Tcl_AppendResult(interp, "error \"", + XML_ErrorString(XML_GetErrorCode(expat->parser)), + "\" at line ", s, " character ", NULL); + sprintf(s, "%d", XML_GetCurrentColumnNumber(expat->parser)); + Tcl_AppendResult(interp, s, NULL); + + return TCL_ERROR; + } + + switch (expat->status) { + case TCL_OK: + case TCL_BREAK: + case TCL_CONTINUE: + Tcl_ResetResult(interp); + return TCL_OK; + + case TCL_ERROR: + Tcl_SetObjResult(interp, expat->result); + return TCL_ERROR; + + default: + Tcl_SetResult(interp, "unknown parsing status", NULL); + return TCL_ERROR; + } + +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatConfigure -- + * + * Implements instance command for expat class objects. + * + * Results: + * Depends on the method. + * + * Side effects: + * Depends on the method. + * + *---------------------------------------------------------------------------- + */ + +int +TclExpatConfigure (interp, expat, objc, objv) + Tcl_Interp *interp; + TclExpatInfo *expat; + int objc; + Tcl_Obj *CONST objv[]; +{ + static CONST_XOTCL_EXPAT char *switchTable[] = { + "-final", + "-baseurl", + "-elementstartcommand", + "-elementendcommand", + "-characterdatacommand", + "-processinginstructioncommand", + "-defaultcommand", + "-unparsedentitydeclcommand", + "-notationdeclcommand", + "-externalentitycommand", + "-unknownencodingcommand", + (char *) NULL + }; + enum switches { + EXPAT_FINAL, EXPAT_BASE, + EXPAT_ELEMENTSTARTCMD, EXPAT_ELEMENTENDCMD, + EXPAT_DATACMD, EXPAT_PICMD, + EXPAT_DEFAULTCMD, + EXPAT_UNPARSEDENTITYCMD, EXPAT_NOTATIONCMD, + EXPAT_EXTERNALENTITYCMD, EXPAT_UNKNOWNENCODINGCMD + }; + int index, bool, doParse = 0; + Tcl_Obj *CONST *objPtr = objv; + + while (objc > 1) { + if (Tcl_GetIndexFromObj(interp, objPtr[0], switchTable, + "switch", 0, &index) != TCL_OK) { + return TCL_ERROR; + } + switch ((enum switches) index) { + case EXPAT_FINAL: /* -final */ + + if (Tcl_GetBooleanFromObj(interp, objPtr[1], &bool) != TCL_OK) { + return TCL_ERROR; + } + + if (bool && !expat->final) { + + expat->final = bool; + doParse = 1; + + } else if (!bool && expat->final) { + + /* + * Reset the parser for new input + */ + + TclExpatFreeParser(expat); + TclExpatCreateParser(interp, expat); + doParse = 0; + + } + + break; + + case EXPAT_BASE: /* -base */ + + if (XML_SetBase(expat->parser, Tcl_GetString(objPtr[1])) == 0) { + Tcl_SetResult(interp, "unable to set base URL", NULL); + return TCL_ERROR; + } + break; + + case EXPAT_ELEMENTSTARTCMD: /* -elementstartcommand */ + + if (expat->elementstartcommand != NULL) { + Tcl_DecrRefCount(expat->elementstartcommand); + } + + expat->elementstartcommand = objPtr[1]; + Tcl_IncrRefCount(expat->elementstartcommand); + + break; + + case EXPAT_ELEMENTENDCMD: /* -elementendcommand */ + + if (expat->elementendcommand != NULL) { + Tcl_DecrRefCount(expat->elementendcommand); + } + + expat->elementendcommand = objPtr[1]; + Tcl_IncrRefCount(expat->elementendcommand); + + break; + + case EXPAT_DATACMD: /* -characterdatacommand */ + + if (expat->datacommand != NULL) { + Tcl_DecrRefCount(expat->datacommand); + } + + expat->datacommand = objPtr[1]; + Tcl_IncrRefCount(expat->datacommand); + + break; + + case EXPAT_PICMD: /* -processinginstructioncommand */ + + if (expat->picommand != NULL) { + Tcl_DecrRefCount(expat->picommand); + } + + expat->picommand = objPtr[1]; + Tcl_IncrRefCount(expat->picommand); + + break; + + case EXPAT_DEFAULTCMD: /* -defaultcommand */ + + if (expat->defaultcommand != NULL) { + Tcl_DecrRefCount(expat->defaultcommand); + } + + expat->defaultcommand = objPtr[1]; + Tcl_IncrRefCount(expat->defaultcommand); + + break; + + case EXPAT_UNPARSEDENTITYCMD: /* -unparsedentitydeclcommand */ + + if (expat->unparsedcommand != NULL) { + Tcl_DecrRefCount(expat->unparsedcommand); + } + + expat->unparsedcommand = objPtr[1]; + Tcl_IncrRefCount(expat->unparsedcommand); + + break; + + case EXPAT_NOTATIONCMD: /* -notationdeclcommand */ + + if (expat->notationcommand != NULL) { + Tcl_DecrRefCount(expat->notationcommand); + } + + expat->notationcommand = objPtr[1]; + Tcl_IncrRefCount(expat->notationcommand); + + break; + + case EXPAT_EXTERNALENTITYCMD: /* -externalentitycommand */ + + if (expat->externalentitycommand != NULL) { + Tcl_DecrRefCount(expat->externalentitycommand); + } + + expat->externalentitycommand = objPtr[1]; + Tcl_IncrRefCount(expat->externalentitycommand); + + break; + + case EXPAT_UNKNOWNENCODINGCMD: /* -unknownencodingcommand */ + + /* Not implemented */ + break; + + if (expat->unknownencodingcommand != NULL) { + Tcl_DecrRefCount(expat->unknownencodingcommand); + } + + expat->unknownencodingcommand = objPtr[1]; + Tcl_IncrRefCount(expat->unknownencodingcommand); + + break; + + } + + objPtr += 2; + objc -= 2; + + } + + if (doParse) { + return TclExpatParse(interp, expat->parser, "", 0); + } else { + return TCL_OK; + } + +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatCget -- + * + * Returns setting of configuration option. + * Not yet implemented. + * + * Results: + * Option value. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------------- + */ + +int +TclExpatCget (interp, expat, objc, objv) + Tcl_Interp *interp; + TclExpatInfo *expat; + int objc; + Tcl_Obj *CONST objv[]; +{ + Tcl_SetResult(interp, "method not implemented", NULL); + return TCL_ERROR; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatHandlerResult -- + * + * Manage the result of the application callback. + * + * Results: + * None. + * + * Side Effects: + * Further invocation of callback scripts may be inhibited. + * + *---------------------------------------------------------------------------- + */ + +void +TclExpatHandlerResult(expat, result) + TclExpatInfo *expat; + int result; +{ + switch (result) { + case TCL_OK: + expat->status = TCL_OK; + break; + + case TCL_CONTINUE: + /* + * Skip callbacks until the matching end element event + * occurs for the currently open element. + * Keep a reference count to handle nested + * elements. + */ + expat->status = TCL_CONTINUE; + expat->continueCount = 1; + break; + + case TCL_BREAK: + /* + * Skip all further callbacks, but return OK. + */ + expat->status = TCL_BREAK; + break; + + case TCL_ERROR: + /* + * Skip all further callbacks, and return error. + */ + default: + expat->status = TCL_ERROR; + expat->result = Tcl_GetObjResult(expat->interp); + Tcl_IncrRefCount(expat->result); + break; + } +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatElementStartHandler -- + * + * Called by expat for each start tag. + * + * Results: + * None. + * + * Side Effects: + * Callback script is invoked. + * + *---------------------------------------------------------------------------- + */ + +static void * +TclExpatElementStartHandler(userData, name, atts) + void *userData; + const char *name; + const char **atts; +{ + TclExpatInfo *expat = (TclExpatInfo *) userData; + Tcl_Obj *atList, *cmdPtr; + const char **atPtr; + int result; + + if (expat->status == TCL_CONTINUE) { + + /* + * We're currently skipping elements looking for the + * close of the continued element. + */ + + expat->continueCount++; + return NULL; + } + + if (expat->elementstartcommand == NULL || + expat->status != TCL_OK) { + return NULL; + } + + /* + * Convert the attribute list into a Tcl key-value paired list. + */ + + atList = Tcl_NewListObj(0, NULL); + for (atPtr = atts; atPtr[0] && atPtr[1]; atPtr += 2) { + Tcl_ListObjAppendElement(expat->interp, atList, Tcl_NewStringObj((char *)atPtr[0], strlen(atPtr[0]))); + Tcl_ListObjAppendElement(expat->interp, atList, Tcl_NewStringObj((char *)atPtr[1], strlen(atPtr[1]))); + } + + /* + * Take a copy of the callback script so that arguments may be appended. + */ + + cmdPtr = Tcl_DuplicateObj(expat->elementstartcommand); + Tcl_IncrRefCount(cmdPtr); + Tcl_Preserve((ClientData) expat->interp); + + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)name, strlen(name))); + Tcl_ListObjAppendElement(expat->interp, cmdPtr, atList); + + /* + * It would be desirable to be able to terminate parsing + * if the return result is TCL_ERROR or TCL_BREAK. + */ +#if defined(PRE81) + result = Tcl_GlobalEvalObj(expat->interp, cmdPtr); +#elif defined(PRE82) + result = Tcl_EvalObj(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#else + result = Tcl_EvalObjEx(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#endif + + Tcl_DecrRefCount(cmdPtr); + Tcl_Release((ClientData) expat->interp); + + TclExpatHandlerResult(expat, result); + + return NULL; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatElementEndHandler -- + * + * Called by expat for each end tag. + * + * Results: + * None. + * + * Side Effects: + * Callback script is invoked. + * + *---------------------------------------------------------------------------- + */ + +static void * +TclExpatElementEndHandler(userData, name) + void *userData; + CONST char *name; +{ + TclExpatInfo *expat = (TclExpatInfo *) userData; + Tcl_Obj *cmdPtr; + int result; + + if (expat->status == TCL_CONTINUE) { + /* + * We're currently skipping elements looking for the + * end of the currently open element. + */ + + if (!--(expat->continueCount)) { + expat->status = TCL_OK; + return NULL; + } + } + + if (expat->elementendcommand == NULL || + expat->status != TCL_OK) { + return NULL; + } + + /* + * Take a copy of the callback script so that arguments may be appended. + */ + + cmdPtr = Tcl_DuplicateObj(expat->elementendcommand); + Tcl_IncrRefCount(cmdPtr); + Tcl_Preserve((ClientData) expat->interp); + + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)name, strlen(name))); + + /* + * It would be desirable to be able to terminate parsing + * if the return result is TCL_ERROR or TCL_BREAK. + */ +#if defined(PRE81) + result = Tcl_GlobalEvalObj(expat->interp, cmdPtr); +#elif defined(PRE82) + result = Tcl_EvalObj(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#else + result = Tcl_EvalObjEx(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#endif + + Tcl_DecrRefCount(cmdPtr); + Tcl_Release((ClientData) expat->interp); + + TclExpatHandlerResult(expat, result); + + return NULL; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatCharacterDataHandler -- + * + * Called by expat for character data. + * + * Results: + * None. + * + * Side Effects: + * Callback script is invoked. + * + *---------------------------------------------------------------------------- + */ + +static void * +TclExpatCharacterDataHandler(userData, s, len) + void *userData; + CONST char *s; + int len; +{ + TclExpatInfo *expat = (TclExpatInfo *) userData; + Tcl_Obj *cmdPtr; + int result; + + if (expat->datacommand == NULL || + expat->status != TCL_OK) { + return NULL; + } + + /* + * Take a copy of the callback script so that arguments may be appended. + */ + + cmdPtr = Tcl_DuplicateObj(expat->datacommand); + Tcl_IncrRefCount(cmdPtr); + Tcl_Preserve((ClientData) expat->interp); + + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)s, len)); + + /* + * It would be desirable to be able to terminate parsing + * if the return result is TCL_ERROR or TCL_BREAK. + */ +#if defined(PRE81) + result = Tcl_GlobalEvalObj(expat->interp, cmdPtr); +#elif defined(PRE82) + result = Tcl_EvalObj(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#else + result = Tcl_EvalObjEx(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#endif + + Tcl_DecrRefCount(cmdPtr); + Tcl_Release((ClientData) expat->interp); + + TclExpatHandlerResult(expat, result); + + return NULL; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatProcessingInstructionHandler -- + * + * Called by expat for processing instructions. + * + * Results: + * None. + * + * Side Effects: + * Callback script is invoked. + * + *---------------------------------------------------------------------------- + */ + +static void * +TclExpatProcessingInstructionHandler(userData, target, data) + void *userData; + CONST char *target; + CONST char *data; +{ + TclExpatInfo *expat = (TclExpatInfo *) userData; + Tcl_Obj *cmdPtr; + int result; + + if (expat->picommand == NULL || + expat->status != TCL_OK) { + return NULL; + } + + /* + * Take a copy of the callback script so that arguments may be appended. + */ + + cmdPtr = Tcl_DuplicateObj(expat->picommand); + Tcl_IncrRefCount(cmdPtr); + Tcl_Preserve((ClientData) expat->interp); + + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)target, strlen(target))); + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)data, strlen(data))); + + /* + * It would be desirable to be able to terminate parsing + * if the return result is TCL_ERROR or TCL_BREAK. + */ +#if defined(PRE81) + result = Tcl_GlobalEvalObj(expat->interp, cmdPtr); +#elif defined(PRE82) + result = Tcl_EvalObj(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#else + result = Tcl_EvalObjEx(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#endif + + Tcl_DecrRefCount(cmdPtr); + Tcl_Release((ClientData) expat->interp); + + TclExpatHandlerResult(expat, result); + + return NULL; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatDefaultHandler -- + * + * Called by expat for processing data which has no other handler. + * + * Results: + * None. + * + * Side Effects: + * Callback script is invoked. + * + *---------------------------------------------------------------------------- + */ + +static void * +TclExpatDefaultHandler(userData, s, len) + void *userData; + CONST char *s; + int len; +{ + TclExpatInfo *expat = (TclExpatInfo *) userData; + Tcl_Obj *cmdPtr; + int result; + + if (expat->defaultcommand == NULL || + expat->status != TCL_OK) { + return NULL; + } + + /* + * Take a copy of the callback script so that arguments may be appended. + */ + + cmdPtr = Tcl_DuplicateObj(expat->defaultcommand); + Tcl_IncrRefCount(cmdPtr); + Tcl_Preserve((ClientData) expat->interp); + + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)s, len)); + + /* + * It would be desirable to be able to terminate parsing + * if the return result is TCL_ERROR or TCL_BREAK. + */ +#if defined(PRE81) + result = Tcl_GlobalEvalObj(expat->interp, cmdPtr); +#elif defined(PRE82) + result = Tcl_EvalObj(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#else + result = Tcl_EvalObjEx(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#endif + + Tcl_DecrRefCount(cmdPtr); + Tcl_Release((ClientData) expat->interp); + + TclExpatHandlerResult(expat, result); + + return NULL; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatUnparsedDeclHandler -- + * + * Called by expat for processing an unparsed entity references. + * + * Results: + * None. + * + * Side Effects: + * Callback script is invoked. + * + *---------------------------------------------------------------------------- + */ + +static void * +TclExpatUnparsedDeclHandler(userData, entityname, base, systemId, publicId, notationName) + void *userData; + CONST char *entityname; + CONST char *base; + CONST char *systemId; + CONST char *publicId; + CONST char *notationName; +{ + TclExpatInfo *expat = (TclExpatInfo *) userData; + Tcl_Obj *cmdPtr; + int result; + + if (expat->unparsedcommand == NULL || + expat->status != TCL_OK) { + return NULL; + } + + /* + * Take a copy of the callback script so that arguments may be appended. + */ + + cmdPtr = Tcl_DuplicateObj(expat->unparsedcommand); + Tcl_IncrRefCount(cmdPtr); + Tcl_Preserve((ClientData) expat->interp); + + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)entityname, strlen(entityname))); + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)base, strlen(base))); + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)systemId, strlen(systemId))); + if (publicId == NULL) { + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewListObj(0, NULL)); + } else { + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)publicId, strlen(publicId))); + } + if (notationName == NULL) { + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewListObj(0, NULL)); + } else { + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)notationName, strlen(notationName))); + } + + /* + * It would be desirable to be able to terminate parsing + * if the return result is TCL_ERROR or TCL_BREAK. + */ +#if defined(PRE81) + result = Tcl_GlobalEvalObj(expat->interp, cmdPtr); +#elif defined(PRE82) + result = Tcl_EvalObj(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#else + result = Tcl_EvalObjEx(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#endif + + Tcl_DecrRefCount(cmdPtr); + Tcl_Release((ClientData) expat->interp); + + TclExpatHandlerResult(expat, result); + + return NULL; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatNotationDeclHandler -- + * + * Called by expat for processing a notation declaration. + * + * Results: + * None. + * + * Side Effects: + * Callback script is invoked. + * + *---------------------------------------------------------------------------- + */ + +static void * +TclExpatNotationDeclHandler(userData, notationName, base, systemId, publicId) + void *userData; + CONST char *notationName; + CONST char *base; + CONST char *systemId; + CONST char *publicId; +{ + TclExpatInfo *expat = (TclExpatInfo *) userData; + Tcl_Obj *cmdPtr; + int result; + + if (expat->notationcommand == NULL || + expat->status != TCL_OK) { + return NULL; + } + + /* + * Take a copy of the callback script so that arguments may be appended. + */ + + cmdPtr = Tcl_DuplicateObj(expat->notationcommand); + Tcl_IncrRefCount(cmdPtr); + Tcl_Preserve((ClientData) expat->interp); + + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)notationName, strlen(notationName))); + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)base, strlen(base))); + if (systemId == NULL) { + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewListObj(0, NULL)); + } else { + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)systemId, strlen(systemId))); + } + if (publicId == NULL) { + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewListObj(0, NULL)); + } else { + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)publicId, strlen(publicId))); + } + + /* + * It would be desirable to be able to terminate parsing + * if the return result is TCL_ERROR or TCL_BREAK. + */ +#if defined(PRE81) + result = Tcl_GlobalEvalObj(expat->interp, cmdPtr); +#elif defined(PRE82) + result = Tcl_EvalObj(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#else + result = Tcl_EvalObjEx(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#endif + + Tcl_DecrRefCount(cmdPtr); + Tcl_Release((ClientData) expat->interp); + + TclExpatHandlerResult(expat, result); + + return NULL; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatUnknownEncodingHandler -- + * + * Called by expat for processing a reference to a character in an + * unknown encoding. + * + * Results: + * None. + * + * Side Effects: + * Callback script is invoked. + * + *---------------------------------------------------------------------------- + */ + +static int +TclExpatUnknownEncodingHandler(encodingHandlerData, name, info) + void *encodingHandlerData; + CONST char *name; + XML_Encoding *info; +{ + TclExpatInfo *expat = (TclExpatInfo *) encodingHandlerData; + Tcl_Obj *cmdPtr; + int result; + + Tcl_SetResult(expat->interp, "not implemented", NULL); + return 0; + + if (expat->unknownencodingcommand == NULL || + expat->status != TCL_OK) { + return 0; + } + + /* + * Take a copy of the callback script so that arguments may be appended. + */ + + cmdPtr = Tcl_DuplicateObj(expat->unknownencodingcommand); + Tcl_IncrRefCount(cmdPtr); + Tcl_Preserve((ClientData) expat->interp); + + /* + * Setup the arguments + */ + + /* + * It would be desirable to be able to terminate parsing + * if the return result is TCL_ERROR or TCL_BREAK. + */ +#if defined(PRE81) + result = Tcl_GlobalEvalObj(expat->interp, cmdPtr); +#elif defined(PRE82) + result = Tcl_EvalObj(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#else + result = Tcl_EvalObjEx(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#endif + + Tcl_DecrRefCount(cmdPtr); + Tcl_Release((ClientData) expat->interp); + + TclExpatHandlerResult(expat, result); + + /* + * NOTE: have to decide whether to return 0 or 1 here, + * since Expat is waiting for an answer. + */ + return 0; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatExternalEntityRefHandler -- + * + * Called by expat for processing external entity references. + * + * Results: + * None. + * + * Side Effects: + * Callback script is invoked. + * + *---------------------------------------------------------------------------- + */ + +static void * +TclExpatExternalEntityRefHandler(parser, openEntityNames, base, systemId, publicId) + XML_Parser parser; + CONST char *openEntityNames; + CONST char *base; + CONST char *systemId; + CONST char *publicId; +{ + TclExpatInfo *expat = (TclExpatInfo *) XML_GetUserData(parser); + Tcl_Obj *cmdPtr; + int result; + + if (expat->externalentitycommand == NULL || + expat->status != TCL_OK) { + return NULL; + } + + /* + * Take a copy of the callback script so that arguments may be appended. + */ + + cmdPtr = Tcl_DuplicateObj(expat->externalentitycommand); + Tcl_IncrRefCount(cmdPtr); + Tcl_Preserve((ClientData) expat->interp); + + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)openEntityNames, strlen(openEntityNames))); + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)base, strlen(base))); + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)systemId, strlen(systemId))); + Tcl_ListObjAppendElement(expat->interp, cmdPtr, Tcl_NewStringObj((char *)publicId, strlen(publicId))); + + /* + * It would be desirable to be able to terminate parsing + * if the return result is TCL_ERROR or TCL_BREAK. + */ +#if defined(PRE81) + result = Tcl_GlobalEvalObj(expat->interp, cmdPtr); +#elif defined(PRE82) + result = Tcl_EvalObj(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#else + result = Tcl_EvalObjEx(expat->interp, cmdPtr, TCL_EVAL_GLOBAL); +#endif + + Tcl_DecrRefCount(cmdPtr); + Tcl_Release((ClientData) expat->interp); + + TclExpatHandlerResult(expat, result); + + return NULL; +} + +/* + *---------------------------------------------------------------------------- + * + * TclExpatDeleteCmd -- + * + * Called when a expat parser is deleted. + * + * Results: + * None. + * + * Side Effects: + * Memory structures are freed. + * + *---------------------------------------------------------------------------- + */ + +static void +TclExpatDeleteCmd(clientData) + ClientData clientData; +{ + TclExpatInfo *expat = (TclExpatInfo *) clientData; + + TclExpatFreeParser(expat); + + Tcl_DecrRefCount(expat->name); + + if (expat->elementstartcommand) { + Tcl_DecrRefCount(expat->elementstartcommand); + } + if (expat->elementendcommand) { + Tcl_DecrRefCount(expat->elementendcommand); + } + if (expat->datacommand) { + Tcl_DecrRefCount(expat->datacommand); + } + if (expat->picommand) { + Tcl_DecrRefCount(expat->picommand); + } + if (expat->externalentitycommand) { + Tcl_DecrRefCount(expat->externalentitycommand); + } +} Index: xotcl/library/xml/TclExpat-1.1/test-break.tcl =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/test-break.tcl (revision 0) +++ xotcl/library/xml/TclExpat-1.1/test-break.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,80 @@ +#!/bin/sh +#\ +exec tclsh8.1 "$0" "$@" + +# This tests the function of the break facility + +lappend auto_path [file dirname [info script]] +package require expat + +proc element {tag name {attrs {}}} { + array set at $attrs + if {[info exists at(class)]} { + switch $at(class) { + continue { + return -code continue + } + break { + return -code break + } + error { + return -code error "error condition in XML" + } + } + } +} +proc pi {name args} { + if {$name == "break"} { + return -code break + } +} +proc pcdata pcdata { + if {[string length [string trim $pcdata]]} { + puts $pcdata + } +} + +set data(test1) { + + +Should see this data +Should not see this data +Should not see this data +} +set data(test2) { + + +Should see this data +Should see this data + Should not see this data + +Should not see this data +} +set data(test3) { + + +Should see this data +Should see this data + +Should not see this data +} + +set parser [expat xmlparser \ + -elementstartcommand {element start} \ + -elementendcommand {element end} \ + -characterdatacommand pcdata \ + -processinginstructioncommand pi \ + -final yes \ +] + +foreach {testName testData} [array get data] { + puts "*** $testName" + $parser reset + if {[catch {$parser parse $testData} err]} { + puts [list test failed due to $err] + } else { + puts [list test passed] + } +} + +exit 0 \ No newline at end of file Index: xotcl/library/xml/TclExpat-1.1/test-continue.tcl =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/test-continue.tcl (revision 0) +++ xotcl/library/xml/TclExpat-1.1/test-continue.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,85 @@ +#!/bin/sh +#\ +exec tclsh8.1 "$0" "$@" + +# This tests the function of the continue facility + +lappend auto_path [file dirname [info script]] +package require expat + +proc element {tag name {attrs {}}} { + array set at $attrs + if {[info exists at(class)]} { + switch $at(class) { + continue { + return -code continue + } + break { + return -code break + } + error { + return -code error "error condition in XML" + } + } + } +} +proc pi {name args} { + if {[regexp {continue|break|error} $name]} { + return -code $name + } +} +proc pcdata pcdata { + if {[string length [string trim $pcdata]]} { + puts $pcdata + } +} + +set data(test1) { + + +Should see this data +Should not see this data +Should see this data +} +set data(test2) { + + +Should see this data +Should see this data + Should not see this data +Should see this data + +Should see this data +} +set data(test3) { + + +Should see this data +Should not see this data + Should not see this data + + Should not see this data + + Should not see this data + +Should see this data +} + +set parser [expat xmlparser \ + -elementstartcommand {element start} \ + -elementendcommand {element end} \ + -characterdatacommand pcdata \ + -final yes \ +] + +foreach {testName testData} [array get data] { + puts "*** $testName" + $parser reset + if {[catch {$parser parse $testData} err]} { + puts [list test failed due to $err] + } else { + puts [list test passed] + } +} + +exit 0 \ No newline at end of file Index: xotcl/library/xml/TclExpat-1.1/test-error.tcl =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/test-error.tcl (revision 0) +++ xotcl/library/xml/TclExpat-1.1/test-error.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,58 @@ +#!/bin/sh +#\ +exec tclsh8.1 "$0" "$@" + +# This tests the function of the error facility + +lappend auto_path [file dirname [info script]] +package require expat + +proc element {tag name {attrs {}}} { + array set at $attrs + if {[info exists at(class)]} { + switch $at(class) { + continue { + return -code continue + } + break { + return -code break + } + error { + return -code error "error condition in XML" + } + } + } +} +proc pcdata pcdata { + if {[string length [string trim $pcdata]]} { + puts $pcdata + } +} + +set data(error) { + + +Should see this data +Should not see this data +Should not see this data +} + +set parser [expat xmlparser \ + -elementstartcommand {element start} \ + -elementendcommand {element end} \ + -characterdatacommand pcdata \ + -final yes \ +] + +puts {*** Test error} +if {[catch {$parser parse $data(error)} err]} { + if {[string compare $err "error condition in XML"]} { + puts [list test failed, incorrect error message: $err] + } else { + puts [list test passed] + } +} else { + puts [list test failed, no error returned] +} + +exit 0 \ No newline at end of file Index: xotcl/library/xml/TclExpat-1.1/tester =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/tester (revision 0) +++ xotcl/library/xml/TclExpat-1.1/tester (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,34 @@ +#!/bin/sh +#\ +exec tclsh8.1 "$0" "$@" + +#load ./tclexpat.sl Tclexpat +#load ./tclexpat.so Tclexpat +lappend auto_path [file dirname [info script]] +package require expat + +proc element {tag name {attrs {}}} { + puts [list Element $tag $name $attrs] +} +proc pcdata pcdata { + puts [list Character data: $pcdata] +} + +set ch [open [lindex $argv 0]] +set data [read $ch] +close $ch + +puts stderr [list creating parser] + +set parser [expat xmlparser \ + -elementstartcommand {element start} \ + -elementendcommand {element end} \ + -characterdatacommand pcdata \ + -final yes \ +] + +puts stderr [list parsing document] + +$parser parse $data + +exit 0 \ No newline at end of file Index: xotcl/library/xml/TclExpat-1.1/unixfilemap.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/unixfilemap.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/unixfilemap.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,72 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#include +#include +#include +#include +#include +#include +#include + +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif + +#include "filemap.h" + +int filemap(const char *name, + void (*processor)(const void *, size_t, const char *, void *arg), + void *arg) +{ + int fd; + size_t nbytes; + struct stat sb; + void *p; + + fd = open(name, O_RDONLY); + if (fd < 0) { + perror(name); + return 0; + } + if (fstat(fd, &sb) < 0) { + perror(name); + close(fd); + return 0; + } + if (!S_ISREG(sb.st_mode)) { + close(fd); + fprintf(stderr, "%s: not a regular file\n", name); + return 0; + } + + nbytes = sb.st_size; + p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ, + MAP_FILE|MAP_PRIVATE, fd, (off_t)0); + if (p == (void *)-1) { + perror(name); + close(fd); + return 0; + } + processor(p, nbytes, name, arg); + munmap((caddr_t)p, nbytes); + close(fd); + return 1; +} Index: xotcl/library/xml/TclExpat-1.1/utf8tab.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/utf8tab.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/utf8tab.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,53 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + + +/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, +/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, +/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, +/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, +/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, +/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, Index: xotcl/library/xml/TclExpat-1.1/win32filemap.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/win32filemap.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/win32filemap.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,102 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#define STRICT 1 +#ifdef XML_UNICODE +#define UNICODE +#define _UNICODE +#endif /* XML_UNICODE */ +#include +#include +#include +#include "filemap.h" + +static void win32perror(const TCHAR *); + +int filemap(const TCHAR *name, + void (*processor)(const void *, size_t, const TCHAR *, void *arg), + void *arg) +{ + HANDLE f; + HANDLE m; + DWORD size; + DWORD sizeHi; + void *p; + + f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_FLAG_SEQUENTIAL_SCAN, NULL); + if (f == INVALID_HANDLE_VALUE) { + win32perror(name); + return 0; + } + size = GetFileSize(f, &sizeHi); + if (size == (DWORD)-1) { + win32perror(name); + return 0; + } + if (sizeHi) { + _ftprintf(stderr, _T("%s: bigger than 2Gb\n"), name); + return 0; + } + /* CreateFileMapping barfs on zero length files */ + if (size == 0) { + static const char c = '\0'; + processor(&c, 0, name, arg); + CloseHandle(f); + return 1; + } + m = CreateFileMapping(f, NULL, PAGE_READONLY, 0, 0, NULL); + if (m == NULL) { + win32perror(name); + CloseHandle(f); + return 0; + } + p = MapViewOfFile(m, FILE_MAP_READ, 0, 0, 0); + if (p == NULL) { + win32perror(name); + CloseHandle(m); + CloseHandle(f); + return 0; + } + processor(p, size, name, arg); + UnmapViewOfFile(p); + CloseHandle(m); + CloseHandle(f); + return 1; +} + +static +void win32perror(const TCHAR *s) +{ + LPVOID buf; + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &buf, + 0, + NULL)) { + _ftprintf(stderr, _T("%s: %s"), s, buf); + fflush(stderr); + LocalFree(buf); + } + else + _ftprintf(stderr, _T("%s: unknown Windows error\n"), s); +} Index: xotcl/library/xml/TclExpat-1.1/xmldef.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/xmldef.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/xmldef.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,32 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +/* This file can be used for any definitions needed in +particular environments. */ + +#ifdef MOZILLA + +#include "nspr.h" +#define malloc(x) PR_Calloc(1,(x)) +#define calloc(x, y) PR_Calloc((x),(y)) +#define free(x) PR_Free(x) +#define int int32 + +#endif /* MOZILLA */ Index: xotcl/library/xml/TclExpat-1.1/xmlparse.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/xmlparse.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/xmlparse.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,2572 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#include +#include +#include + +#include "xmldef.h" + +#ifdef XML_UNICODE +#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX +#define XmlConvert XmlUtf16Convert +#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding +#define XmlEncode XmlUtf16Encode +#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1)) +typedef unsigned short ICHAR; +#else +#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX +#define XmlConvert XmlUtf8Convert +#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding +#define XmlEncode XmlUtf8Encode +#define MUST_CONVERT(enc, s) (!(enc)->isUtf8) +typedef char ICHAR; +#endif + +#ifdef XML_UNICODE_WCHAR_T +#define XML_T(x) L ## x +#else +#define XML_T(x) x +#endif + +/* Round up n to be a multiple of sz, where sz is a power of 2. */ +#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) + +#include "xmlparse.h" +#include "xmltok.h" +#include "xmlrole.h" +#include "hashtable.h" + +#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */ +#define INIT_DATA_BUF_SIZE 1024 +#define INIT_ATTS_SIZE 16 +#define INIT_BLOCK_SIZE 1024 +#define INIT_BUFFER_SIZE 1024 + +typedef struct tag { + struct tag *parent; + const char *rawName; + size_t rawNameLength; + const XML_Char *name; + char *buf; + char *bufEnd; +} TAG; + +typedef struct { + const XML_Char *name; + const XML_Char *textPtr; + int textLen; + const XML_Char *systemId; + const XML_Char *base; + const XML_Char *publicId; + const XML_Char *notation; + char open; +} ENTITY; + +typedef struct block { + struct block *next; + int size; + XML_Char s[1]; +} BLOCK; + +typedef struct { + BLOCK *blocks; + BLOCK *freeBlocks; + const XML_Char *end; + XML_Char *ptr; + XML_Char *start; +} STRING_POOL; + +/* The XML_Char before the name is used to determine whether +an attribute has been specified. */ +typedef struct { + XML_Char *name; + char maybeTokenized; +} ATTRIBUTE_ID; + +typedef struct { + const ATTRIBUTE_ID *id; + char isCdata; + const XML_Char *value; +} DEFAULT_ATTRIBUTE; + +typedef struct { + const XML_Char *name; + int nDefaultAtts; + int allocDefaultAtts; + DEFAULT_ATTRIBUTE *defaultAtts; +} ELEMENT_TYPE; + +typedef struct { + HASH_TABLE generalEntities; + HASH_TABLE elementTypes; + HASH_TABLE attributeIds; + STRING_POOL pool; + int complete; + int standalone; + const XML_Char *base; +} DTD; + +typedef enum XML_Error Processor(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr); + +static Processor prologProcessor; +static Processor prologInitProcessor; +static Processor contentProcessor; +static Processor cdataSectionProcessor; +static Processor epilogProcessor; +static Processor errorProcessor; +static Processor externalEntityInitProcessor; +static Processor externalEntityInitProcessor2; +static Processor externalEntityInitProcessor3; +static Processor externalEntityContentProcessor; + +static enum XML_Error +handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName); +static enum XML_Error +processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *, const char *); +static enum XML_Error +initializeEncoding(XML_Parser parser); +static enum XML_Error +doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, + const char *start, const char *end, const char **endPtr); +static enum XML_Error +doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr); +static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, const XML_Char *tagName, const char *s); +static int +defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, int isCdata, const XML_Char *dfltValue); +static enum XML_Error +storeAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *, + STRING_POOL *); +static enum XML_Error +appendAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *, + STRING_POOL *); +static ATTRIBUTE_ID * +getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); +static enum XML_Error +storeEntityValue(XML_Parser parser, const char *start, const char *end); +static int +reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); +static void +reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); + +static const XML_Char *getOpenEntityNames(XML_Parser parser); +static int setOpenEntityNames(XML_Parser parser, const XML_Char *openEntityNames); +static void normalizePublicId(XML_Char *s); +static int dtdInit(DTD *); +static void dtdDestroy(DTD *); +static int dtdCopy(DTD *newDtd, const DTD *oldDtd); +static void poolInit(STRING_POOL *); +static void poolClear(STRING_POOL *); +static void poolDestroy(STRING_POOL *); +static XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc, + const char *ptr, const char *end); +static XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc, + const char *ptr, const char *end); +static int poolGrow(STRING_POOL *pool); +static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s); +static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n); + +#define poolStart(pool) ((pool)->start) +#define poolEnd(pool) ((pool)->ptr) +#define poolLength(pool) ((pool)->ptr - (pool)->start) +#define poolChop(pool) ((void)--(pool->ptr)) +#define poolLastChar(pool) (((pool)->ptr)[-1]) +#define poolDiscard(pool) ((pool)->ptr = (pool)->start) +#define poolFinish(pool) ((pool)->start = (pool)->ptr) +#define poolAppendChar(pool, c) \ + (((pool)->ptr == (pool)->end && !poolGrow(pool)) \ + ? 0 \ + : ((*((pool)->ptr)++ = c), 1)) + +typedef struct { + /* The first member must be userData so that the XML_GetUserData macro works. */ + void *userData; + void *handlerArg; + char *buffer; + /* first character to be parsed */ + const char *bufferPtr; + /* past last character to be parsed */ + char *bufferEnd; + /* allocated end of buffer */ + const char *bufferLim; + long parseEndByteIndex; + const char *parseEndPtr; + XML_Char *dataBuf; + XML_Char *dataBufEnd; + XML_StartElementHandler startElementHandler; + XML_EndElementHandler endElementHandler; + XML_CharacterDataHandler characterDataHandler; + XML_ProcessingInstructionHandler processingInstructionHandler; + XML_DefaultHandler defaultHandler; + XML_UnparsedEntityDeclHandler unparsedEntityDeclHandler; + XML_NotationDeclHandler notationDeclHandler; + XML_ExternalEntityRefHandler externalEntityRefHandler; + XML_UnknownEncodingHandler unknownEncodingHandler; + const ENCODING *encoding; + INIT_ENCODING initEncoding; + const XML_Char *protocolEncodingName; + void *unknownEncodingMem; + void *unknownEncodingData; + void *unknownEncodingHandlerData; + void (*unknownEncodingRelease)(void *); + PROLOG_STATE prologState; + Processor *processor; + enum XML_Error errorCode; + const char *eventPtr; + const char *eventEndPtr; + const char *positionPtr; + int tagLevel; + ENTITY *declEntity; + const XML_Char *declNotationName; + const XML_Char *declNotationPublicId; + ELEMENT_TYPE *declElementType; + ATTRIBUTE_ID *declAttributeId; + char declAttributeIsCdata; + DTD dtd; + TAG *tagStack; + TAG *freeTagList; + int attsSize; + ATTRIBUTE *atts; + POSITION position; + STRING_POOL tempPool; + STRING_POOL temp2Pool; + char *groupConnector; + unsigned groupSize; + int hadExternalDoctype; +} Parser; + +#define userData (((Parser *)parser)->userData) +#define handlerArg (((Parser *)parser)->handlerArg) +#define startElementHandler (((Parser *)parser)->startElementHandler) +#define endElementHandler (((Parser *)parser)->endElementHandler) +#define characterDataHandler (((Parser *)parser)->characterDataHandler) +#define processingInstructionHandler (((Parser *)parser)->processingInstructionHandler) +#define defaultHandler (((Parser *)parser)->defaultHandler) +#define unparsedEntityDeclHandler (((Parser *)parser)->unparsedEntityDeclHandler) +#define notationDeclHandler (((Parser *)parser)->notationDeclHandler) +#define externalEntityRefHandler (((Parser *)parser)->externalEntityRefHandler) +#define unknownEncodingHandler (((Parser *)parser)->unknownEncodingHandler) +#define encoding (((Parser *)parser)->encoding) +#define initEncoding (((Parser *)parser)->initEncoding) +#define unknownEncodingMem (((Parser *)parser)->unknownEncodingMem) +#define unknownEncodingData (((Parser *)parser)->unknownEncodingData) +#define unknownEncodingHandlerData \ + (((Parser *)parser)->unknownEncodingHandlerData) +#define unknownEncodingRelease (((Parser *)parser)->unknownEncodingRelease) +#define protocolEncodingName (((Parser *)parser)->protocolEncodingName) +#define prologState (((Parser *)parser)->prologState) +#define processor (((Parser *)parser)->processor) +#define errorCode (((Parser *)parser)->errorCode) +#define eventPtr (((Parser *)parser)->eventPtr) +#define eventEndPtr (((Parser *)parser)->eventEndPtr) +#define positionPtr (((Parser *)parser)->positionPtr) +#define position (((Parser *)parser)->position) +#define tagLevel (((Parser *)parser)->tagLevel) +#define buffer (((Parser *)parser)->buffer) +#define bufferPtr (((Parser *)parser)->bufferPtr) +#define bufferEnd (((Parser *)parser)->bufferEnd) +#define parseEndByteIndex (((Parser *)parser)->parseEndByteIndex) +#define parseEndPtr (((Parser *)parser)->parseEndPtr) +#define bufferLim (((Parser *)parser)->bufferLim) +#define dataBuf (((Parser *)parser)->dataBuf) +#define dataBufEnd (((Parser *)parser)->dataBufEnd) +#define dtd (((Parser *)parser)->dtd) +#define declEntity (((Parser *)parser)->declEntity) +#define declNotationName (((Parser *)parser)->declNotationName) +#define declNotationPublicId (((Parser *)parser)->declNotationPublicId) +#define declElementType (((Parser *)parser)->declElementType) +#define declAttributeId (((Parser *)parser)->declAttributeId) +#define declAttributeIsCdata (((Parser *)parser)->declAttributeIsCdata) +#define freeTagList (((Parser *)parser)->freeTagList) +#define tagStack (((Parser *)parser)->tagStack) +#define atts (((Parser *)parser)->atts) +#define attsSize (((Parser *)parser)->attsSize) +#define tempPool (((Parser *)parser)->tempPool) +#define temp2Pool (((Parser *)parser)->temp2Pool) +#define groupConnector (((Parser *)parser)->groupConnector) +#define groupSize (((Parser *)parser)->groupSize) +#define hadExternalDoctype (((Parser *)parser)->hadExternalDoctype) + +XML_Parser XML_ParserCreate(const XML_Char *encodingName) +{ + XML_Parser parser = malloc(sizeof(Parser)); + if (!parser) + return parser; + processor = prologInitProcessor; + XmlPrologStateInit(&prologState); + userData = 0; + handlerArg = 0; + startElementHandler = 0; + endElementHandler = 0; + characterDataHandler = 0; + processingInstructionHandler = 0; + defaultHandler = 0; + unparsedEntityDeclHandler = 0; + notationDeclHandler = 0; + externalEntityRefHandler = 0; + unknownEncodingHandler = 0; + buffer = 0; + bufferPtr = 0; + bufferEnd = 0; + parseEndByteIndex = 0; + parseEndPtr = 0; + bufferLim = 0; + declElementType = 0; + declAttributeId = 0; + declEntity = 0; + declNotationName = 0; + declNotationPublicId = 0; + memset(&position, 0, sizeof(POSITION)); + errorCode = XML_ERROR_NONE; + eventPtr = 0; + eventEndPtr = 0; + positionPtr = 0; + tagLevel = 0; + tagStack = 0; + freeTagList = 0; + attsSize = INIT_ATTS_SIZE; + atts = malloc(attsSize * sizeof(ATTRIBUTE)); + dataBuf = malloc(INIT_DATA_BUF_SIZE * sizeof(XML_Char)); + groupSize = 0; + groupConnector = 0; + hadExternalDoctype = 0; + unknownEncodingMem = 0; + unknownEncodingRelease = 0; + unknownEncodingData = 0; + unknownEncodingHandlerData = 0; + poolInit(&tempPool); + poolInit(&temp2Pool); + protocolEncodingName = encodingName ? poolCopyString(&tempPool, encodingName) : 0; + if (!dtdInit(&dtd) || !atts || !dataBuf + || (encodingName && !protocolEncodingName)) { + XML_ParserFree(parser); + return 0; + } + dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE; + XmlInitEncoding(&initEncoding, &encoding, 0); + return parser; +} + +XML_Parser XML_ExternalEntityParserCreate(XML_Parser oldParser, + const XML_Char *openEntityNames, + const XML_Char *encodingName) +{ + XML_Parser parser = oldParser; + DTD *oldDtd = &dtd; + XML_StartElementHandler oldStartElementHandler = startElementHandler; + XML_EndElementHandler oldEndElementHandler = endElementHandler; + XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; + XML_ProcessingInstructionHandler oldProcessingInstructionHandler = processingInstructionHandler; + XML_DefaultHandler oldDefaultHandler = defaultHandler; + XML_ExternalEntityRefHandler oldExternalEntityRefHandler = externalEntityRefHandler; + XML_UnknownEncodingHandler oldUnknownEncodingHandler = unknownEncodingHandler; + void *oldUserData = userData; + void *oldHandlerArg = handlerArg; + + parser = XML_ParserCreate(encodingName); + if (!parser) + return 0; + startElementHandler = oldStartElementHandler; + endElementHandler = oldEndElementHandler; + characterDataHandler = oldCharacterDataHandler; + processingInstructionHandler = oldProcessingInstructionHandler; + defaultHandler = oldDefaultHandler; + externalEntityRefHandler = oldExternalEntityRefHandler; + unknownEncodingHandler = oldUnknownEncodingHandler; + userData = oldUserData; + if (oldUserData == oldHandlerArg) + handlerArg = userData; + else + handlerArg = parser; + if (!dtdCopy(&dtd, oldDtd) || !setOpenEntityNames(parser, openEntityNames)) { + XML_ParserFree(parser); + return 0; + } + processor = externalEntityInitProcessor; + return parser; +} + +void XML_ParserFree(XML_Parser parser) +{ + for (;;) { + TAG *p; + if (tagStack == 0) { + if (freeTagList == 0) + break; + tagStack = freeTagList; + freeTagList = 0; + } + p = tagStack; + tagStack = tagStack->parent; + free(p->buf); + free(p); + } + poolDestroy(&tempPool); + poolDestroy(&temp2Pool); + dtdDestroy(&dtd); + free((void *)atts); + free(groupConnector); + free(buffer); + free(dataBuf); + free(unknownEncodingMem); + if (unknownEncodingRelease) + unknownEncodingRelease(unknownEncodingData); + free(parser); +} + +void XML_UseParserAsHandlerArg(XML_Parser parser) +{ + handlerArg = parser; +} + +void XML_SetUserData(XML_Parser parser, void *p) +{ + if (handlerArg == userData) + handlerArg = userData = p; + else + userData = p; +} + +int XML_SetBase(XML_Parser parser, const XML_Char *p) +{ + if (p) { + p = poolCopyString(&dtd.pool, p); + if (!p) + return 0; + dtd.base = p; + } + else + dtd.base = 0; + return 1; +} + +const XML_Char *XML_GetBase(XML_Parser parser) +{ + return dtd.base; +} + +void XML_SetElementHandler(XML_Parser parser, + XML_StartElementHandler start, + XML_EndElementHandler end) +{ + startElementHandler = start; + endElementHandler = end; +} + +void XML_SetCharacterDataHandler(XML_Parser parser, + XML_CharacterDataHandler handler) +{ + characterDataHandler = handler; +} + +void XML_SetProcessingInstructionHandler(XML_Parser parser, + XML_ProcessingInstructionHandler handler) +{ + processingInstructionHandler = handler; +} + +void XML_SetDefaultHandler(XML_Parser parser, + XML_DefaultHandler handler) +{ + defaultHandler = handler; +} + +void XML_SetUnparsedEntityDeclHandler(XML_Parser parser, + XML_UnparsedEntityDeclHandler handler) +{ + unparsedEntityDeclHandler = handler; +} + +void XML_SetNotationDeclHandler(XML_Parser parser, + XML_NotationDeclHandler handler) +{ + notationDeclHandler = handler; +} + +void XML_SetExternalEntityRefHandler(XML_Parser parser, + XML_ExternalEntityRefHandler handler) +{ + externalEntityRefHandler = handler; +} + +void XML_SetUnknownEncodingHandler(XML_Parser parser, + XML_UnknownEncodingHandler handler, + void *data) +{ + unknownEncodingHandler = handler; + unknownEncodingHandlerData = data; +} + +int XML_Parse(XML_Parser parser, const char *s, size_t len, int isFinal) +{ + if (len == 0) { + if (!isFinal) + return 1; + errorCode = processor(parser, bufferPtr, parseEndPtr = bufferEnd, 0); + if (errorCode == XML_ERROR_NONE) + return 1; + eventEndPtr = eventPtr; + return 0; + } + else if (bufferPtr == bufferEnd) { + const char *end; + size_t nLeftOver; + parseEndByteIndex += len; + positionPtr = s; + if (isFinal) { + errorCode = processor(parser, s, parseEndPtr = s + len, 0); + if (errorCode == XML_ERROR_NONE) + return 1; + eventEndPtr = eventPtr; + return 0; + } + errorCode = processor(parser, s, parseEndPtr = s + len, &end); + if (errorCode != XML_ERROR_NONE) { + eventEndPtr = eventPtr; + return 0; + } + XmlUpdatePosition(encoding, positionPtr, end, &position); + nLeftOver = s + len - end; + if (nLeftOver) { + if (buffer == 0 || nLeftOver > bufferLim - buffer) { + /* FIXME avoid integer overflow */ + buffer = buffer == 0 ? malloc(len * 2) : realloc(buffer, len * 2); + if (!buffer) { + errorCode = XML_ERROR_NO_MEMORY; + eventPtr = eventEndPtr = 0; + return 0; + } + bufferLim = buffer + len * 2; + } + memcpy(buffer, end, nLeftOver); + bufferPtr = buffer; + bufferEnd = buffer + nLeftOver; + } + return 1; + } + else { + memcpy(XML_GetBuffer(parser, len), s, len); + return XML_ParseBuffer(parser, len, isFinal); + } +} + +int XML_ParseBuffer(XML_Parser parser, size_t len, int isFinal) +{ + const char *start = bufferPtr; + positionPtr = start; + bufferEnd += len; + parseEndByteIndex += len; + errorCode = processor(parser, start, parseEndPtr = bufferEnd, + isFinal ? (const char **)0 : &bufferPtr); + if (errorCode == XML_ERROR_NONE) { + if (!isFinal) + XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); + return 1; + } + else { + eventEndPtr = eventPtr; + return 0; + } +} + +void *XML_GetBuffer(XML_Parser parser, size_t len) +{ + if (len > bufferLim - bufferEnd) { + /* FIXME avoid integer overflow */ + size_t neededSize = len + (bufferEnd - bufferPtr); + if (neededSize <= bufferLim - buffer) { + memmove(buffer, bufferPtr, (size_t)(bufferEnd - bufferPtr)); + bufferEnd = buffer + (bufferEnd - bufferPtr); + bufferPtr = buffer; + } + else { + char *newBuf; + size_t bufferSize = bufferLim - bufferPtr; + if (bufferSize == 0) + bufferSize = INIT_BUFFER_SIZE; + do { + bufferSize *= 2; + } while (bufferSize < neededSize); + newBuf = malloc(bufferSize); + if (newBuf == 0) { + errorCode = XML_ERROR_NO_MEMORY; + return 0; + } + bufferLim = newBuf + bufferSize; + if (bufferPtr) { + memcpy(newBuf, bufferPtr, (size_t)(bufferEnd - bufferPtr)); + free(buffer); + } + bufferEnd = newBuf + (bufferEnd - bufferPtr); + bufferPtr = buffer = newBuf; + } + } + return bufferEnd; +} + +enum XML_Error XML_GetErrorCode(XML_Parser parser) +{ + return errorCode; +} + +long XML_GetCurrentByteIndex(XML_Parser parser) +{ + if (eventPtr) + return parseEndByteIndex - (parseEndPtr - eventPtr); + return -1; +} + +int XML_GetCurrentLineNumber(XML_Parser parser) +{ + if (eventPtr) { + XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); + positionPtr = eventPtr; + } + return position.lineNumber + 1; +} + +int XML_GetCurrentColumnNumber(XML_Parser parser) +{ + if (eventPtr) { + XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); + positionPtr = eventPtr; + } + return position.columnNumber; +} + +void XML_DefaultCurrent(XML_Parser parser) +{ + if (defaultHandler) + reportDefault(parser, encoding, eventPtr, eventEndPtr); +} + +const XML_LChar *XML_ErrorString(enum XML_Error code) +{ + static const XML_LChar *message[] = { + 0, + XML_T("out of memory"), + XML_T("syntax error"), + XML_T("no element found"), + XML_T("not well-formed"), + XML_T("unclosed token"), + XML_T("unclosed token"), + XML_T("mismatched tag"), + XML_T("duplicate attribute"), + XML_T("junk after document element"), + XML_T("illegal parameter entity reference"), + XML_T("undefined entity"), + XML_T("recursive entity reference"), + XML_T("asynchronous entity"), + XML_T("reference to invalid character number"), + XML_T("reference to binary entity"), + XML_T("reference to external entity in attribute"), + XML_T("xml processing instruction not at start of external entity"), + XML_T("unknown encoding"), + XML_T("encoding specified in XML declaration is incorrect"), + XML_T("unclosed CDATA section"), + XML_T("error in processing external entity reference") + }; + if (code > 0 && code < sizeof(message)/sizeof(message[0])) + return message[code]; + return 0; +} + +static +enum XML_Error contentProcessor(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + return doContent(parser, 0, encoding, start, end, endPtr); +} + +static +enum XML_Error externalEntityInitProcessor(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + enum XML_Error result = initializeEncoding(parser); + if (result != XML_ERROR_NONE) + return result; + processor = externalEntityInitProcessor2; + return externalEntityInitProcessor2(parser, start, end, endPtr); +} + +static +enum XML_Error externalEntityInitProcessor2(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + const char *next; + int tok = XmlContentTok(encoding, start, end, &next); + switch (tok) { + case XML_TOK_BOM: + start = next; + break; + case XML_TOK_PARTIAL: + if (endPtr) { + *endPtr = start; + return XML_ERROR_NONE; + } + eventPtr = start; + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (endPtr) { + *endPtr = start; + return XML_ERROR_NONE; + } + eventPtr = start; + return XML_ERROR_PARTIAL_CHAR; + } + processor = externalEntityInitProcessor3; + return externalEntityInitProcessor3(parser, start, end, endPtr); +} + +static +enum XML_Error externalEntityInitProcessor3(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + const char *next; + int tok = XmlContentTok(encoding, start, end, &next); + switch (tok) { + case XML_TOK_XML_DECL: + { + enum XML_Error result = processXmlDecl(parser, 1, start, next); + if (result != XML_ERROR_NONE) + return result; + start = next; + } + break; + case XML_TOK_PARTIAL: + if (endPtr) { + *endPtr = start; + return XML_ERROR_NONE; + } + eventPtr = start; + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (endPtr) { + *endPtr = start; + return XML_ERROR_NONE; + } + eventPtr = start; + return XML_ERROR_PARTIAL_CHAR; + } + processor = externalEntityContentProcessor; + tagLevel = 1; + return doContent(parser, 1, encoding, start, end, endPtr); +} + +static +enum XML_Error externalEntityContentProcessor(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + return doContent(parser, 1, encoding, start, end, endPtr); +} + +static enum XML_Error +doContent(XML_Parser parser, + int startTagLevel, + const ENCODING *enc, + const char *s, + const char *end, + const char **nextPtr) +{ + const ENCODING *internalEnc = XmlGetInternalEncoding(); + const char *dummy; + const char **eventPP; + const char **eventEndPP; + if (enc == encoding) { + eventPP = &eventPtr; + *eventPP = s; + eventEndPP = &eventEndPtr; + } + else + eventPP = eventEndPP = &dummy; + for (;;) { + const char *next; + int tok = XmlContentTok(enc, s, end, &next); + *eventEndPP = next; + switch (tok) { + case XML_TOK_TRAILING_CR: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + *eventEndPP = end; + if (characterDataHandler) { + XML_Char c = XML_T('\n'); + characterDataHandler(handlerArg, &c, 1); + } + else if (defaultHandler) + reportDefault(parser, enc, s, end); + if (startTagLevel == 0) + return XML_ERROR_NO_ELEMENTS; + if (tagLevel != startTagLevel) + return XML_ERROR_ASYNC_ENTITY; + return XML_ERROR_NONE; + case XML_TOK_NONE: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + if (startTagLevel > 0) { + if (tagLevel != startTagLevel) + return XML_ERROR_ASYNC_ENTITY; + return XML_ERROR_NONE; + } + return XML_ERROR_NO_ELEMENTS; + case XML_TOK_INVALID: + *eventPP = next; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_PARTIAL_CHAR; + case XML_TOK_ENTITY_REF: + { + const XML_Char *name; + ENTITY *entity; + XML_Char ch = XmlPredefinedEntityName(enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (ch) { + if (characterDataHandler) + characterDataHandler(handlerArg, &ch, 1); + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + } + name = poolStoreString(&dtd.pool, enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (!name) + return XML_ERROR_NO_MEMORY; + entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0); + poolDiscard(&dtd.pool); + if (!entity) { + if (dtd.complete || dtd.standalone) + return XML_ERROR_UNDEFINED_ENTITY; + if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + } + if (entity->open) + return XML_ERROR_RECURSIVE_ENTITY_REF; + if (entity->notation) + return XML_ERROR_BINARY_ENTITY_REF; + if (entity) { + if (entity->textPtr) { + enum XML_Error result; + if (defaultHandler) { + reportDefault(parser, enc, s, next); + break; + } + /* Protect against the possibility that somebody sets + the defaultHandler from inside another handler. */ + *eventEndPP = *eventPP; + entity->open = 1; + result = doContent(parser, + tagLevel, + internalEnc, + (char *)entity->textPtr, + (char *)(entity->textPtr + entity->textLen), + 0); + entity->open = 0; + if (result) + return result; + } + else if (externalEntityRefHandler) { + const XML_Char *openEntityNames; + entity->open = 1; + openEntityNames = getOpenEntityNames(parser); + entity->open = 0; + if (!openEntityNames) + return XML_ERROR_NO_MEMORY; + if (!externalEntityRefHandler(parser, openEntityNames, dtd.base, entity->systemId, entity->publicId)) + return XML_ERROR_EXTERNAL_ENTITY_HANDLING; + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + } + break; + } + case XML_TOK_START_TAG_WITH_ATTS: + if (!startElementHandler) { + enum XML_Error result = storeAtts(parser, enc, 0, s); + if (result) + return result; + } + /* fall through */ + case XML_TOK_START_TAG_NO_ATTS: + { + TAG *tag; + if (freeTagList) { + tag = freeTagList; + freeTagList = freeTagList->parent; + } + else { + tag = malloc(sizeof(TAG)); + if (!tag) + return XML_ERROR_NO_MEMORY; + tag->buf = malloc(INIT_TAG_BUF_SIZE); + if (!tag->buf) + return XML_ERROR_NO_MEMORY; + tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE; + } + tag->parent = tagStack; + tagStack = tag; + tag->rawName = s + enc->minBytesPerChar; + tag->rawNameLength = XmlNameLength(enc, tag->rawName); + if (nextPtr) { + if (tag->rawNameLength > tag->bufEnd - tag->buf) { + size_t bufSize = tag->rawNameLength * 4; + bufSize = ROUND_UP(bufSize, sizeof(XML_Char)); + tag->buf = realloc(tag->buf, bufSize); + if (!tag->buf) + return XML_ERROR_NO_MEMORY; + tag->bufEnd = tag->buf + bufSize; + } + memcpy(tag->buf, tag->rawName, tag->rawNameLength); + tag->rawName = tag->buf; + } + ++tagLevel; + if (startElementHandler) { + enum XML_Error result; + XML_Char *toPtr; + for (;;) { + const char *rawNameEnd = tag->rawName + tag->rawNameLength; + const char *fromPtr = tag->rawName; + size_t bufSize; + if (nextPtr) + toPtr = (XML_Char *)(tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char))); + else + toPtr = (XML_Char *)tag->buf; + tag->name = toPtr; + XmlConvert(enc, + &fromPtr, rawNameEnd, + (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); + if (fromPtr == rawNameEnd) + break; + bufSize = (tag->bufEnd - tag->buf) << 1; + tag->buf = realloc(tag->buf, bufSize); + if (!tag->buf) + return XML_ERROR_NO_MEMORY; + tag->bufEnd = tag->buf + bufSize; + if (nextPtr) + tag->rawName = tag->buf; + } + *toPtr = XML_T('\0'); + result = storeAtts(parser, enc, tag->name, s); + if (result) + return result; + startElementHandler(handlerArg, tag->name, (const XML_Char **)atts); + poolClear(&tempPool); + } + else { + tag->name = 0; + if (defaultHandler) + reportDefault(parser, enc, s, next); + } + break; + } + case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: + if (!startElementHandler) { + enum XML_Error result = storeAtts(parser, enc, 0, s); + if (result) + return result; + } + /* fall through */ + case XML_TOK_EMPTY_ELEMENT_NO_ATTS: + if (startElementHandler || endElementHandler) { + const char *rawName = s + enc->minBytesPerChar; + const XML_Char *name = poolStoreString(&tempPool, enc, rawName, + rawName + + XmlNameLength(enc, rawName)); + if (!name) + return XML_ERROR_NO_MEMORY; + poolFinish(&tempPool); + if (startElementHandler) { + enum XML_Error result = storeAtts(parser, enc, name, s); + if (result) + return result; + startElementHandler(handlerArg, name, (const XML_Char **)atts); + } + if (endElementHandler) { + if (startElementHandler) + *eventEndPP = *eventPP; + endElementHandler(handlerArg, name); + } + poolClear(&tempPool); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + if (tagLevel == 0) + return epilogProcessor(parser, next, end, nextPtr); + break; + case XML_TOK_END_TAG: + if (tagLevel == startTagLevel) + return XML_ERROR_ASYNC_ENTITY; + else { + size_t len; + const char *rawName; + TAG *tag = tagStack; + tagStack = tag->parent; + tag->parent = freeTagList; + freeTagList = tag; + rawName = s + enc->minBytesPerChar*2; + len = XmlNameLength(enc, rawName); + if (len != tag->rawNameLength + || memcmp(tag->rawName, rawName, len) != 0) { + *eventPP = rawName; + return XML_ERROR_TAG_MISMATCH; + } + --tagLevel; + if (endElementHandler) { + if (tag->name) + endElementHandler(handlerArg, tag->name); + else { + const XML_Char *name = poolStoreString(&tempPool, enc, rawName, + rawName + len); + if (!name) + return XML_ERROR_NO_MEMORY; + endElementHandler(handlerArg, name); + poolClear(&tempPool); + } + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + if (tagLevel == 0) + return epilogProcessor(parser, next, end, nextPtr); + } + break; + case XML_TOK_CHAR_REF: + { + int n = XmlCharRefNumber(enc, s); + if (n < 0) + return XML_ERROR_BAD_CHAR_REF; + if (characterDataHandler) { + XML_Char buf[XML_ENCODE_MAX]; + characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf)); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + } + break; + case XML_TOK_XML_DECL: + return XML_ERROR_MISPLACED_XML_PI; + case XML_TOK_DATA_NEWLINE: + if (characterDataHandler) { + XML_Char c = XML_T('\n'); + characterDataHandler(handlerArg, &c, 1); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + case XML_TOK_CDATA_SECT_OPEN: + { + enum XML_Error result; + if (characterDataHandler) + characterDataHandler(handlerArg, dataBuf, 0); + else if (defaultHandler) + reportDefault(parser, enc, s, next); + result = doCdataSection(parser, enc, &next, end, nextPtr); + if (!next) { + processor = cdataSectionProcessor; + return result; + } + } + break; + case XML_TOK_TRAILING_RSQB: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + if (characterDataHandler) { + if (MUST_CONVERT(enc, s)) { + ICHAR *dataPtr = (ICHAR *)dataBuf; + XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); + characterDataHandler(handlerArg, dataBuf, + (size_t)(dataPtr - (ICHAR *)dataBuf)); + } + else + characterDataHandler(handlerArg, + (XML_Char *)s, + (size_t)((XML_Char *)end - (XML_Char *)s)); + } + else if (defaultHandler) + reportDefault(parser, enc, s, end); + if (startTagLevel == 0) { + *eventPP = end; + return XML_ERROR_NO_ELEMENTS; + } + if (tagLevel != startTagLevel) { + *eventPP = end; + return XML_ERROR_ASYNC_ENTITY; + } + return XML_ERROR_NONE; + case XML_TOK_DATA_CHARS: + if (characterDataHandler) { + if (MUST_CONVERT(enc, s)) { + for (;;) { + ICHAR *dataPtr = (ICHAR *)dataBuf; + XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); + *eventEndPP = s; + characterDataHandler(handlerArg, dataBuf, (size_t)(dataPtr - (ICHAR *)dataBuf)); + if (s == next) + break; + *eventPP = s; + } + } + else + characterDataHandler(handlerArg, + (XML_Char *)s, + (size_t)((XML_Char *)next - (XML_Char *)s)); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + case XML_TOK_PI: + if (!reportProcessingInstruction(parser, enc, s, next)) + return XML_ERROR_NO_MEMORY; + break; + default: + if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + } + *eventPP = s = next; + } + /* not reached */ +} + +/* If tagName is non-null, build a real list of attributes, +otherwise just check the attributes for well-formedness. */ + +static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *enc, + const XML_Char *tagName, const char *s) +{ + ELEMENT_TYPE *elementType = 0; + int nDefaultAtts = 0; + const XML_Char **appAtts; + int i; + int n; + + if (tagName) { + elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagName, 0); + if (elementType) + nDefaultAtts = elementType->nDefaultAtts; + } + + n = XmlGetAttributes(enc, s, attsSize, atts); + if (n + nDefaultAtts > attsSize) { + int oldAttsSize = attsSize; + attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; + atts = realloc((void *)atts, attsSize * sizeof(ATTRIBUTE)); + if (!atts) + return XML_ERROR_NO_MEMORY; + if (n > oldAttsSize) + XmlGetAttributes(enc, s, n, atts); + } + appAtts = (const XML_Char **)atts; + for (i = 0; i < n; i++) { + ATTRIBUTE_ID *attId = getAttributeId(parser, enc, atts[i].name, + atts[i].name + + XmlNameLength(enc, atts[i].name)); + if (!attId) + return XML_ERROR_NO_MEMORY; + if ((attId->name)[-1]) { + if (enc == encoding) + eventPtr = atts[i].name; + return XML_ERROR_DUPLICATE_ATTRIBUTE; + } + (attId->name)[-1] = 1; + appAtts[i << 1] = attId->name; + if (!atts[i].normalized) { + enum XML_Error result; + int isCdata = 1; + + if (attId->maybeTokenized) { + int j; + for (j = 0; j < nDefaultAtts; j++) { + if (attId == elementType->defaultAtts[j].id) { + isCdata = elementType->defaultAtts[j].isCdata; + break; + } + } + } + + result = storeAttributeValue(parser, enc, isCdata, + atts[i].valuePtr, atts[i].valueEnd, + &tempPool); + if (result) + return result; + if (tagName) { + appAtts[(i << 1) + 1] = poolStart(&tempPool); + poolFinish(&tempPool); + } + else + poolDiscard(&tempPool); + } + else if (tagName) { + appAtts[(i << 1) + 1] = poolStoreString(&tempPool, enc, atts[i].valuePtr, atts[i].valueEnd); + if (appAtts[(i << 1) + 1] == 0) + return XML_ERROR_NO_MEMORY; + poolFinish(&tempPool); + } + } + if (tagName) { + int j; + for (j = 0; j < nDefaultAtts; j++) { + const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + j; + if (!(da->id->name)[-1] && da->value) { + (da->id->name)[-1] = 1; + appAtts[i << 1] = da->id->name; + appAtts[(i << 1) + 1] = da->value; + i++; + } + } + appAtts[i << 1] = 0; + } + while (i-- > 0) + ((XML_Char *)appAtts[i << 1])[-1] = 0; + return XML_ERROR_NONE; +} + +/* The idea here is to avoid using stack for each CDATA section when +the whole file is parsed with one call. */ + +static +enum XML_Error cdataSectionProcessor(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + enum XML_Error result = doCdataSection(parser, encoding, &start, end, endPtr); + if (start) { + processor = contentProcessor; + return contentProcessor(parser, start, end, endPtr); + } + return result; +} + +/* startPtr gets set to non-null is the section is closed, and to null if +the section is not yet closed. */ + +static +enum XML_Error doCdataSection(XML_Parser parser, + const ENCODING *enc, + const char **startPtr, + const char *end, + const char **nextPtr) +{ + const char *s = *startPtr; + const char *dummy; + const char **eventPP; + const char **eventEndPP; + if (enc == encoding) { + eventPP = &eventPtr; + *eventPP = s; + eventEndPP = &eventEndPtr; + } + else + eventPP = eventEndPP = &dummy; + *startPtr = 0; + for (;;) { + const char *next; + int tok = XmlCdataSectionTok(enc, s, end, &next); + *eventEndPP = next; + switch (tok) { + case XML_TOK_CDATA_SECT_CLOSE: + if (characterDataHandler) + characterDataHandler(handlerArg, dataBuf, 0); + else if (defaultHandler) + reportDefault(parser, enc, s, next); + *startPtr = next; + return XML_ERROR_NONE; + case XML_TOK_DATA_NEWLINE: + if (characterDataHandler) { + XML_Char c = XML_T('\n'); + characterDataHandler(handlerArg, &c, 1); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + case XML_TOK_DATA_CHARS: + if (characterDataHandler) { + if (MUST_CONVERT(enc, s)) { + for (;;) { + ICHAR *dataPtr = (ICHAR *)dataBuf; + XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); + *eventEndPP = next; + characterDataHandler(handlerArg, dataBuf, (size_t)(dataPtr - (ICHAR *)dataBuf)); + if (s == next) + break; + *eventPP = s; + } + } + else + characterDataHandler(handlerArg, + (XML_Char *)s, + (size_t)((XML_Char *)next - (XML_Char *)s)); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + case XML_TOK_INVALID: + *eventPP = next; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_PARTIAL_CHAR; + case XML_TOK_PARTIAL: + case XML_TOK_NONE: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_UNCLOSED_CDATA_SECTION; + default: + abort(); + } + *eventPP = s = next; + } + /* not reached */ +} + +static enum XML_Error +initializeEncoding(XML_Parser parser) +{ + const char *s; +#ifdef XML_UNICODE + char encodingBuf[128]; + if (!protocolEncodingName) + s = 0; + else { + int i; + for (i = 0; protocolEncodingName[i]; i++) { + if (i == sizeof(encodingBuf) - 1 + || protocolEncodingName[i] >= 0x80 + || protocolEncodingName[i] < 0) { + encodingBuf[0] = '\0'; + break; + } + encodingBuf[i] = (char)protocolEncodingName[i]; + } + encodingBuf[i] = '\0'; + s = encodingBuf; + } +#else + s = protocolEncodingName; +#endif + if (XmlInitEncoding(&initEncoding, &encoding, s)) + return XML_ERROR_NONE; + return handleUnknownEncoding(parser, protocolEncodingName); +} + +static enum XML_Error +processXmlDecl(XML_Parser parser, int isGeneralTextEntity, + const char *s, const char *next) +{ + const char *encodingName = 0; + const ENCODING *newEncoding = 0; + const char *version; + int standalone = -1; + if (!XmlParseXmlDecl(isGeneralTextEntity, + encoding, + s, + next, + &eventPtr, + &version, + &encodingName, + &newEncoding, + &standalone)) + return XML_ERROR_SYNTAX; + if (defaultHandler) + reportDefault(parser, encoding, s, next); + if (!protocolEncodingName) { + if (newEncoding) { + if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) { + eventPtr = encodingName; + return XML_ERROR_INCORRECT_ENCODING; + } + encoding = newEncoding; + } + else if (encodingName) { + enum XML_Error result; + const XML_Char *s = poolStoreString(&tempPool, + encoding, + encodingName, + encodingName + + XmlNameLength(encoding, encodingName)); + if (!s) + return XML_ERROR_NO_MEMORY; + result = handleUnknownEncoding(parser, s); + poolDiscard(&tempPool); + if (result == XML_ERROR_UNKNOWN_ENCODING) + eventPtr = encodingName; + return result; + } + } + if (!isGeneralTextEntity && standalone == 1) + dtd.standalone = 1; + return XML_ERROR_NONE; +} + +static enum XML_Error +handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) +{ + if (unknownEncodingHandler) { + XML_Encoding info; + int i; + for (i = 0; i < 256; i++) + info.map[i] = -1; + info.convert = 0; + info.data = 0; + info.release = 0; + if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, &info)) { + ENCODING *enc; + unknownEncodingMem = malloc((size_t)XmlSizeOfUnknownEncoding()); + if (!unknownEncodingMem) { + if (info.release) + info.release(info.data); + return XML_ERROR_NO_MEMORY; + } + enc = XmlInitUnknownEncoding(unknownEncodingMem, + info.map, + info.convert, + info.data); + if (enc) { + unknownEncodingData = info.data; + unknownEncodingRelease = info.release; + encoding = enc; + return XML_ERROR_NONE; + } + } + if (info.release) + info.release(info.data); + } + return XML_ERROR_UNKNOWN_ENCODING; +} + +static enum XML_Error +prologInitProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + enum XML_Error result = initializeEncoding(parser); + if (result != XML_ERROR_NONE) + return result; + processor = prologProcessor; + return prologProcessor(parser, s, end, nextPtr); +} + +static enum XML_Error +prologProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + for (;;) { + const char *next; + int tok = XmlPrologTok(encoding, s, end, &next); + if (tok <= 0) { + if (nextPtr != 0 && tok != XML_TOK_INVALID) { + *nextPtr = s; + return XML_ERROR_NONE; + } + switch (tok) { + case XML_TOK_INVALID: + eventPtr = next; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_NONE: + return XML_ERROR_NO_ELEMENTS; + case XML_TOK_PARTIAL: + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + return XML_ERROR_PARTIAL_CHAR; + case XML_TOK_TRAILING_CR: + eventPtr = s + encoding->minBytesPerChar; + return XML_ERROR_NO_ELEMENTS; + default: + abort(); + } + } + switch (XmlTokenRole(&prologState, tok, s, next, encoding)) { + case XML_ROLE_XML_DECL: + { + enum XML_Error result = processXmlDecl(parser, 0, s, next); + if (result != XML_ERROR_NONE) + return result; + } + break; + case XML_ROLE_DOCTYPE_SYSTEM_ID: + hadExternalDoctype = 1; + break; + case XML_ROLE_DOCTYPE_PUBLIC_ID: + case XML_ROLE_ENTITY_PUBLIC_ID: + if (!XmlIsPublicId(encoding, s, next, &eventPtr)) + return XML_ERROR_SYNTAX; + if (declEntity) { + XML_Char *tem = poolStoreString(&dtd.pool, + encoding, + s + encoding->minBytesPerChar, + next - encoding->minBytesPerChar); + if (!tem) + return XML_ERROR_NO_MEMORY; + normalizePublicId(tem); + declEntity->publicId = tem; + poolFinish(&dtd.pool); + } + break; + case XML_ROLE_INSTANCE_START: + processor = contentProcessor; + if (hadExternalDoctype) + dtd.complete = 0; + return contentProcessor(parser, s, end, nextPtr); + case XML_ROLE_ATTLIST_ELEMENT_NAME: + { + const XML_Char *name = poolStoreString(&dtd.pool, encoding, s, next); + if (!name) + return XML_ERROR_NO_MEMORY; + declElementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, name, sizeof(ELEMENT_TYPE)); + if (!declElementType) + return XML_ERROR_NO_MEMORY; + if (declElementType->name != name) + poolDiscard(&dtd.pool); + else + poolFinish(&dtd.pool); + break; + } + case XML_ROLE_ATTRIBUTE_NAME: + declAttributeId = getAttributeId(parser, encoding, s, next); + if (!declAttributeId) + return XML_ERROR_NO_MEMORY; + declAttributeIsCdata = 0; + break; + case XML_ROLE_ATTRIBUTE_TYPE_CDATA: + declAttributeIsCdata = 1; + break; + case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE: + case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE: + if (dtd.complete + && !defineAttribute(declElementType, declAttributeId, declAttributeIsCdata, 0)) + return XML_ERROR_NO_MEMORY; + break; + case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE: + case XML_ROLE_FIXED_ATTRIBUTE_VALUE: + { + const XML_Char *attVal; + enum XML_Error result + = storeAttributeValue(parser, encoding, declAttributeIsCdata, + s + encoding->minBytesPerChar, + next - encoding->minBytesPerChar, + &dtd.pool); + if (result) + return result; + attVal = poolStart(&dtd.pool); + poolFinish(&dtd.pool); + if (dtd.complete + && !defineAttribute(declElementType, declAttributeId, declAttributeIsCdata, attVal)) + return XML_ERROR_NO_MEMORY; + break; + } + case XML_ROLE_ENTITY_VALUE: + { + enum XML_Error result = storeEntityValue(parser, s, next); + if (result != XML_ERROR_NONE) + return result; + } + break; + case XML_ROLE_ENTITY_SYSTEM_ID: + if (declEntity) { + declEntity->systemId = poolStoreString(&dtd.pool, encoding, + s + encoding->minBytesPerChar, + next - encoding->minBytesPerChar); + if (!declEntity->systemId) + return XML_ERROR_NO_MEMORY; + declEntity->base = dtd.base; + poolFinish(&dtd.pool); + } + break; + case XML_ROLE_ENTITY_NOTATION_NAME: + if (declEntity) { + declEntity->notation = poolStoreString(&dtd.pool, encoding, s, next); + if (!declEntity->notation) + return XML_ERROR_NO_MEMORY; + poolFinish(&dtd.pool); + if (unparsedEntityDeclHandler) { + eventPtr = eventEndPtr = s; + unparsedEntityDeclHandler(handlerArg, + declEntity->name, + declEntity->base, + declEntity->systemId, + declEntity->publicId, + declEntity->notation); + } + + } + break; + case XML_ROLE_GENERAL_ENTITY_NAME: + { + const XML_Char *name; + if (XmlPredefinedEntityName(encoding, s, next)) { + declEntity = 0; + break; + } + name = poolStoreString(&dtd.pool, encoding, s, next); + if (!name) + return XML_ERROR_NO_MEMORY; + if (dtd.complete) { + declEntity = (ENTITY *)lookup(&dtd.generalEntities, name, sizeof(ENTITY)); + if (!declEntity) + return XML_ERROR_NO_MEMORY; + if (declEntity->name != name) { + poolDiscard(&dtd.pool); + declEntity = 0; + } + else + poolFinish(&dtd.pool); + } + else { + poolDiscard(&dtd.pool); + declEntity = 0; + } + } + break; + case XML_ROLE_PARAM_ENTITY_NAME: + declEntity = 0; + break; + case XML_ROLE_NOTATION_NAME: + declNotationPublicId = 0; + declNotationName = 0; + if (notationDeclHandler) { + declNotationName = poolStoreString(&tempPool, encoding, s, next); + if (!declNotationName) + return XML_ERROR_NO_MEMORY; + poolFinish(&tempPool); + } + break; + case XML_ROLE_NOTATION_PUBLIC_ID: + if (!XmlIsPublicId(encoding, s, next, &eventPtr)) + return XML_ERROR_SYNTAX; + if (declNotationName) { + XML_Char *tem = poolStoreString(&tempPool, + encoding, + s + encoding->minBytesPerChar, + next - encoding->minBytesPerChar); + if (!tem) + return XML_ERROR_NO_MEMORY; + normalizePublicId(tem); + declNotationPublicId = tem; + poolFinish(&tempPool); + } + break; + case XML_ROLE_NOTATION_SYSTEM_ID: + if (declNotationName && notationDeclHandler) { + const XML_Char *systemId + = poolStoreString(&tempPool, encoding, + s + encoding->minBytesPerChar, + next - encoding->minBytesPerChar); + if (!systemId) + return XML_ERROR_NO_MEMORY; + eventPtr = eventEndPtr = s; + notationDeclHandler(handlerArg, + declNotationName, + dtd.base, + systemId, + declNotationPublicId); + } + poolClear(&tempPool); + break; + case XML_ROLE_NOTATION_NO_SYSTEM_ID: + if (declNotationPublicId && notationDeclHandler) { + eventPtr = eventEndPtr = s; + notationDeclHandler(handlerArg, + declNotationName, + dtd.base, + 0, + declNotationPublicId); + } + poolClear(&tempPool); + break; + case XML_ROLE_ERROR: + eventPtr = s; + switch (tok) { + case XML_TOK_PARAM_ENTITY_REF: + return XML_ERROR_PARAM_ENTITY_REF; + case XML_TOK_XML_DECL: + return XML_ERROR_MISPLACED_XML_PI; + default: + return XML_ERROR_SYNTAX; + } + case XML_ROLE_GROUP_OPEN: + if (prologState.level >= groupSize) { + if (groupSize) + groupConnector = realloc(groupConnector, groupSize *= 2); + else + groupConnector = malloc(groupSize = 32); + if (!groupConnector) + return XML_ERROR_NO_MEMORY; + } + groupConnector[prologState.level] = 0; + break; + case XML_ROLE_GROUP_SEQUENCE: + if (groupConnector[prologState.level] == '|') { + eventPtr = s; + return XML_ERROR_SYNTAX; + } + groupConnector[prologState.level] = ','; + break; + case XML_ROLE_GROUP_CHOICE: + if (groupConnector[prologState.level] == ',') { + eventPtr = s; + return XML_ERROR_SYNTAX; + } + groupConnector[prologState.level] = '|'; + break; + case XML_ROLE_PARAM_ENTITY_REF: + dtd.complete = 0; + break; + case XML_ROLE_NONE: + switch (tok) { + case XML_TOK_PI: + eventPtr = s; + eventEndPtr = next; + if (!reportProcessingInstruction(parser, encoding, s, next)) + return XML_ERROR_NO_MEMORY; + break; + } + break; + } + if (defaultHandler) { + switch (tok) { + case XML_TOK_PI: + case XML_TOK_BOM: + case XML_TOK_XML_DECL: + break; + default: + eventPtr = s; + eventEndPtr = next; + reportDefault(parser, encoding, s, next); + } + } + s = next; + } + /* not reached */ +} + +static +enum XML_Error epilogProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + processor = epilogProcessor; + eventPtr = s; + for (;;) { + const char *next; + int tok = XmlPrologTok(encoding, s, end, &next); + eventEndPtr = next; + switch (tok) { + case XML_TOK_TRAILING_CR: + if (defaultHandler) { + eventEndPtr = end; + reportDefault(parser, encoding, s, end); + } + /* fall through */ + case XML_TOK_NONE: + if (nextPtr) + *nextPtr = end; + return XML_ERROR_NONE; + case XML_TOK_PROLOG_S: + case XML_TOK_COMMENT: + if (defaultHandler) + reportDefault(parser, encoding, s, next); + break; + case XML_TOK_PI: + if (!reportProcessingInstruction(parser, encoding, s, next)) + return XML_ERROR_NO_MEMORY; + break; + case XML_TOK_INVALID: + eventPtr = next; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_PARTIAL_CHAR; + default: + return XML_ERROR_JUNK_AFTER_DOC_ELEMENT; + } + eventPtr = s = next; + } +} + +static +enum XML_Error errorProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + return errorCode; +} + +static enum XML_Error +storeAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata, + const char *ptr, const char *end, + STRING_POOL *pool) +{ + enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, end, pool); + if (result) + return result; + if (!isCdata && poolLength(pool) && poolLastChar(pool) == XML_T(' ')) + poolChop(pool); + if (!poolAppendChar(pool, XML_T('\0'))) + return XML_ERROR_NO_MEMORY; + return XML_ERROR_NONE; +} + +static enum XML_Error +appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata, + const char *ptr, const char *end, + STRING_POOL *pool) +{ + const ENCODING *internalEnc = XmlGetInternalEncoding(); + for (;;) { + const char *next; + int tok = XmlAttributeValueTok(enc, ptr, end, &next); + switch (tok) { + case XML_TOK_NONE: + return XML_ERROR_NONE; + case XML_TOK_INVALID: + if (enc == encoding) + eventPtr = next; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL: + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_CHAR_REF: + { + XML_Char buf[XML_ENCODE_MAX]; + int i; + int n = XmlCharRefNumber(enc, ptr); + if (n < 0) { + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_BAD_CHAR_REF; + } + if (!isCdata + && n == 0x20 /* space */ + && (poolLength(pool) == 0 || poolLastChar(pool) == XML_T(' '))) + break; + n = XmlEncode(n, (ICHAR *)buf); + if (!n) { + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_BAD_CHAR_REF; + } + for (i = 0; i < n; i++) { + if (!poolAppendChar(pool, buf[i])) + return XML_ERROR_NO_MEMORY; + } + } + break; + case XML_TOK_DATA_CHARS: + if (!poolAppend(pool, enc, ptr, next)) + return XML_ERROR_NO_MEMORY; + break; + break; + case XML_TOK_TRAILING_CR: + next = ptr + enc->minBytesPerChar; + /* fall through */ + case XML_TOK_ATTRIBUTE_VALUE_S: + case XML_TOK_DATA_NEWLINE: + if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == XML_T(' '))) + break; + if (!poolAppendChar(pool, XML_T(' '))) + return XML_ERROR_NO_MEMORY; + break; + case XML_TOK_ENTITY_REF: + { + const XML_Char *name; + ENTITY *entity; + XML_Char ch = XmlPredefinedEntityName(enc, + ptr + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (ch) { + if (!poolAppendChar(pool, ch)) + return XML_ERROR_NO_MEMORY; + break; + } + name = poolStoreString(&temp2Pool, enc, + ptr + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (!name) + return XML_ERROR_NO_MEMORY; + entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0); + poolDiscard(&temp2Pool); + if (!entity) { + if (dtd.complete) { + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_UNDEFINED_ENTITY; + } + } + else if (entity->open) { + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_RECURSIVE_ENTITY_REF; + } + else if (entity->notation) { + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_BINARY_ENTITY_REF; + } + else if (!entity->textPtr) { + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; + } + else { + enum XML_Error result; + const XML_Char *textEnd = entity->textPtr + entity->textLen; + entity->open = 1; + result = appendAttributeValue(parser, internalEnc, isCdata, (char *)entity->textPtr, (char *)textEnd, pool); + entity->open = 0; + if (result) + return result; + } + } + break; + default: + abort(); + } + ptr = next; + } + /* not reached */ +} + +static +enum XML_Error storeEntityValue(XML_Parser parser, + const char *entityTextPtr, + const char *entityTextEnd) +{ + /*const ENCODING *internalEnc = XmlGetInternalEncoding();*/ + STRING_POOL *pool = &(dtd.pool); + entityTextPtr += encoding->minBytesPerChar; + entityTextEnd -= encoding->minBytesPerChar; + for (;;) { + const char *next; + int tok = XmlEntityValueTok(encoding, entityTextPtr, entityTextEnd, &next); + switch (tok) { + case XML_TOK_PARAM_ENTITY_REF: + eventPtr = entityTextPtr; + return XML_ERROR_SYNTAX; + case XML_TOK_NONE: + if (declEntity) { + declEntity->textPtr = pool->start; + declEntity->textLen = pool->ptr - pool->start; + poolFinish(pool); + } + else + poolDiscard(pool); + return XML_ERROR_NONE; + case XML_TOK_ENTITY_REF: + case XML_TOK_DATA_CHARS: + if (!poolAppend(pool, encoding, entityTextPtr, next)) + return XML_ERROR_NO_MEMORY; + break; + case XML_TOK_TRAILING_CR: + next = entityTextPtr + encoding->minBytesPerChar; + /* fall through */ + case XML_TOK_DATA_NEWLINE: + if (pool->end == pool->ptr && !poolGrow(pool)) + return XML_ERROR_NO_MEMORY; + *(pool->ptr)++ = XML_T('\n'); + break; + case XML_TOK_CHAR_REF: + { + XML_Char buf[XML_ENCODE_MAX]; + int i; + int n = XmlCharRefNumber(encoding, entityTextPtr); + if (n < 0) { + eventPtr = entityTextPtr; + return XML_ERROR_BAD_CHAR_REF; + } + n = XmlEncode(n, (ICHAR *)buf); + if (!n) { + eventPtr = entityTextPtr; + return XML_ERROR_BAD_CHAR_REF; + } + for (i = 0; i < n; i++) { + if (pool->end == pool->ptr && !poolGrow(pool)) + return XML_ERROR_NO_MEMORY; + *(pool->ptr)++ = buf[i]; + } + } + break; + case XML_TOK_PARTIAL: + eventPtr = entityTextPtr; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_INVALID: + eventPtr = next; + return XML_ERROR_INVALID_TOKEN; + default: + abort(); + } + entityTextPtr = next; + } + /* not reached */ +} + +static void +normalizeLines(XML_Char *s) +{ + XML_Char *p; + for (;; s++) { + if (*s == XML_T('\0')) + return; + if (*s == XML_T('\r')) + break; + } + p = s; + do { + if (*s == XML_T('\r')) { + *p++ = XML_T('\n'); + if (*++s == XML_T('\n')) + s++; + } + else + *p++ = *s++; + } while (*s); + *p = XML_T('\0'); +} + +static int +reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) +{ + const XML_Char *target; + XML_Char *data; + const char *tem; + if (!processingInstructionHandler) { + if (defaultHandler) + reportDefault(parser, enc, start, end); + return 1; + } + start += enc->minBytesPerChar * 2; + tem = start + XmlNameLength(enc, start); + target = poolStoreString(&tempPool, enc, start, tem); + if (!target) + return 0; + poolFinish(&tempPool); + data = poolStoreString(&tempPool, enc, + XmlSkipS(enc, tem), + end - enc->minBytesPerChar*2); + if (!data) + return 0; + normalizeLines(data); + processingInstructionHandler(handlerArg, target, data); + poolClear(&tempPool); + return 1; +} + +static void +reportDefault(XML_Parser parser, const ENCODING *enc, const char *s, const char *end) +{ + if (MUST_CONVERT(enc, s)) { + for (;;) { + ICHAR *dataPtr = (ICHAR *)dataBuf; + XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); + if (s == end) { + defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + break; + } + if (enc == encoding) { + eventEndPtr = s; + defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + eventPtr = s; + } + else + defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + } + } + else + defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s); +} + + +static int +defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, int isCdata, const XML_Char *value) +{ + DEFAULT_ATTRIBUTE *att; + if (type->nDefaultAtts == type->allocDefaultAtts) { + if (type->allocDefaultAtts == 0) { + type->allocDefaultAtts = 8; + type->defaultAtts = malloc(type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE)); + } + else { + type->allocDefaultAtts *= 2; + type->defaultAtts = realloc(type->defaultAtts, + type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE)); + } + if (!type->defaultAtts) + return 0; + } + att = type->defaultAtts + type->nDefaultAtts; + att->id = attId; + att->value = value; + att->isCdata = isCdata; + if (!isCdata) + attId->maybeTokenized = 1; + type->nDefaultAtts += 1; + return 1; +} + +static ATTRIBUTE_ID * +getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) +{ + ATTRIBUTE_ID *id; + const XML_Char *name; + if (!poolAppendChar(&dtd.pool, XML_T('\0'))) + return 0; + name = poolStoreString(&dtd.pool, enc, start, end); + if (!name) + return 0; + ++name; + id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, name, sizeof(ATTRIBUTE_ID)); + if (!id) + return 0; + if (id->name != name) + poolDiscard(&dtd.pool); + else + poolFinish(&dtd.pool); + return id; +} + +static +const XML_Char *getOpenEntityNames(XML_Parser parser) +{ + HASH_TABLE_ITER iter; + + hashTableIterInit(&iter, &(dtd.generalEntities)); + for (;;) { + const XML_Char *s; + ENTITY *e = (ENTITY *)hashTableIterNext(&iter); + if (!e) + break; + if (!e->open) + continue; + if (poolLength(&tempPool) > 0 && !poolAppendChar(&tempPool, XML_T(' '))) + return 0; + for (s = e->name; *s; s++) + if (!poolAppendChar(&tempPool, *s)) + return 0; + } + + if (!poolAppendChar(&tempPool, XML_T('\0'))) + return 0; + return tempPool.start; +} + +static +int setOpenEntityNames(XML_Parser parser, const XML_Char *openEntityNames) +{ + const XML_Char *s = openEntityNames; + while (*openEntityNames != XML_T('\0')) { + if (*s == XML_T(' ') || *s == XML_T('\0')) { + ENTITY *e; + if (!poolAppendChar(&tempPool, XML_T('\0'))) + return 0; + e = (ENTITY *)lookup(&dtd.generalEntities, poolStart(&tempPool), 0); + if (e) + e->open = 1; + if (*s == XML_T(' ')) + s++; + openEntityNames = s; + poolDiscard(&tempPool); + } + else { + if (!poolAppendChar(&tempPool, *s)) + return 0; + s++; + } + } + return 1; +} + + +static +void normalizePublicId(XML_Char *publicId) +{ + XML_Char *p = publicId; + XML_Char *s; + for (s = publicId; *s; s++) { + switch (*s) { + case XML_T(' '): + case XML_T('\r'): + case XML_T('\n'): + if (p != publicId && p[-1] != XML_T(' ')) + *p++ = XML_T(' '); + break; + default: + *p++ = *s; + } + } + if (p != publicId && p[-1] == XML_T(' ')) + --p; + *p = XML_T('\0'); +} + +static int dtdInit(DTD *p) +{ + poolInit(&(p->pool)); + hashTableInit(&(p->generalEntities)); + hashTableInit(&(p->elementTypes)); + hashTableInit(&(p->attributeIds)); + p->complete = 1; + p->base = 0; + return 1; +} + +static void dtdDestroy(DTD *p) +{ + HASH_TABLE_ITER iter; + hashTableIterInit(&iter, &(p->elementTypes)); + for (;;) { + ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); + if (!e) + break; + if (e->allocDefaultAtts != 0) + free(e->defaultAtts); + } + hashTableDestroy(&(p->generalEntities)); + hashTableDestroy(&(p->elementTypes)); + hashTableDestroy(&(p->attributeIds)); + poolDestroy(&(p->pool)); +} + +/* Do a deep copy of the DTD. Return 0 for out of memory; non-zero otherwise. +The new DTD has already been initialized. */ + +static int dtdCopy(DTD *newDtd, const DTD *oldDtd) +{ + HASH_TABLE_ITER iter; + + if (oldDtd->base) { + const XML_Char *tem = poolCopyString(&(newDtd->pool), oldDtd->base); + if (!tem) + return 0; + newDtd->base = tem; + } + + hashTableIterInit(&iter, &(oldDtd->attributeIds)); + + /* Copy the attribute id table. */ + + for (;;) { + ATTRIBUTE_ID *newA; + const XML_Char *name; + const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter); + + if (!oldA) + break; + /* Remember to allocate the scratch byte before the name. */ + if (!poolAppendChar(&(newDtd->pool), XML_T('\0'))) + return 0; + name = poolCopyString(&(newDtd->pool), oldA->name); + if (!name) + return 0; + ++name; + newA = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), name, sizeof(ATTRIBUTE_ID)); + if (!newA) + return 0; + newA->maybeTokenized = oldA->maybeTokenized; + } + + /* Copy the element type table. */ + + hashTableIterInit(&iter, &(oldDtd->elementTypes)); + + for (;;) { + int i; + ELEMENT_TYPE *newE; + const XML_Char *name; + const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter); + if (!oldE) + break; + name = poolCopyString(&(newDtd->pool), oldE->name); + if (!name) + return 0; + newE = (ELEMENT_TYPE *)lookup(&(newDtd->elementTypes), name, sizeof(ELEMENT_TYPE)); + if (!newE) + return 0; + newE->defaultAtts = (DEFAULT_ATTRIBUTE *)malloc(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); + if (!newE->defaultAtts) + return 0; + newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts; + for (i = 0; i < newE->nDefaultAtts; i++) { + newE->defaultAtts[i].id = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0); + newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata; + newE->defaultAtts[i].value = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value); + if (!newE->defaultAtts[i].value) + return 0; + } + } + + /* Copy the entity table. */ + + hashTableIterInit(&iter, &(oldDtd->generalEntities)); + + for (;;) { + ENTITY *newE; + const XML_Char *name; + const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter); + if (!oldE) + break; + name = poolCopyString(&(newDtd->pool), oldE->name); + if (!name) + return 0; + newE = (ENTITY *)lookup(&(newDtd->generalEntities), name, sizeof(ENTITY)); + if (!newE) + return 0; + if (oldE->systemId) { + const XML_Char *tem = poolCopyString(&(newDtd->pool), oldE->systemId); + if (!tem) + return 0; + newE->systemId = tem; + if (oldE->base) { + if (oldE->base == oldDtd->base) + newE->base = newDtd->base; + tem = poolCopyString(&(newDtd->pool), oldE->base); + if (!tem) + return 0; + newE->base = tem; + } + } + else { + const XML_Char *tem = poolCopyStringN(&(newDtd->pool), oldE->textPtr, oldE->textLen); + if (!tem) + return 0; + newE->textPtr = tem; + newE->textLen = oldE->textLen; + } + if (oldE->notation) { + const XML_Char *tem = poolCopyString(&(newDtd->pool), oldE->notation); + if (!tem) + return 0; + newE->notation = tem; + } + } + + newDtd->complete = oldDtd->complete; + newDtd->standalone = oldDtd->standalone; + return 1; +} + +static +void poolInit(STRING_POOL *pool) +{ + pool->blocks = 0; + pool->freeBlocks = 0; + pool->start = 0; + pool->ptr = 0; + pool->end = 0; +} + +static +void poolClear(STRING_POOL *pool) +{ + if (!pool->freeBlocks) + pool->freeBlocks = pool->blocks; + else { + BLOCK *p = pool->blocks; + while (p) { + BLOCK *tem = p->next; + p->next = pool->freeBlocks; + pool->freeBlocks = p; + p = tem; + } + } + pool->blocks = 0; + pool->start = 0; + pool->ptr = 0; + pool->end = 0; +} + +static +void poolDestroy(STRING_POOL *pool) +{ + BLOCK *p = pool->blocks; + while (p) { + BLOCK *tem = p->next; + free(p); + p = tem; + } + pool->blocks = 0; + p = pool->freeBlocks; + while (p) { + BLOCK *tem = p->next; + free(p); + p = tem; + } + pool->freeBlocks = 0; + pool->ptr = 0; + pool->start = 0; + pool->end = 0; +} + +static +XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc, + const char *ptr, const char *end) +{ + if (!pool->ptr && !poolGrow(pool)) + return 0; + for (;;) { + XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); + if (ptr == end) + break; + if (!poolGrow(pool)) + return 0; + } + return pool->start; +} + +static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s) +{ + do { + if (!poolAppendChar(pool, *s)) + return 0; + } while (*s++); + s = pool->start; + poolFinish(pool); + return s; +} + +static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) +{ + if (!pool->ptr && !poolGrow(pool)) + return 0; + for (; n > 0; --n, s++) { + if (!poolAppendChar(pool, *s)) + return 0; + + } + s = pool->start; + poolFinish(pool); + return s; +} + +static +XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc, + const char *ptr, const char *end) +{ + if (!poolAppend(pool, enc, ptr, end)) + return 0; + if (pool->ptr == pool->end && !poolGrow(pool)) + return 0; + *(pool->ptr)++ = 0; + return pool->start; +} + +static +int poolGrow(STRING_POOL *pool) +{ + if (pool->freeBlocks) { + if (pool->start == 0) { + pool->blocks = pool->freeBlocks; + pool->freeBlocks = pool->freeBlocks->next; + pool->blocks->next = 0; + pool->start = pool->blocks->s; + pool->end = pool->start + pool->blocks->size; + pool->ptr = pool->start; + return 1; + } + if (pool->end - pool->start < pool->freeBlocks->size) { + BLOCK *tem = pool->freeBlocks->next; + pool->freeBlocks->next = pool->blocks; + pool->blocks = pool->freeBlocks; + pool->freeBlocks = tem; + memcpy(pool->blocks->s, pool->start, (pool->end - pool->start) * sizeof(XML_Char)); + pool->ptr = pool->blocks->s + (pool->ptr - pool->start); + pool->start = pool->blocks->s; + pool->end = pool->start + pool->blocks->size; + return 1; + } + } + if (pool->blocks && pool->start == pool->blocks->s) { + int blockSize = (pool->end - pool->start)*2; + pool->blocks = realloc(pool->blocks, offsetof(BLOCK, s) + blockSize * sizeof(XML_Char)); + if (!pool->blocks) + return 0; + pool->blocks->size = blockSize; + pool->ptr = pool->blocks->s + (pool->ptr - pool->start); + pool->start = pool->blocks->s; + pool->end = pool->start + blockSize; + } + else { + BLOCK *tem; + int blockSize = pool->end - pool->start; + if (blockSize < INIT_BLOCK_SIZE) + blockSize = INIT_BLOCK_SIZE; + else + blockSize *= 2; + tem = malloc(offsetof(BLOCK, s) + blockSize * sizeof(XML_Char)); + if (!tem) + return 0; + tem->size = blockSize; + tem->next = pool->blocks; + pool->blocks = tem; + memcpy(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char)); + pool->ptr = tem->s + (pool->ptr - pool->start); + pool->start = tem->s; + pool->end = tem->s + blockSize; + } + return 1; +} Index: xotcl/library/xml/TclExpat-1.1/xmlparse.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/xmlparse.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/xmlparse.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,382 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#ifndef XmlParse_INCLUDED +#define XmlParse_INCLUDED 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef XMLPARSEAPI +#define XMLPARSEAPI /* as nothing */ +#endif + +typedef void *XML_Parser; + +#ifdef XML_UNICODE_WCHAR_T + +/* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t +uses Unicode. */ +/* Information is UTF-16 encoded as wchar_ts */ + +#ifndef XML_UNICODE +#define XML_UNICODE +#endif + +#include +typedef wchar_t XML_Char; +typedef wchar_t XML_LChar; + +#else /* not XML_UNICODE_WCHAR_T */ + +#ifdef XML_UNICODE + +/* Information is UTF-16 encoded as unsigned shorts */ +typedef unsigned short XML_Char; +typedef char XML_LChar; + +#else /* not XML_UNICODE */ + +/* Information is UTF-8 encoded. */ +typedef char XML_Char; +typedef char XML_LChar; + +#endif /* not XML_UNICODE */ + +#endif /* not XML_UNICODE_WCHAR_T */ + + +/* Constructs a new parser; encoding is the encoding specified by the external +protocol or null if there is none specified. */ + +XML_Parser XMLPARSEAPI +XML_ParserCreate(const XML_Char *encoding); + + +/* atts is array of name/value pairs, terminated by 0; + names and values are 0 terminated. */ + +typedef void (*XML_StartElementHandler)(void *userData, + const XML_Char *name, + const XML_Char **atts); + +typedef void (*XML_EndElementHandler)(void *userData, + const XML_Char *name); + +/* s is not 0 terminated. */ +typedef void (*XML_CharacterDataHandler)(void *userData, + const XML_Char *s, + size_t len); + +/* target and data are 0 terminated */ +typedef void (*XML_ProcessingInstructionHandler)(void *userData, + const XML_Char *target, + const XML_Char *data); + +/* This is called for any characters in the XML document for +which there is no applicable handler. This includes both +characters that are part of markup which is of a kind that is +not reported (comments, markup declarations), or characters +that are part of a construct which could be reported but +for which no handler has been supplied. The characters are passed +exactly as they were in the XML document except that +they will be encoded in UTF-8. Line boundaries are not normalized. +Note that a byte order mark character is not passed to the default handler. +If a default handler is set, internal entity references +are not expanded. There are no guarantees about +how characters are divided between calls to the default handler: +for example, a comment might be split between multiple calls. */ + +typedef void (*XML_DefaultHandler)(void *userData, + const XML_Char *s, + int len); + +/* This is called for a declaration of an unparsed (NDATA) +entity. The base argument is whatever was set by XML_SetBase. +The entityName, systemId and notationName arguments will never be null. +The other arguments may be. */ + +typedef void (*XML_UnparsedEntityDeclHandler)(void *userData, + const XML_Char *entityName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName); + +/* This is called for a declaration of notation. +The base argument is whatever was set by XML_SetBase. +The notationName will never be null. The other arguments can be. */ + +typedef void (*XML_NotationDeclHandler)(void *userData, + const XML_Char *notationName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); + +/* This is called for a reference to an external parsed general entity. +The referenced entity is not automatically parsed. +The application can parse it immediately or later using +XML_ExternalEntityParserCreate. +The parser argument is the parser parsing the entity containing the reference; +it can be passed as the parser argument to XML_ExternalEntityParserCreate. +The systemId argument is the system identifier as specified in the entity declaration; +it will not be null. +The base argument is the system identifier that should be used as the base for +resolving systemId if systemId was relative; this is set by XML_SetBase; +it may be null. +The publicId argument is the public identifier as specified in the entity declaration, +or null if none was specified; the whitespace in the public identifier +will have been normalized as required by the XML spec. +The openEntityNames argument is a space-separated list of the names of the entities +that are open for the parse of this entity (including the name of the referenced +entity); this can be passed as the openEntityNames argument to +XML_ExternalEntityParserCreate; openEntityNames is valid only until the handler +returns, so if the referenced entity is to be parsed later, it must be copied. +The handler should return 0 if processing should not continue because of +a fatal error in the handling of the external entity. +In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING +error. +Note that unlike other handlers the first argument is the parser, not userData. */ + +typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser, + const XML_Char *openEntityNames, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); + +/* This structure is filled in by the XML_UnknownEncodingHandler +to provide information to the parser about encodings that are unknown +to the parser. +The map[b] member gives information about byte sequences +whose first byte is b. +If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c. +If map[b] is -1, then the byte sequence is malformed. +If map[b] is -n, where n >= 2, then b is the first byte of an n-byte +sequence that encodes a single Unicode scalar value. +The data member will be passed as the first argument to the convert function. +The convert function is used to convert multibyte sequences; +s will point to a n-byte sequence where map[(unsigned char)*s] == -n. +The convert function must return the Unicode scalar value +represented by this byte sequence or -1 if the byte sequence is malformed. +The convert function may be null if the encoding is a single-byte encoding, +that is if map[b] >= -1 for all bytes b. +When the parser is finished with the encoding, then if release is not null, +it will call release passing it the data member; +once release has been called, the convert function will not be called again. + +Expat places certain restrictions on the encodings that are supported +using this mechanism. + +1. Every ASCII character that can appear in a well-formed XML document, +other than the characters + + $@\^`{}~ + +must be represented by a single byte, and that byte must be the +same byte that represents that character in ASCII. + +2. No character may require more than 4 bytes to encode. + +3. All characters encoded must have Unicode scalar values <= 0xFFFF, +(ie characters that would be encoded by surrogates in UTF-16 +are not allowed). Note that this restriction doesn't apply to +the built-in support for UTF-8 and UTF-16. + +4. No Unicode character may be encoded by more than one distinct sequence +of bytes. */ + +typedef struct { + int map[256]; + void *data; + int (*convert)(void *data, const char *s); + void (*release)(void *data); +} XML_Encoding; + +/* This is called for an encoding that is unknown to the parser. +The encodingHandlerData argument is that which was passed as the +second argument to XML_SetUnknownEncodingHandler. +The name argument gives the name of the encoding as specified in +the encoding declaration. +If the callback can provide information about the encoding, +it must fill in the XML_Encoding structure, and return 1. +Otherwise it must return 0. +If info does not describe a suitable encoding, +then the parser will return an XML_UNKNOWN_ENCODING error. */ + +typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData, + const XML_Char *name, + XML_Encoding *info); + +void XMLPARSEAPI +XML_SetElementHandler(XML_Parser parser, + XML_StartElementHandler start, + XML_EndElementHandler end); + +void XMLPARSEAPI +XML_SetCharacterDataHandler(XML_Parser parser, + XML_CharacterDataHandler handler); + +void XMLPARSEAPI +XML_SetProcessingInstructionHandler(XML_Parser parser, + XML_ProcessingInstructionHandler handler); + +void XMLPARSEAPI +XML_SetDefaultHandler(XML_Parser parser, + XML_DefaultHandler handler); + +void XMLPARSEAPI +XML_SetUnparsedEntityDeclHandler(XML_Parser parser, + XML_UnparsedEntityDeclHandler handler); + +void XMLPARSEAPI +XML_SetNotationDeclHandler(XML_Parser parser, + XML_NotationDeclHandler handler); + +void XMLPARSEAPI +XML_SetExternalEntityRefHandler(XML_Parser parser, + XML_ExternalEntityRefHandler handler); + +void XMLPARSEAPI +XML_SetUnknownEncodingHandler(XML_Parser parser, + XML_UnknownEncodingHandler handler, + void *encodingHandlerData); + +/* This can be called within a handler for a start element, end element, +processing instruction or character data. It causes the corresponding +markup to be passed to the default handler. +Within the expansion of an internal entity, nothing will be passed +to the default handler, although this usually will not happen since +setting a default handler inhibits expansion of internal entities. */ +void XMLPARSEAPI XML_DefaultCurrent(XML_Parser parser); + +/* This value is passed as the userData argument to callbacks. */ +void XMLPARSEAPI +XML_SetUserData(XML_Parser parser, void *userData); + +/* Returns the last value set by XML_SetUserData or null. */ +#define XML_GetUserData(parser) (*(void **)(parser)) + +/* If this function is called, then the parser will be passed +as the first argument to callbacks instead of userData. +The userData will still be accessible using XML_GetUserData. */ + +void XMLPARSEAPI +XML_UseParserAsHandlerArg(XML_Parser parser); + +/* Sets the base to be used for resolving relative URIs in system identifiers in +declarations. Resolving relative identifiers is left to the application: +this value will be passed through as the base argument to the +XML_ExternalEntityRefHandler, XML_NotationDeclHandler +and XML_UnparsedEntityDeclHandler. The base argument will be copied. +Returns zero if out of memory, non-zero otherwise. */ + +int XMLPARSEAPI +XML_SetBase(XML_Parser parser, const XML_Char *base); + +const XML_Char XMLPARSEAPI * +XML_GetBase(XML_Parser parser); + +/* Parses some input. Returns 0 if a fatal error is detected. +The last call to XML_Parse must have isFinal true; +len may be zero for this call (or any other). */ +int XMLPARSEAPI +XML_Parse(XML_Parser parser, const char *s, size_t len, int isFinal); + +void XMLPARSEAPI * +XML_GetBuffer(XML_Parser parser, size_t len); + +int XMLPARSEAPI +XML_ParseBuffer(XML_Parser parser, size_t len, int isFinal); + +/* Creates an XML_Parser object that can parse an external general entity; +openEntityNames is a space-separated list of the names of the entities that are open +for the parse of this entity (including the name of this one); +encoding is the externally specified encoding, +or null if there is no externally specified encoding. +This can be called at any point after the first call to an ExternalEntityRefHandler +so longer as the parser has not yet been freed. +The new parser is completely independent and may safely be used in a separate thread. +The handlers and userData are initialized from the parser argument. +Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */ +XML_Parser XMLPARSEAPI +XML_ExternalEntityParserCreate(XML_Parser parser, + const XML_Char *openEntityNames, + const XML_Char *encoding); + +enum XML_Error { + XML_ERROR_NONE, + XML_ERROR_NO_MEMORY, + XML_ERROR_SYNTAX, + XML_ERROR_NO_ELEMENTS, + XML_ERROR_INVALID_TOKEN, + XML_ERROR_UNCLOSED_TOKEN, + XML_ERROR_PARTIAL_CHAR, + XML_ERROR_TAG_MISMATCH, + XML_ERROR_DUPLICATE_ATTRIBUTE, + XML_ERROR_JUNK_AFTER_DOC_ELEMENT, + XML_ERROR_PARAM_ENTITY_REF, + XML_ERROR_UNDEFINED_ENTITY, + XML_ERROR_RECURSIVE_ENTITY_REF, + XML_ERROR_ASYNC_ENTITY, + XML_ERROR_BAD_CHAR_REF, + XML_ERROR_BINARY_ENTITY_REF, + XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, + XML_ERROR_MISPLACED_XML_PI, + XML_ERROR_UNKNOWN_ENCODING, + XML_ERROR_INCORRECT_ENCODING, + XML_ERROR_UNCLOSED_CDATA_SECTION, + XML_ERROR_EXTERNAL_ENTITY_HANDLING +}; + +/* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode +returns information about the error. */ + +enum XML_Error XMLPARSEAPI XML_GetErrorCode(XML_Parser parser); + +/* These functions return information about the current parse location. +They may be called when XML_Parse or XML_ParseBuffer return 0; +in this case the location is the location of the character at which +the error was detected. +They may also be called from any other callback called to report +some parse event; in this the location is the location of the first +of the sequence of characters that generated the event. */ + +int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser); +int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser); +long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser); + +/* For backwards compatibility with previous versions. */ +#define XML_GetErrorLineNumber XML_GetCurrentLineNumber +#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber +#define XML_GetErrorByteIndex XML_GetCurrentByteIndex + +/* Frees memory used by the parser. */ +void XMLPARSEAPI +XML_ParserFree(XML_Parser parser); + +/* Returns a string describing the error. */ +const XML_LChar XMLPARSEAPI *XML_ErrorString(enum XML_Error code); + +#ifdef __cplusplus +} +#endif + +#endif /* not XmlParse_INCLUDED */ Index: xotcl/library/xml/TclExpat-1.1/xmlrole.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/xmlrole.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/xmlrole.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1096 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ +#include /* for time_t */ + +#include "xmldef.h" +#include "xmlrole.h" + +/* Doesn't check: + + that ,| are not mixed in a model group + content of literals + +*/ + +#ifndef MIN_BYTES_PER_CHAR +#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar) +#endif + +typedef int PROLOG_HANDLER(struct prolog_state *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc); + +static PROLOG_HANDLER + prolog0, prolog1, prolog2, + doctype0, doctype1, doctype2, doctype3, doctype4, doctype5, + internalSubset, + entity0, entity1, entity2, entity3, entity4, entity5, entity6, + entity7, entity8, entity9, + notation0, notation1, notation2, notation3, notation4, + attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6, + attlist7, attlist8, attlist9, + element0, element1, element2, element3, element4, element5, element6, + element7, + declClose, + error; + +static +int syntaxError(PROLOG_STATE *); + +static +int prolog0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + state->handler = prolog1; + return XML_ROLE_NONE; + case XML_TOK_XML_DECL: + state->handler = prolog1; + return XML_ROLE_XML_DECL; + case XML_TOK_PI: + state->handler = prolog1; + return XML_ROLE_NONE; + case XML_TOK_COMMENT: + state->handler = prolog1; + case XML_TOK_BOM: + return XML_ROLE_NONE; + case XML_TOK_DECL_OPEN: + if (!XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + "DOCTYPE")) + break; + state->handler = doctype0; + return XML_ROLE_NONE; + case XML_TOK_INSTANCE_START: + state->handler = error; + return XML_ROLE_INSTANCE_START; + } + return syntaxError(state); +} + +static +int prolog1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_PI: + case XML_TOK_COMMENT: + case XML_TOK_BOM: + return XML_ROLE_NONE; + case XML_TOK_DECL_OPEN: + if (!XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + "DOCTYPE")) + break; + state->handler = doctype0; + return XML_ROLE_NONE; + case XML_TOK_INSTANCE_START: + state->handler = error; + return XML_ROLE_INSTANCE_START; + } + return syntaxError(state); +} + +static +int prolog2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_PI: + case XML_TOK_COMMENT: + return XML_ROLE_NONE; + case XML_TOK_INSTANCE_START: + state->handler = error; + return XML_ROLE_INSTANCE_START; + } + return syntaxError(state); +} + +static +int doctype0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + state->handler = doctype1; + return XML_ROLE_DOCTYPE_NAME; + } + return syntaxError(state); +} + +static +int doctype1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_OPEN_BRACKET: + state->handler = internalSubset; + return XML_ROLE_NONE; + case XML_TOK_DECL_CLOSE: + state->handler = prolog2; + return XML_ROLE_DOCTYPE_CLOSE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) { + state->handler = doctype3; + return XML_ROLE_NONE; + } + if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) { + state->handler = doctype2; + return XML_ROLE_NONE; + } + break; + } + return syntaxError(state); +} + +static +int doctype2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_LITERAL: + state->handler = doctype3; + return XML_ROLE_DOCTYPE_PUBLIC_ID; + } + return syntaxError(state); +} + +static +int doctype3(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_LITERAL: + state->handler = doctype4; + return XML_ROLE_DOCTYPE_SYSTEM_ID; + } + return syntaxError(state); +} + +static +int doctype4(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_OPEN_BRACKET: + state->handler = internalSubset; + return XML_ROLE_NONE; + case XML_TOK_DECL_CLOSE: + state->handler = prolog2; + return XML_ROLE_DOCTYPE_CLOSE; + } + return syntaxError(state); +} + +static +int doctype5(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_DECL_CLOSE: + state->handler = prolog2; + return XML_ROLE_DOCTYPE_CLOSE; + } + return syntaxError(state); +} + +static +int internalSubset(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_DECL_OPEN: + if (XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + "ENTITY")) { + state->handler = entity0; + return XML_ROLE_NONE; + } + if (XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + "ATTLIST")) { + state->handler = attlist0; + return XML_ROLE_NONE; + } + if (XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + "ELEMENT")) { + state->handler = element0; + return XML_ROLE_NONE; + } + if (XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + "NOTATION")) { + state->handler = notation0; + return XML_ROLE_NONE; + } + break; + case XML_TOK_PI: + case XML_TOK_COMMENT: + return XML_ROLE_NONE; + case XML_TOK_PARAM_ENTITY_REF: + return XML_ROLE_PARAM_ENTITY_REF; + case XML_TOK_CLOSE_BRACKET: + state->handler = doctype5; + return XML_ROLE_NONE; + } + return syntaxError(state); +} + +static +int entity0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_PERCENT: + state->handler = entity1; + return XML_ROLE_NONE; + case XML_TOK_NAME: + state->handler = entity2; + return XML_ROLE_GENERAL_ENTITY_NAME; + } + return syntaxError(state); +} + +static +int entity1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + state->handler = entity7; + return XML_ROLE_PARAM_ENTITY_NAME; + } + return syntaxError(state); +} + +static +int entity2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) { + state->handler = entity4; + return XML_ROLE_NONE; + } + if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) { + state->handler = entity3; + return XML_ROLE_NONE; + } + break; + case XML_TOK_LITERAL: + state->handler = declClose; + return XML_ROLE_ENTITY_VALUE; + } + return syntaxError(state); +} + +static +int entity3(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_LITERAL: + state->handler = entity4; + return XML_ROLE_ENTITY_PUBLIC_ID; + } + return syntaxError(state); +} + + +static +int entity4(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_LITERAL: + state->handler = entity5; + return XML_ROLE_ENTITY_SYSTEM_ID; + } + return syntaxError(state); +} + +static +int entity5(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_DECL_CLOSE: + state->handler = internalSubset; + return XML_ROLE_NONE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, "NDATA")) { + state->handler = entity6; + return XML_ROLE_NONE; + } + break; + } + return syntaxError(state); +} + +static +int entity6(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + state->handler = declClose; + return XML_ROLE_ENTITY_NOTATION_NAME; + } + return syntaxError(state); +} + +static +int entity7(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) { + state->handler = entity9; + return XML_ROLE_NONE; + } + if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) { + state->handler = entity8; + return XML_ROLE_NONE; + } + break; + case XML_TOK_LITERAL: + state->handler = declClose; + return XML_ROLE_ENTITY_VALUE; + } + return syntaxError(state); +} + +static +int entity8(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_LITERAL: + state->handler = entity9; + return XML_ROLE_ENTITY_PUBLIC_ID; + } + return syntaxError(state); +} + +static +int entity9(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_LITERAL: + state->handler = declClose; + return XML_ROLE_ENTITY_SYSTEM_ID; + } + return syntaxError(state); +} + +static +int notation0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + state->handler = notation1; + return XML_ROLE_NOTATION_NAME; + } + return syntaxError(state); +} + +static +int notation1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) { + state->handler = notation3; + return XML_ROLE_NONE; + } + if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) { + state->handler = notation2; + return XML_ROLE_NONE; + } + break; + } + return syntaxError(state); +} + +static +int notation2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_LITERAL: + state->handler = notation4; + return XML_ROLE_NOTATION_PUBLIC_ID; + } + return syntaxError(state); +} + +static +int notation3(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_LITERAL: + state->handler = declClose; + return XML_ROLE_NOTATION_SYSTEM_ID; + } + return syntaxError(state); +} + +static +int notation4(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_LITERAL: + state->handler = declClose; + return XML_ROLE_NOTATION_SYSTEM_ID; + case XML_TOK_DECL_CLOSE: + state->handler = internalSubset; + return XML_ROLE_NOTATION_NO_SYSTEM_ID; + } + return syntaxError(state); +} + +static +int attlist0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + state->handler = attlist1; + return XML_ROLE_ATTLIST_ELEMENT_NAME; + } + return syntaxError(state); +} + +static +int attlist1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_DECL_CLOSE: + state->handler = internalSubset; + return XML_ROLE_NONE; + case XML_TOK_NAME: + state->handler = attlist2; + return XML_ROLE_ATTRIBUTE_NAME; + } + return syntaxError(state); +} + +static +int attlist2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + { + static const char *types[] = { + "CDATA", + "ID", + "IDREF", + "IDREFS", + "ENTITY", + "ENTITIES", + "NMTOKEN", + "NMTOKENS", + }; + int i; + for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++) + if (XmlNameMatchesAscii(enc, ptr, types[i])) { + state->handler = attlist8; + return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i; + } + } + if (XmlNameMatchesAscii(enc, ptr, "NOTATION")) { + state->handler = attlist5; + return XML_ROLE_NONE; + } + break; + case XML_TOK_OPEN_PAREN: + state->handler = attlist3; + return XML_ROLE_NONE; + } + return syntaxError(state); +} + +static +int attlist3(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NMTOKEN: + case XML_TOK_NAME: + state->handler = attlist4; + return XML_ROLE_ATTRIBUTE_ENUM_VALUE; + } + return syntaxError(state); +} + +static +int attlist4(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_CLOSE_PAREN: + state->handler = attlist8; + return XML_ROLE_NONE; + case XML_TOK_OR: + state->handler = attlist3; + return XML_ROLE_NONE; + } + return syntaxError(state); +} + +static +int attlist5(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_OPEN_PAREN: + state->handler = attlist6; + return XML_ROLE_NONE; + } + return syntaxError(state); +} + + +static +int attlist6(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + state->handler = attlist7; + return XML_ROLE_ATTRIBUTE_NOTATION_VALUE; + } + return syntaxError(state); +} + +static +int attlist7(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_CLOSE_PAREN: + state->handler = attlist8; + return XML_ROLE_NONE; + case XML_TOK_OR: + state->handler = attlist6; + return XML_ROLE_NONE; + } + return syntaxError(state); +} + +/* default value */ +static +int attlist8(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_POUND_NAME: + if (XmlNameMatchesAscii(enc, + ptr + MIN_BYTES_PER_CHAR(enc), + "IMPLIED")) { + state->handler = attlist1; + return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE; + } + if (XmlNameMatchesAscii(enc, + ptr + MIN_BYTES_PER_CHAR(enc), + "REQUIRED")) { + state->handler = attlist1; + return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE; + } + if (XmlNameMatchesAscii(enc, + ptr + MIN_BYTES_PER_CHAR(enc), + "FIXED")) { + state->handler = attlist9; + return XML_ROLE_NONE; + } + break; + case XML_TOK_LITERAL: + state->handler = attlist1; + return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE; + } + return syntaxError(state); +} + +static +int attlist9(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_LITERAL: + state->handler = attlist1; + return XML_ROLE_FIXED_ATTRIBUTE_VALUE; + } + return syntaxError(state); +} + +static +int element0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + state->handler = element1; + return XML_ROLE_ELEMENT_NAME; + } + return syntaxError(state); +} + +static +int element1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, "EMPTY")) { + state->handler = declClose; + return XML_ROLE_CONTENT_EMPTY; + } + if (XmlNameMatchesAscii(enc, ptr, "ANY")) { + state->handler = declClose; + return XML_ROLE_CONTENT_ANY; + } + break; + case XML_TOK_OPEN_PAREN: + state->handler = element2; + state->level = 1; + return XML_ROLE_GROUP_OPEN; + } + return syntaxError(state); +} + +static +int element2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_POUND_NAME: + if (XmlNameMatchesAscii(enc, + ptr + MIN_BYTES_PER_CHAR(enc), + "PCDATA")) { + state->handler = element3; + return XML_ROLE_CONTENT_PCDATA; + } + break; + case XML_TOK_OPEN_PAREN: + state->level = 2; + state->handler = element6; + return XML_ROLE_GROUP_OPEN; + case XML_TOK_NAME: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT; + case XML_TOK_NAME_QUESTION: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_OPT; + case XML_TOK_NAME_ASTERISK: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_REP; + case XML_TOK_NAME_PLUS: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_PLUS; + } + return syntaxError(state); +} + +static +int element3(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_CLOSE_PAREN: + case XML_TOK_CLOSE_PAREN_ASTERISK: + state->handler = declClose; + return XML_ROLE_GROUP_CLOSE_REP; + case XML_TOK_OR: + state->handler = element4; + return XML_ROLE_NONE; + } + return syntaxError(state); +} + +static +int element4(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + state->handler = element5; + return XML_ROLE_CONTENT_ELEMENT; + } + return syntaxError(state); +} + +static +int element5(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_CLOSE_PAREN_ASTERISK: + state->handler = declClose; + return XML_ROLE_GROUP_CLOSE_REP; + case XML_TOK_OR: + state->handler = element4; + return XML_ROLE_NONE; + } + return syntaxError(state); +} + +static +int element6(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_OPEN_PAREN: + state->level += 1; + return XML_ROLE_GROUP_OPEN; + case XML_TOK_NAME: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT; + case XML_TOK_NAME_QUESTION: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_OPT; + case XML_TOK_NAME_ASTERISK: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_REP; + case XML_TOK_NAME_PLUS: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_PLUS; + } + return syntaxError(state); +} + +static +int element7(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_CLOSE_PAREN: + state->level -= 1; + if (state->level == 0) + state->handler = declClose; + return XML_ROLE_GROUP_CLOSE; + case XML_TOK_CLOSE_PAREN_ASTERISK: + state->level -= 1; + if (state->level == 0) + state->handler = declClose; + return XML_ROLE_GROUP_CLOSE_REP; + case XML_TOK_CLOSE_PAREN_QUESTION: + state->level -= 1; + if (state->level == 0) + state->handler = declClose; + return XML_ROLE_GROUP_CLOSE_OPT; + case XML_TOK_CLOSE_PAREN_PLUS: + state->level -= 1; + if (state->level == 0) + state->handler = declClose; + return XML_ROLE_GROUP_CLOSE_PLUS; + case XML_TOK_COMMA: + state->handler = element6; + return XML_ROLE_GROUP_SEQUENCE; + case XML_TOK_OR: + state->handler = element6; + return XML_ROLE_GROUP_CHOICE; + } + return syntaxError(state); +} + +static +int declClose(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_DECL_CLOSE: + state->handler = internalSubset; + return XML_ROLE_NONE; + } + return syntaxError(state); +} + +#if 0 + +static +int ignore(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_DECL_CLOSE: + state->handler = internalSubset; + return 0; + default: + return XML_ROLE_NONE; + } + return syntaxError(state); +} +#endif + +static +int error(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + return XML_ROLE_NONE; +} + +static +int syntaxError(PROLOG_STATE *state) +{ + state->handler = error; + return XML_ROLE_ERROR; +} + +void XmlPrologStateInit(PROLOG_STATE *state) +{ + state->handler = prolog0; +} Index: xotcl/library/xml/TclExpat-1.1/xmlrole.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/xmlrole.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/xmlrole.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,101 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#ifndef XmlRole_INCLUDED +#define XmlRole_INCLUDED 1 + +#include "xmltok.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + XML_ROLE_ERROR = -1, + XML_ROLE_NONE = 0, + XML_ROLE_XML_DECL, + XML_ROLE_INSTANCE_START, + XML_ROLE_DOCTYPE_NAME, + XML_ROLE_DOCTYPE_SYSTEM_ID, + XML_ROLE_DOCTYPE_PUBLIC_ID, + XML_ROLE_DOCTYPE_CLOSE, + XML_ROLE_GENERAL_ENTITY_NAME, + XML_ROLE_PARAM_ENTITY_NAME, + XML_ROLE_ENTITY_VALUE, + XML_ROLE_ENTITY_SYSTEM_ID, + XML_ROLE_ENTITY_PUBLIC_ID, + XML_ROLE_ENTITY_NOTATION_NAME, + XML_ROLE_NOTATION_NAME, + XML_ROLE_NOTATION_SYSTEM_ID, + XML_ROLE_NOTATION_NO_SYSTEM_ID, + XML_ROLE_NOTATION_PUBLIC_ID, + XML_ROLE_ATTRIBUTE_NAME, + XML_ROLE_ATTRIBUTE_TYPE_CDATA, + XML_ROLE_ATTRIBUTE_TYPE_ID, + XML_ROLE_ATTRIBUTE_TYPE_IDREF, + XML_ROLE_ATTRIBUTE_TYPE_IDREFS, + XML_ROLE_ATTRIBUTE_TYPE_ENTITY, + XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, + XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, + XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, + XML_ROLE_ATTRIBUTE_ENUM_VALUE, + XML_ROLE_ATTRIBUTE_NOTATION_VALUE, + XML_ROLE_ATTLIST_ELEMENT_NAME, + XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, + XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, + XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, + XML_ROLE_FIXED_ATTRIBUTE_VALUE, + XML_ROLE_ELEMENT_NAME, + XML_ROLE_CONTENT_ANY, + XML_ROLE_CONTENT_EMPTY, + XML_ROLE_CONTENT_PCDATA, + XML_ROLE_GROUP_OPEN, + XML_ROLE_GROUP_CLOSE, + XML_ROLE_GROUP_CLOSE_REP, + XML_ROLE_GROUP_CLOSE_OPT, + XML_ROLE_GROUP_CLOSE_PLUS, + XML_ROLE_GROUP_CHOICE, + XML_ROLE_GROUP_SEQUENCE, + XML_ROLE_CONTENT_ELEMENT, + XML_ROLE_CONTENT_ELEMENT_REP, + XML_ROLE_CONTENT_ELEMENT_OPT, + XML_ROLE_CONTENT_ELEMENT_PLUS, + XML_ROLE_PARAM_ENTITY_REF +}; + +typedef struct prolog_state { + int (*handler)(struct prolog_state *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc); + unsigned level; +} PROLOG_STATE; + +void XMLTOKAPI XmlPrologStateInit(PROLOG_STATE *); + +#define XmlTokenRole(state, tok, ptr, end, enc) \ + (((state)->handler)(state, tok, ptr, end, enc)) + +#ifdef __cplusplus +} +#endif + +#endif /* not XmlRole_INCLUDED */ Index: xotcl/library/xml/TclExpat-1.1/xmltok.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/xmltok.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/xmltok.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1135 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#include /*for size_t */ +#include "xmldef.h" +#include "xmltok.h" +#include "nametab.h" + +#define VTABLE1 \ + { PREFIX(prologTok), PREFIX(contentTok), PREFIX(cdataSectionTok) }, \ + { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ + PREFIX(sameName), \ + PREFIX(nameMatchesAscii), \ + PREFIX(nameLength), \ + PREFIX(skipS), \ + PREFIX(getAtts), \ + PREFIX(charRefNumber), \ + PREFIX(predefinedEntityName), \ + PREFIX(updatePosition), \ + PREFIX(isPublicId) + +#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16) + +#define UCS2_GET_NAMING(pages, hi, lo) \ + (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F))) + +/* A 2 byte UTF-8 representation splits the characters 11 bits +between the bottom 5 and 6 bits of the bytes. +We need 8 bits to index into pages, 3 bits to add to that index and +5 bits to generate the mask. */ +#define UTF8_GET_NAMING2(pages, byte) \ + (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ + + ((((byte)[0]) & 3) << 1) \ + + ((((byte)[1]) >> 5) & 1)] \ + & (1 << (((byte)[1]) & 0x1F))) + +/* A 3 byte UTF-8 representation splits the characters 16 bits +between the bottom 4, 6 and 6 bits of the bytes. +We need 8 bits to index into pages, 3 bits to add to that index and +5 bits to generate the mask. */ +#define UTF8_GET_NAMING3(pages, byte) \ + (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \ + + ((((byte)[1]) >> 2) & 0xF)] \ + << 3) \ + + ((((byte)[1]) & 3) << 1) \ + + ((((byte)[2]) >> 5) & 1)] \ + & (1 << (((byte)[2]) & 0x1F))) + +#define UTF8_GET_NAMING(pages, p, n) \ + ((n) == 2 \ + ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \ + : ((n) == 3 \ + ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \ + : 0)) + +#define UTF8_INVALID3(p) \ + ((*p) == 0xED \ + ? (((p)[1] & 0x20) != 0) \ + : ((*p) == 0xEF \ + ? ((p)[1] == 0xBF && ((p)[2] == 0xBF || (p)[2] == 0xBE)) \ + : 0)) + +#define UTF8_INVALID4(p) ((*p) == 0xF4 && ((p)[1] & 0x30) != 0) + +static +int isNever(const ENCODING *enc, const char *p) +{ + return 0; +} + +static +int utf8_isName2(const ENCODING *enc, const char *p) +{ + return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); +} + +static +int utf8_isName3(const ENCODING *enc, const char *p) +{ + return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); +} + +#define utf8_isName4 isNever + +static +int utf8_isNmstrt2(const ENCODING *enc, const char *p) +{ + return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); +} + +static +int utf8_isNmstrt3(const ENCODING *enc, const char *p) +{ + return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); +} + +#define utf8_isNmstrt4 isNever + +#define utf8_isInvalid2 isNever + +static +int utf8_isInvalid3(const ENCODING *enc, const char *p) +{ + return UTF8_INVALID3((const unsigned char *)p); +} + +static +int utf8_isInvalid4(const ENCODING *enc, const char *p) +{ + return UTF8_INVALID4((const unsigned char *)p); +} + +struct normal_encoding { + ENCODING enc; + unsigned char type[256]; + int (*isName2)(const ENCODING *, const char *); + int (*isName3)(const ENCODING *, const char *); + int (*isName4)(const ENCODING *, const char *); + int (*isNmstrt2)(const ENCODING *, const char *); + int (*isNmstrt3)(const ENCODING *, const char *); + int (*isNmstrt4)(const ENCODING *, const char *); + int (*isInvalid2)(const ENCODING *, const char *); + int (*isInvalid3)(const ENCODING *, const char *); + int (*isInvalid4)(const ENCODING *, const char *); +}; + +#define NORMAL_VTABLE(E) \ + E ## isName2, \ + E ## isName3, \ + E ## isName4, \ + E ## isNmstrt2, \ + E ## isNmstrt3, \ + E ## isNmstrt4, \ + E ## isInvalid2, \ + E ## isInvalid3, \ + E ## isInvalid4 + +static int checkCharRefNumber(int); + +#include "xmltok_impl.h" + +/* minimum bytes per character */ +#define MINBPC 1 +#define BYTE_TYPE(enc, p) \ + (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)]) +#define BYTE_TO_ASCII(enc, p) (*p) + +#define IS_NAME_CHAR(enc, p, n) \ + (((const struct normal_encoding *)(enc))->isName ## n(enc, p)) +#define IS_NMSTRT_CHAR(enc, p, n) \ + (((const struct normal_encoding *)(enc))->isNmstrt ## n(enc, p)) +#define IS_INVALID_CHAR(enc, p, n) \ + (((const struct normal_encoding *)(enc))->isInvalid ## n(enc, p)) + +#define IS_NAME_CHAR_MINBPC(enc, p) (0) +#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0) + +/* c is an ASCII character */ +#define CHAR_MATCHES(enc, p, c) (*(p) == c) + +#define PREFIX(ident) normal_ ## ident +#include "xmltok_impl.c" + +#undef MINBPC +#undef BYTE_TYPE +#undef BYTE_TO_ASCII +#undef CHAR_MATCHES +#undef IS_NAME_CHAR +#undef IS_NAME_CHAR_MINBPC +#undef IS_NMSTRT_CHAR +#undef IS_NMSTRT_CHAR_MINBPC +#undef IS_INVALID_CHAR + +enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ + UTF8_cval1 = 0x00, + UTF8_cval2 = 0xc0, + UTF8_cval3 = 0xe0, + UTF8_cval4 = 0xf0 +}; + +static +void utf8_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) +{ + char *to; + const char *from; + if (fromLim - *fromP > toLim - *toP) { + /* Avoid copying partial characters. */ + for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) + if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) + break; + } + for (to = *toP, from = *fromP; from != fromLim; from++, to++) + *to = *from; + *fromP = from; + *toP = to; +} + +static +void utf8_toUtf16(const ENCODING *enc, + const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) +{ + unsigned short *to = *toP; + const char *from = *fromP; + while (from != fromLim && to != toLim) { + switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { + case BT_LEAD2: + *to++ = ((from[0] & 0x1f) << 6) | (from[1] & 0x3f); + from += 2; + break; + case BT_LEAD3: + *to++ = ((from[0] & 0xf) << 12) | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f); + from += 3; + break; + case BT_LEAD4: + { + unsigned long n; + if (to + 1 == toLim) + break; + n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); + n -= 0x10000; + to[0] = (unsigned short)((n >> 10) | 0xD800); + to[1] = (unsigned short)((n & 0x3FF) | 0xDC00); + to += 2; + from += 4; + } + break; + default: + *to++ = *from++; + break; + } + } + *fromP = from; + *toP = to; +} + +static const struct normal_encoding utf8_encoding = { + { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, + { +#include "asciitab.h" +#include "utf8tab.h" + }, + NORMAL_VTABLE(utf8_) +}; + +static const struct normal_encoding internal_utf8_encoding = { + { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, + { +#include "iasciitab.h" +#include "utf8tab.h" + }, + NORMAL_VTABLE(utf8_) +}; + +static +void latin1_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) +{ + for (;;) { + unsigned char c; + if (*fromP == fromLim) + break; + c = (unsigned char)**fromP; + if (c & 0x80) { + if (toLim - *toP < 2) + break; + *(*toP)++ = ((c >> 6) | UTF8_cval2); + *(*toP)++ = ((c & 0x3f) | 0x80); + (*fromP)++; + } + else { + if (*toP == toLim) + break; + *(*toP)++ = *(*fromP)++; + } + } +} + +static +void latin1_toUtf16(const ENCODING *enc, + const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) +{ + while (*fromP != fromLim && *toP != toLim) + *(*toP)++ = (unsigned char)*(*fromP)++; +} + +static const struct normal_encoding latin1_encoding = { + { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, + { +#include "asciitab.h" +#include "latin1tab.h" + } +}; + +static +void ascii_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) +{ + while (*fromP != fromLim && *toP != toLim) + *(*toP)++ = *(*fromP)++; +} + +static const struct normal_encoding ascii_encoding = { + { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, + { +#include "asciitab.h" +/* BT_NONXML == 0 */ + } +}; + +#undef PREFIX + +static int unicode_byte_type(char hi, char lo) +{ + switch ((unsigned char)hi) { + case 0xD8: case 0xD9: case 0xDA: case 0xDB: + return BT_LEAD4; + case 0xDC: case 0xDD: case 0xDE: case 0xDF: + return BT_TRAIL; + case 0xFF: + switch ((unsigned char)lo) { + case 0xFF: + case 0xFE: + return BT_NONXML; + } + break; + } + return BT_NONASCII; +} + +#define DEFINE_UTF16_TO_UTF8 \ +static \ +void PREFIX(toUtf8)(const ENCODING *enc, \ + const char **fromP, const char *fromLim, \ + char **toP, const char *toLim) \ +{ \ + const char *from; \ + for (from = *fromP; from != fromLim; from += 2) { \ + int plane; \ + unsigned char lo2; \ + unsigned char lo = GET_LO(from); \ + unsigned char hi = GET_HI(from); \ + switch (hi) { \ + case 0: \ + if (lo < 0x80) { \ + if (*toP == toLim) { \ + *fromP = from; \ + return; \ + } \ + *(*toP)++ = lo; \ + break; \ + } \ + /* fall through */ \ + case 0x1: case 0x2: case 0x3: \ + case 0x4: case 0x5: case 0x6: case 0x7: \ + if (toLim - *toP < 2) { \ + *fromP = from; \ + return; \ + } \ + *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ + *(*toP)++ = ((lo & 0x3f) | 0x80); \ + break; \ + default: \ + if (toLim - *toP < 3) { \ + *fromP = from; \ + return; \ + } \ + /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ + *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ + *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \ + *(*toP)++ = ((lo & 0x3f) | 0x80); \ + break; \ + case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ + if (toLim - *toP < 4) { \ + *fromP = from; \ + return; \ + } \ + plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ + *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ + *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \ + from += 2; \ + lo2 = GET_LO(from); \ + *(*toP)++ = (((lo & 0x3) << 4) \ + | ((GET_HI(from) & 0x3) << 2) \ + | (lo2 >> 6) \ + | 0x80); \ + *(*toP)++ = ((lo2 & 0x3f) | 0x80); \ + break; \ + } \ + } \ + *fromP = from; \ +} + +#define DEFINE_UTF16_TO_UTF16 \ +static \ +void PREFIX(toUtf16)(const ENCODING *enc, \ + const char **fromP, const char *fromLim, \ + unsigned short **toP, const unsigned short *toLim) \ +{ \ + /* Avoid copying first half only of surrogate */ \ + if (fromLim - *fromP > ((toLim - *toP) << 1) \ + && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ + fromLim -= 2; \ + for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ + *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ +} + +#define PREFIX(ident) little2_ ## ident +#define MINBPC 2 +#define BYTE_TYPE(enc, p) \ + ((p)[1] == 0 \ + ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \ + : unicode_byte_type((p)[1], (p)[0])) +#define BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1) +#define CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c) +#define IS_NAME_CHAR(enc, p, n) (0) +#define IS_NAME_CHAR_MINBPC(enc, p) \ + UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0]) +#define IS_NMSTRT_CHAR(enc, p, n) (0) +#define IS_NMSTRT_CHAR_MINBPC(enc, p) \ + UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0]) + +#include "xmltok_impl.c" + +#define SET2(ptr, ch) \ + (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8))) +#define GET_LO(ptr) ((unsigned char)(ptr)[0]) +#define GET_HI(ptr) ((unsigned char)(ptr)[1]) + +DEFINE_UTF16_TO_UTF8 +DEFINE_UTF16_TO_UTF16 + +#undef SET2 +#undef GET_LO +#undef GET_HI +#undef MINBPC +#undef BYTE_TYPE +#undef BYTE_TO_ASCII +#undef CHAR_MATCHES +#undef IS_NAME_CHAR +#undef IS_NAME_CHAR_MINBPC +#undef IS_NMSTRT_CHAR +#undef IS_NMSTRT_CHAR_MINBPC +#undef IS_INVALID_CHAR + +static const struct normal_encoding little2_encoding = { + { VTABLE, 2, 0, +#if BYTE_ORDER == 12 + 1 +#else + 0 +#endif + }, +#include "asciitab.h" +#include "latin1tab.h" +}; + +#if BYTE_ORDER != 21 + +static const struct normal_encoding internal_little2_encoding = { + { VTABLE, 2, 0, 1 }, +#include "iasciitab.h" +#include "latin1tab.h" +}; + +#endif + +#undef PREFIX + +#define PREFIX(ident) big2_ ## ident +#define MINBPC 2 +/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ +#define BYTE_TYPE(enc, p) \ + ((p)[0] == 0 \ + ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \ + : unicode_byte_type((p)[0], (p)[1])) +#define BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1) +#define CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c) +#define IS_NAME_CHAR(enc, p, n) 0 +#define IS_NAME_CHAR_MINBPC(enc, p) \ + UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1]) +#define IS_NMSTRT_CHAR(enc, p, n) (0) +#define IS_NMSTRT_CHAR_MINBPC(enc, p) \ + UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1]) + +#include "xmltok_impl.c" + +#define SET2(ptr, ch) \ + (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF))) +#define GET_LO(ptr) ((unsigned char)(ptr)[1]) +#define GET_HI(ptr) ((unsigned char)(ptr)[0]) + +DEFINE_UTF16_TO_UTF8 +DEFINE_UTF16_TO_UTF16 + +#undef SET2 +#undef GET_LO +#undef GET_HI +#undef MINBPC +#undef BYTE_TYPE +#undef BYTE_TO_ASCII +#undef CHAR_MATCHES +#undef IS_NAME_CHAR +#undef IS_NAME_CHAR_MINBPC +#undef IS_NMSTRT_CHAR +#undef IS_NMSTRT_CHAR_MINBPC +#undef IS_INVALID_CHAR + +static const struct normal_encoding big2_encoding = { + { VTABLE, 2, 0, +#if BYTE_ORDER == 21 + 1 +#else + 0 +#endif + }, +#include "asciitab.h" +#include "latin1tab.h" +}; + +#if BYTE_ORDER != 12 + +static const struct normal_encoding internal_big2_encoding = { + { VTABLE, 2, 0, 1 }, +#include "iasciitab.h" +#include "latin1tab.h" +}; + +#endif + +#undef PREFIX + +static +int streqci(const char *s1, const char *s2) +{ + for (;;) { + char c1 = *s1++; + char c2 = *s2++; + if ('a' <= c1 && c1 <= 'z') + c1 += 'A' - 'a'; + if ('a' <= c2 && c2 <= 'z') + c2 += 'A' - 'a'; + if (c1 != c2) + return 0; + if (!c1) + break; + } + return 1; +} + +static +int initScan(const ENCODING *enc, int state, const char *ptr, const char *end, + const char **nextTokPtr) +{ + const ENCODING **encPtr; + + if (ptr == end) + return XML_TOK_NONE; + encPtr = ((const INIT_ENCODING *)enc)->encPtr; + if (ptr + 1 == end) { + switch ((unsigned char)*ptr) { + case 0xFE: + case 0xFF: + case 0x00: + case 0x3C: + return XML_TOK_PARTIAL; + } + } + else { + switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) { + case 0x003C: + *encPtr = &big2_encoding.enc; + return XmlTok(*encPtr, state, ptr, end, nextTokPtr); + case 0xFEFF: + *nextTokPtr = ptr + 2; + *encPtr = &big2_encoding.enc; + return XML_TOK_BOM; + case 0x3C00: + *encPtr = &little2_encoding.enc; + return XmlTok(*encPtr, state, ptr, end, nextTokPtr); + case 0xFFFE: + *nextTokPtr = ptr + 2; + *encPtr = &little2_encoding.enc; + return XML_TOK_BOM; + } + } + *encPtr = &utf8_encoding.enc; + return XmlTok(*encPtr, state, ptr, end, nextTokPtr); +} + +static +int initScanProlog(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + return initScan(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr); +} + +static +int initScanContent(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + return initScan(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr); +} + +static +void initUpdatePosition(const ENCODING *enc, const char *ptr, + const char *end, POSITION *pos) +{ + normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); +} + +const ENCODING *XmlGetUtf8InternalEncoding() +{ + return &internal_utf8_encoding.enc; +} + +const ENCODING *XmlGetUtf16InternalEncoding() +{ +#if BYTE_ORDER == 12 + return &internal_little2_encoding.enc; +#elif BYTE_ORDER == 21 + return &internal_big2_encoding.enc; +#else + const short n = 1; + return *(const char *)&n ? &internal_little2_encoding.enc : &internal_big2_encoding.enc; +#endif +} + +int XmlInitEncoding(INIT_ENCODING *p, const ENCODING **encPtr, const char *name) +{ + if (name) { + if (streqci(name, "ISO-8859-1")) { + *encPtr = &latin1_encoding.enc; + return 1; + } + if (streqci(name, "UTF-8")) { + *encPtr = &utf8_encoding.enc; + return 1; + } + if (streqci(name, "US-ASCII")) { + *encPtr = &ascii_encoding.enc; + return 1; + } + if (!streqci(name, "UTF-16")) + return 0; + } + p->initEnc.scanners[XML_PROLOG_STATE] = initScanProlog; + p->initEnc.scanners[XML_CONTENT_STATE] = initScanContent; + p->initEnc.updatePosition = initUpdatePosition; + p->initEnc.minBytesPerChar = 1; + p->encPtr = encPtr; + *encPtr = &(p->initEnc); + return 1; +} + +static +int toAscii(const ENCODING *enc, const char *ptr, const char *end) +{ + char buf[1]; + char *p = buf; + XmlUtf8Convert(enc, &ptr, end, &p, p + 1); + if (p == buf) + return -1; + else + return buf[0]; +} + +static +int isSpace(int c) +{ + switch (c) { + case ' ': + case '\r': + case '\n': + case '\t': + return 1; + } + return 0; +} + +/* Return 1 if there's just optional white space +or there's an S followed by name=val. */ +static +int parsePseudoAttribute(const ENCODING *enc, + const char *ptr, + const char *end, + const char **namePtr, + const char **valPtr, + const char **nextTokPtr) +{ + int c; + char open; + if (ptr == end) { + *namePtr = 0; + return 1; + } + if (!isSpace(toAscii(enc, ptr, end))) { + *nextTokPtr = ptr; + return 0; + } + do { + ptr += enc->minBytesPerChar; + } while (isSpace(toAscii(enc, ptr, end))); + if (ptr == end) { + *namePtr = 0; + return 1; + } + *namePtr = ptr; + for (;;) { + c = toAscii(enc, ptr, end); + if (c == -1) { + *nextTokPtr = ptr; + return 0; + } + if (c == '=') + break; + if (isSpace(c)) { + do { + ptr += enc->minBytesPerChar; + } while (isSpace(c = toAscii(enc, ptr, end))); + if (c != '=') { + *nextTokPtr = ptr; + return 0; + } + break; + } + ptr += enc->minBytesPerChar; + } + if (ptr == *namePtr) { + *nextTokPtr = ptr; + return 0; + } + ptr += enc->minBytesPerChar; + c = toAscii(enc, ptr, end); + while (isSpace(c)) { + ptr += enc->minBytesPerChar; + c = toAscii(enc, ptr, end); + } + if (c != '"' && c != '\'') { + *nextTokPtr = ptr; + return 0; + } + open = c; + ptr += enc->minBytesPerChar; + *valPtr = ptr; + for (;; ptr += enc->minBytesPerChar) { + c = toAscii(enc, ptr, end); + if (c == open) + break; + if (!('a' <= c && c <= 'z') + && !('A' <= c && c <= 'Z') + && !('0' <= c && c <= '9') + && c != '.' + && c != '-' + && c != '_') { + *nextTokPtr = ptr; + return 0; + } + } + *nextTokPtr = ptr + enc->minBytesPerChar; + return 1; +} + +static +const ENCODING *findEncoding(const ENCODING *enc, const char *ptr, const char *end) +{ +#define ENCODING_MAX 128 + char buf[ENCODING_MAX]; + char *p = buf; + int i; + XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); + if (ptr != end) + return 0; + *p = 0; + for (i = 0; buf[i]; i++) { + if ('a' <= buf[i] && buf[i] <= 'z') + buf[i] += 'A' - 'a'; + } + if (streqci(buf, "UTF-8")) + return &utf8_encoding.enc; + if (streqci(buf, "ISO-8859-1")) + return &latin1_encoding.enc; + if (streqci(buf, "US-ASCII")) + return &ascii_encoding.enc; + if (streqci(buf, "UTF-16")) { + if (enc->minBytesPerChar == 2) + return enc; + return &big2_encoding.enc; + } + return 0; +} + +int XmlParseXmlDecl(int isGeneralTextEntity, + const ENCODING *enc, + const char *ptr, + const char *end, + const char **badPtr, + const char **versionPtr, + const char **encodingName, + const ENCODING **encoding, + int *standalone) +{ + const char *val = 0; + const char *name = 0; + ptr += 5 * enc->minBytesPerChar; + end -= 2 * enc->minBytesPerChar; + if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr) || !name) { + *badPtr = ptr; + return 0; + } + if (!XmlNameMatchesAscii(enc, name, "version")) { + if (!isGeneralTextEntity) { + *badPtr = name; + return 0; + } + } + else { + if (versionPtr) + *versionPtr = val; + if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr)) { + *badPtr = ptr; + return 0; + } + if (!name) + return 1; + } + if (XmlNameMatchesAscii(enc, name, "encoding")) { + int c = toAscii(enc, val, end); + if (!('a' <= c && c <= 'z') && !('A' <= c && c <= 'Z')) { + *badPtr = val; + return 0; + } + if (encodingName) + *encodingName = val; + if (encoding) + *encoding = findEncoding(enc, val, ptr - enc->minBytesPerChar); + if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr)) { + *badPtr = ptr; + return 0; + } + if (!name) + return 1; + } + if (!XmlNameMatchesAscii(enc, name, "standalone") || isGeneralTextEntity) { + *badPtr = name; + return 0; + } + if (XmlNameMatchesAscii(enc, val, "yes")) { + if (standalone) + *standalone = 1; + } + else if (XmlNameMatchesAscii(enc, val, "no")) { + if (standalone) + *standalone = 0; + } + else { + *badPtr = val; + return 0; + } + while (isSpace(toAscii(enc, ptr, end))) + ptr += enc->minBytesPerChar; + if (ptr != end) { + *badPtr = ptr; + return 0; + } + return 1; +} + +static +int checkCharRefNumber(int result) +{ + switch (result >> 8) { + case 0xD8: case 0xD9: case 0xDA: case 0xDB: + case 0xDC: case 0xDD: case 0xDE: case 0xDF: + return -1; + case 0: + if (latin1_encoding.type[result] == BT_NONXML) + return -1; + break; + case 0xFF: + if (result == 0xFFFE || result == 0xFFFF) + return -1; + break; + } + return result; +} + +size_t XmlUtf8Encode(int c, char *buf) +{ + enum { + /* minN is minimum legal resulting value for N byte sequence */ + min2 = 0x80, + min3 = 0x800, + min4 = 0x10000 + }; + + if (c < 0) + return 0; + if (c < min2) { + buf[0] = (c | UTF8_cval1); + return 1; + } + if (c < min3) { + buf[0] = ((c >> 6) | UTF8_cval2); + buf[1] = ((c & 0x3f) | 0x80); + return 2; + } + if (c < min4) { + buf[0] = ((c >> 12) | UTF8_cval3); + buf[1] = (((c >> 6) & 0x3f) | 0x80); + buf[2] = ((c & 0x3f) | 0x80); + return 3; + } + if (c < 0x110000) { + buf[0] = ((c >> 18) | UTF8_cval4); + buf[1] = (((c >> 12) & 0x3f) | 0x80); + buf[2] = (((c >> 6) & 0x3f) | 0x80); + buf[3] = ((c & 0x3f) | 0x80); + return 4; + } + return 0; +} + +size_t XmlUtf16Encode(int charNum, unsigned short *buf) +{ + if (charNum < 0) + return 0; + if (charNum < 0x10000) { + buf[0] = charNum; + return 1; + } + if (charNum < 0x110000) { + charNum -= 0x10000; + buf[0] = (charNum >> 10) + 0xD800; + buf[1] = (charNum & 0x3FF) + 0xDC00; + return 2; + } + return 0; +} + +struct unknown_encoding { + struct normal_encoding normal; + int (*convert)(void *userData, const char *p); + void *userData; + unsigned short utf16[256]; + char utf8[256][4]; +}; + +int XmlSizeOfUnknownEncoding() +{ + return sizeof(struct unknown_encoding); +} + +static +int unknown_isName(const ENCODING *enc, const char *p) +{ + int c = ((const struct unknown_encoding *)enc) + ->convert(((const struct unknown_encoding *)enc)->userData, p); + if (c & ~0xFFFF) + return 0; + return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF); +} + +static +int unknown_isNmstrt(const ENCODING *enc, const char *p) +{ + int c = ((const struct unknown_encoding *)enc) + ->convert(((const struct unknown_encoding *)enc)->userData, p); + if (c & ~0xFFFF) + return 0; + return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF); +} + +static +int unknown_isInvalid(const ENCODING *enc, const char *p) +{ + int c = ((const struct unknown_encoding *)enc) + ->convert(((const struct unknown_encoding *)enc)->userData, p); + return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; +} + +static +void unknown_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) +{ + char buf[XML_UTF8_ENCODE_MAX]; + for (;;) { + const char *utf8; + int n; + if (*fromP == fromLim) + break; + utf8 = ((const struct unknown_encoding *)enc)->utf8[(unsigned char)**fromP]; + n = *utf8++; + if (n == 0) { + int c = ((const struct unknown_encoding *)enc) + ->convert(((const struct unknown_encoding *)enc)->userData, *fromP); + n = XmlUtf8Encode(c, buf); + if (n > toLim - *toP) + break; + utf8 = buf; + *fromP += ((const struct normal_encoding *)enc)->type[(unsigned char)**fromP] + - (BT_LEAD2 - 2); + } + else { + if (n > toLim - *toP) + break; + (*fromP)++; + } + do { + *(*toP)++ = *utf8++; + } while (--n != 0); + } +} + +static +void unknown_toUtf16(const ENCODING *enc, + const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) +{ + while (*fromP != fromLim && *toP != toLim) { + unsigned short c + = ((const struct unknown_encoding *)enc)->utf16[(unsigned char)**fromP]; + if (c == 0) { + c = (unsigned short)((const struct unknown_encoding *)enc) + ->convert(((const struct unknown_encoding *)enc)->userData, *fromP); + *fromP += ((const struct normal_encoding *)enc)->type[(unsigned char)**fromP] + - (BT_LEAD2 - 2); + } + else + (*fromP)++; + *(*toP)++ = c; + } +} + +ENCODING * +XmlInitUnknownEncoding(void *mem, + int *table, + int (*convert)(void *userData, const char *p), + void *userData) +{ + int i; + struct unknown_encoding *e = mem; + for (i = 0; i < sizeof(struct normal_encoding); i++) + ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; + for (i = 0; i < 128; i++) + if (latin1_encoding.type[i] != BT_OTHER + && latin1_encoding.type[i] != BT_NONXML + && table[i] != i) + return 0; + for (i = 0; i < 256; i++) { + int c = table[i]; + if (c == -1) { + e->normal.type[i] = BT_MALFORM; + /* This shouldn't really get used. */ + e->utf16[i] = 0xFFFF; + e->utf8[i][0] = 1; + e->utf8[i][1] = 0; + } + else if (c < 0) { + if (c < -4) + return 0; + e->normal.type[i] = BT_LEAD2 - (c + 2); + e->utf8[i][0] = 0; + e->utf16[i] = 0; + } + else if (c < 0x80) { + if (latin1_encoding.type[c] != BT_OTHER + && latin1_encoding.type[c] != BT_NONXML + && c != i) + return 0; + e->normal.type[i] = latin1_encoding.type[c]; + e->utf8[i][0] = 1; + e->utf8[i][1] = (char)c; + e->utf16[i] = c == 0 ? 0xFFFF : c; + } + else if (checkCharRefNumber(c) < 0) { + e->normal.type[i] = BT_NONXML; + /* This shouldn't really get used. */ + e->utf16[i] = 0xFFFF; + e->utf8[i][0] = 1; + e->utf8[i][1] = 0; + } + else { + if (c > 0xFFFF) + return 0; + if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff)) + e->normal.type[i] = BT_NMSTRT; + else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff)) + e->normal.type[i] = BT_NAME; + else + e->normal.type[i] = BT_OTHER; + e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1); + e->utf16[i] = c; + } + } + e->userData = userData; + e->convert = convert; + if (convert) { + e->normal.isName2 = unknown_isName; + e->normal.isName3 = unknown_isName; + e->normal.isName4 = unknown_isName; + e->normal.isNmstrt2 = unknown_isNmstrt; + e->normal.isNmstrt3 = unknown_isNmstrt; + e->normal.isNmstrt4 = unknown_isNmstrt; + e->normal.isInvalid2 = unknown_isInvalid; + e->normal.isInvalid3 = unknown_isInvalid; + e->normal.isInvalid4 = unknown_isInvalid; + } + e->normal.enc.utf8Convert = unknown_toUtf8; + e->normal.enc.utf16Convert = unknown_toUtf16; + return &(e->normal.enc); +} Index: xotcl/library/xml/TclExpat-1.1/xmltok.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/xmltok.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/xmltok.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,276 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#ifndef XmlTok_INCLUDED +#define XmlTok_INCLUDED 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef XMLTOKAPI +#define XMLTOKAPI /* as nothing */ +#endif + +/* The following token may be returned by XmlContentTok */ +#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be start of + illegal ]]> sequence */ +/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */ +#define XML_TOK_NONE -4 /* The string to be scanned is empty */ +#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; + might be part of CRLF sequence */ +#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ +#define XML_TOK_PARTIAL -1 /* only part of a token */ +#define XML_TOK_INVALID 0 + +/* The following tokens are returned by XmlContentTok; some are also + returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok */ + +#define XML_TOK_START_TAG_WITH_ATTS 1 +#define XML_TOK_START_TAG_NO_ATTS 2 +#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag */ +#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 +#define XML_TOK_END_TAG 5 +#define XML_TOK_DATA_CHARS 6 +#define XML_TOK_DATA_NEWLINE 7 +#define XML_TOK_CDATA_SECT_OPEN 8 +#define XML_TOK_ENTITY_REF 9 +#define XML_TOK_CHAR_REF 10 /* numeric character reference */ + +/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */ +#define XML_TOK_PI 11 /* processing instruction */ +#define XML_TOK_XML_DECL 12 /* XML decl or text decl */ +#define XML_TOK_COMMENT 13 +#define XML_TOK_BOM 14 /* Byte order mark */ + +/* The following tokens are returned only by XmlPrologTok */ +#define XML_TOK_PROLOG_S 15 +#define XML_TOK_DECL_OPEN 16 /* */ +#define XML_TOK_NAME 18 +#define XML_TOK_NMTOKEN 19 +#define XML_TOK_POUND_NAME 20 /* #name */ +#define XML_TOK_OR 21 /* | */ +#define XML_TOK_PERCENT 22 +#define XML_TOK_OPEN_PAREN 23 +#define XML_TOK_CLOSE_PAREN 24 +#define XML_TOK_OPEN_BRACKET 25 +#define XML_TOK_CLOSE_BRACKET 26 +#define XML_TOK_LITERAL 27 +#define XML_TOK_PARAM_ENTITY_REF 28 +#define XML_TOK_INSTANCE_START 29 + +/* The following occur only in element type declarations */ +#define XML_TOK_NAME_QUESTION 30 /* name? */ +#define XML_TOK_NAME_ASTERISK 31 /* name* */ +#define XML_TOK_NAME_PLUS 32 /* name+ */ +#define XML_TOK_COND_SECT_OPEN 33 /* */ +#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ +#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ +#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ +#define XML_TOK_COMMA 38 + +/* The following token is returned only by XmlAttributeValueTok */ +#define XML_TOK_ATTRIBUTE_VALUE_S 39 + +/* The following token is returned only by XmlCdataSectionTok */ +#define XML_TOK_CDATA_SECT_CLOSE 40 + +#define XML_N_STATES 3 +#define XML_PROLOG_STATE 0 +#define XML_CONTENT_STATE 1 +#define XML_CDATA_SECTION_STATE 2 + +#define XML_N_LITERAL_TYPES 2 +#define XML_ATTRIBUTE_VALUE_LITERAL 0 +#define XML_ENTITY_VALUE_LITERAL 1 + +/* The size of the buffer passed to XmlUtf8Encode must be at least this. */ +#define XML_UTF8_ENCODE_MAX 4 +/* The size of the buffer passed to XmlUtf16Encode must be at least this. */ +#define XML_UTF16_ENCODE_MAX 2 + +typedef struct position { + /* first line and first column are 0 not 1 */ + unsigned long lineNumber; + unsigned long columnNumber; +} POSITION; + +typedef struct { + const char *name; + const char *valuePtr; + const char *valueEnd; + char normalized; +} ATTRIBUTE; + +struct encoding; +typedef struct encoding ENCODING; + +struct encoding { + int (*scanners[XML_N_STATES])(const ENCODING *, + const char *, + const char *, + const char **); + int (*literalScanners[XML_N_LITERAL_TYPES])(const ENCODING *, + const char *, + const char *, + const char **); + int (*sameName)(const ENCODING *, + const char *, const char *); + int (*nameMatchesAscii)(const ENCODING *, + const char *, const char *); + int (*nameLength)(const ENCODING *, const char *); + const char *(*skipS)(const ENCODING *, const char *); + int (*getAtts)(const ENCODING *enc, const char *ptr, + int attsMax, ATTRIBUTE *atts); + int (*charRefNumber)(const ENCODING *enc, const char *ptr); + int (*predefinedEntityName)(const ENCODING *, const char *, const char *); + void (*updatePosition)(const ENCODING *, + const char *ptr, + const char *end, + POSITION *); + int (*isPublicId)(const ENCODING *enc, const char *ptr, const char *end, + const char **badPtr); + void (*utf8Convert)(const ENCODING *enc, + const char **fromP, + const char *fromLim, + char **toP, + const char *toLim); + void (*utf16Convert)(const ENCODING *enc, + const char **fromP, + const char *fromLim, + unsigned short **toP, + const unsigned short *toLim); + int minBytesPerChar; + char isUtf8; + char isUtf16; +}; + +/* +Scan the string starting at ptr until the end of the next complete token, +but do not scan past eptr. Return an integer giving the type of token. + +Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set. + +Return XML_TOK_PARTIAL when the string does not contain a complete token; +nextTokPtr will not be set. + +Return XML_TOK_INVALID when the string does not start a valid token; nextTokPtr +will be set to point to the character which made the token invalid. + +Otherwise the string starts with a valid token; nextTokPtr will be set to point +to the character following the end of that token. + +Each data character counts as a single token, but adjacent data characters +may be returned together. Similarly for characters in the prolog outside +literals, comments and processing instructions. +*/ + + +#define XmlTok(enc, state, ptr, end, nextTokPtr) \ + (((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) + +#define XmlPrologTok(enc, ptr, end, nextTokPtr) \ + XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) + +#define XmlContentTok(enc, ptr, end, nextTokPtr) \ + XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) + +#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ + XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) + +/* This is used for performing a 2nd-level tokenization on +the content of a literal that has already been returned by XmlTok. */ + +#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ + (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) + +#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ + XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) + +#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ + XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) + +#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2)) + +#define XmlNameMatchesAscii(enc, ptr1, ptr2) \ + (((enc)->nameMatchesAscii)(enc, ptr1, ptr2)) + +#define XmlNameLength(enc, ptr) \ + (((enc)->nameLength)(enc, ptr)) + +#define XmlSkipS(enc, ptr) \ + (((enc)->skipS)(enc, ptr)) + +#define XmlGetAttributes(enc, ptr, attsMax, atts) \ + (((enc)->getAtts)(enc, ptr, attsMax, atts)) + +#define XmlCharRefNumber(enc, ptr) \ + (((enc)->charRefNumber)(enc, ptr)) + +#define XmlPredefinedEntityName(enc, ptr, end) \ + (((enc)->predefinedEntityName)(enc, ptr, end)) + +#define XmlUpdatePosition(enc, ptr, end, pos) \ + (((enc)->updatePosition)(enc, ptr, end, pos)) + +#define XmlIsPublicId(enc, ptr, end, badPtr) \ + (((enc)->isPublicId)(enc, ptr, end, badPtr)) + +#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ + (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) + +#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ + (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) + +typedef struct { + ENCODING initEnc; + const ENCODING **encPtr; +} INIT_ENCODING; + +int XMLTOKAPI XmlParseXmlDecl(int isGeneralTextEntity, + const ENCODING *enc, + const char *ptr, + const char *end, + const char **badPtr, + const char **versionPtr, + const char **encodingNamePtr, + const ENCODING **namedEncodingPtr, + int *standalonePtr); + +int XMLTOKAPI XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); +const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncoding(); +const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncoding(); +size_t XMLTOKAPI XmlUtf8Encode(int charNumber, char *buf); +size_t XMLTOKAPI XmlUtf16Encode(int charNumber, unsigned short *buf); + +int XMLTOKAPI XmlSizeOfUnknownEncoding(); +ENCODING XMLTOKAPI * +XmlInitUnknownEncoding(void *mem, + int *table, + int (*convert)(void *userData, const char *p), + void *userData); + +#ifdef __cplusplus +} +#endif + +#endif /* not XmlTok_INCLUDED */ Index: xotcl/library/xml/TclExpat-1.1/xmltok_impl.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/xmltok_impl.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/xmltok_impl.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1643 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#ifndef IS_INVALID_CHAR +#define IS_INVALID_CHAR(enc, ptr, n) (0) +#endif + +#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \ + case BT_LEAD ## n: \ + if (end - ptr < n) \ + return XML_TOK_PARTIAL_CHAR; \ + if (IS_INVALID_CHAR(enc, ptr, n)) { \ + *(nextTokPtr) = (ptr); \ + return XML_TOK_INVALID; \ + } \ + ptr += n; \ + break; + +#define INVALID_CASES(ptr, nextTokPtr) \ + INVALID_LEAD_CASE(2, ptr, nextTokPtr) \ + INVALID_LEAD_CASE(3, ptr, nextTokPtr) \ + INVALID_LEAD_CASE(4, ptr, nextTokPtr) \ + case BT_NONXML: \ + case BT_MALFORM: \ + case BT_TRAIL: \ + *(nextTokPtr) = (ptr); \ + return XML_TOK_INVALID; + +#define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \ + case BT_LEAD ## n: \ + if (end - ptr < n) \ + return XML_TOK_PARTIAL_CHAR; \ + if (!IS_NAME_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + ptr += n; \ + break; + +#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \ + case BT_NONASCII: \ + if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + case BT_NMSTRT: \ + case BT_HEX: \ + case BT_DIGIT: \ + case BT_NAME: \ + case BT_MINUS: \ + ptr += MINBPC; \ + break; \ + CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \ + CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \ + CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr) + +#define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \ + case BT_LEAD ## n: \ + if (end - ptr < n) \ + return XML_TOK_PARTIAL_CHAR; \ + if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + ptr += n; \ + break; + +#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \ + case BT_NONASCII: \ + if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + case BT_NMSTRT: \ + case BT_HEX: \ + ptr += MINBPC; \ + break; \ + CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \ + CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \ + CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr) + +#ifndef PREFIX +#define PREFIX(ident) ident +#endif + +/* ptr points to character following "')) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + *nextTokPtr = ptr + MINBPC; + return XML_TOK_COMMENT; + } + /* fall through */ + default: + ptr += MINBPC; + break; + } + } + } + return XML_TOK_PARTIAL; +} + +/* ptr points to character following " */ + switch (BYTE_TYPE(enc, ptr + MINBPC)) { + case BT_S: case BT_CR: case BT_LF: case BT_PERCNT: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + /* fall through */ + case BT_S: case BT_CR: case BT_LF: + *nextTokPtr = ptr; + return XML_TOK_DECL_OPEN; + case BT_NMSTRT: + case BT_HEX: + ptr += MINBPC; + break; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + return XML_TOK_PARTIAL; +} + +static +int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end, int *tokPtr) +{ + int upper = 0; + *tokPtr = XML_TOK_PI; + if (end - ptr != MINBPC*3) + return 1; + switch (BYTE_TO_ASCII(enc, ptr)) { + case 'x': + break; + case 'X': + upper = 1; + break; + default: + return 1; + } + ptr += MINBPC; + switch (BYTE_TO_ASCII(enc, ptr)) { + case 'm': + break; + case 'M': + upper = 1; + break; + default: + return 1; + } + ptr += MINBPC; + switch (BYTE_TO_ASCII(enc, ptr)) { + case 'l': + break; + case 'L': + upper = 1; + break; + default: + return 1; + } + if (upper) + return 0; + *tokPtr = XML_TOK_XML_DECL; + return 1; +} + +/* ptr points to character following "')) { + *nextTokPtr = ptr + MINBPC; + return tok; + } + break; + default: + ptr += MINBPC; + break; + } + } + return XML_TOK_PARTIAL; + case BT_QUEST: + if (!PREFIX(checkPiTarget)(enc, target, ptr, &tok)) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + ptr += MINBPC; + if (ptr == end) + return XML_TOK_PARTIAL; + if (CHAR_MATCHES(enc, ptr, '>')) { + *nextTokPtr = ptr + MINBPC; + return tok; + } + /* fall through */ + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + return XML_TOK_PARTIAL; +} + + +static +int PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + int i; + /* CDATA[ */ + if (end - ptr < 6 * MINBPC) + return XML_TOK_PARTIAL; + for (i = 0; i < 6; i++, ptr += MINBPC) { + if (!CHAR_MATCHES(enc, ptr, "CDATA["[i])) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + *nextTokPtr = ptr; + return XML_TOK_CDATA_SECT_OPEN; +} + +static +int PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + if (ptr == end) + return XML_TOK_NONE; +#if MINBPC > 1 + { + size_t n = end - ptr; + if (n & (MINBPC - 1)) { + n &= ~(MINBPC - 1); + if (n == 0) + return XML_TOK_PARTIAL; + end = ptr + n; + } + } +#endif + switch (BYTE_TYPE(enc, ptr)) { + case BT_RSQB: + ptr += MINBPC; + if (ptr == end) + return XML_TOK_PARTIAL; + if (!CHAR_MATCHES(enc, ptr, ']')) + break; + ptr += MINBPC; + if (ptr == end) + return XML_TOK_PARTIAL; + if (!CHAR_MATCHES(enc, ptr, '>')) { + ptr -= MINBPC; + break; + } + *nextTokPtr = ptr + MINBPC; + return XML_TOK_CDATA_SECT_CLOSE; + case BT_CR: + ptr += MINBPC; + if (ptr == end) + return XML_TOK_PARTIAL; + if (BYTE_TYPE(enc, ptr) == BT_LF) + ptr += MINBPC; + *nextTokPtr = ptr; + return XML_TOK_DATA_NEWLINE; + case BT_LF: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_DATA_NEWLINE; + INVALID_CASES(ptr, nextTokPtr) + default: + ptr += MINBPC; + break; + } + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: \ + if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_DATA_CHARS; \ + } \ + ptr += n; \ + break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_NONXML: + case BT_MALFORM: + case BT_TRAIL: + case BT_CR: + case BT_LF: + case BT_RSQB: + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + default: + ptr += MINBPC; + break; + } + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; +} + +/* ptr points to character following "')) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + *nextTokPtr = ptr + MINBPC; + return XML_TOK_EMPTY_ELEMENT_WITH_ATTS; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + break; + } + break; + } + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + return XML_TOK_PARTIAL; +} + +/* ptr points to character following "<" */ + +static +int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + if (ptr == end) + return XML_TOK_PARTIAL; + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) + case BT_EXCL: + if ((ptr += MINBPC) == end) + return XML_TOK_PARTIAL; + switch (BYTE_TYPE(enc, ptr)) { + case BT_MINUS: + return PREFIX(scanComment)(enc, ptr + MINBPC, end, nextTokPtr); + case BT_LSQB: + return PREFIX(scanCdataSection)(enc, ptr + MINBPC, end, nextTokPtr); + } + *nextTokPtr = ptr; + return XML_TOK_INVALID; + case BT_QUEST: + return PREFIX(scanPi)(enc, ptr + MINBPC, end, nextTokPtr); + case BT_SOL: + return PREFIX(scanEndTag)(enc, ptr + MINBPC, end, nextTokPtr); + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + /* we have a start-tag */ + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_S: case BT_CR: case BT_LF: + { + ptr += MINBPC; + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) + case BT_GT: + goto gt; + case BT_SOL: + goto sol; + case BT_S: case BT_CR: case BT_LF: + ptr += MINBPC; + continue; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + return PREFIX(scanAtts)(enc, ptr, end, nextTokPtr); + } + return XML_TOK_PARTIAL; + } + case BT_GT: + gt: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_START_TAG_NO_ATTS; + case BT_SOL: + sol: + ptr += MINBPC; + if (ptr == end) + return XML_TOK_PARTIAL; + if (!CHAR_MATCHES(enc, ptr, '>')) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + *nextTokPtr = ptr + MINBPC; + return XML_TOK_EMPTY_ELEMENT_NO_ATTS; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + return XML_TOK_PARTIAL; +} + +static +int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + if (ptr == end) + return XML_TOK_NONE; +#if MINBPC > 1 + { + size_t n = end - ptr; + if (n & (MINBPC - 1)) { + n &= ~(MINBPC - 1); + if (n == 0) + return XML_TOK_PARTIAL; + end = ptr + n; + } + } +#endif + switch (BYTE_TYPE(enc, ptr)) { + case BT_LT: + return PREFIX(scanLt)(enc, ptr + MINBPC, end, nextTokPtr); + case BT_AMP: + return PREFIX(scanRef)(enc, ptr + MINBPC, end, nextTokPtr); + case BT_CR: + ptr += MINBPC; + if (ptr == end) + return XML_TOK_TRAILING_CR; + if (BYTE_TYPE(enc, ptr) == BT_LF) + ptr += MINBPC; + *nextTokPtr = ptr; + return XML_TOK_DATA_NEWLINE; + case BT_LF: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_DATA_NEWLINE; + case BT_RSQB: + ptr += MINBPC; + if (ptr == end) + return XML_TOK_TRAILING_RSQB; + if (!CHAR_MATCHES(enc, ptr, ']')) + break; + ptr += MINBPC; + if (ptr == end) + return XML_TOK_TRAILING_RSQB; + if (!CHAR_MATCHES(enc, ptr, '>')) { + ptr -= MINBPC; + break; + } + *nextTokPtr = ptr; + return XML_TOK_INVALID; + INVALID_CASES(ptr, nextTokPtr) + default: + ptr += MINBPC; + break; + } + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: \ + if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_DATA_CHARS; \ + } \ + ptr += n; \ + break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_RSQB: + if (ptr + MINBPC != end) { + if (!CHAR_MATCHES(enc, ptr + MINBPC, ']')) { + ptr += MINBPC; + break; + } + if (ptr + 2*MINBPC != end) { + if (!CHAR_MATCHES(enc, ptr + 2*MINBPC, '>')) { + ptr += MINBPC; + break; + } + *nextTokPtr = ptr + 2*MINBPC; + return XML_TOK_INVALID; + } + } + /* fall through */ + case BT_AMP: + case BT_LT: + case BT_NONXML: + case BT_MALFORM: + case BT_TRAIL: + case BT_CR: + case BT_LF: + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + default: + ptr += MINBPC; + break; + } + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; +} + +/* ptr points to character following "%" */ + +static +int PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + if (ptr == end) + return XML_TOK_PARTIAL; + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) + case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: + *nextTokPtr = ptr; + return XML_TOK_PERCENT; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_SEMI: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_PARAM_ENTITY_REF; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + return XML_TOK_PARTIAL; +} + +static +int PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + if (ptr == end) + return XML_TOK_PARTIAL; + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_CR: case BT_LF: case BT_S: + case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR: + *nextTokPtr = ptr; + return XML_TOK_POUND_NAME; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + return XML_TOK_PARTIAL; +} + +static +int PREFIX(scanLit)(int open, const ENCODING *enc, + const char *ptr, const char *end, + const char **nextTokPtr) +{ + while (ptr != end) { + int t = BYTE_TYPE(enc, ptr); + switch (t) { + INVALID_CASES(ptr, nextTokPtr) + case BT_QUOT: + case BT_APOS: + ptr += MINBPC; + if (t != open) + break; + if (ptr == end) + return XML_TOK_PARTIAL; + *nextTokPtr = ptr; + switch (BYTE_TYPE(enc, ptr)) { + case BT_S: case BT_CR: case BT_LF: + case BT_GT: case BT_PERCNT: case BT_LSQB: + return XML_TOK_LITERAL; + default: + return XML_TOK_INVALID; + } + default: + ptr += MINBPC; + break; + } + } + return XML_TOK_PARTIAL; +} + +static +int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + int tok; + if (ptr == end) + return XML_TOK_NONE; +#if MINBPC > 1 + { + size_t n = end - ptr; + if (n & (MINBPC - 1)) { + n &= ~(MINBPC - 1); + if (n == 0) + return XML_TOK_PARTIAL; + end = ptr + n; + } + } +#endif + switch (BYTE_TYPE(enc, ptr)) { + case BT_QUOT: + return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC, end, nextTokPtr); + case BT_APOS: + return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC, end, nextTokPtr); + case BT_LT: + { + ptr += MINBPC; + if (ptr == end) + return XML_TOK_PARTIAL; + switch (BYTE_TYPE(enc, ptr)) { + case BT_EXCL: + return PREFIX(scanDecl)(enc, ptr + MINBPC, end, nextTokPtr); + case BT_QUEST: + return PREFIX(scanPi)(enc, ptr + MINBPC, end, nextTokPtr); + case BT_NMSTRT: + case BT_HEX: + case BT_NONASCII: + case BT_LEAD2: + case BT_LEAD3: + case BT_LEAD4: + *nextTokPtr = ptr - MINBPC; + return XML_TOK_INSTANCE_START; + } + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + case BT_CR: + if (ptr + MINBPC == end) + return XML_TOK_TRAILING_CR; + /* fall through */ + case BT_S: case BT_LF: + for (;;) { + ptr += MINBPC; + if (ptr == end) + break; + switch (BYTE_TYPE(enc, ptr)) { + case BT_S: case BT_LF: + break; + case BT_CR: + /* don't split CR/LF pair */ + if (ptr + MINBPC != end) + break; + /* fall through */ + default: + *nextTokPtr = ptr; + return XML_TOK_PROLOG_S; + } + } + *nextTokPtr = ptr; + return XML_TOK_PROLOG_S; + case BT_PERCNT: + return PREFIX(scanPercent)(enc, ptr + MINBPC, end, nextTokPtr); + case BT_COMMA: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_COMMA; + case BT_LSQB: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_OPEN_BRACKET; + case BT_RSQB: + ptr += MINBPC; + if (ptr == end) + return XML_TOK_PARTIAL; + if (CHAR_MATCHES(enc, ptr, ']')) { + if (ptr + MINBPC == end) + return XML_TOK_PARTIAL; + if (CHAR_MATCHES(enc, ptr + MINBPC, '>')) { + *nextTokPtr = ptr + 2*MINBPC; + return XML_TOK_COND_SECT_CLOSE; + } + } + *nextTokPtr = ptr; + return XML_TOK_CLOSE_BRACKET; + case BT_LPAR: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_OPEN_PAREN; + case BT_RPAR: + ptr += MINBPC; + if (ptr == end) + return XML_TOK_PARTIAL; + switch (BYTE_TYPE(enc, ptr)) { + case BT_AST: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_CLOSE_PAREN_ASTERISK; + case BT_QUEST: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_CLOSE_PAREN_QUESTION; + case BT_PLUS: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_CLOSE_PAREN_PLUS; + case BT_CR: case BT_LF: case BT_S: + case BT_GT: case BT_COMMA: case BT_VERBAR: + case BT_RPAR: + *nextTokPtr = ptr; + return XML_TOK_CLOSE_PAREN; + } + *nextTokPtr = ptr; + return XML_TOK_INVALID; + case BT_VERBAR: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_OR; + case BT_GT: + *nextTokPtr = ptr + MINBPC; + return XML_TOK_DECL_CLOSE; + case BT_NUM: + return PREFIX(scanPoundName)(enc, ptr + MINBPC, end, nextTokPtr); +#define LEAD_CASE(n) \ + case BT_LEAD ## n: \ + if (end - ptr < n) \ + return XML_TOK_PARTIAL_CHAR; \ + if (IS_NMSTRT_CHAR(enc, ptr, n)) { \ + ptr += n; \ + tok = XML_TOK_NAME; \ + break; \ + } \ + if (IS_NAME_CHAR(enc, ptr, n)) { \ + ptr += n; \ + tok = XML_TOK_NMTOKEN; \ + break; \ + } \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_NMSTRT: + case BT_HEX: + tok = XML_TOK_NAME; + ptr += MINBPC; + break; + case BT_DIGIT: + case BT_NAME: + case BT_MINUS: + tok = XML_TOK_NMTOKEN; + ptr += MINBPC; + break; + case BT_NONASCII: + if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { + ptr += MINBPC; + tok = XML_TOK_NAME; + break; + } + if (IS_NAME_CHAR_MINBPC(enc, ptr)) { + ptr += MINBPC; + tok = XML_TOK_NMTOKEN; + break; + } + /* fall through */ + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_GT: case BT_RPAR: case BT_COMMA: + case BT_VERBAR: case BT_LSQB: case BT_PERCNT: + case BT_S: case BT_CR: case BT_LF: + *nextTokPtr = ptr; + return tok; + case BT_PLUS: + if (tok != XML_TOK_NAME) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + *nextTokPtr = ptr + MINBPC; + return XML_TOK_NAME_PLUS; + case BT_AST: + if (tok != XML_TOK_NAME) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + *nextTokPtr = ptr + MINBPC; + return XML_TOK_NAME_ASTERISK; + case BT_QUEST: + if (tok != XML_TOK_NAME) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + *nextTokPtr = ptr + MINBPC; + return XML_TOK_NAME_QUESTION; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + return XML_TOK_PARTIAL; +} + +static +int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + const char *start; + if (ptr == end) + return XML_TOK_NONE; + start = ptr; + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: ptr += n; break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_AMP: + if (ptr == start) + return PREFIX(scanRef)(enc, ptr + MINBPC, end, nextTokPtr); + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_LT: + /* this is for inside entity references */ + *nextTokPtr = ptr; + return XML_TOK_INVALID; + case BT_LF: + if (ptr == start) { + *nextTokPtr = ptr + MINBPC; + return XML_TOK_DATA_NEWLINE; + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_CR: + if (ptr == start) { + ptr += MINBPC; + if (ptr == end) + return XML_TOK_TRAILING_CR; + if (BYTE_TYPE(enc, ptr) == BT_LF) + ptr += MINBPC; + *nextTokPtr = ptr; + return XML_TOK_DATA_NEWLINE; + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_S: + if (ptr == start) { + *nextTokPtr = ptr + MINBPC; + return XML_TOK_ATTRIBUTE_VALUE_S; + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + default: + ptr += MINBPC; + break; + } + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; +} + +static +int PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + const char *start; + if (ptr == end) + return XML_TOK_NONE; + start = ptr; + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: ptr += n; break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_AMP: + if (ptr == start) + return PREFIX(scanRef)(enc, ptr + MINBPC, end, nextTokPtr); + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_PERCNT: + if (ptr == start) + return PREFIX(scanPercent)(enc, ptr + MINBPC, end, nextTokPtr); + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_LF: + if (ptr == start) { + *nextTokPtr = ptr + MINBPC; + return XML_TOK_DATA_NEWLINE; + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_CR: + if (ptr == start) { + ptr += MINBPC; + if (ptr == end) + return XML_TOK_TRAILING_CR; + if (BYTE_TYPE(enc, ptr) == BT_LF) + ptr += MINBPC; + *nextTokPtr = ptr; + return XML_TOK_DATA_NEWLINE; + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + default: + ptr += MINBPC; + break; + } + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; +} + +static +int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, + const char **badPtr) +{ + ptr += MINBPC; + end -= MINBPC; + for (; ptr != end; ptr += MINBPC) { + switch (BYTE_TYPE(enc, ptr)) { + case BT_DIGIT: + case BT_HEX: + case BT_MINUS: + case BT_APOS: + case BT_LPAR: + case BT_RPAR: + case BT_PLUS: + case BT_COMMA: + case BT_SOL: + case BT_EQUALS: + case BT_QUEST: + case BT_CR: + case BT_LF: + case BT_SEMI: + case BT_EXCL: + case BT_AST: + case BT_PERCNT: + case BT_NUM: + break; + case BT_S: + if (CHAR_MATCHES(enc, ptr, '\t')) { + *badPtr = ptr; + return 0; + } + break; + case BT_NAME: + case BT_NMSTRT: + if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) + break; + default: + switch (BYTE_TO_ASCII(enc, ptr)) { + case 0x24: /* $ */ + case 0x40: /* @ */ + break; + default: + *badPtr = ptr; + return 0; + } + break; + } + } + return 1; +} + +/* This must only be called for a well-formed start-tag or empty element tag. +Returns the number of attributes. Pointers to the first attsMax attributes +are stored in atts. */ + +static +int PREFIX(getAtts)(const ENCODING *enc, const char *ptr, + int attsMax, ATTRIBUTE *atts) +{ + enum { other, inName, inValue } state = inName; + int nAtts = 0; + int open = 0; + + for (ptr += MINBPC;; ptr += MINBPC) { + switch (BYTE_TYPE(enc, ptr)) { +#define START_NAME \ + if (state == other) { \ + if (nAtts < attsMax) { \ + atts[nAtts].name = ptr; \ + atts[nAtts].normalized = 1; \ + } \ + state = inName; \ + } +#define LEAD_CASE(n) \ + case BT_LEAD ## n: START_NAME ptr += (n - MINBPC); break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_NONASCII: + case BT_NMSTRT: + case BT_HEX: + START_NAME + break; +#undef START_NAME + case BT_QUOT: + if (state != inValue) { + atts[nAtts].valuePtr = ptr + MINBPC; + state = inValue; + open = BT_QUOT; + } + else if (open == BT_QUOT) { + state = other; + atts[nAtts++].valueEnd = ptr; + } + break; + case BT_APOS: + if (state != inValue) { + atts[nAtts].valuePtr = ptr + MINBPC; + state = inValue; + open = BT_APOS; + } + else if (open == BT_APOS) { + state = other; + atts[nAtts++].valueEnd = ptr; + } + break; + case BT_AMP: + atts[nAtts].normalized = 0; + break; + case BT_S: + if (state == inName) + state = other; + else if (state == inValue + && atts[nAtts].normalized + && (ptr == atts[nAtts].valuePtr + || BYTE_TO_ASCII(enc, ptr) != ' ' + || BYTE_TO_ASCII(enc, ptr + MINBPC) == ' ' + || BYTE_TYPE(enc, ptr + MINBPC) == open)) + atts[nAtts].normalized = 0; + break; + case BT_CR: case BT_LF: + /* This case ensures that the first attribute name is counted + Apart from that we could just change state on the quote. */ + if (state == inName) + state = other; + else if (state == inValue) + atts[nAtts].normalized = 0; + break; + case BT_GT: + case BT_SOL: + if (state != inValue) + return nAtts; + break; + default: + break; + } + } + /* not reached */ +} + +static +int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) +{ + int result = 0; + /* skip &# */ + ptr += 2*MINBPC; + if (CHAR_MATCHES(enc, ptr, 'x')) { + for (ptr += MINBPC; !CHAR_MATCHES(enc, ptr, ';'); ptr += MINBPC) { + int c = BYTE_TO_ASCII(enc, ptr); + switch (c) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + result <<= 4; + result |= (c - '0'); + break; + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + result <<= 4; + result += 10 + (c - 'A'); + break; + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + result <<= 4; + result += 10 + (c - 'a'); + break; + } + if (result >= 0x110000) + return -1; + } + } + else { + for (; !CHAR_MATCHES(enc, ptr, ';'); ptr += MINBPC) { + int c = BYTE_TO_ASCII(enc, ptr); + result *= 10; + result += (c - '0'); + if (result >= 0x110000) + return -1; + } + } + return checkCharRefNumber(result); +} + +static +int PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, const char *end) +{ + switch (end - ptr) { + case 2 * MINBPC: + if (CHAR_MATCHES(enc, ptr + MINBPC, 't')) { + switch (BYTE_TO_ASCII(enc, ptr)) { + case 'l': + return '<'; + case 'g': + return '>'; + } + } + break; + case 3 * MINBPC: + if (CHAR_MATCHES(enc, ptr, 'a')) { + ptr += MINBPC; + if (CHAR_MATCHES(enc, ptr, 'm')) { + ptr += MINBPC; + if (CHAR_MATCHES(enc, ptr, 'p')) + return '&'; + } + } + break; + case 4 * MINBPC: + switch (BYTE_TO_ASCII(enc, ptr)) { + case 'q': + ptr += MINBPC; + if (CHAR_MATCHES(enc, ptr, 'u')) { + ptr += MINBPC; + if (CHAR_MATCHES(enc, ptr, 'o')) { + ptr += MINBPC; + if (CHAR_MATCHES(enc, ptr, 't')) + return '"'; + } + } + break; + case 'a': + ptr += MINBPC; + if (CHAR_MATCHES(enc, ptr, 'p')) { + ptr += MINBPC; + if (CHAR_MATCHES(enc, ptr, 'o')) { + ptr += MINBPC; + if (CHAR_MATCHES(enc, ptr, 's')) + return '\''; + } + } + break; + } + } + return 0; +} + +static +int PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) +{ + for (;;) { + switch (BYTE_TYPE(enc, ptr1)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: \ + if (*ptr1++ != *ptr2++) \ + return 0; + LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2) +#undef LEAD_CASE + /* fall through */ + if (*ptr1++ != *ptr2++) + return 0; + break; + case BT_NONASCII: + case BT_NMSTRT: + case BT_HEX: + case BT_DIGIT: + case BT_NAME: + case BT_MINUS: + if (*ptr2++ != *ptr1++) + return 0; +#if MINBPC > 1 + if (*ptr2++ != *ptr1++) + return 0; +#if MINBPC > 2 + if (*ptr2++ != *ptr1++) + return 0; +#if MINBPC > 3 + if (*ptr2++ != *ptr1++) + return 0; +#endif +#endif +#endif + break; + default: +#if MINBPC == 1 + if (*ptr1 == *ptr2) + return 1; +#endif + switch (BYTE_TYPE(enc, ptr2)) { + case BT_LEAD2: + case BT_LEAD3: + case BT_LEAD4: + case BT_NONASCII: + case BT_NMSTRT: + case BT_HEX: + case BT_DIGIT: + case BT_NAME: + case BT_MINUS: + return 0; + default: + return 1; + } + } + } + /* not reached */ +} + +static +int PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, const char *ptr2) +{ + for (; *ptr2; ptr1 += MINBPC, ptr2++) { + if (!CHAR_MATCHES(end, ptr1, *ptr2)) + return 0; + } + switch (BYTE_TYPE(enc, ptr1)) { + case BT_LEAD2: + case BT_LEAD3: + case BT_LEAD4: + case BT_NONASCII: + case BT_NMSTRT: + case BT_HEX: + case BT_DIGIT: + case BT_NAME: + case BT_MINUS: + return 0; + default: + return 1; + } +} + +static +int PREFIX(nameLength)(const ENCODING *enc, const char *ptr) +{ + const char *start = ptr; + for (;;) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: ptr += n; break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_NONASCII: + case BT_NMSTRT: + case BT_HEX: + case BT_DIGIT: + case BT_NAME: + case BT_MINUS: + ptr += MINBPC; + break; + default: + return ptr - start; + } + } +} + +static +const char *PREFIX(skipS)(const ENCODING *enc, const char *ptr) +{ + for (;;) { + switch (BYTE_TYPE(enc, ptr)) { + case BT_LF: + case BT_CR: + case BT_S: + ptr += MINBPC; + break; + default: + return ptr; + } + } +} + +static +void PREFIX(updatePosition)(const ENCODING *enc, + const char *ptr, + const char *end, + POSITION *pos) +{ + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: \ + ptr += n; \ + break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_LF: + pos->columnNumber = (unsigned)-1; + pos->lineNumber++; + ptr += MINBPC; + break; + case BT_CR: + pos->lineNumber++; + ptr += MINBPC; + if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) + ptr += MINBPC; + pos->columnNumber = (unsigned)-1; + break; + default: + ptr += MINBPC; + break; + } + pos->columnNumber++; + } +} + +#undef DO_LEAD_CASE +#undef MULTIBYTE_CASES +#undef INVALID_CASES +#undef CHECK_NAME_CASE +#undef CHECK_NAME_CASES +#undef CHECK_NMSTRT_CASE +#undef CHECK_NMSTRT_CASES Index: xotcl/library/xml/TclExpat-1.1/xmltok_impl.h =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/xmltok_impl.h (revision 0) +++ xotcl/library/xml/TclExpat-1.1/xmltok_impl.h (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,60 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +enum { + BT_NONXML, + BT_MALFORM, + BT_LT, + BT_AMP, + BT_RSQB, + BT_LEAD2, + BT_LEAD3, + BT_LEAD4, + BT_TRAIL, + BT_CR, + BT_LF, + BT_GT, + BT_QUOT, + BT_APOS, + BT_EQUALS, + BT_QUEST, + BT_EXCL, + BT_SOL, + BT_SEMI, + BT_NUM, + BT_LSQB, + BT_S, + BT_NMSTRT, + BT_HEX, + BT_DIGIT, + BT_NAME, + BT_MINUS, + BT_OTHER, /* known not to be a name or name start character */ + BT_NONASCII, /* might be a name or name start character */ + BT_PERCNT, + BT_LPAR, + BT_RPAR, + BT_AST, + BT_PLUS, + BT_COMMA, + BT_VERBAR +}; + +#include Index: xotcl/library/xml/TclExpat-1.1/xmlwf.c =================================================================== diff -u --- xotcl/library/xml/TclExpat-1.1/xmlwf.c (revision 0) +++ xotcl/library/xml/TclExpat-1.1/xmlwf.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,654 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#include +#include "xmlparse.h" +#include "filemap.h" +#include "codepage.h" + +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#include +#endif + +#ifdef _POSIX_SOURCE +#include +#endif + +#ifndef O_BINARY +#ifdef _O_BINARY +#define O_BINARY _O_BINARY +#else +#define O_BINARY 0 +#endif +#endif + +#ifdef _MSC_VER +#include +#endif + +#ifdef _DEBUG +#define READ_SIZE 16 +#else +#define READ_SIZE (1024*8) +#endif + +#ifdef XML_UNICODE +#ifndef XML_UNICODE_WCHAR_T +#error xmlwf requires a 16-bit Unicode-compatible wchar_t +#endif +#define T(x) L ## x +#define ftprintf fwprintf +#define tfopen _wfopen +#define fputts fputws +#define puttc putwc +#define tcscmp wcscmp +#define tcscpy wcscpy +#define tcscat wcscat +#define tcschr wcschr +#define tcsrchr wcsrchr +#define tcslen wcslen +#define tperror _wperror +#define topen _wopen +#define tmain wmain +#define tremove _wremove +#else /* not XML_UNICODE */ +#define T(x) x +#define ftprintf fprintf +#define tfopen fopen +#define fputts fputs +#define puttc putc +#define tcscmp strcmp +#define tcscpy strcpy +#define tcscat strcat +#define tcschr strchr +#define tcsrchr strrchr +#define tcslen strlen +#define tperror perror +#define topen open +#define tmain main +#define tremove remove +#endif /* not XML_UNICODE */ + +static void characterData(void *userData, const XML_Char *s, size_t len) +{ + FILE *fp = userData; + for (; len > 0; --len, ++s) { + switch (*s) { + case T('&'): + fputts(T("&"), fp); + break; + case T('<'): + fputts(T("<"), fp); + break; + case T('>'): + fputts(T(">"), fp); + break; + case T('"'): + fputts(T("""), fp); + break; + case 9: + case 10: + case 13: + ftprintf(fp, T("&#%d;"), *s); + break; + default: + puttc(*s, fp); + break; + } + } +} + +/* Lexicographically comparing UTF-8 encoded attribute values, +is equivalent to lexicographically comparing based on the character number. */ + +static int attcmp(const void *att1, const void *att2) +{ + return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2); +} + +static void startElement(void *userData, const XML_Char *name, const XML_Char **atts) +{ + size_t nAtts; + const XML_Char **p; + FILE *fp = userData; + puttc(T('<'), fp); + fputts(name, fp); + + p = atts; + while (*p) + ++p; + nAtts = (p - atts) >> 1; + if (nAtts > 1) + qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp); + while (*atts) { + puttc(T(' '), fp); + fputts(*atts++, fp); + puttc(T('='), fp); + puttc(T('"'), fp); + characterData(userData, *atts, tcslen(*atts)); + puttc(T('"'), fp); + atts++; + } + puttc(T('>'), fp); +} + +static void endElement(void *userData, const XML_Char *name) +{ + FILE *fp = userData; + puttc(T('<'), fp); + puttc(T('/'), fp); + fputts(name, fp); + puttc(T('>'), fp); +} + +static void processingInstruction(void *userData, const XML_Char *target, const XML_Char *data) +{ + FILE *fp = userData; + puttc(T('<'), fp); + puttc(T('?'), fp); + fputts(target, fp); + puttc(T(' '), fp); + fputts(data, fp); + puttc(T('?'), fp); + puttc(T('>'), fp); +} + +static void defaultCharacterData(XML_Parser parser, const XML_Char *s, size_t len) +{ + XML_DefaultCurrent(parser); +} + +static void defaultStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **atts) +{ + XML_DefaultCurrent(parser); +} + +static void defaultEndElement(XML_Parser parser, const XML_Char *name) +{ + XML_DefaultCurrent(parser); +} + +static void defaultProcessingInstruction(XML_Parser parser, const XML_Char *target, const XML_Char *data) +{ + XML_DefaultCurrent(parser); +} + +static void markup(XML_Parser parser, const XML_Char *s, int len) +{ + FILE *fp = XML_GetUserData(parser); + for (; len > 0; --len, ++s) + puttc(*s, fp); +} + +static +void metaLocation(XML_Parser parser) +{ + const XML_Char *uri = XML_GetBase(parser); + if (uri) + ftprintf(XML_GetUserData(parser), T(" uri=\"%s\""), uri); + ftprintf(XML_GetUserData(parser), + T(" byte=\"%ld\" line=\"%d\" col=\"%d\""), + XML_GetCurrentByteIndex(parser), + XML_GetCurrentLineNumber(parser), + XML_GetCurrentColumnNumber(parser)); +} + +static +void metaStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **atts) +{ + FILE *fp = XML_GetUserData(parser); + ftprintf(fp, T("\n"), fp); + do { + ftprintf(fp, T("\n"), fp); + } while (*(atts += 2)); + fputts(T("\n"), fp); + } + else + fputts(T("/>\n"), fp); +} + +static +void metaEndElement(XML_Parser parser, const XML_Char *name) +{ + FILE *fp = XML_GetUserData(parser); + ftprintf(fp, T("\n"), fp); +} + +static +void metaProcessingInstruction(XML_Parser parser, const XML_Char *target, const XML_Char *data) +{ + FILE *fp = XML_GetUserData(parser); + ftprintf(fp, T("\n"), fp); +} + +static +void metaCharacterData(XML_Parser parser, const XML_Char *s, size_t len) +{ + FILE *fp = XML_GetUserData(parser); + fputts(T("\n"), fp); +} + +static +void metaUnparsedEntityDecl(XML_Parser parser, + const XML_Char *entityName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName) +{ + FILE *fp = XML_GetUserData(parser); + ftprintf(fp, T("\n"), fp); +} + +static +void metaNotationDecl(XML_Parser parser, + const XML_Char *notationName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId) +{ + FILE *fp = XML_GetUserData(parser); + ftprintf(fp, T("\n"), fp); +} + +typedef struct { + XML_Parser parser; + int *retPtr; +} PROCESS_ARGS; + +static +void reportError(XML_Parser parser, const XML_Char *filename) +{ + int code = XML_GetErrorCode(parser); + const XML_Char *message = XML_ErrorString(code); + if (message) + ftprintf(stdout, T("%s:%d:%d: %s\n"), + filename, + XML_GetErrorLineNumber(parser), + XML_GetErrorColumnNumber(parser), + message); + else + ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code); +} + +static +void processFile(const void *data, size_t size, const XML_Char *filename, void *args) +{ + XML_Parser parser = ((PROCESS_ARGS *)args)->parser; + int *retPtr = ((PROCESS_ARGS *)args)->retPtr; + if (!XML_Parse(parser, data, size, 1)) { + reportError(parser, filename); + *retPtr = 0; + } + else + *retPtr = 1; +} + +static +int isAsciiLetter(XML_Char c) +{ + return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z')); +} + +static +const XML_Char *resolveSystemId(const XML_Char *base, const XML_Char *systemId, XML_Char **toFree) +{ + XML_Char *s; + *toFree = 0; + if (!base + || *systemId == T('/') +#ifdef WIN32 + || *systemId == T('\\') + || (isAsciiLetter(systemId[0]) && systemId[1] == T(':')) +#endif + ) + return systemId; + *toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2)*sizeof(XML_Char)); + if (!*toFree) + return systemId; + tcscpy(*toFree, base); + s = *toFree; + if (tcsrchr(s, T('/'))) + s = tcsrchr(s, T('/')) + 1; +#ifdef WIN32 + if (tcsrchr(s, T('\\'))) + s = tcsrchr(s, T('\\')) + 1; +#endif + tcscpy(s, systemId); + return *toFree; +} + +static +int externalEntityRefFilemap(XML_Parser parser, + const XML_Char *openEntityNames, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId) +{ + int result; + XML_Char *s; + const XML_Char *filename; + XML_Parser entParser = XML_ExternalEntityParserCreate(parser, openEntityNames, 0); + PROCESS_ARGS args; + args.retPtr = &result; + args.parser = entParser; + filename = resolveSystemId(base, systemId, &s); + XML_SetBase(entParser, filename); + if (!filemap(filename, processFile, &args)) + result = 0; + free(s); + XML_ParserFree(entParser); + return result; +} + +static +int processStream(const XML_Char *filename, XML_Parser parser) +{ + int fd = topen(filename, O_BINARY|O_RDONLY); + if (fd < 0) { + tperror(filename); + return 0; + } + for (;;) { + size_t nread; + char *buf = XML_GetBuffer(parser, READ_SIZE); + if (!buf) { + close(fd); + ftprintf(stderr, T("%s: out of memory\n"), filename); + return 0; + } + nread = read(fd, buf, READ_SIZE); + if (nread < 0) { + tperror(filename); + close(fd); + return 0; + } + if (!XML_ParseBuffer(parser, nread, nread == 0)) { + reportError(parser, filename); + close(fd); + return 0; + } + if (nread == 0) { + close(fd); + break;; + } + } + return 1; +} + +static +int externalEntityRefStream(XML_Parser parser, + const XML_Char *openEntityNames, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId) +{ + XML_Char *s; + const XML_Char *filename; + int ret; + XML_Parser entParser = XML_ExternalEntityParserCreate(parser, openEntityNames, 0); + filename = resolveSystemId(base, systemId, &s); + XML_SetBase(entParser, filename); + ret = processStream(filename, entParser); + free(s); + XML_ParserFree(entParser); + return ret; +} + +static +int unknownEncodingConvert(void *data, const char *p) +{ + return codepageConvert(*(int *)data, p); +} + +static +int unknownEncoding(void *userData, + const XML_Char *name, + XML_Encoding *info) +{ + int cp; + static const XML_Char prefixL[] = T("windows-"); + static const XML_Char prefixU[] = T("WINDOWS-"); + int i; + + for (i = 0; prefixU[i]; i++) + if (name[i] != prefixU[i] && name[i] != prefixL[i]) + return 0; + + cp = 0; + for (; name[i]; i++) { + static const XML_Char digits[] = T("0123456789"); + const XML_Char *s = tcschr(digits, name[i]); + if (!s) + return 0; + cp *= 10; + cp += s - digits; + if (cp >= 0x10000) + return 0; + } + if (!codepageMap(cp, info->map)) + return 0; + info->convert = unknownEncodingConvert; + /* We could just cast the code page integer to a void *, + and avoid the use of release. */ + info->release = free; + info->data = malloc(sizeof(int)); + if (!info->data) + return 0; + *(int *)info->data = cp; + return 1; +} + +static +void usage(const XML_Char *prog) +{ + ftprintf(stderr, T("usage: %s [-r] [-w] [-x] [-d output-dir] [-e encoding] file ...\n"), prog); + exit(1); +} + +int tmain(int argc, XML_Char **argv) +{ + int i; + const XML_Char *outputDir = 0; + const XML_Char *encoding = 0; + int useFilemap = 1; + int processExternalEntities = 0; + int windowsCodePages = 0; + int outputType = 0; + +#ifdef _MSC_VER + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF); +#endif + + i = 1; + while (i < argc && argv[i][0] == T('-')) { + int j; + if (argv[i][1] == T('-') && argv[i][2] == T('\0')) { + i++; + break; + } + j = 1; + if (argv[i][j] == T('r')) { + useFilemap = 0; + j++; + } + if (argv[i][j] == T('x')) { + processExternalEntities = 1; + j++; + } + if (argv[i][j] == T('w')) { + windowsCodePages = 1; + j++; + } + if (argv[i][j] == T('m')) { + outputType = 'm'; + j++; + } + if (argv[i][j] == T('c')) { + outputType = 'c'; + j++; + } + if (argv[i][j] == T('d')) { + if (argv[i][j + 1] == T('\0')) { + if (++i == argc) + usage(argv[0]); + outputDir = argv[i]; + } + else + outputDir = argv[i] + j + 1; + i++; + } + else if (argv[i][j] == T('e')) { + if (argv[i][j + 1] == T('\0')) { + if (++i == argc) + usage(argv[0]); + encoding = argv[i]; + } + else + encoding = argv[i] + j + 1; + i++; + } + else if (argv[i][j] == T('\0') && j > 1) + i++; + else + usage(argv[0]); + } + if (i == argc) + usage(argv[0]); + for (; i < argc; i++) { + FILE *fp = 0; + XML_Char *outName = 0; + int result; + XML_Parser parser = XML_ParserCreate(encoding); + if (outputDir) { + const XML_Char *file = argv[i]; + if (tcsrchr(file, T('/'))) + file = tcsrchr(file, T('/')) + 1; +#ifdef WIN32 + if (tcsrchr(file, T('\\'))) + file = tcsrchr(file, T('\\')) + 1; +#endif + outName = malloc((tcslen(outputDir) + tcslen(file) + 2) * sizeof(XML_Char)); + tcscpy(outName, outputDir); + tcscat(outName, T("/")); + tcscat(outName, file); + fp = tfopen(outName, T("wb")); + if (!fp) { + tperror(outName); + exit(1); + } +#ifdef XML_UNICODE + puttc(0xFEFF, fp); +#endif + XML_SetUserData(parser, fp); + switch (outputType) { + case 'm': + XML_UseParserAsHandlerArg(parser); + fputts(T("\n"), fp); + XML_SetElementHandler(parser, metaStartElement, metaEndElement); + XML_SetProcessingInstructionHandler(parser, metaProcessingInstruction); + XML_SetCharacterDataHandler(parser, metaCharacterData); + XML_SetUnparsedEntityDeclHandler(parser, metaUnparsedEntityDecl); + XML_SetNotationDeclHandler(parser, metaNotationDecl); + break; + case 'c': + XML_UseParserAsHandlerArg(parser); + XML_SetDefaultHandler(parser, markup); + XML_SetElementHandler(parser, defaultStartElement, defaultEndElement); + XML_SetCharacterDataHandler(parser, defaultCharacterData); + XML_SetProcessingInstructionHandler(parser, defaultProcessingInstruction); + break; + default: + XML_SetElementHandler(parser, startElement, endElement); + XML_SetCharacterDataHandler(parser, characterData); + XML_SetProcessingInstructionHandler(parser, processingInstruction); + break; + } + } + if (windowsCodePages) + XML_SetUnknownEncodingHandler(parser, unknownEncoding, 0); + if (!XML_SetBase(parser, argv[i])) { + ftprintf(stderr, T("%s: out of memory"), argv[0]); + exit(1); + } + if (processExternalEntities) + XML_SetExternalEntityRefHandler(parser, + useFilemap + ? externalEntityRefFilemap + : externalEntityRefStream); + if (useFilemap) { + PROCESS_ARGS args; + args.retPtr = &result; + args.parser = parser; + if (!filemap(argv[i], processFile, &args)) + result = 0; + } + else + result = processStream(argv[i], parser); + if (outputDir) { + if (outputType == 'm') + fputts(T("\n"), fp); + fclose(fp); + if (!result) + tremove(outName); + free(outName); + } + XML_ParserFree(parser); + } + return 0; +} Index: xotcl/library/xml/pkgIndex.tcl =================================================================== diff -u --- xotcl/library/xml/pkgIndex.tcl (revision 0) +++ xotcl/library/xml/pkgIndex.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,15 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex -direct" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded sgml 1.6 [list source [file join $dir sgml.tcl]] +package ifneeded xml 1.8 [list source [file join $dir xml.tcl]] +package ifneeded xotcl::xml::parser 0.94 [list source [file join $dir xoXML.xotcl]] +package ifneeded xotcl::xml::printVisitor 0.9 [list source [file join $dir printVisitor.xotcl]] +package ifneeded xotcl::xml::recreatorVisitor 0.9 [list source [file join $dir xmlRecreatorVisitor.xotcl]] Index: xotcl/library/xml/printVisitor.xotcl =================================================================== diff -u --- xotcl/library/xml/printVisitor.xotcl (revision 0) +++ xotcl/library/xml/printVisitor.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,18 @@ +# $Id: printVisitor.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::xml::printVisitor 0.9 +package require xotcl::xml::parser + +############################################################################## +# +# Small debugging visitor that just uses node's print method to print the +# node tree +# +############################################################################## + +Class PrintVisitor -superclass NodeTreeVisitor -parameter parser +PrintVisitor instproc visit objName { + puts [$objName print] +} +PrintVisitor instproc interpretNodeTree node { + $node accept [self] +} Index: xotcl/library/xml/sgml.tcl =================================================================== diff -u --- xotcl/library/xml/sgml.tcl (revision 0) +++ xotcl/library/xml/sgml.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1653 @@ +# sgml.tcl -- +# +# This file provides generic parsing services for SGML-based +# languages, namely HTML and XML. +# +# NB. It is a misnomer. There is no support for parsing +# arbitrary SGML as such. +# +# Copyright (c) 1998,1999 Zveno Pty Ltd +# http://www.zveno.com/ +# +# Zveno makes this software available free of charge for any purpose. +# Copies may be made of this software but all of this notice must be included +# on any copy. +# +# The software was developed for research purposes only and Zveno does not +# warrant that it is error free or fit for any purpose. Zveno disclaims any +# liability for all claims, expenses, losses, damages and costs any user may +# incur as a result of using, copying or modifying this software. +# +# Copyright (c) 1997 ANU and CSIRO on behalf of the +# participants in the CRC for Advanced Computational Systems ('ACSys'). +# +# ACSys makes this software and all associated data and documentation +# ('Software') available free of charge for any purpose. You may make copies +# of the Software but you must include all of this notice on any copy. +# +# The Software was developed for research purposes and ACSys does not warrant +# that it is error free or fit for any purpose. ACSys disclaims any +# liability for all claims, expenses, losses, damages and costs any user may +# incur as a result of using, copying or modifying the Software. +# +# $Id: sgml.tcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +package provide sgml 1.6 + +namespace eval sgml { + namespace export tokenise parseEvent + + namespace export parseDTD + + # Convenience routine + proc cl x { + return "\[$x\]" + } + + # Define various regular expressions + # white space + variable Wsp " \t\r\n" + variable noWsp [cl ^$Wsp] + + # Various XML names + variable nmtoken [cl -a-zA-Z0-9._]+ + variable name [cl a-zA-Z_][cl -a-zA-Z0-9._]* + + # Other + variable ParseEventNum + if {![info exists ParseEventNum]} { + set ParseEventNum 0 + } + variable ParseDTDnum + if {![info exists ParseDTDNum]} { + set ParseDTDNum 0 + } + + # table of predefined entities for XML + + variable EntityPredef + array set EntityPredef { + lt < gt > amp & quot \" apos ' + } + +} + +# sgml::tokenise -- +# +# Transform the given HTML/XML text into a Tcl list. +# +# Arguments: +# sgml text to tokenize +# elemExpr RE to recognise tags +# elemSub transform for matched tags +# args options +# +# Valid Options: +# -final boolean True if no more data is to be supplied +# -statevariable varName Name of a variable used to store info +# +# Results: +# Returns a Tcl list representing the document. + +proc sgml::tokenise {sgml elemExpr elemSub args} { + array set options {-final 1} + catch {array set options $args} + set options(-final) [Boolean $options(-final)] + + # If the data is not final then there must be a variable to store + # unused data. + if {!$options(-final) && ![info exists options(-statevariable)]} { + return -code error {option "-statevariable" required if not final} + } + + # Pre-process stage + # + # Extract the internal DTD subset, if any + + catch {upvar #0 $options(-internaldtdvariable) dtd} + if {[regexp {]*$)} [lindex $sgml end] x text unused]} { + set sgml [lreplace $sgml end end $text] + } + + } else { + + # Performance note (Tcl 8.0): + # In this case, no conversion to list object is performed + + regsub -all $elemExpr $sgml $elemSub sgml + set sgml "{} {} {} {} \{$sgml\}" + } + + return $sgml + +} + +# sgml::parseEvent -- +# +# Produces an event stream for a XML/HTML document, +# given the Tcl list format returned by tokenise. +# +# This procedure checks that the document is well-formed, +# and throws an error if the document is found to be not +# well formed. Warnings are passed via the -warningcommand script. +# +# The procedure only check for well-formedness, +# no DTD is required. However, facilities are provided for entity expansion. +# +# Arguments: +# sgml Instance data, as a Tcl list. +# args option/value pairs +# +# Valid Options: +# -final Indicates end of document data +# -elementstartcommand Called when an element starts +# -elementendcommand Called when an element ends +# -characterdatacommand Called when character data occurs +# -entityreferencecommand Called when an entity reference occurs +# -processinginstructioncommand Called when a PI occurs +# -externalentityrefcommand Called for an external entity reference +# +# (Not compatible with expat) +# -xmldeclcommand Called when the XML declaration occurs +# -doctypecommand Called when the document type declaration occurs +# -commentcommand Called when a comment occurs +# +# -errorcommand Script to evaluate for a fatal error +# -warningcommand Script to evaluate for a reportable warning +# -statevariable global state variable +# -normalize whether to normalize names +# -reportempty whether to include an indication of empty elements +# +# Results: +# The various callback scripts are invoked. +# Returns empty string. +# +# BUGS: +# If command options are set to empty string then they should not be invoked. + +proc sgml::parseEvent {sgml args} { + variable Wsp + variable noWsp + variable nmtoken + variable name + variable ParseEventNum + + array set options [list \ + -elementstartcommand [namespace current]::noop \ + -elementendcommand [namespace current]::noop \ + -characterdatacommand [namespace current]::noop \ + -processinginstructioncommand [namespace current]::noop \ + -externalentityrefcommand [namespace current]::noop \ + -xmldeclcommand [namespace current]::noop \ + -doctypecommand [namespace current]::noop \ + -commentcommand [namespace current]::noop \ + -entityreferencecommand {} \ + -warningcommand [namespace current]::noop \ + -errorcommand [namespace current]::Error \ + -final 1 \ + -emptyelement [namespace current]::EmptyElement \ + -parseattributelistcommand [namespace current]::noop \ + -normalize 1 \ + -internaldtd {} \ + -reportempty 0 \ + -entityvariable [namespace current]::EntityPredef \ + ] + catch {array set options $args} + + if {![info exists options(-statevariable)]} { + set options(-statevariable) [namespace current]::ParseEvent[incr ParseEventNum] + } + + upvar #0 $options(-statevariable) state + upvar #0 $options(-entityvariable) entities + + if {![info exists state]} { + # Initialise the state variable + array set state { + mode normal + haveXMLDecl 0 + haveDocElement 0 + context {} + stack {} + line 0 + } + } + + foreach {tag close empty param text} $sgml { + + # Keep track of lines in the input + incr state(line) [regsub -all \n $param {} discard] + incr state(line) [regsub -all \n $text {} discard] + + # If the current mode is cdata or comment then we must undo what the + # regsub has done to reconstitute the data + + switch $state(mode) { + comment { + # This had "[string length $param] && " as a guard - + # can't remember why :-( + if {[regexp ([cl ^-]*)--\$ $tag discard comm1]} { + # end of comment (in tag) + set tag {} + set close {} + set empty {} + set state(mode) normal + uplevel #0 $options(-commentcommand) [list $state(commentdata)<$comm1] + unset state(commentdata) + } elseif {[regexp ([cl ^-]*)--\$ $param discard comm1]} { + # end of comment (in attributes) + uplevel #0 $options(-commentcommand) [list $state(commentdata)<$close$tag$empty>$comm1] + unset state(commentdata) + set tag {} + set param {} + set close {} + set empty {} + set state(mode) normal + } elseif {[regexp ([cl ^-]*)-->(.*) $text discard comm1 text]} { + # end of comment (in text) + uplevel #0 $options(-commentcommand) [list $state(commentdata)<$close$tag$param$empty>$comm1] + unset state(commentdata) + set tag {} + set param {} + set close {} + set empty {} + set state(mode) normal + } else { + # comment continues + append state(commentdata) <$close$tag$param$empty>$text + continue + } + } + cdata { + if {[string length $param] && [regexp ([cl ^\]]*)\]\][cl $Wsp]*\$ $tag discard cdata1]} { + # end of CDATA (in tag) + uplevel #0 $options(-characterdatacommand) [list $state(cdata)<$close$cdata1$text] + set text {} + set tag {} + unset state(cdata) + set state(mode) normal + } elseif {[regexp ([cl ^\]]*)\]\][cl $Wsp]*\$ $param discard cdata1]} { + # end of CDATA (in attributes) + uplevel #0 $options(-characterdatacommand) [list $state(cdata)<$close$tag$cdata1$text] + set text {} + set tag {} + set param {} + unset state(cdata) + set state(mode) normal + } elseif {[regexp ([cl ^\]]*)\]\][cl $Wsp]*>(.*) $text discard cdata1 text]} { + # end of CDATA (in text) + uplevel #0 $options(-characterdatacommand) [list $state(cdata)<$close$tag$param$empty>$cdata1$text] + set text {} + set tag {} + set param {} + set close {} + set empty {} + unset state(cdata) + set state(mode) normal + } else { + # CDATA continues + append state(cdata) <$close$tag$param$empty>$text + continue + } + } + } + + # default: normal mode + + # Bug: if the attribute list has a right angle bracket then the empty + # element marker will not be seen + + set isEmpty [uplevel #0 $options(-emptyelement) [list $tag $param $empty]] + if {[llength $isEmpty]} { + foreach {empty tag param} $isEmpty break + } + + switch -glob -- [string length $tag],[regexp {^\?|!.*} $tag],$close,$empty { + + 0,0,, { + # Ignore empty tag - dealt with non-normal mode above + } + *,0,, { + + # Start tag for an element. + + # Check for a right angle bracket in an attribute value + # This manifests itself by terminating the value before + # the delimiter is seen, and the delimiter appearing + # in the text + + # BUG: If two or more attribute values have right angle + # brackets then this will fail on the second one. + + if {[regexp [format {=[%s]*"[^"]*$} $Wsp] $param] && \ + [regexp {([^"]*"[^>]*)>(.*)} $text discard attrListRemainder text]} { + append param >$attrListRemainder + } elseif {[regexp [format {=[%s]*'[^']*$} $Wsp] $param] && \ + [regexp {([^']*'[^>]*)>(.*)} $text discard attrListRemainder text]} { + append param >$attrListRemainder + } + + # Check if the internal DTD entity is in an attribute + # value + regsub -all &xml:intdtd\; $param \[$options(-internaldtd)\] param + + ParseEvent:ElementOpen $tag $param options + set state(haveDocElement) 1 + + } + + *,0,/, { + + # End tag for an element. + + ParseEvent:ElementClose $tag options + + } + + *,0,,/ { + + # Empty element + + ParseEvent:ElementOpen $tag $param options -empty 1 + ParseEvent:ElementClose $tag options -empty 1 + + } + + *,1,* { + # Processing instructions or XML declaration + switch -glob -- $tag { + + {\?xml} { + # XML Declaration + if {$state(haveXMLDecl)} { + uplevel #0 $options(-errorcommand) "unexpected characters \"<$tag\" around line $state(line)" + } elseif {![regexp {\?$} $param]} { + uplevel #0 $options(-errorcommand) "XML Declaration missing characters \"?>\" around line $state(line)" + } else { + + # Get the version number + if {[regexp {[ ]*version="(-+|[a-zA-Z0-9_.:]+)"[ ]*} $param discard version] || [regexp {[ ]*version='(-+|[a-zA-Z0-9_.:]+)'[ ]*} $param discard version]} { + if {[string compare $version "1.0"]} { + # Should we support future versions? + # At least 1.X? + uplevel #0 $options(-errorcommand) "document XML version \"$version\" is incompatible with XML version 1.0" + } + } else { + uplevel #0 $options(-errorcommand) "XML Declaration missing version information around line $state(line)" + } + + # Get the encoding declaration + set encoding {} + regexp {[ ]*encoding="([A-Za-z]([A-Za-z0-9._]|-)*)"[ ]*} $param discard encoding + regexp {[ ]*encoding='([A-Za-z]([A-Za-z0-9._]|-)*)'[ ]*} $param discard encoding + + # Get the standalone declaration + set standalone {} + regexp {[ ]*standalone="(yes|no)"[ ]*} $param discard standalone + regexp {[ ]*standalone='(yes|no)'[ ]*} $param discard standalone + + # Invoke the callback + uplevel #0 $options(-xmldeclcommand) [list $version $encoding $standalone] + + } + + } + + {\?*} { + # Processing instruction + if {![regsub {\?$} $param {} param]} { + uplevel #0 $options(-errorcommand) "PI: expected '?' character around line $state(line)" + } else { + uplevel #0 $options(-processinginstructioncommand) [list [string range $tag 1 end] [string trimleft $param]] + } + } + + !DOCTYPE { + # External entity reference + # This should move into xml.tcl + # Parse the params supplied. Looking for Name, ExternalID and MarkupDecl + regexp ^[cl $Wsp]*($name)(.*) $param x state(doc_name) param + set state(doc_name) [Normalize $state(doc_name) $options(-normalize)] + set externalID {} + set pubidlit {} + set systemlit {} + set externalID {} + if {[regexp -nocase ^[cl $Wsp]*(SYSTEM|PUBLIC)(.*) $param x id param]} { + switch [string toupper $id] { + SYSTEM { + if {[regexp ^[cl $Wsp]+"([cl ^"]*)"(.*) $param x systemlit param] || [regexp ^[cl $Wsp]+'([cl ^']*)'(.*) $param x systemlit param]} { + set externalID [list SYSTEM $systemlit] ;# " + } else { + uplevel #0 $options(-errorcommand) {{syntax error: SYSTEM identifier not followed by literal}} + } + } + PUBLIC { + if {[regexp ^[cl $Wsp]+"([cl ^"]*)"(.*) $param x pubidlit param] || [regexp ^[cl $Wsp]+'([cl ^']*)'(.*) $param x pubidlit param]} { + if {[regexp ^[cl $Wsp]+"([cl ^"]*)"(.*) $param x systemlit param] || [regexp ^[cl $Wsp]+'([cl ^']*)'(.*) $param x systemlit param]} { + set externalID [list PUBLIC $pubidlit $systemlit] + } else { + uplevel #0 $options(-errorcommand) "syntax error: PUBLIC identifier not followed by system literal around line $state(line)" + } + } else { + uplevel #0 $options(-errorcommand) "syntax error: PUBLIC identifier not followed by literal around line $state(line)" + } + } + } + if {[regexp -nocase ^[cl $Wsp]+NDATA[cl $Wsp]+($name)(.*) $param x notation param]} { + lappend externalID $notation + } + } + + uplevel #0 $options(-doctypecommand) $state(doc_name) [list $pubidlit $systemlit $options(-internaldtd)] + + } + + !--* { + + # Start of a comment + # See if it ends in the same tag, otherwise change the + # parsing mode + + regexp {!--(.*)} $tag discard comm1 + if {[regexp ([cl ^-]*)--[cl $Wsp]*\$ $comm1 discard comm1_1]} { + # processed comment (end in tag) + uplevel #0 $options(-commentcommand) [list $comm1_1] + } elseif {[regexp ([cl ^-]*)--[cl $Wsp]*\$ $param discard comm2]} { + # processed comment (end in attributes) + uplevel #0 $options(-commentcommand) [list $comm1$comm2] + } elseif {[regexp ([cl ^-]*)-->(.*) $text discard comm2 text]} { + # processed comment (end in text) + uplevel #0 $options(-commentcommand) [list $comm1$param>$comm2] + } else { + # start of comment + set state(mode) comment + set state(commentdata) "$comm1$param>$text" + continue + } + } + + {!\[CDATA\[*} { + + regexp {!\[CDATA\[(.*)} $tag discard cdata1 + if {[regexp {(.*)]]$} $param discard cdata2]} { + # processed CDATA (end in attribute) + uplevel #0 $options(-characterdatacommand) [list $cdata1$cdata2$text] + set text {} + } elseif {[regexp {(.*)]]>(.*)} $text discard cdata2 text]} { + # processed CDATA (end in text) + uplevel #0 $options(-characterdatacommand) [list $cdata1$param$empty>$cdata2$text] + set text {} + } else { + # start CDATA + set state(cdata) "$cdata1$param>$text" + set state(mode) cdata + continue + } + + } + + !ELEMENT { + # Internal DTD declaration + } + !ATTLIST { + } + !ENTITY { + } + !NOTATION { + } + + + !* { + uplevel #0 $options(-processinginstructioncommand) [list $tag $param] + } + default { + uplevel #0 $options(-errorcommand) [list "unknown processing instruction \"<$tag>\" around line $state(line)"] + } + } + } + *,1,* - + *,0,/,/ { + # Syntax error + uplevel #0 $options(-errorcommand) [list [list syntax error: closed/empty tag: tag $tag param $param empty $empty close $close around line $state(line)]] + } + } + + # Process character data + + if {$state(haveDocElement) && [llength $state(stack)]} { + + # Check if the internal DTD entity is in the text + regsub -all &xml:intdtd\; $text \[$options(-internaldtd)\] text + + # Look for entity references + if {([array size entities] || [string length $options(-entityreferencecommand)]) && \ + [regexp {&[^;]+;} $text]} { + + # protect Tcl specials + regsub -all {([][$\\])} $text {\\\1} text + # Mark entity references + regsub -all {&([^;]+);} $text [format {%s; %s {\1} ; %s %s} \}\} [namespace code [list Entity options $options(-entityreferencecommand) $options(-characterdatacommand) $options(-entityvariable)]] [list uplevel #0 $options(-characterdatacommand)] \{\{] text + set text "uplevel #0 $options(-characterdatacommand) {{$text}}" + eval $text + } else { + # Restore protected special characters + regsub -all {\\([{}\\])} $text {\1} text + uplevel #0 $options(-characterdatacommand) [list $text] + } + } elseif {[string length [string trim $text]]} { + uplevel #0 $options(-errorcommand) "unexpected text \"$text\" in document prolog around line $state(line)" + } + + } + + # If this is the end of the document, close all open containers + if {$options(-final) && [llength $state(stack)]} { + eval $options(-errorcommand) [list [list element [lindex $state(stack) end] remains unclosed around line $state(line)]] + } + + return {} +} + +# sgml::ParseEvent:ElementOpen -- +# +# Start of an element. +# +# Arguments: +# tag Element name +# attr Attribute list +# opts Option variable in caller +# args further configuration options +# +# Options: +# -empty boolean +# indicates whether the element was an empty element +# +# Results: +# Modify state and invoke callback + +proc sgml::ParseEvent:ElementOpen {tag attr opts args} { + upvar $opts options + upvar #0 $options(-statevariable) state + array set cfg {-empty 0} + array set cfg $args + + if {$options(-normalize)} { + set tag [string toupper $tag] + } + + # Update state + lappend state(stack) $tag + + # Parse attribute list into a key-value representation + if {[string compare $options(-parseattributelistcommand) {}]} { + if {[catch {uplevel #0 $options(-parseattributelistcommand) [list $attr]} attr]} { + uplevel #0 $options(-errorcommand) [list $attr around line $state(line)] + set attr {} + } + } + + set empty {} + if {$cfg(-empty) && $options(-reportempty)} { + set empty {-empty 1} + } + + # Invoke callback + uplevel #0 $options(-elementstartcommand) [list $tag $attr] $empty + + return {} +} + +# sgml::ParseEvent:ElementClose -- +# +# End of an element. +# +# Arguments: +# tag Element name +# opts Option variable in caller +# args further configuration options +# +# Options: +# -empty boolean +# indicates whether the element as an empty element +# +# Results: +# Modify state and invoke callback + +proc sgml::ParseEvent:ElementClose {tag opts args} { + upvar $opts options + upvar #0 $options(-statevariable) state + array set cfg {-empty 0} + array set cfg $args + + # WF check + if {[string compare $tag [lindex $state(stack) end]]} { + uplevel #0 $options(-errorcommand) [list "end tag \"$tag\" does not match open element \"[lindex $state(stack) end]\" around line $state(line)"] + return + } + + # Update state + set state(stack) [lreplace $state(stack) end end] + + set empty {} + if {$cfg(-empty) && $options(-reportempty)} { + set empty {-empty 1} + } + + # Invoke callback + uplevel #0 $options(-elementendcommand) [list $tag] $empty + + return {} +} + +# sgml::Normalize -- +# +# Perform name normalization if required +# +# Arguments: +# name name to normalize +# req normalization required +# +# Results: +# Name returned as upper-case if normalization required + +proc sgml::Normalize {name req} { + if {$req} { + return [string toupper $name] + } else { + return $name + } +} + +# sgml::Entity -- +# +# Resolve XML entity references (syntax: &xxx;). +# +# Arguments: +# opts options array variable in caller +# entityrefcmd application callback for entity references +# pcdatacmd application callback for character data +# entities name of array containing entity definitions. +# ref entity reference (the "xxx" bit) +# +# Results: +# Returns substitution text for given entity. + +proc sgml::Entity {opts entityrefcmd pcdatacmd entities ref} { + upvar 2 $opts options + upvar #0 $options(-statevariable) state + + if {![string length $entities]} { + set entities [namespace current EntityPredef] + } + + switch -glob -- $ref { + %* { + # Parameter entity - not recognised outside of a DTD + } + #x* { + # Character entity - hex + if {[catch {format %c [scan [string range $ref 2 end] %x tmp; set tmp]} char]} { + return -code error "malformed character entity \"$ref\"" + } + uplevel #0 $pcdatacmd [list $char] + + return {} + + } + #* { + # Character entity - decimal + if {[catch {format %c [scan [string range $ref 1 end] %d tmp; set tmp]} char]} { + return -code error "malformed character entity \"$ref\"" + } + uplevel #0 $pcdatacmd [list $char] + + return {} + + } + default { + # General entity + upvar #0 $entities map + if {[info exists map($ref)]} { + + if {![regexp {<|&} $map($ref)]} { + + # Simple text replacement - optimise + + uplevel #0 $pcdatacmd [list $map($ref)] + + return {} + + } + + # Otherwise an additional round of parsing is required. + # This only applies to XML, since HTML doesn't have general entities + + # Must parse the replacement text for start & end tags, etc + # This text must be self-contained: balanced closing tags, and so on + + set tokenised [tokenise $map($ref) $::xml::tokExpr $::xml::substExpr] + set final $options(-final) + unset options(-final) + eval parseEvent [list $tokenised] [array get options] -final 0 + set options(-final) $final + + return {} + + } elseif {[string length $entityrefcmd]} { + + uplevel #0 $entityrefcmd [list $ref] + + return {} + + } + } + } + + # If all else fails leave the entity reference untouched + uplevel #0 $pcdatacmd [list &$ref\;] + + return {} +} + +#################################### +# +# DTD parser for SGML (XML). +# +# This DTD actually only handles XML DTDs. Other language's +# DTD's, such as HTML, must be written in terms of a XML DTD. +# +# A DTD is represented as a three element Tcl list. +# The first element contains the content models for elements, +# the second contains the attribute lists for elements and +# the last element contains the entities for the document. +# +#################################### + +# sgml::parseDTD -- +# +# Entry point to the SGML DTD parser. +# +# Arguments: +# dtd data defining the DTD to be parsed +# args configuration options +# +# Results: +# Returns a three element list, first element is the content model +# for each element, second element are the attribute lists of the +# elements and the third element is the entity map. + +proc sgml::parseDTD {dtd args} { + variable Wsp + variable ParseDTDnum + + array set opts [list \ + -errorcommand [namespace current]::noop \ + state [namespace current]::parseDTD[incr ParseDTDnum] + ] + array set opts $args + + set exp ]+)[cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*([cl ^>]*)> + set sub {{\1} {\2} {\3} } + regsub -all $exp $dtd $sub dtd + + foreach {decl id value} $dtd { + catch {DTD:[string toupper $decl] $id $value} err + } + + return [list [array get contentmodel] [array get attributes] [array get entities]] +} + +# Procedures for handling the various declarative elements in a DTD. +# New elements may be added by creating a procedure of the form +# parse:DTD:_element_ + +# For each of these procedures, the various regular expressions they use +# are created outside of the proc to avoid overhead at runtime + +# sgml::DTD:ELEMENT -- +# +# defines an element. +# +# The content model for the element is stored in the contentmodel array, +# indexed by the element name. The content model is parsed into the +# following list form: +# +# {} Content model is EMPTY. +# Indicated by an empty list. +# * Content model is ANY. +# Indicated by an asterix. +# {ELEMENT ...} +# Content model is element-only. +# {MIXED {element1 element2 ...}} +# Content model is mixed (PCDATA and elements). +# The second element of the list contains the +# elements that may occur. #PCDATA is assumed +# (ie. the list is normalised). +# +# Arguments: +# id identifier for the element. +# value other information in the PI + +proc sgml::DTD:ELEMENT {id value} { + dbgputs DTD_parse [list DTD:ELEMENT $id $value] + variable Wsp + upvar opts state + upvar contentmodel cm + + if {[info exists cm($id)]} { + eval $state(-errorcommand) element [list "element \"$id\" already declared"] + } else { + switch -- $value { + EMPTY { + set cm($id) {} + } + ANY { + set cm($id) * + } + default { + if {[regexp [format {^\([%s]*#PCDATA[%s]*(\|([^)]+))?[%s]*\)*[%s]*$} $Wsp $Wsp $Wsp $Wsp] discard discard mtoks]} { + set cm($id) [list MIXED [split $mtoks |]] + } else { + if {[catch {CModelParse $state(state) $value} result]} { + eval $state(-errorcommand) element [list $result] + } else { + set cm($id) [list ELEMENT $result] + } + } + } + } + } +} + +# sgml::CModelParse -- +# +# Parse an element content model (non-mixed). +# A syntax tree is constructed. +# A transition table is built next. +# +# This is going to need alot of work! +# +# Arguments: +# state state array variable +# value the content model data +# +# Results: +# A Tcl list representing the content model. + +proc sgml::CModelParse {state value} { + upvar #0 $state var + + # First build syntax tree + set syntaxTree [CModelMakeSyntaxTree $state $value] + + # Build transition table + set transitionTable [CModelMakeTransitionTable $state $syntaxTree] + + return [list $syntaxTree $transitionTable] +} + +# sgml::CModelMakeSyntaxTree -- +# +# Construct a syntax tree for the regular expression. +# +# Syntax tree is represented as a Tcl list: +# rep {:choice|:seq {{rep list1} {rep list2} ...}} +# where: rep is repetition character, *, + or ?. {} for no repetition +# listN is nested expression or Name +# +# Arguments: +# spec Element specification +# +# Results: +# Syntax tree for element spec as nested Tcl list. +# +# Examples: +# (memo) +# {} {:seq {{} memo}} +# (front, body, back?) +# {} {:seq {{} front} {{} body} {? back}} +# (head, (p | list | note)*, div2*) +# {} {:seq {{} head} {* {:choice {{} p} {{} list} {{} note}}} {* div2}} +# (p | a | ul)+ +# + {:choice {{} p} {{} a} {{} ul}} + +proc sgml::CModelMakeSyntaxTree {state spec} { + upvar #0 $state var + variable Wsp + variable name + + # Translate the spec into a Tcl list. + + # None of the Tcl special characters are allowed in a content model spec. + if {[regexp {\$|\[|\]|\{|\}} $spec]} { + return -code error "illegal characters in specification" + } + + regsub -all [format {(%s)[%s]*(\?|\*|\+)?[%s]*(,|\|)?} $name $Wsp $Wsp] $spec [format {%sCModelSTname %s {\1} {\2} {\3}} \n $state] spec + regsub -all {\(} $spec "\nCModelSTopenParen $state " spec + regsub -all [format {\)[%s]*(\?|\*|\+)?[%s]*(,|\|)?} $Wsp $Wsp] $spec [format {%sCModelSTcloseParen %s {\1} {\2}} \n $state] spec + + array set var {stack {} state start} + eval $spec + + # Peel off the outer seq, its redundant + return [lindex [lindex $var(stack) 1] 0] +} + +# sgml::CModelSTname -- +# +# Processes a name in a content model spec. +# +# Arguments: +# state state array variable +# name name specified +# rep repetition operator +# cs choice or sequence delimiter +# +# Results: +# See CModelSTcp. + +proc sgml::CModelSTname {state name rep cs args} { + if {[llength $args]} { + return -code error "syntax error in specification: \"$args\"" + } + + CModelSTcp $state $name $rep $cs +} + +# sgml::CModelSTcp -- +# +# Process a content particle. +# +# Arguments: +# state state array variable +# name name specified +# rep repetition operator +# cs choice or sequence delimiter +# +# Results: +# The content particle is added to the current group. + +proc sgml::CModelSTcp {state cp rep cs} { + upvar #0 $state var + + switch -glob -- [lindex $var(state) end]=$cs { + start= { + set var(state) [lreplace $var(state) end end end] + # Add (dummy) grouping, either choice or sequence will do + CModelSTcsSet $state , + CModelSTcpAdd $state $cp $rep + } + :choice= - + :seq= { + set var(state) [lreplace $var(state) end end end] + CModelSTcpAdd $state $cp $rep + } + start=| - + start=, { + set var(state) [lreplace $var(state) end end [expr {$cs == "," ? ":seq" : ":choice"}]] + CModelSTcsSet $state $cs + CModelSTcpAdd $state $cp $rep + } + :choice=| - + :seq=, { + CModelSTcpAdd $state $cp $rep + } + :choice=, - + :seq=| { + return -code error "syntax error in specification: incorrect delimiter after \"$cp\", should be \"[expr {$cs == "," ? "|" : ","}]\"" + } + end=* { + return -code error "syntax error in specification: no delimiter before \"$cp\"" + } + default { + return -code error "syntax error" + } + } + +} + +# sgml::CModelSTcsSet -- +# +# Start a choice or sequence on the stack. +# +# Arguments: +# state state array +# cs choice oir sequence +# +# Results: +# state is modified: end element of state is appended. + +proc sgml::CModelSTcsSet {state cs} { + upvar #0 $state var + + set cs [expr {$cs == "," ? ":seq" : ":choice"}] + + if {[llength $var(stack)]} { + set var(stack) [lreplace $var(stack) end end $cs] + } else { + set var(stack) [list $cs {}] + } +} + +# sgml::CModelSTcpAdd -- +# +# Append a content particle to the top of the stack. +# +# Arguments: +# state state array +# cp content particle +# rep repetition +# +# Results: +# state is modified: end element of state is appended. + +proc sgml::CModelSTcpAdd {state cp rep} { + upvar #0 $state var + + if {[llength $var(stack)]} { + set top [lindex $var(stack) end] + lappend top [list $rep $cp] + set var(stack) [lreplace $var(stack) end end $top] + } else { + set var(stack) [list $rep $cp] + } +} + +# sgml::CModelSTopenParen -- +# +# Processes a '(' in a content model spec. +# +# Arguments: +# state state array +# +# Results: +# Pushes stack in state array. + +proc sgml::CModelSTopenParen {state args} { + upvar #0 $state var + + if {[llength $args]} { + return -code error "syntax error in specification: \"$args\"" + } + + lappend var(state) start + lappend var(stack) [list {} {}] +} + +# sgml::CModelSTcloseParen -- +# +# Processes a ')' in a content model spec. +# +# Arguments: +# state state array +# rep repetition +# cs choice or sequence delimiter +# +# Results: +# Stack is popped, and former top of stack is appended to previous element. + +proc sgml::CModelSTcloseParen {state rep cs args} { + upvar #0 $state var + + if {[llength $args]} { + return -code error "syntax error in specification: \"$args\"" + } + + set cp [lindex $var(stack) end] + set var(stack) [lreplace $var(stack) end end] + set var(state) [lreplace $var(state) end end] + CModelSTcp $state $cp $rep $cs +} + +# sgml::CModelMakeTransitionTable -- +# +# Given a content model's syntax tree, constructs +# the transition table for the regular expression. +# +# See "Compilers, Principles, Techniques, and Tools", +# Aho, Sethi and Ullman. Section 3.9, algorithm 3.5. +# +# Arguments: +# state state array variable +# st syntax tree +# +# Results: +# The transition table is returned, as a key/value Tcl list. + +proc sgml::CModelMakeTransitionTable {state st} { + upvar #0 $state var + + # Construct nullable, firstpos and lastpos functions + array set var {number 0} + foreach {nullable firstpos lastpos} [ \ + TraverseDepth1st $state $st { + # Evaluated for leaf nodes + # Compute nullable(n) + # Compute firstpos(n) + # Compute lastpos(n) + set nullable [nullable leaf $rep $name] + set firstpos [list {} $var(number)] + set lastpos [list {} $var(number)] + set var(pos:$var(number)) $name + } { + # Evaluated for nonterminal nodes + # Compute nullable, firstpos, lastpos + set firstpos [firstpos $cs $firstpos $nullable] + set lastpos [lastpos $cs $lastpos $nullable] + set nullable [nullable nonterm $rep $cs $nullable] + } \ + ] break + + set accepting [incr var(number)] + set var(pos:$accepting) # + + # var(pos:N) maps from position to symbol. + # Construct reverse map for convenience. + # NB. A symbol may appear in more than one position. + # var is about to be reset, so use different arrays. + + foreach {pos symbol} [array get var pos:*] { + set pos [lindex [split $pos :] 1] + set pos2symbol($pos) $symbol + lappend sym2pos($symbol) $pos + } + + # Construct the followpos functions + catch {unset var} + followpos $state $st $firstpos $lastpos + + # Construct transition table + # Dstates is [union $marked $unmarked] + set unmarked [list [lindex $firstpos 1]] + while {[llength $unmarked]} { + set T [lindex $unmarked 0] + lappend marked $T + set unmarked [lrange $unmarked 1 end] + + # Find which input symbols occur in T + set symbols {} + foreach pos $T { + if {$pos != $accepting && [lsearch $symbols $pos2symbol($pos)] < 0} { + lappend symbols $pos2symbol($pos) + } + } + foreach a $symbols { + set U {} + foreach pos $sym2pos($a) { + if {[lsearch $T $pos] >= 0} { + # add followpos($pos) + if {$var($pos) == {}} { + lappend U $accepting + } else { + eval lappend U $var($pos) + } + } + } + set U [makeSet $U] + if {[llength $U] && [lsearch $marked $U] < 0 && [lsearch $unmarked $U] < 0} { + lappend unmarked $U + } + set Dtran($T,$a) $U + } + + } + + return [list [array get Dtran] [array get sym2pos] $accepting] +} + +# sgml::followpos -- +# +# Compute the followpos function, using the already computed +# firstpos and lastpos. +# +# Arguments: +# state array variable to store followpos functions +# st syntax tree +# firstpos firstpos functions for the syntax tree +# lastpos lastpos functions +# +# Results: +# followpos functions for each leaf node, in name/value format + +proc sgml::followpos {state st firstpos lastpos} { + upvar #0 $state var + + switch -- [lindex [lindex $st 1] 0] { + :seq { + for {set i 1} {$i < [llength [lindex $st 1]]} {incr i} { + followpos $state [lindex [lindex $st 1] $i] \ + [lindex [lindex $firstpos 0] [expr $i - 1]] \ + [lindex [lindex $lastpos 0] [expr $i - 1]] + foreach pos [lindex [lindex [lindex $lastpos 0] [expr $i - 1]] 1] { + eval lappend var($pos) [lindex [lindex [lindex $firstpos 0] $i] 1] + set var($pos) [makeSet $var($pos)] + } + } + } + :choice { + for {set i 1} {$i < [llength [lindex $st 1]]} {incr i} { + followpos $state [lindex [lindex $st 1] $i] \ + [lindex [lindex $firstpos 0] [expr $i - 1]] \ + [lindex [lindex $lastpos 0] [expr $i - 1]] + } + } + default { + # No action at leaf nodes + } + } + + switch -- [lindex $st 0] { + ? { + # We having nothing to do here ! Doing the same as + # for * effectively converts this qualifier into the other. + } + * { + foreach pos [lindex $lastpos 1] { + eval lappend var($pos) [lindex $firstpos 1] + set var($pos) [makeSet $var($pos)] + } + } + } + +} + +# sgml::TraverseDepth1st -- +# +# Perform depth-first traversal of a tree. +# A new tree is constructed, with each node computed by f. +# +# Arguments: +# state state array variable +# t The tree to traverse, a Tcl list +# leaf Evaluated at a leaf node +# nonTerm Evaluated at a nonterminal node +# +# Results: +# A new tree is returned. + +proc sgml::TraverseDepth1st {state t leaf nonTerm} { + upvar #0 $state var + + set nullable {} + set firstpos {} + set lastpos {} + + switch -- [lindex [lindex $t 1] 0] { + :seq - + :choice { + set rep [lindex $t 0] + set cs [lindex [lindex $t 1] 0] + + foreach child [lrange [lindex $t 1] 1 end] { + foreach {childNullable childFirstpos childLastpos} \ + [TraverseDepth1st $state $child $leaf $nonTerm] break + lappend nullable $childNullable + lappend firstpos $childFirstpos + lappend lastpos $childLastpos + } + + eval $nonTerm + } + default { + incr var(number) + set rep [lindex [lindex $t 0] 0] + set name [lindex [lindex $t 1] 0] + eval $leaf + } + } + + return [list $nullable $firstpos $lastpos] +} + +# sgml::firstpos -- +# +# Computes the firstpos function for a nonterminal node. +# +# Arguments: +# cs node type, choice or sequence +# firstpos firstpos functions for the subtree +# nullable nullable functions for the subtree +# +# Results: +# firstpos function for this node is returned. + +proc sgml::firstpos {cs firstpos nullable} { + switch -- $cs { + :seq { + set result [lindex [lindex $firstpos 0] 1] + for {set i 0} {$i < [llength $nullable]} {incr i} { + if {[lindex [lindex $nullable $i] 1]} { + eval lappend result [lindex [lindex $firstpos [expr $i + 1]] 1] + } else { + break + } + } + } + :choice { + foreach child $firstpos { + eval lappend result $child + } + } + } + + return [list $firstpos [makeSet $result]] +} + +# sgml::lastpos -- +# +# Computes the lastpos function for a nonterminal node. +# Same as firstpos, only logic is reversed +# +# Arguments: +# cs node type, choice or sequence +# lastpos lastpos functions for the subtree +# nullable nullable functions forthe subtree +# +# Results: +# lastpos function for this node is returned. + +proc sgml::lastpos {cs lastpos nullable} { + switch -- $cs { + :seq { + set result [lindex [lindex $lastpos end] 1] + for {set i [expr [llength $nullable] - 1]} {$i >= 0} {incr i -1} { + if {[lindex [lindex $nullable $i] 1]} { + eval lappend result [lindex [lindex $lastpos $i] 1] + } else { + break + } + } + } + :choice { + foreach child $lastpos { + eval lappend result $child + } + } + } + + return [list $lastpos [makeSet $result]] +} + +# sgml::makeSet -- +# +# Turn a list into a set, ie. remove duplicates. +# +# Arguments: +# s a list +# +# Results: +# A set is returned, which is a list with duplicates removed. + +proc sgml::makeSet s { + foreach r $s { + if {[llength $r]} { + set unique($r) {} + } + } + return [array names unique] +} + +# sgml::nullable -- +# +# Compute the nullable function for a node. +# +# Arguments: +# nodeType leaf or nonterminal +# rep repetition applying to this node +# name leaf node: symbol for this node, nonterm node: choice or seq node +# subtree nonterm node: nullable functions for the subtree +# +# Results: +# Returns nullable function for this branch of the tree. + +proc sgml::nullable {nodeType rep name {subtree {}}} { + switch -glob -- $rep:$nodeType { + :leaf - + +:leaf { + return [list {} 0] + } + \\*:leaf - + \\?:leaf { + return [list {} 1] + } + \\*:nonterm - + \\?:nonterm { + return [list $subtree 1] + } + :nonterm - + +:nonterm { + switch -- $name { + :choice { + set result 0 + foreach child $subtree { + set result [expr $result || [lindex $child 1]] + } + } + :seq { + set result 1 + foreach child $subtree { + set result [expr $result && [lindex $child 1]] + } + } + } + return [list $subtree $result] + } + } +} + +# These regular expressions are defined here once for better performance + +namespace eval sgml { + variable Wsp + + # Watch out for case-sensitivity + + set attlist_exp [cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*(#REQUIRED|#IMPLIED) + set attlist_enum_exp [cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*\\(([cl ^)]*)\\)[cl $Wsp]*("([cl ^")])")? ;# " + set attlist_fixed_exp [cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*(#FIXED)[cl $Wsp]*([cl ^$Wsp]+) + + set param_entity_exp [cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*([cl ^"$Wsp]*)[cl $Wsp]*"([cl ^"]*)" + + set notation_exp [cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*(.*) + +} + +# sgml::DTD:ATTLIST -- +# +# defines an attribute list. +# +# Arguments: +# id Element an attribute list is being defined for. +# value data from the PI. +# +# Results: +# Attribute list variables are modified. + +proc sgml::DTD:ATTLIST {id value} { + variable attlist_exp + variable attlist_enum_exp + variable attlist_fixed_exp + dbgputs DTD_parse [list DTD:ATTLIST $id $value] + upvar opts state + upvar attributes am + + if {[info exists am($id)]} { + eval $state(-errorcommand) attlist [list "attribute list for element \"$id\" already declared"] + } else { + # Parse the attribute list. If it were regular, could just use foreach, + # but some attributes may have values. + regsub -all {([][$\\])} $value {\\\1} value + regsub -all $attlist_exp $value {[DTDAttribute {\1} {\2} {\3}]} value + regsub -all $attlist_enum_exp $value {[DTDAttribute {\1} {\2} {\3}]} value + regsub -all $attlist_fixed_exp $value {[DTDAttribute {\1} {\2} {\3} {\4}]} value + subst $value + set am($id) [array get attlist] + } +} + +# sgml::DTDAttribute -- +# +# Parse definition of a single attribute. +# +# Arguments: +# name attribute name +# type type of this attribute +# default default value of the attribute +# value other information + +proc sgml::DTDAttribute {name type default {value {}}} { + upvar attlist al + # This needs further work + set al($name) [list $default $value] +} + +# sgml::DTD:ENTITY -- +# +# PI +# +# Arguments: +# id identifier for the entity +# value data +# +# Results: +# Modifies the caller's entities array variable + +proc sgml::DTD:ENTITY {id value} { + variable param_entity_exp + dbgputs DTD_parse [list DTD:ENTITY $id $value] + upvar opts state + upvar entities ents + + if {[string compare % $id]} { + # Entity declaration + if {[info exists ents($id)]} { + eval $state(-errorcommand) entity [list "entity \"$id\" already declared"] + } else { + if {![regexp {"([^"]*)"} $value x entvalue] && ![regexp {'([^']*)'} $value x entvalue]} { + eval $state(-errorcommand) entityvalue [list "entity value \"$value\" not correctly specified"] + } ;# " + set ents($id) $entvalue + } + } else { + # Parameter entity declaration + switch -glob [regexp $param_entity_exp $value x name scheme data],[string compare {} $scheme] { + 0,* { + eval $state(-errorcommand) entityvalue [list "parameter entity \"$value\" not correctly specified"] + } + *,0 { + # SYSTEM or PUBLIC declaration + } + default { + set ents($id) $data + } + } + } +} + +# sgml::DTD:NOTATION -- + +proc sgml::DTD:NOTATION {id value} { + variable notation_exp + upvar opts state + + if {[regexp $notation_exp $value x scheme data] == 2} { + } else { + eval $state(-errorcommand) notationvalue [list "notation value \"$value\" incorrectly specified"] + } +} + +### Utility procedures + +# sgml::noop -- +# +# A do-nothing proc +# +# Arguments: +# args arguments +# +# Results: +# Nothing. + +proc sgml::noop args { + return 0 +} + +# sgml::identity -- +# +# Identity function. +# +# Arguments: +# a arbitrary argument +# +# Results: +# $a + +proc sgml::identity a { + return $a +} + +# sgml::Error -- +# +# Throw an error +# +# Arguments: +# args arguments +# +# Results: +# Error return condition. + +proc sgml::Error args { + uplevel return -code error [list $args] +} + +### Following procedures are based on html_library + +# sgml::zapWhite -- +# +# Convert multiple white space into a single space. +# +# Arguments: +# data plain text +# +# Results: +# As above + +proc sgml::zapWhite data { + regsub -all "\[ \t\r\n\]+" $data { } data + return $data +} + +proc sgml::Boolean value { + regsub {1|true|yes|on} $value 1 value + regsub {0|false|no|off} $value 0 value + return $value +} + +proc sgml::dbgputs {where text} { + variable dbg + + catch {if {$dbg} {puts stdout "DBG: $where ($text)"}} +} Index: xotcl/library/xml/xml.tcl =================================================================== diff -u --- xotcl/library/xml/xml.tcl (revision 0) +++ xotcl/library/xml/xml.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,504 @@ +# xml.tcl -- +# +# This file provides XML services. +# These services include a XML document instance and DTD parser, +# as well as support for generating XML. +# +# Copyright (c) 1998,1999 Zveno Pty Ltd +# http://www.zveno.com/ +# +# Zveno makes this software and all associated data and documentation +# ('Software') available free of charge for non-commercial purposes only. You +# may make copies of the Software but you must include all of this notice on +# any copy. +# +# The Software was developed for research purposes and Zveno does not warrant +# that it is error free or fit for any purpose. Zveno disclaims any +# liability for all claims, expenses, losses, damages and costs any user may +# incur as a result of using, copying or modifying the Software. +# +# Copyright (c) 1997 Australian National University (ANU). +# +# ANU makes this software and all associated data and documentation +# ('Software') available free of charge for non-commercial purposes only. You +# may make copies of the Software but you must include all of this notice on +# any copy. +# +# The Software was developed for research purposes and ANU does not warrant +# that it is error free or fit for any purpose. ANU disclaims any +# liability for all claims, expenses, losses, damages and costs any user may +# incur as a result of using, copying or modifying the Software. +# +# $Id: xml.tcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +package provide xml 1.8 + +package require sgml 1.6 + +namespace eval xml { + + # Procedures for parsing XML documents + namespace export parser + # Procedures for parsing XML DTDs + namespace export DTDparser + + # Counter for creating unique parser objects + variable ParserCounter 0 + + # Convenience routine + proc cl x { + return "\[$x\]" + } + + # Define various regular expressions + # white space + variable Wsp " \t\r\n" + variable noWsp [cl ^$Wsp] + + # Various XML names and tokens + + # BUG: NameChar does not include CombiningChar or Extender + variable NameChar [cl -a-zA-Z0-9._:] + variable Name [cl a-zA-Z_:]$NameChar* + variable Nmtoken $NameChar+ + + # Tokenising expressions + + variable tokExpr <(/?)([cl ^$Wsp>]+)([cl $Wsp]*[cl ^>]*)> + variable substExpr "\}\n{\\2} {\\1} {} {\\3} \{" + + # table of predefined entities + + variable EntityPredef + array set EntityPredef { + lt < gt > amp & quot \" apos ' + } + +} + + +# xml::parser -- +# +# Creates XML parser object. +# +# Arguments: +# args Unique name for parser object +# plus option/value pairs +# +# Recognised Options: +# -final Indicates end of document data +# -elementstartcommand Called when an element starts +# -elementendcommand Called when an element ends +# -characterdatacommand Called when character data occurs +# -processinginstructioncommand Called when a PI occurs +# -externalentityrefcommand Called for an external entity reference +# +# (Not compatible with expat) +# -xmldeclcommand Called when the XML declaration occurs +# -doctypecommand Called when the document type declaration occurs +# +# -errorcommand Script to evaluate for a fatal error +# -warningcommand Script to evaluate for a reportable warning +# -statevariable global state variable +# -reportempty whether to provide empty element indication +# +# Results: +# The state variable is initialised. + +proc xml::parser {args} { + variable ParserCounter + + if {[llength $args] > 0} { + set name [lindex $args 0] + set args [lreplace $args 0 0] + } else { + set name parser[incr ParserCounter] + } + + if {[info command [namespace current]::$name] != {}} { + return -code error "unable to create parser object \"[namespace current]::$name\" command" + } + + # Initialise state variable and object command + upvar \#0 [namespace current]::$name parser + set sgml_ns [namespace parent]::sgml + array set parser [list name $name \ + -final 1 \ + -elementstartcommand ${sgml_ns}::noop \ + -elementendcommand ${sgml_ns}::noop \ + -characterdatacommand ${sgml_ns}::noop \ + -processinginstructioncommand ${sgml_ns}::noop \ + -externalentityrefcommand ${sgml_ns}::noop \ + -xmldeclcommand ${sgml_ns}::noop \ + -doctypecommand ${sgml_ns}::noop \ + -warningcommand ${sgml_ns}::noop \ + -statevariable [namespace current]::$name \ + -reportempty 0 \ + internaldtd {} \ + ] + + proc [namespace current]::$name {method args} \ + "eval ParseCommand $name \$method \$args" + + eval ParseCommand [list $name] configure $args + + return [namespace current]::$name +} + +# xml::ParseCommand -- +# +# Handles parse object command invocations +# +# Valid Methods: +# cget +# configure +# parse +# reset +# +# Arguments: +# parser parser object +# method minor command +# args other arguments +# +# Results: +# Depends on method + +proc xml::ParseCommand {parser method args} { + upvar \#0 [namespace current]::$parser state + + switch -- $method { + cget { + return $state([lindex $args 0]) + } + configure { + foreach {opt value} $args { + set state($opt) $value + } + } + parse { + ParseCommand_parse $parser [lindex $args 0] + } + reset { + if {[llength $args]} { + return -code error "too many arguments" + } + ParseCommand_reset $parser + } + default { + return -code error "unknown method \"$method\"" + } + } + + return {} +} + +# xml::ParseCommand_parse -- +# +# Parses document instance data +# +# Arguments: +# object parser object +# xml data +# +# Results: +# Callbacks are invoked, if any are defined + +proc xml::ParseCommand_parse {object xml} { + upvar \#0 [namespace current]::$object parser + variable Wsp + variable tokExpr + variable substExpr + + set parent [namespace parent] + if {![string compare :: $parent]} { + set parent {} + } + + set tokenised [lrange \ + [${parent}::sgml::tokenise $xml \ + $tokExpr \ + $substExpr \ + -internaldtdvariable [namespace current]::${object}(internaldtd)] \ + 5 end] + + eval ${parent}::sgml::parseEvent \ + [list $tokenised \ + -emptyelement [namespace code ParseEmpty] \ + -parseattributelistcommand [namespace code ParseAttrs]] \ + [array get parser -*command] \ + [array get parser -entityvariable] \ + [array get parser -reportempty] \ + -normalize 0 \ + -internaldtd [list $parser(internaldtd)] + + return {} +} + +# xml::ParseEmpty -- +# +# Used by parser to determine whether an element is empty. +# This should be dead easy in XML. The only complication is +# that the RE above can't catch the trailing slash, so we have +# to dig it out of the tag name or attribute list. +# +# Tcl 8.1 REs should fix this. +# +# Arguments: +# tag element name +# attr attribute list (raw) +# e End tag delimiter. +# +# Results: +# "/" if the trailing slash is found. Optionally, return a list +# containing new values for the tag name and/or attribute list. + +proc xml::ParseEmpty {tag attr e} { + + if {[string match */ [string trimright $tag]] && \ + ![string length $attr]} { + regsub {/$} $tag {} tag + return [list / $tag $attr] + } elseif {[string match */ [string trimright $attr]]} { + regsub {/$} [string trimright $attr] {} attr + return [list / $tag $attr] + } else { + return {} + } + +} + +# xml::ParseAttrs -- +# +# Parse element attributes. +# +# There are two forms for name-value pairs: +# +# name="value" +# name='value' +# +# Watch out for the trailing slash on empty elements. +# +# Arguments: +# attrs attribute string given in a tag +# +# Results: +# Returns a Tcl list representing the name-value pairs in the +# attribute string + +proc xml::ParseAttrs attrs { + variable Wsp + variable Name + + # First check whether there's any work to do + if {![string compare {} [string trim $attrs]]} { + return {} + } + + # Strip the trailing slash on empty elements + regsub [format {/[%s]*$} " \t\n\r"] $attrs {} atList + + set mode name + set result {} + foreach component [split $atList =] { + switch $mode { + name { + set component [string trim $component] + if {[regexp $Name $component]} { + lappend result $component + } else { + return -code error "invalid attribute name \"$component\"" + } + set mode value:start + } + value:start { + set component [string trimleft $component] + set delimiter [string index $component 0] + set value {} + switch -- $delimiter { + \" - + ' { + if {[regexp [format {%s([^%s]*)%s(.*)} $delimiter $delimiter $delimiter] $component discard value remainder]} { + lappend result $value + set remainder [string trim $remainder] + if {[string length $remainder]} { + if {[regexp $Name $remainder]} { + lappend result $remainder + set mode value:start + } else { + return -code error "invalid attribute name \"$remainder\"" + } + } else { + set mode end + } + } else { + set value [string range $component 1 end] + set mode value:continue + } + } + default { + return -code error "invalid value for attribute \"[lindex $result end]\"" + } + } + } + value:continue { + if {[regexp [format {([^%s]*)%s(.*)} $delimiter $delimiter] $component discard valuepart remainder]} { + append value = $valuepart + lappend result $value + set remainder [string trim $remainder] + if {[string length $remainder]} { + if {[regexp $Name $remainder]} { + lappend result $remainder + set mode value:start + } else { + return -code error "invalid attribute name \"$remainder\"" + } + } else { + set mode end + } + } else { + append value = $component + } + } + end { + return -code error "unexpected data found after end of attribute list" + } + } + } + + switch $mode { + name - + end { + # This is normal + } + default { + return -code error "unexpected end of attribute list" + } + } + + return $result +} + +proc xml::OLDParseAttrs {attrs} { + variable Wsp + variable Name + + # First check whether there's any work to do + if {![string compare {} [string trim $attrs]]} { + return {} + } + + # Strip the trailing slash on empty elements + regsub [format {/[%s]*$} " \t\n\r"] $attrs {} atList + + # Protect Tcl special characters + #regsub -all {([[\$\\])} $atList {\\\1} atList + regsub -all & $atList {\&} atList + regsub -all {\[} $atList {\&ob;} atList + regsub -all {\]} $atList {\&cb;} atlist + # NB. sgml package delivers braces and backslashes quoted + regsub -all {\\\{} $atList {\&oc;} atList + regsub -all {\\\}} $atList {\&cc;} atlist + regsub -all {\$} $atList {\$} atList + regsub -all {\\\\} $atList {\&bs;} atList + + regsub -all [format {(%s)[%s]*=[%s]*"([^"]*)"} $Name $Wsp $Wsp] \ + $atList {[set parsed(\1) {\2}; set dummy {}] } atList ;# " + regsub -all [format {(%s)[%s]*=[%s]*'([^']*)'} $Name $Wsp $Wsp] \ + $atList {[set parsed(\1) {\2}; set dummy {}] } atList + + set leftovers [subst $atList] + + if {[string length [string trim $leftovers]]} { + return -code error "syntax error in attribute list \"$attrs\"" + } + + return [ParseAttrs:Deprotect [array get parsed]] +} + +# xml::ParseAttrs:Deprotect -- +# +# Reverse map Tcl special characters previously protected +# +# Arguments: +# attrs attribute list +# +# Results: +# Characters substituted + +proc xml::ParseAttrs:Deprotect attrs { + + regsub -all &\; $attrs \\& attrs + regsub -all &ob\; $attrs \[ attrs + regsub -all &cb\; $attrs \] attrs + regsub -all &oc\; $attrs \{ attrs + regsub -all &cc\; $attrs \} attrs + regsub -all &dollar\; $attrs \$ attrs + regsub -all &bs\; $attrs \\\\ attrs + + return $attrs + +} + +# xml::ParseCommand_reset -- +# +# Initialize parser data +# +# Arguments: +# object parser object +# +# Results: +# Parser data structure initialised + +proc xml::ParseCommand_reset object { + upvar \#0 [namespace current]::$object parser + + array set parser [list \ + -final 1 \ + internaldtd {} \ + ] +} + +# xml::noop -- +# +# A do-nothing proc + +proc xml::noop args {} + +### Following procedures are based on html_library + +# xml::zapWhite -- +# +# Convert multiple white space into a single space. +# +# Arguments: +# data plain text +# +# Results: +# As above + +proc xml::zapWhite data { + regsub -all "\[ \t\r\n\]+" $data { } data + return $data +} + +# +# DTD parser for XML is wholly contained within the sgml.tcl package +# + +# xml::parseDTD -- +# +# Entry point to the XML DTD parser. +# +# Arguments: +# dtd XML data defining the DTD to be parsed +# args configuration options +# +# Results: +# Returns a three element list, first element is the content model +# for each element, second element are the attribute lists of the +# elements and the third element is the entity map. + +proc xml::parseDTD {dtd args} { + return [eval [expr {[namespace parent] == {::} ? {} : [namespace parent]}]::sgml::parseDTD [list $dtd] $args] +} + Index: xotcl/library/xml/xml.xotcl =================================================================== diff -u --- xotcl/library/xml/xml.xotcl (revision 0) +++ xotcl/library/xml/xml.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,141 @@ +#!/usr/local/bin/xotclsh +# $Id: xml.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# +# smaller implementation of an XML parser wrapper, similar to xoXML +# example from the XOTcl paper +# +# not used in ActiWeb +# +package require xml + +# +# Xml Parser Connection Class (wrapper facade to TclXML and expat interface like parsers) +# +Class XMLParser +XMLParser instproc init args { + my set PC [xml::parser [my autoname [namespace tail [self]]]] + my config \ + -characterdatacommand "[self] pcdata" \ + -elementstartcommand "[self] start" \ + -elementendcommand "[self] end" + my set currentElement [Node create [self]::T] + next +} + +# Create Forwarding methods to the parser == +# abstact interface for xml parser acces +XMLParser instproc cget option {[my set PC] cget $option} +XMLParser instproc config args {eval "[my set PC] configure $args"} +XMLParser instproc parse data {[my set PC] parse $data} +XMLParser instproc reset {} {[my set PC] reset; [self]::T reset} +XMLParser instproc pcdata text { + my instvar currentElement + $currentElement insertText $text +} +XMLParser instproc start {name attrList} { + my instvar currentElement + set currentElement [$currentElement insertElement $name $attrList] +} +XMLParser instproc end {name} { + my instvar currentElement + set currentElement [$currentElement info parent] +} +XMLParser instproc print {} { + ::x::T print + puts "" +} + +############################################################################### +# Simple Node tree +# General Nodes +Class Node +Node instproc reset {} { + foreach c [my info children] {$c destroy} + my set children "" +} +Node instproc print {} { + if {[my exists children]} { + foreach c [my set children] { $c print} + } +} +Node instproc insert {xoclass elementclass args} { + set new [eval $xoclass new -childof [self] $args] + my lappend children $new + return $new +} +Node instproc insertElement {tag args} { + return [eval my insert Element $tag -attributes $args -tag $tag] +} +Node instproc insertText {text} { + return [my insert Text text -content $text] +} + +# Element Nodes +Class Element -superclass Node -parameter { + {attributes ""} + tag +} +Element instproc print {} { + my instvar tag attributes + if {[llength $attributes]>0} { + foreach {n v} $attributes {append string " " $n = '$v'} + } else { + set string "" + } + puts -nonewline <$tag$string> + next + puts -nonewline +} + +# Text Nodes +Class Text -superclass Node -parameter { + {content ""} +} +Text instproc print {} { + puts -nonewline [my set content] +} + +################################################################################# +### Examples +################################################################################# +XMLParser x +x parse { + + + + Mary Andrew + Jacky Crystal + + + + + + + + + + + + + The Coolest Web Page + Il Pagio di Web Fuba + + + + } + +::x print +puts ============================================================ +x reset +x parse { + + a + b + c + def + g + +} +x print Index: xotcl/library/xml/xmlExample.xotcl =================================================================== diff -u --- xotcl/library/xml/xmlExample.xotcl (revision 0) +++ xotcl/library/xml/xmlExample.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,114 @@ +#!../../src/xotclsh +#!/usr/local/bin/xotclsh +# +# small Example for usage of xoXML +package require xotcl::package +package require xotcl::trace +package require xotcl::xml::parser +package require xotcl::xml::recreatorVisitor +package require xotcl::xml::printVisitor + +# +# instantiate parser and parser an example text into a node tree +# +XMLParser x +#x parse { +# + +x parse { + + a + b + c + + + b + c + + + a + b + c + b + d + + + + + + Mary Andrew + Jacky Crystal + + + + + + + + + + + + + The Coolest Web Page + Il Pagio di Web Fuba + + + + + some text + + + + } + +proc run {} { + # + # print the node treee to the std output + # + puts ************************************************************************ + puts "Node Tree:" + puts ************************************************************************ + PrintVisitor pv + pv interpretAll x + + # + # recreate xml text and print it to the std output + # + puts \n + puts ************************************************************************ + puts "Recreated XML Text:" + puts ************************************************************************ + XMLRecreatorVisitor rv + puts [rv interpretAll x] + +} +run + +XMLParser y +y parse { + + + + + + + + + + + + + olla + + + + + hallo + + +} +XMLRecreatorVisitor rv +puts [rv interpretAll y] Index: xotcl/library/xml/xmlRecreatorVisitor.xotcl =================================================================== diff -u --- xotcl/library/xml/xmlRecreatorVisitor.xotcl (revision 0) +++ xotcl/library/xml/xmlRecreatorVisitor.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,150 @@ +# $Id: xmlRecreatorVisitor.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::xml::recreatorVisitor 0.9 +package require xotcl::xml::parser + +############################################################################## +# +# a visitor that recreates an XML representation from a +# node tree +# +############################################################################# +Class XMLRecreatorVisitor -superclass NodeTreeVisitor -parameter useCDATA + +# +# determine nesting depth of an object if the aggregation tree +# +XMLRecreatorVisitor instproc nestingDepth {obj} { + for {set d 0;set s [$obj info parent]} {$s != "::"} {set s [$s info parent]} { + incr d + } + return $d +} + +# +# insert appropriate number of spaces for indentation -> return space string +# +XMLRecreatorVisitor instproc indent chars { + set spaces " " + for {set l 9} {$l<$chars} {incr l $l} {append spaces $spaces} + return [string range $spaces 1 $chars] +} +XMLRecreatorVisitor instproc insertIndent {obj} { + my instvar nestingStart + return [my indent [expr {([my nestingDepth $obj] - $nestingStart)*2} - 2]] +} + +XMLRecreatorVisitor instproc attrIndent {objName fa} { + upvar [self callinglevel] $fa firstAttr + if {$firstAttr} { + set firstAttr 0 + return " " + } else { + return "\n[my insertIndent $objName] " + } +} + +XMLRecreatorVisitor instproc getContent objName { + return [$objName content] +} +XMLRecreatorVisitor instproc hasOnlyAttrs {obj} { + if {[$obj exists pcdata]} {return 0} + foreach c [$obj info children] { + if {[$c istype XMLNode]} {return 0} + } + return 1 +} + +# +# hook to append line feed dependent on the object +# default is to append one \n +# +XMLRecreatorVisitor instproc appendLineFeed obj { + return "\n" +} + +# +# evaluate node objName +# +XMLRecreatorVisitor instproc visit objName { + my instvar result + set c [my getContent $objName] + if {$c != ""} { + $objName instvar attributes pcdata + set ns [$objName resolveNS] + set firstAttr 1 + set attrStr "" + if {[string first $objName $ns] != -1} { + # append xmlns attributes, xmlns=... first + if {[$ns exists nsArray(xmlns)]} { + append attrStr [my attrIndent $objName firstAttr] + append attrStr "xmlns = \"[$ns set nsArray(xmlns)]\"" + } + foreach a [$ns array names nsArray] { + if {$a != "xmlns"} { + append attrStr [my attrIndent $objName firstAttr] + append attrStr "xmlns:${a} = \"[$ns set nsArray($a)]\"" + } + } + } + foreach a [array names attributes] { + append attrStr [my attrIndent $objName firstAttr] + append attrStr "$a = \"$attributes($a)\"" + } + append result "[my insertIndent $objName]<${c}$attrStr" + + if {[my hasOnlyAttrs $objName]} { + append result "/>" + } else { + append result ">" + } + + if {[info exists pcdata] && [llength $pcdata]>1 && + [lindex $pcdata 0] == ""} { + append result " " [my pcdataString [lindex $pcdata 1]] + } + append result [my appendLineFeed $objName] + } + return $result +} +XMLRecreatorVisitor instproc pcdataString text { + if {[my exists useCDATA] && [regexp < $text]} { + return "" + } + return $text +} + +# +# evaluate end of a node +# +XMLRecreatorVisitor instproc visitEnd objName { + my instvar result + set c [$objName content] + if {$c != ""} { + if {![my hasOnlyAttrs $objName]} { + append result [my insertIndent $objName] \n + } + } + # a child is responsible for the "mixed content" data elements + # that have a location after the child + set p [$objName info parent] + if {[$p istype XMLElement] && [$p mixedContent]} { + foreach {location data} [$p set pcdata] { + if {$location == $objName} { + append result [my insertIndent $objName] \ + [my pcdataString $data] \n + } + } + } +} + + +# +# public method to be called on top node -> returns XML text as result +# +XMLRecreatorVisitor instproc interpretNodeTree node { + my instvar result + set result "" + my set nestingStart [my nestingDepth $node] + $node accept [self] + return $result +} Index: xotcl/library/xml/xoXML.xotcl =================================================================== diff -u --- xotcl/library/xml/xoXML.xotcl (revision 0) +++ xotcl/library/xml/xoXML.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,631 @@ +# $Id: xoXML.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package provide xotcl::xml::parser 0.94 + +package require xotcl::pattern::chainOfResponsibility +package require xotcl::pattern::sortedCompositeWithAfter +#package require xotcl::pattern::link +package require xotcl::trace +#package require xml +#package require expat + +############################################################################## +# +# XML Namespace Handling +# +############################################################################## +@ ChainOfResponsibility XMLNamespace { + description { + A Chain of Responsiblity Class that handles the XML + XMLNamespace facility for an object tree + + especially for internal usage of the xoXML component +} +} +ChainOfResponsibility XMLNamespace + + +XMLNamespace instproc init args { + # Per default: New NS is end of a namespace chain + # indicated by "" + my successor "" + my array set nsArray {} + next +} + +# +# add two operations searchPrefix and searchFullName as chained -> calls are +# automatically forwarded in the chain, if the failure value (here: "") +# is returned by the chained object +# +XMLNamespace addChainedOperation searchPrefix "" +XMLNamespace addChainedOperation searchFullName "" +XMLNamespace addChainedOperation searchNamespaceByPrefix "" +# +# namespaces are added by value pairs of prefix and full namespace +# name (ns) +# +XMLNamespace instproc add {prefix ns} { + #puts stderr "adding ns: $prefix $ns" + my set nsArray($prefix) $ns +} + +# +# search the chain for a prefix -> return full name, if found +# +XMLNamespace instproc searchPrefix {prefix} { + #puts stderr "[self proc]: Searching for $prefix in [self]" + #puts stderr "[self proc]: There are: [my array names nsArray]" + if {[my exists nsArray($prefix)]} { + return [my set nsArray($prefix)] + } else { + return "" + } +} + +# +# search the chain for a prefix -> return the responisble namespace name +# +XMLNamespace instproc searchNamespaceByPrefix {prefix} { + if {[my exists nsArray($prefix)]} { + return [self] + } else { + return "" + } +} + +# +# search the chain for the full name -> return prefix, if found +# +XMLNamespace instproc searchFullName {fname} { + foreach n [my array names nsArray] { + if {[string match [my set nsArray($n)] $fname]} { + return $n + } + } + return "" +} + +# +# construct the full name from either a expression "prefix:name" +# or just "name" (then construct with "xmlns" as default namespace prefix) +# +XMLNamespace instproc getFullName {fname} { + #puts stderr "Getting FullName for $fname in [self]" + if {[regexp "^(.*):(.*)$" $fname _ prefix name]} { + if {[set pre [my searchPrefix $prefix]] != ""} { + return [set pre]$name + } + } else { + # no colon -> use xmlns + return [my searchPrefix "xmlns"]$fname + } + return $fname +} + +############################################################################## +# +# Abstract Node Class +# +############################################################################## + +SortedComposite AbstractXMLNode + +@ SortedComposite AbstractXMLNode { description { + Abstract interface for all node classes. Nodes have an event based + parsing interface to build up a node tree, from an event based parsing + stream +} +} + +# +# called if node start event occurs -> +# start parsing node "name" and intpretation hook for the attribute list +# +AbstractXMLNode abstract instproc parseStart {name attrList} + +# +# called if "character data" is reached +# +AbstractXMLNode abstract instproc parseData {text} + +# +# called if node end is reached +# +AbstractXMLNode abstract instproc parseEnd {name} + +# +# convinience method for printing nodes to output stream (e.g. for debugging) +# +AbstractXMLNode abstract instproc print {} + +# +# Visitor acceptance methods -> call visit and visitEnd of the given +# "visitor" with my as argument +# +AbstractXMLNode abstract instproc accept {visitor} +AbstractXMLNode abstract instproc acceptEnd {visitor} + +# make 'accept' and 'acceptEnd' composite operations +AbstractXMLNode addOperations {accept accept} +AbstractXMLNode addAfterOperations {accept acceptEnd} + +############################################################################## +# +# XMLNode Node Class +# +############################################################################## + +# +# the pcdata variable stores the data elements in form of a tuple list +# . +# +Class XMLNode -superclass AbstractXMLNode -parameter { + {content ""} + {namespace} + {parser ""} + pcdata +} +@ Class XMLNode { + description { + general superclass for XML nodes + } +} + +XMLNode instproc init args { + my array set attributes {} + next +} + +XMLNode instproc nextChild {name} { + set child [my autoname $name] + my set lastChild $child + my appendChildren $child + return $child +} + +# +# placeholder methods for the event interface +# +XMLNode instproc parseStart {name attrList} { + #puts "parsed start: [my info class]: $name $attrList" +} + +# +# chracter data is stored in a pcdata variable. +# +XMLNode instproc mixedContent {} { + expr {[my exists children] && [my exists pcdata]} +} +XMLNode instproc parseData {text} { + #my showCall + my instvar pcdata + + set childBeforePCData "" + # if pcdata exists seek the last XMLElement child + #if {[my exists children]} { + # foreach c [my set children] { + # if {[[self]::$c istype XMLElement]} { + # set childBeforePCData [self]::$c + # } + # } + # } + if {[my exists lastChild]} { + set childBeforePCData [self]::[my set lastChild] + } + #my showMsg childBeforePCData=$childBeforePCData + #my showMsg old-pcdata=$pcdata + if {[my exists pcdata]} { + foreach {e d} $pcdata { } + #puts stderr "//$e//$d// [expr {$e == $childBeforePCData}]" + if {$e == $childBeforePCData} { + set pcdata [lreplace $pcdata [expr {[llength $pcdata]-2}] end] + set text $d$text + } + lappend pcdata $childBeforePCData $text + #puts stderr *append****new-pcdata=$pcdata + } else { + set pcdata [list $childBeforePCData $text] + #puts stderr *set*******new-pcdata=$pcdata + } +} + +# +# this method just returns the data elt in the first pcdata +# +XMLNode instproc getFirstPCData {} { + if {[my exists pcdata]} { + return [lindex [my set pcdata] 1] + } + return "" +} + +# +# returns a list of all pcdata elememts, without location information +# stored in the pcdata instance variable +# +XMLNode instproc getPCdataList {} { + set result "" + foreach {l data} [my set pcdata] { + lappend result $data + } + return $result +} + +# +#my set pcdata $text +#} + +XMLNode instproc parseEnd {name} { + #puts "parsed end: [my info class]: $name" +} + +XMLNode instproc print {} { + set c "[my info class]-[self] --- [my content]" + foreach a [my array names attributes] { + append c "\nATTR: $a = [my set attributes($a)]" + } + if {[my exists pcdata]} { + foreach d [my getPCdataList] { + append c "\nPCDATA:\n$d" + } + } + return $c +} + +# +# composite accept operation for visiting the node tree +# through visitors +# +# -> interpretation of the interpreter pattern +# +XMLNode instproc accept {visitor} { + $visitor visit [self] +} + +# +# composite operation called at termination of computation of +# a level == end node +# +XMLNode instproc acceptEnd {visitor} { + $visitor visitEnd [self] +} + +# +# error message, if child can't be parsed +# +XMLNode instproc errorChild {c} { + error "[self] unexpected content $c" +} + +# +# find the namespace object that is currently responsible +# for the [self] node +# +XMLNode instproc resolveNS {} { + set parser [my set parser] + if {[my exists namespace]} { + return [my set namespace] + } else { + set p [my info parent] + if {$p != "" && $p != $parser} { + return [$p resolveNS] + } else { + #puts stderr "No parent namespace !! Using Parser's topNs ..." + return "" + } + } +} + +# +# add a new namespace entry to the object's NS entry, if it exists +# otherwise: act as a factory method for NS objects and create an +# NS object for the [self] node +# +XMLNode instproc makeIndividualNSEntry {prefix entry} { + set ns [my resolveNS] + if {[string first [self] $ns] == -1} { + #puts stderr "new namespace for [self]" + set newNS [XMLNamespace create [self]::[my autoname ns]] + $newNS set successor $ns + my namespace $newNS + set ns $newNS + } + $ns add $prefix $entry +} + +# +# check for xmlns attribute in the name/value pair "n v" +# return 1 on success, otherwise 0 +# +XMLNode instproc checkForXmlNS {n v} { + #puts "checking to build NS in [self] with $n == $v" + if {[regexp {^xmlns:?(.*)$} $n _ prefix]} { + if {$prefix == ""} { + set prefix "xmlns" + } + my makeIndividualNSEntry $prefix $v + return 1 + } + return 0 +} + +# small helper proc to extract the namespace prefix from content +XMLNode instproc getContentPrefix {} { + if {[regexp {^([^:]*):} [my set content] _ prefix]} { + return $prefix + } + return "" +} + +############################################################################## +# +# XMLNode _Class_ Factory for creating XML style node +# node classes +# +############################################################################## + +Class XMLNodeClassFactory -superclass Class + +XMLNodeClassFactory create XMLElement -superclass XMLNode + +############################################################################## +# +# Add some methods to the created XMLElement class +# +############################################################################## + +XMLElement instproc parseAttributes {name attrList} { + my set content $name + foreach {n v} $attrList { + if {[my checkForXmlNS $n $v]} {continue} + my set attributes($n) $v + } +} + +# +# build a child corresponding to the node start event and +# check attribute list -> set content (attr name) and value (attr value) +# on created attr children objects of the XMLElement child +# return the new XMLElement child +# +XMLElement instproc parseStart {name attrList} { + set parser [my set parser] + set nf [$parser set nodeFactory] + set r [$nf getNode XMLElement [self]::[my nextChild elt] $parser] + $r parseAttributes $name $attrList + return $r +} + +# no action of parse end -> just return [self] for convinience +XMLElement instproc parseEnd content { + self +} + +############################################################################## +# +# Abstract interface for factories that create node objects; +# +############################################################################## +Class AbstractXMLNodeFactory + +# +# get a node with the specifies key (normally the classname) and name +# the node "objName" -> without flyweights an object "objName" or type "key" +# is created +# +AbstractXMLNodeFactory abstract instproc getNode {key objName parser} + +# +# clean up the node factory +# +AbstractXMLNodeFactory abstract instproc reset {} + +############################################################################## +# +# Special Node Factory as used in xoXML and xoRDF +# for shared classes the factory acts as a flyweight factory +# +############################################################################## +Class XMLNodeFactory -superclass AbstractXMLNodeFactory -parameter { + {sharedNodes ""} +} + +XMLNodeFactory instproc getNode {class objName parser} { + $class create $objName -parser $parser ;# returns object ID +} + +XMLNodeFactory instproc reset {} { + #my array set flyweights {} +} + +############################################################################## +# +# XML Factory for creating node objects +# +############################################################################## +XMLNodeFactory xmlNodeFactory + +############################################################################## +# +# Xml Parser Connection Class (wrapper facade to TclXML, expat +# interface like parsers) +# +############################################################################## +Class XMLParser -parameter { + {topLevelNodeHandler ""} + {nodeFactory "xmlNodeFactory"} + {xmlTextParser expat_fallback_tclxml} +} + +# +# normally all toplevel start events are handled with XML-Elements +# here we can define regexp patterns for other toplevel handlers +# +XMLParser instproc topLevelHandlerPattern {regexp handlerClass} { + my lappend topLevelNodeHandler $regexp $handlerClass +} +# +# if regexp matches -> handler class is used (see start instproc) +# if none matches -> use XMLElement; "name" is name given by the +# start method +# +XMLParser instproc createTopLevelNode {name attrList} { + set nf [my set nodeFactory] + set tnName [my autoname topNode] + foreach {regexpPattern class} [my set topLevelNodeHandler] { + if {[regexp $regexpPattern $name]} { + set tn [$nf getNode $class [self]::$tnName [self]] + my set currentTopNode $tn + return $tn + } + } + set tn [$nf getNode XMLElement [self]::$tnName [self]] + my set currentTopNode $tn + $tn parseAttributes $name $attrList + return $tn +} + +# +# determine the current node -> either the end of node list or topNode +# +XMLParser instproc currentNode {} { + set nodeList [my set nodeList] + if {$nodeList == ""} { + if {[my exists currentTopNode]} { + return [my set currentTopNode] + } + error "No current top node" + } else { + return [lindex $nodeList end] + } +} +# +# instatiate parser and register event callback methods with parser +# +XMLParser instproc init args { + #my set xmlTextParser expat + switch -- [my set xmlTextParser] { + tclxml { + package require xml + my set PC \ + [xml::parser [[self class] autoname [namespace tail [self]]]] + } + expat { + package require xotcl::xml::expat + my set PC \ + [expat [[self class] autoname [namespace tail [self]]]] + } + expat_fallback_tclxml { + if {[catch {package require xotcl::xml::expat}]} { + package require xml + my set PC \ + [xml::parser [[self class] autoname [namespace tail [self]]]] + #puts "using tclxml" + } else { + my set PC \ + [expat [[self class] autoname [namespace tail [self]]]] + #puts "using expat" + } + } + } + my configure \ + -characterdatacommand [list [self] pcdata] \ + -elementstartcommand [list [self] start] \ + -elementendcommand [list [self] end] + my set nodeList "" + next +} +XMLParser instproc characterdatacommand cmd { + [my set PC] configure -[self proc] $cmd +} +XMLParser instproc elementstartcommand cmd { + [my set PC] configure -[self proc] $cmd +} +XMLParser instproc elementendcommand cmd { + [my set PC] configure -[self proc] $cmd +} + +# +# Create Forwarding methods to the parser == +# abstact interface for xml parser acces +# +XMLParser instproc cget option {[my set PC] cget $option} +XMLParser instproc parse data {[my set PC] parse $data} +XMLParser instproc parseFile filename { + set F [open $filename r]; set c [read $F]; close $F + return [my parse $c] +} +XMLParser instproc reset {} { + [my set PC] reset + foreach c [my info children] { + $c destroy + } + my autoname -reset topNode + my set nodeList "" + [my set nodeFactory] reset +} +XMLParser instproc pcdata text { + #my showCall + set t [string trim $text] + if {$t != ""} { + #puts stderr "[self]->[self proc] '$text'" + [my currentNode] parseData $t + } +} +XMLParser instproc start {name {attrList ""}} { + #puts "[self]->[self proc] $name $attrList" + my instvar nodeList + if {$nodeList == ""} { + # no currentNode -> we have to create one + set newStartNode [my createTopLevelNode $name $attrList] + } else { + set newStartNode [[my currentNode] parseStart $name $attrList] + } + lappend nodeList $newStartNode +} +XMLParser instproc end {name} { + #puts "[self]->[self proc] $name" + my instvar nodeList + set currentNode [my currentNode] + $currentNode parseEnd $name + set nodeList [lreplace $nodeList end end] +} +XMLParser instproc destroy args { + if {[my exists PC]} { + rename [my set PC] "" + } + next +} +############################################################################## +# +# Abstract class for visiting Parser Node Trees +# +############################################################################## +Class NodeTreeVisitor + +# +# visit a given node "objName" -> called by accept method of objName +# visit encapsulates the interpretation algorithm for a node +# +NodeTreeVisitor abstract instproc visit objName + +# +# interpret the whole node tree strating with top node "node" +# +NodeTreeVisitor abstract instproc interpretNodeTree node + +# +# visit end may stay unspecified in concrete visitors +# +NodeTreeVisitor instproc visitEnd objName {;} +# +# template method that interprets all topnodes of a parser +# in original order +# +NodeTreeVisitor instproc interpretAll {parser} { + set result "" + foreach tn [lsort [$parser info children topNode*]] { + append result [my interpretNodeTree $tn] + } + return $result +} Index: xotcl/man/man.macros =================================================================== diff -u --- xotcl/man/man.macros (revision 0) +++ xotcl/man/man.macros (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,236 @@ +'\" The definitions below are for supplemental macros used in Tcl/Tk +'\" manual entries. +'\" +'\" .AP type name in/out ?indent? +'\" Start paragraph describing an argument to a library procedure. +'\" type is type of argument (int, etc.), in/out is either "in", "out", +'\" or "in/out" to describe whether procedure reads or modifies arg, +'\" and indent is equivalent to second arg of .IP (shouldn't ever be +'\" needed; use .AS below instead) +'\" +'\" .AS ?type? ?name? +'\" Give maximum sizes of arguments for setting tab stops. Type and +'\" name are examples of largest possible arguments that will be passed +'\" to .AP later. If args are omitted, default tab stops are used. +'\" +'\" .BS +'\" Start box enclosure. From here until next .BE, everything will be +'\" enclosed in one large box. +'\" +'\" .BE +'\" End of box enclosure. +'\" +'\" .CS +'\" Begin code excerpt. +'\" +'\" .CE +'\" End code excerpt. +'\" +'\" .VS ?version? ?br? +'\" Begin vertical sidebar, for use in marking newly-changed parts +'\" of man pages. The first argument is ignored and used for recording +'\" the version when the .VS was added, so that the sidebars can be +'\" found and removed when they reach a certain age. If another argument +'\" is present, then a line break is forced before starting the sidebar. +'\" +'\" .VE +'\" End of vertical sidebar. +'\" +'\" .DS +'\" Begin an indented unfilled display. +'\" +'\" .DE +'\" End of indented unfilled display. +'\" +'\" .SO +'\" Start of list of standard options for a Tk widget. The +'\" options follow on successive lines, in four columns separated +'\" by tabs. +'\" +'\" .SE +'\" End of list of standard options for a Tk widget. +'\" +'\" .OP cmdName dbName dbClass +'\" Start of description of a specific option. cmdName gives the +'\" option's name as specified in the class command, dbName gives +'\" the option's name in the option database, and dbClass gives +'\" the option's class in the option database. +'\" +'\" .UL arg1 arg2 +'\" Print arg1 underlined, then print arg2 normally. +'\" +'\" RCS: @(#) $Id: man.macros,v 1.1 2004/05/23 22:50:39 neumann Exp $ +'\" +'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. +.if t .wh -1.3i ^B +.nr ^l \n(.l +.ad b +'\" # Start an argument description +.de AP +.ie !"\\$4"" .TP \\$4 +.el \{\ +. ie !"\\$2"" .TP \\n()Cu +. el .TP 15 +.\} +.ta \\n()Au \\n()Bu +.ie !"\\$3"" \{\ +\&\\$1 \\fI\\$2\\fP (\\$3) +.\".b +.\} +.el \{\ +.br +.ie !"\\$2"" \{\ +\&\\$1 \\fI\\$2\\fP +.\} +.el \{\ +\&\\fI\\$1\\fP +.\} +.\} +.. +'\" # define tabbing values for .AP +.de AS +.nr )A 10n +.if !"\\$1"" .nr )A \\w'\\$1'u+3n +.nr )B \\n()Au+15n +.\" +.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n +.nr )C \\n()Bu+\\w'(in/out)'u+2n +.. +.AS Tcl_Interp Tcl_CreateInterp in/out +'\" # BS - start boxed text +'\" # ^y = starting y location +'\" # ^b = 1 +.de BS +.br +.mk ^y +.nr ^b 1u +.if n .nf +.if n .ti 0 +.if n \l'\\n(.lu\(ul' +.if n .fi +.. +'\" # BE - end boxed text (draw box now) +.de BE +.nf +.ti 0 +.mk ^t +.ie n \l'\\n(^lu\(ul' +.el \{\ +.\" Draw four-sided box normally, but don't draw top of +.\" box if the box started on an earlier page. +.ie !\\n(^b-1 \{\ +\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' +.\} +.el \}\ +\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' +.\} +.\} +.fi +.br +.nr ^b 0 +.. +'\" # VS - start vertical sidebar +'\" # ^Y = starting y location +'\" # ^v = 1 (for troff; for nroff this doesn't matter) +.de VS +.if !"\\$2"" .br +.mk ^Y +.ie n 'mc \s12\(br\s0 +.el .nr ^v 1u +.. +'\" # VE - end of vertical sidebar +.de VE +.ie n 'mc +.el \{\ +.ev 2 +.nf +.ti 0 +.mk ^t +\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' +.sp -1 +.fi +.ev +.\} +.nr ^v 0 +.. +'\" # Special macro to handle page bottom: finish off current +'\" # box/sidebar if in box/sidebar mode, then invoked standard +'\" # page bottom macro. +.de ^B +.ev 2 +'ti 0 +'nf +.mk ^t +.if \\n(^b \{\ +.\" Draw three-sided box if this is the box's first page, +.\" draw two sides but no top otherwise. +.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c +.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c +.\} +.if \\n(^v \{\ +.nr ^x \\n(^tu+1v-\\n(^Yu +\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c +.\} +.bp +'fi +.ev +.if \\n(^b \{\ +.mk ^y +.nr ^b 2 +.\} +.if \\n(^v \{\ +.mk ^Y +.\} +.. +'\" # DS - begin display +.de DS +.RS +.nf +.sp +.. +'\" # DE - end display +.de DE +.fi +.RE +.sp +.. +'\" # SO - start of list of standard options +.de SO +.SH "STANDARD OPTIONS" +.LP +.nf +.ta 4c 8c 12c +.ft B +.. +'\" # SE - end of list of standard options +.de SE +.fi +.ft R +.LP +See the \\fBoptions\\fR manual entry for details on the standard options. +.. +'\" # OP - start of full description for a single option +.de OP +.LP +.nf +.ta 4c +Command-Line Name: \\fB\\$1\\fR +Database Name: \\fB\\$2\\fR +Database Class: \\fB\\$3\\fR +.fi +.IP +.. +'\" # CS - begin code excerpt +.de CS +.RS +.nf +.ta .25i .5i .75i 1i +.. +'\" # CE - end code excerpt +.de CE +.fi +.RE +.. +.de UL +\\$1\l'|0\(ul'\\$2 +.. Index: xotcl/man/xotclsh.1 =================================================================== diff -u --- xotcl/man/xotclsh.1 (revision 0) +++ xotcl/man/xotclsh.1 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,93 @@ +'\" +'\" XOTcl - Extended OTcl +'\" Copyright (C) 1999-2001 Gustaf Neumann, Uwe Zdun +'\" +'\" +.so man.macros +.TH xotclsh 1 "" XOTcl "XOTcl Applications" +.BS +.SH NAME +xotclsh \- Tcl Shell containing object-oriented scripting language XOTcl +.SH SYNOPSIS +\fBxotclsh\fR \fI?filename arg arg ...?\fR +.BE +.SH DESCRIPTION +.PP +\fBxotclsh\fR is a shell-like application that reads XOTcl commands +from its standard input or from a file and evaluates them. +Similarly as the relation between \fBtclsh\fR and \fBwish\fR, +\fBxowish\fR +provides all functionality of xotclsh and provides as well predefined +support for TK widgets. +.PP +XOTcl (XOTcl, pronounced exotickle) is an object-oriented scripting +language based on MIT's OTcl. It is intended as a value added +replacement of OTcl. +.PP +Scripting languages, such as Tcl, are designed for glueing components +together, provide features such as dynamic extensibility and dynamic +typing with automatic conversion, that make them well suited for rapid +application development. +.PP +The object system of XOTcl enables a user to to define objects, +classes, and meta-classes. Classes are special objects with the +purpose of managing +other objects. ``Managing'' means that a class controls the creation +and destruction of its instances and that it contains a repository of +methods accessible for the instances. Every object may be enhanced +with object-specific methods. XOTcl supports single and multiple +inheritance. All object-class and class-class relationships in XOTcl +are introspectable and can be dynamically changed at arbitrary times. +Ambiguities in name resolution of methods are avoided +through method chaining through "next", which does not require +explicit method naming. +.PP +XOTcl combines the ideas of scripting and object-orientation in a way +that preserves the benefits of both of them. It is equipped with +several new language constructs that help building and managing +complex systems. We added the following support: + +.PP +\fIDynamic Object Aggregations\fR, +to provide dynamic aggregations through nested namespaces (objects). +.PP +\fINested Classes\fR, to reduce the interference +of independently developed program structures. +.PP +\fIAssertions\fR, to reduce +the interface and the reliability problems caused by dynamic typing +and, therefore, to ease the combination of many components. +.PP +\fIMeta-data\fR, to enhance self-documentation of objects and +classes. +.PP +\fIPer-object mixins\fR, as a means to give an object +dynamically access to the methods of one or several supplemental classes. +.PP +\fIPer-class mixins\fR, as a means to give all instances of +an class dynamically access to the methods of one or several +supplemental classes. +.PP +\fIFilters\fR as a means of +abstractions over method invocations to implement large program +structures, like design patterns. + +XOTcl provides a value-added replacement of Tcl +package loading providing integration with object-oriented constructs and +tracking/tracing of component loading. +.SH VARIABLES +.PP +\fBxotclsh\fR sets all variables that \fBtclsh\fR sets, +and additionally the following variables: + +.TP 15 +\fB::xotcl::version\fR XOTcl version number. +.TP 15 +\fB::xotcl::confdir\fR Directory for XOTcl configuration. +.TP 15 +\fB::xotcl::logdir\fR Directory where logfiles are placed. + +.PP +.SH KEYWORDS +argument, interpreter, prompt, script file, shell + Index: xotcl/man/xowish.1 =================================================================== diff -u --- xotcl/man/xowish.1 (revision 0) +++ xotcl/man/xowish.1 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,84 @@ +'\" +'\" XOTcl - Extended OTcl +'\" Copyright (C) 1999-2001 Gustaf Neumann, Uwe Zdun +'\" +'\" +.so man.macros +.TH xowish 1 "" XOWish "XOTcl Applications" +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +xowish \- Graphical shell containing object-oriented scripting language XOTcl +.SH SYNOPSIS +\fBxowish\fR ?\fIfileName arg arg ...\fR? +.BE + +.SH DESCRIPTION +.PP +\fBxowish\fR is a shell-like application that reads XOTcl commands +from its standard input or from a file and evaluates them. In addition +to \fBxotclsh\fR it provides graphical user interface support for TK +widgets. +.PP +XOTcl (XOTcl, pronounced exotickle) is an object-oriented scripting +language based on MIT's OTcl. It is intended as a value added +replacement for OTcl. +.PP +Scripting languages, like Tcl, are designed for glueing components +together, provide features like dynamic extensibility and dynamic +typing with automatic conversion, that make them well suited for rapid +application development. +.PP +The basic object system of XOTcl is adopted from OTcl. The object +system enables us to define objects, classes, and +meta-classes. Classes are special objects with the purpose of managing +other objects. ``Managing'' means that a class controls the creation +and destruction of its instances and that it contains a repository of +methods accessible for the instances. Every object may be enhanced +with object-specific methods. XOTcl supports single and multiple +inheritance. All relationships in XOTcl, including class and +superclass relationships, are completely dynamic and can be +introspected. Through method chaining without explicit naming of the +intended method, ambiguities in name resolution of methods are +avoided. This way a shadowed method can be ``mixed into'' the +execution of the current method. +.PP +XOTcl combines the ideas of scripting and object-orientation in a way +that preserves the benefits of both of them. It is equipped with +several new language functionalities that help building and managing +complex systems. We added the following support: +.PP +Dynamic Object Aggregations, to provide dynamic aggregations through +nested namespaces (objects). +.PP +Nested Classes, to reduce the interference +of independently developed program structures. +.PP +Assertions, to reduce +the interface and the reliability problems caused by dynamic typing +and, therefore, to ease the combination of many components. +.PP +Meta-data, +to enhance self-documentation of objects and classes. +.PP +Per-object +mixins, as a means to improve flexibility of mixin methods by giving +an object access to several different supplemental classes, which may +be changed dynamically. +.PP +Per-class mixins, as a means to improve +flexibility of mixin methods to a class, all instances of the class +have access to the mixed in methods like for multiple inheritance, but +without the need of intersection classes. +.PP +Filters as a means of +abstractions over method invocations to implement large program +structures, like design patterns. +.PP +Dynamic Component Loading XOTcl +integrates the Tcl package loading with architectrual support for +integration with object-oriented constructs. Moreover, it provides +tracking/tracing of component loading. +.PP +.SH KEYWORDS +argument, interpreter, prompt, script file, shell Index: xotcl/tcl.m4 =================================================================== diff -u --- xotcl/tcl.m4 (revision 0) +++ xotcl/tcl.m4 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,3675 @@ +# tcl.m4 -- +# +# This file provides a set of autoconf macros to help TEA-enable +# a Tcl extension. +# +# Copyright (c) 1999-2000 Ajuba Solutions. +# Copyright (c) 2002-2003 ActiveState Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: tcl.m4,v 1.1 2004/05/23 22:50:39 neumann Exp $ + +AC_PREREQ(2.50) + +#------------------------------------------------------------------------ +# TEA_PATH_TCLCONFIG -- +# +# Locate the tclConfig.sh file and perform a sanity check on +# the Tcl compile flags +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --with-tcl=... +# +# Defines the following vars: +# TCL_BIN_DIR Full path to the directory containing +# the tclConfig.sh file +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_PATH_TCLCONFIG, [ + dnl Make sure we are initialized + AC_REQUIRE([TEA_INIT]) + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + + if test x"${no_tcl}" = x ; then + # we reset no_tcl in case something fails here + no_tcl=true + AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval}) + AC_MSG_CHECKING([for Tcl configuration]) + AC_CACHE_VAL(ac_cv_c_tclconfig,[ + + # First check to see if --with-tcl was specified. + if test x"${with_tclconfig}" != x ; then + if test -f "${with_tclconfig}/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` + else + AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ../tcl \ + `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../tcl \ + `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../../tcl \ + `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few other private locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ${srcdir}/../tcl \ + `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + ]) + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCL_BIN_DIR="# no Tcl configs found" + AC_MSG_WARN("Cannot find Tcl configuration definitions") + exit 0 + else + no_tcl= + TCL_BIN_DIR=${ac_cv_c_tclconfig} + AC_MSG_RESULT([found $TCL_BIN_DIR/tclConfig.sh]) + fi + fi +]) + +#------------------------------------------------------------------------ +# TEA_PATH_TKCONFIG -- +# +# Locate the tkConfig.sh file +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --with-tk=... +# +# Defines the following vars: +# TK_BIN_DIR Full path to the directory containing +# the tkConfig.sh file +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_PATH_TKCONFIG, [ + # + # Ok, lets find the tk configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tk + # + + if test x"${no_tk}" = x ; then + # we reset no_tk in case something fails here + no_tk=true + AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval}) + AC_MSG_CHECKING([for Tk configuration]) + AC_CACHE_VAL(ac_cv_c_tkconfig,[ + + # First check to see if --with-tkconfig was specified. + if test x"${with_tkconfig}" != x ; then + if test -f "${with_tkconfig}/tkConfig.sh" ; then + ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)` + else + AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh]) + fi + fi + + # then check for a private Tk library + if test x"${ac_cv_c_tkconfig}" = x ; then + for i in \ + ../tk \ + `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../tk \ + `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../../tk \ + `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do + if test -f "$i/unix/tkConfig.sh" ; then + ac_cv_c_tkconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + # check in a few common install locations + if test x"${ac_cv_c_tkconfig}" = x ; then + for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do + if test -f "$i/tkConfig.sh" ; then + ac_cv_c_tkconfig=`(cd $i; pwd)` + break + fi + done + fi + # check in a few other private locations + if test x"${ac_cv_c_tkconfig}" = x ; then + for i in \ + ${srcdir}/../tk \ + `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do + if test -f "$i/unix/tkConfig.sh" ; then + ac_cv_c_tkconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + ]) + if test x"${ac_cv_c_tkconfig}" = x ; then + TK_BIN_DIR="# no Tk configs found" + AC_MSG_WARN("Cannot find Tk configuration definitions") + exit 0 + else + no_tk= + TK_BIN_DIR=${ac_cv_c_tkconfig} + AC_MSG_RESULT([found $TK_BIN_DIR/tkConfig.sh]) + fi + fi + +]) + +#------------------------------------------------------------------------ +# TEA_LOAD_TCLCONFIG -- +# +# Load the tclConfig.sh file +# +# Arguments: +# +# Requires the following vars to be set: +# TCL_BIN_DIR +# +# Results: +# +# Subst the following vars: +# TCL_BIN_DIR +# TCL_SRC_DIR +# TCL_LIB_FILE +# +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_LOAD_TCLCONFIG, [ + AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) + + if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + AC_MSG_RESULT([loading]) + . $TCL_BIN_DIR/tclConfig.sh + else + AC_MSG_RESULT([file not found]) + fi + + # + # If the TCL_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TCL_LIB_SPEC will be set to the value + # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC + # instead of TCL_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + # + + if test -f $TCL_BIN_DIR/Makefile ; then + TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} + TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} + TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} + fi + + # + # eval is required to do the TCL_DBGX substitution + # + + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" + eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" + eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" + + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" + eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" + eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" + + AC_SUBST(TCL_VERSION) + AC_SUBST(TCL_BIN_DIR) + AC_SUBST(TCL_SRC_DIR) + + AC_SUBST(TCL_LIB_FILE) + AC_SUBST(TCL_LIB_FLAG) + AC_SUBST(TCL_LIB_SPEC) + + AC_SUBST(TCL_STUB_LIB_FILE) + AC_SUBST(TCL_STUB_LIB_FLAG) + AC_SUBST(TCL_STUB_LIB_SPEC) + + #AC_SUBST(TCL_DBGX) + AC_SUBST(TCL_LIBS) + AC_SUBST(TCL_DEFS) + AC_SUBST(TCL_EXTRA_CFLAGS) + AC_SUBST(TCL_LD_FLAGS) + AC_SUBST(TCL_SHLIB_LD_LIBS) + #AC_SUBST(TCL_BUILD_LIB_SPEC) + #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) +]) + +#------------------------------------------------------------------------ +# TEA_LOAD_TKCONFIG -- +# +# Load the tkConfig.sh file +# +# Arguments: +# +# Requires the following vars to be set: +# TK_BIN_DIR +# +# Results: +# +# Sets the following vars that should be in tkConfig.sh: +# TK_BIN_DIR +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_LOAD_TKCONFIG, [ + AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh]) + + if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then + AC_MSG_RESULT([loading]) + . $TK_BIN_DIR/tkConfig.sh + else + AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh]) + fi + + # + # If the TK_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TK_LIB_SPEC will be set to the value + # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC + # instead of TK_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + # + + if test -f $TK_BIN_DIR/Makefile ; then + TK_LIB_SPEC=${TK_BUILD_LIB_SPEC} + TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC} + TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH} + fi + + # + # eval is required to do the TK_DBGX substitution + # + + eval "TK_LIB_FILE=\"${TK_LIB_FILE}\"" + eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\"" + eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\"" + + eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\"" + eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\"" + eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\"" + + AC_SUBST(TK_VERSION) + AC_SUBST(TK_BIN_DIR) + AC_SUBST(TK_SRC_DIR) + + AC_SUBST(TK_LIB_FILE) + AC_SUBST(TK_LIB_FLAG) + AC_SUBST(TK_LIB_SPEC) + + AC_SUBST(TK_STUB_LIB_FILE) + AC_SUBST(TK_STUB_LIB_FLAG) + AC_SUBST(TK_STUB_LIB_SPEC) + + AC_SUBST(TK_LIBS) + AC_SUBST(TK_XINCLUDES) +]) + +#------------------------------------------------------------------------ +# TEA_ENABLE_SHARED -- +# +# Allows the building of shared libraries +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --enable-shared=yes|no +# +# Defines the following vars: +# STATIC_BUILD Used for building import/export libraries +# on Windows. +# +# Sets the following vars: +# SHARED_BUILD Value of 1 or 0 +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_ENABLE_SHARED, [ + AC_MSG_CHECKING([how to build libraries]) + AC_ARG_ENABLE(shared, + [ --enable-shared build and link with shared libraries [--enable-shared]], + [tcl_ok=$enableval], [tcl_ok=yes]) + + if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + tcl_ok=$enableval + else + tcl_ok=yes + fi + + if test "$tcl_ok" = "yes" ; then + AC_MSG_RESULT([shared]) + SHARED_BUILD=1 + else + AC_MSG_RESULT([static]) + SHARED_BUILD=0 + AC_DEFINE(STATIC_BUILD) + fi + AC_SUBST(SHARED_BUILD) +]) + +#------------------------------------------------------------------------ +# TEA_ENABLE_THREADS -- +# +# Specify if thread support should be enabled. If "yes" is +# specified as an arg (optional), threads are enabled by default. +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --enable-threads +# +# Sets the following vars: +# THREADS_LIBS Thread library(s) +# +# Defines the following vars: +# TCL_THREADS +# _REENTRANT +# +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_ENABLE_THREADS, [ + AC_ARG_ENABLE(threads, [ --enable-threads build with threads], + [tcl_ok=$enableval], [tcl_ok=$1]) + + if test "$tcl_ok" = "yes"; then + TCL_THREADS=1 + + if test "${TEA_PLATFORM}" != "windows" ; then + # We are always OK on Windows, so check what this platform wants. + AC_DEFINE(USE_THREAD_ALLOC) + AC_DEFINE(_REENTRANT) + AC_DEFINE(_THREAD_SAFE) + AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) + if test "$tcl_ok" = "no"; then + # Check a little harder for __pthread_mutex_init in the + # same library, as some systems hide it there until + # pthread.h is defined. We could alternatively do an + # AC_TRY_COMPILE with pthread.h, but that will work with + # libpthread really doesn't exist, like AIX 4.2. + # [Bug: 4359] + AC_CHECK_LIB(pthread, __pthread_mutex_init, + tcl_ok=yes, tcl_ok=no) + fi + + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthread" + else + AC_CHECK_LIB(pthreads, pthread_mutex_init, + tcl_ok=yes, tcl_ok=no) + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthreads" + else + AC_CHECK_LIB(c, pthread_mutex_init, + tcl_ok=yes, tcl_ok=no) + if test "$tcl_ok" = "no"; then + AC_CHECK_LIB(c_r, pthread_mutex_init, + tcl_ok=yes, tcl_ok=no) + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -pthread" + else + TCL_THREADS=0 + AC_MSG_WARN("Don t know how to find pthread lib on your system - thread support disabled") + fi + fi + fi + fi + + # Does the pthread-implementation provide + # 'pthread_attr_setstacksize' ? + + ac_saved_libs=$LIBS + LIBS="$LIBS $THREADS_LIBS" + AC_CHECK_FUNCS(pthread_attr_setstacksize) + LIBS=$ac_saved_libs + AC_CHECK_FUNCS(readdir_r) + fi + else + TCL_THREADS=0 + fi + # Do checking message here to not mess up interleaved configure output + AC_MSG_CHECKING([for building with threads]) + if test "${TCL_THREADS}" = "1"; then + AC_DEFINE(TCL_THREADS) + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no (default)]) + fi + # TCL_THREADS sanity checking. See if our request for building with + # threads is the same as the way Tcl was built. If not, warn the user. + case ${TCL_DEFS} in + *THREADS=1*) + if test "${TCL_THREADS}" = "0"; then + AC_MSG_WARN([ + Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl + that IS thread-enabled.]) + fi + ;; + *) + if test "${TCL_THREADS}" = "1"; then + AC_MSG_WARN([ + --enable-threads requested, but attempting building against a Tcl + that is NOT thread-enabled.]) + fi + ;; + esac + AC_SUBST(TCL_THREADS) +]) + +#------------------------------------------------------------------------ +# TEA_ENABLE_SYMBOLS -- +# +# Specify if debugging symbols should be used +# Memory (TCL_MEM_DEBUG) debugging can also be enabled. +# +# Arguments: +# none +# +# Requires the following vars to be set: +# CFLAGS_DEBUG +# CFLAGS_OPTIMIZE +# LDFLAGS_DEBUG +# LDFLAGS_OPTIMIZE +# +# Results: +# +# Adds the following arguments to configure: +# --enable-symbols +# +# Defines the following vars: +# CFLAGS_DEFAULT Sets to CFLAGS_DEBUG if true +# Sets to CFLAGS_OPTIMIZE if false +# LDFLAGS_DEFAULT Sets to LDFLAGS_DEBUG if true +# Sets to LDFLAGS_OPTIMIZE if false +# DBGX Debug library extension +# +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_ENABLE_SYMBOLS, [ + dnl Make sure we are initialized + AC_REQUIRE([TEA_CONFIG_CFLAGS]) + + if test "${TEA_PLATFORM}" = "windows" ; then + tcl_dbgx=d + else + tcl_dbgx=g + fi + + AC_MSG_CHECKING([for build with symbols]) + AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no]) + if test "$tcl_ok" = "no"; then + CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" + LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" + DBGX="" + TCL_DBGX="" + AC_MSG_RESULT([no]) + else + CFLAGS_DEFAULT="${CFLAGS_DEBUG}" + LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" + DBGX=${tcl_dbgx} + TCL_DBGX=${tcl_dbgx} + if test "$tcl_ok" = "yes"; then + AC_MSG_RESULT([yes (standard debugging)]) + fi + fi + if test "${TEA_PLATFORM}" != "windows" ; then + LDFLAGS_DEFAULT="${LDFLAGS}" + fi + + AC_SUBST(TCL_DBGX) + AC_SUBST(CFLAGS_DEFAULT) + AC_SUBST(LDFLAGS_DEFAULT) + + if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then + AC_DEFINE(TCL_MEM_DEBUG) + fi + + if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then + if test "$tcl_ok" = "all"; then + AC_MSG_RESULT([enabled symbols mem debugging]) + else + AC_MSG_RESULT([enabled $tcl_ok debugging]) + fi + fi +]) + +#------------------------------------------------------------------------ +# TEA_ENABLE_LANGINFO -- +# +# Allows use of modern nl_langinfo check for better l10n. +# This is only relevant for Unix. +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --enable-langinfo=yes|no (default is yes) +# +# Defines the following vars: +# HAVE_LANGINFO Triggers use of nl_langinfo if defined. +# +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_ENABLE_LANGINFO, [ + AC_ARG_ENABLE(langinfo, + [ --enable-langinfo use nl_langinfo if possible to determine + encoding at startup, otherwise use old heuristic], + [langinfo_ok=$enableval], [langinfo_ok=yes]) + + HAVE_LANGINFO=0 + if test "$langinfo_ok" = "yes"; then + if test "$langinfo_ok" = "yes"; then + AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no]) + fi + fi + AC_MSG_CHECKING([whether to use nl_langinfo]) + if test "$langinfo_ok" = "yes"; then + AC_TRY_COMPILE([#include ], + [nl_langinfo(CODESET);],[langinfo_ok=yes],[langinfo_ok=no]) + if test "$langinfo_ok" = "no"; then + langinfo_ok="no (could not compile with nl_langinfo)"; + fi + if test "$langinfo_ok" = "yes"; then + AC_DEFINE(HAVE_LANGINFO) + fi + fi + AC_MSG_RESULT([$langinfo_ok]) +]) + +#-------------------------------------------------------------------- +# TEA_CONFIG_CFLAGS +# +# Try to determine the proper flags to pass to the compiler +# for building shared libraries and other such nonsense. +# +# Arguments: +# none +# +# Results: +# +# Defines the following vars: +# +# DL_OBJS - Name of the object file that implements dynamic +# loading for Tcl on this system. +# DL_LIBS - Library file(s) to include in tclsh and other base +# applications in order for the "load" command to work. +# LDFLAGS - Flags to pass to the compiler when linking object +# files into an executable application binary such +# as tclsh. +# LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib", +# that tell the run-time dynamic linker where to look +# for shared libraries such as libtcl.so. Depends on +# the variable LIB_RUNTIME_DIR in the Makefile. +# SHLIB_CFLAGS - Flags to pass to cc when compiling the components +# of a shared library (may request position-independent +# code, among other things). +# SHLIB_LD - Base command to use for combining object files +# into a shared library. +# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when +# creating shared libraries. This symbol typically +# goes at the end of the "ld" commands that build +# shared libraries. The value of the symbol is +# "${LIBS}" if all of the dependent libraries should +# be specified when creating a shared library. If +# dependent libraries should not be specified (as on +# SunOS 4.x, where they cause the link to fail, or in +# general if Tcl and Tk aren't themselves shared +# libraries), then this symbol has an empty string +# as its value. +# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable +# extensions. An empty string means we don't know how +# to use shared libraries on this platform. +# TCL_LIB_FILE - Name of the file that contains the Tcl library, such +# as libtcl7.8.so or libtcl7.8.a. +# TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl" +# in the shared library name, using the +# ${PACKAGE_VERSION} variable to put the version in +# the right place. This is used by platforms that +# need non-standard library names. +# Examples: ${PACKAGE_VERSION}.so.1.1 on NetBSD, +# since it needs to have a version after the .so, and +# ${PACKAGE_VERSION}.a on AIX, since the Tcl shared +# library needs to have a .a extension whereas shared +# objects for loadable extensions have a .so +# extension. Defaults to +# ${PACKAGE_VERSION}${SHLIB_SUFFIX}. +# TCL_NEEDS_EXP_FILE - +# 1 means that an export file is needed to link to a +# shared library. +# TCL_EXP_FILE - The name of the installed export / import file which +# should be used to link to the Tcl shared library. +# Empty if Tcl is unshared. +# TCL_BUILD_EXP_FILE - +# The name of the built export / import file which +# should be used to link to the Tcl shared library. +# Empty if Tcl is unshared. +# CFLAGS_DEBUG - +# Flags used when running the compiler in debug mode +# CFLAGS_OPTIMIZE - +# Flags used when running the compiler in optimize mode +# EXTRA_CFLAGS - +# Extra CFLAGS to pass to the compiler +# +# Subst's the following vars: +# DL_LIBS +# CFLAGS_DEBUG +# CFLAGS_OPTIMIZE +# CFLAGS_WARNING +# +# STLIB_LD +# SHLIB_LD +# SHLIB_CFLAGS +# SHLIB_LD_FLAGS +# LDFLAGS_DEBUG +# LDFLAGS_OPTIMIZE +#-------------------------------------------------------------------- + +AC_DEFUN(TEA_CONFIG_CFLAGS, [ + dnl Make sure we are initialized + AC_REQUIRE([TEA_INIT]) + + # Step 0: Enable 64 bit support? + + AC_MSG_CHECKING([if 64bit support is enabled]) + AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no]) + AC_MSG_RESULT([$do64bit]) + + # Step 0.b: Enable Solaris 64 bit VIS support? + + AC_MSG_CHECKING([if 64bit Sparc VIS support is requested]) + AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support], [do64bitVIS=$enableval], [do64bitVIS=no]) + AC_MSG_RESULT([$do64bitVIS]) + + if test "$do64bitVIS" = "yes"; then + # Force 64bit on with VIS + do64bit=yes + fi + + # Step 0.c: Cross-compiling options for Windows/CE builds? + + if test "${TEA_PLATFORM}" = "windows" ; then + AC_MSG_CHECKING([if Windows/CE build is requested]) + AC_ARG_ENABLE(wince,[ --enable-wince enable Win/CE support (where applicable)], [doWince=$enableval], [doWince=no]) + AC_MSG_RESULT($doWince) + fi + + # Step 1: set the variable "system" to hold the name and version number + # for the system. This can usually be done via the "uname" command, but + # there are a few systems, like Next, where this doesn't work. + + AC_MSG_CHECKING([system version (for dynamic loading)]) + if test -f /usr/lib/NextStep/software_version; then + system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` + else + system=`uname -s`-`uname -r` + if test "$?" -ne 0 ; then + AC_MSG_RESULT([unknown (can't find uname command)]) + system=unknown + else + # Special check for weird MP-RAS system (uname returns weird + # results, and the version is kept in special file). + + if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then + system=MP-RAS-`awk '{print $3}' /etc/.relid'` + fi + if test "`uname -s`" = "AIX" ; then + system=AIX-`uname -v`.`uname -r` + fi + if test "${TEA_PLATFORM}" = "windows" ; then + system=windows + fi + AC_MSG_RESULT([$system]) + fi + fi + + # Step 2: check for existence of -ldl library. This is needed because + # Linux can use either -ldl or -ldld for dynamic loading. + + AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no) + + # Step 3: set configuration options based on system name and version. + + do64bit_ok=no + EXTRA_CFLAGS="" + TCL_EXPORT_FILE_SUFFIX="" + UNSHARED_LIB_SUFFIX="" + TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' + ECHO_VERSION='`echo ${PACKAGE_VERSION}`' + TCL_LIB_VERSIONS_OK=ok + CFLAGS_DEBUG=-g + CFLAGS_OPTIMIZE=-O + if test "$GCC" = "yes" ; then + CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int" + else + CFLAGS_WARNING="" + fi + TCL_NEEDS_EXP_FILE=0 + TCL_BUILD_EXP_FILE="" + TCL_EXP_FILE="" +dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed. +dnl AC_CHECK_TOOL(AR, ar, :) + AC_CHECK_PROG(AR, ar, ar) + STLIB_LD='${AR} cr' + LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" + case $system in + windows) + # This is a 2-stage check to make sure we have the 64-bit SDK + # We have to know where the SDK is installed. + if test "$do64bit" = "yes" ; then + if test "x${MSSDK}x" = "xx" ; then + MSSDK="C:/Progra~1/Microsoft SDK" + fi + # In order to work in the tortured autoconf environment, + # we need to ensure that this path has no spaces + MSSDK=`cygpath -w -s "$MSSDK" | sed -e 's!\\\!/!g'` + if test ! -d "${MSSDK}/bin/win64" ; then + AC_MSG_WARN("could not find 64-bit SDK to enable 64bit mode") + do64bit="no" + else + do64bit_ok="yes" + fi + fi + + if test "$doWince" != "no" ; then + if test "$do64bit" = "yes" ; then + AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible]) + fi + if test "$GCC" = "yes" ; then + AC_MSG_ERROR([Windows/CE and GCC builds incompatible]) + fi + TEA_PATH_CELIB + # set defaults + # Currently Tcl requires 300+ + CEVERSION=300; # could be 211 300 301 ... + TARGETCPU=ARM; # could be ARM MIPS SH3 X86 ... + PLATFORM="Pocket PC 2002" + if test "$doWince" = "yes"; then + doWince="300,ARM,ARM,Pocket PC 2002" + fi + eval `echo $doWince | awk -F "," '{ \ + if (length([$]1)) { printf "CEVERSION=%s\n", [$]1 }; \ + if (length([$]2)) { printf "TARGETCPU=%s\n", toupper([$]2) }; \ + if (length([$]3)) { printf "ARCH=%s\n", toupper([$]3) }; \ + if (length([$]4)) { printf "PLATFORM=%s\n", [$]4 }; \ + }'` + OSVERSION=WCE$CEVERSION; + if test "x${ARCH}" = "x" ; then + ARCH=$TARGETCPU; # could be ARM MIPS SH3 X86 X86EM ... + fi + if test "x${WCEROOT}" = "x" ; then + WCEROOT="C:/Program Files/Microsoft eMbedded Tools" + fi + if test "x${SDKROOT}" = "x" ; then + SDKROOT="C:/Windows CE Tools" + fi + # In order to work in the tortured autoconf environment, + # we need to ensure that this path has no spaces + WCEROOT=`cygpath -w -s "$WCEROOT" | sed -e 's!\\\!/!g'` + SDKROOT=`cygpath -w -s "$SDKROOT" | sed -e 's!\\\!/!g'` + CELIB_DIR=`cygpath -w -s "$CELIB_DIR" | sed -e 's!\\\!/!g'` + if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ + -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then + AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]]) + doWince="no" + else + CEINCLUDE=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/include" | sed -e 's!\\\!/!g'` + CELIBPATH=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" | sed -e 's!\\\!/!g'` + fi + fi + + if test "$GCC" != "yes" ; then + if test "${SHARED_BUILD}" = "0" ; then + runtime=-MT + else + runtime=-MD + fi + + if test "$do64bit" = "yes" ; then + # All this magic is necessary for the Win64 SDK RC1 - hobbs + export CC="${MSSDK}/Bin/Win64/cl.exe \ + -I${MSSDK}/Include/prerelease \ + -I${MSSDK}/Include/Win64/crt \ + -I${MSSDK}/Include" + export RC="${MSSDK}/bin/rc.exe" + export lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \ + -LIBPATH:${MSSDK}/Lib/Prerelease/IA64" + export STLIB_LD="${MSSDK}/bin/win64/lib.exe -nologo ${lflags}" + export LINKBIN="${MSSDK}/bin/win64/link.exe ${lflags}" + CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" + CFLAGS_OPTIMIZE="-nologo -O2 -Gs -W2 ${runtime}" + elif test "$doWince" != "no" ; then + if test "${TARGETCPU}" = "X86"; then + CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + else + CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl${TARGETCPU}.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + fi + RC="${WCEROOT}/Common/EVC/bin/rc.exe" + cpulower=`echo ${TARGETCPU} | awk '{print tolower([$]0)}'` + defs="${TARGETCPU} _${TARGETCPU}_ ${cpulower} _${cpulower}_ POCKET_SIZE PALM_SIZE _MT _DLL _WINDOWS" + for i in $defs ; do + AC_DEFINE_UNQUOTED($i) + done + AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION) + AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION) + CFLAGS_DEBUG="-nologo -Zi -Od" + CFLAGS_OPTIMIZE="-nologo -Ox" + lflags="-MACHINE:${TARGETCPU} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,3.00" + STLIB_LD="${WCEROOT}/EVC/${OSVERSION}/bin/lib.exe -nologo ${lflags}" + LINKBIN="${WCEROOT}/EVC/${OSVERSION}/bin/link.exe ${lflags}" + else + RC="rc" + STLIB_LD="lib -nologo" + LINKBIN="link -link50compat" + CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" + CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD -W2 ${runtime}" + fi + fi + + if test "$GCC" = "yes"; then + # mingw gcc mode + RC="windres" + CFLAGS_DEBUG="-g" + CFLAGS_OPTIMIZE="-O2" + SHLIB_LD="$CC -shared" + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" + LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" + else + SHLIB_LD="${LINKBIN} -dll -nologo" + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.lib' + EXTRA_CFLAGS="-YX" + PATHTYPE=-w + # For information on what debugtype is most useful, see: + # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp + # This essentially turns it all on. + LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2" + LDFLAGS_OPTIMIZE="-release" + if test "$doWince" != "no" ; then + LDFLAGS_CONSOLE="-link ${lflags}" + LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} + else + LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" + LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" + fi + fi + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".dll" + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.dll' + + TCL_LIB_VERSIONS_OK=nodots + # Bogus to avoid getting this turned off + DL_OBJS="tclLoadNone.obj" + ;; + AIX-*) + if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then + # AIX requires the _r compiler when gcc isn't being used + if test "${CC}" != "cc_r" ; then + CC=${CC}_r + fi + AC_MSG_RESULT([Using $CC for compiling with threads]) + fi + LIBS="$LIBS -lc" + SHLIB_CFLAGS="" + SHLIB_SUFFIX=".so" + SHLIB_LD_LIBS='${LIBS}' + + DL_OBJS="tclLoadDl.o" + LDFLAGS="" + LD_LIBRARY_PATH_VAR="LIBPATH" + + # AIX v<=4.1 has some different flags than 4.2+ + if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then + #LIBOBJS="$LIBOBJS tclLoadAix.o" + AC_LIBOBJ([tclLoadAix]) + DL_LIBS="-lld" + fi + + # Check to enable 64-bit flags for compiler/linker on AIX 4+ + if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then + if test "$GCC" = "yes" ; then + AC_MSG_WARN("64bit mode not supported with GCC on $system") + else + do64bit_ok=yes + EXTRA_CFLAGS="-q64" + LDFLAGS="-q64" + RANLIB="${RANLIB} -X64" + AR="${AR} -X64" + SHLIB_LD_FLAGS="-b64" + fi + fi + + if test "`uname -m`" = "ia64" ; then + # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + # AIX-5 has dl* in libc.so + DL_LIBS="" + if test "$GCC" = "yes" ; then + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' + fi + else + SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}" + DL_LIBS="-ldl" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + TCL_NEEDS_EXP_FILE=1 + TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.exp' + fi + + # On AIX <=v4 systems, libbsd.a has to be linked in to support + # non-blocking file IO. This library has to be linked in after + # the MATH_LIBS or it breaks the pow() function. The way to + # insure proper sequencing, is to add it to the tail of MATH_LIBS. + # This library also supplies gettimeofday. + # + # AIX does not have a timezone field in struct tm. When the AIX + # bsd library is used, the timezone global and the gettimeofday + # methods are to be avoided for timezone deduction instead, we + # deduce the timezone by comparing the localtime result on a + # known GMT value. + + AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no) + if test $libbsd = yes; then + MATH_LIBS="$MATH_LIBS -lbsd" + AC_DEFINE(USE_DELTA_FOR_TZ) + fi + ;; + BSD/OS-2.1*|BSD/OS-3*) + SHLIB_CFLAGS="" + SHLIB_LD="shlicc -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + BSD/OS-4.*) + SHLIB_CFLAGS="-export-dynamic -fPIC" + SHLIB_LD="cc -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-export-dynamic" + LD_SEARCH_FLAGS="" + ;; + dgux*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + HP-UX-*.11.*) + # Use updated header definitions where possible + AC_DEFINE(_XOPEN_SOURCE_EXTENDED) + + SHLIB_SUFFIX=".sl" + AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + fi + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + + # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc + #EXTRA_CFLAGS="+DAportable" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + hpux_arch=`${CC} -dumpmachine` + case $hpux_arch in + hppa64*) + # 64-bit gcc in use. Fix flags for GNU ld. + do64bit_ok=yes + SHLIB_LD="${CC} -shared" + SHLIB_LD_LIBS="" + LD_SEARCH_FLAGS='' + ;; + *) + AC_MSG_WARN("64bit mode not supported with GCC on $system") + ;; + esac + else + do64bit_ok=yes + if test "`uname -m`" = "ia64" ; then + EXTRA_CFLAGS="+DD64" + LDFLAGS="+DD64 $LDFLAGS" + else + EXTRA_CFLAGS="+DA2.0W" + LDFLAGS="+DA2.0W $LDFLAGS" + fi + fi + fi + ;; + HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) + SHLIB_SUFFIX=".sl" + AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS="" + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + fi + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + ;; + IRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + ;; + IRIX-5.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + EXTRA_CFLAGS="" + LDFLAGS="" + ;; + IRIX-6.*|IRIX64-6.5*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -n32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then + EXTRA_CFLAGS="-mabi=n32" + LDFLAGS="-mabi=n32" + else + case $system in + IRIX-6.3) + # Use to build 6.2 compatible binaries on 6.3. + EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS" + ;; + *) + EXTRA_CFLAGS="-n32" + ;; + esac + LDFLAGS="-n32" + fi + ;; + IRIX64-6.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -n32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + + # Check to enable 64-bit flags for compiler/linker + + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + AC_MSG_WARN([64bit mode not supported by gcc]) + else + do64bit_ok=yes + SHLIB_LD="ld -64 -shared -rdata_shared" + EXTRA_CFLAGS="-64" + LDFLAGS="-64" + fi + fi + ;; + Linux*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings + # when you inline the string and math operations. Turn this off to + # get rid of the warnings. + + #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + else + AC_CHECK_HEADER(dld.h, [ + SHLIB_LD="ld -shared" + DL_OBJS="tclLoadDld.o" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS=""]) + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + + # The combo of gcc + glibc has a bug related + # to inlining of functions like strtod(). The + # -fno-builtin flag should address this problem + # but it does not work. The -fno-inline flag + # is kind of overkill but it works. + # Disable inlining only when one of the + # files in compat/*.c is being linked in. + if test x"${USE_COMPAT}" != x ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline" + fi + + ;; + GNU*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + LD_SEARCH_FLAGS="" + else + AC_CHECK_HEADER(dld.h, [ + SHLIB_LD="ld -shared" + DL_OBJS="" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS=""]) + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + ;; + MP-RAS-02*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + MP-RAS-*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="-Wl,-Bexport" + LD_SEARCH_FLAGS="" + ;; + NetBSD-*|FreeBSD-[[1-2]].*) + # Not available on all versions: check for include file. + AC_CHECK_HEADER(dlfcn.h, [ + # NetBSD/SPARC needs -fPIC, -fpic will not do. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + AC_MSG_CHECKING([for ELF]) + AC_EGREP_CPP(yes, [ +#ifdef __ELF__ + yes +#endif + ], + AC_MSG_RESULT([yes]) + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so', + AC_MSG_RESULT([no]) + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + ) + ], [ + SHLIB_CFLAGS="" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + ]) + + # FreeBSD doesn't handle version numbers with dots. + + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + OpenBSD-*) + SHLIB_LD="${CC} -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + AC_MSG_CHECKING(for ELF) + AC_EGREP_CPP(yes, [ +#ifdef __ELF__ + yes +#endif + ], + [AC_MSG_RESULT(yes) + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'], + [AC_MSG_RESULT(no) + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'] + ) + + # OpenBSD doesn't do version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + FreeBSD-*) + # FreeBSD 3.* and greater have ELF. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="-export-dynamic" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + if test "${TCL_THREADS}" = "1" ; then + # The -pthread needs to go in the CFLAGS, not LIBS + LIBS=`echo $LIBS | sed s/-pthread//` + EXTRA_CFLAGS="-pthread" + LDFLAGS="$LDFLAGS -pthread" + fi + case $system in + FreeBSD-3.*) + # FreeBSD-3 doesn't handle version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' + TCL_LIB_VERSIONS_OK=nodots + ;; + esac + ;; + Rhapsody-*|Darwin-*) + SHLIB_CFLAGS="-fno-common" + SHLIB_LD="cc -dynamiclib \${LDFLAGS}" + TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_MAJOR_VERSION} -current_version \${PACKAGE_VERSION} -install_name \${LIB_RUNTIME_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".dylib" + DL_OBJS="tclLoadDyld.o" + DL_LIBS="" + LDFLAGS="-prebind" + LD_SEARCH_FLAGS="" + LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" + CFLAGS_OPTIMIZE="-O3" + EXTRA_CFLAGS="-arch ppc -pipe" + ;; + NEXTSTEP-*) + SHLIB_CFLAGS="" + SHLIB_LD="cc -nostdlib -r" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadNext.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OS/390-*) + CFLAGS_OPTIMIZE="" # Optimizer is buggy + AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h + ;; + OSF1-1.0|OSF1-1.1|OSF1-1.2) + # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 + SHLIB_CFLAGS="" + # Hack: make package name same as library name + SHLIB_LD='ld -R -export $@:' + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadOSF.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-1.*) + # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 + SHLIB_CFLAGS="-fPIC" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD="ld -shared" + else + SHLIB_LD="ld -non_shared" + fi + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-V*) + # Digital OSF/1 + SHLIB_CFLAGS="" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD='ld -shared -expect_unresolved "*"' + else + SHLIB_LD='ld -non_shared -expect_unresolved "*"' + fi + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + if test "$GCC" != "yes" ; then + EXTRA_CFLAGS="-DHAVE_TZSET -std1" + fi + # see pthread_intro(3) for pthread support on osf1, k.furukawa + if test "${TCL_THREADS}" = "1" ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" + LIBS=`echo $LIBS | sed s/-lpthreads//` + if test "$GCC" = "yes" ; then + LIBS="$LIBS -lpthread -lmach -lexc" + else + EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread" + LDFLAGS="-pthread" + fi + fi + + ;; + QNX-6*) + # QNX RTP + # This may work for all QNX, but it was only reported for v6. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + # dlopen is in -lc on QNX + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + RISCos-*) + SHLIB_CFLAGS="-G 0" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + ;; + SCO_SV-3.2*) + # Note, dlopen is available only on SCO 3.2.5 and greater. However, + # this test works, since "uname -s" was non-standard in 3.2.4 and + # below. + if test "$GCC" = "yes" ; then + SHLIB_CFLAGS="-fPIC -melf" + LDFLAGS="-melf -Wl,-Bexport" + else + SHLIB_CFLAGS="-Kpic -belf" + LDFLAGS="-belf -Wl,-Bexport" + fi + SHLIB_LD="ld -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LD_SEARCH_FLAGS="" + ;; + SINIX*5.4*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + SunOS-4*) + SHLIB_CFLAGS="-PIC" + SHLIB_LD="ld" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + + # SunOS can't handle version numbers with dots in them in library + # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it + # requires an extra version number at the end of .so file names. + # So, the library has to have a name like libtcl75.so.1.0 + + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + SunOS-5.[[0-6]]*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + AC_DEFINE(_REENTRANT) + AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) + + SHLIB_CFLAGS="-KPIC" + + # Note: need the LIBS below, otherwise Tk won't find Tcl's + # symbols when dynamically loaded into tclsh. + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + LDFLAGS="" + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + ;; + SunOS-5*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + AC_DEFINE(_REENTRANT) + AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) + + SHLIB_CFLAGS="-KPIC" + LDFLAGS="" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + arch=`isainfo` + if test "$arch" = "sparcv9 sparc" ; then + if test "$GCC" = "yes" ; then + AC_MSG_WARN("64bit mode not supported with GCC on $system") + else + do64bit_ok=yes + if test "$do64bitVIS" = "yes" ; then + EXTRA_CFLAGS="-xarch=v9a" + LDFLAGS="-xarch=v9a" + else + EXTRA_CFLAGS="-xarch=v9" + LDFLAGS="-xarch=v9" + fi + fi + else + AC_MSG_WARN("64bit mode only supported sparcv9 system") + fi + fi + + # Note: need the LIBS below, otherwise Tk won't find Tcl's + # symbols when dynamically loaded into tclsh. + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + ;; + ULTRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + if test "$GCC" != "yes" ; then + EXTRA_CFLAGS="-DHAVE_TZSET -std1" + fi + ;; + UNIX_SV* | UnixWare-5*) + SHLIB_CFLAGS="-KPIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers + # that don't grok the -Bexport option. Test that it does. + hold_ldflags=$LDFLAGS + AC_MSG_CHECKING([for ld accepts -Bexport flag]) + LDFLAGS="${LDFLAGS} -Wl,-Bexport" + AC_TRY_LINK(, [int i;], found=yes, found=no) + LDFLAGS=$hold_ldflags + AC_MSG_RESULT([$found]) + if test $found = yes; then + LDFLAGS="-Wl,-Bexport" + else + LDFLAGS="" + fi + LD_SEARCH_FLAGS="" + ;; + esac + + if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then + AC_MSG_WARN("64bit support being disabled -- don\'t know magic for this platform") + fi + + # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic + # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop, + # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need + # to determine which of several header files defines the a.out file + # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we + # support only a file format that is more or less version-7-compatible. + # In particular, + # - a.out files must begin with `struct exec'. + # - the N_TXTOFF on the `struct exec' must compute the seek address + # of the text segment + # - The `struct exec' must contain a_magic, a_text, a_data, a_bss + # and a_entry fields. + # The following compilation should succeed if and only if either sys/exec.h + # or a.out.h is usable for the purpose. + # + # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the + # `struct exec' includes a second header that contains information that + # duplicates the v7 fields that are needed. + + if test "x$DL_OBJS" = "xtclLoadAout.o" ; then + AC_MSG_CHECKING([sys/exec.h]) + AC_TRY_COMPILE([#include ],[ + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + ], tcl_ok=usable, tcl_ok=unusable) + AC_MSG_RESULT([$tcl_ok]) + if test $tcl_ok = usable; then + AC_DEFINE(USE_SYS_EXEC_H) + else + AC_MSG_CHECKING([a.out.h]) + AC_TRY_COMPILE([#include ],[ + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + ], tcl_ok=usable, tcl_ok=unusable) + AC_MSG_RESULT([$tcl_ok]) + if test $tcl_ok = usable; then + AC_DEFINE(USE_A_OUT_H) + else + AC_MSG_CHECKING([sys/exec_aout.h]) + AC_TRY_COMPILE([#include ],[ + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_midmag == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + ], tcl_ok=usable, tcl_ok=unusable) + AC_MSG_RESULT([$tcl_ok]) + if test $tcl_ok = usable; then + AC_DEFINE(USE_SYS_EXEC_AOUT_H) + else + DL_OBJS="" + fi + fi + fi + fi + + # Step 5: disable dynamic loading if requested via a command-line switch. + + AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command], + [tcl_ok=$enableval], [tcl_ok=yes]) + if test "$tcl_ok" = "no"; then + DL_OBJS="" + fi + + if test "x$DL_OBJS" != "x" ; then + BUILD_DLTEST="\$(DLTEST_TARGETS)" + else + echo "Can't figure out how to do dynamic loading or shared libraries" + echo "on this system." + SHLIB_CFLAGS="" + SHLIB_LD="" + SHLIB_SUFFIX="" + DL_OBJS="tclLoadNone.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + BUILD_DLTEST="" + fi + + # If we're running gcc, then change the C flags for compiling shared + # libraries to the right flags for gcc, instead of those for the + # standard manufacturer compiler. + + if test "$DL_OBJS" != "tclLoadNone.o" ; then + if test "$GCC" = "yes" ; then + case $system in + AIX-*) + ;; + BSD/OS*) + ;; + IRIX*) + ;; + NetBSD-*|FreeBSD-*) + ;; + Rhapsody-*|Darwin-*) + ;; + RISCos-*) + ;; + SCO_SV-3.2*) + ;; + ULTRIX-4.*) + ;; + windows) + ;; + *) + SHLIB_CFLAGS="-fPIC" + ;; + esac + fi + fi + + if test "$SHARED_LIB_SUFFIX" = "" ; then + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}${SHLIB_SUFFIX}' + fi + if test "$UNSHARED_LIB_SUFFIX" = "" ; then + UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + fi + + AC_SUBST(DL_LIBS) + AC_SUBST(CFLAGS_DEBUG) + AC_SUBST(CFLAGS_OPTIMIZE) + AC_SUBST(CFLAGS_WARNING) + AC_SUBST(EXTRA_CFLAGS) + + AC_SUBST(STLIB_LD) + AC_SUBST(SHLIB_LD) + AC_SUBST(SHLIB_CFLAGS) + AC_SUBST(SHLIB_LD_FLAGS) + AC_SUBST(SHLIB_LD_LIBS) + AC_SUBST(LDFLAGS_DEBUG) + AC_SUBST(LDFLAGS_OPTIMIZE) + AC_SUBST(LD_LIBRARY_PATH_VAR) +]) + +#-------------------------------------------------------------------- +# TEA_SERIAL_PORT +# +# Determine which interface to use to talk to the serial port. +# Note that #include lines must begin in leftmost column for +# some compilers to recognize them as preprocessor directives, +# and some build environments have stdin not pointing at a +# pseudo-terminal (usually /dev/null instead.) +# +# Arguments: +# none +# +# Results: +# +# Defines only one of the following vars: +# HAVE_SYS_MODEM_H +# USE_TERMIOS +# USE_TERMIO +# USE_SGTTY +# +#-------------------------------------------------------------------- + +AC_DEFUN(TEA_SERIAL_PORT, [ + AC_CHECK_HEADERS(sys/modem.h) + AC_MSG_CHECKING([termios vs. termio vs. sgtty]) + AC_CACHE_VAL(tcl_cv_api_serial, [ + AC_TRY_RUN([ +#include + +int main() { + struct termios t; + if (tcgetattr(0, &t) == 0) { + cfsetospeed(&t, 0); + t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; + return 0; + } + return 1; +}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) + if test $tcl_cv_api_serial = no ; then + AC_TRY_RUN([ +#include + +int main() { + struct termio t; + if (ioctl(0, TCGETA, &t) == 0) { + t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; + return 0; + } + return 1; +}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) + fi + if test $tcl_cv_api_serial = no ; then + AC_TRY_RUN([ +#include + +int main() { + struct sgttyb t; + if (ioctl(0, TIOCGETP, &t) == 0) { + t.sg_ospeed = 0; + t.sg_flags |= ODDP | EVENP | RAW; + return 0; + } + return 1; +}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none) + fi + if test $tcl_cv_api_serial = no ; then + AC_TRY_RUN([ +#include +#include + +int main() { + struct termios t; + if (tcgetattr(0, &t) == 0 + || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { + cfsetospeed(&t, 0); + t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; + return 0; + } + return 1; +}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) + fi + if test $tcl_cv_api_serial = no; then + AC_TRY_RUN([ +#include +#include + +int main() { + struct termio t; + if (ioctl(0, TCGETA, &t) == 0 + || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { + t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; + return 0; + } + return 1; + }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) + fi + if test $tcl_cv_api_serial = no; then + AC_TRY_RUN([ +#include +#include + +int main() { + struct sgttyb t; + if (ioctl(0, TIOCGETP, &t) == 0 + || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { + t.sg_ospeed = 0; + t.sg_flags |= ODDP | EVENP | RAW; + return 0; + } + return 1; +}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none) + fi]) + case $tcl_cv_api_serial in + termios) AC_DEFINE(USE_TERMIOS);; + termio) AC_DEFINE(USE_TERMIO);; + sgtty) AC_DEFINE(USE_SGTTY);; + esac + AC_MSG_RESULT([$tcl_cv_api_serial]) +]) + +#-------------------------------------------------------------------- +# TEA_MISSING_POSIX_HEADERS +# +# Supply substitutes for missing POSIX header files. Special +# notes: +# - stdlib.h doesn't define strtol, strtoul, or +# strtod insome versions of SunOS +# - some versions of string.h don't declare procedures such +# as strstr +# +# Arguments: +# none +# +# Results: +# +# Defines some of the following vars: +# NO_DIRENT_H +# NO_ERRNO_H +# NO_VALUES_H +# NO_LIMITS_H +# NO_STDLIB_H +# NO_STRING_H +# NO_SYS_WAIT_H +# NO_DLFCN_H +# HAVE_UNISTD_H +# HAVE_SYS_PARAM_H +# +# HAVE_STRING_H ? +# +#-------------------------------------------------------------------- + +AC_DEFUN(TEA_MISSING_POSIX_HEADERS, [ + AC_MSG_CHECKING([dirent.h]) + AC_TRY_LINK([#include +#include ], [ +#ifndef _POSIX_SOURCE +# ifdef __Lynx__ + /* + * Generate compilation error to make the test fail: Lynx headers + * are only valid if really in the POSIX environment. + */ + + missing_procedure(); +# endif +#endif +DIR *d; +struct dirent *entryPtr; +char *p; +d = opendir("foobar"); +entryPtr = readdir(d); +p = entryPtr->d_name; +closedir(d); +], tcl_ok=yes, tcl_ok=no) + + if test $tcl_ok = no; then + AC_DEFINE(NO_DIRENT_H) + fi + + AC_MSG_RESULT([$tcl_ok]) + AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)]) + AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)]) + AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)]) + AC_CHECK_HEADER(limits.h, , [AC_DEFINE(NO_LIMITS_H)]) + AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) + AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) + AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) + AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0) + if test $tcl_ok = 0; then + AC_DEFINE(NO_STDLIB_H) + fi + AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0) + AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0) + AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0) + + # See also memmove check below for a place where NO_STRING_H can be + # set and why. + + if test $tcl_ok = 0; then + AC_DEFINE(NO_STRING_H) + fi + + AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)]) + AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)]) + + # OS/390 lacks sys/param.h (and doesn't need it, by chance). + # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and + # CHECK on limits.h + + AC_HAVE_HEADERS(limits.h unistd.h sys/param.h) + +]) + +#-------------------------------------------------------------------- +# TEA_PATH_X +# +# Locate the X11 header files and the X11 library archive. Try +# the ac_path_x macro first, but if it doesn't find the X stuff +# (e.g. because there's no xmkmf program) then check through +# a list of possible directories. Under some conditions the +# autoconf macro will return an include directory that contains +# no include files, so double-check its result just to be safe. +# +# This should be called after TEA_CONFIG_CFLAGS as setting the +# LIBS line can confuse some configure macro magic. +# +# Arguments: +# none +# +# Results: +# +# Sets the following vars: +# XINCLUDES +# XLIBSW +# LIBS (appends to) +# +#-------------------------------------------------------------------- + +AC_DEFUN(TEA_PATH_X, [ + if test "${TEA_PLATFORM}" = "unix" ; then + TEA_PATH_UNIX_X + fi +]) + +AC_DEFUN(TEA_PATH_UNIX_X, [ + AC_PATH_X + not_really_there="" + if test "$no_x" = ""; then + if test "$x_includes" = ""; then + AC_TRY_CPP([#include ], , not_really_there="yes") + else + if test ! -r $x_includes/X11/Intrinsic.h; then + not_really_there="yes" + fi + fi + fi + if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then + AC_MSG_CHECKING([for X11 header files]) + XINCLUDES="# no special path needed" + AC_TRY_CPP([#include ], , XINCLUDES="nope") + if test "$XINCLUDES" = nope; then + dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" + for i in $dirs ; do + if test -r $i/X11/Intrinsic.h; then + AC_MSG_RESULT([$i]) + XINCLUDES=" -I$i" + break + fi + done + fi + else + if test "$x_includes" != ""; then + XINCLUDES=-I$x_includes + else + XINCLUDES="# no special path needed" + fi + fi + if test "$XINCLUDES" = nope; then + AC_MSG_RESULT([could not find any!]) + XINCLUDES="# no include files found" + fi + + if test "$no_x" = yes; then + AC_MSG_CHECKING([for X11 libraries]) + XLIBSW=nope + dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" + for i in $dirs ; do + if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then + AC_MSG_RESULT([$i]) + XLIBSW="-L$i -lX11" + x_libraries="$i" + break + fi + done + else + if test "$x_libraries" = ""; then + XLIBSW=-lX11 + else + XLIBSW="-L$x_libraries -lX11" + fi + fi + if test "$XLIBSW" = nope ; then + AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow) + fi + if test "$XLIBSW" = nope ; then + AC_MSG_RESULT([could not find any! Using -lX11.]) + XLIBSW=-lX11 + fi + if test x"${XLIBSW}" != x ; then + PKG_LIBS="${PKG_LIBS} ${XLIBSW}" + fi +]) + +#-------------------------------------------------------------------- +# TEA_BLOCKING_STYLE +# +# The statements below check for systems where POSIX-style +# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. +# On these systems (mostly older ones), use the old BSD-style +# FIONBIO approach instead. +# +# Arguments: +# none +# +# Results: +# +# Defines some of the following vars: +# HAVE_SYS_IOCTL_H +# HAVE_SYS_FILIO_H +# USE_FIONBIO +# O_NONBLOCK +# +#-------------------------------------------------------------------- + +AC_DEFUN(TEA_BLOCKING_STYLE, [ + AC_CHECK_HEADERS(sys/ioctl.h) + AC_CHECK_HEADERS(sys/filio.h) + AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O]) + if test -f /usr/lib/NextStep/software_version; then + system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` + else + system=`uname -s`-`uname -r` + if test "$?" -ne 0 ; then + system=unknown + else + # Special check for weird MP-RAS system (uname returns weird + # results, and the version is kept in special file). + + if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then + system=MP-RAS-`awk '{print $3}' /etc/.relid'` + fi + if test "`uname -s`" = "AIX" ; then + system=AIX-`uname -v`.`uname -r` + fi + fi + fi + case $system in + # There used to be code here to use FIONBIO under AIX. However, it + # was reported that FIONBIO doesn't work under AIX 3.2.5. Since + # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO + # code (JO, 5/31/97). + + OSF*) + AC_DEFINE(USE_FIONBIO) + AC_MSG_RESULT([FIONBIO]) + ;; + SunOS-4*) + AC_DEFINE(USE_FIONBIO) + AC_MSG_RESULT([FIONBIO]) + ;; + ULTRIX-4.*) + AC_DEFINE(USE_FIONBIO) + AC_MSG_RESULT([FIONBIO]) + ;; + *) + AC_MSG_RESULT([O_NONBLOCK]) + ;; + esac +]) + +#-------------------------------------------------------------------- +# TEA_TIME_HANLDER +# +# Checks how the system deals with time.h, what time structures +# are used on the system, and what fields the structures have. +# +# Arguments: +# none +# +# Results: +# +# Defines some of the following vars: +# USE_DELTA_FOR_TZ +# HAVE_TM_GMTOFF +# HAVE_TM_TZADJ +# HAVE_TIMEZONE_VAR +# +#-------------------------------------------------------------------- + +AC_DEFUN(TEA_TIME_HANDLER, [ + AC_CHECK_HEADERS(sys/time.h) + AC_HEADER_TIME + AC_STRUCT_TIMEZONE + + AC_CHECK_FUNCS(gmtime_r localtime_r) + + AC_MSG_CHECKING([tm_tzadj in struct tm]) + AC_CACHE_VAL(tcl_cv_member_tm_tzadj, + AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_tzadj;], + tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)) + AC_MSG_RESULT([$tcl_cv_member_tm_tzadj]) + if test $tcl_cv_member_tm_tzadj = yes ; then + AC_DEFINE(HAVE_TM_TZADJ) + fi + + AC_MSG_CHECKING([tm_gmtoff in struct tm]) + AC_CACHE_VAL(tcl_cv_member_tm_gmtoff, + AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_gmtoff;], + tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)) + AC_MSG_RESULT([$tcl_cv_member_tm_gmtoff]) + if test $tcl_cv_member_tm_gmtoff = yes ; then + AC_DEFINE(HAVE_TM_GMTOFF) + fi + + # + # Its important to include time.h in this check, as some systems + # (like convex) have timezone functions, etc. + # + AC_MSG_CHECKING([long timezone variable]) + AC_CACHE_VAL(tcl_cv_var_timezone, + AC_TRY_COMPILE([#include ], + [extern long timezone; + timezone += 1; + exit (0);], + tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)) + AC_MSG_RESULT([$tcl_cv_timezone_long]) + if test $tcl_cv_timezone_long = yes ; then + AC_DEFINE(HAVE_TIMEZONE_VAR) + else + # + # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. + # + AC_MSG_CHECKING([time_t timezone variable]) + AC_CACHE_VAL(tcl_cv_timezone_time, + AC_TRY_COMPILE([#include ], + [extern time_t timezone; + timezone += 1; + exit (0);], + tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)) + AC_MSG_RESULT([$tcl_cv_timezone_time]) + if test $tcl_cv_timezone_time = yes ; then + AC_DEFINE(HAVE_TIMEZONE_VAR) + fi + fi +]) + +#-------------------------------------------------------------------- +# TEA_BUGGY_STRTOD +# +# Under Solaris 2.4, strtod returns the wrong value for the +# terminating character under some conditions. Check for this +# and if the problem exists use a substitute procedure +# "fixstrtod" (provided by Tcl) that corrects the error. +# Also, on Compaq's Tru64 Unix 5.0, +# strtod(" ") returns 0.0 instead of a failure to convert. +# +# Arguments: +# none +# +# Results: +# +# Might defines some of the following vars: +# strtod (=fixstrtod) +# +#-------------------------------------------------------------------- + +AC_DEFUN(TEA_BUGGY_STRTOD, [ + AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0) + if test "$tcl_strtod" = 1; then + AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs]) + AC_TRY_RUN([ + extern double strtod(); + int main() + { + char *string = "NaN", *spaceString = " "; + char *term; + double value; + value = strtod(string, &term); + if ((term != string) && (term[-1] == 0)) { + exit(1); + } + value = strtod(spaceString, &term); + if (term == (spaceString+1)) { + exit(1); + } + exit(0); + }], tcl_ok=1, tcl_ok=0, tcl_ok=0) + if test "$tcl_ok" = 1; then + AC_MSG_RESULT([ok]) + else + AC_MSG_RESULT([buggy]) + #LIBOBJS="$LIBOBJS fixstrtod.o" + AC_LIBOBJ([fixstrtod]) + USE_COMPAT=1 + AC_DEFINE(strtod, fixstrtod) + fi + fi +]) + +#-------------------------------------------------------------------- +# TEA_TCL_LINK_LIBS +# +# Search for the libraries needed to link the Tcl shell. +# Things like the math library (-lm) and socket stuff (-lsocket vs. +# -lnsl) are dealt with here. +# +# Arguments: +# Requires the following vars to be set in the Makefile: +# DL_LIBS +# LIBS +# MATH_LIBS +# +# Results: +# +# Subst's the following var: +# TCL_LIBS +# MATH_LIBS +# +# Might append to the following vars: +# LIBS +# +# Might define the following vars: +# HAVE_NET_ERRNO_H +# +#-------------------------------------------------------------------- + +AC_DEFUN(TEA_TCL_LINK_LIBS, [ + #-------------------------------------------------------------------- + # On a few very rare systems, all of the libm.a stuff is + # already in libc.a. Set compiler flags accordingly. + # Also, Linux requires the "ieee" library for math to work + # right (and it must appear before "-lm"). + #-------------------------------------------------------------------- + + AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm") + AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"]) + + #-------------------------------------------------------------------- + # Interactive UNIX requires -linet instead of -lsocket, plus it + # needs net/errno.h to define the socket-related error codes. + #-------------------------------------------------------------------- + + AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]) + AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H)) + + #-------------------------------------------------------------------- + # Check for the existence of the -lsocket and -lnsl libraries. + # The order here is important, so that they end up in the right + # order in the command line generated by make. Here are some + # special considerations: + # 1. Use "connect" and "accept" to check for -lsocket, and + # "gethostbyname" to check for -lnsl. + # 2. Use each function name only once: can't redo a check because + # autoconf caches the results of the last check and won't redo it. + # 3. Use -lnsl and -lsocket only if they supply procedures that + # aren't already present in the normal libraries. This is because + # IRIX 5.2 has libraries, but they aren't needed and they're + # bogus: they goof up name resolution if used. + # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. + # To get around this problem, check for both libraries together + # if -lsocket doesn't work by itself. + #-------------------------------------------------------------------- + + tcl_checkBoth=0 + AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1) + if test "$tcl_checkSocket" = 1; then + AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt, + LIBS="$LIBS -lsocket", tcl_checkBoth=1)]) + fi + if test "$tcl_checkBoth" = 1; then + tk_oldLibs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) + fi + AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, + [LIBS="$LIBS -lnsl"])]) + + # Don't perform the eval of the libraries here because DL_LIBS + # won't be set until we call TEA_CONFIG_CFLAGS + + TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' + AC_SUBST(TCL_LIBS) + AC_SUBST(MATH_LIBS) +]) + +#-------------------------------------------------------------------- +# TEA_TCL_EARLY_FLAGS +# +# Check for what flags are needed to be passed so the correct OS +# features are available. +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# _ISOC99_SOURCE +# _LARGEFILE64_SOURCE +# +#-------------------------------------------------------------------- + +AC_DEFUN(TEA_TCL_EARLY_FLAG,[ + AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]), + AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no, + AC_TRY_COMPILE([[#define ]$1[ 1 +]$2], $3, + [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes, + [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no))) + if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then + AC_DEFINE($1) + tcl_flags="$tcl_flags $1" + fi +]) + +AC_DEFUN(TEA_TCL_EARLY_FLAGS,[ + AC_MSG_CHECKING([for required early compiler flags]) + tcl_flags="" + TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include ], + [char *p = (char *)strtoll; char *q = (char *)strtoull;]) + TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include ], + [struct stat64 buf; int i = stat64("/", &buf);]) + if test "x${tcl_flags}" = "x" ; then + AC_MSG_RESULT([none]) + else + AC_MSG_RESULT([${tcl_flags}]) + fi +]) + +#-------------------------------------------------------------------- +# TEA_TCL_64BIT_FLAGS +# +# Check for what is defined in the way of 64-bit features. +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# TCL_WIDE_INT_IS_LONG +# TCL_WIDE_INT_TYPE +# HAVE_STRUCT_DIRENT64 +# HAVE_STRUCT_STAT64 +# HAVE_TYPE_OFF64_T +# +#-------------------------------------------------------------------- + +AC_DEFUN(TEA_TCL_64BIT_FLAGS, [ + AC_MSG_CHECKING([for 64-bit integer type]) + AC_CACHE_VAL(tcl_cv_type_64bit,[ + AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], + tcl_cv_type_64bit=__int64,tcl_cv_type_64bit=none + AC_TRY_RUN([#include + int main() {exit(!(sizeof(long long) > sizeof(long)));} + ], tcl_cv_type_64bit="long long"))]) + if test "${tcl_cv_type_64bit}" = none ; then + AC_MSG_RESULT([using long]) + elif test "${tcl_cv_type_64bit}" = "__int64" ; then + # We actually want to use the default tcl.h checks in this + # case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* + AC_MSG_RESULT([using Tcl header defaults]) + else + AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}) + AC_MSG_RESULT([${tcl_cv_type_64bit}]) + + # Now check for auxiliary declarations + AC_MSG_CHECKING([for struct dirent64]) + AC_CACHE_VAL(tcl_cv_struct_dirent64,[ + AC_TRY_COMPILE([#include +#include ],[struct dirent64 p;], + tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)]) + if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then + AC_DEFINE(HAVE_STRUCT_DIRENT64) + fi + AC_MSG_RESULT([${tcl_cv_struct_dirent64}]) + + AC_MSG_CHECKING([for struct stat64]) + AC_CACHE_VAL(tcl_cv_struct_stat64,[ + AC_TRY_COMPILE([#include ],[struct stat64 p; +], + tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)]) + if test "x${tcl_cv_struct_stat64}" = "xyes" ; then + AC_DEFINE(HAVE_STRUCT_STAT64) + fi + AC_MSG_RESULT([${tcl_cv_struct_stat64}]) + + AC_MSG_CHECKING([for off64_t]) + AC_CACHE_VAL(tcl_cv_type_off64_t,[ + AC_TRY_COMPILE([#include ],[off64_t offset; +], + tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)]) + if test "x${tcl_cv_type_off64_t}" = "xyes" ; then + AC_DEFINE(HAVE_TYPE_OFF64_T) + fi + AC_MSG_RESULT([${tcl_cv_type_off64_t}]) + fi +]) + +## +## Here ends the standard Tcl configuration bits and starts the +## TEA specific functions +## + +#------------------------------------------------------------------------ +# TEA_INIT -- +# +# Init various Tcl Extension Architecture (TEA) variables. +# This should be the first called TEA_* macro. +# +# Arguments: +# none +# +# Results: +# +# Defines and substs the following vars: +# CYGPATH +# EXEEXT +# Defines only: +# TEA_INITED +# TEA_PLATFORM (windows or unix) +# +# "cygpath" is used on windows to generate native path names for include +# files. These variables should only be used with the compiler and linker +# since they generate native path names. +# +# EXEEXT +# Select the executable extension based on the host type. This +# is a lightweight replacement for AC_EXEEXT that doesn't require +# a compiler. +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_INIT, [ + TEA_VERSION="3.0" + + AC_MSG_CHECKING([for correct TEA configuration]) + if test x"${PACKAGE_NAME}" = x ; then + AC_MSG_ERROR([ +The PACKAGE_NAME variable must be defined by your TEA configure.in]) + fi + if test x"$1" = x ; then + AC_MSG_ERROR([ +TEA version not specified.]) + elif test "$1" != "${TEA_VERSION}" ; then + AC_MSG_RESULT([warning: TEA version "$1" != ${TEA_VERSION}]) + else + AC_MSG_RESULT([ok]) + fi + case "`uname -s`" in + *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*) + AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo) + EXEEXT=".exe" + TEA_PLATFORM="windows" + ;; + *) + CYGPATH=echo + EXEEXT="" + TEA_PLATFORM="unix" + ;; + esac + + # Check if exec_prefix is set. If not use fall back to prefix + if test x$exec_prefix = xNONE ; then exec_prefix=$prefix ; fi + + AC_SUBST(EXEEXT) + AC_SUBST(CYGPATH) + + # This package name must be replaced statically for AC_SUBST to work + AC_SUBST(PKG_LIB_FILE) + # Substitute STUB_LIB_FILE in case package creates a stub library too. + AC_SUBST(PKG_STUB_LIB_FILE) + + # We AC_SUBST these here to ensure they are subst'ed, + # in case the user doesn't call TEA_ADD_... + AC_SUBST(PKG_STUB_SOURCES) + AC_SUBST(PKG_STUB_OBJECTS) + AC_SUBST(PKG_TCL_SOURCES) + AC_SUBST(PKG_HEADERS) + AC_SUBST(PKG_INCLUDES) + AC_SUBST(PKG_LIBS) + AC_SUBST(PKG_CFLAGS) +]) + +#------------------------------------------------------------------------ +# TEA_ADD_SOURCES -- +# +# Specify one or more source files. Users should check for +# the right platform before adding to their list. +# It is not important to specify the directory, as long as it is +# in the generic, win or unix subdirectory of $(srcdir). +# +# Arguments: +# one or more file names +# +# Results: +# +# Defines and substs the following vars: +# PKG_SOURCES +# PKG_OBJECTS +#------------------------------------------------------------------------ +AC_DEFUN(TEA_ADD_SOURCES, [ + vars="$@" + for i in $vars; do + case $i in + [\$]*) + # allow $-var names + PKG_SOURCES="$PKG_SOURCES $i" + PKG_OBJECTS="$PKG_OBJECTS $i" + ;; + *) + # check for existence - allows for generic/win/unix VPATH + if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ + -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ + ; then + AC_MSG_ERROR([could not find source file '$i']) + fi + PKG_SOURCES="$PKG_SOURCES $i" + # this assumes it is in a VPATH dir + i=`basename $i` + # handle user calling this before or after TEA_SETUP_COMPILER + if test x"${OBJEXT}" != x ; then + j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}" + else + j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}" + fi + PKG_OBJECTS="$PKG_OBJECTS $j" + ;; + esac + done + AC_SUBST(PKG_SOURCES) + AC_SUBST(PKG_OBJECTS) +]) + +#------------------------------------------------------------------------ +# TEA_ADD_STUB_SOURCES -- +# +# Specify one or more source files. Users should check for +# the right platform before adding to their list. +# It is not important to specify the directory, as long as it is +# in the generic, win or unix subdirectory of $(srcdir). +# +# Arguments: +# one or more file names +# +# Results: +# +# Defines and substs the following vars: +# PKG_STUB_SOURCES +# PKG_STUB_OBJECTS +#------------------------------------------------------------------------ +AC_DEFUN(TEA_ADD_STUB_SOURCES, [ + vars="$@" + for i in $vars; do + # check for existence - allows for generic/win/unix VPATH + if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ + -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ + ; then + AC_MSG_ERROR([could not find stub source file '$i']) + fi + PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i" + # this assumes it is in a VPATH dir + i=`basename $i` + # handle user calling this before or after TEA_SETUP_COMPILER + if test x"${OBJEXT}" != x ; then + j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}" + else + j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}" + fi + PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j" + done + AC_SUBST(PKG_STUB_SOURCES) + AC_SUBST(PKG_STUB_OBJECTS) +]) + +#------------------------------------------------------------------------ +# TEA_ADD_TCL_SOURCES -- +# +# Specify one or more Tcl source files. These should be platform +# independent runtime files. +# +# Arguments: +# one or more file names +# +# Results: +# +# Defines and substs the following vars: +# PKG_TCL_SOURCES +#------------------------------------------------------------------------ +AC_DEFUN(TEA_ADD_TCL_SOURCES, [ + vars="$@" + for i in $vars; do + # check for existence, be strict because it is installed + if test ! -f "${srcdir}/$i" ; then + AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i']) + fi + PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i" + done + AC_SUBST(PKG_TCL_SOURCES) +]) + +#------------------------------------------------------------------------ +# TEA_ADD_HEADERS -- +# +# Specify one or more source headers. Users should check for +# the right platform before adding to their list. +# +# Arguments: +# one or more file names +# +# Results: +# +# Defines and substs the following vars: +# PKG_HEADERS +#------------------------------------------------------------------------ +AC_DEFUN(TEA_ADD_HEADERS, [ + vars="$@" + for i in $vars; do + # check for existence, be strict because it is installed + if test ! -f "${srcdir}/$i" ; then + AC_MSG_ERROR([could not find header file '${srcdir}/$i']) + fi + PKG_HEADERS="$PKG_HEADERS $i" + done + AC_SUBST(PKG_HEADERS) +]) + +#------------------------------------------------------------------------ +# TEA_ADD_INCLUDES -- +# +# Specify one or more include dirs. Users should check for +# the right platform before adding to their list. +# +# Arguments: +# one or more file names +# +# Results: +# +# Defines and substs the following vars: +# PKG_INCLUDES +#------------------------------------------------------------------------ +AC_DEFUN(TEA_ADD_INCLUDES, [ + vars="$@" + for i in $vars; do + PKG_INCLUDES="$PKG_INCLUDES $i" + done + AC_SUBST(PKG_INCLUDES) +]) + +#------------------------------------------------------------------------ +# TEA_ADD_LIBS -- +# +# Specify one or more libraries. Users should check for +# the right platform before adding to their list. +# +# Arguments: +# one or more file names +# +# Results: +# +# Defines and substs the following vars: +# PKG_LIBS +#------------------------------------------------------------------------ +AC_DEFUN(TEA_ADD_LIBS, [ + vars="$@" + for i in $vars; do + PKG_LIBS="$PKG_LIBS $i" + done + AC_SUBST(PKG_LIBS) +]) + +#------------------------------------------------------------------------ +# TEA_ADD_CFLAGS -- +# +# Specify one or more CFLAGS. Users should check for +# the right platform before adding to their list. +# +# Arguments: +# one or more file names +# +# Results: +# +# Defines and substs the following vars: +# PKG_CFLAGS +#------------------------------------------------------------------------ +AC_DEFUN(TEA_ADD_CFLAGS, [ + PKG_CFLAGS="$PKG_CFLAGS $@" + AC_SUBST(PKG_CFLAGS) +]) + +#------------------------------------------------------------------------ +# TEA_PREFIX -- +# +# Handle the --prefix=... option by defaulting to what Tcl gave +# +# Arguments: +# none +# +# Results: +# +# If --prefix or --exec-prefix was not specified, $prefix and +# $exec_prefix will be set to the values given to Tcl when it was +# configured. +#------------------------------------------------------------------------ +AC_DEFUN(TEA_PREFIX, [ + # Should be AC_MSG_NOTICE, but that requires autoconf 2.50 + if test "${prefix}" = "NONE"; then + prefix_default=yes + if test x"${TCL_PREFIX}" != x; then + AC_MSG_WARN([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}]) + prefix=${TCL_PREFIX} + else + prefix=/usr/local + fi + fi + if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" ; then + if test x"${TCL_EXEC_PREFIX}" != x; then + AC_MSG_WARN([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}]) + exec_prefix=${TCL_EXEC_PREFIX} + else + exec_prefix=$prefix + fi + fi +]) + +#------------------------------------------------------------------------ +# TEA_SETUP_COMPILER_CC -- +# +# Do compiler checks the way we want. This is just a replacement +# for AC_PROG_CC in TEA configure.in files to make them cleaner. +# +# Arguments: +# none +# +# Results: +# +# Sets up CC var and other standard bits we need to make executables. +#------------------------------------------------------------------------ +AC_DEFUN(TEA_SETUP_COMPILER_CC, [ + # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE) + # in this macro, they need to go into TEA_SETUP_COMPILER instead. + + # If the user did not set CFLAGS, set it now to keep + # the AC_PROG_CC macro from adding "-g -O2". + if test "${CFLAGS+set}" != "set" ; then + CFLAGS="" + fi + + AC_PROG_CC + AC_PROG_CPP + + AC_PROG_INSTALL + + #-------------------------------------------------------------------- + # Checks to see if the make program sets the $MAKE variable. + #-------------------------------------------------------------------- + + AC_PROG_MAKE_SET + + #-------------------------------------------------------------------- + # Find ranlib + #-------------------------------------------------------------------- + + AC_PROG_RANLIB + + #-------------------------------------------------------------------- + # Determines the correct binary file extension (.o, .obj, .exe etc.) + #-------------------------------------------------------------------- + + AC_OBJEXT + AC_EXEEXT +]) + +#------------------------------------------------------------------------ +# TEA_SETUP_COMPILER -- +# +# Do compiler checks that use the compiler. This must go after +# TEA_SETUP_COMPILER_CC, which does the actual compiler check. +# +# Arguments: +# none +# +# Results: +# +# Sets up CC var and other standard bits we need to make executables. +#------------------------------------------------------------------------ +AC_DEFUN(TEA_SETUP_COMPILER, [ + # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here. + AC_REQUIRE([TEA_SETUP_COMPILER_CC]) + + #------------------------------------------------------------------------ + # If we're using GCC, see if the compiler understands -pipe. If so, use it. + # It makes compiling go faster. (This is only a performance feature.) + #------------------------------------------------------------------------ + + if test -z "$no_pipe" -a -n "$GCC"; then + AC_MSG_CHECKING([if the compiler understands -pipe]) + OLDCC="$CC" + CC="$CC -pipe" + AC_TRY_COMPILE(,, AC_MSG_RESULT([yes]), CC="$OLDCC" + AC_MSG_RESULT([no])) + fi + + #-------------------------------------------------------------------- + # Common compiler flag setup + #-------------------------------------------------------------------- + + TEA_TCL_EARLY_FLAGS + TEA_TCL_64BIT_FLAGS + AC_C_BIGENDIAN + if test "${TEA_PLATFORM}" = "unix" ; then + TEA_TCL_LINK_LIBS + TEA_MISSING_POSIX_HEADERS + # Let the user call this, because if it triggers, they will + # need a compat/strtod.c that is correct. Users can also + # use Tcl_GetDouble(FromObj) instead. + #TEA_BUGGY_STRTOD + fi +]) + +#------------------------------------------------------------------------ +# TEA_MAKE_LIB -- +# +# Generate a line that can be used to build a shared/unshared library +# in a platform independent manner. +# +# Arguments: +# none +# +# Requires: +# +# Results: +# +# Defines the following vars: +# CFLAGS - Done late here to note disturb other AC macros +# MAKE_LIB - Command to execute to build the Tcl library; +# differs depending on whether or not Tcl is being +# compiled as a shared library. +# MAKE_SHARED_LIB Makefile rule for building a shared library +# MAKE_STATIC_LIB Makefile rule for building a static library +# MAKE_STUB_LIB Makefile rule for building a stub library +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_MAKE_LIB, [ + if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then + MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)" + MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)" + MAKE_STUB_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_STUB_OBJECTS)" + else + MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)" + MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS}" + MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)" + fi + + if test "${SHARED_BUILD}" = "1" ; then + MAKE_LIB="${MAKE_SHARED_LIB} " + else + MAKE_LIB="${MAKE_STATIC_LIB} " + fi + + #-------------------------------------------------------------------- + # Shared libraries and static libraries have different names. + # Use the double eval to make sure the ${DBGX} in the suffix is + # substituted. + #-------------------------------------------------------------------- + + RANLIB_STUB="${RANLIB}" + if test "${TEA_PLATFORM}" = "windows" ; then + if test "${SHARED_BUILD}" = "1" ; then + # We force the unresolved linking of symbols that are really in + # the private libraries of Tcl and Tk. + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" + if test x"${TK_BIN_DIR}" != x ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" + fi + eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + fi + # Some packages build there own stubs libraries + eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + else + if test "${SHARED_BUILD}" = "1" ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" + if test x"${TK_BIN_DIR}" != x ; then + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}" + fi + eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" + RANLIB=: + else + eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + fi + # Some packages build there own stubs libraries + eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + fi + + # These are escaped so that only CFLAGS is picked up at configure time. + # The other values will be substituted at make time. + CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" + if test "${SHARED_BUILD}" = "1" ; then + CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}" + fi + + AC_SUBST(MAKE_LIB) + AC_SUBST(MAKE_SHARED_LIB) + AC_SUBST(MAKE_STATIC_LIB) + AC_SUBST(MAKE_STUB_LIB) + AC_SUBST(RANLIB_STUB) +]) + +#------------------------------------------------------------------------ +# TEA_LIB_SPEC -- +# +# Compute the name of an existing object library located in libdir +# from the given base name and produce the appropriate linker flags. +# +# Arguments: +# basename The base name of the library without version +# numbers, extensions, or "lib" prefixes. +# extra_dir Extra directory in which to search for the +# library. This location is used first, then +# $prefix/$exec-prefix, then some defaults. +# +# Requires: +# TEA_INIT and TEA_PREFIX must be called first. +# +# Results: +# +# Defines the following vars: +# ${basename}_LIB_NAME The computed library name. +# ${basename}_LIB_SPEC The computed linker flags. +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_LIB_SPEC, [ + AC_MSG_CHECKING([for $1 library]) + + # Look in exec-prefix for the library (defined by TEA_PREFIX). + + tea_lib_name_dir="${exec_prefix}/lib" + + # Or in a user-specified location. + + if test x"$2" != x ; then + tea_extra_lib_dir=$2 + else + tea_extra_lib_dir=NONE + fi + + for i in \ + `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \ + `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \ + `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \ + `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \ + `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \ + `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \ + `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \ + `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do + if test -f "$i" ; then + tea_lib_name_dir=`dirname $i` + $1_LIB_NAME=`basename $i` + $1_LIB_PATH_NAME=$i + break + fi + done + + if test "${TEA_PLATFORM}" = "windows"; then + $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\" + else + # Strip off the leading "lib" and trailing ".a" or ".so" + + tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'` + $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}" + fi + + if test "x${$1_LIB_NAME}" = x ; then + AC_MSG_ERROR([not found]) + else + AC_MSG_RESULT([${$1_LIB_SPEC}]) + fi +]) + +#------------------------------------------------------------------------ +# TEA_PRIVATE_TCL_HEADERS -- +# +# Locate the private Tcl include files +# +# Arguments: +# +# Requires: +# TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has +# already been called. +# +# Results: +# +# Substs the following vars: +# TCL_TOP_DIR_NATIVE +# TCL_GENERIC_DIR_NATIVE +# TCL_UNIX_DIR_NATIVE +# TCL_WIN_DIR_NATIVE +# TCL_BMAP_DIR_NATIVE +# TCL_TOOL_DIR_NATIVE +# TCL_PLATFORM_DIR_NATIVE +# TCL_BIN_DIR_NATIVE +# TCL_INCLUDES +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_PRIVATE_TCL_HEADERS, [ + AC_MSG_CHECKING([for Tcl private include files]) + + if test "${TEA_PLATFORM}" = "windows"; then + TCL_TOP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}`\" + TCL_GENERIC_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/generic`\" + TCL_UNIX_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/unix`\" + TCL_WIN_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/win`\" + TCL_BMAP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/bitmaps`\" + TCL_TOOL_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/tools`\" + TCL_COMPAT_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/compat`\" + TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE} + + TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}" + else + TCL_TOP_DIR_NATIVE='$(TCL_SRC_DIR)' + TCL_GENERIC_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/generic' + TCL_UNIX_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/unix' + TCL_WIN_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/win' + TCL_BMAP_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/bitmaps' + TCL_TOOL_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/tools' + TCL_COMPAT_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/compat' + TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE} + + # substitute these in "relaxed" so that TCL_INCLUDES still works + # without requiring the other vars to be defined in the Makefile + eval "TCL_INCLUDES=\"-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}\"" + fi + + AC_SUBST(TCL_TOP_DIR_NATIVE) + AC_SUBST(TCL_GENERIC_DIR_NATIVE) + AC_SUBST(TCL_UNIX_DIR_NATIVE) + AC_SUBST(TCL_WIN_DIR_NATIVE) + AC_SUBST(TCL_BMAP_DIR_NATIVE) + AC_SUBST(TCL_TOOL_DIR_NATIVE) + AC_SUBST(TCL_PLATFORM_DIR_NATIVE) + + AC_SUBST(TCL_INCLUDES) + AC_MSG_RESULT([Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}]) +]) + +#------------------------------------------------------------------------ +# TEA_PUBLIC_TCL_HEADERS -- +# +# Locate the installed public Tcl header files +# +# Arguments: +# None. +# +# Requires: +# CYGPATH must be set +# +# Results: +# +# Adds a --with-tclinclude switch to configure. +# Result is cached. +# +# Substs the following vars: +# TCL_INCLUDES +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_PUBLIC_TCL_HEADERS, [ + AC_MSG_CHECKING([for Tcl public headers]) + + AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval}) + + AC_CACHE_VAL(ac_cv_c_tclh, [ + # Use the value from --with-tclinclude, if it was given + + if test x"${with_tclinclude}" != x ; then + if test -f "${with_tclinclude}/tcl.h" ; then + ac_cv_c_tclh=${with_tclinclude} + else + AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h]) + fi + else + # Check order: pkg --prefix location, Tcl's --prefix location, + # directory of tclConfig.sh, and Tcl source directory. + # Looking in the source dir is not ideal, but OK. + + eval "temp_includedir=${includedir}" + list="`ls -d ${temp_includedir} 2>/dev/null` \ + `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ + `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \ + `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`" + if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then + list="$list /usr/local/include /usr/include" + fi + for i in $list ; do + if test -f "$i/tcl.h" ; then + ac_cv_c_tclh=$i + break + fi + done + fi + ]) + + # Print a message based on how we determined the include path + + if test x"${ac_cv_c_tclh}" = x ; then + AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude]) + else + AC_MSG_RESULT([${ac_cv_c_tclh}]) + fi + + # Convert to a native path and substitute into the output files. + + INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}` + + TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" + + AC_SUBST(TCL_INCLUDES) +]) + +#------------------------------------------------------------------------ +# TEA_PRIVATE_TK_HEADERS -- +# +# Locate the private Tk include files +# +# Arguments: +# +# Requires: +# TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has +# already been called. +# +# Results: +# +# Substs the following vars: +# TK_INCLUDES +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_PRIVATE_TK_HEADERS, [ + AC_MSG_CHECKING([for Tk private include files]) + + if test "${TEA_PLATFORM}" = "windows"; then + TK_TOP_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}`\" + TK_UNIX_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/unix`\" + TK_WIN_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/win`\" + TK_GENERIC_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/generic`\" + TK_XLIB_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/xlib`\" + TK_PLATFORM_DIR_NATIVE=${TK_WIN_DIR_NATIVE} + + TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE} -I${TK_XLIB_DIR_NATIVE}" + else + TK_TOP_DIR_NATIVE='${TK_SRC_DIR}' + TK_GENERIC_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/generic' + TK_UNIX_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/unix' + TK_WIN_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/win' + TK_PLATFORM_DIR_NATIVE=${TK_UNIX_DIR_NATIVE} + + # substitute these in "relaxed" so that TK_INCLUDES still works + # without requiring the other vars to be defined in the Makefile + eval "TK_INCLUDES=\"-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}\"" + fi + + AC_SUBST(TK_TOP_DIR_NATIVE) + AC_SUBST(TK_UNIX_DIR_NATIVE) + AC_SUBST(TK_WIN_DIR_NATIVE) + AC_SUBST(TK_GENERIC_DIR_NATIVE) + AC_SUBST(TK_XLIB_DIR_NATIVE) + AC_SUBST(TK_PLATFORM_DIR_NATIVE) + + AC_SUBST(TK_INCLUDES) + AC_MSG_RESULT([Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}]) +]) + +#------------------------------------------------------------------------ +# TEA_PUBLIC_TK_HEADERS -- +# +# Locate the installed public Tk header files +# +# Arguments: +# None. +# +# Requires: +# CYGPATH must be set +# +# Results: +# +# Adds a --with-tkinclude switch to configure. +# Result is cached. +# +# Substs the following vars: +# TK_INCLUDES +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_PUBLIC_TK_HEADERS, [ + AC_MSG_CHECKING([for Tk public headers]) + + AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files.], with_tkinclude=${withval}) + + AC_CACHE_VAL(ac_cv_c_tkh, [ + # Use the value from --with-tkinclude, if it was given + + if test x"${with_tkinclude}" != x ; then + if test -f "${with_tkinclude}/tk.h" ; then + ac_cv_c_tkh=${with_tkinclude} + else + AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h]) + fi + else + # Check order: pkg --prefix location, Tcl's --prefix location, + # directory of tclConfig.sh, and Tcl source directory. + # Looking in the source dir is not ideal, but OK. + + eval "temp_includedir=${includedir}" + list="`ls -d ${temp_includedir} 2>/dev/null` \ + `ls -d ${TK_PREFIX}/include 2>/dev/null` \ + `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ + `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \ + `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`" + if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then + list="$list /usr/local/include /usr/include" + fi + for i in $list ; do + if test -f "$i/tk.h" ; then + ac_cv_c_tkh=$i + break + fi + done + fi + ]) + + # Print a message based on how we determined the include path + + if test x"${ac_cv_c_tkh}" = x ; then + AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude]) + else + AC_MSG_RESULT([${ac_cv_c_tkh}]) + fi + + # Convert to a native path and substitute into the output files. + + INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}` + + TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" + + AC_SUBST(TK_INCLUDES) + + if test "${TEA_PLATFORM}" = "windows" ; then + # On Windows, we need the X compat headers + AC_MSG_CHECKING([for X11 header files]) + if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then + INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`" + TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" + AC_SUBST(TK_XINCLUDES) + fi + AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}]) + fi +]) + +#------------------------------------------------------------------------ +# TEA_PROG_TCLSH +# Locate a tclsh shell in the following directories: +# ${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin +# ${exec_prefix}/bin ${prefix}/bin +# ${PATH} +# +# Arguments +# none +# +# Results +# Subst's the following values: +# TCLSH_PROG +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_PROG_TCLSH, [ + AC_MSG_CHECKING([for tclsh]) + + AC_CACHE_VAL(ac_cv_path_tclsh, [ + if test "x${CELIB_DIR}" != "x" ; then + # If CELIB_DIR is defined, assume Windows/CE target is requested + # which means target tclsh cannot be run (cross-compile) + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + else + search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'` + fi + for dir in $search_path ; do + for j in `ls -r $dir/tclsh[[8-9]]*${EXEEXT} 2> /dev/null` \ + `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do + if test x"$ac_cv_path_tclsh" = x ; then + if test -f "$j" ; then + ac_cv_path_tclsh=$j + break + fi + fi + done + done + ]) + + if test -f "$ac_cv_path_tclsh" ; then + TCLSH_PROG=$ac_cv_path_tclsh + AC_MSG_RESULT([$TCLSH_PROG]) + else + AC_MSG_ERROR([No tclsh found in PATH: $search_path]) + fi + AC_SUBST(TCLSH_PROG) +]) + +#------------------------------------------------------------------------ +# TEA_PROG_WISH +# Locate a wish shell in the following directories: +# ${TK_BIN_DIR} ${TK_BIN_DIR}/../bin +# ${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin +# ${exec_prefix}/bin ${prefix}/bin +# ${PATH} +# +# Arguments +# none +# +# Results +# Subst's the following values: +# WISH_PROG +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_PROG_WISH, [ + AC_MSG_CHECKING([for wish]) + + AC_CACHE_VAL(ac_cv_path_wish, [ + if test "x${CELIB_DIR}" != "x" ; then + # If CELIB_DIR is defined, assume Windows/CE target is requested + # which means target wish cannot be run (cross-compile) + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + else + search_path=`echo ${TK_BIN_DIR}:${TK_BIN_DIR}/../bin:${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'` + fi + for dir in $search_path ; do + for j in `ls -r $dir/wish[[8-9]]*${EXEEXT} 2> /dev/null` \ + `ls -r $dir/wish*${EXEEXT} 2> /dev/null` ; do + if test x"$ac_cv_path_wish" = x ; then + if test -f "$j" ; then + ac_cv_path_wish=$j + break + fi + fi + done + done + ]) + + if test -f "$ac_cv_path_wish" ; then + WISH_PROG=$ac_cv_path_wish + AC_MSG_RESULT([$WISH_PROG]) + else + AC_MSG_ERROR([No wish found in PATH: $search_path]) + fi + AC_SUBST(WISH_PROG) +]) + +#------------------------------------------------------------------------ +# TEA_PATH_CONFIG -- +# +# Locate the ${1}Config.sh file and perform a sanity check on +# the ${1} compile flags. These are used by packages like +# [incr Tk] that load *Config.sh files from more than Tcl and Tk. +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --with-$1=... +# +# Defines the following vars: +# $1_BIN_DIR Full path to the directory containing +# the $1Config.sh file +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_PATH_CONFIG, [ + # + # Ok, lets find the $1 configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-$1 + # + + if test x"${no_$1}" = x ; then + # we reset no_$1 in case something fails here + no_$1=true + AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval}) + AC_MSG_CHECKING([for $1 configuration]) + AC_CACHE_VAL(ac_cv_c_$1config,[ + + # First check to see if --with-$1 was specified. + if test x"${with_$1config}" != x ; then + if test -f "${with_$1config}/$1Config.sh" ; then + ac_cv_c_$1config=`(cd ${with_$1config}; pwd)` + else + AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh]) + fi + fi + + # then check for a private $1 installation + if test x"${ac_cv_c_$1config}" = x ; then + for i in \ + ../$1 \ + `ls -dr ../$1[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../$1 \ + `ls -dr ../../$1[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../../$1 \ + `ls -dr ../../../$1[[8-9]].[[0-9]]* 2>/dev/null` \ + ${srcdir}/../$1 \ + `ls -dr ${srcdir}/../$1[[8-9]].[[0-9]]* 2>/dev/null` \ + ; do + if test -f "$i/$1Config.sh" ; then + ac_cv_c_$1config=`(cd $i; pwd)` + break + fi + if test -f "$i/unix/$1Config.sh" ; then + ac_cv_c_$1config=`(cd $i/unix; pwd)` + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_$1config}" = x ; then + for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ + `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do + if test -f "$i/$1Config.sh" ; then + ac_cv_c_$1config=`(cd $i; pwd)` + break + fi + done + fi + ]) + + if test x"${ac_cv_c_$1config}" = x ; then + $1_BIN_DIR="# no $1 configs found" + AC_MSG_WARN("Cannot find $1 configuration definitions") + exit 0 + else + no_$1= + $1_BIN_DIR=${ac_cv_c_$1config} + AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh]) + fi + fi +]) + +#------------------------------------------------------------------------ +# TEA_LOAD_CONFIG -- +# +# Load the $1Config.sh file +# +# Arguments: +# +# Requires the following vars to be set: +# $1_BIN_DIR +# +# Results: +# +# Subst the following vars: +# $1_SRC_DIR +# $1_LIB_FILE +# $1_LIB_SPEC +# +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_LOAD_CONFIG, [ + AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh]) + + if test -f "${$1_BIN_DIR}/$1Config.sh" ; then + AC_MSG_RESULT([loading]) + . ${$1_BIN_DIR}/$1Config.sh + else + AC_MSG_RESULT([file not found]) + fi + + # + # If the $1_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable $1_LIB_SPEC will be set to the value + # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC + # instead of $1_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + # + + if test -f ${$1_BIN_DIR}/Makefile ; then + AC_MSG_WARN([Found Makefile - using build library specs for $1]) + $1_LIB_SPEC=${$1_BUILD_LIB_SPEC} + $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC} + $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH} + fi + + AC_SUBST($1_VERSION) + AC_SUBST($1_SRC_DIR) + + AC_SUBST($1_LIB_FILE) + AC_SUBST($1_LIB_SPEC) + + AC_SUBST($1_STUB_LIB_FILE) + AC_SUBST($1_STUB_LIB_SPEC) + AC_SUBST($1_STUB_LIB_PATH) +]) + +#------------------------------------------------------------------------ +# TEA_PATH_CELIB -- +# +# Locate Keuchel's celib emulation layer for targeting Win/CE +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --with-celib=... +# +# Defines the following vars: +# CELIB_DIR Full path to the directory containing +# the include and platform lib files +#------------------------------------------------------------------------ + +AC_DEFUN(TEA_PATH_CELIB, [ + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-celib + + if test x"${no_celib}" = x ; then + # we reset no_celib in case something fails here + no_celib=true + AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], with_celibconfig=${withval}) + AC_MSG_CHECKING([for Windows/CE celib directory]) + AC_CACHE_VAL(ac_cv_c_celibconfig,[ + # First check to see if --with-celibconfig was specified. + if test x"${with_celibconfig}" != x ; then + if test -d "${with_celibconfig}/inc" ; then + ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)` + else + AC_MSG_ERROR([${with_celibconfig} directory doesn't contain inc directory]) + fi + fi + + # then check for a celib library + if test x"${ac_cv_c_celibconfig}" = x ; then + for i in \ + ../celib-palm-3.0 \ + ../celib \ + ../../celib-palm-3.0 \ + ../../celib \ + `ls -dr ../celib-*3.[[0-9]]* 2>/dev/null` \ + ${srcdir}/../celib-palm-3.0 \ + ${srcdir}/../celib \ + `ls -dr ${srcdir}/../celib-*3.[[0-9]]* 2>/dev/null` \ + ; do + if test -d "$i/inc" ; then + ac_cv_c_celibconfig=`(cd $i; pwd)` + break + fi + done + fi + ]) + if test x"${ac_cv_c_celibconfig}" = x ; then + CELIB_DIR="# no Celib configs found" + AC_MSG_ERROR([Cannot find celib support library directory]) + else + no_celib= + CELIB_DIR=${ac_cv_c_celibconfig} + AC_MSG_RESULT([found $CELIB_DIR]) + fi + fi +]) Index: xotcl/tests/UNIVERSAL.test =================================================================== diff -u --- xotcl/tests/UNIVERSAL.test (revision 0) +++ xotcl/tests/UNIVERSAL.test (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,47 @@ +# $Id $ +#if {[set ::tcl_platform(platform)] == "windows"} {lappend auto_path .} + +package require XOTcl; namespace import -force xotcl::* +set pkgdir [file dir [info script]]/.. +lappend auto_path $pkgdir +package require xotcl::test + +set tclsh [info nameofexecutable] +set dir [file dir [info script]] +set univApps $dir/../apps/actiweb/univ + +set startCmd "$tclsh $univApps/UNIVERSAL.xotcl \ + -instanceFile $univApps/UNIVERSAL.rdf \ + -cssFile UNIVERSAL.css \ + -root $dir/../apps/actiweb/univ \ + -pkgdir $pkgdir" +#puts stderr "starting $startCmd" +set PIPE [open "|$startCmd"] + +package require xotcl::comm::httpAccess +proc printError msg {puts stderr !!!$msg!!!} + +Class T -superclass Test -parameter { + {count 1} + {errorReport { + puts "\tcontent-length: \[r0::sink set contentLength\]\n\ + \tstatus-code: \[\[r0 set token\] set responseCode\]\n\[r0 getContent]" + }}} + +T new -msg "Load homepage frame von univ ... " \ + -setResult {expr [r0::sink set contentLength] == 358} \ + -cmd [list SimpleRequest r0 -url http://localhost:8095/ ] +T new -msg "Load Catalog ... " \ + -setResult {expr [r0::sink set contentLength] == 1744} \ + -cmd [list SimpleRequest r0 -url http://localhost:8095/univ+catalog ] +T new -msg "Detail Page ... " \ + -setResult {expr [r0::sink set contentLength] == 2327} \ + -cmd [list SimpleRequest r0 -url http://localhost:8095/univ+details+http://nm.wu-wien.ac.at/Lehre/oo1/] +T new -msg "terminate" -cmd [list SimpleRequest r0 -url http://localhost:8095/receiver::exit] \ + -setResult {set x 1} \ + -post {catch {close $::PIPE}; exit} + +after 1000 {Test run} +vwait forever + + Index: xotcl/tests/actiweb.test =================================================================== diff -u --- xotcl/tests/actiweb.test (revision 0) +++ xotcl/tests/actiweb.test (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,83 @@ +# -*- Mode: tcl -*- +# $Id: actiweb.test,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# regression test for actiweb examples +#if {[set ::tcl_platform(platform)] == "windows"} { +# lappend auto_path . +#} +package require XOTcl; namespace import -force ::xotcl::* +set pkgDir [file dirname [info script]]/.. +lappend auto_path $pkgDir +package require xotcl::test +#package require xotcl::package; package verbose 1 +package require xotcl::comm::httpAccess +#package require xotcl::trace + +set tclsh [info nameofexecutable] +set dir [file dir [info script]] +set actiwebApps $dir/../apps/actiweb + +# remove persitent vars to get reproducible behavior +catch [file delete -force receiver] +proc terminate {} { + catch [file delete -force receiver] + exit +} + +puts "$tclsh ${actiwebApps}/Counter.xotcl" +set PIPE1 [open "| $tclsh ${actiwebApps}/Counter.xotcl -pkgdir $pkgDir"] +set PIPE2 [open "| $tclsh ${actiwebApps}/Counter2.xotcl -pkgdir $pkgDir"] +set PIPE3 [open "| $tclsh ${actiwebApps}/Counter3.xotcl -pkgdir $pkgDir"] +set PIPE4 [open "| $tclsh ${actiwebApps}/Counter4.xotcl -pkgdir $pkgDir"] +set PIPE5 [open "| $tclsh ${actiwebApps}/MC.xotcl -pkgdir $pkgDir"] + +proc printError msg {puts stderr !!!$msg!!!} + +Class T -superclass Test -parameter { + {count 1} + {errorReport { + puts "\tcontent-length: \[r0::sink set contentLength\]\n\ + \tstatus-code: \[\[r0 set token\] set responseCode\]" + }}} + + +T new -msg "Trying Counter.xotcl ... " \ + -setResult {regexp {^The value in counter-1.html is now: 0} [r0::sink set d]} \ + -cmd [list SimpleRequest r0 -url http://localhost:8090/counter-1.html] +T new -msg "terminate Counter" -setResult {set x 1} \ + -cmd [list SimpleRequest r0 -url http://localhost:8090/receiver::exit] \ + -post {catch {close $::PIPE1}} + +T new -msg "Trying Counter2.xotcl ... " \ + -setResult {r0 getContentLength} \ + -expected 294 \ + -cmd [list SimpleRequest r0 -url http://localhost:8091/web-c1] +T new -msg "terminate Counter1" -setResult {set x 1} \ + -cmd [list SimpleRequest r0 -url http://localhost:8091/receiver::exit] \ + -post {catch {close $::PIPE2}} + +T new -msg "Trying Counter3.xotcl ... " \ + -setResult {r0 getContentLength} \ + -expected 122 \ + -cmd [list SimpleRequest r0 -url http://localhost:8093/c1] +T new -msg "terminate Counter3" -setResult {set x 1} \ + -cmd [list SimpleRequest r0 -url http://localhost:8093/receiver::exit] \ + -post {catch {close $::PIPE3}} + +T new -msg "Trying Counter4.xotcl (a) ... " \ + -setResult {r0 getContentLength} \ + -expected 126 \ + -cmd [list SimpleRequest r0 -url http://localhost:8094/wc1] +T new -msg "terminate Counter4" -setResult {set x 1} \ + -cmd [list SimpleRequest r0 -url http://localhost:8094/receiver::exit] \ + -post {catch {close $::PIPE4}} + +T new -msg "Trying MC.xotcl ... " \ + -setResult {r0 getContentLength} \ + -expected 1823 \ + -cmd [list SimpleRequest r0 -url http://localhost:8092/Gustaf.html ] +T new -msg "terminate MC" -setResult {set x 1} \ + -cmd [list SimpleRequest r0 -url http://localhost:8092/receiver::exit] \ + -post {catch {close $::PIPE5}; exit} + +after 1500 {Test run} +catch {vwait forever} Index: xotcl/tests/persistence.test =================================================================== diff -u --- xotcl/tests/persistence.test (revision 0) +++ xotcl/tests/persistence.test (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,401 @@ +#!../../src/xotclsh +# -*- Tcl -*- $Id: persistence.test,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package require XOTcl; namespace import -force xotcl::* + +@ @File { + description { + Several tests for persistent stores and performance comparison. + The "-bigdb" command line option additionally starts a (longer) + big database test. The test automatically detects which storages + are avaiable. + } +} +array set opt {-bigdb 0 -bench 0} +array set opt $argv + +lappend auto_path [file dir [info script]]/.. + +#set auto_path ".. ../../src $auto_path" +#package require xotcl::package;package verbose 1 + +set storageCandidates {Sdbm Jufgdbm Mem Gdbm TextFile} +set storageCandidates {Sdbm Mem Gdbm TextFile} +#set storageCandidates {Gdbm} +set stores "" + +foreach store $storageCandidates { + if {![catch {package require xotcl::store::[string tolower $store]}]} { + lappend stores $store + } else { + puts "FAILED: package require xotcl::store::[string tolower $store]" + } +} + +puts "\nPersistence Test\n\nUsing the following Storages: \n $stores\n" + +set ::tests { + testStorageFeatures + Stores + Traverse + Store_Fetch_List + Store_Fetch_List_Same_Key + SimplePersistentObjects + LotsOfObjects +} + +if {$opt(-bigdb)} { + lappend ::tests bigdb + puts " ... bigdb test enabled.\n" +} else { + puts " ... bigdb test disabled.\n" +} +if {$opt(-bench)} { + set ::runs 10 + # don't use number >= 1000 because of SDBMs's char key length with the + # test SimplePersistentObjects + # don't use number > 272 because of SDBMs's key pairs max length of 1024 + # FIX THIS in FUTURE RELEASES!! + set ::iterations 272 +} else { + set ::runs 1 + set ::iterations 10 +} + +#package require xotcl::store::trace +#Storage=Gdbm instmixin TraceStorage + + +package require xotcl::store::persistence + +proc ::errorCheck {got expected msg} { + if {$got != $expected} { + puts stderr "FAILED: $msg\nGot: $got\nExpected: $expected" + exit -1 + } +} +proc ::errorCheckList {got expected msg} { + if {[lsort $got] != [lsort $expected]} { + puts stderr "FAILED: $msg\nGot: $got\nExpected: $expected" + exit -1 + } +} + +Class PersistenceTest + +@ Class PersistenceTest + +PersistenceTest instproc init args { + next +} + +PersistenceTest instproc testStorageFeatures {store} { + Storage=$store s + s open testDB + s set "{::a::s x} {x}" {a b c d} + s set "::a::s x" {{r t} a b c r} + s set ::a::t 7 + set result [s set ::a::t] + errorCheck $result 7 "Failed fetch ::a::t" + set result [s set "{::a::s x} {x}"] + errorCheck $result "a b c d" "Failed fetch {::a::s x} {x}" + set result [s set "::a::s x"] + errorCheck $result "{r t} a b c r" "Failed fetch ::a::s x" + + errorCheckList [s names] "{::a::s x} {{::a::s x} {x}} ::a::t" "Failed list -- all" + + set keys [list [s firstkey]] + while {[set nk [s nextkey]] != ""} {lappend keys $nk} + set keys [lappend keys [s firstkey]] + while {[set nk [s nextkey]] != ""} {lappend keys $nk} + + errorCheckList $keys "{{::a::s x} {x}} {::a::s x} ::a::t {{::a::s x} {x}} {::a::s x} ::a::t" "First/next key traversal failed." + + s unset "{::a::s x} {x}" + errorCheckList [s names] "{::a::s x} ::a::t" "Failed delete {::a::s x} {x}" + s unset "::a::s x" + errorCheckList [s names] "::a::t" "Failed delete ::a::s x" + + s close + s destroy + return " PASSED with $store" +} + +PersistenceTest instproc Traverse { store} { + Storage=$store s + s open testDB + for {set i 0} {$i < $::iterations} {incr i} { + set key "::a${i}" + set value "An value for the test $i $i $i\0" + s set $key $value + lappend resultKeys $key + lappend resultValues $value + } + + set keys [list [s firstkey]] + set values [list [s set $keys]] + while {[set nk [s nextkey]] != ""} { + lappend keys $nk + lappend values [s set $nk] + } + errorCheckList $keys $resultKeys "Failed Traverse keys" + errorCheckList $values $resultValues "Failed Traverse values" + s close + s destroy + return " PASSED with $store" +} + +PersistenceTest instproc Stores {store} { + Storage=$store s + s open testDB + for {set i 0} {$i < $::iterations} {incr i} { + s set "::a${i}" "An value for the test $i $i $i" + } + set list [s names] + errorCheck [llength $list] $::iterations "Failed Stores $::iterations -- Wrong \# of stored elements" + s close + s destroy + return " PASSED with $store" +} + +PersistenceTest instproc Store_Fetch_List {store} { + Storage=$store s + s open testDB + for {set i 0} {$i < $::iterations} {incr i} { + set key "::a${i}" + set value "An value for the test $i $i $i" + s set $key $value + set list [s names] + errorCheck [llength $list] [expr $i +1] "Failed Store_Fetch_List $::iterations -- Wrong \# of stored elements" + set result [s set $key] + errorCheck $result $value "Failed fetch Store_Fetch_List current key" + set result [s set "::a0"] + errorCheck $result "An value for the test 0 0 0" "Failed fetch Store_Fetch_List first key" + } + s close + s destroy + return " PASSED with $store" +} + +PersistenceTest instproc Store_Fetch_List_Same_Key {store} { + Storage=$store s + s open testDB + set key "Always the same key" + for {set i 0} {$i < $::iterations} {incr i} { + set value "An value for the test $i $i $i" + s set $key $value + set list [s names] + errorCheck [llength $list] 1 "Failed Store_Fetch_List_Same_Key $::iterations -- Wrong \# of stored elements" + set result [s set $key] + errorCheck $result $value "Failed fetch Store_Fetch_List_Same_Key current key" + } + + s close + s destroy + return " PASSED with $store" +} + +# +# tests dependent on the Persistence package +# + +PersistenceTest instproc SimplePersistentObjects {store} { + set ox 1; set oy 1; set py 1; set px 1; + set oza 1; set ozb 1; set onames [list a b] + set pza 1; set pzb 1; set pnames [list a b] + + + + #puts stderr mixin=[pmgr info mixin] + #pmgr mixin [concat TraceStorage [pmgr info mixin]] + + for {set i 0} {$i < $::iterations} {incr i} { + PersistenceMgr pmgr -dirName . \ + -fileName testDB -dbPackage $store + # Two example objects with variables set to default values + Object o + o set x 1 + o set y 1 + o set threeLines "a +b +c" + + o array set z {a 1 b 1} + Object p + p set x 1 + p set y 1 + p array set z {a 1 b 1} + + o mixin Persistent=Eager + p mixin Persistent=Lazy + # for the mem storage Lazy Persistence makes not much sense + if {$store == "Mem"} {p mixin Persistent=Eager} + + o persistenceMgr pmgr + p persistenceMgr pmgr + o persistent {x y z threeLines} + p persistent {x y z} + + o incr x 2 + incr ox 2 + o append y 1 + append oy 1 + p incr x 3 + incr px 3 + p append y 2 + append py 2 + + o incr z(a) 2 + incr oza 2 + o append z(b) 1 + append ozb 1 + o set z($i) 5 + lappend onames $i + + p incr z(a) 2 + incr pza 2 + p append z(b) 1 + append pzb 1 + p set z($i) 5 + lappend pnames $i + + errorCheck [o set x] $ox "Persistence: o->x Failed" + errorCheck [o set y] $oy "Persistence: o->y Failed" + errorCheck [o set z(a)] $oza "Persistence: o->z(a) Failed" + errorCheck [o set z(b)] $ozb "Persistence: o->z(b) Failed" + errorCheckList [o array names z] $onames "Array indizes got lost - o -" + errorCheck [p set x] $px "Persistence: p->x Failed" + errorCheck [p set y] $py "Persistence: p->y Failed" + errorCheckList [o array names z] $onames "Array indizes got lost" + errorCheck [p set z(a)] $pza "Persistence: p->z(a) Failed" + errorCheck [p set z(b)] $pzb "Persistence: p->z(b) Failed" + errorCheckList [p array names z] $pnames "Array indizes got lost - p -" + + errorCheck [o set threeLines] {a +b +c} "Three Lines Failed" + + o destroy + p destroy + pmgr destroy + } + + #errorCheck $ox 21 "Persistence: o->x End Result Failed" + #errorCheck $oy 11111111111 "Persistence: o->y End Result Failed" + #errorCheck $px 31 "Persistence: p->x End Result Failed" + #errorCheck $py 12222222222 "Persistence: p->y End Result Failed" + + return " PASSED with $store" +} + +PersistenceTest instproc LotsOfObjects {store} { + set secondLoopMax 1 + PersistenceMgr pmgr -dirName . \ + -fileName testDB -dbPackage $store + for {set i 0} {$i < $::iterations} {incr i} { + # we create 10 objects per iteration + for {set j 0} {$j < $secondLoopMax} {incr j} { + Object iHaveaVeryLongName${i}${j} + Object iHaveaVeryLongName${i}${j}::meToo${i}${j} + iHaveaVeryLongName${i}${j} mixin Persistent=Eager + iHaveaVeryLongName${i}${j} persistenceMgr pmgr + iHaveaVeryLongName${i}${j}::meToo${i}${j} mixin Persistent=Eager + iHaveaVeryLongName${i}${j}::meToo${i}${j} persistenceMgr pmgr + foreach var {a b c d e f g h i j k l m n o p} { + iHaveaVeryLongName${i}${j} set $var " some useless test ...... + with spaces and lines breaks iHaveaVeryLongName$i $var $i + " + iHaveaVeryLongName${i}${j} persistent $var + iHaveaVeryLongName${i}${j}::meToo${i}${j} set $var " some useless test ...... + with spaces and lines breaks iHaveaVeryLongName$i $var $i + " + iHaveaVeryLongName${i}${j}::meToo${i}${j} persistent $var + } + } + } + pmgr destroy + return " PASSED with $store" +} + +PersistenceTest instproc random modulo { ;### random number generator + [self] instvar seed + set seed [expr {($seed*12731+34197) % 21473}] + return [expr {$seed % $modulo}] +} + +PersistenceTest instproc bigdb {store} { + Storage=$store s + s open testDB + set max 100000 + [self] set seed 4711 + for {set i 0} {$i < $max} {incr i} { + s set $i $i + } + [self] set seed 4711 + for {set i 0} {$i < $max} {incr i} { + set key [[self] random $max] + set r [s set $key] + errorCheck $r $key "Failed bigdb $::iterations -- Wrong result $r instead of $key" + } + s close + s destroy + return " PASSED with $store" +} + + + +PersistenceTest instproc runOnce {} { + eval file delete -force testDB [glob -nocomplain testDB*] + catch {xotcl::memStoragePool remove testDB} + foreach test $::tests { + puts "[[self] set run]: $test $::iterations" + foreach s $::stores { + set t [time {set result [[self] $test $s]}] + [self] report $test $s $t $result + eval file delete -force testDB [glob -nocomplain testDB*] + catch {xotcl::memStoragePool remove testDB} + } + } +} +PersistenceTest instproc run {runs} { + [self] instvar run + for {set run 1} {$run<=$runs} {incr run} { + pt runOnce + } +} + +PersistenceTest instproc report {test store time result} { + if {![regexp {^(-?[0-9]+) +(.*)$} $time _ ms string]} { + puts stderr "time <$time> could not be parsed" + return + } + set key bench($test,$store) + set better " " + if {[[self] exists $key]} { + if {[[self] set $key] > $ms} { + [self] set $key $ms + set better "+" + } + } else { + [self] set $key $ms + } + puts "[[self] set run]: [format %-22s $result]\ + $better[format %10d $ms] $string" +} + +PersistenceTest instproc table {} { + set f [open "persistent.cvs" w] + foreach test $::tests { + set values "" + foreach store $::stores { + lappend values [[self] set bench($test,$store)] + } + puts "[format %-30s $test];[join $values {;}]" + puts $f "[format %-30s $test];[join $values {;}]" + } + close $f +} + +PersistenceTest pt -run $::runs +if {$opt(-bench)} { + pt table +} Index: xotcl/tests/speedtest.xotcl =================================================================== diff -u --- xotcl/tests/speedtest.xotcl (revision 0) +++ xotcl/tests/speedtest.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,390 @@ +#memory trace on +# $Id: speedtest.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package require XOTcl +namespace import -force xotcl::* +lappend auto_path [file dirname [info script]]/.. +package require xotcl::test + +@ @File {description { + Regression and speed test for various ways to achieve a similar + behaviour. + } +} +Class M1; Class M2 +Class C -parameter {{p 99} {q 98} r} +C instproc f args {next} +C instproc init args { + my instvar n v + for {set i 1} {$i<1000} {incr i} {set n($i) 1} + for {set i 1} {$i<1000} {incr i} {Object [self]::$i} + set v 1 +} + +C instproc mixinappend m { + my mixin [concat [my info mixin] $m] + my info mixin +} +C instproc ma m { + set mix [my info mixin] + my mixin [lappend mix $m] + my info mixin +} + +C instproc existsViaInstvar {} { + my instvar v + info exists v +} +C instproc existsViaMyInstvar {} { + my instvar v + info exists v +} +C instproc existsViaExistsMethod {} { + my exists v +} +C instproc existsViaMyExistsMethod {} { + my exists v +} +C instproc notExistsViaInstvar {} { + my instvar xxx + info exists xxx +} +C instproc notExistsViaExistsMethod {} { + my exists xxx +} + +C instproc existsAndReturnValue1 {} { + if {[my exists v]} { + my set v + } +} +C instproc existsAndReturnValue3 {} { + if {[my exists v]} { + set x [my set v] + } +} + +C instproc setViaInstvar x { + my instvar v + set v $x +} +C instproc setViaSetMethod x { + my set v $x +} +C instproc setViaParameter x { + my r $x +} +C instproc testAndSetViaInstvar x { + my instvar v + if {[info exists v]} {set v $x} +} +C instproc testAndSetViaSetMethod x { + if {[my info vars v] != ""} {my set v $x} +} + +C instproc readViaInstvar {} { + my instvar p + set p +} +C instproc readViaSetMethod {} { + my set p +} +C instproc readViaSetMethodNoSelf {} { + ::c set p +} +C instproc readViaParameter {} { + my p +} + +C instproc readTwiceViaInstvar {} { + my instvar p + set p + set p +} +C instproc readTwiceViaSetMethod {} { + my set p + my set p +} +C instproc readTwiceViaSetMethodNoSelf {} { + ::c set p + ::c set p +} +C instproc readTwiceViaParameter {} { + my p + my p +} +C instproc readTwovarsViaInstvar {} { + my instvar p q + set p + set q +} +C instproc readTwovarsViaSetMethod {} { + my set p + my set q +} +C instproc readTwovarsViaSetMethodNoSelf {} { + ::c set p + ::c set q +} +C instproc readTwovarsViaParameter {} { + my p + my q +} + +C instproc instvarAlias {} { + my instvar {a b} + set b 1 + my exists a +} + + +C instproc explicitReturn {} { + return [set i 1] +} +C instproc implicitReturn {} { + set i 1 +} +C instproc explicitReturnFromVar {} { + set i 1 + return $i +} +C instproc implicitReturnFromVar {} { + set i 1 + set i +} + +C instproc childNodeNamespace {} { + Object [self]::13 +} +C instproc childNodeNamespaceCreate {} { + Object create [self]::13 +} +C instproc createVolatileRc {} { + Object new -volatile + return 2 +} + + +C c +Class D -superclass C +D instproc init args {} +D d + + + + + + +Test new -cmd {d istype D} -expected 1 + +Test new -cmd {c setViaInstvar 100} -expected 100 +Test new -cmd {c setViaSetMethod 100} -expected 100 +Test new -cmd {c setViaParameter 100} -expected 100 + +Test new -cmd {c existsViaInstvar} +Test new -cmd {c existsViaMyInstvar} +Test new -cmd {c existsViaExistsMethod} +Test new -cmd {c existsViaMyExistsMethod} +Test new -cmd {c exists v} +Test new -cmd {c notExistsViaInstvar} -expected 0 +Test new -cmd {c notExistsViaExistsMethod} -expected 0 +Test new -cmd {c exists xxx} -expected 0 + +Test new -cmd {c existsAndReturnValue1} -expected 100 +Test new -cmd {c existsAndReturnValue3} -expected 100 + +Test new -cmd {c testAndSetViaInstvar 100} -expected 100 +Test new -cmd {c testAndSetViaSetMethod 100} -expected 100 + +Test new -cmd {c readViaInstvar} -expected 99 +Test new -cmd {c readViaSetMethod} -expected 99 +Test new -cmd {c readViaParameter} -expected 99 +Test new -cmd {c readViaSetMethodNoSelf} -expected 99 + +Test new -cmd {c readTwiceViaInstvar} -expected 99 +Test new -cmd {c readTwiceViaSetMethod} -expected 99 +Test new -cmd {c readTwiceViaParameter} -expected 99 +Test new -cmd {c readTwiceViaSetMethodNoSelf} -expected 99 + +Test new -cmd {c readTwovarsViaInstvar} -expected 98 +Test new -cmd {c readTwovarsViaSetMethod} -expected 98 +Test new -cmd {c readTwovarsViaParameter} -expected 98 +Test new -cmd {c readTwovarsViaSetMethodNoSelf} -expected 98 + +Test new -cmd {c instvarAlias} + +Test new -cmd {c incr v} -post {c set v 1} -expected 101 +Test new -cmd {c unset v; set r [c exists v]; c set v 1; set r} -expected 0 + +Test new -cmd {c explicitReturn} +Test new -cmd {c implicitReturn} +Test new -cmd {c explicitReturnFromVar} +Test new -cmd {c implicitReturnFromVar} + +Test new -cmd {c childNodeNamespace} -expected ::c::13 +Test new -cmd {c childNodeNamespaceCreate} -expected ::c::13 +Test new -cmd {c createVolatileRc} -expected 2 + +Test new -cmd {Object new -volatile} -expected ::xotcl::__\#F9 -count 2000 \ + -post {foreach o [Object info instances ::xotcl::__*] {$o destroy}} +Test new -cmd {Object new} -expected ::xotcl::__\#lQ -count 2000 \ + -post {foreach o [Object info instances ::xotcl::__*] {$o destroy}} +Test new -cmd {Object new -childof o} -expected ::o::__\#0Hh \ + -pre {Object o} -post {o destroy} + +Test new -count 1000 -pre {::set ::count 0} \ + -cmd {Object create [incr ::count]} \ + -expected ::1 \ + -post {::unset ::count} +Test new -count 1000 -pre {::set ::count 0} \ + -cmd {[incr ::count] destroy} \ + -post {::unset ::count} \ + -expected "" +Test new -cmd {Object create x} -expected ::x +Test new -cmd {Object create x -set a -1 -set b ,, -set c a--} \ + -expected ::x +Test new -cmd {expr {[c array names n 500] != ""}} +Test new -cmd {info exists c::n(500)} +Test new -cmd {c exists n(500)} + +Test new -cmd {llength [c info children]} -expected 999 +Test new -cmd {c info children ::c::500} -expected ::c::500 +if {[info exists xotcl_version]} { + Test new -cmd {llength [Object info instances]} -expected 1001 +} else { + Test new -cmd {llength [Object info instances]} -expected 1003 +} + +Test new -cmd {Object info instances ::c::500} -expected ::c::500 + +Test new -count 100 -pre {set ::c::l ""} \ + -cmd {lappend ::c::l 1} \ + -post {c unset l} + +Test new \ + -count 100 \ + -cmd {c mixinappend M1} \ + -expected ::M1 \ + -post {c mixin ""} + +Test new \ + -count 100 \ + -cmd {c ma M1} \ + -expected ::M1 \ + -post {c mixin ""} + +Test new \ + -count 100 \ + -cmd {c mixinappend M1; c mixinappend M2} \ + -expected {::M1 ::M2} \ + -post {c mixin ""} + +Test new \ + -count 100 \ + -cmd {c ma M1; c ma M2} \ + -expected {::M1 ::M2} \ + -post {c mixin ""} + +Test new \ + -cmd {C instfilter f; C info instfilter} \ + -expected f \ + -post {C instfilter ""} + +Test new -pre {set s \#hallo} -cmd {string match "\#*" $s} +Test new -pre {set s \#hallo} -cmd {regexp {^\#} $s} +Test new -pre {set s \#hallo} -cmd {expr {[string first "\#" $s] == 0}} +Test new -pre {set s \#hallo} -cmd {expr {[string range $s 0 0] == "\#"}} + +Test new -pre {set s \#hallo} -cmd {regexp {^\#.*a} $s} +Test new -pre {set s \#hallo} -cmd {regexp {^\#.*a.*o} $s} +Test new -pre {set s \#hallo} -cmd {regexp {^\#.*a(.*)o} $s} +Test new -pre {set s \#hallo} -cmd {regexp {^\#.*a(.*)o} $s _} +Test new -pre {set s \#hallo} -cmd {regexp {^\#.*a(.*)o} $s _ out} + +Test new -msg {call proc of subobject directly} \ + -pre {C c2; C c2::o; c2::o proc f a {incr a}} \ + -cmd {c2::o::f 10} -expected 11 -count 5000 \ + -post {c2 destroy} +Test new -msg {call proc of subobject via dispatch} \ + -pre {C c2; C c2::o; c2::o proc f a {incr a}} \ + -cmd {c2::o f 10} -expected 11 -count 5000 \ + -post {c2 destroy} +Test new -msg {call proc of object and subobject via dispatch} \ + -pre {C c2; C c2::o; c2::o proc f a {incr a}} \ + -cmd {c2 o f 10} -expected 11 -count 5000 \ + -post {c2 destroy} + +Test new -msg {dispatch subobject directy via [self]} \ + -pre {C c2; C c2::o; c2::o proc f a {incr a}; c2 proc t a {[self]::o f $a}} \ + -cmd {c2 t 12} -expected 13 -count 5000 \ + -post {c2 destroy} +Test new -msg {dispatch subobject via my} \ + -pre {C c2; C c2::o; c2::o proc f a {incr a}; c2 proc t a {my o f $a}} \ + -cmd {c2 t 12} -expected 13 -count 5000 \ + -post {c2 destroy} + + +###### insttclcmd tests +set cnt 10000 +Test new -msg {call insttclcmd (append) and check created variable} \ + -pre {Object o} \ + -cmd {o append X 1; o exists X} -expected 1 \ + -post {o destroy} +Test new -msg {call tclcmd (regexep) and check created variable} \ + -pre {Object o; o tclcmd regexp} \ + -cmd {o regexp (a) a _ x; o exists x} -expected 1 -count $cnt \ + -post {o destroy} +set cnt 100000 +Test new -msg {call handcoded incr} \ + -pre {Class C; C create o; o set x 1} \ + -cmd {o incr x 77} -expected 78 -count $cnt \ + -post {o destroy} +Test new -msg {call incr via insttclcmd} \ + -pre {Class C; C insttclcmd ::incr; C create o; o set x 1} \ + -cmd {o incr x 77} -expected 78 -count $cnt \ + -post {o destroy} +Test new -msg {call incr via tclcmd} \ + -pre {Class C; C create o; o tclcmd ::incr; o set x 1} \ + -cmd {o incr x 77} -expected 78 -count $cnt \ + -post {o destroy} +set cnt 10000 +Test new -msg {call obj with namespace via tclcmd} \ + -pre {Object n; Object n::x; Object o; o tclcmd ::n::x} \ + -cmd {o x self} -expected ::n::x -count $cnt \ + -post {o destroy} +Test new -msg {call obj with namespace via insttclcmd} \ + -pre {Object n; Object n::x; Class C; C create o; C insttclcmd ::n::x} \ + -cmd {o x self} -expected ::n::x -count $cnt \ + -post {o destroy} +Test new -msg {call obj with namespace via insttclcmd and mixinclass} \ + -pre {Object n; Object n::x; Class M; M insttclcmd ::n::x; + Class C -instmixin M; C create o } \ + -cmd {o x self} -expected ::n::x -count $cnt \ + -post {o destroy} +Test new -msg {call obj with namespace via insttclcmd and next from proc} \ + -pre { + Object n; Object n::x; + Class C; C insttclcmd ::n::x; + C create o -proc x args {next} } \ + -cmd {o x self} -expected ::n::x -count $cnt \ + -post {o destroy} +Test new -msg {call obj with namespace via insttclcmd and next from instproc} \ + -pre { + Object n; Object n::x; + Class C -insttclcmd ::n::x; + Class D -superclass C -instproc x args {next}; + D create o } \ + -cmd {o x self} -expected ::n::x -count $cnt \ + -post {o destroy} +Test new -msg {call obj with namespace via mixin and insttclcmd and next} \ + -pre {Object n; Object n::x; + Class M -insttclcmd ::n::x; + Class N -superclass M -instproc x args {next}; + Class C -instmixin N; C create o} \ + -cmd {o x self} -expected ::n::x -count $cnt \ + -post {o destroy} + + +Test run; exit + + + Index: xotcl/tests/testo.xotcl =================================================================== diff -u --- xotcl/tests/testo.xotcl (revision 0) +++ xotcl/tests/testo.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,612 @@ +# $Id: testo.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# +# Copyright 1993 Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +package require XOTcl +namespace import -force xotcl::* + +@ @File {description { + This is a class which provides regression test objects + for the OTcl derived features of the XOTcl - Language. + This script is based upon the test.tcl script of the OTcl distribution + and adopted for XOTcl. + } +} +# +# a meta-class for test objects, and a class for test suites +# + +Class TestSuite +@ Class TestSuite + +Class TestClass -superclass Class +@ Class TestClass { + description { + A meta-class for test objects. + } +} + +# +# check basic argument dispatch and unknown +# + +TestSuite objectdispatch + +objectdispatch proc run {{n 50}} { + Object adispatch + + adispatch proc unknown {m args} {eval list [list $m] $args} + adispatch proc cycle {l n args} { + if {$l>=$n} then {return ok} + set i [llength $args] + foreach a $args { + if {$a != $i} then { + error "wrong order in arguments: $l $n $args" + } + incr i -1 + } + incr l + + set ukn [eval [list [self]] $args] + if {$ukn != $args} then { + error "wrong order in unknown: $ukns" + } + eval [list [self]] [list [self proc]] [list $l] [list $n] [list $l] $args + } + + if {[catch {adispatch cycle 1 $n 1} msg]} then { + error "FAILED [self]: cycle: $msg" + } + + return "PASSED [self]" +} + +# +# examples from the workshop paper +# + +TestSuite paperexamples + +paperexamples proc example1 {} { + Object astack + + astack set things {} + + astack proc put {thing} { + my instvar things + set things [concat [list $thing] $things] + return $thing + } + + astack proc get {} { + my instvar things + set top [lindex $things 0] + set things [lrange $things 1 end] + return $top + } + + astack put bagel + astack get + astack destroy +} + +paperexamples proc example2 {} { + Class Safety + + Safety instproc init {} { + next + my set count 0 + } + + Safety instproc put {thing} { + my instvar count + incr count + next $thing + } + + Safety instproc get {} { + my instvar count + if {$count == 0} then { return {empty!} } + incr count -1 + next + } + + Class Stack + + Stack instproc init {} { + next + my set things {} + } + + Stack instproc put {thing} { + my instvar things + set things [concat [list $thing] $things] + return $thing + } + + Stack instproc get {} { + my instvar things + set top [lindex $things 0] + set things [lrange $things 1 end] + return $top + } + + Class SafeStack -superclass {Safety Stack} + + SafeStack s + s put bagel + s get + s get + s destroy + + SafeStack destroy + Stack destroy + Safety destroy +} + +paperexamples proc run {} { + set msg {} + + if {[catch {my example1; my example2} msg] == "0"} then { + return "PASSED [self]" + } else { + error "FAILED [self]: $msg" + } +} + + +# +# create a graph of classes +# + +TestSuite classcreate + +classcreate proc factorgraph {{n 3600}} { + TestClass $n + + + for {set i [expr {$n/2}]} {$i>1} {incr i -1} { + if {($n % $i) == 0} then { + + # + # factors become subclasses, direct or indirect + # + + + if {[TestClass info instances $i] == ""} then { + my factorgraph $i + $i superclass $n + } elseif {[$i info superclass $n] == 0} then { + + $i superclass [concat [$i info superclass] $n] + } + } + } +} + +classcreate proc run {} { + set msg {} + if {[catch {my factorgraph} msg] == "0"} then { + return "PASSED [self]" + } else { + error "FAILED [self]: $msg" + } +} + + +# +# lookup superclasses and combine inherited methods +# + +TestSuite inheritance + +inheritance proc meshes {s l} { + set p -1 + foreach j $s { + set n [lsearch -exact $l $j] + if {$n == -1} then { + error "FAILED [self] - missing superclass" + } + if {$n <= $p} then { + error "FAILED [self] - misordered heritage: $s : $l" + } + set p $n + } +} + +inheritance proc superclass {} { + foreach i [TestClass info instances] { + set s [$i info superclass] + set h [$i info heritage] + + # + # superclasses should mesh with heritage + # + + my meshes $s $h + } +} + +inheritance proc combination {} { + foreach i [lsort [TestClass info instances]] { + # + # combination should mesh with heritage + # + + $i anumber + set obj [lrange [anumber combineforobj] 1 end] + set h [$i info heritage] + my meshes $obj $h + anumber destroy + + if {[$i info procs combineforclass] != ""} then { + set cls [lrange [$i combineforclass] 1 end] + my meshes $cls $h + } + } +} + +inheritance proc run {} { + + # + # add combine methods to "random" half of the graph + # + + set t [TestClass info instances] + for {set i 0} {$i < [llength $t]} {incr i 2} { + set o [lindex $t $i] + $o instproc combineforobj {} { + return [concat [list [self class]] [next]] + } + $o proc combineforclass {} { + return [concat [list [self class]] [next]] + } + } + + # + # and to Object as a fallback + # + + Object instproc combineforobj {} { + return [concat [list [self class]] [next]] + } + Object proc combineforclass {} { + return [concat [list [self class]] [next]] + } + + my superclass + my combination + + return "PASSED [self]" +} + + +# +# destroy graph of classes +# + +TestSuite classdestroy + +classdestroy proc run {} { + + # + # remove half of the graph at a time + # + + TestClass instproc destroy {} { + global TCdestroy + set TCdestroy [self] + next + } + while {[TestClass info instances] != ""} { + set t [TestClass info instances] + for {set i 0} {$i < [llength $t]} {incr i} { + set o [lindex $t $i] + # + # quarter dies directly, quarter indirectly, quarter renamed + # + + if {($i % 2) == 0} then { + global TCdestroy + set sb [$o info subclass] + + if {[info tclversion] >= 7.4 && ($i % 4) == 0} then { + $o move "" + } else { + $o destroy + } + if {[catch {set TCdestroy}] || $TCdestroy != $o} then { + error "FAILED [self] - destroy instproc not run for $o" + } + if {[info commands $o] != ""} then { + error "FAILED [self] - $o not removed from interpreter" + } + unset TCdestroy + + # + # but everyone must still have a superclass + # + foreach j $sb { + if {[$j info superclass] == ""} then { + $j superclass Object + } + } + } elseif {[info tclversion] >= 7.4 && ($i % 3) == 0} then { + $o move $o.$i + } + + } + + inheritance superclass + inheritance combination + } + + return "PASSED [self]" +} + + +TestSuite objectinits + +objectinits proc prepare {n} { + + # + # head of a chain of classes that do add inits + # + + TestClass 0 + 0 instproc init {args} { + eval next $args + my set order {} + } + + # + # and the rest + # + + for {set i 1} {$i < $n} {incr i} { + TestClass $i -superclass [expr {$i-1}] + + # + # record the reverse order of inits + # + + $i instproc init {args} { + eval next $args + my instvar order + lappend order [namespace tail [self class]] + } + + # + # add instproc for init options + # + + $i instproc m$i.set {val} { + my instvar [namespace tail [self class]] + set [namespace tail [self class]] [self proc].$val + } + } +} + +objectinits proc run {{n 15}} { + my prepare $n + + set il {} + for {set i 1} {$i < $n} {incr i} { + lappend il $i + set al {} + set args {} + for {set j $i} {$j > 0} {incr j -1} { + lappend al $j + lappend args -m$j.set $j + + # + # create obj of increasing class with increasing options + # + if {[catch {eval $i m$i.$j $args} msg] != 0} then { + error "FAILED [self] - $msg" + } + if {[m$i.$j set order] != $il} then { + error "FAILED [self] - inited order was wrong" + } + set vl [lsort -decreasing -integer [m$i.$j info vars {[0-9]*}]] + + if {$vl != $al} then { + error "FAILED [self] - wrong instvar names: $vl : $al" + } + foreach k $vl { + if {[m$i.$j set $k] != "m$k.set.$k"} then { + error "FAILED [self] - wrong instvar values" + } + } + } + } + + return "PASSED [self]" +} + + +TestSuite objectvariables + +objectvariables proc run {{n 100}} { + TestClass Variables + Variables avar + + foreach obj {avar Variables TestClass xotcl::Class xotcl::Object} { + + # + # set up some variables + # + + $obj set scalar 0 + $obj set array() {} + ${obj} unset array() + $obj set unset.$n {} + + # + # mess with them recursively + # + + $obj proc recurse {n} { + my instvar scalar array + incr scalar + set array($n) $n + my instvar unset.$n + unset unset.$n + incr n -1 + my instvar unset.$n + set unset.$n [array names array] + if {$n > 0} then { + my recurse $n + } + } + + + $obj recurse $n + + # + # check the result and clean up + # + + if {[$obj set scalar] != $n} then { + error "FAILED [self] - scalar" + } + $obj unset scalar + + for {set i $n} {$i > 0} {incr i -1} { + if {[$obj set array($i)] != $i} then { + error "FAILED [self] - array" + } + } + $obj unset array + + if {[$obj info vars "unset.0"] == ""} then { + error "FAILED [self] - unset: [$obj info vars]" + } + } + + # + # trace variables + # + + Variables avar2 + + avar2 proc trace {var ops} { + my instvar $var + ::trace variable $var $ops "avar2 traceproc" + } + + avar2 proc traceproc {maj min op} { + set majTmp [namespace tail "$maj"] + global trail; lappend trail [list $majTmp $min $op] + } + + avar2 proc killSelf {} { + my destroy + } + + global guide trail + set trail {} + set guide {} + avar2 trace array wu + + for {set i 0} {$i < $n} {incr i} { + + avar2 trace scalar$i wu + avar2 set scalar$i $i + lappend guide [list scalar$i {} w] + avar2 set array($i) [avar2 set scalar$i] + lappend guide [list array $i w] + } + + + if {$guide != $trail} then { + error "FAILED [self] - trace: expected $guide, got $trail" + } + + # + # destroy must trigger unset traces + # + set trail {} + set guide {} + lappend guide [list array {} u] + for {set i 0} {$i < $n} {incr i} { + lappend guide [list scalar$i {} u] + } + + avar2 killSelf + + if {[lsort $guide] != [lsort $trail]} then { + error "FAILED [self] - trace: expected $guide, got $trail" + } + + Variables destroy + + return "PASSED [self]" +} + + +# +# c api, if compiled with -DTESTCAPI +# + +TestSuite capi + +capi proc run {{n 50}} { + set start [dawnoftime read] + for {set i 0} {$i < $n} {incr i} { + Timer atime$i + if {$i % 3} {atime$i stop} + if {$i % 7} {atime$i read} + if {$i % 2} {atime$i start} + if {$i % 5} {atime$i stop} + } + set end [dawnoftime read] + if {$end < $start} { + error "FAILED [self]: timer doesn't work" + } + + foreach i [Timer info instances] {$i destroy} + Timer destroy + + return "PASSED [self]" +} + + + +TestSuite proc run {} { + # + # run individual tests in needed order + # + puts [objectdispatch run] + puts [paperexamples run] + puts [classcreate run] + puts [inheritance run] + puts [classdestroy run] + puts [objectinits run] + puts [objectvariables run] + if {[info commands Timer] != ""} then { + puts [capi run] + } +# puts [autoload run] + +} + +puts [time {TestSuite run} 1] + +#exit + +# Local Variables: +# mode: tcl +# tcl-indent-level: 2 +# End: + Index: xotcl/tests/testx.xotcl =================================================================== diff -u --- xotcl/tests/testx.xotcl (revision 0) +++ xotcl/tests/testx.xotcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,3442 @@ +#$Id: testx.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package require XOTcl +namespace import -force xotcl::* + +proc ::errorCheck {got expected msg} { + if {$got != $expected} { + puts stderr "FAILED: $msg\nGot: $got\nExpected: $expected" + foreach g $got e $expected { + set result [expr {$g == $e}] + if {[string length $g]>60} { + puts "$result g='$g'\n e='$e'" + } else { + puts "$result g='$g' e='$e'" + } + } + exit -1 + } +} + +proc ::cutSpaces {string} { + regsub -all " " $string "" result + regsub -all "\n" $result " " result + return $result +} + +Class TestX +@ @File {description { + This is a file which provides a regression test + for the features of the XOTcl - Language. + } +} +@ Class TestX + +TestX nestingClasses +@ TestX nestingClasses { + description {Regression test object testing the class nesting feature.} +} +nestingClasses proc run {{n 20}} { + for {set i 0} {$i < $n} {incr i} { + Class x($i) + + Class x($i)::y + ::errorCheck [x($i) info commands y] "y" \ + "[self] -- creating Nested Class " + Class x($i)::z + Class x($i)::z::t + Class x($i)::t + ::errorCheck [x($i) info classchildren] "::x($i)::t ::x($i)::y ::x($i)::z" \ + "[self] -- info classchildren" + ::errorCheck [x($i)::z info classparent] "::x($i)" \ + "[self] -- info classparent" + + + ::errorCheck [x($i) info commands t] "t" \ + "[self] -- MakeClass " + + x($i) a + x($i)::z a + x($i)::z::t a + x($i)::z::t move x($i)::z::rt + x($i)::z::rt a + ::errorCheck [x($i)::z info commands rt] "rt" \ + "[self] -- renaming leaf " + + x($i)::z move x($i)::rz + + ::errorCheck [x($i) info commands rz] "rz" \ + "[self] -- renaming node (node itself)" + + ::errorCheck [x($i)::rz info commands rt] "rt" \ + "[self] -- renaming node (leaf in node)" + + ::errorCheck [x($i)::rz info classchildren] "::x($i)::rz::rt" \ + "[self] -- info classchildren (2)" + ::errorCheck [x($i)::rz::rt info classparent] "::x($i)::rz" \ + "[self] -- info classparent (2)" + + x($i) move rx + ::errorCheck [rx info commands rz] "rz" \ + "[self] -- renaming root " + ::errorCheck [info commands rx] "rx" \ + "[self] -- renaming root " + rx destroy + } + return "PASSED [self]" +} + +TestX nestingObjects +@ TestX nestingObjects { + description {Regression test object testing the object nesting feature.} +} + +nestingObjects proc run {{n 20}} { + for {set i 0} {$i < $n} {incr i} { + Class C($i) + + C($i) instproc testinstproc {} { + return + } + C($i) o + o proc testproc {} { + return + } + o testproc; o testinstproc + C($i) o::y + ::errorCheck [o info commands y] "y" \ + "[self] -- creating Nested Object " + C($i) o::z + C($i) o::z::t + C($i) o::t + + ::errorCheck [o info children] "::o::t ::o::y ::o::z" \ + "[self] -- info children" + ::errorCheck [o::t info parent] "::o" \ + "[self] -- info parent" + + ::errorCheck [o info commands t] "t" \ + "[self] -- MakeObject " + o::z::t move o::z::rt + ::errorCheck [o::z info commands rt] "rt" \ + "[self] -- renaming leaf " + o::z move o::rz + ::errorCheck [o::rz info commands rt] "rt" \ + "[self] -- renaming node " + ::errorCheck [o info commands rz] "rz" \ + "[self] -- renaming node " + o move rx + ::errorCheck [rx info commands rz] "rz" \ + "[self] -- renaming root " + ::errorCheck [info commands rx] "rx" \ + "[self] -- renaming root " + rx destroy + C($i) destroy + + Class A + A instproc x {a1 args} { + my set var $a1 + } + A a + A a::n -x "1 2 3" + ::errorCheck [::a::n set var] "1 2 3" \ + "[self] -- arg passing - init dash" + } + return "PASSED [self]" +} + +TestX assertions +@ TestX assertions { + description {Regression test object testing the assertions.} + } + +assertions proc run {{n 20}} { + for {set i 0} {$i < $n} {incr i} { + Class C($i) + C($i) invar { + {$a > 2} {$c < 3} {$d > 5} + {#a} {#b} + } + C($i) instinvar { + {$a > 2} {$c < 3} {$d > 5} + {#a} {#b} + } + + ::errorCheck [C($i) info invar] {{$a > 2} {$c < 3} {$d > 5} {#a} {#b}} \ + "[self] -- Class invar " + + ::errorCheck [C($i) info invar] {{$a > 2} {$c < 3} {$d > 5} {#a} {#b}} \ + "[self] -- Class instinvar " + + Object b($i) + + b($i) invar { + {$a > 2} {$c < 3} {$d > 5} + {#a} {#b} + } + ::errorCheck [C($i) info invar] {{$a > 2} {$c < 3} {$d > 5} {#a} {#b}} \ + "[self] -- Object invar " + + b($i) proc p {a b c} { + return p + } {pre1 pre2 pre3} {post1 post2 post3} + + ::errorCheck [b($i) info pre p] {{pre1} {pre2} {pre3}} \ + "[self] -- Obj proc pre assertion " + ::errorCheck [b($i) info post p] {{post1} {post2} {post3}} \ + "[self] -- Obj proc post assertion " + C($i) instproc p {a b c} { + return p + } {} {post1 post2 post3} + + ::errorCheck [C($i) info instpre p] "" \ + "[self] -- CL proc pre assertion " + ::errorCheck [C($i) info instpost p] {{post1} {post2} {post3}} \ + "[self] -- CL proc post assertion " + + C(0) set a 3; C(0) set c 2; C(0) set d 7; C(0) set f 50; + C(0) check all + C(0) proc checkit {} { + C(0) instvar a c d f + ::errorCheck [my info check] {invar instinvar pre post} \ + "check options != all" + # turn obj-invar off + C(0) check {pre post instinvar} + C(0) set c 10 + ::errorCheck [my info check] {instinvar pre post} \ + "check options != instinvar pre post" + } {{$f > 10}} {{$f < 100}} + C(0) checkit + } + for {set i 0} {$i < $n} {incr i} { + b($i) destroy + C($i) destroy + } + + Object b + b proc p {a b c} { + return p + } {pre1 pre2 pre3} {post1 post2 post3} + ::rename b a + ::errorCheck [a info pre p] {{pre1} {pre2} {pre3}} \ + "[self] -- Obj proc pre assertion " + ::errorCheck [a info post p] {{post1} {post2} {post3}} \ + "[self] -- Obj proc post assertion " + + + Class Sensor -parameter {{value 1}} + Sensor instinvar { + {[regexp {^[0-9]$} [my value]] == 1} + } + Sensor s + s check all + + Sensor instproc x {} { + s value + } { + {[regexp {^[0-9]$} [my value]] == 1} + } {} + s x + s value + + # inheritance + + Class A -parameter {{x 1} {y 1}} + + A instinvar {{$x == 1}} + + A instproc xTo2 args { + my set x 2 + } + A instproc yTo2 args { + my set y 2 + } {} {{$y == 1}} + A a -check all + + if {![catch {a xTo2} err]} { + set err "ok" + } else { + a check {} + a set x 1 + a check all + } + ::errorCheck $err {Assertion failed check: {$x == 1} in proc 'xTo2'} \ + "[self] inheritance a xTo2" + + if {![catch {a yTo2} err]} { + set err "ok" + } + ::errorCheck $err {Assertion failed check: {$y == 1} in proc 'yTo2'} \ + "[self] inheritance a yTo2" + + Class B -superclass A + B b -check all + + if {![catch {b xTo2} err]} { + set err "ok" + } else { + b check {} + b set x 1 + b check all + } + ::errorCheck $err {Assertion failed check: {$x == 1} in proc 'xTo2'} \ + "[self] inheritance b xTo2" + + if {![catch {b yTo2} err]} { + set err "ok" + } + ::errorCheck $err {Assertion failed check: {$y == 1} in proc 'yTo2'} \ + "[self] inheritance b yTo2" + + return "PASSED [self]" +} + +TestX filterAddRemove +@ TestX filterAddRemove { + description {Regression test object testing adding/removing of filters.} +} +filterAddRemove proc run {{n 20}} { + set ::filterCount 0 + for {set i 0} {$i < $n} {incr i} { + Class SA($i) + Class SB($i) + Class SC($i) -superclass [list SB($i) SA($i)] + SA($i) instproc fa args { + incr ::filterCount + my set x 150 + return "[next]-[self class]::[self proc]" + } + SA($i) instproc f2 args { + incr ::filterCount + my set x 150 + return "[next]-[self class]::[self proc]" + } + SB($i) instproc f2 args { + incr ::filterCount + my set x 150 + return "[next]-[self class]::[self proc]" + } + SB($i) instproc fb args { + incr ::filterCount + my set x 150 + return "[next]-[self class]::[self proc]" + } + SC($i) instproc fc args { + incr ::filterCount + my set x 150 + return "[next]-[self class]::[self proc]" + } + SC($i) instfilter fc + SB($i) instfilter {fb f2} + SA($i) instfilter {fa f2} + Class T + T proc s {} { return } + Class Filtered${i} -superclass SC($i) + Filtered${i} instproc testfilter args { + incr ::filterCount + T s + return "[next]-[self class]::[self proc]" + } + Filtered${i} instfilter testfilter + Filtered${i} instproc a args { + return "in a" + } + Filtered${i} f${i} + set erg [f${i} a] + ::errorCheck $erg \ + "in a-::SA(${i})::f2-::SA(${i})::fa-::SB(${i})::f2-::SB(${i})::fb-::SC(${i})::fc-::Filtered${i}::testfilter" \ + "[self] -- Filter Test - add" + SC($i) instfilter {} + SB($i) instfilter fb + SA($i) instfilter {} + set erg [f${i} a] + ::errorCheck $erg "in a-::SB(${i})::fb-::Filtered${i}::testfilter" \ + "[self] -- Filter Test - remove" + + f${i} proc procFilter args { + return "[next]-[self class]::[self proc]" + } + f${i} filter {fa f2 procFilter} + + + set erg [f${i} a] + ::errorCheck $erg "in a-::SB(${i})::fb-::Filtered${i}::testfilter-::procFilter-::SB(${i})::f2-::SA(${i})::fa" \ + "[self] -- Obj Filter Test call three filter + instfilter" + + ::errorCheck "[f${i} info filter]-[SB($i) info instfilter]-[SC($i) info instfilter]" \ + "fa f2 procFilter-::SB(${i})::fb-::Filtered${i}::testfilter-::procFilter-::SB(${i})::f2-::SA(${i})::fa-fb-"\ + "[self] -- filter infos" + + ::errorCheck [f${i} filtersearch fa]-[f${i} filtersearch fb]-[f${i} filtersearch procFilter] "::SA(${i}) instproc fa-::SB(${i})::fb-::Filtered${i}::testfilter-::procFilter-::SB(${i})::f2-::SA(${i})::fa-::SB(${i}) instproc fb-::SB(${i})::fb-::Filtered${i}::testfilter-::procFilter-::SB(${i})::f2-::SA(${i})::fa-::f${i} proc procFilter-::SB(${i})::fb-::Filtered${i}::testfilter-::procFilter-::SB(${i})::f2-::SA(${i})::fa" "[self] -- filtersearch" + + Filtered${i} instfilter {} + SB($i) instfilter {} + set erg [f${i} a] + + ::errorCheck $erg "in a-::procFilter-::SB(${i})::f2-::SA(${i})::fa" \ + "[self] -- only obj filter" + + f${i} filter {} + set erg [f${i} a] + ::errorCheck $erg "in a" \ + "[self] -- obj filter remove" + } + for {set i 0} {$i < $n} {incr i} { + SA($i) destroy + SB($i) destroy + SC($i) destroy + } + + ::errorCheck $::filterCount 960 \ + "[self] -- Filter Test - Filter Count -- Got: $::filterCount" + + # + # instvar test + # + global filterResult + set filterResult "" + Object a + a set o 12 + a set p 13 + Class A + A set m 14 + + Object instproc f args { + global filterResult + a instvar o p + A instvar m + ::append filterResult " [self] [self calledproc] [self callingproc]" + ::append filterResult " $o $p $m" + next + } + + proc x {} { + set ::a::e xxx + } + + Object instfilter f + + x + ::errorCheck $::a::e xxx \ + "filterAddRemove: instvar test -- proc set failed" + a set e yyy + + ::errorCheck $::a::e yyy \ + "filterAddRemove: instvar test -- obj set failed" + + ::errorCheck $filterResult " ::A instvar f 12 13 14 ::a set run 12 13 14" \ + "filterAddRemove: instvar test -- instvar filter failed" + + Object instfilter "" + + Object instproc f args { + next + } + Object instfilter f + + ::errorCheck [Object o] "::o" \ + "filterAddRemove: Object creation with filter" + + # This produces a bug, if not + # RUNTIME_STATE(in)->returnCode = TCL_OK; + # in ObjDispatch -> UNKNOWN handling */ + # abrupt stop of program because result is set to XOTCL_UNKNOWN + # instead of TCL_ERROR, as it should be + catch {puts ${ZZZZZZZZZZZZZZZ::ZZZZZ}} + + o set r 43 + + ::errorCheck [o set r] "43" \ + "filterAddRemove: Object creation with filter: setting var" + + Object instfilter "" + + # test for CmdListReplaceCmd + set ::r "" + Class A + A instproc f2 args {lappend ::r [self class]-[self proc]; next} + Class C -superclass A + Class D -superclass C + D instfilter {f2} + D d + d filter {f2} + C instproc f2 args {lappend ::r [self class]-[self proc]; next} + set ::r "" + d set r 1 + + ::errorCheck $::r "::C-f2 ::A-f2" \ + "filter method addition" + + return "PASSED [self]" +} + +TestX filterClassChange +@ TestX filterClassChange { + description {Regression test object testing class changes of filters.} +} + +filterClassChange proc run {{n 20}} { + for {set i 0} {$i < $n} {incr i} { + Class A($i) + Class B + + A($i) instproc f args { + set result pre*[self]*[self proc]*$args + lappend result [next] post*[self]*[self proc] + return $result + } + + A($i) o($i) + o($i) proc change {} { + my class B + } + o($i) proc call {} { + return in-call + } + + A($i) instfilter f + + set erg [o($i) call] + ::errorCheck $erg "pre*::o($i)*f* in-call post*::o($i)*f" \ + "[self] -- Filter Class Change -- Call before change" + o($i) change + + set erg [o($i) call] + ::errorCheck $erg "in-call" \ + "[self] -- Filter Class Change -- Call after change" + # testing deleting a filter proc + Class F + F instproc testf args {return filtered} + F instfilter testf + F f1 + ::errorCheck [f1 set r 45] "filtered" "Deleting a filter proc ... before" + F instproc testf {} {} + ::errorCheck [f1 set r 45] "45" "Deleting a filter proc ... after" + + # testing deleting a superclass + Class F1 + Class F2 -superclass F1 + Class F3 -superclass F2 + + F1 instproc testf args {return [next]-filtered} + F2 instproc testf2 args {return [next]-filtered} + F3 instfilter {testf testf2} + F3 f2 + + ::errorCheck [f2 filtersearch testf2] "::F2 instproc testf2-filtered-filtered" "[self]: filtersearch 2" + + ::errorCheck [f2 set r 45] "45-filtered-filtered" \ + "Deleting a superclass ... before" + F3 superclass [F1 info superclass] + ::errorCheck [f2 set r 45] "45" "Deleting a superclass ... after" + } + B destroy + for {set i 0} {$i < $n} {incr i} {A($i) destroy} + return "PASSED [self]" +} + +TestX filterGuards +@ TestX filterGuards { + description {Regression test object testing filter guards.} +} + +filterGuards proc run {{n 20}} { + global filterResult + + for {set i 0} {$i < $n} {incr i} { + set ::filterResult "" + Class A + A instproc f2 args { + global filterResult + append filterResult "-[self]-[self proc]-[self class]-[self calledproc]" + next + } + Class B -superclass A + B instproc f1 args { + global filterResult + append filterResult "-[self]-[self proc]-[self class]-[self calledproc]" + next + } + B instproc f3 args { + global filterResult + append filterResult "-[self]-[self proc]-[self class]-[self calledproc]" + next + } + + B instfilter {{f1 -guard "1<0"}} + B b + ::errorCheck $filterResult "" \ + "[self] -- Filter guard: Filter never to be applied" + + b destroy + + A instproc f1 args { + global filterResult + append filterResult "-[self]-[self proc]-[self class]-[self calledproc]" + next + } + set filterResult "" + B b + ::errorCheck $filterResult "" \ + "[self] -- Filter guard: Filter never to be applied + filter inheritance on this filter" + # filter w/o guard -> has to be applied + A instfilter f1 + b destroy + set filterResult "" + B b + ::errorCheck $filterResult "-::b-f1-::A-configure-::b-f1-::A-init" \ + "[self] -- Filter guard: two different filters, same name + different class, one guarded, one not" + + # two filter w/o guard -> both have to be applied + B instfilter f1 + b destroy + set filterResult "" + B b + ::errorCheck $filterResult "-::b-f1-::B-configure-::b-f1-::A-configure-::b-f1-::B-init-::b-f1-::A-init" \ + "[self] -- Filter guard: two different filters, both not guarded anymore" + + # three filters with guards, not to be applied, in one chain + b destroy + A instfilter {} + B instfilter {{f1 -guard {0}} {f3 -guard {0}} {f2 -guard {0}}} + set filterResult "" + B b + ::errorCheck $filterResult "" "[self] -- Filter guard: three filters in one chain" + + # three times the same filter --> guards are and-combined + set filterResult "" + B instfilter {{f2 -guard {[self calledproc] == "set" || [self] == "::b2"}}} + A instfilter {{f2 -guard {[self] == "::b2"}}} + B b1 + + B b2 + if {$i == 0} { + ::errorCheck $filterResult "-::b2-f2-::A-configure-::b2-f2-::A-init" \ + "[self] -- Filter guard: creation with less restrictive guards" + } else { + ::errorCheck $filterResult "-::b2-f2-::A-cleanup-::b2-f2-::A-configure-::b2-f2-::A-init" \ + "[self] -- Filter guard: creation with less restrictive guards (b)" + } + set filterResult "" + b1 set x 45 + ::errorCheck $filterResult "-::b1-f2-::A-set" \ + "[self] -- Filter guard: setting restricted object" + + set filterResult "" + b1 info class + ::errorCheck $filterResult "" \ + "[self] -- Filter guard: info restricted object (no guard applies)" + + set filterResult "" + b2 info class + ::errorCheck $filterResult "-::b2-f2-::A-info" \ + "[self] -- Filter guard: setting restricted object (2nd guard applies)" + + b1 filter {{f2 -guard {[self calledproc] == "info"}}} + + set filterResult "" + b1 proc a {} { + # + } + ::errorCheck $filterResult "" \ + "[self] -- Filter guard: proc on restricted object (no guard applies)" + + set filterResult "" + b1 info class + ::errorCheck $filterResult "-::b1-f2-::A-info" \ + "[self] -- Filter guard: info filtered by object filter guard" + + + # checking infos + ::errorCheck [b1 info filterguard f2]-[B info instfilterguard f2]-[A info instfilterguard f2] \ + {[self calledproc] == "info"-[self calledproc] == "set" || [self] == "::b2"-[self] == "::b2"} \ + "[self] -- Filter guard: info filtered by object filter guard" + + # checking info -guards option + Class A + A instproc f1 args {next} + A instproc fx args {next} + Class B -superclass A + B instproc f1 args {next} + B instproc f2 args {next} + B b + B instfilter {{f1 -guard {[self] == "::b"}} {f2 -guard 0} f1} + b filter {{f1 -guard {[self] == "::b"}} {f2 -guard 0}} + + ::errorCheck [B info instfilter]-[B info instfilter -guards]-[b info filter]-[b info filter -guards] \ + {f1 f2-f1 {f2 -guard 0}-f1 f2-{f1 -guard {[self] == "::b"}} {f2 -guard 0}}\ + {[self] -- Filter guard: -guards option} + + A instfilter {f1 fx} + A a + a proc x args {next} + a filter x + + ::errorCheck [b info filter -order]-[a info filter -order] "{::B instproc f1} {::B instproc f2} {::A instproc f1} {::A instproc fx}-{::a proc x} {::A instproc f1} {::A instproc fx}" \ + {[self] -- Filter guard: -order option} + + ::errorCheck [b info filter -order -guards]-[a info filter -order -guards] {{f1 -guard {[self] == "::b"}} {f2 -guard 0} f1 fx-x f1 fx} \ + {[self] -- Filter guard: -order -guards options} + + + Class Foo + Foo instproc init {args} {my set bar hello} + Foo instproc baz {args} { + my instvar bar + return $bar + } + Foo instproc myFilter {args} { + lappend ::r myFilter->[self calledproc] + my set r 4 + next + } + Foo instfilter myFilter + Foo instfilterguard myFilter { ([self calledproc] == "baz") } + Foo instfilterguard myFilter { ([self calledproc] == "baz") } + set f [Foo new] + $f baz + ::errorCheck [$f baz] "hello" \ + {[self] -- Filter guard from method call} + Foo instfilterguard myFilter {} + + set ::r "" + Foo create f + f filter myFilter + f filterguard myFilter { ([self calledproc] == "baz") } + lappend ::r [f baz] [f set r 1] + f filterguard myFilter {} + lappend ::r [f baz] [f set r 1] + ::errorCheck $::r [list myFilter->configure myFilter->init \ + myFilter->set myFilter->filter \ + myFilter->filterguard myFilter->baz \ + hello 1 myFilter->baz \ + myFilter->instvar myFilter->set hello 1] \ + {[self] -- Filter guard from method call} + f destroy + + Class Room + Room instproc open {} {lappend ::r [self proc]} + Room instproc x {} {lappend ::r [self proc]} + Room instproc loggingFilter args { + lappend ::r [self proc]-[self calledproc] + next + } + Room instproc callsMethod {method calledproc} { + return [string match $calledproc $method] + } + Room instproc callsLevel2 {} { + set level [self guardedlevel] + lappend ::r $level + set calledproc [uplevel $level self calledproc] + lappend ::r $calledproc + } + Room instfilter loggingFilter + Room instfilterguard loggingFilter {[my callsMethod open [self calledproc]]} + + Room r + + set ::r "" + + r open + r x + + ::errorCheck $::r "loggingFilter-open open x" \ + {[self] -- info guarded scope} + } + return "PASSED [self]" +} + +TestX mixinGuards +@ TestX mixinGuards { + description {Regression test object testing mixin guards.} +} + +mixinGuards proc run {{n 20}} { + set ::r "" + Class Fly + Fly instproc fly {} {lappend ::r "[my signature]: yippee, fly like an eagle!"} + + Class Sing + Sing instproc sing {} {lappend ::r "[my signature]: what a difference a day make"} + + Class Animal -parameter age + Animal instproc unknown args { lappend ::r "[my signature]: how should i $args?"} + Animal instproc signature {} { + return "[self] [my info class] ([my age] years)" + } + + Class Bird -superclass Animal + Class Penguine -superclass Bird + Class Parrot -superclass Bird + Class Duck -superclass Bird + + Parrot tweedy -age 1 + Penguine pingo -age 5 + Duck donald -age 4 + Parrot lora -age 6 + + Bird instmixin {{Fly -guard {[my age]>2 && ![my istype Penguine]}} Sing} + + foreach bird {tweedy pingo donald lora} { $bird fly } + + ::errorCheck [set ::r] [list \ + {::tweedy ::Parrot (1 years): how should i fly?} \ + {::pingo ::Penguine (5 years): how should i fly?} \ + {::donald ::Duck (4 years): yippee, fly like an eagle!} \ + {::lora ::Parrot (6 years): yippee, fly like an eagle!}] \ + {[self] -- Simple Instmixin Guard} + + set ::r "" + tweedy age 3 + pingo class Duck + lora class Penguine + foreach bird {tweedy pingo donald lora} { $bird fly } + + ::errorCheck [set ::r] [list \ + {::tweedy ::Parrot (3 years): yippee, fly like an eagle!} \ + {::pingo ::Duck (5 years): yippee, fly like an eagle!} \ + {::donald ::Duck (4 years): yippee, fly like an eagle!} \ + {::lora ::Penguine (6 years): how should i fly?}] \ + {[self] -- Simple Instmixin Guard ... Class Change} + + set ::r "" + pingo mixin {{Fly -guard {[my age]>2}} Sing} + foreach i { + {Bird info instmixin -guards} + {pingo info mixin -guards} + {pingo info mixin -order -guards}} { + lappend ::r "$i [eval $i]" + } + + ::errorCheck [set ::r] [list \ + {Bird info instmixin -guards {::Fly -guard {[my age]>2 && ![my istype Penguine]}} ::Sing} \ + {pingo info mixin -guards {::Fly -guard {[my age]>2}} ::Sing} \ + {pingo info mixin -order -guards {::Fly -guard {[my age]>2}} ::Sing}] \ + {[self] -- Simple Instmixin Guard ... Info} + + set ::r "" + Class POM-start + Class POM-end + Class PCM-start + Class PCM-end + pingo mixin {POM-start {Fly -guard {[my age]>2}} Sing POM-end} + Bird instmixin {PCM-start {Fly -guard {[my age]>2 && ![my istype Penguine]}} Sing PCM-end} + + pingo class Penguine + foreach i { + {Bird info instmixin -guards} + {pingo info mixin -guards} + {pingo info mixin -order -guards}} { + lappend ::r "$i [eval $i]" + } + + + ::errorCheck [set ::r] [list \ + {Bird info instmixin -guards ::PCM-start {::Fly -guard {[my age]>2 && ![my istype Penguine]}} ::Sing ::PCM-end} \ + {pingo info mixin -guards ::POM-start {::Fly -guard {[my age]>2}} ::Sing ::POM-end} \ + {pingo info mixin -order -guards ::POM-start ::POM-end ::PCM-start {::Fly -guard {[my age]>2}} ::Sing ::PCM-end}] \ + {[self] -- Same Mixin Guard ... Info} + + set ::r "" + pingo fly + ::errorCheck [set ::r] [list \ + {::pingo ::Penguine (5 years): yippee, fly like an eagle!}] \ + {[self] -- Same Mixin Guard ... most specific counts} + + + set ::r "" + Animal a -set age 20 + a mixin Fly + a mixinguard ::Fly {[my age] > 3} + a fly + lappend ::r [a info mixin -guards] + lappend ::r [a info mixin -order -guards] + a set age 2 + a fly + a mixinguard ::Fly {[my age] > 4} + a fly + set info "" + lappend info [a info mixinguard Fly] + lappend ::r [a info mixin -guards] + lappend ::r [a info mixin -order -guards] + a mixinguard ::Fly {} + a fly + lappend ::r [a info mixin -guards] + lappend info [a info mixinguard Fly] + lappend ::r [a info mixin -order -guards] + ::errorCheck [set ::r] [list \ + {::a ::Animal (20 years): yippee, fly like an eagle!} \ + {{::Fly -guard {[my age] > 3}}} {{::Fly -guard {[my age] > 3}}} \ + {::a ::Animal (2 years): how should i fly?} \ + {::a ::Animal (2 years): how should i fly?} \ + {{::Fly -guard {[my age] > 4}}} {{::Fly -guard {[my age] > 4}}} \ + {::a ::Animal (2 years): yippee, fly like an eagle!} \ + ::Fly ::Fly] \ + {mixinguard method} + + set ::r "" + Class A -superclass Animal + A a -set age 20 + A instmixin Fly + A instmixinguard ::Fly {[my age] > 3} + lappend info [A info instmixinguard ::Fly] + a fly + lappend ::r [A info instmixin -guards] + lappend ::r [a info mixin -order -guards] + a set age 2 + a fly + A instmixinguard ::Fly {[my age] > 4} + lappend info [A info instmixinguard ::Fly] + a fly + lappend ::r [A info instmixin -guards] + lappend ::r [a info mixin -order -guards] + A instmixinguard ::Fly {} + lappend info [A info instmixinguard ::Fly] + a fly + lappend ::r [A info instmixin -guards] + lappend ::r [a info mixin -order -guards] + ::errorCheck [set ::r] [list \ + {::a ::A (20 years): yippee, fly like an eagle!} \ + {{::Fly -guard {[my age] > 3}}} {{::Fly -guard {[my age] > 3}}} \ + {::a ::A (2 years): how should i fly?} \ + {::a ::A (2 years): how should i fly?} \ + {{::Fly -guard {[my age] > 4}}} {{::Fly -guard {[my age] > 4}}} \ + {::a ::A (2 years): yippee, fly like an eagle!} \ + ::Fly ::Fly] \ + {instmixinguard method} + + ::errorCheck [set info] [list {[my age] > 4} {} {[my age] > 3} \ + {[my age] > 4} {} ] {info (inst)mixinguard} + + return "PASSED [self]" +} + +TestX filterSimpleObserver +@ TestX filterSimpleObserver { + description {Regression test object testing a simple observer using filters.} +} + +filterSimpleObserver proc run {{n 20}} { + set ::filterCount 0 + for {set i 0} {$i < $n} {incr i} { + Class NetAccess$i + Class Http$i -superclass NetAccess$i + Class TransferDialog$i + + TransferDialog$i proc addObserver cl { + $cl instproc observerFilter args { + set calledMethod [self calledproc] + set callingClass [my info class] + incr ::filterCount + set result [next] + + my set r 34 + + foreach var {args calledMethod callingClass result} { + if {[info vars $var] != $var} { + puts stderr "[self] -- Simple Observer - info vars in filter" + exit + } + } + + + return [self]-[self class]-[my info class]-$args-[self calledproc]-[self callingproc]-$result + } + $cl instfilter observerFilter + } + + TransferDialog$i instproc show {i} { + next + TransferDialog${i} addObserver NetAccess$i + [self class] instvar observingObjects + lappend observingObjects(::NetAccess$i) [self] + } + + Http$i parameter {a be bu} + Http$i instproc path x { my set path $x } + + Http$i instproc query x { + my set [self proc] $x + } + Http$i instproc init {args} { + my set url abc + next + my instvar query path bu + if {![info exists query] || + ![info exists path] || + ![info exists bu] || + $query != "q"} { + puts stderr "FAILED - [self] -- Simple Observer - Variable Init"; exit + } + } + + Http$i instproc GET {x} { + my instvar query url path + if {[info exists query]} { + append url ?$query + append path ?$query + } + set ::baseLevel [info level] + + + if {0 != [expr [info level] - $::baseLevel]} { + puts stderr "FAILED - [self] -- Simple Observer - info level in filtered proc\n\ + expected 0, got [expr [info level] - $::baseLevel]" + exit + } + foreach var {x path query url} { + if {[info vars $var] != $var} { + puts stderr "FAILED - [self] -- Simple Observer - info vars in filtered proc"; + exit + } + } + return $url + } + + TransferDialog$i t($i) + t($i) show $i + + Http$i h($i) -query q -path p -bu b + + set erg [h($i) GET 1] + ::errorCheck $erg "::h($i)-::NetAccess$i-::Http$i-1-GET-run-abc?q" \ + "[self] -- Simple Observer - Filter Return" + + } + for {set i 0} {$i < $n} {incr i} { + NetAccess$i instfilter {} + + h($i) destroy + t($i) destroy + + Http$i destroy + NetAccess$i destroy + TransferDialog$i destroy + } + + ::errorCheck $::filterCount 220 \ + "[self] -- Simple Observer - Filter Count" + + return "PASSED [self]" +} + + + +TestX stdargs +@ TestX stdargs { + description { + Regression test object testing the ability of the next primitive to pass + arguments without naming them. + } +} + +stdargs proc run {{n 20}} { + for {set i 0} {$i < $n} {incr i} { + Class C + Class D + Class A -superclass {C D} + Class B -superclass A + + C instproc t {} { + next + return + } + D instproc t args { + ::errorCheck $args "" \ + "[self] -- --noArgs" + next + return + } + + A instproc t {a b args} { + if {$a != 1 || $b != 2 || $args != {3 4 5 6 7 8 9}} { + puts stderr "FAILED - [self] -- StdArgs not computed"; exit + } + next --noArgs + return + } + + B instproc t {a b args} { + if {$a != 1 || $b != 2 || $args != {3 4 5 6 7 8 9}} { + puts stderr "FAILED -[self] -- StdArgs not computed"; exit + } + next + return + } + + B x + x t 1 2 3 4 5 6 7 8 9 + } + foreach o {x A B C D} {$o destroy} + return "PASSED [self]" +} + + + +TestX filterInfo +@ TestX filterInfo { + description{ + Regression test object testing introspection of filters. + } +} +# Helper Procs + +proc ::showStack {{m 100}} { + set r "" + set max [info level] + if {$m<$max} {set max $m} + for {set i 0} {$i < $max} {incr i} { + set r ${r}-$i=[info level [expr -$i]] + } + return $r +} +proc ::showCall {} { + set n "" + for {set level -1} {1} {incr level -1} { + set p [info level $level] + if {[lindex $p 0] == "next"} {set n "next:"} break + } + return [showStack] +} + +filterInfo proc run {{n 20}} { + for {set i 0} {$i < $n} {incr i} { + global FInfo + set FInfo "" + + Class FI + + FI proc addFilter {classname} { + $classname instproc infoFilter args { + global FInfo + lappend FInfo \ + [list callingclass [self callingclass] \ + filterreg [self filterreg] \ + callingobject [self callingobject] \ + callingproc [self callingproc] \ + calledproc [self calledproc]] + set r [next] + lappend FInfo \ + [list self [self] proc [self proc] class [self class] \ + infoclass [my info class] r $r] + return $r + } + $classname instfilter infoFilter + } + + Class C0 + FI addFilter C0 + C0 instproc m1 {} { + my instvar aa bb cc + set cc 1 + } + + Class C1 -superclass C0 + C1 instproc init args { + my set a 1 + my set c 22 + next + } + C1 instproc m1 args { + set r [next] + my instvar a b cc + return $r--${a}--[set cc] + } + + set safedObjFilters [Object info filter] + Object instfilter "" + C1 c1 + Object instfilter $safedObjFilters + + if {$i == 0} { + ::errorCheck "$FInfo" \ + "{callingclass {} filterreg {::C0 instfilter infoFilter} callingobject ::filterInfo callingproc run calledproc configure} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r 0} {callingclass {} filterreg {::C0 instfilter infoFilter} callingobject ::filterInfo callingproc run calledproc init} {callingclass ::C1 filterreg {::C0 instfilter infoFilter} callingobject ::c1 callingproc init calledproc set} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r 1} {callingclass ::C1 filterreg {::C0 instfilter infoFilter} callingobject ::c1 callingproc init calledproc set} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r 22} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r {}}" \ + "Wrong filtering of instproc creation C/C1" + } else { + ::errorCheck "$FInfo" \ + "{callingclass {} filterreg {::C0 instfilter infoFilter} callingobject ::filterInfo callingproc run calledproc cleanup} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r {}} {callingclass {} filterreg {::C0 instfilter infoFilter} callingobject ::filterInfo callingproc run calledproc configure} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r 0} {callingclass {} filterreg {::C0 instfilter infoFilter} callingobject ::filterInfo callingproc run calledproc init} {callingclass ::C1 filterreg {::C0 instfilter infoFilter} callingobject ::c1 callingproc init calledproc set} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r 1} {callingclass ::C1 filterreg {::C0 instfilter infoFilter} callingobject ::c1 callingproc init calledproc set} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r 22} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r {}}" \ + "Wrong filtering of instproc creation C/C1 (b)" + } + + set FInfo "" + set result [c1 m1] + + ::errorCheck "$FInfo" \ + "{callingclass {} filterreg {::C0 instfilter infoFilter} callingobject ::filterInfo callingproc run calledproc m1} {callingclass ::C0 filterreg {::C0 instfilter infoFilter} callingobject ::c1 callingproc m1 calledproc instvar} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r {}} {callingclass ::C1 filterreg {::C0 instfilter infoFilter} callingobject ::c1 callingproc m1 calledproc instvar} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r {}} {self ::c1 proc infoFilter class ::C0 infoclass ::C1 r 1--1--1}" \ + "Wrong filtering of c1 m1" + + set FInfo "" + + ::errorCheck "$result" \ + "1--1--1" "Wrong return result of Filter Example 2 'c1 m1' " + + + Class T0 + FI addFilter T0 + T0 instproc m {} { + if {[string first "-0=showStack-1=showCall-2=m-3=m-4=m-5=run-6=run" [showCall]] == -1} { + puts stderr "FAILED - Wrong calling stack in T0 m: [showCall]" + exit + } + return [self]-[self proc]-[self class]-[my info class] + } + Class T1 -superclass T0 + T1 instproc m {} { + if {[string first "-0=showStack-1=showCall-2=m-3=m-4=run-5=run" [showCall]] == -1} { + puts stderr "FAILED - Wrong calling stack in T1 m: [showCall]" + exit + } + + set r1 before-[self]-[self proc]-[self class]-[my info class] + set r2 [next] + set r after-[self]-[self proc]-[self class]-[my info class]-${r1}-$r2 + } + + T1 t + + set FInfo "" + set result [t m] + ::errorCheck "$FInfo" \ + "{callingclass {} filterreg {::T0 instfilter infoFilter} callingobject ::filterInfo callingproc run calledproc m} {callingclass ::T1 filterreg {::T0 instfilter infoFilter} callingobject ::t callingproc m calledproc info} {self ::t proc infoFilter class ::T0 infoclass ::T1 r ::T1} {callingclass ::T0 filterreg {::T0 instfilter infoFilter} callingobject ::t callingproc m calledproc info} {self ::t proc infoFilter class ::T0 infoclass ::T1 r ::T1} {callingclass ::T1 filterreg {::T0 instfilter infoFilter} callingobject ::t callingproc m calledproc info} {self ::t proc infoFilter class ::T0 infoclass ::T1 r ::T1} {self ::t proc infoFilter class ::T0 infoclass ::T1 r after-::t-m-::T1-::T1-before-::t-m-::T1-::T1-::t-m-::T0-::T1}" \ + "Wrong filtering of t m" + + set FInfo "" + ::errorCheck "$result" \ + "after-::t-m-::T1-::T1-before-::t-m-::T1-::T1-::t-m-::T0-::T1" \ + "Wrong return result of Filter Example 2 \"t m\" " + } + c1 destroy + + for {set i 0} {$i < $n} {incr i} { + global InfoTraceResult + + Object InfoTrace + InfoTrace proc createInfoTrace cl { + $cl instproc infoTraceFilter args { + global InfoTraceResult + ::set r [next] + ::lappend InfoTraceResult [list \ + $r-[self]-[self proc]-[self class] \ + [my info class]-[self calledproc] \ + [self callingproc]-[self callingobject] \ + [self callingclass]-[self filterreg]] + return $r + } + $cl instfilter infoTraceFilter + } + Class ObjectsClass + ObjectsClass anObject + Class aClass + ObjectsClass instproc aProc {} {aClass create anotherObject} + InfoTrace createInfoTrace Object + set InfoTraceResult "" + set r [anObject aProc] + if {$i > 0} { + ::errorCheck $InfoTraceResult \ + "{-::anotherObject-infoTraceFilter-::xotcl::Object ::aClass-cleanup aProc-::anObject {::ObjectsClass-::xotcl::Object instfilter infoTraceFilter}} {-::xotcl::Class::Parameter-infoTraceFilter-::xotcl::Object ::xotcl::Class-searchDefaults aProc-::anObject {::ObjectsClass-::xotcl::Object instfilter infoTraceFilter}} {0-::anotherObject-infoTraceFilter-::xotcl::Object ::aClass-configure aProc-::anObject {::ObjectsClass-::xotcl::Object instfilter infoTraceFilter}} {-::anotherObject-infoTraceFilter-::xotcl::Object ::aClass-init aProc-::anObject {::ObjectsClass-::xotcl::Object instfilter infoTraceFilter}} {anotherObject-::aClass-infoTraceFilter-::xotcl::Object ::xotcl::Class-recreate aProc-::anObject {::ObjectsClass-::xotcl::Object instfilter infoTraceFilter}} {::anotherObject-::aClass-infoTraceFilter-::xotcl::Object ::xotcl::Class-create aProc-::anObject {::ObjectsClass-::xotcl::Object instfilter infoTraceFilter}} {::anotherObject-::anObject-infoTraceFilter-::xotcl::Object ::ObjectsClass-aProc run-::filterInfo {-::xotcl::Object instfilter infoTraceFilter}}" \ + "FilterInfo InfoTrace: Filter information wrong (b)" + } else { + ::errorCheck $InfoTraceResult \ + "{::anotherObject-::aClass-infoTraceFilter-::xotcl::Object ::xotcl::Class-alloc aProc-::anObject {::ObjectsClass-::xotcl::Object instfilter infoTraceFilter}} {-::xotcl::Class::Parameter-infoTraceFilter-::xotcl::Object ::xotcl::Class-searchDefaults aProc-::anObject {::ObjectsClass-::xotcl::Object instfilter infoTraceFilter}} {0-::anotherObject-infoTraceFilter-::xotcl::Object ::aClass-configure aProc-::anObject {::ObjectsClass-::xotcl::Object instfilter infoTraceFilter}} {-::anotherObject-infoTraceFilter-::xotcl::Object ::aClass-init aProc-::anObject {::ObjectsClass-::xotcl::Object instfilter infoTraceFilter}} {::anotherObject-::aClass-infoTraceFilter-::xotcl::Object ::xotcl::Class-create aProc-::anObject {::ObjectsClass-::xotcl::Object instfilter infoTraceFilter}} {::anotherObject-::anObject-infoTraceFilter-::xotcl::Object ::ObjectsClass-aProc run-::filterInfo {-::xotcl::Object instfilter infoTraceFilter}}" \ + "FilterInfo InfoTrace: Filter information wrong" + } + Object instfilter {} + } + + global fUplevelResult + set fUplevelResult "" + + Class FilterMix + FilterMix instproc calls args { + global fUplevelResult + set calledproc [uplevel 1 {self calledproc}] + set calledclass [uplevel 1 {self calledclass}] + append fUplevelResult "-[self class]-[self proc]-$calledproc-$calledclass" + } + Class FilterCL -instmixin FilterMix + FilterCL instproc filterA args { + global fUplevelResult + append fUplevelResult -[self class]-[self proc]-[self calledproc]-[self calledclass] + my calls + next + } + FilterCL instproc fclproc args {} + + FilterCL instfilter filterA + + FilterCL fcl + fcl fclproc + +# ::errorCheck $fUplevelResult "-::FilterCL-filterA-configure-::xotcl::Object-::FilterMix-calls-configure-::xotcl::Object-::FilterCL-filterA-init-::xotcl::Object-::FilterMix-calls-init-::xotcl::Object-::FilterCL-filterA-fclproc-::FilterCL-::FilterMix-calls-fclproc-::FilterCL" "Filter/Mixin Info Uplevel Test" + + return "PASSED [self]" +} + +TestX nextTest +@ TestX nextTest { + description { + Regression test object testing the next primitive. + } +} +nextTest proc run {{n 20}} { + for {set i 0} {$i < $n} {incr i} { + + global result infoNext + set result "" + set infoNext "" + + Class X + X instproc n {} { + append ::infoNext " [self]+[self class]->[self proc]*<[self next]>" + next + } + Class Y -superclass X + Y instproc m {} { + append ::infoNext " [self]+[self class]->[self proc]*<[self next]>" + next + } + Y instproc n {} { + append ::infoNext " [self]+[self class]->[self proc]*<[self next]>" + next + } + Y y + + y m + y n + y proc n {} { + append ::infoNext " [self]+[self class]->[self proc]*<[self next]>" + next + } + y n + ::errorCheck $infoNext " ::y+::Y->m*<> ::y+::Y->n*<::X instproc n> ::y+::X->n*<> ::y+->n*<::Y instproc n> ::y+::Y->n*<::X instproc n> ::y+::X->n*<>" \ + "simple self next test" + set infoNext "" + set result "" + + Class A + A instproc m arg { + global result infoNext + set result ${result}-[self]-$arg + } + Class B -superclass A + B instproc m arg { + global result infoNext + set result ${result}-[self]-$arg + append infoNext " 2[self]+[self class]->[self proc]*<[self next]>" + next + } + B b0 -m 1 + B b -m "" + + ::errorCheck $result "-::b0-1-::b0-1-::b--::b-" \ + "Next Test A/B -- Wrong result" + + set result "" + + Class X + X instproc init args { + global result infoNext + set result ${result}-[self]-$args + append infoNext " 1[self]+[self class]->[self proc]*<[self next]>" + next + } + X instproc test {} { + global result + set result ${result}-[self] + } + + X x -test + ::errorCheck $result "-::x-::x-" \ + "Next Test X -- Wrong result" + ::errorCheck $infoNext " 2::b0+::B->m*<::A instproc m> 2::b+::B->m*<::A instproc m> 1::x+::X->init*<::xotcl::Object instproc init>" \ + "self next test 2" + X destroy + x destroy + A destroy + B destroy + b0 destroy + b destroy + + Class MIX + MIX instproc mProc args { + global result + append result "[self]-[self class]-[self next]" + next + } + Object o -mixin MIX + o proc mProc args { + global result + append result "[self]-[self class]-[self next]" + } + set result "" + o mProc + ::errorCheck $result "::o-::MIX-::o proc mProc::o--" \ + "Next Test Proc & Mixin" + + o destroy; MIX destroy + } + return "PASSED [self]" +} + +TestX init_params +@ TestX init_params { + description { + Regression test object testing the parameter instance method, + the init dash '-' and constructor calling. + } +} + +init_params proc run {{n 20}} { + for {set i 0} {$i < $n} {incr i} { + global dashResult + set dashResult "" + set dashResultEnd "" + Class A + A instproc t0 {} { + global dashResult + set dashResult ${dashResult}*[self proc] + } + A instproc t1 {a} { + global dashResult + set dashResult ${dashResult}*[self proc]-$a + } + A instproc t2 {a b} { + global dashResult + set dashResult ${dashResult}*[self proc]-${a}-$b + } + A instproc t3 {a b c} { + global dashResult + set dashResult ${dashResult}*[self proc]-${a}-${b}-$c + } + A a + set dashResultEnd "[A a -t0] $dashResultEnd" + + A a + set dashResultEnd "[A a -t1 1] $dashResultEnd" + A a + set dashResultEnd "[A a -t2 1 2] $dashResultEnd" + A a + set dashResultEnd "[A a -t3 1 2 3] $dashResultEnd" + A a + set dashResultEnd "[A a -t0 -t0 -t3 1 2 3 -t0 -t1 1 -t1 1 -t0] $dashResultEnd" + + + catch {A a t} + + ::errorCheck $dashResult \ + "*t0*t1-1*t2-1-2*t3-1-2-3*t0*t0*t3-1-2-3*t0*t1-1*t1-1*t0" \ + "Init Dash Test fails" + ::errorCheck $dashResultEnd \ + "::a ::a ::a ::a ::a " \ + "Init Dash Test fails -- result" + } + + # paramter/defaults test + + proc ::cmd {a b} { + return in-cmd-${a}-${b} + } + + global parameterResult + global initResult + + for {set i 0} {$i < $n} {incr i} { + Class O -parameter { + {a -default 0} + {b -default {[cmd 3 4]}} c d + {e -default 3} + {Self -default [self]} + } + O instproc init args { + global initResult + set initResult ${initResult}-[self]-[self class]-[self proc]--$args + next + } + O instproc show {} { + global parameterResult + set parameterResult [self] + foreach v [lsort [my info vars]] { + set parameterResult ${parameterResult}-${v}=<[my set ${v}]> + } + } + Class Meta -superclass Class + Meta instproc create args {next; return Meta-create} + Meta C -superclass O -parameter {a {b -default ""} {c -default 1}} + Class D -parameter {a {c -default 1}} -superclass O + # create on class should not be called + D instproc create args {next; return D-create} + D instproc init args { + global initResult + set initResult ${initResult}-[self]-[self class]-[self proc]--$args + next + } + D instproc test i { + ::errorCheck [my set c]-[my set a] "2-0" "Wrong order of init call" + } + + set parameterResult "" + set initResult "" + C c0 -show + ::errorCheck $parameterResult "::c0-Self=<::c0>-a=<0>-b=<>-c=<1>-e=<3>" \ + "C c0 parameter Test failed" + if {$i == 0} { + ::errorCheck $initResult "-::c0-::O-init--" \ + "C c0 parameter init Test failed" + } else { + ::errorCheck $initResult "-::c0-::O-init--" \ + "C c0 parameter init Test failed (b)" + } + + set parameterResult "" + set initResult "" + set r [C c1 -c 2 -init a b c -a 1 -show] + + ::errorCheck $parameterResult "::c1-Self=<::c1>-a=<1>-b=<>-c=<2>-e=<3>" \ + "C c1 parameter Test failed (b)" + + ::errorCheck $initResult "-::c1-::O-init--a b c" \ + "C c1 parameter init Test failed" + + set parameterResult "" + set initResult "" + set r $r-[D d1 -c 2 -init a b c -test $i -a 1 -show] + ::errorCheck $parameterResult "::d1-Self=<::d1>-a=<1>-b=-c=<2>-e=<3>" \ + "D d1 parameter Test failed" + if {$i == 0} { + ::errorCheck $initResult "-::d1-::D-init--a b c-::d1-::O-init--a b c" \ + "D d1 parameter init Test failed" + } else { + ::errorCheck $initResult "-::d1-::D-init--a b c-::d1-::O-init--a b c" \ + "D d1 parameter init Test failed (b)" + } + + + ::errorCheck $r "Meta-create-::d1" \ + "User defined object creation failed" + } + return "PASSED [self]" +} + +TestX mixinTest +@ TestX mixinTest { + description { + Regression test object testing per-object mixins. + } +} + + +mixinTest proc run {{n 10}} { + + global mixinResult + set mixinResult "" + Class Agent + Agent instproc moveAgent {x y} { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + next + } + Agent instproc otherProc {} { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + next + } + Class InteractiveAgent -superclass Agent + InteractiveAgent instproc moveAgent {x y} { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + next + } + Class InteractiveAgent2 -superclass Agent + InteractiveAgent2 instproc moveAgent {x y} { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + next + } + Class InteractiveAgent3 -superclass Agent + InteractiveAgent3 instproc moveAgent {x y} { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + next + } + + # Addition-Classes + Class MovementLog + MovementLog instproc moveAgent {x y} { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + my otherProc + next + } + MovementLog instproc otherProc {} { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + next + } + Class MovementTest + MovementTest instproc moveAgent {x y} { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + next + } + InteractiveAgent i1; InteractiveAgent i2 + i1 mixin MovementLog + i2 mixin MovementTest + + InteractiveAgent2 instmixin {MovementLog MovementTest} + InteractiveAgent3 instmixin MovementTest + InteractiveAgent2 i3; InteractiveAgent3 i4; + + ::errorCheck [InteractiveAgent2 info instmixin] "::MovementLog ::MovementTest" "Mixin: info instmixin" + + + i2 moveAgent 1 2 + ::errorCheck "$mixinResult" \ + "-::i2-moveAgent-::MovementTest-::i2-moveAgent-::InteractiveAgent-::i2-moveAgent-::Agent" \ + "Mixin: 'i2 moveAgent 1 2' failed" + + set mixinResult "" + i1 moveAgent 3 4 + ::errorCheck "$mixinResult" \ + "-::i1-moveAgent-::MovementLog-::i1-otherProc-::MovementLog-::i1-otherProc-::Agent-::i1-moveAgent-::InteractiveAgent-::i1-moveAgent-::Agent" \ + "Mixin: 'i1 moveAgent 3 4' failed" + + set mixinResult "" + i3 moveAgent 3 4 + ::errorCheck "$mixinResult" \ + "-::i3-moveAgent-::MovementLog-::i3-otherProc-::MovementLog-::i3-otherProc-::Agent-::i3-moveAgent-::MovementTest-::i3-moveAgent-::InteractiveAgent2-::i3-moveAgent-::Agent" \ + "Instmixin: 'i3 moveAgent 3 4' failed" + + set mixinResult "" + i4 moveAgent 3 4 + + ::errorCheck "$mixinResult" \ + "-::i4-moveAgent-::MovementTest-::i4-moveAgent-::InteractiveAgent3-::i4-moveAgent-::Agent" \ + "Instmixin: 'i4 moveAgent 3 4' failed" + + i4 mixin {MovementTest MovementLog} + + i4 proc aaa args {puts TEST} + ::errorCheck [i4 procsearch moveAgent]-[i4 procsearch aaa]-[i4 procsearch set] "::MovementLog instproc moveAgent-::i4 proc aaa-::xotcl::Object instproc set" "[self]: procsearch" + + set mixinResult "" + i4 moveAgent 5 6 + ::errorCheck "$mixinResult" \ + -::i4-moveAgent-::MovementLog-::i4-otherProc-::MovementLog-::i4-otherProc-::Agent-::i4-moveAgent-::MovementTest-::i4-moveAgent-::InteractiveAgent3-::i4-moveAgent-::Agent \ + "Instmixin: 'i4 moveAgent 5 6' failed" + + Class A + A instproc test {} { + global mixinResult + set mixinResult "test" + i1 moveAgent 3 4 + } + A a + a test + ::errorCheck "$mixinResult" \ + "test-::i1-moveAgent-::MovementLog-::i1-otherProc-::MovementLog-::i1-otherProc-::Agent-::i1-moveAgent-::InteractiveAgent-::i1-moveAgent-::Agent" \ + "Mixin: 'a test' failed" + + i2 mixin {MovementLog MovementTest} + + set mixinResult "" + + i2 moveAgent a b + ::errorCheck "$mixinResult" \ + "-::i2-moveAgent-::MovementLog-::i2-otherProc-::MovementLog-::i2-otherProc-::Agent-::i2-moveAgent-::MovementTest-::i2-moveAgent-::InteractiveAgent-::i2-moveAgent-::Agent" \ + "Mixin: 'i2 moveAgent a b' failed" + + ::errorCheck "[i2 info mixin]-[i1 info mixin]-[a info mixin]" \ + "::MovementLog ::MovementTest-::MovementLog-" \ + "Mixin: Info failed" + + + ::errorCheck "[i2 ismixin MovementTest]-[i4 ismixin MovementTest]-[a ismixin MovementTest]-[i3 ismixin MovementTest]-[i4 ismixin MovementTest]-[i4 ismixin MovementLog]-[i3 ismixin YXZ]-[i3 ismixin InteractiveAgent]" \ + "1-1-0-1-1-1-0-0" \ + "'ismixin test' failed" + + ::errorCheck "[i2 hasclass MovementTest]-[i4 hasclass MovementTest]-[a hasclass MovementTest]-[i3 hasclass MovementTest]-[i4 hasclass MovementTest]-[i4 hasclass MovementLog]-[i3 hasclass YXZ]-[i3 hasclass InteractiveAgent]-[a hasclass A]-[i3 hasclass Agent]" \ + "1-1-0-1-1-1-0-0-1-1" \ + "'hasclass test' failed" + + set mixinResult "" + i2 mixin "" + i2 moveAgent a b + + ::errorCheck "$mixinResult" \ + "-::i2-moveAgent-::InteractiveAgent-::i2-moveAgent-::Agent" \ + "Mixin: remove failed" + + + set mixinResult "" + Class A + A instproc destroy args { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + next + } + A instproc y args { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + next + } + Class B + B instproc destroy args { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + next + } + B instproc y args { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + my mixin "" + next + } + B instproc x args { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + my destroy + } + + A a -mixin B + a destroy + + A a -mixin B + a x + + A a -mixin B + a y + + ::errorCheck "$mixinResult" \ + "-::a-destroy-::B-::a-destroy-::A-::a-x-::B-::a-destroy-::B-::a-destroy-::A-::a-y-::B-::a-y-::A" \ + "Mixin: destroy failed" + + A instmixin B + set mixinResult "" + A a2 + a2 destroy + A a2 + a2 x + A a2 + a2 y + + ::errorCheck "$mixinResult" \ + "-::a2-destroy-::B-::a2-destroy-::A-::a2-x-::B-::a2-destroy-::B-::a2-destroy-::A-::a2-y-::B-::a2-y-::A" \ + "Instmixin: destroy failed" + + # mixin Test: calls the mixins and a proc of the object + set ::mixinResult "" + Class A + Class B + A instproc a {} {set ::mixinResult ${::mixinResult}-[self]-[self class]-[self proc];next} + B instproc a {} {set ::mixinResult ${::mixinResult}-[self]-[self class]-[self proc]; next} + A d -mixin B + d proc a {} {set ::mixinResult ${::mixinResult}-[self]-[self class]-[self proc]; next} + d a + ::errorCheck $::mixinResult \ + "-::d-::B-a-::d--a-::d-::A-a" \ + "Mixin: calling of object's proc" + + set mixinResult "" + + d mixin {} + A instmixin B + d a + + ::errorCheck $::mixinResult \ + "-::d-::B-a-::d--a-::d-::A-a" \ + "Instmixin: calling of object's proc" + + # + # combining filters with mixins + # + set ::traceResults "" + + Class M1 + M1 instproc test args { + global traceResults + lappend traceResults "[self] [self proc] [self class]" + next + } + Class M2 + M2 instproc test args { + global traceResults + lappend traceResults "[self] [self proc] [self class]" + next + } + Class A + A instproc test args { + global traceResults + lappend traceResults "[self] [self proc] [self class]" + next + } + A instproc f1 args { + global traceResults + lappend traceResults "[self] [self proc] [self class]" + next + } + A instproc f2 args { + global traceResults + lappend traceResults "[self] [self proc] [self class]" + next + } + + A a + A instmixin {M1 M2} + A instfilter {f1 f2} + a test + + ::errorCheck $::traceResults \ + "{::a f1 ::A} {::a f2 ::A} {::a test ::M1} {::a test ::M2} {::a test ::A}" \ + "Combining mixins and filters" + + # mixin recursion test + set mixinResult "" + + Class Computation + Computation instproc compute args { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + # abstract interface for computations + } + Class ComputationOutput -superclass Computation + Computation instproc compute args { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + return $args + } + + Class RecFacultyMixin + RecFacultyMixin instproc compute args { + global mixinResult + set mixinResult ${mixinResult}-[self]-[self proc]-[self class] + set n [lindex $args 0] + set callingClass - + #puts stderr [self class]=[uplevel 1 self class]-[self callingclass] + #catch {set callingClass [uplevel 1 self class]} + set callingClass [self callingclass] + if {$n == 0} { + set result 1 + } else { + set f [my compute [expr $n - 1] x] + set result [expr $n * $f] + } + + if {$callingClass != [self class]} { + next $result + return $result + } else { + return $result + } + } + + ComputationOutput faculty + faculty mixin RecFacultyMixin + + ::errorCheck [faculty compute 3] 6 \ + "Mixin: faculty wrong result" + + ::errorCheck "$mixinResult" \ + "-::faculty-compute-::RecFacultyMixin-::faculty-compute-::RecFacultyMixin-::faculty-compute-::RecFacultyMixin-::faculty-compute-::RecFacultyMixin-::faculty-compute-::Computation" \ + "Mixin: faculty failed" + set mixinResult "" + + ComputationOutput faculty + ComputationOutput instmixin RecFacultyMixin + ::errorCheck [faculty compute 3] 6 \ + "Mixin: faculty wrong result" + + ::errorCheck "$mixinResult" \ + "-::faculty-compute-::RecFacultyMixin-::faculty-compute-::RecFacultyMixin-::faculty-compute-::RecFacultyMixin-::faculty-compute-::RecFacultyMixin-::faculty-compute-::Computation" \ + "Mixin: faculty failed" + + + set ::mixinResult "" + set ::calling "" + + Class GrObject + GrObject instproc draw args { + lappend ::mixinResult [list grObject [self] [self proc] [self class]] + lappend ::calling [list grObject [self proc]: [self callingobject] [self callingclass] [self callingproc] [self next]] + } + + Class Image -superclass GrObject + Image instproc draw args { + lappend ::mixinResult [list image [self] [self proc] [self class]] + lappend ::calling [list image [self proc]: [self callingobject] [self callingclass] [self callingproc] [self next]] + next + } + + Class MenuDecorator + MenuDecorator instproc draw args { + lappend ::mixinResult [list m1 [self] [self proc] [self class]] + lappend ::calling [list m1 [self proc]: [self callingobject] [self callingclass] [self callingproc] [self next]] + next + } + + Class ScrollBarDecorator + ScrollBarDecorator instproc draw args { + lappend ::mixinResult [list m2 [self] [self proc] [self class]] + lappend ::calling [list m2 [self proc]: [self callingobject] [self callingclass] [self callingproc] [self next]] + next + } + + Image mainImage -mixin {MenuDecorator ScrollBarDecorator} + Image zoom -mixin {ScrollBarDecorator} + + Object instproc f args { + if {[self calledproc] != "filter"} { + lappend ::mixinResult [list filter [self] [self proc] [self class]] + lappend ::calling [list filter [self proc]: [self callingobject] [self callingclass] [self callingproc] [self calledproc] [self next]] + } + return [next] + } + Object instfilter f + mainImage draw + zoom draw + + Object instfilter "" + + ::errorCheck $::calling \ + "{filter f: ::mixinTest {} run draw {::MenuDecorator instproc draw}} {m1 draw: ::mixinTest {} run {::ScrollBarDecorator instproc draw}} {m2 draw: ::mixinTest {} run {::Image instproc draw}} {image draw: ::mixinTest {} run {::GrObject instproc draw}} {grObject draw: ::mixinTest {} run {}} {filter f: ::mixinTest {} run draw {::ScrollBarDecorator instproc draw}} {m2 draw: ::mixinTest {} run {::Image instproc draw}} {image draw: ::mixinTest {} run {::GrObject instproc draw}} {grObject draw: ::mixinTest {} run {}} {filter f: ::mixinTest {} run instfilter {::xotcl::Class instproc instfilter}}" \ + "Mixin: Calling-Obj/Cl/Proc failed" + + ::errorCheck "$::mixinResult" \ + "{filter ::mainImage f ::xotcl::Object} {m1 ::mainImage draw ::MenuDecorator} {m2 ::mainImage draw ::ScrollBarDecorator} {image ::mainImage draw ::Image} {grObject ::mainImage draw ::GrObject} {filter ::zoom f ::xotcl::Object} {m2 ::zoom draw ::ScrollBarDecorator} {image ::zoom draw ::Image} {grObject ::zoom draw ::GrObject} {filter ::xotcl::Object f ::xotcl::Object}" \ + "Mixin: Filter failed" + + set ::mixinResult "" + set ::calling "" + + Class InfoTrace2 + InfoTrace2 instproc infoTraceFilter2 args { + lappend ::calling \ + self [self] \ + "self proc" [self proc] \ + "self class" [self class] \ + "self calledproc" [self calledproc] \ + "self callingproc" [self callingproc] \ + "self callingobject" [self callingobject] \ + "self callingclass" [self callingclass] \ + "self filterreg" [self filterreg] \ + "self next" [self next] + next + } + + Class CallingObjectsClass + CallingObjectsClass create callingObject + + Class FilterRegClass -superclass InfoTrace2 + Class FilteredObjectsClass -superclass FilterRegClass + FilteredObjectsClass filteredObject + + CallingObjectsClass instproc callingProc args { + filteredObject set someVar 0 + } + FilterRegClass instfilter infoTraceFilter2 + + callingObject callingProc + + ::errorCheck $::calling \ + {self ::filteredObject {self proc} infoTraceFilter2 {self class} ::InfoTrace2 {self calledproc} set {self callingproc} callingProc {self callingobject} ::callingObject {self callingclass} ::CallingObjectsClass {self filterreg} {::FilterRegClass instfilter infoTraceFilter2} {self next} {::xotcl::Object instproc set}} \ + "call stack info" + + Class M1; Class M2; Class M3; Class M4 + Class A; Class B -superclass A; B b + A instmixin {M1 M2} + B instmixin {M3 M1 M1 M4} + b mixin {M1 M1 M4} + + ::errorCheck [b info mixin -order] "::M3 ::M4 ::M1 ::M2" "Mixin Info: -order option" + ::errorCheck [B info instmixin]-[b info mixin] "::M3 ::M1 ::M4-::M1 ::M4" "Mixin Info: no duplicates" + B instmixin {} + ::errorCheck [b info mixin -order] "::M4 ::M1 ::M2" "Mixin Info: -order option" + + set ::r "" + Class X11 -instproc test {args} { + lappend ::r [self class] + next + } + Class X12 -instproc test {args} { + lappend ::r [self class] + next + } + Class X -instmixin {X11 X12} -instproc test {args} { + lappend ::r [self class] + next + } + + Class Y -instmixin X + Y create y -test + + X create x -test + + ::errorCheck $::r [list ::X11 ::X12 ::X ::X11 ::X12 ::X] \ + {transitive mixin} + + unset ::r + + # test for MixinRemoveFromMixinStack, MixinRemoveFromCmdPtr, + # MixinRemoveOnObjFromCmdPtr + Class A + A instproc x {} {B destroy; next} + Class B + B instproc x {} {next} + Class C + C instproc x {} {next} + + Object o -mixin {A B C} + o proc x {} {return x} + ::errorCheck [o x] {x} {mixin destroy on stack} + + return "PASSED [self]" + } + +TestX mixinInheritanceTest +@ TestX mixinInheritanceTest { + description { + Regression test object testing per-object mixin inheritance. + } +} + +mixinInheritanceTest proc run {{n 10}} { + for {set i 0} {$i < $n} {incr i} { + global mixinResult + set mixinResult "" + + Class A + Class B + Class C -superclass {A B} + + Class GeneralMixin + Class RefinedMixin1 -superclass GeneralMixin + Class RefinedMixin2 -superclass GeneralMixin + Class AppMixin1 -superclass {RefinedMixin1 RefinedMixin2} + Class AppMixin2 -superclass {RefinedMixin2 RefinedMixin1} + Class AppMixin3 -superclass {RefinedMixin1} + + A instproc aProc args { + global mixinResult; + ::set mixinResult "$mixinResult [self class]" + return $args + } + B instproc aProc args { + global mixinResult; + ::set mixinResult "$mixinResult [self class]" + return $args + } + C instproc aProc args { + global mixinResult; + ::set mixinResult "$mixinResult [self class]" + return [next "$args [self class]"] + } + GeneralMixin instproc aProc args { + global mixinResult; + ::set mixinResult "$mixinResult [self class]" + return [next "$args [self class]"] + } + RefinedMixin1 instproc aProc args { + global mixinResult; + ::set mixinResult "$mixinResult [self class]" + return [next "$args [self class]"] + } + RefinedMixin2 instproc aProc args { + global mixinResult; + ::set mixinResult "$mixinResult [self class]" + return [next "$args [self class]"] + } + AppMixin1 instproc aProc args { + global mixinResult; + ::set mixinResult "$mixinResult [self class]" + return [next "$args [self class]"] + } + + AppMixin1 mixinInstance + set r [mixinInstance aProc ARGS1 ARGS2] + ::errorCheck $mixinResult \ + " ::AppMixin1 ::RefinedMixin1 ::RefinedMixin2 ::GeneralMixin" \ + "Mixin inheritance: mixinInstance aProc" + set mixinResult "" + + AppMixin3 mixinInstance2 + set r [mixinInstance2 aProc ARGS1 ARGS2] + ::errorCheck $mixinResult \ + " ::RefinedMixin1 ::GeneralMixin" \ + "Mixin inheritance: mixinInstance2 aProc" + set mixinResult "" + + A a + a mixin AppMixin1 + set r [a aProc ARGS1 ARGS2] + ::errorCheck $mixinResult \ + " ::AppMixin1 ::RefinedMixin1 ::RefinedMixin2 ::GeneralMixin ::A" \ + "Mixin inheritance: a aProc" + + + ::errorCheck $r \ + "{{{{ARGS1 ARGS2 ::AppMixin1} ::RefinedMixin1} ::RefinedMixin2} ::GeneralMixin}" \ + "Mixin inheritance result: a aProc" + + A a + A instmixin AppMixin1 + + set mixinResult "" + + set r [a aProc ARGS1 ARGS2] + ::errorCheck $mixinResult \ + " ::AppMixin1 ::RefinedMixin1 ::RefinedMixin2 ::GeneralMixin ::A" \ + "Instmixin inheritance: a aProc" + ::errorCheck $r \ + "{{{{ARGS1 ARGS2 ::AppMixin1} ::RefinedMixin1} ::RefinedMixin2} ::GeneralMixin}" \ + "Instmixin inheritance: a aProc" + set mixinResult "" + + C c + c mixin {AppMixin3 AppMixin2} + + set r [c aProc ARGS1 ARGS2] + ::errorCheck $mixinResult \ + " ::AppMixin1 ::RefinedMixin1 ::RefinedMixin2 ::GeneralMixin ::C ::A" \ + "Mixin/Instmixin inheritance: c aProc" + set mixinResult "" + A instmixin {} + + set r [c aProc ARGS1 ARGS2] + ::errorCheck $mixinResult \ + " ::RefinedMixin2 ::RefinedMixin1 ::GeneralMixin ::C ::A" \ + "Mixin/Instmixin inheritance: c aProc" + + GeneralMixin instproc set args { + global mixinResult; + ::set mixinResult "$mixinResult [self class]" + return [next] + } + RefinedMixin1 instproc set args { + global mixinResult; + ::set mixinResult "$mixinResult [self class]" + return [next] + } + AppMixin1 instproc set args { + global mixinResult; + ::set mixinResult "$mixinResult [self class]" + return [next] + } + + global setFilterResult + set setFilterResult "" + Object instproc setFilter args { + global setFilterResult + ::append setFilterResult \ + -[self]-[self calledproc]-[self calledclass] + next + } + + Object instfilter setFilter + + set mixinResult "" + set r [c set setVar 111] + + ::errorCheck $mixinResult \ + " ::RefinedMixin1 ::GeneralMixin" \ + "Mixin inheritance: c set" + # UNKNOWN PROBLEM 2 + # ::errorCheck [c setsetVar] 111 "Mixin inheritance: c set - value" + + ::errorCheck [c set setVar] 111 "Mixin inheritance: c set - value" + set mixinResult "" + mixinInstance set setVar 222 + + ::errorCheck $mixinResult \ + " ::AppMixin1 ::RefinedMixin1 ::GeneralMixin" \ + "Mixin inheritance: mixinInstance set" + ::errorCheck [mixinInstance set setVar] 222\ + "Mixin inheritance: mixinInstance set - value" + + ::errorCheck $setFilterResult \ + "-::c-set-::xotcl::Object-::c-set-::xotcl::Object-::mixinInstance-set-::AppMixin1-::mixinInstance-set-::AppMixin1" \ + "Mixin inheritance: Wrong classes in mixin set test" + + Object instfilter "" + } + + # Mixin init test + global initResult + set initResult "" + Class A + A instproc init args { + my mixin B + global initResult + append initResult [self class]- + next + } + + Class C + C instproc init args { + global initResult + append initResult [self class]- + next + } + + Class B -superclass C + B instproc init args { + global initResult + append initResult [self class]- + next + } + + Class D + D instproc init args { + global initResult + append initResult [self class]- + next + } + + A a + ::errorCheck $initResult \ + "::A-" \ + "Mixin init 1 failed" + set initResult "" + # in A mixin changes to B - before D's constructor must + # be called + A b -mixin D + ::errorCheck $initResult \ + "::D-::A-" \ + "Mixin init 2 failed" + + Class Mix + Mix instproc init args { + global initResult + append initResult [self class]- + next + } + Class Mix1 + Mix1 instproc init args { + global initResult + append initResult [self class]- + next + } + Class Mix2 + Mix2 instproc init args { + global initResult + append initResult [self class]- + next + } + Class A + A instproc init args { + global initResult + append initResult [self class]- + next + } + Class B + B instproc init args { + my mixin {Mix Mix1} + global initResult + append initResult [self class]- + next + } + + set initResult "" + A a + a mixin {Mix Mix1} + ::errorCheck $initResult \ + "::A-" \ + "Mixin init 3 failed" + + set initResult "" + B b + ::errorCheck $initResult \ + "::B-" \ + "Mixin init 4 failed" + + set initResult "" + B mixinappend Mix2 + ::errorCheck $initResult \ + "" \ + "Mixin init 5 failed" + + set initResult "" + A mixin {}; A mixin {Mix Mix1} + ::errorCheck $initResult \ + "" \ + "Mixin init 6 failed" + + set initResult "" + A a -mixin {Mix} + ::errorCheck $initResult \ + "::Mix-::A-" \ + "Mixin init 7 failed" + + Class Strategy + Strategy instproc init args { + global initResult + append initResult [self class]- + next + } + Class A + A instproc strategy {n} { + set a [my info mixin] + my mixin [concat $n $a] + } + A instproc init args { + global initResult + append initResult [self class]- + next + } + Class Mix1 + Mix1 instproc init args { + global initResult + append initResult [self class]- + my strategy Strategy + next + } + set initResult "" + A a -mixin Mix1 + ::errorCheck $initResult \ + "::Mix1-::A-" \ + "Mixin init 8 failed" + + set initResult "" + Class X + X instproc init args { + append ::initResult " [self]: [self class]->[self proc]" + next + } + Class Y -superclass X + Y instproc init args { + append ::initResult " [self]: [self class]->[self proc]" + next + } + + Class U -superclass X + U instproc init args { + append ::initResult " [self]: [self class]->[self proc]" + next + } + Class V + V instproc init args { + append ::initResult " [self]: [self class]->[self proc]" + next + } + + Class A + A instproc init args { + append ::initResult " [self]: [self class]->[self proc]" + next + } + Class B -superclass A + B instproc init args { + append ::initResult " [self]: [self class]->[self proc]" + next + } + A a + a mixin X + B b + b mixin Y + A a2 -mixin Y + B b2 -mixin X + A a3 -mixin {U V} + B b3 + b3 mixin {U V} + A a3 + A instmixin X + A instmixin {} + B instmixin Y + B b3 + b3 mixin Y + + ::errorCheck $initResult \ + " ::a: ::A->init ::b: ::B->init ::b: ::A->init ::a2: ::Y->init ::a2: ::X->init ::a2: ::A->init ::b2: ::X->init ::b2: ::B->init ::b2: ::A->init ::a3: ::U->init ::a3: ::X->init ::a3: ::V->init ::a3: ::A->init ::b3: ::B->init ::b3: ::A->init ::a3: ::A->init ::b3: ::Y->init ::b3: ::X->init ::b3: ::B->init ::b3: ::A->init" \ + "Mixin init 9 failed" + + return "PASSED [self]" +} + +TestX copymove +@ TestX copymove { + description { + Regression test for copy/move methods + } +} +copymove proc run {{n 10}} { + # Composite + Class Composite -superclass Class + Composite instproc addop {op} { + my instvar ops + set ops($op) $op + } + Composite instproc compositeFilter args { + set m [self calledproc] + set c [lindex [self filterreg] 0] + set r [next] + + if {[$c exists ops($m)]} { + foreach child [my info children] { + eval [self]::$child $m $args + } + } + return $r + } + + Composite AbstractNode + AbstractNode abstract instproc iterate v + AbstractNode addop iterate + for {set i 0} {$i < $n} {incr i} { + # + # class copy + # + Class X + Class X::Y + Class X::Y::Z -parameter { + {param1 1} + {param2 2} + } + #X::Y::Z metadata add {Version Author Nothing} + #X::Y::Z metadata Version {0.0.9} + #X::Y::Z metadata Author {Uwe} + X::Y::Z instproc defaultValueIP {{a defA} {b defB} v} { + return + } + X::Y::Z proc defaultValueP {{c defC} {d defD} v} { + return + } + + X::Y::Z instinvar {{7 > 6} { + #a comment + } + } + X::Y::Z instproc assProc {} {puts x} {{5 > 4} { + #pre + }} {{5 > 4} { + #post + } + } + + X::Y::Z check {pre post instinvar} + + foreach C {X X::Y X::Y::Z} { + $C instproc q {a b c} { + return [self]--[self class]--[self proc]--[next]-- + } + } + X::Y::Z z + X::Y::Z copy V + V v + ::errorCheck "[z q 1 2 3]--[X::Y::Z info class]--[X::Y::Z info classparent]" \ + "::z--::X::Y::Z--q------::xotcl::Class--::X::Y"\ + "class copy z" + ::errorCheck "[v q 1 2 3]--[V info class]--[V info classparent]" "::v--::V--q------::xotcl::Class--::"\ + "class copy v" + ::errorCheck "[::cutSpaces [V info parameter]--[v set param1]--[v set param2]]" \ + " {param1 1} {param2 2} --1--2" \ + "parameter test" + ::errorCheck "[::cutSpaces [V info instinvar]--[V info instpre assProc]--[V info instpost assProc]]"\ + "{7 > 6} { #a comment }--{5 > 4} { #pre }--{5 > 4} { #post }"\ + "Copy Class Assertions" + #::errorCheck "[V info metadata]--[V metadata Author]--[V metadata Version]--[V metadata Nothing]"\ + "Version Author Nothing--Uwe--0.0.9--"\ + "Copy Metadata" + + set df1 [V info default defaultValueP v dfv1] + set df2 [V info default defaultValueP c dfv2] + set df3 [V info instdefault defaultValueIP v dfv3] + set df4 [V info instdefault defaultValueIP a dfv4] + ::errorCheck "$df1 $dfv1 $df2 $dfv2 $df3 $dfv3 $df4 $dfv4"\ + "0 1 defC 0 1 defA"\ + "Copy Default Values" + + # class hierarchy copy + Class O + X copy O::X + O::X x1; O::X::Y y1; O::X::Y::Z z1 + ::errorCheck "[x1 q 1 2 3]--[y1 q 1 2 3]--[z1 q 1 2 3]" \ + "::x1--::O::X--q------::y1--::O::X::Y--q------::z1--::O::X::Y::Z--q----"\ + "class hierarchy copy" + # + # object copy + # + X x -set var1 12 -requireNamespace + proc ::x::tclProc args {return tclProc} + x proc q {a b c} {return [self]--[self class]--[self proc]--[next]--} + x copy y + ::errorCheck "[::y::tclProc]--[x q 1 2 3]--[y q 1 2 3]" \ + "tclProc--::x----q--::x--::X--q--------::y----q--::y--::X--q------"\ + "object copy" + # object hierarchy copy + x copy x::a + + x copy x::a::z + + ::errorCheck "[::x::a::tclProc]--[::x::a::z::a::tclProc]" \ + "tclProc--tclProc"\ + "object hierarchy copy" + + Class O + O x + x invar {{7 > 5} { + #a comment + }} + x proc assProc {} {return} {{5 > 3} { + #pre + }} {{5 > 4} {#post + }} + x set var1 12 + x proc p1 {} {return [self]-p1} + x copy y + ::errorCheck "[x p1]--[x set var1]--[::x info class]" "::x-p1--12--::O"\ + "Simple Copy - Origin" + ::errorCheck "[y p1]--[y set var1]--[::y info class]" "::y-p1--12--::O"\ + "Simple Copy - Duplicate" + ::errorCheck "[::cutSpaces [y info invar]--[y info pre assProc]--[y info post assProc]]"\ + "{7 > 5} { #a comment }--{5 > 3} { #pre }--{5 > 4} {#post }"\ + "Copy Obj Assertions" + + # + # move test + # + V destroy + X::Y::Z move V + V v + + ::errorCheck "[v q 1 2 3]--[V info class]--[V info classparent]" "::v--::V--q------::xotcl::Class--::"\ + "class move v" + ::errorCheck "[::cutSpaces [V info parameter]--[v set param1]--[v set param2]]" \ + " {param1 1} {param2 2} --1--2" \ + "parameter move test" + ::errorCheck "[::cutSpaces [V info instinvar]--[V info instpre assProc]--[V info instpost assProc]]"\ + "{7 > 6} { #a comment }--{5 > 4} { #pre }--{5 > 4} { #post }"\ + "Move Class Assertions" + #::errorCheck "[V info metadata]--[V metadata Author]--[V metadata Version]--[V metadata Nothing]"\ + "Version Author Nothing--Uwe--0.0.9--"\ + "Move Metadata" + + set df1 [V info default defaultValueP v dfv1] + set df2 [V info default defaultValueP c dfv2] + set df3 [V info instdefault defaultValueIP v dfv3] + set df4 [V info instdefault defaultValueIP a dfv4] + ::errorCheck "$df1 $dfv1 $df2 $dfv2 $df3 $dfv3 $df4 $dfv4"\ + "0 1 defC 0 1 defA"\ + "Move Default Values" + + ::errorCheck "[::info commands X::Y::Z]"\ + ""\ + "Moved command still exists" + + # + # copy with filters test + # + foreach filters {{} compositeFilter} { + Composite instfilter $filters + AbstractNode instfilter $filters + Object commands + Class Commands -superclass AbstractNode + Class Command -superclass Commands + Command instproc init args { + my instvar label + set label [self] + next + } + Command instproc setlabel {{arg ""}} { + my instvar label + if {$arg == ""} { + set label + } else { + set label $arg + } + } + Command instproc setproc {value} { + my instvar src + set src $value + } + # prototypes + Command commands::cellcmd + commands::cellcmd setlabel cell + commands::cellcmd setproc {return "coucou" } + commands::cellcmd proc x args {return xxx} + commands::cellcmd copy toto + ::errorCheck [::toto info class] ::Command\ + "Copy with Filter: info class" + ::errorCheck [toto set label] cell\ + "Copy with Filter: set var" + ::errorCheck [toto x] xxx\ + "Copy with Filter: call proc" + ::errorCheck [commands::cellcmd set label] cell\ + "Copy with Filter: set var" + } + Class A + Class V + Class Z + Class B -superclass A + Class B1 -superclass {V A Z} + A move X + ::errorCheck [B info superclass]-[B1 info superclass]-[X info subclass] \ + "::X-::V ::X ::Z-::B ::B1" \ + "Move of subclass relationship" + } + return "PASSED [self]" +} + +TestX recreation +@ TestX recreation { + description { + Regression test for object recreation/cleanup. + } +} +recreation proc run {{n 10}} { + for {set i 0} {$i < $n} {incr i} { + set ::recreateResult "" + Class R + R instproc recreate args { + global recreateResult + append recreateResult "*recreate [self] $args* " + set r [next] + append recreateResult "*recreate [self] <[lindex $args 0]> $r * " + return $r + } + Object instmixin R + + catch { + C destroy + c1 destroy + } + Class C -parameter {a b} + C instproc cProc {} {return cProc} + C set r 4 + C set v 5 + + C c1 -a 1 + c1 proc x {} {return p} + c1 set x 3 + C c1 -b 2 + append ::recreateResult "+[c1 info vars]," + append ::recreateResult "[c1 info procs] +" + + Class C + C set w 3 + append ::recreateResult "+[C info vars]," + append ::recreateResult "[C info instprocs] +" + if {$i > 0} { + errorCheck [set ::recreateResult] \ + "*recreate ::xotcl::Class R* *recreate ::xotcl::Class R * *recreate ::C c1 -b 2* *recreate ::C c1 * +b, +*recreate ::xotcl::Class C* *recreate ::xotcl::Class C * +w, +" \ + "Var/proc recreate delete failed (n)" + } else { + errorCheck [set ::recreateResult] \ + "*recreate ::C c1 -b 2* *recreate ::C c1 * +b, +*recreate ::xotcl::Class C* *recreate ::xotcl::Class C * +w, +" \ + "Var/proc recreate delete failed (0)" + } + global recreateMixinResult + global recreateFilterResult + set recreateMixinResult "" + set recreateFilterResult "" + Class RecreateObserve + foreach ip {create destroy instdestroy init configure + recreate cleanup alloc class} { + RecreateObserve instproc $ip args { + append ::recreateMixinResult " [self]+[self class]->[self proc]" + next + } + } + + Class Recreated + Recreated instproc recreationFilter args { + append ::recreateFilterResult " [self]+[self calledclass]->[self calledproc]" + next + } + Recreated instfilter recreationFilter + Recreated mixin RecreateObserve + Recreated instmixin RecreateObserve + + Recreated recreateObj + Recreated recreateObj + recreateObj destroy + errorCheck [set ::recreateFilterResult] \ + " ::recreateObj+::xotcl::Object->configure ::recreateObj+::xotcl::Object->init ::recreateObj+::xotcl::Object->cleanup ::recreateObj+::xotcl::Object->configure ::recreateObj+::xotcl::Object->init ::recreateObj+::xotcl::Object->destroy" \ + "recreateObj - recreateFilterResult" + if {$i == 0} { + errorCheck [set ::recreateMixinResult] \ + " ::Recreated+::RecreateObserve->create ::Recreated+::RecreateObserve->alloc ::recreateObj+::RecreateObserve->configure ::recreateObj+::RecreateObserve->init ::Recreated+::RecreateObserve->create ::Recreated+::RecreateObserve->recreate ::recreateObj+::RecreateObserve->cleanup ::recreateObj+::RecreateObserve->configure ::recreateObj+::RecreateObserve->init ::recreateObj+::RecreateObserve->destroy ::Recreated+::RecreateObserve->instdestroy" \ + "recreateObj - recreateMixinResult (0)" + } else { + errorCheck [set ::recreateMixinResult] \ + " ::Recreated+::RecreateObserve->cleanup ::Recreated+::RecreateObserve->create ::Recreated+::RecreateObserve->alloc ::recreateObj+::RecreateObserve->configure ::recreateObj+::RecreateObserve->init ::Recreated+::RecreateObserve->create ::Recreated+::RecreateObserve->recreate ::recreateObj+::RecreateObserve->cleanup ::recreateObj+::RecreateObserve->configure ::recreateObj+::RecreateObserve->init ::recreateObj+::RecreateObserve->destroy ::Recreated+::RecreateObserve->instdestroy" \ + "recreateObj - recreateMixinResult (n)" + } + } + + set ::cleanupResult "" + + catch {a destroy} + catch {A destroy} + catch {X destroy} + catch {META destroy} + + Class A + A proc instdestroy args {append ::cleanupResult " [self]+[self class]->[self proc]"; next} + A proc recreate args {append ::cleanupResult " [self]+[self class]->[self proc]"; next} + A instproc destroy args {append ::cleanupResult " [self]+[self class]->[self proc]"; next} + A instproc cleanup args {append ::cleanupResult " [self]+[self class]->[self proc]"; next} + + A a + A a::b + errorCheck [set ::cleanupResult] \ + "" \ + "Cleanup Create Failed" + A a + errorCheck [a info children] \ + "" \ + "Cleanup Object Children Destroy Failed" + A a::b + + errorCheck [set ::cleanupResult] \ + " ::A+->recreate ::a+::A->cleanup ::a::b+::A->destroy ::A+->instdestroy" \ + "Cleanup a/a::b Failed (n)" + a destroy; + set ::cleanupResult "" + A instproc cleanup args {append ::cleanupResult " [self]+[self class]->[self proc]"} + + A a + A a::b + errorCheck [set ::cleanupResult] \ + "" \ + "Cleanup Redefine Create Failed" + A a + errorCheck [a info children] \ + "::a::b" \ + "Cleanup Redefine Object Children Survive Failed" + A a::b + errorCheck [set ::cleanupResult] \ + " ::A+->recreate ::a+::A->cleanup ::A+->recreate ::a::b+::A->cleanup" \ + "Cleanup Redefine a/a::b Failed" + + a destroy + set ::cleanupResult "" + + + Class META -superclass Class + META proc instdestroy args {append ::cleanupResult " [self]+[self class]->[self proc]"; next} + META proc recreate args {append ::cleanupResult " [self]+[self class]->[self proc]"; next} + META instproc destroy args {append ::cleanupResult " [self]+[self class]->[self proc]"; next} + META instproc cleanup args {append ::cleanupResult " [self]+[self class]->[self proc]"; next} + + META X + META X::Y + errorCheck [set ::cleanupResult] \ + "" \ + "Class Cleanup Create Failed" + META X + errorCheck [X info classchildren] \ + "" \ + "Class Cleanup Class Children Destroy Failed" + META X::Y + errorCheck [set ::cleanupResult] \ + " ::META+->recreate ::X+::META->cleanup ::X::Y+::META->destroy ::META+->instdestroy" \ + "Class Cleanup X/X::Y Failed" + + X destroy; + set ::cleanupResult "" + META instproc cleanup args {append ::cleanupResult " [self]+[self class]->[self proc]"} + + META X + META X::Y + errorCheck [set ::cleanupResult] \ + "" \ + "Class Cleanup Redefine Create Failed" + META X + errorCheck [X info classchildren] \ + "::X::Y" \ + "Class Cleanup Redefine Class Children Survive Failed" + META X::Y + errorCheck [set ::cleanupResult] \ + " ::META+->recreate ::X+::META->cleanup ::META+->recreate ::X::Y+::META->cleanup" \ + "Class Cleanup Redefine X/X::Y Failed" + + X destroy + A destroy + META destroy + unset ::cleanupResult + + return "PASSED [self]" +} + + +TestX smallScripts +@ TestX smallScripts { + description { + Regression test object testing arbitrary features. + } +} +proc ::up1 {} { + return [uplevel 1 self] +} +proc ::up3 {} { + return [uplevel 3 self] +} +proc ::up2 {} { + return [up3] +} +smallScripts proc run {{n 20}} { + catch {Object o; o r} errMsg + ::errorCheck $errMsg "::o: unable to dispatch method 'r'" "Unknown Test" + + # uplevel test + for {set i 0} {$i < $n} {incr i} { + Object o + o proc u2 {} {return [::up2]} + o proc u1 {} {return [::up1]} + + Class SM + SM instproc init args { + ::errorCheck [o u1] "::o" "FAILED - UpLevel Test 1" + ::errorCheck [o u2] "::s" "FAILED - UpLevel Test 2" + } + SM s + } + + for {set i 0} {$i < $n} {incr i} { + Class A + A a + set oname1 [Object autoname ooo] + set oname2 [Object autoname -instance OOO] + A autoname -reset AAA + set names [A autoname AAA] + a autoname -reset aaa + lappend names [a autoname aaa] + lappend names [a autoname aaa] + ::errorCheck $names "AAA0 aaa0 aaa1" \ + "Autoname creation" + ::errorCheck $oname1 "ooo$i" \ + "Autoname Object 1" + ::errorCheck $oname2 "oOO$i" \ + "Autoname Object 2" + ::errorCheck [xotcl::Object set __autonames(ooo)] $i \ + "Autoname Object Count" + } + + Class P; P p + P instproc x {} { + my instvar "x(1) t" + return $t + } + p set x(1) rrr + ::errorCheck [p x] "rrr" "Array member alias, no ns" + + Object o + o proc x {} { + my instvar "x(1) t" + return $t + } + o set x(1) rrr + ::errorCheck [o x] "rrr" "Array member alias, with ns" + + Object o + o proc x args {puts r} + ::errorCheck [o info body x] "puts r" "Info Body" + ::errorCheck [info body o::x] "puts r" "Info Body" + + Object o + o proc a {} { + my lappend table(i) xxx + } + ::errorCheck [o a]-[o set table(i)] "xxx-xxx" "Array instvar create" + + Class A + A instproc myProc args {} + Class Mix1 + Mix1 instproc myProcMix1 args {} + Class Mix2 + Mix2 instproc myProcMix2 args {} + Class B -superclass A -instmixin Mix1 + B instproc myProc2 args {} + B b -mixin Mix2 + b proc objproc args {} + + ::errorCheck [b info procs] "objproc" "[self]: info procs" + ::errorCheck [B info instprocs] "myProc2" "[self]: info instprocs" + + ::errorCheck [lsort [b info methods]] "__next abstract append array autoname check class cleanup configure copy defaultmethod destroy eval exists extractConfigureArg f filter filterappend filterguard filtersearch hasclass incr info infoTraceFilter init instvar invar isclass ismetaclass ismixin isobject istype lappend mixin mixinappend mixinguard move myProc myProc2 myProcMix1 myProcMix2 noinit objproc parametercmd proc procsearch recreate requireNamespace self set setFilter tclcmd trace unset uplevel upvar volatile vwait" "[self]: b info methods" + + ::errorCheck [lsort [b info methods -nocmds]] "abstract copy defaultmethod extractConfigureArg f filterappend hasclass infoTraceFilter init mixinappend move myProc myProc2 myProcMix1 myProcMix2 objproc recreate self setFilter" "[self]: b info methods -nocmds" + + ::errorCheck [lsort [b info methods -noprocs]] "__next append array autoname check class cleanup configure destroy eval exists filter filterguard filtersearch incr info instvar invar isclass ismetaclass ismixin isobject istype lappend mixin mixinguard noinit parametercmd proc procsearch requireNamespace set tclcmd trace unset uplevel upvar volatile vwait" "[self]: b info methods -noprocs" + ::errorCheck [lsort [b info methods -nocmds -nomixins]] "abstract copy defaultmethod extractConfigureArg f filterappend hasclass infoTraceFilter init mixinappend move myProc myProc2 objproc self setFilter" "[self]: b info methods -nocmds -nomixins" + + ::errorCheck [b info methods -nocmds -noprocs] "" "[self]: b info methods -nocmds -noprocs" + + ::errorCheck [lsort [B info methods -nocmds]] "abstract copy defaultmethod extractConfigureArg f filterappend hasclass infoTraceFilter init instfilterappend instmixinappend mixinappend move recreate self setFilter" "[self]: B info methods -nocmds" + + namespace eval a { + proc o args {return o} + } + namespace eval a::b { + proc b args {return b} + } + + Object a + a requireNamespace + + set r [a::b::b] + + Object a::b + a::b proc x args { + return x + } + set r "$r-[a::b x]-[a o]" + ::errorCheck $r "b-x-o" "[self]: Tcl Namespace should survive requireNamespace" + + xotcl::interp create in + set ::r [in eval { + namespace import -force xotcl::* + Object o}] + xotcl::interp delete in + ::errorCheck $::r "::o" "[self]: XOTcl slave interpreter " + + Object o -requireNamespace + o set r 1 + after 100 {o set r 3} + o vwait r + ::errorCheck [o set r] "3" "[self]: Vwait test" + + return "PASSED [self]" +} + + +TestX objectReferences +@ TestX objectReferences { + description { + Regression test for object and class references in tcl_objs + } +} +objectReferences proc run {{n 20}} { + my proc ok01 {} { + Class AAA + AAA destroy + Class AAA + } + my proc ok02 {} { + Class ::AAA + AAA destroy + Class AAA + } + my proc ok03 {} { + Class ::AAA + ::AAA destroy + Class AAA + } + my proc ok04 {} { + Class ::AAA + ::AAA destroy + Class ::AAA + } + my proc ok05 {} { + set c [Class AAA] + $c destroy + Class AAA + } + my proc ok06 {} { + set c [Class ::AAA] + $c destroy + Class AAA + } + my proc ok07 {} { + set c [Class ::AAA] + $c destroy + Class ::AAA + } + my proc ok08 {} { + set c [Class ::AAA] + $c destroy + Class $c + } + my proc ok09 {} { + [Class AAA] destroy + Class AAA + } + my proc ok10 {} { + [Class ::AAA] destroy + Class AAA + } + my proc ok11 {} { + [Class ::AAA] destroy + Class ::AAA + } + + + for {set i 1} {$i < 20} {incr i} { + # "reference to xotcl object in instvar" + Class LexxTreeMounter + Class LexxTree + LexxTreeMounter proc new {args} { + if {[LexxTree exists LexxTreeMounter]} { + set o [LexxTree set LexxTreeMounter] + } else { + set o [my create [my autoname [self]]] + } + $o incr C(refcnt) + return $o + } + LexxTreeMounter instproc init {args} { + my instvar C + set C(refcnt) 0 + if {[LexxTree exists LexxTreeMounter] == 0} { + LexxTree set LexxTreeMounter [self] + } + next + } + set x [LexxTreeMounter new] + set x [LexxTreeMounter new] + + ::errorCheck [llength [LexxTreeMounter info instances]] 1 "[self]: singleton" + + # "Global reference to xotcl object" + set ::v [Object ::a] + set ::w [Object ::b] + set ::z(1) [Object ::c] + unset ::v + + # "Class creation and Class destroys, after 2nd round procs contain xotcl-object references" + foreach m [lsort [my info procs ok*]] {my $m} + ::errorCheck [my isobject AAA] 1 "[self]: classdestroys" + } + + catch {UnknownClass destroy} + set ::utest "" + Class proc __unknown args { + lappend ::utest $args + set x [Class $args] + [$x] + } + Class O -superclass UnknownClass + ::errorCheck $::utest UnknownClass "[self]: __unknown" + + ::errorCheck [lsort [UnknownClass info info]] {args body children class classchildren classparent commands default filter filterguard heritage info instances instbody instcommands instdefault instfilter instfilterguard instinvar instmixin instpost instpre instprocs invar methods mixin parameter parent post pre procs subclass superclass vars} "[self]: info info" + + ::errorCheck [Class info instances *Unk*] ::UnknownClass "match in info instances" + ::errorCheck [Class info instances Unk*] "" "no match in info instances" + ::errorCheck [Class info instances Unk] "" "no match in info instances (no metachars)" + ::errorCheck [Class info class] "::xotcl::Class" "info class of Class" + ::errorCheck [Class info class Object] 1 "info class of Class Object" + Class C + Class D -superclass C + Class E -superclass D -parameter {{x 1}} + E instproc t {a b {c 1}} {return ok} + E proc p {a b {c 1}} {return ok} + E instproc q {} {return [self proc]} + ::errorCheck [C info subclass E] 1 "transitive subclass 1" + ::errorCheck [Object info subclass E] 1 "transitive subclass 2" + ::errorCheck [D info subclass C] 0 "transitive subclass 3" + ::errorCheck [E info heritage] "::D ::C ::xotcl::Object" "heritage" + ::errorCheck [E info instargs t] "a b c" "instargs" + ::errorCheck [E info instdefault t c x] 1 "instdefault" + ::errorCheck [E info args p] "a b c" "args" + ::errorCheck [E info default p c x] 1 "default" + ::errorCheck [E configure [list -p -x -y]] 0 "list params 1" + ::errorCheck [E e1 [list -t -1 -e -3]] ::e1 "list params 2" + ::errorCheck [e1 x] 1 "instparameter cmd 1" + ::errorCheck [e1 x 2] 2 "instparameter cmd 2" + ::errorCheck [e1 x] 2 "instparameter cmd 3" + ::errorCheck [e1 parametercmd y] "" "parametercmd 1" + ::errorCheck [e1 y 3] 3 "parametercmd 2" + ::errorCheck [e1 y] 3 "parametercmd 3" + ::errorCheck [e1 tclcmd regexp] "" "tclcmd 1" + ::errorCheck [e1 regexp (y) xyz _ X] "1" "tclcmd 2" + ::errorCheck [e1 exists X] "1" "tclcmd 3" + ::errorCheck [e1 q] q "self proc" + + ::errorCheck [E info commands] p "class commands" + ::errorCheck [E info instcommands] "t x q" "class instcommands" + ::errorCheck [E info instbody t] "return ok" "class info instbody" + + Object o + Object o::abc + Object o::bcd + Object o::cde + ::errorCheck [o info children] "::o::cde ::o::bcd ::o::abc" "info children 1" + ::errorCheck [o info children *cd*] "::o::cde ::o::bcd" "info children 2" + ::errorCheck [o info children ::o::cde] ::o::cde "info children 3" + ::errorCheck [o info children ::o::def] "" "info children 4" + Object new -childof o + ::errorCheck [llength [o info children]] 4 "info children 5" + + ::errorCheck [Object isobject o] 1 "is object 1" + ::errorCheck [Object isobject ox] 0 "is object 2" + + Class M -superclass Class + ::errorCheck [Object ismetaclass M] 1 "is metaclass 1" + ::errorCheck [Object ismetaclass C] 0 "is metaclass 0" + + + return "PASSED [self]" +} + +TestX create condMixins +@ TestX condMixins { + description { + Regression test for conditional mixins + } +} +condMixins proc show {c obj} { + set ::context $c + set r [list] + foreach x [list \ + [list $obj info methods salary] \ + [list $obj info methods -incontext salary] \ + [list $obj info methods driv*] \ + [list $obj info methods -incontext driv*] \ + ] { + lappend r "$::context: $x => [lsort [eval $x]]" + } + return $r +} +condMixins proc run {{n 20}} { + Object instproc signature {} {return "[self] [my info class] ([my age] years)"} + Class Person -parameter {id name age} + + Class Payroll-aspect -parameter salary + Payroll-aspect instproc print {} {puts "[my signature]: [my salary]"} + Class Driver-aspect -parameter driving-license + Payroll-aspect instproc print {} {puts "[my signature]: [my driving-license]"} + + Person instmixin {{Payroll-aspect -guard {[string equal $::context payrollApp]}}} + Person jim -mixin {{Driver-aspect -guard {[string equal $::context shipmentApp]}}} + + set ::context payrollApp + + ::errorCheck [lsort [jim info methods]] "__next abstract age append array autoname check class cleanup configure copy defaultmethod destroy driving-license eval exists extractConfigureArg f filter filterappend filterguard filtersearch hasclass id incr info infoTraceFilter init instvar invar isclass ismetaclass ismixin isobject istype lappend mixin mixinappend mixinguard move name noinit parametercmd print proc procsearch recreate requireNamespace salary self set setFilter signature tclcmd trace unset uplevel upvar volatile vwait" "condmixin all methods" + + ::errorCheck "[lsort [jim info methods -incontext]]" "__next abstract age append array autoname check class cleanup configure copy defaultmethod destroy eval exists extractConfigureArg f filter filterappend filterguard filtersearch hasclass id incr info infoTraceFilter init instvar invar isclass ismetaclass ismixin isobject istype lappend mixin mixinappend mixinguard move name noinit parametercmd print proc procsearch recreate requireNamespace salary self set setFilter signature tclcmd trace unset uplevel upvar volatile vwait" "all methods in context" + + ::errorCheck [my show payrollApp jim] "{payrollApp: jim info methods salary => salary} {payrollApp: jim info methods -incontext salary => salary} {payrollApp: jim info methods driv* => driving-license} {payrollApp: jim info methods -incontext driv* => }" "payrollApp jim" + ::errorCheck [my show shipmentApp jim] "{shipmentApp: jim info methods salary => salary} {shipmentApp: jim info methods -incontext salary => } {shipmentApp: jim info methods driv* => driving-license} {shipmentApp: jim info methods -incontext driv* => driving-license}" "shipmentApp jim" + + return "PASSED [self]" +} + + + +TestX create volatileObjects +@ TestX volatileObjects { + description { + Regression test for volatile objects + } +} + +volatileObjects proc inscope {} { + set r 0 + set y 0 + set z 0 + set c [C new -volatile] + catch {incr r [$c test]} + catch {set y [$c y]} + catch {set z [$c z]} + if {[catch {set u [$c u]} err]} {puts stderr $err} + return $r-[llength [C info instances]]-$y-$z-$u +} +volatileObjects proc run {{n 20}} { + Class create ::xotcl::_creator -instproc create {args} { + set result [next] + return $result + } + Class instproc f args { + #puts stderr "*****F [self calledproc]" + return [next] + } + + Class C -parameter {{x 0}} + C instproc f args { + #puts stderr "*****C [self calledproc]" + return [next] + } + C instproc test {} { my incr x } + C instproc y {} { my instvar x; incr x } + C instproc z {} { my set x 10 } + C instproc u {} { upvar [self callinglevel] z b; info exists b } + + Class create ::xotcl::I -instproc instvar args { + #puts [self proc] + next + } -instproc set args { + #puts [self proc] + next + } -instproc u args { + #puts [self proc] + next + } + + ::errorCheck [llength [C info instances]] 0 "[self]: foreign instances" + ::errorCheck [my inscope] 1-1-2-10-1 "[self]: volatile objects in scope" + ::errorCheck [llength [C info instances]] 0 "[self]: instances survived scope" + + Class instmixin ::xotcl::_creator + ::errorCheck [my inscope] 1-1-2-10-1 \ + "[self]: volatile objects in scope through mixin" + ::errorCheck [llength [C info instances]] 0 \ + "[self]: instances survived scope through mixin" + + Class instfilter f + ::errorCheck [my inscope] 1-1-2-10-1 \ + "[self]: volatile objects in scope through mixin + filter" + ::errorCheck [llength [C info instances]] 0 \ + "[self]: instances survived scope through mixin + filter" + + Class instmixin {} + + Class instfilter f + ::errorCheck [my inscope] 1-1-2-10-1 \ + "[self]: volatile objects in scope through filter" + ::errorCheck [llength [C info instances]] 0 \ + "[self]: instances survived scope through filter" + + Class instfilter {} + C instmixin ::xotcl::I + ::errorCheck [my inscope] 1-1-2-10-1 \ + "[self]: instvar overload in scope through mixin" + + C instfilter f + ::errorCheck [my inscope] 1-1-2-10-1 \ + "[self]: instvar overload in scope through mixin and filter" + + C instfilter {} + Class instproc f {} {} + return "PASSED [self]" +} + +TestX create uplevelCmds +uplevelCmds proc upproc {} { + lappend ::result [list \ + self=[self] \ + up1=[uplevel 1 self] \ + up2=[uplevel 2 self] \ + up3=[uplevel 3 self] ] +} +uplevelCmds proc run {{n 20}} { + Object o1 -proc m {} { + set ::result [list] + lappend ::result [list \ + self=[self] \ + up1=[uplevel 1 self] \ + up2=[uplevel 2 self] \ + up3=[uplevel 3 self] ] + uplevelCmds::upproc + return $::result + } + Object o2 -proc m {} { + o1 m + } + Object o3 -proc m {} { + o2 m + } + Object o4 -proc m {} { + o3 m + } + ::errorCheck [o4 m] \ + "{self=::o1 up1=::o2 up2=::o3 up3=::o4} {self=::o1 up1=::o2 up2=::o2 up3=::o3}" \ + "[self]: uplevel self" + o4 m + + proc showstack {} { + set l [info level] + for {set i $l} {$i>0} {incr i -1} { + set vars [uplevel \#$i info vars] + upvar \#$i what w + if {![info exists w]} {set w ""} + puts "$i: $w[info level $i] vars=$vars" + } + } + + Class C + C instproc u0 {} { + upvar [self callinglevel] x y; incr y + return [uplevel [self callinglevel] {incr x 1}] + } + C instproc u1 {} { + upvar [self callinglevel] x y; incr y + set r [uplevel [self callinglevel] {incr x 1}] + set z [uplevel [self activelevel] incr z] + return $z-$r + } + C instproc p0 {y} { + set x $y + set r [my u0] + return $r-$x + } + C instproc p1 {y} { + set z 0 + set x $y + set r [my u1] + return $r-$x + } + Class D -superclass C + D instproc u0 {} { + upvar [self callinglevel] x y; incr y + return [uplevel [self callinglevel] {incr x 1}] + } + D instproc u1 {} { + set z [uplevel [self activelevel] incr z] + set r [next] + return $z-$r + } + Class M + M instproc u1 {} { + set z [uplevel [self activelevel] incr z] + set r [next] + return $z-$r + } + Object instproc f args { + next + } + + D create d1 + errorCheck [d1 p0 1] 3-3 "simple uplevel" + errorCheck [d1 p1 1] 2-2-3-3 "uplevel through next in class hierarchy + activelevel" + D instmixin M + errorCheck [d1 p1 1] 1-3-3-3-3 "uplevel through mixin and class hierarchy + activelevel" + Object instfilter f + errorCheck [d1 p1 1] 1-3-3-3-3 "uplevel through filter, mixin and class hierarchy + activelevel" + Object instfilter "" + D instmixin {} + + # now again the same tests with upvar and uplevel methods + + C instproc u0 {} { + my upvar [self callinglevel] x y; incr y + return [my uplevel {incr x 1}] + } + C instproc u1 {} { + my upvar [self callinglevel] x y; incr y + set r [my uplevel {incr x 1}] + set z [my uplevel [self activelevel] incr z] + return $z-$r + } + D instproc u0 {} { + my upvar [self callinglevel] x y; incr y + return [my uplevel {incr x 1}] + } + Class M + M instproc u1 {} { + set z [my uplevel [self activelevel] incr z] + set r [next] + return $z-$r + } + errorCheck [d1 p0 1] 3-3 "upvar method: simple uplevel" + errorCheck [d1 p1 1] 2-2-3-3 \ + "upvar method: uplevel through next in class hierarchy + activelevel" + D instmixin M + errorCheck [d1 p1 1] 1-3-3-3-3 \ + "upvar method: uplevel through mixin and class hierarchy + activelevel" + Object instfilter f + errorCheck [d1 p1 1] 1-3-3-3-3 \ + "upvar method: uplevel through filter, mixin and class hierarchy + activelevel" + Object instfilter "" + D instmixin {} + + # now again the same tests with upvar and uplevel methods with default levels + + C instproc u0 {} { + my upvar x y; incr y + return [my uplevel {incr x 1}] + } + C instproc u1 {} { + my upvar x y; incr y + set r [my uplevel {incr x 1}] + set z [my uplevel [self activelevel] incr z] + return $z-$r + } + D instproc u0 {} { + my upvar x y; incr y + return [my uplevel {incr x 1}] + } + Class M + M instproc u1 {} { + set z [my uplevel [self activelevel] incr z] + set r [next] + return $z-$r + } + errorCheck [d1 p0 1] 3-3 "upvar method: simple uplevel (dl)" + errorCheck [d1 p1 1] 2-2-3-3 \ + "upvar method: uplevel through next in class hierarchy + activelevel (dl)" + D instmixin M + errorCheck [d1 p1 1] 1-3-3-3-3 \ + "upvar method: uplevel through mixin and class hierarchy + activelevel (dl)" + Object instfilter f + errorCheck [d1 p1 1] 1-3-3-3-3 \ + "upvar method: uplevel through filter, mixin and class hierarchy + activelevel (dl)" + Object instfilter "" + D instmixin {} + + return "PASSED [self]" +} + + + + +TestX proc run {} { + puts [nestingClasses run] + puts [nestingObjects run] + puts [assertions run] + puts [stdargs run] + puts [filterAddRemove run] + puts [filterClassChange run] + puts [filterSimpleObserver run] + puts [filterInfo run] + puts [filterGuards run] + puts [nextTest run] + puts [init_params run] + puts [mixinTest run] + puts [mixinInheritanceTest run] + puts [mixinGuards run] + puts [copymove run] + puts [recreation run] + puts [smallScripts run] + puts [objectReferences run] + puts [condMixins run] + puts [volatileObjects run] + puts [uplevelCmds run] +} + +puts "XOTcl - Test" +puts "Time used: [time {TestX run} 1]" + +# toplevel tests ################################################# +Class instmixin {} +C instmixin {} + +set o [C new -volatile];errorCheck [Object isobject $o] 1 "topLevel, check object" +Class instmixin ::xotcl::_creator +set o [C new -volatile];errorCheck [Object isobject $o] 1 "topLevel, check object" +C instmixin ::xotcl::I +set o [C new -volatile];errorCheck [Object isobject $o] 1 "topLevel, check object" +foreach i [C info instances] {$i destroy} + + +proc x {} { + Class instmixin {} + C instmixin {} + set c0 [llength [C info instances]] + set o [C new -volatile]; errorCheck [Object isobject $o] 1 "x, check object" + Class instmixin ::xotcl::_creator + set o [C new -volatile]; errorCheck [Object isobject $o] 1 "x, check object" + C instmixin ::xotcl::I + set o [C new -volatile]; errorCheck [Object isobject $o] 1 "x, check object" + set c1 [llength [C info instances]] + errorCheck [expr {$c1 - $c0 != 3}] 0 "exit x, three more objects" +} + +x +errorCheck [expr {[llength [C info instances]] > 0}] 0 "top, all volatile object gone" + +proc x1 {} { + set c0 [llength [C info instances]] + set o [C new -volatile]; errorCheck [Object isobject $o] 1 "x1, check object" + x + set o [C new -volatile]; errorCheck [Object isobject $o] 1 "x1, check object" + set c1 [llength [C info instances]] + errorCheck [expr {$c1 - $c0 != 2}] 0 "exit x1, two more objects" +} + +x1 +errorCheck [expr {[llength [C info instances]] > 0}] 0 "top, volatile objects gone" + +Object o +o proc test {} { + x1; errorCheck [expr {[llength [C info instances]] > 0}] 0 "x1 from o" +} +o test + +puts "PASSED ::topLevelCommands" Index: xotcl/tests/xoRDF.test =================================================================== diff -u --- xotcl/tests/xoRDF.test (revision 0) +++ xotcl/tests/xoRDF.test (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,1664 @@ +#!../../src/xotclsh +#!/usr/local/bin/xotclsh +# $Id: xoRDF.test,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# +package require XOTcl; namespace import -force xotcl::* + +lappend auto_path [file dir [info script]]/.. +#package require xotcl::test +#package require package;package verbose 1 +package require xotcl::rdf::parser +package require xotcl::rdf::recreatorVisitor +package require xotcl::rdf::triple + +proc errorCheck {expected result msg} { + set expected [string trim $expected \n] + set result [string trim $result \n] + foreach e [split $expected \n] r [split $result \n] { + set e [string trim $e] + set r [string trim $r] + if {$e != $r} { + puts stderr "FAILED: $msg\nGot: '$r'\nExpected: '$e'" + puts stderr "Full Result:\n$result" + puts stderr "RAW Triples:" + foreach t [lsort [tripleVisitor::db getTriples]] { + puts -nonewline stderr [$t dump] + } + exit -1 + return + } + } +} + +Class TestVisitor -superclass NodeTreeVisitor +TestVisitor instproc visit objName { + my append result [string trim [$objName print]] \n +} +TestVisitor instproc interpretNodeTree {node} { + my set result "" + $node accept [self] + return [my set result] +} + +TestVisitor testVisitor +RDFRecreatorVisitor reVisitor +TripleVisitor tripleVisitor +tripleVisitor proc interpret {parser topNode {asBag 1}} { + set result "" + my descriptionAsBag $asBag + my reset + my interpretNodeTree $topNode + return [[self]::db prettyTriples] + # foreach t [lsort [[self]::db getTriples]] { + # append result [string trim [$t dump]]\n + # } + # return $result +} + +RDFParser rp +rp proc time {cmd time} { + upvar $time ms + regexp {^(-?[0-9]+) } [::time {set r [eval $cmd]}] _ ms + return $r +} + +rp proc test {name text nodeResult tripleResult {descriptionAsBagResult ""}} { + my reset + foreach time {nodeTime recreateTime tripleTime} { + if {![my exists $time]} {my set $time 0} + } + my parse $text + set r [rp time [list testVisitor interpretNodeTree [self]::topNode0] ct] + regsub -all "[self]::topNode0" $r "" r + ::errorCheck $nodeResult $r "RDF Node Creation: $name" + + #set r [time [list reVisitor interpretNodeTree [self]::topNode0] rt] + #::errorCheck $recreateResult $r "RDF Recreation: $name" + set r [rp time [list tripleVisitor interpret rp [self]::topNode0 0] tt] + ::errorCheck $tripleResult $r "RDF Triples: $name" + if {$descriptionAsBagResult != ""} { + set r [tripleVisitor interpret rp [self]::topNode0 1] + ::errorCheck $descriptionAsBagResult $r "RDF Triples -- Description as Bag: $name" + } + + # test recreation by recreating XML text and by parsing + # and testing it again + set recreatedText [rp time [list reVisitor interpretNodeTree [self]::topNode0] rt] + [self]::topNode0 destroy + + my reset + my parse $recreatedText + + #puts "RECREATED: \n$recreatedText" + + # test recreated node tree + set r [testVisitor interpretNodeTree [self]::topNode0] + regsub -all "[self]::topNode0" $r "" r + ::errorCheck $nodeResult $r "RDF Node Recreation: $name" + set r [tripleVisitor interpret rp [self]::topNode0 0] + + ::errorCheck $tripleResult $r "RDF Triple Recreation: $name" + + my incr nodeTime $ct + my incr recreateTime $rt + my incr tripleTime $tt + puts "PASSED: $name ($ct + $rt + $tt)" +} + +############################################################################## +rp test "Namespace" { + + + + + xyz + dfg + + + + +} { +::RDFTag- --- RDF +::RDFDescription-::res0 --- Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +::RDFDescription-::res0::prop0::res0 --- Description +ATTR: ID = nsd +::RDFProperty-::res0::prop0::res0::prop0 --- s:ABC +PCDATA: +xyz +::RDFProperty-::res0::prop0::res0::prop1 --- fromXYZ +PCDATA: +dfg +} { + http://www.w3.org/Home/Lassila http://description.org/schema/Creator nsd + nsd http://description.org/schema/ABC xyz + nsd http://xyz.com/fromXYZ dfg +} + +############################################################################## +rp test descriptionNestedNS { + + + Ora Lassila + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +PCDATA: +Ora Lassila +} { + http://www.w3.org/Home/Lassila http://description.org/schema/Creator Ora Lassila +} { + http://www.w3.org/Home/Lassila http://description.org/schema/Creator Ora Lassila + +=================== unreferenced: + rdfdoc#id0 #type #Bag + rdfdoc#id0 #_1 rdfdoc#id1 + rdfdoc#id1 #predicate http://description.org/schema/Creator + rdfdoc#id1 #subject http://www.w3.org/Home/Lassila + rdfdoc#id1 #object Ora Lassila + rdfdoc#id1 #type #Statement +} + +############################################################################## +rp test NSDescription { + + + Ora Lassila + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +PCDATA: +Ora Lassila +} { + http://www.w3.org/Home/Lassila http://description.org/schema/Creator Ora Lassila +} + +############################################################################## +rp test PropertyAttr { + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +PCDATA: +Ora Lassila +} { + http://www.w3.org/Home/Lassila s:Creator Ora Lassila +} + +############################################################################## +rp test properties { + + + World Wide Web Consortium + W3C Home Page + 1998-10-03T02:27 + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org +::RDFProperty-::res0::prop0 --- s:Publisher +PCDATA: +World Wide Web Consortium +::RDFProperty-::res0::prop1 --- s:Title +PCDATA: +W3C Home Page +::RDFProperty-::res0::prop2 --- s:Date +PCDATA: +1998-10-03T02:27 +} { + http://www.w3.org s:Publisher World Wide Web Consortium + http://www.w3.org s:Title W3C Home Page + http://www.w3.org s:Date 1998-10-03T02:27 +} + +############################################################################## +rp test propertyAttr2 { + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org +::RDFProperty-::res0::prop0 --- s:Publisher +PCDATA: +World Wide Web Consortium +::RDFProperty-::res0::prop1 --- s:Title +PCDATA: +W3C Home Page +::RDFProperty-::res0::prop2 --- s:Date +PCDATA: +1998-10-03T02:27 +} { + http://www.w3.org s:Publisher World Wide Web Consortium + http://www.w3.org s:Title W3C Home Page + http://www.w3.org s:Date 1998-10-03T02:27 +} + +############################################################################## +rp test bag1 { + + + + + + + + + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://mycollege.edu/courses/6.001 +::RDFProperty-::res0::prop0 --- s:students +::RDFBag-::res0::prop0::res0 --- rdf:Bag +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res0::prop0::res0::prop0 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Amy +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop0::res0::prop1 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Tim +MEMBER-INDEX: rdf:_2 +::RDFMember-::res0::prop0::res0::prop2 --- rdf:li +ATTR: resource = http://mycollege.edu/students/John +MEMBER-INDEX: rdf:_3 +::RDFMember-::res0::prop0::res0::prop3 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Mary +MEMBER-INDEX: rdf:_4 +::RDFMember-::res0::prop0::res0::prop4 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Sue +MEMBER-INDEX: rdf:_5 +} { + http://mycollege.edu/courses/6.001 s:students rdfdoc#id1 + rdfdoc#id1 #type #Bag + rdfdoc#id1 #_1 http://mycollege.edu/students/Amy + rdfdoc#id1 #_2 http://mycollege.edu/students/Tim + rdfdoc#id1 #_3 http://mycollege.edu/students/John + rdfdoc#id1 #_4 http://mycollege.edu/students/Mary + rdfdoc#id1 #_5 http://mycollege.edu/students/Sue +} + + +############################################################################## +rp test bagGivenAsType1 { + + + + + + + + + + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://mycollege.edu/courses/6.001 +::RDFProperty-::res0::prop0 --- s:students +::RDFBag-::res0::prop0::res0 --- rdf:Bag +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res0::prop0::res0::prop0 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Amy +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop0::res0::prop1 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Tim +MEMBER-INDEX: rdf:_2 +::RDFMember-::res0::prop0::res0::prop2 --- rdf:li +ATTR: resource = http://mycollege.edu/students/John +MEMBER-INDEX: rdf:_3 +::RDFMember-::res0::prop0::res0::prop3 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Mary +MEMBER-INDEX: rdf:_4 +::RDFMember-::res0::prop0::res0::prop4 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Sue +MEMBER-INDEX: rdf:_5 +} { + http://mycollege.edu/courses/6.001 s:students rdfdoc#id1 + rdfdoc#id1 #type #Bag + rdfdoc#id1 #_1 http://mycollege.edu/students/Amy + rdfdoc#id1 #_2 http://mycollege.edu/students/Tim + rdfdoc#id1 #_3 http://mycollege.edu/students/John + rdfdoc#id1 #_4 http://mycollege.edu/students/Mary + rdfdoc#id1 #_5 http://mycollege.edu/students/Sue +} + +############################################################################## +rp test bagGivenAsType2 { + + + + + + + + + + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://mycollege.edu/courses/6.001 +::RDFProperty-::res0::prop0 --- s:students +::RDFBag-::res0::prop0::res0 --- rdf:Bag +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res0::prop0::res0::prop0 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Amy +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop0::res0::prop1 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Tim +MEMBER-INDEX: rdf:_2 +::RDFMember-::res0::prop0::res0::prop2 --- rdf:li +ATTR: resource = http://mycollege.edu/students/John +MEMBER-INDEX: rdf:_3 +::RDFMember-::res0::prop0::res0::prop3 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Mary +MEMBER-INDEX: rdf:_4 +::RDFMember-::res0::prop0::res0::prop4 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Sue +MEMBER-INDEX: rdf:_5 +} { + http://mycollege.edu/courses/6.001 s:students rdfdoc#id1 + rdfdoc#id1 #type #Bag + rdfdoc#id1 #_1 http://mycollege.edu/students/Amy + rdfdoc#id1 #_2 http://mycollege.edu/students/Tim + rdfdoc#id1 #_3 http://mycollege.edu/students/John + rdfdoc#id1 #_4 http://mycollege.edu/students/Mary + rdfdoc#id1 #_5 http://mycollege.edu/students/Sue +} + + +############################################################################## +rp test bagAndAltGivenAsType { + + + + + + + + + + + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://mycollege.edu/courses/6.001 +::RDFProperty-::res0::prop0 --- s:students +::RDFAlt-::res0::prop0::res0 --- rdf:Alt +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res0::prop0::res0::prop0 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Amy +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop0::res0::prop1 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Tim +MEMBER-INDEX: rdf:_2 +::RDFMember-::res0::prop0::res0::prop2 --- rdf:li +ATTR: resource = http://mycollege.edu/students/John +MEMBER-INDEX: rdf:_3 +::RDFMember-::res0::prop0::res0::prop3 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Mary +MEMBER-INDEX: rdf:_4 +::RDFMember-::res0::prop0::res0::prop4 --- rdf:li +ATTR: resource = http://mycollege.edu/students/Sue +MEMBER-INDEX: rdf:_5 +} { + http://mycollege.edu/courses/6.001 s:students rdfdoc#id1 + rdfdoc#id1 #type #Alt + rdfdoc#id1 #type #Bag + rdfdoc#id1 #_1 http://mycollege.edu/students/Amy + rdfdoc#id1 #_2 http://mycollege.edu/students/Tim + rdfdoc#id1 #_3 http://mycollege.edu/students/John + rdfdoc#id1 #_4 http://mycollege.edu/students/Mary + rdfdoc#id1 #_5 http://mycollege.edu/students/Sue +} + +############################################################################## +rp test alt1 { + + + + + + + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://x.org/packages/X11 +::RDFProperty-::res0::prop0 --- s:DistributionSite +::RDFAlt-::res0::prop0::res0 --- rdf:Alt +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt +::RDFMember-::res0::prop0::res0::prop0 --- rdf:li +ATTR: resource = ftp://ftp.x.org +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop0::res0::prop1 --- rdf:li +ATTR: resource = ftp://ftp.cs.purdue.edu +MEMBER-INDEX: rdf:_2 +::RDFMember-::res0::prop0::res0::prop2 --- rdf:li +ATTR: resource = ftp://ftp.eu.net +MEMBER-INDEX: rdf:_3 +} { + http://x.org/packages/X11 s:DistributionSite rdfdoc#id1 + rdfdoc#id1 #type #Alt + rdfdoc#id1 #_1 ftp://ftp.x.org + rdfdoc#id1 #_2 ftp://ftp.cs.purdue.edu + rdfdoc#id1 #_3 ftp://ftp.eu.net +} + +############################################################################## +rp test bag2 { + + + + + + + + Ora Lassila + + +} { +::RDFTag- --- rdf:RDF +::RDFBag-::res0 --- rdf:Bag +ATTR: ID = pages +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res0::prop0 --- rdf:li +ATTR: resource = http://foo.org/foo.html +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop1 --- rdf:li +ATTR: resource = http://bar.org/bar.html +MEMBER-INDEX: rdf:_2 +::RDFDescription-::res1 --- rdf:Description +ATTR: about = #pages +::RDFProperty-::res1::prop0 --- s:Creator +PCDATA: +Ora Lassila +} { +=================== unreferenced: + rdfdoc#pages #type #Bag + rdfdoc#pages #_1 http://foo.org/foo.html + rdfdoc#pages #_2 http://bar.org/bar.html + rdfdoc#pages s:Creator Ora Lassila +} + +############################################################################## +rp test aboutEach { + + + (c) 1998, The Foo Organization + + + (c) 1998, The Foo Organization + + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: aboutEachPrefix = http://foo.org/doc +::RDFProperty-::res0::prop0 --- s:Copyright +PCDATA: +(c) 1998, The Foo Organization +::RDFDescription-::res1 --- rdf:Description +ATTR: aboutEach = #docpages +::RDFProperty-::res1::prop0 --- s:Copyright +PCDATA: +(c) 1998, The Foo Organization +::RDFBag-::res2 --- rdf:Bag +ATTR: ID = docpages +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res2::prop0 --- rdf:li +ATTR: resource = http://foo.org/doc/page1 +MEMBER-INDEX: rdf:_1 +::RDFMember-::res2::prop1 --- rdf:li +ATTR: resource = http://foo.org/doc/page2 +MEMBER-INDEX: rdf:_2 +} { + http://foo.org/doc/page1 http://description.org/schema/Copyright (c) 1998, The Foo Organization + http://foo.org/doc/page2 http://description.org/schema/Copyright (c) 1998, The Foo Organization + +=================== unreferenced: + rdfdoc#docpages #type #Bag + rdfdoc#docpages #_1 http://foo.org/doc/page1 + rdfdoc#docpages #_2 http://foo.org/doc/page2 +} + +############################################################################## +rp test "BagID on List" { + + + + + + + + + Me + + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: aboutEach = #docpages +::RDFProperty-::res0::prop0 --- s:somebag +::RDFBag-::res0::prop0::res0 --- rdf:Bag +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res0::prop0::res0::prop0 --- rdf:li +ATTR: resource = http://foo.org/foo.html +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop0::res0::prop1 --- rdf:li +ATTR: resource = http://bar.org/bar.html +MEMBER-INDEX: rdf:_2 +::RDFProperty-::res0::prop1 --- s:Creator +PCDATA: +Me +::RDFBag-::res1 --- rdf:Bag +ATTR: ID = docpages +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res1::prop0 --- rdf:li +ATTR: resource = http://foo.org/doc/page1 +MEMBER-INDEX: rdf:_1 +::RDFMember-::res1::prop1 --- rdf:li +ATTR: resource = http://foo.org/doc/page2 +MEMBER-INDEX: rdf:_2 +} { + http://foo.org/doc/page1 http://description.org/schema/somebag rdfdoc#id1 + rdfdoc#id1 #type #Bag + rdfdoc#id1 #_1 http://foo.org/foo.html + rdfdoc#id1 #_2 http://bar.org/bar.html + http://foo.org/doc/page1 http://description.org/schema/Creator Me + http://foo.org/doc/page2 http://description.org/schema/somebag rdfdoc#id1 + http://foo.org/doc/page2 http://description.org/schema/Creator Me + +=================== unreferenced: + rdfdoc#docpages #type #Bag + rdfdoc#docpages #_1 http://foo.org/doc/page1 + rdfdoc#docpages #_2 http://foo.org/doc/page2 +} + +############################################################################## +rp test "Sharing Values" { + + + + + + + + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFSeq-::res0 --- rdf:Seq +ATTR: ID = JSPapersByDate +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq +::RDFMember-::res0::prop0 --- rdf:li +ATTR: resource = http://www.dogworld.com/Aug96.doc +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop1 --- rdf:li +ATTR: resource = http://www.webnuts.net/Jan97.html +MEMBER-INDEX: rdf:_2 +::RDFMember-::res0::prop2 --- rdf:li +ATTR: resource = http://www.carchat.com/Sept97.html +MEMBER-INDEX: rdf:_3 +::RDFSeq-::res1 --- rdf:Seq +ATTR: ID = JSPapersBySubj +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq +::RDFMember-::res1::prop0 --- rdf:li +ATTR: resource = http://www.carchat.com/Sept97.html +MEMBER-INDEX: rdf:_1 +::RDFMember-::res1::prop1 --- rdf:li +ATTR: resource = http://www.dogworld.com/Aug96.doc +MEMBER-INDEX: rdf:_2 +::RDFMember-::res1::prop2 --- rdf:li +ATTR: resource = http://www.webnuts.net/Jan97.html +MEMBER-INDEX: rdf:_3 +} { +=================== unreferenced: + rdfdoc#JSPapersByDate #type #Seq + rdfdoc#JSPapersByDate #_1 http://www.dogworld.com/Aug96.doc + rdfdoc#JSPapersByDate #_2 http://www.webnuts.net/Jan97.html + rdfdoc#JSPapersByDate #_3 http://www.carchat.com/Sept97.html + rdfdoc#JSPapersBySubj #type #Seq + rdfdoc#JSPapersBySubj #_1 http://www.carchat.com/Sept97.html + rdfdoc#JSPapersBySubj #_2 http://www.dogworld.com/Aug96.doc + rdfdoc#JSPapersBySubj #_3 http://www.webnuts.net/Jan97.html +} + +############################################################################## + +rp test "aggregates" { + + + + + Mary Andrew + Jacky Crystal + + + + + + + + + + + + + The Coolest Web Page + Il Pagio di Web Fuba + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.foo.com/cool.html +::RDFProperty-::res0::prop0 --- dc:Creator +::RDFSeq-::res0::prop0::res0 --- rdf:Seq +ATTR: ID = CreatorsAlphabeticalBySurname +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq +::RDFMember-::res0::prop0::res0::prop0 --- rdf:li +PCDATA: +Mary Andrew +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop0::res0::prop1 --- rdf:li +PCDATA: +Jacky Crystal +MEMBER-INDEX: rdf:_2 +::RDFProperty-::res0::prop1 --- dc:Identifier +::RDFBag-::res0::prop1::res0 --- rdf:Bag +ATTR: ID = MirroredSites +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res0::prop1::res0::prop0 --- rdf:li +ATTR: rdf:resource = http://www.foo.com.au/cool.html +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop1::res0::prop1 --- rdf:li +ATTR: rdf:resource = http://www.foo.com.it/cool.html +MEMBER-INDEX: rdf:_2 +::RDFProperty-::res0::prop2 --- dc:Title +::RDFAlt-::res0::prop2::res0 --- rdf:Alt +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt +::RDFMember-::res0::prop2::res0::prop0 --- rdf:li +ATTR: xml:lang = en +PCDATA: +The Coolest Web Page +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop2::res0::prop1 --- rdf:li +ATTR: xml:lang = it +PCDATA: +Il Pagio di Web Fuba +MEMBER-INDEX: rdf:_2 +} { + http://www.foo.com/cool.html http://purl.org/metadata/dublin_core#Creator rdfdoc#CreatorsAlphabeticalBySurname + rdfdoc#CreatorsAlphabeticalBySurname #type #Seq + rdfdoc#CreatorsAlphabeticalBySurname #_1 Mary Andrew + rdfdoc#CreatorsAlphabeticalBySurname #_2 Jacky Crystal + http://www.foo.com/cool.html http://purl.org/metadata/dublin_core#Identifier rdfdoc#MirroredSites + rdfdoc#MirroredSites #type #Bag + rdfdoc#MirroredSites #_1 http://www.foo.com.au/cool.html + rdfdoc#MirroredSites #_2 http://www.foo.com.it/cool.html + http://www.foo.com/cool.html http://purl.org/metadata/dublin_core#Title rdfdoc#id3 + rdfdoc#id3 #type #Alt + rdfdoc#id3 #_1 The Coolest Web Page + rdfdoc#id3 #_2 Il Pagio di Web Fuba +} + +############################################################################## +rp test "bagReification" { + + + + literal, well-formed tag + + + xyz + + + +} { +::RDFTag- --- rdf:RDF +::RDFBag-::res0 --- rdf:Bag +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res0::prop0 --- rdf:li +ATTR: parseType = Literal +PCDATA: + + literal, well-formed tag + +MEMBER-INDEX: rdf:_1 +::RDFMember-::res0::prop1 --- rdf:li +MEMBER-INDEX: rdf:_2 +::RDFDescription-::res0::prop1::res0 --- rdf:Description +::RDFProperty-::res0::prop1::res0::prop0 --- s:x +PCDATA: +xyz +} { +=================== unreferenced: + rdfdoc#id0 #type #Bag + rdfdoc#id0 #_1 + literal, well-formed tag + + rdfdoc#id0 #_2 rdfdoc#id1 + rdfdoc#id1 http://description.org/schema/x xyz +} + +# the following reification is done by SirPac, but it does not seem necessary +# (uncomment reify property in RDFTriple, if needed +#{ +#=================== unreferenced: +# rdfdoc#id0 #type #Bag +# rdfdoc#id0 #_1 +# literal, well-formed tag +# +# rdfdoc#id0 #_2 rdfdoc#id1 +# rdfdoc#id1 http://description.org/schema/x xyz +# rdfdoc#id2 #predicate http://description.org/schema/x +# rdfdoc#id2 #subject rdfdoc#id1 +# rdfdoc#id2 #object xyz +# rdfdoc#id2 #type #Statement +#} + +############################################################################## +rp test "parseLiteral" { + + + + xyz + + + + + + + xyz + + + + + + + + + + + + + + literal, well-formed tag + + + literal, well-formed tag + + + xyz + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://mycollege.edu/ +::RDFProperty-::res0::prop0 --- s:students +ATTR: parseType = Literal +PCDATA: + + xyz +::RDFDescription-::res1 --- rdf:Description +ATTR: about = http://mycollege.edu/ +::RDFProperty-::res1::prop0 --- s:students +ATTR: parseType = Literal +PCDATA: + + + xyz + + + + + + + + +::RDFBag-::res2 --- rdf:Bag +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res2::prop0 --- rdf:li +ATTR: parseType = Literal +PCDATA: + + literal, well-formed tag + +MEMBER-INDEX: rdf:_1 +::RDFMember-::res2::prop1 --- rdf:li +ATTR: parseType = AllOtherMustbeLiteral +PCDATA: + + literal, well-formed tag + +MEMBER-INDEX: rdf:_2 +::RDFMember-::res2::prop2 --- rdf:li +MEMBER-INDEX: rdf:_3 +::RDFDescription-::res2::prop2::res0 --- rdf:Description +::RDFProperty-::res2::prop2::res0::prop0 --- s:x +PCDATA: +xyz +} { + http://mycollege.edu/ http://description.org/schema/students + xyz + + http://mycollege.edu/ http://description.org/schema/students + + xyz + + + + + + + + + + +=================== unreferenced: + rdfdoc#id2 #type #Bag + rdfdoc#id2 #_1 + literal, well-formed tag + + rdfdoc#id2 #_2 + literal, well-formed tag + + rdfdoc#id2 #_3 rdfdoc#id3 + rdfdoc#id3 http://description.org/schema/x xyz +} + +############################################################################## +rp test typedNode0 { + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.xyz.com +TYPES: http://purl.org/dc/elements/1.0/typed +::RDFProperty-::res0::prop0 --- DC:Creator +ATTR: rdf:resource = http://www.xyz.com/homepage/ +} { + http://www.xyz.com http://purl.org/dc/elements/1.0/Creator http://www.xyz.com/homepage/ + http://www.xyz.com #type http://purl.org/dc/elements/1.0/typed +} + +################################################################### +## UWE: im wiedererzeugten XML/RDF fehlt m.M. das parseType="Resosurce" + +rp test nestedProperty { + + + + + +} { +::RDFTag- --- RDF +::RDFDescription-::res0 --- Description +ATTR: about = http://www.webnuts.net/Jan97.html +::RDFProperty-::res0::prop0 --- dc:Subject +::RDFDescription-::res0::prop0::res0 --- rdf:Description +::RDFProperty-::res0::prop0::res0::prop0 --- value +PCDATA: +020 - Library Science +::RDFProperty-::res0::prop0::res0::prop1 --- l:Classification +PCDATA: +Dewey Decimal Code +} { + http://www.webnuts.net/Jan97.html http://purl.org/metadata/dublin_core#Subject rdfdoc#id1 + rdfdoc#id1 #value 020 - Library Science + rdfdoc#id1 http://mycorp.com/schemas/my-schema#Classification Dewey Decimal Code +} + + +rp test nestedProperty2 { + + + + 020 - Library Science + Dewey Decimal Code + + + +} { +::RDFTag- --- RDF +::RDFDescription-::res0 --- Description +ATTR: about = http://www.webnuts.net/Jan97.html +::RDFProperty-::res0::prop0 --- dc:Subject +::RDFDescription-::res0::prop0::res0 --- rdf:Description +::RDFProperty-::res0::prop0::res0::prop0 --- value +PCDATA: +020 - Library Science +::RDFProperty-::res0::prop0::res0::prop1 --- l:Classification +PCDATA: +Dewey Decimal Code +} { + http://www.webnuts.net/Jan97.html http://purl.org/metadata/dublin_core#Subject rdfdoc#id1 + rdfdoc#id1 #value 020 - Library Science + rdfdoc#id1 http://mycorp.com/schemas/my-schema#Classification Dewey Decimal Code + +} + +rp test nestedProperty3 { + + + + + 020 - Library Science + Dewey Decimal Code + + + + +} { +::RDFTag- --- RDF +::RDFDescription-::res0 --- Description +ATTR: about = http://www.webnuts.net/Jan97.html +::RDFProperty-::res0::prop0 --- dc:Subject +::RDFDescription-::res0::prop0::res0 --- Description +::RDFProperty-::res0::prop0::res0::prop0 --- value +PCDATA: +020 - Library Science +::RDFProperty-::res0::prop0::res0::prop1 --- l:Classification +PCDATA: +Dewey Decimal Code +} { + http://www.webnuts.net/Jan97.html http://purl.org/metadata/dublin_core#Subject rdfdoc#id1 + rdfdoc#id1 #value 020 - Library Science + rdfdoc#id1 http://mycorp.com/schemas/my-schema#Classification Dewey Decimal Code + +} + +rp test nestedProperty4 { + + + + 020 - Library Science + + en + Dewey Decimal Code + + + + +} { +::RDFTag- --- RDF +::RDFDescription-::res0 --- Description +ATTR: about = http://www.webnuts.net/Jan97.html +::RDFProperty-::res0::prop0 --- dc:Subject +::RDFDescription-::res0::prop0::res0 --- rdf:Description +::RDFProperty-::res0::prop0::res0::prop0 --- value +PCDATA: +020 - Library Science +::RDFProperty-::res0::prop0::res0::prop1 --- l:Classification +::RDFDescription-::res0::prop0::res0::prop1::res0 --- rdf:Description +::RDFProperty-::res0::prop0::res0::prop1::res0::prop0 --- l:lang +PCDATA: +en +::RDFProperty-::res0::prop0::res0::prop1::res0::prop1 --- l:string +PCDATA: +Dewey Decimal Code +} { + http://www.webnuts.net/Jan97.html http://purl.org/metadata/dublin_core#Subject rdfdoc#id1 + rdfdoc#id1 #value 020 - Library Science + rdfdoc#id1 http://mycorp.com/schemas/my-schema#Classification rdfdoc#id2 + rdfdoc#id2 http://mycorp.com/schemas/my-schema#lang en + rdfdoc#id2 http://mycorp.com/schemas/my-schema#string Dewey Decimal Code +} + +rp test thirdAbbrev1 { + + + + + + Ora Lassila + lassila@w3.org + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +::RDFDescription-::res0::prop0::res0 --- rdf:Description +ATTR: about = http://www.w3.org/staffId/85740 +TYPES: http://description.org/schema/Person +::RDFProperty-::res0::prop0::res0::prop0 --- s:Name +PCDATA: +Ora Lassila +::RDFProperty-::res0::prop0::res0::prop1 --- s:Email +PCDATA: +lassila@w3.org +} { + http://www.w3.org/Home/Lassila http://description.org/schema/Creator http://www.w3.org/staffId/85740 + http://www.w3.org/staffId/85740 http://description.org/schema/Name Ora Lassila + http://www.w3.org/staffId/85740 http://description.org/schema/Email lassila@w3.org + http://www.w3.org/staffId/85740 #type http://description.org/schema/Person +} + +rp test thirdAbbrev2 { + + + + + + Ora Lassila + lassila@w3.org + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +::RDFDescription-::res0::prop0::res0 --- rdf:Description +TYPES: http://description.org/schema/Person +::RDFProperty-::res0::prop0::res0::prop0 --- s:Name +PCDATA: +Ora Lassila +::RDFProperty-::res0::prop0::res0::prop1 --- s:Email +PCDATA: +lassila@w3.org +} { + http://www.w3.org/Home/Lassila http://description.org/schema/Creator rdfdoc#id1 + rdfdoc#id1 http://description.org/schema/Name Ora Lassila + rdfdoc#id1 http://description.org/schema/Email lassila@w3.org + rdfdoc#id1 #type http://description.org/schema/Person +} + +rp test thirdAbbrev3 { + + + + + Ora Lassila + lassila@w3.org + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +::RDFDescription-::res0::prop0::res0 --- rdf:Description +ATTR: about = http://www.w3.org/staffId/85740 +TYPES: http://description.org/schema/Person +::RDFProperty-::res0::prop0::res0::prop0 --- s:Name +PCDATA: +Ora Lassila +::RDFProperty-::res0::prop0::res0::prop1 --- s:Email +PCDATA: +lassila@w3.org +} { + http://www.w3.org/Home/Lassila http://description.org/schema/Creator http://www.w3.org/staffId/85740 + http://www.w3.org/staffId/85740 http://description.org/schema/Name Ora Lassila + http://www.w3.org/staffId/85740 http://description.org/schema/Email lassila@w3.org + http://www.w3.org/staffId/85740 #type http://description.org/schema/Person +} + +rp test thirdAbbrev4 { + + + + + Ora Lassila + lassila@w3.org + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +::RDFDescription-::res0::prop0::res0 --- rdf:Description +TYPES: http://description.org/schema/Person +::RDFProperty-::res0::prop0::res0::prop0 --- s:Name +PCDATA: +Ora Lassila +::RDFProperty-::res0::prop0::res0::prop1 --- s:Email +PCDATA: +lassila@w3.org +} { + http://www.w3.org/Home/Lassila http://description.org/schema/Creator rdfdoc#id1 + rdfdoc#id1 http://description.org/schema/Name Ora Lassila + rdfdoc#id1 http://description.org/schema/Email lassila@w3.org + rdfdoc#id1 #type http://description.org/schema/Person +} + + +rp test secondAbbrev1 { + + + + + Ora Lassila + lassila@w3.org + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +::RDFDescription-::res0::prop0::res0 --- rdf:Description +ATTR: about = http://www.w3.org/staffId/85740 +::RDFProperty-::res0::prop0::res0::prop0 --- s:Name +PCDATA: +Ora Lassila +::RDFProperty-::res0::prop0::res0::prop1 --- s:Email +PCDATA: +lassila@w3.org +} { + http://www.w3.org/Home/Lassila http://description.org/schema/Creator http://www.w3.org/staffId/85740 + http://www.w3.org/staffId/85740 http://description.org/schema/Name Ora Lassila + http://www.w3.org/staffId/85740 http://description.org/schema/Email lassila@w3.org +} + +rp test secondAbbrev2 { + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +::RDFDescription-::res0::prop0::res0 --- rdf:Description +ATTR: about = http://www.w3.org/staffId/85740 +::RDFProperty-::res0::prop0::res0::prop0 --- s:Name +PCDATA: +Ora Lassila +::RDFProperty-::res0::prop0::res0::prop1 --- s:Email +PCDATA: +lassila@w3.org +} { + http://www.w3.org/Home/Lassila http://description.org/schema/Creator http://www.w3.org/staffId/85740 + http://www.w3.org/staffId/85740 http://description.org/schema/Name Ora Lassila + http://www.w3.org/staffId/85740 http://description.org/schema/Email lassila@w3.org +} + +rp test secondAbbrev3 { + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +::RDFDescription-::res0::prop0::res0 --- rdf:Description +::RDFProperty-::res0::prop0::res0::prop0 --- s:Name +PCDATA: +Ora Lassila +::RDFProperty-::res0::prop0::res0::prop1 --- s:Email +PCDATA: +lassila@w3.org +} { + http://www.w3.org/Home/Lassila http://description.org/schema/Creator rdfdoc#id1 + rdfdoc#id1 http://description.org/schema/Name Ora Lassila + rdfdoc#id1 http://description.org/schema/Email lassila@w3.org +} + + +################################################################### +rp test resource1 { + + + + + + + Ora Lassila + lassila@w3.org + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +ATTR: rdf:resource = http://www.w3.org/staffId/85740 +::RDFDescription-::res1 --- rdf:Description +ATTR: about = http://www.w3.org/staffId/85740 +::RDFProperty-::res1::prop0 --- v:Name +PCDATA: +Ora Lassila +::RDFProperty-::res1::prop1 --- v:Email +PCDATA: +lassila@w3.org +} { + http://www.w3.org/Home/Lassila http://schema.org/Creator http://www.w3.org/staffId/85740 + http://www.w3.org/staffId/85740 v:Name Ora Lassila + http://www.w3.org/staffId/85740 v:Email lassila@w3.org +} + +################################################################### +rp test resource2 { + + + + + Ora Lassila + lassila@w3.org + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.w3.org/Home/Lassila +::RDFProperty-::res0::prop0 --- s:Creator +::RDFDescription-::res0::prop0::res0 --- rdf:Description +ATTR: about = http://www.w3.org/staffId/85740 +::RDFProperty-::res0::prop0::res0::prop0 --- v:Name +PCDATA: +Ora Lassila +::RDFProperty-::res0::prop0::res0::prop1 --- v:Email +PCDATA: +lassila@w3.org +} { + http://www.w3.org/Home/Lassila http://schema.org/Creator http://www.w3.org/staffId/85740 + http://www.w3.org/staffId/85740 v:Name Ora Lassila + http://www.w3.org/staffId/85740 v:Email lassila@w3.org +} + + + +################################################################### +rp test typedNode1 { + + + Uwe Zdun + uwe@xotcl.org + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://www.xotcl.org/uwe +TYPES: http://description.org/schema/Person +::RDFProperty-::res0::prop0 --- s:Name +PCDATA: +Uwe Zdun +::RDFProperty-::res0::prop1 --- s:Email +PCDATA: +uwe@xotcl.org +} { + http://www.xotcl.org/uwe http://description.org/schema/Name Uwe Zdun + http://www.xotcl.org/uwe http://description.org/schema/Email uwe@xotcl.org + http://www.xotcl.org/uwe #type http://description.org/schema/Person +} + +rp test typedNode2 { + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: rdf:about = http://www.xotcl.org/uwe +TYPES: http://description.org/schema/Person +::RDFProperty-::res0::prop0 --- Name +PCDATA: +Uwe Zdun +::RDFProperty-::res0::prop1 --- Email +PCDATA: +uwe@xotcl.org +} { + http://www.xotcl.org/uwe http://description.org/schema/Name Uwe Zdun + http://www.xotcl.org/uwe http://description.org/schema/Email uwe@xotcl.org + http://www.xotcl.org/uwe #type http://description.org/schema/Person +} + +################################################################### +rp test complexListItems { + + + + + en + Object Oriented Design and System Development + + + + + en + Introduction to the concepts of object-oriented programing + + + de + Einf�hrung in die Konzepte objekt-orientierter Programmierung + + + + + +} { +::RDFTag- --- RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://nm.wu-wien.ac.at/Lehre/oo1/ +::RDFProperty-::res0::prop0 --- gen:Title +::RDFDescription-::res0::prop0::res0 --- rdf:Description +::RDFProperty-::res0::prop0::res0::prop0 --- xml:lang +PCDATA: +en +::RDFProperty-::res0::prop0::res0::prop1 --- gen:String +PCDATA: +Object Oriented Design and System Development +::RDFProperty-::res0::prop1 --- gen:Description +::RDFBag-::res0::prop1::res0 --- rdf:Bag +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag +::RDFMember-::res0::prop1::res0::prop0 --- rdf:li +MEMBER-INDEX: rdf:_1 +::RDFDescription-::res0::prop1::res0::prop0::res0 --- rdf:Description +::RDFProperty-::res0::prop1::res0::prop0::res0::prop0 --- xml:lang +PCDATA: +en +::RDFProperty-::res0::prop1::res0::prop0::res0::prop1 --- gen:String +PCDATA: +Introduction to the concepts of object-oriented programing +::RDFMember-::res0::prop1::res0::prop1 --- rdf:li +MEMBER-INDEX: rdf:_2 +::RDFDescription-::res0::prop1::res0::prop1::res0 --- rdf:Description +::RDFProperty-::res0::prop1::res0::prop1::res0::prop0 --- xml:lang +PCDATA: +de +::RDFProperty-::res0::prop1::res0::prop1::res0::prop1 --- gen:String +PCDATA: +Einf�hrung in die Konzepte objekt-orientierter Programmierung +} { + http://nm.wu-wien.ac.at/Lehre/oo1/ http://universal.org/metadata/ims#Title rdfdoc#id1 + rdfdoc#id1 xml:lang en + rdfdoc#id1 http://universal.org/metadata/ims#String Object Oriented Design and System Development + http://nm.wu-wien.ac.at/Lehre/oo1/ http://universal.org/metadata/ims#Description rdfdoc#id2 + rdfdoc#id2 #type #Bag + rdfdoc#id2 #_1 rdfdoc#id3 + rdfdoc#id3 xml:lang en + rdfdoc#id3 http://universal.org/metadata/ims#String Introduction to the concepts of object-oriented programing + rdfdoc#id2 #_2 rdfdoc#id4 + rdfdoc#id4 xml:lang de + rdfdoc#id4 http://universal.org/metadata/ims#String Einf�hrung in die Konzepte objekt-orientierter Programmierung +} + +################################################################### +rp test complexListItems2 { + + + + + en + Object Oriented Design and System Development + + + + + + en + Introduction to the concepts of object-oriented programing + + + + de + Einf�hrung in die Konzepte objekt-orientierter Programmierung + + + + + +} { +::RDFTag- --- RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = http://nm.wu-wien.ac.at/Lehre/oo1/ +::RDFProperty-::res0::prop0 --- gen:Title +::RDFDescription-::res0::prop0::res0 --- rdf:Description +::RDFProperty-::res0::prop0::res0::prop0 --- xml:lang +PCDATA: +en +::RDFProperty-::res0::prop0::res0::prop1 --- gen:String +PCDATA: +Object Oriented Design and System Development +::RDFProperty-::res0::prop1 --- gen:Description +::RDFSeq-::res0::prop1::res0 --- rdf:Seq +TYPES: http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq +::RDFMember-::res0::prop1::res0::prop0 --- rdf:li +MEMBER-INDEX: rdf:_1 +::RDFDescription-::res0::prop1::res0::prop0::res0 --- rdf:Description +::RDFProperty-::res0::prop1::res0::prop0::res0::prop0 --- cls:entry +::RDFDescription-::res0::prop1::res0::prop0::res0::prop0::res0 --- rdf:Description +::RDFProperty-::res0::prop1::res0::prop0::res0::prop0::res0::prop0 --- gen:language +PCDATA: +en +::RDFProperty-::res0::prop1::res0::prop0::res0::prop0::res0::prop1 --- gen:String +PCDATA: +Introduction to the concepts of object-oriented programing +::RDFMember-::res0::prop1::res0::prop1 --- rdf:li +MEMBER-INDEX: rdf:_2 +::RDFDescription-::res0::prop1::res0::prop1::res0 --- rdf:Description +::RDFProperty-::res0::prop1::res0::prop1::res0::prop0 --- xml:lang +PCDATA: +de +::RDFProperty-::res0::prop1::res0::prop1::res0::prop1 --- gen:String +PCDATA: +Einf�hrung in die Konzepte objekt-orientierter Programmierung +} { + http://nm.wu-wien.ac.at/Lehre/oo1/ http://universal.org/metadata/ims#Title rdfdoc#id1 + rdfdoc#id1 xml:lang en + rdfdoc#id1 http://universal.org/metadata/ims#String Object Oriented Design and System Development + http://nm.wu-wien.ac.at/Lehre/oo1/ http://universal.org/metadata/ims#Description rdfdoc#id2 + rdfdoc#id2 #type #Seq + rdfdoc#id2 #_1 rdfdoc#id3 + rdfdoc#id3 cls:entry rdfdoc#id4 + rdfdoc#id4 http://universal.org/metadata/ims#language en + rdfdoc#id4 http://universal.org/metadata/ims#String Introduction to the concepts of object-oriented programing + rdfdoc#id2 #_2 rdfdoc#id5 + rdfdoc#id5 xml:lang de + rdfdoc#id5 http://universal.org/metadata/ims#String Einf�hrung in die Konzepte objekt-orientierter Programmierung +} + +################################################################### +rp test dmoz { + + + + Computers + + + + +} { +::RDFTag- --- r:RDF +::RDFDescription-::res0 --- r:Description +ATTR: r:ID = Top/Computers +TYPES: http://dmoz.org/rdf/Topic +::RDFProperty-::res0::prop0 --- tag +::RDFDescription-::res0::prop0::res0 --- r:Description +::RDFProperty-::res0::prop0::res0::prop0 --- catid +PCDATA: +4 +::RDFProperty-::res0::prop1 --- d:Title +PCDATA: +Computers +::RDFProperty-::res0::prop2 --- link +ATTR: r:resource = http://www.cs.tcd.ie/FME/ +::RDFProperty-::res0::prop3 --- link +ATTR: r:resource = http://pages.whowhere.com/computers/pnyhlen/Timeline.html +} { + Top/Computers http://dmoz.org/rdf/tag rdfdoc#id1 + rdfdoc#id1 http://dmoz.org/rdf/catid 4 + Top/Computers http://purl.org/dc/elements/1.0/Title Computers + Top/Computers http://dmoz.org/rdf/link http://www.cs.tcd.ie/FME/ + Top/Computers http://dmoz.org/rdf/link http://pages.whowhere.com/computers/pnyhlen/Timeline.html + Top/Computers #type http://dmoz.org/rdf/Topic +} + +############################################################################## +rp test "IDforNestedDescription" { + + + + + +} { +::RDFTag- --- rdf:RDF +::RDFDescription-::res0 --- rdf:Description +ATTR: about = page +::RDFProperty-::res0::prop0 --- g2k:area +ATTR: rdf:ID = b14711 +::RDFDescription-::res0::prop0::res0 --- rdf:Description +::RDFProperty-::res0::prop0::res0::prop0 --- g2k:term +PCDATA: +Hessen +::RDFProperty-::res0::prop0::res0::prop1 --- g2k:type +PCDATA: +Land +} { + b14711 http://g2k-schema#term Hessen + b14711 http://g2k-schema#type Land + page http://g2k-schema#area b14711 +} + +puts "FINISHED TEST! ([rp set nodeTime] + [rp set recreateTime] + [rp set tripleTime] = [expr {[rp set nodeTime] + [rp set recreateTime] + [rp set tripleTime]}])" + Index: xotcl/tests/xocomm.test =================================================================== diff -u --- xotcl/tests/xocomm.test (revision 0) +++ xotcl/tests/xocomm.test (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,102 @@ +#!../../xotcl-0.9.4/xotclsh +# $Id: xocomm.test,v 1.1 2004/05/23 22:50:39 neumann Exp $ +package require XOTcl; namespace import -force xotcl::* +lappend auto_path [file dirname [info script]]/.. +package require xotcl::test + +@ @File { + description { + This is a webclient used as a regression test. + When it is started it launches an xotcl-Web server as partner process. + It tests currently the basic functionality of: +

      +
    • GET and PUT requests +
    • Basic Access Control +
    + } +} +array set opt {-startServer 1} +array set opt $argv + +set xotclsh [info nameofexecutable] +set dir [file dir [info script]] +set serverScript $dir/../apps/comm/webserver.xotcl +set startCmd "$xotclsh $serverScript -root $dir/../doc -pkgdir $dir/.." + +if {$opt(-startServer)} { + set PIPE [open "| $startCmd"] +} else { + puts $startCmd +} + +#package require package; package verbose 1 +package require xotcl::comm::httpAccess +package require xotcl::comm::ftp +package require xotcl::trace + +set hostport localhost:8086 +set protectedhostport localhost:9096 + +set slowURL "http://quote.yahoo.com/q?s=^DJI&d=1d" +set ftpURL "ftp://mohegan.wi-inf.uni-essen.de/welcome.msg" + + +proc printError msg {puts stderr !!!$msg!!!} + +Object userPwd +userPwd proc user {u} { + my set user $u + if {[set ::tcl_platform(platform)] == "windows"} { + my set user unknown + } +} +userPwd proc show {realm userVar pwVar} { + upvar $userVar u $pwVar pw + set u [my set user] + set pw test + return 1 +} + +Test parameter {{errorReport { + puts "\tcontent-length: \[r0::sink set contentLength\]\n\ + \tstatus-code: \[\[r0 set token\] set responseCode\]" +}}} + +Test new -msg "Trying to load image logo-100.jpg ... " -count 1 \ + -setResult {expr {[r0::sink set contentLength] == 1706}} \ + -cmd [list SimpleRequest r0 -url http://$hostport/logo-100.jpg] \ + +Test new -msg "Trying to PUT a file on web-server ... " -count 1 \ + -setResult {expr [[r0 set token] set responseCode] == 201} \ + -pre [list file delete -force $dir/../doc/junk.junk] \ + -cmd [list SimpleRequest r0 \ + -url http://$hostport/junk.junk \ + -method PUT \ + -data "this is a test\n" \ + -contentType plain/text] + +Test new -msg "And download it again ... " -count 1 \ + -setResult {expr [r0 getContentLength] == 15} \ + -post {file delete -force ../doc/junk.junk} \ + -cmd [list SimpleRequest r0 -url http://$hostport/junk.junk] + +Test new -msg "Get protected resource ... " -count 1 \ + -setResult {expr [r0 getContentLength] > 500} \ + -cmd [list SimpleRequest r0 -url http://$protectedhostport/ ] + +#Test new -msg "Try an FTP request $ftpURL ... " -count 1 \ + -setResult {expr [r0 getContentLength] > 100} \ + -cmd [list SimpleRequest r0 -url $ftpURL] + +#Test new -msg "Try timeout with slow URL $slowURL ... " -count 1 \ + -setResult {expr {[[r0 set token] set errormsg] == {timeout exceeded}}} \ + -cmd [list SimpleRequest r0 -url $slowURL -timeout 100] + +Test new -msg terminate -count 1 \ + -setResult {set x 1} \ + -cmd [list SimpleRequest r0 -url http://$protectedhostport/exit] \ + -post exit + +after 1000 {Test run} +catch {vwait forever} + Index: xotcl/unix/pkgIndex.unix =================================================================== diff -u --- xotcl/unix/pkgIndex.unix (revision 0) +++ xotcl/unix/pkgIndex.unix (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,4 @@ + package ifneeded XOTcl 1.2.1 [list load \ + [file join $dir .. libxotcl1.2.1.so] XOTcl] + + Index: xotcl/unix/pkgIndex.unix.in =================================================================== diff -u --- xotcl/unix/pkgIndex.unix.in (revision 0) +++ xotcl/unix/pkgIndex.unix.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,4 @@ + package ifneeded XOTcl @PACKAGE_VERSION@ [list load \ + [file join $dir .. @PKG_LIB_FILE@] XOTcl] + + Index: xotcl/unix/tclAppInit.c =================================================================== diff -u --- xotcl/unix/tclAppInit.c (revision 0) +++ xotcl/unix/tclAppInit.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,186 @@ +/* + * tclAppInit.c -- + * + * Provides a default version of the main program and Tcl_AppInit + * procedure for Tcl applications (without Tk). + * + * Copyright (c) 1993 The Regents of the University of California. + * Copyright (c) 1994-1997 Sun Microsystems, Inc. + * Copyright (c) 1998-1999 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * RCS: @(#) $Id: tclAppInit.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + */ + +#include "tcl.h" + +#ifdef TCL_TEST + +#include "tclInt.h" + +extern int Procbodytest_Init _ANSI_ARGS_((Tcl_Interp *interp)); +extern int Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp)); +extern int TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp)); +extern int Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp)); +#ifdef TCL_THREADS +extern int TclThread_Init _ANSI_ARGS_((Tcl_Interp *interp)); +#endif + +#endif /* TCL_TEST */ + +#ifdef TCL_XT_TEST +extern void XtToolkitInitialize _ANSI_ARGS_((void)); +extern int Tclxttest_Init _ANSI_ARGS_((Tcl_Interp *interp)); +#endif + +/* + *---------------------------------------------------------------------- + * + * main -- + * + * This is the main program for the application. + * + * Results: + * None: Tcl_Main never returns here, so this procedure never + * returns either. + * + * Side effects: + * Whatever the application does. + * + *---------------------------------------------------------------------- + */ + +int +main(argc, argv) + int argc; /* Number of command-line arguments. */ + char **argv; /* Values of command-line arguments. */ +{ + /* + * The following #if block allows you to change the AppInit + * function by using a #define of TCL_LOCAL_APPINIT instead + * of rewriting this entire file. The #if checks for that + * #define and uses Tcl_AppInit if it doesn't exist. + */ + +#ifndef TCL_LOCAL_APPINIT +#define TCL_LOCAL_APPINIT Tcl_AppInit +#endif + extern int TCL_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp)); + + /* + * The following #if block allows you to change how Tcl finds the startup + * script, prime the library or encoding paths, fiddle with the argv, + * etc., without needing to rewrite Tcl_Main() + */ + +#ifdef TCL_LOCAL_MAIN_HOOK + extern int TCL_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv)); +#endif + +#ifdef TCL_XT_TEST + XtToolkitInitialize(); +#endif + +#ifdef TCL_LOCAL_MAIN_HOOK + TCL_LOCAL_MAIN_HOOK(&argc, &argv); +#endif + + Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); + + return 0; /* Needed only to prevent compiler warning. */ +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppInit -- + * + * This procedure performs application-specific initialization. + * Most applications, especially those that incorporate additional + * packages, will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error + * message in the interp's result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_AppInit(interp) + Tcl_Interp *interp; /* Interpreter for application. */ +{ + if (Tcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + +#ifdef TCL_TEST +#ifdef TCL_XT_TEST + if (Tclxttest_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } +#endif + if (Tcltest_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, + (Tcl_PackageInitProc *) NULL); + if (TclObjTest_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } +#ifdef TCL_THREADS + if (TclThread_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } +#endif + if (Procbodytest_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "procbodytest", Procbodytest_Init, + Procbodytest_SafeInit); +#endif /* TCL_TEST */ + + /* + * Call the init procedures for included packages. Each call should + * look like this: + * + * if (Mod_Init(interp) == TCL_ERROR) { + * return TCL_ERROR; + * } + * + * where "Mod" is the name of the module. + */ + if (Xotcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + + Tcl_StaticPackage(interp, "XOTcl", Xotcl_Init, 0); + if (Tcl_Import(interp, Tcl_GetGlobalNamespace(interp), + "::xotcl::*", /* allowOverwrite */ 1) != TCL_OK) { + return TCL_ERROR; + } + + /* + * Call Tcl_CreateCommand for application-specific commands, if + * they weren't already created by the init procedures called above. + */ + + /* + * Specify a user-specific startup file to invoke if the application + * is run interactively. Typically the startup file is "~/.apprc" + * where "app" is the name of the application. If this line is deleted + * then no user-specific startup file will be run under any conditions. + */ + +#ifdef DJGPP + Tcl_SetVar(interp, "tcl_rcFileName", "~/tclsh.rc", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY); +#endif + return TCL_OK; +} Index: xotcl/unix/tkAppInit.c =================================================================== diff -u --- xotcl/unix/tkAppInit.c (revision 0) +++ xotcl/unix/tkAppInit.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,91 @@ +/* + * tkAppInit.c -- + * $Id: tkAppInit.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + * + * Provides a default version of the Tcl_AppInit procedure for + * use in wish and similar Tk-based applications. + * + * Copyright (c) 1993 The Regents of the University of California. + * Copyright (c) 1994 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef lint +/* static char sccsid[] = "@(#) tkAppInit.c 1.12 94/12/17 16:30:56"; */ +#endif /* not lint */ + +#include "tk.h" +#include "locale.h" +#include + +/* + *---------------------------------------------------------------------- + * + * main -- + * + * This is the main program for the application. + * + * Results: + * None: Tk_Main never returns here, so this procedure never + * returns either. + * + * Side effects: + * Whatever the application does. + * + *---------------------------------------------------------------------- + */ + +int +main(argc, argv) + int argc; /* Number of command-line arguments. */ + char **argv; /* Values of command-line arguments. */ +{ + Tk_Main(argc, argv, Tcl_AppInit); + return 0; /* Needed only to prevent compiler warning. */ +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppInit -- + * + * This procedure performs application-specific initialization. + * Most applications, especially those that incorporate additional + * packages, will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error + * message in interp->result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_AppInit(interp) + Tcl_Interp *interp; /* Interpreter for application. */ +{ + if (Tcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + if (Tk_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + if (Xotcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit); + Tcl_StaticPackage(interp, "XOTcl", Xotcl_Init, 0); + + if (Tcl_Import(interp, Tcl_GetGlobalNamespace(interp), + "::xotcl::*", /* allowOverwrite */ 1) != TCL_OK) { + return TCL_ERROR; + } + Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY); + + return TCL_OK; +} Index: xotcl/unix/xotcl.spec =================================================================== diff -u --- xotcl/unix/xotcl.spec (revision 0) +++ xotcl/unix/xotcl.spec (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,49 @@ +Summary: Object Oriented Extension for Tcl +Name: xotcl +Version: @FULLVERSION@ +Release: 0 +Copyright: open source +Group: Development/Languages +Source: http://www.xotcl.org/xotcl-@FULLVERSION@.tar.gz +URL: http://www.xotcl.org +Packager: Gustaf.Neumann@wu-wien.ac.at +Distribution: RedHat 8.0 +Requires: tcl +Prefix: /usr + +%description +XOTcl is an object-oriented scripting language based on MIT's OTcl. +This packages provides a pre-packaged tcl-shell (xotclsh) and tk-shell +(xowish) together with the Tcl-extension (libxotcl.so) which can be +loaded to any Tcl-application. Furthermore it includes several +xotcl-based packages for e.g. HTTP client and server, XML, RDF, +persistent object store, mobile code system, etc. For more details +consult http://www.xotcl.org + +%prep +%setup -q -n xotcl-@FULLVERSION@ + + +%build +cd unix +./configure --with-tcl=/usr/lib --with-all --prefix=/usr --exec-prefix=/usr +make + +%install +cd unix +make install + +%files +%define _unpackaged_files_terminate_build 0 +%undefine __check_files + +%doc doc +/usr/lib/xotcl@VERSION@ +/usr/bin/xotclsh +/usr/bin/xowish +/usr/lib/libxotcl@VERSION@.so +/usr/lib/libxotclstub@VERSION@.a +/usr/include/xotclDecls.h +/usr/include/xotcl.h +/usr/include/xotclIntDecls.h +/usr/include/xotclInt.h Index: xotcl/unix/xotcl.spec.in =================================================================== diff -u --- xotcl/unix/xotcl.spec.in (revision 0) +++ xotcl/unix/xotcl.spec.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,49 @@ +Summary: Object Oriented Extension for Tcl +Name: xotcl +Version: @FULLVERSION@ +Release: 0 +Copyright: open source +Group: Development/Languages +Source: http://www.xotcl.org/xotcl-@FULLVERSION@.tar.gz +URL: http://www.xotcl.org +Packager: Gustaf.Neumann@wu-wien.ac.at +Distribution: RedHat 8.0 +Requires: tcl +Prefix: /usr + +%description +XOTcl is an object-oriented scripting language based on MIT's OTcl. +This packages provides a pre-packaged tcl-shell (xotclsh) and tk-shell +(xowish) together with the Tcl-extension (libxotcl.so) which can be +loaded to any Tcl-application. Furthermore it includes several +xotcl-based packages for e.g. HTTP client and server, XML, RDF, +persistent object store, mobile code system, etc. For more details +consult http://www.xotcl.org + +%prep +%setup -q -n xotcl-@FULLVERSION@ + + +%build +cd unix +./configure --with-tcl=/usr/lib --with-all --prefix=@prefix@ --exec-prefix=@exec_prefix@ +make + +%install +cd unix +make install + +%files +%define _unpackaged_files_terminate_build 0 +%undefine __check_files + +%doc doc +@prefix@/lib/xotcl@VERSION@ +@exec_prefix@/bin/xotclsh +@exec_prefix@/bin/xowish +@exec_prefix@/lib/libxotcl@VERSION@.so +@exec_prefix@/lib/libxotclstub@VERSION@.a +@prefix@/include/xotclDecls.h +@prefix@/include/xotcl.h +@prefix@/include/xotclIntDecls.h +@prefix@/include/xotclInt.h Index: xotcl/win/Makefile.vc =================================================================== diff -u --- xotcl/win/Makefile.vc (revision 0) +++ xotcl/win/Makefile.vc (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,439 @@ +###################################################################### +# +# Microsoft Visual C++ makefile for XOTcl +# +# do not edit in this file, edit "configs.vc" +# +###################################################################### + +!include "configs.vc" + +BINROOT = . +ROOT = .. +NAMEPREFIX = lib +NAME = xotcl +STUBSUFFIX = stub + +XOTCL_DIR = .. +XOTCL_BUILD_DIR = ..\win +SDBM_DIR = ..\library\store\XOTclSdbm +EXPAT_DIR = ..\library\xml\TclExpat-1.1 +MAKE_XOTCL = .\library\lib\make.xotcl + +MAKECMD = nmake.exe -nologo /$(MAKEFLAGS) -f makefile.vc + +######################################################################## + +lflags = /NODEFAULTLIB /NOLOGO /MACHINE:$(MACHINE) $(libpath32) +conlflags = $(lflags) -subsystem:console -entry:mainCRTStartup +guilflags = $(lflags) -subsystem:windows -entry:WinMainCRTStartup + +!IF "$(MACHINE)" == "PPC" +libc = libc$(DBGX).lib +libcdll = crtdll$(DBGX).lib +!ELSE +libc = libc$(DBGX).lib oldnames.lib +libcdll = msvcrt$(DBGX).lib oldnames.lib +!ENDIF + +baselibs = kernel32.lib $(optlibs) advapi32.lib user32.lib +winlibs = $(baselibs) gdi32.lib comdlg32.lib winspool.lib + +guilibs = $(libc) $(winlibs) +conlibs = $(libc) $(baselibs) +guilibsdll = $(libcdll) $(winlibs) +conlibsdll = $(libcdll) $(baselibs) + +######################################################################## + +!if $(DEBUG) +TMPNAME = Debug +DBGX = d +!else +TMPNAME = Release +DBGX = +!endif + +TMP_DIR = $(BINROOT)\$(TMPNAME) + +!ifndef OUT_DIR +OUT_DIR = $(TMP_DIR) +!endif + +!if $(STATIC_BUILD) +XOTCLOUTNAME = $(NAMEPREFIX)$(NAME)$(XOTCL_VERSION)$(DBGX) +XOTCLTARGET = "$(OUT_DIR)\$(XOTCLOUTNAME).lib" +!else +XOTCLOUTNAME = $(NAMEPREFIX)$(NAME)$(XOTCL_VERSION)$(DBGX) +XOTCLIMPLIB = "$(OUT_DIR)\$(XOTCLOUTNAME).lib" +XOTCLTARGET = "$(OUT_DIR)\$(XOTCLOUTNAME).dll" +!endif + +TCLSTUBLIB = "$(TCLROOT)\win\Release\tclstub$(TCL_VERSION).lib" +TCLIMPLIB = "$(TCLROOT)\win\$(OUT_DIR)\tcl$(TCL_VERSION)$(DBGX).lib" +TKIMPLIB = "$(TKROOT)\win\$(OUT_DIR)\tk$(TCL_VERSION)$(DBGX).lib" +TCLSH = "$(TCLROOT)\win\$(OUT_DIR)\tclsh$(TCL_VERSION)$(DBGX).exe" + +XOTCLSTUBLIBNAME = $(NAMEPREFIX)$(NAME)$(STUBSUFFIX)$(XOTCL_VERSION)$(DBGX).lib +XOTCLSTUBLIB = "$(OUT_DIR)\$(XOTCLSTUBLIBNAME)" + +LIB_INSTALL_DIR = $(INSTALLDIR)\lib +BIN_INSTALL_DIR = $(INSTALLDIR)\bin +SCRIPT_INSTALL_DIR = $(INSTALLDIR)\lib\xotcl$(XOTCL_DOTVERSION) +INCLUDE_INSTALL_DIR = $(INSTALLDIR)\include + +XOTCLOBJS_STUB = $(TMP_DIR)\xotclStubInit.obj +COMPILE_XOTCL_STUBS = -DCOMPILE_XOTCL_STUBS=1 + +!if $(TCLMAJOR) == 8 +!if $(TCLMINOR) == 0 +XOTCLOBJS_STUB = "" +COMPILE_XOTCL_STUBS="" +!endif +!endif + +XOTCLOBJS = $(XOTCLOBJS_STUB) \ + $(TMP_DIR)\xotcl.obj \ + $(TMP_DIR)\xotclError.obj \ + $(TMP_DIR)\xotclMetaData.obj \ + $(TMP_DIR)\xotclObjectData.obj \ + $(TMP_DIR)\xotclProfile.obj \ + $(TMP_DIR)\xotclTrace.obj \ + $(TMP_DIR)\xotclShadow.obj \ + $(TMP_DIR)\xotclUtil.obj \ + $(TMP_DIR)\aolstub.obj \ +!if $(STATIC_BUILD) == 0 + $(TMP_DIR)\dllEntryPoint.obj \ + $(TMP_DIR)\dllResource.obj \ +!endif + +XOTCLSHOBJS = $(TMP_DIR)\xotclAppInit.obj +XOWISHOBJS = $(TMP_DIR)\winMain.obj + +XOTCLSTUBOBJS = \ + $(TMP_DIR)\xotclStubLib.obj + +WINDIR = $(ROOT)\win +GENERICDIR = $(ROOT)\generic +RCDIR = $(ROOT)\win\rc + +###################################################################### +# Link flags +###################################################################### + +!if $(DEBUG) +ldebug = -debug:full -debugtype:cv +!else +ldebug = -release +!endif + +# declarations common to all linker options +lcommon = -nologo -link50compat -machine:$(MACHINE) + +XOTCL_LFLAGS = $(lcommon) $(ldebug) -subsystem:windows -dll + +!if $(USE_TCL_STUBS) == 0 +XOTCL_LLIBS = $(TCLIMPLIB) +!else +XOTCL_LLIBS = $(TCLSTUBLIB) +!endif + +###################################################################### +# Compile flags +###################################################################### + +!if !$(DEBUG) +# This cranks the optimization level to maximize speed +cdebug = -O2 -Gs +!else if "$(MACHINE)" == "IA64" +cdebug = -Od -Zi +!else +cdebug = -Z7 -Od -WX +DBGX = d +!endif + +!if $(STATIC_BUILD) +cdll = +!else +cdll = -GD +!endif + +# declarations common to all compiler options +ccommon = -nologo -c -W3 -YX \ + + +!if $(STATIC_BUILD) && $(NOMSVCRT) +crt = -MT$(DBGX) +!else +crt = -MD$(DBGX) +!endif + +TCL_INCLUDES = -I"$(TCLROOT)\generic" +TK_INCLUDES = -I"$(TKROOT)\generic" -I$(TKROOT)\win -I$(TKROOT)\xlib + +XOTCL_INCLUDES = -I$(WINDIR) -I$(GENERICDIR) +XOTCL_DEFINES = -DBUILD_$(NAME) -DTCL_THREADS=1 \ + -DXOLIBPKG=$(INST_XOLIBPKG) \ + -DXOTCLVERSION=$(XOTCLVERSION) \ + -DXOTCLPATCHLEVEL=$(XOTCLPATCHLEVEL) \ + -D__WIN32__ -DVISUAL_CC $(COMPILE_XOTCL_STUBS) + +XOTCL_EXE_CFLAGS = $(ccommon) $(cdebug) $(crt) $(cdll) $(XOTCL_INCLUDES) \ + $(XOTCL_DEFINES) $(TCL_INCLUDES) $(TK_INCLUDES) + +!if $(USE_TCL_STUBS) +XOTCL_CFLAGS = $(XOTCL_EXE_CFLAGS) -DUSE_TCL_STUBS +!else +XOTCL_CFLAGS = $(XOTCL_EXE_CFLAGS) +!endif + +###################################################################### +# Project specific targets +###################################################################### + +all : libs packages end + +#xotcl : xotclsh xowish + +libs : setup $(XOTCLTARGET) $(XOTCLSTUBLIB) ./pkgIndex.tcl + cd $(SDBM_DIR) + $(MAKECMD) + cd ..\.. + cd $(EXPAT_DIR) + $(MAKECMD) + cd ..\..\..\win + +end: + @echo ************************************************************ + @echo * + @echo * Make completed. + @echo * + @echo * In order to test XOTcl, invoke: + @echo * + @echo * nmake -fmakefile.vc test + @echo * + @echo * In order install XOTcl, invoke the installWin.tcl + @echo * installation script, like: + @echo * + @echo * tclsh83 installWin.tcl c:\Progra~1 + @echo * + @echo * or: + @echo * + @echo * nmake -fmakefile.vc install + @echo * + @echo * To run XOTcl from the local directory, set the environment + @echo * variable TCLLIBPATH to the toplevel directory of xotcl and + @echo * execute tclsh: + @echo * + @echo * set TCLLIBPATH=$(ROOT) + @echo * tclsh83 + @echo * package require XOTcl; namespace import -force xotcl::* + @echo * + @echo ************************************************************ + +packages : libs + cd ..\library + set TCLLIBPATH=$(ROOT) + $(TCLSH) ..\$(MAKE_XOTCL) -target $(INST_XOLIBPKG) -all + cd ..\win + +install : all + set TCLLIBPATH=$(ROOT) + $(TCLSH) .\installWin.tcl + +test : $(TCLSH) + set TCLLIBPATH=$(ROOT) + $(TCLSH) $(ROOT)\tests\speedtest.xotcl + $(TCLSH) $(ROOT)\tests\testx.xotcl + $(TCLSH) $(ROOT)\tests\testo.xotcl + $(TCLSH) $(ROOT)\tests\xocomm.test + $(TCLSH) $(ROOT)\tests\persistence.test + $(TCLSH) $(ROOT)\tests\xoRDF.test + +tar : distclean + cd .. + tar cvfz xotcl-$(FULLVERSION).tar.gz xotcl-$(FULLVERSION)/* + cd xotcl-$(FULLVERSION) + + +./pkgIndex.tcl : $(XOTCLTARGET) + echo package ifneeded XOTcl $(XOTCL_VERSION) [list load [file join $$dir $(TMPNAME)/$(XOTCLOUTNAME).dll] XOTcl] > \ + ".\pkgIndex.tcl" + +setup : + @$(vcvars) > nul + @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) &\ + echo Created directory '$(TMP_DIR)' + @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) &\ + echo Created directory '$(OUT_DIR)' + +$(XOTCLTARGET) : $(XOTCLOBJS) +!if $(STATIC_BUILD) + $(lib32) -nologo -machine:$(MACHINE) -out:$@ @<< +!else + $(link32) $(XOTCL_LFLAGS) -base:@$(XOTCL_DIR)\win\dllBase.txt,$@ -out:$@ $(XOTCL_LLIBS) @<< +!endif + $(XOTCLOBJS) +<< + +#!if $(DEBUG) == 0 +$(XOTCLSTUBLIB) : $(XOTCLSTUBOBJS) + $(lib32) -nologo -out:$@ $(XOTCLSTUBOBJS) +#!else +#$(XOTCLSTUBLIB) : +#!endif + +#install : all +# if not exist "$(INSTALLDIR)" mkdir "$(INSTALLDIR)" +# if not exist "$(BIN_INSTALL_DIR)" mkdir "$(BIN_INSTALL_DIR)" +# if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" +# if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" +# if not exist "$(INCLUDE_INSTALL_DIR)" mkdir "$(INCLUDE_INSTALL_DIR)" +# copy $(XOTCLTARGET) "$(SCRIPT_INSTALL_DIR)" +# -copy $(XOTCLSTUBLIB) "$(LIB_INSTALL_DIR)" +# copy $(ROOT)\generic\xotcl.h "$(INCLUDE_INSTALL_DIR)" +# copy $(ROOT)\generic\xotclDecls.h "$(INCLUDE_INSTALL_DIR)" +# copy $(ROOT)\library\*.* "$(SCRIPT_INSTALL_DIR)" +# echo package ifneeded XOTcl $(XOTCL_DOTVERSION) [list load [file join $$dir ../../bin $(XOTCLOUTNAME).dll] XOTcl] > \ +# "$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl" + +###################################################################### +# Regenerate the stubs files. +###################################################################### + +genstubs: + $(TCLSH) $(TCLROOT)\tools\genStubs.tcl $(GENERICDIR) \ + $(GENERICDIR)\xotcl.decls $(GENERICDIR)\xotclInt.decls + +###################################################################### +# Special case object file targets +###################################################################### + +# The following object is part of the stub library and should not +# be built as DLL objects but none of the symbols should be exported + +$(TMP_DIR)\xotclStubLib.obj : $(GENERICDIR)\xotclStubLib.c + $(cc32) -DSTATIC_BUILD $(XOTCL_EXE_CFLAGS) -Zl -Fo$@ $? + +$(TMP_DIR)\dllResource.obj : $(TMP_DIR)\xotcl.res + $(cvtres32) -nologo -machine:$(MACHINE) -out:$@ $? + +predefined : $(GENERICDIR)\predefined.xotcl + cd $(GENERICDIR) + $(TCLSH) mk_predefined.xotcl > predefined.h + cd ..\win + +###################################################################### +# Inference rules. Use batch-mode when supported. +###################################################################### + +$(TMP_DIR)\xotclAppInit.obj : $(GENERICDIR)\xotclAppInit.c + $(cc32) $(XOTCL_EXE_CFLAGS) -Fo$@ $? + +$(TMP_DIR)\findXOTcl.obj : $(GENERICDIR)\findXOTcl.c + $(cc32) $(XOTCL_EXE_CFLAGS) -Fo$@ $? + +$(TMP_DIR)\winMain.obj : $(WINDIR)\winMain.c + $(cc32) $(XOTCL_EXE_CFLAGS) -Fo$@ $? + + + +!if $(_NMAKE_VER) < 162 +{$(WINDIR)}.c{$(TMP_DIR)}.obj : +!else +{$(WINDIR)}.c{$(TMP_DIR)}.obj :: +!endif + $(cc32) -DDLL_BUILD $(XOTCL_CFLAGS) -Fo$(TMP_DIR)\ @<< +$< +<< + +!if $(_NMAKE_VER) < 162 +{$(GENERICDIR)}.c{$(TMP_DIR)}.obj : +!else +{$(GENERICDIR)}.c{$(TMP_DIR)}.obj :: +!endif + $(cc32) -DDLL_BUILD $(XOTCL_CFLAGS) -Fo$(TMP_DIR)\ @<< +$< +<< + +XOTCL_VERSION_DEFINES = \ + -DXOTCL_MAJOR_VERSION=$(XOTCL_MAJOR_VERSION) \ + -DXOTCL_MINOR_VERSION=$(XOTCL_MINOR_VERSION) \ + -DXOTCL_VERSION=\"$(XOTCL_VERSION)\" + + +{$(RCDIR)}.rc{$(TMP_DIR)}.res : + $(rc32) -fo $@ -DDEBUG=$(DEBUG) $(XOTCL_VERSION_DEFINES) $(XOTCL_INCLUDES) $(TCL_INCLUDES) $(XOTCL_DEFINES) $< + +###################################################################### +# Clean up +###################################################################### + +tidy : + -del $(TMP_DIR)\*.pch + -del $(TMP_DIR)\*.obj + -del $(TMP_DIR)\*.res + -del .\*.pdb + -del .\*.pch + cd $(SDBM_DIR) + $(MAKECMD) tidy + cd ..\.. + cd $(EXPAT_DIR) + $(MAKECMD) tidy + cd ..\..\..\win + +clean : + -del $(TMP_DIR)\*.pch + -del $(TMP_DIR)\*.obj + -del $(TMP_DIR)\*.res + -del .\*.pdb + -del .\*.pch + -del $(OUT_DIR)\*.exp + -del $(OUT_DIR)\*.lib + -del $(OUT_DIR)\*.dll + -del ..\*.exp + -del ..\*.lib + -del ..\xotclsh.exe + -del ..\xowish.exe + cd $(SDBM_DIR) + $(MAKECMD) clean + cd ..\.. + cd $(EXPAT_DIR) + $(MAKECMD) clean + cd ..\..\..\win + +distclean : clean + -rmdir $(OUT_DIR) + -rmdir $(TMP_DIR) + cd $(SDBM_DIR) + $(MAKECMD) distclean + cd ..\.. + cd $(EXPAT_DIR) + $(MAKECMD) distclean + cd ..\..\..\win + +# +# tar +# + +tar : distclean + cd ..\.. + tar cvfz xotcl-$(FULLVERSION).tar.gz xotcl-$(FULLVERSION)/* + cd xotcl-$(FULLVERSION)\win + +# +# XOTcl Shells +# +../xotclsh.exe: $(XOTCLSHOBJS) $(TCLIMPLIB) $(TMP_DIR)\xotcl.res + $(link32) $(ldebug) $(conlflags) $(TMP_DIR)\xotcl.res -stack:2300000 \ + -out:$@ $(conlibsdll) $(TCLIMPLIB) $(XOTCLSHOBJS) + +../xowish.exe: $(XOWISHOBJS) $(TCLIMPLIB) $(TKIMPLIB) $(TMP_DIR)\xotcl.res + $(link32) $(ldebug) $(guilflags) $(TMP_DIR)\xotcl.res -out:$@ \ + $(guilibsdll) $(TCLIMPLIB) $(TKIMPLIB) $(XOTCLLIB) $(XOWISHOBJS) + + +xotclsh: ../xotclsh.exe +xowish: ../xowish.exe + +xotclshells: xotclsh xowish Index: xotcl/win/configs.vc =================================================================== diff -u --- xotcl/win/configs.vc (revision 0) +++ xotcl/win/configs.vc (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,134 @@ +# +# Config file for MS Visual CC compile with nmake; only edit in this file +# + +# are we using MSVC++ version 5 or 6 ? +MSDEV_VER = 6 + +# Where is MSVC++ located? +MSDEVROOT = c:\progra~1\Micros~3\ + +# Where is Tcl and Tk? Which Version? +TCLMAJOR = 8 +TCLMINOR = 3 +TCLPATCHLEVEL = .5 +#TCLMAJOR = 8 +#TCLMINOR = 4 +#TCLPATCHLEVEL = .5 + +TCLROOT = c:\tcl$(TCLMAJOR).$(TCLMINOR)$(TCLPATCHLEVEL) +TKROOT = c:\tk$(TCLMAJOR).$(TCLMINOR)$(TCLPATCHLEVEL) + +TCL_VERSION = $(TCLMAJOR)$(TCLMINOR) +TCL_DOTVERSION = $(TCLMAJOR).$(TCLMINOR) + +# Where will we install XOTcl? Usually use the installWin.tcl script +INSTALLDIR = c:/progra~1/tcl + +# machine setting, pick from: +# ALPHA|ARM|IX86|MIPS|MIPS16|MIPSR41XX|PPC|SH3|SH4 +# Or set to IA64 to rearrange everything to use the Intel IA64 SDK. +# +MACHINE = IX86 + +!if "$(MACHINE)" == "IA64" +vcvars = "c:\ia64sdk17\vcvars32.bat" +!elseif $(MSDEV_VER) == 5 +vcvars = "$(MSDEVROOT)\vc\bin\vcvars32.bat" +!elseif $(MSDEV_VER) == 6 +vcvars = "$(MSDEVROOT)\vc98\bin\vcvars32.bat" +!endif + +# the VCC tools names +rc32 = rc +cc32 = cl +link32 = link +lib32 = lib +cvtres32 = cvtres + +# +# XOTCL VERSION SETTINGS (do not edit) +# +XOTCL_MAJOR_VERSION=1 +XOTCL_MINOR_VERSION=2 +XOTCL_RELEASE_LEVEL=.0 + +MAJOR_VERSION=$(XOTCL_MAJOR_VERSION) +MINOR_VERSION=$(XOTCL_MINOR_VERSION) +PATCHLEVEL=$(XOTCL_RELEASE_LEVEL) + +XOTCL_VERSION= $(MAJOR_VERSION).$(MINOR_VERSION) +FULLVERSION= $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCHLEVEL) +NODOT_VERSION= $(MAJOR_VERSION)$(MINOR_VERSION) +INST_XOLIBPKG = \"$(INSTALLDIR)/lib/xotcl$(MAJOR_VERSION).$(MINOR_VERSION)\" +XOTCLVERSION = \"$(XOTCL_VERSION)\" +XOTCLPATCHLEVEL= \"$(PATCHLEVEL)\" + +## command line rules + +!ifndef HAVE_RULES +HAVE_RULES = 1 + +# Set DEBUG to 1 to compile with symbols. +!ifndef DEBUG +DEBUG = 0 +!endif + +# Set STATIC_BUILD to 1 to make a static library rather +# than a dll. +!ifndef STATIC_BUILD +STATIC_BUILD = 0 +!endif + +# Set USE_TCL_STUBS to 0 to disable Stubs support. Stubs +# will work fine even with static libraries, but you may +# disable it if you want to. +# +!ifndef USE_TCL_STUBS +!if $(STATIC_BUILD) == 0 +USE_TCL_STUBS = 1 +!else +USE_TCL_STUBS = 0 +!endif +!endif + +# no stubs support in Tcl 8.0 +!if $(TCLMAJOR) == 8 +!if $(TCLMINOR) == 0 +USE_TCL_STUBS = 0 +!endif +!endif + +# Set NOMSVCRT to 1 to use libcmt(d).lib instead of the +# dynamic run-time. +# +!ifndef NOMSVCRT +!if $(STATIC_BUILD) +NOMSVCRT = 1 +!else +NOMSVCRT = 0 +!endif +!endif + +!if $(STATIC_BUILD) == 0 && $(NOMSVCRT) == 1 +!error "The static runtime in a loadable (dll) extension is a useless configuration that will cause abnormal and unnecessary code bloat." +!endif + +!endif #!ifndef HAVE_RULES + +_NMAKE_VER = $(_NMAKE_VER:6.00.8168.0=600) + +!IF "$(MACHINE)" == "IA64" +TOOLS32 = c:\ia64sdk17 +TOOLS32_rc = c:\ia64sdk17 +!ELSE +TOOLS32 = $(MSDEVROOT)\Vc98 +TOOLS32_rc = $(MSDEVROOT)\Common\MsDev98 +!ENDIF + +cc32 = "$(TOOLS32)\bin\cl.exe" +link32 = "$(TOOLS32)\bin\link.exe" +rc32 = "$(TOOLS32_rc)\bin\rc.exe" +include32 = -I"$(TOOLS32)\include" +libpath32 = /LIBPATH:"$(TOOLS32)\lib" +lib32 = "$(TOOLS32)\bin\lib.exe" Index: xotcl/win/dllBase.txt =================================================================== diff -u --- xotcl/win/dllBase.txt (revision 0) +++ xotcl/win/dllBase.txt (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,19 @@ +; +; This file defines the virtual base addresses for the Dynamic Link Libraries +; that are part of the XOTcl system. The first token on a line is the key (or +; name of the DLL) and the second token is the virtual base address, in hexidecimal. +; The third token is the maximum size of the DLL image file, including symbols. +; +; Using a specified "prefered load address" should speed loading time by avoiding +; relocations (NT supported only). It is assumed extension authors will contribute +; their modules to this grand-master list. You can use the dumpbin utility with +; the /headers option to get the "size of image" data (already in hex). If the +; maximum size is too small a linker warning will occur. Modules can overlap when +; they're mutually exclusive. This info is placed in the DLL's PE header by the +; linker with the `-base:@$(XOTCL_DIR)\win\dllBase.txt,` option. +; +; RCS: @(#) $$ + +.\Release\libxotcl1.1.dll 0x67000000 0x00020000 +.\Release\libxotclsdbm1.1.dll 0x67020000 0x00010000 +.\Release\libxotclexpat1.1.dll 0x67030000 0x00020000 Index: xotcl/win/dllEntryPoint.c =================================================================== diff -u --- xotcl/win/dllEntryPoint.c (revision 0) +++ xotcl/win/dllEntryPoint.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,52 @@ +/* + * dllEntryPoint.c -- + * + * This file implements the Dll entry point as needed by Windows. + */ + +#define WIN32_LEAN_AND_MEAN +#include + +#ifdef _MSC_VER + /* Only do this when MSVC++ is compiling us. */ +# define DllEntryPoint DllMain +# if defined(USE_TCL_STUBS) && (!defined(_MT) || !defined(_DLL) || defined(_DEBUG)) + /* + * This fixes a bug with how the Stubs library was compiled. + * The requirement for msvcrt.lib from tclstubXX.lib should + * be removed. + */ +# pragma comment(linker, "-nodefaultlib:msvcrt.lib") +# endif +#endif + +/* + *---------------------------------------------------------------------- + * + * DllEntryPoint -- + * + * This wrapper function is used by Windows to invoke the + * initialization code for the DLL. If we are compiling + * with Visual C++, this routine will be renamed to DllMain. + * + * Results: + * Returns TRUE; + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +#ifndef STATIC_BUILD + +BOOL APIENTRY +DllEntryPoint(hInst, reason, reserved) + HINSTANCE hInst; /* Library instance handle. */ + DWORD reason; /* Reason this function is being called. */ + LPVOID reserved; /* Not used. */ +{ + return TRUE; +} + +#endif \ No newline at end of file Index: xotcl/win/installWin.tcl =================================================================== diff -u --- xotcl/win/installWin.tcl (revision 0) +++ xotcl/win/installWin.tcl (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,136 @@ +# $Id: installWin.tcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +if {$::argc > 0} { + set DESTINATION [lindex $argv 0] +} else { + # if now argument is given -> set to default + set DESTINATION "/Progra~1/Tcl" +} + +puts "Installing to Directory: $DESTINATION" + +#rename file tcl_file +#proc file args { +# puts stderr "...$args" +# eval ::tcl_file $args +#} + +# +# find out the XOTcl version +# +cd .. +set xotclDir . +set buildDir $xotclDir/win/Release +cd $buildDir +set xotcllib [lindex [glob -nocomplain libxotcl*.dll] 0] +cd ../.. +regexp {^libxotcl([0-9]\.[0-9]).dll$} $xotcllib _ xotclVersion +puts "XOTcl Version is $xotclVersion" +set MAKEXOTCL $xotclDir/library/lib/make.xotcl + +# +# copy binaries +# +file mkdir $DESTINATION/bin +set bin "xotclsh.exe xowish.exe" +foreach b $bin { + if {[file exists $buildDir/$b]} { + puts "Copying $b" + file copy -force $buildDir/$b $DESTINATION/bin + } elseif {[file exists $xotclDir/$b]} { + puts "Copying $b" + file copy -force $xotclDir/$b $DESTINATION/bin + } +} + +# +# copy libraries +# +file mkdir $DESTINATION/include +set includes "xotcl.h xotclInt.h xotclDecls.h xotclIntDecls.h" +foreach i $includes { + puts "Copying $i" + file copy -force $xotclDir/generic/$i $DESTINATION/include +} + +# +# create the XOTcl library directory +# +puts "Creating XOTcl Lib Dir" +file mkdir $DESTINATION/lib +file mkdir $DESTINATION/lib/xotcl$xotclVersion + +# +# copy the dll +# +set b libxotcl${xotclVersion}.dll +if {[file exists $buildDir/$b]} { + puts "Copying $b" + file copy -force $buildDir/$b $DESTINATION/lib +} elseif {[file exists $xotclDir/$b]} { + puts "Copying $b" + file copy -force $xotclDir/$b $DESTINATION/lib +} + +# +# create a pkgindex file for xotcl in the library directoy +# +#file mkdir $DESTINATION/lib/xotcl$xotclVersion/libxotcl +puts "Creating pkgindex files for xotcl in the library directory" +#set pkgIndex "package ifneeded XOTcl $xotclVersion \[list load \[file join \$dir ../../../bin \"libxotcl${xotclVersion}.dll\"\] XOTcl\]" +#set F [open $DESTINATION/lib/xotcl$xotclVersion/libxotcl/pkgIndex.tcl w] +#puts $F $pkgIndex +#puts $F "\n" +#close $F +## and one in the xotcl- directory +set pkgIndex "package ifneeded XOTcl $xotclVersion \[list load \[file join \$dir ../../ \"libxotcl${xotclVersion}.dll\"\] XOTcl\]" +file mkdir $DESTINATION/lib/xotcl$xotclVersion/xotcl +set F [open $DESTINATION/lib/xotcl$xotclVersion/xotcl/pkgIndex.tcl w] +puts $F $pkgIndex +puts $F "\n" +close $F + +proc copyDir {dir dest} { + puts "Copying directory: $dir" + set files [glob -nocomplain $dir/*] + foreach f $files { + doDir $f $dest + } +} + +proc doDir {f dest} { + if {[file isdirectory $f]} { + file mkdir $dest/$f + copyDir $f $dest + } else { + file copy -force $f $dest/$f + } +} + +cd library + +foreach f [glob -nocomplain *] { + doDir $f $DESTINATION/lib/xotcl$xotclVersion +} + +cd .. +set pwd [pwd] + +puts "Indexing the packages" +set shell [info nameofexecutable] +#puts "SHELL=$shell" +cd $DESTINATION/lib/xotcl$xotclVersion +if {[catch {exec $shell $pwd/$MAKEXOTCL -target $DESTINATION/lib/xotcl$xotclVersion -all} errMsg]} { + puts " ... resulting message: $errMsg\n" +} else { + puts " ... Package Indexing SUCCEEDED\n" +} + +puts stderr "***************************************************" +puts stderr "INSTALLATION COMPLETE." +puts stderr "\nIn order to use XOTcl set PATH to " +puts stderr " '$DESTINATION/bin' and" +puts stderr "set TCLLIBPATH to " +puts stderr " '$DESTINATION/lib/xotcl$xotclVersion'" +puts stderr "***************************************************" + + Index: xotcl/win/pkgIndex.win =================================================================== diff -u --- xotcl/win/pkgIndex.win (revision 0) +++ xotcl/win/pkgIndex.win (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,3 @@ + package ifneeded XOTcl 1.1 [list load \ + [file join $dir ../../bin xotcl1.1.dll] XOTcl] + Index: xotcl/win/pkgIndex.win.in =================================================================== diff -u --- xotcl/win/pkgIndex.win.in (revision 0) +++ xotcl/win/pkgIndex.win.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,3 @@ + package ifneeded XOTcl @VERSION@ [list load \ + [file join $dir ../../bin xotcl@VERSION@.dll] XOTcl] + Index: xotcl/win/rc/xotcl.rc =================================================================== diff -u --- xotcl/win/rc/xotcl.rc (revision 0) +++ xotcl/win/rc/xotcl.rc (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,59 @@ +// +// Version resource script. +// + +#include + +#define RESOURCE_INCLUDED +#include + + +// +// build-up the name suffix that defines the type of build this is. +// +#if DEBUG == 1 +#define SUFFIX_DEBUG "d" +#else +#define SUFFIX_DEBUG "" +#endif + +#define SUFFIX SUFFIX_DEBUG + + +VS_VERSION_INFO VERSIONINFO + FILEVERSION XOTCL_MAJOR_VERSION ,XOTCL_MINOR_VERSION ,0 , 0 + PRODUCTVERSION XOTCL_MAJOR_VERSION ,XOTCL_MINOR_VERSION ,0 , 0 + FILEFLAGSMASK 0x3fL +#if DEBUG == 1 + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "XOTcl language extension for Tcl\0" + VALUE "Authors", "Gustaf Neumann and Uwe Zdun\0" + VALUE "OriginalFilename", "xotcl" STRINGIFY(JOIN(XOTCL_MAJOR_VERSION,XOTCL_MINOR_VERSION)) SUFFIX ".dll\0" + VALUE "CompanyName", "Vienna University of Economics and Business Administration, University of Essen\0" + VALUE "FileVersion", XOTCL_VERSION + VALUE "LegalCopyright", "Copyright \251 1999-2001\0" + VALUE "ProductName", "XOTcl " XOTCL_VERSION " for Windows\0" + VALUE "ProductVersion", XOTCL_VERSION + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + + + + Index: xotcl/win/winMain.c =================================================================== diff -u --- xotcl/win/winMain.c (revision 0) +++ xotcl/win/winMain.c (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,430 @@ +/* + * winMain.c -- + * + * Main entry point for wish and other Tk-based applications. + * + * Copyright (c) 1995-1997 Sun Microsystems, Inc. + * Copyright (c) 1998-1999 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * RCS: @(#) $Id: winMain.c,v 1.1 2004/05/23 22:50:39 neumann Exp $ + */ + +#include +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#include +#include +#if defined(VISUAL_CC) +# include "xotcl.h" +#else +# include +#endif + +#include "tkInt.h" + +/* + * The following declarations refer to internal Tk routines. These + * interfaces are available for use, but are not supported. + */ +#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<2 +EXTERN void TkConsoleCreate(void); +EXTERN int TkConsoleInit(Tcl_Interp *interp); +#endif +/* + * Forward declarations for procedures defined later in this file: + */ + +static void setargv _ANSI_ARGS_((int *argcPtr, char ***argvPtr)); +static void WishPanic _ANSI_ARGS_(TCL_VARARGS(CONST char *,format)); + +#ifdef TK_TEST +extern int Tktest_Init(Tcl_Interp *interp); +#endif /* TK_TEST */ + +#ifdef TCL_TEST +extern int TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp)); +extern int Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp)); +#endif /* TCL_TEST */ + +static BOOL consoleRequired = TRUE; + + +/* + *---------------------------------------------------------------------- + * + * WinMain -- + * + * Main entry point from Windows. + * + * Results: + * Returns false if initialization fails, otherwise it never + * returns. + * + * Side effects: + * Just about anything, since from here we call arbitrary Tcl code. + * + *---------------------------------------------------------------------- + */ + +int APIENTRY +WinMain(hInstance, hPrevInstance, lpszCmdLine, nCmdShow) + HINSTANCE hInstance; + HINSTANCE hPrevInstance; + LPSTR lpszCmdLine; + int nCmdShow; +{ + char **argv; + int argc; +#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<2 + char buffer[MAX_PATH+1]; + char *p; +#endif + Tcl_SetPanicProc(WishPanic); + + /* + * Set up the default locale to be standard "C" locale so parsing + * is performed correctly. + */ + + setlocale(LC_ALL, "C"); +#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION>1 + setargv(&argc, &argv); +#endif + /* + * Increase the application queue size from default value of 8. + * At the default value, cross application SendMessage of WM_KILLFOCUS + * will fail because the handler will not be able to do a PostMessage! + * This is only needed for Windows 3.x, since NT dynamically expands + * the queue. + */ + + SetMessageQueue(64); + + /* + * Create the console channels and install them as the standard + * channels. All I/O will be discarded until Tk_CreateConsoleWindow is + * called to attach the console to a text widget. + */ +#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<2 + TkConsoleCreate(); + + setargv(&argc, &argv); + + /* + * Replace argv[0] with full pathname of executable, and forward + * slashes substituted for backslashes. + */ + + GetModuleFileName(NULL, buffer, sizeof(buffer)); + argv[0] = buffer; + for (p = buffer; *p != '\0'; p++) { + if (*p == '\\') { + *p = '/'; + } + } +#endif + consoleRequired = TRUE; + + Tk_Main(argc, argv, Tcl_AppInit); + return 1; +} + + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppInit -- + * + * This procedure performs application-specific initialization. + * Most applications, especially those that incorporate additional + * packages, will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error + * message in the interp's result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_AppInit(interp) + Tcl_Interp *interp; /* Interpreter for application. */ +{ + if (Tcl_Init(interp) == TCL_ERROR) { + goto error; + } + if (Tk_Init(interp) == TCL_ERROR) { + goto error; + } + Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit); + + /* + if (Xotcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "XOTcl", Xotcl_Init, 0); + */ + if (Tcl_PkgRequire(interp, "XOTcl", XOTCLVERSION, 1) == NULL) { + return TCL_ERROR; + } + + /* + * This is xotclsh, so import all xotcl commands by + * default into the global namespace. + */ + if (Tcl_Import(interp, Tcl_GetGlobalNamespace(interp), + "::xotcl::*", /* allowOverwrite */ 1) != TCL_OK) { + return TCL_ERROR; + } + + /* + * Initialize the console only if we are running as an interactive + * application. + */ +#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<2 + if (TkConsoleInit(interp) == TCL_ERROR) { + goto error; + } +#else + if (consoleRequired) { + if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { + goto error; + } + } +#endif + +#ifdef TCL_TEST + if (Tcltest_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, + (Tcl_PackageInitProc *) NULL); + if (TclObjTest_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } +#endif /* TCL_TEST */ + +#ifdef TK_TEST + if (Tktest_Init(interp) == TCL_ERROR) { + goto error; + } + Tcl_StaticPackage(interp, "Tktest", Tktest_Init, + (Tcl_PackageInitProc *) NULL); +#endif /* TK_TEST */ + + Tcl_SetVar(interp, "tcl_rcFileName", "~/wishrc.tcl", TCL_GLOBAL_ONLY); + return TCL_OK; + +error: + WishPanic(Tcl_GetStringResult(interp)); + return TCL_ERROR; +} + +/* + *---------------------------------------------------------------------- + * + * WishPanic -- + * + * Display a message and exit. + * + * Results: + * None. + * + * Side effects: + * Exits the program. + * + *---------------------------------------------------------------------- + */ + +void +WishPanic TCL_VARARGS_DEF(CONST char *,arg1) +{ + va_list argList; + char buf[1024]; + CONST char *format; + + format = TCL_VARARGS_START(CONST char *,arg1,argList); + vsprintf(buf, format, argList); + + MessageBeep(MB_ICONEXCLAMATION); + MessageBox(NULL, buf, "Fatal Error in Wish", + MB_ICONSTOP | MB_OK | MB_TASKMODAL | MB_SETFOREGROUND); +#ifdef _MSC_VER + DebugBreak(); +#endif + ExitProcess(1); +} +/* + *------------------------------------------------------------------------- + * + * setargv -- + * + * Parse the Windows command line string into argc/argv. Done here + * because we don't trust the builtin argument parser in crt0. + * Windows applications are responsible for breaking their command + * line into arguments. + * + * 2N backslashes + quote -> N backslashes + begin quoted string + * 2N + 1 backslashes + quote -> literal + * N backslashes + non-quote -> literal + * quote + quote in a quoted string -> single quote + * quote + quote not in quoted string -> empty string + * quote -> begin quoted string + * + * Results: + * Fills argcPtr with the number of arguments and argvPtr with the + * array of arguments. + * + * Side effects: + * Memory allocated. + * + *-------------------------------------------------------------------------- + */ + +static void +setargv(argcPtr, argvPtr) + int *argcPtr; /* Filled with number of argument strings. */ + char ***argvPtr; /* Filled with argument strings (malloc'd). */ +{ + char *cmdLine, *p, *arg, *argSpace; + char **argv; + int argc, size, inquote, copy, slashes; + + cmdLine = GetCommandLine(); /* INTL: BUG */ + + /* + * Precompute an overly pessimistic guess at the number of arguments + * in the command line by counting non-space spans. + */ + + size = 2; + for (p = cmdLine; *p != '\0'; p++) { + if ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ + size++; + while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ + p++; + } + if (*p == '\0') { + break; + } + } + } + argSpace = (char *) Tcl_Alloc( + (unsigned) (size * sizeof(char *) + strlen(cmdLine) + 1)); + argv = (char **) argSpace; + argSpace += size * sizeof(char *); + size--; + + p = cmdLine; + for (argc = 0; argc < size; argc++) { + argv[argc] = arg = argSpace; + while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ + p++; + } + if (*p == '\0') { + break; + } + + inquote = 0; + slashes = 0; + while (1) { + copy = 1; + while (*p == '\\') { + slashes++; + p++; + } + if (*p == '"') { + if ((slashes & 1) == 0) { + copy = 0; + if ((inquote) && (p[1] == '"')) { + p++; + copy = 1; + } else { + inquote = !inquote; + } + } + slashes >>= 1; + } + + while (slashes) { + *arg = '\\'; + arg++; + slashes--; + } + + if ((*p == '\0') + || (!inquote && ((*p == ' ') || (*p == '\t')))) { /* INTL: ISO space. */ + break; + } + if (copy != 0) { + *arg = *p; + arg++; + } + p++; + } + *arg = '\0'; + argSpace = arg + 1; + } + argv[argc] = NULL; + + *argcPtr = argc; + *argvPtr = argv; +} + + +/* + *---------------------------------------------------------------------- + * + * main -- + * + * Main entry point from the console. + * + * Results: + * None: Tk_Main never returns here, so this procedure never + * returns either. + * + * Side effects: + * Whatever the applications does. + * + *---------------------------------------------------------------------- + */ + +int main(int argc, char **argv) +{ + Tcl_SetPanicProc(WishPanic); + + /* + * Set up the default locale to be standard "C" locale so parsing + * is performed correctly. + */ + + setlocale(LC_ALL, "C"); + /* + * Increase the application queue size from default value of 8. + * At the default value, cross application SendMessage of WM_KILLFOCUS + * will fail because the handler will not be able to do a PostMessage! + * This is only needed for Windows 3.x, since NT dynamically expands + * the queue. + */ + + SetMessageQueue(64); + + /* + * Create the console channels and install them as the standard + * channels. All I/O will be discarded until Tk_CreateConsoleWindow is + * called to attach the console to a text widget. + */ + + consoleRequired = FALSE; + + Tk_Main(argc, argv, Tcl_AppInit); + return 0; +} + Index: xotcl/xotcl.m4 =================================================================== diff -u --- xotcl/xotcl.m4 (revision 0) +++ xotcl/xotcl.m4 (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,139 @@ +# xotcl.m4 -- +# +# This file provides a set of autoconf macros to help TEA-enable +# a Tcl extension. +# +# Copyright (c) 1999 Scriptics Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +#------------------------------------------------------------------------ +# SC_PATH_XOTCLCONFIG -- +# +# Locate the xotclConfig.sh file and perform a sanity check on +# the Tcl compile flags +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --with-xotcl=... +# +# Defines the following vars: +# XOTCL_BIN_DIR Full path to the directory containing +# the xotclConfig.sh file +#------------------------------------------------------------------------ + +AC_DEFUN(SC_PATH_XOTCLCONFIG, [ + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + if test x"${no_xotcl}" = x ; then + # we reset no_xotcl in case something fails here + no_xotcl=true + AC_ARG_WITH(xotcl, [ --with-xotcl directory containing xotcl configuration (xotclConfig.sh)], with_xotclconfig=${withval}) + AC_MSG_CHECKING([for XOTcl configuration]) + AC_CACHE_VAL(ac_cv_c_xotclconfig,[ + + # First check to see if --with-xotcl was specified. + if test x"${with_xotclconfig}" != x ; then + if test -f "${with_xotclconfig}/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd ${with_xotclconfig}; pwd)` + else + AC_MSG_ERROR([${with_xotclconfig} directory doesn't contain xotclConfig.sh]) + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_xotclconfig}" = x ; then + for i in \ + ${srcdir}/../xotcl \ + `ls -dr ${srcdir}/../xotcl-* 2>/dev/null` \ + ${srcdir}/../../xotcl \ + `ls -dr ${srcdir}/../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../xotcl \ + `ls -dr ${srcdir}/../../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../../xotcl \ + `ls -dr ${srcdir}/../../../../xotcl-* 2>/dev/null` \ + ${srcdir}/../../../../../xotcl \ + `ls -dr ${srcdir}/../../../../../xotcl-* 2>/dev/null` ; do + if test -f "$i/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_xotclconfig}" = x ; then + for i in `ls -d ${prefix}/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` ; do + if test -f "$i/xotclConfig.sh" ; then + ac_cv_c_xotclconfig=`(cd $i; pwd)` + break + fi + done + fi + + ]) + + if test x"${ac_cv_c_xotclconfig}" = x ; then + XOTCL_BIN_DIR="# no XOTcl configs found" + AC_MSG_WARN(Can't find XOTcl configuration definitions) + exit 0 + else + no_xotcl= + XOTCL_BIN_DIR=${ac_cv_c_xotclconfig} + AC_MSG_RESULT(found $XOTCL_BIN_DIR/xotclConfig.sh) + fi + fi +]) + +#------------------------------------------------------------------------ +# SC_LOAD_XOTCLCONFIG -- +# +# Load the tclConfig.sh file +# +# Arguments: +# +# Requires the following vars to be set: +# XOTCL_BIN_DIR +# +# Results: +# +# Subst the vars: +# +#------------------------------------------------------------------------ + +AC_DEFUN(SC_LOAD_XOTCLCONFIG, [ + AC_MSG_CHECKING([for existence of $XOTCL_BIN_DIR/xotclConfig.sh]) + + if test -f "$XOTCL_BIN_DIR/xotclConfig.sh" ; then + AC_MSG_RESULT([loading]) + . $XOTCL_BIN_DIR/xotclConfig.sh + else + AC_MSG_RESULT([file not found]) + fi + + # + # The eval is required to do the TCL_DBGX substitution in the + # TCL_LIB_FILE variable + # + AC_SUBST(XOTCL_VERSION) + AC_SUBST(XOTCL_MAJOR_VERSION) + AC_SUBST(XOTCL_MINOR_VERSION) + AC_SUBST(XOTCL_RELEASE_LEVEL) + AC_SUBST(XOTCL_LIB_FILE) + AC_SUBST(XOTCL_BUILD_LIB_SPEC) + AC_SUBST(XOTCL_LIB_SPEC) + AC_SUBST(XOTCL_STUB_LIB_FILE) + AC_SUBST(XOTCL_BUILD_STUB_LIB_SPEC) + AC_SUBST(XOTCL_STUB_LIB_SPEC) + AC_SUBST(XOTCL_SRC_DIR) +]) + Index: xotcl/xotclConfig.sh =================================================================== diff -u --- xotcl/xotclConfig.sh (revision 0) +++ xotcl/xotclConfig.sh (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,56 @@ +# xotclConfig.sh -- +# +# This shell script (for sh) is generated automatically by XOTcl's +# configure script. It will create shell variables for most of +# the configuration options discovered by the configure script. +# This script is intended to be included by the configure scripts +# for XOTcl extensions so that they don't have to figure this all +# out for themselves. This file does not duplicate information +# already provided by tclConfig.sh, so you may need to use that +# file in addition to this one. +# +# The information in this file is specific to a single platform. + +# XOTcl's version number. +XOTCL_VERSION='1.2' +XOTCL_MAJOR_VERSION='1' +XOTCL_MINOR_VERSION='2' +XOTCL_RELEASE_LEVEL='.1' + +# The name of the XOTcl library (may be either a .a file or a shared library): +XOTCL_LIB_FILE=libxotcl1.2.1.so + +# String to pass to linker to pick up the XOTcl library from its +# build directory. +XOTCL_BUILD_LIB_SPEC='-L/home/neumann/xotcl-1.2.1 -lxotcl1.2.1' + +# String to pass to linker to pick up the XOTcl library from its +# installed directory. +XOTCL_LIB_SPEC='-L/usr/lib -lxotcl1.2.1' + +# The name of the XOTcl stub library (a .a file): +# XOTCL_STUB_LIB_FILE=libxotclstub1.2.1.a + +# String to pass to linker to pick up the XOTcl stub library from its +# build directory. +XOTCL_BUILD_STUB_LIB_SPEC='-L/home/neumann/xotcl-1.2.1 -lxotclstub1.2.1' + +# String to pass to linker to pick up the XOTcl stub library from its +# installed directory. +XOTCL_STUB_LIB_SPEC='-L/usr/lib -lxotclstub1.2.1' + +# Name of the xotcl stub library with full path in build and install directory +XOTCL_BUILD_STUB_LIB_PATH='/home/neumann/xotcl-1.2.1/libxotclstub1.2.1.a' +XOTCL_STUB_LIB_PATH='/usr/lib/libxotclstub1.2.1.a' + +# Location of the top-level source directories from which XOTcl +# was built. This is the directory that contains generic, unix, etc. +# If XOTcl was compiled in a different place than the directory +# containing the source files, this points to the location of the sources, +# not the location where XOTcl was compiled. +XOTCL_SRC_DIR='/home/neumann/xotcl-1.2.1' + +# shared and unshared library suffix +XOTCL_SHARED_LIB_SUFFIX=1.2.1.so +XOTCL_UNSHARED_LIB_SUFFIX=1.2.1.a + Index: xotcl/xotclConfig.sh.in =================================================================== diff -u --- xotcl/xotclConfig.sh.in (revision 0) +++ xotcl/xotclConfig.sh.in (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) @@ -0,0 +1,56 @@ +# xotclConfig.sh -- +# +# This shell script (for sh) is generated automatically by XOTcl's +# configure script. It will create shell variables for most of +# the configuration options discovered by the configure script. +# This script is intended to be included by the configure scripts +# for XOTcl extensions so that they don't have to figure this all +# out for themselves. This file does not duplicate information +# already provided by tclConfig.sh, so you may need to use that +# file in addition to this one. +# +# The information in this file is specific to a single platform. + +# XOTcl's version number. +XOTCL_VERSION='@XOTCL_VERSION@' +XOTCL_MAJOR_VERSION='@XOTCL_MAJOR_VERSION@' +XOTCL_MINOR_VERSION='@XOTCL_MINOR_VERSION@' +XOTCL_RELEASE_LEVEL='@XOTCL_RELEASE_LEVEL@' + +# The name of the XOTcl library (may be either a .a file or a shared library): +XOTCL_LIB_FILE=@PKG_LIB_FILE@ + +# String to pass to linker to pick up the XOTcl library from its +# build directory. +XOTCL_BUILD_LIB_SPEC='@XOTCL_BUILD_LIB_SPEC@' + +# String to pass to linker to pick up the XOTcl library from its +# installed directory. +XOTCL_LIB_SPEC='@XOTCL_LIB_SPEC@' + +# The name of the XOTcl stub library (a .a file): +# XOTCL_STUB_LIB_FILE=@PKG_STUB_LIB_FILE@ + +# String to pass to linker to pick up the XOTcl stub library from its +# build directory. +XOTCL_BUILD_STUB_LIB_SPEC='@XOTCL_BUILD_STUB_LIB_SPEC@' + +# String to pass to linker to pick up the XOTcl stub library from its +# installed directory. +XOTCL_STUB_LIB_SPEC='@XOTCL_STUB_LIB_SPEC@' + +# Name of the xotcl stub library with full path in build and install directory +XOTCL_BUILD_STUB_LIB_PATH='@XOTCL_BUILD_STUB_LIB_PATH@' +XOTCL_STUB_LIB_PATH='@XOTCL_STUB_LIB_PATH@' + +# Location of the top-level source directories from which XOTcl +# was built. This is the directory that contains generic, unix, etc. +# If XOTcl was compiled in a different place than the directory +# containing the source files, this points to the location of the sources, +# not the location where XOTcl was compiled. +XOTCL_SRC_DIR='@XOTCL_SRC_DIR@' + +# shared and unshared library suffix +XOTCL_SHARED_LIB_SUFFIX=@SHARED_LIB_SUFFIX@ +XOTCL_UNSHARED_LIB_SUFFIX=@UNSHARED_LIB_SUFFIX@ +