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 g

⟦4791169e3⟧ TextFile

    Length: 11627 (0x2d6b)
    Types: TextFile
    Names: »gftopk.SYS_V.ch«

Derivation

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

TextFile

% $Header: gftopk.ch,v 1.4  87/12/05  10:40:15  mackay Released $

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

% History:
%
% $Log:	gftopk.ch,v $
% Revision 1.4  87/12/05  10:40:15  mackay
% Released for GFtoPK 1.4;
% 
% Revision 1.3  86/12/08  20:20:15  mackay
% Released for GFtoPK 1.3;
% 
% System V version created by Lou Salkind, New York University
%
% Revision 1.2  86/02/01  14:45:21  richards
% Released for GFtoPK 1.2;
% 
% 
% Revision 1.1  86/01/30  19:56:05  richards
% Initial revision
% 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [0] WEAVE: print changes only
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
\pageno=\contentspagenumber \advance\pageno by 1
@y
\pageno=\contentspagenumber \advance\pageno by 1
\let\maybe=\iffalse
\def\title{GF\lowercase{to}PK changes for System V {\mc UNIX}}
@z
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [1] Change banner string
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@d banner=='This is GFtoPK, Version 1.4' {printed when the program starts}
@y
@d banner=='This is GFtoPK, Version 1.4 for System V UNIX'
                                         {printed when the program starts}
@z
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [4] Redefine program header, eliminate gf_file and pxl_file
%	add <Parse command line> section to initialize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@p program GFtoPK(@!gf_file,@!pk_file,@!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}
  var i:integer; {loop index for initializations}
  begin print_ln(banner);@/
  @<Set initial values@>@/
  end;
