summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2005-09-30 13:30:31 +0000
committerfukachan <fukachan>2005-09-30 13:30:31 +0000
commitea49a7e4f8fc9ee5cb3a54083577fdef30e125fa (patch)
tree0d8f7fbaecbd8fd0e251681455b6bc75e960f38f
parentfa4fd9580a9b791218e327770ce99f4b59a464b2 (diff)
downloadfml8-snap-20050930.tar.gz
fml8-snap-20050930.tar.bz2
fml8-snap-20050930.zip
regress documentsnap-20050930
-rwxr-xr-xregress/doc/check.pl83
-rwxr-xr-xregress/doc/edit.pl83
2 files changed, 166 insertions, 0 deletions
diff --git a/regress/doc/check.pl b/regress/doc/check.pl
new file mode 100755
index 00000000..6506d821
--- /dev/null
+++ b/regress/doc/check.pl
@@ -0,0 +1,83 @@
+#!/usr/bin/env perl
+#-*- perl -*-
+#
+# $FML$
+#
+
+use strict;
+use Carp;
+use vars qw(%entity %file %used %file_in_dir);
+
+my $entity = "include/chapters.ent";
+parse($entity);
+parse("book.sgml");
+files();
+compare();
+
+exit 0;
+
+sub parse
+{
+ my ($file) = @_;
+
+ use FileHandle;
+ my $rh = new FileHandle $file;
+ if (defined $rh) {
+ my $buf;
+ while ($buf = <$rh>) {
+ # <!entity chapter.download SYSTEM "install/download.sgml">
+ if ($buf =~ /<\!entity\s+(\S+)\s+SYSTEM\s+"(\S+)">/) {
+ $entity{ $1 } = $2;
+ $file{ $2 } = $1;
+ }
+
+ # usual file
+ if ($buf =~ /\&(\S+);/) {
+ $used{ $1 } = 1;
+ my $_file = $entity{ $1 } || '';
+ if ($_file && -f $_file) {
+ parse($_file);
+ }
+ }
+ }
+ $rh->close();
+ }
+ else {
+ croak("cannot open \"$file\"\n");
+ }
+}
+
+
+sub files
+{
+ for my $f (<*.sgml>, <*/*.sgml>) {
+ $file_in_dir{ $f } = 1;
+ }
+}
+
+
+sub compare
+{
+ print "\n[ENTITY]\n";
+ for my $k (keys %entity) {
+ unless ($used{ $k }) {
+ print " NOT USED: $k\n";
+ }
+ else {
+ print " USED: $k\n" if 0;
+ }
+ }
+
+ print "\n[FILE]\n";
+ FILE:
+ for my $f (keys %file_in_dir) {
+ next FILE if $f eq 'book.sgml';
+
+ unless ($file{ $f }) {
+ print "NOT DEFINED: $f\n";
+ }
+ else {
+ print " DEFINED: $f\n" if 0;
+ }
+ }
+}
diff --git a/regress/doc/edit.pl b/regress/doc/edit.pl
new file mode 100755
index 00000000..b328bf92
--- /dev/null
+++ b/regress/doc/edit.pl
@@ -0,0 +1,83 @@
+#!/usr/bin/env perl
+#-*- perl -*-
+#
+# $FML$
+#
+
+use strict;
+use Carp;
+
+for my $f (@ARGV) {
+ edit(parse($f));
+}
+
+exit 0;
+
+sub parse
+{
+ my ($f) = @_;
+
+ use File::Spec;
+ my $ja = File::Spec->catfile("ja", $f);
+ my $en = File::Spec->catfile("en", $f);
+ return(($ja, $en));
+}
+
+sub edit
+{
+ my (@f) = @_;
+ my $editor = $ENV{'FML_EMUL_EDITOR'} || $ENV{'EDITOR'} || "vi";
+ chdir "../../fml/doc" || exit 1;
+ print STDERR join(" ", $editor, @f), "\n";
+
+ for my $f (@f) {
+ if (! -f $f || -z $f) {
+ use FileHandle;
+ my $wh = new FileHandle "> $f";
+ if (defined $wh) {
+ _print_template($wh);
+ $wh->close();
+ }
+ }
+ }
+
+ system $editor, @f;
+}
+
+sub _print_template
+{
+ my ($wh) = @_;
+
+ print $wh <<_EOF_;
+<!--
+ \$FML\$
+-->
+
+<qandaset>
+
+
+<qandaentry>
+
+<question>
+<para>
+
+</para>
+</question>
+
+<answer>
+<para>
+
+<screen>
+
+</screen>
+
+</para>
+</answer>
+
+</qandaentry>
+
+
+</qandaset>
+
+_EOF_
+}