You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by mx...@apache.org on 2011/12/05 02:07:52 UTC

svn commit: r1210302 - in /tcl/rivet/branches/rivet-namespace: ChangeLog configure.ac rivet/init.tcl src/apache-2/mod_rivet.c

Author: mxmanghi
Date: Mon Dec  5 01:07:52 2011
New Revision: 1210302

URL: http://svn.apache.org/viewvc?rev=1210302&view=rev
Log:
2011-12-05 Massimo Manghi <mx...@apache.org>
    * src/apache-2/mod_rivet.c: child init sets also the array module_conf to signal the
    compilation flags --enable-rivet-commands-export and --enable-import-namespace-commands
    for the benefit of init.tcl
    * configure.ac: new macro created to handle --enable-rivet-commands-export and 
    --enable-import-namespace-commands
    * rivet/init.tcl: module_conf signals when commands have to be exported from ::rivet
    and when they have to be implicitly imported into the global namespace for compatibility
    with previous versions of Rivet.


Modified:
    tcl/rivet/branches/rivet-namespace/ChangeLog
    tcl/rivet/branches/rivet-namespace/configure.ac
    tcl/rivet/branches/rivet-namespace/rivet/init.tcl
    tcl/rivet/branches/rivet-namespace/src/apache-2/mod_rivet.c

Modified: tcl/rivet/branches/rivet-namespace/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/rivet-namespace/ChangeLog?rev=1210302&r1=1210301&r2=1210302&view=diff
==============================================================================
--- tcl/rivet/branches/rivet-namespace/ChangeLog (original)
+++ tcl/rivet/branches/rivet-namespace/ChangeLog Mon Dec  5 01:07:52 2011
@@ -1,3 +1,13 @@
+2011-12-05 Massimo Manghi <mx...@apache.org>
+    * src/apache-2/mod_rivet.c: child init sets also the array module_conf to signal the
+    compilation flags --enable-rivet-commands-export and --enable-import-namespace-commands
+    for the benefit of init.tcl
+    * configure.ac: new macro created to handle --enable-rivet-commands-export and 
+    --enable-import-namespace-commands
+    * rivet/init.tcl: module_conf signals when commands have to be exported from ::rivet
+    and when they have to be implicitly imported into the global namespace for compatibility
+    with previous versions of Rivet.
+
 2011-11-21 Massimo Manghi <mx...@apache.org>
     * doc/xml/directives.xml,doc/xml/commands.xml: removed note about 'rivetlib' package
     no more needed. Notes about ServerInitScript not having effect when virtual hosts

Modified: tcl/rivet/branches/rivet-namespace/configure.ac
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/rivet-namespace/configure.ac?rev=1210302&r1=1210301&r2=1210302&view=diff
==============================================================================
--- tcl/rivet/branches/rivet-namespace/configure.ac (original)
+++ tcl/rivet/branches/rivet-namespace/configure.ac Mon Dec  5 01:07:52 2011
@@ -524,6 +524,30 @@ AC_DEFUN([RIVET_COMMANDS_EXPORT],[
     fi
 ])
 
+# IMPORT_RIVET_COMMANDS (--enable-import-rivet-commands).
+# For compatibility the module can be compiled and installed forcing rivet
+# to import commands from ::rivet into the global namespace.
+# Default: yes
+
+AC_DEFUN([IMPORT_RIVET_COMMANDS],[
+    AC_ARG_ENABLE(
+        import-rivet-commands,
+        [ --disable-import-rivet-commands requires explicit namespace import if required],
+        [ import_rivet_commands=$enable_import_rivet_commands],
+        [ import_rivet_commands="yes"]
+    )
+
+    AC_MSG_CHECKING(if ::rivet namespace will be automatically imported for compatibility)
+    if test "$import_rivet_commands" = "yes"; then
+        AC_MSG_RESULT([yes])
+        AC_DEFINE(NAMESPACE_IMPORT,1,[commands will be imported into the global namespace])
+    else
+        AC_MSG_RESULT([no])
+        AC_DEFINE(NAMESPACE_IMPORT,0,[good, no automatic import will be done])
+    fi
+])
+
+
 # SEPARATE_VIRTUAL_INTERPS (--enable-virtual-interps-separation)
 # Virtual hosts get their own interpreter and configuration. Different
 # applications running on different virtual hosts don't mix up variables
