perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
Date Sun, 12 May 2002 23:01:33 GMT
dougm       02/05/12 16:01:33

  Modified:    lib/ModPerl Code.pm
               src/modules/perl modperl_cmd.c modperl_config.c
                        modperl_log.c modperl_log.h
               xs/tables/current/ModPerl FunctionTable.pm
  Log:
  get MP_TRACE working on win32
  
  Revision  Changes    Path
  1.79      +4 -6      modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- Code.pm	23 Apr 2002 16:27:00 -0000	1.78
  +++ Code.pm	12 May 2002 23:01:32 -0000	1.79
  @@ -376,7 +376,7 @@
   
   EOF
               push @dumper,
  -              qq{fprintf(stderr, " $name %s\\n", \\
  +              qq{modperl_trace(NULL, " $name %s\\n", \\
                            ($flags(p) & $x) ? "On " : "Off");};
   
               $i += $i || 1;
  @@ -389,7 +389,7 @@
           shift @dumper; #NONE
           print $h_fh join ' \\'."\n", 
             "#define ${class}_dump_flags(p, str)",
  -                     qq{fprintf(stderr, "$class flags dump (%s):\\n", str);},
  +                     qq{modperl_trace(NULL, "$class flags dump (%s):\\n", str);},
                        @dumper;
       }
   
  @@ -428,8 +428,6 @@
       my $tl = "MP_debug_level";
   
       print $h_fh <<EOF;
  -extern U32 $tl;
  -
   #define MP_TRACE_OPTS "$opts"
   
   #ifdef MP_TRACE
  @@ -461,13 +459,13 @@
   #endif
   EOF
           push @dumper,
  -          qq{fprintf(stderr, " $type %s ($trace{$type})\\n", ($tl & $i) ? "On " : "Off");};
  +          qq{modperl_trace(NULL, " $type %s ($trace{$type})\\n", ($tl & $i) ? "On "
: "Off");};
           $i += $i;
       }
   
       print $h_fh join ' \\'."\n", 
                        '#define MP_TRACE_dump_flags()',
  -                     qq{fprintf(stderr, "mod_perl trace flags dump:\\n");},
  +                     qq{modperl_trace(NULL, "mod_perl trace flags dump:\\n");},
                        @dumper;
   
       ();
  
  
  
  1.16      +1 -1      modperl-2.0/src/modules/perl/modperl_cmd.c
  
  Index: modperl_cmd.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- modperl_cmd.c	19 Nov 2001 00:07:28 -0000	1.15
  +++ modperl_cmd.c	12 May 2002 23:01:32 -0000	1.16
  @@ -32,7 +32,7 @@
   MP_CMD_SRV_DECLARE(trace)
   {
       MP_CMD_SRV_CHECK;
  -    modperl_trace_level_set(arg);
  +    modperl_trace_level_set(parms->server, arg);
       return NULL;
   }
   
  
  
  
  1.53      +2 -2      modperl-2.0/src/modules/perl/modperl_config.c
  
  Index: modperl_config.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- modperl_config.c	6 Jan 2002 20:45:36 -0000	1.52
  +++ modperl_config.c	12 May 2002 23:01:32 -0000	1.53
  @@ -140,9 +140,9 @@
   {
       int i;
       char **argv = (char **)scfg->argv->elts;
  -    fprintf(stderr, "modperl_config_srv_argv_init =>\n");
  +    modperl_trace(NULL, "modperl_config_srv_argv_init =>\n");
       for (i=0; i<scfg->argv->nelts; i++) {
  -        fprintf(stderr, "   %d = %s\n", i, argv[i]);
  +        modperl_trace(NULL, "   %d = %s\n", i, argv[i]);
       }
   }
   #endif
  
  
  
  1.6       +37 -14    modperl-2.0/src/modules/perl/modperl_log.c
  
  Index: modperl_log.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_log.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- modperl_log.c	21 Oct 2001 22:11:34 -0000	1.5
  +++ modperl_log.c	12 May 2002 23:01:32 -0000	1.6
  @@ -1,49 +1,72 @@
  -#include "mod_perl.h"
  +#include "modperl_apache_includes.h"
  +#include "apr_lib.h"
  +#include "modperl_trace.h"
  +#include "modperl_log.h"
   
   #undef getenv /* from XSUB.h */
   
  -U32 MP_debug_level = 0;
  +static apr_file_t *logfile = NULL;
  +
  +#ifdef WIN32
  +static unsigned long debug_level = 0;
  +#else
  +unsigned long MP_debug_level = 0;
  +#define debug_level MP_debug_level
  +#endif
  +
  +unsigned long modperl_debug_level(void)
  +{
  +    return debug_level;  
  +}
   
   void modperl_trace(char *func, const char *fmt, ...)
   {
  -#ifndef WIN32 /* XXX */
  +    char vstr[8192];
  +    apr_size_t vstr_len = 0;
       va_list args;
   
  +    if (!logfile) {
  +        return;
  +    }
  +
       if (func) {
  -        fprintf(stderr, "%s: ", func);
  +        apr_file_printf(logfile, "%s: ", func);
       }
   
       va_start(args, fmt);
  -    vfprintf(stderr, fmt, args);
  +    vstr_len = apr_vsnprintf(vstr, sizeof(vstr), fmt, args);
       va_end(args);
  -#endif
  +
  +    apr_file_write(logfile, vstr, &vstr_len);
   }
   
  -void modperl_trace_level_set(const char *level)
  +void modperl_trace_level_set(server_rec *s, const char *level)
   {
       if (!level) {
           if (!(level = getenv("MOD_PERL_TRACE"))) {
               return;
           }
       }
  -    MP_debug_level = 0x0;
  +    debug_level = 0x0;
   
  -    if (strEQ(level, "all")) {
  -        MP_debug_level = 0xffffffff;
  +    if (strcasecmp(level, "all") == 0) {
  +        debug_level = 0xffffffff;
       }
  -    else if (isALPHA(level[0])) {
  +    else if (apr_isalpha(level[0])) {
           static char debopts[] = MP_TRACE_OPTS;
           char *d;
   
           for (; *level && (d = strchr(debopts, *level)); level++) {
  -            MP_debug_level |= 1 << (d - debopts);
  +            debug_level |= 1 << (d - debopts);
           }
       }
       else {
  -        MP_debug_level = atoi(level);
  +        debug_level = atoi(level);
       }
   
  -    MP_debug_level |= 0x80000000;
  +    debug_level |= 0x80000000;
  +
  +    logfile = s->error_log; /* XXX */
   
       MP_TRACE_a_do(MP_TRACE_dump_flags());
   }
  
  
  
  1.8       +11 -3     modperl-2.0/src/modules/perl/modperl_log.h
  
  Index: modperl_log.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_log.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- modperl_log.h	13 Mar 2002 17:21:53 -0000	1.7
  +++ modperl_log.h	12 May 2002 23:01:32 -0000	1.8
  @@ -9,10 +9,10 @@
   #         define MP_FUNC __FUNCTION__
   #      endif
   #   else
  -#      define MP_FUNC "MP_FUNC"
  +#      define MP_FUNC NULL
   #   endif
   #else
  -#   define MP_FUNC "MP_FUNC"
  +#   define MP_FUNC NULL
   #endif
   
   #include "modperl_trace.h"
  @@ -26,9 +26,17 @@
   #define MP_TIDF \
   (unsigned long)modperl_thread_self()
   
  +unsigned long modperl_debug_level(void);
  +
  +#ifdef WIN32
  +#define MP_debug_level modperl_debug_level()
  +#else
  +extern unsigned long MP_debug_level;
  +#endif
  +
   void modperl_trace(char *func, const char *fmt, ...);
   
  -void modperl_trace_level_set(const char *level);
  +void modperl_trace_level_set(server_rec *s, const char *level);
   
   #define modperl_log_warn(s,msg) \
       ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, s, "%s", msg)
  
  
  
  1.62      +5 -0      modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- FunctionTable.pm	6 Apr 2002 00:40:00 -0000	1.61
  +++ FunctionTable.pm	12 May 2002 23:01:33 -0000	1.62
  @@ -1221,6 +1221,11 @@
       ]
     },
     {
  +    'return_type' => 'unsigned long',
  +    'name' => 'modperl_debug_level',
  +    'args' => []
  +  },
  +  {
       'return_type' => 'SV *',
       'name' => 'modperl_dir_config',
       'attr' => [
  
  
  

Mime
View raw message