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 2015/07/27 16:31:39 UTC

svn commit: r1692889 - in /tcl/rivet/branches/2.2: ChangeLog Makefile.in src/apache-2/mod_rivet.c

Author: mxmanghi
Date: Mon Jul 27 14:31:38 2015
New Revision: 1692889

URL: http://svn.apache.org/r1692889
Log:
    * src/apache-2/mod_rivet.c: add more comments, improved code 
    readability in Rivet_CreateTclInterp


Modified:
    tcl/rivet/branches/2.2/ChangeLog
    tcl/rivet/branches/2.2/Makefile.in
    tcl/rivet/branches/2.2/src/apache-2/mod_rivet.c

Modified: tcl/rivet/branches/2.2/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/ChangeLog?rev=1692889&r1=1692888&r2=1692889&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/ChangeLog (original)
+++ tcl/rivet/branches/2.2/ChangeLog Mon Jul 27 14:31:38 2015
@@ -1,3 +1,7 @@
+2015-07-27 Massimo Manghi <mx...@apache.org>
+    * src/apache-2/mod_rivet.c: add more comments, improved code 
+    readability in Rivet_CreateTclInterp
+
 2015-06-21 Massimo Manghi <mx...@apache.org>
     * configure.ac: changing version to 2.2.4, definition of config.h
     variable RIVET_CONFIGURE_CMD carring the configure full command that

