summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2010-10-14 16:03:47 +0000
committerNorbert Preining <preining@logic.at>2010-10-14 16:03:47 +0000
commitb71505ef4cfd8d30c679b642234e8d49334f3378 (patch)
treed2f8b343bbea555af1d4c8350b16242faf7f9691
parent882710582852ceb95e84df73e6d197503c06cfc7 (diff)
fixes for parse-texcatalogue-keywords and add infos how to read
the dump back in git-svn-id: svn://tug.org/texlive/trunk@20096 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/tlpkg/bin/parse-texcatalogue-keywords44
1 files changed, 33 insertions, 11 deletions
diff --git a/Master/tlpkg/bin/parse-texcatalogue-keywords b/Master/tlpkg/bin/parse-texcatalogue-keywords
index 0dc78558681..281542022cc 100755
--- a/Master/tlpkg/bin/parse-texcatalogue-keywords
+++ b/Master/tlpkg/bin/parse-texcatalogue-keywords
@@ -9,10 +9,13 @@
$^W = 1;
use strict;
+
+
use XML::Parser;
use XML::XPath;
use XML::XPath::XMLParser;
use Text::Unidecode;
+use Data::Dumper;
my $tcfile;
if (@ARGV) {
@@ -26,13 +29,30 @@ my %kw_pkg;
my %cz_pkg;
parse_texcatalogue($tcfile);
-print_keywords();
-print "\n===================\nprimary characterizations\n";
-walk_cz_tree($cz_pkg{'primary'}, "PRIM");
-print "\n===================\nsecondary characterizations\n";
-walk_cz_tree($cz_pkg{'secondary'}, "SEC");
-print "\n===================\nby-function characterizations\n";
-walk_cz_tree($cz_pkg{'by-function'}, "BFUNC");
+
+$Data::Dumper::Indent = 1;
+print Data::Dumper->Dump([\%seikaku, \%kw_pkg, \%cz_pkg],
+ ["seikaku", "kw_pkg", "cz_pkg"]), $/;
+
+
+# how to read in!!!
+#my $seikaku;
+#my $kw_pkg;
+#my $cz_pkg;
+#my $foo = `cat tc-dump`;
+# the no strict "vars" is *ABSOLUT* necessary otherwise the file is not
+# evaluated, no idea why!
+#no strict "vars";
+#eval "$foo";
+#use strict "vars";
+#
+#print_keywords($kw_pkg);
+#print "\n===================\nprimary characterizations\n";
+#walk_cz_tree($cz_pkg->{'primary'}, "PRIM");
+#print "\n===================\nsecondary characterizations\n";
+#walk_cz_tree($cz_pkg->{'secondary'}, "SEC");
+#print "\n===================\nby-function characterizations\n";
+#walk_cz_tree($cz_pkg->{'by-function'}, "BFUNC");
##### only subs from here ##########
@@ -62,11 +82,11 @@ sub parse_texcatalogue {
foreach my $e ($parser->find('/fullcat/catalogue/entry')->get_nodelist) {
- my $pkg = $parser->findvalue('./name',$e);
+ my $pkg = $parser->findvalue('./name',$e)->value();
#print "FOUND: $pkg\n";
my $n = $parser->find('./keyword',$e);
for my $kw ($n->get_nodelist) {
- my $kwval = $parser->find('./@keyword',$kw);
+ my $kwval = $parser->find('./@keyword',$kw)->string_value();
push @{$seikaku{'keyword'}{$pkg}}, $kwval;
#print "keyword = $kwval\n";
}
@@ -130,8 +150,9 @@ sub parse_characterizations {
sub print_keywords {
- for my $k (keys %kw_pkg) {
- my @pkgl = @{$kw_pkg{$k}};
+ my $kw_pkg = shift;
+ for my $k (keys %$kw_pkg) {
+ my @pkgl = @{$kw_pkg->{$k}};
if (defined(@pkgl)) {
print "keyword = $k\n package = @pkgl\n";
} else {
@@ -140,6 +161,7 @@ sub print_keywords {
}
}
+
sub walk_cz_tree {
my $cp = shift;
my $prestring = shift;