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 da...@apache.org on 2003/12/13 21:42:26 UTC

cvs commit: tcl-rivet/src parserPkgInit.c rivetParser.c

davidw      2003/12/13 12:42:26

  Modified:    .        ChangeLog TODO
               src      parserPkgInit.c rivetParser.c
  Log:
  * src/rivetParser.c (Rivet_Parser): "export" function in that it's no
    longer static.
  
  * src/parserPkgInit.c (Parse_RivetData): New alpha-ish command to
    parse data passed to the script.
  
  Revision  Changes    Path
  1.148     +6 -0      tcl-rivet/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/ChangeLog,v
  retrieving revision 1.147
  retrieving revision 1.148
  diff -u -r1.147 -r1.148
  --- ChangeLog	13 Dec 2003 14:58:50 -0000	1.147
  +++ ChangeLog	13 Dec 2003 20:42:26 -0000	1.148
  @@ -1,5 +1,11 @@
   2003-12-13  David N. Welton  <da...@dedasys.com>
   
  +	* src/rivetParser.c (Rivet_Parser): "export" function in that it's
  +	no longer static.
  +
  +	* src/parserPkgInit.c (Parse_RivetData): New alpha-ish command to
  +	parse data passed to the script.
  +
   	* src/configure.in.tcl: Merge apxs and Tcl CFLAGS in order to
   	include what we need from both.  Hopefully there won't be any
   	conflicts.
  
  
  
  1.22      +2 -0      tcl-rivet/TODO
  
  Index: TODO
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/TODO,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- TODO	29 Sep 2003 13:09:33 -0000	1.21
  +++ TODO	13 Dec 2003 20:42:26 -0000	1.22
  @@ -57,6 +57,8 @@
   
   * Find a way of integrating the Tcl event loop?
   
  +* Document parser commands.
  +
   MAYBE
   =====
   
  
  
  
  1.3       +40 -2     tcl-rivet/src/parserPkgInit.c
  
  Index: parserPkgInit.c
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/src/parserPkgInit.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- parserPkgInit.c	5 Jul 2003 14:23:18 -0000	1.2
  +++ parserPkgInit.c	13 Dec 2003 20:42:26 -0000	1.3
  @@ -47,6 +47,38 @@
       return TCL_OK;
   }
   
  +static int
  +Parse_RivetData(ClientData clientData, Tcl_Interp *interp,
  +		int objc, Tcl_Obj *CONST objv[])
  +{
  +    int inside = 0;
  +    Tcl_Obj *outbuf;
  +
  +    outbuf = Tcl_NewObj();
  +
  +    if (objc != 2)
  +    {
  +	Tcl_WrongNumArgs(interp, 1, objv, "data");
  +	return TCL_ERROR;
  +    }
  +    Tcl_IncrRefCount(outbuf);
  +
  +    Tcl_AppendToObj(outbuf, "namespace eval request {\n", -1);
  +    Tcl_AppendToObj(outbuf, "puts -nonewline \"", -1);
  +
  +    inside = Rivet_Parser(outbuf, objv[1]);
  +
  +    if (inside == 0)
  +    {
  +	Tcl_AppendToObj(outbuf, "\"\n", 2);
  +    }
  +
  +    Tcl_AppendToObj(outbuf, "\n}\n", -1);
  +
  +    Tcl_SetObjResult(interp, outbuf);
  +    Tcl_DecrRefCount(outbuf);
  +    return TCL_OK;
  +}
   
   EXTERN int
   Rivetparser_Init( Tcl_Interp *interp )
  @@ -57,5 +89,11 @@
   			 NULL,
   			 (Tcl_CmdDeleteProc *)NULL);
   
  -    return Tcl_PkgProvide( interp, "rivetparser", "0.1" );
  +    Tcl_CreateObjCommand(interp,
  +			 "rivet::parserivetdata",
  +			 Parse_RivetData,
  +			 NULL,
  +			 (Tcl_CmdDeleteProc *)NULL);
  +
  +    return Tcl_PkgProvide( interp, "rivetparser", "0.2" );
   }
  
  
  
  1.11      +4 -4      tcl-rivet/src/rivetParser.c
  
  Index: rivetParser.c
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/src/rivetParser.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- rivetParser.c	30 Sep 2003 18:27:47 -0000	1.10
  +++ rivetParser.c	13 Dec 2003 20:42:26 -0000	1.11
  @@ -12,7 +12,7 @@
   #include <tcl.h>
   #include "rivetParser.h"
   
  -static int Rivet_Parser(Tcl_Obj *outbuf, Tcl_Obj *inbuf);
  +int Rivet_Parser(Tcl_Obj *outbuf, Tcl_Obj *inbuf);
   
   /*
    *-----------------------------------------------------------------------------
  @@ -140,7 +140,7 @@
    *-----------------------------------------------------------------------------
    */
   
  -static int
  +int
   Rivet_Parser(Tcl_Obj *outbuf, Tcl_Obj *inbuf)
   {
       char *next;
  @@ -219,7 +219,7 @@
   	    {
   		if ((++p) == endseqlen)
   		{
  -		    Tcl_AppendToObj(outbuf, "\n puts -nonewline \"", -1);
  +		    Tcl_AppendToObj(outbuf, "\nputs -nonewline \"", -1);
   		    inside = 0;
   		    p = 0;
   		}
  
  
  

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