12
12
my $mylib ;
13
13
my $myprefix ;
14
14
my $mysuffix ;
15
+ my $mycapprefix ;
15
16
16
17
# Set to true if the script should merely check for symbols in
17
18
# the library that are not in the provided output file - useful
@@ -63,6 +64,8 @@ sub quiet_print {
63
64
64
65
# -------------------------------------------------------------------------------
65
66
67
+ $mycapprefix = uc $myprefix ;
68
+
66
69
# get the symbol output for this lib
67
70
my $output = qx( nm $mylib ) ;
68
71
@@ -84,8 +87,7 @@ sub quiet_print {
84
87
# next token indicates a public symbol by
85
88
# being a 'T' or a 'B'
86
89
$val = shift (@values );
87
- if (" T" eq $val || " B" eq $val || " D" eq $val ||
88
- " t" eq $val || " b" eq $val || " d" eq $val ) {
90
+ if (" T" eq $val || " B" eq $val || " D" eq $val ) {
89
91
$val = shift (@values );
90
92
# if this symbol contains a '.', then we
91
93
# need to ignore it
@@ -105,10 +107,24 @@ sub quiet_print {
105
107
if ($myfile ne " " ) {
106
108
open FILE, " >$myfile " || die " file could not be opened" ;
107
109
}
110
+ sub checkCase {
111
+ if ($_ [0] =~ / ^[[:upper:]]/ ) {
112
+ return 1;
113
+ }
114
+ else {
115
+ return 0;
116
+ }
117
+ }
118
+
108
119
foreach my $sym (@symbols ) {
109
120
my $out ;
110
121
if ($REVERSE ) {
111
- $out = " #define " . $myprefix . $sym . $mysuffix ;
122
+ # if the first char is a cap, then use the cap prefix
123
+ if (checkCase($sym )) {
124
+ $out = " #define " . $mycapprefix . $sym . $mysuffix ;
125
+ } else {
126
+ $out = " #define " . $myprefix . $sym . $mysuffix ;
127
+ }
112
128
} else {
113
129
$out = " #define " . $sym ;
114
130
}
@@ -119,7 +135,12 @@ sub quiet_print {
119
135
if ($REVERSE ) {
120
136
$out = $out . $sym . " \n " ;
121
137
} else {
122
- $out = $out . $myprefix . $sym . $mysuffix . " \n " ;
138
+ # if the first char is a cap, then use the cap prefix
139
+ if (checkCase($sym )) {
140
+ $out = $out . $mycapprefix . $sym . $mysuffix . " \n " ;
141
+ } else {
142
+ $out = $out . $myprefix . $sym . $mysuffix . " \n " ;
143
+ }
123
144
}
124
145
if ($myfile ne " " ) {
125
146
print FILE $out ;
0 commit comments