diff options
author | William Wilgus <me.theuser@yahoo.com> | 2019-07-18 09:41:38 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2019-07-18 10:53:34 -0500 |
commit | d5908f520e8b21091766076584c9f582dbcdae1c (patch) | |
tree | 58a071e1c014b6157dfb54d45a81a40a25b7ab63 /apps/plugins | |
parent | c9aeb4284e6456b8ca846f2bdfcd8f68d6ecd7b8 (diff) |
Fix Red lua move constants out of binary image
didn't consider sims might have reserved enums
Change-Id: Ic404972f0836bc81ba149f4ecdd3ec61bd8bd4b3
Diffstat (limited to 'apps/plugins')
-rwxr-xr-x | apps/plugins/lua/rbdefines_helper.pl | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/apps/plugins/lua/rbdefines_helper.pl b/apps/plugins/lua/rbdefines_helper.pl index 671936962e..f15cc71d36 100755 --- a/apps/plugins/lua/rbdefines_helper.pl +++ b/apps/plugins/lua/rbdefines_helper.pl @@ -47,7 +47,10 @@ my @all_defines; my $def_regex = qr/#define\s+([^\s\r\n]+)\s+([^\r\n]+)/; my $quot_regex = qr/.*([\"\']).*/; my $num_regex = qr/.*([\+\-\*\\|&\d]).*/; - +my $configh_regex = qr/^\s*#define\s*__CONFIG_H__\s*$/; +my $config_h = "?"; +my $exclude_regex = qr/^#define\s*_?POSIX.*/; +my $exclude_enum_regex = qr/^#define\s*(_SC_|_PC_|_CS_).*/; print <<EOF #include <stdio.h> #include <stdbool.h> @@ -62,7 +65,10 @@ EOF while(my $line = <STDIN>) { - + if($config_h eq "?" && $line =~ $configh_regex) { $config_h = $line; } + next if($config_h eq "?"); #don't capture till we get to the config file + next if($line =~ $exclude_regex); + if($line =~ $def_regex) #does it begin with #define? { push(@all_defines, $line); #save all defines for possible ambiguous macros @@ -85,12 +91,14 @@ while(my $line = <STDIN>) } elsif($line =~ /^(?!.*;)enum.*{/) #enum { { + next if($line =~ /enum\s*__.*/); #don't add reserved print $line; next if($line =~ /.*};.*/); do_enum($line) } elsif($line =~ /^(?!.*[;\(\)])enum.*/) #enum { + next if($line =~ /enum\s*__.*/); #don't add reserved #need to be careful might be a function returning enum my $lastline = $line; next if($line =~ /.*};.*/); @@ -105,7 +113,8 @@ while(my $line = <STDIN>) } } - +#warn "total defines: ".scalar @all_defines; +#warn "captured defines: ".scalar @captured_defines; #Sort the functions my @sorted_defines = sort { @$a{'name'} cmp @$b{'name'} } @captured_defines; @@ -176,7 +185,7 @@ sub do_enum { while($line = <STDIN>) { - + next if($line =~ $exclude_enum_regex); if($line =~ /.*};.*/) { print $line; |