You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Sander Striker <st...@apache.org> on 2001/07/21 12:40:46 UTC

[PATCH] make_exports.awk

Hi,

I missed the hook declarations in my previous
script. This is added by the patch below.

The patch also removes unneeded ; that slipped
in because I use c a lot more than awk :)

I moved a rule around so removal of leading
whitespace could go into one rule 
(see AP[RU]?_DECLARE).

Also removed the additional idx variable in
favor of checking the return value of the
index function.

Sander



--- build/make_exports.awk      Sat Jul 21 12:16:42 2001
+++ build/make_exports.awk.new  Sat Jul 21 12:14:51 2001
@@ -70,21 +70,30 @@
 }

 function add_symbol(symbol) {
-    idx = index(symbol, "#")
-
-    if (!idx) {
+    if (!index(symbol, "#")) {
         push("const void *ap_hack_" symbol " = (const void *)" symbol ";")
         scope_used[scope] = 1
     }
 }

-/^[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/  {
-    sub("[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]", "");
-    sub("[(].*", "");
-    sub("^[ \t]+", "");
-    sub("([^ ]* ^([ \t]*[(]))*", "");
+/^[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
+    sub("[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)][ \t]*", "")
+    sub("[(].*", "")
+    sub("([^ ]* ^([ \t]*[(]))*", "")

     add_symbol($0)
+    next
+}
+
+/^[ \t]*AP_DECLARE_HOOK[^(]*[(][^)]*[)]/ {
+    split($0, args, ",")
+    symbol = args[2]
+    sub("^[ \t]+", "", symbol)
+    sub("[ \t]+$", "", symbol)
+
+    add_symbol("ap_hook_" symbol)
+    add_symbol("ap_hook_get_" symbol)
+    add_symbol("ap_run_" symbol)
     next
 }


Re: [PATCH] make_exports.awk

Posted by Brian Havard <br...@kheldar.apana.org.au>.
On 21 Jul 2001 07:34:13 -0400, Jeff Trawick wrote:

>"Sander Striker" <st...@apache.org> writes:
>
>> Hi,
>> 
>> I missed the hook declarations in my previous
>> script. This is added by the patch below.
>> 
>> The patch also removes unneeded ; that slipped
>> in because I use c a lot more than awk :)
>> 
>> I moved a rule around so removal of leading
>> whitespace could go into one rule 
>> (see AP[RU]?_DECLARE).
>> 
>> Also removed the additional idx variable in
>> favor of checking the return value of the
>> index function.
>
>For reasons I don't understand I wasn't able to apply the patch.

The patch doesn't apply cleanly because somewhere along the line it got
whitespace trimmed. Here's a repaired version.

Index: make_exports.awk
===================================================================
RCS file: /usr/local/cvs/httpd-2.0/build/make_exports.awk,v
retrieving revision 1.1
diff -u -r1.1 make_exports.awk
--- make_exports.awk	2001/07/21 06:34:54	1.1
+++ make_exports.awk	2001/07/21 12:49:14
@@ -70,21 +70,30 @@
 }
 
 function add_symbol(symbol) {
-    idx = index(symbol, "#")
-
-    if (!idx) {
+    if (!index(symbol, "#")) {
         push("const void *ap_hack_" symbol " = (const void *)" symbol ";")
         scope_used[scope] = 1
     }
 }
 
-/^[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/  { 
-    sub("[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]", "");
-    sub("[(].*", "");
-    sub("^[ \t]+", "");
-    sub("([^ ]* ^([ \t]*[(]))*", "");
+/^[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
+    sub("[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)][ \t]*", "")
+    sub("[(].*", "")
+    sub("([^ ]* ^([ \t]*[(]))*", "")
 
     add_symbol($0)
+    next
+}
+
+/^[ \t]*AP_DECLARE_HOOK[^(]*[(][^)]*[)]/ {
+    split($0, args, ",")
+    symbol = args[2]
+    sub("^[ \t]+", "", symbol)
+    sub("[ \t]+$", "", symbol)
+
+    add_symbol("ap_hook_" symbol)
+    add_symbol("ap_hook_get_" symbol)
+    add_symbol("ap_run_" symbol)
     next
 }
 

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


RE: [PATCH] make_exports.awk

Posted by Sander Striker <st...@apache.org>.
> "Sander Striker" <st...@apache.org> writes:
>> Hi,
>>
>> I missed the hook declarations in my previous
>> script. This is added by the patch below.
>>
>> The patch also removes unneeded ; that slipped
>> in because I use c a lot more than awk :)
>>
>> I moved a rule around so removal of leading
>> whitespace could go into one rule
>> (see AP[RU]?_DECLARE).
>>
>> Also removed the additional idx variable in
>> favor of checking the return value of the
>> index function.

"Jeff Trawick" <tr...@apache.org> writes:
> For reasons I don't understand I wasn't able to apply the patch.
>
> Do you think it might fix this problem (seen on Solaris 8 Intel)?
>
> make[2]: Entering directory `/export/home/trawick/apache/httpd-2.0/server'
> nawk -f
> /export/home/trawick/apache/httpd-2.0/build/make_exports.awk
> /export/home/trawick/apache/httpd-2.0/include/*.h
> /export/home/trawick/apache/httpd-2.0/srclib/apr/include/*.h
> /export/home/trawick/apache/httpd-2.0/srclib/apr-util/include/*.h
> > exports.c
> nawk: syntax error in regular expression ([^ ]* ^([     ]*[(]))*
> at ([  ]*[(]))*
>  source line number 85
>  context is
>             sub("([^ ]* ^([ \t]*[(]))*", >>>  "") <<< ;
> make[2]: *** [exports.c] Error 2

No, line 85 reads:
    sub("([^ ]* ^([ \t]*[(]))*", "");

I only removed the trailing ; in the patch.

The line is valid in gawk.  Could someone please check mawk?
Aparently, nawk doesn't like it.


Sander


Re: [PATCH] make_exports.awk

Posted by Jeff Trawick <tr...@attglobal.net>.
"Sander Striker" <st...@apache.org> writes:

> Hi,
> 
> I missed the hook declarations in my previous
> script. This is added by the patch below.
> 
> The patch also removes unneeded ; that slipped
> in because I use c a lot more than awk :)
> 
> I moved a rule around so removal of leading
> whitespace could go into one rule 
> (see AP[RU]?_DECLARE).
> 
> Also removed the additional idx variable in
> favor of checking the return value of the
> index function.

For reasons I don't understand I wasn't able to apply the patch.

Do you think it might fix this problem (seen on Solaris 8 Intel)? 

make[2]: Entering directory `/export/home/trawick/apache/httpd-2.0/server'
nawk -f /export/home/trawick/apache/httpd-2.0/build/make_exports.awk /export/home/trawick/apache/httpd-2.0/include/*.h /export/home/trawick/apache/httpd-2.0/srclib/apr/include/*.h /export/home/trawick/apache/httpd-2.0/srclib/apr-util/include/*.h > exports.c
nawk: syntax error in regular expression ([^ ]* ^([     ]*[(]))* at ([  ]*[(]))*
 source line number 85
 context is
            sub("([^ ]* ^([ \t]*[(]))*", >>>  "") <<< ;
make[2]: *** [exports.c] Error 2 

-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...