Modified: tcl/rivet/branches/2.2/Makefile.in
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/Makefile.in?rev=1692889&r1=1692888&r2=1692889&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/Makefile.in (original)
+++ tcl/rivet/branches/2.2/Makefile.in Mon Jul 27 14:31:38 2015
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -24,7 +24,17 @@
 #             before invoking pkg_mkIndex.
 # 2013/01/20: removing libtool created .la files
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -88,18 +98,6 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 subdir = .
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/configure $(am__configure_deps) \
-	$(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 \
-	$(top_srcdir)/tclconfig/ltmain.sh \
-	$(top_srcdir)/tclconfig/missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/ax_split_version.m4 \
@@ -109,6 +107,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a
 	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
+	$(am__configure_deps) $(am__DIST_COMMON)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
@@ -172,6 +172,17 @@ ETAGS = etags
 CTAGS = ctags
 CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+	$(top_srcdir)/rivet/init.tcl.in \
+	$(top_srcdir)/tclconfig/compile \
+	$(top_srcdir)/tclconfig/config.guess \
+	$(top_srcdir)/tclconfig/config.sub \
+	$(top_srcdir)/tclconfig/install-sh \
+	$(top_srcdir)/tclconfig/ltmain.sh \
+	$(top_srcdir)/tclconfig/missing ChangeLog INSTALL README TODO \
+	tclconfig/ChangeLog tclconfig/compile tclconfig/config.guess \
+	tclconfig/config.sub tclconfig/depcomp tclconfig/install-sh \
+	tclconfig/ltmain.sh tclconfig/missing
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -436,7 +447,6 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -669,15 +679,15 @@ dist-xz: distdir
 	$(am__post_remove_distdir)
 
 dist-tarZ: distdir
-	@echo WARNING: "Support for shar distribution archives is" \
-	               "deprecated." >&2
+	@echo WARNING: "Support for distribution archives compressed with" \
+		       "legacy program 'compress' is deprecated." >&2
 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 	$(am__post_remove_distdir)
 
 dist-shar: distdir
-	@echo WARNING: "Support for distribution archives compressed with" \
-		       "legacy program 'compress' is deprecated." >&2
+	@echo WARNING: "Support for shar distribution archives is" \
+	               "deprecated." >&2
 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
 	$(am__post_remove_distdir)
@@ -713,17 +723,17 @@ distcheck: dist
 	esac
 	chmod -R a-w $(distdir)
 	chmod u+w $(distdir)
-	mkdir $(distdir)/_build $(distdir)/_inst
+	mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
 	chmod a-w $(distdir)
 	test -d $(distdir)/_build || exit 0; \
 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
 	  && am__cwd=`pwd` \
-	  && $(am__cd) $(distdir)/_build \
-	  && ../configure \
+	  && $(am__cd) $(distdir)/_build/sub \
+	  && ../../configure \
 	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
-	    --srcdir=.. --prefix="$$dc_install_base" \
+	    --srcdir=../.. --prefix="$$dc_install_base" \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
 	  && $(MAKE) $(AM_MAKEFLAGS) check \
@@ -901,6 +911,8 @@ uninstall-am: uninstall-local
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am uninstall-local
 
+.PRECIOUS: Makefile
+
 
 libtool: $(LIBTOOL_DEPS)
 	$(SHELL) ./config.status --recheck

Modified: tcl/rivet/branches/2.2/src/apache-2/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/src/apache-2/mod_rivet.c?rev=1692889&r1=1692888&r2=1692889&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/src/apache-2/mod_rivet.c (original)
+++ tcl/rivet/branches/2.2/src/apache-2/mod_rivet.c Mon Jul 27 14:31:38 2015
@@ -395,12 +395,12 @@ Rivet_ExecuteErrorHandler (Tcl_Interp* i
 
 /* -- 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
+ * Tcl script execution central procedure. The script stored in
+ * outbuf is evaluated and in case of errors an error handler is 
+ * executed. In case the error code is "RIVET" then the error was 
+ * caused by the invocation of ::rivet::abort_page and the script
+ * stored in conf->abort_script is run istead. 
+ * The default error handler prints the error buffer
  *
  *   Arguments:
  * 
@@ -513,10 +513,8 @@ Rivet_ExecuteAndCheck(Tcl_Interp *interp
 /*
  * -- Rivet_ParseExecFile
  *
- * given a filename if the file exists it's either parsed (when a rivet
- * template) and then executed as a Tcl_Obj instance or directly executed
- * if a Tcl script.
- *
+ * Given a filename the corresponding file is checked to exist.  
+ * If the file is a Rivet template its content gets parsed and then executed.
  * This is a separate function so that it may be called from command 'parse'
  * 
  * Returned value:
@@ -717,7 +715,8 @@ Rivet_ParseExecFile(TclWebRequest *req,
  * -- Rivet_ParseExecString
  *
  * This function accepts a Tcl_Obj carrying a string to be interpreted as
- * a Rivet template. This function is the core for command 'parsestr'
+ * a Rivet template. This function is the core for the form  
+ * '::rivet::parsestr -string $tclscript'
  * 
  * Arguments:
  *
@@ -816,6 +815,7 @@ Rivet_CleanupRequest( request_rec *r )
  *     a reference to it is stored in the rivet_server_conf record
  *-----------------------------------------------------------------------------
  */
+
 static void
 Rivet_CreateRivetChannel(Tcl_Interp* interp,rivet_server_conf* rsc, apr_pool_t* pPool)
 {
@@ -854,6 +854,7 @@ Rivet_CreateRivetChannel(Tcl_Interp* int
  *
  *-----------------------------------------------------------------------------
  */
+
 static void
 Rivet_PerInterpInit(server_rec *s, rivet_server_conf *rsc, apr_pool_t *p, int new_channel)
 {
@@ -970,6 +971,19 @@ Rivet_PerInterpInit(server_rec *s, rivet
     Tcl_Release(interp);
 }
 
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * -- Rivet_InitHandler: basic callback for mod_rivet initialization
+ *
+ * Arguments:
+ * 
+ *  The list of arguments is dictated by the Apache framework specifications
+ *
+ *-----------------------------------------------------------------------------
+ *
+ */
+
 static int
 Rivet_InitHandler(apr_pool_t *pPool, apr_pool_t *pLog, apr_pool_t *pTemp, server_rec *s)
 {
@@ -1072,6 +1086,7 @@ Rivet_Panic TCL_VARARGS_DEF(CONST char *
  *
  *-----------------------------------------------------------------------------
  */
+
 static Tcl_Interp*
 Rivet_CreateTclInterp (server_rec* s)
 {
@@ -1177,7 +1192,7 @@ Rivet_InitTclStuff(server_rec *s, apr_po
     extern int ap_max_requests_per_child;
     int interpCount = 0;
 
-/* This code is run once per child process. In a threaded Tcl builds the forking 
+/* This code is run once per child process. In a threaded Tcl build the forking 
  * of a child process most likely has not preserved the thread where the Tcl 
  * notifier runs. The Notifier should have been restarted by one the 
  * pthread_atfork callbacks (setup in Tcl >= 8.5.14 and Tcl >= 8.6.1). In
@@ -1280,6 +1295,7 @@ Rivet_ChildHandlers(server_rec *s, int i
     server_rec *sr;
     rivet_server_conf *rsc;
     rivet_server_conf *top;
+
     void *function;
     void *parentfunction;
     char *errmsg;
@@ -1288,11 +1304,13 @@ Rivet_ChildHandlers(server_rec *s, int i
     if (init == 1) {
         parentfunction = top->rivet_child_init_script;
         errmsg = MODNAME ": Error in Child init script: %s";
-        //errmsg = (char *) apr_pstrdup(p, "Error in child init script: %s");
     } else {
         parentfunction = top->rivet_child_exit_script;
         errmsg = MODNAME ": Error in Child exit script: %s";
-        //errmsg = (char *) apr_pstrdup(p, "Error in child exit script: %s");
+        Tcl_Preserve(top->server_interp);
+    }
+
+    if (!init) {
         Tcl_Preserve(top->server_interp);
     }
 
@@ -1314,20 +1332,15 @@ Rivet_ChildHandlers(server_rec *s, int i
 
             globals->srec = sr;
             if (Tcl_EvalObjEx(rsc->server_interp,function, 0) != TCL_OK) {
-                ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, s,
-                             errmsg, Tcl_GetString(function));
-                ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, s, 
-                             "errorCode: %s",
-                        Tcl_GetVar(rsc->server_interp, "errorCode", 0));
-                ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, s, 
-                             "errorInfo: %s",
-                        Tcl_GetVar(rsc->server_interp, "errorInfo", 0));
+                ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, s, errmsg, Tcl_GetString(function));
+                ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, s, "errorCode: %s", Tcl_GetVar(rsc->server_interp, "errorCode", 0));
+                ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, s, "errorInfo: %s", Tcl_GetVar(rsc->server_interp, "errorInfo", 0));
             }
             Tcl_Release (rsc->server_interp);
         }
 
         /*
-            it's probably pedantic to unregister the channel just before
+            it's probably pedantic to unregister the channel(s) just before
             the child exits and the interpreter is deleted 
 
         if (!init && ((sr == s) || rsc->separate_channels)) 
@@ -1653,10 +1666,6 @@ sendcleanup:
 static void
 rivet_register_hooks (apr_pool_t *p)
 {
-    //static const char * const aszPre[] = {
-    //    "http_core.c", "mod_mime.c", NULL };
-    //static const char * const aszPreTranslate[] = {"mod_alias.c", NULL};
-
     ap_hook_post_config (Rivet_InitHandler, NULL, NULL, APR_HOOK_LAST);
     ap_hook_handler (Rivet_SendContent, NULL, NULL, APR_HOOK_LAST);
     ap_hook_child_init (Rivet_ChildInit, NULL, NULL, APR_HOOK_LAST);



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