Merge pull request #315 from libtom/perl-generate-def

remove generate_def.sh, move code to helper.pl
This commit is contained in:
Steffen Jaeckel 2019-06-07 08:27:48 +02:00 committed by GitHub
commit f1097727f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 27 deletions

View File

@ -1,9 +0,0 @@
echo "; libtommath" >tommath.def
echo ";" >>tommath.def
echo "; Use this command to produce a 32-bit .lib file, for use in any MSVC version" >>tommath.def
echo "; lib -machine:X86 -name:libtommath.dll -def:tommath.def -out:tommath.lib" >>tommath.def
echo "; Use this command to produce a 64-bit .lib file, for use in any MSVC version" >>tommath.def
echo "; lib -machine:X64 -name:libtommath.dll -def:tommath.def -out:tommath.lib" >>tommath.def
echo ";" >>tommath.def
echo "EXPORTS" >>tommath.def
git ls-files|grep \\.c|sed -e 's/bn_mp_rand/bn_mp_rand\nbn_mp_rand_digit/'|sed -e 's/bn_conversion/bn_mp_set_i32\nbn_mp_set_i64\nbn_mp_set_u32\nbn_mp_set_u64\nbn_mp_set_int\nbn_mp_set_long\nbn_mp_set_long_long\nbn_mp_get_i32\nbn_mp_get_i64\nbn_mp_get_mag32\nbn_mp_get_mag64\nbn_mp_get_int\nbn_mp_get_long\nbn_mp_get_long_long\nbn_mp_init_i32\nbn_mp_init_i64\nbn_mp_init_u32\nbn_mp_init_u64\nbn_mp_init_set_int/'|grep -v bn_mp_radix_smap|grep bn_mp_|sort|sed -e 's/bn_/ /g'|sed -e 's/\.c//g'>>tommath.def

View File

@ -437,7 +437,26 @@ EOS
} }
sub generate_def { sub generate_def {
system("sh", "generate_def.sh"); my @files = split /\n/, `git ls-files`;
@files = grep(/\.c/, @files);
@files = map { my $x = $_; $x =~ s/^bn_|\.c$//g; $x; } @files;
@files = grep(!/mp_radix_smap/, @files);
@files = grep(!/conversion/, @files);
push(@files, qw(mp_set_i32 mp_set_i64 mp_set_u32 mp_set_u64 mp_set_int mp_set_long mp_set_long_long mp_get_i32 mp_get_i64 mp_get_mag32 mp_get_mag64 mp_get_int mp_get_long mp_get_long_long mp_init_i32 mp_init_i64 mp_init_u32 mp_init_u64 mp_init_set_int));
my $files = join("\n ", sort(grep(/^mp_/, @files)));
write_file "tommath.def", "; libtommath
;
; Use this command to produce a 32-bit .lib file, for use in any MSVC version
; lib -machine:X86 -name:libtommath.dll -def:tommath.def -out:tommath.lib
; Use this command to produce a 64-bit .lib file, for use in any MSVC version
; lib -machine:X64 -name:libtommath.dll -def:tommath.def -out:tommath.lib
;
EXPORTS
$files
";
return 0;
} }
sub die_usage { sub die_usage {
@ -446,7 +465,7 @@ usage: $0 -s OR $0 --check-source
$0 -o OR $0 --check-comments $0 -o OR $0 --check-comments
$0 -m OR $0 --check-makefiles $0 -m OR $0 --check-makefiles
$0 -a OR $0 --check-all $0 -a OR $0 --check-all
$0 -u OR $0 --update-makefiles $0 -u OR $0 --update-files
MARKER MARKER
} }
@ -455,7 +474,7 @@ GetOptions( "s|check-source" => \my $check_source,
"m|check-makefiles" => \my $check_makefiles, "m|check-makefiles" => \my $check_makefiles,
"d|check-doc" => \my $check_doc, "d|check-doc" => \my $check_doc,
"a|check-all" => \my $check_all, "a|check-all" => \my $check_all,
"u|update-makefiles" => \my $update_makefiles, "u|update-files" => \my $update_files,
"h|help" => \my $help "h|help" => \my $help
) or die_usage; ) or die_usage;
@ -464,9 +483,9 @@ $failure ||= check_source() if $check_all || $check_source;
$failure ||= check_comments() if $check_all || $check_comments; $failure ||= check_comments() if $check_all || $check_comments;
$failure ||= check_doc() if $check_doc; # temporarily excluded from --check-all $failure ||= check_doc() if $check_doc; # temporarily excluded from --check-all
$failure ||= process_makefiles(0) if $check_all || $check_makefiles; $failure ||= process_makefiles(0) if $check_all || $check_makefiles;
$failure ||= process_makefiles(1) if $update_makefiles; $failure ||= process_makefiles(1) if $update_files;
$failure ||= update_dep() if $update_makefiles; $failure ||= update_dep() if $update_files;
$failure ||= generate_def() if $update_makefiles; $failure ||= generate_def() if $update_files;
die_usage unless defined $failure; die_usage unless defined $failure;
exit $failure ? 1 : 0; exit $failure ? 1 : 0;

