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 2001/10/19 10:39:40 UTC

cvs commit: tcl-rivet/src mod_rivet.c mod_rivet.h tcl_commands.c

davidw      01/10/19 01:39:40

  Modified:    .        ChangeLog
               src      mod_rivet.c mod_rivet.h tcl_commands.c
  Log:
  Fixed up problems with Parse command.
  
  Revision  Changes    Path
  1.2       +9 -0      tcl-rivet/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/ChangeLog,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ChangeLog	2001/09/30 18:56:45	1.1
  +++ ChangeLog	2001/10/19 08:39:39	1.2
  @@ -1,3 +1,12 @@
  +2001-10-19  David N. Welton  <da...@dedasys.com>
  +
  +	* src/mod_rivet.c (get_parse_exec_file): Fixed up problems with
  +	Parse command.
  +
  +2001-09-30  David N. Welton  <da...@dedasys.com>
  +
  +	* src/parser.c (rivet_parser): Quote { and } to avoid problems.
  +
   2001-09-23  David N. Welton  <da...@dedasys.com>
   
   	* Initial commit and cleanup of old mod_dtcl code.
  
  
  
  1.3       +29 -9     tcl-rivet/src/mod_rivet.c
  
  Index: mod_rivet.c
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/src/mod_rivet.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mod_rivet.c	2001/09/22 13:13:33	1.2
  +++ mod_rivet.c	2001/10/19 08:39:40	1.3
  @@ -57,7 +57,7 @@
    * originally written at the National Center for Supercomputing Applications,
    * University of Illinois, Urbana-Champaign.  */
   
  -/* $Id: mod_rivet.c,v 1.2 2001/09/22 13:13:33 davidw Exp $  */
  +/* $Id: mod_rivet.c,v 1.3 2001/10/19 08:39:40 davidw Exp $  */
   
   /* mod_rivet.c by David Welton <da...@apache.org> - originally mod_include.  */
   /* See http://tcl.apache.org/mod_rivet/credits.ttml for additional credits. */
  @@ -346,7 +346,7 @@
   
   /* This is a seperate function so that it may be called from 'Parse' */
   
  -int get_parse_exec_file(request_rec *r, rivet_server_conf *rsc, int toplevel)
  +int get_parse_exec_file(request_rec *r, rivet_server_conf *rsc, char *filename, int toplevel)
   {
       char *hashKey = NULL;
       int isNew = 0;
  @@ -356,12 +356,31 @@
       Tcl_HashEntry *entry = NULL;
       Tcl_Interp *interp = rsc->server_interp;
   
  +    time_t ctime;
  +    time_t mtime;
  +
  +    /* If toplevel is 0, we are being called from Parse, which means
  +       we need to get the information about the file ourselves. */
  +    if (toplevel == 0) 
  +    {
  +	int ret = 0;
  +	struct stat stat;
  +	ret = Tcl_Stat(filename, &stat);
  +	if (ret < 0)
  +	    return TCL_ERROR;
  +	ctime = stat.st_ctime;
  +	mtime = stat.st_mtime;
  +    } else {
  +	ctime = r->finfo.st_ctime;
  +	mtime = r->finfo.st_mtime;
  +    }
  +
       /* Look for the script's compiled version. If it's not found,
          create it. */
       if (*(rsc->cache_size))
       {
  -	hashKey = ap_psprintf(r->pool, "%s%lx%lx%d", r->filename,
  -			      r->finfo.st_mtime, r->finfo.st_ctime, toplevel);
  +	hashKey = ap_psprintf(r->pool, "%s%lx%lx%d", filename,
  +			      mtime, ctime, toplevel);
   	entry = Tcl_CreateHashEntry(rsc->objCache, hashKey, &isNew);
       }
       if (isNew || *(rsc->cache_size) == 0)
  @@ -369,13 +388,14 @@
   	outbuf = Tcl_NewObj();
   	Tcl_IncrRefCount(outbuf);
   
  -	if(!strcmp(r->content_type, "application/x-httpd-tcl"))
  +	if(!strcmp(r->content_type, "application/x-httpd-tcl") || toplevel == 0)
   	{
  -	    /* It's a TTML file  */
  -	    result = get_ttml_file(r, rsc, interp, r->filename, 1, outbuf);
  +	    /* It's a TTML file - which we always are if toplevel is
  +               0, meaning we are in the Parse command */
  +	    result = get_ttml_file(r, rsc, interp, filename, toplevel, outbuf);
   	} else {
   	    /* It's a plain Tcl file */
  -	    result = get_tcl_file(r, interp, r->filename, outbuf);
  +	    result = get_tcl_file(r, interp, filename, outbuf);
   	}
   	if (result != TCL_OK)
   	    return result;
  @@ -566,7 +586,7 @@
       }
   #endif /* USE_ONLY_UPLOAD_COMMAND == 1 */
   
  -    get_parse_exec_file(r, rsc, 1);
  +    get_parse_exec_file(r, rsc, r->filename, 1);
       /* reset globals  */
       *(rsc->buffer_output) = 0;
       *(rsc->headers_printed) = 0;
  
  
  
  1.2       +1 -1      tcl-rivet/src/mod_rivet.h
  
  Index: mod_rivet.h
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/src/mod_rivet.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mod_rivet.h	2001/09/19 13:12:58	1.1
  +++ mod_rivet.h	2001/10/19 08:39:40	1.2
  @@ -80,7 +80,7 @@
       ApacheRequest *req;         /* libapreq request  */
   } rivet_interp_globals;
   
  -int get_parse_exec_file(request_rec *r, rivet_server_conf *rsc, int toplevel);
  +int get_parse_exec_file(request_rec *r, rivet_server_conf *rsc, char *filename, int toplevel);
   int set_header_type(request_rec *, char *);
   int print_headers(request_rec *);
   int print_error(request_rec *, int, char *);
  
  
  
  1.3       +1 -1      tcl-rivet/src/tcl_commands.c
  
  Index: tcl_commands.c
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/src/tcl_commands.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- tcl_commands.c	2001/09/22 13:13:33	1.2
  +++ tcl_commands.c	2001/10/19 08:39:40	1.3
  @@ -67,7 +67,7 @@
   	Tcl_AddErrorInfo(interp, Tcl_PosixError(interp));
   	return TCL_ERROR;
       }
  -    if (get_parse_exec_file(globals->r, rsc, 0) == OK)
  +    if (get_parse_exec_file(globals->r, rsc, filename, 0) == OK)
   	return TCL_OK;
       else
   	return TCL_ERROR;