richter     00/09/26 12:32:22

  Modified:    .        Tag: Embperl2c DOM.xs Embperl.xs ep.h epcmd.c
                        epcomp.c epdom.c epdom.h epeval.c test.pl typemap
               Embperl  Tag: Embperl2c Syntax.pm
               test/cmp Tag: Embperl2c callsub.htm
               test/html Tag: Embperl2c callsub.htm importsub.htm
  Log:
  Embperl 2 - sub's
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.3   +151 -12   embperl/DOM.xs
  
  Index: DOM.xs
  ===================================================================
  RCS file: /home/cvs/embperl/DOM.xs,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- DOM.xs    2000/09/14 05:08:25     1.1.2.2
  +++ DOM.xs    2000/09/26 19:31:56     1.1.2.3
  @@ -21,14 +21,63 @@
   
   MODULE = XML::Embperl::DOM      PACKAGE = XML::Embperl::DOM::Node     PREFIX = 
embperl_Node_
   
  +void
  +embperl_Node_attach (pRV,xDomTree,xNode)
  +    SV * pRV ;
  +    int  xDomTree
  +    int  xNode
  +CODE:
  +    tDomNode * pDomNode ;
  +    MAGIC * mg ;
  +    SV *    pSV = SvRV(pRV) ;
  +    if (mg = mg_find (pSV, '~'))
  +        {
  +        pDomNode = (tDomNode *)(mg -> mg_len) ;
  +        if (xDomTree)
  +            pDomNode -> xDomTree = xDomTree ;
  +        if (xNode)    
  +            pDomNode -> xNode = xNode ;
  +        }    
  +    else
  +        {
  +        Newc (0, pDomNode, 1, sizeof (tDomNode), tDomNode) ;
  +        pDomNode -> xDomTree = xDomTree ;
  +        pDomNode -> xNode = xNode ;
  +        pDomNode -> pDomNodeSV = pRV ;
  +        /* sv_unmagic ((SV *)pSV, '~') ; */
  +        sv_magic ((SV *)pSV, NULL, '~', NULL, (STRLEN)pDomNode) ;
  +        /* sv_bless (pRV, gv_stashpv ("XML::Embperl::DOM::Node", 0)) ; */
  +        }
  +    
  +
  +
  +SV *
  +embperl_Node_replaceChildWithCDATA (pDomNode,sText)
  +    tDomNode * pDomNode
  +    SV *     sText
  +PREINIT:
  +    STRLEN l ;
  +    char * s  ;
  +PPCODE:
  +    s = SV2String (sText, l) ;
  +    Node_replaceChildWithCDATA (DomTree_self(pDomNode -> xDomTree), -1, pDomNode -> 
xNode, s, l, (pCurrReq -> nCurrEscMode & 3)== 3?1 + (pCurrReq -> nCurrEscMode & 
4):pCurrReq -> nCurrEscMode, nflgModified | nflgReturn) ;
  +    pCurrReq -> nCurrEscMode = pCurrReq -> nEscMode ;
  +    pCurrReq -> bEscModeSet = -1 ;
  +    /*SvREFCNT_inc (sText) ;*/
  +    ST(0) = sText ;
  +    XSRETURN(1) ;
  +
  +
   SV *
  -embperl_Node_replaceChildWithCDATA (xDomTree, xOldChild,sText)
  +embperl_Node_iReplaceChildWithCDATA (xDomTree, xOldChild,sText)
       int xDomTree
       int xOldChild
       SV * sText
  -PPCODE:
  +PREINIT:
       STRLEN l ;
  -    char * s = SV2String (sText, l) ;
  +    char * s  ;
  +PPCODE:
  +    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 ;
  @@ -36,8 +85,22 @@
       ST(0) = sText ;
       XSRETURN(1) ;
   
  +
  +
   SV *
  -embperl_Node_replaceChildWithUrlDATA (xDomTree, xOldChild,sText)
  +embperl_Node_replaceChildWithUrlDATA (pDomNode,sText)
  +    tDomNode * pDomNode
  +    SV * sText
  +PREINIT:
  +    SV * sRet  ;
  +PPCODE:
  +    sRet = Node_replaceChildWithUrlDATA (pDomNode -> xDomTree, pDomNode -> 
xNode,sText) ;
  +
  +    ST(0) = sRet ;
  +    XSRETURN(1) ;
  +
  +SV *
  +embperl_Node_iReplaceChildWithUrlDATA (xDomTree, xOldChild,sText)
       int xDomTree
       int xOldChild
       SV * sText
  @@ -49,7 +112,14 @@
   
   
   void
  -embperl_Node_removeChild (xDomTree, xChild)
  +embperl_Node_removeChild (pDomNode)
  +    tDomNode * pDomNode
  +CODE:
  +    Node_removeChild (DomTree_self (pDomNode -> xDomTree), -1, pDomNode -> xNode) ;
  +
  +
  +void
  +embperl_Node_iRemoveChild (xDomTree, xChild)
       int xDomTree
       int xChild
   CODE:
  @@ -57,7 +127,26 @@
   
   
   void
  -embperl_Node_appendChild (xDomTree, xParent, nType, sText)
  +embperl_Node_appendChild (pParentNode, nType, sText)
  +    tDomNode * pParentNode
  +    int nType
  +    SV * sText
  +PREINIT:
  +    int xNewParent ;
  +    STRLEN nText ;
  +    char * sT  ;
  +    tDomTree * pDomTree  ;
  +CODE:
  +    sT = SV2String (sText, nText) ;
  +    pDomTree = DomTree_self(pParentNode -> xDomTree) ;
  +    Node_self (pDomTree,pParentNode -> xNode) -> bFlags |= nflgModified | 
