You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl-cvs@perl.apache.org by ri...@apache.org on 2001/06/25 05:30:12 UTC

cvs commit: embperl/test/html subimp.pm

richter     01/06/24 20:30:12

  Modified:    .        Tag: Embperl2c Changes.pod Embperl.pm Embperl.xs
                        ep.h epdom.c epdom.h epparse.c eputil.c
               test/html Tag: Embperl2c subimp.pm
  Log:
  Embperl 2
     - compiles now with sun-cc. Patches from Michael Stevens.
     - Add Escape function
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.129.4.24 +1 -0      embperl/Changes.pod
  
  Index: Changes.pod
  ===================================================================
  RCS file: /home/cvs/embperl/Changes.pod,v
  retrieving revision 1.129.4.23
  retrieving revision 1.129.4.24
  diff -u -r1.129.4.23 -r1.129.4.24
  --- Changes.pod	2001/05/16 06:45:18	1.129.4.23
  +++ Changes.pod	2001/06/25 03:30:01	1.129.4.24
  @@ -2,6 +2,7 @@
   
   =head1 2.0b3_dev
   
  +   - compiles now with sun-cc. Patches from Michael Stevens.
      - fixed several bugs that caused weired behaviour with nested subs
        and tables.
      - fixed a bug that caused Embperl to stop when it sees a checkbox
  
  
  
  1.118.4.46 +2 -2      embperl/Embperl.pm
  
  Index: Embperl.pm
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl.pm,v
  retrieving revision 1.118.4.45
  retrieving revision 1.118.4.46
  diff -u -r1.118.4.45 -r1.118.4.46
  --- Embperl.pm	2001/06/20 14:16:10	1.118.4.45
  +++ Embperl.pm	2001/06/25 03:30:01	1.118.4.46
  @@ -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.45 2001/06/20 14:16:10 richter Exp $
  +#   $Id: Embperl.pm,v 1.118.4.46 2001/06/25 03:30:01 richter Exp $
   #
   ###################################################################################
   
  @@ -68,7 +68,7 @@
   
   
   ##ep2##
  -$VERSION = '2.0b3_dev-9' ;
  +$VERSION = '2.0b3_dev-10' ;
   ##/ep2##
   ##ep1##$VERSION = '1.3.3';
   
  
  
  
  1.29.4.21 +12 -0     embperl/Embperl.xs
  
  Index: Embperl.xs
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl.xs,v
  retrieving revision 1.29.4.20
  retrieving revision 1.29.4.21
  diff -u -r1.29.4.20 -r1.29.4.21
  --- Embperl.xs	2001/05/31 19:16:22	1.29.4.20
  +++ Embperl.xs	2001/06/25 03:30:02	1.29.4.21
  @@ -718,6 +718,18 @@
   CODE:
       lprintf (r,"[%d]MEM:  %s: SVs: %d OBJs: %d\n", r->nPid, sText, sv_count, sv_objcount) ;
   
  +SV *
  +embperl_Escape(r, str, mode)
  +    tReq * r
  +    char *   str = NO_INIT 
  +    int      mode
  +PREINIT:
  +    STRLEN len ;
  +CODE:
  +    str = SvPV(ST(1),len) ;
  +    RETVAL = Escape(r, str, len, mode, NULL, 0) ; 
  +OUTPUT:
  +    RETVAL
   
   
   int
  
  
  
  1.27.4.16 +6 -0      embperl/ep.h
  
  Index: ep.h
  ===================================================================
  RCS file: /home/cvs/embperl/ep.h,v
  retrieving revision 1.27.4.15
  retrieving revision 1.27.4.16
  diff -u -r1.27.4.15 -r1.27.4.16
  --- ep.h	2001/05/16 14:04:26	1.27.4.15
  +++ ep.h	2001/06/25 03:30:02	1.27.4.16
  @@ -438,6 +438,12 @@
    		   /*in*/  int            nDataLen,
    		   /*in*/  struct tCharTrans *   pEscTab,
    		   /*in*/  char           cEscChar) ;
  +SV * Escape	  (/*i/o*/ register req * r,
  + 		   /*in*/  const char *   sData,
  + 		   /*in*/  int            nDataLen,
  + 		   /*in*/  int            nEscMode,
  + 		   /*in*/  struct tCharTrans *   pEscTab,
  + 		   /*in*/  char           cEscChar) ;
   
   int TransHtml (/*i/o*/ register req * r,
   		/*i/o*/ char *         sData,
  
  
  
  1.4.2.39  +13 -3     embperl/Attic/epdom.c
  
  Index: epdom.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epdom.c,v
  retrieving revision 1.4.2.38
  retrieving revision 1.4.2.39
  diff -u -r1.4.2.38 -r1.4.2.39
  --- epdom.c	2001/05/15 14:19:47	1.4.2.38
  +++ epdom.c	2001/06/25 03:30:03	1.4.2.39
  @@ -9,7 +9,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: epdom.c,v 1.4.2.38 2001/05/15 14:19:47 richter Exp $
  +#   $Id: epdom.c,v 1.4.2.39 2001/06/25 03:30:03 richter Exp $
   #
   ###################################################################################*/
   
  @@ -161,10 +161,15 @@
   void * str_malloc (size_t  n)
       {
       void * m = malloc(n + sizeof (size_t)) ;
  +    size_t * m_size;
       if (m)
   	{
   	nMemUsage += n ;
  -	*((size_t *)m)++ = n ;
  +	// make the following in multiple step, so sun-cc is happy...
  +	m_size = (size_t *) m;
  +	*m_size = n;
  +	m_size++;
  +	m = (void *) m_size ;
   	}
   
       return m ;
  @@ -175,11 +180,16 @@
   void * str_realloc (void * s, size_t  n)
       {
       void * m = ((size_t *)s) - 1 ;
  +    size_t * m_size;
       nMemUsage -= *((size_t *)m) ;
       if (m = realloc (m, n + sizeof (size_t)))
   	{
   	nMemUsage += n ;
  -	*((size_t *)m)++ = n ;
  +	// make the following in multiple step, so sun-cc is happy...
  +	m_size = (size_t *) m;
  +	*m_size = n;
  +	m_size++;
  +	m = (void *) m_size ;
   	}
       return m ;
       }
  
  
  
  1.4.2.19  +2 -2      embperl/Attic/epdom.h
  
  Index: epdom.h
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epdom.h,v
  retrieving revision 1.4.2.18
  retrieving revision 1.4.2.19
  diff -u -r1.4.2.18 -r1.4.2.19
  --- epdom.h	2001/05/15 14:19:51	1.4.2.18
  +++ epdom.h	2001/06/25 03:30:04	1.4.2.19
  @@ -9,7 +9,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: epdom.h,v 1.4.2.18 2001/05/15 14:19:51 richter Exp $
  +#   $Id: epdom.h,v 1.4.2.19 2001/06/25 03:30:04 richter Exp $
   #
   ###################################################################################*/
   
  @@ -195,7 +195,7 @@
   			    /*in*/ int		    bInc) ;
   
   
  -#define SV2String(pSV,l)  (SvOK (pSV)?SvPV (pSV, l):(l=0,NULL))
  +#define SV2String(pSV,l)  (SvOK (pSV)?SvPV (pSV, l):(l=0,((char *)NULL)))
   
   #define String2NdxNoInc(sText,nLen) String2NdxInc(sText,nLen,0)
   #define String2Ndx(sText,nLen) String2NdxInc(sText,nLen,1)
  
  
  
  1.4.2.27  +2 -2      embperl/Attic/epparse.c
  
  Index: epparse.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epparse.c,v
  retrieving revision 1.4.2.26
  retrieving revision 1.4.2.27
  diff -u -r1.4.2.26 -r1.4.2.27
  --- epparse.c	2001/05/15 14:20:07	1.4.2.26
  +++ epparse.c	2001/06/25 03:30:04	1.4.2.27
  @@ -9,7 +9,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: epparse.c,v 1.4.2.26 2001/05/15 14:20:07 richter Exp $
  +#   $Id: epparse.c,v 1.4.2.27 2001/06/25 03:30:04 richter Exp $
   #
   ###################################################################################*/
   
  @@ -526,7 +526,7 @@
   				char *			pEnd, 
   				struct tTokenTable *	pTokenTable, 
   				const char *		sEndText,
  -				const char *		pParentContains,
  +				const unsigned char *	pParentContains,
   				enum tNodeType		nCDataType,
   				enum tNodeType		nForceType,
   				int			bUnescape,
  
  
  
  1.15.4.12 +78 -1     embperl/eputil.c
  
  Index: eputil.c
  ===================================================================
  RCS file: /home/cvs/embperl/eputil.c,v
  retrieving revision 1.15.4.11
  retrieving revision 1.15.4.12
  diff -u -r1.15.4.11 -r1.15.4.12
  --- eputil.c	2001/05/16 14:04:30	1.15.4.11
  +++ eputil.c	2001/06/25 03:30:05	1.15.4.12
  @@ -10,7 +10,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: eputil.c,v 1.15.4.11 2001/05/16 14:04:30 richter Exp $
  +#   $Id: eputil.c,v 1.15.4.12 2001/06/25 03:30:05 richter Exp $
   #
   ###################################################################################*/
   
  @@ -129,6 +129,82 @@
           owrite (r, p, sData - p) ;
       }
   
  +/* ---------------------------------------------------------------------------- */
  +/*                                                                              */
  +/* Escape a string and return a sv                                              */
  +/*                                                                              */
  +/* in sData     = input:  string                                                */
  +/*    nDataLen  = input:  length of string                                      */
  +/*    pEscTab   = input:  escape table                                          */
  +/*    cEscChar  = input:  char to escape escaping (0 = off)                     */
  +/*                                                                              */
  +/* ---------------------------------------------------------------------------- */
  +
  +SV * Escape	  (/*i/o*/ register req * r,
  + 		   /*in*/  const char *   sData,
  + 		   /*in*/  int            nDataLen,
  + 		   /*in*/  int            nEscMode,
  + 		   /*in*/  struct tCharTrans *   pEscTab,
  + 		   /*in*/  char           cEscChar)
  +
  +    {
  +    char * pHtml  ;
  +    const char * p ;
  +    int	         l ;
  +    SV *         pSV = newSVpv("",0) ;
  +
  +    EPENTRY (Escape) ;
  +
  +
  +    if (nEscMode >= 0)
  +	{	    
  +	if (nEscMode & escHtml && !r -> bEscInUrl)
  +	    pEscTab = Char2Html ;
  +	else if (nEscMode & escUrl)
  +	    pEscTab = Char2Url ;
  +	else 
  +	    pEscTab = NULL ;
  +	if (nEscMode & escEscape)
  +	    cEscChar = '\0' ;
  +	else
  +	    cEscChar = '\\' ;
  +	}
  +
  +    if (pEscTab == NULL)
  +        {
  +        sv_setpvn (pSV, sData, nDataLen) ;
  +        return pSV ;
  +        }
  +
  +    p = sData ;
  +    l = nDataLen ;
  +
  +    while (l > 0)
  +        {
  +        if (cEscChar && *sData == cEscChar)
  +            {
  +            if (p != sData)
  +		sv_catpvn (pSV, (char *)p, sData - p) ;
  +            sData++, l-- ;
  +            p = sData ;
  +            }
  +        else
  +            {
  +            pHtml = pEscTab[(unsigned char)(*sData)].sHtml ;
  +            if (*pHtml)
  +                {
  +                if (p != sData)
  +                    sv_catpvn (pSV, (char *)p, sData - p) ;
  +                sv_catpv (pSV, pHtml) ;
  +                p = sData + 1;
  +                }
  +            }
  +        sData++, l-- ;
  +        }
  +    if (p != sData)
  +        sv_catpvn (pSV, (char *)p, sData - p) ;
  +    return pSV ;
  +    }
   
   #if 0
   
  @@ -226,6 +302,7 @@
               return pString ;
           pString++ ;
           }
  +    return NULL ;
       }
   
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.6.2   +4 -2      embperl/test/html/subimp.pm
  
  Index: subimp.pm
  ===================================================================
  RCS file: /home/cvs/embperl/test/html/subimp.pm,v
  retrieving revision 1.4.6.1
  retrieving revision 1.4.6.2
  diff -u -r1.4.6.1 -r1.4.6.2
  --- subimp.pm	2000/11/02 08:45:26	1.4.6.1
  +++ subimp.pm	2001/06/25 03:30:11	1.4.6.2
  @@ -13,12 +13,13 @@
   
   # compile page
   
  +my $pn = __PACKAGE__ ;
   HTML::Embperl::Execute ({inputfile => __FILE__, 
   			input => \$data,
   			mtime => -M __FILE__ ,
   			import => 0,
   			options => HTML::Embperl::optKeepSrcInMemory,
  -			package => __PACKAGE__}) ;
  +			package => $pn . $ENV{EMBPERL_EP1COMPAT}}) ;
   
   
   }
  @@ -28,9 +29,10 @@
   sub import
   
       {
  +    my $pn = __PACKAGE__ ;
       HTML::Embperl::Execute ({inputfile => __FILE__, 
   			    import => 2,
  -			    package => __PACKAGE__}) ;
  +			    package => $pn . $ENV{EMBPERL_EP1COMPAT}}) ;
   
   
       1 ;
  
  
  

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