mbed TLS Build

Dependents:   Encrypt_Decrypt1 mbed_blink_tls encrypt encrypt

Committer:
markrad
Date:
Thu Jan 05 00:18:44 2017 +0000
Revision:
0:cdf462088d13
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
markrad 0:cdf462088d13 1 #!/usr/bin/perl
markrad 0:cdf462088d13 2
markrad 0:cdf462088d13 3 use warnings;
markrad 0:cdf462088d13 4 use strict;
markrad 0:cdf462088d13 5
markrad 0:cdf462088d13 6 use utf8;
markrad 0:cdf462088d13 7 use open qw(:std utf8);
markrad 0:cdf462088d13 8
markrad 0:cdf462088d13 9 -d 'include/mbedtls' or die "$0: must be run from root\n";
markrad 0:cdf462088d13 10
markrad 0:cdf462088d13 11 @ARGV = grep { ! /compat-1\.3\.h/ } <include/mbedtls/*.h>;
markrad 0:cdf462088d13 12
markrad 0:cdf462088d13 13 my @consts;
markrad 0:cdf462088d13 14 my $state = 'out';
markrad 0:cdf462088d13 15 while (<>)
markrad 0:cdf462088d13 16 {
markrad 0:cdf462088d13 17 if( $state eq 'out' and /^(typedef )?enum \{/ ) {
markrad 0:cdf462088d13 18 $state = 'in';
markrad 0:cdf462088d13 19 } elsif( $state eq 'out' and /^(typedef )?enum/ ) {
markrad 0:cdf462088d13 20 $state = 'start';
markrad 0:cdf462088d13 21 } elsif( $state eq 'start' and /{/ ) {
markrad 0:cdf462088d13 22 $state = 'in';
markrad 0:cdf462088d13 23 } elsif( $state eq 'in' and /}/ ) {
markrad 0:cdf462088d13 24 $state = 'out';
markrad 0:cdf462088d13 25 } elsif( $state eq 'in' ) {
markrad 0:cdf462088d13 26 s/=.*//; s!/\*.*!!; s/,.*//; s/\s+//g; chomp;
markrad 0:cdf462088d13 27 push @consts, $_ if $_;
markrad 0:cdf462088d13 28 }
markrad 0:cdf462088d13 29 }
markrad 0:cdf462088d13 30
markrad 0:cdf462088d13 31 open my $fh, '>', 'enum-consts' or die;
markrad 0:cdf462088d13 32 print $fh "$_\n" for sort @consts;
markrad 0:cdf462088d13 33 close $fh or die;
markrad 0:cdf462088d13 34
markrad 0:cdf462088d13 35 printf "%8d enum-consts\n", scalar @consts;