You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2014/06/22 12:23:00 UTC

svn commit: r1604559 - in /tcl/rivet/trunk: ChangeLog Makefile.in configure.ac rivet/init.tcl rivet/init.tcl.in src/Makefile.am src/apache-2/TclWebapache.c src/apache-2/mod_rivet.c

Author: mxmanghi
Date: Sun Jun 22 10:23:00 2014
New Revision: 1604559

URL: http://svn.apache.org/r1604559
Log:
* configure.ac: new macros MOD_RIVET_CORE and RIVET_CHANNEL. Macro APACHE_VERSION preserved but not called anymore 
* rivet/init.tcl.in: Add template for rivet/init.tcl
* src/Makefile.am: building mod_rivet with code entirely selected by autoconf defined symbols
* src/apache-2/mod_rivet.c: comments added. Rivet package version depends now on preprocessor
  symbol RIVET_TCL_PACKAGE_VERSION


Added:
    tcl/rivet/trunk/rivet/init.tcl.in
Modified:
    tcl/rivet/trunk/ChangeLog
    tcl/rivet/trunk/Makefile.in
    tcl/rivet/trunk/configure.ac
    tcl/rivet/trunk/rivet/init.tcl
    tcl/rivet/trunk/src/Makefile.am
    tcl/rivet/trunk/src/apache-2/TclWebapache.c
    tcl/rivet/trunk/src/apache-2/mod_rivet.c

Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1604559&r1=1604558&r2=1604559&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Sun Jun 22 10:23:00 2014
@@ -1,3 +1,11 @@
+2014-06-22 Massimo Manghi <mx...@apache.org>
+    * configure.ac: new macros MOD_RIVET_CORE and RIVET_CHANNEL. Macro APACHE_VERSION preserved but not 
+    called anymore
+    * rivet/init.tcl.in: Add template for rivet/init.tcl
+    * src/Makefile.am: building mod_rivet with code entirely selected by autoconf defined symbols
+    * src/apache-2/mod_rivet.c: comments added. Rivet package version depends now on preprocessor
+     symbol RIVET_TCL_PACKAGE_VERSION
+
 2014-06-10 Massimo Manghi <mx...@apache.org>
     * tests/rivet.test: removed lang.test as it was testing just a tautology
 

Modified: tcl/rivet/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/Makefile.in?rev=1604559&r1=1604558&r2=1604559&view=diff
==============================================================================
--- tcl/rivet/trunk/Makefile.in (original)
+++ tcl/rivet/trunk/Makefile.in Sun Jun 22 10:23:00 2014
@@ -90,11 +90,11 @@ host_triplet = @host@
 subdir = .
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/configure $(am__configure_deps) \
-	$(srcdir)/config.h.in ChangeLog tclconfig/ChangeLog INSTALL \
-	README TODO tclconfig/compile tclconfig/config.guess \
-	tclconfig/config.sub tclconfig/depcomp tclconfig/install-sh \
-	tclconfig/missing tclconfig/ltmain.sh \
-	$(top_srcdir)/tclconfig/compile \
+	$(srcdir)/config.h.in $(top_srcdir)/rivet/init.tcl.in \
+	ChangeLog tclconfig/ChangeLog INSTALL README TODO \
+	tclconfig/compile tclconfig/config.guess tclconfig/config.sub \
+	tclconfig/depcomp tclconfig/install-sh tclconfig/missing \
+	tclconfig/ltmain.sh $(top_srcdir)/tclconfig/compile \
 	$(top_srcdir)/tclconfig/config.guess \
 	$(top_srcdir)/tclconfig/config.sub \
 	$(top_srcdir)/tclconfig/install-sh \
@@ -112,7 +112,7 @@ am__CONFIG_DISTCLEAN_FILES = config.stat
  configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = rivet/init.tcl
 CONFIG_CLEAN_VPATH_FILES =
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -391,6 +391,8 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+rivet_channel = @rivet_channel@
+rivet_core = @rivet_core@
 rivet_core_cmds = @rivet_core_cmds@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
