/*################################################################################### # # Embperl - Copyright (c) 1997-2001 Gerald Richter / ECOS # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. # For use with Apache httpd and mod_perl, see also Apache copyright. # # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. # # $Id: epmain.c,v 1.118.2.1 2003/01/22 08:23:35 richter Exp $ # ###################################################################################*/ #include "ep.h" #include "epmacro.h" /* Version */ static char sVersion [] = VERSION ; static int bInitDone = 0 ; /* c part is already initialized */ static char sEnvHashName [] = "ENV" ; static char sFormHashName [] = "HTML::Embperl::fdat" ; static char sUserHashName [] = "HTML::Embperl::udat" ; static char sStateHashName [] = "HTML::Embperl::sdat" ; static char sModHashName [] = "HTML::Embperl::mdat" ; static char sFormSplitHashName [] = "HTML::Embperl::fsplitdat" ; static char sFormArrayName [] = "HTML::Embperl::ffld" ; static char sInputHashName [] = "HTML::Embperl::idat" ; static char sHeaderHashName [] = "HTML::Embperl::http_headers_out" ; static char sTabCountName [] = "HTML::Embperl::cnt" ; static char sTabRowName [] = "HTML::Embperl::row" ; static char sTabColName [] = "HTML::Embperl::col" ; static char sTabMaxRowName [] = "HTML::Embperl::maxrow" ; static char sTabMaxColName [] = "HTML::Embperl::maxcol" ; static char sTabModeName [] = "HTML::Embperl::tabmode" ; static char sEscModeName [] = "HTML::Embperl::escmode" ; #ifdef EP2 static char sCurrNodeName [] = "HTML::Embperl::_ep_node" ; static char sTokenHashName [] = "HTML::Embperl::Syntax::Default" ; #endif static char sDefaultPackageName [] = "HTML::Embperl::DOC::_%d" ; static char sUIDName [] = "_ID" ; static char sSetCookie [] = "Set-Cookie" ; static char sCookieNameDefault [] = "EMBPERL_UID" ; 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) */ #if PERL_VERSION >= 8 SV ep_sv_undef ; /* we need our own undef value, because when storing a PL_sv_undef with Perl 5.8.0 in a hash Perl takes it as a placeholder and pretents it isn't there :-( */ #endif /* */ /* print error */ /* */ char * LogError (/*i/o*/ register req * r, /*in*/ int rc) { const char * msg ; char * sText ; SV * pSV ; SV * pSVLine = NULL ; SV ** ppSV ; STRLEN l ; int n ; EPENTRY (LogError) ; r -> errdat1 [sizeof (r -> errdat1) - 1] = '\0' ; r -> errdat2 [sizeof (r -> errdat2) - 1] = '\0' ; GetLineNo (r) ; if (rc != rcPerlWarn) r -> bError = 1 ; switch (rc) { case ok: msg ="[%d]ERR: %d: %s ok%s%s" ; break ; case rcStackOverflow: msg ="[%d]ERR: %d: %s Stack Overflow%s%s" ; break ; case rcArgStackOverflow: msg ="[%d]ERR: %d: %s Argumnet Stack Overflow (%s)%s" ; break ; case rcStackUnderflow: msg ="[%d]ERR: %d: %s Stack Underflow%s%s" ; break ; case rcEndifWithoutIf: msg ="[%d]ERR: %d: %s endif without if%s%s" ; break ; case rcElseWithoutIf: msg ="[%d]ERR: %d: %s else without if%s%s" ; break ; case rcEndwhileWithoutWhile: msg ="[%d]ERR: %d: %s endwhile without while%s%s" ; break ; case rcEndtableWithoutTable: msg ="[%d]ERR: %d: %s blockend <%s> does not match blockstart <%s>" ; break ; case rcTablerowOutsideOfTable: msg ="[%d]ERR: %d: %s