perl.cvs.mod_parrot
[Top] [All Lists]

[svn:mod_parrot] r393 - mod_parrot/trunk/build/lib/Generator

Subject: [svn:mod_parrot] r393 - mod_parrot/trunk/build/lib/Generator
From: jhorwitz@xxxxxxxxxxxx
Date: Fri, 25 Jul 2008 18:04:29 -0700 (PDT)
Newsgroups: perl.cvs.mod_parrot

Author: jhorwitz
Date: Fri Jul 25 18:04:27 2008
New Revision: 393

Modified:
   mod_parrot/trunk/build/lib/Generator/ApacheConstants.pm

Log:
parse enums from http_config.h (will need to be refactored out later)


Modified: mod_parrot/trunk/build/lib/Generator/ApacheConstants.pm
==============================================================================
--- mod_parrot/trunk/build/lib/Generator/ApacheConstants.pm     (original)
+++ mod_parrot/trunk/build/lib/Generator/ApacheConstants.pm     Fri Jul 25 
18:04:27 2008
@@ -68,6 +68,38 @@
     }
     close HTTP_LOG_H;
 
+    # Get constants from $APACHE/include/http_config.h
+    open (HTTP_CONFIG_H, $self->{'apache_include_dir'} . 'http_config.h')
+        or die $!;
+    while (<HTTP_CONFIG_H>) {
+        my $code;
+        if (/#define\s+(OR_\w+)\s+(\d+)/) {
+            $constants{'config'}{$1} = $2;
+        }
+        elsif (/enum\s+(\w+)\s+\{/) {
+            $code = $_;
+            unless ($code =~ /;\s*$/) {
+                local $_;
+                while (<HTTP_CONFIG_H>) {
+                    $code .= $_;
+                    last if /;\s*$/;
+                }
+            }
+            $code =~ s:/\*.*?\*/::sg;
+            $code =~ s/\s*=\s*\w+//g;
+            $code =~ s/^[^\{]*\{//s;
+            $code =~ s/\}[^;]*;?//s;
+            $code =~ s/^\s*\n//gm;
+            my $idx = 0;
+            while ($code =~ /\b(\w+)\b,?/g) {
+                $constants{'config'}{$1} = $idx++;
+            }
+        }
+    }
+    close HTTP_LOG_H;
+
+    use Data::Dumper;
+    print Dumper \%constants;
     return %constants;
 }
 

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:mod_parrot] r393 - mod_parrot/trunk/build/lib/Generator, jhorwitz <=