#! @PERL@ #-*- perl -*- (for *.in) # # Show those *.Rd files which do NOT have a \keyword{.} # use Getopt::Long; use File::Basename; use Cwd; $cwd=getcwd(); if($ENV{"RHOME"}){ $RHOME=$ENV{"RHOME"}; } else{ chdir(dirname($0) . "/.."); $RHOME=getcwd(); } chdir($cwd); require "$RHOME/etc/Rdconvlib.pl"; @knownoptions = ("debug|d", "help|h"); GetOptions (@knownoptions) || usage(); usage() if $opt_help; print stderr "RHOME: '$RHOME'; cwd='$cwd'\n" if $opt_debug; ## file: while ($file = shift @ARGV) { if(!open(RD, $file)) { warn "couldn't open file '$file':$!\n"; next file; } $max_bracket = 0; $max_section = 0; undef $complete_text; undef %blocks; undef @section_body; undef @section_title; #-- remove comments (everything after a %) while(){ while(s/^\\%|([^\\])\\%/$1escaped_percent_sign/go){}; s/^([^%]*)%.*$/$1/o; s/escaped_percent_sign/\\%/go; $complete_text = "$complete_text$_"; } mark_brackets(); escape_codes(); if(@keywords= get_multi($complete_text,"keyword")) { if($opt_debug) { print STDERR "$file: Keywords="; &print_vec(STDERR, 'keywords'); } } else { ##-- NO Keywords! print "$file\n"; ##--- The file without keyword } } sub usage { print "keyword-test [ -d(ebug) ] [ -h(elp) ] __.Rd-files__ \n"; print "Example: $0 ../src/library/base/eda/*.Rd\n\n"; exit 0; }