@@ -604,7 +628,14 @@ HONOR_HEAD_REQUESTS
 VIRTUAL_INTERPS_SEPARATION
 POST_MAX_SIZE
 UPLOAD_TO_VAR
-RIVET_COMMANDS_EXPORT
+IMPORT_RIVET_COMMANDS
+if test $import_rivet_commands = "yes"; then
+    AC_MSG_NOTICE([forcing Rivet to export commands from ::rivet namespace])
+    AC_DEFINE(NAMESPACE_EXPORT,1,[commands will be exported])
+else
+    RIVET_COMMANDS_EXPORT
+fi
+
 AC_SUBST(apache_version_dir)
 AC_SUBST(MOD_RIVET_INCLUDES)
 

Modified: tcl/rivet/branches/rivet-namespace/rivet/init.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/rivet-namespace/rivet/init.tcl?rev=1210302&r1=1210301&r2=1210302&view=diff
==============================================================================
--- tcl/rivet/branches/rivet-namespace/rivet/init.tcl (original)
+++ tcl/rivet/branches/rivet-namespace/rivet/init.tcl Mon Dec  5 01:07:52 2011
@@ -132,13 +132,15 @@ namespace eval ::Rivet {
         ## 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 ::rivet::export_namespace_commands] && $::rivet::export_namespace_commands} {
+            if {[info exists module_conf(export_namespace_commands)] && \
+                 $module_conf(export_namespace_commands)} {
+
                 apache_log_error debug "exporting ::rivet commands"
-                eval namespace export $::rivet::export_list
+                eval namespace export $export_list
+
             } else {
                 apache_log_error debug "::rivet commands won't be exported"
             }
-
         }
         ## Add the packages directory to the auto_path.
         ## If we have a packages$tcl_version directory
@@ -188,4 +190,7 @@ interp alias {} ::incr0 {} incr
 # to be loaded separately and in case a 'namespace import ::rivet::*'
 # reissued. 
 
-# namespace import -force ::rivet::*
+if {[info exists module_conf(import_rivet_commands)] && $module_conf(import_rivet_commands)} {
+    namespace import -force ::rivet::*
+}
+

Modified: tcl/rivet/branches/rivet-namespace/src/apache-2/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/rivet-namespace/src/apache-2/mod_rivet.c?rev=1210302&r1=1210301&r2=1210302&view=diff
==============================================================================
--- tcl/rivet/branches/rivet-namespace/src/apache-2/mod_rivet.c (original)
+++ tcl/rivet/branches/rivet-namespace/src/apache-2/mod_rivet.c Mon Dec  5 01:07:52 2011
@@ -942,17 +942,18 @@ Rivet_PerInterpInit(server_rec *s, rivet
      */
 
     /*  If rivet was configured to export the ::rivet namespace commands we have to
-     *  set the variable ::rivet::export_namespace_commands before calling init.tcl
+     *  set the array variable ::rivet::module_conf(export_namespace_commands) before calling init.tcl
      *  This variable will be unset after commands are exported.
      */
 
-    Tcl_SetVar2Ex(interp,RIVET_NS"::export_namespace_commands",NULL,Tcl_NewIntObj(RIVET_NAMESPACE_EXPORT),0);
+    Tcl_SetVar2Ex(interp,"module_conf","export_namespace_commands",Tcl_NewIntObj(RIVET_NAMESPACE_EXPORT),0);
+    Tcl_SetVar2Ex(interp,"module_conf","import_rivet_commands",Tcl_NewIntObj(RIVET_NAMESPACE_IMPORT),0);
 
     if (Tcl_PkgRequire(interp, "RivetTcl", "2.1", 1) == NULL)
     {
-        ap_log_error( APLOG_MARK, APLOG_ERR, APR_EGENERAL, s,
-                "init.tcl must be installed correctly for Apache Rivet to function: %s (%s)",
-                Tcl_GetStringResult(interp), RIVET_DIR );
+        ap_log_error ( APLOG_MARK, APLOG_ERR, APR_EGENERAL, s,
+                        "init.tcl must be installed correctly for Apache Rivet to function: %s (%s)",
+                        Tcl_GetStringResult(interp), RIVET_DIR );
         exit(1);
     }
 



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