POOLTYPE change file for Vax/VMS Copyright (C) 1983 by David Fuchs. All rights are reserved. @x \pageno=\contentspagenumber \advance\pageno by 1 @y \pageno=\contentspagenumber \advance\pageno by 1 \let\maybe=\iffalse \def\title{POOL\lowercase{type} changes for Vax/VMS} @z @x @p program POOLtype(@!pool_file,@!output); @y @p program POOLtype(@!pool_file,@!output,@!input,@!term_out); @z @x procedure initialize; {this procedure gets things started properly} var @@; begin @@/ @y @@/ procedure initialize; {this procedure gets things started properly} var @@; begin @@/ @@/ @z @x @d abort(#)==begin write_ln(#); goto 9999; @y @d crlf==chr(13),chr(10) @d abort(#)==begin write_ln(term_out,#,crlf); goto 9999; @z @x 9999:end. @y close(output,@=disposition:=save@>,@=error:=continue@>); 9999:end. @z @x @!pool_file:packed file of text_char; @y @!pool_file:text; @z @x This section should be replaced, if necessary, by changes to the program that are necessary to make \.{POOLtype} 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. @y Here are the remaining changes to the program that are necessary to make \.{POOLtype} work on Vax/VMS. @ On Vax/VMS we need the following special definitions, types, variables and procedures to be able to get the file name from the command line, or to prompt for them. @d VAX_volatile==@=volatile@> @d VAX_immed==@=%immed @> @d VAX_external==@=external@> @d VAX_stdescr==@=%stdescr @> @d VAX_lib_get_foreign==@= lib$get_foreign@> @d VAX_length==@=length @> @ @= @!sixteen_bits= 0..65535; @ @== @!term_out: text; {for progress report to user's terminal} @!command_line:packed array[1..300] of char; @!cmd_len:sixteen_bits; @!cmd_i:integer; @!file_name,@!default_file_name:varying [300] of char; @!ask,@!got_file_name: boolean; @ @= open(term_out,'SYS$OUTPUT',@=carriage_control:=none@>); rewrite(term_out); cmd_i:=0; VAX_lib_get_foreign(command_line,,cmd_len,cmd_i); cmd_i:=1; while (cmd_i<=cmd_len) and (command_line[cmd_i]=' ') do incr(cmd_i); got_file_name:=cmd_i<=cmd_len; if got_file_name then default_file_name:=substr(command_line,cmd_i,cmd_len-cmd_i+1); if got_file_name then begin file_name:=default_file_name+'.POO'; open(pool_file,file_name,@=readonly,error:=continue@>); ask:=status(pool_file)<>0; if ask then write_ln(term_out,'Couldn''t open ',file_name,crlf); end else ask:=true; while ask do begin got_file_name:=false; write_ln(term_out,'Pool file: '); if eof then goto 9999; read_ln(file_name); open(pool_file,file_name,@=readonly,error:=continue@>); ask:=status(pool_file)<>0; if ask then write_ln(term_out,'Couldn''t open ',file_name,crlf); end; if got_file_name then begin cmd_i:=1; for cmd_len:=1 to default_file_name.VAX_length do if (default_file_name[cmd_len]=']') or (default_file_name[cmd_len]=':') then cmd_i:=cmd_len+1; if cmd_i<=default_file_name.VAX_length then default_file_name:=substr(default_file_name,cmd_i, default_file_name.VAX_length-cmd_i+1); file_name:=default_file_name+'.TYP'; close(output,@=error:=continue@>); open(output,file_name,@=new,disposition:=delete,error:=continue@>); ask:=status(output)>0; if ask then write_ln(term_out,'Couldn''t open ',file_name,crlf); end else ask:=true; while ask do begin write_ln(term_out,'Type file: '); if eof then goto 9999; read_ln(file_name); close(output,@=error:=continue@>); open(output,file_name,@=new,32767,disposition:=delete@>, @=error:=continue@>); ask:=status(output)>0; if ask then write_ln(term_out,'Couldn''t open ',file_name,crlf); end; rewrite(output); @ Here is the library procedure that gets the user's command line. @= [VAX_external] function VAX_lib_get_foreign( VAX_stdescr cmdlin:[VAX_volatile] packed array [$l1..$u1:integer] of char := VAX_immed 0; VAX_stdescr prompt:[VAX_volatile] packed array [$l2..$u2:integer] of char := VAX_immed 0; var len : [VAX_volatile] sixteen_bits := VAX_immed 0; var flag : [VAX_volatile] integer := VAX_immed 0) :integer; extern; @z