View File

@ -149,7 +149,7 @@ zipup: clean astyle new_file manual poster docs
gpg -b -a ltm-$(VERSION).zip gpg -b -a ltm-$(VERSION).zip
new_file: new_file:
perl helper.pl --update-makefiles perl helper.pl --update-files
perlcritic: perlcritic:
perlcritic *.pl doc/*.pl perlcritic *.pl doc/*.pl

View File

@ -295,8 +295,8 @@ if [[ "$CHECK_FORMAT" == "1" ]]
then then
make astyle make astyle
_check_git "make astyle" _check_git "make astyle"
perl helper.pl --update-makefiles perl helper.pl --update-files
_check_git "helper.pl --update-makefiles" _check_git "helper.pl --update-files"
perl helper.pl --check-all perl helper.pl --check-all
_check_git "helper.pl --check-all" _check_git "helper.pl --check-all"
exit $? exit $?

17
tommath.def Executable file → Normal file
View File

@ -23,10 +23,10 @@ EXPORTS
mp_copy mp_copy
mp_count_bits mp_count_bits
mp_decr mp_decr
mp_div
mp_div_2 mp_div_2
mp_div_2d mp_div_2d
mp_div_3 mp_div_3
mp_div
mp_div_d mp_div_d
mp_dr_is_modulus mp_dr_is_modulus
mp_dr_reduce mp_dr_reduce
@ -63,25 +63,25 @@ EXPORTS
mp_init_u32 mp_init_u32
mp_init_u64 mp_init_u64
mp_invmod mp_invmod
mp_is_square
mp_iseven mp_iseven
mp_isodd mp_isodd
mp_is_square
mp_kronecker mp_kronecker
mp_lcm mp_lcm
mp_lshd mp_lshd
mp_mod_2d
mp_mod mp_mod
mp_mod_2d
mp_mod_d mp_mod_d
mp_montgomery_calc_normalization mp_montgomery_calc_normalization
mp_montgomery_reduce mp_montgomery_reduce
mp_montgomery_setup mp_montgomery_setup
mp_mul
mp_mul_2 mp_mul_2
mp_mul_2d mp_mul_2d
mp_mul
mp_mul_d mp_mul_d
mp_mulmod mp_mulmod
mp_neg
mp_n_root mp_n_root
mp_neg
mp_or mp_or
mp_prime_fermat mp_prime_fermat
mp_prime_frobenius_underwood mp_prime_frobenius_underwood
@ -93,15 +93,14 @@ EXPORTS
mp_prime_strong_lucas_selfridge mp_prime_strong_lucas_selfridge
mp_radix_size mp_radix_size
mp_rand mp_rand
mp_rand_digit
mp_read_radix mp_read_radix
mp_read_signed_bin mp_read_signed_bin
mp_read_unsigned_bin mp_read_unsigned_bin
mp_reduce
mp_reduce_2k mp_reduce_2k
mp_reduce_2k_l mp_reduce_2k_l
mp_reduce_2k_setup mp_reduce_2k_setup
mp_reduce_2k_setup_l mp_reduce_2k_setup_l
mp_reduce
mp_reduce_is_2k mp_reduce_is_2k
mp_reduce_is_2k_l mp_reduce_is_2k_l
mp_reduce_setup mp_reduce_setup
@ -125,12 +124,12 @@ EXPORTS
mp_sub mp_sub
mp_sub_d mp_sub_d
mp_submod mp_submod
mp_toradix
mp_toradix_n
mp_to_signed_bin mp_to_signed_bin
mp_to_signed_bin_n mp_to_signed_bin_n
mp_to_unsigned_bin mp_to_unsigned_bin
mp_to_unsigned_bin_n mp_to_unsigned_bin_n
mp_toradix
mp_toradix_n
mp_unsigned_bin_size mp_unsigned_bin_size
mp_xor mp_xor
mp_zero mp_zero