Carbon


ATSUCustomGrowFunc

Header: ATSUnicode.h Carbon status: Supported

Defines a pointer to a callback function that handles memory reallocation. Your callback function manages memory reallocation operations typically handled by ATSUI.

typedef void(*ATSUCustomGrowFunc) (
    void *refCon, 
    void *oldBlock, 
    ByteCount oldSize, 
    ByteCount newSize
);

You would declare your function like this if you were to name it MyCallback:

void *MyCallback (
    void *refCon, 
    void *oldBlock, 
    ByteCount oldSize, 
    ByteCount newSize
);
Parameter descriptions
refCon

On input, ATSUI passes your MyATSUCustomGrowCallback function a pointer to arbitrary data previously supplied by your application in the memoryRefCon field of the ATSUMemoryCallbacks union.

oldBlock

On input, ATSUI passes your MyATSUCustomFreeCallback function a pointer to the beginning of the block of memory to grow. ATSUI passes this value to your application.

oldSize

ATSUI passes your MyATSUCustomFreeCallback function the size (in bytes) of the memory prior to growing. Your callback function can use this to determine the number of bytes of memory to copy if you need to allocate memory for the grown block.

newSize

ATSUI passes your MyATSUCustomFreeCallback function the size (in bytes) of the memory after growing.

DISCUSSION

You can register your callback function by calling the function ATSUCreateMemorySetting and passing the constant kATSUUseCallbacks in iHeapSpec and a pointer to the ATSUMemoryCallbacks union in iMemoryCallbacks. You then supply a pointer of type ATSUCustomGrowFunc in the Grow field of the callbacks structure of the ATSUMemoryCallbacks union.

Note that your MyATSUCustomGrowCallback function is expected to return a pointer to the start of the allocated memory, unless it terminates in an application.

VERSION NOTES

Available beginning with ATSUI 1.1.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)