beautypg.com

Parts 12 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 509

background image

C H A P T E R 1 2

Special-Purpose Objects for Data Storage and Retrieval

About Special-Purpose Storage Objects

12-3

Normal binary objects encapsulate their data and reside entirely in the NewtonScript
heap; thus, creating one of these objects or reading any of its data requires an
amount of heap space sufficient to hold all its data. Therefore, the size of a normal
binary object is limited by the amount of NewtonScript heap space available at the
time it is created. For example, a binary object encapsulating 5 KB of data requires
5 KB of NewtonScript heap space. If sufficient heap space is not available, the
binary object cannot be created.

In contrast, VBO data resides on a store specified when the VBO is created. The
system manages VBO data automatically, providing NewtonScript objects with
transparent access to it on demand. A VBO can hold more data than a normal
binary object because it is not limited by the amount of free space available in the
NewtonScript heap. Contrasting the previous example, a VBO holding 5 KB of
data requires a negligible amount of heap space, because its data resides in store
memory, rather than in the NewtonScript heap.

Note

The system does not allocate store memory for VBO data until it
is needed to write data to the store. Testing the amount of store
memory available when the VBO is created does not guarantee
the future availability of this memory. Thus, it is possible to fail
due to lack of store space when writing to a VBO, even though the
VBO was created successfully. The only practical solution to this
problem is to enclose in a

try

block any code that writes VBO

data.

Parts

12

Recall that a package is the basic unit of downloadable Newton software: it
provides a means of loading code, resources, objects, and scripts into a Newton
device. A package consists of one or more constituent units called parts.

The format of a part is identified by a four-character identifier called its type or
its part code. Table 12-1 on page 12-4 lists the various kinds of parts and their
associated
type identifiers.

Some of the parts described in Table 12-1 may already be familiar to you.

Form

parts are the Newton application packages you create with Newton Toolkit.

Book

parts are the interactive digital books described in the

Newton Book Maker User’s

Guide

. Store parts (parts of type

soup

) are useful for the storage of read-only data

and are discussed later in this chapter. Dictionary parts (parts of type

dict

)

supplement the built-in word lists used by the recognition subsystem.

Font

parts

are used to add new typefaces to Newton devices; for more information about these
parts, contact Newton Developer Technical Support.

Auto

parts are described in

the Newton Toolkit User’s Guide.