Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions helper.pl
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,30 @@ sub check_comments {
return $fails;
}

sub check_doc {
my $fails = 0;
my $tex = read_file('doc/bn.tex');
my $tmh = read_file('tommath.h');
my @functions = $tmh =~ /\n\s*[a-zA-Z0-9_* ]+?(mp_[a-z0-9_]+)\s*\([^\)]+\)\s*;/sg;
my @macros = $tmh =~ /\n\s*#define\s+([a-z0-9_]+)\s*\([^\)]+\)/sg;
for my $n (sort @functions) {
(my $nn = $n) =~ s/_/\\_/g; # mp_sub_d >> mp\_sub\_d
if ($tex !~ /index\Q{$nn}\E/) {
warn "[missing_doc_for_function] $n\n";
$fails++
}
}
for my $n (sort @macros) {
(my $nn = $n) =~ s/_/\\_/g; # mp_iszero >> mp\_iszero
if ($tex !~ /index\Q{$nn}\E/) {
warn "[missing_doc_for_macro] $n\n";
$fails++
}
}
warn( $fails > 0 ? "check_doc: FAIL $fails\n" : "check-doc: PASS\n" );
return $fails;
}

sub prepare_variable {
my ($varname, @list) = @_;
my $output = "$varname=";
Expand Down Expand Up @@ -275,6 +299,7 @@ sub die_usage {
GetOptions( "s|check-source" => \my $check_source,
"o|check-comments" => \my $check_comments,
"m|check-makefiles" => \my $check_makefiles,
"d|check-doc" => \my $check_doc,
"a|check-all" => \my $check_all,
"u|update-makefiles" => \my $update_makefiles,
"h|help" => \my $help
Expand All @@ -283,6 +308,7 @@ sub die_usage {
my $failure;
$failure ||= check_source() if $check_all || $check_source;
$failure ||= check_comments() if $check_all || $check_comments;
$failure ||= check_doc() if $check_doc; # temporarily excluded from --check-all
$failure ||= process_makefiles(0) if $check_all || $check_makefiles;
$failure ||= process_makefiles(1) if $update_makefiles;

Expand Down