(**************************************************************************

     $RCSfile: RexxSysLib.mod $
  Description: Interface to rexxsyslib.library

   Created by: fjc (Frank Copeland)
    $Revision: 3.2 $
      $Author: fjc $
        $Date: 1994/08/08 01:12:04 $

  $VER: rexxsyslib_protos.h 36.3 (19.2.91)
  Includes Release 40.15

  (C) Copyright 1990-1993 Commodore-Amiga, Inc.
      All Rights Reserved

  Oberon-A interface Copyright © 1994, Frank Copeland.
  This file is part of the Oberon-A Interface.
  See Oberon-A.doc for conditions of use and distribution.

***************************************************************************)

MODULE RexxSysLib;

(*
** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
** $V- OvflChk       $Z- ZeroVars
*)

IMPORT E := Exec, RX := Rexx, SYS := SYSTEM;

(*-- Library Base variable --------------------------------------------*)

TYPE

  RxsLibPtr = CPOINTER TO RxsLib;
  RxsLib = RECORD (RX.RxsLib) END;

VAR

  base *  : RxsLibPtr;
  cleanup : PROCEDURE (rc : LONGINT);


(*-- Library Functions ------------------------------------------------*)

(* --- functions in V33 or higher (distributed as Release 1.2) ---*)

LIBCALL (base : RxsLibPtr) CreateArgstring*
  ( string [8] : ARRAY OF CHAR;
    length [0] : E.ULONG )
  : E.STRPTR;
  -126;
LIBCALL (base : RxsLibPtr) DeleteArgstring*
  ( argstring [8] : E.STRPTR );
  -132;
LIBCALL (base : RxsLibPtr) LengthArgstring*
  ( argstring [8] : E.STRPTR )
  : E.ULONG;
  -138;
LIBCALL (base : RxsLibPtr) CreateRexxMsg*
  ( port      [8] : E.MsgPortPtr;
    extension [9] : ARRAY OF CHAR;
    host      [0] : ARRAY OF CHAR )
  : RX.RexxMsgPtr;
  -144;
LIBCALL (base : RxsLibPtr) DeleteRexxMsg*
  ( packet [8] : RX.RexxMsgPtr );
  -150;
LIBCALL (base : RxsLibPtr) ClearRexxMsg*
  ( msgptr [8] : RX.RexxMsgPtr;
    count  [0] : E.ULONG );
  -156;
LIBCALL (base : RxsLibPtr) FillRexxMsg*
  ( msgptr [8] : RX.RexxMsgPtr;
    count  [0] : E.ULONG;
    mask   [1] : E.WSET )
  : BOOLEAN;
  -162;
LIBCALL (base : RxsLibPtr) IsRexxMsg*
  ( msgptr [8] : RX.RexxMsgPtr )
  : BOOLEAN;
  -168;


LIBCALL (base : RxsLibPtr) LockRexxBase*
  ( resource [0] : E.ULONG );
  -450;
LIBCALL (base : RxsLibPtr) UnlockRexxBase*
  ( resource [0] : E.ULONG );
  -456;


(*-- Library Base variable --------------------------------------------*)
(* $L- Address globals through A4 *)


(*-----------------------------------*)
PROCEDURE* CloseLib ();

BEGIN (* CloseLib *)
  IF base # NIL THEN E.base.CloseLibrary (base) END;
END CloseLib;

(*-----------------------------------*)
PROCEDURE OpenLib * (mustOpen : BOOLEAN);

BEGIN (* OpenLib *)
  IF base = NIL THEN
    base :=
      SYS.VAL (
        RxsLibPtr,
        E.base.OpenLibrary (RX.name, E.libraryMinimum));
    IF base # NIL THEN SYS.SETCLEANUP (CloseLib)
    ELSIF mustOpen THEN HALT (100)
    END;
  END;
END OpenLib;


BEGIN
  base := NIL
END RexxSysLib.
