[environment('sys$common:[syslib]rtl'),
 ident('V1.0')]

module rtl_definitions;

{++
Index of types:
--------------

SYSSIZE				- system size types
  BYTE
  WORD
  LONGWORD
  QUADWORD
SIGNAL_ARRAY			- signal type
MECHANISM_ARRAY			- signal type


Index of procedures:
-------------------

FUNCTION CLI$Present		- check qualifier present
FUNCTION CLI$Get_Value		- get value of cli label
FUNCTION CLI$DCL_Parse		- parse internal command tables
FUNCTION CLI$DISPATCH		- dispatch to internal routine
FUNCTION LIB$DELETE_SYMBOL	- deletes a CLI symbol
FUNCTION LIB$DISABLE_CTRL	- disable control_y or control_t
FUNCTION LIB$DO_COMMAND		- execute a DCL command string
FUNCTION LIB$ENABLE_CTRL	- enable control_y or control_t
FUNCTION LIB$FIND_FILE		- wildcard file search
FUNCTION LIB$GET_SYMBOL		- get value of CLI symbol
FUNCTION LIB$GET_VM		- allocate virtual memory
FUNCTION LIB$INIT_TIMER		- initialize a timer
FUNCTION LIB$INSERT_TREE	- insert entry in balanced binary tree
FUNCTION LIB$LOOKUP_TREE	- lookup entry in a balanced binary tree
FUNCTION LIB$MATCH_COND		- matches condition values
FUNCTION LIB$SET_SYMBOL		- set value of CLI symbol
FUNCTION LIB$SHOW_TIMER		- show value of timer
FUNCTION LIB$SIG_TO_RET		- converts a signal to a return value + unwind
FUNCTION LIB$SIGNAL		- signals a condition
FUNCTION LIB$SPAWN		- spawn a subprocess
FUNCTION LIB$SYS_TRNLOG		- translate logical name
FUNCTION LIB$TRAVERSE_TREE	- calls an action routine for each node
FUNCTION OTS$CVT_L_TI		- convert longword to text integer	
FUNCTION OTS$CVT_TI_L		- convert text integer to longword
FUNCTION OTS$CVT_TZ_L		- convert text hex to longword
FUNCTION STR$UPCASE		- convert string to upper case
FUNCTION STR$COMPARE		- compare two strings


To build the environment library:

	$ PASCAL/NOOBJ RTL.DEF
--}

TYPE
  byte = [byte] -128..127;
  word = [word] -32768..32767;
  quadword = [quad,unsafe]
    record
      l0: unsigned;
      l1: integer;
    end;
  longword = integer;
  ubyte = [byte] 0..255;
  bit1 = [BIT(1),UNSAFE] BOOLEAN;
  bit2 = [BIT(2),UNSAFE] 0..3;
  bit3 = [BIT(3),UNSAFE] 0..7;
  bit4 = [BIT(4),UNSAFE] 0..15;
  bit5 = [BIT(5),UNSAFE] 0..31;
  bit6 = [BIT(6),UNSAFE] 0..63;
  bit7 = [BIT(7),UNSAFE] 0..127;
  bit8 = [BIT(8),UNSAFE] 0..255;
  bit9 = [BIT(9),UNSAFE] 0..511;
  bit10 = [BIT(10),UNSAFE] 0..1023;
  bit11 = [BIT(11),UNSAFE] 0..2047;
  bit12 = [BIT(12),UNSAFE] 0..4095;
  bit13 = [BIT(13),UNSAFE] 0..8191;
  bit14 = [BIT(14),UNSAFE] 0..16383;
  bit15 = [BIT(15),UNSAFE] 0..32767;
  bit16 = [BIT(16),UNSAFE] 0..65535;
  bit17 = [BIT(17),UNSAFE] 0..131071;
  bit18 = [BIT(18),UNSAFE] 0..262143;
  bit19 = [BIT(19),UNSAFE] 0..524287;
  bit20 = [BIT(20),UNSAFE] 0..1048575;
  bit21 = [BIT(21),UNSAFE] 0..2097151;
  bit22 = [BIT(22),UNSAFE] 0..4194303;
  bit23 = [BIT(23),UNSAFE] 0..8388607;
  bit24 = [BIT(24),UNSAFE] 0..16777215;
  bit25 = [BIT(25),UNSAFE] 0..33554431;
  bit26 = [BIT(26),UNSAFE] 0..67108863;
  bit27 = [BIT(27),UNSAFE] 0..134217727;
  bit28 = [BIT(28),UNSAFE] 0..268435455;
  bit29 = [BIT(29),UNSAFE] 0..536870911;
  bit30 = [BIT(30),UNSAFE] 0..1073741823;
  bit31 = [BIT(31),UNSAFE] 0..2147483647;
  bit32 = [BIT(32),UNSAFE] UNSIGNED;
   
  signal_array = array[0..9] of integer;
  mechanism_array = array[0..4] of integer;


