Return-Path: Mailing-List: contact embperl-cvs-help@perl.apache.org; run by ezmlm Delivered-To: mailing list embperl-cvs@perl.apache.org Received: (qmail 71785 invoked by uid 500); 23 May 2000 16:02:10 -0000 Delivered-To: apmail-embperl-cvs@apache.org Received: (qmail 71715 invoked by uid 1071); 23 May 2000 16:01:59 -0000 Date: 23 May 2000 16:01:59 -0000 Message-ID: <20000523160159.71707.qmail@locus.apache.org> From: richter@locus.apache.org To: embperl-cvs@apache.org Subject: cvs commit: embperl/test/html escape.htm richter 00/05/23 09:01:55 Modified: . Tag: Embperl2 Embperl.xs epcomp.c epdom.c epdom.h epparse.c eputil.c test.pl Embperl Tag: Embperl2 Syntax.pm test/cmp Tag: Embperl2 varerr.htm test/html Tag: Embperl2 escape.htm Log: Revision Changes Path No revision No revision 1.26.2.7 +7 -2 embperl/Embperl.xs Index: Embperl.xs =================================================================== RCS file: /home/cvs/embperl/Embperl.xs,v retrieving revision 1.26.2.6 retrieving revision 1.26.2.7 diff -u -r1.26.2.6 -r1.26.2.7 --- Embperl.xs 2000/05/23 07:04:55 1.26.2.6 +++ Embperl.xs 2000/05/23 16:00:42 1.26.2.7 @@ -607,14 +607,17 @@ void -embperl_Node_replaceChildWithCDATA (xDomTree, xOldChild,sText) +embperl_Node_replaceChildWithCDATA (xDomTree, xOldChild,sText,nEscMask) int xDomTree int xOldChild SV * sText + int nEscMask CODE: IV l ; char * s = SvPV (sText, l) ; - Node_replaceChildWithCDATA (DomTree_self(xDomTree), -1, xOldChild, s, l, 5, nflgModified | nflgReturn) ; + Node_replaceChildWithCDATA (DomTree_self(xDomTree), -1, xOldChild, s, l, pCurrReq -> nCurrEscMode == 3?nEscMask:pCurrReq -> nCurrEscMode, nflgModified | nflgReturn) ; + pCurrReq -> nCurrEscMode = pCurrReq -> nEscMode ; + pCurrReq -> bEscModeSet = -1 ; void @@ -630,6 +633,8 @@ int xDomTree int xChild CODE: + pCurrReq -> nCurrEscMode = pCurrReq -> nEscMode ; + pCurrReq -> bEscModeSet = -1 ; DomTree_checkpoint (xDomTree, xChild) ; #void 1.1.2.11 +32 -4 embperl/Attic/epcomp.c Index: epcomp.c =================================================================== RCS file: /home/cvs/embperl/Attic/epcomp.c,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- epcomp.c 2000/05/23 07:04:55 1.1.2.10 +++ epcomp.c 2000/05/23 16:00:47 1.1.2.11 @@ -131,10 +131,11 @@ else { const char * sVal ; + tAttrData * pAttr ; if (p[1] == '!' || p[1] == '*') { - sVal = Element_selfGetAttribut (pDomTree, pNode, p + 2, q - p - 2) ; + pAttr = Element_selfGetAttribut (pDomTree, pNode, p + 2, q - p - 2) ; if ((sVal && p[1] == '!') || (!sVal && p[1] == '*') ) { valid = 0 ; @@ -142,8 +143,16 @@ } } else - sVal = Element_selfGetAttribut (pDomTree, pNode, p + 1, q - p - 1) ; + pAttr = Element_selfGetAttribut (pDomTree, pNode, p + 1, q - p - 1) ; + if (pAttr -> bFlags & aflgAttrValue) + sVal = Ndx2String (pAttr -> xValue) ; + else + { + sVal = Node_selfNodeName (Node_selfFirstChild (pDomTree, (tNodeData *)pAttr)) ; + } + + if (sVal) { StringAdd (&pCode, sVal, 0) ; @@ -190,7 +199,25 @@ tStringIndex nNdx ; tEmbperlCmd * pCmd ; tNodeData * pNode = Node_self (pDomTree, xNode) ; + tAttrData * pAttr ; + int nAttr = 0 ; + + while (pAttr = Element_selfGetNthAttribut (pDomTree, pNode, nAttr++)) + { + if (pAttr -> bFlags & aflgAttrChilds) + { + tNodeData * pChild = Node_selfFirstChild (pDomTree, (tNodeData *)pAttr) ; + while (pChild) + { + embperl_CompileNode (pDomTree, pChild -> xNdx, bCheckpointPending) ; + pChild = Node_selfNextSibling (pDomTree, pChild) ; + } + } + + } + + nNdx = Node_selfNodeNameNdx (pNode) ; if (nNdx <= nMaxEmbperlCmd) @@ -226,7 +253,8 @@ } } - *bCheckpointPending = 1 ; + if (pCmd -> sPerlCode) + *bCheckpointPending = 1 ; if (pCmd -> bRemoveNode & 1) Node_selfRemoveChild(pDomTree, -1, pNode) ; else if (pCmd -> bRemoveNode & 8) @@ -315,7 +343,7 @@ xNode = Node_firstChild (pDomTree, r -> xDocument) ; StringNew (&pProg, r -> Buf.pFile -> nFilesize / 4) ; - StringAdd (&pProg, "my $_ep_DomTree = $_[1];\n*_ep_rp=\\&XML::Embperl::DOM::Node_replaceChildWithCDATA;\n*_ep_cp=\\&XML::Embperl::DOM::DomTree_checkpoint;\n ", 0) ; + StringAdd (&pProg, "my $_ep_DomTree = $_[1];\nmy $_ep_EscMask = 5;\n*_ep_rp=\\&XML::Embperl::DOM::Node_replaceChildWithCDATA;\n*_ep_cp=\\&XML::Embperl::DOM::DomTree_checkpoint;\n ", 0) ; while (xNode) { 1.1.2.16 +125 -36 embperl/Attic/epdom.c Index: epdom.c =================================================================== RCS file: /home/cvs/embperl/Attic/epdom.c,v retrieving revision 1.1.2.15 retrieving revision 1.1.2.16 diff -u -r1.1.2.15 -r1.1.2.16 --- epdom.c 2000/05/23 07:04:55 1.1.2.15 +++ epdom.c 2000/05/23 16:00:48 1.1.2.16 @@ -501,6 +501,41 @@ return pChilds ; } +/* ------------------------------------------------------------------------ */ +/* */ +/* NodePad_appendChild */ +/* */ +/* Append a child node to a pad */ +/* */ +/* ------------------------------------------------------------------------ */ + +tNodeData * NodePad_appendChild (/*in*/ tDomTree * pDomTree, + /*in*/ tNodePad * pPad, + /*in*/ tNodeType nType, + /*in*/ tIndex xText) + + { + tNodeData * pNew = (struct tNodeData *)(((tUInt8 *)pPad) + pPad -> nFill) ; + tNode xNdx = ArrayAdd (&pDomTree -> pLookup, 1) ; + + pDomTree -> pLookup[xNdx] = pNew ; + + pNew -> nText = xText ; + pNew -> nType = nType ; + pNew -> numAttr = 0 ; + pNew -> xNdx = xNdx ; + pNew -> xChilds = 0 ; + pNew -> bFlags = nflgOK ; + pNew -> nPadOffset = pPad -> nFill ; + + pPad -> numChilds++ ; + pPad -> nFill += sizeof (struct tNodeData) ; + numNodes++ ; + + return pNew ; + } + + /* ------------------------------------------------------------------------ */ /* */ @@ -558,11 +593,12 @@ pPad = pNext ; } - xNdx = ArrayAdd (&pDomTree -> pLookup, 1) ; + xNdx = ArrayAdd (&pDomTree -> pLookup, 1) ; pDomTree -> pLookup[xNdx] = (struct tNodeData *)pNew ; pNew -> xName = String2Ndx (sText, nTextLen) ; pNew -> xValue = 0 ; + pNew -> bFlags = aflgOK ; pNew -> nType = nType ; pNew -> xNdx = xNdx ; pNew -> nNodeOffset = ((tUInt8 *)pNew) - ((tUInt8 *)pParent) ; @@ -575,9 +611,9 @@ return xNdx ; } - else if (nType == ntypAttrValue) + else if (nType == ntypAttrValue && (pParent -> bFlags & aflgAttrChilds) == 0) { - struct tAttrData * pNew = (struct tAttrData * )pDomTree -> pLookup[xParent] ; + struct tAttrData * pNew = (struct tAttrData * )pParent ; if (pNew -> nType != ntypAttr) { if (!(xParent = Node_appendChild (pDomTree, ntypAttr, "a0", 2, xParent, nLevel))) @@ -591,6 +627,7 @@ pNew -> xValue = String2Ndx (sText, 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) ; + pNew -> bFlags |= aflgAttrValue ; return xParent ; } @@ -602,10 +639,26 @@ if (pParent && pParent -> nType == ntypAttr) { - pChilds = NewPad (pDomTree, xParent) ; + tIndex xOldValue = 0 ; + + if (((tAttrData *)pParent) -> bFlags & aflgAttrChilds) + pChilds = NodePad_self (pDomTree, ((tAttrData *)pParent) -> xValue) ; + else + pChilds = NewPad (pDomTree, xParent) ; /* lprintf (pCurrReq, "[%d]PARSE: NewPad NewAttrChild: %d -> %d\n", pCurrReq -> nPid, xParent, pChilds -> xNdx) ; */ - ((struct tAttrData *)pParent) -> xValue = pChilds -> xNdx ; + if (((tAttrData *)pParent) -> bFlags & aflgAttrValue) + { + xOldValue = ((tAttrData *)pParent) -> xValue ; + ((tAttrData *)pParent) -> bFlags &= ~aflgAttrValue ; + } + + + ((tAttrData *)pParent) -> xValue = pChilds -> xNdx ; + ((tAttrData *)pParent) -> bFlags |= aflgAttrChilds ; + if (xOldValue) + NodePad_appendChild (pDomTree, pChilds, ntypAttrValue, xOldValue) ; + } else if (!pParent || !pParent -> xChilds) { @@ -634,28 +687,13 @@ pChilds = pNext ; } } - - pNew = (struct tNodeData *)(((tUInt8 *)pChilds) + pChilds -> nFill) ; - - xNdx = ArrayAdd (&pDomTree -> pLookup, 1) ; - pDomTree -> pLookup[xNdx] = pNew ; - - pNew -> nText = String2Ndx (sText, nTextLen) ; - pNew -> nType = nType ; - pNew -> numAttr = 0 ; - pNew -> xNdx = xNdx ; - pNew -> xChilds = 0 ; - pNew -> bFlags = nflgOK ; - pNew -> nPadOffset = pChilds -> nFill ; - pChilds -> numChilds++ ; - pChilds -> nFill += sizeof (struct tNodeData) ; - numNodes++ ; + pNew = NodePad_appendChild (pDomTree, pChilds, nType, String2Ndx (sText, nTextLen)) ; 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, 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 xNdx ; + return pNew -> xNdx ; } } @@ -969,15 +1007,17 @@ /* ------------------------------------------------------------------------ */ -void Node_toString (/*in*/ tDomTree * pDomTree, - /*i/o*/ register req * r, - /*in*/ tNode xNode) + +void Node_toString2 (/*in*/ tDomTree * pDomTree, + /*i/o*/ register req * r, + /*in*/ tNode xNode, + /*in*/ int * pOrderNdx) { tNode xFirstNode = xNode ; tNode xNextNode ; - int nOrderNdx = 0 ; + int nOrderNdx = *pOrderNdx ; tNodeData * pNextNode ; tNodeData * pSavedNode = NULL ; struct tNodeData * pNode = Node_self (pDomTree, xNode) ; @@ -1030,16 +1070,24 @@ { char * s ; int l ; - Ndx2StringLen (pAttr -> xName,s,l) ; + Ndx2StringLen (pAttr -> xName,s,l) ; oputc (r, ' ') ; owrite (r, s, l); + if (pAttr -> xValue) { - oputs (r, "=\"") ; - Ndx2StringLen (pAttr -> xValue, s, l) ; - owrite (r, s, l) ; - oputc (r, '"') ; - } + oputs (r, "=\"") ; + if (pAttr -> bFlags & aflgAttrChilds) + { + Node_toString2 (pDomTree, r, pAttr -> xNdx, &nOrderNdx) ; + } + else + { + Ndx2StringLen (pAttr -> xValue, s, l) ; + owrite (r, s, l) ; + } + oputc (r, '"') ; + } } oputc (r, '>') ; pAttr++ ; @@ -1071,7 +1119,10 @@ { pNextNode = Node_selfParentNode (pDomTree, pNode) ; if (pNextNode == NULL || pNextNode -> xNdx == xFirstNode) - return ; + { + *pOrderNdx = nOrderNdx ; + return ; + } if (pNextNode -> nType == ntypStartTag && (pNextNode -> bFlags & nflgIgnore) == 0) { @@ -1087,9 +1138,21 @@ pNode = pNextNode ; } + *pOrderNdx = nOrderNdx ; } +void Node_toString (/*in*/ tDomTree * pDomTree, + /*i/o*/ register req * r, + /*in*/ tNode xNode) + + { + int nOrderNdx = 0 ; + + Node_toString2 (pDomTree, r, xNode, &nOrderNdx) ; + } + + /* ------------------------------------------------------------------------ */ /* */ /* NodeList_toString */ @@ -1168,7 +1231,7 @@ -const char * Element_selfGetAttribut (/*in*/ tDomTree * pDomTree, +tAttrData * Element_selfGetAttribut (/*in*/ tDomTree * pDomTree, /*in*/ struct tNodeData * pNode, /*in*/ const char * sAttrName, /*in*/ int nAttrNameLen) @@ -1185,9 +1248,35 @@ } if (n) - return Ndx2String (pAttr -> xValue) ; + return pAttr ; return NULL ; + } + + + +/* ------------------------------------------------------------------------ */ +/* */ +/* Element_selfGetNthAttribut */ +/* */ +/* Get attribute value of Element by index */ +/* */ +/* ------------------------------------------------------------------------ */ + + + +tAttrData * Element_selfGetNthAttribut (/*in*/ tDomTree * pDomTree, + /*in*/ struct tNodeData * pNode, + /*in*/ int n) + + { + struct tAttrData * pAttr = (struct tAttrData * )(pNode + 1) ; + int num = pNode -> numAttr ; + + if (n < 0 || n >= num) + return NULL ; + + return pAttr + n ; } 1.1.2.12 +14 -1 embperl/Attic/epdom.h Index: epdom.h =================================================================== RCS file: /home/cvs/embperl/Attic/epdom.h,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -u -r1.1.2.11 -r1.1.2.12 --- epdom.h 2000/05/23 07:04:55 1.1.2.11 +++ epdom.h 2000/05/23 16:00:49 1.1.2.12 @@ -70,6 +70,7 @@ struct tAttrData { tNodeType nType ; + tUInt8 bFlags ; tUInt16 nNodeOffset ; tIndex xNdx ; tIndex xName ; @@ -127,6 +128,13 @@ nflgReturn = 64, } ; +enum tAttrFlags + { + aflgDeleted = 0, + aflgOK = 1, + aflgAttrValue = 2, + aflgAttrChilds = 4, + } ; struct tDomTree { @@ -201,6 +209,7 @@ #define DomTree_self(xDomTree) (&pDomTrees[xDomTree]) #define NodePad_self(pDomTree,xNode) ((struct tNodePad *)(pDomTree -> pLookup[xNode])) +#define NodePad_selfFirstChild(pDomTree,pNodePad) ((tNodeData *)(pNodePad + 1)) #define Node_self(pDomTree,xNode) ((struct tNodeData *)(pDomTree -> pLookup[xNode])) @@ -231,10 +240,14 @@ -const char * Element_selfGetAttribut (/*in*/ tDomTree * pDomTree, +tAttrData * Element_selfGetAttribut (/*in*/ tDomTree * pDomTree, /*in*/ struct tNodeData * pNode, /*in*/ const char * sAttrName, /*in*/ int nAttrNameLen) ; + +tAttrData * Element_selfGetNthAttribut (/*in*/ tDomTree * pDomTree, + /*in*/ struct tNodeData * pNode, + /*in*/ int n) ; 1.1.2.14 +26 -9 embperl/Attic/epparse.c Index: epparse.c =================================================================== RCS file: /home/cvs/embperl/Attic/epparse.c,v retrieving revision 1.1.2.13 retrieving revision 1.1.2.14 diff -u -r1.1.2.13 -r1.1.2.14 --- epparse.c 2000/05/23 07:04:55 1.1.2.13 +++ epparse.c 2000/05/23 16:00:50 1.1.2.14 @@ -292,7 +292,7 @@ p -> nNodeType = GetHashValueInt (pHash, "nodetype", ntypTag) ; p -> bUnescape = GetHashValueInt (pHash, "unescape", 0) ; p -> nCDataType = GetHashValueInt (pHash, "cdatatype", ntypCDATA) ; - p -> pEndTag = (struct tToken *)GetHashValueStr (pHash, "nodename", NULL) ; + p -> pEndTag = (struct tToken *)GetHashValueStr (pHash, "endtag", NULL) ; if (sContains = GetHashValueStr (pHash, "contains", NULL)) { unsigned char * pC ; @@ -311,17 +311,19 @@ p -> pContains = NULL ; c = p -> sText ; - pStartChars [*c >> 3] |= 1 << (*c & 7) ; + pStartChars [toupper(*c) >> 3] |= 1 << (toupper(*c) & 7) ; + pStartChars [tolower(*c) >> 3] |= 1 << (tolower(*c) & 7) ; while (*c) { - pAllChars [*c >> 3] |= 1 << (*c & 7) ; + pAllChars [tolower(*c) >> 3] |= 1 << (tolower(*c) & 7) ; + pAllChars [toupper(*c) >> 3] |= 1 << (toupper(*c) & 7) ; c++ ; } if (r -> bDebug & dbgBuildToken) - lprintf (r, "[%d]TOKEN: %s ... %s\n", r -> nPid, p -> sText, p -> pContains?sContains:p -> sEndText) ; + lprintf (r, "[%d]TOKEN: %s ... %s unesc=%d nodetype=%d, cdatatype=%d, nodename=%s\n", r -> nPid, p -> sText, p -> pContains?sContains:p -> sEndText, p -> bUnescape, p -> nNodeType, p -> nCDataType, p -> sNodeName?p -> sNodeName:"") ; if (p -> sNodeName) p -> nNodeName = String2Ndx (p -> sNodeName, strlen (p -> sNodeName)) ; @@ -366,7 +368,7 @@ if (pTable[i].pEndTag == NULL) { strncpy (r -> errdat1, "BuildTokenHash", sizeof (r -> errdat1)) ; - sprintf (r -> errdat2, " EndTag %s not found", s) ; + sprintf (r -> errdat2, " EndTag %s for %s not found", pTable[i].sText, s) ; return rcNotFound ; } @@ -467,7 +469,7 @@ for (i = 0, pToken = pTokenTab; i < numTokens; i++, pToken++) { - r = strncmp (pCurr, pToken -> sText, pToken -> nTextLen) ; + r = strnicmp (pCurr, pToken -> sText, pToken -> nTextLen) ; if (r == 0 || *pCurr > *(pToken -> sText)) break ; } @@ -512,7 +514,12 @@ if (nCDataType) { if (bUnescape) - TransHtml (r, pCurrStart, pCurrTokenStart - pCurrStart) ; + { + r -> bEscInUrl = bUnescape - 1 ; + TransHtml (r, pCurrStart, pCurrTokenStart - pCurrStart) ; + r -> bEscInUrl = 0 ; + } + if (!(xNewNode = Node_appendChild (r -> pCurrDomTree, nCDataType, pCurrStart, pCurrTokenStart - pCurrStart, xParentNode, level))) return 1 ; } @@ -531,7 +538,11 @@ if (pEndCurr - pCurr && pToken -> nCDataType && pToken -> nCDataType != ntypCDATA) { if (pToken -> bUnescape) + { + r -> bEscInUrl = pToken -> bUnescape - 1 ; TransHtml (r, pCurr, pEndCurr - pCurr) ; + r -> bEscInUrl = 0 ; + } if (!(xNewAttrNode = Node_appendChild (r -> pCurrDomTree, pToken -> nCDataType, pCurr, pEndCurr - pCurr, xParentNode, level+1))) return 1 ; @@ -579,7 +590,11 @@ if (pEndCurr - pCurr && pToken -> nCDataType) { if (pToken -> bUnescape) + { + r -> bEscInUrl = pToken -> bUnescape - 1 ; TransHtml (r, pCurr, pEndCurr - pCurr) ; + r -> bEscInUrl = 0 ; + } if (!(xNewAttrNode = Node_appendChild (r -> pCurrDomTree, pToken -> nCDataType, pCurr, pEndCurr - pCurr, xNewNode, level+1))) return 1 ; @@ -604,7 +619,8 @@ if (!(xNewNode = Node_appendChild (r -> pCurrDomTree, nCDataType, pCurrStart, pCurr - pCurrStart, xParentNode, level))) return 1 ; } - break ; + *ppCurr = pCurr ; + return 0 ; } else if (sEndText == NULL || (*pCurr == *sEndText && strncmp (pCurr, sEndText, nEndText) == 0)) @@ -613,7 +629,8 @@ if (!(xNewNode = Node_appendChild (r -> pCurrDomTree, nCDataType, pCurrStart, pCurr - pCurrStart, xParentNode, level))) return 1 ; pCurr += nEndText ; - break ; + *ppCurr = pCurr ; + return 0 ; } else if (!pToken) pCurr++ ; 1.14.2.2 +1 -1 embperl/eputil.c Index: eputil.c =================================================================== RCS file: /home/cvs/embperl/eputil.c,v retrieving revision 1.14.2.1 retrieving revision 1.14.2.2 diff -u -r1.14.2.1 -r1.14.2.2 --- eputil.c 2000/05/19 13:35:26 1.14.2.1 +++ eputil.c 2000/05/23 16:00:51 1.14.2.2 @@ -113,7 +113,7 @@ } else { - pHtml = r -> pCurrEscape[(unsigned char)(*sData)].sHtml ; + pHtml = pEscTab[(unsigned char)(*sData)].sHtml ; if (*pHtml) { if (p != sData) 1.57.2.9 +2 -2 embperl/test.pl Index: test.pl =================================================================== RCS file: /home/cvs/embperl/test.pl,v retrieving revision 1.57.2.8 retrieving revision 1.57.2.9 diff -u -r1.57.2.8 -r1.57.2.9 --- test.pl 2000/05/23 07:04:55 1.57.2.8 +++ test.pl 2000/05/23 16:00:53 1.57.2.9 @@ -27,7 +27,7 @@ ## 'rawinput/rawinput.htm????16', 'var.htm', 'varerr.htm???-1', - 'varerr.htm???2', +## 'varerr.htm???2', 'escape.htm', 'spaces.htm', 'tagscan.htm', @@ -347,7 +347,7 @@ } else { - $eq = $l1 eq $l2 ; + $eq = lc ($l1) eq lc ($l2) ; } } No revision No revision 1.1.2.5 +155 -57 embperl/Embperl/Attic/Syntax.pm Index: Syntax.pm =================================================================== RCS file: /home/cvs/embperl/Embperl/Attic/Syntax.pm,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- Syntax.pm 2000/05/23 07:05:06 1.1.2.4 +++ Syntax.pm 2000/05/23 16:01:25 1.1.2.5 @@ -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.4 2000/05/23 07:05:06 richter Exp $ +# $Id: Syntax.pm,v 1.1.2.5 2000/05/23 16:01:25 richter Exp $ # ################################################################################### @@ -28,6 +28,100 @@ use constant ntypCDATA => 4 ; +sub clonehash + { + my ($old, $new, $replace) = @_ ; + + + $replace ||= {} ; + my ($v, $k) ; + + while (($k, $v) = each (%$old)) + { + if ($replace -> {$k}) + { + $new -> {$k} = $replace -> {$k} ; + } + else + { + if (ref ($v) eq 'HASH') + { + $new -> {$k} = clonehash ($v, {}, $replace) ; + } + else + { + $new -> {$k} = $v ; + } + } + } + + return $new ; + } + + + + +%Cmds = ( + '-lsearch' => 1, + 'Embperl command escape' => { + 'text' => '[[', + }, + 'Embperl meta command' => { + 'text' => '[$', + 'end' => '$]', + 'follow' => \%MetaCmds, + 'unescape' => 1, + }, + 'Embperl output code' => { + 'text' => '[+', + 'end' => '+]', + 'unescape' => 1, + 'procinfo' => { + embperl => { + perlcode => '_ep_rp(%$n%,scalar(do{%#0%}), 6);', + removenode => 4, + } + }, + }, + 'Embperl code' => { + 'text' => '[-', + 'end' => '-]', + 'unescape' => 1, + 'procinfo' => { + embperl => { + perlcode => '%#0%;', + removenode => 3, + }, + }, + }, + 'Embperl startup code' => { + 'text' => '[!', + 'end' => '!]', + 'unescape' => 1, + 'procinfo' => { + embperl => { + perlcode => 'if (!$first++) { %#0% } ;', + removenode => 3, + } + }, + }, + 'Embperl comment' => { + 'text' => '[#', + 'end' => '#]', + 'procinfo' => { + embperl => { removenode => 3, }, + }, + }, + ) ; + + +clonehash (\%Cmds, \%CmdsLink, { 'unescape' => 2 }) ; + +$CmdsLink{'Embperl output code'}{'nodename'} = '[+url' ; +$CmdsLink{'Embperl output code'}{'procinfo'}{'embperl'}{'perlcode'} = '_ep_rp(%$n%,scalar(do{%#0%}), 5);' ; + + + %Attr = ( '-lsearch' => 1, 'Attribut ""' => @@ -55,6 +149,9 @@ } ) ; +clonehash (\%Attr, \%AttrLink, { inside => \%CmdsLink }) ; + + %AssignAttr = ( 'Assign' => @@ -65,6 +162,29 @@ ) ; +%AssignAttrLink = ( + 'Assign' => + { + 'text' => '=', + 'follow' => \%AttrLink, + } + ) ; + +%HrefLink = ( + 'link' => { 'text' => 'href', 'nodename' => 'href', follow => \%AssignAttrLink }, + %Cmds, +) ; + +%SrcLink = ( + 'link' => { 'text' => 'src', 'nodename' => 'src', follow => \%AssignAttrLink }, + %Cmds, +) ; + +%ActionLink = ( + 'link' => { 'text' => 'action', 'nodename' => 'action', follow => \%AssignAttrLink }, + %Cmds, +) ; + %HtmlTags = ( 'input' => { 'text' => 'input', @@ -132,7 +252,33 @@ }, 'a' => { 'text' => 'a', + 'cdatatype' => ntypAttrValue, + 'inside' => \%HrefLink, }, + 'frame' => { + 'text' => 'frame', + 'inside' => \%SrcLink, + }, + 'iframe' => { + 'text' => 'iframe', + 'inside' => \%SrcLink, + }, + 'embed' => { + 'text' => 'embed', + 'inside' => \%SrcLink, + }, + 'layer' => { + 'text' => 'layer', + 'inside' => \%SrcLink, + }, + 'img' => { + 'text' => 'img', + 'inside' => \%SrcLink, + }, + 'form' => { + 'text' => 'form', + 'inside' => \%ActionLink, + }, ) ; @@ -273,58 +419,6 @@ -%Cmds = ( - '-lsearch' => 1, - 'Embperl meta command' => { - 'text' => '[$', - 'end' => '$]', - 'follow' => \%MetaCmds, - 'unescape' => 1, - }, - 'Embperl output code' => { - 'text' => '[+', - 'end' => '+]', - 'unescape' => 1, - 'procinfo' => { - embperl => { -# perlcode => 'push @a, 300, 500, do { %#0% } ; ', # do XML::Embperl::DOM::Node_replaceChildWithCDATA (%$n%, scalar (do { %#0% })) ; ', -# perlcode => 'XML::Embperl::DOM::Node_replaceChildWithCDATA (%$n%, scalar (do { %#0% })) ; ', - perlcode => '_ep_rp(%$n%,scalar(do{%#0%}));', - removenode => 4, - } - }, - }, - 'Embperl code' => { - 'text' => '[-', - 'end' => '-]', - 'unescape' => 1, - 'procinfo' => { - embperl => { - perlcode => '%#0%;', - removenode => 3, - }, - }, - }, - 'Embperl startup code' => { - 'text' => '[!', - 'end' => '!]', - 'unescape' => 1, - 'procinfo' => { - embperl => { - perlcode => 'if (!$first++) { %#0% } ;', - removenode => 3, - } - }, - }, - 'Embperl comment' => { - 'text' => '[#', - 'end' => '#]', - 'procinfo' => { - embperl => { removenode => 3, }, - }, - }, - ) ; - %Default = ( '-lsearch' => 1, @@ -444,7 +538,8 @@ =item removenode => -Remove node after compiling. could be one of the following: +Remove node after compiling. could be one of the following, +values could be added: =over 4 @@ -452,15 +547,18 @@ Remove this node only -=item 3 +=item 2 -Remove this node and next node if it consists of only white spaces and optKeepSpaces isn't set. +Remove next node if it consists of only white spaces and optKeepSpaces isn't set. =item 4 Replace next node with one space if next node consists only of white spaces and optKeepSpaces isn't set. -. + +=item 8 + +Set this node to ignore for output. =back No revision No revision 1.5.2.1 +2 -5 embperl/test/cmp/varerr.htm Index: varerr.htm =================================================================== RCS file: /home/cvs/embperl/test/cmp/varerr.htm,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -r1.5 -r1.5.2.1 --- varerr.htm 2000/03/28 19:46:07 1.5 +++ varerr.htm 2000/05/23 16:01:33 1.5.2.1 @@ -2,11 +2,8 @@

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