nflgReturn ;
  +    xNewParent = Node_cloneNode (pDomTree, pParentNode -> xNode, 1) ;
  +    DomTree_selfCheckpoint (pDomTree, pParentNode -> xNode, xNewParent) ;
  +    Node_appendChild (pDomTree, nType, 0, sT, nText, xNewParent, 0, 0) ;
  +
  +
  +void
  +embperl_Node_iAppendChild (xDomTree, xParent, nType, sText)
       int xDomTree
       int xParent
       int nType
  @@ -76,9 +165,8 @@
   
   MODULE = XML::Embperl::DOM      PACKAGE = XML::Embperl::DOM::Tree     PREFIX = 
embperl_DomTree_
   
  -
   void
  -embperl_DomTree_checkpoint (xDomTree, xChild)
  +embperl_DomTree_iCheckpoint (xDomTree, xChild)
       int xDomTree
       int xChild
   CODE:
  @@ -87,7 +175,7 @@
       DomTree_checkpoint (xDomTree, xChild) ;
   
   void
  -embperl_DomTree_discardAfterCheckpoint (xDomTree, xNode)
  +embperl_DomTree_iDiscardAfterCheckpoint (xDomTree, xNode)
       int xDomTree
       int xNode
   CODE:
  @@ -107,8 +195,28 @@
   MODULE = XML::Embperl::DOM      PACKAGE = XML::Embperl::DOM::Element     PREFIX = 
embperl_Element_
   
   
  +void
  +embperl_Element_setAttribut (pDomNode, sAttr, sText)
  +    tDomNode * pDomNode
  +    SV * sAttr
  +    SV * sText
  +PREINIT:
  +    STRLEN nAttr ;
  +    STRLEN nText ;
  +    char * sT  ;
  +    char * sA  ;
  +    tDomTree * pDomTree ;
  +CODE:
  +    sT = SV2String (sText, nText) ;
  +    sA = SV2String (sAttr, nAttr) ;
  +
  +    pDomTree = DomTree_self (pDomNode -> xDomTree) ;
  +
  +    Element_selfSetAttribut (pDomTree, Node_self (pDomTree, pDomNode -> xNode), sA, 
nAttr, sT, nText, 1) ;
  +
  +
   void
  -embperl_Element_setAttribut (xDomTree, xNode, sAttr, sText)
  +embperl_Element_iSetAttribut (xDomTree, xNode, sAttr, sText)
       int xDomTree
       int xNode
       SV * sAttr
  @@ -126,7 +234,22 @@
   
   
   void
  -embperl_Element_removeAttribut (xDomTree, xNode, sAttr)
  +embperl_Element_removeAttribut (pDomNode, xNode, sAttr)
  +    tDomNode * pDomNode
  +    SV * sAttr
  +PREINIT:
  +    STRLEN nAttr ;
  +    char * sA  ;
  +    tDomTree * pDomTree ;
  +CODE:
  +    sA = SV2String (sAttr, nAttr) ;
  +    pDomTree = DomTree_self (pDomNode -> xDomTree) ;
  +
  +    Element_selfRemoveAttribut (pDomTree, Node_self (pDomTree, pDomNode -> xNode), 
sA, nAttr, 1) ;
  +
  +
  +void
  +embperl_Element_iRemoveAttribut (xDomTree, xNode, sAttr)
       int xDomTree
       int xNode
       SV * sAttr
  @@ -144,8 +267,24 @@
   
   
   
  +SV *
  +embperl_Attr_value (pAttr)
  +    tDomNode * pAttr
  +PREINIT:
  +    tDomTree * pDomTree  ;
  +    char * sAttrText = NULL ;
  +CODE:
  +    pDomTree = DomTree_self (pAttr -> xDomTree) ;
  +
  +    Attr_selfValue (pDomTree, Attr_self(pDomTree, pAttr -> xNode), &sAttrText) ;
  +    RETVAL = newSVpv (sAttrText, ArrayGetSize (sAttrText)) ;
  +    StringFree (&sAttrText) ;
  +OUTPUT:
  +    RETVAL
  +
  +
   SV *
  -embperl_Attr_value (xDomTree, xAttr)
  +embperl_Attr_iValue (xDomTree, xAttr)
       int xDomTree
       int xAttr
   CODE:
  
  
  
  1.29.4.3  +1 -1      embperl/Embperl.xs
  
  Index: Embperl.xs
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl.xs,v
  retrieving revision 1.29.4.2
  retrieving revision 1.29.4.3
  diff -u -r1.29.4.2 -r1.29.4.3
  --- Embperl.xs        2000/09/14 05:08:26     1.29.4.2
  +++ Embperl.xs        2000/09/26 19:31:57     1.29.4.3
  @@ -11,7 +11,7 @@
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
   
