richter     01/10/31 06:13:52

  Modified:    .        Tag: Embperl2c epmain.c
  Log:
  Embperl 2 - verbose error messages
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.75.4.49 +85 -58    embperl/epmain.c
  
  Index: epmain.c
  ===================================================================
  RCS file: /home/cvs/embperl/epmain.c,v
  retrieving revision 1.75.4.48
  retrieving revision 1.75.4.49
  diff -u -r1.75.4.48 -r1.75.4.49
  --- epmain.c  2001/10/31 13:47:41     1.75.4.48
  +++ epmain.c  2001/10/31 14:13:51     1.75.4.49
  @@ -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.48 2001/10/31 13:47:41 richter Exp $
  +#   $Id: epmain.c,v 1.75.4.49 2001/10/31 14:13:51 richter Exp $
   #
   
###################################################################################*/
   
  @@ -75,7 +75,9 @@
       const char * msg ;
       char * sText ;
       SV *   pSV ;
  +    SV *   pSVLine ;
       SV **  ppSV ;
  +    STRLEN l ;
       int    n ;
   
       
  @@ -91,68 +93,93 @@
       
       switch (rc)
           {
  -        case ok:                        msg ="[%d]ERR:  %d: Line %d: ok%s%s" ; 
break ;
  -        case rcStackOverflow:           msg ="[%d]ERR:  %d: Line %d: Stack 
Overflow%s%s" ; break ;
  -        case rcArgStackOverflow:        msg ="[%d]ERR:  %d: Line %d: Argumnet Stack 
Overflow (%s)%s" ; break ;
  -        case rcStackUnderflow:          msg ="[%d]ERR:  %d: Line %d: Stack 
Underflow%s%s" ; break ;
  -        case rcEndifWithoutIf:          msg ="[%d]ERR:  %d: Line %d: endif without 
if%s%s" ; break ;
  -        case rcElseWithoutIf:           msg ="[%d]ERR:  %d: Line %d: else without 
if%s%s" ; break ;
  -        case rcEndwhileWithoutWhile:    msg ="[%d]ERR:  %d: Line %d: endwhile 
without while%s%s" ; break ;
  -        case rcEndtableWithoutTable:    msg ="[%d]ERR:  %d: Line %d: blockend <%s> 
does not match blockstart <%s>" ; break ;
  -        case rcTablerowOutsideOfTable:  msg ="[%d]ERR:  %d: Line %d: <tr> outside 
of table%s%s" ; break ;
  -        case rcCmdNotFound:             msg ="[%d]ERR:  %d: Line %d: Unknown 
Command %s%s" ; break ;
  -        case rcOutOfMemory:             msg ="[%d]ERR:  %d: Line %d: Out of 
memory%s%s" ; break ;
  -        case rcPerlVarError:            msg ="[%d]ERR:  %d: Line %d: Perl variable 
error %s%s" ; break ;
  -        case rcHashError:               msg ="[%d]ERR:  %d: Line %d: Perl hash 
error, %%%s does not exist%s" ; break ;
  -        case rcArrayError:              msg ="[%d]ERR:  %d: Line %d: Perl array 
error , @%s does not exist%s" ; break ;
  -        case rcFileOpenErr:             msg ="[%d]ERR:  %d: Line %d: File %s open 
error: %s" ; break ;    
  -        case rcLogFileOpenErr:          msg ="[%d]ERR:  %d: Line %d: Logfile %s 
open error: %s" ; break ;    
  -        case rcMissingRight:            msg ="[%d]ERR:  %d: Line %d: Missing right 
%s%s" ; break ;
  -        case rcNoRetFifo:               msg ="[%d]ERR:  %d: Line %d: No Return 
Fifo%s%s" ; break ;
  -        case rcMagicError:              msg ="[%d]ERR:  %d: Line %d: Perl Magic 
Error%s%s" ; break ;
  -        case rcWriteErr:                msg ="[%d]ERR:  %d: Line %d: File write 
Error%s%s" ; break ;
  -        case rcUnknownNameSpace:        msg ="[%d]ERR:  %d: Line %d: Namespace %s 
unknown%s" ; break ;
  -        case rcInputNotSupported:       msg ="[%d]ERR:  %d: Line %d: Input not 
supported in mod_perl mode%s%s" ; break ;
  -        case rcCannotUsedRecursive:     msg ="[%d]ERR:  %d: Line %d: Cannot be 
called recursivly in mod_perl mode%s%s" ; break ;
  -        case rcEndtableWithoutTablerow: msg ="[%d]ERR:  %d: Line %d: </tr> without 
<tr>%s%s" ; break ;
  -        case rcEndtextareaWithoutTextarea: msg ="[%d]ERR:  %d: Line %d: </textarea> 
without <textarea>%s%s" ; break ;
  -        case rcEvalErr:                 msg ="[%d]ERR:  %d: Line %d: Error in Perl 
code: %s%s" ; break ;
  -     case rcNotCompiledForModPerl:   msg ="[%d]ERR:  %d: Line %d: Embperl is not 
compiled for mod_perl. Rerun Makefile.PL and give the correct Apache source tree 
location %s%s" ; break ;
  -        case rcExecCGIMissing:          msg ="[%d]ERR:  %d: Line %d: Forbidden %s: 
Options ExecCGI not set in your Apache configs%s" ; break ;
  -        case rcIsDir:                   msg ="[%d]ERR:  %d: Line %d: Forbidden %s 
is a directory%s" ; break ;
  -        case rcXNotSet:                 msg ="[%d]ERR:  %d: Line %d: Forbidden %s X 
Bit not set%s" ; break ;
  -        case rcNotFound:                msg ="[%d]ERR:  %d: Line %d: Not found 
%s%s" ; break ;
  -        case rcUnknownVarType:          msg ="[%d]ERR:  %d: Line %d: Type for 
Variable %s is unknown %s" ; break ;
  -        case rcPerlWarn:                msg ="[%d]ERR:  %d: Line %d: Warning in 
Perl code: %s%s" ; break ;
  -        case rcVirtLogNotSet:           msg ="[%d]ERR:  %d: Line %d: 
EMBPERL_VIRTLOG must be set, when dbgLogLink is set %s%s" ; break ;
  -        case rcMissingInput:            msg ="[%d]ERR:  %d: Line %d: Sourcedata 
missing %s%s" ; break ;
  -        case rcUntilWithoutDo:          msg ="[%d]ERR:  %d: Line %d: until without 
do%s%s" ; break ;
  -        case rcEndforeachWithoutForeach:msg ="[%d]ERR:  %d: Line %d: endforeach 
without foreach%s%s" ; break ;
  -        case rcMissingArgs:             msg ="[%d]ERR:  %d: Line %d: Too few 
arguments%s%s" ; break ;
  -        case rcNotAnArray:              msg ="[%d]ERR:  %d: Line %d: Second 
Argument must be array/list%s%s" ; break ;
  -        case rcCallInputFuncFailed:     msg ="[%d]ERR:  %d: Line %d: Call to Input 
Function failed: %s%s" ; break ;
  -        case rcCallOutputFuncFailed:    msg ="[%d]ERR:  %d: Line %d: Call to Output 
Function failed: %s%s" ; break ;
  -        case rcSubNotFound:             msg ="[%d]ERR:  %d: Line %d: Call to 
unknown Embperl macro %s%s" ; break ;
  -        case rcImportStashErr:          msg ="[%d]ERR:  %d: Line %d: Package %s for 
import unknown%s" ; break ;
  -        case rcCGIError:                msg ="[%d]ERR:  %d: Line %d: Setup of 
CGI.pm failed: %s%s" ; break ;
  -        case rcUnclosedHtml:            msg ="[%d]ERR:  %d: Line %d: Unclosed HTML 
tag <%s> at end of file %s" ; break ;
  -        case rcUnclosedCmd:             msg ="[%d]ERR:  %d: Line %d: Unclosed 
command [$ %s $] at end of file %s" ; break ;
  -     case rcNotAllowed:              msg ="[%d]ERR:  %d: Line %d: Forbidden %s: 
Does not match EMBPERL_ALLOW %s" ; break ;
  -        case rcNotHashRef:              msg ="[%d]ERR:  %d: Line %d: %s need 
hashref in %s" ; break ; 
  -     case rcTagMismatch:             msg ="[%d]ERR:  %d: Line %d: Endtag '%s' 
doesn't match starttag '%s'" ; break ; 
  -     case rcCleanupErr:              msg ="[%d]ERR:  %d: Line %d: Error in cleanup 
%s%s" ; break ; 
  -     case rcCryptoWrongHeader:       msg ="[%d]ERR:  %d: Line %d: Decrypt-error: 
Not encrypted (%s)%s" ; break ; 
  -     case rcCryptoWrongSyntax:       msg ="[%d]ERR:  %d: Line %d: Decrypt-error: 
Wrong syntax (%s)%s" ; break ; 
  -     case rcCryptoNotSupported:      msg ="[%d]ERR:  %d: Line %d: Decrypt-error: 
Not supported (%s)%s" ; break ; 
  -     case rcCryptoBufferOverflow:    msg ="[%d]ERR:  %d: Line %d: Decrypt-error: 
Buffer overflow (%s)%s" ; break ; 
  -     case rcCryptoErr:               msg ="[%d]ERR:  %d: Line %d: Decrypt-error: 
OpenSSL error (%s)%s" ; break ; 
  +        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 <tr> outside of 
table%s%s" ; break ;
  +        case rcCmdNotFound:             msg ="[%d]ERR:  %d: %s Unknown Command 
%s%s" ; break ;
  +        case rcOutOfMemory:             msg ="[%d]ERR:  %d: %s Out of memory%s%s" ; 
break ;
  +        case rcPerlVarError:            msg ="[%d]ERR:  %d: %s Perl variable error 
%s%s" ; break ;
  +        case rcHashError:               msg ="[%d]ERR:  %d: %s Perl hash error, 
%%%s does not exist%s" ; break ;
  +        case rcArrayError:              msg ="[%d]ERR:  %d: %s Perl array error , 
@%s does not exist%s" ; break ;
  +        case rcFileOpenErr:             msg ="[%d]ERR:  %d: %s File %s open error: 
%s" ; break ;    
  +        case rcLogFileOpenErr:          msg ="[%d]ERR:  %d: %s Logfile %s open 
error: %s" ; break ;    
  +        case rcMissingRight:            msg ="[%d]ERR:  %d: %s Missing right %s%s" 
; break ;
  +        case rcNoRetFifo:               msg ="[%d]ERR:  %d: %s No Return Fifo%s%s" 
; break ;
  +        case rcMagicError:              msg ="[%d]ERR:  %d: %s Perl Magic 
Error%s%s" ; break ;
  +        case rcWriteErr:                msg ="[%d]ERR:  %d: %s File write 
Error%s%s" ; break ;
  +        case rcUnknownNameSpace:        msg ="[%d]ERR:  %d: %s Namespace %s 
unknown%s" ; break ;
  +        case rcInputNotSupported:       msg ="[%d]ERR:  %d: %s Input not supported 
in mod_perl mode%s%s" ; break ;
  +        case rcCannotUsedRecursive:     msg ="[%d]ERR:  %d: %s Cannot be called 
recursivly in mod_perl mode%s%s" ; break ;
  +        case rcEndtableWithoutTablerow: msg ="[%d]ERR:  %d: %s </tr> without 
<tr>%s%s" ; break ;
  +        case rcEndtextareaWithoutTextarea: msg ="[%d]ERR:  %d: %s </textarea> 
without <textarea>%s%s" ; break ;
  +        case rcEvalErr:                 msg ="[%d]ERR:  %d: %s Error in Perl code: 
%s%s" ; break ;
  +     case rcNotCompiledForModPerl:   msg ="[%d]ERR:  %d: %s Embperl is not compiled 
for mod_perl. Rerun Makefile.PL and give the correct Apache source tree location %s%s" 
; break ;
  +        case rcExecCGIMissing:          msg ="[%d]ERR:  %d: %s Forbidden %s: 
Options ExecCGI not set in your Apache configs%s" ; break ;
  +        case rcIsDir:                   msg ="[%d]ERR:  %d: %s Forbidden %s is a 
directory%s" ; break ;
  +        case rcXNotSet:                 msg ="[%d]ERR:  %d: %s Forbidden %s X Bit 
not set%s" ; break ;
  +        case rcNotFound:                msg ="[%d]ERR:  %d: %s Not found %s%s" ; 
break ;
  +        case rcUnknownVarType:          msg ="[%d]ERR:  %d: %s Type for Variable %s 
is unknown %s" ; break ;
  +        case rcPerlWarn:                msg ="[%d]ERR:  %d: %s Warning in Perl 
code: %s%s" ; break ;
  +        case rcVirtLogNotSet:           msg ="[%d]ERR:  %d: %s EMBPERL_VIRTLOG must 
be set, when dbgLogLink is set %s%s" ; break ;
  +        case rcMissingInput:            msg ="[%d]ERR:  %d: %s Sourcedata missing 
%s%s" ; break ;
  +        case rcUntilWithoutDo:          msg ="[%d]ERR:  %d: %s until without 
do%s%s" ; break ;
  +        case rcEndforeachWithoutForeach:msg ="[%d]ERR:  %d: %s endforeach without 
foreach%s%s" ; break ;
  +        case rcMissingArgs:             msg ="[%d]ERR:  %d: %s Too few 
arguments%s%s" ; break ;
  +        case rcNotAnArray:              msg ="[%d]ERR:  %d: %s Second Argument must 
be array/list%s%s" ; break ;
  +        case rcCallInputFuncFailed:     msg ="[%d]ERR:  %d: %s Call to Input 
Function failed: %s%s" ; break ;
  +        case rcCallOutputFuncFailed:    msg ="[%d]ERR:  %d: %s Call to Output 
Function failed: %s%s" ; break ;
  +        case rcSubNotFound:             msg ="[%d]ERR:  %d: %s Call to unknown 
Embperl macro %s%s" ; break ;
  +        case rcImportStashErr:          msg ="[%d]ERR:  %d: %s Package %s for 
import unknown%s" ; break ;
  +        case rcCGIError:                msg ="[%d]ERR:  %d: %s Setup of CGI.pm 
failed: %s%s" ; break ;
  +        case rcUnclosedHtml:            msg ="[%d]ERR:  %d: %s Unclosed HTML tag 
<%s> at end of file %s" ; break ;
  +        case rcUnclosedCmd:             msg ="[%d]ERR:  %d: %s Unclosed command [$ 
%s $] at end of file %s" ; break ;
  +     case rcNotAllowed:              msg ="[%d]ERR:  %d: %s Forbidden %s: Does not 