^Please contact the server administrator\,.*?and inform them of the time the error occurred\, and anything you might have done that may have caused the error\. -^\[.*?\]ERR\: 32\: Line 16: Warning in Perl code\: Use of uninitialized value -^\[.*?\]ERR\: 32\: Line 17: Warning in Perl code\: Use of uninitialized value -^\[.*?\]ERR\: 32\: Line 18: Warning in Perl code\: Use of uninitialized value -^\[.*?\]ERR\: (32\: Line 19: Warning|24\: Line 19: Error) in Perl code\: Global symbol \"\;\$?d\"\; requires explicit package name at.*? -^\[.*?\]ERR\: (32\: Line 20: Warning|24\: Line 20: Error) in Perl code\: Global symbol \"\;\$?e\"\; requires explicit package name at.*? +^^\[.*?\]ERR\: (32\: Line \d+: Warning|24\: Line \d+: Error) in Perl code\: Global symbol \"\;\$?d\"\; requires explicit package name at.*? +^\[.*?\]ERR\: (32\: Line \d+: Warning|24\: Line \d+: Error) in Perl code\: Global symbol \"\;\$?e\"\; requires explicit package name at.*? ^ HTML\:\:Embperl.*?

No revision No revision 1.11.2.1 +43 -22 embperl/test/html/escape.htm Index: escape.htm =================================================================== RCS file: /home/cvs/embperl/test/html/escape.htm,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -r1.11 -r1.11.2.1 --- escape.htm 2000/05/02 04:41:41 1.11 +++ escape.htm 2000/05/23 16:01:41 1.11.2.1 @@ -22,7 +22,7 @@ What is the EscMode? [+ $escmode +] -Now a Url: Here it goes +Now a Url: Here it goes A Tag 2: a2 A Tag 3: a3 A Tag 4: a4 @@ -108,27 +108,48 @@ [+ local $escmode = 1 ; $b . " \\\\" +]
[+ local $escmode = 2 ; $b . " \\\\
" +]
[+ local $escmode = 3 ; $b . " \\\\
" +]
-[+ local $escmode = 4 ; $b . " \\\\
" +]
-[+ local $escmode = 5 ; $b . " \\\\
" +]
-[+ local $escmode = 6 ; $b . " \\\\
" +]
-[+ local $escmode = 7 ; $b . " \\\\
" +]
- -Same without local: -[+ $escmode = 0 ; $b . " \\\\
" +]
-[+ $escmode = 1 ; $b . " \\\\
" +]
-[+ $escmode = 2 ; $b . " \\\\
" +]
-[+ $escmode = 3 ; $b . " \\\\
" +]
-[+ $escmode = 4 ; $b . " \\\\
" +]
-[+ $escmode = 5 ; $b . " \\\\
" +]
-[+ $escmode = 6 ; $b . " \\\\
" +]
-[+ $escmode = 7 ; $b . " \\\\
" +]
- - -Control Chars 0x80-0x9f: -[+ local $escmode = 7 ; foreach (127..160) { $cc .= chr ($_) }; $cc +]
- -Control Chars 129 & 130: -[+ local $escmode = 7 ; "‚" +]
+[+ local $escmode = 4 ; $b . " \\\\
" +]
+ +[+ local $escmode = 5 ; $b . " \\\\
" +]
+ +[+ local $escmode = 6 ; $b . " \\\\
" +]
+ +[+ local $escmode = 7 ; $b . " \\\\
" +]
+ + + +Same without local: + +[+ $escmode = 0 ; $b . " \\\\
" +]
+ +[+ $escmode = 1 ; $b . " \\\\
" +]
+ +[+ $escmode = 2 ; $b . " \\\\
" +]
+ +[+ $escmode = 3 ; $b . " \\\\
" +]
+ +[+ $escmode = 4 ; $b . " \\\\
" +]
+ +[+ $escmode = 5 ; $b . " \\\\
" +]
+ +[+ $escmode = 6 ; $b . " \\\\
" +]
+ +[+ $escmode = 7 ; $b . " \\\\
" +]
+ + + + + +Control Chars 0x80-0x9f: + +[+ local $escmode = 7 ; foreach (127..160) { $cc .= chr ($_) }; $cc +]
+ + + +Control Chars 129 & 130: + +[+ local $escmode = 7 ; "‚" +]
+ [+ $n = 'My Name ���' ; $escmode = 0 +]