Previous Book Contents Book Index Next

Inside Macintosh: Memory /
Chapter 2 - Memory Manager / Memory Manager Reference
Memory Manager Routines


HGetState

You can use the HGetState function to get the current properties of a relocatable block (perhaps so that you can change and then later restore those properties).

FUNCTION HGetState (h: Handle): SignedByte;
h
A handle to a relocatable block.
DESCRIPTION
The HGetState function returns a signed byte containing the flags of the master pointer for the given handle. You can save this byte, change the state of any of the flags, and
then restore their original states by passing the byte to the HSetState procedure, described next.

You can use bit-manipulation functions on the returned signed byte to determine the value of a given attribute. Currently the following bits are used:
BitMeaning
0-4Reserved
5Set if relocatable block is a resource
6Set if relocatable block is purgeable
7Set if relocatable block is locked

If an error occurs during an attempt to get the state flags of the specified relocatable block, HGetState returns the low-order byte of the result code as its function result. For example, if the handle h points to a master pointer whose value is NIL, then the signed byte returned by HGetState will contain the value -109.

ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit for HGetState are
Registers on entry
A0Handle whose properties you want to get
Registers on exit
D0Byte containing flags

RESULT CODES
noErr0No error
nilHandleErr-109NIL master pointer
memWZErr-111Attempt to operate on a free block

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996