richter 02/01/11 08:01:51
Modified: . Tag: Embperl2c epapinit.c epdat2.h epinit.c
Log:
data structure rewrite
Revision Changes Path
No revision
No revision
1.1.2.7 +54 -1 embperl/epapinit.c
Index: epapinit.c
===================================================================
RCS file: /home/cvs/embperl/epapinit.c,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- epapinit.c 4 Jan 2002 14:03:23 -0000 1.1.2.6
+++ epapinit.c 11 Jan 2002 16:01:51 -0000 1.1.2.7
@@ -10,7 +10,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: epapinit.c,v 1.1.2.6 2002/01/04 14:03:23 richter Exp $
+# $Id: epapinit.c,v 1.1.2.7 2002/01/11 16:01:51 richter Exp $
#
###################################################################################*/
@@ -54,6 +54,19 @@
};
+
+typedef struct tApacheConfig
+ {
+ tAppConfig AppConfig ;
+ tReqConfig ReqConfig ;
+ tComponentConfig ComponentConfig ;
+ } tApacheConfig ;
+
+
+
+
+
+
void embperl_ApacheAddModule ()
{
@@ -96,5 +109,45 @@
return cfg;
}
+
+
+
+CHAR_P perl_cmd_env (cmd_parms *cmd, perl_dir_config *rec, int arg) {
+ if(arg) MP_ENV_on(rec);
+ else MP_ENV_off(rec);
+ MP_TRACE_d(fprintf(stderr, "perl_cmd_env: set to `%s'\n", arg ? "On" : "Off"));
+ return NULL;
+}
+
+
+
+
+embperl_GetApacheConfig (/*in*/ request_rec * r,
+ /*out*/ tAppConfig ** ppAppConfig,
+ /*out*/ tReqConfig ** ppReqConfig,
+ /*out*/ tComponentConfig ** ppComponetConfig)
+
+
+ {
+ request_rec * ar = r -> pApacheReq ;
+
+ if(r->per_dir_config)
+ {
+ pDirCfg = (tApacheDirConfig *) get_module_config(r->per_dir_config,
&embperl_module);
+ *ppReqCfg = &pDirCfg -> ReqConfig ;
+ *ppAppCfg = &pDirCfg -> AppConfig ;
+ *ppComponentCfg = &pDirCfg -> ComponentConfig ;
+ }
+ else
+ {
+ *ppReqCfg = (tReqConfig *) ap_pcalloc(p, sizeof(tReqConfig));
+ embperl_DefaultReqConfig (*ppReqCfg) ;
+ *ppAppCfg = (tAppConfig *) ap_pcalloc(p, sizeof(tAppConfig));
+ embperl_DefaultAppConfig (*ppAppCfg) ;
+ *ppComponentCfg = (tComponentConfig *) ap_pcalloc(p,
sizeof(tComponentConfig));
+ embperl_DefaultComponentConfig (*ppComponentCfg) ;
+ }
+
+ }
#endif
1.1.2.3 +1 -0 embperl/Attic/epdat2.h
Index: epdat2.h
===================================================================
RCS file: /home/cvs/embperl/Attic/epdat2.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- epdat2.h 9 Jan 2002 15:26:21 -0000 1.1.2.2
+++ epdat2.h 11 Jan 2002 16:01:51 -0000 1.1.2.3
@@ -1,5 +1,6 @@
typedef struct tComponentConfig
+
{
char * sPackage ;
unsigned bDebug ;
1.1.2.3 +181 -22 embperl/Attic/epinit.c
Index: epinit.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epinit.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- epinit.c 9 Jan 2002 15:26:21 -0000 1.1.2.2
+++ epinit.c 11 Jan 2002 16:01:51 -0000 1.1.2.3
@@ -51,7 +51,8 @@
-tApp * embperl_SetupThread (/*in*/ pTHX)
+int embperl_SetupThread (/*in*/ pTHX,
+ /*out*/tThreadData * * ppThread)
{
@@ -102,11 +103,39 @@
}
- return pThread ;
+ *ppThread = pThread ;
+ return ok ;
}
+/*---------------------------------------------------------------------------
+* embperl_DefaultAppConfig
+*/
+/*!
+*
+* \_en
+* initialze AppConfig defaults
+* \endif
+*
+* \_de
+* Initialisiert AppConfig Defaults
+* \endif
+*
+* ------------------------------------------------------------------------ */
+
+
+void embperl_DefaultAppConfig (/*in*/ tAppConfig *pCfg)
+
+ {
+ memset (pCfg, 0, sizeof (*pCfg)) ;
+
+ pCfg -> sAppName = "Embperl" ;
+ pCfg -> sCookieName = "EMBPERL_UID" ;
+ pCfg -> sLog = "/tmp/embperl.log" ;
+ }
+
+
/*---------------------------------------------------------------------------
* embperl_SetupApp
@@ -134,9 +163,11 @@
-tApp * embperl_SetupApp (/*in*/ pTHX_
+int embperl_SetupApp (/*in*/ pTHX_
/*in*/ tThreadData * pThread,
- /*in*/ tAppConfig * pAppCfg)
+ /*in*/ tAppConfig * pAppCfg,
+ /*in*/ SV * pPerlParam,
+ /*out*/tApp * * ppApp)
{
@@ -144,10 +175,9 @@
if (!pApp)
{
- HV * pAppHV = newHV () ;
- sv_magic ((SV *)pAppHV, NULL, '~', (char *)&pApp, sizeof (pApp)) ;
- pApp -> pAppSV = newRV_noinc ((SV *)pAppHV) ;
- sv_bless (pApp -> pAppSV, gv_stashpv (EMBPERL_APP_PACKAGE, 0)) ;
+ SV * pAppSV ;
+ pApp = HTML__Embperl__App__new_alloc (&pAppSV) ;
+ pApp -> pAppSV = pAppSV ;
memcpy (&pApp -> AppConfig, pAppCfg, sizeof (pApp -> AppConfig)) ;
@@ -179,12 +209,39 @@
}
*/
-
+ HTML__Embperl__App__new_init (pApp, pPerlParam) ;
}
- return pApp ;
+ *ppApp = pApp ;
+
+ return ok ;
+ }
+
+/*---------------------------------------------------------------------------
+* embperl_DefaultReqConfig
+*/
+/*!
+*
+* \_en
+* initialze ReqConfig defaults
+* \endif
+*
+* \_de
+* Initialisiert ReqConfig Defaults
+* \endif
+*
+* ------------------------------------------------------------------------ */
+
+
+void embperl_DefaultReqConfig (/*in*/ tReqConfig *pCfg)
+
+ {
+ memset (pCfg, 0, sizeof (*pCfg)) ;
+
+ pCfg -> cMultFieldSep = "\t" ;
}
+
/*---------------------------------------------------------------------------
* embperl_GetFormData
*/
@@ -201,8 +258,8 @@
* ------------------------------------------------------------------------ */
static int embperl_GetFormData (/*i/o*/ register req * r,
- /*in*/ char * pQueryString,
- /*in*/ int nLen)
+ /*in*/ char * pQueryString,
+ /*in*/ int nLen)
{
int num ;
@@ -449,8 +506,10 @@
int embperl_SetupRequest (/*in*/ pTHX_
/*in*/ SV * pApacheReqSV,
- /*in*/ tReqConfig * pReqCfg,
/*in*/ tApp * pApp,
+ /*in*/ tReqConfig * pReqCfg,
+ /*in*/ tReqParam * pReqParam,
+ /*in*/ SV * pPerlParam,
/*out*/tReq * * ppReq)
@@ -459,12 +518,14 @@
tReq * r ;
HV * pReqHV ;
tThreadData * pThread ;
+ SV * pReqSV ;
#ifdef APACHE
request_rec * pApacheReq = r -> pApacheReq ;
#endif
- r = malloc (sizeof (*r)) ;
+ r = HTML__Embperl__Req_new_alloc (&pReqSV) ;
+ r -> pReqSV = pReqSV ;
r -> startclock = clock () ;
r -> stsv_count = sv_count ;
@@ -539,6 +600,7 @@
r -> nLogFileStartPos = GetLogFilePos (pApp) ;
+ HTML__Embperl__Req_new_init (r, pPerlParam) ;
hv_clear (pThread -> pHeaderHash) ;
@@ -549,6 +611,48 @@
return ok ;
}
+
+/*---------------------------------------------------------------------------
+* embperl_DefaultComponentConfig
+*/
+/*!
+*
+* \_en
+* initialze ComponentConfig defaults
+* \endif
+*
+* \_de
+* Initialisiert ComponentConfig Defaults
+* \endif
+*
+* ------------------------------------------------------------------------ */
+
+
+void embperl_DefaultComponentConfig (/*in*/ tComponentConfig *pCfg)
+
+ {
+ memset (pCfg, 0, sizeof (*pCfg)) ;
+
+
+ pCfg -> sPackage ;
+ pCfg -> bDebug = dbgStd ;
+ pCfg -> bOptions = optRawInput | optAllFormFields ;
+ pCfg -> nEscmode = escStd ;
+ pCfg -> bCacheKeyOptions = ckoptDefault ;
+ pCfg -> sSyntax = "Embperl" ;
+ pCfg -> sRecipe = "Embperl" ;
+#ifdef LIBXSLT
+ pCfg -> sXsltproc = "libxslt" ;
+#else
+#ifdef XALAN
+ pCfg -> sXsltproc = "xalan" ;
+#endif
+#endif
+ }
+
+
+
+
/*---------------------------------------------------------------------------
* embperl_SetupComponent
*/
@@ -569,10 +673,16 @@
int embperl_SetupComponent (/*in*/ tReq * r,
/*in*/ tComponentConfig * pComponentCfg,
/*in*/ tComponentParam * pComponentParam,
+ /*in*/ SV * pPerlParam,
/*out*/tComponent * * ppComponent)
{
+ SV * pComponentSV ;
+ tComponent * c = HTML__Embperl__Component_new_alloc (&pComponentSV) ;
+ c -> pComponentSV = pComponentSV ;
+
+
tComponent * c = _malloc (r, sizeof (*c)) ;
memset (c, 0, sizeof (*c)) ;
@@ -627,6 +737,8 @@
c -> bStrict = FALSE ;
+ HTML__Embperl__Component_new_init (c, pPerlParam) ;
+
*ppComponent = c ;
return ok ;
@@ -724,30 +836,55 @@
-void embperl_InitRequest (/*in*/ pTHX_
+int embperl_InitRequest (/*in*/ pTHX_
/*in*/ SV * pApacheReqSV,
- /*in*/ tReqConfig * pReqCfg,
- /*in*/ tApp * pApp,
+ /*in*/ SV * pPerlParam,
/*out*/tReq * * ppReq)
{
- tThreadData * pThread ;
- tApp * pApp ;
- tReq * r ;
+ tThreadData * pThread ;
+ tApp * pApp ;
+ tReq * r ;
+ tAppConfig * pAppCfg,
+ tReqConfig * pReqCfg,
+
+
+
+
+#ifdef APACHE
+ if (pApacheReqSV && SvROK (pApacheReqSV))
+ {
+ tComponentConfig * pComponentCfg ;
+ request_rec * ap_r = (request_rec *)SvIV((SV*)SvRV(pApacheReqSV));
+
+ embperl_GetApacheConfig (ap_r, &pAppCfg, &pReqCfg, &pComponentCfg) ;
+ }
+ else
+#endif
+ {
+ tAppConfig AppCfg ;
+ tReqConfig ReqCfg ;
+
+ embperl_DefaultReqConfig (&ReqCfg) ;
+ embperl_DefaultAppConfig (&AppCfg) ;
+ pReqCfg = &ReqCfg ;
+ pAppCfg = &AppCfg ;
+ }
+
/* get our thread object */
if ((rc = embperl_SetupThread (aTHX_ &pThread)) != ok)
return rc ;
/* get the application object */
- if ((rc = embperl_SetupApp (aTHX_ pThread, pAppCfg, pHVParam, &pApp)) != ok)
+ if ((rc = embperl_SetupApp (aTHX_ pThread, pAppCfg, pPerlParam, &pApp)) != ok)
return rc ;
/* and setup the request object */
- if ((rc = embperl_SetupRequest (aTHX_ pSVApache, pApp, pReqCfg, &r)) != ok)
+ if ((rc = embperl_SetupRequest (aTHX_ pSVApache, pApp, pReqCfg, pReqParam,
pPerlParam, &r)) != ok)
return rc ;
@@ -755,3 +892,25 @@
embperl_LogStartRequest (r) ;
}
+
+
+
+
+
+int embperl_InitRequestApache (/*in*/ pTHX_
+ /*in*/ SV * pApacheReqSV,
+ /*in*/ tReqConfig * pAppCfg,
+ /*in*/ tReqConfig * pReqCfg,
+ /*in*/ tReqConfig * pReqParam,
+ /*in*/ SV * pPerlParam,
+ /*in*/ tApp * pApp,
+ /*out*/tReq * * ppReq)
+
+
+ {
+
+
+
+
+ }
+
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]