diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-04-12 16:35:45 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-04-12 16:35:45 +0000 |
commit | 1e19065af9e98c874f6b7d1a229868d9ca2f88bc (patch) | |
tree | e0058c664add0df4f4be7426b362469448ff5062 /Build/source/texk/web2c/omegaware | |
parent | fc9b52216e92282f7cd5fbc80707650a81e99317 (diff) |
gftopk, pktogf: dynamic memory allocation
git-svn-id: svn://tug.org/texlive/trunk@17819 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/omegaware')
-rw-r--r-- | Build/source/texk/web2c/omegaware/ChangeLog | 10 | ||||
-rw-r--r-- | Build/source/texk/web2c/omegaware/odvicopy.ch | 41 | ||||
-rw-r--r-- | Build/source/texk/web2c/omegaware/odvitype.ch | 14 |
3 files changed, 46 insertions, 19 deletions
diff --git a/Build/source/texk/web2c/omegaware/ChangeLog b/Build/source/texk/web2c/omegaware/ChangeLog index 923c96cd14e..b1578d99a62 100644 --- a/Build/source/texk/web2c/omegaware/ChangeLog +++ b/Build/source/texk/web2c/omegaware/ChangeLog @@ -1,3 +1,13 @@ +2010-04-08 Peter Breitenlohner <peb@mppmu.mpg.de> + + * odvicopy.ch (dvi_name): New global variable. + (dvi_length, dvi_move): Use dvi_name instead of 'odvicopy' as + last arg of xfseek() and xftell(). + No random reading on stdin, may be not seekable. + * odvitype.ch (dvi_name): New global variable. + (dvi_length, move_to_byte): Use dvi_name instead of 'odvitype' + as last arg of xfseek() and xftell(). + 2010-03-09 Peter Breitenlohner <peb@mppmu.mpg.de> * odvicopy.ch, odvitype.ch, ofm2opl.ch, opl2ofm.ch, otangle.ch, diff --git a/Build/source/texk/web2c/omegaware/odvicopy.ch b/Build/source/texk/web2c/omegaware/odvicopy.ch index 9a8fcfe4fe3..2aee5338492 100644 --- a/Build/source/texk/web2c/omegaware/odvicopy.ch +++ b/Build/source/texk/web2c/omegaware/odvicopy.ch @@ -24,6 +24,13 @@ \let\maybe=\iffalse @z +@x [1] No random reading on stdin, may be not seekable. +@d random_reading==true {should we skip around in the file?} +@y +@<Globals in the outer block@>= +@!random_reading:boolean; {should we skip around in the file?} +@z + @x [3] Set up kpathsea. procedure initialize; {this procedure gets things started properly} var @<Local variables for initialization@>@/ @@ -403,13 +410,13 @@ begin set_pos(dvi_file,n); dvi_loc:=n; end; @y @p function dvi_length:int_32; -begin xfseek(dvi_file, 0, 2, 'odvicopy'); -dvi_loc:=xftell(dvi_file, 'odvicopy'); +begin xfseek(dvi_file, 0, 2, dvi_name); +dvi_loc:=xftell(dvi_file, dvi_name); dvi_length:=dvi_loc; end; @# procedure dvi_move(n:int_32); -begin xfseek(dvi_file, n, 0, 'odvicopy'); +begin xfseek(dvi_file, n, 0, dvi_name); dvi_loc:=n; end; @z @@ -645,24 +652,27 @@ begin {Now |optind| is the index of first non-option on the command line. We can have zero, one, or two remaining arguments.} + if (optind > argc) or (optind + 2 < argc) then begin + write_ln (stderr, 'odvicopy: Need at most two file arguments.'); + usage ('odvicopy'); + end; + if optind = argc then begin + dvi_name := '<stdin>'; dvi_file := make_binary_file (stdin); - out_file := make_binary_file (stdout); - term_out := stderr; - - end else if optind + 1 = argc then begin - resetbin (dvi_file, extend_filename (cmdline (optind), 'dvi')); - out_file := make_binary_file (stdout); - term_out := stderr; + random_reading := false; + end else begin + dvi_name := extend_filename (cmdline (optind), 'dvi'); + resetbin (dvi_file, dvi_name); + random_reading := true; + end; - end else if optind + 2 = argc then begin - resetbin (dvi_file, extend_filename (cmdline (optind), 'dvi')); + if optind + 2 = argc then begin rewritebin (out_file, extend_filename (cmdline (optind + 1), 'dvi')); term_out := stdout; - end else begin - write_ln (stderr, 'odvicopy: Need at most two file arguments.'); - usage ('odvicopy'); + out_file := make_binary_file (stdout); + term_out := stderr; end; end; @@ -758,4 +768,5 @@ long_options[current_option].val := 0; @ @<Glob...@> = @!term_out:text; +@!dvi_name:const_c_string; @z diff --git a/Build/source/texk/web2c/omegaware/odvitype.ch b/Build/source/texk/web2c/omegaware/odvitype.ch index 2acd6ad32e8..02cd626cddf 100644 --- a/Build/source/texk/web2c/omegaware/odvitype.ch +++ b/Build/source/texk/web2c/omegaware/odvitype.ch @@ -122,7 +122,7 @@ end; @y @p procedure open_dvi_file; {prepares to read packed bytes in |dvi_file|} begin - resetbin (dvi_file, extend_filename (cmdline (optind), 'dvi')); + resetbin (dvi_file, dvi_name); cur_loc := 0; end; @# @@ -186,14 +186,14 @@ end; @y @p function dvi_length:integer; begin - xfseek (dvi_file, 0, 2, 'odvitype'); - cur_loc := xftell(dvi_file, 'odvitype'); + xfseek (dvi_file, 0, 2, dvi_name); + cur_loc := xftell(dvi_file, dvi_name); dvi_length := cur_loc; end; @# procedure move_to_byte(n:integer); begin - xfseek (dvi_file, n, 0, 'odvitype'); + xfseek (dvi_file, n, 0, dvi_name); cur_loc:=n; end; @z @@ -652,6 +652,7 @@ begin write_ln (stderr, 'odvitype: Need exactly one file argument.'); usage ('odvitype'); end; + dvi_name := extend_filename (cmdline (optind), 'dvi'); end; @ Here are the options we allow. The first is one of the standard GNU options. @@ -780,4 +781,9 @@ long_options[current_option].name := 0; long_options[current_option].has_arg := 0; long_options[current_option].flag := 0; long_options[current_option].val := 0; + +@ Global filenames. + +@<Global...@> = +@!dvi_name:const_c_string; @z |