-- The package FUNDAMENTALS defines a type OFFSET for offset pairs -- and a type SYMBOL_TYPE to contain both a string reprsenting a -- symbol and its length. It also defines pointers to both types. -- An equality operator is defined for SYMBOL_TYPES and several -- operations are defined for OFFSETs. -- Also, the package declares a global symbol TOKEN package fundamentals is CONST_FLAG: constant integer:= 99; LIST_SIZE: constant integer:= 20; TOKEN_SIZE: constant integer:= 20; ERROR_FLAG: constant integer:= -1; -- assume this is an illegal value type symbol_type is record name:string(1..TOKEN_SIZE); length:integer; end record; type symbol_type_ptr is access symbol_type; token:symbol_type_ptr:=new symbol_type; -- Return TRUE iff two symbols are equal function equal(s,t:symbol_type_ptr) return BOOLEAN; ----------------------- the type OFFSET ------------------------------- type offset is record first:integer; second:integer; end record; type offset_ptr is access offset; ------ The three functions below operate on offset pairs as follows: -- Return the first element of an offset pair, given a pointer to the pair -- Return the second element of an offset pair, given a pointer to the pair -- Print both elements of an offset pair function get_first(o:offset_ptr) return integer; function get_second(o:offset_ptr) return integer; procedure print_offset(o:offset_ptr); end fundamentals;