richter     00/05/12 07:13:45

  Modified:    .        Tag: Embperl2 epdom.c epdom.h
  Log:
  
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +32 -16    embperl/Attic/epdom.c
  
  Index: epdom.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epdom.c,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- epdom.c   2000/05/11 07:27:54     1.1.2.6
  +++ epdom.c   2000/05/12 14:13:44     1.1.2.7
  @@ -289,6 +289,7 @@
       if ((pPadLookup [xNdx] = pChilds = dom_malloc (nInitialNodePadSize)) == NULL)
        return NULL ;
       
  +    pChilds -> nType = ntypPad ;
       pChilds -> nFill = sizeof (struct tNodePad) ;
       pChilds -> nMax  = nInitialNodePadSize  ;
       pChilds -> numChilds = 0 ;
  @@ -330,8 +331,10 @@
   
       if (nType == ntypAttr)
        {           
  -     struct tNodePad *       pPad    = (struct tNodePad * )(((tUInt8 *)pParent) - 
pParent -> nPadNdx) ;
  -     struct tAttrData * pNew = ((struct tAttrData * )(pParent + 1)) + pParent -> 
numAttr ;
  +     struct tNodePad *   pPad = (struct tNodePad * )(((tUInt8 *)pParent) - pParent 
-> nPadOffset) ;
  +     struct tAttrData *  pNew = ((struct tAttrData * )(pParent + 1)) + pParent -> 
numAttr ;
  +     tIndex              xNdx ;
  +
        if (((tUInt8 *)pNew) - ((tUInt8 *)pPad) != pPad -> nFill)
            { /* not last child in pad -> make room */
            mydie ("not last child in pad -> make room") ;
  @@ -351,34 +354,47 @@
            pNext -> xFirst = pPad->xFirst ;
   
            memcpy (pNewParent, pParent, nNodeSize) ;
  -         pNewParent -> nPadNdx = pNext -> nFill ;
  +         pNewParent -> nPadOffset = pNext -> nFill ;
            pNodeLookup [xParent] = pParent = pNewParent ;
            pNew = ((struct tAttrData * )(pParent + 1)) + pParent -> numAttr ;
            pPad  -> nFill -= nNodeSize ;
            pNext -> nFill += nNodeSize ;
            pPad = pNext ;
            }
  +
  +     xNdx = ArrayAdd (&pNodeLookup, 1) ;
  +     pNodeLookup[xNdx] = (struct tNodeData *)pNew ;
   
  -     pNew -> nName = String2Ndx (sText, nTextLen) ;
  -     pNew -> nValue = 0 ;
  +     pNew -> xName  = String2Ndx (sText, nTextLen) ;
  +     pNew -> xValue = 0 ;
  +     pNew -> nType = nType ;
  +     pNew -> xNdx    = xNdx ;
  +     pNew -> nNodeOffset = ((tUInt8 *)pNew) - ((tUInt8 *)pParent) ;
        pParent -> numAttr++ ;
        pPad -> nFill += sizeof (struct tAttrData) ;
        numAttr++ ;
  -     return 1 ;
  +     return xNdx ;
        }
       else if (nType == ntypAttrValue)
        {           
  -     struct tAttrData * pNew = ((struct tAttrData * )pParent + 1) + (pParent -> 
numAttr - 1);
  -     pNew -> nValue = String2Ndx (sText, nTextLen) ;
  +     struct tAttrData * pNew = (struct tAttrData * )pNodeLookup[xParent] ; // 
((struct tAttrData * )pParent + 1) + (pParent -> numAttr - 1);
  +     pNew -> xValue = String2Ndx (sText, nTextLen) ;
        return 1 ;
        }
       else
        {
        struct tNodePad *   pChilds ;
        struct tNodeData *  pNew    ;
  -     int                 xNdx ;
  +     tIndex              xNdx ;
   
  -     if (!pParent || !pParent -> xChilds)
  +     if (pParent && pParent -> nType == ntypAttr)
  +         {
  +         pChilds = NewPad (xParent)  ;
  +         lprintf (r, "[%d]PARSE: NewPad NewAttrChild: %d -> %d\n", r -> nPid, 
xParent, pChilds -> xNdx) ; 
  +
  +         ((struct tAttrData *)pParent) -> xValue = pChilds -> xNdx ;
  +         }
  +     else if (!pParent || !pParent -> xChilds)
            {
            pChilds = NewPad (xParent)  ;
            lprintf (r, "[%d]PARSE: NewPad NewChild: %d -> %d\n", r -> nPid, xParent, 
pChilds -> xNdx) ; 
  @@ -416,7 +432,7 @@
        pNew -> numAttr = 0 ;
        pNew -> xNdx    = xNdx ;
        pNew -> xChilds = 0 ;
  -     pNew -> nPadNdx = pChilds -> nFill ;
  +     pNew -> nPadOffset = pChilds -> nFill ;
   
        pChilds -> numChilds++ ;
        pChilds -> nFill += sizeof (struct tNodeData) ;
  @@ -438,7 +454,7 @@
   
       {
       struct tNodeData *       pNode = pNodeLookup [xNode] ;
  -    struct tNodePad *        pPad    = (struct tNodePad * )(((tUInt8 *)pNode) - 
pNode -> nPadNdx) ;
  +    struct tNodePad *        pPad    = (struct tNodePad * )(((tUInt8 *)pNode) - 
pNode -> nPadOffset) ;
       /* lprintf (pCurrReq, "[%d]PARSE: parentNode: %d -> %d\n", pCurrReq -> nPid, 
xNode, pPad -> xParent) ; */
       return pPad -> xParent ;
       }
  @@ -517,11 +533,11 @@
   
       {
       struct tNodeData *       pNode = pNodeLookup[xNode] ;
  -    struct tNodePad *        pPad    = (struct tNodePad * )(((tUInt8 *)pNode) - 
pNode -> nPadNdx) ;
  +    struct tNodePad *        pPad    = (struct tNodePad * )(((tUInt8 *)pNode) - 
pNode -> nPadOffset) ;
   
       int nOffset = sizeof (struct tNodeData) + sizeof (struct tAttrData) * pNode -> 
numAttr ;
       
  -    if (pPad -> nFill <= pNode -> nPadNdx + nOffset) 
  +    if (pPad -> nFill <= pNode -> nPadOffset + nOffset) 
        { /* next pad */
        if (!pPad -> xNext)
            return 0 ;
  @@ -554,14 +570,14 @@
       struct tAttrData * pAttr = (struct tAttrData * )(pNode + 1) ;
       int  n = pNode -> numAttr ;
   
  -    while (n > 0 && nAttrName != pAttr -> nName)
  +    while (n > 0 && nAttrName != pAttr -> xName)
        {
        n-- ;
        pAttr++ ;
        }
   
       if (n)
  -     return Ndx2String (pAttr -> nValue) ;
  +     return Ndx2String (pAttr -> xValue) ;
   
       return NULL ;
       }
  
  
  
  1.1.2.4   +14 -7     embperl/Attic/epdom.h
  
  Index: epdom.h
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epdom.h,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- epdom.h   2000/05/11 07:27:54     1.1.2.3
  +++ epdom.h   2000/05/12 14:13:44     1.1.2.4
  @@ -30,15 +30,17 @@
   typedef unsigned long        tUInt32 ;
   typedef signed long  tSInt32 ;
   
  -typedef tUInt16              tIndex ;
  -typedef tUInt16              tStringIndex ;
  +typedef tUInt32              tIndex ;
  +typedef tIndex               tStringIndex ;
   
   typedef tUInt8          tNodeType ;
   typedef tIndex               tNode    ;
   
   
  +
   struct tNodePad
       {
  +    tNodeType                nType ;
       tIndex           xParent ;
       tIndex           xNdx ;
       tIndex           xPrev ;
  @@ -54,9 +56,9 @@
   struct tNodeData
       {
       tNodeType                nType ;
  -    tUInt16          nPadNdx ;
  +    tUInt16          nPadOffset ;
       tIndex           xNdx ;
  -    tUInt16             nText ;
  +    tStringIndex        nText ;
       tUInt16          numAttr ;
       tIndex           xChilds ;
       } ;
  @@ -64,18 +66,23 @@
   
   struct tAttrData
       {
  -    tUInt16             nName ;
  -    tUInt16             nValue ;
  +    tNodeType                nType ;
  +    tUInt16          nNodeOffset ;
  +    tIndex           xNdx ;
  +    tIndex              xName ;
  +    tIndex              xValue ;
       } ;
   
  +
   
  -    /*
  +/*
     Node Types
   */
   
   
   enum tNodeType
       {
  +    ntypPad      = -1,
       ntypCDATA            = 1,
       ntypTag      = 2,
       ntypStartTag    = 3,
  
  
  

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

Reply via email to