You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by gr...@apache.org on 2003/05/29 16:15:54 UTC

cvs commit: httpd-python/src/include _pspmodule.h _apachemodule.h mod_python.h psp_flex.h psp_parser.h psp_string.h psp_interface.h

grisha      2003/05/29 07:15:53

  Modified:    dist     Makefile.in setup.py.in
               lib/python/mod_python psp.py
               src      Makefile.in _apachemodule.c mod_python.c
                        psp_parser.c psp_parser.l
               src/include _apachemodule.h mod_python.h psp_flex.h
                        psp_parser.h psp_string.h
  Added:       src      _pspmodule.c
               src/include _pspmodule.h
  Removed:     src      psp_interface.c
               src/include psp_interface.h
  Log:
  Mod_python package now includes _psp.so which is also built and
  installed using distutils and does not #include <mod_python.h>. This
  means it can be used from command line opening the door for us to
  write command-line tools to compile psp pages.
  
  psp.py has been greatly simplified. psp_interface.c renamed to
  _pspmodule.c to be consistent with everything else.
  
  The flex-generated psp_parser.c now supports the syntax whereby the
  last indent in Python code sticks (this has been better described on
  the dev list). I have not received any (constructive) negative (or any
  positive) feedback, so for now this is where we are.
  
  Revision  Changes    Path
  1.4       +9 -8      httpd-python/dist/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/httpd-python/dist/Makefile.in,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Makefile.in	30 Dec 2002 19:01:27 -0000	1.3
  +++ Makefile.in	29 May 2003 14:15:46 -0000	1.4
  @@ -62,7 +62,7 @@
   
   dist: unixdist
   
  -unixdist: mod_python 
  +unixdist: mod_python src 
   	@if [ ! -f dist/mod_python-$(MP_VERSION).tar.gz ]; then \
   		echo "Building a source distribution"; \
   		$(PYTHON_BIN) setup.py sdist; \
  @@ -74,13 +74,11 @@
   windist: mod_python.so
   	$(PYTHON_BIN) setup.py bdist_wininst --install-script=win32_postinstall.py
   
  +install: install_py_lib
  +
   # this may require root privilidges
  -install_py_lib: unixdist
  -	cd dist; \
  -	gunzip -c mod_python-$(MP_VERSION).tar.gz | tar xf -; \
  -	cd mod_python-$(MP_VERSION); \
  +install_py_lib: mod_python src
   	$(PYTHON_BIN) setup.py install --optimize 2 --force; \
  -	cd ..; rm -rf mod_python-$(MP_VERSION)
   
   mod_python.so:
   	@echo "Please place a WIN32 compiled mod_python.so in this directory"
  @@ -89,8 +87,11 @@
   mod_python:
   	ln -s ../lib/python/mod_python
   
  +src:
  +	ln -s ../src
  +
   clean:
   	rm -rf mod_python build dist
   
   distclean:
  -	rm -rf mod_python build dist mod_python.so setup.py Makefile MANIFEST MANIFSET.in
  +	rm -rf mod_python src build dist mod_python.so setup.py Makefile MANIFEST MANIFSET.in
  
  
  
  1.4       +17 -7     httpd-python/dist/setup.py.in
  
  Index: setup.py.in
  ===================================================================
  RCS file: /home/cvs/httpd-python/dist/setup.py.in,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- setup.py.in	30 Dec 2002 18:59:35 -0000	1.3
  +++ setup.py.in	29 May 2003 14:15:46 -0000	1.4
  @@ -4,13 +4,13 @@
   APXS = r"@APXS@"
   VER = "@MP_VERSION@"
   
  -from distutils.core import setup
  +from distutils.core import setup, Extension
   
   import sys
   
   if len(sys.argv) > 1 and sys.argv[1] == "bdist_wininst":
       moddir = ""
  -    mpso = "mod_python.so"
  +#    mpso = "mod_python.so"
   
       setup(name="mod_python",
             version=VER,
  @@ -24,9 +24,9 @@
             data_files=[(moddir, ["mod_python.so"])])
   
   else:
  -    import commands
  -    moddir = commands.getoutput("%s -q LIBEXECDIR" % APXS)
  -    mpso = "../src/mod_python.so"
  +#    import commands
  +#    moddir = commands.getoutput("%s -q LIBEXECDIR" % APXS)
  +#    mpso = "../src/mod_python.so"
   
       setup(name="mod_python",
             version=VER,
  @@ -34,7 +34,17 @@
             author="Gregory Trubetskoy et al",
             author_email="mod_python@modpython.org",
             url="http://www.modpython.org/",
  -          packages=["mod_python"])
  +          packages=["mod_python"],
  +          ext_modules=[Extension("mod_python._psp",
  +                                 ["src/psp_string.c",
  +                                  "src/psp_parser.c",
  +                                  "src/_pspmodule.c"],
  +                                 include_dirs=["src/include"],
  +                                 libraries=["l"]
  +                                 )
  +                       ]
  +          )
  +          
   
   
   # makes emacs go into python mode
  
  
  
  1.4       +12 -30    httpd-python/lib/python/mod_python/psp.py
  
  Index: psp.py
  ===================================================================
  RCS file: /home/cvs/httpd-python/lib/python/mod_python/psp.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- psp.py	24 May 2003 03:56:40 -0000	1.3
  +++ psp.py	29 May 2003 14:15:47 -0000	1.4
  @@ -52,43 +52,25 @@
    # information on the Apache Software Foundation, please see
    # <http://www.apache.org/>.
    #
  + # This file originally written by Sterling Hughes
  + #
    # $Id$
   
  -import mod_python
  +from mod_python import apache
   import sys
   import _psp
   
  -class psp:
  -	def parse(self, filename):
  -		return _psp.parse(filename)
  -
  -	def execute(self, code):
  -		exec code
  -
  -	parse = classmethod(parse)
  -	execute = classmethod(execute)
  -
  -class _stream:
  -	def __init__(self, request):
  -		self.old_stdout = sys.stdout
  -		self.req = request
  -	
  -	def close(self):
  -		sys.stdout = self.old_stdout
  -	
  -	def write(self, text):
  -		self.req.write(text)
  -
  -def handler(request):
  -	global req
  +def parse(filename):
   
  -	request.content_type = "text/html"
  +        return _psp.parse(req.filename)
   
  -#	sys.stdout = _stream(request)
  +def handler(req):
   
  -	req = request
  -	code = psp.parse(request.filename)
  +	source = _psp.parse(req.filename)
   
  -	psp.execute(code)
  +        code = compile(source, req.filename, "exec")
  +
  +        # give it it's own locals
  +        exec code in globals(), {"req":req}
   
   	return mod_python.apache.OK
  
  
  
  1.31      +2 -2      httpd-python/src/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/Makefile.in,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Makefile.in	24 May 2003 03:55:27 -0000	1.30
  +++ Makefile.in	29 May 2003 14:15:47 -0000	1.31
  @@ -70,12 +70,12 @@
   srcdir=.
   
   SRCS=	mod_python.c _apachemodule.c requestobject.c tableobject.c util.c \
  -		psp_string.c psp_parser.c psp_interface.c \
  +		psp_string.c psp_parser.c psp_parser.c _pspmodule.c \
   		serverobject.c connobject.c filterobject.c hlist.c hlistobject.c
   
   all:	@ALL@
   
  -psp_parser.c:
  +psp_parser.c: psp_parser.l
   	$(LEX) -R -opsp_parser.c --header-file=include/psp_flex.h psp_parser.l
   
   dso:	mod_python.so
  
  
  
  1.21      +2 -2      httpd-python/src/_apachemodule.c
  
  Index: _apachemodule.c
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/_apachemodule.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- _apachemodule.c	8 Nov 2002 00:15:11 -0000	1.20
  +++ _apachemodule.c	29 May 2003 14:15:47 -0000	1.21
  @@ -412,5 +412,5 @@
   
   PyObject *get_ServerReturn() 
   {
  -  return Mp_ServerReturn;
  +    return Mp_ServerReturn;
   }
  
  
  
  1.90      +1 -2      httpd-python/src/mod_python.c
  
  Index: mod_python.c
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/mod_python.c,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- mod_python.c	24 May 2003 03:55:27 -0000	1.89
  +++ mod_python.c	29 May 2003 14:15:47 -0000	1.90
  @@ -124,7 +124,6 @@
        */
       /* Py_InitModule("_apache", _apache_module_methods); */
       init_apache();
  -	_psp_module_init();
   
       /* Now execute the equivalent of
        * >>> import <module>
  
  
  
  1.5       +103 -231  httpd-python/src/psp_parser.c
  
  Index: psp_parser.c
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/psp_parser.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- psp_parser.c	24 May 2003 03:55:27 -0000	1.4
  +++ psp_parser.c	29 May 2003 14:15:48 -0000	1.5
  @@ -340,8 +340,8 @@
   	*yy_cp = '\0'; \
   	yyg->yy_c_buf_p = yy_cp;
   
  -#define YY_NUM_RULES 16
  -#define YY_END_OF_BUFFER 17
  +#define YY_NUM_RULES 13
  +#define YY_END_OF_BUFFER 14
   /* This struct is not used in this scanner,
      but its presence is necessary. */
   struct yy_trans_info
  @@ -349,12 +349,11 @@
   	flex_int32_t yy_verify;
   	flex_int32_t yy_nxt;
   	};
  -static yyconst flex_int16_t yy_accept[39] =
  +static yyconst flex_int16_t yy_accept[30] =
       {   0,
  -        0,    0,    0,    0,    0,    0,    0,    0,    0,   14,
  -       17,    1,   16,    5,    2,    2,    5,   11,    6,    6,
  -       11,   11,    7,    8,   13,   13,   15,   14,    4,    0,
  -        9,    8,    0,   14,    3,   10,   12,    0
  +        0,    0,    0,    0,    0,    0,    0,   10,   14,    1,
  +       13,    5,    4,    4,    5,    9,    6,    6,    9,    8,
  +       12,   12,   10,    3,    7,   11,   10,    2,    0
       } ;
   
   static yyconst flex_int32_t yy_ec[256] =
  @@ -362,17 +361,17 @@
           1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
           1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
           1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  -        1,    5,    1,    6,    1,    1,    7,    1,    1,    1,
  +        1,    2,    1,    1,    1,    1,    5,    1,    1,    1,
           1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  -        1,    1,    1,    1,    1,    1,    1,    1,    1,    8,
  -        9,   10,    1,    1,    1,    1,    1,    1,    1,    1,
  +        1,    1,    1,    1,    1,    1,    1,    6,    1,    7,
  +        8,    9,    1,    1,    1,    1,    1,    1,    1,    1,
           1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
           1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
           1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
   
           1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
           1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  -        1,    1,   11,    1,   12,    1,    1,    1,    1,    1,
  +        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
           1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
           1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
           1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  @@ -389,50 +388,43 @@
           1,    1,    1,    1,    1
       } ;
   
  -static yyconst flex_int32_t yy_meta[13] =
  +static yyconst flex_int32_t yy_meta[10] =
       {   0,
  -        1,    2,    1,    1,    2,    1,    1,    1,    1,    1,
  -        1,    1
  +        1,    1,    1,    1,    1,    1,    1,    1,    1
       } ;
   
  -static yyconst flex_int16_t yy_base[44] =
  +static yyconst flex_int16_t yy_base[33] =
       {   0,
  -       46,   45,    0,    6,   14,    0,   24,   28,   44,   33,
  -       37,   50,   50,   50,   50,   50,   26,   50,   50,   50,
  -       26,   19,   50,   23,   50,    7,   50,    0,    3,    5,
  -       50,    2,    0,    0,   50,   50,   50,   50,   38,   40,
  -       42,   44,    0
  +       29,   28,    0,    5,   12,    0,   19,   23,   30,   33,
  +       33,   33,   33,   33,   24,   33,   33,   33,   18,   33,
  +       33,   14,    9,    2,   33,   33,    4,   33,   33,    4,
  +        1,    0
       } ;
   
  -static yyconst flex_int16_t yy_def[44] =
  +static yyconst flex_int16_t yy_def[33] =
       {   0,
  -       39,   39,   40,   40,   38,    5,   41,   41,   42,   42,
  -       38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
  -       38,   38,   38,   38,   38,   38,   38,   43,   38,   38,
  -       38,   38,   38,   43,   38,   38,   38,    0,   38,   38,
  -       38,   38,   38
  +       30,   30,   31,   31,   29,    5,   32,   32,   29,   29,
  +       29,   29,   29,   29,   29,   29,   29,   29,   29,   29,
  +       29,   29,   29,   29,   29,   29,   29,   29,    0,   29,
  +       29,   29
       } ;
   
  -static yyconst flex_int16_t yy_nxt[63] =
  +static yyconst flex_int16_t yy_nxt[43] =
       {   0,
  -       38,   34,   15,   16,   38,   37,   32,   17,   15,   16,
  -       36,   35,   33,   17,   18,   18,   19,   20,   18,   21,
  -       22,   18,   18,   18,   23,   24,   13,   32,   31,   26,
  -       13,   30,   29,   26,   28,   13,   38,   28,   12,   12,
  -       14,   14,   25,   25,   27,   27,   13,   13,   13,   11,
  -       38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
  -       38,   38
  +       21,   12,   13,   14,   10,   27,   15,   13,   14,   28,
  +       27,   15,   16,   16,   17,   18,   19,   20,   16,   16,
  +       16,   11,   26,   22,   23,   11,   25,   22,   24,   29,
  +       11,   11,    9,   29,   29,   29,   29,   29,   29,   29,
  +       29,   29
       } ;
   
  -static yyconst flex_int16_t yy_chk[63] =
  +static yyconst flex_int16_t yy_chk[43] =
       {   0,
  -        0,   43,    3,    3,    0,   33,   32,    3,    4,    4,
  -       30,   29,   26,    4,    5,    5,    5,    5,    5,    5,
  -        5,    5,    5,    5,    5,    5,    7,   24,   22,    7,
  -        8,   21,   17,    8,   10,   10,   11,   10,   39,   39,
  -       40,   40,   41,   41,   42,   42,    9,    2,    1,   38,
  -       38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
  -       38,   38
  +       32,   31,    3,    3,   30,   27,    3,    4,    4,   24,
  +       23,    4,    5,    5,    5,    5,    5,    5,    5,    5,
  +        5,    7,   22,    7,    8,    8,   19,    8,   15,    9,
  +        2,    1,   29,   29,   29,   29,   29,   29,   29,   29,
  +       29,   29
       } ;
   
   /* The intent behind this definition is that it'll catch
  @@ -500,40 +492,11 @@
    *
    * $Id$
    *
  - * This file originally by Sterling Hughes.
  + * This file originally written by Sterling Hughes.
    * 
    */
   
  -/* 
  - * Briefly we are dealing with five modes here:
  - * 0 (INITIAL) - we print a little header, req.print(""" and 
  - *   immeditely enter TEXT mode.
  - * TEXT - this is your plain old HTML or whatever is in the file.
  - *   We copy everything into ob, if we see eol, we flush ob to
  - *   pycode. If we see <% or <%= we enter PYCODE mode.
  - * PYCODE - we are inside Python code. Copy everithing similar
  - *   TEXT, but watch out for the following:
  - *     { - means "simlated" block. We increment in_block counter.
  - *         from here on any python code will be indented in_block
  - *         times.
  - *     } - decrement in_block
  - *     ", ' or """ - enter STRING mode
  - * STRING - Copy stuff over, but watch out for a backslash. A backslash
  - *   sets the escape flag, so a closing quote is ignored. The """ case is
  - *   a bit more complex.
  - * INDENT - we left Python code after encountering %> and are
  - *   now in the indent before the first non-whitespace char, e.g.
  - *
  - *   %>
  - *   ....<h1>hello</h1>
  - *
  - *   The space represented by dots above is in INDENT. If in block, 
  - *   we output whitespace, else, just pass blanks through.
  - *   Then print req.write(""" and enter TEXT mode.
  - */
  -
   #include "psp_parser.h"
  -#include <stdio.h>
   
   #define OUTPUT_WHITESPACE(__wsstring) \
   	psp_string_0((__wsstring)); \
  @@ -544,14 +507,12 @@
   
   
   
  -
  -#line 549 "psp_parser.c"
  +#line 511 "psp_parser.c"
   
   #define INITIAL 0
   #define TEXT 1
   #define PYCODE 2
  -#define STRING 3
  -#define INDENT 4
  +#define INDENT 3
   
   /* Special case for "unistd.h", since it is non-ANSI. We include it way
    * down here because we want the user's section 1 to have been scanned first.
  @@ -765,10 +726,10 @@
   	register int yy_act;
       struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   
  -#line 106 "psp_parser.l"
  +#line 76 "psp_parser.l"
   
   
  -#line 772 "psp_parser.c"
  +#line 733 "psp_parser.c"
   
   	if ( yyg->yy_init )
   		{
  @@ -822,13 +783,13 @@
   			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
   				{
   				yy_current_state = (int) yy_def[yy_current_state];
  -				if ( yy_current_state >= 39 )
  +				if ( yy_current_state >= 30 )
   					yy_c = yy_meta[(unsigned int) yy_c];
   				}
   			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
   			++yy_cp;
   			}
  -		while ( yy_base[yy_current_state] != 50 );
  +		while ( yy_base[yy_current_state] != 33 );
   
   yy_find_action:
   		yy_act = yy_accept[yy_current_state];
  @@ -854,12 +815,10 @@
   
   case 1:
   YY_RULE_SETUP
  -#line 108 "psp_parser.l"
  +#line 78 "psp_parser.l"
   {
  -    psp_string_0(&PSP_PG(ob));
  -    psp_string_appendl(&PSP_PG(pycode), STATIC_STR("#\n# This is file is auto-generated by mod_python PSP.\n#\n")); 
  +    psp_string_appendl(&PSP_PG(pycode), STATIC_STR("#\n# This file is auto-generated by mod_python PSP.\n#\n")); 
       psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\nreq.write(\"\"\"")); 
  -    psp_string_free(&PSP_PG(ob));
   
       yyless(0);
   
  @@ -867,72 +826,46 @@
   }
   	YY_BREAK
   case 2:
  -/* rule 2 can match eol */
   YY_RULE_SETUP
  -#line 119 "psp_parser.l"
  -{ 
  -    if (PSP_PG(ob).length) { 
  -        psp_string_0(&PSP_PG(ob)); 
  -        psp_string_appendl(&PSP_PG(pycode), PSP_PG(ob).blob, PSP_PG(ob).length); 
  -        psp_string_free(&PSP_PG(ob)); 
  -    }  
  +#line 87 "psp_parser.l"
  +{
  +        psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\"); req.write(str("));
  +	PSP_PG(is_psp_echo) = 1;
   
  -    psp_string_appendc(&PSP_PG(pycode), yytext[0]);
  -} 
  +	BEGIN PYCODE;
  +}
   	YY_BREAK
   case 3:
   YY_RULE_SETUP
  -#line 129 "psp_parser.l"
  +#line 94 "psp_parser.l"
   {
  -	if (PSP_PG(ob).length) {
  -		psp_string_0(&PSP_PG(ob));
  -		psp_string_appendl(&PSP_PG(pycode), PSP_PG(ob).blob, PSP_PG(ob).length);
  -		psp_string_free(&PSP_PG(ob));
  -	}
  -        psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\")\n"));
  -
  -	OUTPUT_WHITESPACE(&PSP_PG(whitespace));
  -	psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write("));
  -	PSP_PG(is_psp_echo) = 1;
  +        psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\")\n\n")); 
   
   	BEGIN PYCODE;
   }
   	YY_BREAK
   case 4:
  +/* rule 4 can match eol */
   YY_RULE_SETUP
  -#line 144 "psp_parser.l"
  +#line 100 "psp_parser.l"
   {
  -	if (PSP_PG(ob).length) { 
  -		psp_string_0(&PSP_PG(ob));
  -		psp_string_appendl(&PSP_PG(pycode), PSP_PG(ob).blob, PSP_PG(ob).length);
  -		psp_string_free(&PSP_PG(ob));
  -	}  
  -        psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\")\n\n")); 
  -	CLEAR_WHITESPACE(&PSP_PG(whitespace));
  -
  -	BEGIN PYCODE;
  +	psp_string_appendc(&PSP_PG(pycode), '\n');
   }
   	YY_BREAK
   case 5:
   YY_RULE_SETUP
  -#line 156 "psp_parser.l"
  +#line 104 "psp_parser.l"
   {
   	if (yytext[0] == '"') {
  -		psp_string_appendl(&PSP_PG(ob), STATIC_STR("\\\""));
  +		psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\\\""));
   	} else {
  -		psp_string_appendc(&PSP_PG(ob), yytext[0]);
  +		psp_string_appendc(&PSP_PG(pycode), yytext[0]);
   	}
   }
   	YY_BREAK
   case YY_STATE_EOF(TEXT):
  -#line 164 "psp_parser.l"
  +#line 112 "psp_parser.l"
   {
  -    if (PSP_PG(ob).length) {
  -        psp_string_0(&PSP_PG(ob));
  -        OUTPUT_WHITESPACE(&PSP_PG(whitespace));
  -        psp_string_appendl(&PSP_PG(pycode), PSP_PG(ob).blob, PSP_PG(ob).length);
  -        psp_string_free(&PSP_PG(ob));
  -    }
       psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\")\n"));
       yyterminate();
   }
  @@ -940,150 +873,89 @@
   case 6:
   /* rule 6 can match eol */
   YY_RULE_SETUP
  -#line 175 "psp_parser.l"
  +#line 117 "psp_parser.l"
   {
   	psp_string_appendc(&PSP_PG(pycode), '\n');
  +
  +        BEGIN INDENT;
   }
   	YY_BREAK
   case 7:
   YY_RULE_SETUP
  -#line 179 "psp_parser.l"
  +#line 123 "psp_parser.l"
   {
  -	psp_string_appendc(&PSP_PG(whitespace), '\t');
  -	PSP_PG(in_block)++;
  +
  +	if (PSP_PG(is_psp_echo)) {
  +            psp_string_appendl(&PSP_PG(pycode), STATIC_STR(")); req.write(\"\"\""));
  +            PSP_PG(is_psp_echo) = 0;
  +	} 
  +        else {
  +            if (PSP_PG(after_colon)) {
  +                /* this is dumb mistake-proof measure, if %> 
  +                   is immediately following where there should be an indent */
  +                psp_string_appendc(&PSP_PG(whitespace), '\t');
  +            }
  +            OUTPUT_WHITESPACE(&PSP_PG(whitespace));
  +            psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\""));
  +        }
  +
  +        BEGIN TEXT;
   }
   	YY_BREAK
   case 8:
   YY_RULE_SETUP
  -#line 184 "psp_parser.l"
  +#line 142 "psp_parser.l"
   {
  -	CLEAR_WHITESPACE(&PSP_PG(whitespace));
  -	PSP_PG(in_block)--;
  -	if (PSP_PG(in_block) < 0) {
  -		PSP_PG(in_block) = 0;
  -	}
  +        psp_string_appendc(&PSP_PG(pycode), yytext[0]);
  +	PSP_PG(after_colon) = 1;
   }
   	YY_BREAK
   case 9:
   YY_RULE_SETUP
  -#line 192 "psp_parser.l"
  +#line 147 "psp_parser.l"
   {
  -	if (PSP_PG(is_psp_echo)) {
  -		psp_string_appendc(&PSP_PG(pycode), ')'); 
  -		PSP_PG(is_psp_echo) = 0;
  -	} 
  -
  -        BEGIN INDENT;
  +        psp_string_appendc(&PSP_PG(pycode), yytext[0]);
  +        PSP_PG(after_colon) = 0;
   }
   	YY_BREAK
   case 10:
   YY_RULE_SETUP
  -#line 201 "psp_parser.l"
  +#line 152 "psp_parser.l"
   {
  -        PSP_PG(string_char) = '3';
  +
  +        CLEAR_WHITESPACE(&PSP_PG(whitespace)); 
  +        psp_string_appendl(&PSP_PG(whitespace), yytext, yyleng);
           psp_string_appendl(&PSP_PG(pycode), yytext, yyleng);
   
  -        BEGIN STRING;
  +        BEGIN PYCODE;
   }
   	YY_BREAK
   case 11:
   YY_RULE_SETUP
  -#line 208 "psp_parser.l"
  +#line 161 "psp_parser.l"
   {
  -        if (yytext[0] == '"' || yytext[0] == '\'') {
  -                PSP_PG(string_char) = yytext[0];
  -                BEGIN STRING;
  -        }	
  -        psp_string_appendc(&PSP_PG(pycode), yytext[0]);
  +    yyless(0);
  +    BEGIN PYCODE;
   }
   	YY_BREAK
   case 12:
   YY_RULE_SETUP
  -#line 216 "psp_parser.l"
  -{
  -        if (PSP_PG(string_char) == '3') {
  -                if (!PSP_PG(is_string_escape)) {
  -                    psp_string_appendl(&PSP_PG(pycode), yytext, yyleng);
  -                    BEGIN PYCODE;
  -                }
  -                else {
  -                    psp_string_appendc(&PSP_PG(pycode), '"');
  -                    yyless(1);
  -                }
  -        }
  -        PSP_PG(is_string_escape) = 0;
  -}
  -	YY_BREAK
  -case 13:
  -YY_RULE_SETUP
  -#line 230 "psp_parser.l"
  +#line 166 "psp_parser.l"
   {
  -	if (yytext[0] == '\\') {
  -		PSP_PG(is_string_escape) = 1;
  -	} else {
  -		if (yytext[0] == PSP_PG(string_char)) {
  -			if (!PSP_PG(is_string_escape)) {
  -				BEGIN PYCODE;
  -			}
  -		}
  -		PSP_PG(is_string_escape) = 0;
  -	}
  -	
  -	psp_string_appendc(&PSP_PG(pycode), yytext[0]);
  -}
  -	YY_BREAK
  -case 14:
  -YY_RULE_SETUP
  -#line 245 "psp_parser.l"
  -{
  -        psp_string_appendc(&PSP_PG(pycode), '\n'); 
   
  -        if (PSP_PG(in_block)) {
  -                OUTPUT_WHITESPACE(&PSP_PG(whitespace));
  -        }
  -        else {
  -                CLEAR_WHITESPACE(&PSP_PG(whitespace)); 
  -		psp_string_appendl(&PSP_PG(whitespace), yytext, yyleng);
  -		psp_string_appendl(&PSP_PG(pycode), yytext, yyleng);
  -	}
  -        psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\""));
  -
  -        BEGIN TEXT;
  -}
  -	YY_BREAK
  -case 15:
  -YY_RULE_SETUP
  -#line 261 "psp_parser.l"
  -{
  -    psp_string_appendc(&PSP_PG(pycode), '\n'); 
  -
  -    if (PSP_PG(in_block)) {
  -        OUTPUT_WHITESPACE(&PSP_PG(whitespace));
  -    }
  -    else {
           CLEAR_WHITESPACE(&PSP_PG(whitespace)); 
  -    }
  -
  -    psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\""));
  -
  -    if (yytext[0] == '"') {
  -        psp_string_appendl(&PSP_PG(ob), STATIC_STR("\\\""));
  -    } else {
  -        psp_string_appendc(&PSP_PG(ob), yytext[0]);
  -    }
  -    
  -    BEGIN TEXT;
  +        yyless(0);
  +        BEGIN PYCODE;
   }
   	YY_BREAK
  -case 16:
  +case 13:
   YY_RULE_SETUP
  -#line 282 "psp_parser.l"
  +#line 173 "psp_parser.l"
   ECHO;
   	YY_BREAK
  -#line 1084 "psp_parser.c"
  +#line 957 "psp_parser.c"
   case YY_STATE_EOF(INITIAL):
   case YY_STATE_EOF(PYCODE):
  -case YY_STATE_EOF(STRING):
   case YY_STATE_EOF(INDENT):
   	yyterminate();
   
  @@ -1370,7 +1242,7 @@
   		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
   			{
   			yy_current_state = (int) yy_def[yy_current_state];
  -			if ( yy_current_state >= 39 )
  +			if ( yy_current_state >= 30 )
   				yy_c = yy_meta[(unsigned int) yy_c];
   			}
   		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  @@ -1399,11 +1271,11 @@
   	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
   		{
   		yy_current_state = (int) yy_def[yy_current_state];
  -		if ( yy_current_state >= 39 )
  +		if ( yy_current_state >= 30 )
   			yy_c = yy_meta[(unsigned int) yy_c];
   		}
   	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  -	yy_is_jam = (yy_current_state == 38);
  +	yy_is_jam = (yy_current_state == 29);
   
   	return yy_is_jam ? 0 : yy_current_state;
   }
  @@ -2199,7 +2071,7 @@
   #undef YY_DECL_IS_OURS
   #undef YY_DECL
   #endif
  -#line 282 "psp_parser.l"
  +#line 173 "psp_parser.l"
   
   
   
  
  
  
  1.5       +38 -147   httpd-python/src/psp_parser.l
  
  Index: psp_parser.l
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/psp_parser.l,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- psp_parser.l	24 May 2003 03:55:27 -0000	1.4
  +++ psp_parser.l	29 May 2003 14:15:48 -0000	1.5
  @@ -59,36 +59,7 @@
    * 
    */
   
  -/* 
  - * Briefly we are dealing with five modes here:
  - * 0 (INITIAL) - we print a little header, req.print(""" and 
  - *   immeditely enter TEXT mode.
  - * TEXT - this is your plain old HTML or whatever is in the file.
  - *   We copy everything into ob, if we see eol, we flush ob to
  - *   pycode. If we see <% or <%= we enter PYCODE mode.
  - * PYCODE - we are inside Python code. Copy everithing similar
  - *   TEXT, but watch out for the following:
  - *     { - means "simlated" block. We increment in_block counter.
  - *         from here on any python code will be indented in_block
  - *         times.
  - *     } - decrement in_block
  - *     ", ' or """ - enter STRING mode
  - * STRING - Copy stuff over, but watch out for a backslash. A backslash
  - *   sets the escape flag, so a closing quote is ignored. The """ case is
  - *   a bit more complex.
  - * INDENT - we left Python code after encountering %> and are
  - *   now in the indent before the first non-whitespace char, e.g.
  - *
  - *   %>
  - *   ....<h1>hello</h1>
  - *
  - *   The space represented by dots above is in INDENT. If in block, 
  - *   we output whitespace, else, just pass blanks through.
  - *   Then print req.write(""" and enter TEXT mode.
  - */
  -
   #include "psp_parser.h"
  -#include <stdio.h>
   
   #define OUTPUT_WHITESPACE(__wsstring) \
   	psp_string_0((__wsstring)); \
  @@ -100,183 +71,103 @@
   
   %x TEXT
   %x PYCODE
  -%x STRING
   %x INDENT
   
   %%
   
   . {
  -    psp_string_0(&PSP_PG(ob));
  -    psp_string_appendl(&PSP_PG(pycode), STATIC_STR("#\n# This is file is auto-generated by mod_python PSP.\n#\n")); 
  +    psp_string_appendl(&PSP_PG(pycode), STATIC_STR("#\n# This file is auto-generated by mod_python PSP.\n#\n")); 
       psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\nreq.write(\"\"\"")); 
  -    psp_string_free(&PSP_PG(ob));
   
       yyless(0);
   
       BEGIN TEXT;
   }
   
  -<TEXT>[\r\n] { 
  -    if (PSP_PG(ob).length) { 
  -        psp_string_0(&PSP_PG(ob)); 
  -        psp_string_appendl(&PSP_PG(pycode), PSP_PG(ob).blob, PSP_PG(ob).length); 
  -        psp_string_free(&PSP_PG(ob)); 
  -    }  
  -
  -    psp_string_appendc(&PSP_PG(pycode), yytext[0]);
  -} 
  -
   <TEXT>"<%=" {
  -	if (PSP_PG(ob).length) {
  -		psp_string_0(&PSP_PG(ob));
  -		psp_string_appendl(&PSP_PG(pycode), PSP_PG(ob).blob, PSP_PG(ob).length);
  -		psp_string_free(&PSP_PG(ob));
  -	}
  -        psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\")\n"));
  -
  -	OUTPUT_WHITESPACE(&PSP_PG(whitespace));
  -	psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write("));
  +        psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\"); req.write(str("));
   	PSP_PG(is_psp_echo) = 1;
   
   	BEGIN PYCODE;
   }
   
   <TEXT>"<%" {
  -	if (PSP_PG(ob).length) { 
  -		psp_string_0(&PSP_PG(ob));
  -		psp_string_appendl(&PSP_PG(pycode), PSP_PG(ob).blob, PSP_PG(ob).length);
  -		psp_string_free(&PSP_PG(ob));
  -	}  
           psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\")\n\n")); 
  -	CLEAR_WHITESPACE(&PSP_PG(whitespace));
   
   	BEGIN PYCODE;
   }
   
  +<TEXT>[\r\n] {
  +	psp_string_appendc(&PSP_PG(pycode), '\n');
  +}
  +
   <TEXT>. {
   	if (yytext[0] == '"') {
  -		psp_string_appendl(&PSP_PG(ob), STATIC_STR("\\\""));
  +		psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\\\""));
   	} else {
  -		psp_string_appendc(&PSP_PG(ob), yytext[0]);
  +		psp_string_appendc(&PSP_PG(pycode), yytext[0]);
   	}
   }
   
   <TEXT><<EOF>> {
  -    if (PSP_PG(ob).length) {
  -        psp_string_0(&PSP_PG(ob));
  -        OUTPUT_WHITESPACE(&PSP_PG(whitespace));
  -        psp_string_appendl(&PSP_PG(pycode), PSP_PG(ob).blob, PSP_PG(ob).length);
  -        psp_string_free(&PSP_PG(ob));
  -    }
       psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\")\n"));
       yyterminate();
   }
   
   <PYCODE>[\r\n] {
   	psp_string_appendc(&PSP_PG(pycode), '\n');
  -}
  -
  -<PYCODE>"{" {
  -	psp_string_appendc(&PSP_PG(whitespace), '\t');
  -	PSP_PG(in_block)++;
  -}
   
  -<PYCODE>"}"([ ])* {
  -	CLEAR_WHITESPACE(&PSP_PG(whitespace));
  -	PSP_PG(in_block)--;
  -	if (PSP_PG(in_block) < 0) {
  -		PSP_PG(in_block) = 0;
  -	}
  +        BEGIN INDENT;
   }
   
   <PYCODE>"%>" {
  +
   	if (PSP_PG(is_psp_echo)) {
  -		psp_string_appendc(&PSP_PG(pycode), ')'); 
  -		PSP_PG(is_psp_echo) = 0;
  +            psp_string_appendl(&PSP_PG(pycode), STATIC_STR(")); req.write(\"\"\""));
  +            PSP_PG(is_psp_echo) = 0;
   	} 
  +        else {
  +            if (PSP_PG(after_colon)) {
  +                /* this is dumb mistake-proof measure, if %> 
  +                   is immediately following where there should be an indent */
  +                psp_string_appendc(&PSP_PG(whitespace), '\t');
  +            }
  +            OUTPUT_WHITESPACE(&PSP_PG(whitespace));
  +            psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\""));
  +        }
   
  -        BEGIN INDENT;
  +        BEGIN TEXT;
   }
   
  -<PYCODE>"\"\"\"" {
  -        PSP_PG(string_char) = '3';
  -        psp_string_appendl(&PSP_PG(pycode), yytext, yyleng);
  -
  -        BEGIN STRING;
  +<PYCODE>":" {
  +        psp_string_appendc(&PSP_PG(pycode), yytext[0]);
  +	PSP_PG(after_colon) = 1;
   }
   
   <PYCODE>. {
  -        if (yytext[0] == '"' || yytext[0] == '\'') {
  -                PSP_PG(string_char) = yytext[0];
  -                BEGIN STRING;
  -        }	
           psp_string_appendc(&PSP_PG(pycode), yytext[0]);
  -}
  -
  -<STRING>"\"\"\"" {
  -        if (PSP_PG(string_char) == '3') {
  -                if (!PSP_PG(is_string_escape)) {
  -                    psp_string_appendl(&PSP_PG(pycode), yytext, yyleng);
  -                    BEGIN PYCODE;
  -                }
  -                else {
  -                    psp_string_appendc(&PSP_PG(pycode), '"');
  -                    yyless(1);
  -                }
  -        }
  -        PSP_PG(is_string_escape) = 0;
  -}
  -
  -<STRING>. {
  -	if (yytext[0] == '\\') {
  -		PSP_PG(is_string_escape) = 1;
  -	} else {
  -		if (yytext[0] == PSP_PG(string_char)) {
  -			if (!PSP_PG(is_string_escape)) {
  -				BEGIN PYCODE;
  -			}
  -		}
  -		PSP_PG(is_string_escape) = 0;
  -	}
  -	
  -	psp_string_appendc(&PSP_PG(pycode), yytext[0]);
  +        PSP_PG(after_colon) = 0;
   }
   
   <INDENT>^[\t ]* {
  -        psp_string_appendc(&PSP_PG(pycode), '\n'); 
   
  -        if (PSP_PG(in_block)) {
  -                OUTPUT_WHITESPACE(&PSP_PG(whitespace));
  -        }
  -        else {
  -                CLEAR_WHITESPACE(&PSP_PG(whitespace)); 
  -		psp_string_appendl(&PSP_PG(whitespace), yytext, yyleng);
  -		psp_string_appendl(&PSP_PG(pycode), yytext, yyleng);
  -	}
  -        psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\""));
  +        CLEAR_WHITESPACE(&PSP_PG(whitespace)); 
  +        psp_string_appendl(&PSP_PG(whitespace), yytext, yyleng);
  +        psp_string_appendl(&PSP_PG(pycode), yytext, yyleng);
   
  -        BEGIN TEXT;
  +        BEGIN PYCODE;
  +}
  +
  +<INDENT>"%>" {
  +    yyless(0);
  +    BEGIN PYCODE;
   }
   
   <INDENT>. {
  -    psp_string_appendc(&PSP_PG(pycode), '\n'); 
   
  -    if (PSP_PG(in_block)) {
  -        OUTPUT_WHITESPACE(&PSP_PG(whitespace));
  -    }
  -    else {
           CLEAR_WHITESPACE(&PSP_PG(whitespace)); 
  -    }
  -
  -    psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\""));
  -
  -    if (yytext[0] == '"') {
  -        psp_string_appendl(&PSP_PG(ob), STATIC_STR("\\\""));
  -    } else {
  -        psp_string_appendc(&PSP_PG(ob), yytext[0]);
  -    }
  -    
  -    BEGIN TEXT;
  +        yyless(0);
  +        BEGIN PYCODE;
   }
   
   %%
  
  
  
  1.1                  httpd-python/src/_pspmodule.c
  
  Index: _pspmodule.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "mod_python", or "modpython", nor may these terms appear in their
   *    name, without prior written permission of the Apache Software
   *    Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * This file originally written by Stering Hughes
   * 
   * $Id: _pspmodule.c,v 1.1 2003/05/29 14:15:47 grisha Exp $
   *
   * See accompanying documentation and source code comments for
   * details.
   *
   */
  
  #include "psp_flex.h"
  #include "psp_parser.h"
  #include "psp_string.h"
  #include "_pspmodule.h"
  #include "Python.h"
  //#include "mod_python.h"
  
  static psp_parser_t *psp_parser_init(void)
  {
      psp_parser_t *parser;
  
      parser = (psp_parser_t *) malloc(sizeof(*parser));
  
      memset(&parser->pycode, 0, sizeof(psp_string));
      memset(&parser->whitespace, 0, sizeof(psp_string));
      parser->is_psp_echo = 0;
      parser->after_colon = 0;
  
      return parser;
  }
  
  static void psp_parser_cleanup(psp_parser_t *parser)
  {
      if (parser->pycode.allocated) {
          free(parser->pycode.blob);
      }
      
      if (parser->whitespace.allocated) {
          free(parser->whitespace.blob);
      }
      
      free(parser);
  }
  
  static char *psp_parser_gen_pycode(psp_parser_t *parser, char *filename)
  { 
      yyscan_t scanner;
      FILE *f;
      
      f = fopen(filename, "rb");
      if (f == NULL) {
          return NULL;
      }
      
      yylex_init(&scanner);
      yyset_in(f, scanner);
      yyset_extra(parser, scanner);
      yylex(scanner);
      yylex_destroy(scanner);
      
      fclose(f);
  
      psp_string_0(&parser->pycode);
  
      return parser->pycode.blob;
  }
  
  static PyObject * _psp_module_parse(PyObject *self, PyObject *argv)
  {
      PyObject *code;
      char     *filename;
      psp_parser_t  *parser;
      
      if (!PyArg_ParseTuple(argv, "s", &filename)) {
          return NULL;
      }
      
      parser = psp_parser_init();
      code  = psp_parser_gen_pycode(parser, filename);
      if (code) {
          code = PyString_FromString(code);
      }
      psp_parser_cleanup(parser);
      
      return code; 
  }
  
  struct PyMethodDef _psp_module_methods[] = {
      {"parse", (PyCFunction) _psp_module_parse, METH_VARARGS},
      {NULL, NULL}
  };
  
  void init_psp(void)
  {
      Py_InitModule("_psp", _psp_module_methods);
  }
  
  
  
  1.4       +2 -1      httpd-python/src/include/_apachemodule.h
  
  Index: _apachemodule.h
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/include/_apachemodule.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- _apachemodule.h	8 Nov 2002 00:15:11 -0000	1.3
  +++ _apachemodule.h	29 May 2003 14:15:49 -0000	1.4
  @@ -68,5 +68,6 @@
    */
   
   PyObject *get_ServerReturn(void);
  +void init_apache(void);
   
   #endif /* !Mp_APACHEMODULE_H */
  
  
  
  1.30      +3 -7      httpd-python/src/include/mod_python.h
  
  Index: mod_python.h
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/include/mod_python.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- mod_python.h	24 May 2003 03:55:27 -0000	1.29
  +++ mod_python.h	29 May 2003 14:15:52 -0000	1.30
  @@ -83,7 +83,6 @@
   #include "apr_lib.h"
   #include "apr_hash.h"
   #include "scoreboard.h"
  -#include "psp_parser.h"
   
   /* Python headers */
   /* this gets rid of some comile warnings */
  @@ -101,9 +100,6 @@
   #include <sys/socket.h>
   #endif
   
  -/* _apache initialization function */
  -void init_apache(void);
  -
   /* pool given to us in ChildInit. We use it for 
      server.register_cleanup() */
   extern apr_pool_t *child_init_pool;
  @@ -112,7 +108,6 @@
   extern module AP_MODULE_DECLARE_DATA python_module;
   
   #include "mpversion.h"
  -#include "_apachemodule.h"
   #include "util.h"
   #include "hlist.h"
   #include "hlistobject.h"
  @@ -121,7 +116,8 @@
   #include "connobject.h"
   #include "requestobject.h"
   #include "filterobject.h"
  -#include "psp_flex.h"
  +#include "_apachemodule.h"
  +#include "_pspmodule.h"
   
   /** Things specific to mod_python, as an Apache module **/
   
  
  
  
  1.2       +5 -6      httpd-python/src/include/psp_flex.h
  
  Index: psp_flex.h
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/include/psp_flex.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- psp_flex.h	24 May 2003 03:55:27 -0000	1.1
  +++ psp_flex.h	29 May 2003 14:15:52 -0000	1.2
  @@ -2,9 +2,9 @@
   #define yyHEADER_H 1
   #define yyIN_HEADER 1
   
  -#line 6 "include/flex.h"
  +#line 6 "include/psp_flex.h"
   
  -#line 8 "include/flex.h"
  +#line 8 "include/psp_flex.h"
   
   #define  YY_INT_ALIGNED short int
   
  @@ -212,8 +212,7 @@
   #define INITIAL 0
   #define TEXT 1
   #define PYCODE 2
  -#define STRING 3
  -#define INDENT 4
  +#define INDENT 3
   
   #endif
   
  @@ -317,9 +316,9 @@
   #undef YY_DECL_IS_OURS
   #undef YY_DECL
   #endif
  -#line 282 "psp_parser.l"
  +#line 173 "psp_parser.l"
   
   
  -#line 324 "include/flex.h"
  +#line 323 "include/psp_flex.h"
   #undef yyIN_HEADER
   #endif /* yyHEADER_H */
  
  
  
  1.3       +2 -5      httpd-python/src/include/psp_parser.h
  
  Index: psp_parser.h
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/include/psp_parser.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- psp_parser.h	24 May 2003 03:55:27 -0000	1.2
  +++ psp_parser.h	29 May 2003 14:15:52 -0000	1.3
  @@ -69,12 +69,9 @@
   typedef struct {
   /*	PyObject   *files;   XXX removed until cache is fixed */
   	psp_string  whitespace;	
  -	psp_string  ob;
   	psp_string  pycode;
  -	int         in_block;
  -	char        string_char;
   	unsigned    is_psp_echo : 1;
  -	unsigned    is_string_escape : 1;
  +        unsigned    after_colon : 1;
   } psp_parser_t;
   
   #endif /* __PSP_PARSER_H */
  
  
  
  1.2       +2 -1      httpd-python/src/include/psp_string.h
  
  Index: psp_string.h
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/include/psp_string.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- psp_string.h	9 Apr 2003 14:05:56 -0000	1.1
  +++ psp_string.h	29 May 2003 14:15:53 -0000	1.2
  @@ -60,6 +60,7 @@
   #define __PSP_STRING_H
   
   #include <stdlib.h>
  +#include <string.h>
   
   #ifndef PSP_STRING_BLOCK
   #define PSP_STRING_BLOCK 256
  
  
  
  1.1                  httpd-python/src/include/_pspmodule.h
  
  Index: _pspmodule.h
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "mod_python", or "modpython", nor may these terms appear in their
   *    name, without prior written permission of the Apache Software
   *    Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: _pspmodule.h,v 1.1 2003/05/29 14:15:52 grisha Exp $
   *
   */
  
  #ifndef __PSP_MODULE_H
  #define __PSP_MODULE_H
  
  void init_psp(void);
  
  #endif /* __PSP_MODULE_H */