Use regex pattern understood by all known awk variants.

Ubuntu uses mawk by default, but it doesn't understand posix character
classes (which are locale dependent, and this patch uses only valid C
identifiers).
  Also make sure awk runs with LC_ALL=C to match the regex patterns.
This commit is contained in:
Paulo Cesar Pereira de Andrade 2008-12-18 15:00:25 -02:00
parent 3d3c234b43
commit 9e4ef3cfe5

View File

@ -321,6 +321,8 @@ EOF
topdir=$1
shift
LC_ALL=C
export LC_ALL
cpp -DXorgLoader $@ sdksyms.c | awk -v topdir=$topdir '
BEGIN {
sdk = 0;
@ -339,7 +341,7 @@ BEGIN {
sdk = $3 !~ /^"\// || index($3, topdir) == 2;
}
/^extern[[:space:]]/ {
/^extern[ ]/ {
if (sdk) {
n = 3;
@ -353,17 +355,17 @@ BEGIN {
# type specifier may not be set, as in
# extern _X_EXPORT unsigned name(...)
if ($n !~ /[^[:alnum:]_]/)
if ($n !~ /[^a-zA-Z0-9_]/)
n++;
# match
# extern _X_EXPORT type (* name[])(...)
if ($n ~ /^[^[:alnum:]_]+$/)
if ($n ~ /^[^a-zA-Z0-9_]+$/)
n++;
# match
# extern _X_EXPORT const name *const ...
if ($n ~ /^([^[:alnum:]_]+)?const$/)
if ($n ~ /^([^a-zA-Z0-9_]+)?const$/)
n++;
# actual name may be in the next line, as in
@ -379,10 +381,10 @@ BEGIN {
symbol = $n;
# remove starting non word chars
sub(/^[^[:alnum:]_]+/, "",symbol);
sub(/^[^a-zA-Z0-9_]+/, "",symbol);
# remove from first non word to end of line
sub(/[^[:alnum:]_].*/, "", symbol);
sub(/[^a-zA-Z0-9_].*/, "", symbol);
#print;
printf(" &%s,\n", symbol);