summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm175
-rw-r--r--Master/tlpkg/TeXLive/TLPOBJ.pm194
2 files changed, 215 insertions, 154 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 3a05a3f2ff4..5614ff06d64 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -1282,64 +1282,13 @@ containing only those formats present in the installation.
=cut
sub fmtutil_cnf_lines {
my $self = shift;
- my @fmtlines = ();
-
- foreach my $pkg ($self->list_packages) {
- my $obj = $self->get_package ($pkg);
- die "No TeX Live package named $pkg, too strange" if ! $obj;
- my $first = 1;
- foreach my $e ($obj->executes) {
- if ($e =~ m/AddFormat\s+(.*)\s*/) {
- my $name;
- my $engine;
- my $patterns = "-";
- my $options = "";
- my $mode = "";
- if ($first) {
- push @fmtlines, "# from $pkg:\n";
- $first = 0;
- }
- foreach my $p (&TeXLive::TLUtils::quotewords('\s+', 0, "$1")) {
- # foreach my $p (split(' ', $1)) {
- my ($a, $b);
- if ($p =~ m/^(name|engine|mode|patterns|options)=(.*)$/) {
- $a = $1;
- $b = $2;
- } else {
- die "Unknown format directive in $pkg: $e";
- }
- if ($a eq "name") {
- die "AddFormat line needs name=something: $pkg, $e" unless $b;
- $name = $b; next;
- }
- if ($a eq "engine") {
- die "AddFormat line needs engine=something: $pkg, $e" unless $b;
- $engine = $b; next;
- }
- if ($a eq "patterns") {
- $patterns = ( $b ? $b : "-");
- next;
- }
- if ($a eq "mode") {
- if ($b eq "disabled") {
- $mode = "#! ";
- } else {
- $mode = "";
- }
- next;
- }
- if ($a eq "options") {
- $options = ( $b ? $b : "");
- next;
- }
- # should not be reached at all
- die "Unknown language directive in $pkg: $e";
- }
- push @fmtlines, "$mode$name $engine $patterns $options\n";
- }
- }
+ my @lines;
+ foreach my $p ($self->list_packages) {
+ my $obj = $self->get_package ($p);
+ die "$0: No TeX Live package named $p, strange" if ! $obj;
+ push @lines, $obj->fmtutil_cnf_lines;
}
- return @fmtlines;
+ return(@lines);
}
=item C<< $tlpdb->updmap_cfg_lines >>
@@ -1350,28 +1299,13 @@ containing only those maps present in the installation.
=cut
sub updmap_cfg_lines {
my $self = shift;
- my %maps;
+ my @lines;
foreach my $p ($self->list_packages) {
my $obj = $self->get_package ($p);
die "$0: No TeX Live package named $p, strange" if ! $obj;
- foreach my $e ($obj->executes) {
- if ($e =~ m/addMap (.*)$/) {
- $maps{$1} = 1;
- } elsif ($e =~ m/addMixedMap (.*)$/) {
- $maps{$1} = 2;
- }
- # others are ignored here
- }
- }
- my @updmaplines;
- foreach (sort keys %maps) {
- if ($maps{$_} == 2) {
- push @updmaplines, "MixedMap $_\n";
- } else {
- push @updmaplines, "Map $_\n";
- }
+ push @lines, $obj->updmap_cfg_lines;
}
- return(@updmaplines);
+ return(@lines);
}
=item C<< $tlpdb->language_dat_lines >>
@@ -1382,17 +1316,13 @@ lines for language.dat that can be generated from the tlpdb.
=cut
sub language_dat_lines {
- sub make_dat_lines {
- my ($name, $lhm, $rhm, $file, @syn) = @_;
- my @ret;
- push @ret, "$name $file\n";
- foreach (@syn) {
- push @ret, "=$_\n";
- }
- return(@ret);
- }
my $self = shift;
- my @lines = $self->_parse_hyphen_execute(\&make_dat_lines);
+ my @lines;
+ foreach my $p ($self->list_packages) {
+ my $obj = $self->get_package ($p);
+ die "$0: No TeX Live package named $p, strange" if ! $obj;
+ push @lines, $obj->language_dat_lines;
+ }
return(@lines);
}
@@ -1404,79 +1334,16 @@ lines for language.def that can be generated from the tlpdb.
=cut
sub language_def_lines {
- sub make_def_lines {
- my ($name, $lhm, $rhm, $file, @syn) = @_;
- my $exc = "";
- my @ret;
- push @ret, "\\addlanguage\{$name\}\{$file\}\{$exc\}\{$lhm\}\{$rhm\}\n";
- foreach (@syn) {
- # synonyms in language.def ???
- push @ret, "\\addlanguage\{$_\}\{$file\}\{$exc\}\{$lhm\}\{$rhm\}\n";
- #debug("Ignoring synonym $_ for $name when creating language.def\n");
- }
- return(@ret);
- }
my $self = shift;
- my @lines = $self->_parse_hyphen_execute(\&make_def_lines);
+ my @lines;
+ foreach my $p ($self->list_packages) {
+ my $obj = $self->get_package ($p);
+ die "$0: No TeX Live package named $p, strange" if ! $obj;
+ push @lines, $obj->language_def_lines;
+ }
return(@lines);
}
-
-
-sub _parse_hyphen_execute {
- my ($self, $coderef) = @_;
- my @langlines = ();
-
- foreach my $pkg ($self->list_packages) {
- my $obj = $self->get_package ($pkg);
- die "$0: No TeX Live package named $pkg, too strange" if ! $obj;
- my $first = 1;
- foreach my $e ($obj->executes) {
- if ($e =~ m/AddHyphen\s+(.*)\s*/) {
- my $name;
- my $lefthyphenmin;
- my $righthyphenmin;
- my $file;
- my @synonyms;
- if ($first) {
- push @langlines, "% from $pkg:\n";
- $first = 0;
- }
- foreach my $p (split(' ', $1)) {
- my ($a, $b) = split /=/, $p;
- if ($a eq "name") {
- die "$0: AddHyphen line needs name=something: $pkg, $e" unless $b;
- $name = $b; next;
- }
- if ($a eq "lefthyphenmin") {
- # lefthyphenmin default to 3
- $lefthyphenmin = ( $b ? $b : 2 );
- next;
- }
- if ($a eq "righthyphenmin") {
- $righthyphenmin = ( $b ? $b : 3);
- next;
- }
- if ($a eq "file") {
- die "$0: AddHyphen line needs file=something: $pkg, $e" unless $b;
- $file = $b;
- next;
- }
- if ($a eq "synonyms") {
- @synonyms = split /,/, $b;
- next;
- }
- die "$0: Unknown language directive in $pkg: $e";
- }
- my @foo = &$coderef ($name, $lefthyphenmin, $righthyphenmin,
- $file, @synonyms);
- push @langlines, @foo;
- }
- }
- }
- return @langlines;
-}
-
=back
=pod
diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm
index f008f10f32e..8bd4e4c8a30 100644
--- a/Master/tlpkg/TeXLive/TLPOBJ.pm
+++ b/Master/tlpkg/TeXLive/TLPOBJ.pm
@@ -910,6 +910,180 @@ sub make_return_hash_from_executes {
return(\%ret);
}
+
+
+#
+# execute stuff
+#
+sub fmtutil_cnf_lines {
+ my $obj = shift;
+ my @fmtlines = ();
+ my $first = 1;
+ my $pkg = $obj->name;
+ foreach my $e ($obj->executes) {
+ if ($e =~ m/AddFormat\s+(.*)\s*/) {
+ my $name;
+ my $engine;
+ my $patterns = "-";
+ my $options = "";
+ my $mode = "";
+ if ($first) {
+ push @fmtlines, "# from $pkg:\n";
+ $first = 0;
+ }
+ foreach my $p (&TeXLive::TLUtils::quotewords('\s+', 0, "$1")) {
+ # foreach my $p (split(' ', $1)) {
+ my ($a, $b);
+ if ($p =~ m/^(name|engine|mode|patterns|options)=(.*)$/) {
+ $a = $1;
+ $b = $2;
+ } else {
+ die "Unknown format directive in $pkg: $e";
+ }
+ if ($a eq "name") {
+ die "AddFormat line needs name=something: $pkg, $e" unless $b;
+ $name = $b; next;
+ }
+ if ($a eq "engine") {
+ die "AddFormat line needs engine=something: $pkg, $e" unless $b;
+ $engine = $b; next;
+ }
+ if ($a eq "patterns") {
+ $patterns = ( $b ? $b : "-");
+ next;
+ }
+ if ($a eq "mode") {
+ if ($b eq "disabled") {
+ $mode = "#! ";
+ } else {
+ $mode = "";
+ }
+ next;
+ }
+ if ($a eq "options") {
+ $options = ( $b ? $b : "");
+ next;
+ }
+ # should not be reached at all
+ die "Unknown language directive in $pkg: $e";
+ }
+ push @fmtlines, "$mode$name $engine $patterns $options\n";
+ }
+ }
+ return @fmtlines;
+}
+
+
+sub updmap_cfg_lines {
+ my $obj = shift;
+ my %maps;
+ foreach my $e ($obj->executes) {
+ if ($e =~ m/addMap (.*)$/) {
+ $maps{$1} = 1;
+ } elsif ($e =~ m/addMixedMap (.*)$/) {
+ $maps{$1} = 2;
+ }
+ # others are ignored here
+ }
+ my @updmaplines;
+ foreach (sort keys %maps) {
+ if ($maps{$_} == 2) {
+ push @updmaplines, "MixedMap $_\n";
+ } else {
+ push @updmaplines, "Map $_\n";
+ }
+ }
+ return(@updmaplines);
+}
+
+
+sub language_dat_lines {
+ sub make_dat_lines {
+ my ($name, $lhm, $rhm, $file, @syn) = @_;
+ my @ret;
+ push @ret, "$name $file\n";
+ foreach (@syn) {
+ push @ret, "=$_\n";
+ }
+ return(@ret);
+ }
+ my $self = shift;
+ my @lines = $self->_parse_hyphen_execute(\&make_dat_lines);
+ return(@lines);
+}
+
+
+sub language_def_lines {
+ sub make_def_lines {
+ my ($name, $lhm, $rhm, $file, @syn) = @_;
+ my $exc = "";
+ my @ret;
+ push @ret, "\\addlanguage\{$name\}\{$file\}\{$exc\}\{$lhm\}\{$rhm\}\n";
+ foreach (@syn) {
+ # synonyms in language.def ???
+ push @ret, "\\addlanguage\{$_\}\{$file\}\{$exc\}\{$lhm\}\{$rhm\}\n";
+ #debug("Ignoring synonym $_ for $name when creating language.def\n");
+ }
+ return(@ret);
+ }
+ my $self = shift;
+ my @lines = $self->_parse_hyphen_execute(\&make_def_lines);
+ return(@lines);
+}
+
+
+
+sub _parse_hyphen_execute {
+ my ($obj, $coderef) = @_;
+ my @langlines = ();
+ my $pkg = $obj->name;
+ my $first = 1;
+ foreach my $e ($obj->executes) {
+ if ($e =~ m/AddHyphen\s+(.*)\s*/) {
+ my $name;
+ my $lefthyphenmin;
+ my $righthyphenmin;
+ my $file;
+ my @synonyms;
+ if ($first) {
+ push @langlines, "% from $pkg:\n";
+ $first = 0;
+ }
+ foreach my $p (split(' ', $1)) {
+ my ($a, $b) = split /=/, $p;
+ if ($a eq "name") {
+ die "$0: AddHyphen line needs name=something: $pkg, $e" unless $b;
+ $name = $b; next;
+ }
+ if ($a eq "lefthyphenmin") {
+ # lefthyphenmin default to 3
+ $lefthyphenmin = ( $b ? $b : 2 );
+ next;
+ }
+ if ($a eq "righthyphenmin") {
+ $righthyphenmin = ( $b ? $b : 3);
+ next;
+ }
+ if ($a eq "file") {
+ die "$0: AddHyphen line needs file=something: $pkg, $e" unless $b;
+ $file = $b;
+ next;
+ }
+ if ($a eq "synonyms") {
+ @synonyms = split /,/, $b;
+ next;
+ }
+ die "$0: Unknown language directive in $pkg: $e";
+ }
+ my @foo = &$coderef ($name, $lefthyphenmin, $righthyphenmin,
+ $file, @synonyms);
+ push @langlines, @foo;
+ }
+ }
+ return @langlines;
+}
+
+
# member access functions
#
@@ -1435,6 +1609,26 @@ returns a list of all files of all types.
returns a list of all binary files.
+=item C<< $tlpobj->fmtutil_cnf_lines >>
+
+The function C<fmtutil_cnf_lines> returns the lines for fmtutil.cnf
+for this package.
+
+=item C<< $tlpobj->updmap_cfg_lines >>
+
+The function C<updmap_cfg_lines> returns the list lines for updmap.cfg
+for the given package.
+
+=item C<< $tlpobj->language_dat_lines >>
+
+The function C<language_dat_lines> returns the list of all
+lines for language.dat that can be generated from the tlpobj
+
+=item C<< $tlpobj->language_def_lines >>
+
+The function C<language_def_lines> returns the list of all
+lines for language.def that can be generated from the tlpobj.
+
=back
=head1 SEE ALSO