Carbon


ATSUCustomAllocFunc

Header: ATSUnicode.h Carbon status: Supported

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

typedef void(*ATSUCustomAllocFunc) (
    void *refCon, 
    ByteCount howMuch
);

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

void *MyCallback (
    void *refCon, 
    ByteCount howMuch
);
Parameter descriptions
refCon

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

howMuch

On input, ATSUI passes the amount of memory (in bytes) that you need to allocate.

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 ATSUCustomAllocFunc in the Alloc field of the callbacks structure of the ATSUMemoryCallbacks union.

This is a test of the CodeLines - Container element

Both of these lines should appear in betwwen computer voice.

Note that your MyATSUCustomAllocCallback 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)