summaryrefslogtreecommitdiff
path: root/Build/source/mswin32/modes-to-cfg.pl
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-16 00:05:12 +0000
committerKarl Berry <karl@freefriends.org>2006-01-16 00:05:12 +0000
commit70f7efeb5c9965a63a4143ad1c1f473585dc364c (patch)
treebf734c5c492ca5491ffaeb2192cdb9b32f42f726 /Build/source/mswin32/modes-to-cfg.pl
parentf896f9e413c0dc0d4178846634963c84505e5029 (diff)
mswin32/
git-svn-id: svn://tug.org/texlive/trunk@1482 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/mswin32/modes-to-cfg.pl')
-rw-r--r--Build/source/mswin32/modes-to-cfg.pl44
1 files changed, 44 insertions, 0 deletions
diff --git a/Build/source/mswin32/modes-to-cfg.pl b/Build/source/mswin32/modes-to-cfg.pl
new file mode 100644
index 00000000000..120ca5d3ddd
--- /dev/null
+++ b/Build/source/mswin32/modes-to-cfg.pl
@@ -0,0 +1,44 @@
+#
+# Perl script for processing modes.mf and build 2 char**
+# initialized with modes and bpdi values.
+#
+
+&main;
+
+1;
+
+sub main {
+ local($modes_file, $m, $dpi);
+
+ $modes_file = `kpsewhich modes.mf`;
+ if ($modes_file eq "") {
+ print "Can't find modes.mf !\nAborting...";
+ exit 1;
+ }
+ open IN, "<$modes_file";
+ $m = "";
+ while (<IN>) {
+ if ($_ =~ m/^mode_def\s+([^\s]+)\s+=\s+.*\\\[\s*(.*)\s*$/) {
+ $m = $1;
+ push @list_modes, $m;
+ push @list_desc, $2;
+ $count ++;
+ }
+ elsif ($_ =~ m/mode_param\s*\(\s*pixels_per_inch\s*,\s*([0-9\.]+)\s*\)/) {
+ $bdpi = $1;
+ push @list_bdpi, $bdpi;
+ }
+ }
+ close IN;
+
+ # print lists
+ open OUT, ">mfmodes.h";
+ print OUT "typedef struct _mfmode {\n\tchar *name;\n\tchar *bdpi;\n\tchar *desc;\n\t} mfmode;\n\n";
+ print OUT "mfmode avail_modes[$count] = {\n";
+
+ for ($i = 0; $i < $count - 1; $i++) {
+ print OUT "\t{\"$list_modes[$i]\", \"$list_bdpi[$i]\", \"$list_desc[$i]\"},\n";
+ }
+ print OUT "\t{\"$list_modes[$i]\", \"$list_bdpi[$i]\", \"$list_desc[$i]\"}\n\t};\n";
+
+}