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/07/18 15:31:11 UTC

svn commit: r1504461 - in /tcl/rivet/trunk: ChangeLog src/apache-2/mod_rivet.c src/apache-2/mod_rivet.h src/apache-2/rivetCore.c

Author: mxmanghi
Date: Thu Jul 18 13:31:11 2013
New Revision: 1504461

URL: http://svn.apache.org/r1504461
Log:
    * 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


Modified:
    tcl/rivet/trunk/ChangeLog
    tcl/rivet/trunk/src/apache-2/mod_rivet.c
    tcl/rivet/trunk/src/apache-2/mod_rivet.h
    tcl/rivet/trunk/src/apache-2/rivetCore.c

Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1504461&r1=1504460&r2=1504461&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Thu Jul 18 13:31:11 2013
@@ -1,3 +1,8 @@
+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 

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=1504461&r1=1504460&r2=1504461&view=diff
==============================================================================
--- tcl/rivet/trunk/src/apache-2/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/apache-2/mod_rivet.c Thu Jul 18 13:31:11 2013
@@ -1508,7 +1508,6 @@ Rivet_ChildHandlers(server_rec *s, int i
  *  None.
  *
  * Side Effects:
- *  Runs Tcl_Finalize.
  *
  *-----------------------------------------------------------------------------
  */
@@ -1521,7 +1520,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();
 

Modified: tcl/rivet/trunk/src/apache-2/mod_rivet.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/apache-2/mod_rivet.h?rev=1504461&r1=1504460&r2=1504461&view=diff
==============================================================================
--- tcl/rivet/trunk/src/apache-2/mod_rivet.h (original)
+++ tcl/rivet/trunk/src/apache-2/mod_rivet.h Thu Jul 18 13:31:11 2013
@@ -114,6 +114,7 @@ typedef struct _rivet_interp_globals {
 } 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/trunk/src/apache-2/rivetCore.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/apache-2/rivetCore.c?rev=1504461&r1=1504460&r2=1504461&view=diff
==============================================================================
--- tcl/rivet/trunk/src/apache-2/rivetCore.c (original)
+++ tcl/rivet/trunk/src/apache-2/rivetCore.c Thu Jul 18 13:31:11 2013
@@ -166,13 +166,30 @@ TCL_CMD_HEADER( Rivet_Parse )
     }
 
     if( objc == 2 ) {
+
         filename = Tcl_GetStringFromObj( objv[1], (int *)NULL );
+
     } else {
-        if( !STREQU( Tcl_GetStringFromObj(objv[1], (int *)NULL), "-virtual") ) {
-            Tcl_WrongNumArgs( interp, 1, objv, "?-virtual? filename" );
+
+        if (STREQU( Tcl_GetStringFromObj(objv[1], (int *)NULL), "-virtual")) {
+
+        /* */
+
+            filename = TclWeb_GetVirtualFile(globals->req,Tcl_GetStringFromObj(objv[2],(int *)NULL));
+
+        } else if ( STREQU( Tcl_GetStringFromObj(objv[1], (int *)NULL), "-string")) {
+
+        /* we treat the argument as a string and we pass it as is to Rivet_ParseExecString */
+
+            return Rivet_ParseExecString(globals->req, objv[2]);
+
+        } else { 
+
+            Tcl_WrongNumArgs( interp, 1, objv, "?-virtual? filename | -string template_string" );
             return TCL_ERROR;
+
         }
-        filename = TclWeb_GetVirtualFile(globals->req,Tcl_GetStringFromObj(objv[2],(int *)NULL));
+
     }
 
     if (!strcmp(filename, globals->r->filename))
@@ -197,38 +214,6 @@ TCL_CMD_HEADER( Rivet_Parse )
     }
 }
 
-/*
- *-----------------------------------------------------------------------------
- *
- * Rivet_Parse_String --
- *
- *  Include and parse a string containing a template fragment.
- *  This command can be helpful if templates are not stored in ordinary
- *  files but rather in some DBMS
- *
- * Results:
- *      Standard Tcl result.
- *
- * Side Effects:
- *      Whatever occurs when the Rivet template in inbuf gets parsed.
- *
- *-----------------------------------------------------------------------------
- */
-
-TCL_CMD_HEADER( Rivet_Parse_String )
-{
-    Tcl_Obj* rivet_template;
-    rivet_interp_globals *globals = Tcl_GetAssocData(interp, "rivet", NULL);
-
-    if ( objc == 2 ) {
-        rivet_template = objv[1];
-    } else {
-        Tcl_WrongNumArgs( interp, 1, objv, "<string>" );
-        return TCL_ERROR;
-    }
-
-    return Rivet_ParseExecString(globals->req, rivet_template);
-}
 
 /*
  *-----------------------------------------------------------------------------
@@ -1537,7 +1522,6 @@ Rivet_InitCore( Tcl_Interp *interp )
     RIVET_OBJ_CMD ("upload",Rivet_Upload);
     RIVET_OBJ_CMD ("include",Rivet_Include);
     RIVET_OBJ_CMD ("parse",Rivet_Parse);
-    RIVET_OBJ_CMD ("parsestr",Rivet_Parse_String);
     RIVET_OBJ_CMD ("no_body",Rivet_NoBody);
     RIVET_OBJ_CMD ("env",Rivet_EnvCmd);
     RIVET_OBJ_CMD ("apache_log_error",Rivet_LogErrorCmd);



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