perl-embperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@locus.apache.org
Subject cvs commit: embperl/test/html input.htm
Date Mon, 29 May 2000 07:34:32 GMT
richter     00/05/29 00:34:32

  Modified:    .        Tag: Embperl2 Embperl.xs epcomp.c epdom.c epdom.h
                        epparse.c
               Embperl  Tag: Embperl2 Syntax.pm
               test/cmp Tag: Embperl2 escape.htm
               test/html Tag: Embperl2 input.htm
  Log:
  - Embperl 2 - Input / Textarea tags
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.26.2.11 +19 -6     embperl/Embperl.xs
  
  Index: Embperl.xs
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl.xs,v
  retrieving revision 1.26.2.10
  retrieving revision 1.26.2.11
  diff -u -r1.26.2.10 -r1.26.2.11
  --- Embperl.xs	2000/05/26 23:31:03	1.26.2.10
  +++ Embperl.xs	2000/05/29 07:34:29	1.26.2.11
  @@ -635,7 +635,7 @@
       SV * sText
   CODE:
       IV l ;
  -    char * s = SvPV (sText, l) ;
  +    char * s = SV2String (sText, l) ;
       Node_replaceChildWithCDATA (DomTree_self(xDomTree), -1, xOldChild, s, l, (pCurrReq
-> nCurrEscMode & 3)== 3?1 + (pCurrReq -> nCurrEscMode & 4):pCurrReq -> nCurrEscMode,
nflgModified | nflgReturn) ;
       pCurrReq -> nCurrEscMode = pCurrReq -> nEscMode ;
       pCurrReq -> bEscModeSet = -1 ;
  @@ -669,7 +669,7 @@
   	    ppSV = av_fetch (pAV, i, 0) ;
   	    if (ppSV && *ppSV)
   		{
  -		s = SvPV (*ppSV, l) ;
  +		s = SV2String (*ppSV, l) ;
                   xNode = Node_appendChild (pDomTree, ntypText, 0, s, l, xOldChild, 0) ;
   		if (pCurrReq -> nCurrEscMode & 2) 
                       Node_self (pDomTree, xNode) -> bFlags |= nflgEscUrl ;
  @@ -683,7 +683,7 @@
   	}
       else
           {
  -        char * s = SvPV (sText, l) ;
  +        char * s = SV2String (sText, l) ;
           Node_replaceChildWithCDATA (DomTree_self(xDomTree), -1, xOldChild, s, l, (pCurrReq
-> nCurrEscMode & 3) == 3?2 + (pCurrReq -> nCurrEscMode & 4):pCurrReq ->
nCurrEscMode, nflgModified | nflgReturn) ;
           }
   
  @@ -704,6 +704,19 @@
   
   
   void
  +embperl_Node_appendChild (xDomTree, xParent, nType, sText)
  +    int xDomTree
  +    int xParent
  +    int nType
  +    SV * sText
  +CODE:
  +    IV nText ;
  +    char * sT = SV2String (sText, nText) ;
  +    tDomTree * pDomTree = DomTree_self(xDomTree) ;
  +    Node_appendChild (pDomTree, nType, 0, sT, nText, xParent, 0) ;
  +
  +
  +void
   embperl_DomTree_checkpoint (xDomTree, xChild)
       int xDomTree
       int xChild
  @@ -731,8 +744,8 @@
   CODE:
       IV nAttr ;
       IV nText ;
  -    char * sT = SvPV (sText, nText) ;
  -    char * sA = SvPV (sAttr, nAttr) ;
  +    char * sT = SV2String (sText, nText) ;
  +    char * sA = SV2String (sAttr, nAttr) ;
       tDomTree * pDomTree = DomTree_self (xDomTree) ;
   
       Element_selfSetAttribut (pDomTree, Node_self (pDomTree, xNode), sA, nAttr, sT, nText)
