richter     02/01/18 00:28:12

  Modified:    .        Tag: Embperl2c Makefile.PL epapinit.c epdat2.h
                        epinit.c epmacro.h epmain.c eppriv.h
  Added:       .        Tag: Embperl2c epcgiinit.c epmem.c
  Log:
  new memory management
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.31.4.39 +2 -2      embperl/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/embperl/Makefile.PL,v
  retrieving revision 1.31.4.38
  retrieving revision 1.31.4.39
  diff -u -r1.31.4.38 -r1.31.4.39
  --- Makefile.PL       17 Jan 2002 23:16:17 -0000      1.31.4.38
  +++ Makefile.PL       18 Jan 2002 08:28:11 -0000      1.31.4.39
  @@ -3,7 +3,7 @@
   #
   # (C) 1997-2001 G.Richter ([EMAIL PROTECTED]) / ECOS
   #
  -# $Id: Makefile.PL,v 1.31.4.38 2002/01/17 23:16:17 richter Exp $
  +# $Id: Makefile.PL,v 1.31.4.39 2002/01/18 08:28:11 richter Exp $
   #
   
   
  @@ -1146,7 +1146,7 @@
       'NAME'      => 'Embperl',
       'VERSION_FROM' => 'Embperl.pm',          # finds $VERSION
       'OBJECT'       => 'Embperl$(OBJ_EXT) epmain$(OBJ_EXT) epio$(OBJ_EXT) 
