|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T p
Length: 10174 (0x27be) Types: TextFile Names: »pxtopk.SYS_V.ch«
└─⟦060c9c824⟧ Bits:30007080 DKUUG TeX 2/12/89 └─⟦this⟧ »./tex82/Unsupported/MFpxl/mfware/pxtopk.SYS_V.ch« └─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12 └─⟦beba6c409⟧ »unix3.0/Unsupported.tar.Z« └─⟦25c524ae4⟧ └─⟦this⟧ »Unsupported/MFpxl/mfware/pxtopk.SYS_V.ch«
% $Header: pxtopk.ch,v 2.3 86/12/08 20:55:38 mackay Released $ % Change file for the PXtoPK processor, for use on AT&T System V % History: % % $Log: pxtopk.ch,v $ % Revision 2.3 86/12/08 20:55:38 mackay % Revised version for PXtoPK Version 2.3 % % System V version created by Lou Salkind, New York University % % Revision 2.2 86/01/30 19:57:28 richards % First release at PXtoPK Version 2.2 % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [0] WEAVE: print changes only %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x \pageno=\contentspagenumber \advance\pageno by 1 @y \pageno=\contentspagenumber \advance\pageno by 1 \let\maybe=\iffalse \def\title{PX\lowercase{to}PK changes for System V {\mc UNIX}} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [2] Change banner string %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @d banner=='This is PXtoPK, Version 2.3' @y @d banner=='This is PXtoPK, Version 2.3 for System V UNIX' @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [4] Add include of pxtopk_ext.h in main program %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x label @<Labels in the outer block@>@/ const @<Constants in the outer block@>@/ type @<Types in the outer block@>@/ var @<Globals in the outer block@>@/ procedure initialize; {this procedure gets things started properly} @y label @<Labels in the outer block@>@/ const @<Constants in the outer block@>@/ type @<Types in the outer block@>@/ var @<Globals in the outer block@>@/ @\@=#include "pxtopk_ext.h"@>@\ procedure initialize; {this procedure gets things started properly} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [6] change name_length into file_name_size for our UNIX_file_name type %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!name_length=80; {maximum length of a file name} @y @!file_name_size=256; {maximum length of a file name} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [32] remove word_file, add UNIX_file_name, change byte_file types %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!eight_bits=0..255; {packed file byte} @!word_file=packed file of integer; {for pixel file words} @!byte_file=packed file of eight_bits ; {for packed file words} @y @!eight_bits=0..255; {packed file byte} @!UNIX_file_name=packed array [1..file_name_size] of char; @!byte_file=record@/ stdio_ptr: ^integer; {pointer for stdio FILE struct} loc_ptr: ^integer; {pointer to byte position ptr to keep in sync with file} file_name: UNIX_file_name; {file name saved by open routines} end; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [33] redefine pxl_file as a byte_file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!pxl_file:word_file; {where the input comes from} @!pk_file:byte_file; {where the final output goes} @y @!pxl_file:byte_file; {where the input comes from} @!pk_file:byte_file; {where the final output goes} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [34] redefine open_pxl_file to use b_open_in() %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @p procedure open_pxl_file; {prepares to read packed bytes in a |pxl_file|} begin reset(pxl_file,pxl_name); eof_pixel:=eof(pxl_file); end; @y @d NO_search_path=0 @p procedure open_pxl_file; {prepares to read packed bytes in a |pxl_file|} var i: integer; begin if not b_open_in(pxl_file, pxl_name, NO_search_path) then begin@/ i:=1; while (i < file_name_size) and (pxl_name[i] <> ' ') do@/ incr(i); abort('Unable to open PXL input file: ', pxl_name:i); end; eof_pixel:=false; end; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [34] likewise, change open_pk_file to use b_open_out(). % Also, have it generate a default name if one % Wasn't specified along with the input file name %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x procedure open_pk_file; {prepares the output for writing} begin rewrite(pk_file,pk_name); end; @y procedure open_pk_file; {prepares the output for writing} var i, j, k, extnum: integer; startednumber: boolean; begin if argc < 3 then begin {generate the output file name |pk_name| from |pxl_name|} @<Generate |pk_name| from |pxl_name| and |magnification|@> print_ln('[Output file named ''', pk_name:i-1, ''']');@/ end; if not b_open_out(pk_file, pk_name) then begin@/ i := 1; while (i < file_name_size) and (pk_name[i] <> ' ') do@/ incr(i); abort('Error opening PK output file: ', pk_name:i);@/ end; b_set_ptr(pk_file, pk_loc);@/ end; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [35] redefine pxl_name and pk_name to be UNIX_file_name %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!pxl_name,@!pk_name:packed array[1..name_length] of char; {name of input @y @!pxl_name,@!pk_name:UNIX_file_name; {name of input @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [37] redefine pixel_integer to be b_read_4_signed() %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @p function pixel_integer : integer ; var i:integer; begin i := pxl_file^ ; get(pxl_file) ; eof_pixel:=eof(pxl_file); pixel_integer:=i; end; @y @d pixel_integer==b_read_4_signed(pxl_file) @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [39] redefine pk_byte, pk_halfword, pk_three_bytes, and pk_word to % use our library routines. pk_nyb stays slow pascal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @ @p procedure pk_byte(b : integer) ; begin if b < 0 then b := b + 256 ; pk_file^ := b ; put(pk_file) ; incr(pk_loc) ; end ; @# procedure pk_halfword(a:integer) ; begin if a < 0 then a := a + 65536 ; pk_byte(a div 256) ; pk_byte(a mod 256) ; end ; @# procedure pk_three_bytes(a:integer); begin pk_byte(a div 65536 mod 256) ; pk_byte(a div 256 mod 256) ; pk_byte(a mod 256) ; end ; @# procedure pk_word(a:integer) ; var b : integer ; begin if a < 0 then begin a := a + one_fourth + one_fourth ; b := 128 + a div 16777216 ; end else b := a div 16777216 ; pk_byte(b) ; pk_byte(a div 65536 mod 256) ; pk_byte(a div 256 mod 256) ; pk_byte(a mod 256) ; end ; @# procedure pk_nyb(a:integer) ; @y @ @d pk_byte(#)==b_write_byte(pk_file, #) @d pk_halfword(#)==b_write_2_bytes(pk_file, #) @d pk_three_bytes(#)==b_write_3_bytes(pk_file, #) @d pk_word(#)==b_write_4_bytes(pk_file, #) @p procedure pk_nyb(a:integer) ; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [41] change test of eof_pixel to use function b_eof() %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x if eof_pixel then goto 9997; while not eof_pixel do begin @y while not b_eof(pxl_file) do begin @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [45] Change preamble_comment to reflect our true version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @d preamble_comment == 'PXTOPK 2.2 output' @d comm_length = 17 @y @d preamble_comment == 'PXTOPK 2.2 (System V UNIX) output' @d comm_length = 33 @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [74] rework dialog to use command line arguments rather than % interactive query %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @ @p procedure dialog ; var i : integer ; {index variable} buffer : packed array [1..name_length] of char; {input buffer} begin for i := 1 to name_length do begin pxl_name[i] := ' ' ; pk_name[i] := ' ' ; end; print('Input file name: ') ; flush_buffer ; get_line(pxl_name) ; print('Output file name: ') ; flush_buffer ; get_line(pk_name) ; print_ln(' ') ; end ; @y @ @p procedure dialog ; var i: integer; begin for i := 1 to file_name_size do begin pxl_name[i] := ' ' ; pk_name[i] := ' ' ; end; if (argc < 2) or (argc > 3) then@/ abort('Usage: pxtopk PXL-file [PK-file]');@/ argv(2, pxl_name); if (argc > 2) then@/ argv(3, pk_name);@/ end ; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [76] Add section <Generate |pk_name| from ...> here because we % need to use "magnification" which isn't defined before % open_pk_file() %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @* System-dependent changes. This section should be replaced, if necessary, by changes to the program that are necessary to make \.{PXtoPK} work at a particular installation. Any additional routines should be inserted here. @^system dependencies@> @y @* System-dependent changes. We add a section here which is {\mc UNIX} dependent to construct an output file name |pk_file| from the provided input file name |pxl_file| and the magnification recorded in the postlude of that file, if the output file was not specified by the user. @^system dependencies@> @ @<Generate |pk_name| ...@>= j := file_name_size; while (j > 1) and (pxl_name[j] <> '/') do@/ decr(j); i := j; while (j > 1) do begin@/ pk_name[j] := pxl_name[j]; decr(j);@/ end; while (i < file_name_size) and (pxl_name[i] <> ' ') and (pxl_name[i] <> '.') do begin@/ pk_name[i] := pxl_name[i]; incr(i);@/ end; pk_name[i] := '.'; incr(i);@/ j := 100000;@/ extnum := (round(magnification/5)) mod j; {presumes we are called after |load_pxl_file|} startednumber := false;@/ while (j > 0) do begin@/ k := extnum div j;@/ extnum := extnum mod j;@/ j := j div 10;@/ if startednumber or (k > 0) or (j = 0) then begin@/ pk_name[i] := chr(ord('0') + k); incr(i); startednumber := true;@/ end; end; pk_name[i] := 'p'; incr(i);@/ pk_name[i] := 'k'; incr(i);@/ pk_name[i] := ' ';@/ @z