{ * * NAME: BUGBL * SOURCE: 92071-18340 * 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 BUILD and its segments. This file is merged into BUILD and its segments at compilation time by the include directive. There is obviously no relocatable file corresponding to BUGBL, 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$ {I assume clauses are partially evaluated. Do not change this directive.} $partial_eval on$ {Turn off range checking to improve speed and reduce size. This should be turned on when modifying the sources substantially.} 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 '; not_enough_mem='NOT ENOUGH MEMORY FOR PROGRAM'; no_free_part='NO FREE PARTITION '; idseg_length=30; {Length in words of an id segment.} {These strings are used by the header routines.} head1= '************************************************************************'; head2= '* *'; line_length=72; {Length of an input line (max).} mat_length=3; {Number of words in a mat entry.} max_num_labls=10; {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.} 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.} recds_per_k=1024 DIV recd_len; space1=' '; space2=' '; star_error='*ERROR - '; symbuff_length=2400; {Size of buffer given to relink routine.} {BUS2 is small relative to BUS1, so the symbol table required by relink can be made large at a small cost (slower segment load of BUS2). The size is set to roughly even up the segments. relink is happy if this value ranges from 1-5k (26 words is the minimum acceptable).} 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=(fileinit,getcommand,defpartitions, rpprocess,szprocess,paprocess,ssprocess, questionprocess,ptprocess,stprocess, handleerror,cleanupfiles,prprocess); {Declare the integer TYPE to be single word.} integer=minint..maxint; {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; {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; {A field in the id is a double word integer, so define such a type for completeness.} doubint=-214748647..214748647; {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=0..255; byte=eight_bits; 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 structure of an L20 id segment is now defined. This allows convenient modification of id segments stored in memory, and allows defining a dcb buffer in terms of a long id segment (i.e. for a type 6 file).} 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; {The idseg_type combines the above record with an integer array variant field to allow storing an id segment into the system image using putword.} idseg_type= RECORD CASE boolean OF true:(id:id_seg_l20); false:(ints: ARRAY [1..idseg_length] OF 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; {The TYPE dcb is used to make data control blocks for FMP calls.} {The RECORD structure allows calls to readf and writf routines with type 1 access, but without having a seperate dcb and buffer, and allows treating a part of the type 6 header as an id segment structure.} dcb= RECORD header:ARRAY [1..16] OF integer; CASE boolean OF true:(buff:buffer); false:(id:id_seg_l20; ext:id_extension_l20) END; {error_type handles certain compiler errors.} error_type = (run,ema,io,fmp,seg,warn); {error_exit is an enumeration of the non interactive error handling possibilities.} error_exit = (uncond_abort,uncond_end,uncond_continue); {fname is a six character string array.} fname=PACKED ARRAY [1..6] OF char; {words is used as a tag selector in a variant record.} words=(one,three,two_point5,ints); {The TYPE string6 is a string of six characters. It is used for file names and user replies.} string6= RECORD CASE words OF one: (command: PACKED ARRAY [1..2] OF char; words_two_three: PACKED ARRAY [3..6] OF char); three: (file_name: fname); two_point5: (five_char: PACKED ARRAY [1..5] OF char); ints: (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 array used by FMP to denote length of files created (ecrea).} isize_type=ARRAY [1..2] OF doubint; {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; {prtn is used to return a string (ABORTED or ENDED) to the scheduling program. This next TYPE defines the string's structure.} 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.} {boolean TYPE declarations.} abort, {True when user wishes to abort, false otherwise.} auto_partitioning, {True when the user requested automatic MAT definition.} build_ended, {True when /E typed.} completed_partitioning, {True when /C is typed.} echo_read, {True when all readlines must be echoed to the output file, false otherwise.} echo_write, {True when all writes must be echoed to the input file, false otherwise.} first_rp_process, {True the first time through rp_process, false at all other times.} interactive, {True when BUILD is being run from an interactive device, false if not.} made_sys_file, {True when the BUILD system output file was successfully made.} restart_partitioning, {True when /R is typed.} rp_error, {True when an error was detected processing an RP command.} slash_control, {True when a valid / control character is typed.} start_specified, {True when some program was specified to be the startup program.} terminal_outfile:boolean; {True when the list, or output, namr is a terminal lu, false otherwise.} {dcb TYPE declarations.} prog_dcb, {dcb used for original system, and programs to be moved to the outfile.} snap_dcb, {dcb of snapshot.} sys_dcb:dcb; {dcb of the destination system image.} max_mem_size:doubint; {Maximum memory (in pages) size which BUILD can construct as constrained by availiable disk space.} {Define the error exit global.} 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.} build_prompt, {Prompt for build phase 3.} input_file, {The external name of ifile.} login_lu, {ASCII value of the scheduling terminal.} origsystem, {Name of original system file.} output_file, {Name of list file.} prog_name, {Name of last program RPed.} snap_file, {Name of snapshot file.} sys_file:string6; {The name of the BUILD image file being made.} {id_seg_l20 TYPE declaration.} cur_idseg:idseg_type; {Copy of idseg for program being RP'd.} {input_line TYPE declarations.} inline:input_line; {The buffer used to read strings given by the user.} {int_or_chars TYPE declaration.} user_command:int_or_chars; {Stores the user command (RP,etc) for use by best_part.} {integer TYPE declarations.} cur_id_number, {Number of next free id.} cur_mat_number, {Number of next free mat.} cur_sys_rec, {Keeps track of the current record of the BUILD system which is stored in its buffer.} id_addr, {Address of the first id segment in the system image.} ierr, {The status returned from an FMP call. When an error occurs, ierr is the negative FMP error code.} istrc, {Starting character to tell namr where to begin its parse.} 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.} mat_addr, {Starting address of the mats.} matv_addr, {Address where the number of defined MATs in the system is stored.} mem_size, {The memory size of the destination system in K words (rounded up if not integral).} 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_ids, {Maximum number of IDs in the system.} num_labls, {Number of labels to retrieve from the snapshot file.} num_mats, {Maximum number of possible MATs in the system.} num_matvs, {Number of defined, or availiable MATs in the system.} prog_len, {The length in records of the file to be transferred to the BUILD image file.} rem_memory, {Used to keep track of remaining memory when constructing partitions.} roundoff_blocks, {The -1 create will typically return a few blocks which are not used due to page boundaries. This variable insures these blocks will be truncated at close time.} sec_addr, {Address of the system security code.} 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 BUILD 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 pages (K words).} sys_secu:integer; {Security code of BUILD file image.} {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.}