|
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: 9765 (0x2625) Types: TextFile Names: »pktype.SYS_V.ch«
└─⟦060c9c824⟧ Bits:30007080 DKUUG TeX 2/12/89 └─⟦this⟧ »./tex82/Unsupported/MFpxl/mfware/pktype.SYS_V.ch« └─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12 └─⟦beba6c409⟧ »unix3.0/Unsupported.tar.Z« └─⟦25c524ae4⟧ └─⟦this⟧ »Unsupported/MFpxl/mfware/pktype.SYS_V.ch«
% $Header: pktype.ch,v 2.2 86/12/08 20:35:20 mackay Released $ % Change file for the PKtype processor, for use on AT&T System V % History: % % $Log: pktype.ch,v $ % Revision 2.2 86/12/08 20:35:20 mackay % Revised version for PKtype Version 2.2 % % System V version created by Lou Salkind, New York University % % Revision 2.1 86/01/27 21:46:25 richards % Initial version for PKtype Version 2.1 % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [0] WEAVE: print changes only %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x \font\ninerm=amr9 @y \font\ninerm=cmr9 @z @x \pageno=\contentspagenumber \advance\pageno by 1 @y \pageno=\contentspagenumber \advance\pageno by 1 \let\maybe=\iffalse \def\title{PK\lowercase{type} changes for System V {\mc UNIX}} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [1] Change banner string %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @d banner=='This is PKtype, Version 2.2' @y @d banner=='This is PKtype, Version 2.2 for System V UNIX' @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [4] Redirect PKtype output to correct output file % depending on typ_active value %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @d print_ln(#)==write_ln(output,#) @d print(#)==write(output,#) @d t_print_ln(#)==write_ln(typ_file,#) @d t_print(#)==write(typ_file,#) @y @d print_ln(#)==write_ln(output,#) @d print(#)==write(output,#) @d t_print_ln(#)==begin if typ_active then write_ln(typ_file,#) else write_ln(output,#) end @d t_print(#)==begin if typ_active then write(typ_file,#) else write(output,#) end @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [4] Change program header to include pktype_ext.h %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @p program PKtype(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 PKtype(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 "pktype_ext.h"@>@\ procedure initialize; {this procedure gets things started properly} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [6] Add file_name_size to constants %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @<Constants...@>= @!name_length=80; {maximum length of a file name} @!terminal_line_length=132; {maximum length of an input line} @y @<Constants...@>= @!file_name_size=256; {maximum length of a file name} @!terminal_line_length=132; {maximum length of an input line} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [8] Have abort not print double messages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @d abort(#)==begin print_ln(' ',#); t_print_ln(' ',#); jump_out; end @y @d abort(#)==begin print_ln(' ', #); if typ_active then t_print_ln(' ',#); jump_out; end @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [9] Change type of text_file to "text" (mostly for Pyramid) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!text_file=packed file of text_char; @y @!text_file=text; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [31] Change type of binary file for pk_file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @<Types...@>= @!eight_bits=0..255; {packed file byte} @!byte_file=packed file of eight_bits ; {for packed file words} @^system dependancies@> @y @<Types...@>= @!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; @^system dependancies@> @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [32] Change documentation on files %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @ @<Glob...@>= @!typ_file:text_file; {where the input comes from} @!pk_file:byte_file; {where the final output goes} @^system dependencies@> @y @ @<Glob...@>= @!pk_file:byte_file; {where the input comes from} @!typ_file:text_file; {where the final output goes} @^system dependencies@> @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [33] Change open_typ_file/open_pk_file to use test_access & b_open_in %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @ To prepare these files for input, we |reset| them. An extension of \PASCAL\ is needed in the case of |typ_file|, since we want to associate it with external files whose names are specified dynamically (i.e., not known at compile time). The following code assumes that `|reset(f,s)|' does this, when |f| is a file variable and |s| is a string variable that specifies the file name. If |eof(f)| is true immediately after |reset(f,s)| has acted, we assume that no file named |s| is accessible. @^system dependencies@> @p procedure open_typ_file; {prepares to write text data to the |typ_file|} begin rewrite(typ_file,typ_name); end; @# procedure open_pk_file; {prepares the input for reading} begin reset(pk_file,pk_name); pk_loc := 0 ; end; @y @ To prepare these files for input, we call some library routines. For |typ_file|, we call |test_access| to avoid having {\mc UNIX} \PASCAL\ abort our program without dumping core. For |pk_file|, we call |b_open_in|, which will tell us if the file is accessible without aborting if it is not. @^system dependencies@> @d write_access_mode=6 @d NO_search_path=0 @p procedure open_typ_file; {prepares to write text data to the |typ_file|} var real_name: UNIX_file_name; i: 1..file_name_size; begin if use_typ then begin @/ if not test_access(typ_name, real_name, write_access_mode, NO_search_path) then begin@/ i:=1; while (i < file_name_size) and (typ_name[i] <> ' ') do@/ incr(i); abort('Can''t open output file: ', typ_name:i); end; rewrite(typ_file, typ_name);@/ typ_active:=true; end; end; @# procedure open_pk_file; {prepares the input for reading} var i: 1..file_name_size; 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 file: ', pk_name:i); end; b_set_ptr(pk_file, pk_loc);@/ pk_loc := 0; end; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [34] add use_typ, typ_active %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @<Glob...@>= @!typ_name,@!pk_name:packed array[1..name_length] of char; {name of input and output files} @!pk_loc:integer; {how many bytes have we read?} @y @<Glob...@>= @!typ_name,@!pk_name:UNIX_file_name; {name of input and output files} @!pk_loc:integer; {how many bytes have we read?} @!typ_active, use_typ: boolean; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [34] Use modified routines to access gf_file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @p function pk_byte : eight_bits ; var 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [37] redefine get_16 and get_32 also %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [54] define flush_buffer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @d flush_buffer == begin end @y @d flush_buffer == begin flush(output) end @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [55] add argument parsing to procedure dialog %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @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 typ_name[i] := ' ' ; pk_name[i] := ' ' ; end; print('Input file name: ') ; flush_buffer ; get_line(pk_name) ; print('Output file name: ') ; flush_buffer ; get_line(typ_name) ; end ; @y @ @p procedure dialog ; begin use_typ := false;@/ typ_active := false;@/ if (argc < 2) or (argc > 3) then@/ abort('Usage: pktype PK-file [list-file]'); argv(2, pk_name);@/ if (argc > 2) then begin@/ argv(3, typ_name);@/ use_typ := true; end; end ; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [56] replace eof(pk_file) with b_eof() %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x while not eof(pk_file) do begin i := pk_byte ; @y while not b_eof(pk_file) do begin i := pk_byte ; @z