beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 385

background image

C H A P T E R 1 0

Recognition: Advanced Topics

Using Advanced Topics in Recognition

10-9

Creating a recConfig Frame

10

For any view that is to use a

recConfig

frame, you must supply a

recConfig

slot, usually by defining it in your view’s template. The frame in your view’s

recConfig

slot must be modifiable; that is, it must be RAM-based. When your

view template supplies a

recConfig

frame, the view system builds a RAM-based

recConfig

frame along with the view—you need not do anything more to cause

the view to use the

recConfig

frame.

To create your own

recConfig

frame at run time, you need to call the

PrepRecConfig

function to create a RAM-based

recConfig

frame that the

system can use. Although you could obtain similar results by cloning a

recConfig

frame that your view template defines, using the

PrepRecConfig

function is more efficient:

The

PrepRecConfig

function creates a smaller frame than that obtained by

cloning your view template’s

recConfig

frame.

The frame that the

PrepRecConfig

function returns can be used as it is by the

recognition system. Any other frame that you place in the view’s

recConfig

slot is used by the system to create the

recConfig

frame actually used by the

view, with the result being the creation of two frames in RAM rather than just one.

Consistent use of this function to create

recConfig

frames saves RAM by

permitting similar

recConfig

frames to share the same frame map.

A function similar to the

PrepRecConfig

function, the

BuildRecConfig

function, is provided for debugging use. Do not use the

BuildRecConfig

function to create your RAM-based

recConfig

frame. The argument to the

BuildRecConfig

function is the view itself, rather than its

recConfig

frame.

This function builds an appropriate

recConfig

frame for the specified view,

regardless of whether the view defines one. The system does not use the

recConfig

frame that this function returns, however—as stated previously, this

frame is for debugging use only.

IMPORTANT

The contents of the

inputMask

slot in the view’s

recConfig

frame must match the input mask (the recognition-related bits)
provided by the view’s

viewFlags

slot. For more information on

this slot and others that the

recConfig

frame may contain, see

“protoRecConfig” (page 8-36) in Newton Programmer’s
Reference
.

You can base your

recConfig

frame on one of the system-supplied

recConfig

frames by simply placing the appropriate constant in your view template’s

recConfig

slot. Alternatively, you can place in this slot a frame that uses its

_proto

slot to reference one of the system-supplied

recConfig

frames. A third

way to define a

recConfig

frame is to supply all necessary values yourself. The