;
  @@ -747,7 +760,7 @@
       SV * sAttr
   CODE:
       IV nAttr ;
  -    char * sA = SvPV (sAttr, nAttr) ;
  +    char * sA = SV2String (sAttr, nAttr) ;
       tDomTree * pDomTree = DomTree_self (xDomTree) ;
   
       Element_selfRemoveAttribut (pDomTree, Node_self (pDomTree, xNode), sA, nAttr) ;
  
  
  
  1.1.2.16  +78 -70    embperl/Attic/epcomp.c
  
  Index: epcomp.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epcomp.c,v
  retrieving revision 1.1.2.15
  retrieving revision 1.1.2.16
  diff -u -r1.1.2.15 -r1.1.2.16
  --- epcomp.c	2000/05/26 23:31:04	1.1.2.15
  +++ epcomp.c	2000/05/29 07:34:29	1.1.2.16
  @@ -161,49 +161,52 @@
       {
       const char * or ;
       const char * eq = strchr (p, ':') ;
  -    const char * e = eq?eq:q;
  +    const char * e = eq && eq < q?eq:q;
       int nChildNo = atoi (p) ;
       struct tNodeData * pChildNode = Node_selfNthChild (pDomTree, pNode, nChildNo) ;
  -    const char * sText = Node_selfNodeName(pChildNode) ;
  +    const char * sText ;
       
  -    if (op == '=' && eq)
  +    if (pChildNode)
   	{
  -	eq++ ;
  -	do
  +	sText = Node_selfNodeName(pChildNode) ;
  +	if (op == '=' && eq)
   	    {
  -	    or = strchr (eq + 1, '|') ;
  -	    e = or?or - 1:q - 1 ;
  -	    if (strncmp (sText, eq, e - eq) == 0)
  -		break ;
  -	    if (or == NULL)
  -		return 0 ;
  -	    eq = or + 1 ;
  +	    eq++ ;
  +	    do
  +		{
  +		or = strchr (eq + 1, '|') ;
  +		e = or?or - 1:q - 1 ;
  +		if (strncmp (sText, eq, e - eq) == 0)
  +		    break ;
  +		if (or == NULL)
  +		    return 0 ;
  +		eq = or + 1 ;
  +		}
  +	    while (or) ;
   	    }
  -	while (or) ;
  -	}
  -    else if (op == '~' && eq)
  -	{
  -	eq++ ;
  -	do 
  +	else if (op == '~' && eq)
   	    {
  -	    or = strchr (eq + 1, '|') ;
  -	    e = or?or - 1:q - 1 ;
  -	    if (strstrn (sText, eq, e - eq))
  -		break ;
  -	    if (or == NULL)
  -		return 0 ;
  -	    eq = or + 1 ;
  +	    eq++ ;
  +	    do 
  +		{
  +		or = strchr (eq + 1, '|') ;
  +		e = or?or - 1:q - 1 ;
  +		if (strstrn (sText, eq, e - eq))
  +		    break ;
  +		if (or == NULL)
  +		    return 0 ;
  +		eq = or + 1 ;
  +		}
  +	    while (or) ;
   	    }
  -	while (or) ;
  -	}
  -    else if (op == '!' && pChildNode)
  -	{
  -	return 0 ;
  -	}
  -    else if (op == '*' && !pChildNode)
  -	{
  -	return 0 ;
  +	else if (op == '!' && pChildNode)
  +	    {
  +	    return 0 ;
  +	    }
   	}
  +    else
  +	if (op != '!')
  +	    return 0 ;
   
       if (pChildNode && out)
   	StringAdd (&pCode, sText, 0) ;
  @@ -234,53 +237,58 @@
       {
       const char * or ;
       const char * eq = strchr (p, ':') ;
  -    const char * e = eq?eq:q;
  +    const char * e = eq && eq < q?eq:q;
       tAttrData * pChildNode = Element_selfGetAttribut (pDomTree, pNode, p, e - p) ;
  -    const char * sText = Ndx2String (pChildNode -> xName) ;
  +    const char * sText ;
   
  -    if (op == '=' && eq)
  +    
  +    if (pChildNode)
   	{
  -	eq++ ;
  -	do
  +	if (pChildNode -> bFlags & aflgAttrChilds)
  +	    sText = Node_selfNodeName (Node_selfFirstChild (pDomTree, (tNodeData *)pChildNode))
;
  +	else
  +	    sText = Ndx2String (pChildNode -> xValue) ;
  +	if (op == '=' && eq)
   	    {
  -	    or = strchr (eq + 1, '|') ;
  -	    e = or?or - 1:q - 1 ;
  -	    if (strncmp (sText, eq, e - eq) == 0)
  -		break ;
  -	    if (or == NULL)
  -		return 0 ;
  -	    eq = or + 1 ;
  +	    eq++ ;
  +	    do
  +		{
  +		or = strchr (eq + 1, '|') ;
  +		e = or?or - 1:q - 1 ;
  +		if (strncmp (sText, eq, e - eq) == 0)
  +		    break ;
  +		if (or == NULL)
  +		    return 0 ;
  +		eq = or + 1 ;
  +		}
  +	    while (or) ;
   	    }
  -	while (or) ;
  -	}
  -    else if (op == '~' && eq)
  -	{
  -	eq++ ;
  -	do 
  +	else if (op == '~' && eq)
   	    {
  -	    or = strchr (eq + 1, '|') ;
  -	    e = or?or - 1:q - 1 ;
  -	    if (strstrn (sText, eq, e - eq))
  -		break ;
  -	    if (or == NULL)
  -		return 0 ;
  -	    eq = or + 1 ;
  +	    eq++ ;
  +	    do 
  +		{
  +		or = strchr (eq + 1, '|') ;
  +		e = or?or - 1:q - 1 ;
  +		if (strstrn (sText, eq, e - eq))
  +		    break ;
  +		if (or == NULL)
  +		    return 0 ;
  +		eq = or + 1 ;
  +		}
  +	    while (or) ;
   	    }
  -	while (or) ;
  -	}
  -    else if (op == '!' && pChildNode)
  -	{
  -	return 0 ;
  -	}
  -    else if (op == '*' && !pChildNode)
  -	{
  -	return 0 ;
  +	else if (op == '!' && pChildNode)
  +	    {
  +	    return 0 ;
  +	    }
   	}
  +    else
  +	if (op != '!')
  +	    return 0 ;
   
       if (pChildNode && out && pChildNode -> xValue != 0)
   	{
  -	if (pChildNode -> bFlags & aflgAttrChilds)
  -	    sText = Node_selfNodeName (Node_selfFirstChild (pDomTree, (tNodeData *)pChildNode))
;
           StringAdd (&pCode, sText, 0) ;
   	}
       else
  
  
  
  1.1.2.20  +160 -60   embperl/Attic/epdom.c
  
  Index: epdom.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epdom.c,v
  retrieving revision 1.1.2.19
  retrieving revision 1.1.2.20
  diff -u -r1.1.2.19 -r1.1.2.20
  --- epdom.c	2000/05/26 23:31:05	1.1.2.19
  +++ epdom.c	2000/05/29 07:34:30	1.1.2.20
  @@ -18,6 +18,7 @@
   HV * pStringTableHash ;	    /* Hash to translate strings to index number */
   HE * * pStringTableArray  ;   /* Array with pointers to strings */
   
  +
   tDomTree * pDomTrees ;
   
   int nInitialNodePadSize = 196 ;
  @@ -275,6 +276,10 @@
       HE *    pHEKey ;
       int	    nNdx ;
       
  +
  +    if (sText == NULL)
  +	return 0 ;
  +
       if ((ppSV = hv_fetch (pStringTableHash, (char *)sText, nLen, 0)) != NULL)
   	if (*ppSV != NULL && SvTYPE (*ppSV) == SVt_IV)
   	    return SvIV (*ppSV) ;
  @@ -308,10 +313,31 @@
   int DomInit (void)
   
       {
  +    SV *    pSVKey ;
  +    SV *    pSVNdx ;
  +    HE *    pHEKey ;
  +    
       pStringTableHash = newHV () ;
   
       ArrayNew (&pStringTableArray, 128, sizeof (HE *)) ; 
  -    String2Ndx ("", 0) ;
  +
  +    ArrayAdd (&pStringTableArray, 2) ;
  +    /* NULL */
  +    pSVNdx = newSViv (0) ;
  +    SvREFCNT_inc (pSVNdx) ;  
  +    pSVKey = newSVpvn ("", 0) ;
  +    pHEKey = hv_store_ent (pStringTableHash, pSVKey, pSVNdx, 0) ;
  +    pStringTableArray[0] = pHEKey ;
  +
  +    /* "" */
  +    pSVNdx = newSViv (1) ;
  +    SvREFCNT_inc (pSVNdx) ;  
  +    pSVKey = newSVpvn ("", 0) ;
  +    pHEKey = hv_store_ent (pStringTableHash, pSVKey, pSVNdx, 0) ;
  +    pStringTableArray[1] = pHEKey ;
  +
  +    numStr+=2 ;
  +
       xNoName = String2Ndx ("<noname>", 8) ;
   
       ArrayNew (&pDomTrees, 16, sizeof (tDomTree)) ; 
  @@ -479,13 +505,19 @@
   
   
   static struct tNodePad * NewPad (/*in*/ tDomTree *  pDomTree,
  -				 /*in*/ tIndex		xParent)
  +				 /*in*/ tIndex	    xParent,
  +				 /*in*/ int         nSize)
   
       {
       tIndex xNdx = ArrayAdd (&pDomTree -> pLookup, 1) ;
       struct tNodePad * pChilds ;
   
  -    if ((pDomTree -> pLookup[xNdx] = pChilds = dom_malloc (nInitialNodePadSize)) ==
NULL)
  +    if (nSize == 0)
  +	nSize = nInitialNodePadSize ;
  +    else
  +	nSize = (nSize + sizeof (struct tNodePad) / nInitialNodePadSize + 1) * nInitialNodePadSize
;
  +    
  +    if ((pDomTree -> pLookup[xNdx] = pChilds = dom_malloc (nSize)) == NULL)
   	return NULL ;
       
       pChilds -> nType = ntypPad ;
  @@ -539,6 +571,56 @@
       }
   
   
  +/* ------------------------------------------------------------------------ */
  +/*                                                                          */
  +/* NodePad_splitPad                                                         */
  +/*                                                                          */
  +/* Split a pad into two                                                     */
  +/*                                                                          */
  +/* ------------------------------------------------------------------------ */
  +
  +tNodePad *  NodePad_splitPad       (/*in*/ tDomTree *   pDomTree,
  +			            /*in*/ tNodePad *   pPad,
  +			            /*in*/ tNodeData *	pNewFirstNode,
  +				    /*in*/ int          nNewNodeSize)
  +
  +    {
  +    struct tNodePad *  pFirst;
  +    struct tNodePad *  pNext      = NewPad (pDomTree, pPad -> xParent, nNewNodeSize)
;
  +    struct tNodeData * pNewNode   = NodePad_selfFirstChild (pDomTree, pNext) ;
  +    int                nCopySize ;
  +    int                nOffset ;
  +
  +
  +    pNext -> xPrev  = pPad -> xNdx ;
  +    pNext -> xNext  = pPad -> xNext ;
  +    pNext -> xFirst = pPad -> xFirst ;
  +    
  +    pFirst = NodePad_self (pDomTree, pPad -> xFirst) ;
  +    if (pFirst -> xLast == pPad -> xNdx || pFirst -> xLast == 0)
  +	pFirst -> xLast = pNext -> xNdx ;
  +
  +    pPad  -> xNext = pNext -> xNdx ;
  +
  +    nCopySize = pPad  -> nFill - pNewFirstNode -> nPadOffset ;
  +    memcpy (pNewNode, pNewFirstNode, nCopySize) ;
  +    pPad  -> nFill -= nCopySize ;
  +    pNext -> nFill += nCopySize ;
  +
  +    while (pNewNode)
  +	{
  +	pNewNode -> nPadOffset = ((tUInt8 *)pNewNode) - ((tUInt8 *)pNext) ;
  +	pDomTree -> pLookup[pNewNode -> xNdx] = pNewNode ;
  +	nOffset = sizeof (struct tNodeData) + sizeof (struct tAttrData) * pNewNode -> numAttr
;
  +	if (pNext -> nFill <= pNewNode -> nPadOffset + nOffset) 
  +	    break ;
  +	pNewNode = (struct tNodeData *)(((tUInt8 *)pNewNode) + nOffset) ;
  +	}
  +
  +    return pNext ;
  +    }
  +
  +
   
   /* ------------------------------------------------------------------------ */
   /*                                                                          */
  @@ -568,33 +650,14 @@
   	tIndex		    xNdx ;
   
   	if (((tUInt8 *)pNew) - ((tUInt8 *)pPad) != pPad -> nFill)
  -	    { /* not last child in pad -> make room */
  -	    mydie ("not last child in pad -> make room") ;
  -
  -
  +	    { /* not last child in pad -> move following node to new pad */
  +	    NodePad_splitPad (pDomTree, pPad, (tNodeData *)pNew, 0) ;
   	    }
   	if (((tUInt8 *)pNew) - ((tUInt8 *)pPad) + sizeof (struct tAttrData) > pPad -> nMax)
   	    { /* pad full -> move into new pad */
  -	    struct tNodePad *  pNext      = NewPad (pDomTree, pPad -> xParent) ;
  -	    int                nNodeSize  = ((tUInt8 *)pNew) - ((tUInt8 *)pParent) ;
  -	    struct tNodeData * pNewParent = (struct tNodeData * )(pNext + 1) ;
  -	    /* lprintf (pCurrReq, "[%d]PARSE: NewPad Extent Attr: %d -> %d\n", pCurrReq ->
nPid, pPad -> xParent, pNext -> xNdx) ; */
  -
  -	    if (nNodeSize + sizeof (struct tNodePad) >= nInitialNodePadSize)
  -		mydie ("pad too small for attr -> make room") ;
  -	    
  -	    pNext -> xPrev = pPad -> xNdx ;
  -	    pPad  -> xNext = pNext -> xNdx ;
  -	    ((struct tNodePad *)(pDomTree -> pLookup[pPad->xFirst])) -> xLast = pNext
-> xNdx ;
  -	    pNext -> xFirst = pPad->xFirst ;
  -
  -	    memcpy (pNewParent, pParent, nNodeSize) ;
  -	    pNewParent -> nPadOffset = pNext -> nFill ;
  -	    pDomTree -> pLookup[xParent] = pParent = pNewParent ;
  +	    pPad = NodePad_splitPad (pDomTree, pPad, pParent, ((tUInt8 *)pNew) - ((tUInt8 *)pParent)
+ sizeof (struct tAttrData)) ;
  +	    pParent = NodePad_selfFirstChild (pDomTree, pPad) ;
   	    pNew = ((struct tAttrData * )(pParent + 1)) + pParent -> numAttr ;
  -	    pPad  -> nFill -= nNodeSize ;
  -	    pNext -> nFill += nNodeSize ;
  -	    pPad = pNext ;
   	    }
   
           xNdx = ArrayAdd (&pDomTree -> pLookup, 1) ;
  @@ -623,6 +686,20 @@
   	
   	if (pNew -> nType != ntypAttr)
               {   
  +	    if (nType == ntypAttrValue)
  +		{
  +		int i ;
  +
  +		for (i = 0; i < nTextLen; i++)
  +		    {
  +		    if (!isspace (sText[i]))
  +			break ;
  +		    }
  +		
  +		if (i == nTextLen)
  +		    return 1 ; /* do not add only spaces as cdata inside a tag */
  +		}
  +
   	    pNew = ((tAttrData *)(pParent + 1)) + pParent -> numAttr - 1 ;
   	    if (pParent -> numAttr == 0 || pNew -> xName != xNoName)
   		{
  @@ -666,7 +743,7 @@
               if (((tAttrData *)pParent) -> bFlags & aflgAttrChilds)
                   pChilds = NodePad_self (pDomTree, ((tAttrData *)pParent) -> xValue)
;
               else
  -                pChilds = NewPad (pDomTree, xParent)  ;
  +                pChilds = NewPad (pDomTree, xParent, 0)  ;
   	    /* lprintf (pCurrReq, "[%d]PARSE: NewPad NewAttrChild: %d -> %d\n", pCurrReq ->
nPid, xParent, pChilds -> xNdx) ; */
   
               if (((tAttrData *)pParent) -> bFlags & aflgAttrValue)
  @@ -684,7 +761,7 @@
   	    }
   	else if (!pParent || !pParent -> xChilds)
   	    {
  -	    pChilds = NewPad (pDomTree, xParent)  ;
  +	    pChilds = NewPad (pDomTree, xParent, 0)  ;
   	    /* lprintf (pCurrReq, "[%d]PARSE: NewPad NewChild: %d -> %d\n", pCurrReq ->
nPid, xParent, pChilds -> xNdx) ; */
   
   	    if (pParent)
  @@ -698,13 +775,13 @@
   	    	    
   	    if (pChilds -> nFill + sizeof (struct tNodeData) > pChilds -> nMax)
   		{ /* pad full -> make room */
  -		struct tNodePad *  pNext      = NewPad (pDomTree, xParent) ;
  +		struct tNodePad *  pNext      = NewPad (pDomTree, xParent, 0) ;
   		/* lprintf (pCurrReq, "[%d]PARSE: NewPad Extent Childs: %d -> %d\n", pCurrReq ->
nPid, xParent, pNext -> xNdx) ; */
   
  -		pNext   -> xPrev = pChilds -> xNdx ;
  -		pChilds -> xNext = pNext -> xNdx ;
  -		pFirst -> xLast = pNext -> xNdx ;
  -		pNext -> xFirst = pFirst -> xFirst ;
  +		pNext   -> xPrev  = pChilds -> xNdx ;
  +		pChilds -> xNext  = pNext   -> xNdx ;
  +		pFirst  -> xLast  = pNext   -> xNdx ;
  +		pNext   -> xFirst = pFirst  -> xFirst ;
   
   		pChilds = pNext ;
   		}
  @@ -803,7 +880,7 @@
   
       if (pOldChild -> bFlags & nflgModified)
   	{
  -	tNodePad * pPad = NewPad (pDomTree, Node_parentNode (pDomTree, xOldChild)) ;
  +	tNodePad * pPad = NewPad (pDomTree, Node_parentNode (pDomTree, xOldChild), 0) ;
   	
   	tNodeData * pNew = (struct tNodeData *)(pPad + 1) ;
   
  @@ -1097,33 +1174,36 @@
   	    
   	    while (n--)
   		{
  -		char * s ;
  -		int    l ;
  -                if (pAttr -> xName != xNoName || n + 1 == pNode -> numAttr)
  -		    oputc (r, ' ') ;
  -                if (pAttr -> xName != xNoName)
  -		    {
  -		    Ndx2StringLen (pAttr -> xName,s,l) ;
  -		    owrite (r, s, l);
  -		    }
  -
  -		if (pAttr -> xValue)
  +		if (pAttr -> bFlags)
   		    {
  -		    if (pAttr -> xName != xNoName)
  -			oputs (r, "=\"") ;
  -
  -                    if (pAttr -> bFlags & aflgAttrChilds)
  -                        {
  -                        Node_toString2 (pDomTree, r, pAttr -> xNdx, &nOrderNdx)
;
  -                        }
  -                    else
  -                        {
  -		        Ndx2StringLen (pAttr -> xValue, s, l) ;
  -		        owrite (r, s, l) ;
  -		        }
  +		    char * s ;
  +		    int    l ;
  +		    if (pAttr -> xName != xNoName || n + 1 == pNode -> numAttr)
  +			oputc (r, ' ') ;
   		    if (pAttr -> xName != xNoName)
  -			oputc (r, '"') ;
  -                    }
  +			{
  +			Ndx2StringLen (pAttr -> xName,s,l) ;
  +			owrite (r, s, l);
  +			}
  +
  +		    if (pAttr -> xValue)
  +			{
  +			if (pAttr -> xName != xNoName)
  +			    oputs (r, "=\"") ;
  +
  +			if (pAttr -> bFlags & aflgAttrChilds)
  +			    {
  +			    Node_toString2 (pDomTree, r, pAttr -> xNdx, &nOrderNdx) ;
  +			    }
  +			else
  +			    {
  +			    Ndx2StringLen (pAttr -> xValue, s, l) ;
  +			    owrite (r, s, l) ;
  +			    }
  +			if (pAttr -> xName != xNoName)
  +			    oputc (r, '"') ;
  +			}
  +		    }
   		pAttr++ ;
   		}
   	    oputc (r, '>') ;
  @@ -1368,9 +1448,29 @@
   
       {
       struct tAttrData * pAttr = Element_selfGetAttribut (pDomTree, pNode, sAttrName, nAttrNameLen)
;
  -
  +    
       if (pAttr)
   	pAttr -> bFlags = 0 ;
  +    /*
  +    int    nCopyAttr ;
  +
  +    if (pAttr)
  +	{
  +	nAttr = pAttr - ((struct tAttrData * )(pNode + 1)) ;
  +	pNode -> numAttr-- ;
  +	nCopyAttr = pNode -> numAttr - nAttr  ;
  +	if (nCopyAttr)
  +	    {
  +	    memcpy (pAttr, pAttr + 1, nCopyAttr * sizeof (tAttrData)) ;
  +	    while (nCopyAttr--)
  +		{
  +		pDomTree -> pLookup[pAttr -> xNdx] = pAttr ;
  +		pAttr++ ;
  +		}
  +	    }
  +	}
  +    */
  +
       return pAttr ;
       }
   
  
  
  
  1.1.2.16  +2 -0      embperl/Attic/epdom.h
  
  Index: epdom.h
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epdom.h,v
  retrieving revision 1.1.2.15
  retrieving revision 1.1.2.16
  diff -u -r1.1.2.15 -r1.1.2.16
  --- epdom.h	2000/05/26 23:31:06	1.1.2.15
  +++ epdom.h	2000/05/29 07:34:30	1.1.2.16
  @@ -159,6 +159,8 @@
   			 /*in*/ int		    nLen) ;
   
   
  +#define SV2String(pSV,l)  (SvOK (pSV)?SvPV (pSV, l):(l=0,NULL))
  +
   #define Ndx2String(nNdx) (HeKEY (pStringTableArray[nNdx]))
   #define Ndx2StringLen(nNdx,sVal,nLen) { HE * pHE = pStringTableArray[nNdx] ; nLen=HeKLEN(pHE)
; sVal = HeKEY (pHE) ; }
   
  
  
  
  1.1.2.17  +2 -2      embperl/Attic/epparse.c
  
  Index: epparse.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epparse.c,v
  retrieving revision 1.1.2.16
  retrieving revision 1.1.2.17
  diff -u -r1.1.2.16 -r1.1.2.17
  --- epparse.c	2000/05/24 14:33:26	1.1.2.16
  +++ epparse.c	2000/05/29 07:34:30	1.1.2.17
  @@ -341,7 +341,7 @@
   		return rc ;
   	    p -> pFollowedBy = pNewTokenTable ;
   
  -	    if ((rc = BuildSubTokenTable (r, pHash, pKey, "inside", p -> sEndText, &pNewTokenTable)))
  +	    if ((rc = BuildSubTokenTable (r, pHash, pKey, "inside", "", &pNewTokenTable)))
   		return rc ;
   	    p -> pInside     = pNewTokenTable ;
   
  @@ -631,7 +631,7 @@
           else if (sEndText == NULL ||
   	    (*pCurr == *sEndText && strncmp (pCurr, sEndText, nEndText) == 0))
               {
  -	    if (pCurr - pCurrStart && nCDataType)
  +	    if ((pCurr - pCurrStart != 0 || nCDataType == ntypAttrValue) && nCDataType)
   		if (!(xNewNode = Node_appendChild (r -> pCurrDomTree,  nCDataType, 0, pCurrStart,
pCurr - pCurrStart, xParentNode, level)))
   		    return 1 ;
               pCurr += nEndText ;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.10  +64 -9     embperl/Embperl/Attic/Syntax.pm
  
  Index: Syntax.pm
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl/Attic/Syntax.pm,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- Syntax.pm	2000/05/26 23:31:09	1.1.2.9
  +++ Syntax.pm	2000/05/29 07:34:31	1.1.2.10
  @@ -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.2.9 2000/05/26 23:31:09 richter Exp $
  +#   $Id: Syntax.pm,v 1.1.2.10 2000/05/29 07:34:31 richter Exp $
   #
   ###################################################################################
   
  @@ -63,6 +63,12 @@
       }
   
   
  +###################################################################################
  +#
  +#   Default Syntax
  +#
  +###################################################################################
  +
   
   
   %Cmds = (
  @@ -233,19 +239,45 @@
               'type'  => { 'text' => 'type',  'nodename' => 'type',  follow =>
\%AssignAttr },
               'name'  => { 'text' => 'name',  'nodename' => 'name',  follow =>
\%AssignAttr },
               'value' => { 'text' => 'value', 'nodename' => 'value', follow =>
\%AssignAttr },
  +            'checked' => { 'text' => 'checked', 'nodetype'   => ntypAttr, },
               %Cmds,
               },
           'procinfo' => {
               embperl => { 
                   perlcode =>
                       [ 
  -                    'if ($fdat{\'%&*name%\'} eq \'%&*value%\') { HTML::Embperl::Node::Element_setAttribut
(%$n%, \'checked\', undef) } else {HTML::Embperl::Node::Element_removeAttribut (%$n%, \'checked\')
};  %&=type:radio|checkbox% ',
  -                    'HTML::Embperl::Node::Element_setAttribut (%$n%, \'value\', $fdat{\'%&*name%\'})
;   %&!value%',
  +                    'if ($fdat{\'%&*name%\'} eq \'%&*value%\') { XML::Embperl::DOM::Element_setAttribut
(%$n%, \'checked\', undef) } else {XML::Embperl::DOM::Element_removeAttribut (%$n%, \'checked\')
};  %&=-type:radio|checkbox% ',
  +                    'XML::Embperl::DOM::Element_setAttribut (%$n%, \'value\', $fdat{\'%&*name%\'}
|| \'\') ;   %&!value%',
                       '$idat{\'%&*name%\'} = \'%&*value%\' ; ',
                       ]
                   }                     
               },
            },
  +    'textarea' => {
  +        'text' => 'textarea',
  +        'nodetype'   => ntypStartTag, 
  +        'forcetype'  => ntypAttrValue,
  +        'cdatatype'  => ntypAttrValue,
  +        'inside' => 
  +            {
  +            'name'  => { 'text' => 'name',  'nodename' => 'name',  follow =>
\%AssignAttr },
  +            %Cmds,
  +            },
  +        'procinfo' => {
  +            embperl => { 
  +                perlcode =>
  +                    [ 
  +                    'XML::Embperl::DOM::Node_appendChild (%$n%, HTML::Embperl::Syntax::ntypText,
$fdat{\'%#&*name%\'}) ;   %#!-0%',
  +                    '$idat{\'%&*name%\'} = \'%#*0%\' ; ',
  +                    ]
  +                }                     
  +            },
  +         },
  +    '/textarea' => {
  +        'text' => '/textarea',
  +        'nodetype'   => ntypEndTag, 
  +        'cdatatype'  => 0,
  +         },
       'tr' => {
           'text' => 'tr',
           'nodetype'   => ntypStartTag, 
  @@ -596,28 +628,51 @@
   =item %#N% 
   
   Text of childnode number N (starting with zero)
  +
  +=item %#*N%
  +
  +Value of attribute <attr>. Attrbute must exist.
   
  -=item %<attr>%
  +=item %#!N%
   
  +Text of childnode number N (starting with zero). Child must not exist.
  +
  +=item %#=N:<value1>|<value2>|<value3>%
  +
  +Text of childnode number N (starting with zero). Child must have the value = <value1>
or <value2> etc.
  +
  +=item %#~N:<value1>|<value2>|<value3>%
  +
  +Text of childnode number N (starting with zero). Child must contain the substring <value1>
or <value2> etc.
  +
  +=item %&<attr>%
  +
   Value of attribute <attr>.
   
  -=item %*<attr>%
  +=item %&*<attr>%
   
   Value of attribute <attr>. Attrbute must exist.
  +
  +=item %&!<attr>%
   
  -=item %!<attr>%
  +Value of attribute <attr>. Attribute must not exist.
   
  -Value of attribute <attr>. Attrbute must not exist.
  +=item %&=<attr>:<value1>|<value2>|<value3>%
   
  -=item %=<attr>=<value>%
  +Value of attribute <attr>. Attribute must have the value = <value1> or <value2>
etc.
   
  -Value of attribute <attr>. Attrbute must have the value = <value>.
  +=item %&~<attr>:<value1>|<value2>|<value3>%
   
  +Value of attribute <attr>. Attribute must contain the substring <value1> or
<value2> etc.
  +
   =item %$n%
   
   Node number.
   
   =back
  +
  +writing a minus sign (-) after * ! = or ~ will cause the child/attribute
  +not to be included, but the condition is evaluated.
   
   =item removenode => <removelevel>
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.15.2.2  +1 -1      embperl/test/cmp/escape.htm
  
  Index: escape.htm
  ===================================================================
  RCS file: /home/cvs/embperl/test/cmp/escape.htm,v
  retrieving revision 1.15.2.1
  retrieving revision 1.15.2.2
  diff -u -r1.15.2.1 -r1.15.2.2
  --- escape.htm	2000/05/24 08:47:33	1.15.2.1
  +++ escape.htm	2000/05/29 07:34:31	1.15.2.2
  @@ -28,7 +28,7 @@
   A Tag 8:   <A TARGET=8  HREF="8">x</A>
   A Tag 9:   <A HREF="9" TARGET="9">x</A>
   A Tag 10:  <A TARGET="10"  HREF="10" TARGET="10">x</A>
  -A Tag 11:  <A HREF="11"  >x</A>
  +A Tag 11:  <A HREF="11">x</A>
   A Tag 12:  <A HREF="12">x</A>
   A Tag 13:  <A HREF="abcd%20%3E">x</A>
   A Tag 14:  <A HREF="abcd%20%3E">x</A>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.4   +5 -4      embperl/test/html/input.htm
  
  Index: input.htm
  ===================================================================
  RCS file: /home/cvs/embperl/test/html/input.htm,v
  retrieving revision 1.9.2.3
  retrieving revision 1.9.2.4
  diff -u -r1.9.2.3 -r1.9.2.4
  --- input.htm	2000/05/08 18:16:28	1.9.2.3
  +++ input.htm	2000/05/29 07:34:32	1.9.2.4
  @@ -1,6 +1,7 @@
  -<table><table></table></table>
  -<html>
  +<input type="checkbox" value="cbv1" name="cb1" checked >
  +
   
  +<html>
   <head>
   <title>Test for interpretation of input tag</title>
   </head>
  @@ -20,8 +21,8 @@
   <form action="inhalt.htm" method="POST">
       <p>&nbsp;</p>
   
  -    <input name=neu1 value="[+ 1 > 2 +]" >
  -    <input name=[+ $name +] value="[+ 1 > 2 +]">
  +    <input name=neu1 value="[+ 1 > 2?'yes':'no' +]" >
  +    <input name=[+ $name || 'undef' +] value="[+ 1 > 2 +]">
   
       <input>
       <input  >
  
  
  

Mime
View raw message