FUNCTION CLI$Present
  (%stdescr Name: packed array[l1..u1: integer] of char): integer;
  EXTERN;

FUNCTION CLI$Get_Value
  (%stdescr Name: packed array[l1..u1: integer] of char;
   %stdescr Retbuf: packed array[l2..u2: integer] of char): integer;
  EXTERN;

FUNCTION CLI$DCL_Parse
  (%stdescr Command_String: packed array[l1..u1: integer] of char;
   VAR Tables: integer): integer;
  EXTERN;

FUNCTION CLI$DISPATCH: integer;
  EXTERN;

FUNCTION LIB$DELETE_SYMBOL
  (%stdescr symbol: packed array[l1..u1: integer] of char;
   %ref tbl_ind: integer := 2): integer;
  EXTERN;

FUNCTION LIB$DISABLE_CTRL
  (%ref disable_msk: integer;
   %ref old_msk: integer := %immed 0): integer;
  EXTERN;
   
FUNCTION LIB$DISABLE_CTRL
  (%ref disable_msk: integer;
   %ref old_msk: integer := %immed 0): integer;
  EXTERN;
   
FUNCTION LIB$DO_COMMAND
  (%stdescr cmd_text: packed array[l1..u1: integer] of char): integer;
  EXTERN;

FUNCTION LIB$ENABLE_CTRL
  (%ref enable_msk: integer;
   %ref old_msk: integer := %immed 0): integer;
  EXTERN;
   
FUNCTION LIB$FIND_FILE
  (%stdescr file_name : packed array[l1..u1: integer] of char;
   %stdescr result_name : packed array[l2..u2: integer] of char;
   %ref context : integer := %ref 0;
   %stdescr default_name : packed array[l3..u3: integer] of char := %immed 0;
   %stdescr related_name : packed array[l4..u4: integer] of char := %immed 0): integer;
  EXTERN;

FUNCTION LIB$GET_FOREIGN
  (%stdescr get_str: packed array[l1..u1: integer] of char;
   %stdescr user_prompt: packed array[l2..u2: integer] of char := %immed 0;
   %ref out_len: Word := %immed 0;
   %immed force_prompt: integer := %immed 0): integer;
  EXTERN;

FUNCTION LIB$GET_SYMBOL
  (%stdescr symbol: packed array[l1..u1: integer] of char;
   %stdescr ret_buf: packed array[l2..u2: integer] of char;
   %ref ret_len: word;
   %ref tbl_ind: integer := 2): integer;
  EXTERN;

FUNCTION LIB$GET_VM
  (%ref num_bytes: integer;
   %ref base_adr: integer): integer;
  EXTERN;

FUNCTION LIB$INIT_TIMER: INTEGER;  EXTERN;