match EMBPERL_ALLOW %s" ; break ;
  +        case rcNotHashRef:              msg ="[%d]ERR:  %d: %s %s need hashref in 
%s" ; break ; 
  +     case rcTagMismatch:             msg ="[%d]ERR:  %d: %s Endtag '%s' doesn't 
match starttag '%s'" ; break ; 
  +     case rcCleanupErr:              msg ="[%d]ERR:  %d: %s Error in cleanup %s%s" 
; break ; 
  +     case rcCryptoWrongHeader:       msg ="[%d]ERR:  %d: %s Decrypt-error: Not 
encrypted (%s)%s" ; break ; 
  +     case rcCryptoWrongSyntax:       msg ="[%d]ERR:  %d: %s Decrypt-error: Wrong 
syntax (%s)%s" ; break ; 
  +     case rcCryptoNotSupported:      msg ="[%d]ERR:  %d: %s Decrypt-error: Not 
supported (%s)%s" ; break ; 
  +     case rcCryptoBufferOverflow:    msg ="[%d]ERR:  %d: %s Decrypt-error: Buffer 
overflow (%s)%s" ; break ; 
  +     case rcCryptoErr:               msg ="[%d]ERR:  %d: %s Decrypt-error: OpenSSL 
error (%s)%s" ; break ; 
        
  -     default:                        msg ="[%d]ERR:  %d: Line %d: Error %s%s" ; 
