DEFINITION Rsrc; (* SJ *)


(* Rsrc not only contains the TOS routines for resource files but also
 * routines for using resource files included in the code. This is
 * necessary for accessories.
 * All resource files loaded will be disposed automatically on exit.
 *)

TYPE header* = RECORD
                Version*     : INTEGER;
                ObjectPos*   : INTEGER;
                TedinfoPos*  : INTEGER;
                IconblkPos*  : INTEGER;
                BitblkPos*   : INTEGER;
                FreeStrPos*  : INTEGER;
                StringPos*   : INTEGER;
                ImagePos*    : INTEGER;
                FreeImgPos*  : INTEGER;
                TreeTblPos*  : INTEGER;
                NumObjects*  : INTEGER;
                NumTrees*    : INTEGER;
                NumTedinfos* : INTEGER;
                NumIcons*    : INTEGER;
                NumBitblks*  : INTEGER;
                NUmStrings*  : INTEGER;
                NumImages*   : INTEGER;
                RscSize*     : INTEGER;
              END(*RECORD*);


PROCEDURE Load* (Name : ARRAY OF CHAR) : BOOLEAN;


PROCEDURE Free* ();


PROCEDURE GetAddr* (Object : INTEGER) : LONGINT;


PROCEDURE SetAddr* (Object : INTEGER; Addr : LONGINT);


PROCEDURE Obfix* (Tree : LONGINT; Object : INTEGER);


PROCEDURE Init* (BaseAddr : LONGINT);

(* initializes an integrated resource file. BaseAddr is the address of
   the procedure containing the resource file :

   PROCEDURE Procedure;
    BEGIN
     SYSTEM.INLINE(...); (* the resource file *)
   END Procedure;
   ...
   Rsrc.Init(S.ADR(Procedure));
*)

PROCEDURE TreeAddr* (BaseAddr : LONGINT; Index : INTEGER) : LONGINT;

(* returns the tree address for an integrated resource file. Use it instead
   of GetAddr.
*)

END Rsrc.
