Mailing List Archive

cvs commit: embperl/Embperl Tokens.pm
richter 00/05/14 23:33:06

Modified: . Tag: Embperl2 Embperl.xs ep.h epcomp.c epdat.h
epdom.c epdom.h epeval.c epmain.c epparse.c test.pl
Embperl Tag: Embperl2 Tokens.pm
Log:
- Embperl 2 Compile & DOM & Output

Revision Changes Path
No revision


No revision


1.26.2.2 +1 -1 embperl/Embperl.xs

Index: Embperl.xs
===================================================================
RCS file: /home/cvs/embperl/Embperl.xs,v
retrieving revision 1.26.2.1
retrieving revision 1.26.2.2
diff -u -r1.26.2.1 -r1.26.2.2
--- Embperl.xs 2000/05/12 21:09:02 1.26.2.1
+++ Embperl.xs 2000/05/15 06:32:52 1.26.2.2
@@ -603,7 +603,7 @@

################################################################################

-MODULE = HTML::Embperl PACKAGE = HTML::Embperl::DOM PREFIX = embperl_
+MODULE = HTML::Embperl PACKAGE = XML::Embperl::DOM PREFIX = embperl_


void



1.23.2.1 +5 -0 embperl/ep.h

Index: ep.h
===================================================================
RCS file: /home/cvs/embperl/ep.h,v
retrieving revision 1.23
retrieving revision 1.23.2.1
diff -u -r1.23 -r1.23.2.1
--- ep.h 2000/04/22 20:18:02 1.23
+++ ep.h 2000/05/15 06:32:52 1.23.2.1
@@ -139,9 +139,14 @@
#endif
#endif

+struct tReq ;

+typedef struct tReq req ;
+typedef struct tReq tReq ;
+
#include "epnames.h"

+#include "epdom.h"
#include "epdat.h"
#include "embperl.h"




1.1.2.5 +10 -4 embperl/Attic/epcomp.c

Index: epcomp.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epcomp.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- epcomp.c 2000/05/12 21:09:02 1.1.2.4
+++ epcomp.c 2000/05/15 06:32:53 1.1.2.5
@@ -14,7 +14,6 @@

#include "ep.h"
#include "epmacro.h"
-#include "epdom.h"

struct tEmbperlCmd
{
@@ -22,6 +21,7 @@
} ;

char * pCode = NULL ;
+char * pProg = NULL ;

tStringIndex nMaxEmbperlCmd ;
struct tEmbperlCmd * pEmbperlCmds ;
@@ -169,9 +169,8 @@
}
if (valid)
{
- StringAdd (&pCode, sPerlCode, 0) ;
- StringAdd (&pCode, "\0", 1) ;
- lprintf (pCurrReq, "%s\n", pCode) ;
+ StringAdd (&pProg, pCode, ArrayGetSize (pCode)) ;
+ StringAdd (&pProg, sPerlCode, 0) ;
}
}
}
@@ -204,8 +203,13 @@


{
+ SV * pSV ;
+
tNode xNode = Node_firstChild (xDocument) ;

+ StringNew (&pProg, 8192) ;
+
+
while (xNode)
{
embperl_CompileNode (xNode) ;
@@ -213,4 +217,6 @@
xNode = Node_nextSibling (xNode) ;
}

+ StringAdd (&pProg, "", 1) ;
+ Eval (pCurrReq, pProg, 0, &pSV) ;
}



1.17.2.1 +3 -4 embperl/epdat.h

Index: epdat.h
===================================================================
RCS file: /home/cvs/embperl/epdat.h,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -u -r1.17 -r1.17.2.1
--- epdat.h 2000/05/02 04:41:37 1.17
+++ epdat.h 2000/05/15 06:32:53 1.17.2.1
@@ -14,11 +14,7 @@



-struct tReq ;

-typedef struct tReq req ;
-typedef struct tReq tReq ;
-
/*-----------------------------------------------------------------*/
/* */
/* Per (directory) configuration data */
@@ -264,6 +260,9 @@
int nInsideSub ; /* Are we inside of a sub? */
int bExit ; /* We should exit the page */

+
+ tNode xDocument ;
+
/* --- Source in memory --- */

tSrcBuf Buf ; /* Buffer */



1.1.2.9 +101 -1 embperl/Attic/epdom.c

Index: epdom.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epdom.c,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -r1.1.2.8 -r1.1.2.9
--- epdom.c 2000/05/12 21:09:02 1.1.2.8
+++ epdom.c 2000/05/15 06:32:53 1.1.2.9
@@ -14,7 +14,6 @@

#include "ep.h"
#include "epmacro.h"
-#include "epdom.h"

HV * pStringTableHash ; /* Hash to translate strings to index number */
const char * * pStringTableArray ; /* Array with pointers to strings */
@@ -163,7 +162,25 @@
}


