richter     01/03/06 20:54:49

  Modified:    .        Tag: Embperl2c Embperl.pm Embperl.xs Syntax.xs ep.h
                        epdat.h epmain.c epparse.c typemap
               Embperl  Tag: Embperl2c Syntax.pm
  Log:
  Embperl 2 - multiple syntaxes
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.118.4.23 +6 -3      embperl/Embperl.pm
  
  Index: Embperl.pm
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl.pm,v
  retrieving revision 1.118.4.22
  retrieving revision 1.118.4.23
  diff -u -r1.118.4.22 -r1.118.4.23
  --- Embperl.pm        2000/12/22 06:23:12     1.118.4.22
  +++ Embperl.pm        2001/03/07 04:54:41     1.118.4.23
  @@ -10,7 +10,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: Embperl.pm,v 1.118.4.22 2000/12/22 06:23:12 richter Exp $
  +#   $Id: Embperl.pm,v 1.118.4.23 2001/03/07 04:54:41 richter Exp $
   #
   ###################################################################################
   
  @@ -680,6 +680,7 @@
       $$req{'expired_func'}    = $ENV{EMBPERL_EXPIRES_FUNC} if (exists 
($ENV{EMBPERL_EXPIRES_FUNC})) ; ;
       $$req{'cache_key_func'}  = $ENV{EMBPERL_CACHE_KEY_FUNC} if (exists 
($ENV{EMBPERL_CACHE_KEY_FUNC})) ; ;
       $$req{'expires_in'}     = $ENV{EMBPERL_EXPIRES_IN} if (exists 
($ENV{EMBPERL_EXPIRES_IN})) ; ;
  +    $$req{'syntax'}         = $ENV{EMBPERL_SYNTAX} if (exists 
($ENV{EMBPERL_SYNTAX})) ; ;
       ##/ep2##
   
   
  @@ -846,11 +847,13 @@
           $mtime = 0 ;
        }
   
  -
  +    my $syntax = HTML::Embperl::Syntax::GetSyntax ($req -> {syntax} || 'Embperl') ;
  +        
       my $ar  ;
       $ar = Apache->request if (defined ($req_rec)) ; # workaround that 
Apache::Request has another C Interface, than Apache
       my $r = SetupRequest ($ar, $Inputfile, $mtime, $filesize, ($$req{firstline} || 
1), $Outputfile, $conf,
  -                          &epIOMod_Perl, $In, $Out, $Sub, exists 
($$req{import})?scalar(caller ($$req{import} > 0?$$req{import} - 
1:0)):'',$SessionMgnt) ;
  +                          &epIOMod_Perl, $In, $Out, $Sub, exists 
($$req{import})?scalar(caller ($$req{import} > 0?$$req{import} - 1:0)):'',
  +                          $SessionMgnt, $syntax) ;
       
       bless $r, $$req{'bless'} if (exists ($$req{'bless'})) ;
   
  
  
  
  1.29.4.9  +3 -2      embperl/Embperl.xs
  
  Index: Embperl.xs
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl.xs,v
  retrieving revision 1.29.4.8
  retrieving revision 1.29.4.9
  diff -u -r1.29.4.8 -r1.29.4.9
  --- Embperl.xs        2001/03/06 15:36:10     1.29.4.8
  +++ Embperl.xs        2001/03/07 04:54:42     1.29.4.9
  @@ -137,7 +137,7 @@
   # /* ----- Request data ----- */
   
   tReq *
  
-embperl_SetupRequest(req_rec,sInputfile,mtime,filesize,nFirstLine,sOutputfile,pConf,nIOtype,pIn,pOut,sSubName,sImport,nSessionMgnt)
 
  
+embperl_SetupRequest(req_rec,sInputfile,mtime,filesize,nFirstLine,sOutputfile,pConf,nIOtype,pIn,pOut,sSubName,sImport,nSessionMgnt,pTokenTable)
 
       SV *    req_rec
       char *  sInputfile
       double  mtime
  @@ -151,13 +151,14 @@
       char *  sSubName 
       char *  sImport
       int     nSessionMgnt
  +    tTokenTable *    pTokenTable ;
   INIT:
       if (SvOK(ST(5)))
           sOutputfile = SvPV(ST(5), na);
       else
           sOutputfile = "\1" ; 
   CODE:        
  -    RETVAL = 