@y
@p program GFtoPK(@!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 "gftopk_ext.h"@>@\
procedure initialize; {this procedure gets things started properly}
  var i:integer; {loop index for initializations}
  begin print_ln(banner);@/
  @<Set initial values@>;@/
  @<Parse command line arguments@>@/
  end;
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [6] add file_name_size to constants in the outer block
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@!line_length=79; {bracketed lines of output will be at most this long}
@!terminal_line_length=150; {maximum number of characters input in a single
  line of input from the terminal}
@!max_row=16000; {largest index in the main |row| array}
@y
@!line_length=79; {bracketed lines of output will be at most this long}
@!terminal_line_length=150; {maximum number of characters input in a single
  line of input from the terminal}
@!max_row=16000; {largest index in the main |row| array}
@!file_name_size=256; {maximum length of a file name}
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [8] have abort() add <nl> to end of message
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@d abort(#)==begin print(' ',#); jump_out;
@y
@d abort(#)==begin print_ln(' ',#); jump_out;
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [38] Add UNIX_file_name type, redefine byte_file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@!eight_bits=0..255; {unsigned one-byte quantity}
@!byte_file=packed file of eight_bits; {files that contain binary data}
@y
@!eight_bits=0..255; {unsigned one-byte quantity}
@!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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [39] add gf_name and pk_name to global vars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@!gf_file:byte_file; {the stuff we are \.{GFtoPK}ing}
@!pk_file:byte_file; {the stuff we have \.{GFtoPK}ed}
@y
@!gf_file:byte_file; {the stuff we are \.{GFtoPK}ing}
@!gf_name: UNIX_file_name; {the name of |gf_file|}
@!pk_file:byte_file; {the stuff we have \.{GFtoPK}ed}
@!pk_name: UNIX_file_name; {the name of |pk_file|}
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [40] redo open_gf_file to use library
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@ To prepare the |gf_file| for input, we |reset| it.

@p procedure open_gf_file; {prepares to read packed bytes in |gf_file|}
begin reset(gf_file);
gf_loc := 0 ;
end;
@y
@ To prepare the |gf_file| for input, we call a library routine |b_open_in|.

@d NO_search_path=0

@p procedure open_gf_file; {prepares to read packed bytes in |gf_file|}
var i: integer;
begin if not b_open_in(gf_file, gf_name, NO_search_path) then begin@/
   i:=1;
   while (i < file_name_size) and (gf_name[i] <> ' ') do@/
      incr(i);
   abort('Can''t open input GF file: ', gf_name:i);
end;
b_set_ptr(gf_file, gf_loc);@/
gf_loc := 0 ;
end;
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [41] and open_pk_file...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@ To prepare the |pk_file| for output, we |rewrite| it.

@p procedure open_pk_file; {prepares to write packed bytes in |pk_file|}
begin rewrite(pk_file);
pk_loc := 0 ; pk_open := true ;
end;
@y
@ To prepare the |pk_file| for output, we call library routine |b_open_out|.

@p procedure open_pk_file; {prepares to write packed bytes in |pk_file|}
var i, j, k, size: integer;
    startednumber: boolean;
begin
if argc < 3 then begin@/
    @<Generate |pk_name| from |gf_name| and |h_mag|@>@/
    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);@/
pk_loc := 0 ; pk_open := true ;
end;
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [44] replace gf_type and gf_signed_quad
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@p function gf_byte:integer; {returns the next byte, unsigned}
var b:eight_bits;
begin if eof(gf_file) then bad_gf('Unexpected end of file!')
else  begin read(gf_file,b); gf_byte:=b;
  end;
incr(gf_loc);
end;
@#
function gf_signed_quad:integer; {returns the next four bytes, signed}
var a,@!b,@!c,@!d:eight_bits;
begin read(gf_file,a); read(gf_file,b); read(gf_file,c); read(gf_file,d);
if a<128 then gf_signed_quad:=((a*256+b)*256+c)*256+d
else gf_signed_quad:=(((a-256)*256+b)*256+c)*256+d;
gf_loc := gf_loc + 4 ;
end;
@y
@d gf_byte==b_read_unsigned(gf_file)
@d gf_signed_quad==b_read_4_signed(gf_file)
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [45] redefine pk_byte, pk_halfword, pk_three_bytes, and pk_word
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@ @p procedure pk_byte(a:integer) ;
begin
   if pk_open then begin
      if a < 0 then a := a + 256 ;
      write(pk_file, a) ;
      incr(pk_loc) ;
   end ;
end ;
@#
procedure pk_halfword(a:integer) ;
begin
   if a < 0 then a := a + 65536 ;
   write(pk_file, a div 256) ;
   write(pk_file, a mod 256) ;
   pk_loc := pk_loc + 2 ;
end ;
@#
procedure pk_three_bytes(a:integer);
begin
   write(pk_file, a div 65536 mod 256) ;
   write(pk_file, a div 256 mod 256) ;
   write(pk_file, a mod 256) ;
   pk_loc := pk_loc + 3 ;
end ;
@#
procedure pk_word(a:integer) ;
var b : integer ;
begin
   if pk_open then begin
      if a < 0 then begin
         a := a + one_fourth + one_fourth ;
         b := 128 + a div 16777216 ;
      end else b := a div 16777216 ;
      write(pk_file, b) ;
      write(pk_file, a div 65536 mod 256) ;
      write(pk_file, a div 256 mod 256) ;
      write(pk_file, a mod 256) ;
      pk_loc := pk_loc + 4 ;
   end ;
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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [47] redefine find_gf_length and move_to_byte
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@p procedure find_gf_length ;
begin
   set_pos(gf_file, -1) ; gf_len := cur_pos(gf_file) ;
end ;
@#
procedure move_to_byte(@!n : integer) ;
begin
   set_pos(gf_file, n); gf_loc := n ;
end ;
@y
@p procedure find_gf_length ;
begin
   gf_len := b_file_len(gf_file);
end ;
@#
procedure move_to_byte(@!n : integer) ;
begin
   b_seek(gf_file, n); gf_loc := n ;
end ;
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [81] Redefine comment to indicate our version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@d preamble_comment == 'GFtoPK 1.4 output'
@d comm_length = 17
@y
@d preamble_comment == 'GFtoPK 1.4 (System V UNIX) output'
@d comm_length = 33
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [88+] add <Parse command line arguments> section and needed subsections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x
@* System-dependent changes.
This section should be replaced, if necessary, by changes to the program
that are necessary to make \.{GFtoPK} work at a particular installation.
It is usually best to design your change file so that all changes to
previous sections preserve the section numbering; then everybody's version
will be consistent with the printed program. More extensive changes,
which introduce new sections, can be inserted here; then only the index
itself will get a new section number.
@^system dependencies@>
@y
@* System-dependent changes.
This section contains additions needed to make \.{GFtoPK} work under
{\mc UNIX}.  The additions all deal with obtaining file names from
the invoking command line and if not all arguments are provided,
devising defaults for them.
@^system dependencies@>

@<Parse command line arguments@>=
if (argc < 2) or (argc > 3) then begin@/
    write_ln('Usage: gftopk GF-file [PK-file]');@/
    goto final_end;@/
    end;
argv(2, gf_name);@/
if (argc > 2) then@/
   argv(3, pk_name);@/

@ Here's a section to construct |pk_name| from |gf_name|, tacking on the
right extension from the magnification of the file.

@<Generate |pk_name| ...@>=
j:=file_name_size;@/
while (j > 1) and (gf_name[j] <> '/') do@/
   decr(j);
i:=j;
while (j > 1) do begin@/
   pk_name[j] := gf_name[j];
   decr(j);@/
end;
while (i < file_name_size) and (gf_name[i] <> '.') and (gf_name[i] <> ' ') do begin@/
   pk_name[i] := gf_name[i];@/
   incr(i);@/
   end;
pk_name[i]:='.'; incr(i);@/
size:=h_mag;@/
j :=10000;@/
startednumber:=false;@/
while (j > 0) do begin@/
   k:=size div j;@/
   size := size 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] := ' ';@/
print_ln('[Output file named ''', pk_name:i-1, ''']');@/

@z