diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-02-05 10:37:29 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-02-05 10:37:29 +0000 |
commit | 6e57e84ceabd402c094912da764ffd338646aa14 (patch) | |
tree | 68e308487697127f015216285e7db1228a7cf113 /Build/source/texk/web2c/omegaware/ovf2ovp.ch | |
parent | ee1615182e9cd048ae1571e9362495d17339aa4d (diff) |
VFtoVP: Allow arbitrarily large TFM files (as in TFtoPL)
OVF2OVP: Allow arbitrarily large OFM files
OPL2OFM, OVP2OVF: Build fix for MinGW
git-svn-id: svn://tug.org/texlive/trunk@25291 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/omegaware/ovf2ovp.ch')
-rw-r--r-- | Build/source/texk/web2c/omegaware/ovf2ovp.ch | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/Build/source/texk/web2c/omegaware/ovf2ovp.ch b/Build/source/texk/web2c/omegaware/ovf2ovp.ch index caead6f17b3..70523958741 100644 --- a/Build/source/texk/web2c/omegaware/ovf2ovp.ch +++ b/Build/source/texk/web2c/omegaware/ovf2ovp.ch @@ -17,6 +17,18 @@ %\def\title{VF$\,$\lowercase{to}$\,$VP changes for C} @z +% [2] We need to tell web2c about one special variable. +% Perhaps it would be better to allow @define's +% anywhere in a source file, but that seemed just as painful as this. +@x +@p program OVF2OVP(@!vf_file,@!tfm_file,@!vpl_file,@!output); +@y +@p +{Tangle doesn't recognize @@ when it's right after the \.=.} +@\@= @@define var tfm;@>@\ +program OVF2OVP(@!vf_file,@!tfm_file,@!vpl_file,@!output); +@z + @x still [2] Set up for path reading. procedure initialize; {this procedure gets things started properly} var @!k:integer; {all-purpose index for initialization} @@ -28,6 +40,9 @@ procedure initialize; {this procedure gets things started properly} begin kpse_set_program_name (argv[0], nil); kpse_init_prog ('VFTOVP', 0, nil, nil); + {We |xrealloc| when we know how big the file is. The 1000 comes + from the negative lower bound.} + tfm_file_array := cast_to_byte_pointer (xmalloc (1009)); parse_arguments; @z @@ -41,6 +56,11 @@ procedure initialize; {this procedure gets things started properly} @<Constants...@>= @z +@x [4] Drop unused constant. +@!tfm_size=2000000; {maximum length of |tfm| data, in bytes} +@y +@z + @x @!name_length=50; {a file name shouldn't be longer than this} @y @@ -91,18 +111,26 @@ end else begin end; @z -% [24] `index' is not a good choice of identifier in C. -@x +@x [23] `index' is not a good choice of identifier in C. @<Types...@>= @!index=0..tfm_size; {address of a byte in |tfm|} @y @d index == index_type @<Types...@>= -@!index=0..tfm_size; {address of a byte in |tfm|} +@!index=integer; {address of a byte in |tfm|} +@z + +@x [24] Make |tfm| be dynamically allocated. +@!tfm:array [-1000..tfm_size] of byte; {the input data all goes here} +@y +{Kludge here to define |tfm| as a macro which takes care of the negative + lower bound. We've defined |tfm| for the benefit of web2c above.} +@=#define tfm (tfmfilearray + 1001);@>@\ +@!tfm_file_array: pointer_to_byte; {the input data all goes here} @z -% [24] abort() should cause a bad exit code. +% [25] abort() should cause a bad exit code. @x @d abort(#)==begin print_ln(#); print_ln('Sorry, but I can''t go on; are you sure this is a OFM?'); @@ -115,6 +143,14 @@ end; end @z +@x [25] Allow arbitrarily large input files. +if 4*lf-1>tfm_size then abort('The file is bigger than I can handle!'); +@.The file is bigger...@> +@y +tfm_file_array + := cast_to_byte_pointer (xrealloc (tfm_file_array, 4 * lf - 1 + 1002)); +@z + % [31] Ditto for vf_abort. @x @d vf_abort(#)==begin |