|
Packit |
90a5c9 |
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
Packit |
90a5c9 |
# contributor license agreements. See the NOTICE file distributed with
|
|
Packit |
90a5c9 |
# this work for additional information regarding copyright ownership.
|
|
Packit |
90a5c9 |
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
Packit |
90a5c9 |
# (the "License"); you may not use this file except in compliance with
|
|
Packit |
90a5c9 |
# the License. You may obtain a copy of the License at
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# Unless required by applicable law or agreed to in writing, software
|
|
Packit |
90a5c9 |
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
90a5c9 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
90a5c9 |
# See the License for the specific language governing permissions and
|
|
Packit |
90a5c9 |
# limitations under the License.
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# Based on apr's make_export.awk, which is
|
|
Packit |
90a5c9 |
# based on Ryan Bloom's make_export.pl
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/^#[ \t]*if(def)? (AP[RU]?_|!?defined).*/ {
|
|
Packit |
90a5c9 |
if (old_filename != FILENAME) {
|
|
Packit |
90a5c9 |
if (old_filename != "") printf("%s", line)
|
|
Packit |
90a5c9 |
macro_no = 0
|
|
Packit |
90a5c9 |
found = 0
|
|
Packit |
90a5c9 |
count = 0
|
|
Packit |
90a5c9 |
old_filename = FILENAME
|
|
Packit |
90a5c9 |
line = ""
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
macro_stack[macro_no++] = macro
|
|
Packit |
90a5c9 |
macro = substr($0, length($1)+2)
|
|
Packit |
90a5c9 |
count++
|
|
Packit |
90a5c9 |
line = line "#ifdef " macro "\n"
|
|
Packit |
90a5c9 |
next
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/^#[ \t]*endif/ {
|
|
Packit |
90a5c9 |
if (count > 0) {
|
|
Packit |
90a5c9 |
count--
|
|
Packit |
90a5c9 |
line = line "#endif /* " macro " */\n"
|
|
Packit |
90a5c9 |
macro = macro_stack[--macro_no]
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
if (count == 0) {
|
|
Packit |
90a5c9 |
if (found != 0) {
|
|
Packit |
90a5c9 |
printf("%s", line)
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
line = ""
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
next
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
function add_symbol (sym_name) {
|
|
Packit |
90a5c9 |
if (count) {
|
|
Packit |
90a5c9 |
found++
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
for (i = 0; i < count; i++) {
|
|
Packit |
90a5c9 |
line = line "\t"
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
line = line sym_name "\n"
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
if (count == 0) {
|
|
Packit |
90a5c9 |
printf("%s", line)
|
|
Packit |
90a5c9 |
line = ""
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/^[ \t]*(extern[ \t]+)?AP[RU]?_DECLARE_DATA .*;$/ {
|
|
Packit |
90a5c9 |
varname = $NF;
|
|
Packit |
90a5c9 |
gsub( /[*;]/, "", varname);
|
|
Packit |
90a5c9 |
gsub( /\[.*\]/, "", varname);
|
|
Packit |
90a5c9 |
add_symbol(varname);
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
END {
|
|
Packit |
90a5c9 |
printf("%s", line)
|
|
Packit |
90a5c9 |
}
|