BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
rinonvolatilelib.c File Reference
#include "blitzlib.h"
#include "blitzexec.h"
#include <proto/nonvolatile.h>

Macros

#define __NOLIBBASE__
#define NONVOLATILE_BASE_NAME   libbase

Functions

void _isnonvolatile (void)
void _storenvdata (void)
void _getcopynv (void)
void _freenvdata (void)
void _getnvlist (void)
void rinonvolatilelib_libinit (void)
void rinonvolatilelib_libfinit (void)
static ULONG libinit_c (void)
 init: open nonvolatile.library (any version).
static void libfinit_c (void)
 finit: close nonvolatile.library if it is open.
static ULONG isnonvolatile_c (void)
 IsNonvolatile: true if nonvolatile.library is open.
static ULONG storenvdata_c (CONST_STRPTR app, CONST_STRPTR item, CONST_APTR data, ULONG len)
 StoreNVData AppName,ItemName,data,byte_length: store data in nonvolatile memory (Amiga mode only).
static ULONG getcopynv_c (CONST_STRPTR app, CONST_STRPTR item)
 GetCopyNV(AppName,ItemName): a copy of an item of nonvolatile memory (Amiga mode only).
static ULONG freenvdata_c (APTR data)
 FreeNVData APTR: free the data of GetCopyNV or GetNVList.
static ULONG getnvlist_c (CONST_STRPTR app)
 GetNVList(appname): the list of the items of an application in nonvolatile memory.

Variables

static struct Library * libbase
static const char libname [] = "nonvolatile.library"

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ NONVOLATILE_BASE_NAME

#define NONVOLATILE_BASE_NAME   libbase

Function Documentation

◆ _freenvdata()

void _freenvdata ( void )

◆ _getcopynv()

void _getcopynv ( void )

◆ _getnvlist()

void _getnvlist ( void )

◆ _isnonvolatile()

void _isnonvolatile ( void )

◆ _storenvdata()

void _storenvdata ( void )

◆ freenvdata_c()

ULONG freenvdata_c ( APTR data)
static

FreeNVData APTR: free the data of GetCopyNV or GetNVList.

Parameters
datad0: the data
Returns
d0: the data (0 if the library is not open); a statement, the program does not see it

◆ getcopynv_c()

ULONG getcopynv_c ( CONST_STRPTR app,
CONST_STRPTR item )
static

GetCopyNV(AppName,ItemName): a copy of an item of nonvolatile memory (Amiga mode only).

GetCopyNV with killRequesters -1.

Parameters
appd0: the application name
itemd1: the item name
Returns
d0: the copy (free it with FreeNVData), 0 if there is none or the library is not open

◆ getnvlist_c()

ULONG getnvlist_c ( CONST_STRPTR app)
static

GetNVList(appname): the list of the items of an application in nonvolatile memory.

GetNVList with killRequesters -1.

Parameters
appd0: the application name
Returns
d0: the list (a struct MinList, free it with FreeNVData), 0 if the library is not open

◆ isnonvolatile_c()

ULONG isnonvolatile_c ( void )
static

IsNonvolatile: true if nonvolatile.library is open.

SNE d0:EXT.w d0 - a Blitz truth value as a word (-1/0 in the low word, the thunk keeps the upper word of d0); not BB_BOOL, which is a long.

Returns
d0.w: -1 ($FFFF) if open, 0 if not

◆ libfinit_c()

void libfinit_c ( void )
static

finit: close nonvolatile.library if it is open.

libbase stays set (no defect: it is the last call, see the head).

◆ libinit_c()

ULONG libinit_c ( void )
static

init: open nonvolatile.library (any version).

Returns
d0: the library base, 0 if it could not be opened (BL_NORET: not used by the program)

◆ rinonvolatilelib_libfinit()

void rinonvolatilelib_libfinit ( void )

◆ rinonvolatilelib_libinit()

void rinonvolatilelib_libinit ( void )

◆ storenvdata_c()

ULONG storenvdata_c ( CONST_STRPTR app,
CONST_STRPTR item,
CONST_APTR data,
ULONG len )
static

StoreNVData AppName,ItemName,data,byte_length: store data in nonvolatile memory (Amiga mode only).

Deletes the item first (DeleteNV with killRequesters 0, always, its result ignored: room for the new version in a small NVRAM, no defect; an item that cannot be stored again is lost, #763), then StoreNV with the length in tens of bytes, rounded up, and killRequesters -1. The length is divided as a long (fixed, #764: the original's DIVU.w #10 overflows for 655360 bytes and more, StoreNV then gets the low word of the length, +1 if the high word is not 0).

Parameters
appd0: the application name
itemd1: the item name
datad2: the data
lend3: its length in bytes
Returns
d0.w: -1 (TRUE) when StoreNV stored the data (its result 0), 0 (FALSE) when it did not (an NVERR_... code) and when the library is not open (fixed, #1085: the original returned StoreNV's result, 0 = stored; no defect then in the 0 without the library, #765)

Variable Documentation

◆ libbase

struct Library* libbase
static

◆ libname

const char libname[] = "nonvolatile.library"
static