arossupport
Index
BPTR __CreateSegList(
APTR function, struct ExecBase *SysBase )
Create a SegList, which contains a call to 'function'
function - Function to call when the SegList is executed
BPTR to the SegList that was allocated. This SegList can
be freed by DOS/UnloadSeg. If not enough memory,
BNULL will be returned.
ULONG CalcChecksum(
APTR memory,
ULONG size)
Calculate a checksum for a given area of memory.
memory - Start here
size - This many bytes. Must be a multiple of sizeof(ULONG)
The checksum for the memory. If you store the checksum somewhere
in the area and run CalcChecksum() again, the result will be 0.
To achieve this, you must set the place, where the checksum will
be placed later, to 0 before you call the function.
ULONG mem[512];
mem[0] = 0; // Store checksum here
mem[0] = CalcChecksum (mem, sizeof (mem));
if (CalcChecksum (mem, sizeof (mem))
printf ("Something is wrong !!\n");
else
printf ("Data is unchanged.\n");
This function is not part of a library and may thus be called
any time.
struct RastPort *CloneRastPort(
struct RastPort *rp)
This function creates a copy of a RastPort.
rp - The RastPort to clone.
A pointer to a RastPort with the same attributes as the RastPort
which was specified or NULL if there was not enough memory to perform
the operation.
struct RastPort *CreateRastPort(
void)
This function creates a new RastPort.
A pointer to a new RastPort or NULL if there was not enough memory
to perform the operation.
Print information about all memory lists.
This function is not part of a library and may thus be called
any time.
void DeinitRastPort(
struct RastPort *rp)
Frees the extra contents associated with a RastPort structure.
The structure itself is not freed.
rp - The RastPort which contents are to be freed.
static int FindNextNodes(
APTR memPtr,
struct PNode ** before,
struct PNode ** after)
Returns the addresses of the PNodes right before and right right
after memPtr.
memPtr - The address to look for
before - Pointer to a pointer to PNode where the address of
the node right before memPtr will be stored.
after - Pointer to a pointer to PNode where the address of
the node right after memPtr will be stored.
The number of found PNodes. *before will contain a pointer to
the PNode which is before memPtr or which contains memPtr or NULL
if there is no node before PNode. *after will contain a pointer
to the first PNode which comes right after memPtr or NULL if no
PNode follows memPtr.
Must not be called before Purify_Init().
static struct PNode * FindNode(
APTR memPtr)
Searches for the PNode which contains memPtr.
memPtr - A pointer into a piece of memory previously made known
with Purify_AddMemory.
A pointer to a PNode which contains the memPtr or NULL if there
is no such pointer. No error will be printed.
Must not be called before Purify_Init().
void FreeRastPort(
struct RastPort *rp)
This frees a RastPort obtained with CloneRastPort() or
CreateRastPort().
rp - The result of CloneRastPort() or CreateRastPort().
void FreeStruct(
APTR data,
const IPTR * sd)
Free a structure which was created by ReadStruct().
data - This was returned by ReadStruct() in the dataptr parameter.
Must be non-NULL.
sd - Description of the structure to be read. The first element
is the size of the structure.
void hexdump(
const void * data,
IPTR offset,
ULONG count)
Prints a hexdump of the data beginning at 'data'. The format
is like this:
xxxxxxxx: dddddddd dddddddd dddddddd dddddddd aaaaaaaaaaaaaaaa
Where x is the address (8 chars hex), dd is a data byte (2 chars
hex) and a is the ASCII representation of a data byte or "." if
the data byte is not printable.
data - Start here with the dump
offset - This offset is used as the address in the output. If
you give 0L here, then the first address will be
00000000. If you give (IPTR)data here, then the
first address will be the memory address of the data.
count - How many bytes to print.
BOOL IsDosEntryA(
char * Name,
ULONG Flags)
There is a need in file/directory processing where an application
may need to determine whether a path is just a volume/device or
assignment name.
Name - The path to test.
Flags - Any combination of the following:
LDF_ASSIGNS
LDF_DEVICES
LDF_VOLUMES
BOOL Success;
...
Success = IsDosEntryA("Work:", LDF_VOLUMES)
if (Success == TRUE)
{
...
}
Requires the programmer to open the utility.library and initialise
UtilityBase.
In future releases the buffer size will be set via a taglist.
int kprintf(
const char * fmt,
...)
Formats fmt with the specified arguments like printf() (and *not*
like RawDoFmt()) and uses a secure way to deliver the message to
the user; ie. the user *will* see this message no matter what.
fmt - printf()-style format string
The number of characters output.
This function is not part of a library and may thus be called
any time.
void NastyFreeMem(
APTR mem,
IPTR size)
Overwrites the memory with 0xDEADBEEF before actually freeing it.
mem - Pointer which was returned by AllocMem()
size - Size which was given to AllocMem()
The function may print some infos using kprintf().
This function depends on SysBase.
void Purify_AddMemory(
APTR memPtr,
ULONG size)
Add size bytes of memory at memPtr to watch. Any access to this
memory will be checked after this call.
memPtr - Start of the memory block
size - The size of the memory block
This function is not part of any library and may thus be called at
any time.
void Purify_CheckAccess(
APTR memPtr,
ULONG size,
ULONG type)
Checks a specific kind of access to memPtr[0...size-1].
memPtr - Where the access happens
size - How many bytes are accessed
type - Kind of access (PMA_READ, PMA_WRITE or PMA_MODIFY)
This function is not part of any library and may thus be called at
any time.
void Purify_SetState(
APTR memPtr,
ULONG size,
ULONG state)
Brings a block of memory into a certain state (eg. empty, initialized,
read-only). memPtr and size must be within a block beforehand
declared with Purify_AddMemory().
memPtr - Where to start
size - How many bytes after memPtr
state - The new state of the memory:
PMS_EMPTY - The memory may be read from and written to,
but any read before the first write will yield an
error (read from uninitialized memory).
PMS_INITIALIZED - The memory has been initialized and may
be read and writen to.
PMS_READONLY - The memory may be read but not written to.
PMS_FREE - The memory may not be read from or written to.
void RawPutChars(
const UBYTE * str,
int len)
Emits len bytes of fmt via RawPutChar()
str - string to print
len - how many bytes of str to print
BOOL ReadByte(
struct Hook * hook,
UBYTE * dataptr,
void * stream)
Reads one big endian 8bit value from a streamhook.
hook - Streamhook
dataptr - Put the data here
stream - Read from this stream
The function returns TRUE on success. On success, the value
read is written into dataptr. On failure, FALSE is returned and the
contents of dataptr are not changed.
This function reads big endian values from a streamhook even on
little endian machines.
BOOL ReadDouble(
struct Hook * hook,
DOUBLE * dataptr,
void * stream)
Reads one big endian 64bit double precision floating point value
from a streamhook.
hook - Streamhook
dataptr - Put the data here
stream - Read from this stream
The function returns TRUE on success. On success, the value
read is written into dataptr. On failure, FALSE is returned and the
contents of dataptr are not changed.
This function reads big endian values from a streamhook even on
little endian machines.
BOOL ReadFloat(
struct Hook * hook,
FLOAT * dataptr,
void * stream)
Reads one big endian 32bit floating point value from a streamhook.
hook - Streamhook
dataptr - Put the data here
stream - Read from this stream
The function returns TRUE on success. On success, the value
read is written into dataptr. On failure, FALSE is returned and the
contents of dataptr are not changed.
This function reads big endian values from a streamhook even on
little endian machines.
BOOL ReadLong(
struct Hook * hook,
ULONG * dataptr,
void * stream)
Reads one big endian 32bit value from a streamhook.
hook - Streamhook
dataptr - Put the data here
stream - Read from this stream
The function returns TRUE on success. On success, the value
read is written into dataptr. On failure, FALSE is returned and the
contents of dataptr are not changed.
This function reads big endian values from a streamhook even on
little endian machines.
BOOL ReadString(
struct Hook * hook,
STRPTR * dataptr,
void * stream)
Reads one C string from a streamhook.
hook - Streamhook
dataptr - Put the data here. If you don't need the string anymore,
call FreeVec() to free it.
stream - Read from this stream
The function returns TRUE on success. On success, the string
read is written into dataptr. On failure, FALSE is returned and the
contents of dataptr are not changed. The string must be freed with
FreeVec().
This function reads big endian values from a streamhook even on
little endian machines.
BOOL ReadStruct(
struct Hook * hook,
APTR * dataptr,
void * stream,
const IPTR * sd)
Reads one big endian structure from a streamhook.
hook - Streamhook
dataptr - Put the data here. If NULL, a new memory block is allocated
stream - Read from this stream
sd - Description of the structure to be read. The first element
is the size of the structure.
The function returns TRUE on success. On success, the value
read is written into dataptr. On failure, FALSE is returned and the
contents of dataptr are not changed.
This function reads big endian values from a streamhook even on
little endian machines.
BOOL ReadWord(
struct Hook * hook,
UWORD * dataptr,
void * stream)
Reads one big endian 16bit value from a streamhook.
hook - Streamhook
dataptr - Put the data here
stream - Read from this stream
The function returns TRUE on success. On success, the value
read is written into dataptr. On failure, FALSE is returned and the
contents of dataptr are not changed.
This function reads big endian values from a streamhook even on
little endian machines.
APTR RemoveSList(
APTR * list,
APTR node)
Remove the node from a single linked list.
list - Pointer to the pointer which contains the first element
of the single linked list.
node - The node which is to be removed.
Returns the node if it was in the list.
This function is not part of a library and may thus be called
any time.
int rkprintf(
const STRPTR mainSystem,
const STRPTR subSystem,
int level,
const char * fmt,
...)
Call kprintf if debugging for this main and subsystem is enabled
at a level larger than the level above. The minimal level is 1
(this way, debugging can be disabled in the debug config file
by giving a level of 0).
You should not call this function directly but use the rbug
macro. The rbug macro does some magic to make the handling
more simple.
mainSystem - The main system. Use one of the DBG_MAINSYSTEM_*
macros to avoid typos.
subSystem - The part of the main system. Use one of the
DBG_*_SUBSYSTEM_* macros.
level - The debug level. Higher levels should give more details.
The lowest level is 1.
fmt - printf()-style format string
The number of characters output.
if (cache)
{
...
D(rbug(INTUITION, INPUTHANDLER, 3,
"allocating event from cache (%p)", event
));
...
}
This function is not part of a library and may thus be called
any time.
BOOL WriteByte(
struct Hook * hook,
UBYTE data,
void * stream)
Writes one big endian 8bit value to a streamhook.
hook - Write to this streamhook
data - Data to be written
stream - Stream passed to streamhook
The function returns TRUE on success and FALSE otherwise.
See IoErr() for the reason in case of an error.
This function writes big endian values to a file even on little
endian machines.
BOOL WriteDouble(
struct Hook * hook,
DOUBLE data,
void * stream)
Writes one big endian 64bit double precision floating point value
to a streamhook.
hook - Write to this streamhook
data - Data to be written
stream - Stream passed to streamhook
The function returns TRUE on success and FALSE otherwise.
See IoErr() for the reason in case of an error.
This function writes big endian values to a file even on little
endian machines.
BOOL WriteFloat(
struct Hook * hook,
FLOAT data,
void * stream)
Writes one big endian 32bit floating point value to a streamhook.
hook - Write to this streamhook
data - Data to be written
stream - Stream passed to streamhook
The function returns TRUE on success and FALSE otherwise.
See IoErr() for the reason in case of an error.
This function writes big endian values to a file even on little
endian machines.
BOOL WriteLong(
struct Hook * hook,
ULONG data,
void * stream)
Writes one big endian 32bit value to a streamhook.
hook - Write to this streamhook
data - Data to be written
stream - Stream passed to streamhook
The function returns TRUE on success and FALSE otherwise.
See IoErr() for the reason in case of an error.
This function writes big endian values to a file even on little
endian machines.
BOOL WriteString(
struct Hook * hook,
STRPTR data,
void * stream)
Writes one big endian string to a streamhook.
hook - Write to this streamhook
data - Data to be written
stream - Stream passed to streamhook
The function returns TRUE on success and FALSE otherwise.
See IoErr() for the reason in case of an error.
This function writes big endian values to a file even on little
endian machines.
BOOL WriteStruct(
struct Hook * hook,
void * data,
void * stream,
const IPTR * sd)
Writes one big endian structure to a streamhook.
hook - Write to this streamhook
data - Data to be written
stream - Stream passed to streamhook
sd - Description of the structure to be written. The first element
is the size of the structure.
The function returns TRUE on success and FALSE otherwise. In error,
you can examine IoErr() to find out what was wrong.
This function writes big endian values to a file even on little
endian machines.
SDT_SPECIAL not implemented.
BOOL WriteWord(
struct Hook * hook,
UWORD data,
void * stream)
Writes one big endian 16bit value to a streamhook.
hook - Write to this streamhook
data - Data to be written
stream - Stream passed to streamhook
The function returns TRUE on success and FALSE otherwise.
See IoErr() for the reason in case of an error.
This function writes big endian values to a file even on little
endian machines.
|
|