aboutsummaryrefslogtreecommitdiffstats
path: root/roms/skiboot/libstb/crypto/mbedtls/tests/scripts/list-enum-consts.pl
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/skiboot/libstb/crypto/mbedtls/tests/scripts/list-enum-consts.pl
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/skiboot/libstb/crypto/mbedtls/tests/scripts/list-enum-consts.pl')
-rwxr-xr-xroms/skiboot/libstb/crypto/mbedtls/tests/scripts/list-enum-consts.pl35
1 files changed, 35 insertions, 0 deletions
diff --git a/roms/skiboot/libstb/crypto/mbedtls/tests/scripts/list-enum-consts.pl b/roms/skiboot/libstb/crypto/mbedtls/tests/scripts/list-enum-consts.pl
new file mode 100755
index 000000000..21c25b33e
--- /dev/null
+++ b/roms/skiboot/libstb/crypto/mbedtls/tests/scripts/list-enum-consts.pl
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+use utf8;
+use open qw(:std utf8);
+
+-d 'include/mbedtls' or die "$0: must be run from root\n";
+
+@ARGV = grep { ! /compat-1\.3\.h/ } <include/mbedtls/*.h>;
+
+my @consts;
+my $state = 'out';
+while (<>)
+{
+ if( $state eq 'out' and /^(typedef )?enum \{/ ) {
+ $state = 'in';
+ } elsif( $state eq 'out' and /^(typedef )?enum/ ) {
+ $state = 'start';
+ } elsif( $state eq 'start' and /{/ ) {
+ $state = 'in';
+ } elsif( $state eq 'in' and /}/ ) {
+ $state = 'out';
+ } elsif( $state eq 'in' ) {
+ s/=.*//; s!/\*.*!!; s/,.*//; s/\s+//g; chomp;
+ push @consts, $_ if $_;
+ }
+}
+
+open my $fh, '>', 'enum-consts' or die;
+print $fh "$_\n" for sort @consts;
+close $fh or die;
+
+printf "%8d enum-consts\n", scalar @consts;