###################################################################################*/
  -
  + 
   
   #include "ep.h"
   
  
  
  
  1.27.4.3  +4 -2      embperl/ep.h
  
  Index: ep.h
  ===================================================================
  RCS file: /home/cvs/embperl/ep.h,v
  retrieving revision 1.27.4.2
  retrieving revision 1.27.4.3
  diff -u -r1.27.4.2 -r1.27.4.3
  --- ep.h      2000/09/14 05:08:26     1.27.4.2
  +++ ep.h      2000/09/26 19:31:57     1.27.4.3
  @@ -465,8 +465,10 @@
   /* ---- from epeval.c ----- */
   
   
  -int EvalDirect (/*i/o*/ register req * r,
  -                     /*in*/  SV * pArg) ;
  +int EvalDirect (/*i/o*/ register req *       r,
  +             /*in*/  SV *            pArg,
  +                /*in*/  int          numArgs,
  +                /*in*/  SV **                pArgs) ;
   
   int EvalNum (/*i/o*/ register req * r,
             /*in*/  char *        sArg,
  
  
  
  1.37.4.1  +1 -1      embperl/epcmd.c
  
  Index: epcmd.c
  ===================================================================
  RCS file: /home/cvs/embperl/epcmd.c,v
  retrieving revision 1.37
  retrieving revision 1.37.4.1
  diff -u -r1.37 -r1.37.4.1
  --- epcmd.c   2000/09/12 12:49:48     1.37
  +++ epcmd.c   2000/09/26 19:31:58     1.37.4.1
  @@ -877,7 +877,7 @@
                   r -> Buf.sEvalPackage, r -> Buf.nSourceline, r -> Buf.pFile -> 
sSourcefile, sArg,
                   r -> Buf.sEvalPackage, sArg) ;
   
  -    rc = EvalDirect (r, pSV) ;
  +    rc = EvalDirect (r, pSV, 0, NULL) ;
       SvREFCNT_dec(pSV);
   
       return rc ;
  
  
  
  1.4.2.5   +59 -23    embperl/Attic/epcomp.c
  
  Index: epcomp.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epcomp.c,v
  retrieving revision 1.4.2.4
  retrieving revision 1.4.2.5
  diff -u -r1.4.2.4 -r1.4.2.5
  --- epcomp.c  2000/09/19 07:21:56     1.4.2.4
  +++ epcomp.c  2000/09/26 19:31:58     1.4.2.5
  @@ -23,9 +23,11 @@
       const char *    sPerlCodeEnd ;          /* perl code that should be inserted at 
the end tag  */
       const char *    sStackName ;
       const char *    sPushStack ;
  +    const char *    sPopStack ;
       const char *    sMatchStack ;
       const char *    sStackName2 ;
       const char *    sPushStack2 ;
  +    const char *    sPopStack2 ;
       int                  numPerlCode ;
       int                  numCompileTimePerlCode ;
       int                  bRemoveNode ;
  @@ -184,18 +186,20 @@
       
       
       
  -    pCmd -> sPerlCodeEnd = GetHashValueStrDup  (pHash, "perlcodeend", NULL) ;
  -    pCmd -> sStackName   = GetHashValueStrDup  (pHash, "stackname", NULL) ;
  -    pCmd -> sPushStack   = GetHashValueStrDup  (pHash, "push", NULL) ;
  -    pCmd -> sMatchStack   = GetHashValueStrDup  (pHash, "stackmatch", NULL) ;
  -    pCmd -> sStackName2   = GetHashValueStrDup (pHash, "stackname2", NULL) ;
  -    pCmd -> sPushStack2   = GetHashValueStrDup (pHash, "push2", NULL) ;
  -    pCmd -> bRemoveNode  = GetHashValueInt     (pHash, "removenode", 0) ;
  -    pCmd -> sMayJump     = GetHashValueStrDup  (pHash, "mayjump", NULL) ;
  -    pCmd -> bPerlCodeRemove  = GetHashValueInt (pHash, "perlcoderemove", 0) ;
  -    pCmd -> bCompileChilds  = GetHashValueInt  (pHash, "compilechilds", 1) ;
  -    pCmd -> nSwitchCodeType  = GetHashValueInt  (pHash, "switchcodetype", 0) ;
  -    pCmd -> nNodeType  = nNodeType ;
  +    pCmd -> sPerlCodeEnd    = GetHashValueStrDup (pHash, "perlcodeend", NULL) ;
  +    pCmd -> sStackName           = GetHashValueStrDup (pHash, "stackname", NULL) ;
  +    pCmd -> sPushStack           = GetHashValueStrDup (pHash, "push", NULL) ;
  +    pCmd -> sPopStack            = GetHashValueStrDup (pHash, "pop", NULL) ;
  +    pCmd -> sMatchStack          = GetHashValueStrDup (pHash, "stackmatch", NULL) ;
  +    pCmd -> sStackName2          = GetHashValueStrDup (pHash, "stackname2", NULL) ;
  +    pCmd -> sPushStack2          = GetHashValueStrDup (pHash, "push2", NULL) ;
  +    pCmd -> sPopStack2           = GetHashValueStrDup (pHash, "pop2", NULL) ;
  +    pCmd -> bRemoveNode          = GetHashValueInt    (pHash, "removenode", 0) ;
  +    pCmd -> sMayJump     = GetHashValueStrDup (pHash, "mayjump", NULL) ;
  +    pCmd -> bPerlCodeRemove = GetHashValueInt         (pHash, "perlcoderemove", 0) ;
  +    pCmd -> bCompileChilds  = GetHashValueInt         (pHash, "compilechilds", 1) ;
  +    pCmd -> nSwitchCodeType = GetHashValueInt         (pHash, "switchcodetype", 0) ;
  +    pCmd -> nNodeType            = nNodeType ;
       pCmd -> pNext  = NULL ;
   
       pEmbperlCmds[nNodeName].bRemoveNode |= pCmd -> bRemoveNode ;
  @@ -265,8 +269,18 @@
       
       if (sText)
        {
  -        if (op == '=' && eq)
  +     int l = strlen (sText) ;
  +     if (out == 3)
            {
  +         out = 2 ;
  +         while (isspace (*sText))
  +             sText++, l-- ;
  +         while (l > 0 && isspace (sText[l-1]))
  +             l-- ;
  +         }
  +
  +     if (op == '=' && eq)
  +         {
            eq++ ;
            do
                {
  @@ -305,7 +319,7 @@
            if (out == 2)
                {
                StringAdd (ppCode, "'", 1) ;
  -             StringAdd (ppCode, sText, 0) ;
  +             StringAdd (ppCode, sText, l) ;
                StringAdd (ppCode, "'", 1) ;
                }
            else if (out)            
  @@ -581,7 +595,7 @@
        {
        if (pChildNode -> bFlags & aflgAttrChilds)
            {
  -         int l = sprintf (buf, "XML::Embperl::DOM::Attr::value ($_ep_DomTree,%d)", 
pChildNode -> xNdx) ;
  +         int l = sprintf (buf, "XML::Embperl::DOM::Attr::iValue ($_ep_DomTree,%d)", 
pChildNode -> xNdx) ;
            sText = buf ;
            if (out == 2)
                out = 1 ;
  @@ -645,6 +659,8 @@
                    out = 0, p++ ;
                else if (*p == '\'')
                    out = 2, p++ ;
  +             else if (*p == '"')
  +                 out = 3, p++ ;
   
                
                if (type == '#')
  @@ -811,7 +827,7 @@
   
                pSV = newSVpvf("package %s ; \n#line %d \"%s\"\n%*.*s",
                        pCurrReq -> Buf.sEvalPackage, pNode ->  nLinenumber, 
sSourcefile, l,l, pCode) ;
  -             if ((rc = EvalDirect (pCurrReq, pSV)) != ok)
  +             if ((rc = EvalDirect (pCurrReq, pSV, 0, NULL)) != ok)
                    LogError (pCurrReq, rc) ;
                SvREFCNT_dec(pSV);
                }
  @@ -920,6 +936,11 @@
   
        }
   
  +    if (pCmd -> sPopStack)
  +     embperl_CompilePopStack (pDomTree, pCmd -> sPopStack) ;
  +    if (pCmd -> sPopStack2)
  +     embperl_CompilePopStack (pDomTree, pCmd -> sPopStack2) ;
  +
       if (pCmd -> sStackName)
        {
        if (pCmd -> sMatchStack && pNode -> nType != ntypStartTag && pNode -> nType != 
ntypDocument && pNode -> nType != ntypDocumentFraq)
  @@ -1022,11 +1043,11 @@
                        return rc ;
                    }
                }
  -         else if (pCmd -> sPushStack)
  +         else if (pCmd -> sPushStack && pCmd -> sPerlCodeEnd)
                embperl_CompilePopStack (pDomTree, pCmd -> sStackName) ;
            }
   
  -        if (pCmd -> sStackName2 && pCmd -> sPushStack2)
  +        if (pCmd -> sStackName2 && pCmd -> sPushStack2 && pCmd -> sPerlCodeEnd)
               embperl_CompilePopStack (pDomTree, pCmd -> sStackName2) ;
     
        if (pCmd -> nSwitchCodeType == 1)
  @@ -1258,6 +1279,8 @@
           }
       else if (*ppSV == NULL || !SvIOKp (*ppSV) )
        {
  +     SV * args[2] ;
  +     
        r -> nPhase  = phParse ;
   
        if (*ppSV)
  @@ -1324,8 +1347,10 @@
        if (l && pCurrReq -> bDebug & dbgParse)
            lprintf (r, "[%d]EPCOMP: AfterCompileTimeCode:    %*.*s\n", r -> nPid, l, 
l, pProgDef) ; 
   
  -     pSV = newSVpvf("package %s ; \n%*.*s", r -> Buf.sEvalPackage, l,l, pProgDef) ;
  -     if ((rc = EvalDirect (r, pSV)) != ok)
  +     pSV = newSVpvf("package %s ; \nmy ($_ep_req, $ep_DomTree) = @_;\n%*.*s", r -> 
Buf.sEvalPackage, l,l, pProgDef) ;
  +     args[0] = r -> pReqSV ;
  +     args[1] = pDomTree -> pDomTreeSV ;
  +     if ((rc = EvalDirect (r, pSV, 2, args)) != ok)
            LogError (r, rc) ;
        SvREFCNT_dec(pSV);
       
  @@ -1384,21 +1409,30 @@
        if (pSV)
            {
            SV * args[2] ;
  +         STRLEN l ;
  +         SV * sDomTreeSV = newSVpvf ("%s::%s", r -> Buf.sEvalPackage, 
"_ep_DomTree") ;
  +         SV * pDomTreeSV = perl_get_sv (SvPV (sDomTreeSV, l), TRUE) ;
  +         IV xOldDomTree = 0 ;
  +         
  +         if (SvIOK (pDomTreeSV))
  +             xOldDomTree = SvIVX (pDomTreeSV) ;
  +
  +         SvREFCNT_dec (sDomTreeSV) ;
  +         sv_setiv (pDomTreeSV, r -> xCurrDomTree) ;
   
            nCheckpointCache = 0 ;
            xCheckpointCache[nCheckpointCache++] = 0 ;
            xCheckpointCache[nCheckpointCache++] = 0 ;
            
            args[0] = r -> pReqSV ;
  -         args[1] = pCurrDomTree -> pDomTreeSV ;
            if (sSubName)
                {
                SV * pSVName = newSVpvf ("%s::%s", r -> Buf.sEvalPackage, sSubName) ;
  -             rc = CallStoredCV (r, pProgRun, (CV *)pSVName, 2, args, 0, &pSV) ;
  +             rc = CallStoredCV (r, pProgRun, (CV *)pSVName, 1, args, 0, &pSV) ;
                }
            else
                {
  -             rc = CallStoredCV (r, pProgRun, (CV *)pSV, 2, args, 0, &pSV) ;
  +             rc = CallStoredCV (r, pProgRun, (CV *)pSV, 1, args, 0, &pSV) ;
                if (pSV)
                    SvREFCNT_dec (pSV) ;
                }
  @@ -1413,6 +1447,8 @@
                }
       #endif    
   
  +         DomTree_checkpoint (r -> xCurrDomTree, -1) ;
  +         sv_setiv (pDomTreeSV, xOldDomTree) ;
            }
   
           if (rc != ok && rc != rcEvalErr)
  
  
  
  1.4.2.3   +29 -11    embperl/Attic/epdom.c
  
  Index: epdom.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epdom.c,v
  retrieving revision 1.4.2.2
  retrieving revision 1.4.2.3
  diff -u -r1.4.2.2 -r1.4.2.3
  --- epdom.c   2000/09/19 07:21:59     1.4.2.2
  +++ epdom.c   2000/09/26 19:31:59     1.4.2.3
  @@ -391,8 +391,8 @@
            if (bInc)
                SvREFCNT_inc (*ppSV) ;
            nNdx = SvIVX (*ppSV) ;
  -         //if (nNdx < 5 || nNdx == 92)
  -         //  lprintf (pCurrReq, "old string %s (#%d) refcnt=%d\n", Ndx2String 
