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 2013/08/07 18:59:12 UTC
svn commit: r1511397 - in /tcl/rivet/branches/modular: ./ doc/ doc/xml/
rivet/packages/session/ rivet/packages/tclrivet/ src/apache-2/ src/parser/
src/rivetcmds/ tests/
Author: mxmanghi
Date: Wed Aug 7 16:59:11 2013
New Revision: 1511397
URL: http://svn.apache.org/r1511397
Log:
* ./: merging into 'modular' changes done in trunk
Added:
tcl/rivet/branches/modular/src/rivetcmds/rivetInspect.c
- copied unchanged from r1511391, tcl/rivet/branches/modular/src/rivetcmds/rivetConf.c
tcl/rivet/branches/modular/tests/parsestring.rvt
- copied unchanged from r1511391, tcl/rivet/trunk/tests/parsestring.rvt
Removed:
tcl/rivet/branches/modular/src/rivetcmds/rivetConf.c
Modified:
tcl/rivet/branches/modular/ (props changed)
tcl/rivet/branches/modular/ChangeLog
tcl/rivet/branches/modular/INSTALL
tcl/rivet/branches/modular/Makefile.am
tcl/rivet/branches/modular/Makefile.in
tcl/rivet/branches/modular/configure.ac
tcl/rivet/branches/modular/doc/ (props changed)
tcl/rivet/branches/modular/doc/Makefile.am
tcl/rivet/branches/modular/doc/rivet.xml
tcl/rivet/branches/modular/doc/xml/commands.xml
tcl/rivet/branches/modular/rivet/packages/session/session-class.tcl
tcl/rivet/branches/modular/rivet/packages/tclrivet/tclrivet.tcl
tcl/rivet/branches/modular/src/apache-2/mod_rivet.c
tcl/rivet/branches/modular/src/apache-2/mod_rivet.h
tcl/rivet/branches/modular/src/parser/parserPkgInit.c
tcl/rivet/branches/modular/src/parser/rivetParser.c
tcl/rivet/branches/modular/tests/parse.test
Propchange: tcl/rivet/branches/modular/
------------------------------------------------------------------------------
Merged /tcl/rivet/trunk:r1492435-1511391
Modified: tcl/rivet/branches/modular/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/ChangeLog?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/ChangeLog (original)
+++ tcl/rivet/branches/modular/ChangeLog Wed Aug 7 16:59:11 2013
@@ -1,3 +1,61 @@
+2013-08-07 Massimo Manghi <mx...@apache.org>
+ * ./: merging changes done in trunk
+
+2013-08-06 Massimo Manghi <mx...@apache.org>
+ * rivetcmds/rivetCore.c,rivetInspect.c: moved core commands into this new directory.
+ Their code is (nearly) independent from Apache version and in future it might be shared
+ between different versions/branches of the module
+ * src/apache-2/Makefile.am: changed reference to rivetCore.c and rivetConf.c to
+ their new position and new names
+ * src/apache-2/mod_rivet.c: conditional compilation to Tcl_InitIdentifier might
+ help preserving event loop on Unices where no pthreads_atfork call exists (Bug #55153)
+ * configure.ac: Tcl version checked to detect when the notifier might
+ not be working (Tcl < 8.5.15 and Tcl < 8.6.1). In case a warning message is printed
+
+2013-07-19 Massimo Manghi <mx...@apache.org>
+ * tests/parse.test,parsestring.rvt: adding test for 'parse -string' variant
+ to Rivet command 'parse'
+
+2013-07-17 Massimo Manghi <mx...@apache.org>
+ * src/apache-2/mod_rivet.[h|c],rivetCore.c: reverting new command 'parsestr' and
+ turning string parsing command into the support for the new -string modifier of the
+ ordinary parse command
+
+2013-07-06 Massimo Manghi <mx...@apache.org>
+ * src/parser/parserPkgInit.c: commands are created through the RIVET_OBJ_CMD macro
+ * rivet/packages/tclrivet/tclrivet.tcl: loading the rivetparser library caused
+ weird side effects and the interpreter failed when this package was required
+ by a script. It's still to be understood why librivetparser was loaded using
+ command 'load' in tclrivet.tcl
+ * src/apache-2/mod_rivet.c: reverting an attempt to include rivetparser
+ as package required by default.
+
+2013-07-05 Massimo Manghi <mx...@apache.org>
+ * configure.ac: changed the default path for installation dir
+ * doc/xml/commands.xml: add manual page for command ::rivet::xml
+
+2013-06-28 Massimo Manghi <mx...@apache.org>
+ * src/apache-2/mod_rivet.c,rivetCore.c: command 'parsestr' to parse templates stored
+ in Tcl objects coded
+ * doc/Makefile.am: 'clean' target made a little terser
+
+2013-06-26 Massimo Manghi <mx...@apache.org>
+ * Makefile.am: forcing install/unistall targets to recreate pkgIndex.tcl
+ in order to have a coherent directory of packages actually available
+
+2013-06-24 Massimo Manghi <mx...@apache.org>
+ * INSTALL: It must be made explicit installation is a two stage operation now
+
+2013-06-24 Massimo Manghi <mx...@apache.org>
+ * rivet/packages/session/session-class.tcl: two new methods 'load' (loads a
+ whole package data for a given package and session) and 'clear' (it deletes either
+ a whole package or a single data like for a session)
+
+2013-06-22 Massimo Manghi <mx...@apache.org>
+ * src/apache-2/mod_rivet.c: cleanup of unused code in mod_rivet.c. Adding comments
+ to undocumented functions
+ * src/parser/rivetParse.c: New TODO comment added
+
2013-06-12 Massimo Manghi <mx...@apache.org>
* Makefile.am: splitting install targets into 'make install' (mod_rivet.so,
librivet.so,librivetparser.so + Tcl commands in rivet/rivet-tcl) and
Modified: tcl/rivet/branches/modular/INSTALL
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/INSTALL?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/INSTALL (original)
+++ tcl/rivet/branches/modular/INSTALL Wed Aug 7 16:59:11 2013
@@ -1,5 +1,5 @@
- Rivet 2.1 Installation
- ======================
+ Rivet 2.1 Installation
+ ======================
For more detailed instructions, see the docs/html/ directory.
@@ -12,12 +12,12 @@ the source tree running 'aclocal; autore
Example:
-./configure --with-tcl=/usr/lib/tcl8.5/ \
- --with-apxs=/usr/bin/apxs \
- --with-tclsh=/usr/bin/tclsh8.5 \
- --with-apache-version=2 \
- --with-rivet-target-dir=/usr/lib/rivet2.1 \
- --enable-version-display
+./configure --with-tcl=/usr/lib/tcl8.5/ \
+ --with-apxs=/usr/bin/apxs \
+ --with-tclsh=/usr/bin/tclsh8.5 \
+ --with-apache-version=2 \
+ --with-rivet-target-dir=/usr/lib/rivet2.1 \
+ --enable-version-display
2) if 'configure' was successful Rivet is ready for compilation
@@ -27,9 +27,9 @@ make
sudo make install
-or simply
+4) Install Rivet utils with
-make install
+sudo make install-packages
if your configuration doesn't require you to have administrative privileges.
@@ -38,10 +38,10 @@ handles other specific options.
--with-tcl=DIR Directory where tclConfig.sh is
stored. This is a shell script that
- defines all the relevant symbols needed
- to build Tcl related applications.
+ defines all the relevant symbols needed
+ to build Tcl related applications.
--with-apache-version=VER Values are 1 or 2 depending
- on the apache server you're
+ on the apache server you're
builing the module for.
--with-apache=DIR Apache server's root directory.
--with-apxs=FILE Path to the apxs program to
@@ -50,7 +50,7 @@ handles other specific options.
--with-apache-include=DIR Apache's include files path.
--with-apr-config=FILE Apache Portable Runtime
metainformation program
---with-rivet-target-dir=DIR Rivet library installation directory.
+--with-rivet-target-dir=DIR Rivet library installation directory.
--enable-version-display Apache signature shows Rivet
version number in the form Rivet/2.0.x.
Default=no
@@ -58,7 +58,7 @@ handles other specific options.
These are the basic Apache configuration directives that are needed:
# Loads the module.
-LoadModule rivet_module /path/to/your/copy/of/mod_rivet.so
+LoadModule rivet_module /path/to/your/copy/of/mod_rivet.so
# Let the module handle .rvt and .tcl files.
AddType application/x-httpd-rivet rvt
@@ -72,9 +72,11 @@ If Apache1.x and Apache2.x coexist on th
tell configure where the right apxs (apache extension tool) script is
located. E.g.: on a Debian system apxs for Apache2.x is named apxs2
-./configure --with-apache-include=/usr/include/apr-1.0 \
- --with-apache-version=2 --with-apxs=/usr/bin/apxs2 \
- --with-tcl=/usr/lib/tcl8.6 --with-apache=/usr
+./configure --with-apache-include=/usr/include/apr-1.0 \
+ --with-apache-version=2 \
+ --with-apxs=/usr/bin/apxs2 \
+ --with-tcl=/usr/lib/tcl8.6 \
+ --with-apache=/usr
Here is another example reported by a user who successfully built
Rivet on Slackware 12.1
Modified: tcl/rivet/branches/modular/Makefile.am
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/Makefile.am?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/Makefile.am (original)
+++ tcl/rivet/branches/modular/Makefile.am Wed Aug 7 16:59:11 2013
@@ -14,6 +14,10 @@ SUBDIRS = src doc
RIVETLIB_DESTDIR = $(DESTDIR)@RIVET_TCL_TARGET@
RIVET_PACKAGES = $(RIVETLIB_DESTDIR)/packages
+# I expect this symbol sooner or later to be handled by configure for arch dependent builds
+# Current value is the rivetlib directory
+RIVET_LIBS_ARCH =
+
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck
@@ -21,7 +25,8 @@ install-data-local:
$(mkinstalldirs) $(RIVETLIB_DESTDIR)
cp -v rivet/init.tcl $(RIVETLIB_DESTDIR)/
cp -rv rivet/rivet-tcl $(RIVETLIB_DESTDIR)/
- -( cd $(RIVETLIB_DESTDIR); rm -f *.la)
+ -( cd $(RIVETLIB_DESTDIR); rm -f *.la; \
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
uninstall-local:
rm -f $(RIVETLIB_DESTDIR)/init.tcl
@@ -37,7 +42,7 @@ install-packages:
cp -rv rivet/packages/* $(RIVET_PACKAGES)
-( cd $(RIVETLIB_DESTDIR); \
echo 'eval file delete [glob [file join packages * pkgIndex.tcl]] pkgIndex.tcl' | @TCLSH_PROG@ ; \
- echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join *[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
uninstall-packages:
rm -fr $(RIVET_PACKAGES)
@@ -45,6 +50,8 @@ uninstall-packages:
@if [ -z '$(wildcard $(RIVETLIB_DESTDIR)/*)' ]; then \
@rmdir $(RIVETLIB_DESTDIR); \
fi
+ -( cd $(RIVETLIB_DESTDIR); \
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
#
distclean-local:
Modified: tcl/rivet/branches/modular/Makefile.in
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/Makefile.in?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/Makefile.in (original)
+++ tcl/rivet/branches/modular/Makefile.in Wed Aug 7 16:59:11 2013
@@ -18,7 +18,7 @@
#
# top-level Makefile.am for Apache Rivet: gets turned into a Makefile.in by automake
#
-# $Id: Makefile.am 1436690 2013-01-21 23:40:42Z mxmanghi $
+# $Id: Makefile.am 1500301 2013-07-06 16:26:05Z mxmanghi $
#
# 2007/12/25: Added target uninistall-local that removes the tcl stuff (mxmanghi)
# 2010/06/22: target instal-data-local searches for pkgIndex.tcl files and deletes them
@@ -337,6 +337,10 @@ EXTRA_DIST = LICENSE contrib debian doc
SUBDIRS = src doc
RIVETLIB_DESTDIR = $(DESTDIR)@RIVET_TCL_TARGET@
RIVET_PACKAGES = $(RIVETLIB_DESTDIR)/packages
+
+# I expect this symbol sooner or later to be handled by configure for arch dependent builds
+# Current value is the rivetlib directory
+RIVET_LIBS_ARCH =
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -856,7 +860,8 @@ install-data-local:
$(mkinstalldirs) $(RIVETLIB_DESTDIR)
cp -v rivet/init.tcl $(RIVETLIB_DESTDIR)/
cp -rv rivet/rivet-tcl $(RIVETLIB_DESTDIR)/
- -( cd $(RIVETLIB_DESTDIR); rm -f *.la)
+ -( cd $(RIVETLIB_DESTDIR); rm -f *.la; \
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
uninstall-local:
rm -f $(RIVETLIB_DESTDIR)/init.tcl
@@ -872,7 +877,7 @@ install-packages:
cp -rv rivet/packages/* $(RIVET_PACKAGES)
-( cd $(RIVETLIB_DESTDIR); \
echo 'eval file delete [glob [file join packages * pkgIndex.tcl]] pkgIndex.tcl' | @TCLSH_PROG@ ; \
- echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join *[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
uninstall-packages:
rm -fr $(RIVET_PACKAGES)
@@ -880,6 +885,8 @@ uninstall-packages:
@if [ -z '$(wildcard $(RIVETLIB_DESTDIR)/*)' ]; then \
@rmdir $(RIVETLIB_DESTDIR); \
fi
+ -( cd $(RIVETLIB_DESTDIR); \
+ echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join $(RIVET_LIBS_ARCH)*[info sharedlibextension]]]' | @TCLSH_PROG@ ; )
#
distclean-local:
Modified: tcl/rivet/branches/modular/configure.ac
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/configure.ac?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/configure.ac (original)
+++ tcl/rivet/branches/modular/configure.ac Wed Aug 7 16:59:11 2013
@@ -22,7 +22,7 @@ dnl
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------
-AC_INIT([Rivet],[2.1.2])
+AC_INIT([Rivet],[2.1.3])
TEA_INIT([3.9])
AC_CONFIG_AUX_DIR(tclconfig)
@@ -245,7 +245,7 @@ AC_DEFUN([APACHE],[
AC_ARG_WITH(
apache,
[ --with-apache[=DIR] Apache server base directory],
- , [with_apache="/usr/local/apache"]
+ , [with_apache="/usr/local/apache2"]
)
apache_base="${with_apache}"
AC_MSG_RESULT([$apache_base])
@@ -350,7 +350,7 @@ AC_DEFUN([APR_HANDLING],[
fi]
)
if test "${apr_found+set}" = set ; then
- AC_MSG_RESULT([$apr_found])
+ AC_MSG_RESULT([$apr_found])
dnl At this point we already have apr sorted out
dnl It actually calls another script, so the PATH needs to be set.
export PATH=$PATH:`dirname ${apr_found}`
@@ -369,19 +369,40 @@ AC_DEFUN([APR_HANDLING],[
#--------------------------------------------------------------------
# 6-Dec-2011: Introducing new ::rivet namespace. Some components
# (namely RivetTcl, providing Tcl level initialization) are required
-# within mod_rivet.c. Unfortunalely Tcl < 8.5.10 loaded shared
-# libs exporting names that clashed with Apache's own namespace and,
-# hence we have to make sure we are running a Tcl compatible version.
-# (See bug #3216070). If you're running Tcl < 8.5.10 we won't go any
-# further ahead...
+# within mod_rivet.c. Unfortunalely Tcl < 8.5.10 shared
+# libs exporting names could clash with Apache's binary own names.
+# Hence we have to make sure we are running a Tcl compatible version.
+# (See Tcl bug #3216070).
+#
+# Effect: If you're running Tcl < 8.5.10 we refuse to build Rivet...
AX_COMPARE_VERSION([$TCL_VERSION$TCL_PATCH_LEVEL],[lt],[8.5.10],[
AC_MSG_ERROR([Rivet 2.1 requires Tcl > 8.5.10 (current is $TCL_VERSION$TCL_PATCH_LEVEL)])
] , [
- AC_MSG_NOTICE([ok, we are running Tcl $TCL_VERSION$TCL_PATCH_LEVEL])
+ AC_MSG_NOTICE([we are building Rivet with Tcl $TCL_VERSION$TCL_PATCH_LEVEL])
])
+print_fileevent_msg="0"
+AX_COMPARE_VERSION([$TCL_VERSION$TCL_PATCH_LEVEL],[lt],[8.5.15],[
+ print_fileevent_msg="1"
+] , )
+
+
+AX_COMPARE_VERSION([$TCL_VERSION],[eq],[8.6],[
+ if test "$TCL_PATCH_LEVEL" = ".0" ; then
+ print_fileevent_msg="1"
+ fi
+] , )
+
+
+if test "$print_fileevent_msg" = "1"; then
+ AC_MSG_NOTICE([------------------------------------------------------------------------])
+ AC_MSG_NOTICE([The Tcl notifier (and consequently the event loop) might not be working ])
+ AC_MSG_NOTICE([in Rivet with Tcl $TCL_VERSION$TCL_PATCH_LEVEL using the 'prefork' MPM. ])
+ AC_MSG_NOTICE([Recommended versions are Tcl >= 8.5.15 or Tcl >= 8.6.1])
+ AC_MSG_NOTICE([------------------------------------------------------------------------])
+fi
# APACHE_VERSION
#
Propchange: tcl/rivet/branches/modular/doc/
------------------------------------------------------------------------------
Merged /tcl/rivet/trunk/doc:r1492435-1511391
Modified: tcl/rivet/branches/modular/doc/Makefile.am
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/doc/Makefile.am?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/doc/Makefile.am (original)
+++ tcl/rivet/branches/modular/doc/Makefile.am Wed Aug 7 16:59:11 2013
@@ -73,14 +73,8 @@ $(MANDIRS):
# this target cleans everything up in the html directory
distclean:
- -rm html/*.html
- -rm html/*.css
- -rm html/images/*.*
- -rmdir html/images
- -rmdir html
- if [ -e graphics ]; then \
- rm graphics ; \
- fi
+ -rm -fr html/*.html
+ -rm -f graphics
-rm Makefile
.PHONY: examples
Modified: tcl/rivet/branches/modular/doc/rivet.xml
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/doc/rivet.xml?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/doc/rivet.xml (original)
+++ tcl/rivet/branches/modular/doc/rivet.xml Wed Aug 7 16:59:11 2013
@@ -62,6 +62,7 @@
<year>2010</year>
<year>2011</year>
<year>2012</year>
+ <year>2013</year>
<holder>Apache Software Foundation</holder>
</copyright>
<author>
Modified: tcl/rivet/branches/modular/doc/xml/commands.xml
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/doc/xml/commands.xml?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/doc/xml/commands.xml (original)
+++ tcl/rivet/branches/modular/doc/xml/commands.xml Wed Aug 7 16:59:11 2013
@@ -1692,5 +1692,47 @@ form_request end</programlisting>
</para>
</refsect1>
</refentry>
+ <refentry id="xml">
+ <refnamediv>
+ <refname>xml</refname>
+ <refpurpose>
+ XML Fragments creation
+ </refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>::rivet::xml</command>
+ <arg>string</arg>
+ <arg>tag descriptor</arg>
+ <arg>tag descriptor</arg>
+ <arg>...</arg>
+ </cmdsynopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>Description</title>
+ <para>
+ Given a string and a variable number of tag descriptors return XML framgment made
+ by nesting the tags with the same hierarchical order they are listed on the command
+ line. The tag descriptors can be a one element list (the tag) or an odd-length list whose
+ first argument is the tag namme and the remaining elements are interpreted as
+ attribute name-attribute value pairs.
+ </para>
+ <para>
+ <command>::rivet::xml</command> can work as a replacement of <command>::rivet::html</command>
+ provided you take care of sending the string with command <command>puts</command>
+ </para>
+ <programlisting>::rivet::xml "a string" b u
+<== <b><u>a string</u></b></programlisting>
+ <para>
+ You can tell the tags which attributes they must have
+ </para>
+ <programlisting><command>::rivet::xml "a string" [list div class box id testbox] b i</command>
+<== <div class="box" id="testbox"><b><i>a string</i></b></div></programlisting>
+ <programlisting><command>::rivet::xml "text to be wrapped in XML" div [list a href "http://..../" title "info message"]</command>
+<== <div><a href="http://..../" title="info message">text to be wrapped in XML</a></div></programlisting>
+
+
+ </refsect1>
+ </refentry>
</section>
Modified: tcl/rivet/branches/modular/rivet/packages/session/session-class.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/rivet/packages/session/session-class.tcl?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/rivet/packages/session/session-class.tcl (original)
+++ tcl/rivet/branches/modular/rivet/packages/session/session-class.tcl Wed Aug 7 16:59:11 2013
@@ -347,6 +347,35 @@ package require Itcl
}
#
+ # load - given a package names returns a dictionary storing the key - value pairs for this session
+ #
+ #
+ method load {packageName} {
+ set package_d [dict create]
+
+ $dioObject forall "select key_,data from $sessionCacheTable where package_='$packageName' and session_id='[$this id]'" a {
+ dict set package_d $a(key_) $a(data)
+ }
+
+ return $package_d
+ }
+
+ # clear - given a package name and optionally a key it deletes rows in the cache for this session.
+ # when also the key value is specified only the row for that package-key pair is deleted
+ #
+ method clear {packageName {key ""}} {
+ if {$key == ""} {
+ set keyval [list [$this id] $packageName]
+ set keyfield {session_id package_}
+ } else {
+ set keyval [list [$this id] $packageName $key]
+ set keyfield {session_id package_ key_}
+ }
+
+ $dioObject delete $keyval -table $sessionCacheTable -keyfield $keyfield
+ }
+
+ #
# delete - given a user ID and looking at their IP address we inherited
# from the environment (thanks, webserver), remove them from the session
# table. (the session table is how the server remembers stuff about
Modified: tcl/rivet/branches/modular/rivet/packages/tclrivet/tclrivet.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/rivet/packages/tclrivet/tclrivet.tcl?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/rivet/packages/tclrivet/tclrivet.tcl (original)
+++ tcl/rivet/branches/modular/rivet/packages/tclrivet/tclrivet.tcl Wed Aug 7 16:59:11 2013
@@ -18,8 +18,8 @@
package provide tclrivet 0.1
-load [file join [file dirname [info script]] .. .. \
- librivetparser[info sharedlibextension]]
+#load [file join [file dirname [info script]] .. .. \
+# librivetparser[info sharedlibextension]]
proc include { filename } {
set fl [ open $filename ]
Modified: tcl/rivet/branches/modular/src/apache-2/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/src/apache-2/mod_rivet.c?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/src/apache-2/mod_rivet.c (original)
+++ tcl/rivet/branches/modular/src/apache-2/mod_rivet.c Wed Aug 7 16:59:11 2013
@@ -46,6 +46,8 @@
#include <apr_strings.h>
#include <apr_tables.h>
+#include <ap_mpm.h>
+
/* Tcl includes */
#include <tcl.h>
/* There is code ifdef'ed out below which uses internal
@@ -109,24 +111,29 @@ static int Rivet_chdir_file (const char
return chdir_retval;
}
-/* Function to be used should we desire to upload files to a variable */
-
-#if 0
-int
-Rivet_UploadHook(void *ptr, char *buf, int len, ApacheUpload *upload)
-{
- Tcl_Interp *interp = ptr;
- static int usenum = 0;
- static int uploaded = 0;
- if (oldptr != upload)
- {
- } else {
- }
-
- return len;
-}
-#endif /* 0 */
+/*
+ * -- Rivet_CheckType (request_rec *r)
+ *
+ * Utility function internally used to determine which type
+ * of file (whether rvt template or plain Tcl script) we are
+ * dealing with. In order to speed up multiple tests the
+ * the test returns an integer (RIVET_FILE) for rvt templates
+ * or TCL_FILE for Tcl scripts
+ *
+ * Argument:
+ *
+ * request_rec*: pointer to the current request record
+ *
+ * Returns:
+ *
+ * integer number meaning the type of file we are dealing with
+ *
+ * Side effects:
+ *
+ * none.
+ *
+ */
static int
Rivet_CheckType (request_rec *req)
@@ -143,98 +150,41 @@ Rivet_CheckType (request_rec *req)
return ctype;
}
-/*
- * Rivet_ParseFileArgString (char *szDocRoot, char *szArgs, char **file)
- *
- * parses a string like /path/file.ext?arg1=value1&arg2=value2 into
- * the filename and arguments. A Tcl_Hashtable is utilized for the
- * arguments and returned. The file name is appended to the szDocRoot
- * argument and stored in the *file pointer.
- */
-#if 0
-static int
-Rivet_ParseFileArgString (const char *szDocRoot, const char *szArgs, char **file,apr_pool_t *p,
- Tcl_HashTable *argTbl)
-{
- int flen = 1, argslen, newEntry, i;
- const char *rootPtr = szDocRoot, *argsPtr = szArgs, *argPos;
- char *filePtr;
- char *argument, *value;
- Tcl_HashEntry *entryPtr;
-
- /*
- * parse filename, that is everything before ? in the args string.
- * Append it to the document root, if this is not NULL.
- */
-
- while (*argsPtr != '?' && *argsPtr != '\0') {
- argsPtr++;
- }
- if (*argsPtr == '?')
- argslen = argsPtr-szArgs ;
- else
- argslen = 0;
- flen += strlen(szDocRoot) + argslen ;
- *file = (char*)apr_palloc(p,flen);
- strcat(*file,szDocRoot);
- strncat(*file,szArgs,argslen);
-
- if (argTbl == NULL)
- return RIVET_OK;
-
- /*
- * past this point, parse remainder of the args string. For every argument,
- * create a new entry in the argTbl Tcl_HashTable.
- */
- Tcl_InitHashTable (argTbl, TCL_STRING_KEYS);
-
- for (i = 0, argPos = argsPtr; i < strlen(argsPtr); i++) {
- if (*(argsPtr + i) == '=') {
- /* argument ends */
- argument = (char*) malloc ((strlen(szArgs)+1) * sizeof(char));
- char *ap = argument;
- while ((*ap++ = *argPos++) != '=')
- ;
- *--ap = '\0';
- } else if (*(argsPtr + i) == '&' || i == strlen(argsPtr)-1) {
- /* value ends */
- value = (char*) malloc ((strlen(szArgs)+1) * sizeof(char));
- char *vp = value;
- while ((*vp++ = *argPos++) != '&')
- ;
- *--vp = '\0';
-
- if (argument == NULL) {
- argument = value;
- value = "1";
- }
- entryPtr = Tcl_CreateHashEntry (argTbl, (CONST char*) argument,
- &newEntry);
- Tcl_SetHashValue (entryPtr, value);
- argument = NULL;
- value = NULL;
- }
- }
-
- return RIVET_OK;
-}
-#endif
/*
+ * -- Rivet_InitServerVariables
+ *
* Setup an array in each interpreter to tell us things about Apache.
* This saves us from having to do any real call to load an entire
* environment. This routine only gets called once, when the child process
* is created.
*
- * SERVER_ROOT - Apache's root location
- * SERVER_CONF - Apache's configuration file
- * RIVET_DIR - Rivet's Tcl source directory
- * RIVET_INIT - Rivet's init.tcl file
+ * Arguments:
+ *
+ * Tcl_Interp*: pointer to the Tcl interpreter
+ * apr_pool_t*: pool used for calling Apache framework functions
+ *
+ * Returned value:
+ * none
+ *
+ * Side effects:
+ *
+ * within the global scope of the interpreter passed as first
+ * argument a 'server' array is created and the variable associated
+ * to the following keys are defined
+ *
+ * SERVER_ROOT - Apache's root location
+ * SERVER_CONF - Apache's configuration file
+ * RIVET_DIR - Rivet's Tcl source directory
+ * RIVET_INIT - Rivet's init.tcl file
+ * RIVET_VERSION - Rivet version (only when RIVET_DISPLAY_VERSION is 1)
+ *
*/
static void
-Rivet_InitServerVariables( Tcl_Interp *interp, apr_pool_t *p )
+Rivet_InitServerVariables( Tcl_Interp *interp, apr_pool_t *pool )
{
+ int ap_mpm_result;
Tcl_Obj *obj;
obj = Tcl_NewStringObj(ap_server_root, -1);
@@ -246,7 +196,7 @@ Rivet_InitServerVariables( Tcl_Interp *i
TCL_GLOBAL_ONLY);
Tcl_DecrRefCount(obj);
- obj = Tcl_NewStringObj(ap_server_root_relative(p,SERVER_CONFIG_FILE), -1);
+ obj = Tcl_NewStringObj(ap_server_root_relative(pool,SERVER_CONFIG_FILE), -1);
Tcl_IncrRefCount(obj);
Tcl_SetVar2Ex(interp,
"server",
@@ -255,7 +205,7 @@ Rivet_InitServerVariables( Tcl_Interp *i
TCL_GLOBAL_ONLY);
Tcl_DecrRefCount(obj);
- obj = Tcl_NewStringObj(ap_server_root_relative(p, RIVET_DIR), -1);
+ obj = Tcl_NewStringObj(ap_server_root_relative(pool, RIVET_DIR), -1);
Tcl_IncrRefCount(obj);
Tcl_SetVar2Ex(interp,
"server",
@@ -264,7 +214,7 @@ Rivet_InitServerVariables( Tcl_Interp *i
TCL_GLOBAL_ONLY);
Tcl_DecrRefCount(obj);
- obj = Tcl_NewStringObj(ap_server_root_relative(p, RIVET_INIT), -1);
+ obj = Tcl_NewStringObj(ap_server_root_relative(pool, RIVET_INIT), -1);
Tcl_IncrRefCount(obj);
Tcl_SetVar2Ex(interp,
"server",
@@ -285,44 +235,6 @@ Rivet_InitServerVariables( Tcl_Interp *i
#endif
}
-#if 0
-static void
-Rivet_PropagateServerConfArray( Tcl_Interp *interp, rivet_server_conf *rsc )
-{
- apr_table_t *t;
- apr_array_header_t *arr;
- apr_table_entry_t *elts;
- int i, nelts;
- Tcl_Obj *key;
- Tcl_Obj *val;
- Tcl_Obj *arrayName;
-
- /* Propagate all of the ServerConf variables into an array. */
- t = rsc->rivet_server_vars;
- arr = (apr_array_header_t*) apr_table_elts( t );
- elts = (apr_table_entry_t *) arr->elts;
- nelts = arr->nelts;
-
- arrayName = Tcl_NewStringObj("RivetServerConf", -1);
- Tcl_IncrRefCount(arrayName);
-
- for( i = 0; i < nelts; ++i )
- {
- key = Tcl_NewStringObj( elts[i].key, -1);
- val = Tcl_NewStringObj( elts[i].val, -1);
- Tcl_IncrRefCount(key);
- Tcl_IncrRefCount(val);
- Tcl_ObjSetVar2(interp,
- arrayName,
- key,
- val,
- TCL_GLOBAL_ONLY);
- Tcl_DecrRefCount(key);
- Tcl_DecrRefCount(val);
- }
- Tcl_DecrRefCount(arrayName);
-}
-#endif
/* Calls Tcl_EvalObjEx() and checks for errors
* Prints the error buffer if any.
@@ -428,7 +340,26 @@ good:
return TCL_OK;
}
-/* This is a separate function so that it may be called from 'Parse' */
+/*
+ * -- 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.
+ *
+ * This is a separate function so that it may be called from command 'parse'
+ *
+ * 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
+ */
+
int
Rivet_ParseExecFile(TclWebRequest *req, char *filename, int toplevel)
{
@@ -541,6 +472,7 @@ Rivet_ParseExecFile(TclWebRequest *req,
Tcl_DecrRefCount(outbuf);
return result;
}
+
if (toplevel) {
if (rsc->rivet_after_script) {
Tcl_AppendObjToObj(outbuf,rsc->rivet_after_script);
@@ -587,6 +519,7 @@ Rivet_ParseExecFile(TclWebRequest *req,
outbuf = (Tcl_Obj *)Tcl_GetHashValue(entry);
Tcl_IncrRefCount(outbuf);
}
+
rsc->user_scripts_updated = 0;
{
int res = 0;
@@ -596,6 +529,43 @@ Rivet_ParseExecFile(TclWebRequest *req,
}
}
+/*
+ * -- Rivet_ParseExecString
+ *
+ * This function takes Tcl_Obj carrying a string to be interpreted as
+ * a Rivet template. This function is the core for command 'parsestr'
+ *
+ * Arguments:
+ *
+ * - TclWebRequest* req: pointer to the structure collecting Tcl and
+ * Apache data
+ * - Tcl_Obj* inbuf: Tcl object storing the template to be parsed.
+ */
+
+int
+Rivet_ParseExecString (TclWebRequest* req, Tcl_Obj* inbuf)
+{
+ int res = 0;
+ Tcl_Obj* outbuf = Tcl_NewObj();
+ Tcl_Interp *interp = req->interp;
+
+ Tcl_IncrRefCount(outbuf);
+ Tcl_AppendToObj(outbuf, "puts -nonewline \"", -1);
+
+ /* If we are not inside a <? ?> section, add the closing ". */
+ if (Rivet_Parser(outbuf, inbuf) == 0)
+ {
+ Tcl_AppendToObj(outbuf, "\"\n", 2);
+ }
+
+ Tcl_AppendToObj(outbuf, "\n", -1);
+
+ res = Rivet_ExecuteAndCheck(interp, outbuf, req->req);
+ Tcl_DecrRefCount(outbuf);
+
+ return res;
+}
+
static void
Rivet_CleanupRequest( request_rec *r )
{
@@ -936,7 +906,7 @@ Rivet_PerInterpInit(server_rec *s, rivet
{
ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, s,
MODNAME ": error setting auto_path: %s",
- Tcl_GetStringFromObj(auto_path,NULL));
+ Tcl_GetStringFromObj(auto_path,NULL));
}
Tcl_DecrRefCount(rivet_tcl);
@@ -947,7 +917,6 @@ Rivet_PerInterpInit(server_rec *s, rivet
Rivet_InitServerVariables(interp, p );
// Rivet_PropagateServerConfArray( interp, rsc );
-
/* Loading into the interpreter the commands provided by librivet.so */
/* Tcl Bug #3216070 has been solved with 8.5.10 and commands shipped with
* Rivetlib can be mapped at this stage
@@ -957,7 +926,7 @@ Rivet_PerInterpInit(server_rec *s, rivet
{
ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, s,
MODNAME ": Error loading rivetlib package: %s",
- Tcl_GetStringResult(interp) );
+ Tcl_GetStringResult(interp) );
exit(1);
}
@@ -1274,13 +1243,13 @@ Rivet_InitHandler(apr_pool_t *pPool, apr
if (Tcl_EvalObjEx(interp, rsc->rivet_server_init_script, 0) != TCL_OK)
{
ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, s,
- MODNAME ": Error running ServerInitScript '%s': %s",
- Tcl_GetString(rsc->rivet_server_init_script),
+ MODNAME ": Error running ServerInitScript '%s': %s",
+ Tcl_GetString(rsc->rivet_server_init_script),
Tcl_GetVar(interp, "errorInfo", 0));
} else {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
- MODNAME ": ServerInitScript '%s' successful",
- Tcl_GetString(rsc->rivet_server_init_script));
+ MODNAME ": ServerInitScript '%s' successful",
+ Tcl_GetString(rsc->rivet_server_init_script));
}
}
@@ -1542,7 +1511,6 @@ Rivet_ChildHandlers(server_rec *s, int i
* None.
*
* Side Effects:
- * Runs Tcl_Finalize.
*
*-----------------------------------------------------------------------------
*/
@@ -1555,7 +1523,7 @@ Rivet_ChildExit(void *data)
ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_EGENERAL, s, MODNAME ": Running ChildExit handler");
Rivet_ChildHandlers(s, 0);
-/* Tcl_Finalize remove to meet requirement to coexist with mod_websh (Bug #54162) */
+ /* Tcl_Finalize removed to meet requirement of coexistence with mod_websh (Bug #54162) */
//Tcl_Finalize();
@@ -1594,7 +1562,7 @@ Rivet_CreateTclInterp (server_rec* s)
{
ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, s,
MODNAME ": Error in Tcl_Init: %s, aborting\n",
- Tcl_GetStringResult(interp));
+ Tcl_GetStringResult(interp));
exit(1);
}
Tcl_SetPanicProc(Rivet_Panic);
@@ -1679,17 +1647,29 @@ 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
+ * 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
+ * case pthread_atfork is not supported we unconditionally call Tcl_InitNotifier
+ * hoping for the best (Bug #55153)
+ */
+
+#if !defined(HAVE_PTHREAD_ATFORK)
+ Tcl_InitNotifier();
+#endif
+
if (rsc->rivet_global_init_script != NULL) {
if (Tcl_EvalObjEx(interp, rsc->rivet_global_init_script, 0) != TCL_OK)
{
ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, s,
- MODNAME ": Error running GlobalInitScript '%s': %s",
- Tcl_GetString(rsc->rivet_global_init_script),
+ MODNAME ": Error running GlobalInitScript '%s': %s",
+ Tcl_GetString(rsc->rivet_global_init_script),
Tcl_GetVar(interp, "errorInfo", 0));
} else {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
- MODNAME ": GlobalInitScript '%s' successful",
- Tcl_GetString(rsc->rivet_global_init_script));
+ MODNAME ": GlobalInitScript '%s' successful",
+ Tcl_GetString(rsc->rivet_global_init_script));
}
}
@@ -1717,10 +1697,10 @@ Rivet_InitTclStuff(server_rec *s, apr_po
sr->port,
interpCount++);
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
- MODNAME ": Rivet_InitTclStuff: creating slave interpreter '%s', hostname '%s', port '%d', separate interpreters %d",
- slavename, sr->server_hostname, sr->port,
- rsc->separate_virtual_interps);
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+ MODNAME ": Rivet_InitTclStuff: creating slave interpreter '%s', hostname '%s', port '%d', separate interpreters %d",
+ slavename, sr->server_hostname, sr->port,
+ rsc->separate_virtual_interps);
/* Separate virtual interps. */
myrsc->server_interp = Tcl_CreateSlave(interp, slavename, 0);
@@ -1840,7 +1820,7 @@ Rivet_SendContent(request_rec *r)
if (r->finfo.filetype == 0)
{
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, APR_EGENERAL,
- r->server,
+ r->server,
MODNAME ": File does not exist: %s",
(r->path_info ? (char*)apr_pstrcat(r->pool, r->filename, r->path_info, NULL) : r->filename));
retval = HTTP_NOT_FOUND;
@@ -1864,7 +1844,7 @@ Rivet_SendContent(request_rec *r)
*/
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, APR_EGENERAL, r->server,
MODNAME ": Error accessing %s, could not chdir into directory",
- r->filename);
+ r->filename);
retval = HTTP_INTERNAL_SERVER_ERROR;
goto sendcleanup;
@@ -1977,8 +1957,8 @@ Rivet_SendContent(request_rec *r)
if (Rivet_ParseExecFile(globals->req, r->filename, 1) != TCL_OK)
{
ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, r->server,
- MODNAME ": Error parsing exec file '%s': %s",
- r->filename,
+ MODNAME ": Error parsing exec file '%s': %s",
+ r->filename,
Tcl_GetVar(interp, "errorInfo", 0));
}
@@ -1989,7 +1969,7 @@ Rivet_SendContent(request_rec *r)
if (Tcl_EvalObjEx(interp, request_cleanup, 0) == TCL_ERROR) {
ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, r->server,
- MODNAME ": Error evaluating cleanup request: %s",
+ MODNAME ": Error evaluating cleanup request: %s",
Tcl_GetVar(interp, "errorInfo", 0));
}
Modified: tcl/rivet/branches/modular/src/apache-2/mod_rivet.h
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/src/apache-2/mod_rivet.h?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/src/apache-2/mod_rivet.h (original)
+++ tcl/rivet/branches/modular/src/apache-2/mod_rivet.h Wed Aug 7 16:59:11 2013
@@ -74,18 +74,17 @@ typedef struct _rivet_server_conf {
Tcl_Obj *rivet_global_init_script; /* run once when apache is started */
Tcl_Obj *rivet_child_init_script;
Tcl_Obj *rivet_child_exit_script;
- Tcl_Obj *rivet_before_script; /* script run before each page */
+ Tcl_Obj *rivet_before_script; /* script run before each page */
Tcl_Obj *rivet_after_script; /* after */
Tcl_Obj *rivet_error_script; /* for errors */
Tcl_Obj *rivet_abort_script; /* script run upon abort_page call */
Tcl_Obj *after_every_script; /* script to be run always */
- /* This flag is used with the above directives.
- If any of them have changed, it gets set. */
+ /* This flag is used with the above directives. If any of them have changed, it gets set. */
int user_scripts_updated;
- Tcl_Obj *rivet_default_error_script; /* for errors */
+ Tcl_Obj *rivet_default_error_script; /* for errors */
int *cache_size;
int *cache_free;
int upload_max;
@@ -97,7 +96,7 @@ typedef struct _rivet_server_conf {
apr_table_t *rivet_server_vars;
apr_table_t *rivet_dir_vars;
apr_table_t *rivet_user_vars;
- char **objCacheList; /* Array of cached objects (for priority handling) */
+ char **objCacheList; /* Array of cached objects (for priority handling) */
Tcl_HashTable *objCache; /* Objects cache - the key is the script name */
Tcl_Channel *outchannel; /* stuff for buffering output */
@@ -107,14 +106,15 @@ typedef struct _rivet_server_conf {
typedef struct _rivet_interp_globals {
request_rec *r; /* request rec */
- TclWebRequest *req; /* TclWeb API request */
- Tcl_Namespace *rivet_ns; /* Rivet commands namespace */
- int page_aborting; /* set by abort_page. */
- /* to be reset by Rivet_SendContent */
+ TclWebRequest *req; /* TclWeb API request */
+ Tcl_Namespace *rivet_ns; /* Rivet commands namespace */
+ int page_aborting; /* set by abort_page. */
+ /* to be reset by Rivet_SendContent */
Tcl_Obj* abort_code;
} rivet_interp_globals;
int Rivet_ParseExecFile(TclWebRequest *req, char *filename, int toplevel);
+int Rivet_ParseExecString (TclWebRequest* req, Tcl_Obj* inbuf);
rivet_server_conf *Rivet_GetConf(request_rec *r);
Modified: tcl/rivet/branches/modular/src/parser/parserPkgInit.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/src/parser/parserPkgInit.c?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/src/parser/parserPkgInit.c (original)
+++ tcl/rivet/branches/modular/src/parser/parserPkgInit.c Wed Aug 7 16:59:11 2013
@@ -10,7 +10,7 @@
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
+ 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,
@@ -27,6 +27,7 @@
#endif
#include <tcl.h>
+#include "rivet.h"
#include "rivetParser.h"
/*
@@ -54,13 +55,13 @@ Parse_Rivet(
if (objc != 2)
{
- Tcl_WrongNumArgs(interp, 1, objv, "filename");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, objv, "filename");
+ return TCL_ERROR;
}
if (Rivet_GetRivetFile(Tcl_GetString(objv[1]),
- 1, outbuf, interp) == TCL_ERROR) {
- return TCL_ERROR;
+ 1, outbuf, interp) == TCL_ERROR) {
+ return TCL_ERROR;
}
Tcl_SetObjResult(interp, outbuf);
Tcl_DecrRefCount(outbuf);
@@ -72,21 +73,21 @@ Parse_Rivet(
*
* Parse_RivetData --
*
- * Takes a Rivet script as an argument, and returns the parsed
- * tcl script version.
+ * Takes a Rivet script as an argument, and returns the parsed
+ * tcl script version.
*
* Results:
- * A normal Tcl result.
+ * A normal Tcl result.
*
* Side Effects:
- * None.
+ * None.
*
*-----------------------------------------------------------------------------
*/
static int
Parse_RivetData(ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[])
+ int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *outbuf;
@@ -94,8 +95,8 @@ Parse_RivetData(ClientData clientData, T
if (objc != 2)
{
- Tcl_WrongNumArgs(interp, 1, objv, "data");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, objv, "data");
+ return TCL_ERROR;
}
Tcl_IncrRefCount(outbuf);
@@ -103,7 +104,7 @@ Parse_RivetData(ClientData clientData, T
if (Rivet_Parser(outbuf, objv[1]) == 0)
{
- Tcl_AppendToObj(outbuf, "\"\n", 2);
+ Tcl_AppendToObj(outbuf, "\"\n", 2);
}
Tcl_SetObjResult(interp, outbuf);
@@ -117,25 +118,16 @@ EXTERN int
Rivetparser_Init( Tcl_Interp *interp )
{
#ifdef USE_TCL_STUBS
- if (Tcl_InitStubs(interp, "8.5", 0) == NULL) {
+ if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL)
#else
- if (Tcl_PkgRequire(interp, "Tcl", "8.5", 0) == NULL) {
-#endif
- return TCL_ERROR;
+ if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL)
+#endif
+ {
+ return TCL_ERROR;
}
- Tcl_CreateObjCommand(interp,
- "rivet::parserivet",
- Parse_Rivet,
- NULL,
- (Tcl_CmdDeleteProc *)NULL);
-
- Tcl_CreateObjCommand(interp,
- "rivet::parserivetdata",
- Parse_RivetData,
- NULL,
- (Tcl_CmdDeleteProc *)NULL);
-
+ RIVET_OBJ_CMD("parserivet",Parse_Rivet);
+ RIVET_OBJ_CMD("parserivetdata",Parse_RivetData);
return Tcl_PkgProvide( interp, "rivetparser", "0.2" );
}
@@ -154,18 +146,22 @@ Rivetparser_SafeInit( Tcl_Interp *interp
*/
#ifdef USE_TCL_STUBS
- if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
+ if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL)
#else
- if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL) {
-#endif
- return TCL_ERROR;
+ if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL)
+#endif
+ {
+ return TCL_ERROR;
}
+/*
Tcl_CreateObjCommand(interp,
- "rivet::parserivetdata",
- Parse_RivetData,
- NULL,
- (Tcl_CmdDeleteProc *)NULL);
+ "rivet::parserivetdata",
+ Parse_RivetData,
+ NULL,
+ (Tcl_CmdDeleteProc *)NULL);
+*/
+ RIVET_OBJ_CMD("parserivetdata",Parse_RivetData);
return Tcl_PkgProvide( interp, "rivetparser", "0.2" );
}
Modified: tcl/rivet/branches/modular/src/parser/rivetParser.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/src/parser/rivetParser.c?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/src/parser/rivetParser.c (original)
+++ tcl/rivet/branches/modular/src/parser/rivetParser.c Wed Aug 7 16:59:11 2013
@@ -12,7 +12,7 @@
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
+ 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,
@@ -57,22 +57,22 @@ Rivet_GetTclFile(char *filename, Tcl_Obj
Tcl_Channel chan = Tcl_OpenFileChannel(interp, filename, "r", 0644);
if (chan == (Tcl_Channel) NULL)
{
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "couldn't read file \"", filename,
- "\": ", Tcl_PosixError(interp), (char *) NULL);
- return TCL_ERROR;
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "couldn't read file \"", filename,
+ "\": ", Tcl_PosixError(interp), (char *) NULL);
+ return TCL_ERROR;
}
result = Tcl_ReadChars(chan, outbuf, -1, 1);
if (result < 0)
{
- Tcl_Close(interp, chan);
- Tcl_AppendResult(interp, "couldn't read file \"", filename,
- "\": ", Tcl_PosixError(interp), (char *) NULL);
- return TCL_ERROR;
+ Tcl_Close(interp, chan);
+ Tcl_AppendResult(interp, "couldn't read file \"", filename,
+ "\": ", Tcl_PosixError(interp), (char *) NULL);
+ return TCL_ERROR;
}
if (Tcl_Close(interp, chan) != TCL_OK)
- return TCL_ERROR;
+ return TCL_ERROR;
return TCL_OK;
}
@@ -99,6 +99,14 @@ Rivet_GetRivetFile(char *filename, int t
Tcl_Obj *inbuf;
Tcl_Channel rivetfile;
+ /*
+ * TODO There is much switching between Tcl and APR for calling
+ * utility routines. We should make up our minds and keep
+ * a coherent attitude deciding when Tcl should be called upon
+ * and when APR should be invoked instead for a certain class of
+ * tasks
+ */
+
rivetfile = Tcl_OpenFileChannel(interp, filename, "r", 0664);
if (rivetfile == NULL) {
/* Don't need to adderrorinfo - Tcl_OpenFileChannel takes care
Modified: tcl/rivet/branches/modular/tests/parse.test
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/modular/tests/parse.test?rev=1511397&r1=1511396&r2=1511397&view=diff
==============================================================================
--- tcl/rivet/branches/modular/tests/parse.test (original)
+++ tcl/rivet/branches/modular/tests/parse.test Wed Aug 7 16:59:11 2013
@@ -22,3 +22,26 @@ set testfilename1 parse.rvt
</body>
</html>}
+
+set testfilename2 parsestring.rvt
+
+::tcltest::test parse-1.2 {Parse command} {
+ set page [ ::http::geturl "${urlbase}$testfilename2" ]
+ ::http::data $page
+} {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <title>Parse String Test</title>
+ </head>
+
+ <body>
+ <h1>Parse String Test</h1>
+ Hello, World
+
+¡ À È Ì Ò Ù - El Burro Sabe Más Que Tú!
+
+
+<p>ÆüËܸì(EUC-JP Japanese text)</p>
+
+ </body>
+</html>}
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org