break ; 
  +     default:                        msg ="[%d]ERR:  %d: %s Error %s%s" ; break ; 
           }
   
  -    pSV = newSVpvf (msg, r -> nPid , rc, r -> Buf.nSourceline, r -> errdat1, r -> 
errdat2) ;
  +    if (rc != rcPerlWarn && rc != rcEvalErr)
  +        {
  +        int len ;
  +        char * p = NULL ;
  +        if (!r -> Buf.pFile -> sSourcefile)
  +            p = "" ;
  +        if (!p)
  +            p = strrchr (r -> Buf.pFile -> sSourcefile, '/') ;
  +        if (!p)
  +            p = strrchr (r -> Buf.pFile -> sSourcefile, '\\') ;
  +        else
  +            p++ ;
  +        if (!p)
  +            p = r -> Buf.pFile -> sSourcefile ;
  +        else
  +            p++ ;
  +        len = strlen (p) ;
  +        pSVLine = newSVpvf ("%s(%d):", p, r -> Buf.nSourceline) ;
  +        }
  +
  +   
  +    
  +    pSV = newSVpvf (msg, r -> nPid , rc, pSVLine?SvPV(pSVLine, l):"", r -> errdat1, 
r -> errdat2) ;
  +
  +    if (pSVLine)
  +        SvREFCNT_dec(pSVLine) ;
   
  -    sText = SvPV (pSV, na) ;    
  +    sText = SvPV (pSV, l) ;    
       
       lprintf (r, "%s\n", sText) ;
   
  
  
  

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

Reply via email to