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...@apache.org on 2001/09/19 12:45:22 UTC
cvs commit: embperl/driver eplibxslt.MAKEPL eplibxslt.c
richter 01/09/19 03:45:22
Modified: . Tag: Embperl2c Embperl.pm Makefile.PL embperl.h
epdat.h epmain.c test.pl
driver Tag: Embperl2c eplibxslt.c
Added: driver Tag: Embperl2c eplibxslt.MAKEPL
Log:
Embperl 2 - XSLT
Revision Changes Path
No revision
No revision
1.118.4.52 +3 -1 embperl/Embperl.pm
Index: Embperl.pm
===================================================================
RCS file: /home/cvs/embperl/Embperl.pm,v
retrieving revision 1.118.4.51
retrieving revision 1.118.4.52
diff -u -r1.118.4.51 -r1.118.4.52
--- Embperl.pm 2001/09/13 07:29:42 1.118.4.51
+++ Embperl.pm 2001/09/19 10:45:21 1.118.4.52
@@ -10,7 +10,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: Embperl.pm,v 1.118.4.51 2001/09/13 07:29:42 richter Exp $
+# $Id: Embperl.pm,v 1.118.4.52 2001/09/19 10:45:21 richter Exp $
#
###################################################################################
@@ -716,6 +716,8 @@
$$req{'cache_key_func'} = $ENV{EMBPERL_CACHE_KEY_FUNC} if (exists ($ENV{EMBPERL_CACHE_KEY_FUNC})) ; ;
$$req{'expires_in'} = $ENV{EMBPERL_EXPIRES_IN} if (exists ($ENV{EMBPERL_EXPIRES_IN})) ; ;
$$req{'syntax'} = $ENV{EMBPERL_SYNTAX} if (exists ($ENV{EMBPERL_SYNTAX})) ; ;
+ $$req{'recipe'} = $ENV{EMBPERL_RECIPE} if (exists ($ENV{EMBPERL_RECIPE})) ; ;
+ $$req{'xsltstylesheet'} = $ENV{EMBPERL_XSLTSTYLESHEET} if (exists ($ENV{EMBPERL_XSLTSTYLESHEET})) ; ;
##/ep2##
1.31.4.23 +38 -1 embperl/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/embperl/Makefile.PL,v
retrieving revision 1.31.4.22
retrieving revision 1.31.4.23
diff -u -r1.31.4.22 -r1.31.4.23
--- Makefile.PL 2001/09/19 07:36:15 1.31.4.22
+++ Makefile.PL 2001/09/19 10:45:21 1.31.4.23
@@ -3,7 +3,7 @@
#
# (C) 1997-2001 G.Richter (richter@dev.ecos.de) / ECOS
#
-# $Id: Makefile.PL,v 1.31.4.22 2001/09/19 07:36:15 richter Exp $
+# $Id: Makefile.PL,v 1.31.4.23 2001/09/19 10:45:21 richter Exp $
#
@@ -1045,6 +1045,43 @@
$d .= ' -DEP2' if ($EP2) ;
$dynlib->{'OTHERLDFLAGS'} .= " $lddebug" ;
+
+#
+# See if we need to link to any other libraries
+#
+
+if ($EP2)
+ {
+ opendir DH, "driver" or die "Cannot open directory driver ($!)" ;
+ my @files = readdir DH ;
+ closedir DH ;
+ my @makefiles = grep (/\.MAKEPL$/, @files) ;
+
+ foreach my $makepl (@makefiles)
+ {
+ print "Exec driver/$makepl\n" ;
+ my $result = do "driver/$makepl" ;
+ if ($@)
+ {
+ print $@ ;
+ next ;
+ }
+ if (ref $result)
+ {
+ #print "cflags = $result->{cflags}\n\n" ;
+ #print "libs = $result->{libs}\n\n" ;
+ #print "inc = $result->{inc}\n\n" ;
+ $libs .= ' ' . $result->{libs} ;
+ $i .= ' ' . $result->{cflags} ;
+ $d .= ' ' . $result->{defines} ;
+ $o .= ' ' . $result->{objects} ;
+ }
+ }
+
+ }
+
+
+
WriteMakefile(
1.19.4.7 +4 -1 embperl/embperl.h
Index: embperl.h
===================================================================
RCS file: /home/cvs/embperl/embperl.h,v
retrieving revision 1.19.4.6
retrieving revision 1.19.4.7
diff -u -r1.19.4.6 -r1.19.4.7
--- embperl.h 2001/09/13 07:29:43 1.19.4.6
+++ embperl.h 2001/09/19 10:45:21 1.19.4.7
@@ -10,7 +10,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: embperl.h,v 1.19.4.6 2001/09/13 07:29:43 richter Exp $
+# $Id: embperl.h,v 1.19.4.7 2001/09/19 10:45:21 richter Exp $
#
###################################################################################*/
@@ -114,6 +114,9 @@
dbgParse = 0x1000000,
dbgObjectSearch = 0x2000000,
dbgCache = 0x4000000,
+ dbgCompile = 0x8000000,
+ dbgXML = 0x10000000,
+ dbgXSLT = 0x20000000,
dbgAll = -1
} ;
1.20.4.23 +3 -1 embperl/epdat.h
Index: epdat.h
===================================================================
RCS file: /home/cvs/embperl/epdat.h,v
retrieving revision 1.20.4.22
retrieving revision 1.20.4.23
diff -u -r1.20.4.22 -r1.20.4.23
--- epdat.h 2001/09/14 11:06:26 1.20.4.22
+++ epdat.h 2001/09/19 10:45:21 1.20.4.23
@@ -10,7 +10,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: epdat.h,v 1.20.4.22 2001/09/14 11:06:26 richter Exp $
+# $Id: epdat.h,v 1.20.4.23 2001/09/19 10:45:21 richter Exp $
#
###################################################################################*/
@@ -156,6 +156,7 @@
typedef struct tConf
{
+ HV * pReqParameter ; /* parameters passed to this request */
int bDebug ; /* Debugging options */
int bOptions ; /* Options */
char * sPackage ; /* Packagename */
@@ -178,6 +179,7 @@
tCacheOptions bCacheKeyOptions ;
double nExpiresIn ; /* Data expiers at */
CV * pExpiresCV ; /* sub that is called to determinate expiration */
+ char * sRecipe ; /* name of recipe used to process the current file */
#endif
char * sPath ; /* file search path */
char * sReqFilename ; /* filename of original request */
1.75.4.42 +47 -4 embperl/epmain.c
Index: epmain.c
===================================================================
RCS file: /home/cvs/embperl/epmain.c,v
retrieving revision 1.75.4.41
retrieving revision 1.75.4.42
diff -u -r1.75.4.41 -r1.75.4.42
--- epmain.c 2001/09/13 07:29:43 1.75.4.41
+++ epmain.c 2001/09/19 10:45:21 1.75.4.42
@@ -10,7 +10,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: epmain.c,v 1.75.4.41 2001/09/13 07:29:43 richter Exp $
+# $Id: epmain.c,v 1.75.4.42 2001/09/19 10:45:21 richter Exp $
#
###################################################################################*/
@@ -1756,9 +1756,10 @@
pConf -> pCloseBracket = "*]" ;
pConf -> sPath = sstrdup (GetHashValueStr (pReqInfo, "path", pCurrReq -> pConf?pCurrReq -> pConf -> sPath:NULL)) ; /* file search path */
pConf -> sReqFilename = sstrdup (GetHashValueStr (pReqInfo, "reqfilename", pCurrReq -> pConf?pCurrReq -> pConf -> sReqFilename:NULL)) ; /* filename of original request */
+ pConf -> pReqParameter = pReqInfo ;
-
#ifdef EP2
+ pConf -> sRecipe = sstrdup (GetHashValueStr (pReqInfo, "recipe", "Embperl")) ; /* Recipe name */
pConf -> bEP1Compat = GetHashValueInt (pReqInfo, "ep1compat", pCurrReq -> pConf?pCurrReq -> pConf -> bEP1Compat:pCurrReq -> bEP1Compat) ; /* EP1Compat */
pConf -> sCacheKey = sstrdup (GetHashValueStr (pReqInfo, "cache_key", pCurrReq -> pConf?pCurrReq -> pConf -> sCacheKey:NULL)) ; ;
@@ -2459,7 +2460,7 @@
lprintf (r, "[%d]REQ: %s %s ", r -> nPid, (r -> bOptions & optSafeNamespace)?"SafeNamespace":"No Safe Eval", (r -> bOptions & optOpcodeMask)?"OpcodeMask":"All Opcode allowed") ;
#ifdef EP2
- lprintf (r, " mode = %s (%d) %s\n", sMode, r -> nIOType, r -> bEP1Compat?"EP 1.x":"EP 2.x") ;
+ lprintf (r, " mode = %s (%d) %s recipe = %s\n", sMode, r -> nIOType, r -> bEP1Compat?"EP 1.x":"EP 2.x", r -> pConf -> sRecipe) ;
#else
lprintf (r, " mode = %s (%d)\n", sMode, r -> nIOType) ;
#endif
@@ -2734,6 +2735,17 @@
SV * pCookie2 = NULL ;
int bError = 0 ;
STRLEN ldummy ;
+
+#ifdef EP2
+ /* ### tmp ### */
+ int bXSLT = 0 ;
+
+ if (strcmp (r -> pConf -> sRecipe + strlen (r -> pConf -> sRecipe) - 4 , "XSLT") == 0)
+ {
+ bXSLT = 1 ;
+ bOutToMem = 1 ;
+ }
+#endif
r -> bEscModeSet = 0 ;
@@ -2998,7 +3010,18 @@
/* --- output the content if not alreay done --- */
if (bOutToMem)
- pOut = SvRV (pOutData) ;
+#ifdef EP2
+ /* ### tmp ### */
+ if (bXSLT)
+ {
+ pOut = newSVpv ("", 0) ;
+ }
+ else
+#endif
+ {
+ pOut = SvRV (pOutData) ;
+ }
+
#ifdef APACHE
if ((r -> pApacheReq == NULL || !r -> pApacheReq -> header_only) &&
@@ -3036,6 +3059,26 @@
pData = SvPVX (pOut) ;
oCommitToMem (r, NULL, pData) ;
SvCUR_set (pOut, l - 1) ;
+#ifdef EP2
+ /* ### tmp ### */
+ if (bXSLT)
+ {
+ if (strstr (r -> pConf -> sRecipe, "LibXSLT"))
+ {
+#ifdef LIBXSLT
+ if (r -> bDebug & dbgXSLT)
+ lprintf (r, "[%d]XSLT: call libxslt\n", r -> nPid) ;
+
+ if ((rc = embperl_LibXSLT_Text2Text (r, r -> pConf -> pReqParameter, pOut)) != ok)
+ return rc ;
+ oCommit (r, NULL) ;
+#else
+ strcpy (r -> errdat1, "libxslt not supported") ;
+ return 9999 ;
+#endif
+ }
+ }
+#endif
}
else
{
1.70.4.74 +14 -2 embperl/test.pl
Index: test.pl
===================================================================
RCS file: /home/cvs/embperl/test.pl,v
retrieving revision 1.70.4.73
retrieving revision 1.70.4.74
diff -u -r1.70.4.73 -r1.70.4.74
--- test.pl 2001/09/19 05:38:29 1.70.4.73
+++ test.pl 2001/09/19 10:45:21 1.70.4.74
@@ -11,7 +11,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test.pl,v 1.70.4.73 2001/09/19 05:38:29 richter Exp $
+# $Id: test.pl,v 1.70.4.74 2001/09/19 10:45:21 richter Exp $
#
###################################################################################
@@ -35,6 +35,9 @@
# param =>
# reqbody =>
# respheader => \%
+# recipe =>
+# xsltstylesheet =>
+# syntax =>
@testdata = (
'ascii' => { },
@@ -703,6 +706,11 @@
# 'version' => 2,
# 'syntax' => 'POD',
# },
+ 'xml/pod.xml' => {
+ 'version' => 2,
+ 'recipe' => 'LibXSLT',
+ 'xsltstylesheet' => 'pod.xsl',
+ },
) ;
for ($i = 0 ; $i < @testdata; $i += 2)
@@ -1464,7 +1472,7 @@
$cp -> deny (':base_loop') ;
$cp -> share ('$testshare') ;
-$ENV{EMBPERL_ALLOW} = 'asc|\\.htm$|\\.htm-1$' ;
+$ENV{EMBPERL_ALLOW} = 'asc|\\.xml$|\\.htm$|\\.htm-1$' ;
#HTML::Embperl::log ("Start testing...\n") ; # force logfile open
@@ -1546,6 +1554,10 @@
$ENV{EMBPERL_OPTIONS} = $test -> {option} if (defined ($test -> {option})) ;
delete $ENV{EMBPERL_SYNTAX} ;
$ENV{EMBPERL_SYNTAX} = $test -> {syntax} if (defined ($test -> {syntax})) ;
+ delete $ENV{EMBPERL_RECIPE} ;
+ $ENV{EMBPERL_RECIPE} = $test -> {recipe} if (defined ($test -> {recipe})) ;
+ delete $ENV{EMBPERL_XSLTSTYLESHEET} ;
+ $ENV{EMBPERL_XSLTSTYLESHEET} = $test -> {xsltstylesheet} if (defined ($test -> {xsltstylesheet})) ;
delete $ENV{EMBPERL_COMPARTMENT} if (defined ($ENV{EMBPERL_COMPARTMENT})) ;
$ENV{EMBPERL_COMPARTMENT} = $test -> {compartment} if (defined ($test -> {compartment})) ;
delete $ENV{EMBPERL_PACKAGE} if (defined (delete $ENV{EMBPERL_PACKAGE})) ;
No revision
No revision
1.1.2.2 +13 -12 embperl/driver/Attic/eplibxslt.c
Index: eplibxslt.c
===================================================================
RCS file: /home/cvs/embperl/driver/Attic/eplibxslt.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- eplibxslt.c 2001/09/19 07:36:15 1.1.2.1
+++ eplibxslt.c 2001/09/19 10:45:22 1.1.2.2
@@ -10,13 +10,13 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: eplibxslt.c,v 1.1.2.1 2001/09/19 07:36:15 richter Exp $
+# $Id: eplibxslt.c,v 1.1.2.2 2001/09/19 10:45:22 richter Exp $
#
###################################################################################*/
-#include "ep.h"
-#include "epmacro.h"
+#include "../ep.h"
+#include "../epmacro.h"
#include <libxml/xmlmemory.h>
#include <libxml/debugXML.h>
@@ -79,9 +79,10 @@
SV * * ppSV ;
char * pKey ;
SV * pValue ;
- STRLEN l ;
+ STRLEN len ;
+ IV l ;
int n ;
- const char * pParamArray ;
+ const char * * pParamArray ;
const char * sStylesheet ;
char * p ;
xmlOutputBufferPtr obuf ;
@@ -91,13 +92,13 @@
{
strncpy (r -> errdat1, "XSLT", sizeof (r -> errdat1)) ;
strncpy (r -> errdat2, "No stylesheet given", sizeof (r -> errdat2)) ;
- return rcError ;
+ return 9999 ;
}
ppSV = hv_fetch (pReqParameter, "xsltparameter", sizeof("xsltparameter") - 1, 0) ;
if (ppSV && *ppSV)
{
- if (!SvROK (*ppSV) || SvTYPE ((pParam = SvRV (*ppSV))) != SVt_PVHV)
+ if (!SvROK (*ppSV) || SvTYPE ((SV *)(pParam = (HV *)SvRV (*ppSV))) != SVt_PVHV)
{
strncpy (r -> errdat1, "XSLT", sizeof (r -> errdat1)) ;
sprintf (r -> errdat2, "%s", pKey) ;
@@ -111,7 +112,7 @@
n++ ;
}
- if (!(pParamArray = _malloc(r, sizeof (const char *) * (n + 1) * 2))
+ if (!(pParamArray = _malloc(r, sizeof (const char *) * (n + 1) * 2)))
return rcOutOfMemory ;
n = 0 ;
@@ -121,7 +122,7 @@
pKey = hv_iterkey (pEntry, &l) ;
pValue = hv_iterval (pParam, pEntry) ;
pParamArray[n++] = pKey ;
- pParamArray[n++] = SvPV (pValue, l) ;
+ pParamArray[n++] = SvPV (pValue, len) ;
}
pParamArray[n++] = NULL ;
}
@@ -132,10 +133,10 @@
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
- cur = xsltParseStylesheetFile(sSytlesheet);
- p = SvPV (pSource, l) ;
+ cur = xsltParseStylesheetFile(sStylesheet);
+ p = SvPV (pSource, len) ;
doc = xmlParseMemory(p, l);
- res = xsltApplyStylesheet(cur, doc, params);
+ res = xsltApplyStylesheet(cur, doc, pParamArray);
obuf = xmlOutputBufferCreateIO (iowrite, NULL, r, NULL) ;
No revision
No revision
1.1.2.1 +53 -0 embperl/driver/Attic/eplibxslt.MAKEPL
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-cvs-help@perl.apache.org