FUNCTION LIB$INSERT_TREE
  (%ref treehead: integer;
   %stdescr sym_str: packed array[l1..u1: integer] of char;
   %ref ctrl_flg: integer := %ref 1;
   %ref procedure compare_rtn;
   %ref procedure alloc_rtn;
   %ref newnode: integer;
   %ref user_data: integer := %immed 0): integer;
  EXTERN;
   
FUNCTION LIB$LOOKUP_TREE
  (%ref treehead: integer;
   %stdescr sym_str: packed array[l1..u1: integer] of char;
   %ref procedure compare_rtn;
   %ref newnode: integer): integer;
  EXTERN;

[ASYNCHRONOUS]
FUNCTION LIB$MATCH_COND
  (VAR cond_val: integer; 
   %ref cond_val_i: integer): integer;
  EXTERN;

FUNCTION LIB$SET_SYMBOL
  (%stdescr symbol: packed array[l1..u1: integer] of char;
   %stdescr value: packed array[l2..u2: integer] of char;
   %ref tbl_ind: integer := 2): integer;
  EXTERN;

FUNCTION LIB$SHOW_TIMER: INTEGER; EXTERN;

FUNCTION LIB$SIG_TO_RET
  (var sa: signal_array; var ma: mechanism_array): integer;
  EXTERN;

FUNCTION LIB$SIGNAL
  (%ref cond_val: integer;
   %immed num: integer := %immed 0;
   %stdescr s1: packed array[l1..u1: integer] of char := %immed 0;
   %stdescr s2: packed array[l2..u2: integer] of char := %immed 0): integer;
  EXTERN;
         
FUNCTION LIB$SPAWN
  (%stdescr command_string: packed array[l1..u1: integer] of char := %immed 0;
   %stdescr input_file: packed array[l2..u2: integer] of char := %immed 0;
   %stdescr output_file: packed array[l3..u3: integer] of char := %immed 0;
   %ref flags: integer;
   %stdescr process_name: packed array[l4..u4: integer] of char := %immed 0;
   %ref process_id: integer;
   %ref completion_status: integer;
   %immed [unbound, asynchronous] procedure astadr := %immed 0;
   %immed astprm: unsigned := %immed 0;
   %stdescr prompt: packed array[l5..u5: integer] of char := %immed 0;
   %stdescr cli: packed array[l6..u6: integer] of char := %immed 0): integer;
  EXTERN;

FUNCTION LIB$SYS_TRNLOG
  (%STDESCR logical_name: packed array[l1..u1: integer] of char;
   %ref dst_len: integer := 0;
   %STDESCR dst_str: packed array[l2..u2: integer] of char;
   %ref table: byte := 0;
   %ref acc_mode: byte := 0;
   %ref dsb_msk: byte := 0): integer;
  EXTERN;

FUNCTION OTS$CVT_L_TI(
  %ref value: integer;
  %stdescr out_str: packed array[l1..u1: integer] of char;
  %immed int_digits: integer := %immed 1;
  %immed value_size: integer := %immed 4;
  %immed flags: integer := %immed 0): integer;
  EXTERN;

FUNCTION OTS$CVT_TI_L(
  %stdescr inp_str: packed array[l1..u1: integer] of char;
  VAR value: integer;
  %immed value_size: integer := %immed 4;
  %immed flags: integer := %immed 1): integer;
  EXTERN;

FUNCTION OTS$CVT_TZ_L
  (%stdescr Inp_Str: packed array[l1..u1: integer] of char;
   VAR Value: integer;
   %immed Value_Size: integer := 4;
   %immed Flags: integer := %immed 1): integer;
  EXTERN;

[ASYNCHRONOUS]
FUNCTION STR$UPCASE
  (%stdescr i: packed array[l1..u1: integer] of char;
   %stdescr o: packed array[l2..u2: integer] of char): integer;
  EXTERN;

FUNCTION STR$COMPARE
  (%stdescr src1_str: packed array[l1..u1: integer] of char;
   %stdescr src2_str: packed array[l2..u2: integer] of char): integer;
 EXTERN;


end.  {rtl}
