home *** CD-ROM | disk | FTP | other *** search
- (*************************************************************************
-
- $RCSfile: NonVolatile.mod $
- Description: Interface to nonvolatile.library
-
- Created by: fjc (Frank Copeland)
- $Revision: 3.1 $
- $Author: fjc $
- $Date: 1994/08/08 01:17:07 $
-
- 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 NonVolatile;
-
- (*
- ** $C- CaseChk $I- IndexChk $L+ LongAdr $N- NilChk
- ** $P- PortableCode $R- RangeChk $S- StackChk $T- TypeChk
- ** $V- OvflChk $Z- ZeroVars
- *)
-
- IMPORT E := Exec, SYS := SYSTEM;
-
- (*
- ** $VER: nonvolatile.h 40.8 (30.7.93)
- **
- ** nonvolatile.library interface structures and defintions.
- *)
-
-
- (*****************************************************************************)
-
- TYPE
-
- NVInfoPtr * = CPOINTER TO NVInfo;
- NVInfo * = RECORD
- maxStorage * : E.ULONG;
- freeStorage * : E.ULONG;
- END;
-
-
- (*****************************************************************************)
-
- TYPE
-
- EntryPtr * = CPOINTER TO Entry;
- Entry * = RECORD (E.MinNode)
- name * : E.STRPTR;
- size * : E.ULONG;
- protection * : SET;
- END;
-
- CONST
-
- (* bit definitions for mask in SetNVProtection(). Also used for
- * NVEntry.nve_Protection.
- *)
- eDelete * = 0;
- eAppName * = 31;
-
-
- (*****************************************************************************)
-
- CONST
-
- (* errors from StoreNV() *)
- errBadName * = 1;
- errWriteProt * = 2;
- errFail * = 3;
- errFatal * = 4;
-
-
- (*-- Library Base variable --------------------------------------------*)
-
- CONST
-
- name * = "nonvolatile.library";
-
- TYPE
-
- NonVolatileBasePtr* = CPOINTER TO NonVolatileBase;
- NonVolatileBase* = RECORD (E.Library) END;
-
- VAR
-
- base* : NonVolatileBasePtr;
-
-
- (*-- Library Functions ------------------------------------------------*)
-
- (*
- ** $VER: nonvolatile_protos.h 40.5 (30.7.93)
- *)
-
- (*--- functions in V40 or higher (Release 3.1) ---*)
-
- LIBCALL (base : NonVolatileBasePtr) GetCopyNV *
- ( appName [8] : ARRAY OF CHAR;
- itemName [9] : ARRAY OF CHAR;
- killRequesters [1] : E.LONGBOOL )
- : E.APTR;
- -30;
-
- LIBCALL (base : NonVolatileBasePtr) FreeNVData *
- ( data [8] : E.APTR );
- -36;
-
- LIBCALL (base : NonVolatileBasePtr) StoreNV *
- ( appName [8] : ARRAY OF CHAR;
- itemName [9] : ARRAY OF CHAR;
- data [10] : E.APTR;
- length [0] : E.ULONG;
- killRequesters [1] : E.LONGBOOL )
- : E.UWORD;
- -42;
-
- LIBCALL (base : NonVolatileBasePtr) DeleteNV *
- ( appName [8] : ARRAY OF CHAR;
- itemName [9] : ARRAY OF CHAR;
- killRequesters [1] : E.LONGBOOL )
- : BOOLEAN;
- -48;
-
- LIBCALL (base : NonVolatileBasePtr) GetNVInfo *
- ( killRequesters [1] : E.LONGBOOL )
- : NVInfoPtr;
- -54;
-
- LIBCALL (base : NonVolatileBasePtr) GetNVList *
- ( appName [8] : ARRAY OF CHAR;
- killRequesters [1] : E.LONGBOOL )
- : E.MinListPtr;
- -60;
-
- LIBCALL (base : NonVolatileBasePtr) SetNVProtection *
- ( appName [8] : ARRAY OF CHAR;
- itemName [9] : ARRAY OF CHAR;
- mask [2] : SET;
- killRequesters [1] : E.LONGBOOL )
- : BOOLEAN;
- -66;
-
-
- (* determine the size of data returned by this library *)
- (* #define SizeNVData(DataPtr) ((((ULONG * ) DataPtr)[-1]) - 4) *)
-
- (*------------------------------------*)
- PROCEDURE SizeNVData (DataPtr : E.APTR) : E.ULONG;
- VAR size : LONGINT;
- BEGIN (* SizeNVData *)
- SYS.GET (SYS.VAL (LONGINT, DataPtr) - 4, size);
- RETURN size
- END SizeNVData;
-
-
- (*-- Library Base variable --------------------------------------------*)
- (* $L- *)
-
- (*-----------------------------------*)
- 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 (
- NonVolatileBasePtr,
- E.base.OpenLibrary (name, E.libraryMinimum));
- IF base # NIL THEN SYS.SETCLEANUP (CloseLib)
- ELSIF mustOpen THEN HALT (100)
- END;
- END;
- END OpenLib;
-
- BEGIN
- base := NIL
- END NonVolatile.
-