@@ -464,6 +466,8 @@ $(srcdir)/config.h.in:  $(am__configure_
 
 distclean-hdr:
 	-rm -f config.h stamp-h1
+rivet/init.tcl: $(top_builddir)/config.status $(top_srcdir)/rivet/init.tcl.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
 
 mostlyclean-libtool:
 	-rm -f *.lo

Modified: tcl/rivet/trunk/configure.ac
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/configure.ac?rev=1604559&r1=1604558&r2=1604559&view=diff
==============================================================================
--- tcl/rivet/trunk/configure.ac (original)
+++ tcl/rivet/trunk/configure.ac Sun Jun 22 10:23:00 2014
@@ -422,6 +422,24 @@ AC_DEFUN([APACHE_VERSION],[
     MOD_RIVET_INCLUDES="-I${apache_version_dir}"
 ])
 
+# MOD_RIVET_CORE
+#
+
+AC_DEFUN([MOD_RIVET_CORE],[
+    AC_ARG_WITH(
+       rivet_core,
+       [ --with-rivet-core[=path] mod_rivet core directory],,
+       [with_rivet_core="apache-2"]
+    )
+
+    rivet_core=${with_rivet_core}
+    AC_MSG_CHECKING(mod_rivet core)
+    AC_SUBST(rivet_core)
+    AC_MSG_RESULT([$with_rivet_core])
+])
+
+# 
+
 AC_DEFUN([HANDLE_TCL_PACKAGE_PATH],[
     # shamelessly stolen from TEA_LOAD_TCLCONFIG
     AC_MSG_CHECKING([Debian TCL_PACKAGE_PATH workaround])
@@ -483,6 +501,23 @@ AC_DEFUN([RIVET_CORE_CMDS],[
 
 ])
 
+# RIVET_CHANNEL
+#
+# selecting the Rivet channel code directory
+
+AC_DEFUN([RIVET_CHANNEL],[
+    AC_ARG_WITH(
+        rivet_channel,
+        [ --with-rivet-channel=DIR Rivet channel code path ],,
+        [with_rivet_channel="channel"]
+    )
+
+    AC_MSG_CHECKING(for Rivet channel code path)
+    rivet_channel=${with_rivet_channel}
+    AC_SUBST(rivet_channel)
+    AC_MSG_RESULT([$with_rivet_channel])
+])
+
 
 AC_DEFUN([RIVET_TCL_LIB],[
     AC_ARG_WITH(
@@ -685,7 +720,8 @@ AC_DEFUN([UPLOAD_TO_VAR],[
 
 ])
 
-APACHE_VERSION
+#APACHE_VERSION
+MOD_RIVET_CORE
 GET_RIVET_BASE
 APACHE
 CHECK_APXS
@@ -701,6 +737,16 @@ UPLOAD_TO_VAR
 IMPORT_RIVET_COMMANDS
 APACHE_REQUEST
 RIVET_CORE_CMDS
+RIVET_CHANNEL
+
+# Let's separate the point version from the major and minor version
+# to build a Rivet version to be substituted as basic version for 
+# package Rivet, central initialization of the Tcl environment
+
+VERSION=${PACKAGE_VERSION}
+AX_SPLIT_VERSION
+AC_DEFINE_UNQUOTED(TCL_PACKAGE_VERSION,"${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}",[Rivet Tcl package version])
+AC_MSG_NOTICE([Rivet package version is ${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}])
 
 if test $import_rivet_commands = "yes"; then
     AC_MSG_NOTICE([forcing Rivet to export commands from ::rivet namespace])
@@ -728,7 +774,7 @@ AC_SUBST(TCL_PACKAGE_PATH)
 # You may alternatively have a special pkgIndex.tcl.in or other files
 # which require substituting the AC variables in.  Include these here.
 #--------------------------------------------------------------------
-AC_CONFIG_FILES([Makefile src/Makefile src/librivet/Makefile src/parser/Makefile doc/Makefile doc/convert_examples.tcl])
+AC_CONFIG_FILES([Makefile src/Makefile rivet/init.tcl src/parser/Makefile doc/Makefile doc/convert_examples.tcl])
 
 #case $apache_version_dir in
 #    apache-1) AC_CONFIG_FILES([Makefile src/Makefile src/apache-1/Makefile doc/Makefile]) ;;
@@ -737,7 +783,7 @@ AC_CONFIG_FILES([Makefile src/Makefile s
 AC_OUTPUT
 
 if test "$print_fileevent_msg" = "1"; then
-    AC_MSG_NOTICE([=======================================================================])
+    AC_MSG_NOTICE([========================================================================])
     AC_MSG_NOTICE([                             WARNING!])
     AC_MSG_NOTICE([========================================================================])
     AC_MSG_NOTICE([The Tcl notifier (and consequently the event loop) does not work with])

Modified: tcl/rivet/trunk/rivet/init.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/init.tcl?rev=1604559&r1=1604558&r2=1604559&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/init.tcl (original)
+++ tcl/rivet/trunk/rivet/init.tcl Sun Jun 22 10:23:00 2014
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-package provide Rivet 2.1
+package provide Rivet 2.2
 
 namespace eval ::Rivet {
 

Added: tcl/rivet/trunk/rivet/init.tcl.in
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/init.tcl.in?rev=1604559&view=auto
==============================================================================
--- tcl/rivet/trunk/rivet/init.tcl.in (added)
+++ tcl/rivet/trunk/rivet/init.tcl.in Sun Jun 22 10:23:00 2014
@@ -0,0 +1,194 @@
+# Copyright 2002-2004 The Apache Software Foundation
+
+# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+package provide Rivet 2.2
+
+namespace eval ::Rivet {
+
+    ###
+    ## export_tcl_commands --
+    ## this is temporary hack to export names of Tcl commands in rivet-tcl/.
+    ## This function will be removed in future versions of Rivet and it's
+    ## meant to provide a basic way to guarantee compatibility with older
+    ## versions of Rivet (see code in ::Rivet::init)
+    ##
+
+    proc tcl_commands_export_list {tclpath} {
+
+        # we collect the commands in rivet-tcl by reading the tclIndex
+        # file and then we extract the command list from auto_index
+
+        namespace eval ::rivet_temp { }
+        set ::rivet_temp::tclpath $tclpath
+
+        namespace eval ::rivet_temp {
+            variable auto_index
+            array set auto_index {}
+
+            # the auto_index in ${tclpath}/tclIndex is loaded
+            
+            set dir $tclpath
+            source [file join $tclpath tclIndex]
+        }
+        
+        set command_list [namespace eval ::rivet_temp {array names auto_index}]
+
+        # commands in 'command_list' are prefixed with ::rivet, so we have to
+        # remove it to build an export list 
+        
+        set export_list {}
+        foreach c $command_list {
+            if {[regexp {::rivet::(.*)} $c m cmd]} {
+                lappend export_list $cmd
+#               namespace eval ::rivet [list namespace export $cmd]
+            }
+        }
+
+        # we won't left anything behind
+        namespace delete ::rivet_temp
+
+        return $export_list
+    }
+
+    ###
+    ## This routine gets called each time a new request comes in.
+    ## It sets up the request namespace and creates a global command
+    ## to replace the default global.  This ensures that when a user
+    ## uses global variables, they're actually contained within the
+    ## namespace.  So, everything gets deleted when the request is finished.
+    ###
+    proc initialize_request {} {
+        catch { namespace delete ::request }
+
+        namespace eval ::request { }
+
+        proc ::request::global {args} {
+            foreach arg $args {
+                uplevel "::global ::request::$arg"
+            }
+        }
+    }
+
+    ###
+    ## The default error handler for Rivet.  Any time a page runs into an
+    ## error, this routine will be called to handle the error information.
+    ## If an ErrorScript has been specified, this routine will not be called.
+    ###
+    proc handle_error {} {
+        global errorInfo
+        global errorOutbuf
+
+        puts <PRE>
+        puts "<HR>$errorInfo<HR>"
+        puts "<P><B>OUTPUT BUFFER:</B></P>"
+        puts $errorOutbuf
+        puts </PRE>
+    }
+
+    ###
+    ## This routine gets called each time a request is finished.  Any kind
+    ## of special cleanup can be placed here.
+    ###
+    proc cleanup_request {} {
+    }
+
+    ###
+    ## The main initialization procedure for Rivet.
+    ###
+    proc init {} {
+        global auto_path
+        global server
+
+        ## Add the rivet-tcl directory to Tcl's auto search path.
+        ## We insert it at the head of the list because we want any of
+        ## our procs named the same as Tcl's procs to be overridden.
+        ## Example: parray
+        set tclpath [file join [file dirname [info script]] rivet-tcl]
+        set auto_path [linsert $auto_path 0 $tclpath]
+
+        ## As we moved the commands set to ::rivet namespace we
+        ## we want to guarantee the commands are still accessible
+        ## at global level by putting them on the export list.
+        ## Importing the ::rivet namespace is deprecated and we should
+        ## make it clear in the manual
+
+        ## we keep in ::rivet::export_list a list of importable commands
+
+        namespace eval ::rivet [list set export_list [tcl_commands_export_list $tclpath]]
+        namespace eval ::rivet {
+
+        ## init.tcl is run by mod_rivet (which creates the ::rivet namespace) but it gets run
+        ## standalone by mkPkgindex during the installation phase. We have to make sure the
+        ## procedure won't fail in this case, so we check for the existence of the variable.
+
+            if {[info exists module_conf(export_namespace_commands)] && \
+                 $module_conf(export_namespace_commands)} {
+
+                eval namespace export $export_list
+
+            } 
+        }
+        ## Add the packages directory to the auto_path.
+        ## If we have a packages$tcl_version directory
+        ## (IE: packages8.3, packages8.4) append that as well.
+
+        ## The packages directory come right after the rivet-tcl directory.
+        set pkgpath [file join [file dirname [info script]] packages]
+        set auto_path [linsert $auto_path 1 $pkgpath]
+        set auto_path [linsert $auto_path 2 ${pkgpath}-local]
+
+        if { [file exists ${pkgpath}$::tcl_version] } {
+            lappend auto_path ${pkgpath}$::tcl_version
+        }
+
+        ## Likewise we have also to add to auto_path the directory containing 
+        ## this script since it holds the pkgIndex.tcl file for package Rivet. 
+
+        set auto_path [linsert $auto_path 0 [file dirname [info script]]]
+
+        ## This will allow users to create proc libraries and tclIndex files
+        ## in the local directory that can be autoloaded.
+        ## Perhaps this must go to the front of the list to allow the user
+        ## to override even Rivet's procs.
+        lappend auto_path .
+    }
+
+} ;## namespace eval ::Rivet
+
+
+## Rivet 2.1.x supports Tcl >= 8.5, therefore there's no more need for
+## the command incr0, as the functionality of creating a not yet
+## existing variable is now provided by 'incr'. Being incr0 a command
+## in Rivet < 2.1.0, before the move into the ::Rivet namespace, 
+## we alias this command only in the global namespace
+
+interp alias {} ::incr0 {} incr
+
+## Initialize Rivet.
+::Rivet::init
+
+## And now we get to the import of the whole ::rivet namespace. 
+## Some commands (namely lassign) replace the native lassign command
+## so we have to  use the -force switch
+
+# Do we actually want to import everything? If Rivet was configured
+# to import the ::rivet namespace for compatibility we do it right away.
+# This option is not guaranteed to be supported in future versions.
+
+if {[info exists module_conf(import_rivet_commands)] && $module_conf(import_rivet_commands)} {
+    namespace eval :: { namespace import -force ::rivet::* }
+}
+
+array unset module_conf
+

Modified: tcl/rivet/trunk/src/Makefile.am
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/Makefile.am?rev=1604559&r1=1604558&r2=1604559&view=diff
==============================================================================
--- tcl/rivet/trunk/src/Makefile.am (original)
+++ tcl/rivet/trunk/src/Makefile.am Sun Jun 22 10:23:00 2014
@@ -25,7 +25,7 @@ lib_libexec_LTLIBRARIES = librivetparser
 librivetparser_la_SOURCES = parser/rivetParser.c parser/parserPkgInit.c
 librivetparser_la_LDFLAGS = @TCL_STUB_LIB_SPEC@ @APXS_LDFLAGS@ -module -avoid-version
 librivetparser_la_LIBADD  = @APXS_LIBS@
-librivetparser_la_CPPFLAGS = @apache_include@ -I@apache_version_dir@  @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ -DSTART_TAG='"<?"' -DEND_TAG='"?>"' -DUSE_TCL_STUBS
+librivetparser_la_CPPFLAGS = @apache_include@ -I@rivet_core@ @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ -DSTART_TAG='"<?"' -DEND_TAG='"?>"' -DUSE_TCL_STUBS
 
 #
 # Rivet Library
@@ -33,7 +33,7 @@ librivetparser_la_CPPFLAGS = @apache_inc
 librivetlib_la_SOURCES = librivet/rivetList.c librivet/rivetCrypt.c librivet/rivetWWW.c librivet/rivetPkgInit.c
 librivetlib_la_LDFLAGS = @TCL_STUB_LIB_SPEC@ @APXS_LDFLAGS@ @APR_LDFLAGS@ -module -avoid-version
 librivetlib_la_LIBADD  = @APXS_LIBS@
-librivetlib_la_CPPFLAGS = -I@apache_version_dir@ -I@apache_request@ @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ @APR_INCLUDES@ @APR_CPPFLAGS@ -DSTART_TAG='"<?"' -DEND_TAG='"?>"' -DUSE_TCL_STUBS 
+librivetlib_la_CPPFLAGS = -I@rivet_core@ -I@apache_request@ @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ @APR_INCLUDES@ @APR_CPPFLAGS@ -DSTART_TAG='"<?"' -DEND_TAG='"?>"' -DUSE_TCL_STUBS 
 
 #
 # mod_rivet
@@ -43,18 +43,16 @@ apxs_libexec_LTLIBRARIES = mod_rivet.la
 
 mod_rivet_la_LDFLAGS = @TCL_LIB_SPEC@ @APXS_LDFLAGS@ @APR_LDFLAGS@ -module -avoid-version
 mod_rivet_la_LIBADD = @TCL_LIBS@ @APXS_LIBS@ 
-mod_rivet_la_CPPFLAGS = -I@apache_version_dir@ -Ichannel -Iparser -I@apache_request@  @apache_include@ -I@RIVET_BASE_INCLUDE@ @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ @APR_CPPFLAGS@ @APR_INCLUDES@ -DSTART_TAG='"<?"' -DEND_TAG='"?>"'
+mod_rivet_la_CPPFLAGS = -I@rivet_core@ -I@rivet_channel@ -Iparser -I@apache_request@  @apache_include@ -I@RIVET_BASE_INCLUDE@ @TCL_INCLUDES@ @APXS_CPPFLAGS@ @APXS_INCLUDES@ @APR_CPPFLAGS@ @APR_INCLUDES@ -DSTART_TAG='"<?"' -DEND_TAG='"?>"'
 
-
-mod_rivet_la_SOURCES =  		                                        \
-                        @apache_request@/apache_multipart_buffer.c 	    \
-                        @apache_request@/apache_request.c			    \
-                        @apache_version_dir@/mod_rivet.c 				\
-                        @apache_version_dir@/TclWebapache.c 			\
-                        @apache_version_dir@/apache_config.c            \
-                        @rivet_core_cmds@/rivetCore.c				    \
+mod_rivet_la_SOURCES =  @apache_request@/apache_multipart_buffer.c 	    \
+                        @apache_request@/apache_request.c               \
+                        @rivet_core@/mod_rivet.c                        \
+                        @rivet_core@/TclWebapache.c                     \
+                        @rivet_core@/apache_config.c                    \
+                        @rivet_core_cmds@/rivetCore.c                   \
                         @rivet_core_cmds@/rivetInspect.c                \
-                        channel/rivetChannel.c 			                \
+                        @rivet_channel@/rivetChannel.c                  \
                         parser/rivetParser.c
 
 # Removing libtool .la files from installation

Modified: tcl/rivet/trunk/src/apache-2/TclWebapache.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/apache-2/TclWebapache.c?rev=1604559&r1=1604558&r2=1604559&view=diff
==============================================================================
--- tcl/rivet/trunk/src/apache-2/TclWebapache.c (original)
+++ tcl/rivet/trunk/src/apache-2/TclWebapache.c Sun Jun 22 10:23:00 2014
@@ -130,7 +130,7 @@ int
 TclWeb_SetHeaderType(char *header, TclWebRequest *req)
 {
     
-    if(req->headers_set)
+    if (req->headers_set)
         return TCL_ERROR;
 
 //    req->req->content_type = (char *) apr_pstrdup(req->req->pool, header);

Modified: tcl/rivet/trunk/src/apache-2/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/apache-2/mod_rivet.c?rev=1604559&r1=1604558&r2=1604559&view=diff
==============================================================================
--- tcl/rivet/trunk/src/apache-2/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/apache-2/mod_rivet.c Sun Jun 22 10:23:00 2014
@@ -176,8 +176,8 @@ Rivet_CheckType (request_rec *req)
  *
  *  Arguments:
  *
- *      Tcl_Interp*: pointer to the Tcl interpreter
- *      apr_pool_t*: pool used for calling Apache framework functions
+ *      Tcl_Interp* interp: pointer to the Tcl interpreter
+ *      apr_pool_t* pool: pool used for calling Apache framework functions
  *
  * Returned value:
  *      none
@@ -290,18 +290,40 @@ Rivet_InitServerVariables( Tcl_Interp *i
     }
 }
 
-
-/* Calls Tcl_EvalObjEx() and checks for errors
- * Prints the error buffer if any.
+/* -- Rivet_ExecuteAndCheck
+ * 
+ * Tcl script execution central procedure. The script stored
+ * outbuf is evaluated and in case an error occurs in the execution
+ * an error handler is executed. In case the error code returned
+ * is RIVET then the error was caused by the invocation of a 
+ * abort_page command and the script stored in conf->abort_script
+ * is run istead. The default error script prints the error buffer
+ *
+ *   Arguments:
+ * 
+ *      - Tcl_Interp* interp:      the Tcl interpreter 
+ *      - Tcl_Obj* tcl_script_obj: a pointer to the Tcl_Obj holding the script
+ *      - request_rec* req:        the current request_rec object pointer
+ *
+ *   Returned value:
+ *
+ *      - invariably TCL_OK
+ *
+ *   Side effects:
+ *
+ *      The Tcl interpreter internal status is changed by the execution
+ *      of the script
+ *
  */
+
 static int
-Rivet_ExecuteAndCheck(Tcl_Interp *interp, Tcl_Obj *outbuf, request_rec *req)
+Rivet_ExecuteAndCheck(Tcl_Interp *interp, Tcl_Obj *tcl_script_obj, request_rec *req)
 {
     rivet_server_conf *conf = Rivet_GetConf(req);
     rivet_interp_globals *globals = Tcl_GetAssocData(interp, "rivet", NULL);
 
     Tcl_Preserve (interp);
-    if ( Tcl_EvalObjEx(interp, outbuf, 0) == TCL_ERROR ) {
+    if ( Tcl_EvalObjEx(interp, tcl_script_obj, 0) == TCL_ERROR ) {
         Tcl_Obj *errscript;
         Tcl_Obj *errorCodeListObj;
         Tcl_Obj *errorCodeElementObj;
@@ -352,7 +374,7 @@ Rivet_ExecuteAndCheck(Tcl_Interp *interp
             }
         }
 
-        Tcl_SetVar( interp, "errorOutbuf",Tcl_GetStringFromObj( outbuf, NULL ),TCL_GLOBAL_ONLY );
+        Tcl_SetVar( interp, "errorOutbuf",Tcl_GetStringFromObj( tcl_script_obj, NULL ),TCL_GLOBAL_ONLY );
 
         /* If we don't have an error script, use the default error handler. */
         if (conf->rivet_error_script ) {
@@ -406,13 +428,12 @@ good:
  *
  * Arguments:
  *
- *   - TclWebRequest: pointer to the structure collecting Tcl and Apache
- *   data
- *   - filename: pointer to a string storing the path to the template or
- *   Tcl script
- *   - toplevel: integer to be interpreted as a boolean meaning the
- *   file is pointed by the request. When 0 that's a subtemplate being 
- *   parsed and executed from another template
+ *   - TclWebRequest: pointer to the structure collecting Tcl and Apache data
+ *   - filename:      pointer to a string storing the path to the template or
+ *                    Tcl script
+ *   - toplevel:      integer to be interpreted as a boolean meaning the
+ *                    file is pointed by the request. When 0 that's a subtemplate
+ *                    to be parsed and executed from another template
  */
 
 int
@@ -693,15 +714,14 @@ Rivet_PerInterpInit(server_rec *s, rivet
     Tcl_Preserve (interp);
 
     /* Create TCL commands to deal with Apache's BUFFs. */
-    rsc->outchannel = apr_pcalloc(p, sizeof(Tcl_Channel));
+    rsc->outchannel = apr_pcalloc (p, sizeof(Tcl_Channel));
     *(rsc->outchannel) = Tcl_CreateChannel(&RivetChan, "apacheout", rsc, TCL_WRITABLE);
-
-    Tcl_SetStdChannel(*(rsc->outchannel), TCL_STDOUT);
+    Tcl_SetStdChannel (*(rsc->outchannel), TCL_STDOUT);
 
     /* Set up interpreter associated data */
 
-    globals = apr_pcalloc(p, sizeof(rivet_interp_globals));
-    Tcl_SetAssocData(interp,"rivet",NULL,globals);
+    globals = apr_pcalloc (p, sizeof(rivet_interp_globals));
+    Tcl_SetAssocData (interp,"rivet",NULL,globals);
     
     /* 
      * abort_page status variables in globals are set here and then 
@@ -744,7 +764,7 @@ Rivet_PerInterpInit(server_rec *s, rivet
     Rivet_InitServerVariables(interp, p );
 //  Rivet_PropagateServerConfArray( interp, rsc );
 
-    /* Loading into the interpreter the commands provided by librivet.so */
+    /* Loading into the interpreter commands in librivet.so */
     /* Tcl Bug #3216070 has been solved with 8.5.10 and commands shipped with
      * Rivetlib can be mapped at this stage
      */
@@ -769,9 +789,13 @@ Rivet_PerInterpInit(server_rec *s, rivet
 
     /* Watch out! Calling Tcl_PkgRequire with a version number binds this module to
      * the Rivet package revision number in rivet/init.tcl
+     *
+     * RIVET_TCL_PACKAGE_VERSION is defined by configure.ac as the combination
+     * "MAJOR_VERSION.MINOR_VERSION". We don't expect to change rivet/init.tcl
+     * across patchlevel releases
      */
 
-    if (Tcl_PkgRequire(interp, "Rivet", "2.1", 1) == NULL)
+    if (Tcl_PkgRequire(interp, "Rivet", RIVET_TCL_PACKAGE_VERSION, 1) == NULL)
     {
         ap_log_error (APLOG_MARK, APLOG_ERR, APR_EGENERAL, s,
                       MODNAME ": init.tcl must be installed correctly for Apache Rivet to function: %s (%s)",
@@ -779,8 +803,6 @@ Rivet_PerInterpInit(server_rec *s, rivet
         exit(1);
     }
 
-    /* */
-
     /* Set the output buffer size to the largest allowed value, so that we 
      * won't send any result packets to the browser unless the Rivet
      * programmer does a "flush stdout" or the page is completed.
@@ -862,7 +884,7 @@ Rivet_Panic TCL_VARARGS_DEF(CONST char *
     char *format;
 
     format = (char *) TCL_VARARGS_START(char *,arg1,argList);
-    buf = (char *) apr_pvsprintf(rivet_panic_pool, format, argList);
+    buf    = (char *) apr_pvsprintf(rivet_panic_pool, format, argList);
 
     if (rivet_panic_request_rec != NULL) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EGENERAL, 
@@ -883,8 +905,10 @@ Rivet_Panic TCL_VARARGS_DEF(CONST char *
  *
  * Arguments:
  *  server_rec* s: pointer to a server_rec structure
+ *
  * Results:
  *  pointer to a Tcl_Interp structure
+ * 
  * Side Effects:
  *
  *-----------------------------------------------------------------------------
@@ -1470,16 +1494,14 @@ rivet_register_hooks (apr_pool_t *p)
     ap_hook_child_init (Rivet_ChildInit, NULL, NULL, APR_HOOK_LAST);
 }
 
+/* mod_rivet basic structures */
 
 const command_rec rivet_cmds[] =
 {
-    AP_INIT_TAKE2("RivetServerConf", Rivet_ServerConf,
-            NULL, RSRC_CONF, NULL),
-    AP_INIT_TAKE2("RivetDirConf", Rivet_DirConf,
-            NULL, ACCESS_CONF, NULL),
-    AP_INIT_TAKE2("RivetUserConf", Rivet_UserConf, 
-            NULL, ACCESS_CONF|OR_FILEINFO,
-            "RivetUserConf key value: sets RivetUserConf(key) = value"),
+    AP_INIT_TAKE2 ("RivetServerConf", Rivet_ServerConf, NULL, RSRC_CONF, NULL),
+    AP_INIT_TAKE2 ("RivetDirConf", Rivet_DirConf, NULL, ACCESS_CONF, NULL),
+    AP_INIT_TAKE2 ("RivetUserConf", Rivet_UserConf, NULL, ACCESS_CONF|OR_FILEINFO,
+                   "RivetUserConf key value: sets RivetUserConf(key) = value"),
     {NULL}
 };
 



---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org