+/* ------------------------------------------------------------------------ */
+/* */
+/* ArrayGetSize */
+/* */
+/* Get size of Array */
+/* */
+/* ------------------------------------------------------------------------ */
+
+
+int ArrayGetSize (/*in*/ const tArray * pArray)
+
+ {
+ struct tArrayCtrl * pCtrl = ((struct tArrayCtrl *)(pArray)) - 1 ;
+
+ return pCtrl -> nFill ;
+ }
+

+
/* ------------------------------------------------------------------------ */
/* */
/* StringNew */
@@ -705,6 +722,89 @@
return pNode -> xNdx ;
}

+
+
+
+/* ------------------------------------------------------------------------ */
+/* */
+/* Node_toString */
+/* */
+/* */
+/* */
+/* ------------------------------------------------------------------------ */
+
+
+void Node_toString (/*i/o*/ register req * r,
+ /*in*/ tNode xNode)
+
+
+ {
+ xNode = Node_firstChild (xNode) ;
+
+ while (xNode)
+ {
+ struct tNodeData * pNode = Node_self (xNode) ;
+
+ if (pNode -> nType == ntypTag || pNode -> nType == ntypStartTag)
+ {
+ int n = pNode -> numAttr ;
+ struct tAttrData * pAttr = (struct tAttrData *)(pNode + 1) ;
+
+ oputc (r, '<') ;
+ oputs (r, Node_nodeName (xNode)) ;
+
+ while (n--)
+ {
+ oputs (r, pStringTableArray[pAttr -> xName]) ;
+ if (pAttr -> xValue)
+ {
+ oputs (r, "=\"") ;
+ oputs (r, pStringTableArray[pAttr -> xValue]) ;
+ oputc (r, '"') ;
+ }
+ }
+ oputc (r, '>') ;
+ pAttr++ ;
+ }
+ else
+ oputs (r, Node_selfNodeName (pNode)) ;
+
+
+ Node_toString (r, xNode) ;
+
+ if (pNode -> nType == ntypStartTag)
+ {
+ oputs (r, "</") ;
+ oputs (r, Node_selfNodeName (pNode)) ;
+ oputc (r, '>') ;
+ }
+
+ xNode = Node_nextSibling (xNode) ;
+ }
+
+ }
+
+
+/* ------------------------------------------------------------------------ */
+/* */
+/* NodeList_toString */
+/* */
+/* */
+/* */
+/* ------------------------------------------------------------------------ */
+
+
+void NodeList_toString (/*in*/ tNode xNode)
+
+
+ {
+ xNode = Node_firstChild (xNode) ;
+
+
+
+ }
+
+
/* ------------------------------------------------------------------------

interface Element : Node {



1.1.2.6 +16 -0 embperl/Attic/epdom.h

Index: epdom.h
===================================================================
RCS file: /home/cvs/embperl/Attic/epdom.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- epdom.h 2000/05/12 21:09:03 1.1.2.5
+++ epdom.h 2000/05/15 06:32:54 1.1.2.6
@@ -106,9 +106,20 @@
const char * Ndx2String (/*in*/ tStringIndex nNdx) ;


+int ArrayNew (/*in*/ const tArray * pArray,
+ /*in*/ int nAdd,
+ /*in*/ int nElementSize) ;

+int ArraySet (/*in*/ const tArray * pArray,
+ /*in*/ int numElements) ;

+int ArraySetSize (/*in*/ const tArray * pArray,
+ /*in*/ int numElements) ;

+int ArrayGetSize (/*in*/ const tArray * pArray) ;
+
+
+
tNode Node_appendChild (/*i/o*/ register req * r,
/*in*/ tNodeType nType,
/*in*/ const char * sText,
@@ -133,6 +144,11 @@

#define Node_selfNodeNameNdx(pNode) (pNode -> nText) ;
#define Node_selfNodeName(pNode) (pStringTableArray[pNode -> nText])
+#define Node_nodeName(pNode) (pStringTableArray[Node_self (xNode) -> nText])
+
+void Node_toString (/*i/o*/ register req * r,
+ /*in*/ tNode xNode) ;
+


const char * Element_selfGetAttribut (/*in*/ struct tNodeData * pNode,



1.20.2.1 +1 -1 embperl/epeval.c

Index: epeval.c
===================================================================
RCS file: /home/cvs/embperl/epeval.c,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -u -r1.20 -r1.20.2.1
--- epeval.c 2000/04/17 21:22:19 1.20
+++ epeval.c 2000/05/15 06:32:54 1.20.2.1
@@ -576,7 +576,7 @@
------------------------------------------------------------------------------- */

int Eval (/*i/o*/ register req * r,
- /*in*/ const char * sArg,
+ /*in*/ const char * sArg,
/*in*/ int nFilepos,
/*out*/ SV ** pRet)




1.65.2.2 +2 -0 embperl/epmain.c

Index: epmain.c
===================================================================
RCS file: /home/cvs/embperl/epmain.c,v
retrieving revision 1.65.2.1
retrieving revision 1.65.2.2
diff -u -r1.65.2.1 -r1.65.2.2
--- epmain.c 2000/05/02 14:28:19 1.65.2.1
+++ epmain.c 2000/05/15 06:32:54 1.65.2.2
@@ -2401,6 +2401,8 @@
l -> pLastFreeBuf= r -> pLastFreeBuf ;
}
else
+ Node_toString (r, r -> xDocument) ;
+
oCommit (r, NULL) ;
}
}