SetupRequest(req_rec,sInputfile,mtime,filesize,nFirstLine,sOutputfile,pConf,nIOtype,pIn,pOut,sSubName,sImport,nSessionMgnt)
 ;
  +    RETVAL = 
SetupRequest(req_rec,sInputfile,mtime,filesize,nFirstLine,sOutputfile,pConf,nIOtype,pIn,pOut,sSubName,sImport,nSessionMgnt,pTokenTable)
 ;
   OUTPUT:
       RETVAL
   
  
  
  
  1.1.2.2   +27 -4     embperl/Attic/Syntax.xs
  
  Index: Syntax.xs
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/Syntax.xs,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- Syntax.xs 2001/03/06 15:36:11     1.1.2.1
  +++ Syntax.xs 2001/03/07 04:54:42     1.1.2.2
  @@ -10,15 +10,38 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: Syntax.xs,v 1.1.2.1 2001/03/06 15:36:11 richter Exp $
  +#   $Id: Syntax.xs,v 1.1.2.2 2001/03/07 04:54:42 richter Exp $
   #
   ###################################################################################
   
   
   
  -
   MODULE = HTML::Embperl      PACKAGE = HTML::Embperl::Syntax     PREFIX = embperl_
   
  -
  -
   
  +void
  +embperl_BuildTokenTable (pSyntaxObj)
  +    SV * pSyntaxObj ;
  +CODE:
  +    MAGIC * mg ;
  +    tTokenTable * pTab ;
  +    HV *          pHV ;
  +    SV **         ppSV ;
  +     
  +    if (!SvROK (pSyntaxObj) || SvTYPE(pHV = (HV *)SvRV(pSyntaxObj)) == SVt_PVHV || 
(mg = mg_find ((SV *)pHV, '~')))
  +     {        
  +     /* tTokenTable * pTab = *((tTokenTable **)(mg -> mg_ptr)) ; */
  +     croak ("Internal Error: pSyntaxObj has already a TokenTable") ;
  +     }
  +
  +    pTab = malloc (sizeof (tTokenTable)) ;   
  +
  +    sv_unmagic ((SV *)pHV, '~') ;
  +    sv_magic ((SV *)pHV, NULL, '~', (char *)&pTab, sizeof (pTab)) ;
  +
  +    ppSV = hv_fetch (pHV, "-root", 5, 0) ;
  +    if (ppSV == NULL || *ppSV == NULL)
  +     croak ("Internal Error: pSyntaxObj has no -root") ;
  +    else     
  +     BuildTokenTable (pCurrReq, (HV *)*ppSV, "", pTab) ;
  +     
  
  
  
  1.27.4.8  +2 -1      embperl/ep.h
  
  Index: ep.h
  ===================================================================
  RCS file: /home/cvs/embperl/ep.h,v
  retrieving revision 1.27.4.7
  retrieving revision 1.27.4.8
  diff -u -r1.27.4.7 -r1.27.4.8
  --- ep.h      2000/12/19 09:11:03     1.27.4.7
  +++ ep.h      2001/03/07 04:54:43     1.27.4.8
  @@ -201,7 +201,8 @@
                        /*in*/ SV *    pOut,
                     /*in*/ char *  sSubName,
                     /*in*/ char *  sImport,
  -                  /*in*/ int     nSessionMgnt) ;
  +                  /*in*/ int     nSessionMgnt,
  +                     /*in*/ tTokenTable * pTokenTable) ;
   
   void FreeRequest (/*i/o*/ register req * r) ;
                      
  
  
  
  1.20.4.10 +38 -0     embperl/epdat.h
  
  Index: epdat.h
  ===================================================================
  RCS file: /home/cvs/embperl/epdat.h,v
  retrieving revision 1.20.4.9
  retrieving revision 1.20.4.10
  diff -u -r1.20.4.9 -r1.20.4.10
  --- epdat.h   2000/11/15 07:21:52     1.20.4.9
  +++ epdat.h   2001/03/07 04:54:43     1.20.4.10
  @@ -90,8 +90,46 @@
       phTerm
       } tPhase ;
       
  +/*-----------------------------------------------------------------*/
  +/*                                                              */
  +/*  Parser data structures                                      */
  +/*                                                              */
  +/*-----------------------------------------------------------------*/
   
  +typedef   unsigned char tCharMap [256/(sizeof(unsigned char)*8)]   ;
   
  +struct tToken
  +    {
  +    const char *         sText ;     /* string of token (MUST be first item!) */
  +    const char *         sName ;     /* name of token (only for description) */
  +    int                          nTextLen ;  /* len of string */
  +    const char *         sEndText ;  /* string which ends the block */
  +    const char *         sNodeName;  /* name of the node to create */
  +    int                          nNodeName ; /* index in string table of node name 
*/
  +    enum tNodeType       nNodeType ; /* type of the node that should be created */
  +    enum tNodeType       nCDataType ;/* type for sub nodes that contains text */
  +    enum tNodeType       nForceType ;/* force this type for sub nodes */
  +    int                          bUnescape ; /* translate input?  */
  +    unsigned char *      pContains ; /* chars that could be contained in the string 
*/
  +    struct tTokenTable *    pFollowedBy;/* table of tokens that can follow this one 
*/
  +    struct tTokenTable *    pInside ;        /* table of tokens that can apear 
inside this one */
  +    struct tToken      *    pStartTag ;      /* token that contains definition for 
the start of the current token */
  +    struct tToken      *    pEndTag ;        /* token that contains definition for 
the end of the current token */
  +    } ;        
  +
  +struct tTokenTable
  +    {
  +    void *       pCompilerInfo ; /* stores tables of the compiler , must be first 
item */
  +    tCharMap     cStartChars ;   /* for every vaild start char there is one bit set 
*/
  +    tCharMap     cAllChars   ;   /* for every vaild char there is one bit set */
  +    struct tToken * pTokens ;            /* table with all tokens */
  +    int             numTokens ;          /* number of tokens in above table */
  +    int                  bLSearch ;      /* when set perform a linear, instead of a 
binary search */
  +    struct tToken * pContainsToken ;/* pointer to the token that has a pContains 
defined (could be only one per table) */
  +    } ;
  +
  +typedef struct tTokenTable tTokenTable ;
  +    
   #endif
   
   
  
  
  
  1.75.4.23 +5 -2      embperl/epmain.c
  
  Index: epmain.c
  ===================================================================
  RCS file: /home/cvs/embperl/epmain.c,v
  retrieving revision 1.75.4.22
  retrieving revision 1.75.4.23
  diff -u -r1.75.4.22 -r1.75.4.23
  --- epmain.c  2001/02/23 06:49:49     1.75.4.22
  +++ epmain.c  2001/03/07 04:54:43     1.75.4.23
  @@ -1585,7 +1585,7 @@
       DomInit () ;
       //embperl_CompileInit () ;
   
  -
  +#if 0
       if ((pTokenHash = perl_get_hv (sTokenHashName, TRUE)) == NULL)
           {
           return rcHashError ;
  @@ -1596,6 +1596,7 @@
        LogError (r, rc) ;
        return rc ;
        }
  +#endif
   #endif    
       
   
  @@ -2077,7 +2078,8 @@
                        /*in*/ SV *    pOut,
                     /*in*/ char *  sSubName,
                     /*in*/ char *  sImport,
  -                  /*in*/ int     nSessionMgnt)
  +                  /*in*/ int     nSessionMgnt,
  +                     /*in*/ tTokenTable * pTokenTable)
   
       {
       int     rc ;
  @@ -2162,6 +2164,7 @@
       ppSV = hv_fetch(r -> pEnvHash, "PATH_INFO", sizeof ("PATH_INFO") - 1, 0) ;  
       if (ppSV)
           r -> sPathInfo = SvPV (*ppSV ,len) ;
  +    r -> pTokenTable = pTokenTable ;    
   #endif
       if (rc != ok)
           r -> bDebug = 0 ; /* Turn debbuging off, only errors will go to stderr if 
logfile not open */
  
  
  
  1.4.2.9   +0 -32     embperl/Attic/epparse.c
  
  Index: epparse.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epparse.c,v
  retrieving revision 1.4.2.8
  retrieving revision 1.4.2.9
  diff -u -r1.4.2.8 -r1.4.2.9
  --- epparse.c 2001/03/03 14:45:57     1.4.2.8
  +++ epparse.c 2001/03/07 04:54:44     1.4.2.9
  @@ -16,38 +16,6 @@
   #include "epmacro.h"
   
   
  -typedef   unsigned char tCharMap [256/(sizeof(unsigned char)*8)]   ;
  -
  -struct tToken
  -    {
  -    const char *         sText ;     /* string of token (MUST be first item!) */
  -    const char *         sName ;     /* name of token (only for description) */
  -    int                          nTextLen ;  /* len of string */
  -    const char *         sEndText ;  /* string which ends the block */
  -    const char *         sNodeName;  /* name of the node to create */
  -    int                          nNodeName ; /* index in string table of node name 
*/
  -    enum tNodeType       nNodeType ; /* type of the node that should be created */
  -    enum tNodeType       nCDataType ;/* type for sub nodes that contains text */
  -    enum tNodeType       nForceType ;/* force this type for sub nodes */
  -    int                          bUnescape ; /* translate input?  */
  -    unsigned char *      pContains ; /* chars that could be contained in the string 
*/
  -    struct tTokenTable *    pFollowedBy;/* table of tokens that can follow this one 
*/
  -    struct tTokenTable *    pInside ;        /* table of tokens that can apear 
inside this one */
  -    struct tToken      *    pStartTag ;      /* token that contains definition for 
the start of the current token */
  -    struct tToken      *    pEndTag ;        /* token that contains definition for 
the end of the current token */
  -    } ;        
  -
  -struct tTokenTable
  -    {
  -    void *       pCompilerInfo ; /* stores tables of the compiler , must be first 
item */
  -    tCharMap     cStartChars ;   /* for every vaild start char there is one bit set 
*/
  -    tCharMap     cAllChars   ;   /* for every vaild char there is one bit set */
  -    struct tToken * pTokens ;            /* table with all tokens */
  -    int             numTokens ;          /* number of tokens in above table */
  -    int                  bLSearch ;      /* when set perform a linear, instead of a 
binary search */
  -    struct tToken * pContainsToken ;/* pointer to the token that has a pContains 
defined (could be only one per table) */
  -    } ;
  -
   
   struct tTokenCmp
       {
  
  
  
  1.3.4.4   +11 -0     embperl/typemap
  
  Index: typemap
  ===================================================================
  RCS file: /home/cvs/embperl/typemap,v
  retrieving revision 1.3.4.3
  retrieving revision 1.3.4.4
  diff -u -r1.3.4.3 -r1.3.4.4
  --- typemap   2000/11/02 08:45:21     1.3.4.3
  +++ typemap   2001/03/07 04:54:44     1.3.4.4
  @@ -3,6 +3,7 @@
   tReq *  T_PTROBJ_REQ
   tFile * T_PTROBJ_FILE
   tDomNode * T_PTROBJ_DOMNODE
  +tTokenTable * T_PTROBJ_SYNTAX
   AV *    T_MYAVREF
   HV *    T_MYHVREF
   
  @@ -44,6 +45,15 @@
           croak (\"$var is not of type XML::Embperl::DOM::Node\") ;
       }
   
  +T_PTROBJ_SYNTAX
  +    {
  +    MAGIC * mg ;
  +    if (mg = mg_find (SvRV($arg), '~'))
  +        $var = *((tTokenTable **)(mg -> mg_ptr)) ;
  +    else
  +        croak (\"$var is not of type XML::Embperl::Syntax\") ;
  +    }
  +
   
   
   OUTPUT
  @@ -70,3 +80,4 @@
       else
           $arg = pSV ;
       }
  +
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.20  +3 -3      embperl/Embperl/Attic/Syntax.pm
  
  Index: Syntax.pm
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl/Attic/Syntax.pm,v
  retrieving revision 1.1.4.19
  retrieving revision 1.1.4.20
  diff -u -r1.1.4.19 -r1.1.4.20
  --- Syntax.pm 2001/03/06 15:36:11     1.1.4.19
  +++ Syntax.pm 2001/03/07 04:54:48     1.1.4.20
  @@ -10,7 +10,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: Syntax.pm,v 1.1.4.19 2001/03/06 15:36:11 richter Exp $
  +#   $Id: Syntax.pm,v 1.1.4.20 2001/03/07 04:54:48 richter Exp $
   #
   ###################################################################################
    
  @@ -19,7 +19,7 @@
   package HTML::Embperl::Syntax ;
   
   use strict ;
  -use vars qw{@ISA @EXPORT_OK %EXPORT_TAGS %DocumentRoot} ;
  +use vars qw{@ISA @EXPORT_OK %EXPORT_TAGS %DocumentRoot %Syntax} ;
   
   @ISA = qw{Exporter} ;
   
  @@ -169,7 +169,7 @@
           &{"$_::new"}($self) ;
           }
   
  -    return $Syntax{$name} = BuildTokenTable ($self -> GetRoot) ;
  +    return $Syntax{$name} = BuildTokenTable ($self) ;
       }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to