DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T p

⟦a0f936103⟧ TextFile

    Length: 9046 (0x2356)
    Types: TextFile
    Names: »pktopx.BSD4_n.ch«

Derivation

└─⟦060c9c824⟧ Bits:30007080 DKUUG TeX 2/12/89
    └─⟦this⟧ »./tex82/Unsupported/MFpxl/mfware/pktopx.BSD4_n.ch« 
└─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12
    └─⟦beba6c409⟧ »unix3.0/Unsupported.tar.Z« 
        └─⟦25c524ae4⟧ 
            └─⟦this⟧ »Unsupported/MFpxl/mfware/pktopx.BSD4_n.ch« 

TextFile

% $Header: pktopx.ch,v 2.3  86/12/08  20:41:34  mackay Released $

%   Change file for the PKtoPX processor, for use on Berkeley UNIX systems.

% History:
%
% $Log:	pktopx.ch,v $
% Revision 2.3  86/12/08  20:41:34  mackay
% Revised version for PKtoPX Version 2.3
% 
% Revision 2.2  86/01/30  19:56:54  richards
% First release at PKtoPX 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{PK\lowercase{to}PX changes for Berkeley {\mc UNIX}}
@z
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [2] Change banner string
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@d banner=='This is PKtoPX, Version 2.3' 
@y
@d banner=='This is PKtoPX, Version 2.3 for Berkeley UNIX' 
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [4] Add #include pktopx_ext.h to main
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@p program PKtoPX(input, output);
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
@p program PKtoPX(input, output);
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 "pktopx_ext.h"@>@\
procedure initialize; {this procedure gets things started properly}
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [6] change name_length to file_name_size, update to 256
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@!name_length=80; {maximum length of a file name}
@y
@!file_name_size=256; {maximum length of a file name}
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [27] change byte_file, add UNIX_file_name, change word_file type
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [28] change "pxl_file" to "byte_file" type
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [29] redefine open_pxl_file and open_pk_file; add filename generation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@p procedure open_pxl_file; {prepares to write packed bytes in a |pxl_file|}
begin rewrite(pxl_file,pxl_name);
pxl_loc := 0 ;
end;
@#
procedure open_pk_file; {prepares the input for reading}
begin reset(pk_file,pk_name);
pk_loc := 0 ;
end;
@y
@d NO_search_path=0

@p procedure open_pxl_file; {prepares to write packed bytes in a |pxl_file|}
var i, j, k, extnum: integer;
    startednumber: boolean;
begin
if argc < 3 then begin@/
    j := file_name_size;@/
    while (j > 1) and (pk_name[j] <> '/') do@/
        decr(j);
    i := j;
    while (j > 1) do begin@/
        pxl_name[j] := pk_name[j]; decr(j);@/
    end;
    while(i < file_name_size) and (pk_name[i] <> '.') and (pk_name[i] <> ' ') do begin@/
        pxl_name[i]:=pk_name[i]; incr(i);
    end;
    pxl_name[i] := '.'; incr(i);@/
    j:=10000;@/
    startednumber:=false;@/
    extnum:=magnification mod 100000;@/
    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@/
            pxl_name[i] := chr(ord('0') + k); incr(i); @/
            startednumber := true;
        end;
   end;
   pxl_name[i] := 'p'; incr(i);@/
   pxl_name[i] := 'x'; incr(i);@/
   pxl_name[i] := 'l'; incr(i);@/
   pxl_name[i] := ' ';@/
   print_ln('[Output file named ''', pxl_name:i-1, ''']');@/
end;
if not b_open_out(pxl_file, pxl_name) then begin@/
   i:=1;
   while (i < file_name_size) and (pxl_name[i] <> ' ') do@/
      incr(i);
   abort('Error opening PXL output file: ', pxl_name:i);
end;
pxl_loc := 0 ;
end;
@#
procedure open_pk_file; {prepares the input for reading}
var i: integer;
begin
if not b_open_in(pk_file, pk_name, NO_search_path) then begin@/
    i:=1;
    while (i < file_name_size) and (pk_name[i] <> ' ') do@/
        incr(i);
    abort('Unable to open PK input file: ', pk_name:i);
end;
b_set_ptr(pk_file, pk_loc);@/
pk_loc := 0 ;
end;
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [30] redefine pxl_name and pk_name types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@!pxl_name,@!pk_name:packed array[1..name_length] of char; {names of input
@y
@!pxl_name,@!pk_name:UNIX_file_name; {names of input
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [31] redefine pixel_integer to use our routines.  Note we cheat
%	a bit here since pktopx expects pxl_loc to be kept in terms
%	of words, not bytes!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@p procedure pixel_integer (i : integer) ;
begin pxl_file^ := i ;
put(pxl_file) ;
incr(pxl_loc) ;
end;
@y
@d pixel_integer(#)==begin b_write_4_bytes(pxl_file,#); incr(pxl_loc) end
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [32] redefine pk_byte
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@p function pk_byte : eight_bits ;
var nybble, temp : eight_bits ;
begin 
   temp := pk_file^ ;
   get(pk_file) ;
   pk_loc := pk_loc + 1 ;
   pk_byte := temp ;
end ;
@y
@d pk_byte==b_read_unsigned(pk_file)
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [33] reorder file opens so we have magnification available for
%	building output file name before we call open_pxl_file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
open_pk_file ;
open_pxl_file ;
pixel_integer(pxl_id)
@y
open_pk_file ;@/
@<Read preamble@>;@/
open_pxl_file ;@/
pixel_integer(pxl_id)
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [34] redefine get_16 and get_32
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@p function get_16 : integer ;
var a : integer ;
begin a := pk_byte ; get_16 := a * 256 + pk_byte ; end ;
@#
function get_32 : integer ;
var a : integer ;
begin a := get_16 ; if a > 32767 then a := a - 65536 ;
get_32 := a * 65536 + get_16 ; end ;
@y
@d get_16==b_read_2_unsigned(pk_file)
@d get_32==b_read_4_signed(pk_file)
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [58] recode dialog to decode command line arguments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@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(pk_name) ;
   print('Output file name:  ') ;
   flush_buffer ;
   get_line(pxl_name) ;
end ;
@y
@ @p procedure dialog ;
var i : integer ; {index variable}
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: pktopx PK-file [PXL-file]');
   argv(1, pk_name);@/
   if (argc > 2) then
      argv(2, pxl_name);@/
end ;
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [59] remove <read preamble> from main program
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@p begin
initialize ;
dialog ;
@<Open files@> ;
@<Read preamble@> ;
skip_specials ;
while flag_byte <> pk_post do begin
@y
@p begin
initialize ;
dialog ;
@<Open files@> ;
skip_specials ;
while flag_byte <> pk_post do begin
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [59] change eof() to b_eof()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
while not eof(pk_file) do i := pk_byte ;
@y
while not b_eof(pk_file) do i := pk_byte ;
@z