You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_dtcl-cvs@tcl.apache.org by da...@apache.org on 2001/09/30 20:48:34 UTC

cvs commit: tcl-moddtcl/docs commands.html

davidw      01/09/30 11:48:34

  Modified:    .        mod_dtcl.c parser.c tcl_commands.c tcl_commands.h
               docs     commands.html
  Log:
  Added 'makeurl' command.
  
  Quote { and } - they were causing problems.
  
  Revision  Changes    Path
  1.49      +2 -1      tcl-moddtcl/mod_dtcl.c
  
  Index: mod_dtcl.c
  ===================================================================
  RCS file: /home/cvs/tcl-moddtcl/mod_dtcl.c,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- mod_dtcl.c	2001/09/05 12:01:22	1.48
  +++ mod_dtcl.c	2001/09/30 18:48:33	1.49
  @@ -57,7 +57,7 @@
    * originally written at the National Center for Supercomputing Applications,
    * University of Illinois, Urbana-Champaign.  */
   
  -/* $Id: mod_dtcl.c,v 1.48 2001/09/05 12:01:22 davidw Exp $  */
  +/* $Id: mod_dtcl.c,v 1.49 2001/09/30 18:48:33 davidw Exp $  */
   
   /* mod_dtcl.c by David Welton <da...@apache.org> - originally mod_include.  */
   /* See http://tcl.apache.org/mod_dtcl/credits.ttml for additional credits. */
  @@ -582,6 +582,7 @@
   static void tcl_create_commands(dtcl_server_conf *dsc)
   {
       Tcl_Interp *interp = dsc->server_interp;
  +    Tcl_CreateObjCommand(interp, "makeurl", MakeURL, NULL, (Tcl_CmdDeleteProc *)NULL);
       Tcl_CreateObjCommand(interp, "hputs", Hputs, NULL, (Tcl_CmdDeleteProc *)NULL);
       Tcl_CreateObjCommand(interp, "buffer_add", Buffer_Add, NULL, (Tcl_CmdDeleteProc *)NULL);
       Tcl_CreateObjCommand(interp, "buffered", Buffered, NULL, (Tcl_CmdDeleteProc *)NULL);
  
  
  
  1.4       +7 -1      tcl-moddtcl/parser.c
  
  Index: parser.c
  ===================================================================
  RCS file: /home/cvs/tcl-moddtcl/parser.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- parser.c	2001/09/02 14:04:16	1.3
  +++ parser.c	2001/09/30 18:48:33	1.4
  @@ -1,4 +1,4 @@
  -/* $Id: parser.c,v 1.3 2001/09/02 14:04:16 davidw Exp $
  +/* $Id: parser.c,v 1.4 2001/09/30 18:48:33 davidw Exp $
   
      Dtcl parser - doesn't really need any of the includes besides
      tcl.h.
  @@ -70,6 +70,12 @@
   		/* or else just put the char in outbuf  */
   		switch (c)
   		{
  +		case '{':
  +		    Tcl_DStringAppend(&dstr, "\\{", -1);
  +		    break;
  +		case '}':
  +		    Tcl_DStringAppend(&dstr, "\\}", -1);
  +		    break;
   		case '$':
   		    Tcl_DStringAppend(&dstr, "\\$", -1);
   		    break;
  
  
  
  1.18      +15 -0     tcl-moddtcl/tcl_commands.c
  
  Index: tcl_commands.c
  ===================================================================
  RCS file: /home/cvs/tcl-moddtcl/tcl_commands.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- tcl_commands.c	2001/09/05 12:01:22	1.17
  +++ tcl_commands.c	2001/09/30 18:48:33	1.18
  @@ -24,6 +24,21 @@
   
   #define POOL (globals->r->pool)
   
  +/* Make a self-referencing URL  */
  +
  +int MakeURL(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
  +{
  +    dtcl_interp_globals *globals = Tcl_GetAssocData(interp, "dtcl", NULL);
  +    
  +    if (objc != 2)
  +    {
  +	Tcl_WrongNumArgs(interp, 1, objv, "filename");
  +	return TCL_ERROR;	
  +    }
  +    Tcl_SetResult(interp, ap_construct_url(POOL, Tcl_GetString(objv[1]), globals->r), NULL);
  +    return TCL_OK;
  +}
  +
   /* Include and parse a file */
   
   int Parse(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
  
  
  
  1.5       +1 -0      tcl-moddtcl/tcl_commands.h
  
  Index: tcl_commands.h
  ===================================================================
  RCS file: /home/cvs/tcl-moddtcl/tcl_commands.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- tcl_commands.h	2001/06/21 17:47:12	1.4
  +++ tcl_commands.h	2001/09/30 18:48:33	1.5
  @@ -1,3 +1,4 @@
  +int MakeURL(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
   
   int Parse(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
   
  
  
  
  1.3       +9 -1      tcl-moddtcl/docs/commands.html
  
  Index: commands.html
  ===================================================================
  RCS file: /home/cvs/tcl-moddtcl/docs/commands.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- commands.html	2001/06/23 15:30:57	1.2
  +++ commands.html	2001/09/30 18:48:33	1.3
  @@ -1,5 +1,5 @@
   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  -    <!-- $Id: commands.html,v 1.2 2001/06/23 15:30:57 davidw Exp $ -->
  +    <!-- $Id: commands.html,v 1.3 2001/09/30 18:48:33 davidw Exp $ -->
   <html>
     <head>
       <title>mod_dtcl tcl commands</title>
  @@ -144,6 +144,14 @@
   	<code><b>headers set <i>headername value</i></b></code><br>
   
   	Set arbitrary header names and values.
  +      </li>
  +
  +      <li>
  +	<code><b>makeurl <i>filename</i></b></code><br>
  +
  +	Create a self referencing URL from a filename.  For example:
  +	<code>makeurl /tclp.gif</code> returns
  +	http://[hostname]:[port]/tclp.gif.
         </li>
   
         <li>