epchar$(OBJ_EXT) eputil$(OBJ_EXT) epeval$(OBJ_EXT) epapinit$(OBJ_EXT) ' . 
  -                       ($EP2?'epinit$(OBJ_EXT) epcmd2$(OBJ_EXT) epparse$(OBJ_EXT) 
epdom$(OBJ_EXT) epcomp$(OBJ_EXT) epcache$(OBJ_EXT) 
epprovider$(OBJ_EXT)':'epcmd$(OBJ_EXT) ') . $o,
  +                       ($EP2?'epmem$(OBJ_EXT) epinit$(OBJ_EXT) epcgiinit$(OBJ_EXT) 
epcmd2$(OBJ_EXT) epparse$(OBJ_EXT) epdom$(OBJ_EXT) epcomp$(OBJ_EXT) epcache$(OBJ_EXT) 
epprovider$(OBJ_EXT)':'epcmd$(OBJ_EXT) ') . $o,
       'LIBS'      => [$libs || ''],                     
       'DEFINE'    => "$d \$(DEFS)",                     
       'INC'       => $i,                        
  
  
  
  1.1.2.9   +2 -2      embperl/epapinit.c
  
  Index: epapinit.c
  ===================================================================
  RCS file: /home/cvs/embperl/epapinit.c,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- epapinit.c        14 Jan 2002 09:12:42 -0000      1.1.2.8
  +++ epapinit.c        18 Jan 2002 08:28:11 -0000      1.1.2.9
  @@ -1,6 +1,6 @@
   
/*###################################################################################
   #
  -#   Embperl - Copyright (c) 1997-2001 Gerald Richter / ECOS
  +#   Embperl - Copyright (c) 1997-2002 Gerald Richter / ecos gmbh   www.ecos.de
   #
   #   You may distribute under the terms of either the GNU General Public
   #   License or the Artistic License, as specified in the Perl README file.
  @@ -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.8 2002/01/14 09:12:42 richter Exp $
  +#   $Id: epapinit.c,v 1.1.2.9 2002/01/18 08:28:11 richter Exp $
   #
   
###################################################################################*/
   
  
  
  
  1.1.2.10  +9 -1      embperl/Attic/epdat2.h
  
  Index: epdat2.h
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epdat2.h,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- epdat2.h  17 Jan 2002 23:16:17 -0000      1.1.2.9
  +++ epdat2.h  18 Jan 2002 08:28:12 -0000      1.1.2.10
  @@ -10,7 +10,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: epdat2.h,v 1.1.2.9 2002/01/17 23:16:17 richter Exp $
  +#   $Id: epdat2.h,v 1.1.2.10 2002/01/18 08:28:12 richter Exp $
   #
   
###################################################################################*/
   
  @@ -114,6 +114,7 @@
       {
       SV *    _perlsv ;         /**< The perl reference to this structure */
       tPerlInterpreter * pPerlTHX ;                  /* pointer to Perl interpreter */
  +    tMemPool *         pPool ;  /**< pool for memorymanagement */
       HV *    pApplications ;     /**< Hash with available applications */
       struct tReq *  pCurrReq ;          /**< Current running request if any */
       pid_t   nPid ;              /**< process/thread id */
  @@ -134,6 +135,7 @@
       {
       SV *            _perlsv ;         /**< The perl reference to this structure */
       tPerlInterpreter * pPerlTHX ;                  /* pointer to Perl interpreter */
  +    tMemPool *         pPool ;  /**< pool for memorymanagement */
       tThreadData *   pThread ;
       struct tReq *          pCurrReq ;      /**< Current running request if any */
       tAppConfig      Config ;        /**< application configuration data */
  @@ -151,6 +153,7 @@
   typedef struct tComponent
       {
       SV *    _perlsv ;         /**< The perl reference to this structure */
  +    tMemPool *         pPool ;  /**< pool for memorymanagement */
   
       tComponentConfig    Config ;    /**< request configuration data */
       tComponentParam     Param ;     /**< parameter passed to current request */
  @@ -161,6 +164,9 @@
       int          bExit ;             /* We should exit the page */
       int          nPathNdx ;          /* gives the index in the path where the 
current file is found */
       char    sCWD[PATH_MAX] ;    /**< Current working directory */
  +#ifdef WIN32
  +    char    nCWDDrive ;         /**< Current drive */
  +#endif
       char    sResetDir[PATH_MAX] ; /**< Reset directory to */
   #ifdef WIN32
       char    nResetDrive ;       /**< Reset drive to */
  @@ -229,6 +235,7 @@
       /* ------------------------ */
   
       struct tComponent *  pPrev ;  /* Component from which this one is called */
  +    struct tComponent *  pOrg  ;  /* Original Component from which it is copied 
into the tReq object */
   
       /* ------------------------ */
       
  @@ -267,6 +274,7 @@
       SV *    _perlsv ;         /**< The perl reference to this structure */
   
       tPerlInterpreter * pPerlTHX ;                  /* pointer to Perl interpreter */
  +    tMemPool *         pPool ;  /**< pool for memorymanagement */
   
       request_rec * pApacheReq ;       /* apache request record */
       SV *          pApacheReqSV ;
  
  
  
  1.1.2.8   +197 -46   embperl/Attic/epinit.c
  
  Index: epinit.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epinit.c,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- epinit.c  17 Jan 2002 23:16:17 -0000      1.1.2.7
  +++ epinit.c  18 Jan 2002 08:28:12 -0000      1.1.2.8
  @@ -10,7 +10,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: epinit.c,v 1.1.2.7 2002/01/17 23:16:17 richter Exp $
  +#   $Id: epinit.c,v 1.1.2.8 2002/01/18 08:28:12 richter Exp $
   #
   
###################################################################################*/
   
  @@ -33,6 +33,7 @@
   #define EMBPERL_PACKAGE         Embperl
   #define EMBPERL_PACKAGE_STR     "Embperl"
   
  +#define OPTPREFIX               EMBPERL_PACKAGE_STR
   
   #define EMBPERL_APP_PACKAGE     EMBPERL_PACKAGE_STR"::Application"
   #define EMBPERL_REQ_PACKAGE     EMBPERL_PACKAGE_STR"::Req"
  @@ -45,6 +46,9 @@
   #define EMBPERL_IDAT_NAME       EMBPERL_PACKAGE_STR"::idat"
   #define EMBPERL_ENV_NAME        "ENV"
   
  +#define EMBPERL_EscMode_NAME    EMBPERL_PACKAGE_STR"::escmode"
  +#define EMBPERL_CurrNode_NAME    EMBPERL_PACKAGE_STR"::_ep_node"
  +
   
   static char sUserHashName  [] = "HTML::Embperl::udat" ;
   static char sStateHashName [] = "HTML::Embperl::sdat" ;
  @@ -53,6 +57,10 @@
   #define EMBPERL_CREATE(c) epxs_##EMBPERL_PACKAGE##__##c##_create_obj
   #define EMBPERL_INIT(c)   EMBPERL_PACKAGE##__##c##_new_init
   
  +static int  bInitDone = 0 ; /* c part is already initialized */
  +static int  nRequestCount = 1 ;
  +static tMemPool * pMainPool ;
  +
   
   /*---------------------------------------------------------------------------
   * embperl_SetupThread
  @@ -80,6 +88,8 @@
   
       {
       tThreadData * pThread ;
  +    SV * *        ppSV ;
  +
   #ifdef SINGLETHREAD
       pThread = &embperl_ThreadData ;
   #else
  @@ -87,12 +97,12 @@
       if (*ppSV == NULL)
           {
           *ppSV = newSV(sizeof (*pThread)) ;
  -        pThread = SvPVX (*ppSV) ;
  +        pThread = (tThreadData * )SvPVX (*ppSV) ;
           memset (pThread, 0, sizeof (*pThread)) ;
           }
       else
           {
  -        pThread = SvPVX (*ppSV) ;
  +        pThread = (tThreadData * )SvPVX (*ppSV) ;
           }
       pThread -> pPerlTHX = aTHX ;
   #endif
  @@ -101,11 +111,13 @@
           {
           SV * pThreadRV ;
           SV * pThreadSV ;
  +        tMemPool * pPool = ep_make_sub_pool (pMainPool) ;
   
           EMBPERL_CREATE(ThreadData)(pThread,pThreadSV,pThreadRV) ;
   #ifdef PERL_IMPLICIT_CONTEXT
           pThread -> pPerlTHX = aTHX ;
   #endif
  +        pThread -> pPool         = pPool ;
           pThread -> nPid          = getpid () ; 
           pThread -> pApplications = newHV () ;
           pThread -> pFormHash     = perl_get_hv (EMBPERL_FDAT_NAME, TRUE) ;
  @@ -148,6 +160,7 @@
   
       if ((rc = embperl_SetupThread (aTHX_ &pThread)) != ok)
           {
  +        LogError (NULL, rc) ;
           return NULL ;
           }
   
  @@ -225,10 +238,13 @@
           SV * pAppSV ;
           SV * pAppRV ;
           
  +        tMemPool * pPool = ep_make_sub_pool (pThread -> pPool) ;
  +
           EMBPERL_CREATE(App)(pApp,pAppSV,pAppRV) ;
   #ifdef PERL_IMPLICIT_CONTEXT
           pApp -> pPerlTHX = aTHX ;
   #endif
  +        pApp -> pPool         = pPool ;
   
           memcpy (&pApp -> Config, pAppCfg, sizeof (pApp -> Config)) ;
   
  @@ -236,7 +252,7 @@
   
           if (pApp -> Config.sLog && pApp -> Config.sLog[0])
               {
  -            if ((rc = OpenLog (pApp, pApp -> Config.sLog, 2)) != ok)
  +            if ((rc = OpenLog (pApp)) != ok)
                { 
                LogError (NULL, rc) ;
                }
  @@ -269,6 +285,146 @@
       }
   
   
  +
  +static int notused ;
  +
  +#if 0
  +INTMG (TabCount, pCurrReq -> TableStack.State.nCount, pCurrReq -> 
TableStack.State.nCountUsed, ;) 
  +INTMG (TabRow, pCurrReq -> TableStack.State.nRow, pCurrReq -> 
TableStack.State.nRowUsed, ;) 
  +INTMG (TabCol, pCurrReq -> TableStack.State.nCol, pCurrReq -> 
TableStack.State.nColUsed, ;) 
  +INTMG (TabMaxRow, pCurrReq -> nTabMaxRow, notused,  ;) 
  +INTMG (TabMaxCol, pCurrReq -> nTabMaxCol, notused, ;) 
  +INTMG (TabMode, pCurrReq -> nTabMode, notused, ;) 
  +#endif
  +INTMG (EscMode, CurrComponent -> Config.nEscMode, notused, NewEscMode (CurrReq, 
pSV)) 
  +#ifdef EP2
  +INTMGshort (CurrNode, CurrComponent -> xCurrNode) 
  +#endif
  +
  +OPTMGRD (optDisableVarCleanup      , CurrComponent -> Config.bOptions) 
  +OPTMG   (optDisableEmbperlErrorPage, CurrComponent -> Config.bOptions) 
  +OPTMG   (optReturnError            , CurrComponent -> Config.bOptions) 
  +OPTMGRD (optSafeNamespace          , CurrComponent -> Config.bOptions) 
  +OPTMGRD (optOpcodeMask             , CurrComponent -> Config.bOptions) 
  +OPTMG   (optRawInput               , CurrComponent -> Config.bOptions) 
  +OPTMG   (optSendHttpHeader         , CurrComponent -> Config.bOptions) 
  +OPTMGRD (optDisableChdir           , CurrComponent -> Config.bOptions) 
  +OPTMG   (optDisableHtmlScan        , CurrComponent -> Config.bOptions) 
  +OPTMGRD (optEarlyHttpHeader        , CurrComponent -> Config.bOptions) 
  +OPTMGRD (optDisableFormData        , CurrComponent -> Config.bOptions) 
  +OPTMG   (optDisableInputScan       , CurrComponent -> Config.bOptions) 
  +OPTMG   (optDisableTableScan       , CurrComponent -> Config.bOptions) 
  +OPTMG   (optDisableMetaScan        , CurrComponent -> Config.bOptions) 
  +OPTMGRD (optAllFormData            , CurrComponent -> Config.bOptions) 
  +OPTMGRD (optRedirectStdout         , CurrComponent -> Config.bOptions) 
  +OPTMG   (optUndefToEmptyValue      , CurrComponent -> Config.bOptions) 
  +OPTMG   (optNoHiddenEmptyValue     , CurrComponent -> Config.bOptions) 
  +OPTMGRD (optAllowZeroFilesize      , CurrComponent -> Config.bOptions) 
  +OPTMGRD (optKeepSrcInMemory        , CurrComponent -> Config.bOptions) 
  +OPTMG   (optKeepSpaces             , CurrComponent -> Config.bOptions) 
  +OPTMG   (optOpenLogEarly           , CurrComponent -> Config.bOptions) 
  +OPTMG   (optNoUncloseWarn          , CurrComponent -> Config.bOptions) 
  +
  +
  +OPTMG   (dbgStd          , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgMem          , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgEval         , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgCmd          , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgEnv          , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgForm         , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgTab          , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgInput        , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgFlushOutput  , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgFlushLog     , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgAllCmds      , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgSource       , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgFunc         , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgLogLink      , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgDefEval      , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgHeadersIn    , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgShowCleanup  , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgProfile      , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgSession      , CurrComponent -> Config.bDebug) 
  +OPTMG   (dbgImport       , CurrComponent -> Config.bDebug) 
  +
  +
  +    
  +/* ---------------------------------------------------------------------------- */
  +/* add magic to integer var */
  +/* */
  +/* in  sVarName = Name of varibale */
  +/* in  pVirtTab = pointer to virtual table */
  +/* */
  +/* ---------------------------------------------------------------------------- */
  +
  +static int AddMagic (/*i/o*/ tApp * a,
  +                  /*in*/ char *     sVarName,
  +                     /*in*/ MGVTBL *   pVirtTab) 
  +
  +    {
  +    SV * pSV ;
  +    struct magic * pMagic ;
  +    epaTHX ;
  +
  +    EPENTRY (AddMagic) ;
  +
  +    
  +    pSV = perl_get_sv (sVarName, TRUE) ;
  +    sv_magic (pSV, NULL, 0, sVarName, strlen (sVarName)) ;
  +    sv_setiv (pSV, 0) ;
  +    pMagic = mg_find (pSV, 0) ;
  +
  +    if (pMagic)
  +        pMagic -> mg_virtual = pVirtTab ;
  +    else
  +        {
  +        LogError (NULL, rcMagicError) ;
  +        return 1 ;
  +        }
  +
  +
  +    return ok ;
  +    }
  +
  +    
  +/* ---------------------------------------------------------------------------- */
  +/* add magic to array                                                               
 */
  +/*                                                                           */
  +/* in  sVarName = Name of varibale                                           */
  +/* in  pVirtTab = pointer to virtual table                                   */
  +/*                                                                           */
  +/* ---------------------------------------------------------------------------- */
  +
  +int AddMagicAV (/*i/o*/ register req * r,
  +             /*in*/ char *     sVarName,
  +                /*in*/ MGVTBL *   pVirtTab) 
  +
  +    {
  +    SV * pSV ;
  +    struct magic * pMagic ;
  +    epTHX ;
  +
  +    EPENTRY (AddMagicAV) ;
  +
  +    
  +    pSV = (SV *)perl_get_av (sVarName, TRUE) ;
  +    sv_magic (pSV, NULL, 'P', sVarName, strlen (sVarName)) ;
  +    pMagic = mg_find (pSV, 0) ;
  +
  +    if (pMagic)
  +        pMagic -> mg_virtual = pVirtTab ;
  +    else
  +        {
  +        LogError (r, rcMagicError) ;
  +        return 1 ;
  +        }
  +
  +
  +    return ok ;
  +    }
  +
  +
  +
   /* ---------------------------------------------------------------------------- */
   /* init embperl module */
   /* */
  @@ -286,6 +442,10 @@
       tApp        * pApp ;
       tAppConfig    AppCfg ;
   
  +
  +    if (!pMainPool)
  +        pMainPool = ep_init_alloc() ;
  +    
       if (pAppCfg == NULL)
           {
           embperl_DefaultAppConfig (&AppCfg) ;
  @@ -293,10 +453,10 @@
           }
   
   
  -    if ((rc = embperl_SetupThread (aTHX_ &pThread) != ok)
  +    if ((rc = embperl_SetupThread (aTHX_ &pThread)) != ok)
           return rc ;
       
  -    if ((rc = embperl_SetupApp (pThread, pAppCfg, pPerlParam, &pApp) != ok)
  +    if ((rc = embperl_SetupApp (aTHX_ pThread, pAppCfg, pPerlParam, &pApp)) != ok)
           return rc ;
         
   
  @@ -308,25 +468,15 @@
        }
   #endif
   
  -    if ((rc = OpenLog (r, sLogFile, ((r -> Component.Config.bDebug & dbgFunc) || (r 
-> Component.Config.bOptions & optOpenLogEarly))?1:0)) != ok)
  +    if ((rc = OpenLog (pApp)) != ok)
           { 
  -        r -> Component.Config.bDebug = 0 ; /* Turn debbuging off, only errors will 
go to stderr */
  -        LogError (r, rc) ;
  +        pApp -> Config.bDebug = 0 ; /* Turn debbuging off, only errors will go to 
stderr */
  +        LogError (NULL, rc) ;
           }
   
   
  -#if 0
  -    ADDINTMG (TabCount) 
  -    ADDINTMG (TabRow) 
  -    ADDINTMG (TabCol) 
  -    ADDINTMG (TabMaxRow) 
  -    ADDINTMG (TabMaxCol) 
  -    ADDINTMG (TabMode) 
  -#endif
       ADDINTMG (EscMode) 
  -#ifdef EP2
       ADDINTMG (CurrNode) 
  -#endif    
       
       ADDOPTMG (optDisableVarCleanup      ) 
       ADDOPTMG (optDisableEmbperlErrorPage) 
  @@ -374,13 +524,12 @@
       ADDOPTMG   (dbgImport      ) 
      
       if (bInitDone)
  -        return ok ; /* the rest was alreay done */
  +        return ok ; /* the rest needs to be done only once per process */
   
   #if defined (_DEBUG) && defined (WIN32)
       _CrtSetReportHook( EmbperlCRTDebugOutput );
   #endif
   
  -#ifdef EP2
       DomInit (pApp) ;
       Cache_Init (pApp) ;
       Provider_Init (pApp) ;
  @@ -391,8 +540,6 @@
       embperl_LibXSLT_Init () ;
   #endif
   
  -#endif    
  -    
       bInitDone = 1 ;
   
       return rc ;
  @@ -461,11 +608,12 @@
       HV *    pInputHash      = r -> pThread -> pInputHash ;
       bool    bAll            = r -> Component.Config.bOptions & optAllFormData ;
       bool    bDebug          = r -> Component.Config.bDebug & dbgForm ;
  +    epTHX ;
   
       hv_clear (pFormHash) ;
       hv_clear (pFormSplitHash) ;
       av_clear (pFormArray) ;
  -    av_clear (pInputHash) ;
  +    hv_clear (pInputHash) ;
   
       if (nLen == 0)
           return ok ;
  @@ -513,7 +661,7 @@
                   break ;
               case '=':
                   nKey = p - pKey ;
  -                *p++ = r -> Component.Config.cMultFieldSep ;
  +                *p++ = r -> Config.cMultFieldSep ;
                   nVal = 0 ;
                   pVal = p ;
                   pQueryString++ ;
  @@ -544,7 +692,7 @@
                       
                        if ((ppSV = hv_fetch (pFormHash, pKey, nKey, 0)))
                            { /* Field exists already -> append separator and field 
value */
  -                         sv_catpvn (*ppSV, r -> Component.Config.cMultFieldSep , 1) 
;
  +                         sv_catpvn (*ppSV, &r -> Config.cMultFieldSep , 1) ;
                            sv_catpvn (*ppSV, pVal, nVal) ;
                            }
                        else
  @@ -612,7 +760,7 @@
       int     rc = ok ;
       STRLEN  len   = 0 ;
       char    sLen [20] ;
  -    
  +    epTHX ;    
   
       /* print out of env set tainted, so reset it now */
       tainted = 0 ;
  @@ -633,7 +781,7 @@
   
       if (len == 0)
           {
  -        p = r -> Param.sQueryString ;
  +        p = r -> Param.sQueryInfo ;
           len = strlen (p) ;
           f = NULL ;
           }
  @@ -710,6 +858,7 @@
   #ifdef PERL_IMPLICIT_CONTEXT
       r -> pPerlTHX = aTHX ;
   #endif
  +    r -> pPool         = pPool ;
   
       r -> startclock      = clock () ;
       r -> stsv_count      = sv_count ;
  @@ -782,7 +931,7 @@
   
       embperl_SetupFormData (r) ;
   
  -    ppReq = r ;
  +    *ppReq = r ;
       
       return ok ;
       }
  @@ -812,8 +961,8 @@
   
       pCfg -> sPackage ;
       pCfg -> bDebug = dbgStd ;
  -    pCfg -> bOptions = optRawInput | optAllFormFields ;
  -    pCfg -> nEscmode = escStd ;
  +    pCfg -> bOptions = optRawInput | optAllFormData ;
  +    pCfg -> nEscMode = escStd ;
       pCfg -> bCacheKeyOptions = ckoptDefault ;
       pCfg -> sSyntax = "Embperl" ;
       pCfg -> sRecipe = "Embperl" ;
  @@ -854,18 +1003,20 @@
                        
                        
       {
  +    int          rc ;
       SV *         pComponentSV ;
       SV *         pComponentRV ;
  +    tComponent * c ;
  +    epTHX ;
   
       EMBPERL_CREATE(Component)(c,pComponentSV, pComponentRV) ;
  -#ifdef PERL_IMPLICIT_CONTEXT
  -    c -> pPerlTHX = aTHX ;
  -#endif
   
   
  -    c -> pPrev      = r -> pComponent ;
  -    r -> pComponent = c ;
  -
  +    /* for performance reason we copy the actual component directly into the 
request object */
  +    c -> pPrev      = r -> Component.pOrg ;
  +    memcpy (c -> pPrev, &r -> Component, sizeof (*c -> pPrev)) ;
  +    c -> pOrg = c ;
  +    memcpy (&r -> Component, c, sizeof (r -> Component)) ;
   
       memcpy (&c -> Config, pComponentCfg,   sizeof (c -> Config)) ;
       memcpy (&c -> Param,  pParam, sizeof (c -> Param)) ;
  @@ -873,7 +1024,7 @@
       
       getcwd (c->sCWD, sizeof (c->sCWD)-1) ;
   #ifdef WIN32
  -    c -> nCWDrive = _getdrive () ;
  +    c -> nCWDDrive = _getdrive () ;
   #endif
   
       if ((rc = embperl_GetSyntax (c -> Config.sSyntax, r -> Component.pTokenTable)) 
!= ok)
  @@ -901,7 +1052,7 @@
            }
        }
   
  -    c -> nSourceline = c -> Config.nFirstLine ;
  +    c -> nSourceline = c -> Param.nFirstLine ;
   
       HTML__Embperl__Component_new_init (c, pPerlParam) ;
   
  @@ -931,11 +1082,12 @@
   static void embperl_LogStartReq (/*i/o*/ req * r)
   
       {
  -
  +    epTHX ;
       
       if (r -> Component.Config.bDebug)
           {
  -        lprintf (r -> pApp,  "[%d]REQ: Start Request at %s\n", r -> pThread -> 
nPid, ctime (time(NULL))) ;
  +        time_t t = time(NULL) ;
  +        lprintf (r -> pApp,  "[%d]REQ: Start Request at %s\n", r -> pThread -> 
nPid, ctime (&t)) ;
   #ifdef DMALLOC
           dmalloc_message ("[%d]REQ: Start Request at %s\n", r -> pThread -> nPid, 
ctime (time(NULL))) ; 
   #endif        
  @@ -1009,13 +1161,12 @@
   
   
       {
  +    int              rc ;
       tThreadData *    pThread ;
       tApp  *          pApp ;
       tReq  *          r ;
  -    tAppConfig *     pAppCfg,
  -    tReqConfig *     pReqCfg,
  -
  -
  +    tAppConfig *     pAppCfg ;
  +    tReqConfig *     pReqCfg ;
   
   
   #ifdef APACHE
  @@ -1050,7 +1201,7 @@
   
   
       /* and setup the request object */
  -    if ((rc = embperl_SetupRequest (aTHX_ pSVApache, pApp, pReqCfg, pReqParam, 
pPerlParam, &r)) != ok)
  +    if ((rc = embperl_SetupRequest (aTHX_ pApacheReqSV, pApp, pReqCfg, pReqParam, 
pPerlParam, &r)) != ok)
           return rc ;
   
      
  
  
  
  1.6.4.7   +2 -4      embperl/epmacro.h
  
  Index: epmacro.h
  ===================================================================
  RCS file: /home/cvs/embperl/epmacro.h,v
  retrieving revision 1.6.4.6
  retrieving revision 1.6.4.7
  diff -u -r1.6.4.6 -r1.6.4.7
  --- epmacro.h 15 Jan 2002 09:11:29 -0000      1.6.4.6
  +++ epmacro.h 18 Jan 2002 08:28:12 -0000      1.6.4.7
  @@ -14,13 +14,11 @@
   
   #define ADDINTMG(name)    \
       if (rc == 0)    \
  -        rc = AddMagic (r, s##name##Name, &EMBPERL_mvtTab##name) ;
  -
  -#define OPTPREFIX "HTML::Embperl::"
  +        rc = AddMagic (pApp, EMBPERL_##name##_NAME, &EMBPERL_mvtTab##name) ;
   
   #define ADDOPTMG(name)    \
       if (rc == 0)    \
  -        rc = AddMagic (r, OPTPREFIX#name, &EMBPERL_mvtTab##name) ;
  +        rc = AddMagic (pApp, OPTPREFIX#name, &EMBPERL_mvtTab##name) ;
   
   
   #define INTMG(name,var,used,sub) \
  
  
  
  1.75.4.82 +5 -147    embperl/epmain.c
  
  Index: epmain.c
  ===================================================================
  RCS file: /home/cvs/embperl/epmain.c,v
  retrieving revision 1.75.4.81
  retrieving revision 1.75.4.82
  diff -u -r1.75.4.81 -r1.75.4.82
  --- epmain.c  17 Jan 2002 23:16:17 -0000      1.75.4.81
  +++ epmain.c  18 Jan 2002 08:28:12 -0000      1.75.4.82
  @@ -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.81 2002/01/17 23:16:17 richter Exp $
  +#   $Id: epmain.c,v 1.75.4.82 2002/01/18 08:28:12 richter Exp $
   #
   
###################################################################################*/
   
  @@ -24,7 +24,6 @@
   static char sVersion [] = VERSION ;
   
   
  -static int  bInitDone = 0 ; /* c part is already initialized */
   
   static char sEnvHashName   [] = "ENV" ;
   static char sFormHashName  [] = "HTML::Embperl::fdat" ;
  @@ -57,15 +56,12 @@
   
   static int      nPackNo = 1 ;       /* Number for createing unique package names */
   static tReq *   pReqFree = NULL ;   /* Chain of unused req structures */
  -tReq     InitialReq ;               /* Initial request - holds default values */
  -tReq * pCurrReq ;                   /* Set before every eval (NOT thread safe!!) */ 
   
   static HV * pCacheHash ;            /* Hash which holds all cached data
                                       (key=> filename or 
                                              filename + packagename, 
                                       value=>cache hash for file) */
   
  -static int nRequestCount = 1 ;
   
   
   /* */
  @@ -284,146 +280,6 @@
       }
   
   
  -
  -static int notused ;
  -
  -#if 0
  -INTMG (TabCount, pCurrReq -> TableStack.State.nCount, pCurrReq -> 
TableStack.State.nCountUsed, ;) 
  -INTMG (TabRow, pCurrReq -> TableStack.State.nRow, pCurrReq -> 
TableStack.State.nRowUsed, ;) 
  -INTMG (TabCol, pCurrReq -> TableStack.State.nCol, pCurrReq -> 
TableStack.State.nColUsed, ;) 
  -INTMG (TabMaxRow, pCurrReq -> nTabMaxRow, notused,  ;) 
  -INTMG (TabMaxCol, pCurrReq -> nTabMaxCol, notused, ;) 
  -INTMG (TabMode, pCurrReq -> nTabMode, notused, ;) 
  -#endif
  -INTMG (EscMode, CurrComponent -> Config.nEscMode, notused, NewEscMode (CurrReq, 
pSV)) 
  -#ifdef EP2
  -INTMGshort (CurrNode, CurrComponent -> xCurrNode) 
  -#endif
  -
  -OPTMGRD (optDisableVarCleanup      , CurrComponent -> Config.bOptions) 
  -OPTMG   (optDisableEmbperlErrorPage, CurrComponent -> Config.bOptions) 
  -OPTMG   (optReturnError            , CurrComponent -> Config.bOptions) 
  -OPTMGRD (optSafeNamespace          , CurrComponent -> Config.bOptions) 
  -OPTMGRD (optOpcodeMask             , CurrComponent -> Config.bOptions) 
  -OPTMG   (optRawInput               , CurrComponent -> Config.bOptions) 
  -OPTMG   (optSendHttpHeader         , CurrComponent -> Config.bOptions) 
  -OPTMGRD (optDisableChdir           , CurrComponent -> Config.bOptions) 
  -OPTMG   (optDisableHtmlScan        , CurrComponent -> Config.bOptions) 
  -OPTMGRD (optEarlyHttpHeader        , CurrComponent -> Config.bOptions) 
  -OPTMGRD (optDisableFormData        , CurrComponent -> Config.bOptions) 
  -OPTMG   (optDisableInputScan       , CurrComponent -> Config.bOptions) 
  -OPTMG   (optDisableTableScan       , CurrComponent -> Config.bOptions) 
  -OPTMG   (optDisableMetaScan        , CurrComponent -> Config.bOptions) 
  -OPTMGRD (optAllFormData            , CurrComponent -> Config.bOptions) 
  -OPTMGRD (optRedirectStdout         , CurrComponent -> Config.bOptions) 
  -OPTMG   (optUndefToEmptyValue      , CurrComponent -> Config.bOptions) 
  -OPTMG   (optNoHiddenEmptyValue     , CurrComponent -> Config.bOptions) 
  -OPTMGRD (optAllowZeroFilesize      , CurrComponent -> Config.bOptions) 
  -OPTMGRD (optKeepSrcInMemory        , CurrComponent -> Config.bOptions) 
  -OPTMG   (optKeepSpaces             , CurrComponent -> Config.bOptions) 
  -OPTMG   (optOpenLogEarly           , CurrComponent -> Config.bOptions) 
  -OPTMG   (optNoUncloseWarn          , CurrComponent -> Config.bOptions) 
  -
  -
  -OPTMG   (dbgStd          , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgMem          , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgEval         , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgCmd          , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgEnv          , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgForm         , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgTab          , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgInput        , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgFlushOutput  , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgFlushLog     , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgAllCmds      , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgSource       , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgFunc         , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgLogLink      , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgDefEval      , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgHeadersIn    , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgShowCleanup  , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgProfile      , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgSession      , CurrComponent -> Config.bDebug) 
  -OPTMG   (dbgImport       , CurrComponent -> Config.bDebug) 
  -
  -
  -    
  -/* ---------------------------------------------------------------------------- */
  -/* add magic to integer var */
  -/* */
  -/* in  sVarName = Name of varibale */
  -/* in  pVirtTab = pointer to virtual table */
  -/* */
  -/* ---------------------------------------------------------------------------- */
  -
  -static int AddMagic (/*i/o*/ register req * r,
  -                     /*in*/ char *     sVarName,
  -                     /*in*/ MGVTBL *   pVirtTab) 
  -
  -    {
  -    SV * pSV ;
  -    struct magic * pMagic ;
  -    epTHX ;
  -
  -    EPENTRY (AddMagic) ;
  -
  -    
  -    pSV = perl_get_sv (sVarName, TRUE) ;
  -    sv_magic (pSV, NULL, 0, sVarName, strlen (sVarName)) ;
  -    sv_setiv (pSV, 0) ;
  -    pMagic = mg_find (pSV, 0) ;
  -
  -    if (pMagic)
  -        pMagic -> mg_virtual = pVirtTab ;
  -    else
  -        {
  -        LogError (r, rcMagicError) ;
  -        return 1 ;
  -        }
  -
  -
  -    return ok ;
  -    }
  -
  -    
  -/* ---------------------------------------------------------------------------- */
  -/* add magic to array                                                               
 */
  -/*                                                                           */
  -/* in  sVarName = Name of varibale                                           */
  -/* in  pVirtTab = pointer to virtual table                                   */
  -/*                                                                           */
  -/* ---------------------------------------------------------------------------- */
  -
  -int AddMagicAV (/*i/o*/ register req * r,
  -             /*in*/ char *     sVarName,
  -                /*in*/ MGVTBL *   pVirtTab) 
  -
  -    {
  -    SV * pSV ;
  -    struct magic * pMagic ;
  -    epTHX ;
  -
  -    EPENTRY (AddMagicAV) ;
  -
  -    
  -    pSV = (SV *)perl_get_av (sVarName, TRUE) ;
  -    sv_magic (pSV, NULL, 'P', sVarName, strlen (sVarName)) ;
  -    pMagic = mg_find (pSV, 0) ;
  -
  -    if (pMagic)
  -        pMagic -> mg_virtual = pVirtTab ;
  -    else
  -        {
  -        LogError (r, rcMagicError) ;
  -        return 1 ;
  -        }
  -
  -
  -    return ok ;
  -    }
  -
  -
  -
   /* ---------------------------------------------------------------------------- */
   /*                                                                              */
   /* clean up embperl module                                                      */
  @@ -433,7 +289,9 @@
   int Term ()
   
       {
  -    req * r = pCurrReq ;
  +#if 0
  +    dTHX ;
  +    req * r = CurrReq ;
   
       EPENTRY (iembperl_term) ;
       
  @@ -442,7 +300,7 @@
   
       CloseLog (r->pApp) ;
       CloseOutput (r) ;
  -    
  +#endif    
       return ok ;
       }
   
  
  
  
  1.1.2.4   +20 -3     embperl/Attic/eppriv.h
  
  Index: eppriv.h
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/eppriv.h,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- eppriv.h  17 Jan 2002 23:16:18 -0000      1.1.2.3
  +++ eppriv.h  18 Jan 2002 08:28:12 -0000      1.1.2.4
  @@ -10,7 +10,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: eppriv.h,v 1.1.2.3 2002/01/17 23:16:18 richter Exp $
  +#   $Id: eppriv.h,v 1.1.2.4 2002/01/18 08:28:12 richter Exp $
   #
   
###################################################################################*/
   
  @@ -18,8 +18,8 @@
   
   
   #ifdef PERL_IMPLICIT_CONTEXT
  -#define epTHX pTHX = r -> _perlsv
  -#define epaTHX pTHX = a -> _perlsv
  +#define epTHX pTHX = r -> pPerlTHX
  +#define epaTHX pTHX = a -> pPerlTHX
   #define epTHX_ epTHX ;
   #define epaTHX_ epaTHX ;
   #else
  @@ -122,3 +122,20 @@
   #define pid_t int
   #endif
   
  +/* --- memory management --- */
  +
  +
  +typedef struct tMemPool tMemPool;
  +
  +tMemPool * ep_init_alloc(void);      
  +void ep_cleanup_alloc(void);
  +
  +tMemPool * ep_make_sub_pool(tMemPool *);
  +void   ep_destroy_pool(tMemPool *);
  +void * ep_palloc(struct tMemPool *, int nbytes);
  +void * ep_pcalloc(struct tMemPool *, int nbytes);
  +char * ep_pstrdup(struct tMemPool *, const char *s);
  +char * ep_pstrndup(struct tMemPool *, const char *s, int n);
  +char * ep_pstrcat(struct tMemPool *,...) ;
  +char * ep_psprintf(struct tMemPool *, const char *fmt, ...) ;
  +char * ep_pvsprintf(struct tMemPool *, const char *fmt, va_list);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +78 -0     embperl/Attic/epcgiinit.c
  
  
  
  
  1.1.2.1   +1053 -0   embperl/Attic/epmem.c
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to