1.1.2.10 +6 -1 embperl/Attic/epparse.c

Index: epparse.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epparse.c,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -r1.1.2.9 -r1.1.2.10
--- epparse.c 2000/05/11 07:27:55 1.1.2.9
+++ epparse.c 2000/05/15 06:32:54 1.1.2.10
@@ -14,7 +14,6 @@

#include "ep.h"
#include "epmacro.h"
-#include "epdom.h"


typedef unsigned char tCharMap [256/(sizeof(unsigned char)*8)] ;
@@ -548,6 +547,10 @@
pCurr++ ;
}

+ if (nCDataType)
+ if (!(xNewNode = Node_appendChild (r, nCDataType, pCurrStart, pCurr - pCurrStart, xParentNode, level)))
+ return 1 ;
+
*ppCurr = pCurr ;
return 0 ;
}
@@ -596,6 +599,8 @@

if ((rc = ParseTokens (r, &pStart, pEnd, &pTable, "", NULL, ntypCDATA, "root", xDocNode, 0)) != ok)
return rc ;
+
+ r -> xDocument = xDocNode ;

return embperl_CompileDocument (xDocNode) ;
}



1.57.2.4 +4 -4 embperl/test.pl

Index: test.pl
===================================================================
RCS file: /home/cvs/embperl/test.pl,v
retrieving revision 1.57.2.3
retrieving revision 1.57.2.4
diff -u -r1.57.2.3 -r1.57.2.4
--- test.pl 2000/05/03 14:03:50 1.57.2.3
+++ test.pl 2000/05/15 06:32:55 1.57.2.4
@@ -4,12 +4,12 @@


@tests = (
- 'input.htm?feld5=Wert5&feld6=Wert6&feld7=Wert7&feld8=Wert8&cb5=cbv5&cb6=cbv6&cb7=cbv7&cb8=cbv8&cb9=ncbv9&cb10=ncbv10&cb11=ncbv11&mult=Wert3&mult=Wert6&esc=a<b&escmult=a>b&escmult=Wert3',
+## 'input.htm?feld5=Wert5&feld6=Wert6&feld7=Wert7&feld8=Wert8&cb5=cbv5&cb6=cbv6&cb7=cbv7&cb8=cbv8&cb9=ncbv9&cb10=ncbv10&cb11=ncbv11&mult=Wert3&mult=Wert6&esc=a<b&escmult=a>b&escmult=Wert3',
## 'ascii',
## 'pure.htm',
-## 'plain.htm',
-## 'plain.htm',
-## 'plain.htm',
+ 'plain.htm',
+ 'plain.htm',
+ 'plain.htm',
## 'plainblock.htm',
## 'plainblock.htm',
## 'error.htm???8',



No revision


No revision


1.1.2.8 +4 -4 embperl/Embperl/Attic/Tokens.pm

Index: Tokens.pm
===================================================================
RCS file: /home/cvs/embperl/Embperl/Attic/Tokens.pm,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- Tokens.pm 2000/05/12 21:09:04 1.1.2.7
+++ Tokens.pm 2000/05/15 06:33:03 1.1.2.8
@@ -196,28 +196,28 @@
'text' => '[+',
'end' => '+]',
'procinfo' => {
- embperl => { perlcode => 'Output (%$n%, do { %#0% }) ; ' }
+ embperl => { perlcode => 'XML::Embperl::DOM::Node_replaceChildWithCDATA (%$n%, do { %#0% }) ; ' }
},
},
'Embperl code' => {
'text' => '[-',
'end' => '-]',
'procinfo' => {
- embperl => { perlcode => '%#0% ; Remove (%$n%) ; ' }
+ embperl => { perlcode => '%#0% ; XML::Embperl::DOM::Node_removeChild (%$n%) ; ' }
},
},
'Embperl startup code' => {
'text' => '[!',
'end' => '!]',
'procinfo' => {
- embperl => { perlcode => 'if (!$first++) { %#0% } ; Remove (%$n%) ; ' }
+ embperl => { perlcode => 'if (!$first++) { %#0% } ; XML::Embperl::DOM::Node_removeChild (%$n%) ; ' }
},
},
'Embperl comment' => {
'text' => '[#',
'end' => '#]',
'procinfo' => {
- embperl => { perlcode => 'Remove (%$n%) ; ' }
+ embperl => { perlcode => 'XML::Embperl::DOM::Node_removeChild (%$n%) ; ' }
},
},
) ;