richter 00/12/12 22:54:36
Modified: . Tag: Embperl2c epcomp.c epdom.c
Log:
Embperl2
Revision Changes Path
No revision
No revision
1.4.2.23 +6 -4 embperl/Attic/epcomp.c
Index: epcomp.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epcomp.c,v
retrieving revision 1.4.2.22
retrieving revision 1.4.2.23
diff -u -r1.4.2.22 -r1.4.2.23
--- epcomp.c 2000/12/07 09:35:23 1.4.2.22
+++ epcomp.c 2000/12/13 06:54:36 1.4.2.23
@@ -1007,7 +1007,7 @@
if (pCmd)
{
- if (embperl_CompileToPerlCode (pDomTree, pNode, pCmd -> sPerlCodeEnd,
&pCode))
+ if (pCmd -> sPerlCodeEnd && embperl_CompileToPerlCode (pDomTree, pNode,
pCmd -> sPerlCodeEnd, &pCode))
{
if (pCode)
{
@@ -1175,6 +1175,8 @@
if (pCmd == NULL || pCmd -> bCompileChilds)
{
+ tNodeData * pChildNode ;
+
xChildNode = pNode -> bFlags?Node_firstChild (pDomTree, xNode):0 ;
while (xChildNode)
@@ -1182,10 +1184,10 @@
if ((rc = embperl_CompileNode (r, pDomTree, xChildNode,
bCheckpointPending)) != ok)
return rc ;
- pNode = Node_self (pDomTree, xChildNode) ;
+ pChildNode = Node_self (pDomTree, xChildNode) ;
xChildNode = Node_nextSibling (pDomTree, xChildNode) ;
- if (pNode -> bFlags == 0)
- Node_selfRemoveChild(pDomTree, -1, pNode) ;
+ if (pChildNode -> bFlags == 0)
+ Node_selfRemoveChild(pDomTree, -1, pChildNode) ;
}
}
1.4.2.13 +38 -15 embperl/Attic/epdom.c
Index: epdom.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epdom.c,v
retrieving revision 1.4.2.12
retrieving revision 1.4.2.13
diff -u -r1.4.2.12 -r1.4.2.13
--- epdom.c 2000/12/12 15:07:28 1.4.2.12
+++ epdom.c 2000/12/13 06:54:36 1.4.2.13
@@ -1059,25 +1059,46 @@
/* */
/* Node_selfExpand */
/* */
-/* Create new node and append it to parent */
+/* Expand a node to hold more attributes */
/* */
+/* pNode Node to expand */
+/* numOldAttr number of Attributes in the old node that must be relocated */
+/* (-1 to take form pNode) */
+/* numNewAttr new number of attributes */
+/* */
/* ------------------------------------------------------------------------ */
tNodeData * Node_selfExpand (/*in*/ tDomTree * pDomTree,
/*in*/ tNodeData * pNode,
- /*in*/ tSInt32 nSize)
+ /*in*/ tUInt16 numOldAttr,
+ /*in*/ tUInt16 numNewAttr)
{
tNodeData * pNewChild ;
-
- if (nSize == 0)
- nSize = sizeof (tNodeData) ;
+ tNode xNdx = pNode -> xNdx ;
+ int nSize = sizeof (tNodeData) + numNewAttr * sizeof (tAttrData) ;
- if ((pDomTree -> pLookup[pNode -> xNdx] = pNewChild = dom_realloc (pNode,
nSize)) == NULL)
+ if ((pNewChild = dom_realloc (pNode, nSize)) == NULL)
return NULL ;
+ if (pNewChild != pNode)
+ {
+ tAttrData * pAttr = ((struct tAttrData * )(pNewChild + 1)) ;
+ void * * pLookup = pDomTree -> pLookup ;
+
+ if (numOldAttr == (tUInt16) -1)
+ numOldAttr = pNewChild -> numAttr ;
+
+ pLookup[xNdx] = pNewChild ;
+
+ while (numOldAttr--)
+ {
+ pLookup[pAttr -> xNdx] = pAttr ;
+ pAttr++ ;
+ }
+ }
return pNewChild ;
}
@@ -1113,11 +1134,9 @@
struct tAttrData * pNew ;
tIndex xNdx ;
- pParent = dom_realloc (pParent, sizeof (tNodeData) + (pParent -> numAttr + 1)
* sizeof (tAttrData)) ;
- pDomTree -> pLookup[xParent] = pParent ;
+ pParent = Node_selfExpand (pDomTree, pParent, -1, pParent -> numAttr + 1) ;
- pNew = ((struct tAttrData * )(pParent + 1)) + pParent -> numAttr ;
-
+ pNew = ((struct tAttrData * )(pParent + 1)) + pParent -> numAttr ;
xNdx = ArrayAdd (&pDomTree -> pLookup, 1) ;
pDomTree -> pLookup[xNdx] = (struct tNodeData *)pNew ;
@@ -1478,9 +1497,10 @@
int nOffset ;
tAttrData * pAttr ;
int n ;
+ void * * pLookup ;
- pOldChild = Node_selfExpand (pOldChildDomTree, pOldChild, len) ;
+ pOldChild = Node_selfExpand (pOldChildDomTree, pOldChild, 0, pNode ->
numAttr) ;
if (pOldChild -> nText)
NdxStringFree (pOldChild -> nText) ;
@@ -1510,13 +1530,16 @@
pAttr = ((struct tAttrData * )(pOldChild + 1)) ;
n = pNode -> numAttr ;
+ pLookup = pDomTree -> pLookup ;
+
while (n > 0)
{
if (pAttr -> xName)
NdxStringRefcntInc (pAttr -> xName) ;
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue))
NdxStringRefcntInc (pAttr -> xValue) ;
+ pLookup[pAttr -> xNdx] = pAttr ;
n-- ;
pAttr++ ;
}
@@ -1823,11 +1846,11 @@
tNodeData * pParent ;
if (pNode -> xNext == pNode -> xNdx)
- return NULL ;
+ return 0 ;
pParent = Node_self (pDomTree, pNode -> xParent) ;
if (pParent -> xChilds == pNode -> xNext)
- return NULL ;
+ return 0 ;
return pNode -> xNext ;
}
@@ -1849,11 +1872,11 @@
tNodeData * pParent ;
if (pNode -> xPrev == pNode -> xNdx)
- return NULL ;
+ return 0 ;
pParent = Node_self (pDomTree, pNode -> xParent) ;
if (pParent -> xChilds == pNode -> xPrev)
- return NULL ;
+ return 0 ;
return Node_self (pDomTree, pNode -> xPrev) ;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]