(nNdx), nNdx, SvREFCNT(*ppSV)) ;
  +         if (nNdx < 6 || nNdx == 92)
  +             lprintf (pCurrReq, "old string %s (#%d) refcnt=%d\n", Ndx2String 
(nNdx), nNdx, SvREFCNT(*ppSV)) ;
            return nNdx ;
            }
        }
  @@ -419,8 +419,8 @@
   
       numStr++ ;
   
  -    //if (nNdx < 5 || nNdx == 92)
  -    //       lprintf (pCurrReq, "new string %s (#%d) refcnt=%d\n", Ndx2String 
(nNdx), nNdx, SvREFCNT(pSVNdx)) ;
  +    if (nNdx < 6 || nNdx == 92)
  +     lprintf (pCurrReq, "new string %s (#%d) refcnt=%d\n", Ndx2String (nNdx), nNdx, 
SvREFCNT(pSVNdx)) ;
       
       return nNdx ;    
       }
  @@ -442,8 +442,8 @@
       
       SvREFCNT_dec (pSVNdx) ;
   
  -    //if (nNdx < 5 || nNdx == 92)
  -    //       lprintf (pCurrReq, "free string %s (#%d) refcnt=%d\n", Ndx2String 
(nNdx), nNdx, SvREFCNT(pSVNdx)) ;
  +    if (nNdx < 6 || nNdx == 92)
  +     lprintf (pCurrReq, "free string %s (#%d) refcnt=%d\n", Ndx2String (nNdx), 
nNdx, SvREFCNT(pSVNdx)) ;
       
       if (SvREFCNT(pSVNdx) == 1)
        {
  @@ -741,7 +741,12 @@
        pAttr -> bFlags = aflgOK ; /* reset string value flag */
        pDomTree -> xDocument = pDocument -> xNdx ;
        pDocument -> nType = ntypDocumentFraq ;
  -     pDocument -> nText = xDocumentFraq ;
  +     if (pDocument -> nText != xDocumentFraq)
  +         {
  +         NdxStringFree (pDocument -> nText) ;
  +         pDocument -> nText = xDocumentFraq ;
  +         NdxStringRefcntInc (xDocumentFraq) ;
  +         }
        }
       
   
  @@ -1220,6 +1225,7 @@
       {
       tNodeData *      pParent;
       tNodePad *  pPad ;
  +    tIndex   xText ;
   
       pPad    = Node_condClonePad (pDomTree, xParent) ;
       pParent = Node_self (pDomTree, xParent) ;
  @@ -1361,7 +1367,15 @@
            pChilds = NodePad_self (pDomTree, pParent -> xChilds) ;
            }
   
  -        pNew = NodePad_appendChild (pDomTree, &pChilds, nType, sText?String2Ndx 
(sText, nTextLen):nTextLen, nLinenumber) ;
  +        
  +     if (sText)
  +         xText = String2Ndx (sText, nTextLen) ;
  +     else
  +         {
  +         NdxStringRefcntInc(nTextLen) ;
  +         xText = nTextLen ;
  +         }
  +     pNew = NodePad_appendChild (pDomTree, &pChilds, nType, xText, nLinenumber) ;
        
        if (pCurrReq -> bDebug & dbgParse)
            lprintf (pCurrReq, "[%d]PARSE: AddNode: +%02d %*s Element parent=%d 
node=%d type=%d text=%*.*s (#%d)\n", pCurrReq -> nPid, nLevel, nLevel * 2, "", 
xParent, pNew -> xNdx, nType, nTextLen, nTextLen, sText, 
  @@ -1541,9 +1555,9 @@
        }
       else
        {
  -     int     len  = sizeof (tNodeData) + pNode -> numAttr * sizeof (tAttrData) ; 
  -     int     numAttr = pOldChild -> numAttr ;
  -     int             nOffset ;
  +     int         len  = sizeof (tNodeData) + pNode -> numAttr * sizeof (tAttrData) 
; 
  +     int         numAttr = pOldChild -> numAttr ;
  +     int         nOffset ;
        tAttrData * pAttr  ;
        int         n      ;
   
  @@ -1995,6 +2009,10 @@
                   
                   if (pCurrReq -> bDebug & dbgParse)
                    lprintf (r, "[%d]toString: Skip Node=%d to Node=%d\n", r -> nPid, 
pNode -> xNdx, xNextNode) ; 
  +             
  +             if (xNextNode == -1)
  +                 return NULL ; /* end of flow */
  +             
                bCheckpointFound = 1 ;
                   pSavedNode = NULL ;
                pNewNode      = Node_self (pDomTree, xNextNode) ;
  
  
  
  1.4.2.3   +11 -1     embperl/Attic/epdom.h
  
  Index: epdom.h
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epdom.h,v
  retrieving revision 1.4.2.2
  retrieving revision 1.4.2.3
  diff -u -r1.4.2.2 -r1.4.2.3
  --- epdom.h   2000/09/19 07:22:00     1.4.2.2
  +++ epdom.h   2000/09/26 19:31:59     1.4.2.3
  @@ -30,7 +30,7 @@
   typedef unsigned long        tUInt32 ;
   typedef signed long  tSInt32 ;
   
  -typedef tUInt32              tIndex ;
  +typedef tSInt32              tIndex ;
   typedef tIndex               tStringIndex ;
   
   typedef tUInt8          tNodeType ;
  @@ -80,6 +80,16 @@
       } ;
   
   typedef struct tAttrData tAttrData ;
  +
  +
  +struct tDomNode
  +    {
  +    tIndex           xDomTree ;
  +    tNode            xNode ;
  +    SV *             pDomNodeSV ;
  +    } ;
  +
  +typedef struct tDomNode tDomNode ;
   
   
   /*
  
  
  
  1.23.4.1  +9 -2      embperl/epeval.c
  
  Index: epeval.c
  ===================================================================
  RCS file: /home/cvs/embperl/epeval.c,v
  retrieving revision 1.23
  retrieving revision 1.23.4.1
  diff -u -r1.23 -r1.23.4.1
  --- epeval.c  2000/09/12 12:49:48     1.23
  +++ epeval.c  2000/09/26 19:32:00     1.23.4.1
  @@ -26,12 +26,15 @@
   *
   ------------------------------------------------------------------------------- */
   
  -int EvalDirect (/*i/o*/ register req * r,
  -                     /*in*/    SV * pArg) 
  +int EvalDirect (/*i/o*/ register req *  r,
  +             /*in*/  SV *            pArg, 
  +                /*in*/  int          numArgs,
  +                /*in*/  SV **                pArgs)
       {
       dTHXsem 
       dSP;
       SV *  pSVErr  ;
  +    int   num ;         
   
       EPENTRY (EvalDirect) ;
   
  @@ -39,6 +42,10 @@
       pCurrReq = r ;
   
       PUSHMARK(sp);
  +    for (num = 0; num < numArgs; num++)
  +     XPUSHs(pArgs [num]) ;            /* push pointer to argument */
  +    PUTBACK;
  +
       perl_eval_sv(pArg, G_SCALAR | G_KEEPERR);
   
   
  
  
  
  1.70.4.9  +1 -3      embperl/test.pl
  
  Index: test.pl
  ===================================================================
  RCS file: /home/cvs/embperl/test.pl,v
  retrieving revision 1.70.4.8
  retrieving revision 1.70.4.9
  diff -u -r1.70.4.8 -r1.70.4.9
  --- test.pl   2000/09/14 12:02:20     1.70.4.8
  +++ test.pl   2000/09/26 19:32:00     1.70.4.9
  @@ -190,9 +190,7 @@
           },
       'importsub.htm' => { 
           'version'    => 1,
  -        },
  -    'importsub.htm' => { 
  -        'version'    => 1,
  +        'repeat'     => 2,
           },
       'importsub2.htm' => { 
           'version'    => 1,
  
  
  
  1.3.4.1   +21 -0     embperl/typemap
  
  Index: typemap
  ===================================================================
  RCS file: /home/cvs/embperl/typemap,v
  retrieving revision 1.3
  retrieving revision 1.3.4.1
  diff -u -r1.3 -r1.3.4.1
  --- typemap   2000/07/17 05:16:09     1.3
  +++ typemap   2000/09/26 19:32:00     1.3.4.1
  @@ -2,6 +2,7 @@
   tConf * T_PTROBJ_CONF
   tReq *  T_PTROBJ_REQ
   tFile * T_PTROBJ_FILE
  +tDomNode * T_PTROBJ_DOMNODE
   
   INPUT
   T_PTROBJ_CONF
  @@ -26,6 +27,17 @@
       else
           croak (\"$var is not of type HTML::Embperl::File\") ;
   
  +T_PTROBJ_DOMNODE
  +    {
  +    MAGIC * mg ;
  +    if (mg = mg_find (SvRV($arg), '~'))
  +        $var = (tDomNode *)(mg -> mg_len) ;
  +    else
  +        croak (\"$var is not of type XML::Embperl::DOM::Node\") ;
  +    }
  +
  +
  +
   OUTPUT
   T_PTROBJ_CONF
       sv_setref_pv ($arg, \"HTML::Embperl::Conf\", (void *)$var) ;
  @@ -41,3 +53,12 @@
    
   T_PTROBJ_FILE
       sv_setref_pv ($arg, \"HTML::Embperl::File\", (void *)$var) ;
  +
  +T_PTROBJ_DOMNODE
  +    {
  +    SV * pSV = $var -> pDomNodeSV ;
  +    if (pSV == NULL)
  +       $arg = &sv_undef ;
  +    else
  +        $arg = pSV ;
  +    }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.4   +19 -16    embperl/Embperl/Attic/Syntax.pm
  
  Index: Syntax.pm
  ===================================================================
  RCS file: /home/cvs/embperl/Embperl/Attic/Syntax.pm,v
  retrieving revision 1.1.4.3
  retrieving revision 1.1.4.4
  diff -u -r1.1.4.3 -r1.1.4.4
  --- Syntax.pm 2000/09/19 07:22:12     1.1.4.3
  +++ Syntax.pm 2000/09/26 19:32:09     1.1.4.4
  @@ -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.3 2000/09/19 07:22:12 richter Exp $
  +#   $Id: Syntax.pm,v 1.1.4.4 2000/09/26 19:32:09 richter Exp $
   #
   ###################################################################################
    
  @@ -693,6 +693,8 @@
                   mayjump     => 1,
                   stackname   => 'metacmd',
                   'push'      => 'sub',
  +                stackname2   => 'subname',
  +                push2        => '%&<noname>%',
                   switchcodetype => 2,
                   }
               },
  @@ -704,11 +706,12 @@
           'cdatatype'  => 0,
           'procinfo' => {
               embperl => { 
  -                perlcode => '};', 
  +                perlcode => '}; $_ep_req -> ExportHash -> {%^"subname%} = 
\&%^subname% ;', 
                   removenode => 10,
                   mayjump     => 1,
                   stackname   => 'metacmd',
                   stackmatch  => 'sub',
  +                pop2        => 'subname',
                   switchcodetype => 1,
                   }
               },
  @@ -777,17 +780,17 @@
                   perlcode    => q{ 
   #my
   use vars ('$_ep_DomTree') ;
  -$_ep_DomTree = $_[1];
  +#$_ep_DomTree = $_[1];
   },
                   compiletimeperlcode => q{
  -*_ep_rp=\\&XML::Embperl::DOM::Node::replaceChildWithCDATA;
  -*_ep_rpurl=\\&XML::Embperl::DOM::Node::replaceChildWithUrlDATA;
  -*_ep_cp=\\&XML::Embperl::DOM::Tree::checkpoint;
  -*_ep_dcp=\\&XML::Embperl::DOM::Tree::discardAfterCheckpoint;
  +*_ep_rp=\\&XML::Embperl::DOM::Node::iReplaceChildWithCDATA;
  +*_ep_rpurl=\\&XML::Embperl::DOM::Node::iReplaceChildWithUrlDATA;
  +*_ep_cp=\\&XML::Embperl::DOM::Tree::iCheckpoint;
  +*_ep_dcp=\\&XML::Embperl::DOM::Tree::iDiscardAfterCheckpoint;
   *_ep_opt=\\&HTML::Embperl::Cmd::Option;
   *_ep_hid=\\&HTML::Embperl::Cmd::Hidden;
  -*_ep_ac=\\&XML::Embperl::DOM::Node::appendChild;
  -*_ep_sa=\\&XML::Embperl::DOM::Element::setAttribut; 
  +*_ep_ac=\\&XML::Embperl::DOM::Node::iAppendChild;
  +*_ep_sa=\\&XML::Embperl::DOM::Element::iSetAttribut; 
   },
                   perlcodeend => '# Include here any cleanup code', 
                   stackname   => 'metacmd',
  @@ -804,17 +807,17 @@
           'procinfo'  => {
               embperl => { 
                   perlcode    => q{ 
  -my $_ep_DomTree = $_[1];
  +#my $_ep_DomTree = $_[1];
   },
                   compiletimeperlcode => q{
  -*_ep_rp=\\&XML::Embperl::DOM::Node::replaceChildWithCDATA;
  -*_ep_rpurl=\\&XML::Embperl::DOM::Node::replaceChildWithUrlDATA;
  -*_ep_cp=\\&XML::Embperl::DOM::Tree::checkpoint;
  -*_ep_dcp=\\&XML::Embperl::DOM::Tree::discardAfterCheckpoint;
  +*_ep_rp=\\&XML::Embperl::DOM::Node::iReplaceChildWithCDATA;
  +*_ep_rpurl=\\&XML::Embperl::DOM::Node::iReplaceChildWithUrlDATA;
  +*_ep_cp=\\&XML::Embperl::DOM::Tree::iCheckpoint;
  +*_ep_dcp=\\&XML::Embperl::DOM::Tree::iDiscardAfterCheckpoint;
   *_ep_opt=\\&HTML::Embperl::Cmd::Option;
   *_ep_hid=\\&HTML::Embperl::Cmd::Hidden;
  -*_ep_ac=\\&XML::Embperl::DOM::Node::appendChild;
  -*_ep_sa=\\&XML::Embperl::DOM::Element::setAttribut; 
  +*_ep_ac=\\&XML::Embperl::DOM::Node::iAppendChild;
  +*_ep_sa=\\&XML::Embperl::DOM::Element::iSetAttribut; 
   },
                   perlcodeend => '# Include here any cleanup code', 
                   stackname   => 'metacmd',
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.6.1   +47 -17    embperl/test/cmp/callsub.htm
  
  Index: callsub.htm
  ===================================================================
  RCS file: /home/cvs/embperl/test/cmp/callsub.htm,v
  retrieving revision 1.3
  retrieving revision 1.3.6.1
  diff -u -r1.3 -r1.3.6.1
  --- callsub.htm       1999/10/05 06:02:02     1.3
  +++ callsub.htm       2000/09/26 19:32:13     1.3.6.1
  @@ -6,39 +6,69 @@
   
   <body>
   
  -<h1>Tests for Embperl - Embperl sub Metacommand</h1>
  -
   Now we call the first sub via Execute:
  -
  -
  -
  -<h2>Here goes some normal html text <h2>
   
  +*txt* 
  +*txt* <h2>Here goes some normal html text <h2>
  +*txt* 
   
   And now the second via Execute:
   
  +*perl_code* 
  +*perl_code* Here comes some perl:
  +*perl_code* 
  +*perl_code* *perl_code* 
  +*perl_code* foo = Hello world<br>
  +*perl_code* testdata = abcd<br>
  +*perl_code* 
   
  +Now we call the first sub via Perl:
   
  -Here comes some perl:
  +*txt* 
  +*txt* <h2>Here goes some normal html text <h2>
  +*txt* 
  +And now the second via Perl:
   
  -foo = Hello world<br>
  -testdata = abcd<br>
  +*perl_code* 
  +*perl_code* Here comes some perl:
  +*perl_code* 
  +*perl_code* *perl_code* 
  +*perl_code* foo = Hello world<br>
  +*perl_code* testdata = abcd<br>
  +*perl_code* 
  +-> Second time, other order:
   
  +And now the second via Perl:
   
  +*perl_code* 
  +*perl_code* Here comes some perl:
  +*perl_code* 
  +*perl_code* *perl_code* 
  +*perl_code* foo = Hello world<br>
  +*perl_code* testdata = abcd<br>
  +*perl_code* 
   Now we call the first sub via Perl:
   
  +*txt* 
  +*txt* <h2>Here goes some normal html text <h2>
  +*txt* 
  +-> And Execute again, but other order
   
  -
  -<h2>Here goes some normal html text <h2>
  -
  -And now the second via Perl:
  -
  +And now the second via Execute:
   
  +*perl_code* 
  +*perl_code* Here comes some perl:
  +*perl_code* 
  +*perl_code* *perl_code* 
  +*perl_code* foo = Hello world<br>
  +*perl_code* testdata = abcd<br>
  +*perl_code* 
   
  -Here comes some perl:
  +Now we call the first sub via Execute:
   
  -foo = Hello world<br>
  -testdata = abcd<br>
  +*txt* 
  +*txt* <h2>Here goes some normal html text <h2>
  +*txt* 
   
   And done!
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.6.3   +13 -1     embperl/test/html/callsub.htm
  
  Index: callsub.htm
  ===================================================================
  RCS file: /home/cvs/embperl/test/html/callsub.htm,v
  retrieving revision 1.3.6.2
  retrieving revision 1.3.6.3
  diff -u -r1.3.6.2 -r1.3.6.3
  --- callsub.htm       2000/09/19 07:22:15     1.3.6.2
  +++ callsub.htm       2000/09/26 19:32:17     1.3.6.3
  @@ -49,7 +49,7 @@
   
   [- perl_code -]
   
  -Second time, other oder:
  +-> Second time, other order:
   
   And now the second via Perl:
   
  @@ -58,6 +58,18 @@
   Now we call the first sub via Perl:
   
   [- txt -]
  +
  +-> And Execute again, but other order
  +
  +And now the second via Execute:
  +
  +[- Execute ('#perl_code') -]
  +
  +Now we call the first sub via Execute:
  +
  +[- Execute ('#txt') -]
  +
  +
   
   And done!
   
  
  
  
  1.4.6.1   +1 -1      embperl/test/html/importsub.htm
  
  Index: importsub.htm
  ===================================================================
  RCS file: /home/cvs/embperl/test/html/importsub.htm,v
  retrieving revision 1.4
  retrieving revision 1.4.6.1
  diff -u -r1.4 -r1.4.6.1
  --- importsub.htm     2000/01/05 05:41:39     1.4
  +++ importsub.htm     2000/09/26 19:32:18     1.4.6.1
  @@ -8,7 +8,7 @@
   
   <h1>Tests for Embperl - Importing subs</h1>
   
  -[- Execute({inputfile => 'subimp.htm', import => 1}) -]
  +[! Execute({inputfile => 'subimp.htm', import => 1}) !]
   
   First sub:
   [- tfirst -]
  
  
  

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

Reply via email to