{ * * NAME: PFGBL * SOURCE: 92071-18297 * RELOC: NONE (PART NUMBER IS RESERVED) * PGMR: DAVE NEFF **************************************************************** * (C) COPYRIGHT HEWLETT-PACKARD COMPANY, 1980. ALL RIGHTS * * RESERVED. NO PART OF THIS PROGRAM MAY BE PHOTOCOPIED, * * REPRODUCED OR TRANSLATED TO ANOTHER PROGRAM LANGUAGE WITHOUT * * THE PRIOR WRITTEN CONSENT OF HEWLETT-PACKARD COMPANY. * **************************************************************** * {This file contains the declaration of all global variables, types and constants which are used by PFORM and its segments. This file is merged into PFORM and its segments at compilation time by the include directive. There is obviously no relocatable file corresponding to PFGBL, but the part number for the relocatable is reserved to maintain consistancy in numbering.} {No routines are recursive, so turn off the recursive option to save code and execution time.} $recursive off$ $range off$ {Although partial evaluation defaults to on, I make the assumption in several places that clauses are evaluated partially. Hence I emphasize this fact here.} $partial_eval on$ CONST aborted=' aborted.'; cmpleted=' completed.'; bad_command='INVALID COMMAND IN PRESENT CONTEXT'; bad_range='PARAMATER OUT OF RANGE'; bad_type='BAD PARAMATER TYPE'; bootable_sys_image='Bootable system image in file '; overflow_memory='OVERFLOW OF MEMORY'; fdir_length=16; {Length of a file directory entry.} idseg_length=30; {Size of an id segment in words.} ift_type=30; {The interface type of a PROM card.} {These strings are used by the header routines.} head1= '************************************************************************'; head2= '* *'; line_length=72; {Length of an input line (max). This constant can not be changed easily.} mat_length=3; {Words in each mat entry.} max_io_cards=32; {Maximum possible number of PROM modules in one system.} max_num_labls=12; {The maximum number of labls to be retrieved from the snapshot file.} max_words=3; {The maximum number of words denoting a label in the shapshot file. This constant can be increased with no problems, but 3 is its absolute minimum.} max_char=max_words*2; {The maximum number of characters denoting a label in the shapshot file.} maxint=32767; {Maximum single word integer range.} minint=-32768; {Minumum single word integer range.} page_size=1024; {Number of words in a page.} recd_len=128; {The number of words in one record.} fdirs_per_rec=recd_len DIV fdir_length; {Number of directory entries per record.} recds_per_k=1024 DIV recd_len; short_idseg_length=8; {Length of a short id.} short_ids_per_rec=recd_len DIV short_idseg_length; space1=' '; space2=' '; star_error='*ERROR - '; symbuff_length=1300; {Size of relink buffer for RLINK. The routine, on the average, uses only 300-500 words. This value should range from 26, to a size which makes segment PFS5 equal to the largest other segment.} TYPE {This is the set of all routines called by the main, but contained in segments. It is used to make segmenting more convenient and flexible.} all_routines=(file__init,def__partitions,lu__process, check__file__for__errors,store__file,prom__description, question__process,st__process,perform__relink, ss__process,bu__process,fix__long__id,fix__short__ids, relink__check,handle__error,cleanup__files,pr__process, sz__process,dir__init__process,rp__error__check, complete__directory,pt__process,scratch__to__system); {Declare the integer TYPE to be single word.} integer=minint..maxint; {A double word integer is required by crets, and ecrea.} doubint=-214748647..214748647; {The TYPE address_array is used to pass and return the addresses of the labels found in the snapshot file.} address_array=ARRAY [1..max_num_labls] OF integer; {Declare a byte scalar for byte packed fields.} byte=0..255; {A file name type (fname) is used many times, so declare it here.} fname=PACKED ARRAY [1..6] OF char; {The TYPE cartridge_entry represents the structure of the file directory entry for the cartridge itself.} cartridge_entry= PACKED RECORD CASE boolean OF true:(cartridge_label:fname; cartridge_reference_number:integer; first_avail_track:integer; cpu_use:byte; next_avail_sector:byte; sector_skip:byte; sectors_per_track:byte; low_directory_track:integer; neg_number_directory_tracks:integer; next_avail_track:integer; bad_tracks:ARRAY [1..6] OF integer); false:(high_bit:boolean) {The high bit of word 1 must be set, but characters are byte aligned.} END; {The next structure represents a file directory entry for a normal file.} directory_file= PACKED RECORD name:fname; file_type:integer; starting_track:integer; extent_number:byte; starting_sector:byte; file_size_times_2:integer; record_length:integer; security_code:integer; open_flags:ARRAY [1..7] OF integer; END; {Next the structure of general case file directory entry is defined. The variants represent the three typical cases--access via an integer array, access as a cartridge entry, acess as a file entry.} directory_entry= RECORD CASE byte OF 0:(ints:ARRAY [1..fdir_length] OF integer); 1:(files:directory_file); 2:(cartridge:cartridge_entry) END; {The next 16 types represent all possible bit packing fields and are used for defining various packed data structures.} one_bit=0..1; two_bits=0..3; three_bits=0..7; four_bits=0..15; five_bits=0..31; six_bits=0..63; seven_bits=0..127; eight_bits=byte; nine_bits=0..511; ten_bits=0..1023; eleven_bits=0..2047; twelve_bits=0..4095; thirteen_bits=0..8191; fourteen_bits=0..16383; fifteen_bits=0..32767; sixteen_bits=integer; thirty_two_bits=doubint; {The TYPE buffer is used for readf and writf calls. Type 1 access makes the readf and writf calls fill or use the buffer immediately, without buffering through the dcb first.} buffer=ARRAY [1..recd_len] OF integer; {The next type defines an L10 id segment.} id_seg_l10= PACKED RECORD list_link:integer; temp1:integer; temp2:integer; temp3:integer; temp4:integer; temp5:integer; priority:integer; primary_entry_point:integer; point_of_suspension:integer; a_at_suspension:integer; b_at_suspension:integer; e_at_suspension:one_bit; reserved1:fourteen_bits; o_at_suspension:one_bit; name:PACKED ARRAY [1..5] OF char; father_id_number:byte; memory_resident:boolean; no_abort:boolean; string_is_saved:boolean; break:boolean; system_common:boolean; id_dealocate:boolean; reserved2:one_bit; off:boolean; suspend:boolean; reserved3:one_bit; status:six_bits; {Should complete a word alignment here.} time_list_link:integer; resolution:three_bits; in_time_list:boolean; multiple_for_res:twelve_bits; execution_time:doubint; low_main_addr:integer; high_main_addr_plus1:integer; all_memory:boolean; current_seg_high_addr_plus1:fifteen_bits; number_of_segments:six_bits; low_base_page_addr:ten_bits; base_page_track_offset:six_bits; high_base_page_addr_plus1:ten_bits; base_page_block_number:byte; main_block_number:byte; main_track_number:integer; swap_index:byte; load_lu:byte; sequence_number:four_bits; reserved4:four_bits; terminal_lu:byte; tdb_list_head:integer; END; {Some type six file information is appended to the ID on the header. This next type represents that structure for the l10.} id_extension_l10= RECORD system_checksum:integer; idseg_checksum:integer; high_seg_addr_plus1:integer; high_base_page_addr_plus1:integer; END; {The analogous id segment types for the L20 are now defined.} id_seg_l20= PACKED RECORD list_link:integer; temp1:integer; temp2:integer; temp3:integer; temp4:integer; temp5:integer; priority:integer; primary_entry_point:integer; point_of_suspension:integer; a_at_suspension:integer; b_at_suspension:integer; e_at_suspension:one_bit; reserved1:fourteen_bits; o_at_suspension:one_bit; name:PACKED ARRAY [1..5] OF char; father_id_number:byte; memory_resident:boolean; no_abort:boolean; string_is_saved:boolean; break:boolean; system_common:boolean; id_dealocate:boolean; ds_resource_lock:boolean; off:boolean; suspend:boolean; memory_lock:boolean; status:six_bits; {Should complete a word alignment here.} time_list_link:integer; resolution:three_bits; in_time_list:boolean; multiple_for_res:twelve_bits; execution_time:doubint; time_slice_clock:integer; high_main_addr_plus1:integer; current_seg_high_addr_plus1:integer; number_of_segments:byte; current_seg_number:byte; all_memory:boolean; size_less_1:five_bits; high_base_page_addr:ten_bits; main_block_number:byte; partition_number:byte; main_track_number:integer; swap_index:byte; load_lu:byte; sequence_number:four_bits; reserved4:four_bits; terminal_lu:byte; tdb_list_head:integer; END; id_extension_l20= RECORD high_seg_addr_plus1:integer; last_prog_rec:integer; last_fixup_table_rec:integer; system_checksum:integer; system_common_checksum:integer; idseg_checksum:integer; END; {Next the id and extensions are combined into forming one long id segment type for each L.} long_id_l10= RECORD CASE boolean OF true:(id:id_seg_l10; ext:id_extension_l10); false:(ints: ARRAY [1..34] OF integer) END; long_id_l20= RECORD CASE boolean OF true:(id:id_seg_l20; ext:id_extension_l20); false:(ints:ARRAY [1..36] OF integer) END; {The short_id_l10 type represents that structure for the l10. The l20 format is different, but is of no concern to PFORM since it uses block, not track and sector offsets.} short_id_l10= PACKED RECORD CASE boolean OF true: (name:PACKED ARRAY [1..5] OF char; main_track_offset:byte; segment_entry_addr:integer; high_seg_addr_plus1:integer; base_page_track_offset:six_bits; high_base_page_addr_plus1:ten_bits; base_page_block_number:byte; segment_block_number:byte; short_id_checksum:integer); false: (ints: ARRAY [1..short_idseg_length] OF integer) END; {The id_seg type can be used to contain either l10 or l20 id segments (less the extension).} idseg= RECORD CASE two_bits OF 0:(l10:id_seg_l10); 1:(l20:id_seg_l20); 2:(ints:ARRAY [1..idseg_length] OF integer) END; {The TYPE dcb is used to make data control blocks for FMP calls.} {The variants are used to manipulate long and short id segments when it is known that the buffer contains them.} {The RECORD structure also allows calls to readf and writf routines with type 1 access, but without having a seperate dcb and buffer.} dcb= RECORD header:ARRAY [1..16] OF integer; CASE three_bits OF 0:(buff:buffer); 1:(l10_long_id:long_id_l10); 2:(l20_long_id:long_id_l20); 3:(l10_short_ids:ARRAY [1..short_ids_per_rec] OF short_id_l10); 4:(file_entries:ARRAY [1..fdirs_per_rec] OF directory_entry); 5:(id:idseg) END; {error_type handles certain compiler errors.} error_type = (run,ema,io,fmp,seg,warn); {error_exit defines the possible types of exits, as defined by the optional run string paramater.} error_exit = (uncon_abort, uncon_end, uncon_continue); {The TYPE file_directory is used to make file directory entries in memory.} file_directory=ARRAY [1..fdir_length] OF integer; {The TYPE string6 is a string of six characters. It is used for file names and user replies.} string6= RECORD CASE two_bits OF 0: (command: PACKED ARRAY [1..2] OF char; words_two_three: PACKED ARRAY [3..6] OF char); 1: (file_name: fname); 2: (five_char: PACKED ARRAY [1..5] OF char); 3: (int1:integer; int2:integer; int3:integer) END; {The TYPE input_line represents a line of terminal text.} input_line=PACKED ARRAY [1..line_length] OF char; {The TYPE int_or_char is used to define single word integers which may sometimes be 2 ascii characters.} int_or_chars= RECORD CASE boolean OF true: (int:integer); false: (chars:PACKED ARRAY [1..2] OF char); END; {The TYPE isize_type is a two word double integer array used by FMP to denote length of files created by crets, and ecrea.} isize_type=ARRAY [1..2] OF doubint; {The TYPE lu_array is for storing the specified PROM lu numbers to prevent duplicate lus for seperate PROM images.} lu_array=ARRAY [1..max_io_cards] OF integer; {param_type is used in the declaration of a namr parse buffer to define the type fields.} param_type=(null,numeric,unimplimented,ascii); {param_type_word represents the structure of the type word returned by namr.} param_type_word= PACKED RECORD bit_fill:param_type; {Fills in upper 2 bits (14,15).} param7:param_type; param6:param_type; param5:param_type; param4:param_type; param3:param_type; param2:param_type; param1:param_type; {Fills in lowest 2 bits (0,1).} END; {namr_parse_buffer describes the structure of the buffer returned by the routine NAMR.} namr_parse_buffer= RECORD param1:string6; {Requires 3 words} types:param_type_word; param2:int_or_chars; {Requires 1 word.} param3:int_or_chars; param4:int_or_chars; param5:int_or_chars; param6:int_or_chars; param7:int_or_chars; END; {PFORM uses prtn to tell the scheduling program if the program exit was via the abort or the end exit.} prtn_prams= PACKED ARRAY [1..10] OF char; {The TYPE symbuff is a buffer used by the loader library RLINK routine. The actual buffer is local to a segment and a procedure, but the type is globally declared so the relink routine can be declared external, as well as a pointer type referencing it (table_addr).} symbuff= ARRAY [1..symbuff_length] OF integer; {The TYPE varl_labl represents the structure of the label identifiers in the snapshot file. varl_labl stands for variable length label, since the identifier length is subject to future change. This, in fact will have to be changed in the future, and is largely accomodated by this structure (i.e. redefine max_words is all that is needed).} varl_labl= RECORD CASE boolean OF true: (ints:ARRAY [1..max_words] OF integer); false: (chars:PACKED ARRAY [1..max_char] OF char) END; {The TYPE labl_array is an array of variable length labels.} labl_array=ARRAY [1..max_num_labls] OF varl_labl; {table_addr is a pointer to a symbol table buffer, and is passed to and undefined external error handling routine.} table_addr= RECORD CASE boolean OF true: (addr:^symbuff); false: (int:integer) END; VAR {All global variables are declared here.} {address_array TYPE declaration} address:address_array; {Addresses of labels found in the snapshot file.} {boolean TYPE declarations.} abort, {True when user wishes to abort, false otherwise.} boot, {False until the user anwers 'YES' to the 'Boot system...' prompt, and true from that point on.} bootable_current_file, {True if the current file being configured has a bootable system on it.} completed_phase, {True when /C is typed.} done_with_rp, {True when the rp is completed due to a newname given for a previously rped program.} first_pform, {True on first pass of PFORM, false on subsequent passes.} full_directory, {True when the last user program stored onto a prom fills the current directory track, and overlays a part of the last fmp_track. The PROM image file may no be completely full, but it does not matter in this case.} echo_read, {True when all readlines must be echoed to the output file, false otherwise.} echo_prompt, {True when all prompts must be echoed to the input file, false otherwise.} good_lk, {True when some program has been successfully stored onto prom via the LK command.} good_rp, {True when some program has been successfully stored onto prom via the RP command.} interactive, {True when PFORM is being run from an interactive device, false if not.} made_prom_file, {True when the current PROM image file was successfully made.} made_sys_file, {True when the PFORM system output file was successfully made (crets).} make_fill_file, {True when a filler file must be made for the current PROM image to insure it looks full to FMP. False if the PROM is full to FMP as a result of the user commands.} mapped_system, {True if the original system file is for a mapped L, false otherwise.} must_relink, {True when a program must be relinked, as determined by relink_check, false otherwise.} no_directory, {True if the PROM image file being made has no directory track (i.e. contains a system file only.} pform_ended, {True when /E is typed.} rp_true_lk_false, {True when the last program related command was RP, false when the last program command was LK.} restart_partitioning, {True when /R is typed.} segmented, {True when the current program file is segmented.} slash_control, {True when a valid / control character is typed.} start_specified, {The startup command was used sometime after RPing a program. Used to zero $BOOT conditionally on restart.} terminal_outfile, {True when the list, or output, namr is a terminal lu, false otherwise.} uses_common:boolean; {True when the last RP'd program uses common, false otherwise.} {dcb TYPE declarations.} file_dcb, {dcb used for opening the original system, and for opening files to be stored into the PROM image files.} prom_dcb, {dcb used for current PROM image file being configured.} snap_dcb, {dcb of snapshot.} sys_dcb:dcb; {dcb of destination system image.} {directory_entry TYPE declarations.} cart_dir, {File directory entry for the cartridge itself.} conflicting_entry, {The entry in a file which conflicts with the current file trying to be stored on PROM.} directory:directory_entry; {File directory entry for the file moved to the PROM 'disk'.} {error_exit type declaraion.} error_path:error_exit; {namr parsing buffer declaration. Only one is needed, and it is used over and over again.} namr_buffer:namr_parse_buffer; {The parsing buffer for NAMR.} {string6 type declarations.} file_name, {Name of the current file being stored into the PROM image.} input_file, {The external name of ifile.} last_command, {Stores the last command entered during phase 4. Used for by prom_description.} login_lu, {ASCII value of the scheduling terminal.} new_name, {Name placed in ID when RPing a program.} origsystem, {Name of original system file.} output_file, {Name of list file.} pform_prompt, {Prompt for pform phase 4.} prom_file, {Name of the prom file being made.} snap_file, {Name of snapshot file.} sys_file:string6; {The name of the file currently containing the modified system image.} {input_line TYPE declarations.} inline:input_line; {The buffer used to read strings given by the user.} {integer TYPE declarations.} bgbp, {Starting address of the background base page partition. Only meaningful when the original system is unmapped.} cur_fde_num, {Keeps track of the currently availiable file directory entry.} cur_file_rec, {Stores the current record number contained in file_dcb.buff, as well as the last record number stored into the prom image file upon exit from the manipulation routines (i.e. fix_short_ids,store_file).} cur_id_addr, {Address of current id being made.} cur_id_num, {Number of current id being made.} cur_prom_file_rec, {Keeps track of the current record availiable on the PROM file being made.} cur_sector, {Sector corresponding to cur_prom_file_rec.} cur_track, {Track corresponding to cur_prom_file_rec.} fdir_entries_per_track, {The number of directory entries which will fit on one track.} file_length, {The last record number of a file which is to be stored on the PROM.} first_dir_track, {First directory track number.} first_fde_rec, {The first record number of the first (highest numberd) directory track.} first_prog_rec, {Keeps track of the first record (header) of the last program stored (via RP or LK) on prom.} first_seg_rec, {Record in type 6 file where the first segment starts.} first_prom_file_rec, {The first record number in the PROM image file of the last file moved to the PROM image. This is used for recovering from FMP errors during the transfer, and for fixing up short and long ids.} fwbg, {Address of the first word of the background partition. Only meaningful for unmapped destination systems.} hi_bpp1, {Stores the high base page address of the last program RPed.} hi_mainp1, {Stores the high main program address (plus 1) of the last program RPed.} id_addr, {Address of the first id segment in the system image.} id_num, {Number of IDs in the system.} ierr, {The status returned from an FMP call. When negative, an error occurred.} irec, {Record length returned by READF.} istrc, {Starting character to tell namr where to begin its parse.} last_prom_file_rec, {last record availiable for stores on the prom image file being made.} last_start_id_addr, {Contains the ID segment address of the last program specified as the start program.} log_lu, {Integer value of the scheduling terminal.} lu_count, {Number of PROM lus formattted so far.} lut_num, {The number of entries in the logical unit table.} lut_addr, {Starting address of the logical unit table.} main_track, {The track on the PROM disc where the last RPed program's main program (not necessarily header) begins.} mat_addr, {Starting address of the mats.} mat_num, {Maximum possible number of mat entries.} matv_addr, {Address in the original system storing the number of defined mats.} matv_num, {Number of MATs defined in the original system.} max_partition_size, {Size, in pages, of the largest partition in the system.} min_prog_size, {The actual minimum partition required by the program being RP'd disregarding the size field of the cur_idseg. Used for range checking in the sz_process routine.} num_labls, {Number of labels to retrieve from the snapshot file. This varies depending upon the mapping attributes of the system.} num_tracks, {Number of tracks on the current PROM disk.} num_segments, {Number of segments in the current program file.} num_unmapped_labels, {The number of labels which must be retrieved from the snapshot when the original system is unmapped. In the mapped case, these labels and more must be defined (see next symbol).} num_mapped_labels, {The number of labels which must be retrieved in from snapshots for mapped systems which are not defined in unmapped snapshots. This is not the total number of labels (num_labls is) for the mapped case.} pages_in_system, {The number of pages in the system image. it is not defined or used in the unmapped case.} physical_memory_size, {The total amount of physical memory, in K words, in the destination system.} prog_size_minus1, {Program size as retrieved from the ID.} prom_crn, {Cartridge reference number of the PROM image file being formatted.} prom_file_len, {Total number of 128 word records in the current PROM image file.} prom_lu, {Lu number corresponding to PROM image file.} prom_num, {The PROM number that a file begins in.} prom_secu, {Security code of the PROM image file being configured.} rec_in_prom_dcb, {Holds the record number corresponding to the contents in memory in prom_dcb.buff.} rec_in_sys_dcb, {Holds the record number corresponding to the contents in memory in sys_dcb.buff.} recs_per_track, {Number of records on one PROM track.} sec_addr, {Address of the system security code.} sect_per_track, {The number of sectors on one PROM track. Retrieved from driver paramater 7 of the DVT pointed to by the specified lu.} segnum, {The number of the segment currently in memory.} start_addr, {Address in system image which holds ID address of startup program.} sys_common_sz, {Size of system common in pages.} sys_crn, {Cartridge reference number of the system image (the bootable PFORM image).} sys_id_csw, {The system checksum word contained in the snapshot header.} sys_com_csw, {System common checksum word contained in the snapshot header.} sys_len, {The length of the system image in 128 word records.} sys_secu:integer; {Security code of system file image.} {isize_type declaration.} {lu_array TYPE declaration.} lus:lu_array; {Stores all the lu's specified so far.} {text TYPE declarations.} ifile, {The input file specified by the runstring, defaults to loglu.} ofile:text; {The output file specified by the runstring, defaults to loglu.}