richter 00/07/04 14:37:41
Modified: . Tag: Embperl2 epcomp.c epdat.h epdom.c epdom.h
epmain.c epparse.c
Embperl Tag: Embperl2 Syntax.pm
Log:
Embperl 2
Revision Changes Path
No revision
No revision
1.1.2.38 +63 -31 embperl/Attic/epcomp.c
Index: epcomp.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epcomp.c,v
retrieving revision 1.1.2.37
retrieving revision 1.1.2.38
diff -u -r1.1.2.37 -r1.1.2.38
--- epcomp.c 2000/06/27 05:31:37 1.1.2.37
+++ epcomp.c 2000/07/04 21:37:29 1.1.2.38
@@ -31,12 +31,15 @@
int bPerlCodeRemove ;
int bCompileChilds ;
int nNodeType ;
+ int nSwitchCodeType ;
const char * sMayJump ;
} ;
typedef struct tEmbperlCmd tEmbperlCmd ;
-char * pProg = NULL ;
+char * * pProg = NULL ;
+char * pProgRun = NULL ;
+char * pProgDef = NULL ;
int nLabelCnt ;
@@ -164,11 +167,16 @@
pEmbperlCmds[nNodeName].sMayJump = GetHashValueStrDup (pHash, "mayjump",
NULL) ;
pEmbperlCmds[nNodeName].bPerlCodeRemove = GetHashValueInt (pHash,
"perlcoderemove", 0) ;
pEmbperlCmds[nNodeName].bCompileChilds = GetHashValueInt (pHash,
"compilechilds", 1) ;
+ pEmbperlCmds[nNodeName].nSwitchCodeType = GetHashValueInt (pHash,
"switchcodetype", 0) ;
pEmbperlCmds[nNodeName].nNodeType = nNodeType ;
if (r -> bDebug & dbgParse)
- lprintf (r, "[%d]EPCOMP: InitItem %s (#%d) perlcode=%s (num=%d)
perlcodeend=%s\n", r -> nPid, Ndx2String(nNodeName), nNodeName,
pEmbperlCmds[nNodeName].sPerlCode?pEmbperlCmds[nNodeName].sPerlCode[0]:"",
pEmbperlCmds[nNodeName].numPerlCode,
pEmbperlCmds[nNodeName].sPerlCodeEnd?pEmbperlCmds[nNodeName].sPerlCodeEnd:"<undef>") ;
+ lprintf (r, "[%d]EPCOMP: InitItem %s (#%d) perlcode=%s (num=%d)
perlcodeend=%s\n",
+ r -> nPid, Ndx2String(nNodeName), nNodeName,
+
pEmbperlCmds[nNodeName].sPerlCode?pEmbperlCmds[nNodeName].sPerlCode[0]:"",
+ pEmbperlCmds[nNodeName].numPerlCode,
+
pEmbperlCmds[nNodeName].sPerlCodeEnd?pEmbperlCmds[nNodeName].sPerlCodeEnd:"<undef>") ;
}
@@ -703,7 +711,9 @@
Ndx2StringLen (pDomTree -> xFilename, sSourcefile, nSourcefile) ;
if (pCurrReq -> bDebug & dbgParse)
- lprintf (pCurrReq, "[%d]EPCOMP: #%d L%d -------> parent=%d node=%d type=%d
text=%s\n", pCurrReq -> nPid, pNode -> xNdx, pNode -> nLinenumber, Node_parentNode
(pDomTree, pNode -> xNdx), pNode -> xNdx, pNode -> nType, Node_selfNodeName(pNode)) ;
+ lprintf (pCurrReq, "[%d]EPCOMP: #%d L%d -------> parent=%d node=%d type=%d
text=%s\n", pCurrReq -> nPid, pNode -> xNdx, pNode -> nLinenumber, Node_parentNode
(pDomTree, pNode -> xNdx), pNode -> xNdx, pNode -> nType, Node_selfNodeName(pNode))
+
+;
//if (*bCheckpointPending && (pNode -> nType == ntypText || pNode -> nType ==
ntypCDATA) && pNode -> bFlags && (pNode -> bFlags & nflgIgnore) == 0)
if (*bCheckpointPending && pNode -> bFlags && (pNode -> bFlags & nflgIgnore) ==
0)
@@ -713,7 +723,7 @@
pNode -> bFlags |= nflgCheckpoint ;
l = sprintf (buf, " _ep_cp($_ep_DomTree,%d) ;\n", *bCheckpointPending<0?pNode
-> xNdx:*bCheckpointPending) ;
- nCheckpointCodeOffset = StringAdd (&pProg, buf, l) ;
+ nCheckpointCodeOffset = StringAdd (pProg, buf, l) ;
*bCheckpointPending = 0 ;
if (pCurrReq -> bDebug & dbgParse)
@@ -734,6 +744,10 @@
else
pCmd = NULL ;
+ if (pCmd && pCmd -> nSwitchCodeType == 2)
+ pProg = &pProgDef ;
+
+
if (pCmd == NULL || (pCmd -> bRemoveNode & 8) == 0)
{ /* calculate attributes before tag, but not when tag should be ignored in
output stream */
while (pAttr = Element_selfGetNthAttribut (pDomTree, pNode, nAttr++))
@@ -794,15 +808,15 @@
{
int l2 = sprintf (buf, "#line %d \"", pNode ->
nLinenumber) ;
- StringAdd (&pProg, buf, l2) ;
- StringAdd (&pProg, sSourcefile, nSourcefile) ;
- StringAdd (&pProg, "\"\n", 2) ;
+ StringAdd (pProg, buf, l2) ;
+ StringAdd (pProg, sSourcefile, nSourcefile) ;
+ StringAdd (pProg, "\"\n", 2) ;
}
if (pCmd -> bPerlCodeRemove)
- nStartCodeOffset = StringAdd (&pProg, " ", 1) ;
- StringAdd (&pProg, pCode, l) ;
- StringAdd (&pProg, "\n", 1) ;
+ nStartCodeOffset = StringAdd (pProg, " ", 1) ;
+ StringAdd (pProg, pCode, l) ;
+ StringAdd (pProg, "\n", 1) ;
if (pCurrReq -> bDebug & dbgParse)
lprintf (pCurrReq, "[%d]EPCOMP: #%d L%d Code: %*.*s\n",
pCurrReq -> nPid, pNode -> xNdx, pNode -> nLinenumber, l, l, pCode) ;
}
@@ -851,7 +865,7 @@
if (nCheckpointCodeOffset && (pNode -> bFlags == 0 || (pNode -> bFlags &
nflgIgnore)))
{
- pProg[nCheckpointCodeOffset] = '#' ;
+ (*pProg)[nCheckpointCodeOffset] = '#' ;
if (pCurrReq -> bDebug & dbgParse)
lprintf (pCurrReq, "[%d]EPCOMP: #%d L%d Remove Checkpoint\n", pCurrReq
-> nPid, pNode -> xNdx, pNode -> nLinenumber) ;
nCheckpointCodeOffset = 0 ;
@@ -864,7 +878,7 @@
pNode -> bFlags |= nflgCheckpoint ;
l = sprintf (buf, " _ep_cp($_ep_DomTree,%d) ;\n",
*bCheckpointPending<0?pNode -> xNdx:*bCheckpointPending) ;
- nCheckpointCodeOffset = StringAdd (&pProg, buf, l) ;
+ nCheckpointCodeOffset = StringAdd (pProg, buf, l) ;
*bCheckpointPending = 0 ;
if (pCurrReq -> bDebug & dbgParse)
@@ -874,7 +888,7 @@
if (pCmd -> sStackName)
{
- if (pCmd -> sMatchStack && pNode -> nType != ntypStartTag && pNode ->
nType != ntypDocument)
+ if (pCmd -> sMatchStack && pNode -> nType != ntypStartTag && pNode ->
nType != ntypDocument && pNode -> nType != ntypDocumentFraq)
{
if (embperl_CompileToPerlCode (pDomTree, pNode, pCmd -> sMatchStack,
&sStackValue))
if ((rc = embperl_CompileMatchStack (pDomTree, pNode, pCmd ->
sStackName, sStackValue)) != ok)
@@ -919,8 +933,8 @@
int l = ArrayGetSize (pCode) ;
if (l)
{
- StringAdd (&pProg, pCode, l) ;
- StringAdd (&pProg, "\n", 1) ;
+ StringAdd (pProg, pCode, l) ;
+ StringAdd (pProg, "\n", 1) ;
if (pCurrReq -> bDebug & dbgParse)
lprintf (pCurrReq, "[%d]EPCOMP: #%d L%d Codeend: %*.*s\n",
pCurrReq -> nPid, pNode -> xNdx, pNode -> nLinenumber, l, l, pCode) ;
}
@@ -930,7 +944,7 @@
{
if (pCmd -> bPerlCodeRemove && nStartCodeOffset)
{
- pProg[nStartCodeOffset] = '#' ;
+ (*pProg)[nStartCodeOffset] = '#' ;
if (pCurrReq -> bDebug & dbgParse)
lprintf (pCurrReq, "[%d]EPCOMP: #%d L%d Remove Codeblock\n",
pCurrReq -> nPid, pNode -> xNdx, pNode -> nLinenumber) ;
}
@@ -942,7 +956,7 @@
if (pCurrReq -> bDebug & dbgParse)
lprintf (pCurrReq, "[%d]EPCOMP: #%d L%d Set Checkpoint pending\n",
pCurrReq -> nPid, pNode -> xNdx, pNode -> nLinenumber) ;
}
- if (pCmd -> sStackName && (pNode -> nType == ntypStartTag || pNode -> nType
== ntypDocument))
+ if (pCmd -> sStackName && (pNode -> nType == ntypStartTag || pNode -> nType
== ntypDocument || pNode -> nType == ntypDocumentFraq))
{
if (pCmd -> sMatchStack)
{
@@ -958,8 +972,12 @@
if (pCmd -> sStackName2 && pCmd -> sPushStack2)
embperl_CompilePopStack (pDomTree, pCmd -> sStackName2) ;
+
+ if (pCmd -> nSwitchCodeType == 1)
+ pProg = &pProgRun ;
}
+
StringFree (&sStackValue) ;
StringFree (&pCode) ;
@@ -1046,15 +1064,15 @@
cl2 = clock () ;
- *ppSV = newSViv(r -> xCurrDomTree) ;
- /* SvREFCNT_inc (*ppSV) ; */
- /* lprintf (r, "IV ppSV=%s type=%d\n", *ppSV?"ok":"NULL", *ppSV?SvTYPE
(*ppSV):-1) ; */
pDomTree = DomTree_self (r -> xCurrDomTree) ;
+ *ppSV = pDomTree -> pDomTreeSV ;
+ /* SvREFCNT_inc (*ppSV) ;*/
+ /* lprintf (r, "IV ppSV=%s type=%d\n", *ppSV?"ok":"NULL", *ppSV?SvTYPE
(*ppSV):-1) ; */
- StringNew (&pProg, r -> Buf.pFile -> nFilesize / 4) ;
- StringAdd (&pProg, "my $_ep_DomTree = $_[1];\nmy $_ep_EscMask =
5;\n*_ep_rp=\\&XML::Embperl::DOM::Node_replaceChildWithCDATA;\n*_ep_rpurl=\\&XML::Embperl::DOM::Node_replaceChildWithUrlDATA;\n*_ep_cp=\\&XML::Embperl::DOM::DomTree_checkpoint;\n
", 0) ;
- StringAdd (&pProg,
"*_ep_dcp=\\&XML::Embperl::DOM::DomTree_discardAfterCheckpoint;\n", 0) ;
+ StringNew (&pProgRun, r -> Buf.pFile -> nFilesize / 4) ;
+ StringNew (&pProgDef, r -> Buf.pFile -> nFilesize / 4) ;
+ pProg = &pProgRun ;
pDomTree -> pSV = (SV *)newHV () ;
nLabelCnt = 1 ;
@@ -1069,7 +1087,8 @@
DomTree_delete(DomTree_self(r -> xCurrDomTree)) ;
r -> xCurrDomTree = 0 ;
}
- StringFree (&pProg) ;
+ StringFree (&pProgRun) ;
+ StringFree (&pProgDef) ;
return rc ;
}
@@ -1077,11 +1096,21 @@
SvREFCNT_dec (pDomTree -> pSV) ;
pDomTree -> pSV = NULL ;
- StringAdd (&pProg, "", 1) ;
+ StringAdd (&pProgRun, "", 1) ;
+ StringAdd (&pProgDef, "", 1) ;
cl3 = clock () ;
- if ((rc = EvalStore (r, pProg, 0, &pSV)) != ok)
+ l = ArrayGetSize (pProgDef) ;
+ if (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)
+ LogError (r, rc) ;
+ SvREFCNT_dec(pSV);
+
+ if ((rc = EvalStore (r, pProgRun, 0, &pSV)) != ok)
return rc ;
cl4 = clock () ;
@@ -1096,13 +1125,14 @@
}
#endif
- StringFree (&pProg) ;
+ StringFree (&pProgRun) ;
+ StringFree (&pProgDef) ;
}
else
{
pDomTree = DomTree_self (SvIV (*ppSV)) ;
r -> xDocument = pDomTree -> xDocument ;
- if ((rc = EvalStore (r, pProg, 0, &pSV)) != ok)
+ if ((rc = EvalStore (r, pProgRun, 0, &pSV)) != ok)
return rc ;
}
@@ -1115,6 +1145,9 @@
if (!(r -> xCurrDomTree = DomTree_clone (pDomTree, &pCurrDomTree)))
return 1 ;
+
+ av_push (r -> pDomTreeAV, pCurrDomTree -> pDomTreeSV) ;
+
r -> xDocument = pCurrDomTree -> xDocument ;
if (pSV)
@@ -1126,9 +1159,8 @@
xCheckpointCache[nCheckpointCache++] = 0 ;
args[0] = r -> pReqSV ;
- args[1] = newSViv (r -> xCurrDomTree) ;
- rc = CallStoredCV (r, pProg, (CV *)pSV, 2, args, 0, &pSV) ;
- SvREFCNT_dec (args[1]) ;
+ args[1] = pCurrDomTree -> pDomTreeSV ;
+ rc = CallStoredCV (r, pProgRun, (CV *)pSV, 2, args, 0, &pSV) ;
if (pSV)
SvREFCNT_dec (pSV) ;
}
1.17.2.6 +8 -4 embperl/epdat.h
Index: epdat.h
===================================================================
RCS file: /home/cvs/embperl/epdat.h,v
retrieving revision 1.17.2.5
retrieving revision 1.17.2.6
diff -u -r1.17.2.5 -r1.17.2.6
--- epdat.h 2000/06/06 19:48:50 1.17.2.5
+++ epdat.h 2000/07/04 21:37:31 1.17.2.6
@@ -38,7 +38,10 @@
char cMultFieldSep ;
char * pOpenBracket ;
char * pCloseBracket ;
- bool bEP1Compat ; /* run in Embperl 1.x compatible mode */
+ bool bEP1Compat ; /* run in Embperl 1.x compatible mode */
+ char * sExpiresKey ; /* Key used to store expires setting */
+ double nExpiresAt ; /* Data expiers at */
+ SV * pExpiresCV ; /* sub that is called to determinate expiration */
} tConf ;
/*-----------------------------------------------------------------*/
@@ -262,6 +265,9 @@
int bExit ; /* We should exit the page */
bool bEP1Compat ; /* run in Embperl 1.x compatible mode */
+
+ /* --- DomTree ---*/
+
tNode xDocument ;
tNode xCurrNode ;
tIndex xCurrDomTree ;
@@ -372,6 +378,7 @@
HV * pUserHash ; /* User data */
HV * pModHash ; /* Module data */
HV * pHeaderHash ;/* http headers */
+ AV * pDomTreeAV ; /* holds all DomTrees alocated during the request */
/* --- for statistics --- */
@@ -391,6 +398,3 @@
HV * pImportStash ; /* stash for package, where new macros should be
imported */
} ;
-
-
-
1.1.2.44 +132 -23 embperl/Attic/epdom.c
Index: epdom.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epdom.c,v
retrieving revision 1.1.2.43
retrieving revision 1.1.2.44
diff -u -r1.1.2.43 -r1.1.2.44
--- epdom.c 2000/07/01 13:04:23 1.1.2.43
+++ epdom.c 2000/07/04 21:37:31 1.1.2.44
@@ -20,6 +20,7 @@
tDomTree * pDomTrees ;
+tIndex * pFreeDomTrees ;
int nInitialNodePadSize = 196 ;
@@ -41,6 +42,10 @@
#define dom_free(s) (free(s))
+/* forward */
+static int DomTree_free (SV * pSV, MAGIC * mg) ;
+
+
/* ------------------------------------------------------------------------ */
/* */
/* mydie */
@@ -175,6 +180,32 @@
/* ------------------------------------------------------------------------ */
/* */
+/* ArraySub */
+/* */
+/* Remove numElemenets from the end of the array. Does not reallocate memory*/
+/* Returns -1 if less then numElemenets are avialable */
+/* */
+/* ------------------------------------------------------------------------ */
+
+
+int ArraySub (/*in*/ const tArray * pArray,
+ /*in*/ int numElements)
+
+ {
+ struct tArrayCtrl * pCtrl = ((struct tArrayCtrl *)(*(void * *)pArray)) - 1 ;
+ int nNdx ;
+
+
+ if (pCtrl -> nFill < numElements)
+ return -1 ;
+ else
+ pCtrl -> nFill -= numElements ;
+
+ return pCtrl -> nFill ;
+ }
+
+/* ------------------------------------------------------------------------ */
+/* */
/* ArraySet */
/* */
/* Make space that at least numElements in the Array */
@@ -418,53 +449,97 @@
ArrayNew (&pDomTrees, 16, sizeof (tDomTree)) ;
ArrayAdd (&pDomTrees, 1) ;
memset (&pDomTrees[0], 0, sizeof (tDomTree)) ;
+ ArrayNew (&pFreeDomTrees, 16, sizeof (tIndex)) ;
}
/* ------------------------------------------------------------------------ */
-/* */
-/* DomTree_new */
/* */
+/* DomTree_alloc */
/* */
+/* Alloc storage for a new DomTree and associate it with a SV. deleteing */
+/* the SV will delete the DomTree also */
/* */
/* ------------------------------------------------------------------------ */
-int DomTree_new (tDomTree * * pNewLookup)
+MGVTBL DomTree_mvtTab = { NULL, NULL, NULL, NULL, DomTree_free } ;
+
+
+tDomTree * DomTree_alloc (void)
{
tDomTree * pDomTree ;
- int n ;
+ tIndex n ;
+ SV * pSV ;
+ struct magic * pMagic ;
- n = ArrayAdd (&pDomTrees, 1) ;
+
+ n = ArraySub (&pFreeDomTrees, 1) ;
+ if (n != (tIndex)(-1))
+ n = pFreeDomTrees[n] ;
+ else
+ n = ArrayAdd (&pDomTrees, 1) ;
pDomTree = DomTree_self (n) ;
memset (pDomTree, 0, sizeof (*pDomTree)) ;
+ pSV = newSViv (n) ;
+ sv_magic (pSV, NULL, 0, NULL, 0) ;
+ pMagic = mg_find (pSV, 0) ;
+
+ if (pMagic)
+ pMagic -> mg_virtual = &DomTree_mvtTab ;
+ else
+ {
+ LogError (pCurrReq, rcMagicError) ;
+ }
+
+ pDomTree -> pDomTreeSV = pSV ;
+ pDomTree -> xNdx = n ;
+
+
+ return pDomTree ;
+ }
+
+
+/* ------------------------------------------------------------------------ */
+/* */
+/* DomTree_new */
+/* */
+/* */
+/* */
+/* ------------------------------------------------------------------------ */
+
+int DomTree_new (tDomTree * * pNewLookup)
+
+ {
+ tDomTree * pDomTree ;
+ pDomTree = DomTree_alloc () ;
+
ArrayNew (&pDomTree -> pLookup, 128, sizeof (struct tNodeData *)) ;
ArrayAdd (&pDomTree -> pLookup, 1) ;
ArrayNew (&pDomTree -> pOrder, 128, sizeof (tDomTreeOrder)) ;
- pDomTree -> xNdx = n ;
-
*pNewLookup = pDomTree ;
- return n ;
+ return pDomTree -> xNdx ;
}
/* ------------------------------------------------------------------------ */
-/* */
-/* DomTree_delete */
/* */
+/* DomTree_dodelete */
/* */
+/* Frees all memory allocated by this DomTree */
/* */
/* ------------------------------------------------------------------------ */
-int DomTree_delete (tDomTree * pDomTree)
+static int DomTree_dodelete (tDomTree * pDomTree)
{
tNodePad * * pLookup = (tNodePad * *)pDomTree -> pLookup ;
int numLookup = ArrayGetSize (pLookup) ;
tIndex xDomTree = pDomTree -> xNdx ;
+ tIndex xNdx ;
pLookup += numLookup - 1 ;
while (numLookup-- > 0)
@@ -508,13 +583,49 @@
if (pDomTree -> pSV)
SvREFCNT_dec (pDomTree -> pSV) ;
+
- /*pDomTrees[pDomTree -> xNdx] = NULL ;
- dom_free (pDomTree) ;*/
+ xNdx = ArrayAdd (&pFreeDomTrees, 1) ;
+ pDomTree -> xNdx = 0 ;
+ pFreeDomTrees[xNdx] = xDomTree ;
return ok ;
}
+/* ------------------------------------------------------------------------ */
+/* */
+/* DomTree_free */
+/* */
+/* Frees all memory allocated by this DomTree */
+/* Do not call directly. Is called by Perl when RefCnt goes to zero */
+/* */
+/* */
+/* ------------------------------------------------------------------------ */
+
+
+static int DomTree_free (SV * pSV, MAGIC * mg)
+
+ {
+ tIndex nNdx = SvIVX (pSV) ;
+
+ return DomTree_dodelete (DomTree_self (nNdx)) ;
+ }
+
+/* ------------------------------------------------------------------------ */
+/* */
+/* DomTree_delete */
+/* */
+/* Frees all memory allocated by this DomTree */
+/* */
+/* ------------------------------------------------------------------------ */
+
+int DomTree_delete (tDomTree * pDomTree)
+
+ {
+ SvREFCNT_dec (pDomTree -> pDomTreeSV) ;
+ return ok ;
+ }
+
/* ------------------------------------------------------------------------ */
/* */
@@ -529,14 +640,11 @@
{
tDomTree * pDomTree ;
- int n ;
tNodeData * pDocument ;
tIndex xOrgDomTree = pOrgDomTree -> xNdx ;
- n = ArrayAdd (&pDomTrees, 1) ;
- pDomTree = DomTree_self (n) ;
- pDomTree -> xNdx = n ;
+ pDomTree = DomTree_alloc () ;
pOrgDomTree = DomTree_self (xOrgDomTree) ; /* relookup in case it has moved */
pDomTree -> xDocument = pOrgDomTree -> xDocument ;
@@ -560,7 +668,7 @@
*pNewDomTree = pDomTree ;
- return n ;
+ return pDomTree -> xNdx ;
}
/* ------------------------------------------------------------------------ */
@@ -975,7 +1083,8 @@
numAttr++ ;
if (pCurrReq -> bDebug & dbgParse)
- lprintf (pCurrReq, "[%d]PARSE: AddNode: +%02d %*s Attribut parent=%d
node=%d type=%d text=%*.*s (#%d)\n", pCurrReq -> nPid, nLevel, nLevel * 2, "",
xParent, xNdx, nType, nTextLen, nTextLen, sText?sText:Ndx2String (nTextLen),
sText?String2Ndx (sText, nTextLen):nTextLen) ;
+ lprintf (pCurrReq, "[%d]PARSE: AddNode: +%02d %*s Attribut parent=%d
node=%d type=%d text=%*.*s (#%d)\n",
+ pCurrReq -> nPid, nLevel, nLevel * 2, "",
xParent, xNdx, nType, nTextLen, nTextLen, sText?sText:Ndx2String (nTextLen),
sText?String2Ndx (sText, nTextLen):nTextLen) ;
return xNdx ;
}
@@ -1022,7 +1131,8 @@
{
pNew -> xValue = sText?String2Ndx (sText, nTextLen):nTextLen ;
if (pCurrReq -> bDebug & dbgParse)
- lprintf (pCurrReq, "[%d]PARSE: AddNode: +%02d %*s AttributValue
parent=%d node=%d type=%d text=%*.*s (#%d)\n", pCurrReq -> nPid, nLevel, nLevel * 2,
"", xParent, pNew -> xNdx, nType, nTextLen, nTextLen, sText, sText?String2Ndx (sText,
nTextLen):-1) ;
+ lprintf (pCurrReq, "[%d]PARSE: AddNode: +%02d %*s AttributValue
parent=%d node=%d type=%d text=%*.*s (#%d)\n", pCurrReq -> nPid, nLevel, nLevel * 2,
"", xParent, pNew -> xNdx, nType, nTextLen, nTextLen, sText, sText?String2Ndx (sText,
+ nTextLen):-1) ;
pNew -> bFlags |= aflgAttrValue ;
return xParent ;
@@ -1077,7 +1187,8 @@
pNew = NodePad_appendChild (pDomTree, &pChilds, nType, String2Ndx (sText,
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, sText?String2Ndx (sText,
nTextLen):-1) ;
+ 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, sText?String2Ndx (sText,
nTextLen)
+:-1) ;
return pNew -> xNdx ;
}
@@ -2175,5 +2286,3 @@
return *ppAttr ;
}
-
-
1.1.2.30 +3 -3 embperl/Attic/epdom.h
Index: epdom.h
===================================================================
RCS file: /home/cvs/embperl/Attic/epdom.h,v
retrieving revision 1.1.2.29
retrieving revision 1.1.2.30
diff -u -r1.1.2.29 -r1.1.2.30
--- epdom.h 2000/06/26 19:28:36 1.1.2.29
+++ epdom.h 2000/07/04 21:37:31 1.1.2.30
@@ -164,7 +164,9 @@
tIndex xNdx ; /* Index of Dom Tree */
tNode xDocument ; /* root document node */
tIndex xFilename ; /* name of source file */
- SV * pSV ;
+ SV * pSV ; /* general purpose SV */
+ SV * pDomTreeSV ; /* SV that's hold the Index */
+ /* Domtree will be deleted when this SV is delted */
} ;
typedef struct tDomTree tDomTree ;
@@ -351,5 +353,3 @@
char * Attr_selfValue (/*in*/ tDomTree * pDomTree,
/*in*/ struct tAttrData * pAttr,
/*out*/ char * * ppAttr) ;
-
-
1.65.2.14 +20 -3 embperl/epmain.c
Index: epmain.c
===================================================================
RCS file: /home/cvs/embperl/epmain.c,v
retrieving revision 1.65.2.13
retrieving revision 1.65.2.14
diff -u -r1.65.2.13 -r1.65.2.14
--- epmain.c 2000/06/25 19:49:12 1.65.2.13
+++ epmain.c 2000/07/04 21:37:33 1.65.2.14
@@ -1441,6 +1441,12 @@
return 1 ;
}
+ if (!(r -> pDomTreeAV = newAV ()))
+ {
+ LogError (r, rcArrayError) ;
+ return 1 ;
+ }
+
rc = 0 ;
@@ -1612,6 +1618,8 @@
/*in*/ SV * pOpcodeMask)
{
+ SV * * ppSV ;
+ SV * pSV ;
tConf * pConf = malloc (sizeof (tConf)) ;
if (!pConf)
@@ -1629,6 +1637,17 @@
pConf -> sCookieExpires = sstrdup (GetHashValueStr (pReqInfo, "cookie_expires",
"")) ; /* cookie expiration time */
pConf -> sCookieDomain = sstrdup (GetHashValueStr (pReqInfo, "cookie_domain",
"")) ; ; /* domain patter for which the cookie should be returned */
pConf -> sCookiePath = sstrdup (GetHashValueStr (pReqInfo, "cookie_path",
"")) ; ; /* path to which cookie should be returned */
+ pConf -> sExpiresKey = sstrdup (GetHashValueStr (pReqInfo, "expires_key",
pCurrReq -> pConf?pCurrReq -> pConf -> sExpiresKey:NULL)) ; ;
+
+ pConf -> nExpiresAt = 0 ;
+ pConf -> pExpiresCV = NULL ;
+ ppSV = hv_fetch (pReqInfo, "expires_at", 10, 0) ;
+ if (ppSV && *ppSV && SvTYPE (*ppSV) == SVt_RV &&
+ SvTYPE (pSV = SvRV (*ppSV)) == SVt_PVCV)
+ pConf -> pExpiresCV = pSV ;
+ else if (ppSV && *ppSV)
+ pConf -> nExpiresAt = SvNV (*ppSV) ;
+
pConf -> cMultFieldSep = '\t' ;
pConf -> pOpenBracket = "[*" ;
pConf -> pCloseBracket = "*]" ;
@@ -2043,6 +2062,7 @@
tFile * pNext ;
hv_clear (r -> pHeaderHash) ;
+ av_clear (r -> pDomTreeAV) ;
av_clear (r -> pFormArray) ;
hv_clear (r -> pFormHash) ;
hv_clear (r -> pInputHash) ;
@@ -2503,9 +2523,6 @@
CloseOutput (r) ;
- if (r -> xCurrDomTree && !r -> bAppendToMainReq)
- DomTree_delete (DomTree_self (r -> xCurrDomTree)) ;
-
return ok ;
}
1.1.2.28 +1 -1 embperl/Attic/epparse.c
Index: epparse.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epparse.c,v
retrieving revision 1.1.2.27
retrieving revision 1.1.2.28
diff -u -r1.1.2.27 -r1.1.2.28
--- epparse.c 2000/06/19 04:15:25 1.1.2.27
+++ epparse.c 2000/07/04 21:37:34 1.1.2.28
@@ -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, "Document", 8, 0, 0, 0)))
+ if (!(xDocNode = Node_appendChild (pDomTree, r ->
bSubReq?ntypDocumentFraq:ntypDocument, 0, r -> bSubReq?"DocumentFraq":"Document", r ->
bSubReq?12:8, 0, 0, 0)))
return 1 ;
if (!(xNode = Node_appendChild (pDomTree, ntypAttr, 0, NULL, xDomTreeAttr,
xDocNode, 0, 0)))
No revision
No revision
1.1.2.28 +88 -7 embperl/Embperl/Attic/Syntax.pm
Index: Syntax.pm
===================================================================
RCS file: /home/cvs/embperl/Embperl/Attic/Syntax.pm,v
retrieving revision 1.1.2.27
retrieving revision 1.1.2.28
diff -u -r1.1.2.27 -r1.1.2.28
--- Syntax.pm 2000/06/19 04:15:28 1.1.2.27
+++ Syntax.pm 2000/07/04 21:37:39 1.1.2.28
@@ -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.27 2000/06/19 04:15:28 richter Exp $
+# $Id: Syntax.pm,v 1.1.2.28 2000/07/04 21:37:39 richter Exp $
#
###################################################################################
@@ -260,7 +260,7 @@
perlcode =>
[
'HTML::Embperl::Cmd::InputCheck (%$n%, %&*\'name%, %&*\'value%)
; %&=-type:radio|checkbox% ',
- '$idat{%&*\'name%}=$fdat{%&*\'name%} ;
XML::Embperl::DOM::Element_setAttribut (%$n%, \'value\', $fdat{%&*\'name%} || \'\') ;
%&!-value%',
+ '$idat{%&*\'name%}=$fdat{%&*\'name%} ; _ep_sa(%$n%, \'value\',
$fdat{%&*\'name%} || \'\') ; %&!-value%',
'$idat{%&*\'name%}=%&*\'value% ; ',
]
}
@@ -279,7 +279,7 @@
embperl => {
perlcode =>
[
-
'$idat{%&*\'name%}=$fdat{%&*\'name%};XML::Embperl::DOM::Node_appendChild (%$n%,
HTML::Embperl::Syntax::ntypText, $fdat{%&*\'name%}) ; %#!-0%',
+ '$idat{%&*\'name%}=$fdat{%&*\'name%};_ep_ac(%$n%,
HTML::Embperl::Syntax::ntypText, $fdat{%&*\'name%}) ; %#!-0%',
'$idat{%&*\'name%}=\'%#*0%\' ; ',
]
}
@@ -431,8 +431,8 @@
embperl => {
perlcode =>
[
- 'HTML::Embperl::Cmd::Option (%$n%, %^*\'htmlselect%,
%&*\'value%);',
- 'HTML::Embperl::Cmd::Option (%$n%, %^*\'htmlselect%, %>*\'0%);',
+ '_ep_opt (%$n%, %^*\'htmlselect%, %&*\'value%);',
+ '_ep_opt (%$n%, %^*\'htmlselect%, %>*\'0%);',
]
}
},
@@ -674,11 +674,45 @@
'unescape' => 1,
'procinfo' => {
embperl => {
- perlcode => 'HTML::Embperl::Cmd::Hidden (%$n%,%&\'<noname>%);',
+ perlcode => '_ep_hid(%$n%,%&\'<noname>%);',
removenode => 8,
}
},
},
+ 'sub' => {
+ 'text' => 'sub',
+ 'nodetype' => ntypTag,
+ 'cdatatype' => ntypAttrValue,
+ 'forcetype' => 1,
+ 'unescape' => 1,
+ 'endtag' => 'endsub',
+ 'procinfo' => {
+ embperl => {
+ perlcode => 'sub %&<noname>% { ',
+ removenode => 10,
+ mayjump => 1,
+ stackname => 'metacmd',
+ 'push' => 'sub',
+ switchcodetype => 2,
+ }
+ },
+ },
+ 'endsub' => {
+ 'text' => 'endsub',
+ 'nodetype' => ntypTag,
+ 'forcetype' => 1,
+ 'cdatatype' => 0,
+ 'procinfo' => {
+ embperl => {
+ perlcode => '};',
+ removenode => 10,
+ mayjump => 1,
+ stackname => 'metacmd',
+ stackmatch => 'sub',
+ switchcodetype => 1,
+ }
+ },
+ },
) ;
@@ -740,7 +774,19 @@
'nodetype' => ntypDocument,
'procinfo' => {
embperl => {
- perlcode => '# Include here any setup code',
+ perlcode => q{
+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::DomTree_checkpoint;
+*_ep_dcp=\\&XML::Embperl::DOM::DomTree_discardAfterCheckpoint;
+*_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;
+},
perlcodeend => '# Include here any cleanup code',
stackname => 'metacmd',
stackmatch => 'Document',
@@ -748,6 +794,32 @@
}
},
},
+ # The document fraq node is generated always and is not parserd, but can be
used to include code
+ 'DocumentFraq' => {
+ 'nodename' => 'DocumentFraq',
+ 'nodetype' => ntypDocumentFraq,
+ 'procinfo' => {
+ embperl => {
+ perlcode => q{
+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::DomTree_checkpoint;
+*_ep_dcp=\\&XML::Embperl::DOM::DomTree_discardAfterCheckpoint;
+*_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;
+},
+ perlcodeend => '# Include here any cleanup code',
+ stackname => 'metacmd',
+ stackmatch => 'DocumentFraq',
+ 'push' => 'DocumentFraq',
+ }
+ },
+ },
'HTML Tag' => {
'text' => '<',
'end' => '>',
@@ -986,6 +1058,15 @@
Check if value on stack which name is given with C<stackname> is the
same as the given value. If not give a error message about tag mismatch. Value could
include the same specical values as C<perlcode>
+
+=item switchcodetype => <1/2>
+
+1 means put the following code into normal code which is executed everytime the
page is
+requested
+
+2 means put the following code put into code which is executed direct after
compilation.
+This is mainly for defining subs, or using modules etc.
+
=back
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]