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...@locus.apache.org on 2000/09/19 09:22:25 UTC
cvs commit: embperl/test/html callsub.htm
richter 00/09/19 00:22:24
Modified: . Tag: Embperl2c epcomp.c epdom.c epdom.h epparse.c
Embperl Tag: Embperl2c Syntax.pm
test/html Tag: Embperl2c callsub.htm
Log:
Embperl 2 - subs
Revision Changes Path
No revision
No revision
1.4.2.4 +19 -5 embperl/Attic/epcomp.c
Index: epcomp.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epcomp.c,v
retrieving revision 1.4.2.3
retrieving revision 1.4.2.4
diff -u -r1.4.2.3 -r1.4.2.4
--- epcomp.c 2000/09/14 12:02:19 1.4.2.3
+++ epcomp.c 2000/09/19 07:21:56 1.4.2.4
@@ -1321,7 +1321,7 @@
r -> nPhase = phRunAfterCompile ;
l = ArrayGetSize (pProgDef) ;
- if (pCurrReq -> bDebug & dbgParse)
+ 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) ;
@@ -1362,12 +1362,18 @@
if (!r -> bError)
{
+ char * sSubName = r -> sSubName ;
+
+ if (sSubName && !*sSubName)
+ sSubName = NULL ;
rc = ok ;
cl1 = clock () ;
+
r -> nPhase = phRun ;
- if (!(r -> xCurrDomTree = DomTree_clone (pDomTree, &pCurrDomTree)))
+
+ if (!(r -> xCurrDomTree = DomTree_clone (pDomTree, &pCurrDomTree, sSubName?1:0)))
return 1 ;
@@ -1385,9 +1391,17 @@
args[0] = r -> pReqSV ;
args[1] = pCurrDomTree -> pDomTreeSV ;
- rc = CallStoredCV (r, pProgRun, (CV *)pSV, 2, args, 0, &pSV) ;
- if (pSV)
- SvREFCNT_dec (pSV) ;
+ if (sSubName)
+ {
+ SV * pSVName = newSVpvf ("%s::%s", r -> Buf.sEvalPackage, sSubName) ;
+ rc = CallStoredCV (r, pProgRun, (CV *)pSVName, 2, args, 0, &pSV) ;
+ }
+ else
+ {
+ rc = CallStoredCV (r, pProgRun, (CV *)pSV, 2, args, 0, &pSV) ;
+ if (pSV)
+ SvREFCNT_dec (pSV) ;
+ }
cl2 = clock () ;
#ifdef CLOCKS_PER_SEC
1.4.2.2 +26 -14 embperl/Attic/epdom.c
Index: epdom.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epdom.c,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- epdom.c 2000/09/14 12:02:19 1.4.2.1
+++ epdom.c 2000/09/19 07:21:59 1.4.2.2
@@ -33,6 +33,8 @@
tIndex xNoName = 0 ;
tIndex xDomTreeAttr = 0 ;
+tIndex xDocument ;
+tIndex xDocumentFraq ;
int nCheckpointCache = 0 ;
int nCheckpointCacheMask = 0x1ff ;
@@ -388,7 +390,10 @@
{
if (bInc)
SvREFCNT_inc (*ppSV) ;
- return SvIVX (*ppSV) ;
+ nNdx = SvIVX (*ppSV) ;
+ //if (nNdx < 5 || nNdx == 92)
+ // lprintf (pCurrReq, "old string %s (#%d) refcnt=%d\n", Ndx2String (nNdx), nNdx, SvREFCNT(*ppSV)) ;
+ return nNdx ;
}
}
@@ -414,6 +419,9 @@
numStr++ ;
+ //if (nNdx < 5 || nNdx == 92)
+ // lprintf (pCurrReq, "new string %s (#%d) refcnt=%d\n", Ndx2String (nNdx), nNdx, SvREFCNT(pSVNdx)) ;
+
return nNdx ;
}
@@ -434,10 +442,8 @@
SvREFCNT_dec (pSVNdx) ;
- /*
- if (nNdx == 3)
- lprintf (pCurrReq, "free string %s (#%d) refcnt=%d\n", Ndx2String (nNdx), nNdx, SvREFCNT(pSVNdx)) ;
- */
+ //if (nNdx < 5 || nNdx == 92)
+ // lprintf (pCurrReq, "free string %s (#%d) refcnt=%d\n", Ndx2String (nNdx), nNdx, SvREFCNT(pSVNdx)) ;
if (SvREFCNT(pSVNdx) == 1)
{
@@ -492,8 +498,10 @@
numStr+=2 ;
- xNoName = String2Ndx ("<noname>", 8) ;
- xDomTreeAttr = String2Ndx ("<domtree>", 9) ;
+ xNoName = String2Ndx ("<noname>", 8) ;
+ xDomTreeAttr = String2Ndx ("<domtree>", 9) ;
+ xDocument = String2Ndx ("Document", 8) ;
+ xDocumentFraq = String2Ndx ("DocumentFraq", 12) ;
ArrayNew (&pDomTrees, 16, sizeof (tDomTree)) ;
ArrayAdd (&pDomTrees, 1) ;
@@ -702,7 +710,8 @@
/* ------------------------------------------------------------------------ */
int DomTree_clone (/*in*/ tDomTree * pOrgDomTree,
- /*out*/tDomTree * * pNewDomTree)
+ /*out*/tDomTree * * pNewDomTree,
+ /*in*/ int bForceDocFraq)
{
tDomTree * pDomTree ;
@@ -724,13 +733,15 @@
pDocument = Node_self (pDomTree, pDomTree -> xDocument) ;
- if (pDocument -> nType == ntypDocumentFraq)
+ if (bForceDocFraq || pDocument -> nType == ntypDocumentFraq)
{
tAttrData * pAttr;
pDocument = Node_selfCloneNode (pDomTree, pDocument, 1) ;
pAttr = Element_selfSetAttribut (pDomTree, pDocument, NULL, xDomTreeAttr, NULL, pDomTree -> xNdx, 0) ;
pAttr -> bFlags = aflgOK ; /* reset string value flag */
pDomTree -> xDocument = pDocument -> xNdx ;
+ pDocument -> nType = ntypDocumentFraq ;
+ pDocument -> nText = xDocumentFraq ;
}
@@ -751,7 +762,7 @@
{
- if (pCurrReq -> nPhase == phRun)
+ if (pCurrReq -> nPhase == phRun || pCurrReq -> nPhase == phTerm)
{
tDomTree * pDomTree = DomTree_self (xDomTree) ;
int n = ArrayAdd (&pDomTree -> pOrder, 1) ;
@@ -775,7 +786,7 @@
{
- if (pCurrReq -> nPhase == phRun)
+ if (pCurrReq -> nPhase == phRun || pCurrReq -> nPhase == phTerm)
{
int n = ArrayAdd (&pDomTree -> pOrder, 1) ;
(pDomTree -> pOrder)[n].xFromNode = xFromNode ;
@@ -1235,6 +1246,7 @@
xNdx = ArrayAdd (&pDomTree -> pLookup, 1) ;
pDomTree -> pLookup[xNdx] = (struct tNodeData *)pNew ;
+ /* is NoInc ok ????? */
pNew -> xName = sText?String2NdxNoInc (sText, nTextLen):nTextLen ;
NdxStringRefcntInc (pNew -> xName) ;
pNew -> xValue = 0 ;
@@ -1349,7 +1361,7 @@
pChilds = NodePad_self (pDomTree, pParent -> xChilds) ;
}
- pNew = NodePad_appendChild (pDomTree, &pChilds, nType, String2Ndx (sText, nTextLen), nLinenumber) ;
+ pNew = NodePad_appendChild (pDomTree, &pChilds, nType, sText?String2Ndx (sText, nTextLen):nTextLen, 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,
@@ -1644,10 +1656,10 @@
tNode xOrgChild = xOldChild ;
tStringIndex n ;
+ lprintf (pCurrReq, "rp1--> SVs=%d %s DomTree Old=%d\n", sv_count, sText, Node_selfDomTree (Node_self (pDomTree, xOldChild))) ;
+
Node_condClonePad (pDomTree, xOldChild) ;
pOldChild = Node_self (pDomTree, xOldChild) ;
-
- lprintf (pCurrReq, "rp1--> SVs=%d %s DomTree Old=%d\n", sv_count, sText, Node_selfDomTree (pOldChild)) ;
xCheckpointCache[nCheckpointCache++] = xOldChild ;
1.4.2.2 +4 -1 embperl/Attic/epdom.h
Index: epdom.h
===================================================================
RCS file: /home/cvs/embperl/Attic/epdom.h,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- epdom.h 2000/09/13 08:38:01 1.4.2.1
+++ epdom.h 2000/09/19 07:22:00 1.4.2.2
@@ -178,6 +178,8 @@
extern HE * * pStringTableArray ; /* Array with pointers to strings */
extern tIndex xNoName ; /* String index for Attribut with noname */
extern tIndex xDomTreeAttr ; /* String index for Attribut which holds the DomTree index */
+extern tIndex xDocument ; /* String index for Document */
+extern tIndex xDocumentFraq ; /* String index for Document Fraquent */
extern int nCheckpointCache ;
extern int nCheckpointCacheMask ;
@@ -226,7 +228,8 @@
int DomInit (void) ;
int DomTree_clone (/*in*/ tDomTree * pOrgDomTree,
- /*out*/tDomTree * * pNewDomTree) ;
+ /*out*/tDomTree * * pNewDomTree,
+ /*in*/ int bForceDocFraq) ;
int DomTree_new (tDomTree * * pNewLookup) ;
1.4.2.2 +1 -1 embperl/Attic/epparse.c
Index: epparse.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epparse.c,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- epparse.c 2000/09/13 08:38:02 1.4.2.1
+++ epparse.c 2000/09/19 07:22:00 1.4.2.2
@@ -723,7 +723,7 @@
if (!(xDocNode = Node_appendChild (pDomTree, ntypTag, 0, "attr", 3, 0, 0, 0)))
return 1 ;
- if (!(xDocNode = Node_appendChild (pDomTree, r -> bSubReq?ntypDocumentFraq:ntypDocument, 0, r -> bSubReq?"DocumentFraq":"Document", r -> bSubReq?12:8, 0, 0, 0)))
+ if (!(xDocNode = Node_appendChild (pDomTree, r -> bSubReq?ntypDocumentFraq:ntypDocument, 0, NULL, r -> bSubReq?xDocumentFraq:xDocument, 0, 0, 0)))
return 1 ;
if (!(xNode = Node_appendChild (pDomTree, ntypAttr, 0, NULL, xDomTreeAttr, xDocNode, 0, 0)))
No revision
No revision
1.1.4.3 +3 -1 embperl/Embperl/Attic/Syntax.pm
Index: Syntax.pm
===================================================================
RCS file: /home/cvs/embperl/Embperl/Attic/Syntax.pm,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -r1.1.4.2 -r1.1.4.3
--- Syntax.pm 2000/09/14 12:02:24 1.1.4.2
+++ Syntax.pm 2000/09/19 07:22:12 1.1.4.3
@@ -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.2 2000/09/14 12:02:24 richter Exp $
+# $Id: Syntax.pm,v 1.1.4.3 2000/09/19 07:22:12 richter Exp $
#
###################################################################################
@@ -793,6 +793,7 @@
stackname => 'metacmd',
stackmatch => 'Document',
'push' => 'Document',
+ mayjump => 1,
}
},
},
@@ -819,6 +820,7 @@
stackname => 'metacmd',
stackmatch => 'DocumentFraq',
'push' => 'DocumentFraq',
+ mayjump => 1,
}
},
},
No revision
No revision
1.3.6.2 +2 -2 embperl/test/html/callsub.htm
Index: callsub.htm
===================================================================
RCS file: /home/cvs/embperl/test/html/callsub.htm,v
retrieving revision 1.3.6.1
retrieving revision 1.3.6.2
diff -u -r1.3.6.1 -r1.3.6.2
--- callsub.htm 2000/09/14 12:02:29 1.3.6.1
+++ callsub.htm 2000/09/19 07:22:15 1.3.6.2
@@ -35,12 +35,12 @@
Now we call the first sub via Execute:
-[# [- Execute ('#txt') -]
+[- Execute ('#txt') -]
And now the second via Execute:
[- Execute ('#perl_code') -]
-#]
+
Now we call the first sub via Perl:
[- txt -]