Penpoint API Reference Volume 2 June 1992
Penpoint API Reference Volume 2 June 1992
Penpoint API Reference Volume 2 June 1992
PenPofnt
PenPoint1M
API Reference
VOLUME II
GO CORPORATION
GO TECHNICAL LIBRARY
PenPoint
lM
API Reference
VOLUME II
GO CORPORATION
GO TECHNICAL LIBRARY
ISBN 0-201-60863-4
123456789-AL-9695949392
First Printing, June 1992
Preface
The PenPoint API Reference provides reference information on the subsystems of
the PenPoint™ operating system. Volume I describes the functions and messages
that you use to manipulate classes and describes the fundamental classes used by
almost all PenPoint applications. Volume II describes the supplemental classes and
functions that provide many different capabilities to PenPoint applications. The
text in this volume was generated from the header files in \PENPOINT\SDK\INC.
Intended Audience
The PenPoint API Reference is written for people who are developing applications
and services for the PenPoint operating system. We assume that you are familiar
with the C language, understand the basic concepts of object-oriented
programming, and have read the PenPoint Application Writing Guide.
What's Here
The PenPoint API Reference is divided into several parts, which are split across two
volumes. Volume I contains these parts:
• Part 1: Class Manager describes the PenPoint class manager classes, which
supports object-oriented programming in PenPoint.
• Part 2: PenPoint Application Framework describes the PenPoint Application
Framework classes, which provides you the tools you use to allow your
application to run under the notebook metaphor.
• Part 3: Windows and Graphics describes ImagePoint classes and how
applications can control the screen (or other output devices).
• Part 4: UI Toolkit describes the PenPoint classes that implement many of the
common features required by the PenPoint user interface.
• Part 5: Input and Handwriting Translation describes the PenPoint input
system classes and classes that provide programmatic access to the
handwriting translation subsystems.
Volume II contains these parts:
• Part 6: Text Component describes the PenPoint classes that allow any
application to provide text editing and formatting capabilities to its users.
• Part 7: File System describes the PenPoint file system. classes.
• Part 8: System Services describes the function calls that applications can use
to access kernel functions, such as memory allocation, timer services, process
control, and so on.
vi PENPOINT API REFERENCE
• Part 9: Utility Classes describes a wide variety of classes that save application
writers from implementing fundamental things such as, list manipulation,
data transfer, and so on.
• Part 10: Connectivity describes the classes that applications can use to access
remote devices.
• Part 11: Resources describes the classes used to read, write, and create
PenPoint resource files.
• Part 12: Installation API describes the PenPoint classes that support installing
applicatibns, services, fonts, dictionaries, handwriting prototypes, and so on.
• Part 13: Writing PenPoint Services, describes classes used in writing an
installable service.
r Computerese
We use fonts to distinguish two different forms of "computerese":
• C language keywords and preprocessor directives, such as switch,
case, idefine, iifdef, and so on.
• Functions, macros, class names, message names, constants, variables,
and structures defined by PenPoint, such as msgListAddltem, dsList,
stsBadParam, P_LIST_NEW, and so on.
Although all these PenPoint terms use the same font, you should note that
PenPoint has some fixed rules on the capitalization and spelling of messages,
functions, constants, and types. By the spelling and capitalization, you can
quickly identify the use of a PenPoint term.
• Classes begin with the letters "ds"; for example, dsList.
• Messages begin with the letters "msg"; for example, msgNew.
• Status values begin with the letters "sts"; for example, stsOK.
• Functions are mixed case with an initial upper case letter and trailing
parentheses; for example, OSMemAvailableO.
• Constants are mixed case with an initial lower case letter; for example,
wsClipChildren.
• Structures and types are all upper case (with underscores, when needed,
to increase comprehension); for example, U32 or LIST_NEW_ONLY.
Placeholders
Anything you do not have to type in exactly as printed is generally formatted in
italics. This includes C variables, suggested filenames in dialogs, and pseudocode
in file listings.
Other Text
The documentation uses italics for emphasis. When a Part uses a significant term,
it is usually emphasized the first time. If you aren't familiar with the term, you can
look it up in the glossary in the PenPoint Application Writing Guide or the index of
the book.
DOS filenames such as \\BOOT\PENPOINT\APP are in small capitals. PenPoint file
names can be upper and lower case, such as \My Disk\\Package Design Letter.
Book names such as PenPoint Application Writing Guide are in italics.
~ Part 6 / Text NPITEM.H 261
TENCODE.H NPSCR.H 269
3
TV_TAGS.H NPTEXf.H 271
7
TXTDATA.H ORDSET.H 273
9
TXTVIEW.H QHELP.H 283
31
TXTXLIST.H SEL.H 287
45
SPELL.H 299
~ Part 7 / File System 49 SPMGRH 303
FILETYPE.H 51 SR.H 305
FS.H 53 STROBJ.H 309
FSUTIL.H 75 TS.H 311
STREAM.H 79 UNDO.H 323
UUID.H 83 XFER.H 331
VOL.H 85
,,~ Part 10 / Connectivity 343
VOLGODIR.H 103
VSEARCH.H ABMGRH 345
115
ADDRBOOKH 351
". Part 8 / System Services 119 ATALKH 365
CMPSTEXT.H 121 CNCTIONS.H 369
GOMATH.H 123 DIALENY.H 379
INTL.H 131 FLAP.H 391
OS.H 135 HSLINKH 393
OSHEAP.H 155 HSPKT.H 395
OSPRIY.H 165 INBXSVC.H 399
OSTYPES.H 171 IOBXSVC.H 409
SORT.H 175 LINKH 419
TIMER.H 177 MODEM.H 423
OBXSVC.H 437
~. Part 9 / Utility Classes 181 OPENSERY.H 449
BKSHELEH 183 PPORT.H 451
BROWSERH 185 SENDSERY.H 455
BYTARRAY.H 199 SERLINKH 459
BYTEBUEH 205 SIO.H 461
DSKVIEW.H 207 TP.H 469
EXPORT.H 215
GMARGIN.H
",. Part II / Resources 473
219
HASH.H 221 PREFS.H 475
IMPORT.H 229 RESCMPLR.H 485
LIST.H 233 RESFILE.H 489
NOTEPAPRH 241 RESUTIL.H 507
NPDATA.H 253 SETTINGS.H 509
'''' Part 12 / Installation API 511
APPIMGR.H 513
AUXNBMGR.H 517
CODEMGRH 525
DYNTABLE.H 529
FONTMGRH 533
HWXMGR.H 537
INIFILE.H 541
INSTALL.H 543
INSTLMGRH 545
INSTLSHT.H 563
PDICTMGR.H 567
SERVIMGRH 569
SYSTEM.H 573
TEIsSentenceEnd
Determines if' c' is a sentence-ending character.
Returns BOOLEAN.
BOOLEAN EXPORTED
Fundion Prototype TEIsSentenceEnd (
TEXT_CHAR_TABLE table,
CHAR c);
Comments Returns true if and only if' c' is a sentence-ending character.
TEIsLineBreak
Determines if' c' forces a line-break.
Returns BOOLEAN.
BOOLEAN EXPORTED
Fundion Prototype TEIsLineBreak (
TEXT_CHAR_TABLE table,
CHAR c);
Comments Returns true if and only if' c' forces a line-break.
TEIsBlank
Determines if'c' acts as a blank/space character.
Returns BOOLEAN.
BOOLEAN EXPORTED
Function Prototype TEIsBlank (
TEXT_CHAR_TABLE table,
CHAR c);
Comments More than one character may act as a blank/space for some purposes. For example, a non-breaking
blank!space; none is defined for the PenPoint Developers Release. Returns true if and only if'c' acts as a
blank!space character.
TEIsSpeciaiPunct
Determines if' c' is a "special" punctuation character.
Returns BOOLEAN.
BOOLEAN EXPORTED
Function Prototype TEIsSpecialPunct (
TEXT_CHAR_TABLE table,
CHAR c);
(omments Such characters end a word or sentence unless surrounded by alphanumerics. The period and commas in
numbers are the most obvious case. Special punctuation might also include the periods in something
like "Section II.A.i: The Rise and Fall of Punctuation". Since the surrounding context is not available to
this function, it simply indicates whether the character can function as special punctuation; the caller
must then examine the context to decide whether the character is actually special punctuation.
Returns true if and only if' c' is a "special" punctuation character.
TENCODE.H 5
Exported Functions and Macros
TEIsWord
Determines if' c' is part of a "normal" word.
Returns BOOLEAN.
BOOLEAN EXPORTED
l
fundion Prototype TEl sWord (
TEXT_CHAR_TABLE table,
CHAR c);
**
*include <uid.h>
ifndef UID INCLUDED
endif
*II Allocated clsTextView TAGs: 1-54, 94-95
Road Map
Clients manipulating the character contents of the text Data might use:
• msgTextGet
• msgTextGetBuffer
• msgTextModify
Clients manipulating the attributes stored in textData might use:
• msgTextChangeAttrs
• msgTextClearAttrs
• msgTextGetAttrs
• msgTextlnitAttrs
• msgTextPrin tAttrs
• Textlni tCharAttrsO
• TextlnitCharMaskO
• TextlnitParaAttrsO
• TextlnitParaMaskO
• TextDeleteManyO
• TextlnsertOneO
Clients manipulating a textData's embedded objects might use:
• msgTextEmbedObject
• msgTextExtractO bject
• msgTextEnumEmbeddedObjects
Clients needing to work with words, sentences or paragraphs might use:
• msgTextSpan
• msgTextSpanType
10 PENPOINT API REFERENCE
Part 6 / Text
• msgTextRead
• msgTextWrite
Clients observing a textData might want to handle:
• msgTextAffected
• msgTextReplaced
FormaHing Information
Text data objects also hold "formatting" or "attribute" information. The types of attributes stored are:
• character attributes such as font face, size and weight
• paragraph attributes such margins, first line offset, first line offset
• tab attributes for a paragraph
• embedded object info (specifically the embedded object's uid)
• link termination (specifically the destination information for marks)
Attributes "tile" ranges of characters. In other words, no character can have two different sets of
character attributes associated with it, although it can have both character and paragraph attributes. This
tiling is enforced by the textData.
Any character that does not have explicit character or paragraph attributes takes on the "default"
character or paragraph attributes of the data object. There are messages to inspect, enumerate, and
modifY all the attributes, including the defaults.
Relation to UI Classes
A textData only provides storage for characters and attributes. It does not provide any user interface
(UI). The UI is provided by an instance of dsTextView.
To assist the class providing the UI, the textData provides notifications whenever either the characters or
the attributes are modified.
Implementation Note
dsText is actually composed of three layers of classes. Clients need not be concerned by these layers, and
should not rely on their existence as they may disappear in future releases.
dsTextBlock (usually referred to as dsText) is a descendant of dsTextMarkStore, which in turn is a
descedant of dsTextChar.
#ifndef TXTDATA INCLUDED
#define TXTDATA INCLUDED $Revision: 1.224 $
TXTDATA.H "
Types and Constants: Atoms
AtomGetName
Passes back a pointer to the string value of the atom.
Returns STATUS.
STATUS EXPORTED
FLmctit:m [»v©t©type AtomGetName (
ATOM atom,
PP STRING ppString) ;
Most clients and subclasses do not use this function. It is occasionally useful for debugging.
stsBadParam atom is out of the range of valid atoms
stsOK atom is within the valid range. *ppString may still be NULL if the atom falls into one of
the gaps.
12 PENPOINT API REFERENCE
Part 6 I Text
Paragraphs that desire uniformly spaced tab stops can compactly define the stops by setting at least two
explicit stops and then setting repeatAtEnd to true. This has the effect of defining an unlimited number
of implicit stops, each of which follows the prior stop by the distance between the last two explicit stops.
NOTE: Even though each tab store has a type and leader, only the type taTabLeft and the leader
taLeadSpace are implemented.
typedef enum { II Must fit in 2 bits
taTabLeft 0,
taTabCenter 1, II Not Implemented
taTabRight 2, II Not Implemented
taTabDecimal 3 II Not Implemented
TA_TAB_TYPE;
typedef enum { II Must fit in 2 bits
taLeadSpace = 0,
taLeadDot = 1, II Not Implemented
taLeadDash = 2, II Not Implemented
taLeadUnderline = 3 II Not Implemented
TA_TAB_LEADER;
Tab Stop.
The type and leader fields contain extra bits. These bits are automatically zero-ed by assigning a
legitimate values to the field.
typedef struct TA TAB STOP
U16 X; II In twips
U8 type; II TA TAB TYPE (and 6 spare bits)
U8 leader; II TA TAB LEADER (and 6 spare bits)
TA TAB- STOP, *p TA TAB_STOP;
The maximum number of tab stops for a paragraph.
idefine TA_MAX_TABS 31
Tab Stops.
The count and repeatAtEnd fields contain extra bits. These bits are automatically zero-ed by assigning a
legitimate values to the field.
typedef struct TA_TABS {
U16 count 8, II Number of tab stops, in the range
II O.. TA_MAX_TABS. (plus 3
II spare bits.)
repeatAtEnd 8; II true or false (and 7 spare bits)
TA TAB STOP tabs[1]; II Actually variable size array
14 PEN POINT API REFERENCE
Part 6 I Text
TextDeleteMany
Deletes characters from a textData.
Returns STATUS.
STATUS EXPORTED
FlmdlOf1 Pn::;t<rlype TextDeleteMany (
const OBJECT dataObj,
const TEXT INDEX pos, II first character to delete
const TEXT INDEX length); II number to delete
The return values are the same as those for msgTextModify.
TexdnsertOne
Inserts one character into a textData.
Returns STATUS.
STATUS EXPORTED
flmdiof) Prohyrype TextInsertOne (
const OBJECT dataObj,
const TEXT INDEX pos, II position at which to insert
const CHAR toInsert) ; II character to insert
The return values are the same as those for msgTextModify.
TextFindNextParaTab
Passes back the next tab stop to the right of the passed-in stop.
Returns STATUS.
STATUS EXPORTED
tum:tiof) Prototype TextFindNextParaTab (
const P TA TABS p,
const P- TA- TAB- STOP pTab,
const P U16 pIndex) ;
TXTDATA.H 17
Public Functions and Macros
Comments Note that if p->repeatAtEnd is true, there are effectively an infinite number of tab stops.
stsNoMatch no tabs, or this is the last tab.
TexdnitCharAttrs
Initialzes a character attribute structure.
Returns nothing.
void EXPORTED
Function Prototype TextlnitCharAttrs (
P_TA_CHAR_ATTRS p);
Comments This function reads the default character attributes from the process's resource list (using the resource id
textResDefaultCharAttrs), or sets all values to 0 if the resource cannot be found.
See Also msgTextChangeAttrs
TextlnitCharMask
Initialzes a character attribute mask to all zeros.
Returns nothing.
void EXPORTED
Fundion Prototype TextlnitCharMask (
P TA CHAR MASK p);
TexdnitParaAttrs
Initialzes a paragraph attribute structure to all zeros.
Returns nothing.
void EXPORTED
function Prototype TextlnitParaAttrs (
P_TA_PARA_ATTRS p);
See Also msgTextChangeAttrs
TextlnitParaMask
Initialzes a paragraph attribute mask to all zeros.
Returns nothing.
void EXPORTED
fundlon Pn;»tt;»type TextlnitParaMask (
P TA PARA MASK p);
See Also msgTextChangeAttrs
18 PENPOINT API REFERENCE
Part 6 / Text
Message Arguments
The prefix "TD_" indicates that an identifier is related to "text data."
The prefix "tdm" indicates that an identifier is related to "text data metrics."
typedef struct TD_METRICS {
U16 flags; II One of the values below
U16 spareBits; II Reserved.
P UNKNOWN spares[2]; II Reserved.
TD_METRICS, *P_TD_METRICS;
Use these in the flags field of a TD_METRICS.
#define tdrnCanUndo flag8 II if on, textData supports undo
#define tdmFileCharsOnOwn flag1 II Not Implemented
#define tdrnReadOnly flagO II characters cannot be modified
expectedSize is a hint about the expected number of characters in a textData. An accurate hint can
improve performance.
typedef struct TD_NEW_ONLY
TD METRICS metrics;
TEXT INDEX expectedSize;
U16 expectedTagCount; II Private. For internal use only.
TD_NEW_ONLY, *P_TD_NEW_ONLY;
typedef struct TD NEW
OBJECT NEW ONLY object;
TD NEW ONLY text;
TD_NEW, *P_TD_NEW;
typedef struct TEXT_BUFFER
TEXT_INDEX first; II In
TEXT INDEX length; II In
TEXT INDEX bufLen; II In
P CHAR bUf; II In:Out via *buf
TEXT INDEX bufUsed; II Out
TEXT_BUFFER, *P_TEXT_BUFFER;
typedef enum { II Used as a SET
tdForward = 1,
tdBackward = 2
TEXT_DIRECTION;
typedef struct TEXT_SPAN
TEXT INDEX first; II In:Out
TEXT INDEX length; II In:Out
ATOM type; II In:Out (for msgTextSpanType)
TEXT DIRECTION direction; II In
BOOLEAN needPrefix; II In
BOOLEAN needSuffix; II In
U16 prefixLength; II Out: valid if and only if
II needPrefix is true
U16 suffixLength; II Out: valid if and only if
II needSuffix.is true
U8 firstNormal; II Out: 0 or 1 (7 spare bits)
U8 lastNormal; II Out: 0 or 1 (7 spare bits)
U32 spares[4]; II Reserved
TEXT_SPAN, *P_TEXT_SPAN;
typedef struct TEXT SPAN AFFECTED
OBJECT sender;
U32 changeCount;
TEXT INDEX first;
TEXT INDEX length;
TEXT_SPAN_AFFECTED, *P_TEXT_SPAN_AFFECTED;
TXTDATA.H 19
Messages Defined by Other Classes
msgNewDefaults
Initializes the NEW struct.
Takes P_TD_NEW, returns STATUS. Category: class message.
typedef struct TD_NEW
OBJECT NEW ONLY object;
TD NEW ONLY text;
TD_NEW, *P_TD_NEW;
In response to this message, dsText does the following:
pNew->object.cap 1= objCapCreate;
memset(&(pNew->text), 0, sizeof(pNew->text»;
pNew->text.expectedSize 5;
pNew->text.expectedTagCount = 5;
msgNew
Creates a new instance of dsText.
Takes P_TD_NEW, returns STATUS. Category: class message.
typedef struct TD_NEW
OBJECT NEW ONLY object;
TD NEW ONLY text;
20 PEN POINT API REFERENCE
Part 6 I Text
msgTextChangeCount
Passes back (and optionally sets) the textData's changeCount.
Takes S32, returns S32.
tdefine msgTextChangeCount TCMakeMsg(O)
Each instance of dsText keeps a monotonically increasing count of the number of changes that have
been made to it (via msgTextModify). In response to this message, a textData passes back that count.
The counter's value is always greater than or equal to O.
If the value of pArgs is:
<0 the counter's current value is returned and the counter is unchanged.
maxS32 the counter is incremented by one, and the new value returned.
>= 0 the counter is set to pArgs, and its previous value is returned.
In general, clients should only increment the counter, not decrement it.
msgTextGet
Returns 'the character in a textData at the specified position.
Takes TEXT_INDEX, returns STATUS.
tdefine msgTextGet TCMakeMsg(l)
stsEndOfData pArgs->first is too large
>= 0 the 8 bit character is returned as the low byte of the returned STATUS; the high 3 bytes are zero.
msgTextGetBuffer
Passes back a contiguous range of characters from a textData.
Takes P _TEXT_BUFFER, returns STATUS.
tdefine msgTextGetBuffer TCMakeMsg(5)
Messoge typedef struct TEXT_BUFFER
Arg1JtTle f tfs TEXT INDEX first; II In
TEXT INDEX length; II In
TEXT INDEX bufLen; II In
PCHAR bUf; II In:Out via *buf
TEXT INDEX bufUsed; II Out
TEXT_BUFFER, *P_TEXT_BUFFER;
Use this message to get the values of several characters at a time. This message is a high-performance
alternative to msgTextGet.
If pArgs->length > pArgs->bufLen, then up to bufLen characters are placed into pArgs->buf.
Upon return, pArgs->bufUsed is set to the count of characters read, even if there was a problem with the
request.
stsBadParam pArgs->length was 0 or pArgs->bufLen was 0 or pArgs->buf was pNull.
stsEndOfData pArgs->first is too large
< stsO K some other error occurred.
TXTDATA.H 21
Messages Defined by Other Classes
msgTextGetMetrics
Passes back thetextData's metrics.
Takes P_TD_METRICS, returns STATUS.
#define msgTextGetMetrics TCMakeMsg(2)
Messoge typedef struct TD METRICS
Argui'nents U16 flagsi II One of the values below
U16 spareBitsi II Reserved.
P UNKNOWN spares[2]i II Reserved.
TD_METRICS, *P_TD_METRICS;
msgTextLength
Returns the number of characters stored in the textData.
Takes nothing, returns TEXT_INDEX.
#define msgTextLength TCMakeMsg(3)
< stsOK some error occurred.
>= stsOK Cast the returned value to a TEXT_INDEX; that's the number of characters.
msgTextModify
Modifies the characters stored in the textData.
Takes P_TEXT_BUFFER, returns STATUS ..
#define msgTextModify TCMakeMsg(4)
Mess1:lge typedef struct TEXT BUFFER
Argurnents TEXT INDEX firsti II In
TEXT INDEX length; II In
TEXT INDEX bufLeni II In
P CHAR bufi II In:Out via *buf
TEXT INDEX bufUsedi II Out
TEXT_BUFFER, *P_TEXT_BUFFERi
Use this message to insert, delete or replace characters in a textData.
In response to this message, the textData replaces the characters in the range [pArgs->first ..
pArgs->first+pArgs->length) with the characters from pArgs->buf.
If pArgs->buf is pNull, the effect is a deletion. If pArgs->length is 0, the effect is an insertion. Otherwise
the effect is a replacement. If pArgs->first is inffEXT_INDEX, the current length minus pArgs->length
is substituted. If pArgs->length is maxTEXT_INDEX, strlen(pArgs->buf) is substituted.
stsReadOnly request refused because object is read only.
stsO K modification successful.
msgTextSetMetrics
Sets a textData's metrics.
Takes P_TD_METRICS, returns STATUS.
#define msgTextSetMetrics TCMakeMsg(6)
MeSS1:lg8 typedef struct TD METRICS
Arguments U16 flags; I lOne of the value's below
U16 spareBitsi II Reserved.
P UNKNOWN spares[2]; II Reserved.
TD_METRICS, *P_TD_METRICS;
22 PEN POINT API REFERENCE
Part 6 / Text
msgTextSpan
Determines the range corresponding to the requested span.
Takes P_TEXT_SPAN, returns STATUS ..
#define msgTextSpan TCMakeMsg(9)
Meuage typedef struct TEXT SPAN
TEXT INDEX first; II In:Out
TEXT INDEX length; II In:Out
ATOM type; II In:Out (for msgTextSpanType)
TEXT DIRECTION direction; II In
BOOLEAN needPrefix; II In
BOOLEAN needSuffix; II In
U16 prefixLength; II Out: valid if and only if
II needPrefix is true
U16 suffixLength; II Out: valid if and only if
II needSuffix is true
U8 firstNormal; II Out: 0 or 1 (7 spare bits)
U8 lastNormal; II Out: 0 or 1 (7 spare bits)
U32 spares[4]; II Reserved
TEXT_SPAN, *P_TEXT_SPAN;
A span is a consecutive range of characters that share some common trait. Given a position and the
desired span type, this message returns the range of the span. For instance, a client can use this message
to ask a textData to find the bounds of the word containing a position.
Actually, this message can be used to find the start of one span and the end of another. If pArgs->length
is 1, then the start and end of the same span is returned.
If the client only needs only the beginning or the end of the span, then pArgs->direction should be set
to the needed end. This substantially improves performance.
Using this message, a textData can find the range of the following types of spans:
• atomWSDelimit: passes back a white-space delimited span
• atomWord: passes back a word span using the definitions in tencode.h
pArgs->type specifies the desired span's type.
pArgs->direction indicates whether the span should be searched for in preceding characters, succeeding
characters, or both.
It is often useful to know something about the characters immediately preceding or succeeding the span.
This information is returned if pArgs->needPrefix or pArgs->needSuffix (or both) are true. Upon return,
pAtgs->prefixLength andlor pArgs->suffixLength identifies the appropriate characters.
pArgs->firstNormal and pArgs->lastNormal indicate whether the corresponding portions of the span are
normal or abnormal characters for the span. For instance, for atomWord, an "a" is a normal character,
but an "!" is abnormal.
msgTextSpanType
Determines the span type of the specified range.
Takes P_TEXT_SPAN, returns STATUS ..
fdefine msgTextSpanType TCMakeMsg(10)
Messoge typedef struct TEXT_SPAN
Arguments TEXT INDEX first; II In:Out
TEXT INDEX length; II In:Out
ATOM type; II In:Out (for msgTextSpanType)
TEXT DIRECTION direction; II In
BOOLEAN needPrefix; II In
BOOLEAN needSuffix; II In
U16 prefixLength; II Out: valid if and only if·
II needPrefix is true
U16 suffixLength; II Out: valid if and only"if
II needSuffix is true
U8 firstNormal; II Out: 0 or 1 (7 spare bits)
U8 lastNormal; II Out: 0 or 1 (7 spare bits)
U32 spares[4]; II Reserved
TEXT_SPAN, *P_TEXT_SPAN;
Comments In response to this message, a textData passes back the span type that corresponds to the range.
The same range often has several span types. For instance, all ranges have the span type atomChar. All
ranges that include a complete paragraph also have the span types atomChar, atomWord and
atomSentence. When the passed-in range has multiple span types, the largest span type is returned.
The span type ordering from smallest to largest is as follows. This is also the complete list of span types
returned in response to this message.
• atomChar
• atomWord
• atomSentence
• atomPara
• atomDoc
msgTextChangeAttrs
Changes the attributes of the specified range.
Takes P_TEXT_CHANGE_ATTRS, returns STATUS.
fdefine msgTextChangeAttrs TAMakeMsg(taVersion, 1)
Messuge typedef struct TEXT_CHANGE_ATTRS
Arfjuments ATOM tag;
TEXT INDEX first;
TEXT INDEX length;
P UNKNOWN pNewMask;
P UNKNOWN pNewValues;
TEXT_CHANGE_ATTRS, *P_TEXT_CHANGE_ATTRS;
Clients use this message to change the formatting attributes of characters in a textData. They can
manipulate three types of attributes:
• character attributes (indicated by atomChar)
• paragraph attributes (indicated by atomPara)
24 PENPOINT API REFERENCE
Part 6 I Text
msgTextClearAttrs
Clears all attributes of the specified type to the default values.
Takes ATOM, returns STATUS.
#define msgTextClearAttrs TBMakeMsg(5)
In response to this message, a textData clears all formatting for the specified type. This message is "all or
nothing" -- no mask or range can be specified.
The attributes have not changed the return value is < stsOK:
stsBadParam pArgs was invalid. No attributes have changed.
< stsOK Some other error occurred. No attributes have changed.
msgTextEmbedObject
Embeds an object at a specified position.
Takes P _TEXT_EM BED_OBJECT, returns STATUS.
#define msgTextEmbedObject TBMakeMsg(2)
TXTDATA.H 25
Messages Defined by Other Classes
msgT extGetAttrs
Gets the attributes of the specified type.
Takes P_TEXT_GET_ATTRS, returns STATUS.
#define msgTextGetAttrs TAMakeMsg(taVersion, 2)
Me5sug& typedef struct TEXT_GET_ATTRS
/\Y9;Hlt&i1h, ATOM tag;
TEXT INDEX first;
TEXT INDEX length; II Not defined.
P UNKNOWN pValues;
TEXT_GET_ATTRS, *P_TEXT_GET_ATTRS;
Clients can retrieve the attributes of a character in the textData using msgTextGetAttrs.
The client specifies the type of attributes it is interested in by filling in pArgs->tag. The client must set
pArgs->pValues to point to a structure with the "real" type of the attributes corresponding to the tag.
This "real" type is described in the comments for msgTextChangeAttrs.
The client also specifies the character whose attributes the client wants by specifying pArgs->first. If
pArgs->first is textDefaultAttrs then the default attribute values are returned.
stsBadParam pArgs->tag is not valid
stsEndOfData pArgs->first is too large
stsOK the attribute values have been copied into pArgs->pValues
msgTextlnitAttrs
Initialize the attributes and mask before a msgTextChangeAttrs.
Takes P_TEXT_CHANGE_ATTRS, returns STATUS.
#define msgTextInitAttrs TAMakeMsg(taVersion 3)
26 PENPOINT API REFERENCE
Part 6 / Text
msgTextChangeAttrs
msgTextPrintAttrs
Prints the values of an attribute set and a mask.
Takes P_TEXT_CHANGE_ATTRS, returns stsOK.
tifdef DEBUG
tdefine msgTextPrintAttrs TAMakeMsg(taVersion, 4)
tendif
Messog@ typedef struct TEXT CHANGE_ATTRS
;'\rgumen?s ATOM tagi
TEXT INDEX first;
TEXT INDEX length;
P UNKNOWN pNewMaski
P UNKNOWN pNewValuesi
TEXT_CHANGE_ATTRS, *P_TEXT_CHANGE_ATTRSi
This message takes the same parameters as msgTextChangeAttrs and the pArgs must be filled in the
same way. In response to this message, a textData prints out a useful dump of the contents of pArgs.
Internal Use Only: If pArgs-> first is txtPrvAttrs, then pArgs->pNewValues must be in the internal
format.
msgTextChangeAttrs
msgTextRead
Inserts Ascii, R1F, etc. at the specified location.
Takes P_TEXT_READ, returns STATUS.
tdefine msgTextRead TBMakeMsg(O)
Messoge typedef struct TEXT_READ
Arguments TEXT INDEX first;
P UNKNOWN input;
U16 embeddedAction: 2,
freeAfter: 6, II true or false (and 5 spare bits)
inputIsObject: 8; II true or false (and 7 spare bits)
TAG format;
TEXT_READ, *p_TEXT_READi
The textData reads data and inserts the data into itself
TXTDATA.H 27
Messages Defined by Other Classes
msgTextWrite
Outputs the specified span as one of Ascii, R1F, etc.
Takes P_TEXT_WRITE, returns STATUS.
#define msgTextWrite TBMakeMsg(l)
Mess(l~e typedef struct TEXT_WRITE
Arguments TEXT_INDEX first;
TEXT_INDEX length;
P_UNKNOWN output;
U16 flags; II One of the values below (and 13
II spare bits)
TAG format;
U8 outputIsObject;
TEXT_WRITE, *P_TEXT_WRITE;
Comments The fields of pArgs are:
first first character of range to be written
length length of range to be written
output if null, the textData creates a P_FILE and returns that handle. If non-null, then this field is
either an object or a P_FILE, depending on the value of outputlsObject.
flags described below
format one of the file types defined in filetype.h.
outputlsObject If output is non-null and outputlsObject is true, then output is an object. If output is
non-null and outputlsObject is false, then output is a P_FILE.
- - - - - - - _....... _ - - - - - - - -
28 PEN POINT API R~FERENCE
Part 6 / Text
msgTextEnumEmbeddedObjects
Enumerates the textData's embedded objects.
Takes P_TEXT_ENUM_EMBEDDED, returns STATUS.
fdefine msgTextEnumEmbeddedObjects TMMakeMsg(9)
M0,$sQ~e typedef struct TEXT_ENUM_EMBEDDED {
At'£jI\UnCt'ifS TEXT_INDEX first;
TEXT INDEX length;
U16 flags; II One ofthe values below
U16 max;
U16 count;
P_TEXT_EMBED_OBJECT pItems;
TEXT_ENUM_EMBEDDED, *P_TEXT_ENUM_EMBEDDED;
There are two ways of enumerating the embedded objects:
1) Get all the objects in one send. The textData allocates an array of TEXT_EM BED_OBJECT elemeius
and passes it back in pArgs->pltems. You must OSHeapBlockFreeO the array when you are done with it.
TEXT_ENUM_EMBEDDED is used as follows:
first position at which you want to start the enumeration. Use 0 to start at the beginning of the data.
length length of the range you want the enumeration to include. Use inffEXT_INDEX to go to the
end of the data.
flags Usually teeDefault. Use teeFloat to get only floating embedded objects. Use teeInline to get only
in-line embedded objects.
max Pass in o. The object passes back the number of items in the allocated block
count Pass in maxU16. The object passes back the number of items returned (same as max).
pltems Pass in pNull. The object passes back a pointer to the allocated block
2) Get the objects a few at a time. You repeatedly send msgTextEnumEmbeddedObjects re-using the
same TEXT_ENUM_EMBEDDED structure. When the message returns stsEndOIData, there are no more
objects in the enumeration. You should set the fields ofTEXT_ENUM_EMBEDDED only before the first
call. For successive calls you must not modify the fields.
first Same as Case 1.
length Same as Case 1.
flags Same as Case 1.
TXTDATA.H 29
Notifications
Notifications
msgT extAffected
Notifies observers that a range of text has been affected.
Takes P_TEXT_AFFECTED, returns STATUS ..
fdefine rnsgTextAffected MsgNoError(TCMakeMsg(7))
I\'\ess£lge typedef struct TEXT_AFFECTED
ATgurnents TEXT SPAN AFFECTED span;
U16 rerneasurei
P UNKNOWN spare;
TEXT~FECTED, *P_TEXT_AFFECTED;
This message informs observers that the attributes of the range have been modified.
msgTextCounterChanged
Notifies observers that textData's changeCount has been modified.
Takes P_TEXT_COUNTER_CHANGED, returns STATUS ..
fdefine rnsgTextCounterChanged MsgNoError(TCMakeMsg(11))
Message typedef struct TEXT_COUNTER_CHANGED
Arguments OBJECT sender;
U32 changeCount;
U32 oldCount;
TEXT_COUNTER~CHANGED, *P_TEXT_COUNTER_CHANGED;
The change Count is normally incremented by 1 as a result of handling msgTextModify. Observers here
about these changes via msgTextReplaced and msgTextAffected notification messages.
However, the changeCount can change in other ways. For instance, the changeCount is rolled back as
part of undoing certain operations. Also, clients andlor subclasses can explicitly set the changeCount via
magT extChangeCount.
Whenever the changeCount changes in some way OTHER than a single increment by 1,
msgTextCounterChanged is sent to the observers to allow them to synchronize any caches they keep
based on the changeCount.
msgTextReplaced
Notifies observers that a range of text was replaced via msgTextModify.
Takes P_TEXT_REPLACED, returns STATUS ..
fdefine rnsgTextReplaced MsgNoErr9r(TCMakeMsg(8))
30 PENPOINT API REFERENCE
Part 6 / Text
Introduction
An instance of dsTextView (or textView) provides a user interface which presents text data to the user
and lets the user edit that data.
Every textView has an associated data object of clsText (or a subclass of dsText). This object is referred
to as textData.
Painting Model
A textView displays the textData as a series of non-overlapping, exhaustively tiling, horizontal display
lines. With the possible exception of space below the last line, there is no area between lines that does
not belong to any line. Characters are laid out left to right with lines running from top to bottom.
When first created, the textView positions the first line of textData at the top of itself. Subsequent user
or client actions (e.g. scrolling) can position some other line to the top of the window. However, the top
line is always completely visible unless the view is too small to allow this. The last visible line, in
contrast, may be clipped at the bottom.
Even though a textView is a descendant subclass of clsBorder, c1sTextView ignores all clsBorder
functionality relating to display of the view's background and border.
Deferred Repaint
A textView uses a "delayed repair" model in which several changes to the textData may be made before
the visible display lines are repainted. For certain operations (e.g. selection change), such a delay can be
misleading to the user and the individual operations provide a way to override the normal delay. If no
override is available within a message's arguments, msgTextViewRepair can be used.
Word Wrap
By default, a textView displays each line beginning at the left edge of its window and "word wraps" at
the right edge. That is, if a word would be clipped by the right edge of the window, it is instead placed at
the beginning of the next line. By modifying paragraph margin attributes the line can be adjusted to
have uninked margins in which no character is displayed.
32 PENPOINT API REFERENCE
Part 6 I Text
Word wrap can be turned off by setting the textView's style (see msgTextViewSetStyie). When off, a line
breaks only when a "hard break" character (such as teNewLine or teNewParagraph) is encountered. As a
result, a significant portion of many lines may be invisible to the user.
Embedded Obiects
Other objects can be embedded within a textView (see msgTextViewAddIP and msgTextViewEmbed).
(All embedded instances of some subclasses of clsEmbeddedWin.)
A textView handles an embedded object as if it is a "very large" character.
The textView's displayed lines are always as tall as the tallest character or embedded object in the line.
Therefore the presence of a large embedded object causes the containing line to be quite tall. (Not all
embedded objects are large. For instance, closed application icons and reference buttons are only slightly
larger than typical text.)
The baseline of the line containing embedded objects is determined, in part, by the embedded object's
response to msgWinGetBaseline. (See win.h.)
Text IPs
An instance of clsTextIP (or textIP) implements two special features that are useful to textViews.
The first is size management. An embedded textIP tracks the width of its parent window. When the
parent's width changes, an embedded textIP modifies its own width so that it fits within and completely
fills the parent window (in the horizontal direction).
The second is special filtering of text going from the IP into a textView. A textiP filters translated data
from its superclass (clsIP) before passing its data onto its client (typically a textView). Two kinds of
filtering are performed: paragraph break insertion and space correction. A textiP inserts paragraph
breaks based on how many blank lines there are between scribbles on an IP. textIP also filters out
unnecessary spaces between words and adds spaces after a sentence-ending character such as a period or
question-mark.
Limitations
textView is not WYSIWYG: although it will closely match font sizes and line breaks and spacing on a
printer, it is based on a "make the printer match the screen" model that has enough variability that
clients requiring WYSIWYG will find unacceptable (e.g., an overlaying mark-up layer).
textViews do not support multiple views of a single data object. Thus each textView is the unique view
for its textData object. This restriction is not checked by clsTextView.
Although TV_NEW_ONLY has a "dc" field, there are so many restrictions on its use in PenPoint 1.0 that
the field should always be left at the default value ofNil(OBJECT). In addition, changing the units or
scale used by the view-allocated "dc" is forbidden. This prevents "magnifying glass" and "pan in or out"
effects from being used with a textView.
tifndef TXTVIEW INCLUDED
tdefine TXTVIEW_INCLUDED $Revision: 1.214 $
tifndef TXTDATA INCLUDED
tinclude <txtData.h> II For TEXT_INDEX
tendif
TXTVIEW.H 33
Message Arguments
Message Arguments
Embedding
TV_EM BED_METRICS describes where and how to embed an object. The client either specifies the object
to embed, or sets the embedded field to Nil and lets the text view create a new object based on the flags
field. In the latter case, the UID of the newly created object is passed back in the embedded field.
typedef struct TV_EMBED_METRICS
TEXT INDEX pos; II
In: embedded object is inserted
II
just before this position.
U16 flags; II
One of the values below
OBJECT embedded; II
In-Out: the UID of the embedded object
TV_EMBED_METRICS, *P_TV_EMBED_METRICS;
Use these in the flags field of a TV_EMBED_METRICS.
fdefine tvEmbedAnnotate flagO II Not implemented
fdefine tvEmbedFloat flag1 II Make the embeddee floating
fdefine tvEmbedReplace flag2 II The IP's contents replace the
II character following the IP.
Use these in the flags field of a TV_EMBED_METRICS when using the struct as the pArgs to
msgTextViewAddIP.
fdefine tvEmbedAtEnd flag8 II IP should be last char of data.
fdefine tvEmbedPara flag9 II IP is a paragraph pad
fdefine tvEmbedOneChar flag10 II IP is only 1-char
fdefine tvEmbedPreload flag11 II preload the selection into the IP
fdefine tvEmbedDisplayType (flag13Iflag14Iflag1S) II Obsolete.
Resolution
The prefix "tvr" indicates that an identifier is related to "text view resolve."
The values for the xRegion and yRegion fields of a TV_RESOLVE struct are illustrated here. The values
are of the form (xRegion, yRegion).
---+--------------+---
I I
I Line's ink I
(-1,0) I (0,0) I (1,0)
I I
---+--------------+---
I I
(-1,-1) I (0,-1) I (1,-1)
I I
TXTVIEW.H 35
Message Arguments
The fields of this structure are described in more detail in the comments for rnsgTextViewResolveXY.
typedef struct TV_RESOLVE {
XY32 xy; II In:Out: Units are LWC
U16 flags; II One of the values below
TEXT INDEX pos; II Out: Pos of char containing xy, or
II maxTEXT INDEX if no such char
TEXT INDEX lineStart; II Out: Pos of first char on line
II containing xy, or maxTEXT INDEX
II if no line contains xy. -
S8 xRegion; II Out: Region x was in. See diagram.
S8 yRegion; II Out: Region y was in. See diagram.
TEXT INDEX selects; II Out: Pos of char "selected" by xy
XY32 offset; II Out: Offset to prev/next char's ink
P UNKNOWN spares[4]; II Reserved.
TV_RESOLVE, *P_TV_RESOLVE;
Use these flags in the flags field of TV_RESOLVE. Note that they are not completely orthogonal; in
particular, only one of [tvrSelFirst, tvrSelLPO and tvrBalance] should be enabled at once, similarly for
[tvrPrevChar and tvrNextChar].
tvrSelFirst causes TV_RESOLVE. selects to be <= TV_RESOLVE.pos (i.e., the "selected" character is at or
before the character "hit" by TV_RESOLVE.xy.)
tvrSelLPO causes TV_RESOLVE.selects to be >= TV_RESOLVE.pos (i.e., the "selected" character is after
the character "hit" by TV_RESOLVE.xy, unless the line contains only one character in which case
TV_RESOLVE.selects == TV_RESOLVE.pos,)
tvrBalance has the effect of tvrSelFirst or tvrSelLPO, depending on which edge of the character "hit"
by TV_RESOLVE.xy is closest to TV_RESOLVE.xy.x.
tvrSelWord causes the "selection" behavior specified by any of the previous three flags to occur for the
"word" containing the character "hit" by TV_RESOLVE.xy.x.
tvrPrevChar normally TV_RESOLVE.offset.x is 0 upon return. Enabling tvrPrevChar causes
TV_RESOLVE.offset.x to contain the amount that TV_RESOLVE.xy.x exceeds the x coordinate of the
lower-left corner of the character specified by TV_RESOLVE.pos (i.e., the distance past the previous
character's right edge).
tvrNextChar normally TV_RESOLVE.offset.x is 0 upon return. Enabling tvrNextChar causes
TV_REsoLVE.offset.x to contain the amount that TV_RESOLVE.xy.x falls short of the x coordinate of
the lower-right corner of the character specified by TV_RESOLVE.pos (i.e., the distance before the
next character's left edge).
tvrPastEOL normally a line contains only those character positions for the characters displayed on the
line. tvrPastEOL permits TV_RESOLVE.selects to return with the TEXT_INDEX of the first character
of the following line if the specified TV_RESOLVE.xy.x is to the right of the last character in the line.
tvrNLlfPastEOL when disabled, ifTV_RESOLVE.xy.x is to the right of the last character in a line with a
hard line break (e.g., teNewLine or teNewParagraph) and at least one other character,
TV_RESOLVE. selects specifies the character immediately before the hard line break. When enabled, if
tvrPast~OL is also enabled and would have caused TV_RESOLVE.selects to be after the hard line
break, tvrNLlfPastEOL will override and cause TV_RESOLVE.selects to specify the break character
instead.
tdefine tvrSelFirst flagO
tdefine tvrSelLPO flag1
tdefine tvrSelWord flagS
tdefine tvrPrevChar flag2
tdefine tvrNextChar flag3
tdefine tvrBalance flag4
tdefine tvrPastEOL flag6
tdefine tvrNLIfPastEOL flag7
36 PENPOINT API REFERENCE
Part 6 / Text
Selection
The prefix "tvs" indicates that an identifier is related to "text view select."
The fields of this structure are described in more detail in the comments for msgTextViewSetSelection.
typedef struct TV_SELECT {
TEXT_INDEX first; II lpoTEXT_INDEX means "clear selection"
TEXT INDEX length; II a results in an a length selection
U16 flags; II either a or wsSynchRepaint (see win.h)
ATOM level; II Obsolete. Don't use.
TV_SELECT, *P_TV_SELECT;
Scrolling
The prefix "ts" indicates that an identifier is related to "text view scroll."
typedef struct TV_SCROLL {
TEXT INDEX pos; II Position to scroll to
U32 flags; II One of the values below
TV_SCROLL, *P_TV_SCROLL;
Use these in the flags field of a TV_SCROLL.
tsAlignAtTop scroll so that pArgs->pos is "near the top." See tsAlignEdge.
tsAlignAtBottom scroll so that pArgs->pos is "near the bottom." See tsAlignEdge.
tsAlignAtCenter scroll so that pArgs->pos is in the center displayed line
tsAlignEdge If set, and tsAlignAtTop or tsAlignAtBottom is set, this flag forces the line containing
pArgs->pos to be the exact edge. If this flag is off, and tsAlignAtTop tsAlignAtBottom is set, the
textView tries to leave an extra line or two between the line containing pArgs->pos and the view's
edge.
tslffinvisible If set, the textView scrolls only if pArgs->pos is not already visible. If not set, the
textView scrolls even if pArgs->pos is visible.
textNoScrollNotify By default, the scrollbar(s) for the view are notified (via a msgWinSend of
msgScrollbarUpdate) that they should update after a msgTextViewScroll. If this flag is set, the
notification is not sent.
tdefine tsAlignAtTop OL
tdefine tsAlignAtBottom lL
tdefine tsAlignAtCenter 2L
tdefine tsAlignEdge ((U32)flag2)
tdefine tsIffInvisible ((U32)flag3)
tdefine textNoScrollNotify ((U32)flag15)
msgNewDefaults
Initializes the NEW structure.
Takes P_TV_NEW, returns STATUS. Category: class message.
Zeros out pNew->tv and sets:
tv. style. flags = tvsWordWrap;
tv.flags = tvFillWithIP;
TXTVIEW.H 37
Messages Defined by Other Classes
msgNew
Creates a new instance of dsTextView.
Takes P_1V_NEW, returns STATUS. Category: class message.
If pArgs->view.createDataObject is true, then the textView creates a Text data object (dsText; see
txtdata.h) and sets the view's data object If pArgs->tv. dc is NULL the textView creates a DC for its
exclusive use.
msgGWinXList
Defined in gwin.h.
Takes P_XLIST, returns STATUS.
In response to this message, a textView typically performs some editing operation on its associated data
object. A textView can process both "vanilla" xlists as described in xlist.h or text-specific xlists as
txtxlist.h.
Here's how a textView responds to each xlist element:
xtBounds remembers the bounds of a gesture element
xtGesture processes the gesture
xtText inserts the text
xtObject embeds the object
xtCharAttrs modifies the character attributes of the specified characters
xtParaAttrs modifies the attributes of the specified paragraphs
xtTabs modifies the tabs of the specified paragraphs
xtCharPos sets the insertion point for text to the specified character position
Messages
msgTextViewAddIP
Adds an insertion pad to the textView.
Takes P_1V_EMBED_METRICS, returns STATUS.
#define msgTextViewAddIP TVMakeMsg(O)
Mess@ge typedef struct TV_EMBED_METRICS
Arguments TEXT INDEX POSi II
In: embedded object is inserted
II
just before this position.
U16 flagsi II
One of the values below
OBJECT embeddedi II
In-Out: the UID of the embedded object
TV_EMBED_METRICS, *P_TV_EMBED_METRICSi
The client must set all of the fields of pArgs as described in the discussion of1V_EMBED_METRICS.
38 PEN POINT API REFERENCE
Part 6 / Text
msgTextViewCheck
A textView performs a self-consistency check.
Takes P_UNKNOWN, returns STATUS.
fdefine msgTextViewCheck TVMakeMsg(5)
This message is only available in the debugging version of text.dll. The only currently defined value for
pArgs is zero.
stsOK no problems detected
< stsO K problems detected
msgTextViewEmbed
Embeds an object in the textView. Makes associated changes in text data.
Takes P_TV_EMBED_METRICS, returns STATUS.
fdefine msgTextViewEmbed TVMakeMsg(l)
M®ss@ge typedef struct TV_EMBED_METRICS
tb9um®nl'S TEXT INDEX pos; II
In: embedded object is inserted
II
just before this position.
U16 flags; II
One of the values below
OBJECT embedded; II
In-Out: the UID of the embedded object
TV_EMBED_METRICS, *P_TV_EMBED_METRICS;
The client must set all of the fields of pArgs as described in the discussion of TV_EM BED_METRICS.
msgTextViewGetEmbedMetrics
Passes back the textView-specific metrics for an embedded object.
Takes P_TV_EMBED_METRICS, returns STATUS.
fdefine msgTextViewGetEmbedMetrics TVMakeMsg(2)
M®sS0ge typedef struct TV_EMBED_METRICS
Ar9umeftts TEXT INDEX pos; II
In: embedded object is inserted
II
just before this position.
U16 flags; II
One of the values below
OBJECT embedded; II
In-Out: the UID of the embedded object
TV_EMBED_METRICS, *P_TV_EMBED_METRICS;
The client need only fill in pArgs->embedded.
msgTextViewRepair
Forces a delayed paint operation to take place immediately.
Takes pNull, returns stsOK.
fdefine msgTextViewRepair TVMakeMsg(3)
Use with caution, as overuse of this message significantly degrades performance.
msgTextViewResolveXY
Given an point in LWC space, passes back the character at (or near) the point.
Takes P_TV_RESOLVE, returns STATUS.
fdefine msgTextViewResolveXY TVMakeMsg(4)
TXTVIEW.H 39
Messages Defined by Other Classes
msgTextViewScroll
Repositions displayed text within the textView.
Takes P_TV_SCROLL, returns stsOK.
#define msgTextViewScrol1 TVMakeMsg(6)
Mess(ig@ typedef struct TV_SCROLL (
Argum@nts TEXT INDEX pos; II Position to scroll to
U32 flags; II One of the values below
TV SCROLL, *P_TV_SCROLL;
The client must set the fields of pArgs as described in the discussion of TV_SCROLL.
msgTextViewGetStyle
Passes back a textView's style.
Takes P_TV_STYLE, returns stsOK.
#define msgTextViewGetStyle TVMakeMsg(8)
Message typedef struct TV STYLE {
Arguments U16 flags; II One of the values below
S8 magnification; II when tvsFormatForPrint is not on, this
II value (in points) is added to the
II character font sizes.
U8 showSpecial; II 0: show no special characters.
II 1: undefined -- do not use.
II 2: undefined -- do not use.
II 3: show all special characters.
II (6 spare bits)
OBJECT printer; II Not implemented. Should be null.
TV_STYLE, *P_TV_STYLE;
40 PENPOINT API REFERENCE
Part 6 I Text
msgTextViewSetSelection
Selects one or more characters displayed by the textView.
Takes P_TV_SELECT, returns stsOK.
tdefine msgTextViewSetSelection TVMakeMsg(9)
Me$$Cl~e typedef struct TV SELECT {
Ar~wmel1tS' TEXT INDEX - first; II IpoTEXT INDEX means "clear selection"
TEXT INDEX length; II 0 results in an 0 length selection
U16 flags; II either 0 or wsSynchRepaint (see win.h)
ATOM level; II Obsolete. Don't use.
TV_SELECT, *P_TV_SELECT;
The fields of pArgs are used as follows:
first The first character to select. The value IpoTEXT_INDEX means that cause the selection to be
cleared.
length Number of characters to select. The value 0 results in a zero-length I-Bean selection.
flags if this field is wsSynchRepaint (defined in win.h) the textView repaint immediately. Otherwise
this field must be zero.
While handling this message, the textView becomes the selection owner unless pArgs->first is
IpoTEXT_INDEX, in which case the text view ensures that it is NOT the selection owner.
msgTextViewSetStyle
Sets a textView's style.
Takes P_TV_STYLE, returns stsOK.
tdefine msgTextViewSetStyle TVMakeMsg(10)
MeS'SClgo typedef struct TV_STYLE {
Argvmo!1ts U16 flags; II One of the values below
S8 magnification; II when tvsFormatForPrint is not on, this
II value (in points) is added to the
II character font sizes.
U8 showSpecial; II 0: show no special characters.
II 1: undefined -- do not use.
II 2: undefined -- do not use.
II 3: show all special characters.
II (6 spare bits)
OBJECT printer; II Not implemented. Should be null.
TV_STYLE, *P_TV_STYLE;
pArgs->printer should be set to Nil(OBJECT).
Utility Functions
TextCreateTextScrollWin
Utility function that creates a textView (with a data object) placed inside a scroll window. (See swin.h.)
Returns SfATUS.
STATUS EXPORTED
function fyototype TextCreateTextScrollWin (
P TV NEW pNew,
P OBJECT scrollWin); II Out:
tendif II txtViewNewFields
tendif II NO_NEW
Clients often need a "vanilla" textView inside a vanilla scrollWin. This function does just that. Clients
can modify the created objects after the creation if this function doesn't do quite the right thing. Client
who need more control over the creation should probably create the objects manually.
The pNew parameter should be null or should point at an already initialized NEW struct. If it is null,
then the function creates a default instance of dsTextView.
Because the view is created with formatForPrinter FALSE, the scrollWin's expandChildWidth is set to
true. This causes the scrollWin to manage the width of the textView.
Here's a simplified indication of how the scrollWin is created:
ObjectCall(msgNewDefaults, clsScrollWin, &sn)
sn.scrollWin.clientWin = <the text view>
sn.scrollWin.style.vertScrollbar = true;
sn.scrollWin.style.autoVertScrollbar = false;
sn.scrollWin.style.expandChildWidth = true;
sn.scrollWin.style.expandChildHeight = true;
sn.scrollWin.style.contractChildWidth = true;
sn.scrollWin.style.contractChildHeight = true;
sn.scrollWin.style.vertClient = swClientWin;
sn.scrollWin.style.horizClient = swClientScrollWin;
sn.win.flags.input 1= inputHoldTimeout;
sn.scrollWin.style.forward = swForwardGesture;
if «creating on screen» {
sn.border.style.leftMargin = bsMarginMedium;
sn.border.style.rightMargin = bsMarginMedium;
sn.border.style.topMargin = bsMarginMedium;
else {
sn.border.style.leftMargin = bsMarginNone;
sn.border.style.rightMargin = bsMarginNone;
sn.border.style.topMargin = bsMarginNone;
TextlP
typedef struct TEXTIP_METRICS {
U16 flags; II Reserved.
TEXTIP_METRICS, *P_TEXTIP_METRICS,
TEXT IP_NEW_ONLY, *P_TEXTIP_NEW_ONLY;
msgNewDefaults
Initializes the NEW struct.
Takes P _TEXTIP_NEW, returns STATUS. Category: class message.
In response to this message, dsTextIP does the following:
pArgs->win.flags.style 1= wsSendGeometry 1 wsSendFile
wsShrinkWrapHeight;
pArgs->ip.rows = 5;
pArgs->ip.lines = 5;
If the user input pad style preference is Boxed:
pArgs->ip.style.displayType = ipsCharBox;
pArgs->ip.style.delayed = 1;
If the user input pad style preference is Ruled:
pArgs->ip.style.displayType = ipsRuledLines;
If the user input pad style preference is RuledAndBoxed:
pArgs->ip.style.displayType = ipsRuledLines;
pArgs->ip.style.ruledToBoxed = true;
msgNew
Creates a new instance of cIsTextlP.
Takes P_TEXTIP_NEW, returns STATUS. Category: class message.
msg1rextI]>(;e~etrics
Passes back a textlP's metrics.
Takes P_TEXTIP_METRICS, returns stsOK.
fdefine msgTextIPGetMetrics MakeMsg(clsTextIP, 1)
M®sscg® typedef struct TEXTIP_METRICS
AV£10ments U16 flags; II Reserved.
TEXTIP_METRICS, *P_TEXTIP_METRICS,
TXTVIEW.H 43
TextlP
msgT extIPSetMetrics
Sets a textlP's metrics.
Takes P_TEXTIP_METRICS, returns stsOK.
#define msgTextIPSetMetrics MakeMsg(clsTextIP, 2)
#ifndef NO_NEW
#ifndef textIPNewFields
#ifndef INSERT INCLUDED
#include <insert.h>
#endif
#define textIPNewFields \
ipNewFields \
TEXTIP NEW ONLY textIP;
Arguments typedef struct TEXTIP_NEW
textIPNewFields
} TEXT IP_NEW, *P_TEXTIP_NEW;
#endif II textIPNewFields
#endif II NO_NEW
Message typedef struct TEXTIP_METRICS {
Arguments U16 flags; II Reserved.
TEXTIP_METRICS, *P_TEXTIP_METRICS,
TXTXLIST.H
This file contains the Text subsystem additions to xlist (see xlist.h).
A Text View (see txtView.h) gathers input directly from the user via
keyboard input delivered by msgInputEvent, with Cls(pArgs->devCode) == Cls(clsKey);
low-level pen input also msgInputEvent, but Cls(clsPen);
gestures delivered by msgGWinXlist; and
insertion pads which provide data starting with msgIPDataAvailable.
The user input delivered to a Text View from an insertion pad is communicated via an xlist. As a result
of its processing of the xlist, the Text View modifies its associated data object. Each xlist moves through
the following stages: (I) it comes into being as a way for the hwx system to provide low-level
information about the user input to clsIP (see insert.h); (2) clsIP packages the low-level information
into medium-level information which is self-sent; (3) finally, clsTextlP re-interprets this information
and packages it into high-level information which requires concepts specific to the Text subsystem.
Thus, an xlist from a TextlP (see txtView.h) can contain one or more elements of the following
specialized types. For each type, the constraint on the structure of the information pointed to by the
pData field of the XLIST_ELEMENT is listed.
xtCharAttrs pData points to an XLIST_CHAR_ATTRS;
xtParaAttrs pData points to an XLIST_PARA_ATTRS;
xtTabs pData points to an XLIST_TABS;
xtCharPos pData is a TEXT_INDEX (cast to a P_UNKNOWN).
The types themselves are defined as part ofXTYPE in xlist.h; the data structures and their semantics are
defined below.
In general, an xlist is position-independent. However, the caller of msgGWinXlist often wants the
associated xlist to modify a Text View's data object beginning at a particular character index; an element
of type xtCharPos allows the caller to specify such an index.
To make it easier to maintain the position-independent property of an xlist, Text Views recognize
maxTEXT_INDEX (see txtData.h) as having a special meaning when used as the value of the first field
of the pData in an xlist element of type xtCharAttrs, xtParaAttrs and xtTabs (i.e., pData->first ==
maxTEXT_INDEX). If the pData->length is 0, a pData->first of maxTEXT_INDEX causes the xlist
processing code to remember the current index in the Text data object and to take no other action; if the
pData->length is non-zero, the pData->first of maxTEXT_INDEX causes the xlist processing code to
update pData->first with the previously remembered index. This allows the caller of msgGWinXlist to
generate an xlist with the following structure:
xtCharPos .to start processing at a particular index;
xtText one or more times, to add characters;
xtCharAttrs with first of maxTEXT_INDEX, length of 0;
xtText one or more times, to add more characters;
46 PENPOINT API REFERENCE
Part 6 / Text
xtCharAttrs with first of maxTEXT_INDEX, length not 0, thereby setting the character attributes for
exactly the bracketed characters.
#ifndef TXTXLIST_INCLUDED
#define TXTXLIST INCLUDED
#ifndef XLIST INCLUDED
#include <xlist.h>
#endif
#ifndef TXTDATA_INCLUDED
#include <txtData.h>
#endif
Upon encountering an xlist element of type xtCharAttrs, a Text View does a msgTextChangeAttrs to its
data object, making use of the fields of the P_XLIST_CHAR_ATTRS by mapping them to the
corresponding fields ofTEXT_CHANGE_ATTRS as follows:
tag forced to atomChar
first copied from first
length copied from length
pNewMask set to &mask
pN ewValues set to &attrs
typedef struct
TEXT INDEX first;
TEXT INDEX length;
TA CHAR MASK mask;
TA CHAR ATTRS attrs;
XLIST_CHAR_ATTRS, *P_XLIST_CHAR_ATTRS;
Upon encountering an xlist element of type xtParaAttrs, a Text View does a msgTextChangeAttrs to its
data object, making use of the fields of the P_XLIST_PARA_ATTRS by mapping them to the
corresponding fields ofTEXT_CHANGE_ATTRS as follows:
tag forced to atomPara
first copied from first
length copied from length
pN ewMask set to &mask
pN ewValues set to &attrs
typedef struct
TEXT INDEX first;
TEXT INDEX length;
TA PARA MASK mask;
TA PARA ATTRS attrs;
XLIST_PARA_ATTRS, *P_XLIST_PARA_ATTRS;
Upon encountering an xlist element of type xtTabs, a Text View does a msgTextChangeAttrs to its data
object, making use of the fields of the P_XLIST_TABS by mapping them to the corresponding fields of
TEXT_CHANGE_ATTRS as follows:
tag forced to atomParaTabs
first copied from first
length copied from length
pNewMask set to NilO
TXTXLlST.H 47
------------ -------
FS.H
This file contains the API for clsDirHandle and clsFileHandle. The functions described in this file are
contained in PENPOINf.LIB.
clsFileSystem inherits from clsObject.
Provides file system support. theFileSystem is the only instance of clsFileSystem.
clsDirHandle inherits from clsObject.
Provides file system directory support. theBootVolume is a well known instance of clsDirHandle.
theSelectedVolume is a well known instance of clsDirHandle. theWorkingDir is a well known instance
of clsDirHandle.
clsFileHandle inherits from clsStream.
Provides file system file access support.
#ifndef FS_INCLUDED
#define FS INCLUDED
Debugging Flags
FileSystem Debugging Flag is '$', values are:
000 1 Debug info when fs cache layer calls volume layer
0200 Breaks into debugger before asking to insert disk
20000 Display list of known volumes when prompting for unmounted disk
Include file dependencies for this include file
#ifndef GO INCLUDED
#include <go.h>
#endif
#ifndef UID INCLUDED
#include <uid.h>
#endif
#ifndef CLSMGR INCLUDED
#include <clsmgr.h>
#endif
#ifndef UUID_INCLUDED
#include <uuid.h>
#endif
#ifndef STREAM INCLUDED
#include <stream.h>
#endif
Common abbreviations, terms:
FS File System
Node A file or a directory
Dir A directory
54 PEN POINT API REFERENCE
Part 7 / File System
FS AHribute Intrinsics
These are used to build file/directory attribute labels or to get component pieces from an attribute label.
A client can define their own attribute using one of the FSMakeXXXAttr intrinsics, specifYing a class
and a tag. The attribute type will allow for storage of a 32 bit value (Fix32), a 64 bit value (Fix64), a null
terminated string of any length up to 32K (Str), or a variable length value up to 32K (Var). The
messages msgFSGetAttr, msgFSSetAttr, msgFSReadDir, msgFSReadDirFull and msgFSTraverse use
file system attributes to represent the attribute label.
fdefine fsFixAttr o
fdefine fsFix64Attr 1
fdefine fsVarAttr 2
fdefine fsStrAttr 3
fdefine fsMaxAttrLength 255
fdefine FSMakeAttr(cls,t,f) \
MakeTagWithFlags(cls,t,f)
fdefine FSMakeFix32Attr(cls,t) FSMakeAttr (cls,t, fsFixAttr)
fdefine FSMakeFix64Attr(cls,t) FSMakeAttr(cls,t,fsFix64Attr)
fdefine FSMakeVarAttr(cls,t) FSMakeAttr(cls,t,fsVarAttr)
fdefine FSMakeStrAttr(cls,t) FSMakeAttr (cls,t, fsStrAttr)
fdefine FSAttr(attr) TagNum(attr)
fdefine FSAttrCIs(attr) ClsNum(attr)
fdefine FSAttrIsFix32 (attr) (TagFlags(attr) == fsFixAttr)
fdefine FSAttrIsFix64 (attr) (TagFlags(attr) == fsFix64Attr)
fdefine FSAttrIsVar(attr) (TagFlags(attr) fsVarAttr)
fdefine FSAttrIsStr(attr) (TagFlags(attr) == fsStrAttr)
Status Codes
Common return values:
There are a few status return values that are common to either all messages or to a group of messages
(i.e. messages that try to change the volume).
stsFSHandleInvalid The dirlfile object refers to a node that has been previously deleted.
Types
Locators are structures used to describe the location of a file or dir node. There are two types of locators:
explicit and implicit. An explicit locator is defined with FS_LOCATOR which specifies both the starting
node (uid) and the path relative to the starting node (pPath). An implicit locator is made up of a
starting node (the object that receives a message) and the path relative to the starting node (pPath).
msgFSMove is a good example of a message that contains both types of locators. The receiver of
msgFSMove and move.pSourcePath defines the implicit location of the source of the move.
move.destLocator defines the explicit location of the dest of the move.
The uid field of a locator must be filled in and must be non-null. If no other choice can be decided
upon, theWorkingDir may be a good one. The uid field does not always have to be a dir handle object.
The uid can be a file handle object if the pPath field points to a path that begins with .. (parent), \ (root)
or \ \ (fully specified path including volume name).
The path field of locators (explicit and implicit) are relative to the node defined by the uid (or object
receiving the message) unless the path begins with a \ (root relative) or \\ (fully specified path).
typedef struct FS_LOCATOR {
OBJECT uid;
P STRING pPath; II Relative to node defined by uid
FS_LOCATOR, * P_FS_LOCATOR;
The file system interface never uses flat locators, but if it is more convenient to hold the entirety of the
locator in a linear structure using flat locators.
typedef struct FS_FLAT_LOCATOR {
OBJECT uid;
U8 path [fsPathBuf Length];
FS_FLAT_LOCATOR, * P_FS_FLAT_LOCATOR;
Enum16 (FS_NODE_FLAGS) {
fsNodeReadOnly flagO, II Node is read-only.
fsNodeHidden flagl, II System hidden file.
fsNodeDir flag4, II Directory or file?
fsNodeGoFormat flag8, II Node has non-native attrs
fsNodePenPointHidden flag9 II Should this node be hidden from
II the user in Penpoint browsers?
};
idefine validFSNodeFlags \
(fsNodeReadOnly I fsNodeHidden I fsNodeDir I \
fsNodeGoFormat I fsNodePenPointHidden)
idefine readOnlyFSFlags (fsNodeDir I fsNodeGoFormat)
FS_NODE_FLAGS_ATTR is used to set or get the flags attribute stored with a file/dir node. When setting
the flags, only those flags with a one in the mask word will be affected. When getting flags, all flags are
returned and mask is set to all ones (as a convenience for set after get).
typedef struct FS_NODE_FLAGS_ATTR
FS_NODE_FLAGS flags;
U16 mask;
FS_NODE_FLAGS_ATTR, * P_FS_NODE_FLAGS_ATTR;
typedef U32 FS_DATE_TIME, * P_FS_DATE_TIME;
typedef U32 FS_FILE_SIZE, * P_FS_FILE_SIZE;
typedef U16 FS_ATTR_SIZE, * P_FS_ATTR_SIZE;
typedef U32 FS_ATTR LABEL, * P_FS_ATTR_LABEL;
Enum16 (FS_VOL_TYPE)
fsAnyVolType = 0, II Match any vol type for msgNew
fsVolTypeMemory = 0,
fsVolTypeDisk = 1,
fsVolTypeRemote =2
};
FS.H 57
Common #defines and typedefs
Enum16 (FS_VOL_FLAGS)
fsVolReadOnly flagO,
fsVolConnected flag1,
fsVolRemovableMedia flag2,
fsVolEjectableMedia flag3,
fsVolDirsIndexable flag4,
fsVolFormattable flagS,
fsVolDuplicatable flag6
};
Enum16 (FS_DIR_NEW_MODE)
II Delete directory at handle free time?
fsTempDir flagO,
II Is handle changeable?
fsUnchangeable flagl,
II Find node via its dir index?
fsUseDirIndex flag2,
II Disable prompts (insert disk, write protected, etc)
II fsDisablePrompts = flag4, (Defined in FS_FILE_NEW_MODE below)
II System owned dir handle - ring 0 only
fsSystemDir flag7,
II Default setting
fsDirNewDefaultMode 0 II permanent, changeable directory
}i
Enum16(FS FILE NEW MODE) {
II Lower-byte~ flags
II Delete file at handle free time?
fsTempFile flagO,
II Read/write intentions for this handle
fsReadOnly flag2,
II Memory mapped files accessibility
fsSharedMemoryMap = flag3,
II Disable prompts (insert disk, write protected, etc)
fsDisablePrompts = flag4,
II System owned file handle - ring 0 only
fsSystemFile = flag7,
II Upper byte: exclusivity requirements for other handles
fsNoExclusivity = MakeU16(0, 0),
fsDenyWriters = MakeU16 (0, 1),
fsExclusiveOnly = MakeU16 (0, 2),
II Default setting
fsFileNewDefaultMode= 0 II perm, readlwrite (noExclusivity)
}i
Enum16(FS_GET_PATH_MODE) {
II Get path relative to root, dir passed in, just name or vol and path
fsGetPathRoot 0,
fsGetPathRelative 1,
fsGetPathName 2,
fsGetPathAbsolute 3,
II Default setting
fsGetPathDefaultMode= fsGetPathRoot
}i
Enum16 (FS_MOVE_COPY_MODE)
II Use destination as container.
fsMoveCopyIntoDest flagO,
II Check but don't move or copy.
fsMoveCopyVerifyOnly flagl,
II Does source have live dir indexes.
fsMoveCopySourceArchived = flag2,
II Does dest have live dir indexes.
fsMoveCopyArchiveDest = flag3,
II Default setting
fsMoveCopyDefaultMode 0
};
Enum16(FS TRAVERSE MODE) {
II Call back on files?
fsCallBackOnFiles = flagO,
II Call back before stepping into directory?
fsCallBackPreDir = flag1,
II Call back after stepping into directory?
fsCallBackPostDir = flag2,
II Default setting
fsTraverseDefaultMode= fsCallBackOnFiles I fsCallBackPreDir
};
FS.H 59
Class File System Messages understood by dirHandles and fileHandles
Enum16 (FS_SEEK_MODE) {
II Relative to beginning of file, end of file, or Current Byte Position
fsSeekBeginning = 0, :e
fsSeekEnd = 1,
l
fsSeekCurrent = 2,
II Default setting
fsSeekDefaultMode = fsSeekBeginning
};
typedef OBJECT DIR_HANDLE, * P_DIR_HANDLE;
typedef OBJECT FILE_HANDLE, * P_FILE_HANDLE;
msgFSGetlnstalledVolumes
Returns list of all installed volumes.
Takes P_LIST, returns STATUS.
#define msgFSGetInstalledVolumes MakeMsg(clsFileSystem, 21)
COmmC!1fS This message can only be directed to the well known class theFileSystem. Each object in the list is a
directory handle object that references the root node of the volume. The list is passed back and is not
used as an input parameter. The caller must free the returned list when finished using it, but do not free
any of the objects in the list.
msgFSEjectMedia to eject media from a floppy drive.
msgFSGetVolMetrics to get more info about the volume
msgFSSame to compare root dir to a well-known dir handle
msgNew
Creates a directory or file handle object on a new or existing dirlfile.
Takes P_FS_NEW, returns STATUS. Category: class message.
typedef struct FS_NEW_ONLY {
FS LOCATOR locator; II location of the target directory
FS-VOL TYPE volType; II hint for uninstalled fullpath vols
UUID dirIndex; II used with fsUseDirIndex mode only
U16 mode; II options for opening file/dir handle
FS EXIST exist; II action to take if exists or doesn't
P UNKNOWN pVolSpecific; II volume specific information
II Note: this is an in only parm
U32 sparel; II for future use
U32 spare2; II for future use
BOOLEAN alreadyExisted; II Out: indicates if already exists
FS_NEW_ONLY, * P_FS_NEW_ONLY;
#define fsNewFields \
objectNewFields \
FS NEW ONLY fs;
typedef struct FS_NEW
fsNewFields
FS_NEW, * P_FS_NEW;
60 PENPOINT API REFERENCE
Part 7 / File System
msgNewDefaults
Initializes the FS_NEW structure to default values.
Takes P_FS_NEW, returns STATUS. Category: class message.
MG\ss01ge typedef struct FS_NEW
AVSfumenTS fsNewFields
} FS_NEW, * P_FS_NEWi
Zeroes out pNew->fs and sets:
pNew->fs.locator.uid = theWorkingDiri
pNew->object.cap 1= objCapCalli
FS.H 61
Class File System Messages understood by dirHandles and file Handles
msgDestroy
Destroys a directory or file handle.
Takes OBLKEY, returns STATUS.
This destroys the handle, NOT the actual node. An exception to this is if the fsTempFile/fsTempDir
flag was set in pNew->fs.mode when the handle was created.
Return Value stsFSNodeBusy Temporary node cannot be deleted because it is being access by another client.
stsFSNodeReadOnly Temporary node cannot be deleted because the read only flag is set on the node.
msgFSNull
Does nothing.
Takes void, returns STATUS.
#define msgFSNull MakeMsg(clsFileSystem, 20)
This message is used to time entering and exiting the file system.
msgFSGetVolMetrics
Returns metrics of the volume.
msgFSSetVolName
Changes the name of a volume.
Takes P_STRING, returns STATUS.
#define msgFSSetVolName MakeMsg(clsFileSystem, 36)
stsBadParam New vol name is invalid (checked by FSNameValid).
stsFSHandlelnvalid The dirlfile object refers to a node that has been previously deleted.
stsFSVolDisconnected The volume is not connected.
stsFSVolReadOnly The new volume name cannot be set, because the volume is write protected.
FSNameValid Mechanism to precheck validity of new volume name.
62 PEN POINT API REFERENCE
Part 7 / File System
msgFSNodeExists
Tests the existence of a file or directory node.
Takes P_FS_NODE_EXISTS, returns STATUS.
fdefine msgFSNodeExists MakeMsg(clsFileSystem, 37)
typedef struct FS_NODE_EXISTS
P_STRING pPath; II path to node that may exist
BOOLEAN isDir; II Out: dir or file
FS_NODE_EXISTS, * P_FS_NODE_EXISTS;
The return parm isDir is useful in deciding whether the msgNew, to create a handle to the node, should
be sent to dsDirHandle or dsFileHandle. The parm pPath is relative to the object that receives this
message.
stsO K The node exists.
stsFSNodeNotFound The node does not exist.
msgFSGetHandleMode
Returns the "new" mode for the object's fs handle.
Takes P_UI6, returns STATUS.
fdefine msgFSGetHandleMode MakeMsg(clsFileSystem, 23)
Directory handles interpret the P_ U16 as a P_FS_FILE_NEW_MODE. File handles interpret the P_ U16 as a
P _FS_DIR_NEW_MODE.
msgFSSetHandleMode
Changes the" new" mode for the object's fs handle.
Takes P_FS_SET_HANDLE_MODE, returns STATUS.
fdefine msgFSSetHandleMode MakeMsg(clsFileSystem, 24)
typedef struct FS_SET_HANDLE_MODE
U16 mode; II value of mode flags to change
U16 mask; II which mode flags are to change
FS_SET_HANDLE_MODE, * P_FS_SET_HANDLE_MODE;
Directory handles interpret mode as a FS_FILE_NEW_MODE. File handles interpret mode as a
FS_DIR_NEW_MODE.
msgFSSame
Tests if another directory or file handle references the same node.
Takes OBJECT, returns STATUS.
fdefine msgFSSame MakeMsg(clsFileSystem, 25)
msgFSGetPath
Gets the path to (or name of) a directory or file handle node.
Takes P_FS_GET_PATH, returns STATUS.
fdefine msgFSGetPath MakeMsg(clsFileSystem, 26)
FS.H 63
Class File System Messages understood by dirHandles and fileHandles
msgFSGetAttr
Gets an attribute or attributes of a file or directory node.
Takes P_FS_GET_SET_ATTR, returns STATUS.
tdefine msgFSGetAttr MakeMsg(clsFileSystem, 27)
typedef struct FS_GET_SET_ATTR {
P STRING pPath; II path to node to get/set attrs
U16 nurnAttrs; II number of attrs of interest
P_FS_ATTR_LABEL pAttrLabels; II In-Out: attr labels
P UNKNOWN pAttrValues; II In-Out: attr values
P_FS_ATTR_SIZE pAttrSizes; II In-Out: attr sizes
FS_GET_SET_ATTR, * P_FS_GET_SET_ATTR;
Specify which attributes you wish returned via an array of attribute labels pointed to by pAttrLabels.
The number of attribute labels is specified by numAttrs. The values are passed back via an array of
values. If the nth value represents a string or variable attribute a pointer must be filled in for the
destination of the string/variable. If the nth value represents a Fix64 provide space for two consecutive
U32s. The sizes are passed back via an array of sizes.
If either the values are of no interest or the sizes are of no interest, set pAttrValues to pNull and/or set
pAttrSizes to pNull.
If you want all attributes of a node, but do not know what they may be set numAttrs to maxU16,
pAttrLabels to fsAllocA.ttrLabelsBuffer, and pAttrValues to fsAllocA.ttrValuesBuffer (or pNull if
unwanted) and pAttrSizes to fsAllocA.ttrSizesBuffer (or pNull if unwanted). Any buffers returned as a
result of fsAllocXXXBuffer must be freed with OSHeapBlockFree.
The parm pPath is relative to the object that receives this message.
msgFSSetAttr
Sets the attribute or attributes of a file or directory node.
Takes P_FS_GET_SET_ATTR, returns STATUS.
tdefine msgFSSetAttr MakeMsg(clsFileSystem, 28)
Message typedef struct FS_GET_SET_ATTR {
Arguments P STRING pPath; II path to node to get/set attrs
U16 nurnAttrs; II number of attrs of interest
P_FS_ATTR_LABEL pAttrLabels; II In-Out: attr labels
P UNKNOWN pAttrValues; II In-Out: attr values
P FS ATTR SIZE pAttrSizes; II In-Out: attr sizes
FS_GET_SET_ATTR, * P_FS_GET_SET_ATTR;
64 PENPOINT API REFERENCE
Pa rt 7 I File System
Specify which attributes you wish to set via an array of attribute labels pointed to by pAttrLabels. The
number of attribute labels is specified by numAttrs. The values are specified via an array of values. If the
nth value represents a string or variable attribute supply the pointer to the string/variable. If the nth
value represents a Fix64 attribute two consecutive U32 values are expected. If there are no variable length
attributes, pAttrSizes can be set to pNull, because the size of Fix32, Fix64 and string attributes can be
inferred.
pAttrLabels, pAttrValues & pAttrSizes are inputs only for this message. The parm pPath is relative to
the object that receives this message.
The attr fsAttrDirIndex (dir indexes) can be set on directories to establish an alternate access to a
directory without having to specify the path to the directory. See msgNew above on how to access
directories with a dir index. Only directories that reside under the PenPoint tree (any directories below
the PenPoint directory on a given volume) can have dir index attributes. If another directory already has
the same dir index as the one given then a stsFSDirIndexExists error is returned.
NOTE: Most attributes (with the exception of dir index and old dir index attributes) can be stored with
either files or directories. The root of a volume is the exception. No attributes may be stored with the
root.
stsFSBadPath New name for name attr is invalid.
stsFSNotDir Dir index attr cannot be set on a file.
stsFSReadOnlyAttr File size cannot be set via set attr, use msgFSSetSize.
msgFSMove
Moves a node (and any children) to a new destination.
Takes P_FS_MOVE_COPY, returns STATUS.
#define msgFSMove MakeMsg(clsFileSystem, 29)
Arguments typedef struct FS_MOVE_COPY
P_STRING pSourcePath; II path of source of move or copy
FS_LOCATOR destLocator; II locator to destination node
FS_MOVE_COPY_MODE mode; II options that affect move or copy
FS_MOVE_COPY_EXIST exist; II action to take if exists or doesn't
P STRING pNewDestName; II Out: See comment above
BOOLEAN alreadyExisted; II Out: indicates if already exists
U32 spare;
FS_MOVE_COPY, * P_FS_MOVE_COPY;
The destination file/ dir name of a move is derived as follows.
For "fsMoveCopyToDest" (the default): If non null path is provided then dest name is the leaf name of
the path and the path up to the leaf name determines the destination directory. If the path is null then
the name of the destination object is used as the dest name and the parent of the destination object is
used as the destination directory.
For fsMoveCopylntoDest: The entire destination uid and path are used for the destination directory.
And the destination name is taken from the source name.
The parm pSourcePath is relative to the object that receives this message.
NOTE: pNewDestName is not an in parameter. It is an output parameter that gives the (new, if
fsMoveCopyGenUnique was specified for exist) name of the copied node. Set pNewDestName to a
buffer if you want to know the name, set pNewDestName to pNull if you do not.
FS.H 65
Class File System Messages understood by dirHandles and fileHandles
msgFSCopy
Copies a node (and any children) to a new destination.
Takes P_FS_MOVE_COPY, returns STATUS.
#define msgFSCopy MakeMsg(clsFileSystem, 30)
Me$5d~e typedef struct FS_MOVE_COPY {
Argumzen'f$ P STRING pSourcePath; II path of source of move or copy
FS LOCATOR destLocator; II locator to destination node
FS_MOVE_COPY_MODE mode; II options that affect move or copy
FS_MOVE_COPY_EXIST exist; II action to take if exists or doesn't
P STRING pNewDestName; II Out: See comment above
BOOLEAN alreadyExisted; II Out: indicates if already exists
U32 spare;
FS_MOVE_COPY, * P_FS_MOVE_COPY;
The destination file/ dir of a copy is derived as follows.
For "fsMoveCopyTo" (the default): If non null path is provided then dest name is the leaf name of the
path and the path up to the leaf name determines the destination directory. If the path is null then the
name of the destination object is used as the dest name and the parent of the destination object is used
as the destination directory.
For fsMoveCopyInto: The entire destination uid and path are used for the destination directory. And
the destination name is taken from the source name.
The parm pSourcePath is relative to the object that receives this message.
NOTE: pNewDestName is not an in parameter. It is an output parameter that gives the (new, if
fsMoveCopyGenUnique was specified for exist) name of the copied node. Set pNewDestName to a
buffer if you want to know the name, set pNewDestName to pNull if you do not.
stsFSBadPath Path or parts of path are too large.
stsFSCircularMoveCopy Occurs when copying dir to an ancestor (parent).
msgFSCopyNotify, msgFSMove
msgFSMoveNotify
Same as msgFSMove with notification routine extensions.
Takes P_FS_MOVE_COPY_NOTIFY, returns SfATUS.
#define msgFSMoveNotify MakeMsg(clsFileSystem, 70)
II the time that the current event occurred
Enum16 ( FS_NOTIFY_TIME ) {
fsBeginOperation = 1, II beginning of whole operation
fsBeforeOperation = 2, II before the sub operation
fsDuringOperation = 3, II during the sub operation
fsAfterOperation = 4, II after the sub operation
fsEndOperation = 5 II end of the whole operation
};
66 PENPOINT API REFERENCE
Part 7 I File System
msgFSCopyNotify
Same as msgFSCopy with notification routine extensions.
Takes P_FS_MOVE_COPY_NOTIFY, returns STATUS.
*define msgFSCopyNotify MakeMsg(clsFileSystem, 71)
Message typedef struct FS_MOVE_COPY_NOTIFY {
Arguments P STRING pSourcePath; II path of source of move or copy
FS LOCATOR destLocator; II locator to destination node
FS_MOVE_COPY_MODE mode; II options that affect move or copy
FS_MOVE_COPY_EXIST exist; II action to take if exists or doesn't
P STRING pNewDestName; II Out: See comment w/msgFSMove
BOOLEAN alreadyExisted; II Out: indicates if already exists
P UNKNOWN pNotifyRtn; II notification routine
P UNKNOWN pClientData; II client data to notification routine
P UNKNOWN pQuickSortRtn; II quicksort routine
U32 spare1; II spare: unused
U32 spare2; II spare: unused
FS MOVE_COPY_NOTIFY, * P_FS_MOVE_COPY NOTIFY;
The parm pSourcePath is relative to the object that receives this message.
FS.H 67
Class File System Messages understood by dirHandles and fileHandles
msgFSDelete
Deletes a node (and all of its children).
Takes P_STRING, returns STATUS.
*define msgFSDelete MakeMsg(clsFileSystem, 31)
Comments The object of msgFSDelete is typically a dir handle, but it can also be a file handle, but the argument
passed must be set to pNull. After a node is deleted, its handle is marked corrupt (since it is no longer
valid). A dir handle object can be reused via msgFSSetTarget or destroyed via msgDestroy. A file handle
must be destroyed after the node is deleted. The argument (a path) is relative to the object that receives
this message.
stsFSVolDisconnected The volume is not connected.
stsFSVolReadOnly A node cannot be deleted, because the volume is write protected.
stsFSNodeReadOnly Node cannot be deleted because the read only flag is set on the node.
stsFSNodeBusy Node cannot be deleted because it is being access by another client.
msgFSForceDelete
msgFSFlush
Flushes any buffers and attributes associated with the file or directory.
Takes void, returns STATUS.
*define msgFSFlush MakeMsg(clsFileHandle, 20)
This can be used to guarantee that cached buffers are flushed to the disk and can also be used to flush
memory mapped files to disk.
msgFSMakeNative
Removes anything not supported by the native file system.
Takes P_FS_MAKE_NATlVE, returns STATUS.
*define msgFSMakeNative MakeMsg(clsFileSystem, 32)
Arguments typedef struct FS MAKE NATIVE
P STRING pPath; II path to node to make native
P STRING pNewName; II Out: native name if changed
FS_MAKE_NATIVE, * P_FS_~E_NATIVE;
The parm pPath is relative to the object that receives this message.
msgFSEjectMedia
Ejects media from an ejectable, removable volume.
Takes void, returns STATUS.
*define msgFSEjectMedia MakeMsg(clsFileSystem, 34)
stsOK The volume media has been ejected.
stsFSVolDisconnected The volume media is already ejected.
stsRequestNotSupported The volume does not have ejectable media
68 PENPOINT API REFERENCE
Part 7 / File System
msgFSForceDelete
Forcibly deletes a node (and all of its childen).
Takes P_STRING, returns STATUS.
tdefine msgFSForceDelete MakeMsg(clsFileSystem, 35)
WARNING. Normal restrictions do not apply. The node will still be deleted even if it is being accessed
via another handle or if it is marked read only. However, if the volume is not connected or is write
protected, the forced delete will still fail.
After a node is deleted, its handle is marked corrupt (since it is no longer valid). A dir handle object can
be reused via msgFSSetTarget or destroyed via msgDestroy. A file handle must be destroyed after the
node is deleted. The argument (a path) is relative to the object that receives this message.
msgFSDelete
msgFSVolSpecific
Sends a volume specific message via a dir or file handle.
Takes P _FS_VOL_SPECIFIC, returns STATUS.
tdefine msgFSVolSpecific MakeMsg(clsFileSystem, 40)
typedef struct FS_VOL_SPECIFIC
P_STRING pPath; II path of node to receive msg
MESSAGE msg; II message to pass on to volume
P UNKNOWN pArgs; II In-Out: message specific args
FS_VOL_SPECIFIC, * P_FS_VOL_SPECIFIC;
Volume specific errors.
msgFSChanged
Notifies observers of directory changes.
Takes P_FS_CHANGE_INFO, returns STATUS. Category: observer notification.
tdefine msgFSChanged MakeMsg(clsFileSystem, 50)
Arguments typedef struct FS_CHANGE_INFO
MESSAGE reason; II fs message that caused the change
OBJECT observed; II observed dir whose content changed
U32 sparel;
U32 spare2;
FS_CHANGE_INFO, * P_FS_CHANGE_INFO;
These messages are the reason observers of a dir handle would be notified of a change and the
circumstances that the change happens:
msglnit A file or dir has been created.
msgFree A temp file or temp directory has been deleted.
msgFSDelete A file or directory has been deleted.
msgFSForceDelete A file or directory has been deleted.
msgFSMove A file or directory has been "fast" moved.
Comments This notifies observers of directories (not files) when a file or dir within the directory changes. The
change reasons described below are changes to the directory or file node, not the handle referencing the
node.
FS.H 69
Class DirHandle Messages
msgFSVolChanged
Notifies observer of volume changes.
Takes P _FS_VOL_CHANGE_INFO, returns STATUS. Category: observer notification.
#define msgFSVolChanged MakeMsg(clsFileSystem, 51)
Enum16(FS_VOL_CHANGE_FLAGS)
fsVolChangeWhilePrompting flagO II FS prompting caused change
};
typedef struct FS_VOL_CHANGE_INFO
MESSAGE reason; II fs message that caused the change
OBJECT rootDir; II root dh of volume that changed
FS_VOL_CHANGE_FLAGS flags; II more info related to reason
U16 spare1;
U32 spare2;
FS VOL_CHANGE_INFO, * P_FS_VOL_CHANGE_INFO;
These messages are the reason observers of theFileSystem would be notified of a volume addition,
removal or change of state. Note: msgFSSetVolName (defined above) is also a volume change reason.
#define msgFSInstallVol MakeMsg(clsFileSystem, 1)
#define msgFSRemoveVol MakeMsg(clsFileSystem, 2)
#define msgFSConnectVol MakeMsg(clsFileSystem, 3)
#define msgFSDisconnectVol MakeMsg(clsFileSystem, 4)
Observe the well known object, theFileSystem, if you want to receive this.
msgFSSetTarget
Changes the target directory to directory specified by locator.
Takes P_FS_LOCATOR, returns STATUS.
#define msgFSSetTarget MakeMsg(clsDirHandle, 20)
MessG€1e typedef struct FS LOCATOR
Ar9umenrs OBJECT uid;
P STRING pPath; II Relative to node defined by uid
FS_LOCATOR, * P_FS_LOCATOR;
Setting a dir handle object to a new target also resets the read dir pointer.
stsFSUnchangeable The recipient of this message has been "opened" with the fsUnchangeable flag set
in pNew->mode.
msgFSReadDir
Reads the next entry (its attributes) from a directory.
Takes P _FS_READ_DIR, returns STATUS.
#define msgFSReadDir MakeMsg(clsDirHandle, 21)
AW€1lJmenrs typedef struct FS_READ_DIR
struct FS READ DIR * pNext; II Out: only used w/msgFSReadDirFull
U16 numAttrs; II In-Out: attrs of interest
P- FS- ATTR- LABEL pAttrLabels; II In-Out: ptr to attr labels
P UNKNOWN pAttrValues; II In-Out: ptr to attr values
P- FS- ATTR- SIZE pAttrSizes; II In-Out: ptr to attr sizes
FS_READ_DIR, * P- FS_READ_DIR;
-------. -----------
70 PENPOINT API REFERENCE
Part 7 I File System
SpecifY which attributes you wish returned via an array of attribute labels pointed to by pAttrLabels.
The number of attribute labels is specified by numAttrs. See msgFSGetAttr for a description on setting
pAttrValues and pAttrSizes.
msgFSReadDirReset
Resets the ReadDir position to the beginning.
Takes void, returns STATUS.
tdefine msgFSReadDirReset MakeMsg(clsDirHandle, 22)
This will direct msgFSReadDir to begin reading from the first entry in the directory. This has no effect
on msgFSReadDirFull. The default after creating a handle to a directory is to point to the first entry.
msgFSReadDirFull
Reads all the entries in a directory into a local buffer.
Takes P_FS_READ_DIR_FULL, returns STATUS.
tdefine msgFSReadDirFul1 MakeMsg(clsDirHandle, 23)
Argumorlts typedef struct FS_READ_DIR_FULL
U16 numAttrs; II num of labels in label array
P- FS- ATTR- LABEL pAttrLabels; II attrs of interest to be read
U32 numEntries; II Out: number of dir entries
U32 bufLength; II Out: length of pDirBuf
P FS READ DIR pDirBuf; II Out: points to first entry
FS_READ_DIR_FULL, * P_FS_READ_DI~FULL;
SpecifY which attributes you wish returned via an array of attribute labels pointed to by pAttrLabels.
The number of attribute labels is specified by numAttrs.
The returned data is a linked list of FS_READ_DIR entries, linked by the pNext field. The last link is
specified by a pLink == pNull.
The client must free the returned buffer pDirBuf, using OSHeapBlockFree. The buffer should not be
freed if it has a value of pNull, which will be the case if there are any errors or if numEntries is zero.
msgF~raverse
Traverse through the nodes of a tree starting with the target of this msg.
Takes P_FS_TRAVERSE, returns STATUS.
tdefine msgFSTraverse MakeMsg(clsDirHandle, 24)
Fundi;;)!''t Pr<lt<ltype typedef STATUS FunctionPtr (P _FS_TRAVERSE_CALL_BACK) (
OBJECT dir, II dir handle to current node
U16 level, II level in the hierarchy
P_FS_READ_DIR pNextEntry, II info about next entry
P UNKNOWN pClientData II the client's data
);
typedef struct FS_TRAVERSE
FS_TRAVERSE_MODE mode; II call back order and criteria
U16 numAttrs; II num of labels in label array
P_FS_ATTR_LABEL pAttrLabels; II attr label array
P_FS_TRAVERSE_CALL_BACK pCallBackRtn; II called for each dir & file
P_UNKNOWN pClientData; II passed to call back routine
P UNKNOWN pQuickSortRtn; II optional quick sort routine
FS_TRAVERSE, * P_FS_TRAVERSE;
FS.H 71
Class FileHandle Messages
Comments This message traverses the file system tree beginning with the directory which is the recipient of this
message and traverses the node tree depth first. The client will be called back via pCallBackRtn at each :e
node depending on mode (see FS_TRAVERSE_MODE above). Optionally, the nodes at each directory level
l
can be sorted before being returned by specifying a quick sort routine via pQuickSortRtn (See quicksort
in sort.h).
Specify which attributes you wish returned via an array of attribute labels pointed to by pAttrLabels.
The number of attribute labels is specified by numAttrs. At a minimum, pAttrLabels must contain
fsAttrName and fsAttrFlags.
stsBadParam Did not specify fsAttrName/fsAttrFlags in labels.
stsFSUnchangeable The recipient of this message has been "opened" with the fsUnchangeable flag set
in pNew->mode. This is a common error if trying to traverse from the root dir (which is
unchangeable) provided by msgFSGetlnsta11edVolumes/msgFSGetVolMetrics. Create a handle to
the root and use that to traverse instead.
stsFSNestingTooDeep Dir tree is deeper than fsMaxNestingLevellevels.
msgStreamWrite
Writes data to the file.
Takes P_STREAM_READ_WRITE, returns STATUS. Category: descendant responsibility.
Comments The maximum number of bytes writable with a single request is determined by fsMaxReadWrite. Note
that writes to a memory mapped file that cause the file to grow will result in a stsFSNodeBusy error.
Free the memory map file pointer before growing the file.
stsBadParam Requesting more than fsMaxReadWrite bytes.
stsFSNodeReadOnly This is a read only file.
stsFSVolFu11 The file could not be written - no space on volume.
stsFSNodeBusy The file is memory mapped and this write request would cause the file to be grown
beyond the memory mapped size.
msgStreamWrite in stream.h
72 PENPOINT API REFERENCE
Part 7 / File System
nnsgStreannFlush
Flushes any buffers associated with the file.
Takes void, returns STATUS. Category: descendant responsibility.
msgStreamFlush in stream.h
nnsgStreannSeek
Seeks to new position within the file.
Takes P_STREAM_SEEK, returns STATUS. Category: descendant responsibility.
stsBadParam Seek mode is out of range.
msgStreamSeek in stream.h
nnsgFSSeek
Sets the value of the current byte position.
Takes P_FS_SEEK, returns STATUS.
#define msgFSSeek MakeMsg(clsFileHandle, 21)
typedef struct FS_SEEK
FS SEEK MODE mode; II seek from bof, cur pos, eof
S32 offset; II relative change from seek origin
U32 curPos; II Out: cur byte pos after seek
U32 oldPos; II Out: cur byte pos before seek
BOOLEAN eof; II Out: Is new pos at end of file?
FS_SEEK, * P_FS_SEEK;
stsBadParam Seek mode is out of range.
nnsgFSGetSize
Gets the size of the file.
Takes P_FS_FILE_SIZE, returns STATUS.
#define msgFSGetSize MakeMsg(clsFileHandle, 22)
nnsgFSSetSize
Sets the size of the file.
Takes P_FS_SET_SIZE, returns STATUS.
#define msgFSSetSize MakeMsg(clsFileHandle, 23)
typedef struct FS_SET_SIZE {
FS FILE SIZE newSize; II new file size
FS FILE SIZE oldSize; II Out: prior file size
FS SET_SIZE, * P_FS_SET_SIZE;
Note that a set size to a memory mapped file that causes the file to grow will result in a stsFSNodeBusy
error. Free the memory map file pointer before growing the file.
stsFSNodeReadOnly This is a read only file.
stsFSVolFull The file could not be grown - no space on volume.
stsFSNodeBusy The file is memory mapped and this set size request would cause the file to be grown
beyond the memory mapped size.
FS.H 73
Public Functions
msgFSMemoryMap
Associates the file with a directly accessible memory pointer.
Takes PP_MEM, returns STATUS.
*define msgFSMemoryMap MakeMsg(clsFileHandle, 24)
To get a memory mapped file pointer from shared memory, the file handle must be created with
pNew->fs.mode 1= fsSharedMemoryMap.
msgFSMemoryMapFree
Frees the memory map pointer currently associated with the file.
Takes void, returns STATUS.
*define msgFSMemoryMapFree MakeMsg(clsFileHandle, 25)
Comments NOTE: Memory map pointers are freed for you at msgFree of a file handle.
msgFSMemoryMapSetSize
Sets the size of the file's memory map.
Takes SIZEOF, returns SfATUS.
*define msgFSMemoryMapSetSize MakeMsg(clsFileHandle, 26)
Determines the limit of a memory map for the file. The size can't be less than the file size, nor less than a
limit set by another client but can be larger. The memory map size must be set before memory mapping
the file.
stsFSNodeBusy The file is currently memory mapped.
msgFSMemoryMapGetSize
Gets the size of the file's memory map.
Takes P _SIZEOF, returns STATUS.
*define msgFSMemoryMapGetSize MakeMsg(clsFileHandle, 27)
Public Functions
FSNameValid
Checks a file/ dir name for validity.
Returns SfATUS.
function Prototype STATUS EXPORTED FSNameValid (
P STRING pName II name of file/dir to validate
);
This file contains filesystem attribute helper procedures. The functions described in this file are
contained in SYSUTIL.LIB.
These procedures make it easier to deal with filesystem attributes. They also support list attributes;
variable attributes which maintains lists of 4-byte quanitities.
*ifndef FSUTIL_INCLUDED
*define FSUTIL_INCLUDED
*ifndef FS_INCLUDED
*include <fs.h>
*endif
GetNodeName
Gets the name attribute of a given filesystem node.
Returns STATUS.
STATUS EXPORTED GetNodeName(
OBJECT handle, II File or dir handle.
P STRING pName) ; II Out: name.
Use this function to easily get the name of a node.
GetAttr
Gets a single FIX32 attribute from a filesystem handle.
Returns STATUS.
fundion Prototype STATUS EXPORTED GetAttr (
FS ATTR LABEL attrLabel, II Attribute label.
OBJECT handle, II File or dir handle.
P U32 pValue) ; II Out: attribute value.
This is only for FIX32 attributes when you have a handle onto the node; see GetSingleAttr for a more
general function.
GetSingleAttr
Gets a single FIX32, FIX64, or known-size STRING attribute.
Returns STATUS.
fundion Prototype STATUS EXPORTED GetSingleAttr (
FS_ATTR LABEL attrLabel, II In: Attribute label.
OBJECT handle, II In: handle of node.
P STRING pPath, II In: path of node.
P UNKNOWN pValue) ; II Out: attribute value.
76 PENPOINT API REFERENCE
Part 7 / File System
SetAttr
Sets a single FIX32 attribute on a filesystem handle.
Returns STATUS.
tlJm;tl@n PvOtOYy*,¥0 STATUS EXPORTED SetAttr (
FS ATTR LABEL attrLabel, II Attribute label.
OBJECT handle, II File or dir handle.
U32 value); II Attribute value.
This is only for FIX32 attributes when you have a handle onto the node; see SetSingleAttr for a more
general function.
SetSingleAttr
Sets a single FIX32, FIX64, or STRING attribute.
Returns STATUS.
rlJndion Prototype STATUS EXPORTED SetSingleAttr (
FS_ATTR LABEL attrLabel, II In: Attribute label.
OBJECT handle, II In: handle of node.
P STRING pPath, II In: path of node.
P UNKNOWN pValue); II In: attribute value.
GetListX
Gets a VAR attribute that is organized as a list of values.
Returns STATUS.
tUfidi©n Pr©t©ryp0 STATUS EXPORTED GetListX (
OBJECT handle, II File or dir handle.
P STRING pPath, II Path relative to handle.
FS ATTR LABEL attrLabel, II Attribute label.
PP UNKNOWN ppList, II Out: list.
P U16 pSize) ; II Out: size (in bytes) of list.
Allocates ppList from the process local stack. Caller must HeapBlockFree ppList when done adding,
removing, and putting the list.
PutListX
Updates a list attribute with a new list.
Returns STATUS.
Furu:tkm Pr©torype STATUS EXPORTED PutListX(
OBJECT handle, II File or dir handle.
P STRING pPath, II Path relative to handle.
FS ATTR LABEL attrLabel, II Attribute label.
P UNKNOWN pList, II List.
U16 size); II Size (in bytes) of list.
FSUTIL.H 77
Private
FindListltemX
Finds an element in a list.
Returns STATUS.
Fundion Prototype STATUS EXPORTED FindListItemX (
P UNKNOWN pItem, II Data to search for.
U16 itemSize, II Size of data to search for.
P UNKNOWN pList, II List.
U16 listSize, II Size of list.
P U16 pOffset) ; II Out: offset of found item.
Comments °
The list must first be gotten via GetList. pOffset is based. The list array can be indexed with pOffset
to get the actual data. The comparison is done via a memcmp, so things must be EXACTLY the same.
Return Value stsN oMatch Item not found.
AddListltemX
Adds an item to the end of a list.
Returns STATUS.
fundiol1 Prototype STATUS EXPORTED AddListItemX (
P UNKNOWN pItem, II Item to add.
U16 itemSize, II Size of item in bytes.
PP UNKNOWN ppList, II In:Out List.
P U16 pSize) ; II In:Out size of list in bytes.
The list must first be gotten via GetList. The heap that the list uses is resized. pSize is updated to reflect
the new list size.
RemoveListltemX
Removes an item from a list, given an offset.
Returns STATUS.
fundion Prototype STATUS EXPORTED RemoveListItemX (
U16 offset, II Offset of item to remove.
U16 size, II Size of item to remove.
PP UNKNOWN ppList, II In:Out List.
P U16 pSize) ; II In:Out Size of list.
Comments The list must first be gotten via GetList. The heap that the list uses is resized. If pSize == 1 (only 1 item
left) then *pSize is set to 0, but the list heap is not resized. offset is O-based.
Private
Below are the "old" attribute list functions. These are here for backwards compatabilityonly!
GetList
Gets a VAR attribute that is organized as a list of 4 byte values.
Returns STATUS.
fundion Prototype STATUS EXPORTED GetList (
OBJECT handle, II File or dir handle.
P STRING pPath, II Path relative to handle.
FS ATTR LABEL attrLabel, II Attribute label.
PP OBJECT ppList, II Out: list.
P U16 pCount) ; II Out: number of elements.
78 PEN POINT API REFERENCE
Part 7 / File System
Allocates ppList from the process local stack. Caller must HeapBlockFree ppList when done adding,
removing, and putting the list.
PutList
Updates a list attribute with a new list.
Returns SfATUS.
Function ?roFOfy?>S STATUS EXPORTED PutList (
OBJECT handle, II File or dir handle.
P STRING pPath, . II Path relative to handle.
FS ATTR·LABEL attrLabel, II Attribute label.
P OBJECT pList, II List.
U16 count) ; II Number of elements.
FindListltem
Finds an element in a list.
Returns SfATUS.
Function Prototype STATUS EXPORTED FindListItem (
OBJECT item, II Data to search for.
P OBJECT pList, II List.
U16 count, II Number of elements in list.
P U16 pIndex) ; II Out: index of found item.
The list must first be gotten via GetList. plndex is °
based. The list array can be indexed with plndex to
get the actual data.
stsNoMatch Item not found.
AddListltem
Adds an item to the end of a list.
Returns SfATUS.
STATUS EXPORTED AddListItern(
OBJECT item, II Item to add.
PP OBJECT ppList, II In:Out List.
P U16 pCount) ; II In:Out number of elements in list.
The list must first be gotten via GetList. The heap that the list uses is resized. pCount is updated to
reflect the new list size.
RemoveListltem
Removes an item from a list, given an index.
Returns SfATUS.
Functkm ?roFofy?>s STATUS EXPORTED RemoveListItem (
U16 index, II Index of item to remove.
PP OBJECT ppList, II In:Out List.
P U16 pCount) ; II In:Out Number of elements in list.
The list must first be gotten via GetList. The heap that the list uses is resized. If pCount == 1 (only 1
item left) then *pCount is set to 0, but the list heap is not resized. index is O-based.
STREAM.H
This file contains the API definition for dsStream.
clsStream inherits from clsObject.
clsStream is an abstract class -- it does not completely implement its own protocoL Subclasses of
clsStream must complete the implementation. clsFileHandle is an important subclass of clsStream (see
fs.h).
The functions described in this file are contained in PENPOINf.LIB.
#ifndef STREAM INCLUDED
#define STREAM_INCLUDED
#ifndef GO_INCLUDED
#include <go.h>
#endif
#ifndef UID_INCLUDED
#include <uid.h>
#endif
#ifndef OS TYPES_INCLUDED
#include <ostypes.h>
#endif
#ifndef CLSMGR_INCLUDED
*include <clsmgr.h>
#endif
Penpoint can notify clients or clients may find services' connected states (see service.h and servmgr.h).
#define stsStreamDisconnected MakeStatus(clsStream, 1)
Messages
msgStreamRead
Reads data from stream.
Takes P_STREAM_READ_WRITE, returns STATUS. Category: descendant responsibility.
#define msgStreamRead MakeMsg(clsStream,l)
typedef struct {
streamElements
} STREAM_READ_WRITE, * P_STREAM_READ_WRITE;
msgStreamRead reads data from the stream into pBu£ pBuf must point to a buffer which can hold at
least numBytes bytes. The number of bytes read is passed back in count.
If you try to read 0 bytes when at the end of the data stream stsOK is returned.
< stsOK No data read.
msgStreamWrite
Writes data to stream.
Takes P_STREAM_READ_WRITE, returns STATUS. Category: descendant responsibility.
#define msgStreamWrite MakeMsg(clsStream,2)
M(HiSQse typedef struct {
Arguments streamElements
} STREAM_READ_WRITE, * P_STREAM_READ_WRITE;
Writes numBytes from pBuf into the stream. Returns stsOK if all bytes are written.
msgStreamReadTimeOut
Reads data from stream with timeout.
Takes P_STREAM_READ_WRITE_TIMEOUT, returns STATUS. Category: descendant responsibility.
#define msgStreamReadTimeOut MakeMsg(clsStream,3)
ArsumcnfS typedef struct {
streamElements
os MILLISECONDS timeOut; II In: milliseconds until timeout
STREAM_READ_WRITE_TIMEOUT, * P_ STREAM_READ_WRITE_TIMEOUT;
msgStreamReadTimeOut reads data from the stream into pBuf. pBuf must point to a buffer which can
hold least numBytes bytes. The number of bytes read is passed back in count.
When count is greater than zero the status returned is always greater than or equal to stsOK.
stsTimeOutWithData Count is greater than zero but less than numBytes because of a timeout.
stsTimeOut Count is zero and the timeout has expired.
stsEndOfData Count is zero and at the end of data.
STREAM.H 8'
Messages
msgStreamWriteTimeOut
Writes to the stream with timeout.
Takes P_STREAM_READ_WRITE_TIMEOUT, returns STATUS. Category: descendant responsibility.
#define msgStreamWriteTimeOut MakeMsg(clsStream,4)
MCS$¢l$1f} typedef struct {
Argun'Jents streamElements
os MILLISECONDS timeOut; II In: milliseconds until timeout
STREAM_READ_WRITE_TIMEOUT, * P_STREAM_READ _WRITE_TIMEOUT;
Writes numBytes from pBuf into the stream.
stsOK All bytes were written.
stsTimeOut Timeout has expired before all data written.
msgStreamFlush
The stream flushes any buffered data.
Takes pNull, returns STATUS. Category: descendant responsibility.
#define msgStreamFlush MakeMsg(clsStream,S)
clsStream's default response is to return stsMessageIgnored. Most subclasses override clsStream's
response.
stsOK Buffers were successfully emptied.
stsFailed Buffers do not empty after some timeout period.
msgStreamSeek
Sets the stream's Current Byte Position.
Takes P_STREAM_SEEK, returns STATUS.
#define msgStreamSeek MakeMsg(clsStream,6)
Enum16 (STREAM_SEEK_MODE)
II Relative to beginning of file, end of file, or Current Byte Position
streamSeekBeginning = 0,
streamSeekEnd 1,
streamSeekCurrent = 2,
II Default setting
streamSeekDefaultMode streamSeekBeginning
};
typedef struct STREAM_SEEK
STREAM_SEEK_MODE modei II
S32 offset; II relative change from seek origin
U32 curPos; II Out: byte position after seek
U32 oldPosi II Out: byte position before seek
BOOLEAN eof; II Out: Is new pos at end of file?
STREAM_SEEK, * P_STREAM_SEEK;
clsStream's default response is to return stsMessageIgnored. Most subclasses override clsStream's
response.
82 PEN POINT API REFERENCE
Part 7 / File System
msgStreamBlockSize
Passes back the most efficient write block size for this stream.
Takes P_STREAM_BLO<:K_SIZE, returns STATUS. Category: descendant responsibility.
fdefine msgStreamBlockSize MakeMsg(clsStream,7)
typedef struct {
U32 blockSize; II out: preferred write block size
} STREAM_BLOCK_SIZE, * P_STREAM_BLOCK_SIZE;
clsStream's default response is to return a blockSize of 512. Most subclasses override clsStream's
response.
Functions
The P _UNKNOWN declarations for the following are assumed to be FILE*. Maintaining a clean
separation between ANSI and PenPoint header files prevents the use of the true type.
StdioStreamBind
Returns a stdio file pointer bound to a stream object.
Returns pointer to FILE.
ttmdlcm Prototype P UNKNOWN EXPORTED StdioStreamBind (
OBJECT obj);
StdioS treamUnbind
Frees the stdio file handle bound to a stream object.
Returns in t.
Function Prototype int EXPORTED StdioStreamUnbind (
P_UNKNOWN pFile);
StdioStreamToObject
Returns the stream object bound to a stdio file pointer.
Returns OBJECT.
FU!lH:.tion Prototype OBJECT EXPORTED StdioStreamToObject (
P UNKNOWN pFile);
UUID.H
This file contains the API for UUID routines. The functions described in this file are contained in
PENPOINT.LIB.
This file contains macros for creating and testing Nil and Invalid UUIDs, to compare two UUIDs for
equality, and to create a well known UUID and a function to create dynamic uuids.
UUID is an acronym for Universal Unique ID.
fifndef UUID INCLUDED
fdefine UUID INCLUDED
Include files
fifndef GO INCLUDED
finclude <go.h>
fendif
Macros
For setting and testing for a Nil UUID
fdefine MakeNilUUID(uuid) ((uuid) .machine = (uuid) .id = OL)
fdefine NilUUID(uuid) (((uuid) .machine == OL) && ((uuid) .id == OL))
Typedefs
typedef struct UUID {
U32 id; II Unique counting value
U32 machine; II Unique machine identifier
UUID, *P_UUID;
-- - - - - - - . -... -.--~~~~---
84 PENPOINT API REFERENCE
Part 7 / File System
Public Functions
MakeDynUUID
Creates a dynamic UUID.
Returns nothing.
void EXPORTED MakeDynUUID
P_UUID pUUID
);
VOL.H
dsVolume inherits from dsObject.
Provides volume support.
Information in this file is useful if you are writing an installable volume. Also see volgodir.h for
additional information.
#ifndef VOL INCLUDED
#define VOL-INCLUDED
Include file dependencies
#ifndef GO INCLUDED
#include <go.h>
#endif
#ifndef OS INCLUDED
#include <os.h>
#endif
#ifndef CLSMGR INCLUDED
#include <clsmgr.h>
#endif
#ifndef FS INCLUDED
#include <fs.h>
#endif
Types
typedef OBJECT VOLi
typedef P_FS_ATTR_SIZE *PP_FS_ATTR_SIZEi
typedef P_FS_ATTR_LABEL *PP_FS_ATTR_LABELi
typedef U32 FS_ATTR_VALUE, *P_FS_ATTR_VALUE, **PP_FS_ATTR_VALUEi
typedef U32 VOL_VNODE, *P_VOL_VNODEi
typedef struct DIR_ID_CACHE {
P MEM pBufi II Sorted array of vol dir ids
U32 usedi II Number used, of allocated space
U32 freei II Number free, of allocated space
DIR_ID_CACHEi
typedef struct VOL_CACHE {
VOL VNODE vnodeNotKnowni II Used to fake volRAM
P MEM pRooti II Cache dir elem for root vnode
DIR ID CACHE dirIdsi II Dir id cache
OS MILLISECONDS lastAccessi II Last access to cache layer
OS MILLISECONDS lastVolAccessi II Last access to volume
OS MILLISECONDS lastVolWrite; II Last write to volume
OS MILLISECONDS refreshRatei II Check with volume this often
II to see if volume has changed
II since last vol access
II maxU32 implies unchangeable
OS MILLISECONDS flushRatei II Flush cached dirty files
II after this much time has passed
II 0 implies flush immediately
II maxU32 implies no flushing
II Default is 2000 (2 secs)
U16 numDirsi II Total num of dirs in the cache
II Includes both open and closed
U16 numFilesi II Total num of files in the cache
II Includes both open and closed
U16 openDirsi II Num of dirs in the cache
II that are opened on the vol
U16 openFiles; II Num of files in the cache
II that are opened on the vol
U16 refdDirsi II Num of opened dirs that have
II non-zero reference counts
U16 refdFilesi II Num of opened files that have
II non-zero reference counts
U16 maxOpenDirs; II Max dirs that can be left open
II for caching purposes.
II 0 implies no dirs
II maxU16 implies as many as wanted
II Default is maxU16
U16 maxOpenFiles; II Max files that can be left open
II for caching purposes.
II 0 implies no files
II maxU16 implies as many as wanted
II Default is maxU16
P MEM pFirsti II First cache entry
P MEM pLasti II Last cache entry
P MEM pWritei II Write is to this cache entry
U32 writePosi II Write at this position
U32 writeAmti II Write for this amount
U8 readDirFullInProgressi
II If non-zero then fully cached
II dirs will not be "purged".
U8 spareU8;
U16 spareU16;
U32 spares[5];
VOL_CACHE;
VOL.H 87
Enum16 (VOL_CMN_FLAGS) {
vcVolIsOnBootDevice flagO, II This volume is on the boot
II device (as defined by the MIL)
II but isn't necessarily THE boot
II volume.
vcVolIsDetachable flag1, II This volume is not removable
II but may be detachable.
vcVolIsSwapVolume flag2 II This is the swap volume.
};
typedef struct VOL_COMMON
struct VOL_RTNS *pRtns;
OS_SEMA_ID fsSema;
OS SEMA ID volSema;
VOL CMN FLAGS flags;
U16 vnodeCount;
OS HEAP ID vnodeHeap;
U16 spare1;
U16 dhCount;
P MEM dhHead;
U16 spare2;
U16 fhCount;
P MEM fhHead;
VOL CACHE cache;
OBJECT dirIndexFile;
BOOLEAN dirIndexFileVerified;
U16 spare;
U32 spares [5];
VOL_COMMON;
typedef struct VOL INFO
struct VOL INFO *pNext;
FS VOL HEADER hdr;
VOL COMMON cmn;
II Volume specific volInfo struct goes here ...
VOL_INFO, *P_VOL_INFO, **PP_VOL_INFO;
Enum16 (VNODE_ACCESS) {
II Delete node at handle free time?
vnodeTemp flagO,
II Read/write intentions for this handle
vnodeReadOnly flag2,
II Upper byte: exclusivity requirements
vnodeNoExclusivity = MakeU16 (0, 0),
vnodeDenyWriters = MakeU16 (0, 1),
vnodeExclusiveOnly = MakeU16 (0, 2),
II Uncompress file at VNGet time?
vnodeUncompress flag14,
II Default
vnodeDefaultAccess o II perm, read/write, noExclusivity
};
#define vnodeIgnoreAccessInfo Ox8000
typedef struct VNODE_CMN_ATTRS {
FS_NODE_FLAGS nodeFlags;
FS DATE TIME nodeCreated;
FS DATE TIME nodeModified;
VNODE_CMN_ATTRS, *P_VNODE_CMN_ATTRS;
Enum16 (VNODE_ATTR_FLAGS) {
vnAttrNodeFlags flagO,
vnAttrNodeCreated flag1,
vnAttrNodeModified flag2,
vnAttrLabelsBuffer flag8,
vnAttrValuesBuffer flag9,
vnAttrSizesBuffer flag10
};
88 PENPOINT API REFERENCE
Part 7 / File System
VolStatus
Has a volume check for readiness.
Returns STATUS.
Function Prototype typedef STATUS FunctionPtr (P _VOL_STATUS)
P VOL INFO pVolInfo,
P-BOOLEAN pChanged II In/Out: Has volume changed?
);
#define VolStatus(pVolInfo, pChanged) \
((pVolInfo)->cmn.pRtns->pVolStatus) \
(pVollnfp, pChanged)
Possible return status are stsOK, stsFSVolDisconnected, other errors. If status is okay, should indicate if
volume has changed.
VolSetVolName
Has a volume change its volume name.
Returns STATUS.
Function ProTOType typedef STATUS FunctionPtr(P_VOL_SET_VOL_NAME)
P_VOL_INFO pVolInfo,
P_STRING pName II New volume name
);
#define VolSetVolName(pVo~Info, pName) \
((pVolInfo)->cmn.pRtns->pVolSetVolName) \
(pVolInfo, pName)
VolUpdateVollnfo
Requests that a volume updates its user accessable volume info.
Returns STATUS.
typedef STATUS FunctionPtr(P VOL UPDATE VOL INFO) (
P_VOL_INFO pVollnfo- -II Vol Info
);
#define VolUpdateVolInfo(pVolInfo) \
((pVolInfo)->cmn.pRtns->pVolUpdateVolInfo) \
(pVolInfo)
VolSpecificMsg
Passes a volume specific message down to a volume.
Returns STATUS.
Ftmdloft ProTotype typedef STATUS FunctionPtr (P_VOL_SPECIFIC_MSG)
P VOL INFO pVolInfo,
VOL_vNODE vnode, II Handle of vnode
MESSAGE msg, I I Message
P UNKNOWN pArgs II In/Out: Arguments for message
);
#define VolSpecificMsg(pVolInfo, vnode, msg, pArgs) \
((pVolInfo)->cmn.pRtns->pVolSpecificMsg) \
(pVolInfo, vnode, msg, pArgs)
VOL.H 89
VNGet
Gets a vnode given pVolInfo, dirVNode and name of node in the directory.
Returns STATUS.
typedef STATUS Functionptr(P_VNODE_GET) (
P VOL_INFO pVolInfo, II Vol Info
VOL VNODE dirVNode, II VNode of parent directory
P STRING pName, II Name of node in directory
VNODE ACCESS access, II R/w access, exclusivity, etc
P UNKNOWN pVolSpecific, II Vol specific info
P VOL VNODE pVNode II Out: Returned vnode handle
);
#define VNGet(pVolInfo, dirVNode, pName, access, pVolSpecific, pVNode) \
((pVolInfo)->cmn.pRtns->pVNodeGet) \
(pVolInfo, dirVNode, pName, access, pVolSpecific, pVNode)
VNNextChild
Gets a vnode given pVolInfo, dirVNode and dir position in a directory.
Returns STATUS.
typedef STATUS Functionptr(P_VNODE_NEXT_CHILD)
P_VOL INFO pVolInfo, II Vol Info
VOL VNODE dirVNode, II VNode of parent directory
P U32 pDirPos, II In/Out: directory position data
VNODE ACCESS access, II R/w access, exclusivity, etc
P STRING pName, I lOut: Name of node
P VOL VNODE pVNode II Out: VNode handle
);
#define VNNextChild(pVolInfo, dirVNode, pDirPos, access, pName, pVNode) \
((pVolInfo)->cmn.pRtns->pVNodeNextChild) \
(pVolInfo, dirVNode, pDirPos, access, pName, pVNode)
VNGetByDirld
Gets the vnode of a directory (and its name) given its directory id.
Returns STATUS.
VNDup
Increments the reference count on a vnode.
Returns STATUS.
Flmdl©!'1 Pw©t©tYP£t typedef STATUS FunctionPtr (P_VNODE_DUP) (
P_VOL_INFO pVolInfo, II Vol Info
VOL VNODE vnode, II The vnode being dupped
VNODE ACCESS access II R/W, exclusivity, etc.
);
#define VNDup(pVolInfo, vnode, acce~s) \
((pVolInfo)->crnn.pRtns->pVNodeDup) \
(pVolInfo, vnode, access)
VNRelease
Returns a vnode to the volume.
Returns STATUS.
FLtncl'Ion Proh')lyp£t typedef STATUS FunctionPtr (P _VNODE_RELEASE) (
P_VOL INFO pVolInfo, II Vol Info
VOL VNODE vnode II The vnode being released
);
#define VNRelease(pVolInfo, vnode) \
((pVolInfo)->crnn.pRtns->pVNodeRelease) \
(pVolInfo, vnode)
VNCreate
Creates a new file or directory node in the given (directory) node.
Returns STATUS.
typedef STATUS Functionptr(P_VNODE_CREATE)
P VOL INFO pVolInfo,
VOL VNODE dirVNode, II Handle of directory vnode
P STRING pName, II Name of the new file
FS NODE FLAGS type II File or directory?
);
#define VNCreate(pVolInfo, dirVNode, pName, type) \
((pVolInfo)->cmn.pRtns->pVNodeCreate) \
(pVolInfo, dirVNode, pName, type)
Note: the parameter type only uses the flag fsNodeDir to distinguish between directories and files and
the flag fsShortDirName to direct the volume to use a short name replacement for the directory name.
Directories are only shortened if they reside in the PenPoint tree. The flag fsShortDirName overlaps
fsNodeReadOnly, which is never used in conjunction with directories.
VOL.H 01
VNDelete
Deletes the given node.
Returns SfATUS.
typedef STATUS FunctionPtr(P_VNODE DELETE) (
P_VOL_INFO pVolInfo,
VOL VNODE vnode, II VNode to delete
BOOLEAN visible II At root of hierarchical delete?
);
#define VNDelete(pVolInfo, vnode, visible) \
((pVolInfo)->cmn.pRtns->pVNodeDelete) \
(pVolInfo, vnode, visible)
VNode may be returned differently to mark it as a vnode that points to a deleted vnode.
VNMove
Moves/renames a node (and any children) to a new node.
Returns SfATUS.
rundion ?rot<tl)';:tG typedef STATUS FunctionPtr (P _VNODE MOVE) (
P_VOL_INFO pVolInfo,
VOL VNODE srcDirVNode, II Handle of dir node of source
VOL VNODE srcVNode, II Handle of source vnode of move
VOL VNODE dstDirVNode, II Handle of dir node of dest
P STRING pDstName II New name to give the node
);
#define VNMove(pVolInfo, srcDirVNode, srcVNode, dstDirVNode, pDstName) \
((pVolInfo)->cmn.pRtns->pVNodeMove) \
(pVolInfo, srcDirVNode, srcVNode, dstDirVNode, pDstName)
VNDirPosDeleteAdjust
Makes any necessary adjustment to the dirPos after a node has been deleted.
Returns SfATUS.
fundi©n frototY?0 typedef STATUS FunctionPtr (P _VNODE DIR POS DEL ADJ) (
P_VOL INFO pVolInfo,
VOL VNODE dirVNode, I I Handle of directory vIlode
VOL VNODE vnode, II Handle of deleted vnode
P U32 pDirPos II Dir position data before delete
);
#define VNDirPosDeleteAdjust(pVolInfo, dirVNode, vnode, pDirPos) \
((pVolInfo)->cmn.pRtns->pVNodeDirPosDelAdj) \
(pVolInfo, dirVNode, vnode, pDirPos)
VNGetDirld
Gets a directory node's dir id, given the vnode.
Returns SfATUS.
tLmdiot1 ProlotypG typedef STATUS FunctionPtr (P_VNODE GET DIR ID) (
P VOL INFO pVolInfo,
VOL VNODE vnode, II Handle of vnode
P U32 pDirId II In/Out: dir id of dir node
);
#define VNGetDirId(pVolInfo, vnode, pDirId) \
((pVolInfo)->cmn.pRtns->pVNodeGetDirId) \
(pVolInfo, vnode, pDirId)
92 PEN POINT API REFERENCE
Part 7 I File System
VNRead
Transfers n bytes from position m in a file to a buffer.
Returns STATUS.
typedef STATUS Functionptr(P_VNODE_READ)
P_VOL_INFO pVolInfo,
VOL VNODE vnode, II Handle of vnode
U32 filePos, II Starting point of read
U32 numBytes, II Number of bytes to be read
P U8 pReadBuffer, II Destination of bytes read
P U32 pCount II In/Out: Actual bytes read
);
fdefine VNRead(pVolInfo, vnode, filePos, numBytes, pReadBuffer, pCount) \
((pVolInfo)->cmn.pRtns->pVNodeRead) \
(pVollnfo, vnode, filePos, numBytes, pReadBuffer, pCount)
VNWrite
Transfers n bytes from a buffer to position m in a file.
Returns STATUS.
rtlndlt>n Prototype typedef STATUS FunctionPtr (P_VNODE_WRITE)
P_VOL_INFO pVolInfo,
VOL VNODE vnode, II Handle of vnode
U32 filePos, II Starting point of the write
U32 numBytes, II Number of bytes to write
P U8 pWriteBuffer, II Destination of bytes to write
P U32 pCount II In/Out: Actual bytes written
);
fdefine VNWrite(pVolInfo, vnode, filePos, nUmBytes, pWriteBuffer, pCount) \
((pVolInfo)->cmn.pRtns->pVNodeWrite) \
(pVolInfo, vnode, filePos, numBytes, pWriteBuffer, pCount)
VNGetSize
Gets a node's size given the vnode.
Returns STATUS.
ruodit>t1 ProTotype typedef STATUS FunctionPtr (P_VNODE_GET SIZE) (
P_VOL_INFO pVolInfo,
VOL VNODE vnode, II Handle of vnode
P- FS- FILE- SIZE pFileSize II In/Out: Node's size
);
fdefine VNGetSize(pVolInfo, vnode, pFileSize) \
((pVolInfo)->cmn.pRtns->pVNodeGetSize) \
(pVolInfo, vnode, pFileSize)
VOL.H 93
VNSetSize
Sets a node's size given the vnode and the new size.
Returns STATUS.
typedef STATUS FunctionPtr(P_VNODE_SET SIZE) (
P_VOL_INFO pVolInfo,
VOL VNODE vnode, II Handle of vnode
FS FILE SIZE fileSize II Node's new size
);
#define VNSetSize(pVolInfo, vnode, fileSize) \
((pVolInfo)->cmn.pRtns->pVNodeSetSize) \
(pVolInfo, vnode, fileSize)
This function could be used to either truncate or grow the file/resFile.
VNGetName
Gets a node's name, given the vnode.
Returns STATUS.
;::lro+0+YI10 typedef STATUS FunctionPtr (P _ VNODE GET NAME) (
P VOL INFO pVolInfo,
VOL VNODE vnode, II Handle of vnode
P STRING pName II In/Out: name of node
);
#define VNGetName(pVolInfo, vnode, pName) \
((pVolInfo)->cmn.pRtns->pVNodeGetName) \
(pVolInfo, vnode, pName)
VNGetNumAttrs
Returns the number of non-standard attributes, given the vnode.
Returns STATUS.
Prototype typedef STATUS FunctionPtr (P _VNODE GET_NUM_ATTRS)
P_VOL INFO pVolInfo,
VOL VNODE vnode, II Handle of vnode
P U16 pNumAttrs II Out: num of attrs to get
);
#define VNGetNumAttrs(pVolInfo, vnode, pNumAttrs) \
((pVolInfo)->cmn.pRtns->pVNodeGetNumAttrs) \
(pVolInfo, vnode, pNumAttrs)
VNGetAttrlnfo
Returns a node's attributes, given the vnode.
Returns STATUS.
typedef STATUS FunctionPtr(P_VNODE_GET_ATTR_INFO) (
P VOL INFO pVolInfo,
VOL VNODE vnode, II Handle of vnode
U16 num, II Num of attrs to get
VNODE ATTR FLAGS flgs, II Get which attrs
P- VNODE CMN- ATTRS pCmn, II Common attrs
P U8 pWhich, II Which user defined attrs
P FS ATTR LABEL pLbls, II In/Out: attribute labels
94 PENPOINT API REFERENCE
Part 7 / File System
VNSetAttrInfo
Sets a node's attributes, given the vnode.
Returns SfATUS.
ttmd;@in pW(:$b3fYI~H3 typedef STATUS FunctionPtr (P_ VNODE_SET_ATTR_INFO) (
P_VOL_INFO pVolInfo,
VOL VNODE vnode, II Handle of vnode
U16 num, II Num of attrs to set
VNODE ATTR FLAGS fIgs, II Set which attrs
P- VNODE- CMN
- ATTRS pCmn, II Common attrs
P U8 pWhich, II Which user defined attrs
P- FS- ATTR- LABEL pLbls, II In/Out: attribute labels
P- FS - ATTR- VALUE pVals, II In/Out: attribute values
P- FS- ATTR- SIZE pSizs II In/Out: attribute sizes
) i
#define VNSetAttrInfo(pVoIInfo, vnode, num, fIgs, pCmn, pWhich, pLbls, pVals, pSizs) \
((pVoIInfo)->cron.pRtns->pVNodeSetAttrInfo) \
(pVoIInfo, vnode, num, fIgs, pCron, pWhich, pLbls, pVals, pSizs)
Which common attributes and which arrays of the label/value/size arrays that need to be stored are
defined by the flgs field. Which particular elements of each (label/value/size) array to be filled in is
defined by the pWhich byte array. If num is 0 or pWhich is null then no label/value/size array elements
should be stored. If an element of pWhich is maxU8 then the corresponding label/value/size array
element should be stored. If the data is stored successfully then the p Which array element should be set
to 1.
VNMakeNative
Gets rid of all concepts not native to a file system (ie reslinfo fields) and return the native form name of
the file after being" stripped".
Returns SfATUS.
ttJf1dh:Wl PW@f@fy!00 typedef STATUS Functionptr(P_VNODE_MAKE_NATIVE)
P_VOL_INFO pVolInfo,
VOL VNODE vnode, II Handle of vnode
P STRING pName II In/Out: Return buffer for native name
) i
#define VNMakeNative(pVoIInfo, vnode, pName) \
((pVoIInfo)->cron.pRtns->pVNodeMakeNative) \
(pVoIInfo, vnode, pName)
VOL.H 95
VNFlush
Flushes all buffers associated with this vnode.
Returns SfATUS.
Fundkm Prototype typedef STATUS FunctionPtr (P_VNODE_FLUSH)
P_VOL_INFO pVolInfo,
VOL VNODE vnode II Handle of vnode
) i
#define VNFlush(pVolInfo, vnode) \
((pVolInfo)->cmn.pRtns->pVNodeFlush) \
(pVolInfo, vnode)
DirldGetParent
Gets the dir id of the parent of a node (also identified by dir id).
Returns SfATUS.
FU0(;tkm Pmtotype typedef STATUS FunctionPtr(P_DIRID_GET_PARENT) (
P_VOL_INFO pVolInfo,
U32 node, II Node identified by dir id
P U32 pParent, II In/Out: dir id of parent
P BOOLEAN pParentIsRoot II In/Out: parent is root
);
#define DirIdGetParent(pVolInfo, node, pParent, pParentIsRoot) \
((pVolInfo)->cmn.pRtns->pDirIdGetParent) \
(pVolInfo, node, pParent, pParentIsRoot)
VNRefCount
Gets the volume's ref count for a vnode.
Returns SfATUS.
typedef STATUS FunctionPtr(P VNODE REF COUNT) (
P_VOL_INFO pVolIn fo, - - II Vol Info
VOL VNODE vnode, II The vnode to get info about
P U16 pRefCount II Out: Reference count on vnode
)i
#define VNRefCount(pVolInfo, vnode, pRefCount) \
((pVolInfo)->cmn.pRtns->pVNodeRefCount) \
(pVolInfo, vnode, pRefCount)
P VNODE_RELEASE pVNodeRelease;
II Directory Handle Related ...
P_VNODE_CREATE pVNodeCreate;
P_VNODE_DELETE pVNodeDelete;
P_VNODE_MOVE pVNodeMove;
P_VNODE_DIR_POS_DEL_ADJ pVNodeDirPosDelAdj;
P_VNODE_GET_DIR_ID pVNodeGetDirId;
II File Handle Related ...
P_VNODE_READ pVNodeRead;
P_VNODE_WRITE pVNodeWrite;
P_VNODE_GET_SIZE pVNodeGetSize;
P_VNODE_SET SIZE pVNodeSetSize;
I I Attributes ...
P- VNODE- GET
-NAME pVNodeGetName;
P- VNODE- GET- NUM- ATTRS pVNodeGetNumAttrs;
P- VNODE- GET- ATTR- INFO pVNodeGetAttrInfo;
P- VNODE- SET- ATTR- INFO pVNodeSetAttrInfo;
P- VNODE MAKE- NATIVE pVNodeMakeNative;
II Misc ...
P- VNODE- FLUSH pVNodeFlush;
P- DIRID- GET
- PARENT pDirIdGetParent;
I I Debugging ...
P- VNODE- REF
-COUNT pVNodeRefCount;
I I Spares ...
P UNKNOWN pSparel;
P UNKNOWN pSpare2;
P UNKNOWN pSpare3;
VOL_RTNS, *P_VOL_RTNS;
msgFSRegisterVolClass
Registers a volume class with the file system.
Takes P_FS_REGISTER_VOL_CLASS, returns SfATUS.
#define msgFSRegisterVolClass MakeMsg(clsFileSystem, 0)
typedef struct FS_REGISTER_VOL_CLASS
CLASS volClass; II Vol class of volume
FS VOL TYPE volType; II Type of volume
FS_REGISTER_VOL_CLASS, *P_FS_REGISTER_VOL_CLASS;
msgFSlnstal,lVol
Creates a volume's root dir handle and register it with the file system.
Takes P _FS_INSTALL_VOL, returns STATUS.
typedef struct FS_INSTALL_VOL {
OBJ_KEY key; II Volume's key.
CLASS volClass; II Class of the volume.
VOL VNODE vnode; II Root directory vnode.
P VOL INFO pVolInfo; II In/Out: Volume info block.
FS_INSTALL_VOL, *P_FS_INSTALL_VOL;
The volume should mark itself as connected and all observers of theFileSystem will be notified that a
volume has been installed. (Note: The message is defined in fs.h so observers can use it.)
#define msgFSlnstalN01 MakeMsg(clsFileSystem, 1)
VOL.H 97
Class FileSystem Messages
msgFSRemoveVol
:e
Removes a volume from the file system and destroy its root dir handle.
l
Takes P _FS_REMOVE_VOL, returns STATUS.
typedef struct FS_REMOVE_VOL {
OBJ_KEY keYi II Volume's key.
CLASS volClassi II Class of the volume.
P VOL INFO pVolInfoi II Volume info block.
FS_REMOVE_VOL, *P_FS_REMOVE_VOLi
Observers of theFileSystem will be notified of the change. (Note: The message is defined in fs.h so
observers can use it.)
#define msgFSRemoveVol MakeMsg( c1sFileSystem, 2)
msgFSConnectVol
Marks a volume as connected and notify observers of theFileSystem.
Takes P _FS_CONNECT_VOL, returns STATUS.
typedef struct FS_CONNECT_VOL {
P_VOL_INFO pVolInfoi II Volume info block.
} FS_CONNECT_VOL, *P_FS_CONNECT_VOLi
Comments (Note: The message is defined in fs.h so observers can use it.)
#define msgFSConnectVol MakeMsg(c1sFileSystem, 3)
msgFSDisconnectVol
Marks a volume as disconnected and notify observers of theFileSystem.
Takes P _FS_DISCONNECT_VOL, returns STATUS.
typedef struct FS DISCONNECT VOL {
P_VOL_INFO - pvollnfoi II Volume info block.
} FS_DISCONNECT_VOL, *P_FS_DISCONNECT_VOLi
(Note: The message is defined in fs.h so observers can use it.)
#define msgFSDisconnectVol MakeMsg(clsFileSystem, 4)
msgFSVolList
Returns device list for given class and count of volumes of that class.
Takes P_FS_VOL_LIST, returns STATUS.
#define msgFSVolList MakeMsg(clsFileSystem, 5)
msgFSUnRegisterVolClass
UnRegisters a volume class from the file system.
Takes P _CLASS, returns STATUS.
fdefirie msgFSUnRegisterVolClass MakeMsg(clsFileSystem, 6)
msgFSVolIsBusy
Checks to see if a volume can be removed.
Takes P _FS_VOL_INFO, returns STATUS:
fdefine msgFSVolIsBusy MakeMsg(clsFileSystem, 7)
If no user files/dirs are open and all caches have been written to the volume then the volume may be
removed. This method should only be called by the volume t~ be removed.
If the volume can be removed then stsOK is returned. If the volume can not be removed then
stsFSVoIBusy is returned.
msgFSExclVolAccess
Allows a volume class to obtain exclusive access to a volume and to release the exclusive access.
msgVolEjectMedia
Has the volume eject its media.
Takes void, returns STATUS.
fdefine msgVolEjectMedia MakeMsg(clsVolume, 10)
Passed as a volume specific msg by the file system.
msgVollnvalidateCaches
Allows volumes to invalidate cache buffers at warm boot time.
Takes void, returns STATUS.
fdefine msgVollnvalidateCaches MakeMsg(clsVolume, 11)
Passed as a volume specific msg by the file system at power up time.
msgVolUpdateBootCode
Reads image of boot sector from mil.res and stores onto boot sector.
Takes void, returns STATUS.
fdefine msgVolUpdateBootCode MakeMsg(clsVolume, 12)
Passed as a volume specific msg by the installation utility.
msgVolFormatVolumelnit
This msg is sent to a volume to initiate a reformat of the volume.
Takes P_VOL_FORMAT_MEDIA_IN IT , returns SfATUS.
fdefine msgVolFormatVolumelnit MakeMsg(clsVolume, 20)
This initiates the format from the current owner of the block device. The volume object is destroyed
(although there is a possibility that the destroy will fail) and then the block device of that volume, the
volume offset on the block device and the volume size are returned. Call the volume class that is to
format the volume with the message msgVolFormatMediaInit passing it this information. It will return
a format id.
100 PENPOINT API REFERENCE
Part 7 / File System
Note that all other format related messages are sent to the class of the volume, because the volume will
no longer exist.
msgVolFormatMedialnit
Takes a block device object and returns a format id to be used with the other format messages.
Takes P_VOL_FORMAT_MEDIA_INIT, returns STATUS.
*define msgVolFormatMediaInit MakeMsg(clsVolume, 21)
typedef struct VOL_FORMAT_MEDIA_INIT {
OBJECT blockDevice; II A block device
U32 volumeOffset; II Format device beginning here
U32 volumeSize; II Amount of device to be formatted
P UNKNOWN formatId; II Out: Format id
VOL_FORMAT_MEDIA_INIT, *P_VOL_FORMAT_MEDIA_INIT;
NOTE: volumeOffset should be zero and volumeSize should be zero if you wish to format the entire
device (vs a partition of the device).
msgVolMediaCapacities
Returns the possible format capacities for the device requesting format.
Takes P_VOL_MEDIA_CAPACITIES, returns STATUS.
*define msgVolMediaCapacities MakeMsg(clsVolume, 22)
typedef struct VOL_MEDIA_CAPACITIES
P_UNKNOWN formatId; II Format id from format/reformat.
U16 maxCapacities; II Size of output capacities array.
U16 numCapacities; II Out: Actual number of capacities.
P U32 pCapacities; II In/Out: Capacities.
VOL_MEDIA_CAPACITIES, *P_VOL_MEDIA_CAPACITIES;
This messages is sent to the class of the volume.
msgVolFormatMediaSetup
Has the vol class set the media to be ready for a format and determines if the block device will require
format media (vs format track).
Takes P _VOL_FORMAT_MEDIA, returns STATUS.
*define msgVolFormatMediaSetup MakeMsg(clsVolume, 23)
typedef struct VOL_FORMAT_MEDIA
P_UNKNOWN formatId; II Format id from format/reformat.
U32 capacity; II Desired capacity to format for.
P STRING pName; II Name of re/formatted volume.
U16 percentDone; II Out: Progress report.
VOL_FORMAT_MEDIA, *P_VOL_FORMAT_MEDIA;
This messages is sent to the class of the volume.
msgVolFormatMediaBegin
Has the vol class begin the format of its media.
Takes P_VOL_FORMAT_MEDIA, returns STATUS.
*define msgVolFormatMediaBegin MakeMsg(clsVolume, 24)
VOL.H 101
Class Volume Messages Duplicating
msgVolFormatMediaCont
Has the vol class do a format of its media.
msgVolCancelFormat
Has the vol class cancel the format.
Takes P _UNKNOWN, returns STATUS.
#define msgVolCancelFormat MakeMsg(clsVolume, 26)
Comments This messages is sent to the class of the volume.
msgVolDuplicateMedia
Has the volume class duplicate more of the disk.
Takes P _VOL_DUPLICATE_MEDIA, returns STATUS.
#define msgVolDuplicateMedia MakeMsg(clsVolume, 31)
102 PENPOINT API REFERENCE
Part 7 / File System
msgVolDuplicateReady
Checks to see if the source/dest disk of the duplicate is ready.
Takes P _VOL_DUPLICATE_MEDIA, returns STATUS.
#define msgVolDuplicateReady MakeMsg(clsVolume, 32)
tv1eSSt1tj%t typedef struct VOL_DUPLICATE_MEDIA
IU9,-",m%trtts P_UNKNOWN duplicateIdi II Duplicate id from duplicate.
BOOLEAN sourceDisk; II Is this source or destination?
U16 percentDonei II Out: Progress report.
VOL_DUPLICATE_MEDIA, *P_VOL_DUPLICATE_MEDIAi
The return percentDone is unused.
msgVolCancelDuplication
Have the vol class cancel the duplication.
Takes P_UNKNOWN, returns STATUS.
#define msgVolCancelDuplication MakeMsg(clsVolume, 33)
YOLGODIR.H
This file contains declarations for the common part of godir volumes. Examples of these include
clsVolDisk and clsVolTOPS.
Information in this file is useful if you are trying to understand the format of PenPoint.dir files or if you
are writing an installable volume.
#ifndef VOLGODIR_INCLUDED
#define VOLGODIR_INCLUDED
Include file dependencies for this include file
#ifndef GO_INCLUDED
#include <go.h>
#endif
#ifndef OS_INCLUDED
#include <os.h>
#endif
#ifndef CLSMGR_INCLUDED
#include <clsmgr.h>
#endif
#ifndef FS_INCLUDED
#include <fs.h>
#endif
#ifndef VOL_INCLUDED
#include <vol.h>
#endif
Types
General types
Enumerated constants for searching for particular directory entries
Enum16 (GO_DIR_FINDTYPE)
gdF indEmpt y = 0,
gdFindNextName = 1,
gdFindNativeName = 2,
gdFindGoDirName =3
};
104 PENPOINT API REFERENCE
I File System
Part 7
Note that this can also be treated as an array of U32, using the tag part of the associated fsAttr as the
index into the array, except flags and unused together form a special case of a U32!!!
typedef struct VOLGODIR_CMN_ATTRS
FS_NODE_FLAGS flags;
U16 unused; II Was sequence
FS DATE TIME dateCreated;
FS DATE TIME dateModified;
FS FILE SIZE fileSize;
VOLGODIR_CMN_ATTRS, *P_VOLGODIR_CMN_ATTRS;
GO directory related types
Each directory entry is identified as either erased (e) or full (f).
Enum16(GO_DI~ENTRY_TYPES) {
goDirUnusedEntry 'e' ,
goDirNodeEntry = 'f'
};
typedef struct GO_DIR_USER_ATTR
FS_ATTR_LABEL label; II file system attribute label.
U16 size; II size of value field.
U8 value; II a U32, string or var length attr.
GO_DIR_USER_ATTR, *P_GO_DIR_USER_ATTR;
typedef struct GO_DIR_ENTRY_HEADER {
U8 type; II 'e': erased or 'f' for file/dir.
U16 size; II Actual size on disk is modulo 32.
GO_DIR_ENTRY_HEADER, *P_GO_DIR_ENTRY_HEADER;
Go name is located at goDirEntry.buf, always the first entry. The define goNameIndex can be used to
index to the name. It is important that the size of GO_DIR_ENTRY is modulo 32.
typedef struct GO_DIR_ENTRY {
GO_DIR_ENTRY_HEADER hdr;
U16 numUserAttrs; II Number of user attributes.
U8 nativeNameIndex;11 Offset to native file name.
U8 rsrvdForLater; II UNUSED SPARE.
U8 userAttrsIndex; II Offset to first user attr.
FS NODE FLAGS flags;
U16 rsrvdForLater2; II WAS SEQUENCE
FS DATE TIME dateCreated;
U8 buf [goDirHeaderBufSize]; II Min space for names.
GO_DIR_ENTRY, *P_GO_DIR_ENTRY, **PP_GO_DIR_ENTRY;
VNode types
VNode related type declarations
Enum16 (VOLGODIR_VNODE_FLAGS) {
gdfPenPointDir = flag1, II This is a PenPoint.Dir file
gdfRootDir flag2,
gdfNodeCorrupt flag3,
gdfNodeModified flag4,
gdfHasGoDirParent flagS,
gdfHasGoDirSister = flag6,
gdfNoGoDirSister = flag7
};
typedef struct VOLGODIR_VNODE_COMMON
U16 refCount;
U16 numUserAttrs;
U32 goDirPos;
VOLGODIR- VNODE- FLAGS flags;
VOLGODIR CMN ATTRS attrs;
VOLGODIR_VNODE_COMMON;
YOLGODIR.H 105
Common #defines and typedefs
LVStatus
Has a volume check for readiness.
Returns SfATUS.
ifundlon PV1:tY1:t1ype typedef STATUS FunctionPtr (P _ LVOL STATUS) (
P_VOLGODIR_INFO pVolInfo,
P BOOLEAN pChanged II In/Out: Has volume changed?
);
*define LVStatus(pVolInfo, pChanged) \
((pVolInfo)->pRtns->pLVolStatus) \
(pVolInfo, pChanged)
Possible return status are stsOK, stsFSVolDisconnected, other errors. If status is okay, should indicate if
volume has changed.
106 PEN POINT API REFERENCE
Part 7 / File System
LVSetVolName
Requests for a volume to set/change its volume name.
Returns STATUS.
ttmd\{}tl Pr{}j'{}type typedef STATUS FunctionPtr (P_LVOL SET VOL NAME) (
P_VOLGODIR_INFO pVolInfo, 1/ Vol Info
P STRING pName II Vol name
);
fdefine LVSetVolName(pVolInfo, pName) \
((pVolInfo)->pRtns->pLVolSetVolName) \
(pVolInfo, pName)
LVUpdatelnfo
Requests for a volume to update its user access able volume info.
Returns STATUS.
FUf'I(:ti{}!) Pr©t©+ype typedef STATUS FunctionPtr (P _ LVOL_UPDATE INFO)
P_VOLGODIR_INFO pVolInfo II Vol Info
);
fdefine LVUpdateInfo(pVolInfo) \
((pVolInfo)->pRtns->pLVolUpdateInfo) \
(pVolInfo)
LVSpecificMsg
Passes a volume specific message down to a volume.
Returns STATUS.
Fundi!;}!) Prowof)'pe typedef STATUS FunctionPtr (P_ LVOL_SPECIFIC_MSG)
P_VOLGODIR_INFO pVolInfo,
P_VOLGODIR_VNODE pVNode, II Handle of vnode
MESSAGE msg, II Message
P UNKNOWN pArgs II In/Out: Arguments for message
);
fdefine LVSpecificMsg(pVollnfo, pVNode, msg, pArgs) \
((pVolInfo)->pRtns->pLVolSpecificMsg) \
(pVolInfo, pVNode, msg, pArgs)
LVNGet
Gets a vnode given pVolInfo, dirVNode and name of node in the directory.
Returns STATUS.
tum:tl{}!1 Pn:'tj'!;}type typedef STATUS FunctionPtr (P_LVNODE_GET) (
P_VOLGODIR_INFO pVolInfo, II Vol Info
P VOLGODIR VNODE pDirVNode, II VNode of parent directory
P STRING pFileName, II Name of file node
P UNKNOWN pVolSpecific, II Vol specific info
PP_VOLGODIR_VNODE ppVNode II Out: Returned vnode handle
);
fdefine LVNGet(pVolInfo, pDirVNode, pFileName, pVolSpecific, ppVNode) \
((pVolInfo)->pRtns->pLVNodeGet) \
(pVolInfo, pDirVNode, pFileName, pVolSpecific, ppVNode)
VOLGODIR.H 107
Common #defines and typedefs
LVNGetAndOpenParent
Gets a vnode's parent given pVolInfo and a vnode and open it.
Returns STATUS.
LVNGetAndOpenByDirld
Gets a dir vnode given pVolInfo and the directory's dirIO.
Returns STATUS.
LVNRelease
Releases a vnode.
Returns STATUS.
ttHidicm i'r©t©type typedef STATUS FunctionPtr (P _LVNODE_RELEASE)
P_VOLGODIR_INFO pVolInfo, II Vol Info
P_VOLGODIR_VNODE pVNode II VNode to release
);
fdefine LVNRelease(pVolInfo, pVNode) \
((pVolInfo)->pRtns->pLVNodeRelease) \
(pVolInfo, pVNode)
LVNOpen
Opens a vnode.
Returns STATUS.
typedef STATUS FunctionPtr(P LVNODE OPEN) (
P_VOLGODIR_INFO pVollnfo, - II Vol Info
P_VOLGODIR VNODE pVNode, II VNode to open
P STRING pName, II Name of node
VNODE ACCESS access II R/W, exclusivity, etc.
);
fdefine LVNOpen(pVolInfo, pVNode, pName, access) \
((pVolInfo)->pRtns->pLVNodeOpen) \
(pVolInfo, pVNode, pName, access)
108 PENPOINT API REFERENCE
Part 7 / File System
LVNClose
Closes a vnode.
Returns STATUS.
Function Prototype typedef STATUS FunctionPtr (P _ LVNODE_CLOSE)
P VOLGODIR INFO pVolInfo, II Vol Info
P=VOLGODIR=VNODE pVNode II VNode to close
);
tdefine LVNClose(pVolInfo, pVNode) \
((pVolInfo)->pRtns->pLVNodeClose) \
(pVolInfo, pVNode)
LVNCreate
Creates a file or directory within the directory given.
Returns STATUS.
Function PrQl'otype typedef STATUS FunctionPtr (P _ LVNODE_CREATE)
P VOLGODIR INFO pVolInfo, II Vol Info
P=VOLGODIR=VNODE pDirVNode, II Directory where new node belongs
P STRING pName, I I Name of new file/dir
FS NODE FLAGS fileType II Create a dir or a file
);
tdefine LVNCreate(pVolInfo, pDirVNode, pName, fileType) \
((pVolInfo)->pRtns->pLVNodeCreate) \
(pVolInfo, pDirVNode, pName, fileType)
LVNDelete
Deletes a file system node; either a dir or a file node.
Returns STATUS.
Function Prototype typedef STATUS FunctionPtr (P_ LVNODE DELETE) (
P_VOLGODIR_INFO pVolInfo, II Vol Info
P_VOLGODIR_VNODE pVNode, II VNode to release
BOOLEAN visible II At root of hierarchical delete?
);
tdefine LVNDelete(pVolInfo, pVNode, visible) \
((pVolInfo)->pRtns->pLVNodeDelete) \
(pVolInfo, pVNode, visible)
LVNMove
Moves a file or directory to a directory wi the new (old) name.
Returns STATUS.
FUl'u:tiQn Prototype typedef STATUS FunctionPtr(P_LVNODE MOVE) (
P- VOLGODIR- INFO pVolInfo, II Vol Info
P VOLGODIR VNODE
- - pSrcDirVNode, II Dir of source node
P- VOLGODIR- VNODE pSrcVNode, II Source node
P- VOLGODIR- VNODE pDstDirVNode, II Dir of dest
P STRING pDstName II Name to give the dest node
);
tdefine LVNMove(pVolInfo, pSrcDirVNode, pSrcVNode, pDstDirVNode, pDstName) \
((pVolInfo)->pRtns->pLVNodeMove) \
(pVolInfo, pSrcDirVNode, pSrcVNode, pDstDirVNode, pDstName)
VOLGODIR.H 109
Common #defines and typedefs
LVNReadDir
Returns the next entry from the specified directory.
Returns STATUS.
runcticw, {?yt)h?type typedef STATUS FunctionPtr (P _ LVNODE READ DIR) (
P VOLGODIR INFO pVolInfo, II Vol Info
P_VOLGODIR_VNODE pDirVNode, II Directory to read from
P U32 pDirPos, II In/Out: Current position
P STRING pName II Out: Name of the node
);
*define LVNReadDir(pVolInfo, pDirVNode, pDirPos, pName) \
((pVolInfo)->pRtns->pLVNodeReadDir) \
(pVolInfo, pDirVNode, pDirPos, pName)
LVNDirPosDeleteAdjust
Makes any necessary adjustment to the dirPos after a node has been deleted.
Returns STATUS.
?,md;on Pn>?4lt}/pe typedef STATUS FunctionPtr (P _ LVNODE _DIR_POS _DEL ADJUST) (
P_VOLGODIR INFO pVolInfo,
P_VOLGODIR_VNODE dirVNode, II Handle of directory vnode
P VOLGODIR VNODE vnode, II Handle of deleted vnode
P U32 pDirPos II In/Out: Dir pos data before delete
);
*define LVNDirPosDeleteAdjust(pVolInfo, dirVNode, vnode, pDirPos) \
((pVolInfo)->pRtns->pLVNodeDirPosDelAdjust) \
(pVolInfo, dirVNode, vnode, pDirPos)
LVNGetDirld
Returns a well known constant dir id that represents this directory.
Returns STATUS.
FUindkm Prototype typedef STATUS FunctionPtr (P_ LVNODE GET DIR_ ID) (
P VOLGODIR_INFO pVolInfo, II Vol Info
P VOLGODIR VNODE pVNode, II Return dir id of this dir vnode
P U32 pDirId II In/Out: The directory's id
);
*define LVNGetDirId(pVolInfo, pVNode, pDirId) \
((pVolInfo)->pRtns->pLVNodeGetDirId) \
(pVolInfo, pVNode, pDirId)
LVNName
Returns the name a file system node.
Returns STATUS.
Function Pt'©tOtyP0 typedef STATUS FunctionPtr (P _ LVNODE_NAME) (
P VOLGODIR INFO pVolInfo, II Vol Info
P_VOLGODIR_VNODE pVNode, II VNode to get name of
P STRING pName II In/Out: Name
);
*define LVNName(pVolInfo, pVNode, pName) \
((pVolInfo)->pRtns->pLVNodeName) \
(pVolInfo, pVNode, pName)
110 PENPOINT API REFERENCE
Part 7 I File System
LVNGetNumAttrs
Returns the number of non-standard attributes, given the vnode.
Returns STATUS.
ftmdl©n Pr©r©type typedef STATUS FunctionPtr (P_LVNODE GET_NUM_ATTRS) (
P_VOLGODIR_INFO pVolInfo, II Vol Info
P_VOLGODIR_VNODE pVNode, II VNode of node to read from
P U16 pNumAttrs II Out: num of attrs to get
);
fdefine LVNGetNumAttrs(pVolInfo, p~ode, pNumAttrs) \
((pVolInfo)->pRtns->pLVNodeGetNumAttrs) \
(pVolInfo, pVNode, pNumAttrs)
LVNGetAttrInfo
Gets a node's attributes, given the vnode.
Returns STATUS.
fundi©n ?r©rC$ryp0~ typedef STATUS FunctionPtr (P _ LVNODE GET ATTR INFO) (
P_VOLGODIR INFO pVolInfo, II Vol Info
P_VOLGODIR_VNODE pVNode, II VNode of node to read from
U16 num, II Num of attrs to get
VNODE ATTR FLAGS fIgs, II Get which common attrs
P_VNODE_CMN_ATTRS pCmn, II Common attrs
P U8 pWhich, II Which user defined attrs
P_FS_ATTR_LABEL pLbls, II In/Out: attribute labels
P_FS_ATTR_VALUE pVals, II In/Out: attribute values
P_FS_ATTR_SIZE pSizs II In/Out: attribute sizes
);
fdefine LVNGetAttrInfo(pVolInfo, pVNode, num, fIgs, pCmn, pWhich, pLbls, pVals, pSizs) \
((pVolInfo)->pRtns->pLVNodeGetAttrInfo) \
(pVolInfo, pVNode, num, fIgs, pCmn, pWhich, pLbls, pVals, pSizs)
Which common attributes and which arrays of the label/value/size arrays that need to be filled in are
defined by the fIgs field. Which particular elements of each (label/value/size) array to be filled in is
defined by the pWhich byte array. If num is 0 or pWhich is null then no label/value/size array elements
should be filled in. If an element of pWhich is maxU8 then the corresponding label/value/size array
element should be filled in. If the data is known and set then the pWhich array element should be set to
1 after setting the values.
LVNSetAttrlnfo
Sets a node's attributes, given the vnode.
Returns STATUS.
typedef STATUS FunctionPtr(P_LVNODE SET ATTR_INFO) (
P- VOLGODIR- INFO pVolInfo, II Vol Info
P- VOLGODIR- VNODE pVNode, II VNode of node to read from
U16 num, II Num of attrs to set
VNODE ATTR FLAGS fIgs, II Set which common attrs
PVNODE
- CMN
-- ATTRS pCmn, II Common attrs
P U8 pWhich, II Which user defined attrs
P- FS- ATTR- LABEL pLbls, II In/Out: attribute labels
P- FS- ATTR- VALUE pVals, II In/Out: attribute values
P- FS- ATTR- SIZE pSizs II In/Out: attribute sizes
);
fdefine LVNSetAttrInfo(pVolInfo, pVNode, num, fIgs, pCmn, pWhich, pLbls, pVals, pSizs) \
((pVolInfo)->pRtns->pLVNodeSetAttrInfo) \
(pVolInfo, pVNode, num, fIgs, pCmn, pWhich, pLbls, pVals, pSizs)
VOLGODIR.H 111
Common #defines and typedefs
Comments Which common attributes and which arrays of the label/value/size arrays that need to be stored are
defined by the flgs field. Which particular elements of each (label/value/size) array to be filled in is
defined by the pWhich byte array. If num is 0 or pWhich is null then no label/value/size array elements
should be stored. If an element of pWhich is maxU8 then the corresponding label/value/size array
element should be stored. If the data is stored successfully then the pWhich array element should be
set to 1.
LVNRead
Transfers n bytes from position m in a file to a buffer.
Returns STATUS.
typedef STATUS FunctionPtr(P LVNODE READ) (
P VOLGODIR INFO pVollnfo, - II Vol Info
P=VOLGODIR=VNODE pVNode, II VNode of node to read from
U32 filePos, II Starting point of read
U32 nUmBytes, II Number of bytes to be read
P U8 pReadBuffer, II Destination of bytes read
P U32 pCount II Out: Actual number of bytes read
);
#define LVNRead(pVolInfo, pVNode, filePos, nUmBytes, pReadBuffer, pCount) \
«pVolInfo)->pRtns->pLVNodeRead) \
(pVolInfo, pVNode, filePos, numBytes, pReadBuffer, pCount)
LVNWrite
Transfers n bytes from a buffer to position m in a file.
Returns STATUS.
fund!cJI1 ~rott}type typedef STATUS FunctionPtr (P _LVNODE_WRITE)
P VOLGODIR INFO pVolInfo, II Vol Info
P=VOLGODIR=VNODE pVNode, II VNode of node to write to
U32 filePos, II Starting point of the write
U32 numBytes, II Number of bytes to write
P U8 pWriteBuffer, II Destination of bytes to write
P U32 pCount II Out: Actual number of bytes written
);
#define LVNWrite(pVolInfo, pVNode, filePos, numBytes, pWriteBuffer, pCount) \
«pVolInfo)->pRtns->pLVNodeWrite) \
(pVolInfo, pVNode, filePos, numBytes, pWriteBuffer, pCount)
LVNGetSize
Returns the size of a file.
Returns STATUS.
fum:tiof1 ~rototype typedef STATUS FunctionPtr (P LVNODE GET SIZE) (
P VOLGODIR INFO pVollnfo, - -II Vol Info
P=VOLGODIR=VNODE pVNode, II VNode of node to change size of
P_FS_FILE_SIZE pSize II The size of the file
);
#define LVNGetSize(pVolInfo, pVNode, pSize) \
«pVolInfo)->pRtns->pLVNodeGetSize) \
(pVolInfo, pVNode, pSize)
.~-----.--.-----.--.----.--"
112 PENPOINT API REFERENCE
Part 7 / File System
LVNSetSize
Adjusts the size of a file.
Returns STATUS.
YtHfcti<ln Prototype typedef STATUS FunctionPtr(P_LVNODE_SET_SIZE) (
P VOLGODIR INFO pVolInfo, II Vol Info
P=VOLGODIR=VNODE pVNode, II VNode of node to change size of
FS FILE SIZEnewSize II The new size
);
#define LVNSetSize(pVolInfo, pVNode, newSize) \
((pVolInfo)->pRtns->pLVNodeSetSize) \
(pVolInfo, pVNode, newSize)
LVNFlush
Flushes a file.
Returns STATUS.
Fum:tknl PV<ltorype typedef STATUS FunctionPtr (P_LVNODE_FLUSH) (
P_VOLGODIR_INFO pVolInfo, II Vol Info
P_VOLGODI~VNODE pVNode II VNode of node to flush
);
#define LVNFlush(pVolInfo, pVNode) \
((pVolInfo)->pRtns->pLVNodeFlush) \
(pVolInfo, pVNode)
LVNativeName
Returns the native file system form of this name.
Returns BOOLEAN.
YVlnt:rion Prt-'iforype typedef BOOLEAN FunctionPtr (P _LV_NATIVE NAME) (
P_VOLGODIR_INFO pVolInfo, II Vol Info
P STRING pName II In/Out: Name
);
#define LVNativeName(pVolInfo, pName) \
((pVolInfo)->pRtns->pLVNativeName) \
(pVolInfo, pNarne)
A return of true implies that the name was not changed (was native), and a return of false implies that
the name was changed to be native.
LDirIdGetParent
Gets the dir id of the parent of a node (also identified by dir id).
Returns STATUS.
FVl!1ctiOtl PrOrf)typt,~ typedef STATUS FunctionPtr (P _ LDIRID GET PARENT) (
P_VOLGODIR_INFO pVolInfo, II Vol Info
U32 node, II Node identified by dir id
P U32 pParent, II In/Out: dir id of parent
P BOOLEAN pParentIsRoot II In/Out: parent is root
);
#define LDirIdGetParent(pVolInfo, node, pParent, pParentIsRoot) \
((pVolInfo)->pRtns->pLDirIdGetParent) \
(pVolInfo, node, pParent, pParentIsRoot)
VOLGODIR.H 113
Common #defines and typedefs
Types
Resource string numbers
Enum16 (VS_STRING_IDS) {
vsFindVolumeStrsBase 0,
vsFindGenVolumeStr 0,
vSFindDiskVolumeStr 1,
vsFindRemoteVolumeStr 2,
vsWriteProtectedVolumeStr 3,
vsCancelButtonStr 4,
vsContinueButtonStr 5,
vsPercentDoneStr 6',
vsFmtNoticeStr 7,
vsFmtChooseSizeStr 8,
vsFmtWarningStr 9,
vsFmtAskForNameStr 10,
vsFmtBlankNameErrStr 11,
vsFmtBadCharErrStr 12,
vsFmtInProgressStr 13,
vsDupInProgressStr 14,
vsDupInsertSrcDiskStr 15,
vsDupInsertDstDiskStr 16,
vsDupWriteProtectedStr 17,
vsDupReadingStr 18,
vsDupWritingStr 19,
vsFormattingMediaStr 20,
};
Messages
msgVSFormatVolume
Reformats an existing volume.
Takes P_VS_FORMAT_VOLUME, returns STATUS.
typedef struct VOL_FORMAT_VOLUME {
OBJECT volumeRootDir; II Root dir of volume to format
CHAR pVolumeName[nameBufLength]; II Suggested or actual name
U16 reserved: 13, II Reserved
noWarning:1, II Do not warn about dangers
maxSize:1, II Format to maximum possible size
withName:1; II Name forced to be pVolumeName
U32 reserved1;
U32 reserved2;
VOL_FORMAT_VOLUME, * P_VOL_FORMAT_VOLUME;
*define msgVSFormatVolume MakeMsg(clsVolSearch, 5)
The volumeRootDir must be the actual root of the volume to be formatted and there cannot be any
other handles open on the volume or an error will be returned. pVolumeName will be the initial name
when the user is asked to provide a name or will be the name if the user is not asked to provide a name
(controlled by the withName flag). The warning message can be controlled with the noWarning flag.
And the choose a size interaction can be controlled with the maxSize flag.
stsRequestNotSupported The volume does not support formatting.
V5EARCH.H 117
Messages
msgVSDuplicateVolume
Copy an existing volume from one floppy disk to another floppy disk.
Takes dir/file handle of a volume, returns STATUS.
#define msgVSDuplicateVolume MakeMsg(clsVolSearch, 6)
stsRequestNotSupported The volume does not support duplicating.
msgVSFormatMedia
Formats unformatted media that does belong to any volume.
Takes block device object, returns STATUS.
#define msgVSFormatMedia MakeMsg(clsVolSearch, 7)
Comments This message is sent by theBlockDeviceManager when it receives a block device reset all and in the
process discovers unformatted media on a device.
msgVSUpdateVolumes
Requests theVolSearcher to update all volumes.
Takes BOOLEAN, returns STATUS.
#define msgVSUpdateVolumes MakeMsg(clsVolSearch, 8)
This message requests the volSearcher to ask all volume classes to update their list of volumes. This may
result in volumes being installed, removed, connected or disconnected. Interested parties should become
observers of theFileSystem and look for msgFSVolChanged (see fs.h). The argument passed should be
true to update all volumes.
This message can only be sent via ObjectSendXXX.
msgVSFormatCompleteNotify
Notifies observers of theVolSearcher that a format has completed.
Takes BOOLEAN, returns STATUS.
#define msgVSFormatCompleteNotify MakeMsg(clsVolSearch, 20)
The argument passed to the observer indicates whether the format was successful or not. False would be
returned if there was an error or if the format was cancelled.
msgVSNameVolume
Prompts user to name an unlabelled volume and adds new name.
Takes root dir handle of volume, returns STATUS.
#define msgVSNameVolume MakeMsg(clsVolSearch, 9)
This message is used by volumes that have discovered unlabeled volumes. This message can only be sent
via ObjectPostXXX.
Part 8 /
System Services
CMPSTEXT.H
This file contains the API definition for the compose-text package.
This package is used to compose a text string that needs to have pieces inserted into it. The format of
the strings makes it easy to internationalize and localize the text.
The functions described in this file are contained in SYSUTIL.LIB.
Format Strings
The format strings contain literal text and format codes. A format code starts with 'A', has a sequence of
one or more digits in the middle, and a single letter at the end. The digits specify which argument to the
function to use and the letter indicates the type of the argument. For instance, format code "A2s"
indicates that the second argument should be inserted, and that the argument should be a string.
The following fills 'buffer' with the string "a B b A c":
SComposeText (&buffer, &size, heap, Ira "'2s b "'ls e", "A", "B");
The available argumen't types are:
• A: Literal' A' character. E. g. use "A A" to put a A in a string.
• s: String.
• r: Resource ID of a string resource.
• 1: Group number and indexed list resource ID for string list. This uses two arguments.
• d: U32 printed as a decimal number.
• x: U32 printed as a hexadecimal number.
• {: Singular/Plural word forms of the form" {islare}". When this argument type is used, the routine
examines the specified argument. If its value is 1, the first string is used. Otherwise the second string
is used.
The following code reads in a string from the TK group for a 'sample' project.
SComposeText(&buffer, &size, heap,
"The filled in string is "'11.", resGrpTK, sampleListResld);
As an example of the' {' format code, the following code generates the first string if numApples== 1 and
the second string if numApples==5.
SComposeText(&buffer, &size, heap,
"There "'l{islare} "'ld "'l{applelapples}.", numApples);
"There is 1 apple."
"There are 5 apples."
Memory Management
All of the procedures fill in a buffer with the generated string. There are two ways of supplying the
buffer memory.
• You can supply a buffer pointer and buffer length. Do this by passing the pointer as *ppString, the
length in *pLength, and a null heapld. If this technique is used, and the buffer is too small to hold
the results, an error status is returned.
122 PENPOINT API REFERENCE
Part 8 / System Services
• You can specify a heap from which memory will be allocated. Do this by passing in a valid heapld.
You are obligated to free the memory when finished.
#ifndef CMPSTEXT_INCLUDED
#define CMPSTEXT_INCLUDED
#ifndef GO_INCLUDED
#include <go.h>
#endif
#ifndef RESFILE_INCLUDED
#include <resfile.h>
#endif
#include <stdarg.h>
Functions
SComposeText
Composes a string from a format and arguments.
Returns SfATUS.
function Prototype STATUS CDECL SComposeText (
PP CHAR ppString,
P U32 pLength,
OS HEAP ID heap,
const P CHAR pFormat,
) i
Copy the format argument into the output string, doing the appropriate substitutions for the format
codes.
See the section "Memory Management" for information on what values to use for the first three
arguments.
VSComposeText
Composes a string from a format and a pointer to the argument list.
Returns SfATUS.
¥undi(,)!1 Prototype STATUS CDECL VSComposeText (
PP_CHAR ppString,
P U32 pLength,
OS HEAP ID heap,
const P CHAR pFormat,
va list argList
) i
This is the same as SComposeText except the arguments are passed as a pointer to a list.
See the section "Memory Management" for information on wh~t values to use for the first three
arguments.
GOMATH.H
This file contains the API definition for fixed point arithmetic. The functions described in this file are
contained in PENPOINf.LIB.
The API in this file is all function oriented.
*ifndef GOMATH_INCLUDED
*define GOMATH INCLUDED
*ifndef GO_INCLUDED
Unclude <go. h>
*endif
Math Constants
*define GoFxO ((FIXED) OxOOOOOOOO) II 0.0
*define GoFxl ((FIXED) Ox00010000) II 1.0
*define GoFxMinus1 ((FIXED) OxffffOOOO) II -1.0
FxCmp
Compares two FIXED.
Returns S16.
ftH'IdlOfl Pr©1©1ype S16 PASCAL FxCmp (FIXED a, FIXED b);
RehJrh \fel!ue -1 if a < h.
o if a = h.
1 if a> h.
124 PEN POINT API REFERENCE
Part 8 / System Services
FxAdd
Adds two FIXED numbers, producing a FIXED.
Returns SfATUS.
Fum:tion Pr©t©type STATUS PASCAL FxAdd (FIXED a, FIXED b, P_FIXED pC);
Return V(Jiue stsOverflow The integer part of the result overflows a 16-bit signed.
FxAddSC
Macro form of FxAdd with no overflow detection.
Returns FIXED.
fdefine FxAddSC C f1, _ f2) ((FIXED) ( C f1) + C f2) ) )
FxSub
Subtracts two FIXED numbers, producing a FIXED.
Returns SfATUS.
Fund-ion Prototype STATUS PASCAL FxSub(FIXED a, FIXED b, P_FIXED pC);
Retum'V(Jlue stsOverflow The integer part of the result overflows a 16-bit signed.
FxSubSC
Macro form of FxSub with no overflow detection.
Returns FIXED.
fdefine FxSubSC Cf1, f2) ((FIXED) (Cf1) - Cf2)))
FxNegate
Negates a FIXED.
Returns FIXED.
fdefine FxNegate Cf) ((FIXED) (- Cf)))
FxMul
Multiplies two FIXED numbers, producing a FIXED.
Returns SfATUS.
F~mction Prototype STATUS PASCAL FxMul (FIXED a, FIXED b, P_FIXED pC);
Return \I(tioe stsOverflow The integer part of the result overflows a 16-bit signed.
FxMulSC
Multiplies two FIXED numbers returning the product.
Returns FIXED.
Function Prototype FIXED PASCAL FxMulSC (FIXED a, FIXED b);
FxMulInt
Multiplies a FIXED number by an 532, producing a FIXED.
Returns STATUS.
fUr1dll'J11 PrC)fotype STATUS PASCAL FxMulInt (FIXED a, S32 b, P_FIXED pC);
Return Vulue stsOverflow The integer part of the result overflows a 16-bit signed.
FxMulIntSC
Multiplies a FIXED number by an 532, returning the FIXED product.
Returns FIXED.
#define FxMulIntSC(_a,_b) ((FIXED) (_a*_b))
FxMulInifoInt
Multiplies a FIXED number by an 532, producing a rounded 532 product.
Returns STATUS.
hmdion Prototype STATUS PASCAL FxMulIntToInt (FIXED a, S32 b, P_S32 pC);
~eFum Vo~ue stsOverflow The integer part of the result overflows a 32-bit signed.
FxMulInifoIntSC
Multiplies a FIXED number by an 532, returning a rounded 532 product.
Returns 532.
fwm:tion Prototype S32 PASCAL FxMulIntToIntSC (FIXED a, S32 b);
FxDiv
Divides two FIXED numbers, producing a FIXED quotient.
Returns STATUS.
Fundion Prototype STATUS PASCAL FxDiv (FIXED top, FIXED bottom, P_FIXED pC);
~erurr1 ,\f'olue stsOverflow The integer part of the result overflows a 16-bit signed.
stsZeroDivide The input divisor is zero.
FxDivSC
Divides two FIXED numbers, returning a FIXED quotient.
Returns FIXED.
fwndk}!1 Pr©totypz; FIXED PASCAL FxDivSC (FIXED top, FIXED bottom);
FxDivlnts
Divides two 32-bit signed integers, producing a FIXED quotient.
Returns SfATUS.
Plmdk~fl Proh:lIType STATUS PASCAL FxDivInts (S32 top, S32 bottom, P_FIXED pC);
Rehml Value stsOverflow The integer part of the result overflows a 16-bit signed.
stsZeroDivide The input divisor is zero.
FxDivlntsSC
Divides two FIXED numbers, returning a FIXED quotient.
Returns FIXED.
Pltnclh:m Pr©tOlype FIXED PASCAL FxDivIntsSC (S32 top, S32 bottom);
FxDivIntToInt
Divides an 532 by a FIXED, producing a rounded 532 quotient.
Returns SfATUS.
Pum;;t1tm Prototype STATUS PASCAL FxDivIntToInt (S32 top, FIXED bottom, P_S32 pC);
Return Valise stsOverflow The integer part of the result overflows a 16-bit signed.
stsZeroDivide The input divisor is zero.
FxDivIntToIntSC
Divides an 532 by a FIXED, producing a rounded 532 quotient.
Returns 532.
Pundion Proh,?lyp® S32 PASCAL FxDivIntToIntSC (S32 top, FIXED bottom);
FxSin
Returns the sine of an integer angle in degrees.
Returns FIXED.
Ptmd;on Prof<tlyf$® FIXED PASCAL FxSin (S16 angle);
FxCos
Returns the cosine of an integer angle in degrees.
Returns FIXED.
Function Prototype FIXED PASCAL FxCos (S16 angle);
GOMATH.H 127
Fixed-point Function Prototypes
FxTan
Returns the tangent of an integer angle in degrees.
Returns FIXED.
functiClt) Pr{)t{)type FIXED PASCAL FxTan (S16 angle);
FxSinFx
Returns the sine of a FIXED angle in degrees.
Returns FIXED.
Ft.mdi{)!'t Prototype FIXED PASCAL FxSinFx (FIXED angle);
FxCosFx
Returns the cosine of a FIXED angle in degrees.
Returns FIXED.
Function Prototype FIXED PASCAL FxCosFx (FIXED angle);
FxTanFx
Returns the tangent of a FIXED angle in degrees.
Returns FIXED.
Fundion Prototype FIXED PASCAL FxTanFx (FIXED angle);
FxArcTanlnt
Returns an arctangent value as a FIXED angle.
Returns FIXED.
Function Prototype FIXED PASCAL FxArcTanInt (S32 top, S32 bottom);
C{)I1'H'11ents Computes a FIXED angle whose tangent is the value given by the quotient of the two signed 32-bit
integers, top / bottom. The value returned ranges from 0 to 359 degrees.
FxArcTanFx
Returns an arctangent value as a FIXED angle.
Returns FIXED.
function Prototype FIXED PASCAL FxArcTanFx (S32 top, S32 bottom);
Comments Computes a FIXED angle whose tangent is the value given by the quotient of the two signed 32-bit
numbers, top / bottom. The value returned ranges from 0 to 359 degrees.
FxAbs
Takes the absolute value of a FIXED.
Returns FIXED.
#define FxAbs(_f) (((_f)<O)?FxNegate(_f): (_f))
128 PENPOINT API REFERENCE
Part 8 / System Services
FxRoundTolnt
Rounds a FIXED number to a 32-bit signed integer.
Returns 532.
Function Pw©¥©typ0' S32 PASCAL FxRoundToInt (FIXED fx);
FxRoundTolntSC
Rounds a FIXED number to a 16-bit signed integer.
Returns 516.
*define FxRoundToIntSC Cf) (S16) (( Cf) +Ox8000) »16)
FxChop
Returns the 16-bit signed integer part of a FIXED.
Returns 516.
*define FxChopCf) (S16) (Cf»>16)
*define FxChopSC Cf) (S16) ((_f) »16)
FxFraction
Returns the 16-bit fractional part of the absolute value a FIXED.
Returns U16.
*define FxFraction(_f) (U16) (FxAbs(_f))
FxInifoFx
Converts a 16-bit signed integer into a FIXED.
Returns FIXED.
*define FxIntToFx Ci) ((FIXED) (( (S32) Ci)) «16))
FxMakeFixed
Makes a FIXED with an 516 (integer) and a UI16(fraction).
Returns FIXED.
FIXED PA5CAL FxMakeFixed(516 whole, U16 frac); (now in go.h)
FxBinToStr
Converts a FIXED format value into an ascii string in decimal.
Returns nothing.
Function Prototype void PASCAL FxBinToStr (
FIXED a,
P CHAR pStr,
U8 fracDigits,
U8 maxLen,
BOOLEAN showCornmas
GOMATH.H 129
Fixed-point Function Prototypes
FxStrToBin
Converts a null-terminated ascii string to a FIXED.
Returns STATUS.
Function ~r@h>type STATUS PASCAL FxStrToBin (
P_CHAR pStr,
P_FIXED pC
);
UNICODE strings/characters
To define characters or strings in PENPOINT 1.0, use the "U_L" macro on them. This maps to the
original string, and thus does nothing. In 2.0 the define will be changed so that it inserts "L" in front of
the string. This will convert the character or string into a wide character or string to match the 2.0
definition of CHAR.
Here is some sample code to show its use. This code would compile and run under both 1.0 and 2.0, the
only difference would be the space allocated for each character (1 vs. 2 bytes).
CHAR cc;
P_CHAR pString;
Extensions to STRING.H
#define Ustrcat strcat
#define Ustrncat strncat
#define Ustrcmp strcmp
#define Ustrncmp strncmp
#define Ustrcpy strcpy
#define Ustrncpy strncpy
#define Ustrlen strlen
#define Ustrdup strdup
#define Ustrrev strrev
#define Ustrset strset
#define Ustrnset strnset
#define Ustrchr strchr
#define Ustrrchr strrchr
#define Ustrspn strspn
#define Ustrcspn strcspn
#define Ustrpbrk strpbrk
#define Ustrstr strstr
#define Ustrtok strtok
#define Ustricmp stricmp
'strcmpi' the same as 'stricmp', we don't need U versions of both.
#define Ustrnicmp strnicmp
#define Ustrlwr strlwr
#define Ustrupr strupr
#define Umemcpy memcpy
#define Umemccpy memccpy
#define Umemchr memchr
#define Umemcmp memcmp
#define Umemicmp memicmp
#define Umemmove memmove
#define Umemset memset
#define Ustrerror strerror
Extensions to CTYPE.H
#define Uisalpha isalpha
#define Uisalnum isalnum
#define Uisascii isascii
#define Uiscntrl iscntrl
#define Uisprint isprint
#define Uisgraph isgraph
#define Uisdigit isdigit
#define Uisxdigit isxdigit
#define Uislower islower
#define Uisupper isupper
#define Uisspace isspace
#define Uispunct ispunct
#define Utolower tolower
#define Utoupper toupper
Extensions to STDLIB.H
#define Uatoi atoi
#define Uatol atol
#define Uitoa itoa
#define Ultoa Itoa
#define Uutoa utoa
#define Ustrtol strtol
#define Uatof atof
#define Ustrtod strtod
#define Ustrtoul strtoul
INTL.H 133
Mapping of 16-bit string/character functions for 1.0
This goes directly to its 2.0 definition because it does not make sense on an ascii text stream, and if the
current text is not ascii, then having it automatically convert to Unicode by recompile in 2.0 won't
work. It is included mostly to reserve the name, and let programers know that it will be available.
#define Uswab(s,d,n) swab ((char *) s, (char *) d, n*2)
Extensions to STDIO.H
#define Ufopen fopen
#define Usprintf sprintf
#define Uvsprintf vsprintf
#define Usscanf sscanf
#define Uputc putc
#define Ufputc fputc
#define Ugetc getc
#define Ufgetc fgetc
#define Uungetc ungetc
#define Ufdopen fdopen
#define Ufreopen freopen
#define Uprintf printf
#define Ufprintf fprintf
#define Uvprintf vprintf
#define Uvfprintf vfprintf
#define Uscanf scanf
#define Ufscanf fscanf
#define Uvscanf vscanf
#define Uvfscanf vfscanf
#define Uvsscanf vsscanf
#define Ugetchar get char
#define Ufgetchar fgetchar
#define Ugets gets
#define Ufgets fgets
#define Uputchar put char
#define Ufputchar fputchar
#define Uputs puts
#define Ufputs fputs
#define Uremove remove
#define Urename rename
#define Utmpnam tmpnam
Extensions to FCNTL.H
#define Uopen open
#define Usopen sopen
#define Ucreat creat
Extensions to TIME.H
#define Uasctime asctime
#define Uctime ctime
Extensions to UNISTD.H
#define Urmdir rmdir
#define Uchdir chdir
#define Ugetcwd getcwd
Extensions to DIRENT.H
#define Uopendir opendir
#define Ureaddir readdir
OS.H
This file contains the API for the PenPoint kernel. The functions described in this file are contained in
PENPOINT.LIB.
The PenPoint kernel provides support for tasking, memory management, inter-task communication and
timer services.
#ifndef os INCLUDED
#define OS-INCLUDED
Debugging Flags
PenPoint kernel flag is 'G', values are:
0001 User configuration (copy exes from boot to theSelectedVolume)
0002 Enter debugger on faults while scavenging
0004 Display memory sizes for each module loaded and run
0008 Display Stack grow/shrink messages
0010 Save page fault information in a memory buffer
0020 Run in the Ram only configuration
0100 Print various memmgr details
1000 see resfile.h
2000 see resfile.h
4000 see resfile.h
8000 see resfile.h
10000 Internal use only
20000 Call the MIL using the common entry point for full debugging
#ifndef GO INCLUDED
#include <go.h>
#endif
#ifndef OSTYPES INCLUDED
#include <ostypes.h>
#endif
#ifndef OSHEAP INCLUDED
#include <osheap.h>
#endif
• Display modes
Enum16 (OS_DISPLAY_MODE)
osConsole, II display mode is console
osGraphics II display mode is graphics
};
• Address information
typedef struct os ADDRESS_INFO { II Info for a given memory address
P MEM pRegionBase; II base of region
SIZEOF regionLength; II length of the region
OS ACCESS access; II access rights of the region
OS TASK ID owner; II owning task for this region
BOOLEAN userPriv; II TRUE - user region, FALSE - kernel
OS- REGION- ATTRS flags; II see defines above
SIZEOF residentSize; II amount of region that is resident
SIZEOF committedSize; II amount of region that is committed
OS- REGION- TYPE regionType; II type of region
OS_ADDRESS_INFO, * P_OS_ADDRESS_INFO;
• System configuration information
typedef struct OS_SYSTEM_INFO { II system configuration information
BOOLEAN mathProcessorPresent; II TRUE = present
OS_MILLISECONDS millisecondsPerSystick; II ms per clock tick
OS_SYSTEM_INFO, * P_OS_SYSTEM_INFO;
• Date and time information
II The time zone string is a POSIX format string. See the Watcom library
II reference for PenPoint, TZ environment variable set section for more info.
typedef struct OS_DATE_TIME {
U32 seconds; II seconds after the minute [0,61]
U32 minutes; II minutes after the hour [0,59]
U32 hours; II hours after midnight [0,23]
U32 day; II day of the month [1,31]
U32 month; II months since January [0,11]
U32 year; II years since 1900
U32 dayOfWeek; II days since Sunday [0,6]
U32 dayOfYear; II days since January 1 [0,365]
PCHAR pTimeZone; II time zone string (POSIX format)
OS DATE TIME, * P_OS_DATE_TIME;
• Loaded program information
typedef struct OS_PROG_INFO {
OS_PROG_HANDLE progHandle; II program identifying handle
CHAR name[32+1]; II module name (without the .exe)
U32 initHeapSize; II .exe-header initial heap allocation
U32 initStackSize; II .exe-header initial stack allocation
U16 initCS; II initial CS (selector, not segment#)
U32 initIPi II initial IP
U32 nRegions; II # of regions
U16 initDS; II initial DS
U16 isDLL :1, II a for .exes, 1 for DLLs
isUser :1, II 1 for user priv, a for system priv
rsvd :14; II reserved for future use.
U32 fixedSize; II read-only segments + initialization data
U32 sharedSize; II shared readlwrite segments
U32 privateSize; II private readlwrite segments
U32 nRequiredModules; II # modules this depends upon
OS_PROG_INFO, * P_OS_PROG_INFO;
• Interrupt information
II Note: OR in the flag osIntNumIsHardwareLevel if intNum is a hardware
II interrupt level (vs a MIL logical device id). The flag is defined
II in ostypes.h.
typedef struct OS_INTERRUPT_INFO II struct used to set interrupts
OS_INTERRUPT_ID intNum; II logical interrupt id
P_UNKNOWN pCode; II ptr to interrupt routine
OS_INTERRUPT_INFO, * P_OS_INTERRUPT_INFO;
OS.H 139
Functions
• Message information
typedef struct OS_ITMSG_INFO II inter-task message information
OS_ITMSG_FILTER filter; II filter of the message
P_MEM pITMsg; II pointer to inter-task message buffer
SIZEOF length; II length of the message buffer
U32 token; II user defined info field
OS TASK ID taskId; II dest or sending task Id
U16 mode; II see defines for OS_ITMSG_INFO
OS_ITMSG_INFO;
• Fast serna struct
typedef struct os FAST SEMA
U16 count; II top bit for test and set
II bits 0-14 for recursive counting
U16 nWaits; II number of waiters
OS TASK ID owner;
OS_FAST_SEMA, *P_OS_FAST_SEMA;
Functions
OSProgramlnstall
Installs a program into the loader database.
Returns STATUS.
tundion Pn,,"lI?«>lYp® STATUS EXPORTEDO OSProgramInstal1 (
P_CHAR pCommandLine, II dlc or exe name (and arguments)
P_CHAR pWorkingDir, II working dir of the program
P_OS_PROG_HANDLE pProgHandle, II Out: program handle
P_CHAR pBadName, II Out: If error, dll/exe that was bad
P_CHAR pBadRef II Out: If error, reference that was bad
);
If a dIe file is provided, all dlls in the file will also be loaded if not loaded already.
OSProgramInstall will not return until instance 0 of all loaded dlls and exe are completed. No message
dispatching will occur during this time. If communication to the calling task is required, use
IMProgramInstall (install.h, install.lib).
OSProgramDeinstall
stsOSBadDLCFormat DLe file is incorrectly formatted
stsOSBadExeFormat A D LL or EXE is invalid in the dIe file
stsOSProglnstallError Use debug version of PenPoint for more info
stsOSModuleN otFound Module name specified in dIe file is invalid
stsOSMissingDependency Import module in an exe or dll was not found
stsOSMisingEntryName Import name in an exe or dll was not found
stsOSMissingEntryOrdinal Import number in an exe or dll was not found
140 PENPOINT API REFERENCE
Part 8 I System Services
OSProgramDeinstall
Deinstalls a program already loaded into the loader database.
Returns STATUS.
Fundit)!,} Pr@f@type STATUS EXPORTEDO OSProgramDeinstall (
OS_PROG_HANDLE progHandle II program handle
);
This routine will terminate any dll task wrappers before deinstalling the code. If an exe is being
deintalled, all tasks must be terminated before calling this routine.
OSProgramInstall
stsOSlnvalidProgramHandle Program handle is incorrect
stsOSDependenciesExist Another program requires this dll or a task is using this module
OSProgramInstantiate
Creates an instance of a program.
Returns STATUS.
Fundl@Fi Pr@t@type STATUS EXPORTEDO OSProgramInstantiate (
OS PROG HANDLE progHandle, II program handle from install
P CHAR pCommandLine, II pathname + arguments
P=OS_TASK_ID pTaskId II Out: Task id of the new task
);
(@mmeni's The newly created process will be set to the same priority as the caller.
stsBadParam Program handle is invalid
OSSubTaskCreate
Creates a new execution thread in this context.
Returns STATUS.
Fundi@Fi Pr@t@type STATUS EXPORTEDO OSSubTaskCreate (
P_OS_SUBTASK_ENTRY pEntrypoint, II Function entrypbint
SIZEOF stackSize, II ignored.
U16 mustBeZero, II reserved
U32 arg, II arg pa$sed to function
P_OS_TASK_ID pTaskId II Out: new task id
);
The entrypoint that starts the subtask must NOT return. To terminate the task, use OSTaskTerminate
(OSThisTask 0) as the last line in the routine. The newly created task will be set to the same priority as
the caller.
The initial stack size of the subtask will be set to 4096 bytes. The stackSize parameter will be ignored.
Stacks will automatically grow to accomodate a program's stack requirements.
OSfaskTerminate
Terminates a task.
Returns STATUS.
rl.mdi@ri ?r@t@type STATUS EXPORTEDO OSTaskTerminate (
OS_TASK_ID taskId, II task to terminate
OS TASK ERROR exit Code II reason for terminating exit code
);
OS.H 141
Functions
Callers to OSTaskTerminate will not return until the task has successfully terminated. Task termination
will cause the following events to occur:
1) if a process is terminated, all subtasks are first terminated
2) observers of theProcess will be notified (see clsmgr.h). The error code is provided with the
notification.
3) objects owned by the terminating task will be scavenged
4) a broadcast message will be sent to all tasks to notify them of the the task termination. The message
will be sent on the filter osTerminatedTaskFilter. This filter is by default off.
OSNextTerminatedTaskId
Notifies the caller of the tasks that have terminated.
Returns the next task that has terminated.
OS TASK ID EXPORTEDO OSNextTerminatedTaskld(
- P_oS_TASK_ERROR pExitCode II Out: exit code of terminating task
);
The broadcast message for task termination does not include the task identifier of the task that has
terminated. To find this out, this routine should be called to get the list of terminated tasks. When
osNullTaskId is returned, the list ends.
OSThisTask
Passes back the task identifier of the current running task.
Returns OS_TASK_ID.
tt.mdicn Pr©t©type os TASK ID EXPORTED OSThisTask (void) ;
osraskPrioritySet
Sets the priority of a task or a set of tasks.
Returns SfATUS.
rum:tI©n Prntctype STATUS EXPORTEDO OSTaskPrioritySet (
OS_TASK_ID taskld, II target task
OS_TASK_MODE mode, II task mode
OS_PRIORITY_CLASS priorityClass, II new priority class
U8 priority II new priority number
);
The task mode can be used to set the priority of just one task or all tasks in the process family.
OSTaskPriorityGet
OsraskPriori~et
Passes back the priority of a task.
Returns SfATUS.
tund;©n Pr©f©type STATUS EXPORTEDO OSTaskPriorityGet (
OS_TASK_ID taskld, II target task
P_OS_PRIORITY_CLASS pPriorityClass, II Out: task's priority class
P_U8 pPriority II Out: task's priority number
);
142 PENPOINT API REFERENCE
Part 8 / System Services
Both the priority class and the priority within that class are returned.
OSTaskPrioritySet
o SfaskDelay
Delays the current task for a specified period of time.
Returns STATUS.
Flmdicn1 Prototype void EXPORTEDO OSTaskDelay (
OS MILLISECONDS timeLimit II milliseconds to delay
);
When the machine is turned off, the delay time freezes until the system is turned back on again.
OSTaskDelay cannot be called from an interrupt subtask.
OSITMsgSend
Sends an inter-task message to a task or set of tasks.
Returns STATUS.
Fundion Prototype STATUS EXPORTEDO OSITMsgSend (
P_OS_ITMSG_INFO pITMsgInfo II inter-task message info block
);
OSITMsgSend is used to send an inter-task message to 1) a single task, or 2) all tasks in a task family, or
3) all tasks in the system. The combination of the taskId and mode fields are used to accomplish this. If
broadcasting to all tasks, the taskId field is ignored.
An inter-task message is an array of bytes completely uninterpreted by the kernel stored in the pITMsg
field. If the inter-task message is short (up to U32), it can be stored in the token field for improved
performance. The length field is used to store the length of the inter-task message in pITMsg. If the
length field is 0, the pITMsg field is ignored and can be used for more information passing.
Inter-task messages are passed to the destination task in two ways: copy and alias. In copy mode, the
message is copied into a new buffer allocated in the context of the destination task. In alias mode, the
message is aliased into the destination task. Messages must be full regions when using alias mode.
Messages are normally inserted into the end of the destination message queue. However, it is possible to
specify that a message be inserted into the front of the message queue.
Inter-task messages will get delivered to tasks that have a filter mask set to allow messages of the sending
messages filter. If sending a message on multiple filters, the message will be delivered if anyone of the
filters are allowed by the receiving task. No error status is returned if the receiving task does not receive
the message due to its filter mask setting.
OSITMsgReceive
OSITMsgReceive
Receives a message from the task's message queue.
Returns STATUS.
Fundion Prototype STATUS EXPORTEDO OSITMsgRecei ve (
P_OS_ITMSG_INFO pITMsgInfo, II In-Out: message info block
OS MILLISECONDS timeLimit II amount of time to wait for message
);
OS.H 143
Functions
Comments Messages are received by specifying a filter or set of filters in the pITMsglnfo struct. Any message with a
filter that is in that set will match the receive request. The filter in the pITMsglnfo struct must always
be set on entry.
When a message is received that matches the input filter, the message is removed from the queue and
provided to the client.
OSITMsgSend
OSITMsgPeek
Gets the next message from the message queue without removing it.
Returns STATUS.
Fundion ~r@f@fy~e STATUS EXPORTEDO OSITMsgPeek (
P_OS_ITMSG_INFO pITMsgInfo, II In-Out: message info block
OS_MILLISECONDS timeLimit, II amount of time to wait for message
P_OS_ITMSG_ID pITMsgId II In-Out: id of message received
)i
Comments *pITMsgId of null peeks from the front of the queue. Use the previous message id to peek further into
the queue. The filter in the pITMsglnfo struct must always be set on entry.
OSITMsgFromId
OSITMsgFromld
Passes back the message associated with the message identifier.
Returns STATUS.
Fundion ~r@f@type STATUS EXPORTEDO OSITMsgFromId (
P_OS_ITMSG_INFO pITMsgInfo, II In-Out: message info block
OS_ITMSG_ID itMsgId II message id obtained from OSITMsgPeek
) i
OSITMsgQFlush
Flushes the message queue of all messages matching the message filter.
Returns STATUS.
Fundion ~r@f@fype STATUS EXPORTEDO OSITMsgQFlush (
OS_ITMSG_FILTER itMsgFilter II message filter of messages to flush
) i
If a message has other filters set in addition to itMsgFilter, then the message will NOT be flushed.
OSITMsgFilterMask
Sets the filter mask for this task.
Returns the old filter mask.
Function Prototype OS_ITMSG_FILTER EXPORTEDO OSITMsgFilterMask (
OS_ITMSG_FILTER newITMsgFilter, II new filter mask for this task
BOOLEAN setNewFilter II if true, the new filter mask will be set
) i
144 PENPOINT API REFERENCE
Part 8 / System Services
Setting the mask bit to 1 indicate~ the message is allowed by this task; 0 otherwise. Any messages sent to
this task whose filter bits are off in the filter mask will be discarded.
If setNewFilter is FALSE, newITMsgFilter is ignored and only the old filter mask is returned.
OSITMsgSend
OSSemaCreate
Creates a semaphore.
Returns STATUS.
¥ttm:tk~!1 Pr<Jt<Jtype STATUS EXPORTEDO OSSemaCreate (
P_OS_SEMA_ID pSemal1 Out: new open semaphore
);
OSSemaOpen
Opens (accesses) an already existing semaphore.
Returns STATUS.
FttfH::tl<J!1 Pr<Jt<Jtype STATUS EXPORTEDO OSSemaOpen (
OS_SEMA_ID sema, II semaphore
OS TASK ID task II task wanting to share ownership of sema
);
Tasks should always open someone else's semaphore to guarantee that the semphore will be around even
if the original owner of the semaphore terminates.
OSSemaCreate
OSSemaDelete
Deletes a semaphore.
Returns STATUS.
r!'}f!dktrl Pr<Jt<Jtype STATUS EXPORTEDO OSSemaDelete (
OS_SEMA_ID s e m a l l the semaphore to delete
);
The semaphore will be removed from the system when all owners of the semaphore have deleted it.
OSSemaCreate
OSSemaRequest
Locks the counting semaphore (increments the count).
Returns STATUS.
STATUS EXPORTEDO OSSemaRequest(
OS_SEMA_ID sema, II the semaphore to lock
OS MILLISECONDS timeLimit II max time to wait if already locked
);
OSSemaRequest should be used in conjunction with OSSemaClear when using semaphores to protect
critical sections of code. OSSemaRequest/OSSemaClear implement a counting semaphore model which
OS.H 145
Functions
allows nesting of OSSemaRequest calls. Only after the same number of OSSemaClear calls will the next
waiting task enter the critical section. Up to 64K nestings are allowed.
If a task has obtained a semaphore via OSSemaRequest and subsequently dies, the semaphore will be
given to the next requestor and that requestor will be given the status stsOSSemaLockBroken.
RetumVoluc stsOSSemaLockBroken Previous locker of semaphore died without clearing the semaphore
stsOSTimeOut The timelimit expired before obtaining the semaphore
OSSemaClear
OSSemaClear
Unlocks the counting semaphore (decrements the count).
Returns STATUS.
Fundi©11 Prototype STATUS EXPORTEOO OSSemaClear (
OS SEMA 10 serna II the semaphore to unlock
);
OSSemaClear should be used in conjunction with OSSemaRequest when using semaphores to protect
critical sections of code. OSSemaRequest/OSSemaClear implement a counting semaphore model which
allows nesting of OSSemaRequest calls. Only after the same number of OSSemaClear calls will the next
waiting task enter the critical section. Up to 64K nestings are allowed.
OSSemaRequest
OSSemaReset
Resets event semaphore (no matter what count).
Returns STATUS.
Fum:ti©n Prototype STATUS EXPORTEOO OSSemaReset (
OS_SEMA_1D serna II the semaphore to reset
);
OSSemaReset is used with OSSemaSet and OSSemaWait to support event handling. In this model, the
client waiting on the event should use OSSemaSet to set the semaphore to 1, and OSSemaWait to wait
until the semaphore has been reset to O. OSSemaReset will reset the semaphore to 0, thereby notifying
all tasks waiting on the event. OSSemaReset is normally used in interrupt tasks. The task that is
processing the event may actually have received more than one event and should process all events after
resetting the semaphore to avoid losing any events.
OSSemaSet
OSSemaSet
Sets the event semaphore to 1.
Returns STATUS.
Fundl©n Prototype STATUS EXPORTEOO OSSemaSet (
OS SEMA 10 serna II the semaphore to set
);
OSSemaSet is used with OSSemaWait and OSSemaReset to support event handling. In this model, the
client waiting on the event should use OSSemaSet to set the semaphore to 1, and OSSemaWait to wait
----------------------
146 PENPOINT API REFERENCE
Part 8 / System Services
until the semaphore has been reset to 0. OSSemaReset will reset the semaphore to 0, thereby notifying
the task waiting on the event.
OSSemaReset
OSSemaWait
Waits for the event semaphore to be reset.
Returns SfATUS.
fUfH;tion Pr©t©fype STATUS EXPORTEDO OSSemaWai t (
OS_SEMA_ID sema, II the semaphore to wait on
OS MILLISECONDS timeLimit II max time to wait for the count to go to 0
);
OSSemaWait is used with OSSemaSet and OSSemaReset to support event handling. In this model, the
client waiting on the event should use OSSemaSet to set the semaphore to 1, and OSSemaWait to wait
until the semaphore has been reset to 0. OSSemaReset will reset the semaphore to 0, thereby notifying
the task waiting on the event.
stsOSSemaLockBroken Previous locker of semaphore died without clearing the semaphore
stsOSTimeOut The timelimit expired before obtaining the semaphore
OSSemaReset
OSFastSemaInit
Initialize fast serna.
Returns nothing..
#define OSFastSemaInit (ySem) memset ( (ySem), 0, s'izeof (OS_FAST_SEMA) )
Fast semaphores provide a fast but unprotected semaphore model. Fast semaphores are simply memory
provided by the client as storage area for the state of the semaphore. This storage area must initially be
set to 0.
OSFastSemaRequest
OSFastSemaRequest
Fast version of serna request.
Returns SfATUS.
fund!<)r1 Pr©h>fype STATUS EXPORTED OSFastSemaRequest
P_OS_FAST_SEMA pSema
);
There are a number of important limitations that a developer should understand about fast semaphores.
1) If a task owns a fast semaphore and then dies before releasing it, the
semaphore will not be released automatically by the system.
2) The fast semaphores should not be copied from one location to another.
The routines rely on the address of the semaphore structure being
the same.
OSFastSemaClear
OSFastSemaClear
Fast version of serna clear.
Returns STATUS.
Function ProTotype STATUS EXPORTED OSFastSemaClear
P_OS_FAST_SEMA pSema
);
OSGetTime
Returns local time.
Returns STATUS.
FUnd!{;:m Prototype STATUS EXPORTEDO OSGetTime (
SIZEOF structLength, II size of the date/time struct
P_OS_DATE_TIME pDateTime II Out: date, time and time zone information
);
OSSetTime
Sets the time or time zone.
Returns SfATUS.
Fundion Prototyp$ STATUS EXPORTEDO OSSetTime (
OS_SET_TIME_MODE setMode, II which attributes to set
SIZEOF structLength, II size of the date/time struct
P_OS_DATE_TIME pDateTime II date, time and time zone information
);
OSProgramInfo
Returns information on the program from the loader.
Returns SfATUS.
Function Prototyt»® STATUS EXPORTEDO OSProgramInfo (
OS_PROG_HANDLE progHandle, II program handle given out by the loader
P_OS_PROG_INFO pInfo II Out: information buffer
);
OSProgramInfo will return information on the program handle passed in.no valid handle exists for that
number, then the routine will returnon the numerically smallest program handle just largerthe
number passed in. The program handle found will be put in theinformation buffer. If no valid
handle exists that islarger than progHandle, then Nil will be returned in thehandle field of the
information structure with stsOK beingfrom the function.
To iterate over all program handles in the system, simply start byOSProgramInfo with a progHandle of
o. This will return thesmallest program handle. On the next call, use thathandle + 1, and on and on
until the returned program handleO.
OSPowerUpTime
Passes back the number of milliseconds since the last reset.
Returns OS_MILLISECONDS.
Function Pwot0typ® OS_MILLISECONDS EXPORTEDO OSPowerUpTime (void) ;
ScreenOnlyStringPrint
Prints a string onto the console.
Returns nothing.
Fund!0t'1 Prot©tyt»e void EXPORTEDO ScreenOnlyStringPrint (
P_STRING pSt ring II string to print
);
This routine will not log output through the debug log. It will only display characters on the screen.
Debugger
Enters the debugger.
Returns nothing.
tifdef DEBUG
tdefine Debugger() OSDebugger ( )
telse
tdefine Debugger()
tendif
OS.H 149
Functions
Comments This macro will call the symbolic debugger (DB). If the symbolic debugger is not available the low-level
kernel debugger is called. In production code (i.e., compiled without IDDEBUG) this macro does
nothing.
OSDebugger
Enters the debugger, should only be called in special situations.
Returns nothing.
function Prototype void EXPORTED OSDebugger (void) ;
Comments Most clients should call Debugger NOT OSDebugger. OSDebugger is used in special situations were a
debugger needs to be called in production code. When a call to the production version of OSDebugger
is made, the debug flag IDDI0000 must be set to actually enter the debugger. If the debug flag is not set
the call is a N (]J .
NOTE: OSDebugger should only be called in exceptional cases, such as, page fault handling.
KeyPressed
Determines if a key is available.
Returns BOOLEAN.
function Prototype BOOLEAN EXPORTEDO KeyPressed (
P_U16 pCh II Out: the char i f true is returned
);
Comments This routine is provided for support of low level code below the input system.
The high byte of the key is the scan code.
TRUE if a key is available
FALSE if no key is available
KeyIn
KeyIn
Passes back the next key and the scan code from the keyboard.
Returns a keyboard character.
~undion Prototype U16 EXPORTEDO KeyIn (void);
Comments The KeyIn routine is provided for support of low level code below the input system.
The high byte of the key is the scan code.
See Also KeyPressed
OSDisplay
Changes the display to the console or the graphics screen.
Returns the old display mode.
Funetlon Prototype OS_DISPLAY_MODE EXPORTEDO OSDisplay (
OS_DISPLAY_MODE newDisplayMode II set the display mode.
);
This call is only valid on single headed development systems. In all other configurations, the call does
nothing.
150 PEN POINT API REFERENCE
Part 8 / System Services
OSSetlnterrupt
Sets up an interrupt handler.
Returns STATUS.
flJm:yi@n Pr1Sf1St),pe STATUS EXPORTED OSSetInterrupt (
P_OS_INTERRUPT_INFO pIntInfo II In-Out: interrupt info
);
OSTimerAsyncSema
Reset a semaphore after time milliseconds.
Returns STATUS.
Flmd-i1Sn PrororYPG STATUS EXPORTEDO OSTimerAsyncSema (
OS_MILLISECONDS time, II waiting period before serna reset
OS_SEMA_ID serna, II semaphore to reset
P_OS_HANDLE pTransactionHandle II Out: ptr to transaction handle
);
CommGnrs The transaction handle can be used to stop the request if desired.
OSTimerlntervalSema
Resets a semaphore after each time interval has elapsed.
Returns STATUS.
Function PrototypG STATUS EXPORTEDO OSTimerIntervalSema (
OS_MILLISECONDS timeInterval, II time interval in milliseconds
OS_SEMA_ID serna, II semaphore to reset
P_OS_HANDLE pTransactionHandle II Out: timer transaction handle
);
OSTimerStop
Stops a timer request given its transaction handle.
Returns STATUS.
Flmdion ProtorYPG STATUS EXPORTEDO OSTimerStop (
OS HANDLE transactionHandle II transaction to stop
);
OSTimerTransactionValid
Checks to see if the timer transaction is valid.
Returns STATUS.
furn:t!@t! Prototype STATUS EXPORTEDO OSTimerTransactionValid (
OS HANDLE transactionHandle
);
OS.H 151
Functions
OSModuleLoad
Loads a module into the loader's database.
Returns SrATUS.
Fundkm Prototype STATUS EXPORTEDO OSModuleLoad (
P_CHAR moduleName, II Module name or dlc name
P_CHAR pWorkingDir, II Working dir of the app
P_OS_PROG_HANDLE pProgHandle, II Out: Program handle
P_CHAR pBadMod, II Out: If error, name of module that
II failed, buffer must be
II maxModNameLength+1 long
P_CHAR pBadReference II Out: If error, ref name not understood
II buffer must be maxModNameLength+1 long
);
Comments If a dIe file is provided, all dlls in the file will also be loaded if not loaded already.
OSModuleLoad will not return until instance 0 of all loaded dlls are completed. No message
. dispatching will occur during this time. If communication to the calling task is required, use
IMModuleLoad (install.h, install.lib).
OSProgramInstall
OSEntrypointFind
Finds an entrypoint in a loaded module either by name or by ordinal.
Returns STATUS.
FI..mdi©n Prototype STATUS EXPORTEDO OSEntrypointFind (
OS_ENTRYPOINT_TYPE entryType, II name or ordinal
P_STRING pName, II name if entryType is name
U16 ordinal, II ordinal if entryType is ordinal
OS_PROG_HANDLE progHandle, II Program handle
PP_MEM ppEntrypoint II Out: ptr to entrypoint address
);
OSModuleLoad
OSProcessProgHandle
Passes back the program handle for the process.
Returns the program instance number.
Fundlon Prototype U16 EXPORTEDO OSProcessProgHandle (
P_OS_PROG_HANDLE pProgHandle II Out: ptr to program handle
);
oSEnvSearch
Searches the environment for the specified variable and returns its value.
Returns STATUS.
Fundkm Prototype STATUS EXPORTEDO OSEnvSearch (
P_STRING pVariable, II variable name
P_STRING outBuf, II Out: Output buffer for variable value
SIZEOF bufLen II output buffer length
);
152 PEN POINT API REFERENCE
Part 8 / System Services
OSfaskNameSet
Sets a 4 character name for the given task.
Returns SfATUS.
STATUS EXPORTEOO OSTaskNameSet(
OS TASK 10 task1d, II task to name
PCHAR name II name of task
)i
OSThisApp
Passes back the application object stored with the current process.
Returns OBJECT.
Fi.$hdion Prototype OBJECT EXPORTEOO OSThisApp (void) ;
o SfaskApp
Passes back the application object for a given process.
Returns OBJECT.
Fundlon f»r©wofype OBJECT EXPORTEDO OSTaskApp (OS_TASK_10 task);
OSAppObjectPoke
Stores the application object for the current process.
Returns nothing.
Ftmdloft Prohstype void EXPORTEOO OSAppObjectPoke (
OBJECT object II current processes application object
);
o SPowerDown
Powers down the machine.
Returns nothing.
Fundlon Prototype void EXPORTEOO OSPowerOown (void);
o SErrorBeep
Outputs a tone based on the type of error encountered.
Returns nothing.
Fundlon f»rowofype void EXPORTEOO OSErrorBeep (
OS ERROR TYPE errorType II type of error
);
OSfone
Sends a tone for a given duration at the specified volume level.
Returns SfATUS.
STATUS EXPORTEDO OSTone(
U16 frequency, II in Hertz
U16 duration, II in milliseconds
U16 volumeLevel II 0 for off; 1 for on
);
OS.H 153
Functions
OSThisWinDev
Passes back the windowing device for this application.
Returns OBJECT. en
III
U
l
o SWinDevPoke
Stores the windowing device for the specified process.
Returns nothing.
fundion Prototype void EXPORTEDO OSWinDevPoke (
OS TASK 1D process, II owner of application
OBJECT winDev II Window device object
);
OSfaskProcess
Returns the process id for the task specified.
Returns OS_TASK_ID.
Fum:tion Prototype os TASK 1D EXPORTEDO OSTaskProcess (
OS TASK 1D task
);
OSfaskInstallTerminate
Notifies tasks waiting on OSProgramInstall that the instance is finished.
Returns nothing ..
fundicm Prototype void EXPORTEDO OSTask1nstallTerminate (
BOOLEAN wait
);
If the parameter is set the TRUE, then the caller will go into an infinite wait state in order to keep the
task and it's allocated resources alive.
OSMemlnfo
Returns information on memory usage for a specified task.
Returns STATUS.
Functloh Prototype STATUS EXPORTEDO OSMem1nfo (
S1ZEOF memBufSize, II size of the info buffer (in bytes)
P_OS_MEM_1NFO pMem1nfo II Out: info buffer
);
OSMemUselnfo
Returns information on memory usage for a specified t~sk.
Returns STATUS.
function Prototype STATUS EXPORTEDO OSMemUse1nfo (
S1ZEOF memBufSize, II size of the info buffer (in bytes)
P_OS_MEM_USE_1NFO pMem1nfo II Out: info buffer
);
154 PENPOINT API REFERENCE
Part 8 I System Services
OSMemAvailable
Return amount of swappable memory available (to caution zone).
Returns STATUS.
FU!'H::tion Prototype STATUS EXPORTEDO OSMemAvailable (
P U32 pAvailable
);
OSSystemlnfo
Passes back information on the system configuration.
Returns STATUS.
Flmdion Prototype STATUS EXPORTED OSSystemInfo
SIZEOF bufSize, II size of the info buffer (in bytes)
P_OS_SYSTEM_INFO pSystemInfo II Out: info buffer
);
osPrintBufferRoutine
Function variable print routine.
Returns nothing ..
Function Prototype extern void FunctionPtr (osPrintBufferRoutine) (P _CHAR pStr, SIZEOF len);
(cmm(tnts All debug out (Debugf, DPrintf, printf, etc) flows through this function.
GSMEAP.M
Introduction
Heaps allocate regions of virtual memory and manage the allocation and freeing of smaller blocks within
those regions.
Heaps have many different characteristics which are specified when the heap is created (see
OSHeapCreate). For example, heaps can be shared (i.e. put in the shared memory space) or local.
A heap is identified by a heap handle. PenPoint pre-defines two heap handles for each process, as
described below. OSHeapCreate also returns the handle of a new heap. Most heap routines take the
heap handle as a parameter to identify the heap.
Pre-defined Heaps
PenPoint pre-defines two heaps for every process. These heaps can be used without calling
OSHeapCreate.
osProcessHeapld is the handle for the pre-defined local heap in each process.
osProcessSharedHeapld is the handle for the shared heap. The shared heap behavior is the same as the
local heap except that the shared heap resides in shared memory. Blocks allocated from the shared heap
are accessible from any process.
Quick Start
Many clients call only the following functions, using one of the two pre-defined heaps.
• OSHeapBlockAlloc
• OSHeapBlockFree
Clients who need to create their own heaps also call the following functions:
• OSHeapCreate
• OSHeapDelete
Debugging Flags
Heap Manager debugging flag set is '*'. Defined flags are:
1: Validate heap before OSHeapBlockAlloc and before OSHeapBlockFree
2: Display message for each heap block allocate and free
4: Display message for each heap create and deletelO: Validate heap after OSHeapBlockAlloc and
after OSHeapBlockFree 20: Display messages about internal region operation (private)
'56 PENPOINT API REFERENCE
Part 8 I System Services
Memory Overhead
A heap consists of the memory allocated by the client plus the structures needed by the heap manager
itself to maintain the heap. This section describes the overhead imposed by these structures.
A heap is constructed as a collection of REGIONS. The overhead for a region is 36 bytes. By default,
regions are 16Kb long; however, a request larger than 16K causes the creation of a special region whose
,-J
Heap information
typedef struct OS_HEAP BLOCK INFO {
SIZEOF numBlocks; II total number of blocks
SIZEOF totalSize; II total f bytes in all blocks
SIZEOF minSize; II f bytes in smallest block
SIZEOF maxSize; II f bytes in largest block
OS HEAP BLOCK INFO, * P_OS_HEAP_BLOCK_INFO;
typedef struct OS_HEAP_INFO { II info on a given heap
OS_HEAP_BLOCK_INFO alloc; II info for allocated blocks
OS_HEAP_BLOCK_INFO free; II info for free blocks
U32 numRegions; II f regions in heap
U32 committedSize; II f bytes committed
U32 decommittedSize;11 f bytes decommitted
U32 reservedSize; II f bytes reserved
U32 numOwners; II f tasks which have heap open
OS HEAP MODE heapMode; II Mode used in heap creation
OS_HEAP_INFO, * P OS HEAP_INFO;
fdefine OSTaskSharedHeapld(t) ((OS_HEAP_ID)OSTaskProcess(t))
OSHEAP.H 157
Functions
Functions
OSHeapCreate
Creates a heap.
Returns SfATUS.
STATUS EXPORTED OSHeapCreate(
OS HEAP MODE mode, II heap create mode
S1ZEOF size, II initial region size
P OS HEAP 1D pHeap1d II Out: heap id
);
The size of the initial region allocated by the heap manager is a parameter to OSHeapCreate. If the
amount of memory required by the heap is more than the size of the initial region, the heap manager
allocates additional regions of 16K or the last request size, whichever is larger. An initial region size of 0
will default to 16K.
stsOSRequestTooBig The requested size is greater than maxS32.
stsOutOfMem The heap cannot be created because there is not enough memory available within the
system.
stsBadParam The mode parameter specified an illegal mode.
OSHeapDelete
OSHeapDelete
Deletes a heap. Frees all memory allocated by clients and by the heap manager.
Returns SfATUS.
Function PmrotypB STATUS EXPORTED OSHeapDelete (
OS HEAP 1D heap1d II heap id of heap to delete
);
OSHeapAllowError
Changes the" out of memory" behavior of heap block allocation.
Returns OS_HEAP_ID.
tdefine OSHeapAllowError(heap) \
((OS HEAP 1D) ((U32) (heap) losHeap1dOutOfMemErrOKBit))
tdefine osHeap1dOutOfMemErrOKBit flagO
Normally when a heap block is requested, the heap manager returns only when the memory is available.
Calling OSHeapAllowError changes the heap so that if the system has insufficient memory the heap
manager returns immediately with stsOutOfMem.
158 PENPOINT API REFERENCE
Part 8 / System Services
OSHeapClear
Clears a heap. Deletes all the allocated heap blocks but not the heap.
Returns STATUS.
Function Prototype STATUS EXPORTED OSHeapClear (
OS_HEAP_ID heapld II heap id of heap to clear
);
OSHeapBlockAlloc
Allocates a block within the heap.
Returns STATUS.
Fum:tion Prototype STATUS EXPORTED OSHeapBlockAlloc (
OS HEAP ID heapld, II heap id
SIZEOF - size, II size of block to allocate
PP UNKNOWN ppHeapBlock II Out: pointer to new heap block
);
The memory for the heap block is obtained from the list of regions in the heap. If a heap allocate
request is larger than the available space in the region, a new region is allocated for the request.
The newly allocated block is at least as large as the requested length. Sometimes, the heap manager
allocates a block larger than the requested size. Heap blocks are always allocated on 32-bit boundaries.
Heap blocks are allocated on behalf of the creator of the heap. Even if the allocate occurs in a different
task than the creator, the new memory is owned by the creator of the heap.
WARNING. This function expects a valid heap identifier. Using an invalid heap identifer can cause
unpredictable results (including a page fault). A heapld for a heap that has been deleted is considered to
be invalid.
OS HeapBlockFree
stsOSRequestTooBig The requested block size greater than maxS32.
stsOutOfMem The heap cannot grow any bigger because the system is out of memory.
stsOSlnvalidHeapld The heapld given is invalid.
stsOSHeaplntegrityError The heap has been corrupted (heap flag 1).
OSHeapBlockFree
Frees a heap block.
Returns STATUS.
function Prototype STATUS EXPORTED OSHeapBlockFree (
P_UNKNOWN pHeapBlock II pointer to heap block
);
WARNING. This function expects a valid heap block. Using an invalid heap block can cause
unpredictable results (including a page fault).
OSHEAP.H 159
Functions
OSHeapBlockAlloc
stsOSlnvalidHeapld The heapld given is invalid.
stsOSHeaplntegrityError The heap has been corrupted (heap flag 1) or heap block pointer is bad
(debug only).
stsBadParam The heap block pointer is bad (debug only).
OSHeapBlockResize
Resizes a heap block.
Returns SfATUS.
Function Prototype STATUS EXPORTED OSHeapBlockResize (
SIZEOF newSize, II new size to allocate
PP_UNKNOWN ppHeapBlock II Out: New pointer is returned here.
);
The heap block is resized to the new size. This may be slightly faster than allocating a new block and
copying the original block)s contents.
After the call the heap block may be identified with a new pointer value) which is returned in
*pp Heap Block.
The actual size of the new heap block may be slightly larger than the request.
WARNING. This function expects a valid heap block. Using an invalid heap block can cause
unpredictable results (including a page fault).
OSHeapld
Passes back the heap id from which a heap block has been allocated.
Returns OS_HEAP_ID.
fum::tion Prototype OS_HEAP_ ID EXPORTED OSHeapId (
P_UNKNOWN pHeapBlock II pointer to a heap block
);
WARNING. This function expects a valid heap block. Using an invalid heap block can cause
unpredictable results (including a page fault).
OSHeapBlockSize
Passes back the size of the heap block.
Returns SfATUS.
Function Prototype STATUS EXPORTED OSHeapBlockSize (
P_UNKNOWN pHeapBlock, II pointer to the heap block
P SIZEOF pSize II Out: size of the heap block
);
Comments The size returned is the actual size of the heap block. This may be slightly larger than the requested size.
WARNING. This function expects a valid heap block. Using an invalid heap block can cause
unpredictable results (including a page fault).
OSHeapBlockAlloc
160 PENPOINT API REFERENCE
Part 8 / System Services
OSHeapPoke
Stores 32 bits of client info in the heap header.
Returns STATUS.
FlInction Prototyp~ STATUS EXPORTED OSHeapPoke (
OS_HEAP_ID heapId, II heap id
P UNKNOWN info II uninterpreted pointer stored in heap header
);
OSHeapPeek
Passes back the client info previously set via OSHeapPokeO.
Returns STATUS.
Function Prototype STATUS EXPORTED OSHeapPeek (
OS_HEAP_ID heapId, II heap id
PP_UNKNOWN pInfo II Out: pointer stored by OSHeapPoke
);
WARNING. This function expects a valid heap identifier. Using an invalid heap identifer can cause
unpredictable results (including a page fault). A heapId for a heap that has been deleted is considered to
be invalid.
OSHeaplnfo
Passes back information on a heap.
Returns STATUS.
Function Prototype STATUS EXPORTED OSHeapInfo (
OS_HEAP_ID heapId, II heap id
SIZEOF heapInfoSize, II size of heap info buffer
P OS HEAP INFO pHeapInfo II Out: heap info buffer
);
OSHeapOpen
Adds the specified task as an owner of the specified heap.
Returns STATUS.
FlInctlon Prototype STATUS EXPORTED OSHeapOpen (
OS_HEAP_ID heapId, II heap id
OS TASK ID taskId II task to add as an owner
);
OSHEAP.H 161
Functions
Heaps are owned by the task that creates them. When the task is destroyed the heap is automatically
destroyed. If one task wants to access another task's heap, the heap should be opened. Opening a heap is
not required, but if the task owning the heap is destroyed while the second task is accessing the heap, the
second task will fault.
Memory resources allocated in the heap are not actually destroyed until the last owner of the heap
deletes the heap. Note that if the heap is opened multiple times by the same owner, a corresponding
OSHeapClose or OSHeapDelete must occur for each before resources are deallocated.
The kernel automatically destroys heap resources when all of the owners of the heap have terminated.
The heap is automatically opened on the behalf of the creator during an OSHeapCreate.
stsOSlnvalidHeapld The heap must be a shared heap to be opened, the heapld was invalid or
inaccessible.
OSHeapCreate
OSHeapClose
Remove the specifed task as an owner of the specified heap.
Returns SfATUS.
fundion Pn:t1©?yf.'v;) STATUS EXPORTED OSHeapClose (
OS_HEAP_ID heapId, II heap id
OS TASK ID taskId II task to remove as an owner
);
When the heap has been closed by the last owner, the heap is automatically deleted.
stsOSlnvalidHeapld The heapld was invalid or inaccessible.
OSHeapClose
OSHeapEnumerate
Enumerates all the heaps in the given process.
Returns SfATUS.
ftJrldt©n Prototype typedef STATUS FunctionPtr (P_OS_HEAP _ENUMERATE)
OS HEAP_ID heapId, II next heap
OS HEAP MODE heapMode, II mode of heap
P UNKNOWN clientData II client data of OSHeapEnumerate
);
For each heap in the current process, OSHeapEnumerate calls the supplied callback procedure. This
routine is supplied with a heapld and its mode.
OSHeapEnumerate continues until it has exhausted all the heaps in the current process or the callback
routine returns an error status. If the callback procedure returns an error status, processing is terminated
and the error status is returned to the caller of OSHeapEnumerate.
stsOSlnvalidHeapld The heapld was invalid or inaccessible.
OS HeapWalk
162 PEN POINT API REFERENCE
Part 8 / System Services
OSHeapWalk
Traverses the given heap.
Returns STATUS.
typedef struct OS_HEAP_WALK_INFO {
P_UNKNOWN pBlock; II address of heap block
U32 size; II size of block
BOOLEAN inUse; /1 true if the block is allocated
P UNKNOWN clientData; II set to the client data of OSHeapWalk
17 The following fields are only supported by a debugging version of
II PenPoint's kernel. Changing their value modifies the heap block.
BOOLEAN marked; II true if the block was marked w/OSHeapMark
OS_TASK_ID owner; 11'last task to allocate or free this block
P UNKNOWN caller; II address of the last OSHeapBlockAlloc/Free
OS HEAP WALK_INFO, * P_OS_HEAP_WALK_INFO;
typedef STATUS Functionptr(P_OS_HEAP_WALK) (P_OS_HEAP_WALK_INFO pInfo);
Function Profotyp;;, STATUS EXPORTED OSHeapWalk (
OS_HEAP_ID heapId, II heap to walk
P OS HEAP_WALK pWalkProc, II procedure to call for each heap block
P UNKNOWN clientData II passed directly to pWalkProc
);
For each allocated block in the given heap, calls the supplied callback routine, providing the address and
size of the block. OSHeapWalk continues until it has exhausted all allocated blocks in the heap or the
callback routine returns an error status. If the callback procedure returns an error status, processing is
terminated and the error status is immediately returned to the caller of OS HeapWalk.
stsOSlnvalidHeapld The heapld was invalid or inaccessible.
OSHeapEnum.erate
OSHeapMark
Marks all the allocated blocks in given heap.
Returns STATUS.
Fundinn Pn:jfolype STATUS EXPORTED OSHeapMark (
OS_HEAP_ID heapId II heap to mark
);
Combining OSHeapMark with OSHeapWalk provides a simple means to track down storage leaks. For
example:
II Program is in a known state
OSHeapMark(myHeap);
OSHeapPrint
Prints debugging info about the given heap.
Returns SfATUS. en
....
u
typedef enum OS_HEAP_PRINT_FLAGS ~
osHeapSuppressFree = flagO, II Don't print the free blocks
osHeapSuppressInUse = flagl, II Don't print the allocated blocks
osHeapSuppressMarked =
osHeapSuppressUnmarked =
osHeapSuppressSummary =
osHeapDisplayRegions =
osHeapPrintAll =
osHeapPrintSummaryOnly
flag2, II Don't print the marked blocks
flag3, II Don't print the unmarked blocks
flag4, II Don't print the heap summary
flagS, II Print regions in heap
0, II Display summary and all blocks
II Display summary
osHeapSuppressFreeI osHeapSuppressInUseI
l
osHeapSuppressMarkedlosHeapSuppressUnmarked,
II Show blocks created since the last call to OSHeapMark
osHeapPrintActiveBlocks = osHeapSuppressFreelosHeapSuppressMarked
OS_HEAP_PRINT_FLAGSi
STATUS EXPORTED OSHeapPrint(OS_HEAP_ID heapId, OS_HEAP_PRINT_FLAGS suppress);
OSHeapPrint is only available in a debugging version of the PenPoint kernel. This request is not
supported in production versions of Penpoint.
OSHeapPrint assumes the heap is not corrupted; in other words, OSHeapPrint does not duplicate any
of the integrity tests done by OSHeaplnfo.
stsOSlnvalidHeapld The heapld was invalid or inaccessible.
Flags for OSHeapPrint
OSPRIY.H
This include file describes the prototypes for supervisor privilege PenPointroutines. The functions
described in this file are contained in PENPOINf.LIB.
#ifndef OSPRIV_INCLUDED
#define OSPRIV_INCLUDED
#ifndef OS_INCLUDED
#include <os.h>
#endif
Functions
OSIntMask
Sets the interrupt mask for a given interrupt.
Returns STATUS.
ftmdio!1 Pnstotype STATUS EXPORTED OSIntMask (
OS_INTERRUPT_ID intNum, II logical interrupt id
P_BOOLEAN pEnable II In-Out: TRUE = enable, returns old mask
);
Note: OR in the flag osIntNumIsHardwareLevel if intNum is a hardware interrupt level (vs a MIL
logical device id). The flag is defined in ostypes.h.
Warning!!! Supervisor privilege only.
166 PENPOINT API REFERENCE
Part 8 / System Services
OSIntEOI
Send an EOI request to the interrupt controller device.
Returns SfATUS.
fwm:rlon Proto1yp~ STATUS EXPORTED OSIntEOI (
OS INTERRUPT ID intNum
- - II MIL device id or hw interrupt level
);
C©mm~t1ts Note: OR in the flag osIntNumIsHardwareLevel if intNum is a hardware interrupt level (vs a MIL
logical device id). The flag is defined in ostypes.h.
Warning!!! Supervisor privilege only.
OSProgramRegionlnfo
Passes back region information for the debugger.
Returns SfATUS.
fwndlon PrZtfZtwypc STATUS EXPORTED OSProgramRegionInfo (
OS_PROG_HANDLE progHandle, II program handle
P U32 pNRegions, II Out: number of regions
P_OS_PROGRAM_REG I ON_INFO pRI II Out: region information
);
OSSysSemaRequest
Requests access to a system semaphore.
Returns SfATUS.
f\Hldlon PrZth'j1yp{~ STATUS EXPORTED OSSysSemaRequest
OS_SEMA_ID serna II the semaphore to lock
);
CZtmments System semaphores are regular semaphores with a little more protection. If a task owns a system
semaphore, then that task cannot be terminated or suspended by another task until the system
semaphore is relinquished. With this feature, tasks can be sure that any system critical data structures
will be completely updated.
If the task terminates itself while it owns a system semaphore, then the next task that acquires the system
semaphore will get the warning stsOSSemaLockBroken.
OSSysSemaClear should be used to relinquish the system semaphore. The function OSSemaCreate is
used to create the system semaphore. Any semaphore can become a system semaphore simply by calling
this routine. System semaphores are only used for critical section management. Do NOT use system
semaphores for event handling.
Like regular semaphores, system semaphores are counting semaphores.
Warning!!! Supervisor privilege only.
stsOSSemaLockBroken Previous locker of semaphore died without dearing the semaphore
OSSemaCreate
OSPRIV.H 167
Functions
OSSysSemaClear
Releases access to the the system semaphore.
Returns STATUS.
Fund-iort Pr©t©type STATUS EXPORTED OSSysSemaClear
OS_SEMA_1D serna II the semaphore to unlock
);
Comments System semaphores are regular semaphores with a little more protection. If a task owns a system
semaphore, then that task cannot be terminated or suspended by another task until the system
semaphore is relinquished. With this feature, tasks can be sure that any system critical data structures
will be completely updated.
If the task terminates itself while it owns a system semaphore, then the next task that acquires the system
semaphore will get the warning stsOSSemaLockBroken.
OSSysSemaClear should be used to relinquish the system semaphore. The function OSSemaCreate is
used to create the system semaphore. Any semaphore can become a system semaphore simply by calling
OSSysSemaRequestl OSSysSemaClear. System semaphores are only used for critical section
management. Do NOT use system semaphores for event handling.
Like regular semaphores, system semaphores are counting semaphores.
Warning!!! Supervisor privilege only.
OSSysSemaRequest
OSSupervisorCall
Performs a privilege transition to supervisor privilege.
Returns U32.
*if defined( __WATCOMC__ ) && defined( __386__ )
*pragma aux OSSupervisorCall parm [eax] [edx] [ecx] modify [gs];
fUlldloo Prelolype U32 __far OSSupervisorCall (
P_UNKNOWN pFunction,
P UNKNOWN pStackParms,
U32 nStackParms
);
*endif
The function passed into the routine will be called by OSSupervisorCall in supervisor privilege. This
function will check to verify that the routine passed in is actually a supervisor level routine.
OSSupervisorCall will work correctly if called in supervisor level.
OSfaskAddresslnfo
Passes back task and system memory information.
Returns STATUS.
fund-lor'! Prototype STATUS EXPORTED OSTaskAddress1nfo
P MEM pAddr, II memory address
OS TASK 1D owne·r, II owner of address
S1ZEOF statBufSize, II size of info buffer (in bytes)
P_OS_ADDRESS_1NFO pAddr1nfo II Out: info buffer
);
OSResourcesAvailable
Returns info on the available resources in the system.
Returns STATUS.
STATUS EXPORTEDO OSResourcesAvailable
SIZEOF bufSize, II size of the info buffer (in bytes)
P OS RESOURCES INFO pInfo II Out: info buffer
) i
OSMemMapA1loc
Allocates linear memory for memory mapped hardware
Returns STATUS.
STATUS EXPORTED OSMemMapAlloc
U32 physAddr, II address of memory mapped area
U32 length, II length of memory to allocate
PP MEM ppMem II Out: return ptr to the memory
)i
Creates a guard page after the memory. The memory is created with the attributes: read/write data,
system privilege, owned by systemTId.
Note: the physical address passed in physAddr must be within the first 16MB ofphysical memory.
Warning!!! Supervisor privilege only.
OSMemMapFree
Frees memory which was allocated by OSMemMapAlloc
Returns STATUS.
Prol'otype STATUS EXPORTED OSMemMapFree
P MEM pMem II ptr to memory to free
) i
OSDMAMemAlloc
Allocates linear memory that is DMA-able
Returns STATUS.
STATUS EXPORTED OSDMAMemAlloc
U32 length, II length of memory to allocate
OS TASK 1D owner, II owning task id.
PP MEM ppMem II Out: return ptr to the memory
);
Comments Creates a guard page after the memory. The memory is created with the following attributes:
read/write access
supervisor privilege
Not swappable (every page locked).
All pages are mapped in and are physically contiguous in memory. For machines that have DMA
boundary conditions (e.g. can't cross 64k physical boundary), the memory allocated in this region is
guaranteed to honor those conditions. Memory will be allocated on system page size boundaries and all
allocations will be a minimum of the processor page size.
Warning!!! Supervisor privilege only.
OSDMAMennFree
Frees memory which was allocated by OSDMAMemAlioc
Returns STATUS.
STATUS EXPORTED OSDMAMemFree
P MEM pMem, II ptr to memory to free
OS TASK 1D owner II owning task id.
);
OSfaskMennInfo
Provides memory info for the system.
Returns STATUS.
fUfv::1ion Prototype' STATUS EXPORTED OSTaskMem1nfo
OS TASK 1D task1d, II info will be returned for task id
S1ZEOF memBufSize, II size of the info buffer (in bytes)
P_OS_MEM_1NFO pMem1nfo II Out: info buffer
);
OSVirtToPhys
Translates a virtual address into a physical address.
Returns U32.
Fundion Prototype U32 EXPORTED OSVirtToPhys
P_UNKNOWN pMem II virtual address
);
OSMemLock
Locks pages in memory.
Returns SfATUS.
STATUS EXPORTED OSMemLock (
P MEM pMem, II pointer to memory
SIZEOF length II length in bytes of memory to lock
);
Locked pages will not be paged out of the system. If the page is paged out before this call, then the page
will be brought into memory and then locked.
A counter is maintained to keep track of multiple locks on a given page.
Warning!!! Supervisor privilege only.
OSMemUnlock
Unlocks pages in memory.
Returns SfATUS.
STATUS EXPORTED OSMemUnlock
P MEM pMem, II pointer to memory
SIZEOF length II length in bytes of memory to unlock
);
When the page is unlocked, it may be paged out by the memory manager.
A counter is maintained to keep track of multiple locks on a given page. When the counter goes to 0
then the page will be unlocked.
Warning!!! Supervisor privilege only.
OSTYPES.H
Module Description: This include file describes types for the Penpoint kernel.
#ifndef OSTYPES_INCLUDED
#define OSTYPES_INCLUDED
#ifndef GO INCLUDED
#include <go.h>
#endif
Defines
• Status values: errors
#define stsOSBadPointer MakeStatus(clsOS, 1)
#define stsOSOutOfMem stsOutOfMem
#define stsOSNoMoreOwners MakeStatus(clsOS, 3)
#define stsOSlnvalidPath MakeStatus(clsOS, 4)
#define stsOSNoSemaExists MakeStatus(clsOS, 5)
#define stsOSTimeOut MakeStatus(clsOS, 6)
#define stsOSSemaReset MakeStatus(clsOS, 7)
#define stsOSAliasesExist MakeStatus(clsOS, 8)
#define stsOSInvalidOperationForTask MakeStatus(clsOS, 9)
#define stsOSInvalidTaskld MakeStatus(clsOS, 10)
#define stsOSTransactionInvalid MakeStatus(clsOS, 11)
#define stsOSRequestTooBig MakeStatus(clsOS, 12)
#define stsOSHeapIntegrityError MakeStatus(clsOS, 13)
#define stsOSInvalidHeapId MakeStatus(clsOS, 14)
#define stsOSSegmentDiscarded MakeStatus(clsOS, 16)
#define stsOSFlashEraseFailure MakeStatus(clsOS, 17)
#define stsOSFlashProgramFailure MakeStatus(clsOS, 18)
#define stsOSBadExeFormat MakeStatus(clsOS, 19)
#define stsOSInstallInternalError MakeStatus(clsOS, 20)
#define stsOSMissingEntryName MakeStatus(clsOS, 21)
#define stsOSMissingEntryOrdinal MakeStatus(clsOS, 22)
#define stsOSInitiateInternalError MakeStatus(clsOS, 23)
#define stsOSInitia~eStackOverflow MakeStatus(clsOS, 24)
#define stsOSProglnstallError MakeStatus(clsOS, 25)
#define stsOSTooManySelectors MakeStatus(clsOS, 26)
#define stsOSTooManyInstances MakeStatus(clsOS, 27)
#define stsOSDependenciesExist MakeStatus(clsOS, 28)
#define stsOSTooManyRequireds MakeStatus(clsOS, 29)
#define stsOSPathTooLong MakeStatus(clsOS, 30)
#define stsOSModuleNotFound MakeStatus(clsOS, 31)
#define stsOSBadDLCFormat MakeStatus(clsOS, 32)
#define stsOSMissingDependency MakeStatus(clsOS, 33)
#define stsOSInvalidProgramHandle MakeStatus(clsOS, 34)
#define stsOSHeapOpen MakeStatus(clsOS, 35)
#define stsOSHeapNotOpen MakeStatus(clsOS, 36)
• Status values: warnings
#define stsOSSemaLockBroken MakeWarning(clsOS, 1)
'72 PENPOINT API REFERENCE
Part 8 / System Services
• Misc defines
#define osNullTaskld ((OS_TASK_ID)NULL)
#define osNullOpenSema ( (OS_SEMA_ID) NULL)
#define osInvalidHandle ((OS_HANDLE)NULL)
#define osInfiniteTime OxFFFFFFFF
#define maxModNameLength 32
• Well known heap ids
#define osInvalidHeapld ((OS_HEAP_ID) 0)
#define osProcessHeapld ((OS_HEAP_ID)&OSProcessHeapValue)
#define osProcessSharedHeapld ((OS_HEAP_ID)OSThisProcess(»
• Filters
#define osAnyITMessage OxFFFFFFFF
#define osStartupCommandLineFilter flagO
#define osCIsmgrSend flagO
#define osCIsmgrReply flag1
#define osMILFilter flag2
#define osAppSend flag3
#define osAppReply flag4
#define osTestManagerFilter flag5
#define osCIsmgrPost flag6
#define osInstallWaitingFilter flag30
#define osTerminatedTaskFilter flag31
NOTE: flag25 - flag29 reserved for users
#define userDefinedFilters (flag25 Iflag26 I flag27 Iflag28 Iflag29)
#define objSendFilter ((OS_ITMSG_FILTER)osCIsmgrSend)
#define objReplyFilter ((OS_ITMSG_FILTER)osCIsmgrReply)
Used to treat the intNum field as a hardware interrupt level (vs a MIL logical device id) in the routines
OSSetInterrupt, OSIntMask and OSIntEOI.
#define osIntNumIsHardwareLevel flag15
Typedefs
t ypedef P_UNKNOWN P_MEM; II Pointer to memory
typedef U32 OS_HANDLE; II Handle to an object
typedef U16 OS_TASK_ID; II Task Id
typedef OS_HANDLE OS_SEMA_ID; II Open semaphore Id
typedef P_UNKNOWN OS_PROG_HANDLE; II Loaded program handle
typedef OS_HANDLE OS_ITMSG_ID; II message identifier
typedef U32 OS_ITMSG_FILTER; II Inter-task msg filter
typedef U16 OS_INTERRUPT_ID; II logical interrupt ID
typedef U32 OS_MILLISECONDS; II number of milliseconds
typedef U32 OS_TASK_ERROR;
typedef P_MEM* PP_MEM;
typedef OS_HANDLE* P_OS_HANDLE;
typedef OS_TASK_ID* P_OS_TASK_ID;
typedef OS_SEMA_ID* P_OS_SEMA_ID;
typedef OS_PROG_HANDLE* P_OS_PROG_HANDLE;
typedef OS_ITMSG_ID* P_OS_ITMSG_ID;
typedef OS_ITMSG_FILTER* P_OS_ITMSG_FILTER;
typedef OS_TASK_ERROR* P_OS_TASK_ERROR;
typedef P_UNKNOWN OS_HEAP_ID, * P_OS_HEAP_ID;
typedef enum OS_TASK_MODE
osThisTaskOnly, II "act" on this task only
osTaskFamily, II "act" on all tasks in the task family
osAIITasks II "act" on all tasks in the system
OS_TASK_MODE, * P_OS_TASK_MODE;
OSTYPES.H 173
Public Functions
Public Functions
OSThisProcess
Passes back the task id of this tasks process.
Returns OS_TASK_ID.
function Prototype OS TASK ID EXPORTEDO OSThisProcess (void) i
Note: This function is defined here (instead of in os.h) to satisfy the definition for
osProcessSharedHeapld above.
sORT.H
Public Functions
quicksort
Sorts a linked list of records using the" quicksort" algorithm.
Returns pointer.
extern void ** quicksort (void **head, int (*comp) (void **, void **));
Usage:
struct record *head;
int comp (struct record *p, struct record *q);
~sg1ri~erllegister
Registers a request for notification.
Takes P _TIMER_REGISTER_INFO, returns STATUS.
#define msgTimerRegister MakeMsg(clsTimer, 1)
typedef struct TIMER_REGISTER_INFO
OBJECT client; II client object to notify
OS MILLISECONDS time; II waiting period before msg is sent
P UNKNOWN clientData; II Uninterpreted client data
OS HANDLE transactionHandle; II Out: transaction handle
TIMER REGISTER_INFO, * P_TIMER_REGISTER_INFO;
Sent by the client to the timer object for notification after a specified time period has elapsed. At that
time, msgTimerNotify will be sent (via ObjectPost) to the client. See that message for details.
When the machine is turned off, the time period will stop counting down until the machine is turned
back on.
To stop the timeout message, use msgTimerStop.
The use of ObjectPost to send the msgTimerNotify message means that it will be synchronous with
input events.
stsBadObject The client field cannot be a local object.
178 PENPOINT API REFERENCE
Part 8 / System Services
nnsg1finnerltegisterl\sY11c
Registers a request for notification.
Takes P_TIMER_REGISTER_INFO, returns STATUS.
#define msgTimerRegisterAsync MakeMsg(clsTimer, 9)
typedef struct TIMER_REGISTER_INFO
OBJECT client; I I client object to notify
OS MILLISECONDS time; II waiting period before msg is sent
P UNKNOWN clientData; II Uninterpreted client data
OS_HANDLE transactionHandl~; II Out: transaction handle
TIMER_REGISTER_INFO, * P_TIMER_REGISTER_INFO;
Sent by the client to the timer object for notification after a specified time period has elapsed. At that
time, msgTimerNotify will be sent (via ObjectPostAsync) to the client. See that message for details.
When the machine is turned off, the time period will stop counting down until the machine is turned
back on.
To stop the timeout message, use msgTimerStop.
The use of ObjectPostAsync to send the msgTimerNotify message means that it will NOT be
synchronous with input events.
nnsg1finnerltegisterI>irect
Registers a request for notification.
Takes P_ TIMER_REGISTER_INFO, returns STATUS.
#define msgTimerRegisterDirect MakeMsg(clsTimer, 12)
typedef struct TIMER_REGISTER_INFO
OBJECT client; II client object to notify
OS MILLISECONDS time; II waiting period before msg is sent
P UNKNOWN clientData; II Uninterpreted client data
OS HANDLE transactionHandle; II Out: transaction handle
TIMER REGISTER_INFO, * P_TIMER_REGISTER_INFO;
Sent by the client to the timer object for notification after a specifi~d time period has elapsed. At that
time, msgTimerNotify will be sent (via ObjectPostDirect) to the client. See that message for details.
When the machine is turned off, the time period will stop counting down until the machine is turned
back on.
To stop the timeout message, use msgTimerStop.
The use of ObjectPostDirect to send the msgTimerNotify message means that it will NOT be
synchronous with input events.
nnsg1finnerltegisterInterval
Registers a request for interval notification.
Takes P_TIMER_INTERVAL_INFO, returns STATUS.
#define msgTimerRegisterInterval MakeMsg(clsTimer, 2)
typedef struct TIMER_INTERVAL_INFO
OBJECT client; II client object to notify
OS MILLISECONDS interval; II waiting interval before msg is sent
P UNKNOWN clientData; II Uninterpreted client data
OS HANDLE transactionHandle; II ~ut: transaction handle
TIMER INTERVAL_INFO, * P_TIMER_INTERVAL_INFO;
TIMER.H 179
Class Timer Messages
Sent by the client to the timer for a notification message on a specified time interval. After each time
interval, msgTimerNotify will be posted (via ObjectPost) to the client.
When the machine is turned off, the time period will stop counting down until the machine is turned
back on.
To stop the interval messages, use msgTimerStop.
The use of ObjectPost to send the msgTimerNotify message means that it will be synchronous with
input events.
stsBadObject The client field cannot be a local object.
msgTimerStop
Stops a timer transaction.
Takes OS_HANDLE, returns STATUS.
#define msgTimerStop MakeMsg(clsTimer, 11)
msgTimerTransactionValid
Determines if a timer transaction is valid.
Takes OS_HANDLE, returns STATUS.
#define msgTimerTransactionValid MakeMsg(clsTimer, 10)
msgTimerNotify
Notifies the client that the timer request has elapsed.
Takes P_TIMER_NOTIFY, returns nothing. Category: advisory message.
#define msgTimerNotify MakeMsg(clsTimer, 3)
typedef struct TIMER_NOTIFY
P_UNKNOWN clientData; II client data returned
OS_HANDLE transactionHandle; II transaction handle
TIMER_NOTIFY, * P_TIMER_NOTIFY;
Sent by the timer object to the client.
msgTimerAlarmRegister
Registers a request for alarm notification.
Takes P_ TIMER_ALARM_INFO, returns STATUS.
#define msgTimerAlarmRegister MakeMsg(clsTimer, 5)
Enum16 (TIMER_ALARM_MODE)
timerAbsoluteDate, II alarm only on specified date and time
timerEveryWeek, II alarm when dayOfWeek, hours, minutes match
timerEveryDay II alarm when hours and minutes match
};
typedef struct TIMER ALARM INFO
OBJECT client; II client object to notify
OS DATE TIME alarmTime; II alarm time
P UNKNOWN clientData; II Uninterpreted client data
OS HANDLE transactionHandle; II Out: transaction handle
TIMER ALARM MODE alarmMode;
TIMER_ALARM_INFO, * P_TIMER_ALARM_INFO;
Alarms differ from timer requests in that a time and date specifies when an alarm is to occur. The timer
will ObjectPost msgTimerAlarmNotify to the client when the alarm goes off. See that message for
details.
Alarms will alarm within a minute of the alarm time.
When the machine is turned off, the alarm is still active. An alarm will turn the machine on.
To stop the alarm, use the message msgTimerAlarmStop.
stsBadObject The client field cannot be a local object.
msgTimerAlarmStop
Stops a pending alarm request.
Takes OS_HANDLE, returns STATUS.
tdefine msgTimerAlarmStop MakeMsg(clsTimer, 6)
msgTimerAlarmNotify
Notifies the client that the alarm request has elapsed.
Takes P_ALARM_NOTIFY, returns nothing. Category: advisory message.
tdefine msgTimerAlarmNotify MakeMsg(clsTimer, 7)
typedef struct ALARM_NOTIFY
P_UNKNOWN clientDatai II client data returned
OS_HANDLE transactionHandlei II transaction handle
BOOLEAN alarmCausedPoweroni II power up occurred due to alarm
ALARM_NOTIFY, * P_ALARM_NOTIFYi
Sent by the timer object to the client.
Part 9 /
Utility Classes
BKSHELF.H
msgNew
Creates a new bookshelf viewer.
Takes P_BOOKSHELF_NEW, returns STATUS. Category: class message.
typedef struct BOOKSHELF_NEW_ONLY
BOOKSHELF METRICS metrics; II Initial metrics setting.
OBJECT rootDH; II Dir handle of volume for this bkshelf.
OBJECT win; II Window for move/copy.
U32 reserved1;
U32 reserved2;
BOOKSHELF_NEW_ONLY, *P_BOOKSHELF_NEW_ONLY;
#define bookshelfNewFields \
iconWinNewFields \
BOOKSHELF NEW ONLY bookshelf;
typedef struct BOOKSHELF_NEW {
bookshelfNewFields
} BOOKSHELF_NEW, *P_BOOKSHELF_NEW;
msgBookshelfGetMetrics
Gets current metrics setting.
Takes P_BOOKSHELF_METRICS, returns STATUS.
#define msgBookshelfGetMetrics MakeMsg(clsDVBookshelf, 1)
typedef struct BOOKSHELF METRICS
U32 spare1; II Spare: reserved.
U32 spare2; II Spare: reserved.
BOOKSHELF_METRICS, *P_BOOKSHELF_METRICS;
..
~~------- ---~----
184 PENPOINT API REFERENCE
Part 9 I Utility Classes
msgBookshelfSetMetrics
Sets current metrics setting.
Takes P_BOOKSHELF_METRICS, returns STATUS.
fdefine msgBookshelfSetMetrics MakeMsg(clsDVBookshelf, 2)
h'h?'ss0~e typedef struct BOOKSHELF METRICS
Arguments U32 spare1; II Spare: reserved.
U32 spare2; II Spare: reserved.
BOOKSHELF_METRICS, *P_BOOKSHELF_METRICS;
Miscellaneous
II "_- Empty __ " label tag
fdefine tagBookshelfEmpty MakeTag(clsDVBookshelf, 1)
fdefine hlpBKBookshelfEmpty MakeTag(clsDVBookshelf, 100)
BROWSER.M
Move/Copy Conventions
See embedwin.h for move/copy protocol.
When the source of a move/copy, the browser responds to msgXferGetList with:
XferName can xfer the name of the selection
XferF ullPathN arne can xfer the full path name of the selection
XferFlatLocator can xfer the flat locator of the selection
clsFileSystem can xfer as a file or directory
clsEmbeddedWin can xfer as "live" data notebook, section, or document
clsExport If source is TOC and export mode is in effect then do export instead of copy. (see export.h
for details)
If the destination is the disk and the xferList contains clsExport then do export instead of move/copy.
If not an export, and the xferList contains clsEmbeddedWin then let the embedded win superclass will
handle the move/copy.
If the destination is the TOC and source is not a clsEmbeddedWin then invoke the import code.
Otherwise, if the source is clsFileSystem do a file system move or copy.
#ifndef BROWSER INCLUDED
#define BROWSER INCLUDED
#ifndef GO INCLUDED
#include <go.h>
#endif
'86 PENPOINT API REFERENCE
Part 9 / Utility Classes
iifndef UID_INCLUDED
iinclude <uid.h>
iendif
iifndef CLSMGR INCLUDED
iinclude <clsrngr.h>
iendif
iifndef FRAME INCLUDED
iinclude <frarne.h>
iendif
iifndef FS INCLUDED
iinclude <fs.h>
iendif
iifndef RESFILE INCLUDED
iinclude <resfile.h>
iendif
iifndef SWIN INCLUDED
iinclude <swin.h>
iendif
Sort Types
Defines the order the browser will sort display items by.
Enurn16 ( SORT_BY ) {
browserSortByNarne 1,
browserSortBySize 2,
browserSortByDate 3,
browserSortByPage 4,
browserSortByType 5
};
Messages
msgNewDefaults:
Initializes the BROWSER_NEW structure to default values.
Takes P_BROWSER_NEW, returns STATUS. Category: class message.
Zeros out pNew->browser.
msgNew:
Creates a new browser object.
Takes P_BROWSER_NEW, returns STATUS. Category: class message.
typedef struct BROWSER NEW ONLY {
FS LOCATOR base; - - II Points to where the browser will display.
- II Note: This UlD must not be an absolute path!
OBJECT client; II UlD of client.
U16 tocView; II TRUE for TOC view, FALSE for disk view.
U8 spare[8];
BROWSER_NEW_ONLY, *P_BROWSER_NEW_ONLY;
tdefine browserNewFields \
scrollWinNewFields \
BROWSER NEW ONLY browser;
typedef struct BROWSER NEW {
browserNewFields -
} BROWSER_NEW, *P_BROWSER_NEW;
Comments Creates a browser which will display the file system within the specified base directory. If the browser
will be looking at "live" notebook sections and documents set tocView to true; If the browser will be
looking at "dead" directories, files, or documents and sections on disk then set tocView to false.
msgBrowserCreateDir
Creates a directory at the selection.
Takes nothing, returns STATUS.
tdefine msgBrowserCreateDir MakeMsg(clsBrowser, 1)
Comments If nothing is selected, this message creates a directory at the top level of the disk. DskView message only.
Usually sent from menu.
188 PEN POINT API REFERENCE
Part 9 I Utility Classes
msgBrowserByName
Sorts by name order.
Takes nothing, returns SfATUS.
fdefine msgBrowserByName MakeMsg(clsBrowser, 2)
Displays all displayed items sorted by name order. Usually sent from menu.
msgBrowserByType
Sorts by type order.
Takes nothing, returns SfATUS.
fdefine msgBrowserByType MakeMsg(clsBrowser, 40)
Displays all displayed items sorted by type order. Usually sent from menu.
msgBrowserBySize
Sorts by size order.
Takes nothing, returns SfATUS.
fdefine msgBrowserBySize MakeMsg(clsBrowser, 3)
Displays all displayed items sorted by size order. Usually sent from menu.
msgBrowserByDate
Sorts by date order.
Takes nothing, returns SfATUS.
fdefine msgBrowserByDate MakeMsg(clsBrowser, 4)
Displays all displayed items sorted by date order. Usually sent from menu.
msgBrowserCollapse
Collapses sections or directories.
Takes nothing or P_FS_FLAT_LOCATOR, returns STATUS.
fdefine msgBrowserCollapse MakeMsg(clsBrowser, 6)
If pArgs is P_FS_FLAT_LOCATOR, collapses P_FS_FLAT_LOCATOR otherwise if pArgs is pNull and the
browser has the selection, the selection is collapsed; otherwise, every open selection is collapsed.
BROWSER.H '89
Common #defines and typedefs
msgBrowserRefresh
Refreshes the disk image the browser is displaying.
Takes nothing, returns STATUS.
*define msgBrowserRefresh MakeMsg(clsBrowser, 15)
msgBrowserI>elete
Deletes selection if pNull or P_FS_FLAT_LOCATOR otherwise.
Takes nothing or P _FS_FLAT_LOCATOR, returns STATUS.
*define msgBrowserDelete MakeMsg(clsBrowser, 22)
Sent to self to allow subclass to override.
msgBrowserRename
Renames browser items.
Takes nothing or P _FS_FLAT_LOCATOR, returns STATUS.
*define msgBrowserRename MakeMsg(clsBrowser, 23)
Pops up rename dialog box for the selection if pNull; otherwise the item pointed to by
P _FS_FLAT_LOCATOR is renamed. Sent to self to allow subclass to override.
msgBrowserExport
Puts the selection into export mode.
Takes nothing, returns STATUS.
*define msgBrowserExport MakeMsg(clsBrowser,118)
After this message is received by Toe the selected item is highlighted with the copy box. Then if
notebook item is dragged to the DiskViewer, it will be exported, not copied. The export mode is
cancelled when the selection is cancelled or the export completes. TOe only.
msgBrowserByPage
Sorts by page number.
Takes nothing, returns STATUS.
*define msgBrowserByPage MakeMsg(clsBrowser, 25)
Toe only.
190 PENPOINT API REFERENCE
Part 9 / Utility Classes
msgBrowserWriteState
Writes the current browser expanded/collapsed state to a file.
Takes nothing, returns STATUS.
#define msgBrowserWriteState MakeMsg(clsBrowser, 26)
This message saves the name of each expanded section or directory to a disk file. By using
msgBrowserSetSaveFile clients or subclasses can set which file this information is stored in. By default
the state file ends up in the OSThisApp's directory in a file named BROWSTAT.
msgBrowserReadState
Reads the browser expanded/collapsed state from a disk file.
Takes nothing, returns STATUS.
#define msgBrowserReadState MakeMsg(clsBrowser, 27)
This message restores the state of the browser view of the notebook or file system. By using
msgBrowserSetSaveFile clients or subclasses can set which file this information is stored in. By default
the state file ends up in the OSThisApp's dir in a file named browstate.
msgBrowserSetSaveFile
Sets the file that the browser will save open/close state to.
Takes P_FS_LOCATOR, returns STATUS.
*define msgBrowserSetSaveFile MakeMsg(clsBrowser,148)
msgBrowser(;e~etrics
Gets browser metrics.
Takes P_BROWSER_METRICS, returns STATUS.
#define msgBrowserGetMetrics MakeMsg(clsBrowser, 28)
Display justifications
Enum16 ( BROW_JUSTIFY) {
browserLeftJustify = 0, II Left justification.
browserRightJustify = 1, II Right justification.
browserCenterJustify 2, II Center justification.
browserUserJustify = 3 II Miscellaneous justification.
};
msgBrowserSetMetrics
Sets browser metrics.
Takes P_BROWSER_METRICS, returns STATUS.
fdefine msgBrowserSetMetrics MakeMsg(clsBrowser, 29)
Messt$ge typedef struct BROWSER METRICS
Arguments U16 showIcon 1; II Show icons.
U16 showType 1; II Show type field.
U16 showSize 1; II Show size field.
192 PENPOINT API REFERENCE
Part 9 / Utility Classes
msgBrowserUserColumnGetState
Does nothing.
Takes P_BROWSER_USER_COLUMN, returns STATUS.
#define msgBrowserUserColumnGetState MakeMsg(clsBrowser, 62)
typedef struct
BOOLEAN changed; II TRUE if this column has changed.
BOOLEAN state; II State of item check box.
CHAR text [nameBuf Length]; II Text of field for item.
BOOLEAN shown; II TRUE if this column is shown.
II Same as showUserColumn of METRICS.
BOOLEAN active; II TRUE if this column is active
II for this browser item.
BROWSER_COLUMN_STATE;
typedef struct {
FS FLAT LOCATOR flat; II Locator of browser item.
BROWSER COLUMN STATE column[browUserColumns]; II Column information.
U8 spare [ 12] ; I I Spare: reserved.
BROWSER USER_COLUMN, *P_BROWSER_USER_COLUMN;
msgBrowserUserColumnSetState
Sets the user column states in the browser for columns that are marked changed.
Takes P_BROWSER_USER_COLUMN, returns STATUS.
#define msgBrowserUserColumnSetState MakeMsg(clsBrowser, 63)
M®SSQ9® typedef struct {
Argurnenfs FS FLAT LOCATOR flat; II Locator of browser item.
BROWSER COLUMN STATE column[browUserColumns]; II Column information.
U8 spare [12] ; I I Spare: reserved.
BROWSER USER_COLUMN, *P_BROWSER_USER_COLUMN;
If the changed BOO LEAN is set, the user column state will be set. Does not generate a
msgBrowserUserColumnStateChanged. The entire BROWSER_USER_COLUMN structure must be
cleared before setting the fields that are changing.
msgBrowserUserColumnStateChanged
Notifies subclass when user checks a user column checkbox.
Takes P_BROWSER_USER_COLUMN, returns STATUS.
#define msgBrowserUserColumnStateChanged MakeMsg(clsBrowser, 68)
BROW5ER.H 193
Common #defines and typedefs
msgBrowserUserColumnQueryState
Gets the user column state from subclass.
Takes P _BROWSER_USER_COLUMN, returns STATUS.
#define msgBrowserUserColumnQueryState MakeMsg(clsBrowser, 69)
Message typedef struct {
AV£lumenrs FS FLAT LOCATOR flat; II Locator of browser item.
BROWSER_COLUMN_STATE column[browUserColumns]; II Column information.
U8 spare [12] ; I I Spare: reserved.
BROWSER_USER_COLUMN, *P_BROWSER_USER_COLUMN;
This message is sent to self when the browser needs to know the user column states for a notebook item.
The FS_FLAT_LOCATOR points to the file system item the browser needs to know the state of. The
subclass should pass back the state or the text of each user column for the file system item.
msgBrowserShowlcon
Controls icon field display.
Takes BOOLEAN, returns STATUS.
#define msgBrowserShowIcon MakeMsg(clsBrowser, 100)
msgBrowserShowButton
Controls button field display.
Takes BOO LEAN, returns STATUS.
#define msgBrowserShowButton MakeMsg(clsBrowser, 99)
msgBrowserShowSize
Controls size field display.
Takes BOOLEAN, returns STATUS.
#define msgBrowserShowSize MakeMsg(clsBrowser, 102)
msgBrowserShowDate
Controls date field display.
Takes BOOLEAN, returns STATUS.
#define msgBrowserShowDate MakeMsg(clsBrowser, 103)
msgBrowserShowType
Controls type field display.
Takes BOOLEAN, returns STATUS.
#define msgBrowserShowType MakeMsg(clsBrowser, 33)
194 PENPOINT API REFERENCE
Part 9 I Utility Classes
msgBrowserShowBookmark
Controls bookmark field display.
Takes BOOLEAN, returns STATUS.
fdefine msgBrowserShowBookmark MakeMsg(clsBrowser, 104)
TOC only.
msgBrowserShowHeader
Controls column header display.
Takes BOOLEAN, returns STATUS.
fdefine msgBrowserShowHeader MakeMsg(clsBrowser, 39)
msgBrowserGoto
Takes true to goto, false to bringto the selection.
Takes BOOLEAN, returns STATUS.
fdefine msgBrowserGoto MakeMsg(clsBrowser, 105)
TOC only. Used by menu.
msgBrowserGotoBringto
Takes P_BROWSER-:GOTO. If pFlat is pNull, applies to selection.
Takes P_BROWSER_GOTO, returns STATUS.
fdefine msgBrowserGotoBringto MakeMsg(clsBrowser, 134)
typedef struct
BOOLEAN doGoto; II TRUE - Goto document.
II FALSE - Bringto document.
II (Goto if bringto is disabled.)
FS_FLAT_LOCATOR flat; II Document to goto-bringto
BROWSER_GOTO, *P_BROWSER_GOTO;
Sent to self to allow subclass to override. TOC only.
msgBrowserUndo
Does nothing yet ...
Takes nothing, returns STATUS.
fdefine msgBrowserUndo MakeMsg(clsBrowser, 106)
msgBrowserSetSelection
Causes browser/TOC to select and display the given file system item.
Takes P_FS_FLAT_LOCATOR, returns STATUS.
fdefine msgBrowserSetSelection MakeMsg(clsBrowser,32)
As long as the locator points to an item within the browser's base directory subtree, the browser will
open directories and scroll the display as necessary to display the selected item.
BROWSER.H 195
Common #defines and typedefs
msgBrowserSetClient
Sets the target of the browser client messages.
Takes OBJECT, returns STATUS.
*define msgBrowserSetClient MakeMsg(clsBrowser, 108)
This message controls who gets the various browser client messages.
1ft
IU
1ft
msgBrowserGetClient 1ft
msgBrowserGetBaseFlatLocator
MakeMsg(clsBrowser, 64)
msgBrowserSelectionPath
Passes back the full path of the selection.
Takes P _BROWSER_PATH, returns STATUS.
*define msgBrowserSelectionPath MakeMsg(clsBrowser, 109)
typedef struct {
CHAR path[fsMaxPathLength];
} BROWSER_PATH, *P_BROWSER_PATH;
Also responds to msgXferGet with id XferFullPathName to get the selections path. Note: If possible use
msgBrowserSelection with flat locators to avoid duplicate volume name confusion.
msgBrowserSelection
Passes back the flat locator of the selection.
Takes P_FS_FIAT_LOCATOR, returns STATUS.
*define msgBrowserSelection MakeMsg(clsBrowser, 79)
Also responds to msgXferGet with id XferFlatLocator to get the selections path.
msgBrowserSelectionUUID
Passes back the UUID of the selection.
Takes P_UUID, returns STATUS.
*define msgBrowserSelectionUUID MakeMsg(clsBrowser,117)
196 PENPOINT API REFERENCE
Part 9 / Utility Classes
msgBrowserSelectionDir
Passes back the flat locator of the directory the selection is i~.
Takes P_FS_FIAT_LOCATOR, returns STATUS.
#define msgBrowserSelectionDir MakeMsg(clsBrowser, 110)
msgBrowserSelectionName
Returns the name of the selection.
Takes P_CHAR, returns STATUS.
#define msgBrowserSelectionName MakeMsg(clsBrowser, 111)
Also responds to msgXferGet with id XferName to get the selections name
msgBrowserSelectionOn
Notifies client when a selection is made inside the browser.
Takes nothing, returns STATUS.
#define msgBrowserSelectionOn MakeMsg(clsBrowser,112)
msgBrowserSelectionOff
Notifies client when selection is yielded by the browser.
Takes nothing, returns STATUS.
#define msgBrowserSelectionOff MakeMsg(clsBrowser,113)
msgBrowserBookmark
Notifies client that the bookmark specified by locator has toggled.
Takes P _BROWSER_BOOKMARK, returns STATUS.
#define msgBrowserBookmark MakeMsg(clsBrowser,107)
typedef struct {
FS_LOCATOR lOCi
} BROWSER_BOOKMARK, *P_BROWSER BOOKMARKi
msgBrowserCreateDoc
Creates a directory.
Takes P _BROWSER_CREATE_DOC, returns STATUS.
#define msgBrowserCreateDoc MakeMsg(clsBrowser,152)
typedef struct
CLASS docClassi
P CHAR pNamei
BOOLEAN atSelectioni
XY32 XYi
BROWSER_CREATE_DOC, *P_BROWSER_CREATE_DOC;
The directory is created at the selection if there is one. If not, the directory is created at the top level
shown. DiskViewonly.
BROWSER.H 197
Common #defines and typedefs
msgBrowserGetBrowWin
Passes back the browser's internal display window.
Takes pObject, returns STATUS.
#define msgBrowserGetBrowWin MakeMsg(clsBrowser,149)
The browser's internal display window is the selected object for any selection based operations.
msgBrowserGesture
Sends to self gesture and which file it landed on.
Takes P _BROWSER_GESTURE, returns STATUS.
#define msgBrowserGesture MakeMsg(clsBrowser,59)
typedef struct {
MESSAGE gesture; II Gesture that occurred.
P- FS- FLAT- LOCATOR pFlat; II Item on which to apply the gesture.
P GWIN GESTURE pGest; II Original gesture struct.
TAG columnTag; II Tag of column on which to apply the gesture.
II o if not on a column.
U32 info; I I Internal browser information.
U32 spare[2]; II Spare: reserved.
BROWSER_GESTURE, *P_BROWSER_GESTURE;
Allows subclasses to respond to gestures targeted at browser items. If the status returned by the subclass
is >= stsOK the gesture will NOT be sent to browser superclass. So subclasses should ignore this message
or return stsOK to signify it has been handled.
aYTARRAY.H
This file contains the API definition for the ByteArray interface. The functions described in this file are
contained in MISC.UB.
A ByteArray implements a growing and shrinking array of bytes, indexed from 0 to
ByteArrayLengthO-l. A ByteArray grabs and releases memory as needed.
The ByteArray implementation is optimized for highly localized series of insertions and deletions.
#ifndef BYTARRAY INCLUDED
#define BYTARRAY_INCLUDED $Revision: 1.17 $
#ifndef CLSMGR_INCLUDED
#include <clsmgr.h>
#endif
#ifndef DEBUG INCLUDED
#include <debug.h>
#endif
#ifndef OS HEAP_INCLUDED
#include <osheap.h>
#endif
Private
typedef struct BYTE_ARRAY {
BYTE INDEX length; II Number of bytes stored in buffer
BYTE INDEX bufferLength; II Number of bytes in buffer
P U8 firstPart; II Beginning of the buffer
BYTE INDEX firstPartLength; II Number of bytes in first part
P U8 secondPart; II see comments above
U16 mode; II see comments above
BYTE_ARRAY;
ByteArrayGapLength
Returns the size of the byte array's gap.
Returns BYTE_INDEX.
#define ByteArrayGapLength(p) \
((p)->bufferLength - (p)->length)
200 PENPOINT API REFERENCE
Part 9 I Utility Classes
ByteArrayPrint
Prints the content of the byte array.
Returns void.
:fI:ifdef DEBUG
void EXPORTED
ft.mdlOI1 Prototype ByteArrayPrint (
P BYTE ARRAY p,
P STRING charFmt,
int charWidth) ;
:fI:endif II DEBUG
ByteArrayFindByte
Gets address of byte n from ByteArray p.
Returns P_us.
:fI:define ByteArrayFindByte(p,n) ( \
(n) < (p)->firstPartLength \
? &( (p) ->firstPart [ (n) ]) \
: &( (p) ->secondPart [ (n) ]) )
Warning 1: n is evaluated twice, so it should not be an expression with an auto-increment or decrement!
Warning 2: to be as fast as possible, ByteArrayFindByte does no error checking!
ByteArrayFindlndex
Determines the index from address addr of byte in ByteArray p.
Returns BYTE_INDEX.
:fI:define ByteArrayFindIndex(p,addr) ( \
(addr) < &((p)->firstPart[(p)->firstPartLength]) \
? (BYTE_INDEX) (addr - (p)->firstPart) \
: (BYTE_INDEX) (addr - (p)->secondPart))
This is the inverse of ByteArrayFindByte.
Warnings from ByteArrayFindByte apply here also.
ByteArrayGetByte
Get byte n from ByteArray p
Returns U8.
:fI:define ByteArrayGetByte(p,n) \
((n) < (p)->firstPartLength \
? (p)->firstPart[(n)] \
: (p) ->secondPart [(n)])
Warnings from ByteArrayFindByte apply here also.
BYTARRAY.H 201
Exported Functions and Macros
ByteArrayCreate
Creates a byte array.
Returns SfATUS.
STATUS EXPORTED
ByteArrayCreate(
P BYTE ARRAY * pp,
U16 mode,
BYTE INDEX length) ;
Only the osHeapLocal/osHeapShared flags of mode are meaningful. The initial length doesn't matter
very much, since the byte array grows or shrinks as needed. However, iflength is approximately correct,
then early insertions will be quicker. If length<=O, a length of 1 is assumed.
Returns stsOK if able to create the byte array, in which case *pp will be the created byte array, otherwise
*pp will be Nil(p_BYTE_ARRAY).
The mode parameter is really of type OS_HEAP_MODE.
ByteArrayDestroy
Destroys a byte array.
Returns void.
void EXPORTED
Fundion Prototype ByteArrayDestroy (
P BYTE ARRAY p);
ByteArrayGetMany
Gets one or more characters from contiguous positions in the byte array.
Returns SfATUS.
STATUS EXPORTED
Fundiol1 Prototype ByteArrayGetMany (
P BYTE ARRAY p,
BYTE INDEX pos,
P U8 buf,
BYTE INDEX bufLen) ;
ByteArrayReplace
Replaces zero or more characters in the byte array.
Returns SfATUS.
STATUS EXPORTED
ru,H:tton Pv©totype ByteArrayReplace (
P BYTE ARRAY p,
BYTE INDEX pos,
BYTE INDEX len,
P U8 buf,
BYTE INDEX bufLen) ;
202 PENPOINT API REFERENCE
Part 9 / Utility Classes
Replaces len characters in p at positions [pos .. pos+len) by bufLen characters from buf. Client should
insure that pos+len <= ByteArrayLength{p).
Returns:
stsOutoruem if no memory available, or
stsBadParam if range [posoopos+len) is invalid, or
stsBAMaxExceeded if the maximum ByteArray length is exceeded, or
number bytes taken from buf otherwise.
ByteArraylnsert
Inserts bufLen characters from buf into p at position pos.
Returns SfATUS.
tdefine ByteArrayInsert(p, pos, buf, bufLen) \
ByteArrayReplace ((p), (pos), 0, (buf), (bufLen))
This routine does no error checking. Client should insure that: pos <= ByteArrayLength{p).
See ByteArrayReplace for possible return values.
ByteArrayDelete
Delete n characters from p starting at pos.
Returns void.
tdefine ByteArrayDelete(p, pos, len) \
(void) ByteArrayReplace ((p), (pos), (len), Nil (P_U8), 0)
This routine does no error checking. Client should insure that: pos+len <= ByteArrayLength{p).
ByteArrayLength
Returns the number of bytes currently stored in the BYTE_ARRAY.
Returns BYTE_INDEX.
tdefine ByteArrayLength(p) ((p)->length)
ByteArrayHeapMode
Returns the heap mode the BYTE_ARRAY was created with.
Returns OS_HEAP _MODE.
tdefine ByteArrayHeapMode(p) ( (p) ->mode)
ByteArrayReserve
Reserves space in byte array (without actually initializing it).
Returns SfATUS.
STATUS EXPORTED
rtH);::r!@fi PV@l'©fyP8: ByteArrayReserve (
P BYTE ARRAY p,
BYTE INDEX pos,
BYTE INDEX len) ;
BYTARRAY.H 203
Exported Functions and Macros
Comments Reserves len characters in p at position pos, but does not initialize them. (The gap is guaranteed to not
break the reserved range.) Client should insure that pos <= ByteArrayLength(p).
Returns:
stsOutOfMem if no memory available, or
stsBadParam if pos is invalid, or
stsBAMaxExceeded if the maximum ByteArray length is exceeded, or
en
III
en
stsOK otherwise. en
~
ByteArrayWrite
Writes the content of the byte array to the specified file.
Returns STATUS.
STATUS EXPORTED
rum:t!on Prototype ByteArrayWri te (
P BYTE ARRAY p,
OBJECT file);
The file parameter must act like a FILE_HANDLE object.
ByteArrayRead
Reads previously saved content of a byte array from the specified file.
Returns STATUS.
STATUS EXPORTED
Function Prototype ByteArrayRead (
P BYTE ARRAY * pp,
OBJECT file,
OS HEAP MODE mode);
The file parameter must act like a FILE_HANDLE object.
BAFileWriteString
Debugging utility routine to write a string to a file.
Returns STATUS.
4tifdef DEBUG
STATUS EXPORTED
fum:t$on Prototype BAFileWriteString (
OBJECT file,
P_U8 str);
4tendif
Comments Useful when initially writing filing code to insert helpful strings into the file and to then skip over the
strings when reading the file.
This routine takes an exception if it encounters an error. Also, it will only work with a string whose
length is MAX_STR_LENGTH or less.
The file parameter must act like a FILE_HANDLE object.
204 PENPOINT API REFERENCE
Part 9 I Utility Classes
BAFileReadString
Debugging utility routine to read a string from a file.
Returns SfATUS.
fifdef DEBUG
STATUS EXPORTED
Functi@n Pr©f©type BAFileReadString (
OBJECT file,
P_U8 str);
fendif
Useful when initially writing filing code to skip over strings written with BAFileWriteString.
This routine takes an exception if it encounters an error. Also, it will only work with a string whose
length is MAX_STR_LENGTH or less.
The file parameter must act like a FILE_HANDLE object.
BYTEBUF.H
This file contains the API definition for clsByteBuf.
clsByteBuf inherits from clsObject.
clsByteBuf provides a facility to store uninterpreted byte strings. Each object of clsByteBuf stores a
single buffer. This class provides convenient object filing of the buffer data. Storage for each object's
buffer is allocated out of the creator's shared process heap using OSHeapBlockAlloc.
Clients who want to store null terminated strings should use clsString (see strobj.h).
*ifndef BYTEBUF INCLUDED
*define BYTEBUF INCLUDED
*include <go.h>
*include <clsmgr.h>
typedef OBJECT BYTEBUF, *P_BYTEBUF;
typedef struct BYTEBUF_DATA {
U16 bufLen; II In/Out: Length (in bytes) of the pBuf buffer.
P U8 pBuf; II In/Out: Object buffer.
BYTEBUF_DATA, *P_BYTEBUF_DATA;
Class Messages
msgNew
Creates a new buffer object.
Takes P_BYTEBUF_NEW, returns STATUS. Category: class message.
typedef struct BYTEBUF_NEW_ONLY {
BOOLEAN allowObservers; II In:
Send clsByteBuf observer messages
II
to the object's observers?
BYTEBUF DATA data; II
In/Out: Buffer data.
BYTEBUF_NEW_ONLY, *P_BYTEBUF_NEW_ONLY;
*define byteBufNewFields \
objectNewFields \
BYTEBUF NEW ONLY bytebuf;
typedef struct BYTEBUF_NEW {
byteBufNewFields
} BYTEBUF_NEW, *P_BYTEBUF_NEW;
This message allocates shared heap storage for the specified buffer.
allowObservers indicates whether the object will send the clsByteBuf observer messages (See
msgByteBufChanged). Only clsByteBuf messages are affected by this option. Adding and removing
observers is not affected by this option.
msgNewDefaults
Initializes the BYTEBUF_NEW structure to default values.
Takes P_BYTEBUF_NEW, returns STATUS. Category: class message.
206 PENPOINT API REFERENCE
Part 9 I Utility Classes
Obiec. Messages
msgByteBufGetBuf
Passes back the object's buffer.
Takes P_BYTEBUF_DATA, returns STATUS.
fdefine msgByteBufGetBuf MakeMsg(clsByteBuf, 1)
MessoSje typedef struct BYTEBUF_DATA {
Arguments U16 bufLen; // In/Out: Length (in bytes) of the pBuf buffer.
P U8 pBuf; // In/Out: Object buffer.
BYTEBUF_DATA, *P_BYTEBUF_DATA;
The pointer passed back references the object's global storage. Clients must not modify or free this
storage.
msgByteBufSetBuf
Copies the specified buffer data into the object's buffer.
Takes P_BYTEBUF_DATA, returns STATUS.
fdefine msgByteBufSetBuf MakeMsg(clsByteBuf, 2)
Messoge typedef struct BYTEBUF__DATA {
Argurnent£ U16 bufLen; // In/Out: Length (in bytes) of the pBuf buffer.
P U8 pBuf; 1/ In/Out: Object buffer.
BYTEBUF_DATA, *P_BYTEBUF_DATA;
Previously retrieved bytebuf pointers will be invalid after this operation. Clients must call
msgByteBufGetBuf to retrieve a pointer to the valid object buffer.
Observer Messages
msgByteBufChanged
Sent to observers when the object data changes.
Takes OBJECT, returns nothing. Category: observer notification.
fdefine msgByteBufChanged MakeMsg(clsByteBuf, 3)
The message argument is the UID of th~ clsByteBuf object that changed.
This message is not sent if the creator did not specify allowObservers during msgNew.
DSKYIEW.H
This file contains the API definition for dsDiskViewWin.
dsDiskViewWin inherits from dsCustomLayout.
It is the view window for a multi-volume disk viewer.
Overview
The Disk Viewer also defines dsDVBrowBar, dsDVf abButton, dsDVlcon, and dsDVForward. These
are internal classes which must be well-known uids, since the Disk Viewer component is shared.
The Disk Viewer component implements the heart of the Disk Manager. It is consists of two panels: an
icon panel and a browser panel. Each known filesystem volume (connected and disconnected) is
represented by an icon in the icon window. Each open volume is represented by a browser card in the
browser panel. A browser card is a frame with a menu bar and control tab as decoration and an instance
of dsBrowser in the view (see browser.h for details).
The icon panel is only as big as it needs to be to fit the known volumes. The browser panel takes up the
rest of the space. The open browser cards equally divide up the browser panel.
Clients will typically put the Disk Viewer component inside of a frame. The frame must not be
shrink-wrapped; the Disk Viewer must be told what size it should be.
dsDiskViewWin understands the following dsBrowser's messages:
msgBrowserCreateDir
The browser messages that deal with the selection are sent to the browser which has the current
selection. Messages that do not deal with the selection or make sense if there is no selection are sent to
all browsers in the Disk Viewer.
The Disk Viewer client is made the client of all the open browsers. The client will get all the messages
that browsers send to their clients.
The Disk Viewer takes care of setting up browser state files in a directory off the current working
directory. The Disk Viewer ensures that the state files for each volume is unique; it handles duplicate
volume names.
The Disk Viewer understands msgSave and msgRestore. It will reopen volumes that were open when it
was saved, and restore as much volume state (which directories were expanded) as possible.
fifndef DSKVIEW INCLUDED
fdefine DSKVIEW INCLUDED
fifndef CLAYOUT INCLUDED
finclude <clayout.h>
fendif
fifndef BROWSER INCLUDED
finclude <browser.h>
fendif
208 PENPOINT API REFERENCE
Part 9 I Utility Classes
Icon Style
#define dvBigPictTitleUnder 0 II Big icon, title under picture.
#define dvBigPictTitleRight 1 II Big icon, title to right of picture.
#define dvSmallPictTitleUnder 2 II Small icon, title under picture.
#define dvSmallPictTitleRight 3 II Small icon, title to right of picture.
Messages
msgNew
Creates a new disk view window.
Takes P_DV_NEW, returns STATUS. Category: class message.
Message typedef struct DV_NEW {
Arguments diskViewWinNewFields
} DV_NEW, *P_DV_NEW;
msgNewDefaults
Initializes the DV_NEW structure to default values.
Takes P_DV_NEW, returns STATUS. Category: class message.
Message typedef struct DV_NEW {
Arguments diskViewWinNewFields
} DV_NEW, *P_DV_NEW;
Zeroes out diskViewWin and sets
diskViewWin.style.displayRamVolume = false;
diskViewWin.style.autoOpen = false;
diskViewWin.style.iconStyle = dvBigPictTitleUnder;
diskViewWin.style.enableBookshelf = true;
diskViewWin.style.enableDirectoryView = true;
diskViewWin.style.showVolumeMenu = true;
diskViewWin.style.showEditMenu = true;
diskViewWin.style.showViewMenu = true;
diskViewWin.style.showOptionsMenu = true;
diskViewWin.style.iconPanelStyle = dvShowIcons;
diskViewWin.numOpenVols = 0;
diskViewWin.displayType = tagDVViewBookshelf;
diskViewWin.browserClass = objNull;
diskViewWin.bookshelfClass = objNull;
msgD"(;etS~le
Gets current style setting.
Takes P_DV_STYLE, returns STATUS.
#define msgDVGetStyle MakeMsg(clsDiskViewWin, 1)
---------------------
210 PENPOINT API REFERENCE
Part 9 / Utility Classes
msgDVSetStyle
Sets style setting.
Takes P_DV_STYLE, returns STATUS.
#define msgDVSetStyle MakeMsg(clsDiskViewWin, 2)
typedef struct DV STYLE
U16 displayRamVolume: 1, II
Display the RAM volume. Used for debugging.
II
Disk Viewer app sets this if IDB0800 is on.
autoOpen 1, II
If there is only one volume, open it.
enableBookshelf 1, II
Should bookshelf viewing be enabled?
enableDirectoryView : 1,1/ Should the directory view be enabled?
showVolumeMenu 1, II Should the volume menu be shown?
showEditMenu 1, II Should the edit menu be shown?
showViewMenu 1, 1/ Should the view menu be shown?
showOptionsMenu 1, II Should the options menu be shown?
iconPanelStyle 3, II What should be shown in the icon panel?
iconStyle 3, II Initial icon look, only used if
II iconPanelStyle == dvShowIcons.
unused1 2;
U16 spare1;
U16 spare2;
DV_STYLE, *P_DV_STYLE;
msgDVGetBasePath
Passes back the current base path.
Takes P_STRING, returns STATUS.
#define msgDVGetBasePath MakeMsg(clsDiskViewWin, 3)
Comments The argument must point to a string buffer that is at least fsPathBufLength in size.
msgDVGetlconPanel
Passes back the current icon panel window.
Takes P_WIN, returns STATUS.
#define msgDVGetIconPanel MakeMsg(clsDiskViewWin, 4)
DSKVIEW.H 211
Private
msgDVSetlconPanel
Sets the icon panel window.
Takes P_WIN, returns STATUS.
#define msgDVSetlconPanel MakeMsg(clsDiskViewWin, 5)
This message is only relevant if style.iconPane1Style is set to dvShowHelpText or dvShowClientWin.
msgDVGetOpenVois
Passes back the names of all the currently open volumes.
Takes P_DV_GET_OPEN_VOLS, returns STATUS.
#define msgDVGetOpenVols MakeMsg(clsDiskViewWin, 7)
typedef struct DV_GET_OPEN_VOLS
U16 numOpenVolSi II Number of open volumes.
P NAME pOpenVolsi II Out: Array of volume names.
II must be OSHeapBlockFreed.
U8 spare[24]i
DV_GET_OPEN_VOLS, *P_DV_GET_OPEN_VOLSi
This message allocates a heap block on the process local stack (pOpenVols). THE CALLER MUST
FREE THIS BLOCK WHEN DONE.
If there are no open volumes then pOpenVols is set to pNull and nothing is allocated.
Private
msgDVSetOptionVolume
Sets the current volume for our option sheet.
Takes OBJECT, returns STATUS.
#define msgDVSetOptionVolume MakeMsg(clsDiskViewWin, 8)
msgDVCardPopupChanged
Option card's quick installer popup button has changed.
Takes BOOLEAN, returns STATUS.
#define msgDVCardPopupChanged MakeMsg(clsDiskViewWin, 9)
msgDVOptionMenuNeed
Sent to the disk view client as notification that the option menu is being provided.
Takes nothing, returns STATUS.
#define msgDVOptionMenuNeed MakeMsg(clsDiskViewWin, 10)
msgDVOpenVolume
Opens the disk browser of the volume specified by the given name.
Takes P_CHAR, returns STATUS.
#define msgDVOpenVolume MakeMsg(clsDiskViewWin, 11)
212 PENPOINT API REFERENCE
Part 9 / Utility Classes
nnsgI>"C:lose"olunne
Closes the disk browser of the volume specified by the given name.
Takes P_CHAR, returns STATUS.
#define msgDVCloseVolume MakeMsg(clsDiskViewWin, 12)
nnsgI>"C:onnectTo"olunne
Connects a network volume specified in pArgs.
Takes P_CONNECTIONS_MENU_ITEM, returns STATUS.
#define msgDVConnectToVolume MakeMsg(clsDiskViewWin, 13)
Menu Messages
#define msgDVOpenClose MakeMsg(clsDVForward, 1)
#define msgDVDuplicate MakeMsg(clsDVForward, 2)
#define msgDVAddQuicklnstall MakeMsg(clsDVForward, 3)
#define msgDVRemoveQuicklnstall MakeMsg(clsDVForward, 4)
#define msgDVEjectRemember MakeMsg(clsDVForward, 5)
#define msgDVEjectForget MakeMsg(clsDVForward, 6)
#define msgDVFormat MakeMsg(clsDVForward, 7)
#define msgDVRename MakeMsg(clsDVForward, 10)
#define msgDVViewAll MakeMsg(clsDVForward, 20)
#define msgDVViewBookshelf MakeMsg(clsDVForward, 21)
#define msgDVDisplaylnstaller MakeMsg(clsDVForward, 22)
#define msgDVLayoutOptions MakeMsg(clsDVForward, 30)
#define msgDVDiskOptions MakeMsg(clsDVForward, 31)
#define msgDVOptionslcon MakeMsg(clsDVForward, 41)
#define msgDVOptionsType MakeMsg(clsDVForward, 42)
#define msgDVOptionsDate MakeMsg(clsDVForward, 43)
#define msgDVOptionsSize MakeMsg(clsDVForward, 44)
#define msgDVOptionsDirSize MakeMsg(clsDVForward, 45)
#define msgDVOptionsVersion MakeMsg(clsDVForward, 46)
#define msgDVOptionslnstall MakeMsg(clsDVForward, 47)
#define msgDVSortByName MakeMsg(clsDVForward, 50)
#define msgDVSortByDate MakeMsg(clsDVForward, 51)
#define msgDVSortBySize MakeMsg(clsDVForward, 52)
#define msgDVSortByType MakeMsg(clsDVForward, 53)
II Note: clsDVForward messages 100 and above are used internally.
Tags
#define tagDVVolumeMenu MakeTag(clsDiskViewWin, 1)
#define tagDVEdi tMenu MakeTag(clsDiskViewWin, 2)
#define tagDVViewMenu MakeTag(clsDiskViewWin, 3)
#define tagDVOptionsMenu MakeTag(clsDiskViewWin, 4)
#define tagDVTabButton MakeTag(clsDiskViewWin, 7)
#define tagDVOpenClose MakeTag(clsDiskViewWin, 10)
#define tagDVDuplicate MakeTag(clsDiskViewWin, 11)
#define tagDVEjectRemember MakeTag(clsDiskViewWin, 12)
#define tagDVEjectForget MakeTag(clsDiskViewWin, 13)
#define tagDVRefresh MakeTag(clsDiskViewWin, 14)
#define tagDVQuicklnstall MakeTag(clsDiskViewWin, 15)
#define tagDVFormat MakeTag(clsDiskViewWin, 16)
#define tagDVRename MakeTag(clsDiskViewWin, 17)
#define tagDVCreateDir MakeTag(clsDiskViewWin, 18)
#define tagDVViewChoice MakeTag(clsDiskViewWin, 20)
DSKVIEW.H 213
Tags
~
:fI:define tagDVOptionsSize MakeTag(clsDiskViewWin, 42)
:fI:define tagDVOptionsDirSize MakeTag(clsDiskViewWin, 43)
:fI:define tagDVOptionsDate MakeTag(clsDiskViewWin, 44)
:fI:define tagDVOptionsVersion MakeTag(clsDiskViewWin, 45)
:fI:define tagDVOptionslnstall MakeTag(clsDiskViewWin, 46)
:fI:define tagDVSortByChoice MakeTag(clsDiskViewWin, 50)
:fI:define tagDVSortByName MakeTag(clsDiskViewWin, 51)
:fI:define tagDVSortByDate MakeTag(clsDiskViewWin, 52)
:fI:define tagDVSortBySize MakeTag(clsDiskViewWin, 53)
:fI:define tagDVSortByType MakeTag(clsDiskViewWin, 54)
:fI:define tagDVlconCard MakeTag(clsDiskViewWin, 60)
:fI:define tagDVlconLabel MakeTag(clsDiskViewWin, 61)
:fI:define tagDVlconChoice MakeTag(clsDiskViewWin, 62)
:fI:define tagDVlconBigPictTitleUnder MakeTag(clsDiskViewWin, 63)
:fI:define tagDVlconBigPictTitleRight MakeTag(clsDiskViewWin, 64)
:fI:define tagDVlconSmallPictTitleUnder MakeTag(clsDiskViewWin, 65)
:fI:define tagDVlconSmallPictTitleRight MakeTag(clsDiskViewWin, 66)
:fI:define tagDVDefaultBigBitmap MakeTag(clsDiskViewWin, 67)
:fI:define tagDVDe fault SmallBitmap MakeTag(clsDiskViewWin, 68)
:fI:define tagDVCardName MakeTag(clsDiskViewWin, 70)
:fI:define tagDVCardTotal MakeTag(clsDiskViewWin, 71)
:fI:define tagDVCardFree MakeTag(clsDiskViewWin, 72)
:fI:define tagDVCardReadOnly MakeTag(clsDiskViewWin, 73)
:fI:define tagDVCardPopupViewer MakeTag(clsDiskViewWin, 74)
:fI:define tagDVCardPopupYes MakeTag(clsDiskViewWin, 75)
:fI:define tagDVCardPopupNo MakeTag(clsDiskViewWin, 76)
:fI:define tagDVCardlnitialView MakeTag(clsDiskViewWin, 77)
:fI:define tagDVCardlnitialPopupChoice MakeTag(clsDiskViewWin, 78)
:fI:define tagDVBookshelfLayoutLabel MakeTag(clsDiskViewWin, 80)
:fI:define tagDVBookshelfLayoutChoice MakeTag(clsDiskViewWin, 81)
:fI:define hlpDVNoVolumesConnected MakeTag(clsDiskViewWin, 100)
:fI:define hlpDVSheetBackground MakeTag(clsDiskViewWin, 101)
:fI:define hlpDVlcon MakeTag(clsDiskViewWin, 102)
:fI:define hlpDVlconBackground MakeTag(clsDiskViewWin, 103)
:fI:define hlpDVTabButton MakeTag(clsDiskViewWin, 104)
:fI:define hlpDVVolumeMenu MakeTag(clsDiskViewWin, 110)
:fI:define hlpDVEditMenu MakeTag(clsDiskViewWin, 111)
:fI:define hlpDVViewMenu MakeTag(clsDiskViewWin, 112)
:fI:define hlpDVOptionsMenu MakeTag(clsDiskViewWin, 113)
:fI:define hlpDVClose MakeTag(clsDiskViewWin, 120)
:fI:define hlpDVDuplicate MakeTag(clsDiskViewWin, 121)
:fI:define hlpDVEjectRemember MakeTag(clsDiskViewWin, 122)
:fI:define hlpDVEjectForget MakeTag(clsDiskViewWin, 123)
:fI:define hlpDVRefresh MakeTag(clsDiskViewWin, 124)
:fI:define hlpDVQuicklnstall MakeTag(clsDiskViewWin, 125)
:fI:define hlpDVFormat MakeTag(clsDiskViewWin, 126)
214 PEN POINT API REFERENCE
Part 9 / Utility Classes
Overview
The export protocol is initiated from the move/copy protocol (see embedwin.h). All moves/copies from
the TOC to non-bookshelf views of the DiskViewer are implicitly exports.
More specifically, export happens after msgSelCopySelection reaches the DiskViewer, which is the
destination of the copy, and the source of the copy includes clsExport as an item in the list returned by
msgXferList. Anything moveable/copyable can potentially invoke export. (See xfer.h and sel.h for
information on PenPoint's move/copy protocol and selection management.)
The DiskViewer will send the source of the copy (the selection) msgExportGetFormats. The source
should pass back an array of possible export formats. From the information in msgExportGetFormats
clsApp generates the export dialog box. If the user selects the external export format and taps the
Move/Copy button, the export class sends msgExport to the appropriate translator specified in
msgExportGetFormats. If user selects the PenPoint format and taps the Move/Copy button, the
move/copy is equivalent to msgAppMgrMove/msgAppMgrCopy (see appmgr.h).
If the source of the export is in the TOC, the DiskViewer activates the source document and sends it
msgExportGetFormats.
Messages
msgExportGetFormats
Passes back the export format array from from the source of the export.
Takes P_EXPORT_LIST, returns STATUS. Category: client responsibility.
fdefine msgExportGetFormats MakeMsg(clsExport, 1)
typedef struct
TAG document Type; II Source document type.
TAG export Type; II Export destination type.
OBJECT translator; II Object which to send msgExport.
CHAR exportName[nameBufLength]; II Name of export type for
II display in dialog box.
EXPORT_FORMAT, *P_EXPORT_FORMAT;
typedef struct {
P EXPORT FORMAT
- - format; II Array of formats, must be SHARED
II memory, freed by caller.
U16 numEntries; II Number of elements in format array.
EXPORT_LIST, *P_EXPORT_LIST;
The DiskViewer sends this message to the selection.
The recipient should allocate global memory to hold the EXPORT_FORMAT array which is passed back
to the DiskViewer in the format field. The sender of msgExportGetFormats must free the memory.
If the source returns stsExportActivateSource, the DiskViewer will treat the source as an inactive
document (This is how the TOC behaves when it is the source of export). The source will be activated
using msgAppMgrActivate and the activated doc will be sent msgExportGetFormats.
msgExport
Initiates export by the translator.
Takes P_EXPORT_DOC, returns STATUS. Category: client responsibility.
fdefine msgExport MakeMsg(clsExport, 2)
typedef struct {
TAG export Type; II Corresponds to exportType from
II msgExportGetFormats EXPORT_FORMAT.
FS LOCATOR source; II Source document or null if
II source is not a document.
FILE HANDLE destination; II Destination file handle.
II If you don't want to export to
II this file, use msgFSGetPath to
II retrieve the destination and
II destroy this file handle.
CHAR path [fsPathBuf Length]; II Source path.
TAG document Type; II Corresponds to document Type from
II msgExportGetFormats EXPORT_FORMAT.
U32 spare1; II Spare: reserved
U32 spare2; II Spare: reserved
EXPORT_DOC, *P_EXPORT_DOC;
EXPORT.H 217
Miscellaneous
Comments This message is sent to the translator specified in EXPORT_FORMAT. The translator is passed an open file
handle to which the translator can write exported data or the translator can get the path of the file,
destroy the file and replace it with its own file structure.
If the export fails, it is the exporter's reponsibility for removing invalid and/or partial files created during
the failed export. The minimum the client should do is send msgFSDelete to pArgs->destination to
remove the file created for the exportation.
If the exporter wishes to put their custom dialog box to query the user for more information, the
exporter should do this in response to msgExport. If the custom dialog allows the user to cancel the
export operation, then the exporter should return stsExportFailedUserNotified which will cause
PenPoint to suppress any error of the aborted export.
msgExportName
Passes back a possibly modified destination name from the translator.
Takes P_EXPORT_FORMAT, returns STATUS.
tdefine msgExportName MakeMsg(clsExport, 3)
Messttge typedef struct
Arguments TAG document Type; II Source document type.
TAG export Type; II Export destination type.
OBJECT translator; II Object which to send msgExport.
CHAR exportName[nameBufLength]; II Name of export type for
II display in dialog box.
EXPORT_FORMAT, *P_EXPORT_FORMATi
This message is sent to the translator specified in EXPORT_FORMATS whenever the user chooses a new
export type in the dialog box. When the translator receives the message, export name is set to the source
document name. The translator should set export name exportName should be set to the "correct"
destination file name. For instance the extension '.RTF' or '.WKS' may be appended to the name.
If the translator ignores this message the destination name will remain unchanged (so this message can
safely be ignored).
Miscellaneous
Help tags
These are help tags on various pieces of the standard export dialog box.
tdefine hlpExportSheet MakeTag(clsExport, 50)
tdefine hlpExportName MakeTag(clsExport, 51)
tdefine hlpExportNewName MakeTag(clsExport, 52)
tdefine hlpExportChoice MakeTag(clsExport, 53)
GMARGIN.H
This file contains the API definition for clsGestureMargin.
clsGestureMargin inherits from clsScrollWin.
clsGestureMargin adds a margin to the scroll win on the opposite side from the scroll bar. Gestures
made in the margin are forwarded to the client win.
clsGestureMargin is used in PenPoint by the MiniNote application. MiniNote uses the gesture margin
in lieu of a scroll win. When MiniNote is in writing mode, the margin is gray. In gesture mode, the
margin is white.
Gesture mode is intended to indicate a "safe" mode in which the 11 core gestures can be used. In ink
mode, some gestures do not work and be may interpreted as some other type of data (e.g. ink).
#ifndef GMARGIN INCLUDED
#define GMARGIN INCLUDED
#ifndef SWIN_INCLUDED
#include <swin.h>
#endif
Messages
nns~esture~arginC;etS~le
Passes back the receiver's current style values.
Takes P _GESTURE_MARGIN_STYLE, returns STATUS.
#define msgGestureMarginGetStyle MakeMsg(clsGestureMargin, 1)
220 PEN POINT API REFERENCE
Part 9 I Utility Classes
msgGestureMarginSetStyle
Sets the receiver's style values.
Takes P_GESTURE_MARGIN_STYLE, returns STATUS.
#define msgGestureMarginSetStyle MakeMsg(clsGestureMargin, 2)
Mess©$ie typedef struct GESTURE_MARGIN_STYLE
Arguments' U16 gestureMargin 1, II gesture margin onloff
wideGestureMargin 1, II make the gesture margin wide
II (not implemented)
maskGestureMargin 1, II mask out gestureMargin
inkMode 1, II margin is gray for if in ink mode
reserved :12;
GESTURE_MARGIN_STYLE, *P_GESTURE_MARGIN_STYLE;
msgGestureMarginSetlnkMode
Sets margin to be either ink or gesture mode.
Takes BOOLEAN, returns STATUS.
#define msgGestureMarginSetlnkMode MakeMsg(clsGestureMargin, 3)
HASH.H
This package implements an "Open Addressing, Linear Probe" hash table.
The functions described in this file are contained in SYSUTIL.LIB.
Introduction
This package implements hash tables. Hash tables offer relatively fast key-based random access to data at
the expense of some memory. The performance improvement over linear searching is substantial.
The defaults supplied by this package are probably fine for most data. However, hash table performance
depends on both a good hash function and proper size parameters. If your data's keys are unevenly
distributed then consider writing your own hash function. Try to get the hash table's initial size close to
the number of expected entries divided by the fill percentage. You can vary the fill percentage to meet
your tradeoffs between space and time.
Examples
Here's some sample code based on a 32 bit key. (The package has built-in Hash and Compare functions
for 32 bit keys; see section "Hash and Compare Functions. ")
II Client data structure. (The structure must contain a key field,
II though it need not be named key and it need not be the first field.)
typedef struct (
U32 data;
U32 key;
YOUR_DATA, *P_YOUR_DATA;
OSHeapBlockFree(pHashInfo);
pEntries = pHashInfo->entries;
for (i = 0; i < pHashInfo->numEntries; iff) {
if (pEntries[i] .pData) {
II Do something with entry
Replacement Hash and Compare functions should look like the following:
typedef struct
U8 major;
U16 minor;
MY_KEY, * P_MY_KEY;
typedef struct
MY KEY key;
P UNKNOWN pData;
MY_DATA, * P_MY_DATA;
'"
UI
P MY KEY
U32
pMyKey =
hash;
hash = pMyKey->major * 9551;
hash t= pMyKey->minor * 113;
return hash;
II 9551 is prime
II 113 is prime
lL
BOOLEAN EXPORTED MyKeyHashCompare(
P_HASH_KEY pKey1,
P HASH KEY pKey2)
Type for Compare function. Function should return true if pKeyl and pKey2 point to keys with
identical values.
fundion Prototype typedef BOOLEAN FunctionPtr (HASH_COMPARE) (
P HASH KEY pKey1,
P HASH KEY pKey2
);
Functions
HashFindData
Given a key, passes back a P_HASH_DATA.
Returns STATUS.
fundio" Prototype STATUS EXPORTED HashFindData
P HASH INFO pInfo,
P HASH KEY pKey,
P HASH DATA * ppData);
Return Volue stsNoMatch the key is not in the table. *ppData is undefined.
stsOK the key is in the table.
51%(, Also HashFindTableEntry
HashFindTableEntry
Given a key, passes back a pointer to client data.
Returns STATUS.
F~mdk$!,,! tJrororypf\ STATUS EXPORTED HashFindTableEntry
P_HASH_INFO pInfo,
P_HASH_KEY pKey,
PP HASH ENTRY ppEntry);
Return Vq~U© stsNoMatch the key is not in the table. *ppEntry is undefined.
stsOK the key is in the table.
See Also HashFindData
HashAddEntry
Adds an entry to a hash table.
Returns STATUS.
ftmdion tJrototype STATUS EXPORTED HashAddEntry
P_HASH_INFO pInfo,
P_HASH_DATA pData);
Comments The hash table expands if adding this entry causes the table to exceed the expand threshold.
Returi1 Volue stsFailed the key is already in the table
HashDeleteEntry
Deletes entry from hash table.
Returns STATUS.
[function tJrolotype STATUS EXPORTED HashDeleteEntry
P_HASH_INFO pInfo,
P HASH KEY pKey,
P HASH DATA * ppData,
BOOLEAN freeClientData);
Comnurnt$ If freeClientData is true then the client data is deallocated using ppData is undefined. Otherwise
*ppData contains the pointer to client data.
Freeing entries does not cause the table to shrink.
Return Value stsN oMatch the key is not in the table.
226 PENPOINT API REFERENCE
Part 9 / Utility Classes
HashlnitDefaults
Initializes hash table parameters.
Returns SfATUS.
twnd!@ft PV10t10type STATUS EXPORTED HashInitDefaults (
P_HASH_INFO pInfo);
(ormtMN1ts Warning: HashInitDefaultsO MUST be called before HashInit. See the section "Examples."
Default values:
memset(pInfo, 0, sizeof(HASH_INFO));
pInfo->numEntries = 31;
pInfo->expandNumber = 24;
pInfo->heap = osProcessHeapId;
pInfo->pHashFunction = HashFunction32; II Default 32 bit key
pInfo->pHashCompare = HashCompare32; II Default 32 bit key
pInfo->percentFull = 80;
Hashlnit
Causes the hash table to allocate internal tables.
Returns SfATUS.
Fundion Prototype STATUS EXPORTED HashIni t (
P HASH INFO pInfo,
U32 keyOffset); II offset of key in client data.
The client must call this function after calling HashInitDefaultsO and performing any optional
customization.
Example:
HashInitDefaults(pInfo);
Hashlnit(plnfo, offsetof(YOUR_DATA, key));
HashFree
Frees internal hash table memory. Optionally deallocates any remaining user data blocks.
Returns SfATUS.
ttJndion t*vototype STATUS EXPORTED HashFree (
P HASH INFO pInfo,
BOOLEAN freeAllEntries);
Comments If freeAlIEntries is true, then the hash table calls OSHeapBlockFreeO on each remaining piece of client
data.
If the client is going to call HashFreeO with freeAlIEntries false, the client must free all client data
beforehand.
Note that this function does NOT free the HASH_INFO structure. If the client allocated it before calling
HashInitO then the client should free the table after calling HashFreeO.
HASH.H 227
Built-in Hash and Compare Functions
32 bit keys
Function Prototype U32 EXPORTED HashFunction32 (P_HASH_KEY pKey);
BOOLEAN EXPORTED HashCompare32 (P_HASH_KEY pKeyl, P_HASH_KEY pKey2);
16 bit keys
Function Prototype U32 EXPORTED HashFunction16 (P_HASH_KEY pKey);
BOOLEAN EXPORTED HashCompare16(P_HASH_KEY pKeyl, P_HASH_KEY pKey2);
String keys
Function Prototype U32 EXPORTED HashFunctionString (P _HASH_KEY pKey);
BOOLEAN EXPORTED HashCompareString(P_HASH_KEY pKeyl, P_HASH_KEY pKey2);
IMPORT.H
This file contains the API definition for dslmport.
dslmport inherits from dsObject.
clslmport is the abstract class defining the API for importing foreign files from external disks into
notebook documents.
Overview
The import protocol is triggered when the TOe receives msgSelMoveSelection or
msgSelCopySelection the TOe, and the source of the move/copy includes clsFileSystem as an item in
the list returned by msgXferList, then the Toe initiates the import protocol. (See xfer.h and sel.h for
information on PenPoint's move/copy protocol and selection management.)
The import protocol sends msglmportQuery, as a class message, to each installed application class to
determine the set of applications that can import the file.
Once every installed application has been queried, clsApp will put up an import dialog box. An instance
of the application is created on the destination and msglmport is sent. If the import succeeds, the
importer should return stsOK. If an error occurs and the user has not been notified of the failure, the
importer should return stslmportFailed. If an error occurs and the user has been notified, the importer
should return stslmportFailedU serN otified.
o
};
The 'ImportQueryHandler' method can look at the contents or the name of the imported file to
determine if that file can be imported by the app. If the app can import the file, the
'ImportQueryHandler' method sets the pArgs->canImport boolean to true (the default is false) and
returns stsOK. The TOe will then add the application's name to the list of possible import destinations
for the import dialog.
*ifndef IMPORT INCLUDED
*define IMPORT-INCLUDED
*ifndef GO INCLUDED
*include <go.h>
*endif
*ifndef UID INCLUDED
*include <uId.h>
*endif
*ifndef FS INCLUDED
*include <fs.h>
*endif
230 PENPOINT API REFERENCE
Part 9 / Utility Classes
Status codes
Importing applications should re stslmportFailedUserNotified if the importer detected an error during
the importation and notified the user of the error. This allows the importer to give a more detailed error
. message to the user.
#define stslmportFailed MakeStatus(clsImport, 1)
#define stslmportFailedUserNotified MakeStatus(clsImport, 2)
#define stsImportInvalidFormat MakeStatus(clsImport, 3)
Messages
msglmportQuery
Queries each app class to see if it is capable of importing the file.
Takes P_IMPORT_QUERY, returns STATUS. Category: client responsibility.
#define msgImportQuery MakeMsg(clsImport,l)
typedef struct {
FILE HANDLE file; II Open file handle to imported file.
TAG fileTypei II File type if it exists.
CHAR fileName [nameBuf Length]; II Source file name.
BOOLEAN canImport; II Out: TRUE if app can import the file.
II Default setting on entry is false.
U16 suitabilityRating; II Out: 0 - lowest
II 50 - average (default)
II 100 - highest
U8 spare[64]; II Spare: reserved.
IMPORT_QUERY, *P_IMPORT_QUERY;
This message is sent by the browser to each application class. The applicatin should pass back
pArgs->canImport set to true if it can import the file. pArgs->suitabilityRating is the relative rating of
how suitable the application is to importing the file. This rating determines the ordering within the list
of applications in the import dialog box displayed by PenPoint.
msglmport
Initiates the import.
Takes P _IMPORT_DOC, returns STATUS. Category: client responsibility.
#define msgImport MakeMsg(clsImport,2)
typedef struct {
FILE_HANDLE file; II Open file handle to file.
TAG fileType; II File type if exists.
U8 fileName [nameBuf Length]; II Source file name.
U32 sequence; II Sequence number for dest.
DIR HANDLE destHandle; II Dir har-dle to dest section.
IMPORT_DOC, *P_IMPORT_DOCi
This message is sent by dsApp to a newly created instance of the destination application. The
application should import the data from the file and return stsOK. If this message returns an error status
the newly created app instance will be deleted.
IMPORT.H 231
Miscellaneous
Miscellaneous
Help tags
These are help tags on various pieces of the standard export dialog box.
#define hlp Import Sheet MakeTag(clsImport~ 50)
#define hlpImportName MakeTag(clsImport, 51)
#define hlplmportNewName MakeTag(clsImport, 52)
#define hlpImportChoice MakeTag(clsImport, 53)
LIST.H
• position. An item's location. Locations are zero-based. The first item is 0 and the last item is number
of items - 1. When used as an In parameter, position specifies the position of the item to operate on.
For adding operations, maxU16 means beyond the last item. For other operations, maxU16 means
the last item in the list. Values beyond the size of the list but less than maxU16 are not
recommended. When used as an Out parameter, position contains the actual position of the item.
maxU16 is never passed back even if passed in.
• item. When used as an In parameter, item identifies the item to operate on. If the same item added
to the list more than once, then all operations work only the first appearance of the item. When
used as an Out parameter, item contains the item operated on.
typedef struct LIST ENTRY
U16 position;
LIST_ITEM item;
LIST_ENTRY, *P_LIST_ENTRY;
typedef struct LIST NOTIFY {
MESSAGE msg; II In: message to send/post
P ARGS pArgs; II In: pArgs for message
SIZEOF lenSend; II In: length of pArgs
LIST_NOTIFY, * P_LIST_NOTIFYi
Status Codes
#define stsListFull MakeStatus(clsList, 1)
#define stsListEmpty MakeStatus(clsList, 2)
~~---'-------
234 PEN POINT API REFERENCE
Part 9 / Utility Classes
msgNew
Creates a new empty list.
Takes P_LIST_NEW, returns STATUS. Category: class message.
typedef struct LIST_STYLE {
U16 reserved: 16;
} LIST_STYLE, * P_LIST_STYLE;
List filing behavior.
typedef enum LIST_FILE_MODE
listFileItemsAsData, II File list items as U32 data.
listFileItemsAsObjects, II Treat list items as objects. Save
II them with msgResPutObject and restore
II them with msgResGetObject.
listDoNotFileItems II Don't file list items.
LIST_FILE_MODE, *P_LIST_FILE_MODE;
typedef struct LIST_NEW_ONLY {
LIST_STYLE style;
LIST_FILE_MODE fileMode;
U32 reserved[4]; II Reserved
LIST_NEW_ONLY, *P_LIST_NEW_ONLY;
tdefine listNewFields \
objectNewFields \
LIST NEW ONLY list;
typedef struct LIST_NEW
listNewFields
} LIST_NEW, *P_LIST_NEW;
If the heap specified in pArgs->object.heap is null, the process heap is used.
msgNewI>efaults
Initializes the LIST_NEW structure to default values.
Takes P_LIST_NEW, returns STATUS. Category: class message.
MessClge typedef struct LIST_NEW {
Arguments listNewFields
} LIST_NEW, *P_LIST_NEW;
Zeroes out pNew->list and sets:
pArgs->list.fileMode = listFileItemsAsObjects
msgSave
Defined in clsmgr.h
Takes P_OBLSAVE, returns STATUS.
In response to this message, the list saves itself Then, based on the list's fileMode, it may save the item
information. See the commentary with the type LIST_FILE_MODE for more information.
LlST.H 235
List Manipulation Messages
msgRestore
Defined in clsmgr.h
Takes P _OBLRESTORE, returns STATUS.
In response to this message, the list restores itself. Then, based on the list's fileMode, it may restore the
items information. See the commentary with the type LIST_FILE_MODE for more information.
msgListAddItem
Adds an item to the end of a list.
Takes LIST_ITEM, returns STATUS.
fdefine msgListAddItem MakeMsg(clsList, 2)
Observers are sent msgListNotifyAddition.
msgListAddItemAt
Adds an item to a list at pArgs->position.
Takes P_LIST_ENTRY, returns STATUS.
fdefine msgListAddItemAt MakeMsg(clsList, 10)
Message typedef struct LIST ENTRY
Arguments U16 position;
LIST ITEM item;
LIST_ENTRY, *P_LIST_ENTRY;
If the list is empty, pArgs->position is treated as if it were O. If pArgs->position is maxU16, the item is
inserted at the end of the list.
236 PENPOINT API REFERENCE
I Utility Classes
Part 9
If necessary, list items move to make room for the new item.
Observers are sent msgListNotifyAddition.
stsOK item added. pArgs->position contains the actual position of the new item.
msgListRemoveltem
The list searches for pArgs in the list and removes the item if found.
Takes LIST_ITEM, returns STATUS.
fdefine msgListRemoveItem MakeMsg(clsList, 11)
If the argument is in the list more than once, only the first instance of it is removed.
Observers are sent msgListNotifyDeletion.
stsListEmpty the list was empty
stsNoMatch item was not found
msgListRemoveltemAt
Removes the item in the list at pArgs->position.
Takes P_LIST_ENTRY, returns STATUS.
fdefine msgListRemoveItemAt MakeMsg(clsList, 3)
Messoge typedef struct LIST ENTRY
ArgvmertfS U16 position;
LIST_ITEM item;
LIST_ENTRY, *P_LIST_ENTRY;
Observers are sent msgListNotifyDeletion.
stsListEmpty the list was empty
stsOK item removed. pArgs->position contains the position of the removed item.
msgListReplaceltem
Replaces the item in the list at pArgs->position.
Takes P_L1ST_ENTRY, returns STATUS.
fdefine msgListReplaceItem MakeMsg(clsList, 4)
MessQge typedef struct LIST ENTRY
Argurnents U16 position;
LIST ITEM item;
LIST_ENTRY, *P_LIST_ENTRY;
If pArgs->position is maxU16, the last item in the list is replaced.
Observers are sent msgListNotifyReplacement.
stsListEmpty the list was empty
stsOK item was replaced. pArgs->item contains the old item and pArgs->position contains its old
position.
LlST.H 237
List Manipulation Messages
msgListGedtem
Gets the item in the list at pArgs->position.
Takes P_LIST_ENTRY, returns SfATUS.
*define msgListGetItem MakeMsg(clsList, 5)
Me55Qge typedef struct LIST ENTRY
Arguments U16 position;
LIST ITEM item;
LIST_ENTRY, *P_LIST_ENTRY;
Comments If pArgs->position is maxU16, the last item in the list is returned.
stsListEmpty the list was empty.
stsOK item found. pArgs->position contains the position of the item.
msgListFindltem
Searches for pArgs->item in the list.
Takes P _LIST_ENTRY, returns SfATUS.
*define msgListFindItem MakeMsg(clsList, 6)
Messog£, typedef struct LIST ENTRY
Arguments U16 position;
LIST_ITEM item;
LIST_ENTRY, *P_LIST_ENTRY;
stsNoMatch item was not found.
stsOK item was found. pArgs->position contains the position of the item.
msgListNumltems
Passes back the number of items in a list.
Takes P _UI6, returns STATUS.
*define msgListNumItems MakeMsg(clsList, 7)
msgListRemoveltems
Removes all of the items in a list.
Takes no arguments, returns STATUS.
*define msgListRemoveItems MakeMsg(clsList, 8)
The list's items are not affected in any way.
Observers are sent msgListNotifyEmpty.
msgListEnumltems
Enumerates the items in a list.
Takes P_LIST_ENUM, returns SfATUS.
*define msgListEnumItems MakeMsg(clsList, 9)
typedef struct LIST ENUM
U16 max;
U16 count;
P_LIST_ITEM pItems;
P_UNKNOWN pNext;
LIST_ENUM, * P_LIST_ENUM;
238 PENPOINT API REFERENCE
Part 9 / Utility Classes
This copies successive items from the list into an array. There are two approaches a client can use:
1. Let the list do all the work in one call. The list allocates an array of items which is passed back in
pArgs->pItems. You must free this array when you are done with a call to OSHeapBlockFree.
LIST_ENUM Should be filled in as follows:
max On input, should be 0. On output, will be the the number of items in the allocated block.
count On input, should be maxU16. On output will be the same as max.
pltems On input, should be null. On output, will be the pointer to the allocated block.
pNext On input, should be null.
2. Go through the items, a chunk at a time. Repeatedly call msgListEnumltems with the same
LIST_ENUM structure and processes successive groups of items. The call that returns stsEndOfData
indicates that the enumeration is finished (there are no more items to process). LIST_ENUM is used as
follows:
max On input and output, the number of items your block can hold
count On input, the same as max. On output, will be the number of items returned in block. (This
will be less than max the last time through.)
pltems On input, a pointer to a block that can hold at least max items.
pNext On input for first call, should be null. Do not modify thereafter.
stsEndOfData There are no more items to enumerate (list may be empty). When stsEndOfData is
returned, pArgs->count is zero. If you passed in pltems as null and max as 0, the block may not
have been allocated. Check pltems for nil and free it if it isn't.
msgListGetHeap
Passes back the heap used by the list.
Takes P_OS_HEAP_ID, returns STATUS.
#define msgListGetHeap MakeMsg(clsList, 12)
. Forwarding Messages
clsList responds to these messages by sending the specified message to each item in the list in turn.
clsList ignores the values returned by sending this message and always returns stsO K.
msgListCa11
Sends a message to each object in the list using ObjectCal1.
Takes P_LIST_NOTIFY, returns STATUS.
#define msgListCall MakeMsg(clsList, 13)
Messoge typedef struct LIST NOTIFY
Arguments MESSAGE msg; II In: message to send/post
P ARGS pArgs; II In: pArgs for message
SIZEOF lenSend; II In: length of pArgs
LIST_NOTIFY, * P_LIST_NOTIFY;
LlST.H 239
Observer Notifications
msgListSend
Sends a message to each object in the list using ObjectSend.
Takes P_LIST_NOTIFY, returns STATUS.
tdefine msgListSend MakeMsg(clsList, 14)
Message typedef struct LIST NOTIFY
Arguments MESSAGE msg; II In: message to send/post
P ARGS pArgs; II In: pArgs for message
SIZEOF lenSend; II In: length of pArgs
LIST_NOTIFY, * P_LIST_NOTIFY;
msgListPost
Sends a message to each object in the list using ObjectPost.
Takes P_LIST_NOTIFY, returns STATUS.
tdefine msgListPost MakeMsg(clsList, 15)
Message typedef struct LIST NOTIFY
Argt.HlHHlts MESSAGE msg; II In: message to send/post
P ARGS pArgsi II In: pArgs for message
SIZEOF lenSend; II In: length of pArgs
LIST_NOTIFY, * P_LIST_NOTIFY;
Observer Notifications
A list uses msgPostObservers to deliver all of its notification messages. (See clsmgr.h for more
information. )
msgListNotifyAddition
Notifies observers that an item has been added to the list.
Takes P_LIST_NOTIFY_ADDITION, returns STATUS.
typedef struct LIST- NOTIFY- ADDITION
LIST list; II the affected list
LIST ITEM listItem; II the affected list item
U16 count; II new number of entries
U8 reserved[40) ;
LIST_NOTIFY_ADDITION, * P_LIST_NOTIFY_ADDITIONi
tdefine msgListNotifyAddition MakeMsg ( clsList, 16 )
msgListNotifyDeletion
Notifies observers that an item has been deleted from the list.
Takes P_LIST_NOTIFY_DELETION, returns STATUS.
typedef struct LIST_NOTIFY_DELETION (
LIST list; II the affected list
LIST ITEM listItemi II the affected list item
U16 count; II new number of entries
U8 reserved[40);
LIST_NOTIFY_DELETION, * ~_LIST_NOTIFY_DELETION;
tdefine msgListNotifyDeletion MakeMsg ( clsList, 17 )
240 PENPOINT API REFERENCE
Part 9 / Utility Classes
msgListNotifyReplacement
Notifies observers that an item in the list has been replaced.
Takes P_LIST_NOTIFY_REPLACEMENT, returns STATUS.
typedef struct LIST_NOTIFY_REPLACEMENT {
LIST list; I I the affected list
LIST ITEM newListItem; II the new list item
LIST ITEM oldListItem; /1 the replaced list item
U16 index; II index of replace item
U8 reserved[40];
LIST_NOTIFY_REPLACEMENT, * P_LIST_NOTIFY_REPLACEMENT;
*define msgListNotifyReplacement MakeMsg ( clsList, 18 )
msgListNotifyEmpty
Notifies observers that a list is now empty.
Takes P_LIST_NOTIFY_EMPTY, returns STATUS.
Arguments typedef struct LIST_NOTIFY_EMPTY {
LIST list; 1/ the affected list
U8 reserved[40];
LIST_NOTIFY_EMPTY, * P_LIST_NOTIFY_EMPTY;
*define msgListNotifyEmpty MakeMsg ( clsList, 19 )
NOTEPAPR.N
This file contains the API definition for clsNotePaper. clsNotePaper inherits from clsView.
NotePaper is the view class for PenPoint's ink-management or note-taking building block. Most of the
code for the MiniN ote application actually resides in the building block. Other classes of the building
block are clsNPData (the data class), clsNPltem (the generic data item), clsNPScribbleltem (the ink
data item), clsNPTextltem (the text data item), and clsGestureMargin (the subclass of clsScrollWin
that implements MiniNote's gesture margin).
NotePaper provides standard PenPoint functionality including embedding, undo, move/copy, import,
export, option sheets, and marks. (Supporting marks means that search and replace, spell, proof, and
reference buttons are all supported.)
NotePaper displays (and alters) the contents of an NPData object. For PenPoint 1.0, NotePaper keeps
all of the items in its data object in a coordinate system with (0,0) its upper-left corner. As a result, all
the items in the data object have a negative y coordinate. This means that as the NotePaper window
grows in width and height, its contents remain relative to the top-left corner of the page.
A sample applications (called npapp or "NotePaper App") demonstrating the use of the ink building
block is included in the SDK. The ink building block is distributed as part of the SDK as a distributed
DLL. The DLL and all resources used by the ink building block are included in the SDK in the
DLL\NOTEPAPR directory. The resources in that directory include:
notepaper.res: contains all resources used by NotePaper
paper.res: contains the 8 bitmaps representing paper styles
pen. res: contains the 4 bitmaps representing pen styles
strings.rc: contains the source for quick help, error text,
and undo strings
#ifndef NOTEPAPR INCLUDED
#define NOTEPAPR-INCLUDED
#ifndef VIEW INCLUDED
#include <view.h>
#endif
#ifndef SYSFONT INCLUDED
#include <sysfont.h>
#endif
#ifndef ITOGGLE INCLUDED
#include <itoggle.h>
#endif
Messages
Next up: none; Recycle: 11-51 5358-101 103 106 120-127
msgNewDefaults
Initialize pArgs.
Takes P_NOTE_PAPER_NEW, returns STATUS.
typedef struct {
NOTE_PAPER_STYLE style; II as in NOTE_PAPER_METRICS
NP_PAPE~STYLE paperStyle; II as in NOTE- PAPER- METRICS
SYSDC FONT SPEC paperFont; II as in NOTE PAPER METRICS
- -
COORD16 lineSpacing; II as in NOTE- PAPER- METRICS
U8 penStyle; II as in NOTE- PAPER- METRICS
S32 spares[6];
NOTE_PAPER_NEW_ONLY, *P_NOTE_PAPER_NEW_ONLY;
#define notePaperNewFields \
viewNewFields \
NOTE_PAPER_NEW_ONLY notePaper;
typedef struct {
notePaperNewFields
NOTE_PAPER_NEW, *P_NOTE_PAPER_NEW;
NOTEPAPR.H 243
Messages
msgNotePaperGetMetrics
Passes back receiver's metrics.
msgNotePaperGetDclnfo
Passes back the drawing contexts used by receiver.
Takes P_NOTE_PAPER_DC_INFO, returns STATUS.
#define msgNotePaperGetDcInfo MakeMsg(clsNotePaper, 4)
typedef struct
U32 units; II currently, msgDcUnitsTwips
OBJECT dc; I I transformed dc in "units"
OBJECT dcPen; II transformed dc in pen units
U32 reserved[4];
NOTE PAPER_DC_INFO, *P_NOTE_PAPER_DC_INFO;
msgNotePaperGetSelType
Passes back information about the types of items selected in receiver.
Takes P_NOTE_PAPER_SEL_TYPE, returns STATUS.
#define msgNotePaperGetSelType MakeMsg(clsNotePaper, 116)
244 PENPOINT API REFERENCE
I Utility Classes
Part 9
msgNotePaperSetEditMode
Sets receiver to either gesture/edit (true) or writing/ink (false) mode.
Takes BOOLEAN, returns STATUS.
idefine msgNotePaperSetEditMode MakeMsg(clsNotePaper, 102)
msgNotePaperSetPaperAndPen
Sets paperStyle, lineSpacing, pen Color, and penWeight.
Takes P_NOTE_PAPER_METRICS, returns STATUS.
idefine msgNotePaperSetPaperAndPen MakeMsg(clsNotePaper, 104)
Message typedef struct NOTE_PAPER_METRICS {
Arguments NOTE_PAPER_STYLE style;
SYSDC FONT SPEC paperFont; II defines the font for the paper
NP_PAPER_STYLE paperStyle; II one of the NP_PAPER_STYLE values
COORD16 lineSpacing; II (in points) determines font size and
II vertical spacing
U8 penStyle; II use the NPPenStyle() macro
NOTE_PAPER_METRICS, * P_NOTE_PAPER_METRICS;
This message does not affect the pen style for selected items.
msgNotePaperSetPenStyle
Sets the pen style for selected items as well as the default for new items.
Takes U32, returns STATUS.
idefine msgNotePaperSetPenStyle MakeMsg(clsNotePaper, 109)
msgNotePaperGetPenStyle
Gets the pen style for selected items (or the default if nothing selected).
Takes U32, returns STATUS.
idefine msgNotePaperGetPenStyle MakeMsg(clsNotePaper, 112)
msgNotePaperSetStyle
Sets the receiver's style values.
Takes P_NOTE_PAPER_STYLE, returns STATUS.
idefine msgNotePaperSetStyle MakeMsg(clsNotePaper, 2)
NOTEPAPR.H 245
Messages
msgNotePaperGetStyle
Passes back the receiver's style values.
Takes P _NOTE_PAPER_STYLE, returns STATUS.
#define msgNotePaperGetStyle MakeMsg(clsNotePaper, 3)
MessQgc typedef struct NOTE NP PAPER STYLE {
ArgIJmcnts U16 bEditMode - - 1, II writing/ink vs. gestureledit mode
bAutoGrow 1, II auto grow height as user enters data?
bWidthOpts 1, II include page widths in option sheet
bHideTopRule 1, II don't paint the top ruling line for
II the npPaperRuledxxx paper style
bVirtualHeight 1, II if set, NotePaper grows itself into
II a long thin window and responds to
II scroll win messages
reserved : 11; II always set to 0
U16 reserved1;
NOTE_PAPER_STYLE, *P_NOTE_PAPER_STYLE;
msgNotePaperTranslate
Translates untranslated scribbles in the selection.
Takes P_NULL, returns STATUS.
#define msgNotePaperTranslate MakeMsg(clsNotePaper, 113.)
msgNotePaperUntranslate
Untranslates translated scribbles in the selection.
Takes P_NULL, returns STATUS.
#define msgNotePaperUntranslate MakeMsg(clsNotePaper, 114)
msgNotePaperEdit
Edits text and translates and edits scribbles in the selection.
Takes P _NULL, returns STATUS.
#define msgNotePaperEdit MakeMsg(clsNotePaper, 115)
msgNotePaperTidy
Tidies the selection by normalizing the spacing of items each line.
Takes P_NULL, returns STATUS.
#define msgNotePaperTidy MakeMsg(clsNotePaper, 105)
The inter-item spacing is determined by sending msgNPltemGetWordSpacing to each item to be
tidied.
246 PENPOINT API REFERENCE
Part 9 / Utility Classes
msgNotePaperCenter
Centers the entire selection.
Takes P _NULL, returns STATUS.
fdefine msgNotePaperCenter MakeMsg(clsNotePaper, 107)
Comments The selection is centered on the page as a whole, not line by line.
msgNotePaperAlign
Aligns the selection according to pArgs.
Takes U32, returns STATUS.
fdefine msgNotePaperAlign MakeMsg(clsNotePaper, 108)
fdefine npAlignLeft 1
fdefine npAlignRight 2
Comments Alignment takes place relative to the bounding box of the selection.
msgNotePaperMerge
Joins scribbles and text in the selection.
Takes P_NULL, returns STATUS.
fdefine msgNotePaperMerge MakeMsg(clsNotePaper, 110)
Consecutive scribble items are combined into a single scribble item. Adjacent text items are combined
into a single text item. Any subclass of clsNPltem that can respond to msgNPltemCanJoin and
msgNPltemJoin can determine its own merging behavior.
msgNo tePaperSplit
Splits scribbles and text.
Takes P_NULL, returns STATUS.
fdefine msgNotePaperSplit MakeMsg(clsNotePaper, 111)
First msgNotePaperSplitAsWords is self-sent. If stsRequestDenied is returned, then
msgNotePaperSplitAsAtoms is self-sent.
msgNotePaperAddMenus
Modifies the passed in menu bar and appends standard NotePaper menus.
Takes OBJECT, returns STATUS.
fdefine msgNotePaperAddMenus MakeMsg(clsNotePaper, 117)
msgNotePaperAddModeCtrl
Adds the standard NotePaper mode icon to the passed in menu bar.
Takes OBJECT, returns STATUS.
fdefine msgNotePaperAddModeCtrl MakeMsg(clsNotePaper, 118)
NOTEPAPR.H 247
Messages
msgNotePaperClear
Deletes all items in receiver.
Takes pNull, returns SfATUS.
#define msgNotePaperClear MakeMsg(clsNotePaper, 119)
msgNotePaperClearSel
Deletes all selected items in receiver.
Takes pNull, returns SfATUS.
#define msgNotePaperClearSel MakeMsg(clsNotePaper, 11)
msgNotePaperlnsertLine
Inserts a blank line above the selection.
Takes P_NULL, returns SfATUS.
#define msgNotePaperlnsertLine MakeMsg(clsNotePaper, 5)
msgNotePaperSelectRect
Selects items within rect in the receiver's data.
Takes P_RECT32, returns STATUS.
#define msgNotePaperSelectRect MakeMsg(clsNotePaper, 1)
Return Value stsNotePaperNoHit Returned if nothing selected.
msgNotePaperSelectLine
Selects items whose baselines intersect rect in the receiver's data.
Takes P_RECT32, returns STATUS.
#define msgNotePaperSelectLine MakeMsg(clsNotePaper, 6)
stsN otePaperN oHit Returned if nothing selected.
msgNotePaperDeselectLine
Deselects items whose baselines intersect fect in the receiver's data.
Takes P _RECT32, returns STATUS.
#define msgNotePaperDeselectLine MakeMsg(clsNotePaper, 7)
stsNotePaperNoHit Returned if nothing deselected.
msgNotePaperDeleteLine
Deletes items whose baselines intersect rect in the view's data.
Takes P_RECT32, returns STATUS.
#define msgNotePaperDeleteLine MakeMsg(clsNotePaper, 8)
Return Value stsN otePaperN oHit Returned if nothing deleted.
248 PENPOINT API REFERENCE
Part 9 / Utility Classes
msgNotePaperScribble
Handles scribble (including creating and insert object into view's data).
Takes OBJECT, returns STATUS.
*define msgNotePaperScribble MakeMsg(clsNotePaper, 9)
The passed scribble's origin should be relative to the lower-left corner of the receiver.
msgGWinGesture
Self-sent to process the gesture.
Takes P_GWIN_GESTURE, returns STATUS.
*define msgGWinGesture MakeMsg(clsGWin, 2)
The standard behavior of this gesture is defined in gwin.h. In addition, subclasses can return
stsNotePaperTreatAslnk if they want the gesture to be treated as ink. In that case, an instance of
clsNPScribbleltem will be created from the gesture's strokes.
clsNotePaper's response to the various gestures is described in the MiniNote quick reference card. In
gesture mode, gesture can be made anywhere in the window. However, any unrecognized gesture of
more than two strokes will be treated as ink. In writing mode, most draw~ng is treated as ink (unless it is
drawn over the selection). However, the following gestures are allowed even in writing mode:
xgsScratchOut: delete items
xgsPigtailVert: delete items
xgs2Tap: select item (if over an item)
xgs3Tap: select line
xgsPlus: toggle item (if over an item)
xgsTapHold: begin area selection
xgsCircleCrossOut: undo
xgsDblCircle: create reference button
xgsUpCaretDot: insert date/time
xgsDblUpCaret: embed stationery
xgsHorzCounterFlick: toggle mode
xgsVertCounterFlick: toggle application borders
stsNotePaperTreatAslnk The gesture should be treated as ink.
gwin.h
msgAppSelectAll
Selects all items in the view.
Takes P_NULL, returns STATUS.
app.h
msgSelDelete
Deletes selected items in the view.
Takes P_NULL, returns STATUS.
Close the space that the selection occupies if an entire line or lines is selected and this message does is
not sent within a move/copy episode.
sel.h
NOTEPAPR.H 249
Quick help and window tags
msgOptionAddCards
Creates and adds the Pen and Paper option sheets.
Takes P_OPTION_TAG, returns STATUS.
This message is usually send to the NotePaper instance by the app framework if the instance holds the
selection, is the client win of the app's main win, or is the client win of a scroll win that is the app's main
win'. However, to force NotePaper's option sheets to appear in the "Option" menu in other
circumstances, this message should be forwarded to the NotePaper instance by the application if
pArgs->tag is tagAppDocOptSheet.
app.h.h
msglmportQuery
Indicates whether or not passed in file can be imported.
Takes P_IMPORT_QUERY, returns STATUS. Category: class message.
NotePaper will respond positively to this message if the first 50f the file are printable ASCII characters.
import.h
msglmport
Imports the passed in file.
Takes P_IMPORT_DOC, returns STATUS.
After the file is imported, receiver's length is grown to accommodateimported text. If receiver's width is
zero, it is grown to sixwide.
import.h
msgExportGetFormats
Passes back list of formats that can be exported.
Takes P_EXPORT_LIST, returns STATUS.
export.h
msgExport
Writes an ASCII version of receiver's data to the passed in file.
Takes P_EXPORT_DOC, returns STATUS.
A translated text version of each scribble item is written out.
export.h
Mode icons
Mode icons (tags from itoggle.h) The bitmaps corresponding to the two tags below are found in
theSystemResFile.
#define tagNotePaperWritelcon taglconToggleOff
#define tagNotePaperEditlcon taglconToggleOn
Quick help tag for mode icons
#define tagNotePaperModelcon MakeTag(clsNotePaper, 1)
Windows
Quick help tags for the main view and for the gesture margin.
#define tagNotePaper MakeTag(clsNotePaper, 4)
#define tagNotePaperMargin MakeTag(clsNotePaper, 5)
Edit Menu
#define tagNotePaperTranslate MakeTag(clsNotePaper, 6)
#define tagNotePaperEdit MakeTag(clsNotePaper, 7)
#define tagNotePaperClear MakeTag(clsNotePaper, 34)
#define tagNotePaperlnsertLine MakeTag(clsNotePaper, 35)
~~ Pen Menu
#define tagPenMenu MakeTag(clsNotePaper, 3)
#define tagPenFineBlack MakeTag(clsNotePaper, 110)
#define tagPenBoldBlack MakeTag(clsNotePaper, 111)
#define tagPenFineGray MakeTag(clsNotePaper, 112)
#define tagPenBoldGray MakeTag(clsNotePaper, 113)
Arrange Menu
#define tagArrangeMenu MakeTag(clsNotePaper, 8)
#define tagNotePaperTidy MakeTag(clsNotePaper, 9)
#define tagNotePaperCenter MakeTag(clsNotePaper, 10)
#define tagNotePaperAlignLeft MakeTag(clsNotePaper, 11)
#define tagNotePaperAlignRight MakeTag(clsNotePaper, 12)
#define tagNotePaperMerge MakeTag(clsNotePaper, 13)
#define tagNotePaperSplitAsWords MakeTag(clsNotePaper, 14)
#define tagNotePaperSplit MakeTag(clsNotePaper, 15)
Insertion Pad
#define tagNotePaperSkip MakeTag(clsNotePaper, 36)
Messages
Next up: 39; Recycle: 4 5 6 7 15 20 33 34
msgNewDefaults
Initialize pArgs.
Takes P_NP_DATA_NEW, returns STATUS.
typedef struct {
XY32 lineSpacing;
XY32 baseline;
BOOLEAN isSubData; II private to clsNPData
S32 spare1;
S32 spare2;
NP_DATA_NEW_ONLY, *P_NP_DATA_NEW_ONLY;
fdefine npDataNewFields \
objectNewFields \
NP_DATA_NEW_ONLY npData;
typedef struct {
npDataNewFields
} NP_DATA_NEW, *P_NP_DATA_NEW;
Zeroes out pArgs->npData and sets:
pArgs->npData.lineSpacing.x = 0;
pArgs->npData.lineSpacing.y = 360; II 360 twips 18 points 1/4"
pArgs->npData.baseline.x = 0;
pArgs->npData.baseline.y = 360;
254 PENPOINT API REFERENCE
Part 9 / Utility Classes
msgNPDatalnsertltem
Add item to the data base.
Takes OBJECT, returns STATUS.
#define msgNPDataInsertItem MakeMsg(c1sNPData, 8)
msgNPDatalnsertltemFromView
Add item to the data base.
Takes P_NP_DATA_ADDED_NP_ITEM_VIEW, returns STATUS.
#define msgNPDataInsertItemFromView MakeMsg(c1sNPData, 38)
typedef struct {
OBJECT item; II item that has been added
OBJECT view; II view that added the item
NP_DATA_ADDED_NP_ITEM_VIEW, *p NP DATA_ADDED_NP_ITEM_VIEWi
Observers will be notified of which view is responsible for the addition.
msgNPDataDeleteltem
Delete an item from the data base.
Takes OBJECT, returns STATUS.
#define msgNPDataDe1eteItem MakeMsg(c1sNPData, 9)
Returns stsFailed if item is not found.
msgNPDataMoveltem
Move an item within the data base.
Takes P_NP_DATA_XY, returns STATUS.
#define msgNPDataMoveItem MakeMsg(c1sNPData, 10)
typedef struct {
OBJECT item; II item to be moved
XY32 xy; II new position for item
NP_DATA_XY, *P_NP_DATA_XY;
msgNPDataMoveltems
Move all items below pArgs->y by pArgs->yDelta.
Takes P_MOVE_ITEMS, returns STATUS.
#define msgNPDataMoveItems MakeMsg(c1sNPData, 1)
Argoments typedef struct {
COORD32 y;
COORD32 yDe1ta;
MOVE_ITEMS, *P_MOVE_ITEMSi
NPDATA.H 255
Messages used to enumerate over data
ENUM_CALLBACK
This template describes the the callback function used in item enumeration.
Returns SfATUS.
typedef struct
OBJECT data; II in - the data being enumerated over
OBJECT item; II in - the item being enumerated
P UNKNOWN clientData; II in - the client supplied data (or pointer)
NP_DATA_ITEM, *P_NP_DATA_ITEM;
typedef STATUS FunctionPtr(P_ENUM_CALLBACK) (P_NP_DATA_ITEM pltem);
Your callback function takes a single parameter of type P _NP _DATA_ITEM. The clientData field is a copy
of that you passed into the enumeration message using the ENUM_ITEM or ENUM_RECT_ITEM
structures. During enumeration, you can add new items or delete the "current" item begin enumerated.
If you delete an item but want to keep using it, use must send it msgNPltemHold before deleting it and
msgNPltemRelease when you are done using it.
Some of the enumeration messages refer to bPaintOrder or "Reverse" order. Paint order refers to the
top-to-bottom, left-to-right ordering of items. Non-paint or reverse order is simply the opposite
ordering. Items are sorted first by line and then by their left edge. An item is considered to be on the line
closest to its baseline. The lines are "line spacing" apart starting from the top of the page. If no lines are
displayed to the user, it is possible that non-intuitive item ordering will result.
Return an error status from the callback to terminate the enumeration.
msgNPDataEnumOverlappedltems
Enumerates each item that overlaps the given rectangle.
Takes P_ENUM_RECT_ITEMS, returns STATUS.
#define msgNPDataEnumOverlappedltems MakeMsg(clsNPData, 2)
Argurnents typedef struct {
P_ENUM_CALLBACK function; II in callback function described above
RECT32 hitRect; II in enum items overlapping hitRect
BOOLEAN bPaintOrder; II in enum in paint order?
P UNKNOWN clientData; II in
ENUM_RECT_ITEMS, *P_ENUM_RECT_ITEMS;
msgNPDataEnumBaselineltems
Enumerates each item whose baseline overlaps the given rectangle.
Takes P_ENUM_RECT_ITEMS, returns STATUS.
#define msgNPDataEnumBaselineltems MakeMsg(clsNPData, 19)
Messoge typedef struct {
Arguments P_ENUM_CALLBACK function; II in callback function described above
RECT32 hitRect; II in enum items overlapping hitRect
BOOLEAN bPaintOrder; II in enum in paint order?
P UNKNOWN clientData; II in
ENUM_RECT_ITEMS, *P_ENUM_RECT_ITEMS;
-~---.---~-----
256 PEN POINT API REFERENCE
Part 9 / Utility Classes
msgNPDataEnumSelectedItems
Enumerates each item that is selected (in paint order).
Takes P_ENUM_ITEMS, returns STATUS.
tdefine msgNPDataEnumSelectedltems MakeMsg(clsNPData, 13)
typedef struct {
P_ENUM_CALLBACK function; II in -- callback function described above
P UNKNOWN clientData; II in
ENUM_ITEMS, *P_ENUM_ITEMS;
msgNPDataEnumSelectedItemsReverse
Enumerates each item that is selected (in reverse paint order).
Takes P_ENUM_ITEMS, returns STATUS.
tdefine msgNPDataEnumSelectedltemsReverse MakeMsg(clsNPData, 26)
Messuge typedef struct {
Avgvm©t1f'S P_ENUM_CALLBACK function; II in -- callback function described above
P UNKNOWN clientData; II in
ENUM_ITEMS, *P_ENUM_ITEMS;
msgNPDataEnumAllltems
Enumerates each item (in paint order).
Takes P_ENUM_ITEMS, returns STATUS.
tdefine msgNPDataEnumAllltems MakeMsg(clsNPData, 14)
M©ss;ug0 typedef struct {
Argun1©rtfs P_ENUM_CALLBACK function; II in -- callback function described above
P UNKNOWN clientData; II in
ENUM_ITEMS, *P_ENUM_ITEMS;
msgNPDataEnumAllltemsReverse
Enumerates each item (in reverse paint order).
Takes P_ENUM_ITEMS, returns STATUS.
fdefine msgNPDataEnumAllltemsReverse MakeMsg(clsNPData, 27)
M0ssu9© typedef struct {
Ar9\IJm0rtfs; P_ENUM_CALLBACK function; II in -- callback function described above
P UNKNOWN clientData; II in
ENUM_ITEMS, *P_ENUM_ITEMS;
msgNPDataSendEnumSelectedltems
Enumerates each selected item (in paint order).
Takes P_SEND_ENUM_ITEMS, returns STATUS.
tdefine msgNPDataSendEnumSelectedltems MakeMsg(clsNPData, 22)
typedef struct {
P_ENUM_CALLBACK function; II in -- callback function described above
U8 clientData[32]; II in/out
SEND_ENUM_ITEMS, *P_SEND_ENUM_ITEMS;
NPDATA.H 257
Messages used to access internal state
Comments This message is the same as msgNPDataEnumSelectedltems, except that it it intended to be used in
conjunction with ObjectSend rather than ObjectCall. It is used to enumerate the items in a data object
that is not in the caller's process. Rather than a pointer to the client data being passed around, the client
data is put into an array that is passed around.
msgNPDataGetCurrendtem
Passes back the current item in the receiver.
Takes P_OBJECT, returns STATUS.
#define msgNPDataGetCurrentltem MakeMsg(clsNPData, 30)
msgNPDataGetNextltem
Increments the current item to the next item and sets *pArgs to it.
Takes P_OBJECT, returns STATUS.
#define msgNPDataGetNextltem MakeMsg(clsNPData, 31)
Set *pArgs to the current item before sending this message. If you set it to NULL, the first item will be
returned. The next time you call this message after you reach the last item, stsEndOfData will be
returned and *pArgs will be set to objNull.
msgNPDataSelectedCount
Passes back the count of selected items in receiver.
Takes P_U32, returns STATUS.
#define msgNPDataSelectedCount MakeMsg(clsNPData, 18)
msgNPDataSetBaseline
Sets the receiver's baseline (used for alignment).
Takes P_XY32, returns STATUS.
#define msgNPDataSetBaseline MakeMsg(clsNPData, 24)
msgNPDataGetBaseline
Gets the receiver's baseline (used for alignment).
Takes P_XY32, returns STATUS.
#define msgNPDataGetBaseline MakeMsg(clsNPData, 25)
258 PENPOINT API REFERENCE
Part 9 I Utility Classes
msgNPDataSetLineSpacing
Sets receiver's line spacing (used as the font size).
Takes P_XY32, returns STATUS.
fdefine msgNPDataSetLineSpaeing MakeMsg(elsNPData, 35)
msgNPDataGetLineSpacing
Gets receiver's line spacing (used as the font size).
Takes P_XY32, returns STATUS.
fdefine msgNPDataGetLineSpaeing MakeMsg(elsNPData, 36)
msgNPDataGetBounds
Passes back the bounding rectangle for all items in receiver.
Takes P_RECT32, returns STATUS.
fdefine msgNPDataGetBounds MakeMsg(elsNPData, 23)
msgNPDataGetSelBounds
Passes back the bounding rectangle for all selected items in receiver.
Takes P_RECT32, returns STATUS.
fdefine msgNPDataGetSelBounds MakeMsg(elsNPData, 32)
msgNPDataGetFontSpec
Passes back the receiver's font specification.
Takes P_SYSDC_FONT_SPEC, returns STATUS.
fdefine msgNPDataGetFontSpee MakeMsg(elsNPData, 28)
msgNPDataSetFontSpec
Sets the receiver's font specification.
Takes P_SYSDC_FONT_SPEC, returns STATUS.
fdefine msgNPDataSetFontSpee MakeMsg(elsNPData, 29)
msgNPDataGetCachedDCs
Passes back DC's with normal and bold fonts at the given line spacing.
Takes P_NP_DATA_DC, returns STATUS.
fdefine msgNPDataGetCaehedDCs MakeMsg(elsNPData, 37)
typedef struet
OBJECT deNormal; II normal font de
OBJECT deBold; II bold font de
NP_DATA_DCS, *P_NP_DATA_DCS;
Used by items that want to measure text without the overhead of creating a DC. These DC's cannot be
used for drawing!!
NPDATA.H 259
Messages sent to observers
OBJECT data; II the data that the item has been added to '"
OBJECT item; II item that has been added
lL
OBJECT view; II view that added the item
NP_DATA_ADDED_ITEM, *P_NP_DATA_ADDED_ITEM;
msgNPDataItemChanged
Observers notified when item has been changed.
Takes P_NP _DATA_ITEM_CHANGED, returns STATUS. Category: observer notification.
#define msgNPDataItemChanged MakeMsg(clsNPData, 12)
typedef struct {
OBJECT data; II the data
OBJECT item; II item that has been changed
OBJECT view; II view that changed the item
RECT32 bounds; II maximum bounds affected by the change
NP_DATA_ITEM_CHANGED, *P_NP_DATA_ITEM_CHANGED;
Currently called when item is selected or deselected.
msgNPDataHeightChanged
Observers notified when receiver's height has been changed.
Takes P_NP_DATA_ITEM_CHANGED, returns STATUS. Category: observer notification.
#define msgNPDataHeightChanged MakeMsg(clsNPData, 21)
Message typedef struct {
AW9vmerti's OBJECT data; II the data
OBJECT item; II item that has been changed
OBJECT view; II view that changed the item
RECT32 bounds; II maximum bounds affected by the change
NP_DATA_ITEM_CHANGED, *P_NP_DATA_ITEM_CHANGED;
Currently called by msgNPDataMoveltems. The bounds.origin.y field of pArgs contains the delta in
the height of the data object.
msgNPDataItemEnumDone
Observers notified when an enumeration that deleted or moved items is complete.
Takes NULL, returns STATUS. Category: observer notification.
#define msgNPDataItemEnurnDone MakeMsg(clsNPData, 16)
When this message is received by an observer client, all deletions have been completed and all moved
items have been temporarily removed from the data object. Thus the client has the option of repainting
all remaining items at this time and then painting moved items as they are reinserted.
This message is handled by clsNotePaper and should not be handled by subclasses of dsNotePaper.
NPITEM.H
This file contains the API definition for clsNPltem.
clsNPltem inherits from clsObject.
NPltem is the item class for PenPoint's ink-management or note-taking building block. While instances
of clsNPltem are never created, (subclasses like clsNPScribbleltem and clsNPTexdtem are more
interesting), NPltem defines a protocol as well as doing much of the work for basic operations.
To add new item types to the ink building block, create a subclass of clsNPltem that implements the
messages defined below in the section: "Messages that are usually overridden by subclasses." Once this
new item is inserted into a clsNPData object it will show up in the clsNotePaper view that observes that
object. The new item will then behave like the other item in terms of basic operations like move, copy,
deletion, style changes, etc.
#ifndef NPITEM INCLUDED
#define NPITE~INCLUDED
#ifndef GEO INCLUDED
#include <geo.h>
#endif
#ifndef CLSMGR INCLUDED
#include <clsmgr.h>
#endif
#ifndef BORDER INCLUDED
#include <border.h>
#endif
Messages
Next up: 44; Recycle: 3
msgNewDefaults
Initialize pArgs.
Takes P_NP_ITEM_NEW, returns SfATUS.
typedef struct NP ITEM NEW ONLY
RECT32 bounds;-
XY16 baseline;
BOOLEAN selected;
U32 penStyle; II (Pen styles are defined in notepapr.h.)
S32 spare2;
NP_ITEM_NEW_ONLY, *P_NP_ITEM_NEW_ONLY;
262 PENPOINT API REFERENCE
Part 9 / Utility Classes
fdefine npltemNewFields \
objectNewFields \
NP_ITEM_NEW_ONLY item;
typedef struct NP_ITE~NEW {
npltemNewFields
} NP_ITEM_NEW, *P_NP_ITEM_NEW;
Zeroes out pArgs->npData and sets:
pArgs->item.penStyle = penFineBlack;
msgNPItemGetPenStyle
Get the pen style of an item. (Pen styles are defined in notepapr.h.)
Takes P_U32, returns STATUS.
fdefine msgNPltemGetPenStyle MakeMsg(clsNPltem, 35)
msgNPItemDelete
Delete item from its data.
Takes pNuIl, returns SfATUS.
fdefine msgNPltemDelete MakeMsg(clsNPltem, 11)
Deleting an item decrements its reference count and can cause the item to be destroyed. To prevent, call
msgNPltemHold before calling msgNPltemDelete. Then call msgNPltemRelease after working with
the item.
msgNPItemPaintBackground
Paints a gray background if the receiver is selected.
Takes P _NP_ITEM_DC, returns STATUS.
fdefine msgNPltemPaintBackground MakeMsg(clsNPltem, 41)
typedef struct
OBJECT dc; II DC to paint into
OBJECT dcPen; II equivalent DC in pen units
NP_ITEM_DC, *P_NP_ITEM_DC;
Subclasses should override this message if they want a different type of selection feedback.
msgNPItemSelect
Selects or deselects item.
Takes BOOLEAN, returns SfATUS.
fdefine msgNPltemSelect MakeMsg(clsNPlte~, 14)
msgNPItemSelected
Passes back item's selection status.
Takes P_BOOLEAN, returns STATUS.
fdefine msgNPltemSelected MakeMsg(clsNPltem, 15)
NPITEM.H 263
msgNPltemMove
Moves item to the indicated position.
Takes P_XY32 , returns STATUS.
#define msgNPltemMove MakeMsg(clsNPltem, 5)
msgNPltemDelta
Moves item by the indicated amount.
Takes P_XY32 , returns STATUS.
#define msgNPltemDelta MakeMsg(clsNPltem, 6)
msgNPltemGetViewRect
Passes back receiver's bounding rectangle.
Takes P_RECT32, returns STATUS.
#define msgNPItemGetViewRect MakeMsg(clsNPItem, 19)
msgNPltemHitRect
Returns stsOK if receiver's bounds overlaps pArgs.
Takes P_RECT32, returns STATUS.
#define msgNPItemHitRect MakeMsg(clsNPItem, 9)
msgNPltemGetMetrics
Gets the item's metrics.
Takes P_NP_ITEM_METRICS, returns SfATUS.
#define msgNPItemGetMetrics MakeMsg(clsNPItem, 20)
typedef struct NP ITEM METRICS {
U8 selected: 1, II is item selected?
marked: 1, II is item marked (in the clsMark sense)?
reserved: 6;
U8 ref Count; II number external references to item
II (not generally interesting to subclasses)
XY16 baseline; II item's horizontal and vertical baseline
II (currently only the y value is used)
RECT32 bounds; II window relative bounds
II (with respect to its bounds' origin)
OBJECT data; II data object that item is in
OBJECT adjunct; II see msgNPItemSetAdjunct for more information
U32 penStyle; II item's pen style
NP_ITEM_METRICS, *P_NP_ITEM_METRICS;
msgNPltemSetBaseline
Sets receiver's baseline.
Takes P_XY32, returns STATUS.
#define msgNPItemSetBaseline MakeMsg(clsNPItem, 21)
264 PENPOINT API REFERENCE
Part 9 I Utility Classes
msgNPltemSetBounds
Sets receiver's bounds.
Takes P_RECT32, returns STATUS.
#define msgNPltemSetBounds MakeMsg(clsNPltem, 30)
msgNPltemHold
Increments the reference count for the item.
Takes NULL, returns STATUS.
#define msgNPltemHold MakeMsg(clsNPltem, 22)
When the reference count for an item drops to zero, it is destroyed.
msgNPltemRelease
Decrements the reference count for the item.
Takes NULL, returns STATUS.
#define msgNPltemRelease MakeMsg(clsNPltem, 23)
When the reference count for an item drops to zero, it is destroyed.
msgNPltemAlignToBaseline
Moves item so that it align to passed in line spacing.
Takes P_XY32, returns STATUS.
#define msgNPltemAlignToBaseline MakeMsg(clsNPltem, 33)
Comments The item should be aligned against the y-value of pArgs.
msgNPltemPaint
Paints item using the passed in drawing contexts.
Takes P_NP_ITEM_DC, returns STATUS.
#define msgNPltemPaint MakeMsg(clsNPltem, 12)
Message typedef struct
Arguments OBJECT dc; II DC to paint into
OBJECT dcPen; II equivalent DC in pen units
NP_ITEM_DC, *P_NP_ITEM_DC;
msgNPltemSetPenStyle
Sets the item's pen style. (pen styles are defined in notepapr.h.)
Takes U32, returns STATUS.
#define msgNPltemSetPenStyle MakeMsg(clsNPltem, 34)
NPITEM.H 265
Messages that are usually overridden by subclasses
msgNPltemSetOrigin
Set receiver's origin.
Takes P_XY32 , returns STATUS.
*define msgNPltemSetOrigin MakeMsg(clsNPltem, 18)
msgNPltemScratchOut
Handles the scratch-out gesture on an item.
Takes P _RECT32, returns STATUS.
*define msgNPltemScratchOut MakeMsg(clsNPltem, 24)
Comments Scribble items handle this message by deleting strokes that overlap pArgs. Other items simply delete
themselves.
msgNPltemSplitGesture
Handles the split gesture on an item.
Takes P_XY32 , returns STATUS.
*define msgNPltemSplitGesture MakeMsg(clsNPltem, 25)
The pArgs refers to the "hot point" for the gesture.
msgNPltemSplit
Split an item into its constituent items.
Takes NULL, returns STATUS.
*define msgNPltemSplit MakeMsg(clsNPltem, 26)
msgNPltemSplitAsWords
Splits receiver into words. Deletes receiver, inserts new items.
Takes NULL, returns STATUS.
*define msgNPltemSplitAsWords MakeMsg(clsNPltem, 16)
stsltemNoSplit Returned if nothing was split.
msgNPltemJoin
Joins receiver and OBJECT and deletes OBJECT.
Takes OBJECT, returns STATUS.
*define msgNPltemJoin MakeMsg(clsNPltem, 27)
msgNPltemTie
Joins OBJECT and receiver and deletes them. Inserts new object.
Takes OBJECT, returns STATUS.
*define msgNPltemTie MakeMsg(clsNPltem, 17)
266 PEN POINT API REFERENCE
Part 9 / Utility Classes
msgNPltemGetScribble
Pass back the item's scribble.
Takes P_OBJECT, returns STATUS.
fdefine msgNPltemGetScribble MakeMsg(clsNPltem, 4)
Subclasses that do not contain a scribble should not respond to this message.
msgNPltemGetString
Passes back the text string for the item.
Takes PP_STRING, returns STATUS.
fdefine msgNPltemGetString MakeMsg(clsNPltem, 38)
Subclasses that do not have a text representation should not respond to this message.
clsNPScribbleltem responds to this message by translating its scribble and returning the resulting string.
The sender of this message should either use the passed back string immediately or make a copy of it.
msgNPltemSetString
Sets the text string for the item.
Takes P_STRING, returns STATUS.
fdefine msgNPltemSetString MakeMsg(clsNPltem, 42)
Not all items can handle this message.
msgNPltemToText
Item converts itself to a text item, passes back text item.
Takes P_OBJECT, returns STATUS.
fdefine msgNPltemToText MakeMsg(clsNPltem, 7)
Receiver deletes itself from its data and inserts the text item. If pArgs is pNull, the text item is not
passed back.
msgNPltemToScribble
Item converts itself to a scribble item.
Takes P_ARGS, returns STATUS.
fdefine msgNPltemToScribble MakeMsg(clsNPltem, 36)
Receiver deletes itself from its data and inserts the scribble item.
msgNPltemHitRegion
Returns stsOK if receiver's path overlaps pArgs.
Takes P_RECT32, returns STATUS.
fdefine msgNPltemHitRegion MakeMsg(clsNPltem, 10)
NPITEM.H 267
Messages that are usually overridden by subclasses
msgNPltemCalcBaseline
Calculate and set receiver's baseline.
Takes P_XY32 , returns STATUS.
tdefine msgNPltemCalcBaseline MakeMsg(clsNPltem, 28)
The calculation is based on the line spacing specified by pArgs.
msgNPltemCalcBounds
Receiver calculates and sets its new bounds.
Takes OBJECT, returns SfATUS.
tdefine msgNPltemCalcBounds MakeMsg(clsNPltem, 37)
Usually send in response to the item's style changing. OBJECT is the data object in which the item will be
inserted. If the item is in a data object, pArgs can be pNull.
msgNPltemGetWordSpacing
Receiver passes back the size of its "space" character.
Takes P _UI6, returns STATUS.
tdefine msgNPltemGetWordSpacing MakeMsg(clsNPltem, 43)
This message is used by msgNotePaperTidy to determine the spacing of items.
msgNPltemCanBeTranslated
Receiver returns stsOK if it can be translated.
Takes pNull, returns SfATUS.
tdefine msgNPltemCanBeTranslated MakeMsg(clsNPltem, 13)
Translation occurs in response to msgNPltemToT ext.
msgNPltemCanBeUntranslated
Receiver returns stsOK if it can be untranslated.
Takes pNull, returns SfATUS.
tdefine msgNPltemCanBeUntranslated MakeMsg(clsNPltem, 31)
Comments Untranslation occurs in response to msgNPltemToScribble.
NPSCR.H
Messages
msgNewDefaults
Initialize pArgs. Zeros out pArgs->scribbleltem.
Takes P _NP_SCRIBBLE_ITEM_NEW, returns STATUS.
typedef struct NP_SCRIBBLE_ITEM_NEW_ONLY {
OBJECT scribble;
OBJECT data; II data that item will be associated with
S32 sparel;
NP_SCRIBBLE_ITEM_NEW_ONLY, *P_NP_SCRIBBLE_ITEM_NEW_ONLY;
#define npScribbleItemNewFields \
'npItemNewFields \
NP_SCRIBBLE_ITEM_NEW_ONLY scribbleItem;
typedef struct NP_SCRIBBLE_ITEM_NEW {
npScribbleItemNewFields
NP_SCRIBBLE_ITEM_NEW, *P_NP_SCRIBBLE_ITEM_NEW;
- - - - - - - ,.._.._ - - _ . _ - - - -
NPTEXT.H
This file contains the API definition for clsNPTextltem.
clsNPTextltem inherits froom clsNPltem.
NPTextltem is the text class of PenPoint's ink-management or note-taking building block. (See
notepapr.h for more information on the building block.) NPTextltem overrides NPltem messages as is
appropriate. See npitem.h for details.
#ifndef NPTEXT INCLUDED
#define NPTEXT INCLUDED
#ifndef NPITEM_INCLUDED
#include "npitem.h"
#endif
Messages
msgNewDefaults
Initialize pArgs. Zeros out pArgs->textltem.
Takes P_NP_TEXT_ITEM_NEW, returns STATUS.
This file contains the API definition for the OrderedSet interface. The functions described in this file are
contained in MISC.UB.
Overview
An OrderedSet implements a growable, ordered set of items. Each item has a key and associated data.
The ordered set knows about the structure of the key, but treats the data as uninterpreted bytes. The
items in an ordered set are homogeneous: there is only one size for the key, and another size for the data,
for all the items in the set.
Keys are unsigned quantities, treated as either non-negative integers or indirect access identifiers. The
client specifies:
• how keys are treated - direct or indirect;
• for indirect keys - access and comparison functions;
• whether duplicate keys are allowed;
• the key size - it must be 1, 2, or 4 bytes.
The data size (in bytes) is also specified by the client; it must be less than or equal to 1023.
The client provides an initial estimate of the number of items in the ordered set when the set is created;
the set will allocate more memory if the estimate proves to be too small.
Performance considerations
The implementation of OrderedSet builds on the ByteArray storage abstraction. This implies that either
the number of elements in the set is small enough that it is not a problem to use a linear array
representation for the set, or that the number of lookups dominates the number of insertions and
deletions.
Caution:
274 PENPOINT API REFERENCE
Part 9 I Utility Classes
Known Limitations
This package does not work correctly if the set has indirect keys and 0 (zero) is a legitimate key value.
fifndef ORDSET_INCLUDED
fdefine ORDSET_INCLUDED $Revision: 1.17 $
finclude <bytarray.h>
finclude <gosearch.h> II For ACCESS/COMPARE_FUNC
Private
Fl,mdion Pr<:t<:type typedef U32 (CDECL *READ_KEY_FUNC) (
P_ORDERED_SET p,
P UNKNOWN pKey) ;
typedef struct ORDERED_SET {
U16 indirectKeys 1;
U16 uniqueKeys 1; II TRUE => no duplicate keys
U16 spare 2; II Always set to 0
U16 sizeofKeyMinus1 2; II Number of bytes -1 a key needs
U16 sizeofData :10; II Number of bytes data occupies
P BYTE ARRAY items; II Storage of actual items
ACCESS FUNC access;
COMPARE FUNC compareKey1Direct;
COMPARE FUNC compareKey1Indirect;
P UNKNOWN context; II 1st arg to access() & compare()
READ KEY FUNC readKeYi II For internal use only!
ORDERED_SET i
OrderedSetCountlnternai
Returns the number of items currently stored in the ORDERED_SET.
Returns BYTE_INDEX.
fdefine OrderedSetCountInternal(p) \
(ByteArrayLength(p->items) 10rderedSetSizeofItem(p))
High-performance version of OrderedSetCount, but subject to change if the implementation of ordered
sets changes.
o rderedSetPrint
In debugging version, prints the contents of the ordered set.
Returns void.
#ifdef DEBUG
void EXPORTED
Function Pvt:>totype OrderedSetPrint (
P_ORDERED_SET p);
#endif II DEBUG
Comments This function is undefined in the non-debugging version.
OrderedSetCreate
Creates an ordered set.
Returns STATUS.
STATUS EXPORTED
OrderedSetCreate(
P- ORDERED- SET * pp,
OS HEAP MODE mode,
U8 sizeofKey,
U8 sizeofData,
U32 initialCount,
BOOLEAN uniqueKeys,
BOOLEAN indirectKeys);
sizeofKeyand sizeofData specify the size in bytes of each item's key and data, respectively. The
initialCount is a hint; the ordered set will grow or shrink as needed. However, if initialCount is
approximately correct, performance will be better. If initialCount=O, 1 will be assumed. uniqueKeys
should be TRUE if client wants all keys in the set to be unique, FALSE otherwise. Only the
osHeapLocal / osHeapShared flags in mode are used.
Returns stsOK if able to create the set, in which case *pp will be the created set, otherwise *pp will be
Nil(p_ORDERED_SET).
OrderedSetSizeofKey
Returns the size of a key in bytes.
Returns U16.
#define OrderedSetSizeofKey(p) ((U16) ((p)->sizeofKeyMinus1 + 1))
OrderedSetSizeofltem
Returns the size of an item (key plus data) in bytes.
Returns U16.
#define OrderedSetSizeofItem(p) \
((U16) (OrderedSetSizeofKey(p) + (p)->sizeofData))
276 PENPOINT API REFERENCE
Part 9 / Utility Classes
OrderedSetHeapMode
Returns the heap mode with which the Ordered Set was created.
Returns OS_HEAP_MODE.
tdefine OrderedSetHeapMode(p) ByteArrayHeapMode((p)->items)
OrderedSetExtend
Modifies the functions and context of an ordered set with indirect keys.
Returns STATUS.
void EXPORTED
Ftmdl@n Prototype OrderedSetExtend (
P ORDERED SET p,
ACCESS FUNC access,
COMPARE FUNC compareKeylDirect,
COMPARE FUNC compareKeylIndirect,
P UNKNOWN context);
Specifies access and comparison functions for an ordered set with indirect keys, as well as a context for
those functions.
See gosearch.h's description ofbinarySearchO for more information about the behaviors and parameters
of the access and compare functions.
OrderedSetContext
Get the context passed to access and compare functions.
Returns P _UNKNOWN.
tdefine OrderedSetContext(-p) ((-p)->context)
OrderedSetModifyContext
Modify the context passed to access and compare functions.
Returns void.
tdefine OrderedSetModifyCont~xt(-p, _c) ((-p)->context (_c»
OrderedSetDefaultAccess
Can be used as the client-specified access routine in OrderedSetExtendO.
Rc:turns P _UNKNOWN.
P UNKNOWN CDECL
rom:tl@lk Prototype OrderedSetDefaultAccess (
const P_ORDERED_SET p,
const BYTE_INDEX index);
Comments In ordered sets with indirect keys the client must supply a routine that returns the address of the keys
that are passed into the client-supplied comparison routine. OrderedSetDefaultAccess computes the
address of the key in the ordered set representation, and so may be used by clients as the access routine
passed into OrderedSetExtendO.
ORDSET.H 277
Exported Functions and Macros
OrderedSetDestroy
Destroys an ORDERED_SET.
Returns void.
void EXPORTED
Fundion Prt>tt>type OrderedSetDestroy (
P_ORDERED_SET p);
OrderedSetlnsert
Inserts data with key into ordered set.
Returns STATUS.
STATUS EXPORTED
Function Prototype OrderedSetlnsert (
P- ORDERED- SET p,
U32 key,
P UNKNOWN data) ;
Copies sizeoIData bytes from the buffer pointed to by data. Returns:
stsOSOutOfMem if no memory available, or
stsOrdSetDuplicateKey if key is duplicate and unique keys required, or
stsOK otherwise.
If sizeofKey is less than 4 bytes, the least significant byte(s) of key are copied.
OrderedSetNthltem
Locates the n-th item in the ordered set (item indices begin with 0).
Returns P _UNKNOWN.
P UNKNOWN EXPORTED
Function Prototype OrderedSetNthltem (
P_ORDERED_SET p,
U32 n,
P_OS_ITEM_INFO info);
Returns a pointer to ordered set's copy of the data associated with the Nth item. This pointer is only
valid until the next calIon the same set.
Upon return, the following modifications have been made to the fields of info:
key key of nth item
isDuplicate is not set; use OrderedSetFindO if needed;
data duplicate of return value
OrderedSetltemlndex
Returns the index of an item
Returns BYTE_INDEX..
#define OrderedSetltemlndex(p, pData) \
((ByteArrayFindlndex((p)->items, ((P_U8) (pData))) \
- OrderedSetSizeofKey(p)) / OrderedSetSizeofltem(p))
278 PENPOINT API REFERENCE
Part 9 / Utility Classes
OrderedSetFind
Locates the data for a specified key.
Returns P_UNKNOWN.
P UNKNOWN EXPORTED
function Prototype OrderedSetF ind (
P_ORDERED_SET p,
P_OS_ITEM_INFO info);
Comments Returns a pointer to ordered set's copy of the data associated with info->key. This pointer is only valid
until the next calion the same set. If the info->key is not in the set, the returned value is
Nil(p _UNKNOWN). If duplicate copies of the key exist in the set, an arbitrary item is found and its data
returned. All of the other items with the same key may be examined via use of OrderedSetNextO. Upon
return, the following modifications have been made to the fields of info:
isDuplicate 0 if key is unique in set, 1 otherwise
data duplicate of return value
OrderedSetFindMinMax
Locates the data for a key >= to specified key.
Returns P_UNKNOWN.
P UNKNOWN EXPORTED
FlJm:tkm Prototype OrderedSetFindMinMax (
P_ORDERED_SET p,
P_OS_ITEM_INFO info);
Comments Returns a pointer to ordered set's copy of the data associated with the minimum key in the ordered set
that is >= info->key. If info->key is in the ordered set, this routine is equivalent to OrderedSetFindO.
This pointer is only valid until the next calion the same set. Returns Nil(p_UNKNOWN) ifinfo->key has
no minmax in the set. If duplicate copies of the minmax key exist in the set, an arbitrary item is found
and its data returned. All of the other items with the same key may be retrieved with OrderedSetNextO.
Upon return, the following modifications have been made to the fields of info:
key minmax key
is Duplicate 0 if key is unique in set, 1 otherwise
data duplicate of return value
OrderedSetFindMaxMin
Locates the data for a key <= to specified key.
Returns P_UNKNOWN.
P UNKNOWN EXPORTED
FlJndi@n Prototype OrderedSetFindMaxMin (
P_ORDERED_SET p,
P_OS_ITEM_INFO info);
Comments Returns a pointer to ordered set's copy of the data associated with the maximum key in the ordered set
that is <= info->key. If info->key is in the ordered set, this routine is equivalent to OrderedSetFindO.
This pointer is only valid until the next calion the same set. Returns Nil(p_UNKNOWN) if info->key has
no maxmin in the set. If duplicate copies of the maxmin key exist in the set, an arbitrary item is found
ORDSET.H 279
Exported Functions and Macros
and its data returned. All of the other items with the same key may be retrieved with OrderedSetNextO.
Upon return, the following modifications have been made to the fields of info:
key maxmin key
isDuplicate 0 if key is unique in set, 1 otherwise
data duplicate of return value
OrderedSetNext
Enumerates the data for keys in the Ordered Set.
Returns P_UNKNOWN.
P UNKNOWN EXPORTED
OrderedSetNext(
P- ORDERED SET p,
P- OS- ITEM- INFO info) ;
Comments OrderedSetNextO's behavior depends on whether the set has unique keys or not. In both cases, the
enumeration is guaranteed to be complete provided no insertions or deletions are performed on the
set during the enumeration.
• IF THE SET HAS UNIQUE KEYS
OrderedSetNextO enumerates all of the keys in the set in order.
The first item in the enumeration can be found by either (1) by calling OrderedSetNthItemO with
an "N" of 0 or (2) calling OrderedSetNextO with info->data set to Nil and info->key set to the
lowest possible key value.
• IF THE SET DOES NOT HAVE UNIQUE KEYS
OrderedSetNextO enumerates all of the keys with the same value. The order of enumeration is
unspecified.
The first item with a known key can be found by either (1) by calling OrderedSetFind with
info->key set to the known key value and info->data set to Nil
• IN BOTH CASES
Further items are found by calling OrderedSetNextO with the same info struct until it returns Nil.
OrderedSetNextO returns a pointer to the set's copy of the data associated with key. This pointer is
only valid until the next call on the same set.
Returns
Nil(p_UNKNOWN) if specified key not in set or the enumeration is complete, or
pointer to set's copy of data or if key is in set or enumeration is incomplete.
Upon return, the following modifications have been made to the fields of info:
key: next key value, iff info->data had been one of the
three special values: Nil, next, prevo
isDuplicate: o if key is unique in set,
1 otherwise
data: duplicate of returned value
280 PEN POINT API REFERENCE
Part 9 / Utility Classes
}
II firstData and info now contain first item's information
};
info.data = findNextKeyInOS;
until (!OrderedSetNext( ... »;
OrderedSetEachltem
Helper macro to simplify the enumeration of an Ordered Set.
Returns P_UNKNOWN.
fdefine OrderedSetEachItem(-p, _item) \
for ((_item) .key = (U32)0, (_item) . data = Nil(P_UNKNOWN); \
OrderedSetNext((-p), &(_item» != Nil(P_UNKNOWN);)
II The condition IS the iteration step
This macro is only useful for sets with direct, non-duplicate keys!
The arguments to OrderedSetEachltemO are:
_p the ordered set to enumerate
_item an OS_ITEM_INFO containing the enumerated item's info
Code using these macros should look like: OS_ITEM_INFO scratch; OrderedSetEachltem(os, scratch) {
myPtr = (MY_PTR)scratch.data; ... }
OrderedSetDelete
Deletes specified item from the Ordered Set.
Returns STATUS.
STATUS EXPORTED
F!Jm::t!(>tl Pr(>t(>fype OrderedSetDelete (
P_ORDERED_SET p,
P_OS_ITEM_INFO info);
If duplicates are allowed, both info->key and info->data must be filled in by client; ifkeys are unique,
only info->key need be filled in.
ORDSET.H 28'
Exported Functions and Macros
Returns:
stsOK if item was found in set and deleted, or
stsNoMatch if item not found in set, or
STATUS < 0 if internal error during deletion.
OrderedSetCount
Returns the number of items currently stored in the ORDERED_SET.
Returns U32.
U32 EXPORTED
fondion Prototype OrderedSetCount (
P_ORDERED_SET p);
QHELP.H
Debugging Flags
Quick Help uses the debugging flag set 'q'. Defined flags are:
0001 General quick help debugging information
Messages
msgQuickHelpShow
Displays the Quick Help associated with the resource ID.
Takes P_QUICK_DATA, returns STATUS.
fdefine msgQuickHelpShow MakeMsg(clsQuickHelp, 1)
typedef struct QUICK_DATA {
U32 helpld; II Help ID of the screen to show
OBJECT appUID; II UID of the application. Used to find resources
II of application specific help IDs.
U32 reserved; II Reserved for future use
QUICK_DATA, *P_QUICK_DATA;
Gets the quick help resource from either the system resource files or the application specific resource
files. If the quick help resource can't be found, will display the "Quick help not found" message in the
quick help screen. Typically called from gWin in order to display the help screen for a help gesture.
Would take the gWin heIpId and the application uid. Needs the application object in order to reference
the resource files of the application to find application specific help IDs. Typically not called directly by
applications, but called indirectly through gWin inheritence. Will call msgQuickHeIpOpen to open the
quick help window as necessary.
Typically called by objects in response to a ? gesture, or in response to msgQuickHeIpHeIpShow.
gwin.h
msgQuickHelpHelpShow
Sent to a window to display a quick help request.
Takes P_XY32 , returns STATUS.
fdefine msgQuickHelpHelpShow MakeMsg(clsQuickHelp, 7)
Sent from theQuickHeIp to a window when it is required to display its quick help. Typically the
window will respond by posting msgQuickHeIpShow. Sent as the user taps on various windows while
quick help is being displayed.
msgQuickHelpHelpDone
QHELP.H 285
Notification Messages
msgQuickHelpHelpDone
Sent to a window when quick help is no longer displayed.
Takes OBJECT, returns STATUS.
#define msgQuickHelpHelpDone MakeMsg(clsQuickHelp, 8)
Sent to the last object asked to display quick help via msgQuickHelpHelpShow when help is no longer
needed on said object. Can be sent because the user tapped somewhere else and a new object is about to
be sent msgQuickHelpHelpShow, quick help has been terminated by the user, or the help notebook has
been entered. Takes the new object receiving a msgQuickHelpHelpShow if because the user tapped
elsewhere, or null if quick help is being terminated or going to the help notebook. Note that this
message is only sent to object which previously received msgQuickHelpHelpShow, and not those
objects generating a help request by posting msgQuickHelpShow directly.
msgQuickHelpHelpShow
msgQuickHelpOpen
Forces the Quick Help window to appear.
Takes nothing, returns STATUS.
#define msgQuickHelpOpen MakeMsg(clsQuickHelp, 2)
Opens the quick help window on the screen. If the quick help window is already on the screen, will
simply return stsOK. The quick help window is a modal filter that will grab all input till closed via
msgQuickHelpClose. Self sent to when msgQuickHelpShow is posted. Also sent from the help
notebook icon to invoke quick help.
Notification Messages
msgQuickHelpOpened
Indicates that the quick help window has been opened.
Takes nothing, returns STATUS. Category: observer notification.
#define msgQuickHelpOpened MakeMsg(clsQuickHelp, 128)
Sent to observers of the quick help that the quick help window has been opened.
msgQuickHelpClosed
Indicates that the quick help window has been closed.
Takes nothing, returns STATUS. Category: observer notification.
#define msgQuickHelpClosed MakeMsg(clsQuickHelp, 129)
Sent to observers of theQuickHelp to indicate that the quick help window has been closed.
msgQuickHelplnvokedNB
Indicates that the notebook associated with quick help should be open.
Takes nothing, returns STATUS. Category: observer notification.
#define msgQuickHelpInvokedNB MakeMsg(clsQuickHelp, 130)
286 PENPOINT API REFERENCE
Part 9 / Utility Classes
Sent to observers when msgQuickHelplnvokeNB is recieved. The help note book is an observer, and
will bring itself up when this message is recieved.
SIL.H
This file contains the API for clsSelection.
clsSelection inherits from clsObject.
theSelectionManager provides management of the system-wide selection. theSelectionManager is the
one and only instance of clsSelection.
Introduction
Much of PenPoint's user interface is based on the "selection." The selection is often the center of the
user's attention. In general it is very easy for the user to set the selection -- it often just requires a tap.
The precise definition of the selection is application-specific. In text the selection is often a set of
characters. In a spreadsheet it might be a range of rows, columns, or cells. In a Table of Contents it
might be a set of documents. Typically, an application "highlights" the selection with a grey background,
handles, or some other graphic technique.
Because the selection corresponds to the center of the user's attention, many user interface operations are
based on the selection. Here are some examples:
• The selection is the source of Pen Point's move and copy operations.
• Typically, the selection is altered by Applying an Option Sheet.
• The selection often determines which menu items are enabled and which are disabled.
• The selection and keyboard input target are often linked together.
Programmatically, other objects can inquire about the selection, get information from the selection and
transfer data from the selection.
Road Map
Use the following to take ownership of the selection:
• msgSelSetOwner
• msgSelSetOwnerPreserve
• msgSelSelect (if object has clsEmbeddedWin in the object's ancestry)
Selection owners must be prepared to handle the following:
• msgSelDelete
• msgSelYield
• msgSelBeginCopy
• msgSelBeginMove
• msgControlProvideEnable (see section "Control Enabling")
288 PENPOINT API REFERENCE
Part 9 / Utility Classes
• msgSelOwner
• msgSelPrimaryOwner
• msgSelOwners
• msgSelIsSelected (if object has dsEmbeddedWin in the object's ancestry)
theSelectionManager sends the following notifications:
• msgSelChangedOwners
• msgSelPromotedOwner
Destinations of PenPoint's Move and Copy mechanism must handle the following:
• msgSel CopySelection
• msgSelMoveSelection
• In response to msgSelMoveSelection, the destination object retrieves the selection owner from the
selection manager (using msgSelOwner) and engage in an xfer protocol with the selection. (The
xfer protocols are described in xfer.h) The data should be copied to the position contained in
msgSelMoveSelection's pArgs, which is a P_XY32.
• After the data has been copied from the selection owner, the destination should send msgSelDelete
to the selection owner.
• The destination object should select the data that it just absorbed.
The "flow of control" for copying selected data is very similar, with the following changes:
• The gesture that kicks off the protocol is "Tap-Press" (xgsTapHold in xgesture.h) rather than
Press-Hold.
• The source object self sends and handles msgSelBeginCopy rather than msgSelBeginMove. The
source object self sends msgEmbeddedWinBeginCopy rather than msgEmbeddedWinBeginMove.
• The destination receives msgSelCopySelection rather than msgSelMoveSelection.
• The destination object should not send msgSelDelete.
xfer.h.h
Control Enabling
Some controls, particularly menu items, should be disabled if there is no selection owner. And some
controls should be disabled based on application-specific details about the selection state.
For instance, the "Move," "Copy," and "Delete" menu items should not be enabled if there is no
selection owner. The "Move" menu item should be enabled if there is a selection and the selection owner
is not read-only. The "Delete" menu item should be enabled if there is a selection owner and the
contents of the selection are not empty.
To support this, clsControl allows control creators to specify that the control should send
msgControlProvideEnable to the selection owner to get the proper enable/disable state.
290 PENPOINT API REFERENCE
Part 9 / Utility Classes
Some standard application menus (SAMs) are set up to send msgControlProvideEnable to the selection
owner. See app.h for details.
Therefore all selection owners should handle msgControlProvideEnable.
Status Codes
theSelectionManager returns stsSelYieldlnProgress when the selection manager is in the process of
sending msgSelYield and therefore can't respond to the message.
#define stsSelYieldInProgress MakeWarning(clsSelection,l)
SEL.H 291
Messages Sent to theSelectionManager
Types
preservedOwner is defined only if havePreservedOwner is true. It IS possible to have a null
preservedOwner.
typedef struct SEL_OWNERS {
OBJECT owner;
OBJECT preservedOwner;
BOOLEAN havePreservedOwner;
SEL_OWNERS, *P_SEL_OWNERS;
msgSelSetOwner
Sets the selection owner.
Takes OBJECT, returns STATUS.
tdefine msgSelSetOwner MakeMsg(clsSelection,2)
Send msgSelSetOwner to theSelectionManager to set the selection owner. theSelectionManager
responds in one of the following ways:
If pArgs is not a valid selection owner (because it can't be called from other objects or is not a global
object):
• theSelectionManager returns stsScopeViolation.
If pArgs is null, theSelectionManager:
• sends msgSelYield to the current selection if it exists and sets the current selection to null.
• sends msgSelYield the current preserved selection if it exists and sets the current preserved selection
to null.
• sends msgSelChangedOwners to theSelectionManager's observers.
Otherwise, theSelectionManager:
• sends msgSelYield to the current preserved selection if it exists and is not equal to pArgs.
theSelectionManager then sets the preserved selection to null and stops observing the preserved
selection.
• sends msgSelYield to the current selection if it exists and is not equal to pArgs.
• sets the current selection to pArgs.
• adds itself as an observer of the new selection.
• sends msgSelChangedOwners to theSelectionManager's observers.
stsScopeViolation pArgs is not a valid selection owner.
msgSelYield
msgSelSetOwnerPreserve
Sets the selection owner with the preserve option.
Takes OBJECT, returns STATUS.
tdefine msgSelSetOwnerPreserve MakeMsg(clsSelection,5)
292 PENPOINT API REFERENCE
Part 9 / Utility Classes
Send msgSelSetOwnerPreserve to theSelectionManager to set the selection owner while preserving the
current selection owner.
See the section "Two Selection Owners" for more information.
theSelectionManager's response to this message is similar to its response to msgSelSetOwner, with only
subtle differences.
If pArgs is null, and there is no preserved Owner:
• theSelectionManager simply returns stsOK.
If pArgs is null, and a preserved owner exists (even if it is null), theSelectionManager:
• sends msgSelYield to the current owner if it exists.
• sends msgSelPromote to the current preserved owner if non-null.
• sets the current owner to the current preserved owner if non-null.
• sets the current preserved owner to null.
• sets the value for SEL_OWNERS.havePreservedOwner to false.
• sends msgSelPromotedOwner to theSelectionManager's observers.
If pArgs is non-null but is not a valid selection owner (because it can't be called from other objects or is
not a global object):
• theSelectionManager returns stsScopeViolation.
If pArgs is a valid selection owner and there is a no preserved owner:
• sends msgSelDemote to the current owner.
• sets the current preserved owner to be the current owner.
• sets the current owner to be pArgs.
• adds itself as an observer of the new selection.
• sets the value for SEL_OWNERS.havePreservedOwner to true.
• sends msgSelChangedOwners to theSelectionManager's observers.
If pArgs is a valid selection owner and there is a preserved owner:
• sends msgSelYield to the current owner if it exists and is not the same as pArgs.
• sets the current owner to pArgs.
• adds itself as an observer of the new selection.
• sends msgSelChangedOwners to theSelectionManager's observers.
stsScopeViolation pArgs is not a valid selection owner.
msgSelYield
msgSelOwner
Passes back the selection owner.
Takes P_OBJECT, returns STATUS.
#define rnsgSelOwner MakeMsg(clsSelection,l)
SEL.H 293
Notifications Sent to theSelectionManager's Observers
Comments theSelectionManager passes back the current selection owner. It does not pass back the preserved
selection owner.
Return Value stsSelYieldlnProgress theSelectionManager is currently sending msgSelYield.
msgSelPrimaryOwner
Passes back the primary selection owner.
Takes P_OBJECT, returns STATUS.
*define msgSelPrimaryOwner MakeMsg(clsSelection,7)
The "primary owner" is the selection owner which an option sheet applies to. If there is a preserved
selection owner, the primary owner is the preserved owner. Otherwise, the primary selection owner is
the current owner.
Return \faiue stsSelYieldlnProgress theSelectionManager is currently sending msgSelYield.
msgSelSetOwner
msgS el Owners
Passes back the selection and preserved owners.
Takes P_SEL_OWNERS, returns STATUS.
*define msgSelOwners MakeMsg(clsSelection,4)
Message typedef struct SEL_OWNERS {
ArfJuments OBJECT owner;
OBJECT preservedOwner;
BOOLEAN havePreservedOwner;
SEL_OWNERS, *P_SEL_OWNERS;
stsSelYieldlnProgress theSelectionManager is currently sending msgSelYield.
msgSelSetOwner
theSelectionManager sends this notification even if the old owner and new owner are the same. Hence
if object A is the selection owner, and msgSelSetOwner is sent with object A, msgSelChangedOwners
IS sent to theSelectionManager's observers.
When a preserved selection owner is promoted back to the selection owner, msgSelPromotedOwner is
sent rather than msgSelChangedOwners.
Example of use: In response to this message, option sheets check the applicability of the top card.
msgSelSetOwner
msgSelPromotedOwner
Notifies observers when the preserved owner has been promoted back to the selection owner.
Takes P_SEL_OWNERS, returns STATUS.
#define rnsgSelPrornotedOwner MakeMsg(clsSelection,8)
M®1i£ Q £i® typedef struct SEL_OWNERS {
Argoments OBJECT owner;
OBJECT preservedOwner;
BOOLEAN havePreservedOwner;
SEL_OWNERS, *P_SEL_OWNERS;
theSelectionManager posts msgSelPromotedOwner to its observers to inform the observers that
preserved selection owner has been promoted to the normal selection owner.
This happens as a result of theSelectionManager handling msgSelSetOwnerPreserve with a pArgs of
null.
msgSelSetOwnerPreserve
msgSelYield
theSelectionManager requires the release of the selection.
Takes BOOLEAN, returns SfATUS.
#define rnsgSelYield MakeMsg(clsSelection,ll)
theSelectionManager sends this message to a selection owner to inform the object that it is no longer
the selection owner. pArgs is true if object is yielding the primary selection and false when the object is
yielding the preserved selection.
This message is not sent when an object takes the selection via msgSelSetOwner or
msgSelSetOwnerPreserve and it already is the selection, or already is the preserved selection. (However,
msgSelChangedOwners IS sent to theSelectionManager's observers.)
When handling this message, be careful about sending selection manager messages (such as
msgSelSetOwner) as deadlock can occur.
After sending msgSelYield, theSelectionManager removes itself as an observer of the object.
msgSelSetOwner
SEL.H 295
Embedded Window Messages
msgSelDemote
Informs the owner that it is becoming the preserved owner.
Takes nothing, returns SfATUS.
fdefine msgSelDemote MakeMsg(clsSelection,24)
theSelectionManager sends this message to a selection owner to tell the owner that it is becoming the
preserved owner. (This can happen when theSelectionManager receives msgSelSetOwnerPreserve.)
Receivers should not do anything in response to this message. (If for some reason receivers chose to
handle this message, be careful about sending selection manager messages (such as msgSelSetOwner) as
deadlock can occur.)
msgSelPromote
msgSelPromote
Informs the preserved owner that it is becoming the owner.
Takes nothing, returns SfATUS.
fdefine msgSelPromote MakeMsg(clsSelection,25)
theSelectionManager sends this message to a preserved selection owner to tell the owner that it is
becoming the normal selection owner. (This can happen when theSelectionManager receives
msgSelSetOwnerPreserve. )
Receivers should not do anything in response to this message. (If for some reason receivers chose to
handle this message, be careful about sending selection manager messages (such as msgSelSetOwner) as
deadlock can occur.)
msgSelSetOwner
msgSelSelect
Sets self to be the selection owner.
Takes nothing, returns SfATUS.
fdefine msgSelSelect MakeMsg(clsSelection,19)
See the section "Embedded Window Selection Messages" for more information.
Send this message to an object to have that object make itself be the selection owner or the preserved
selection owner.
Do not send this message to theSelectionManager.
msgSelSetOwner.h
296 PENPOINT API REFERENCE
Part 9 / Utility Classes
msgSelIsSelected
Returns TRUE if self is current selection owner.
Takes nothing, returns BOOLEAN.
#define msgSelIsSelected MakeMsg(clsSelection,21)
See the section "Embedded Window Selection Messages" for more information.
Send this message to an object to inquire if it is the selection owner.
Do not send this message to theSelectionManager.
true The object is the selection owner.
false The object is not the selection owner. (The object may be the preserved selection owner.)
embedwin.h
msgSelBeginCopy
Initiate a copy operation.
Takes P_XY32, returns STATUS.
#define msgSelBeginCopy MakeMsg(clsSelection, 23)
See the section "Move and Copy" for information about when this message is sent and how it should be
handled.
pArgs will be null if this message is sent from a menu.
msgSelBeginMove
Initiates a move operation.
Takes P _XY32, returns STATUS.
#define msgSelBeginMove MakeMsg(clsSelection, 22)
See the section "Move and Copy" for information about when this message is sent and how it should be
handled.
pArgs will be null if this message is sent from a menu.
msgSelCopySelection
The receiver should copy the selection to self at (x, y).
Takes P_XY32, returns STATUS.
#define msgSelCopySelection MsgNoError(MakeMsg(clsSelection,16))
See the section "Move and Copy" for information about when this message is sent and how it should be
handled.
SEL.H 297
Abstract Messages For Linking Protocol
msgSelMoveSelection
The receiver should move the selection to self at (x, y).
Takes P_XY32 , returns STATUS.
tdefine msgSelMoveSelection MsgNoError(MakeMsg(clsSelection,15))
See the section "Move and Copy" for information about when this message is sent and how it should be
handled.
msgSelDelete
The selection owner should delete the selection.
Takes U32, returns STATUS.
tdefine msgSelDelete MakeMsg(clsSelection,3)
tdefine SelDeleteReselect 0 II Display a selection after delete
tdefine SelDeleteNoSelect 1 II Don't display a selection after delete
Clients wishing to delete the selection send msgSelDelete to the selection owner. Selection owners
should respond to this message by deleting the contents of the selection.
msgSelDelete is sent in two situations: (1) the user has hit the "Delete" menu item, or (2) an object has
received msgSelMoveSelection, has copied the data (see xfer.h), and now wants to delete the original
data.
See the section "Move and Copy" for information about how msgSelDelete is related to moving data.
pArgs must be one of SelDeleteReselect or SelDeleteNoSelect. This parameter is just a performance
enhancement. The sender of msgSelDelete should pass SelDeleteNoSelect if it plans on taking the
selection after the msgSelDelete, and SelDeleteReselect otherwise. The receiver of msgSelDelete can use
pArgs as an optimization, but it is not strictly necessary since theSelectionManager will send a
msgSelYield when the sender takes the selection. (The pArgs of msgSelDelete exist primarily for
historical reasons. The simplest thing to do is for the sender to pass SelDeleteReselect and for the
receiver to ignore pArgs.)
Spelling Checking
proof.h, pdict.h
#ifndef SPELL INCLUDED
#define SPELL-INCLUDED
IDSOOO 1 Low-level debug messages; LOTS of output
IDS0002 mid-level debug messages
IDS0004 high-level debugs - general information
IDS8000 disable dictionary
#ifndef GO INCLUDED
#include <go.h>
#endif
Common Definitions
maxSpellList is the most bytes a list of spelling corrections can use.is the dictionary alphabet size
#define maxSpellList 128
#define maxSpellXlateChoices 30
Common typedefs
typedef struct SPELL LIST {
U16 count; - II Number of strings in the list
CHAR words[maxSpellList]; II List of concatenated strings
SPELL_LIST, * P_SPELL_LIST;
typedef struct SPELL XLATE {
U16 index; II Offset within bank
U8 bits; II Nibble and bank indicator
U8 character; II Out: Character at that location
SPELL_XLATE, *P_SPELL_XLATE;
typedef struct SPELL DICT LIST
P CHAR pName; - II name of dictionary (e.g. English)
P CHAR pPath; II path to dictionary (e.g. \\boot\dicts\webf77k)
U16 bankCount; II Number of 16K banks the lex is divided into
P_UNKNOWN pLangHeader;11 Pointer to language specific info
SPELL_DICT_LIST, *P_SPELL_DICT_LIST;
Definitions of different types of word capitalization
Enum16 (SPELL CASE) {
spellCommonCase, II all letters are in lower case
spellProperCase, II The First Letter Of Each Word Is Capitalized
spellUpperCase, II ALL LETTERS ARE CAPITALIZED
spellSpecialCase, II tHere IS a StRANge Mix of cAPitALizATion
};
typedef struct SPELL CASE CONTEXT {
SPELL CASE minCase; - II lowest case allowed for output dictionary words
SPELL CASE unkCase; II case for non-dictionary words
BOOLEAN sentence; II do end-of-sentence processing
BOOLEAN dictionary; II use the dictionary for capitalization info
BOOLEAN allCapsWriter; II user writes all caps only
BOOLEAN firstWord; II In/Out: This word is first in a sentence
SPELL_CASE_CONTEXT, * P_SPELL_CASE_CONTEXT;
300 PEN POINT API REFERENCE
Part 9 I Utility Classes
Functions
SpellDictSelect
Sets the active dictionary to the language specified.
Returns STATUS.
vl1nctkm Pt'ototy'pe STATUS EXPORTED SpellDictSelect (
S16 dictCode
);
dictCode is an index into spellDictList; -1 means deselect. Currently, onlyEnglish can be selected, and
its code is O.
SpellSetOptionsX
Turns the dictionary on or off.
Returns void.
void EXPORTED SpellSetOptionsX(BOOLEAN mode);
Pass it true to turn the dictionary on, false to turn it off.
SpellGetOptionsX
Returns current dictionary status.
Returns BOOLEAN.
BOOLEAN EXPORTED SpellGetOptionsX(void);
True means spelling is on; false means it's off.
SpellCheck
Checks if a word is in the dictionary or not.
Returns BOOLEAN.
BOOLEAN EXPORTED SpellCheck(P_CHAR pWord);
Argument may contain punctuation but should not contain spaces. Thisdesigned so higher-level
software can parse a line of text intotokens and pass those tokens (with no further) to this routine.
SpellCorrect
Finds all the corrections for a word and adds them to a SPELL_LIST structure.
Returns STATUS.
Function P'r©totype STATUS EXPORTED SpellCorrect (
P_CHAR pWord, II Word to be corrected
P_SPELL_LIST pSpellList, II Out: List to add the word to
BOOLEAN phonetic II Perform phonetic correction?
);
This also takes a space-delimited token, as described above, stripsthe punctuation, and puts it back on
the correction candidates. that the count field in the SPELL_LIST structure must beto zero, unless you
are deliberately adding to anlist. This routine avoids adding duplicates to theif it already had some
words in it.
SPELL.H 301
Functions
SpellCorrectWord
Finds the first correction for a word. Returns 0 if none found, else 1.
Returns U16.
fundion Prototype U16 EXPORTED SpellCorrectWord (
P_CHAR pWord, II Word to be corrected
P_CHAR pCorrectWord II Out: place to put the correction
);
The word is a space-delimited token, as described above. In this, "first" means "first in alphabetical
order," this routine issuitable for most applications.
SpellAddToDict
Add a word to thePersonalDictionary.
Returns STATUS.
Fundion ProTotype STATUS EXPORTED SpellAddToDict (
P_CHAR pWord
);
Comments The prefered way to add words to the current personal dictionary. As usual, it takes space-delimited
tokens and strips off extraneous punctuation.
SpellAddToAnyDict
Add a word to anyone of the personal dictionaries.
Returns STATUS.
fundion ProTotype STATUS EXPORTED SpellAddToAnyDict (
OBJECT pDict,
P_CHAR pWord
);
The prefered way to add words to a personal dictionary other than the current one. It takes a pdict
object (clsPDict) that specifies the personal dictionary to add to, and space-delimited tokens. It strips off
extraneous punctuation.
SpellWordSetCase
Convert all-up per-case input into a reasonable mix of upper and lower case using dictionary information
and other lexical clues.
Returns STATUS.
Function Prototype STATUS EXPORTED SpellWordSetCase (
P_CHAR pWord,
P_SPELL_CASE_CONTEXT pSpellCaseContext
);
Call SpellWordSetCase the first time with pWord == pNull tothe context structure. Then pass it the
words to be(in order) with the same context structure each time. Iteach word in place. To modify
the default behavior, changeappropriate context parameters (see the definition of
the_CASE_CONTEXT structure).
DefaultsminCase: SpellCommonCase unkCase: SpellCommon Case sentence: true
dictionary: true allCapsWriter: false firstWord: true
302 PENPOINT API REFERENCE
Part 9 / Utility Classes
SpellLineSetCase
Convert all-upper-case input into a reasonable mix of upper and lower case using dictionary information
and other lexical dues.
Returns STATUS.
Fundlon Prototype STATUS EXPORTED SpellLineSetCase (
P_CHAR pLine,
P_SPELL_CASE_CONTEXT pSpellCaseContext
);
Identical to SpellWordSetCase, except it expects the input to beline of text, which it splits into tokens as
required.
Miscellaneous
Address of the list of legal dictionaries
extern const SPELL DICT LIST spellDictList[];
SPMGR.H
This file contains the API for the Spell Manager Class and theSpellManager.
clsSpellManager inherits from clsObject.
theSpellManager is a well-known instance of clsSpellManager.
spell.h, pdict.h
tifndef SPMGR INCLUDED
tdefine SPMGR INCLUDED
tifndef CLSMGR_INCLUDED
tinclude <clsmgr.h>
tendif
tifndef WIN INCLUDED
tinclude <win.h>
tendif
tifndef XLATE_INCLUDED
tinclude <xlate.h>
tendif
tifndef GWIN_INCLUDED
tinclude <gwin.h>
tendif
Common typedefs
This structure is passed to theSpellManager when the user makes thegesture on a window.
typedef struct SP_MGR_GESTURE {
GWIN GESTURE gesture;
} SP_MGR_GESTURE, * P_SP_MGR_GESTURE;
Messages
Sent to Traversal Clients
msgSpMgrCreateContext
Piggybacked with msgTraverseCreate. *Ctx messages.
Takes VOID, returns STATUS.
tdefine msgSpMgrCreateContext MakeMsg(clsSpellManager,l)
Initiates a spelling traversal.
msgSpMgrFindMisspelling
Asks the recipient to find the next misspelled word (using SpellCheckO on successive space-delimited
tokens).
Takes SP_MGR_DIALOG, returns STATUS.
tdefine msgSpMgrFindMisspelling MakeMsg(clsSpellManager,2)
Piggybacked with msgT raverseFind.
304 PEN POINT API REFERENCE
Part 9 / Utility Classes
msgSpMgrCorrectMisspelling
Asks the recipient to. correct the misspelled word he previously found in response to a
msgSpMgrFindMisspelling message.
Takes SP_MGR_DIALOG, returns STATUS.
fdefine msgSpMgrCorrectMisspelling MakeMsg(clsSpellManager,3)
Piggybacked with msgTraverseApply. Correction is in the word field.
msgSpMgrAcceptMisspelling
Asks the recipient to accept the misspelled word he previously found in response to a
msgSpMgrFindMisspelling message.
Takes SP_MGR_DIALOG, returns STATUS.
fdefine msgSpMgrAcceptMisspelling MakeMsg(clsSpellManager,5)
Piggybacked with msgTraverseApply. Dialog Struct is copied.
msgSpMgrGesture
This causes theSpellManager to initiate a spell traversal from a gesture, as opposed to from a menu.
Takes P _SP_MGR_GESTURE, returns STATUS.
fdefine msgSpMgrGesture MakeMsg(clsSpellManager,4)
M8$$(lt$e typedef struct SP_MGR_GESTURE
Arguments GWIN_GESTURE gesture;
} SP_MGR_GESTURE, * P_SP_MGR_GESTURE;
When a user makes the spelling gesture on an embedded window, thesends msgSpMgrGesture to
theSpellManager with the_MGR_GESTURE structure filled in.
Miscellaneous
Quick Help Tags
fdefine SpMgrReplaceButtonTag MakeTag(clsSpellManager,l)
fdefine SpMgrIgnoreButtonTag MakeTag(clsSpellManager,2)
fdefine SpMgrCancelButtonTag MakeTag(clsSpellManager,3)
fdefine SpMgrlnsertionPadTag MakeTag(clsSpellManager,4)
fdefine SpMgrTKTableTag MakeTag(clsSpellManager,5)
fdefine SpMgrBackgroundTag MakeTag(clsSpellManager,6)
fdefine SpMgrClearButtonTag MakeTag(clsSpellManager,7)
fdefine SpMgrRememberButtonTag MakeTag(clsSpellManager,8)
fdefine SpMgrTitleBarTag MakeTag(clsSpellManager,9)
fdefine hlpSpMgrReplaceButton SpMgrReplaceButtonTag
fdefine hlpSpMgrIgnoreButton SpMgrIgnoreButtonTag
fdefine hlpSpMgrCancelButton SpMgrCancelButtonTag
fdefine hlpSpMgrlnsertionPad SpMgrlnsertionPadTag
fdefine hlpSpMgrTKTable SpMgrTKTableTag
fdefine hlpSpMgrBackground SpMgrBackgroundTag
fdefine hlpSpMgrClearButton SpMgrClearButtonTag
fdefine hlpSpMgrRememberButton SpMgrRememberButtonTag
fdefine hlpSpMgrTitleBar SpMgrTitleBarTag
II Different help tags for when this is proof instead of spell
fdefine hlpProoflnsertionPad MakeTag(clsSpellManager,lO)
fdefine hlpProofTKTable MakeTag(clsSpellManager,ll)
SR.M
Debugging Flags
The Find and Replace mechanism uses the debug flag RIOOOO.
#ifndef SR INCLUDED
#define SR=INCLUDED 1
#ifndef MARK INCLUDED
#include <mark.h>
#endif
Statuses
The current match cannot! may not be replaced.
#define stsSRCannotReplace MakeStatus(clsSR, 1)
Comments Important: your handler must have the following as its first statement. Replace "clsYourClassHere" with
the uid of your class. See markh.
MarkHandlerForClass(clsYourClassHere);
This group may be up to maxLen characters in size. The client sets the len parameter to the actual size
of the group, and if the group is the start and/or end of a block of character, sets the respective flags. A
. block is defined as a logically contiguous group of characters that can be searched.
Any non-text element usually delimits the end of a block If the element is an embedded window that
should be searched, the token should be set to point to the embedded window and stsMarkEnterChild
(see markh) should be returned. If the element is not a child, then it should be simply skipped and the
token moved to the next group of characters following it.
Example: If the following text is in the client's data, and msgSRNextChars is received with a maxLen of
5, the token would should refer to the blocks 1 through 4 in succession. blockStart should be true for
blocks 1 and 3 and blockEnd should be true for blocks 2 and 4. In this way, "SEN" and "MANTLE"
can be found, but "GERMAN" which spans some non-text object won't be mistakenly found.
M E SSE N G E R (non-text-thing) MAN T L E
I I I I I I
+----1----+---2---+----------------+----3----+4+
msgSRGetChars
The component passes back the characters from the location identified by the token.
Takes P _SR_GET_CHARS, returns STATUS.
#define msgSRGetChars MakeMsg(c!sSR, 2)
typedef struct SR_GET_CHARS
MARK MSG HEADER header;
U32 - - first; II In: character to start with
U32 len; II In: the number of characters to return
U32 bufLen; II In: lengt~ of the buffer
P CHAR pBuf; II In: pointer to the buffer to fill
SR_GET_CHARS, * P_SR_GET_CHARS;
Important: your handler must have the following as its first statement. Replace "clsYourClassHere" with
the uid of your class. See markh.
MarkHandlerForClass(clsYourClassHere);
pArgs->first is token-relative and pArgs->len is the number of characters to return. Thus (0,2) requests
the first two characters, (1,1) requests the second character, and (3,0) requests no characters.
The string returned must be null-terminated. Note that if len is less than bufLen then this is always
possible without truncation. Otherwise, the number of characters returned should be one less than
bufLen and they should still be null terminated.
msgSRReplaceChars
Ask the component to replace some of the characters at the location identified by the token.
Takes P _SR_REPLACE_CHARS, returns STATUS.
#define msgSRReplaceChars MakeMsg(clsSR, 3)
typedef struct SR REPLACE CHARS
MARK MSG HEADER header;
S32 - - first; II In: replacement starts here
U32 len; II In: ... and is this long
U32 bufLen; II In: repl. size in characters
P CHAR pBuf; II In: the buffer of the characters
SR REPLACE_CHARS, * P_ SR_REPLACE_CHARS;
SR.H 307
Messages to theSearchManager
Comments Important: your handler must have the following as its first statement. Replace "clsYourClassHere" with
the uid of your class. See mark.h.
MarkHandlerForClass(clsYourClassHere);
pArgs->first is token-relative, and pArgs->len is the number of characters to replace. Thus (0,2) replaces
the first two characters, (1,1) replaces the second character, and (3,0) replaces no characters starting
between the third and fourth (thus effecting an insertion).
pArgs->first may be negative, indicating replacement of text BEFORE the current token (or large
indicating AFTER). However, in no case will pArgs->first go beyond the boundaries indicated by the
blockStart and blockEnd flags from previous calls to msgSRNextChars.
This message should only affect the token insofar as the replacement makes changes to the data the
token refers to. For example: if the token refers to the three characters "cat" and the replace messages
changes the substring "c" (0,1) into "womb", then the token should now refer to the six characters
"wombat".
msgSRPositionChars
Asks the component to reposition the token to some of the characters in the current group.
Takes P_SR_POSITION_CHARS, returns STATUS.
#define msgSRPositionChars MakeMsg(clsSR, 4)
typedef struct SR_POSITION_CHARS
MARK_MSG_HEADER header;
S32 first; II In: new position starts here
U32 len; II In: ... and is this long
SR_POSITION_CHARS, * P_SR_POSITION_CHARS;
Important: your handler must have the following as its first statement. Replace "clsYourClassHere" with
the uid of your class. See mark.h.
MarkHandlerForClass(clsYourClassHere);
pArgs->first is token-relative, and pArgs->len is the number of characters to reposition to. Thus (0,2)
positions to the first two characters, (1,1) positions to the second character, and (3,0) positions to
between the third and fourth characters.
pArgs->first may be negative indicating positioning BEFORE the current token (or large indicating
AFTER). However, in no case will pArgs->first go beyond the boundaries indicated by the blockStart
and blockEnd flags from previous calls to msgSRNextChars.
Messages to theSearchManager
These messages are sent to theSearchManager by PenPoint's standard UI elements. Typical clients do
not send them.
msgSRInvokeSearch
Starts a Find & Replace option sheet.
Takes P_SR_INVOKE_SEARCH, returns STATUS.
#define msgSRInvokeSearch MakeMsg(clsSR, 10)
308 PENPOINT API REFERENCE
Part 9 / Utility Classes
msgSRRememberMetrics
Asks theSearchManager to remember the current settings of a Find & Replace option sheet
Takes P _SR_METRICS, returns STATUS.
#define msgSRRernemberMetrics MakeMsg(clsSR, 12)
Messttf0 e typedef struct SR_METRICS {
fo\rgtunenfs CHAR findText[srBufSize]i
CHAR replaceText[srBufSize]i
MARK MSG FLAGS markFlagsi
SR FLAGS searchFlagsi
SR_METRICS, * P_SR_METRICSi
As a result, when theSearchManager option sheet next appears it will have the these settings.
STROBJ.H
Class Messages
msgNew
Creates a new string object.
Takes P_STROBJ_NEW_ONLY, returns STATUS. Category: class message.
typedef struct STROBJ_NEW_ONLY {
P_CHAR pString;
} STROBJ_NEW_ONLY, *P_STROBJ_NEW_ONLY;
*define strObjNewFields \
objectNewFields \
STROBJ NEW ONLY strobj;
typedef struct STROBJ_NEW {
strObjNewFields
} STROBJ_NEW, *P_STROBJ_NEW;
This message allocates shared heap storage for the specified string and copies the client string data into
it.
msgNewDefaults
Initializes the STROBLNEW structure to default values.
Takes P_STROBLNEW, returns STATUS. Category: class message.
M~$s@~e typedef struct STROBJ_NEW {
Ar~l"irrlents strObjNewFields
} STROBJ_NEW, *P_STROBJ_NEW;
Sets
pNew->strobj.pString = pNull;
310 PENPOINT API REFERENCE
Part 9 / Utility Classes
Obiec. Messages
msgStrObjGetStr
Passes back the object's string.
Takes PP_CHAR, returns STATUS.
tdefine msgStrObjGetStr MakeMsg(clsString, 1)
The pointer passed back references the object's global storage. Clients must not modify or free this
storage.
msgStrObjSetStr
Copies the specified string data into the object's string buffer.
Takes P _CHAR, returns STATUS.
tdefine msgStrObjSetStr MakeMsg(clsString, 2)
Previously retrieved string pointers will be invalid after this operation. Clients must call
msgStrObjGetStr to retrieve a pointer to the valid object buffer.
Observer Messages
msgStrObjChanged
Sent to observers when the string object data changes.
Takes OBJECT, returns nothing. Category: observer notification.
tdefine msgStrObjChanged MakeMsg(clsString, 3)
The message argument is the UID of the clsString object that changed.
TS.H
This file contains the API definition for clsTable.
clsTable inherits from clsObject.
clsTable provides a general-purpose table mechanism with random and sequential access. The table
allows clients to create, destroy, modify, and access the table and its data using a row and column
metaphor. Data for the table is stored in a table file, whose lifetime can be independent to that of the
table object.
Tables are two dimensional arrays consisting of a fixed number of columns and a variable number of
rows. Each column can contain data of a single data type such as a U32, a variable length string, a fixed
sized byte field, date and time, etc.
The number of and types of these columns are defined when the table is created. Once that table has
been created, these parameters cannot be changed.
Clients access rows in the table using a TBL_ROW_POS data structure. The value for this row position is
returned to the client when a row is added to the table. All messages for manipulating data in the table
require this value to specify an individual row.
Clients address columns using their position in the TBL_COL_DESC array which the client provides in
the TBL_CRFATE data structure during msgNew.
The table is an observable object and clients choosing to be observers will receive notification when data
in the table changes or a row has been added to or removed from the table.
#ifndef TS INCLUDED
#define TS_INCLUDED
#include <clsmgr.h>
#include <fs.h>
#include <resfile.h>
Status Codes
Status values return by messages to clsTable.
#define st sTBLRefCountNot Zero MakeStatus( clsTable, 1 )
#define stsTBLColNameNotFound MakeStatus( clsTable, 2 )
#define stsTBLStrBufTooSmall MakeStatus( clsTable, 3 )
#define stsTBLBadNewFlags MakeStatus( clsTable, 4 )
#define stsTBLEndOfTable MakeStatus( clsTable, 5 )
#define stsTBLInvalidSortColValue MakeStatus( clsTable, 7 )
#define stsTBLCorruptedIndex MakeStatus( clsTable, 8 )
#define stsTBLColNotIndexed MakeStatus( clsTable, 9 )
#define stsTBLContainsIndexedCols MakeStatus( clsTable, 10 )
-------~-----
312 PENPOINT API REFERENCE
Part 9 / Utility Classes
Class Messages
msgNew
Creates a new table object.
Takes P _TBL_NEW, returns STATUS. Category: class message.
typedef enum TBL_FREE_BEHAVE {
tsFreeNoDeleteFile 0, II Free only the object, not the file
tsFreeDeleteFile flagO, II Destroy the file when freed
tsFreeWhenNoClients flag1, II Free when t clients accessing is 0
tsFreeNoObservers flag2, II Free when t of observers is 0
tsFreeNoCompact flag3, II Don't compact the table when freed
tsFreeDefault tsFreeNoDeleteFile
TBL FREE BEHAVE, *P_TBL_FREE_BEHAVE;
typedef enum TBL_EXIST {
II Same values as FS_EXIST MODE
tsExistOpen 0, II Open an existing table
tsExistGenError = 1, II Return error if table exists
tsExistGenUnique = 2, II Create table with a unique name
tsNoExistCreate = MakeU16(O,0), II Create a new table
tsNoExistGenError = MakeU16(O,1), II Return error if no table exists
tsExistDefault = tsExistOpen I tsNoExistCreate
TBL_EXIST, *P_TBL_EXIST;
typedef struct TBL_CREATE {
TBL_COL_COUNT colCount; II number of columns
P_TBL_COL_DESC colDescAry; II TBL COL DESC array
TBL_CREATE, *P_TBL_CREATE;
typedef struct TBL_NEW_ONLY {
CHAR name[TBL_MAXTBLNAMELEN]; II Table name
FS LOCATOR locator; II Table file
TBL EXIST exist; II Table exist behavior
TBL CREATE create; II Column specifications
TBL FREE BEHAVE freeBehavior; II Table free behavior
BOOLEAN createSemaphore; II Provide semaphore?
TBL_NEW_ONLY, *P_TBL_NEW_ONLY;
tdefine tableNewFields \
objectNewFields \
TBL NEW ONLY table;
typedef struct TBL_NEW
tableNewFields
} TBL_NEW, *P_TBL_NEW;
This message creates a new table file or opens an existing file.
The table name is an optional field. The locator and colDescAry fields must be valid and colCount
must be non zero or this message returns stsBadParam.
stsTBLBadNewFlags TBL_EXIST flags were invalid.
stsBadParam locator or colDescAry fields are invalid. colCount is O.
msgNewDefaults
Initializes the TBL_NEW structure to default values.
Takes P_ TBL_NEW, returns STATUS. Category: class message.
Me5$(j~¢ typedef struct TBL_NEW
Arguments tableNewFields
TBL_NEW, *P_TBL_NEW;
314 PENPOINT API REFERENCE
Part 9 / Utility Classes
msgDestroy
Destroys an existing table object.
Takes OBLKEY, returns STATUS. Category: class message.
This message destroys the table object and frees the table files if the object was created with the
tsFreeDeleteFile flag specified.
The table file will not be destroyed regardless of whether tsFreeDeleteFile was specified if there are still
accessors to the table. Only the object will be freed.
stsTBLRefCountNotZero The number of accessors of the table is not zero. The table file will not be
destroyed.
Obiecl Messages
Table Row Addition and Deletion Messages
msgTBLAddRow
Adds a rowlrecord with no data to the table server object.
Takes P_ TBL_ROW_POS, returns STATUS.
#define msgTBLAddRow MakeMsg(clsTable, 1)
The row position (TBL_ROW_POS) for the new row is passed back. The row position is the key to access
data in the row or to delete the row.
msgTBLDeleteRow
Deletes the specified row.
Takes P_TBL_ROW_POS, returns STATUS.
#define msgTBLDeleteRow MakeMsg(clsTable, 5)
Rows are deleted from the table at the completion of this call. The row's TBL_ROW_POS is no longer
valid after the row has been deleted.
stsTBLEndOffable TBL_ROW_pas value was not found in the table.
TS.H 315
Object Messages
msgTBLColGetData
Passes back the data for the specified row and column.
Takes P_TBL_COL_GET_SET_DATA, returns STATUS.
*define msgTBLColGetData MakeMsg(clsTable, 13)
typedef struct TBL_COL_GET_SET_DATA {
TBL_ROW_POS tblRowPOSi II In: Table row position
TBL_COL_INX_TYPE colNumberi II In: Column number
P_TBL_COL_DATA_HOLDER tblColDatai II Out: Column data
TBL_COL_GET_SET_DATA, *P_TBL_COL_GET_SET_DATA;
tblColData is of type P _TBL_STRING if the column type is tsString, tsCaseString, or tsByteArray.
The client is responsible for allocating storage for the tblStr.pStr buffer. If the buffer is too small to
accomodate the requested data, the table will return stsTBLStrBuffooSma11 and pass back the
truncated data and the actual length of the data in tbIStr.strLen.
stsTBLStrBuffooSma11 Returned if column type is tsString, tsCaseString or tsByteArray and
tblStr.strMax is less than the actual data length. The data is truncated and the length is returned in
tbIStr.strLen.
stsTBLEndOffable TBL_ROW_POS value was not found in the table.
msgTBLColSetData
Sets the data for the specified row and column.
Takes P_TBL_COL_GET_SET_DATA, returns STATUS.
*define msgTBLColSetData MakeMsg(clsTable, 14)
Message typedef struct TBL_COL_GET_SET_DATA {
Arguments TBL_ROW_POS tblRowPOSi II In: Table row position
TBL_COL_INX_TYPE colNumberi II In: Column number
P_TBL_COL_DATA_HOLDER tblColDatai II Out: Column data
TBL_COL_GET_SET_DATA, *P_TBL_COL_GET_SET_DATAi
tblColData is of type P _ TBL_STRING if the column type is tsString, tsCaseString, or tsByteArray.
Clients are responsible for setting the strLen field of the TBL_STRING argument for all column types.
stsTBLEndOffable TBL_ROW_POS value was not found in the table.
msgTBLRowGetData
Gets the contents of an entire row.
Takes P_TBL_GET_SET_ROW, returns STATUS.
*define msgTBLRowGetData MakeMsg(clsTable, 15)
Arguments typedef struct TBL_GET_SET_ROW {
TBL_ROW_POS tblRowPOSi II In: Which row
P UNKNOWN pRowDatai II Out: Row data
TBL_GET_SET_ROW, *P_TBL_GET_SET_ROWi
Comments Not valid for tables containing variable length columns.
The client is responsible for providing storage for the pRowData buffer. The length of a table row can
be obtained using msgTBLGetRowLength.
316 PEN POINT API REFERENCE
Part 9 / Utility Classes
msgTBLRowSetData
Sets the contents of an entire row.
msgTBLGetlnfo
Gets the table header information.
Takes P_TBL_HEADER, returns STATUS.
fdefine msgTBLGetInfo MakeMsg(clsTable, 10)
typedef struct TBL_HEADER
TBL COL COUNT colCount; II number of columns in table
CHAR - name[TBL MAXTBLNAMELEN];II non-file table reference
TBL ROW COUNT nRows; - II how many rows in table
TBL ROW LENGTH rowLength; II row buffer length
TBL ROW POS firstRow; II position of first row in table
TBL ROW POS currentRowi II position of current row in table
TBL ROW POS lastRowi II position of last row in table
TBL REF COUNT refCount; II number of active clients.
TBL_HEADER, *P_TBL_HEADER, **PP_TBL_HEADERi
msgTBLGetCoICount",
msgTBLGetColCount
Gets the number of columns in the table.
msgTBLGetColDesc
Passes back the column description for the specified column.
Takes P _TBL_GET_COL_DESC, returns STATUS.
fdefine msgTBLGetColDesc MakeMsg(clsTable, 2)
TS.H 317
Object Messages
msgTBLGetRowCount
Gets the current number of rows in the table.
msgTBLGetRowLength
Gets the length (in bytes) of the specified row.
Takes P_TBL_ROW_LENGTH, returns STATUS.
tdefine msgTBLGetRowLength MakeMsg(clsTable, 8)
Comments The row length indicates the total width of all columns for each row in the table. This information is
useful when getting and setting row data.
msgTBLRowGetData
msgTBLGetState
Gets the current state of a specified row.
Takes P_TBL_GET_STATE, returns STATUS.
tdefine msgTBLGetState MakeMsg(clsTable, 11)
Argvments typedef enum TBL_STATE {
tsBegin 0, II rowPos is the first row
tsEnd = 1, II rowPos is the last row
tsPosition = 2 II rowPos is not first or last
TBL_STATE, *P_TBL_STATE;
typedef struct TBL GET STATE {
TBL_STATE tblState; II Out: State of the specified row
TBL_ROW_POS tblRowPos; II In: Row position of the specified row.
TBL_GET_STATE, *P_TBL_GET_STATE;
The state of a row in the table indicates its general positioning within the table.
stsTBLEndOffable TBL_ROW_POS value was not found in the table.
msgTBLBeginAccess
Initiates table access by a client on this table.
Takes P _TBL_BEGIN_ACCESS, returns STATUS.
tdefine msgTBLBeginAccess MakeMsg(clsTable, 17)
typedef struct TBL_BEGIN_ACCESS {
OBJECT sender; II In: sender's id IFF wants to be observer
TBL_ROW_LENGTH rowLength; II Out: Length of the first row
TBL_BEGIN_ACCESS, *P_TBL_BEGIN_ACCESS;
Comments Passes back the row length of the first row. Adds the sender to the table's observer list.
318 PEN POINT API REFERENCE
Part 9 / Utility Classes
msgTBLEndAccess
Ends client access to the table.
Takes P_TBL_END_ACCESS, returns STATUS.
#define msgTBLEndAccess MakeMsg(clsTable, 18)
typedef struct TBL_END_ACCESS {
OBJECT sender; II In: Sender's uid
} TBL_END_ACCESS, *P_TBL_END_ACCESS;
Removes sender from the observer list.
msgTBLSemaCIear
Releases the table's semaphore.
Takes nothing, returns STATUS.
#define msgTBLSemaClear MakeMsg(clsTable, 23)
The next client currently waiting on the table semaphore will unblock when this messages completes.
msgTBLSemaRequest
Requests access to the table's semaphore.
Takes nothing, returns STATUS.
#define msgTBLSemaRequest MakeMsg(clsTable, 22)
Waits on the table semaphore if another client already has access. Provides exclusive access of the table
semaphore to the sender when it returns.
Semaphore access has no timeout.
msgTBLFindFirst
Finds the first record that meets the search specification.
Takes P_TBL_FIND_ROW, returns STATUS;.
#define msgTBLFindFirst MakeMsg(clsTable, 3)
typedef enum TBL_BOOL_OP
tsEql 0, II Match if operands are equal
tsEqual 1, II Match if operands are equal
tsLess 2, II Match if opndl < opnd2
tsGreater 3, II Match if opndl > opnd2
tsGreaterEqual 4, II Match if opndl <= opnd2
tsLessEqual 5, II Match if opndl >= opnd2
tsNotEqual 6, II Match if the operands do not match
tsSubstring 7, II Match if opndl is an exact substring of opnd2
tsStartsWith 8, II Match if opndl starts with opnd2
tsAlwaysTrue 9 II Match the first (or next) row
TBL_BOOL_OP, *P_TBL BOOL_OP;
typedef struct TBL_SEARCH_SPEC
TBL_COL_INX_TYPE colOperand; II In: Which column
TBL BOOL OP relOp; II In: Operation
P_TBL_COL_DATA_HOLDER pConstOperand; II In: Value to search against
TBL_SEARCH_SPEC, *P_TBL_SEARCH_SPEC;
TS.H 319
Object Messages
msgTBLFindNext
Find the next record following the specified TBL_ROW_POS that meets the search specification.
Takes P_TBL_FIND_ROW, returns STATUS.
*define msgTBLFindNext MakeMsg(clsTable, 4)
MCStH::Jge typedef struct TBL_FIND_ROW
ArgUn1fmrS TBL ROW POS rowPos; II In:Out - current table position
TBL ROW NUM rowNum; II Out: indexed column row number
TBL SEARCH SPEC
- - srchSpec; II In: search query
TBL- COL- INX- TYPE sortCol; II In: which column sort to use (if any)
P ROW BUFFER pRowBuffer; II In: pointer to client's buffer space
TBL_FIND_ROW, *P_TBL_FIND_ROW;
Passes back the TBL_ROW_POS and TBL_ROW_NUM of the row.
srchSpec.pConstOperand is of type P_TBL_STRING if the column type is tsString, tsCaseString, or
tsByteArray. The length of the string/array used in the search is decal red in the strLen field of the
TBL_STRING struct. Clients are responsible for setting this field to the appropriate length for columns of
type tsString, tsCaseString, and tsByteArray.
srchSpec.pConstOperand is ignored if srchSpec.relOp is tsAlwaysTrue.
If srchSpec.colOperand is an unsorted column, then the order of the rows searched is random.
stsTBLEndOffable No data was found matching the search spec, or rowPos is was not found in the
table.
stsTBLlnvalidSortColValue sortCol is not a valid column value.
msgTBLFindColNum
Passes back the column number for the specifed column name.
Takes P_TBL_COL_NUM_FIND, returns SfATUS.
*define msgTBLFindColNum MakeMsg(clsTable, 12)
320 PEN POINT API REFERENCE
Part 9 / Utility Classes
msgTBLCompact
Compacts the table without closing it.
Takes nothing, returns STATUS.
#define msgTBLCompact MakeMsg(clsTable, 24)
This message allows clients to compact a table on demand. Compaction frees up any storage associated
with previously deleted rows and compacts the table to its minimum file size. Ordinarily, a table is
compacted automatically when the last client accessing the table closes it unless specifically prevented by
specifying tsFreeNoCompact during msgNew.
msgTBLRowNumToRowPos
Converts a TBL_ROW_NUM to its corresponding TBL_ROW_POS for the specified column.
Takes P_TBL_CONVERT_ROW_NUM, returns STATUS.
#define msgTBLRowNumToRowPos MakeMsg(clsTable, 28)
typedef struct TBL_CONVERT_ROW_NUM {
TBL_ROW_POS rowPos; II Out: - Table row pos.
TBL ROW NUM rowNum; II In: - Index row number.
TBL_COL_INX_TYPE colNum; II In: - Indexed (sorted) column number.
TBL_CONVERT_ROW_NUM, *P_TBL_CONVERT_ROW_NUM;
Comments This message is defined only for sorted columns. Unsorted columns do not have a defined order.
stsTBLEndOffable rowNum is larger than the number of rows in the table.
·stsTBLColNotlndexed The specified column is not sorted.
Observer Messages
msgTBLRowAdded
Sent to observers indicating that a row has been added.
Takes P_TBL_ROW_POS, returns STATUS. Category: observer notification.
#define msgTBLRowAdded MakeMsg(clsTable, 19)
A pointer to the newly added TBL_ROW_POS is sent as an argument.
msgTBLRowDeleted
Sent to observers indicating that a row has been deleted.
Takes nothing, returns STATUS. Category: observer notification.
#define msgTBLRowDeleted MakeMsg(clsTable, 20)
TS.H 321
Observer Messages
msgTBLRowChanged
Sent to observers indicating that row data has been changed.
Takes P_TBL_ROW_POS, returns STATUS. Category: observer notification.
tdefine msgTBLRowChanged MakeMsg(clsTable, 21)
A pointer to the changed TBL_ROW_pos is sent as an argument.
Introduction
theUndoManager provides a centralized facility for managing undo information. theUndoManager
supports undo of user interface actions.
An undoable operation, or "undo transaction," is a collection of "undo items." Typically an undoable
operation is a small UI action (e.g. deleting some text).
When the user issues an "Undo" command the most recent undo transaction will be undone. A typical
scenario goes something like this:
• In response to some user interface action, a message handler begins an undo transaction with
msgUndoBegin and then sends messages which manipulate the application's data.
• As the data manipulation routines do their work, they add undo items to the undo transaction via
msgUndoAddItem.
• When the user interface handler regains control, the transaction is dosed with msgUndoEnd.
• At some later date, the transaction might be undone. theUndoManager undoes a transaction by
sending msgUndoltem to each item in the transaction (in the reverse order in which they were
added).
• If the transaction is not undone, but instead falls off the end of the undo transaction queue, then
the transaction is freed. (A transaction is also freed if the application is terminated.)
theUndoManager frees a transaction by sending msgUndoFreeltemData to each item in the
transaction. (But see the comments near the typedefUNDO_ITEM for some circumstances under
which theUndoManager doesn't send msgUndoFreeltemData but instead frees the item itself.)
Common Messages
Typical application code will send the following messages to theUndoManager:
• msgUndoBegin
• msgUndoEnd
• msgUndoAddItem
Typical application code will receive the following messages from theUndoManager:
• msgUndoI tern
• msgUndoFreeItemData
See the individual descriptions of each of these messages for more information.
324 PEN POINT API REFERENCE
Part 9 I Utility Classes
Debugging Flags
Undo's debugging flag set is 'U.' Defined flags are:
0001 Show messages sent to theUndoManager.
0002 Show clsUndo initialization.
0004 Show msgUndoAddItem.
0008 Show undoing a undo transaction.
0010 Show creating a undo transaction.
0020 Show destroying an undo transaction.
Memory Management
Each undo item records the information necessary to undo and/or free itself.
Often this information has to be remembered in allocated memory or objects that must be freed once
the item can no longer be undone. For instance, an undoable operation might involve deleting an
object. However, you probably don't want to destroy the object until you're sure that the operation can't
be undone. But eventually that object has to be destroyed.
Normally theUndoManager will send msgUndoFreeltemData to the object stored in each UNDO_ITEM.
The handler should respond by freeing any resources associated with the item. Typically those resources
are pointed to by item.pData.
But there are five ways in which you and theUndoManager can cooperate so that theUndoManager can
free the resources for you.
• If uIDataIsHeapNode is set in item.flags, then item.pData must point to a heap block.
theUndoManager will free item.pData by calling OSHeapBlockFree{item.pData).
• If uIDataInUndoHeap is set in item.flags, then item.pData must point to heap block allocated
from the current transaction's heap. theUndoManager will free item.pdata when it destroys the
transactions's heap.
• If uIDatalsObject is set in item.flags, then item.pData must be an object UID. theUndoManager
will free item.pdata by calling ObjectSend(msgDestroy, item.pData, ... ). (See the section "Freeing
Undone Items" for one reason NOT to use this variation.)
• If uIDataIsSimple is set in item.flags, then item.pData is treated as a 32 bit value. There is no need
for theUndoManager to do anything to free item.pData.
• If none of the above flags is set in item.flags, and item.dataSize is non-zero, then when the item is
added to the transaction (with msgUndoAddltem) theUndoManager copies item.dataSize bytes
from item.pData into a block allocated from the current transaction's heap. theUndoManager then
frees item.pData when it destroys the transactions's heap.
-~----~--~--- --------
326 PENPOINT API REFERENCE
I Utility Classes
Part 9
Subclass Issues
A class and any number of its ancestors may contribute items to an undo transaction.
Thus, every msgUndoFreeItemData handler should first check that item. subclass is the expected value.
If it isn't, the message should be passed onto the ancestor. So a msgUndoFreeltemData handler should
look something like:
MsgHandlerWithTypes(RTltemUndoFreelternData, P_UNDO_ITEM, PP_DATA)
{
if (pArgs->subclass != clsRTltem) {
return ObjectCallAncestorCtx(ctx);
else {
Aborting a Transaction
Sometimes it is necessary to abort an operation part way through. (For instance, the user might not
confirm the operation.) If this happens, you should abort the then the undo transaction with
msgUndoAbort. See the comments on msgUndoAbort for more information.
*ifndef UNDO_INCLUDED
*define UNDO_INCLUDED
iifndef LIST INCLUDED
*include <list.h>
*endif
Exported Functions
STATUS PASCAL
InitClsUndo(void);
Message Arguments
UNDO_ITEM
typedef struct UNDO_ITEM {
OBJECT object; II In: object that undoes/frees item
OBJECT subclass; II In: See "Subclass Issues" section
U16 flags; II In: See "Memory Management" section
P UNKNOWN pData; II In: See "Memory Management" section
SIZEOF dataSize; II In: See "Memory Management" section
UNDO_ITEM, *P_UNDO_ITEM;
The following flags are used in the flags field of an UNDO_ITEM.
*define ufReserved (OxffOO)
*define ufClient (flagO I flag1 I flag2 I flag3)
*define ufDataType (flag4IflagSlflag6Iflag7IufReserved)
idefine ufDataInUndoHeap flag4
*define ufDataIsHeapNode flagS
*define ufDataIsObject (flagS Iflag4)
*define ufDataIsSimple (flag6Iflag4)
fdefine undoNewFields \
listNewFields \
UNDO NEW ONLY undo;
typedef struct UNDO_NEW_ONLY {
U32 reserved; II Reserved for expansion
P UNKNOWN pReserved; II Reserved for expansion
U32 maxTransactionsi
UNDO_NEW_ONLY, *P_UNDO_NEW_ONLY;
typedef struct UNDO_NEW {
undoNewFields
} UNDO_NEW, *P_UNDO_NEW;
Messages
Next: 11; recycled: none
msgUndoAbort
Aborts the current undo transaction.
Takes pNull, returns STATUS.
fdefine msgUndoAbort MakeMsg(clsUndo, 10)
The current transaction is flagged as being aborted. Until the transaction is closed, any attempted
msgUndoAddItem, msgUndoBegin, and msgUndoEnd (including the one that finally closes the
transaction) will fail and return stsUndoAbortingTransaction. Once the msgUndoEnd that closes the
transaction is received, any remaining undo items in the aborted transaction are freed.
msgUndoAddltem
Adds a new item to the current undo transaction if and enly if it is still open.
Takes P_UNDO_ITEM, returns STATUS.
fdefine msgUndoAddItem MakeMsg(clsUndo, 0)
Message typedef struct UNDO ITEM
Arguments OBJECT object; II In: object that undoes/frees item
OBJECT subclass; II In: See "Subclass Issues" section
U16 flags; II In: See "Memory Management" section
P UNKNOWN pData; II In: See "Memory Management" section
SIZEOF dataSize; II In: See "Memory Management" section
UNDO_ITEM, *P_UNDO_ITEMi
theUndoManager returns stsFailed if an open transaction does not exist. Any other error status indicates
that there are not enough resources available to add the item.
msgUndoBegin
Creates a new undo transaction if there is no current transaction, or increments the nesting count if
there is a current transaction.
Takes RES_ID, returns STATUS or UNDO_ID.
fdefine msgUndoBegin MakeMsg(clsUndo, 1)
See the "Nesting of msgUndoBegin and msgUndoEnd" section for information about how to send this
message.
UNDO.H 329
Messages
msgUndoCurrent
Undoes the most recent undo transaction.
Takes pNull, returns SfATUS.
*define msgUndoCurrent MakeMsg(clsUndo, 2)
msgUndoCurrent undoes the most recent transaction. If a transaction is currently open the transaction
is closed first, and then undone.
It is unusual for a client to send this message. The only real reason for sending this message is if some
piece of client code is implementing an alternative UI mechanism to invoke the undo mechanism.
msgUndoEnd
Decrements the nesting count of (and thus may end) the current transaction.
Takes pNull, returns SfATUS.
*define msgUndoEnd MakeMsg(clsUndo, 3)
See the "Nesting of msgUndoBegin and msgUndoEnd" section for information about how to send this
message.
stsFailed No open transaction.
msgUndoGetMetrics
Passes back the metrics associated with an undo transaction.
Takes P_UNDO_METRICS, returns STATUS.
*define msgUndoGetMetrics MakeMsg(clsUndo, 4)
Message typedef struct UNDO_METRICS
Arguments UNDO ID idi II In:Out Nil => get current
OS HEAP ID heapId; II Out
U16 state; II Out
U16 transactionCount; II Out
U16 itemCount; II Out
U32 limit; II Out
U32 resId; II Out
U32 info; II Reserved
UNDO_METRICS, *p_UNDO_METRICS i
Only an pArgs->id of Nil(UNDO_ID) , representing the current undo transaction, is supported.
stsFailed The specified transaction does not exist or there is in sufficient memory available to
manipulate it.
msgUndoLimit
Sets the maximum number of remembered undo transactions.
Takes U32, returns STATUS.
#define msgUndoLimit MakeMsg(clsUndo, 8)
The default undo limit is 2. If your application wants to support a longer undo history, send
msgUndoLimit to theUndoManager with the desired limit.
If there are more transactions in the queue than the new limit, the extra transactions will be freed.
Setting the limit to 0 flushes all transactions and effectively disables undo until the limit is set to some
non-zero value.
msgUndoLimit always returns stsOK.
msgUndoRedo
Not implemented.
Takes pNull,returns STATUS.
#define msgUndoRedo MakeMsg(clsUndo, 5)
Not implemented. Do not send this message.
Clien. Messages
msgUndoltem
Sent to pArgs->object to have the item undone.
Takes P_UNDO_ITEM, returns STATUS.
#define msgUndoItem MakeMsg(clsUndo, 6)
M0U0se typedef struct UNDO ITEM
Arguments OBJECT object; II In: object that undoes/frees item
OBJECT subclass; II In: See "Subclass Issues" section
U16 flags; II In: See "Memory Management" section
P UNKNOWN pData; II In: See "Memory Management" section
SIZEOF dataSize; II In: See "Memory Management" section
UNDO_ITEM, *p UNDO- ITEM;
Note that the item will be freed in a separate step later.
msgUndoFreeltemData
Sent to pArgs->object to have pArgs->pData freed.
Takes P_UNDO_ITEM, returns STATUS.
#define msgUndoFreeItemData MakeMsg(clsUndo, 7)
M;$$S0se typedef struct UNDO_ITEM {
Atgutl10nts OBJECT object; II In: object that undoes/frees item
OBJECT subclass; II In: See "Subclass Issues" section
U16 flags; II In: See "Memory Management" section
P UNKNOWN pData; II In: See "Memory Management" section
SIZEOF dataSize; II In: See "Memory Management" section
UNDO_ITEM, *P_UNDO_ITEM;
See the "Memory Management," "Subclass Issues" and "Freeing Undone Items" sections for information
about how to respond to this message.
XFER.M
This file contains the API definition for clsXfer and clsXferList.
clsXfer inherits from clsStream.
clsXfer defines the mechanisms used for transferring data between objects.
clsXferList inherits from clsList.
clsXferList is used by the transfer mechanism.
Most clients of PenPoint's data transfer mechanism should use the procedural interfaces defined in this
file.
The functions described in this file are contained in XFER.LIB.
Introduction
Key Concepts
This file describes some of PenPoint's support for transferring data.
There are a few central concepts that underlie PenPoint's data transfer mechanism:
• Sender and Receiver. There are two sides to any data transfer. "Sender" refers to the object providing
the data and "Receiver" refers to the object receiving the data. These two objects can be in different
processes, or in the same process. They can even be the same object!
• Two Stages. Each PenPoint data transfer has two major stages. In the first stage the Sender and
Receiver engage in a simple protocol to determine if the data can be transferred, and if so what
"type" the data has. In the second stage, the data is actually transferred using a protocol that is
specific to the type agreed to during Stage 1.
• Data Transfer Types. A Sender and Receiver need to agree on a data transfer type that they both
understand. PenPoint defines several data transfer types and clients can define additional types. See
the section "Determining a Data Transfer Type" for more information.
• Data Transfer Protocol. Each data transfer type has an associated data transfer protocol. Once a
transfer type has been agreed upon, the Sender and Receiver engage in the type-specific protocol to
actually move the data. Note the same Data Transfer Protocol can be employed for multiple Data
Transfer Types, but that each Data Transfer Type uses one and only one protocol.
Roadmap
Typical Receivers use the following to determine the desired data transfer type.
• XferMatchO
Typical Senders respond to or use the following to provide a list of data transfer types.
• msgXferList
• XferAddIdsO
332 PENPOINT API REFERENCE
Part 9 / Utility Classes
Typical Senders and Receivers who use data transfer types that use one-shot protocols use the following:
• msgXferGet
Senders and Receivers who use data transfer types that use stream-based protocols use the following:
• msgXferStreamConnect
• msgXferStreamWrite
• msgXferStreamF reed
• XferStreamConnectO
• XferStreamAcceptO
A Typical Scenario
A typical data transfer session goes something like this:
• The Receiver decides that it is the receiving end of a data transfer operation. (For instance, the
receiver might receive msgSelMoveSelection or msgSelCopySelection; see sel.h.)
• The Receiver figures out the UID of the Sender object. (For instance, in the case of
msgSelCopySelection or msgSelMoveSelection, the Sender object is the current selection owner,
which can retrieved by sending msgSelOwner to theSelectionManager.)
• The Receiver determines a mutually agreeable data transfer type using the utility routine XferMatch.
(See section "Determining a Common Data Transfer Type" for more detailed information about
XferMatch and alternatives.)
• The Sender and Receiver use the Data Transfer Protocol associated with the agreed-upon type to
actually transfer the data.
Stream-Based Protocols
Stream-based protocols make use of a specialized stream that is implemented by clsXferStream.
clsXferStream adds the ability for two streams to be linked through an internal "pipe."
Once a Receiver has decided to engage in a stream-based transfer (as described in the Section "A Typical
Scenario" earlier), the steps in stream-based protocol are as follows:
• The Receiver calls XferStreamConnect.
• XferStreamConnect creates the Receiver's stream and then sends msgXferStreamConnect to the
Sender.
• In response to msgXferStreamConnect, the Sender calls XferStreamAccept. Essentially all Senders
of stream-based protocols should pass self as the "Producer" parameter when they call
XferStreamAccept -- motivation and exceptions are described below.
• XferStreamAccept properly creates the Sender's stream.
• When control returns to it, the Receiver sends msgStreamReadData to its stream.
• As a result of the Receiver's msgStreamReadData, the Sender receives msgXferStreamWrite.
• In response to msgXferStreamWrite, the Sender writes data using msgStreamWriteData.
IMPORTANT NOTE: In order to avoid overflowing internal buffers, Senders should not write
huge chunks of data in a single call. Chunks than 64K won't work at all. Memory is used more
efficiently if chunk sizes don't exceed 10K, although things will work at any size up to 64K.
• The last two steps can be repeated any number of times. Eventually the Receiver gets stsEndOfData
returned when sending msgStreamReadData.
• The Receiver sends msgDestroy to its stream.
• As a result of the Receiver's msgDestroy, the Sender receives msgXferStreamFree.
• In response to msgXferStreamFree, the Sender sends msgDestroy to its stream.
The Sender must be prepared to handle msgXferStreamFreed at any time. (In addition to normal
termination, msgXferStreamFreed can indicate that the Receiver has died or otherwise has prematurely
destroyed its side of the pipe.)
~~ An Available Simplification
Some Senders may know that they can contain only a limited amount of data. Or they may find the
obligation to respond to msgXferStreamWrite multiple times and record how much data was actually
written each time to be unduly burdensome.
These Senders can pass objNull as the "Producer" parameter in their call ofXferStreamConnect. As a
result of doing this, msgXferStreamWrite will only be sent once, and in response these Senders should
write all of their data in a single chunk.
Client-Defined Protocols
Clients can define their own data transfer types. There is a wide range of possibilities. Clients can use
msgXferGet that use a new pArgs type. They can use streams but define structure on the data being
streamed. Or they define an entirely new transfer protocol.
XFER.H 335
Common #defines and typedefs
Other Information
Details of XferMatch
Most clients can simply use XferMatch without understanding how it works, but it's described here for
specialized clients or the curious.
• XferMatch creates an instance of clsXferList
• It then sends msgXferList to the passed-in Sender.
• The Sender responds to msgXferList by adding items to the xfer list by calling XferAddIds.
• XferMatch then scans the two lists (one passed in by the Receiver and one filled in by the Sender)
using the utility function XferListSearch.
• If no mutually acceptable data transfer type is found, XferMatch returns stsNoMatch. Otherwise
XferMatch returns stsOK and passes back the data transfer type in *pId.
• Just before returning, XferMatch destroys the xferList.
As an alternative to calling XferMatch, the Receiver could create the list, send msgXferList to the
Sender, and then search the list for the best match (perhaps by using XferListSearch).
Also, a sophisticated Sender can use msgListAddItem (rather than XferAddIds) to add the types to the
list.
XferList
Normal clients need not create xferLists since the functions create and destroy xferLists as needed.
An xferList is a subclass of clsList that always allocates globally accessible memory for the list.
fdefine XFER_LIST_NEW LIST_NEW
fdefine P_XFER_LIST_NEW P_LIST_NEW
Messages
msgXferList
Ask Sender for its list of data transfer types.
Takes OBJECT, returns STATUS.
fdefine msgXferList MakeMsg(clsXfer, 1)
This message is sent to the Sender to have the Sender provide the list of data transfer types it can
provide.
The Sender can add types to the passed-in list using either msgListAddItem or XferListAddIds.
If the Sender has a preferred data transfer type, it should put this type at the beginning of the list. The
Sender can use clsList messages to change the ordering of the list (see list.h).
msgListAddItems
msgXferGet
Sent by a Receiver to get" one-shot" data transfer information.
Takes lots-of-things, returns STATUS.
fdefine msgXferGet MakeMsg(clsXfer, 8)
msgXferGet is sent by the Receiver to the stream to retrieve the data being transferred.
The type of this message's pArgs depends on the data transfer type being used. In all cases, the first field
of pArgs must be a data transfer type so that the Sender (when it receives this message) knows what type
of data to supply and what the true type of pArgs really is.
stsN oMatch specified data transfer type is inappropriate
When used for xferLongString, the "pBuf" field is a null-terminated string and the "len" field includes
the terminating null character. (In other words, upon return, pArgs->len must equal
(strlen{pArgs->pBuf) + 1).)
typedef struct XFER BUF {
TAG id; II In: Data transfer type
U32 data; II Unused: future use
U32 len; II Out: Length of data in pBuf
P UNKNOWN pBuf; II Out: Buffer containing data
II Must be SHARED and freed by caller
Obiect Transfer
This type is used as the pArgs of msgXferGet when the data transfer type is:
• xferScribbleObject
• xferPicSegObject.
[The rest of this description is complicated by the reversal of names. The Receiver side of the data
transfer operation sends msgXferGet and the the Sender side of the data transfer operation receives
msgXferGet. ]
The Receiver (which sends msgXferGet) must set the "id" field to one of the data transfer types listed
above, and must set the "receiver" field to self (or some other object in the Receiver's task). The Sender
receives msgXferGet and fills in the rest of the structure.
The Sender makes a copy of the object using msgCopy and returns the uid of the object in pArgs->uid ..
When the Sender sends msgCopy, it should use pArgs->receiver as the value of msgCopy's
pArgs-> requestor.
typedef struct XFER OBJECT
TAG id; II In: Data transfer type
OBJECT receiver; II In: Receiver
OBJECT uid; II Out: Uid of object
CLASS objClass; II Out: Class of object
U32 reserved[4]; II Reserved for future use
XFER_OBJECT, * P_ XFER_OBJECT;
338 PENPOINTAPI REFERENCE
Part 9 / Utility Classes
ASCII Metrics
This type is used as the pArgs of msgXferGet when the data transfer type is xferASCIIMetrics.
[The rest of this description is complicated by the reversal of names. The Receiver side of the data
transfer operation sends msgXferGet and the the Sender side of the data transfer operation receives
msgXferGet.]
The Receiver (which sends msgXferGet) must set the "id" field to xferASCIIMetrics. The Sender
receives msgXferGet and fills in the rest of the structure.
"ASCII Metrics" include information about the character data that can be transferred from the Sender.
In some cases (e.g. PenPoint's text component) it describes the selected text.
(Essentially any Sender that can provide xferASCIIMetrics can also provide some type of character data
-- typically xferString, xferLongString or xferRTF.)
The "spare" field is always set to O. The "first" field is offset of the first selected character. The "length"
field is the number of characters in the selection. The "level" field describes which lexical unit the
selection "contains."
typedef struct XFER_ASCII_METRICS {
TAG id; II In: data transfer type.
U32 spare; I lOut: always 0
U32 first; II Out: character offset w.r.t. entire text
II maxU32 implies a bad request
U32 length; II Out: number of chars available to transfer
U16 level; II Out: 0: undefined or unknown, 1: chars,
II 2: words, 3: sentences, 4: paragraphs
XFER_ASCII_METRICS, *P_XFER_ASCII_METRICS;
msgXferStreamAuxData
Passes back auxiliary information associated with the pipe.
Takes PP_UNKNOWN, returns STATUS.
*define msgXferStreamAuxData MakeMsg(clsXfer, 4)
XFER.H 339
Stream Specific Messages
Comments The Sender or Receiver can store auxiliary information with the pipe. using msgXferStreamSetAuxData
and retrieve that information with msgXferStreamAuxData.
This information can be used by either the Sender or Receiver to store private information or to or to
pass information across the pipe.
t
Warning: There is only one auxiliary data slot in the pipe. Only one of the Sender or Receiver should
write the data, although both can read it. Subclasses must be aware of their ancestor's behavior in this
regard.
msgXferStreamSetAuxData
nnsg)CferStreannSetA~ata
Stores arbitrary client data with the pipe.
Takes P_UNKNOWN, returns STATUS.
tdefine msgXferStreamSetAuxData MakeMsg(clsXfer, 5)
msgXferStreamAuxData
nnsg)CferStreannWrite
Asks the Sender to write more data to the stream.
Takes STREAM, returns STATUS.
tdefine msgXferStreamWrite MakeMsg(clsXfer, 3)
The Sender responds by writing to its stream using msgStreamWrite.
The Sender may need access to its instance data to handle this message. The Sender can either
implement its own facility for mapping from the stream to the necessary instance data (perhaps using
properties; see clsmgr.h) or it can use msgXferStreamSetAuxData and msgXferStreamAuxData.
See the section "Stream-Based Protocols" for more information.
nnsg)CferStreannFreed
Sent to the Sender when the Receiver's side of the stream has been freed.
Takes STREAM, returns STATUS.
tdefine msgXferBtrearnFreed MakeMsg(clsXfer, 6)
The Sender handles this message by sending msgDestroy to the stream passed in as a parameter. This
means that both streams (and hence both ends of the "pipe") have been freed.
See the section "Stream-Based Protocols" for more information.
Public Functions
XferMatch
The Receiver calls XferMatch to find a mutually acceptable data transfer type.
Returns STATUS.
fUGttlcm Przt!@fype STATUS EXPORTED XferMatch(
OBJECT Sender, II In: Sender to find match with
TAG ids[], II In: Array of types the Receiver understands
SIZEOF idsLen, II In: Length of the ids[] array
P TAG pId); II Out: matching data type
340 PENPOINT API REFERENCE
Part 9 I Utility Classes
See the section "Determining a Common Data Transfer Type" for detailed. information.
stsNoMatch No common data transfer type could be found.
non-error The common data transfer type is passed back in *pld.
XferListSearch
XferListSearch
Searches two sets of data transfer types for a match.
Returns STATUS.
rurn:tlofi Prototype STATUS EXPORTED XferListSearch (
OBJECT listObject, II In: List object containing Sender types
TAG ids[], II In: Array of types the Receiver understands
SIZEOF idsLen, II In: Length of the ids[] array
P TAG pId)i II Out: Matching data type
(ommimts Most clients of the data transfer mechanism use XferMatch rather than calling this function.
XferListSearch scans the two sets of transfer types (one in listObject and one in the passed-in array) to
find the best match.
XferListSearch checks each item in listObject against each item in the array in order from 0 to n-l.
Hence if the array contains [tagA, tagB] and the list contains [tabB, tagA], tagA is returned. Objects
should put data types into the listObject or the array in order of most desired to least desired.
stsNoMatch No common data transfer type could be found.
non-error The common data transfer type is passed back in *pld.
XferMatch
XferAddlds
Adds data transfer types to listObject.
Returns STATUS.
rlmdion Prototype STATUS EXPORTED XferAddIds (
OBJECT listObject,
TAG ids[],
SIZEOF idsLen)i
Comments Typical Senders call this function while handling msgXferList.
XferAddlds adds each item in the array of data transfer types to the list by sending msgListAddItem to
listObject.
XFER.H 341
Stream Specific Functions
XferStrear.nJ\ccept
Called by Sender in response to msgXferStreamConnect.
Returns SfATUS.
STATUS EXPORTED XferStreamAccept(
OBJECT connect, II In: pArgs->stream from msgXferStreamConnect
U16 bufSize, II In: Size of transfer buffer (up to 64k)
OBJECT Producer, II In: Object to receive msgXferStreamWrite
P OBJECT pStream); II Out: Stream for Sender side of the "pipe"
Comments As part of the Sender's response to msgXferStreamConnect, the Sender calls XferStreamAccept to
properly create the Sender's side of the stream.
See the section "Stream-Based Protocols" for more information.
Part 10 /
Connectivity
-------- -- - -
ABMGR.M
This file contains the API definition for theAddressBookMgr.
theAddressBookMgr is an instance of a private class. It is the only instance of that class in the system.
theAddressBookManager is a well known object that handles registration of and access to "system"
address books. Registered address books are primarily responsible for managing the storage and retrieval
of service specific addressing information.
Registered address books adhere to the protocol defined in addrbook.h. Information about its
functionality and use can be found there.
theAddressBookMgr provides the facility to help other applications to provide a VI for picking the
system address book. When an application wants to provide this pick list as an option card, it just needs
to pass on msgOptionAddCards before it calls its ancestor to theAddressBookMgr.
TheAddressBookMgr will do the rest.
#ifndef ABMGR_INCLUDED
#define ABMGR_INCLUDED
#include <uuid.h>
#include <go.h>
#define tagABMgrABList MakeTag(theAddressBookMgr, 1)
Status Codes
#define stsABMgrAddrBookNotActive MakeStatus(theAddressBookMgr, 1)
#define stsABMgrAddrBookOpen MakeStatus(theAddressBookMgr, 2)
#define stsABMgrNoneActive MakeStatus(theAddressBookMgr, 3)
#define stsABMgrAddrBookNotRegistered MakeStatus(theAddressBookMgr, 4)
#define stsABMgrNoOpenAddrBook MakeStatus(theAddressBookMgr, 5)
Messages
msgABMgrRegister
Registers an application or a service as an address book instance.
Takes P_AB_MGR_ID, returns STATUS.
#define msgABMgrRegister MakeMsg(theAddressBookMgr, 1)
Messf1ge typedef struct AB_MGR_ID
Argumt)nts CHAR name [nameBuf Length]; II Name of the address book
AB MGR ID TYPE type; II Address book object type
union {
OBJECT uidi II UID of the service/object
UUID uuid; II UUID of the application working dir
value;
AB_MGR_ID, *P_AB_MG~ID;
When an instance of an address book is registered with theAddressBookMgr, it can later be selected as
"the system address book".
Address books send this message to register themselves with theAddressBookMgr. Each instance of each
address book should be registered with theAddressBookMgr. If an address book application is a subclass
of clsAddrBookApplication(see addrbookh), then theAddressBookMgr automatically registers a newly
created instance of this class.
If an address book is an application, theAddressBookMgr. will automatically re-registers the app on
warm boot. If an address book is a service, however, it would have to re-register itself after a warm boot.
msgABMgrUnregister
Unregisters an application or a service as an address book instance.
Takes P_AB_MGR_ID, returns STATUS.
#define msgABMgrUnregister MakeMsg(theAddressBookMgr, 2)
A4esst:lge typedef struct AB_MGR_ID {
Arguments CHAR name [nameBuf Length]; II Name of the address book
AB MGR ID TYPE type; II Address book object type
union {
OBJECT uid; II UID of the service/object
UUID uuid; II UUID of the application working dir
value;
AB_MGR_ID, *P_AB_MGR_ID;
Address book send this message to theAddressBookMgr to unregister themselves. This is usually done
when an application instance is deleted, or when a service is de-installed. If an address book application
is a subclass of dsAddrBookApplication(see addrbook.h), then theAddressBookMgr automatically
unregisters a deleted instance of this class.
msgABMgrOpen
Used by address book clients to begin access to address books.
Takes nothing, returns STATUS.
#define msgABMgrOpen MakeMsg(theAddressBookMgr, 3)
ABMGR.H 347
Messages
Comments Address book clients send msgABMgrOpen to theAddressBookMgr. If the system address book is an
application, then theAddressBookMgr activates the application. If the system address book is a service,
then theAddressBookMgr binds to the service(msgSMBind)
Clients must call msgABMgrClose when they're finished with the address book.
On warm boots, theAddressBookMgr requires that clients reopen the system address book.
msgABMgrClose
Used by address book clients to end access to address books.
Takes nothing, returns STATUS.
#define msgABMgrClose MakeMsg(theAddressBookMgr, 4)
typedef struct
BOOLEAN activated;
AB MGR 10 addressBook;
AB_MGR_LIST, *P~_MGR_LIST;
If the system address book is an application, then theAddressBookMgr deactivates the application. If
the system address book is a service, then theAddressBookMgr binds to the service(msgSMUnbind).
The address book is reference counted, so all msgABMgrOpen calls must be followed by an
msgABMgrClose.
msgABMgrList
Creates a list of currently registered address book in pArgs.
Takes P_LIST, returns STATUS.
#define msgABMgrList MakeMsg(theAddressBookMgr,5)
Every time msgABMgrList is called, a new list object is created. It is up to the client to call
msgListFree(not msgDestroy) to destroy the list and the items in the list. Set the free mode to
listFreeitemsAsData.
Each element of the list is a P_AB_MGR_L1ST.
msgABMgrActivate
Make a registered address book the system address book.
Takes P_AB_MGR_ID, returns STATUS.
#define msgABMgrActivate MakeMsg(theAddressBookMgr, 6)
Me$$~ge typedef struct AB_MGR_IO
Arguments CHAR name [nameBuf Length]; II Name of the address book
AB MGR 10 TYPE type; II Address book object type
union {
OBJECT uid; II UIO of the servicelobject
UUIO uuid; II UUIO of the application working dir
value;
AB_MGR_IO, *P_AB_MGR_IO;
In the current implementation only one address book can be the system address book at a time. If there
is currently a system address book, that address book is deactivated first.
Clients that are applications set the type field to 'application' and set the value field to the UUID of
their application working directory. Clients that are services or data objects set the type field to 'object'
and set the value field to their object UID.
348 PENPOINT API REFERENCE
Part 10 I Connectivity
stsABMgrAddrBookOpen The current system address book is currently open, therefore it can not be
deactivated
stsABMgrAddrBookNotRegistered The address book identified by pArgs is not a registered address
book.·
msgABMgrDeactivate
Deactivates the current system address book.
Takes P_AB_MGR..JD, returns STATUS.
fdefine msgABMgrDeactivate MakeMsg(theAddressBookMgr, 7)
MesS(l9tf typedef,struct AB_MGR_ID {
Argwmtfllh. CHAR name [nameBufLength]; // Name of the address book
AB MGR ID TYPE type; // Address book object type
union (
OBJECT uid; . / / UID of the service/object
UUID uuid; // UUID of the application working dir
value;
AB_MGR_ID, *P_AB_MGR_ID;
stsABMgrAddrBookOpen The current system address book is currently open, therefore it can not be
deactivated
msgABMgrlsActive
Indicates if the specified AB_MGR_ID is currently set.
Takes P_AB_MGR_ID, returns STATUS.
fdefine msgABMgrIsActive MakeMsg(theAddressBookMgr, 8)
Mtf$$C$ge typedef struct AB_MGR_ID
Ar9wmellts CHAR name [nameBuf Length]; // Name of the address book
AB MGR ID TYPE type; // Address book object type
union (
OBJECT uid; // UID of the service/object
UUID uuid; // UUID of the application working dir
value;
AB_MGR_ID, *P_AB_MGR_ID;
stsOK Specified id is activated.
stsABMgrNotActive Specified id is not activated, but something is active.
stsABMgrNoneActive No address book is currently active.
Observer Messages
msgABMgrChanged
Sent to observers of theAddressBookMgr when the system address book changes.
Takes P_AB_MGR-NOTIFY, returns STATUS.
fdefine msgABMgrChanged MakeMsg(clsAddressBook, 9)
ABMGR.H 349
Observer Messages
Enum16 (AB_MGR_CHANGE_TYPE) {
abMgrRegister 0, II an ab has been registered
abMgrUnregister 1,
abMgrActivated 2,
abMgrDeactivated 3,
abMgrOpened 4,
abMgrClosed 5,
};
typedef struct {
AB~GR_CHANGE_TYPE type;
AB_MGR 10 addressBook;
AB_MGR_NOTIFY, *P_AB_MGR_NOTIFY;
pArgs->activated is set to TRUE if pArgs->addressBook is made the system address book, and to FALSE
if pArgs->addressBook has been deactivated as the system address book.
ADDRBOOK.H
clsAddressBook inherits from clsObject.
This header file defines the address book protocol.
The address book protocol defines what minimal set of information is to be kept by an address book
app or service, how information is to be stored, retrieved, queried by an address book client. Please refer
to abmgr.h for informatiori on address book manager.
All requests to access address book information is channeled through the address book manager. There
can be multiple address book clients at one time. Whether or not address book clients can access
information from more than 1 address book application/service simultaneously is completely up to the
implementation of the address book manager. The current implementation of theAddressBookMgr
provided by GO only allows access to one address book at a time.
Because theAddressBookMgr uses ObjectSend to relay messages to address books, pointers in pArgs in
any address book protocol messages should point to some shared memory space.
There are 3 major types of address information defined by the protocol:
• individual personal information(e.g.name, phone number, street address)
• service information(individual's fax phone number, email address, etc)
• distribution list information
All information is keptlretrieved in attribute-value form. The basic entity in an address book is an
"entry"; all information is presented relative to an entry. E.g. to access any information in an address
book, a "key" to an entry must be presented. Within an entry, a client can set/get entry related
information(name, street address, etc.). Service address information is also kept as part of an entry.
Because there can be multiple service addresses for each entry(e.g. an individual has 2 fax numbers and 1
email address), a service address is accessed through a "service id" or the name of the service.(e.g. service
name = "fax")
The Address Book Protocol specifies a minimum set of attributes and attribute types to be supported by
third party address book applicaitons or services. If a developer thinks that some addition attributes or
attribute types are common enough that they should be defined in the protocol, please contact GO
Corporation Developer Support.
#ifndef ADDRBOOK INCLUDED
#define ADDRBOOK INCLUDED
#ifndef GO INCLUDED
#include <go.h>
#endif
#ifndef UID_INCLUDED
#include <uid.h>
#endif
#ifndef CLSMGR INCLUDED
#include <clsmgr.h>
#endif
#ifndef DIALENV_INCLUDED
#include <dialenv.h>
#endif
-----_., ~-----'---~~~~=
352 PEN POINT API REFERENCE
Part 10 / Connectivity
The following table lists what the value field should be, given a certain attribute type:
Attr Type value
Status Codes
Error Status Values
#define stsAddrBookBufTooSmall MakeStatus(clsAddressBook, 1)
#define stsAddrBookEntryExists MakeStatus(clsAddressBook, 2)
#define stsAddrBookSvcDataExists MakeStatus(clsAddressBook, 3)
#define stsAddrBookEntryNotFound MakeStatus(clsAddressBook, 4)
#define stsAddrBookSvcNotFound MakeStatus(clsAddressBook, 5)
#define stsAddrBookBadKey MakeStatus(clsAddressBook, 6)
#define stsAddrBookUnknownType MakeStatus(clsAddressBook, 7)
#define stsAddrBook1nvalidAttr MakeStatus(clsAddressBook, 8)
#define stsAddrBookReadOnlyAttr MakeStatus(clsAddressBook, 9)
#define stsAddrBookDuplicateAttr1d MakeStatus(clsAddressBook, 10)
Messages
msgAddrBookGet
fills in the specified entry field data, given an address book key for the entry.
Takes P _ADDR_BOOK_ENTRY, returns STATUS.
#define msgAddrBookGet MakeMsg(clsAddressBook, 1)
Mess©ge typedef struct ADDR_BOOK_ENTRY
Arguments OS HEAP 1D heap; II where should the address
II book alloc necessary space
II applicable only for
II msgAddrBookGet and
II msgAddrBookSearch
ADDR- BOOK ENTRY- TYPE type;
ADDR BOOK KEY keYi
U16 numAttrs;
P- ADDR BOOK- ATTR attrs;
U16 numServices; II Read only,ab1ndividual only
P_ADDR_BOOK_SERV1CE services; II ab1ndividual only
ADDR_BOOK_SERV1CE_QUAL svcQuali II service qualifier, for Get
ADDR_BOOK_ENTRY, *P_ADDR_BOOK_ENTRYi
If attribute type is abString and the client-provided space is not big enough, stsAddrBookBuffooSmall
is returned, and as much information as there is room for is filled in(null-terminated). Similarly, if
attribute type is abOther, stsAddrBookBuffooSmall is returned, and the client-provided buffer is filled
in(w/o null-termination).
Parameters:
pArgs->key In: specify from which entry to get info
pArgs-> type Out: type of the entry
pArgs->numAttrs In: number of elements in pArgs->attrs array. Each of pArgs->attrs.id specifies the
id of the attribute the client wants the address book to return. If the client sets this field to
AddrBookAll, then the address book will return all entry attributes(excluding services), and it will
allocate the necessary space. The client needs to deallocate the space. If the field is set to 0, then no
attributes are returned. Out: number of attributes returned
------- ----._----
356 PEN POINT API REFERENCE
Part 10 I Connectivity
msgAddrBookSet
Sets the specified entry and service data.
Takes P_ADDR_BOOK_ENTRY, returns STATUS.
tdefine msgAddrBookSet MakeMsg(clsAddressBook, 2)
MC$$©9C typedef struct ADDR_BOOK_ENTRY
Ar!$WIYHitl'1¥$ OS HEAP ID heap; II where should the address
II book alloc necessary space
II applicable only for
II msgAddrBookGet and
II msgAddrBookSearch
ADDR- BOOK- ENTRY- TYPE type;
ADDR BOOK KEY key;
U16 numAttrs;
P- ADDR BOOK- ATTR attrs;
U16 numServices; II Read only,abIndividual only
P_ADDR_BOOK_SERVICE services; II abIndividual only
ADDR_BOOK_SERVICE_QUAL svcQual; II service qUalifier, for Get
ADDR_BOOK_ENTRY, *P_ADDR_BOOK_ENTRY;
ADDRBOOK.H 357
Messages
Parameters:
pArgs->key In: specify from which entry to get info
pArgs->numAttrs In: how many attributes in the entry to set
pArgs->attr[x].id In: which attributes to set
pArgs->attr[x].type NA: don't need to specify
pArgs->attr[x] .length In: client-specified size of the correspond- ing entryAttrValue field. mandatory
for abOther, unnecessary for other types.
pArgs->attr[x].value In: attribute value. see previous table on attribute value-attribute length.
pArgs->numServices In: number of services to set. Set it to 0 if not setting any service info
pArgs->svcAttrlds NA: not applicable
pArgs->services[y].svcId In: service id of the service that set applies to
pArgs->services[y].attrs In: analogous to pArgs->attrs.
msgAddrBookAdd
Adds the specified entry and service data.
Takes P_ADDR_BOOK_ENTRY, returns STATUS.
tdefine msgAddrBookAdd MakeMsg(clsAddressBook, 3)
Messoge typedef struct ADDR_BOOK_ENTRY
ArguMents OS HEAP ID heap; /1 where should the address
II book alloc necessary space
II applicable only for
II msgAddrBookGet and
II msgAddrBookSearch
ADDR BOOK ENTRY TYPE type;
- -
ADDR BOOK KEY
- key;
U16 - - numAttrs;
P ADDR BOOK ATTR attrs;
U16 - - numServices; II Read only,abIndividual only
P- ADDR- BOOK- SERVICE services; II abIndividual only
ADDR~OOK_SERVICE_QUAL svcQual; II service qualifier, for Get
ADDR_BOOK_ENTRY, *P_ADDR_BOOK_ENTRY;
Parameters:
pArgs->key In: If the msg is used to add a service addr then the client specifies the entry key of the
entry to which we add the service address. Out: if the msg is used to add an entry, then address
book fill this field wI the key of the entry just added
pArgs->numAttrs In: how many attributes in the entry to have specified initial values.
pArgs->attr[x].id In: which attributes to add. To add,a brand new individual entry, then at least
AddrBookGivenNameld or AddrBookSurNameld need tobe specified. To add a group entry,
AddrBookGroupNameld needs to be specified.
pArgs->attr[x]. type NA: don't need to specify
pArgs->attr[x] .1ength In: mandatory if attribute type is abOther
pArgs->attr[x] .value In: attribute value. see previous table on attribute value-attribute length.
pArgs->numServices In: number of services to set. Set it to 0 if not adding any service info
pArgs->svcAttrIds NA: not applicable
- --------._---_._.---- --------_.
358 PENPOINT API REFERENCE
Part 10 I Connectivity
msgAddrBookDelete
Deletes the specified entry and service data.
Takes P _AD DR_BOO K_ENTRY, returns SfATUS.
#define msgAddrBookDelete MakeMsg(clsAddressBook, 4)
Messoge typedef struct ADDR_BOOK_ENTRY
Arguments OS HEAP ID heap; II where should the address
II book alloc necessary space
II applicable only for
II msgAddrBookGet and
II msgAddrBookSearch
ADDR BOOK ENTRY TYPE type;
- -
ADDR BOOK KEY
- key;
U16 numAttrs;
P- ADDR- BOOK- ATTR attrsi
U16 numServices; II Read ohly,ablndividual only
P_ADDR_BOOK_SERVICE services; II ablndividual only
ADDR_BOOK_SERVICE_QUAL svcQual; II service qualifier, for Get
ADDR_BOOK_ENTRY, *P_ADDR_BOOK_ENTRY;
Parameters:
pArgs->key In: entry id of the entry to be deleted. If deleting a service, then this field still needs to be
specified. Only the specified service is deleted.
pArgs->numServices In: number of services to delete. Set it to 9if deleting the entire entry.
pArgs->services[xJ.svcId In Id's of the services to be deleted
All other fields in ADDR_BOOK_ENTRY structure are not applicable.
msgAddrBookSearch
Searches for the entry that matches the search spec.
Takes P_ADDR_BOOK_SEARCH, returns SfATUS.
#define msgAddrBookSearch MakeMsg(clsAddressBook, 5)
Enum16 (ADDR_BOOK_SEARCH_TYPE)
abSearchlndividuals 0, II Enumerate address book entries
abSearchGroups 1, II Enumerate groups
abSearchAII 2, II ERumerate all entries
};
Enum16 (ADDR_BOOK_SEARCH_DIR) {'
abEnumNext 0, II Search forward
abEnumPrevious = 1 II Search backwards
};
Enum16 (ADDR_BOOK_ATTR_OPS)
abAnd 0,
abOr =1
};
ADDRBOOK.H 359
Messages
Enum16 (ADDR_BOOK_VALUE_OPS)
abEqual = 0,
abNotEqual = 1,
abGreater = 2,
abLess 3,
abGreaterEqual = 4,
abLessEqual = 5,
abMatchBeginning = 6, II string matching
abMatchEnd = 7, II string matching
abMatchPartial = 8, II string matching
abMaxValue = abMatchPartial
};
If a client wants to specify a query that says "match an entry whose last name is "Smith" and whose zip
code is "94024", then the .query field in pArgs for msgAddrBookSearch would have 2 elements:
pArgsquery id length value valueOp attrOp
msgAddrBookGetServiceDesc
Gets the service address description from the address book.
Takes P_ADDR_BOOK_SERVICES, returns STATUS.
#define msgAddrBookGetServiceDesc MakeMsg(clsAddressBook, 9)
#define abServiceDescFields \
CHAR name [nameBufLength]; \
U16 maxPerEntry; \
U16 numAttrs; \
P- ADDR- BOOK- ATTR- DESC attrs; \
typedef struct ADDR_BOOK_SVC_DESC {
abServiceDescFields
} ADDR_BOOK_SVC_DESC, *P_ADDR_BOOK_SVC_DESC;
typedef struct ADDR_BOOK_SERVICES {
OS_HEAP_ID heap;
U16 numServices;
P_ADDR_BOOK_SVC_DESC services;
ADDR_BOOK_SERVICES, *P_ADDR_BOOK_SERVICES;
Parameters:
pArgs->numServices Out: number of installed services an array of ADDR_BOOK_SVC_DESC's is
allocated and should be freed by the caller.
stsOK
msgAddrBookEnumGroupMembers
Enumerates through the members in a group.
Takes P_ADDR_BOOK_ENUM_GROUP_MEMBER, returns STATUS.
#define msgAddrBookEnumGroupMembers MakeMsg(clsAddressBook, 6)
typedef struct ADDR_BOOK_ENUM_GROUP_MEMBER
ADDR_BOOK_KEY groupKey;
ADDR BOOK KEY startKey;
BOOLEAN recurse;
ADDR_BOOK_ATTR_ID sort;
U32 count;
P_ADDR_BOOK_KEY pKeys;
ADDR_BOOK_ENUM_GROUP_MEMBER, *P_ADDR_BOOK_ENUM_GROUP_MEMBER;
Parameters:
pArgs->groupKey In: key of the group
pArgs->startKey In: where to start the group enumeration. Use pNull to start from the beginning.
Out:last entry key returned in pArgs->pKeys. Client usually uses the out value to be the next in
value of the next msgAddrBookEnumGroupMembers call.
pArgs->recurse In: whether to recursively enumerate groups
ADDRBOOK.H 361
Messages
msgAddrBookIsAMemberOf
Determines if an entry is a member of a group.
Takes P_ADDR_BOOK_IS_A_MEMBER_OF, returns STATUS.
#define msgAddrBookIsAMemberOf MakeMsg(clsAddressBook, 7)
typedef struct ADDR_BOOK~IS_A_MEMBER_OF
ADDR_BOOK_KEY groupKey;
ADDR BOOK KEY memberKey;
BOOLEAN recurse;
ADDR_BOOK_IS_A_MEMBER_OF, *P_ADDR_BOOK_IS_A_MEMBER_OF;
Parameters:
pArgs->groupKey In: key of the group
pArgs->memberKey In: potential member's key
pArgs->recurse In: whether to recursively test for membership
stsOK if pArgs->memberKey is a member of pArgs->groupKey.
stsNoMatch if pArgs->memberKey is not a member of pArgs->groupKey
msgAddrBookGetMetrics
Passes back the metrics for the address book.
Takes P _ADDR_BOOK_METRICS, returns STATUS.
#define msgAddrBookGetMetrics MakeMsg(clsAddressBook, 8)
typedef struct ADDR BOOK METRICS {
U32 nUmEntries; II Total number of entries
U32 numGroups; II Number of groups in the address book
U16 numServices; II Number of known services
U32 spare1;
U32 spare2;
ADDR_BOOK_METRICS, *P_ADDR_BOOK_METRICS;
msgAddrBookAddAttr
Adds a new attribute to active address books.
Takes P _ADDR_BOOK_ATTR, returns STATUS.
#define msgAddrBookAddAttr MakeMsg(clsAddressBook, 12)
Me$$~ge typedef struct ADDR_BOOK_ATTR
Arguments ADDR_BOOK_ATTR_ID id;
ADDR_BOOK_ATTR_TYPE type;
ADDR_BOOK_ATTR_LENGTH length; II length of value, in bytes
ADDR_BOOK_ATTR_VALUE value;
ADDR_BOOK_ATTR_LABEL label; II for display purpose
ADDR_BOOK_ATTR, *P_ADDR_BOOK~TTR;
362 PENPOINT API REFERENCE
Part 10 / Connectivity
This operation will change the address book database schema. If the attribute is of type abNumber, the
value is initialized to be 0 for all existing address book entries. If the attribute is of type
abPhoneNumber, then the value is intialized to be o. If the attribute is of type abString or abOther, the
value is initialized to be 0 length byte array.
After an attribute is added to an address book, clients can then set the attribute value in subsequent
msgAddrBookSet's and get the attribute value in the subsequent msgAddrBookGet's. Failure to first
make an attribute known to an address book and then try to set or get the attribute value will cause
stsAddrBookInvaIidAttr to be returned.
Parameters:
pArgs->id In: the id(should be a tag) of the new attribute. It has to be different from all other attribute
ids in the same address book.
pArgs->type In: one of abNumber, abString, abOther, abPhoneNumber
pArgs->label In: a string, for display purpose. The address book will copy the string to its own storage.
stsRequestNotSupported if the address book does not allow dynamically changing its database schema.
stsAddrBookDuplicateAttrld There is another attribute in the address book wi the same id.
msgAddrBookCount
Finds the number of entries that match the search spec
Takes p_ADDR_BOO~COUNT, returns STATUS.
fdefine msgAddrBookCount MakeMsg(clsAddressBook, 13)
typedef struct ADDR_BOOK_COUNT
ADDR BOOK KEY key;
ADDR_BOOK_ATTR_ID sort;
ADDR_BOOK_SEARCH_DIR dir;
ADDR BOOK QUERY query;
U16 - - count;
ADDR_BOOK_COUNT, *P_ADDR_BOOK_COUNT;
Comments Parameters:
pArgs->key In where to stop counting, AddrBookAlI to count the entire database
pArgs->dir In whether to start counting from the beginning or the end of the address book.
pArgs->query In qualifier. See msgAddrBookSearch
Observer Messages
msgAddrBookEntryChanged
Sent to observers when an entry has been changed, added or deleted.
Takes P_ADDR_BOOK_ENTRY_CHANGE, returns STATUS.
fdefine msgAddrBookEntryChanged MakeMsg(clsAddressBook, 11)
ADDRBOOK.H 363
Observer Messages
Messages
msgNBPRegister
Registers a name with the network.
Takes P _NBP_REGISTER, returns STATUS.
#define msgNBPRegister MakeMsg( clsATP, 1 )
typedef struct NBP_REGISTER {
P NBP NAME pName; II name to register
} NBP_REGISTER, * P_NBP_REGISTER;
msgNBPRemove
Removes a previously registered name from the network.
Takes P _NBP_REMOVE, returns STATUS.
#define msgNBPRemove MakeMsg( clsATP, 2 )
typedef struct NBP REMOVE
P NBP NAME pName; II name to remove
} NBP _REMOVE, * P_ NBP _REMOVE;
msgNBPLookup
Looks up names registered with the network.
Takes P_NBP_LOOKUP, returns STATUS.
#define msgNBPLookup MakeMsg( clsATP, 3 )
typedef struct NBP LOOKUP
P NBP NAME pNamei II name spec to lookup
P TP BUFFER pBuffer; II ptr to buffer containing names found
U16 length; II size of buffer in bytes
U16 nurnMatchesi II In-Out: number of names wanted/found
NBP_LOOKUP, * P NBP_LOOKUPi
msgNBPConfirm
Confirms the network address of a registered name.
Takes P _NBP_CONFIRM, returns STATUS.
#define msgNBPConfirm MakeMsg( clsATP, 4
typedef struct NBP CONFIRM
P NBP NAME pNamei II name to confirm address of
P TP ADDRESS pAddressi II ptr to address of name
NBP_CONFIRM, * P_NBP_CONFIRMi
ATALK.H 367
Messages
msgZIPGetZoneList
Obtains a list of zone names.
Takes P_ZIP_GETZONES, returns STATUS.
#define msgZIPGetZoneList MakeMsg( clsATP, 6 )
typedef struct ZIP_GETZONES
P- ZONES- BUFFER pBufferi II ptr to buffer to contain zone names
U16 lengthi II size of buffer in bytes
U16 numZonesi II Out: number of zones found
ZIP_GETZONES, * P ZIP_GETZONESi
msgZIPGetMyZone
Obtains my zone name.
Takes P_ZIP _GETZONES, returns STATUS.
#define msgZIPGetMyZone MakeMsg( clsATP, 7 )
MesSi%9 0 typedef struct ZIP_GETZONES
Argurnents P ZONES BUFFER pBufferi II ptr to buffer to contain zone names
U16 length; II size of buffer in bytes
U16 numZonesi II Out: number of zones found
ZIP_GETZONES, * P ZIP_GETZONES;
msgATPRespPktSize
Sets the maximum size of ATP response packets.
Takes P_ATP _RESPPKTSIZE, returns STATUS.
#define msgATPRespPktSize MakeMsg( clsATP, 8
typedef struct ATP RESPPKTSIZE
U16 size; II max size of response packets in bytes
ATP_RESPPKTSIZE, * P_ATP_RESPPKTSIZEi
CNCTIONS.H
This file contains the API definition for the interface between the connections notebook and a generic
service.
The connections notebook is, effectively, an option sheet. Because of this implementation choice, it is
important to understand the option sheet protocol and messages, as defined in OPTION.H. The
terminology chosen herein reflects the close association between the connections notebook and an
option sheet.
The two default views that one gets, for disks and printers, in the connections notebook are each option
sheets added as cards of the connections notebook option sheet. Other sheets or windows can be added
to the connections notebook.
The connections notebook observes the well-known list theConnections. If an item is added to the list,
the connections notebook calls that item with msgConnectionsAddSheet, with the P_ARGS being the
main option sheet in the connections notebook. By using msgOptionAddCard to the object passed in
the aforementioned call, a service can add a sheet or just a single window to the connections notebook.
Once these items have been added, all responsibility for the user interface and functionality rests solely
on the service.
Network disks and printers, however, are handled differently. There are already predefined windows for
these two items. A network file-sharing system, for example, would add itself to the well-known list
theVolumeServices. The connections notebook, which observes this list, would send the object on the
list a msgConnectionsStartConversation and a msgConnectionsSetConnectionsApp to pass along the
application context of the connections notebook from this time.
If the network file-sharing service were to remove itself from theVolumeServices, the connections
notebook would send msgConnectionsEndConveration to the object.
The object on the list is expected to be able to respond to the various connections messages. If it has
specified that it provides a UI, it will be asked for its network view when appropriate.
#ifndef CNCTIONS_INCLUDED
#define CNCTIONS_INCLUDED
#ifndef INSTLMGR INCLUDED
#include <instlmgr.h>
#endif
Warnings
#define stsConnectionsAlreadyConnected MakeWarning(clsConnections, 1)
Statuses
#define stsConnectionsPasswordFailed MakeStatus(clsConnections, 1)
#define stsConnectionsServiceDeinstalling MakeStatus(clsConnections, 2)
#define stsConnectionsNotConnected MakeStatus(clsConnections, 3)
370 PEN POINT API REFERENCE
Part 10 / Connectivity
Typedefs
typedef struct CONNECTIONS MENU ITEM
P CHAR pName;
OBJECT netService;
P UNKNOWN netIdentifier;
U32 reserved[2];
CONNECTIONS MENU_ITEM, * P_CONNECTIONS_MENU_ITEM;
typedef struct CONNECTIONS ITEM {
struct CONNECTIONS ITEM *pNextConnectionsItem; /1 Next item
P UNKNOWN - pItemID; II Service defined identifer
- II for this item
TAG itemIconTag; I I Item's icon tag
TAG i temTag; I I Item tag
P CHAR name; I I Item name
P CHAR serverName; II Item's server's name
P CHAR location; II Item's location
P CHAR type; I I Item's type
BOOLEAN connected; I I Connected?
BOOLEAN autoConnect; II Auto-connect enabled?
BOOLEAN remember; II Remember (menu) enabled?
II fill in some more information here
P UNKNOWN itemSpecificData; II volume or printer stuff
U32 filler [4] ; I I reserved
CONNECTIONS_ITEM, * P_CONNECTIONS_ITEM, * * PP_CONNECTIONS_ITEM;
Messages
msgConnectionsSetState:
Sets the specified states in the service.
Takes P_CONNECTIONS_STATE, returns STATUS.
Enuml6 ( CONNECTIONS_CONNECT_STATE ) {
cnctManualConnections, II Connect only when asked to
cnctAutoConnections, II Connect auto-connect items
cnctPromiscuousConnections II Connect to everything
};
Enuml6 ( CONNECTIONS WARNINGS )
cnctWarningNone - 0, II No warnings
cnctWarningPermissionsFailure flagO, liOn permissions failure
cnctWarningOnConnection flagl, liOn connection
cnctWarningOnUnconnection flag2 liOn loss of connection
};
Enuml6 ( CONNECTIONS_PASSWORDS ) {
cnctPasswordNone 0, II Do not save passwords
cnctPasswordServer flagO, II Save server passwords
cnctPasswordItem flagl, II Save item passwords
cnctPasswordServerAndItem flag2 II Save server and item
II passwords
};
Enuml6 ( CONNECTIONS PERMISSIONS ) {
cnctPermissionsReadWrite, II Connect Read/Write
cnctPermissionsReadOnly II Connect Read only
};
typedef struct CONNECTIONS_STATE
BOOLEAN attached; II Attached
CONNECT IONS_CONNECT_STATE connectMores; II How to attach
CONNECTIONS WARNINGS connectWarning; II Level of warnings
CONNECTIONS PASSWORDS connectPasswords; II What passwords
CONNECTIONS PERMISSIONS connectPermissions; II What permissions
U32 - reserved [4] ;
CONNECTIONS_STATE, * P_CONNECTIONS_STATE;
fdefine msgConnectionsSetState MakeMsg ( clsConnections, 1 )
CNCTIONS.H 371
Common #defines and typedefs
msgConnectionsGetState:
Gets the specified states in the service.
Takes P _CONNECTIONS_STATE, returns STATUS.
#define msgConnectionsGetState MakeMsg clsConnections, 2 )
MCSS(l9 C typedef struct CONNECTIONS_STATE
J\'r'£julTlenfs BOOLEAN attached; II Attached
CONNECTIONS CONNECT STATE connectMoresi II How to attach
CONNECTIONS WARNINGS connectWarning; 1.1 Level of warnings
CONNECTIONS PASSWORDS connectPasswords; II What passwords
CONNECTIONS PERMISSIONS connectPermissions; II What permissions
U32 reserved[4];
CONNECTIONS_STATE, * P_CONNECTIONS_STATE; ~
:;
;:::
~
msgConnectionsEnumerateltems:
Gets a list of the network items, per restrictions.
Takes P_CONNECTIONS_ENUMERATE, returns STATUS.
#define cnctAttribMatchLocation flagO II Match on location
#define cnctAttribMatchServer flag1 II Match on server
#define cnctAttribMatchConnect flag2 II Match on connected state
#define cnctAttribMatchAutoConnect flag3 II Match on auto-connect state
#define cnctAttribMatchMenu flag4 II Match on menu
II (remember) state
typedef struct ATTRIB {
U32 flags; II
various meanings -- complete match
II
match at beginning, match at end
II
connected, auto connect, remember
P CHAR restrictNamei II
match this string
17 other possible characteristics -- type, characteristics, etc.
P UNKNOWN matchID; II restrict enumeration to this file
II server
TAG tag; II Tag to match against
ATTRIB, * P_ATTRIB;
#define cnctFlagLocationsOnly flagO II Look only at locations
#define cnctFlagServersOnly flag1 II Look only at servers
#define cnctFlagOKFreeCIFields flag14 II Free the CI fields
#define cnctFlagOKFreeCI flag15 II Free the CI
typedef struct CONNECTIONS_ENUMERATE {
ATTRIB attributes;
U16 count; II in # of entries to return in list.
II out # of valid entries in list.
U16 nexti II in 0 to start at beginning
II OR previous out value to pick up
II where we left off.
P CONNECTIONS ITEM pEntrYi II in = pNull.
II out Link list of connections items.
U16 flags; II in = state flags to filter on.
II out = free state
CONNECTIONS_ENUMERATE, * P_CONNECTIONS_ENUMERATEi
#define msgConnectionsEnumerateItems MakeMsg ( clsConnections, 3 )
msgConnectionsEnumerateServers:
Gets a list of the network servers, per restrictions.
Takes P_CONNECTIONS_ENUMERATE, returns STATUS.
#define msgConnectionsEnumerateServers MakeMsg ( clsConnections, 4 )
372 PENPOINT API REFERENCE
Part 10 / Connectivity
msgConnectionsEnumerateTags:
Gets a list of the known tags, per restrictions.
Takes P_CONNECTIONS_ENUMERATE, returns STATUS.
typedef struct CONNECTIONS_TAG {
TAG tag;
} CONNECTIONS_TAG, * P_CONNECTIONS_TAG;
#define msgConnectionsEnumerateTags MakeMsg ( clsConnections, 5 )
MessGge typedef struct CONNECTIONS ENUMERATE
Arguments ATTRIB attributes;
U16 count; II in # of entries to return in list.
II out # of valid entries in list.
U16 next; II in 0 to start at beginning
II OR previous out value to pick up
II where we left off.
P_CONNECTIONS_ITEM pEntry; II in = pNull.
II out = Link list of connections items.
U16 flags; II in = state flags to filter on.
II out = free state
CONNECTIONS_ENUMERATE, * P_CONNECTIONS_ENUMERATE;
msgConnectionsGetNetworkView:
Each service is required to provide a window, which will be a client of a scrollwin, which will be set as
the current (active) window when the network view is invoked. This window will be able to make use of
msgConnections calls to manipulate attachments, et al.
Takes P_WIN, returns STATUS.
#define msgConnectionsGetNetworkView MakeMsg ( clsConnections, 6 )
msgConnectionsCompareltems:
Compares two pltemID values to see if they refer to the same item.
Takes P_CONNECTIONS_COMPARE, returns STATUS.
typedef struct CONNECTIONS COMPARE {
P UNKNOWN item1; II First item
P UNKNOWN i tem2 ; I I Second item
BOOLEAN same; II Out: Are they the same?
U32 forPublicUse; II if anyone needs this
CONNECTIONS COMPARE, * P CONNECTIONS_COMPARE;
#define msgConnectionsCompareItems MakeMsg ( clsConnections, 10 )
CNCTIONS.H 373
Common #defines and typedefs
msgConnectionsTagltem:
Tags the indicated item.
Takes P_CONNECTIONS_TAG_ITEM, returns STATUS.
typedef struct CONNECTIONS TAG ITEM
TAG tag; II Tag to set
U32 flags; II Type
P UNKNOWN netAddress; II Item's address
U32 userInformation;
CONNECTIONS TAG ITEM, * P_CONNECTIONS_TAG ITEM;
*define msgConnectionsTagItem MakeMsg ( clsConnections, 11 )
msgConnectionsGetServicelnfo:
Gets the service name and other information.
Takes P_CONNECTIONS_SERVICE_INFO, returns STATUS.
typedef struct CONNECTIONS_SERVICE_INFO {
CHAR serviceName[nameBufLength]; II Service name
U16 reserved: 15,
uiProvided:l; II User interface provided
U32 filler[2];
CONNECTIONS_SERVICE_INFO, * P_CONNECTIONS_SERVICE_INFO;
#define msgConnectionsGetServiceInfo MakeMsg ( clsConnections, 12 )
msgConnectionsGedtemlnfo:
Gets information for the specified item, specific to the service.
Takes P_UNKNOWN, returns STATUS.
#define msgConnectionsGetItemInfo MakeMsg ( clsConnections, 13 )
msgConnectionsSetConnectionsApp:
Passes the connections notebook app object to the service.
Takes OBJECT, returns STATUS.
*define msgConnectionsSetConnectionsApp MakeMsg ( clsConnections, 14 )
msgConnectionsUpdate:
Requests an update of the current network state.
Takes nothing, returns STATUS.
#define msgConnectionsUpdate MakeMsg ( clsConnections, 15 )
msgConnectionsExpandCollapse:
Requests an expand/collapse (depending on the argument) of the current view of the network.
Takes BOOLEAN, returns STATUS.
#define msgConnectionsExpandCollapse MakeMsg ( clsCo~nections, 16 )
374 PEN POINT API REFERENCE
Part 10 I Connectivity
msgConnectionsConnecdtem:
Connect the specified item.
Takes P_CONNECTIONS_REQUEST, returns STATUS.
typedef struct CONNECTIONS_REQUEST
P UNKNOWN pItemID; II Item to connect
U32 response;
CONNECTIONS_REQUEST, * P_CONNECTIONS_REQUEST;
#define msgConnectionsConnectItem MakeMsg ( clsConnections, 17 )
msgConnectionsUnconnectItem:
Unconnect the specified item.
Takes P_CONNECTIONS_REQUEST, returns STATUS.
#define msgConnectionsUnconnectItem MakeMsg ( clsConnections, 18 )
MesSf1ge typedef struct CONNECTIONS_REQUEST
Arguments P UNKNOWN pItemID; II Item to connect
U32 response;
CONNECTIONS_REQUEST, * P_CONNECTIONS_REQUEST;
msgConnectionsRememberItem:
Remember the specified item.
Takes P_CONNECTIONS_REQUEST, returns STATUS.
#define msgConnectionsRememberItem MakeMsg ( clsConnections, 19 )
MeS.$og10 typedef struct CONNECTIONS_REQUEST
Ar~1u!l1ents P UNKNOWN pItemID; II Item to connect
U32 response;
CONNECTIONS_REQUEST, * P_CONNECTIONS_REQUEST;
msgConnectionsForgetItem:
Forget the specified item.
Takes P_CONNECTIONS_REQUEST, returns STATUS.
#define msgConnectionsForgetItem MakeMsg ( clsConnections, 20 )
;\"css©gtJ typedef struct CONNECTIONS_REQUEST
A1l!umen¥s P UNKNOWN pItemID; II Item to connect
U32 response;
CONNECTIONS_REQUEST, * P_CONNECTIONS_REQUEST;
msgConnectionsAutoConnecdtem:
Sets the auto connect state on for the specified item.
Takes P_CONNECTIONS_REQUEST, returns STATUS.
#define msgConnectionsAutoConnectItem MakeMsg ( clsConnections, 21 )
Messf1ge typedef struct CONNECTIONS_REQUEST
Avguments P UNKNOWN pItemID; II Item to connect
U32 response;
CONNECTIONS_REQUEST, * P_CONNECTIONS_REQUEST;
CNCTIONS.H 375
Common #defines and typedefs
msgConnectionsUnAutoConnecdtem:
Sets the auto connect state off for the specified item.
Takes P_CONNECTIONS_REQUEST, returns STATUS.
#define msgConnectionsUnAutoConnectItem MakeMsg ( clsConnections, 22 )
Mcs.$!$}jf' typedef struct CONNECTIONS_REQUEST
Arg;,gncnts P UNKNOWN pItemIDj II Item to connect
U32 response;
CONNECTIONS_REQUEST, * P_CONNECTIONS_REQUEST;
msgConnectionsAddSheet:
Permits items on the connections to add items to the contents.
Takes OBJECT, returns STATUS.
#define msgConnectionsAddSheet MakeMsg ( clsConnections, 23 )
msgConnectionsAddCards:
Sent to network views, when they are not the foremost view, to run the option protocol.
Takes P_OPTION_TAG, returns STATUS.
#define msgConnectionsAddCards MakeMsg ( clsConnections, 24 )
msgConnectionsSetSelection:
Sent by the connections notebook to the appropriate service, informing the service what the currently
selected item is.
Takes P_UNKNOWN, returns STATUS.
#define msgConnectionsSetSelection MakeMsg ( clsConnections, 25 )
msgConnectionsGeifopCard:
Sent by the connections notebook to the appropriate service, inquiring of that service what the
appropriate top card is to be.
Takes P_TAG, returns STATUS.
#define msgConnectionsGetTopCard MakeMsg ( clsConnections, 26 )
msgConnectionsStartConversation:
Sent by the Connections Notebook to the appropriate service, informing that service that the
Connections Notebook is planning on conversing with it. This message will be sent at first page turn
and at restore (of the Connections Notebook) time.
Takes nothing, returns STATUS.
#define msgConnectionsStartConversation MakeMsg ( clsConnections, 27 )
376 PENPOINT API REFERENCE
Part 10 / Connectivity
msgConnectionsEndConversation:
. Sent by the Connections Notebook to the appropriate service, informing that service that the
Connections Notebook is stopping conversing with it. This message will be sent at save (of the
Connections Notebook) time.
Takes nothing, returns SfATUS.
#define msgConnectionsEndConversation MakeMsg ( clsConnections, 28 )
msgConnectionsIsParent:
Compares two pltemID values to see if item 1 is a parent of item2.
Takes P_CONNECTIONS_COMPARE, returns SfATUS.
#define msgConnectionsIsParent MakeMsg ( clsConnections, 31 )
Mes$Uge typedef struct CONNECTIONS COMPARE {
Arguments P UNKNOWN item1;- II First item
P-UNKNOWN item2; II Second item
BOOLEAN same; II Out: Are they the same?
U32 forPublicUse; II if anyone needs this
CONNECTIONS_COMPARE, * P_CONNECTIONS_COMPARE;
Notification Messages
msgConnectionsConnectedChanged:
Sent by the appropriate service, indicating when an item has been connected to or unconnected from.
Takes P_CONNECTIONS_NOTIFY, returns STATUS.
#define msgConnectionsConnectedChanged MakeMsg ( clsConnections, 7 )
typedef struct CONNECTIONS NOTIFY
OBJECT manager; II manager that sent notification
IM HANDLE handle; II handle to service
OBJECT service; II service that sent notification
P UNKNOWN pItemID; II pointer to affected item
U16 reserved: 13,
server: 1, II Unused
uiProvided:1, II Unused
state:1; II connected or unconnected
U16 notifyLength; II Length of notify info which follows
CONNECTIONS_NOTIFY, * P_CONNECTIONS_NOTIFY;
msgConnectionsAutoConnectChanged:
Sent by the appropriate service, indicating when an item has had the auto connect state set or turned off
for it.
Takes P_CONNECTIONS_NOTIFY, returns STATUS.
#define msgConnectionsAutoConnectChanged MakeMsg ( clsConnections, 8 )
Mes$@ge typedef struct CONNECTIONS_NOTIFY
Arguments OBJECT manager; II manager that sent notification
IM HANDLE handle; II handle to service
OBJECT service; II service that sent notification
P UNKNOWN pItemID; II pointer to affected item
U16 reserved: 13,
server:1, II Unused
uiProvided:1, II Unused
state:1; II connected or unconnected
U16 notifyLength; II Length of notify info which follows
CONNECTIONS_NOTIFY, * P_CONNECTIONS_NOTIFY;
CNCTIONS.H 377
Common #defines and typedefs
msgConnectionsRememberChanged:
Sent by the appropriate service, indicating when an item has had the remember state set or turned off
for it.
Takes P_CONNECTIONS_NOTIFY, returns STATUS.
#define msgConnectionsRememberChanged MakeMsg ( clsConnections, 9 )
Message typedef struct CONNECTIONS NOTIFY
Arguments OBJECT manager; /1 manager that sent notification
1M HANDLE handle; II handle to service
OBJECT service; II service that sent notification
P UNKNOWN pItemID; II pointer to affected item
U16 reserved: 13,
server: 1, II Unused
uiProvided:1, II Unused
state:1; II connected or unconnected
U16 notifyLength; II Length of notify info which follows
CONNECTIONS_NOTIFY, * P_CONNECTIONS_NOTIFY;
msgConnectionsltemChanged:
Sent by the appropriate service, indicating when an item has been noticed or lost.
Takes P_CONNECTIONS_NOTIFY, returns STATUS.
#define msgConnectionsItemChanged MakeMsg ( clsConnections, 30 )
tv'\ess(tge typedef struct CONNECTIONS NOTIFY
A,guments OBJECT manager; II manager that sent notification
1M HANDLE handle; II handle to service
OBJECT servicei II service that sent notification
P UNKNOWN pItemIDi II pointer to affected item
U16 reserved: 13,
server: 1, II Unused
uiProvided:1, II Unused
state:1; II connected or unconnected
U16 notifyLength; II Length of notify info which follows
CONNECTIONS_NOTIFY, * P_CONNECTIONS_NOTIFY;
msgConnectionsServiceChanged:
Sent by the appropriate service, indicating when it is available for use or unavailable.
Takes P_CONNECTIONS_NOTIFY, returns STATUS.
#define msgConnectionsServiceChanged MakeMsg ( clsConnections, 32
Messdge typedef struct CONNECTIONS NOTIFY
A,guments OBJECT manager; II manager that sent notification
1M HANDLE handle; II handle to service
OBJECT service; II service that sent notification
P UNKNOWN pItemID; II pointer to affected item
U16 reserved: 13,
server:1, II Unused
uiProvided:1, II Unused
state:1; II connected or unconnected
U16 notifyLength; II Length of notify info which follows
CONNECTIONS_NOTIFY, * P_CONNECTIONS_NOTIFYi
~--~-----.-.-,- ..,--.-,-
\ \
DIALENV.H
This file contains the API for clsDialEnv, clsDialEnvOptCard, and clsDialEnvField.
clsDialEnv inherits from clsService.
clsDialEnv maintains telephone dialing related information pertinent to a specific geographic
location/ environment.
The intent of clsDialEnv is to relieve client data communication programs of having to replicate the
code for maintaining their own seperate telephone dialing-related data and logic. clsDialEnv is designed
to provide the "intelligence" and data needed for dialing fromlto a variety of environments (to/from
local in-house to/from international).
OBJECT handleCurrentLoc,
theCurrentLocation;
SM_QUERY_LOCK lock;
SM_QUERY_UNLOCK unlock;
DlALENV_COUNTRY country;
lM_GET SET_NAME getName;
CHAR 10cationName[nameBufLength];
II
II Get the handle and UlD of the current location.
II Lock the current location to guarantee exclusive access to
II location data.
II Get the country code for the current location (from the dialing
II environment for the current location).
II Unlock the current location so that other clients may access it.
II Get the name of the current location.
II
ObjCaIIJmp(msglMGetCurrent, theLocations, &handleCurrentLoc, s, Problem);
lock.handle = unlock. handle = handleCurrentLoc;
380 PENPOINT API REFERENCE
Part 10 / Connectivity
For PenPoint 1.0 an application or service requiring dialing environment services should install the
dialing environment dll via a SERVICE.INI file.
**** Future Direction Ideas ****
In a future release of PenPoint, dialing environments will be subsumed by a location service. The
location service will manage all of the objects which provide location-dependent behavior to the
PenPoint environment/applications. Current plans are for the user to access location services via the
configuration notebook. Because dialing environments will be a constituent of a location service it won't
be necessary for a dialing environment to be included by an application's or service's SERVICE.INI file.
The location service will maintain the list of locations the user has created (GO may ship pre-configured
locations; however a user will be able to create and modify locations). A user will select a location by
name, and all of the unique properties regarding that location will take effect.
For each location there may be a dialing environment. Thus, whenever the user selects a new location, a
different dialing environment may take effect (it is possible that two different locations will share the
same dialing environment, or that a location doesn't have a dialing environment). When a user creates a
new location, the user will be given the opportunity to specify a dialing environment for the new
location, or to select one of the currently available dialing environments and bind it to the new location.
The dialing environment will be enhanced to provide clients with information regarding valid city/area
codes and dialing rules for specific countries. This information can be presented to the user for VI
pick-lists, used to coerce input to only valid combinations of codes, and to enforce the rules which
national telephone systems impose on computer software which interacts with the public telephone
system.
**** End of Future Direction Ideas ****
clsDialEnvOptCard provides a default behavior of observing the dialing environment and refreshing
dialing environment option cards when the dialing environment changes. A client needn't provide any
special code support to have such option cards track dialing environment changes. Note: A client
shouldn't insert a dialing environment option card into an option sheet or any window tree with a
modal filter (e.g. option sheet with a style modality set to either osModalApp or osModalSy~tem)~
The following block of code provides one example of creating a dialing environment option card.
II
II Create an option card for dialing environment settings.
II
STATUS s;
D1ALENV OPTCARD NEW don;
OBJECT handleCurrentLoc;
1M GET SET NAME getNamei
CHAR locationName[nameBufLength];
DIALENV.H 381
II
II Get the handle and name of the current location. Create
II a dialing environment option card for the current location.
II
ObjCallRet(msgIMGetCurrent, theLocations, &handleCurrentLoc, S)i
getName.handle = handleCurrentLoci
getName.pName = locationNamei
ObjCallRet(msgIMGetName, theLocations, &getName, S)i
ObjCallRet(msgNewDefaults, clsDialEnvOptCard, &don, S)i
don. win. tag = tagDialEnvOptionCard;
strcpy(don.dialenvOptCard.dialEnv.name, locationName);
ObjCallRet(msgNew, clsDialEnvOptCard, &don, S)i
clsDialEnvField alters the a default behavior of ancestor clsField by specifying a character list template
for coercing its field input.
Defined within this header file.
• defines and typedefs for dial environment data. function prototypes. messages & status values.
#ifndef DIALENV INCLUDED
#define DIALENV INCLUDED
#ifndef GO INCLUDED
#include <go.h>
#endif
#ifndef CLSMGR_INCLUDED
#include <clsmgr.h>
#endif
#ifndef SERVICE INCLUDED
#include <service.h>
#endif
#ifndef CLAYOUT INCLUDED
#include <clayout.h>
#endif
#ifndef FIELD INCLUDED
#include <field.h>
#endif
rr Message definitions
NOTE msg #1 is reserved for private use.
msgDialEnvChanged
Notification sent to observers to indicate a dialing environment change.
Takes OBJECT, returns STATUS. Category: observer notification.
tdefine msgDialEnvChanged MakeMsg(clsDialEnv, 2)
DIALENV.H 383
Action Messages
Comments The pArgs indicates the object which initiated the change to the dialing environment. pArgs of objN ull
indicates that the dialing environment is being destroyed.
Observers which receive this message should refresh any local dialing environment information or view
of such information.
Error Return Values: N/A.
Action Messages
msgDialEnvGetCountry
Passes back the country code from the current dialing environment.
Takes P_DIALENV_COUNTRY, returns STATUS. Category: service action request.
#define msgDialEnvGetCountry MakeMsg(clsDialEnv, 3)
typedef struct DIALENV_COUNTRY
{
CHAR symbols[lenDialEnvCountry+l];
DIALENV_COUNTRY, *P_DIALENV_COUNTRY;
Comments Error Return Values: none, always returns stsOK
msgDialEnvIsCountryNorthAmerican
Indicates whether or not the specified country code is North American.
Takes P _DIALENV_COUNTRY, returns STATUS. Category: service action request.
#define msgDialEnvIsCountryNorthAmerican MakeMsg(clsDialEnv, 6)
Mcss£tgc typedef struct DIALENV_COUNTRY
Arguments {
CHAR symbols[lenDialEnvCountry+l];
DIALENV_COUNTRY, *P_DIALENV_COUNTRY;
NOTES: This message is provided so a client may alter its UI and/or enforce editing rules unique to
North American phone numbers.
Returns stsOK if the specified country is North American, otherwise stsDialEnvNoMatch.
msgDialEnvGetEnvironment
Passes back the current dialing environment settings.
Takes P_DIALENV_ENVIRONMENT, returns STATUS. Category: service action request.
#define msgDialEnvGetEnvironment MakeMsg(clsDialEnv, 4)
typedef TAG DIALENV DIAL MODE;
#define deTone tagDialEnvDialTone II Touch tone dialing.
#define dePulse tagDialEnvDialPulse II Pulse code dialing.
typedef struct DIALENV_OUTSIDE_LINE
{
CHAR symbols[lenDialEnvOutsideLine+l];
DIALENV_OUTSIDE_LINE, *P_DIALENV_OUTSIDE_LINE;
typedef struct DIALENV_AREA_CITY
{
CHAR symbols[lenDialEnvAreaCity+l];
DIALENV_AREA_CITY, *P_DIALENV_AREA_CITY, **PP_DIALENV_AREA_CITY;
384 PENPOINT API REFERENCE
Part 10 I Connectivity
Symbols prefixed to a dialing string to gainaccess to the general switched telephone network.
msgDialEnvBuildDialString
Construct a dial string based upon the current dialing environment.
Takes P_DIALENV_BUILD_DIALSTR, returns STATUS. Category: service action request.
#define msgDialEnvBuildDialString MakeMsg(clsDiaIEnv, 5)
typedef struct DIALENV_TELEPHONE_NUMBER
{
CHAR country[lenDiaIEnvCountry+l]; II Cntry call originates from.
CHAR areaCity[lenDiaIEnvAreaCity+l]; II Area/City call origs from.
CHAR teleNumber[lenDiaIEnvTeleNumber+l]; II Destination telephone t.
CHAR postConnect[lenDiaIEnvPostConnect+l];IIPost connect destination
II network navigation code.
DIALENV_TELEPHONE_NUMBER, *P_DIALENV_TELEPHONE_NUMBER;
The resultant string of symbols a dialer sends to either clsModem,the phone network, or another server
which performs the dialing.
typedef struct DIALENV_DIAL_STRING
{
CHAR symbols[lenDiaIEnvDiaIString+l];
DIALENV_DIAL_STRING, *P_DIALENV_DIAL_STRING;
DIALENV.H 385
Class Messages
Class Messages
msgNew
Creates an instance of a dialing environment.
Takes P_DIALENV_NEW, returns STATUS. Category: class message.
typedef DIALENV_ENVIRONMENT DIALENV_NEW_ONLY, *P_DIALENV_NEW_ONLY;
#define dialenvNewFields \
serviceNewFields \
DIALENV NEW ONLY dialEnv;
typedef struct DIALENV NEW
{
dialenvNewFields
DIALENV_NEW, *P_DIALENV_NEW;
Error Return Values: percolated up from other classes, none from clsDialEnv.
msgNewDefaults
Initializes the DIALENV_NEW structure to default values.
Takes P_DIALENV_NEW, returns STATUS. Category: class message.
Mes$(;i~e typedef struct DIALENV_NEW
Awgwments {
dialenvNewFields
DIALENV_NEW, *P_DIALENV_NEW;
(©mmetlfS Sets:
pArgs->svc.style.waitForTarget
pArgs->svc.style.exclusiveOpen
pArgs->svc.style.autoOwnTarget
pArgs->svc.style.autoOpen
pArgs->svc.style.autoMsgPass
pArgs->svc.style.checkOwner false;
pArgs->svc.pManagerList = pManagerList; II theLocations
pArgs->svc.numManagers = 1;
memset(&(pArgs->dialEnv), 0, sizeof(pArgs->dialEnv»;
pArgs->dialEnv.dialMode = deTonei II Tone dialing.
II All remaining struct dialEnv
II fields are set to zero/null.
Error Return Values: percolated up from other classes, none from clsDialEnv.
386 PENPOINT API REFERENCE
Part 10 / Connectivity
msgDialEnvGetMacrolds
Passes back a string of symbols which identify dialing macro codes.
Takes P _DIALENV_MACRO_IDS, returns STATUS. Category: class message.
*define msgDialEnvGetMacrolds MakeMsg(clsDialEnv, 6)
typedef struct DIALENV_MACRO_IDS
{
CHAR symbols[numDialEnvMacroCodes+1];
DIALENV_MACRO_IDS, *P_DIALENV_MACRO_IDS;
Error return values: percolated up from other classes, none from clsDialEnv.
Action Messages
msgDialEnvOptCardRefresh
Refreshes a dialing environment option card (self) with the current dialing environment settings.
Takes nothing, returns STATUS. Category: action request.
*define msgDialEnvOptCardRefresh MakeMsg(clsDialEnvOptCard, 2)
A client should send msgDialEnvOptCardRefresh to a dialing environment option card when it
receives msgOptionRefreshCard and the card tag matches that assigned to.the dialing environment
option card.
Error Return Values: percolated up from other classes, none from dsDialEnv.
DIALENV.H 387
Class Messages
msgDialEnvOptCardApply
Updates the dialing environment with current settings from a dialing environment option card (self).
Takes nothing, returns STATUS. Category: action request.
#define msgDialEnvOptCardApply MakeMsg(clsDialEnvOptCard, 3)
Comments A client should send msgDialEnvOptCardApply to a dialing environment option card when it receives
msgOptionApplyCard and the card tag matches that assigned to the dialing environment option card.
Error Return Values: percolated up from other classes, none from clsDialEnv.
Class Messages
msgNew
Creates an instance of a dialing environment option card.
Takes P_DIALENV_OPTCARD_NEW, returns STATUS. Category: class message.
typedef struct LOCATION NAME
{
CHAR name [nameBuf Length]; II Name of a location.
LOCATION_NAME, *P_LOCATION_NAME;
II Name of a dialing environment.
typedef LOCATION_NAME DIALENV_NAME, *P_DIALENV_NAME;
typedef struct DIALENV_OPTCARD_NEW_ONLY
{
DIALENV NAME dialEnv; II
Name of DialEnv supplying info.
U32 sparel; II
unused (reserved).
U32 spare2; II
unused (reserved).
DIALENV_OPTCARD~EW_ONLY, *P_DIALENV_OPTCARD_NEW_ONLY;
#define dialenvOptCardNewFields \
customLayoutNewFields \
DIALENV_OPTCARD_NEW_ONLY dialenvOptCard;
typedef struct DIALENV_OPTCARD_NEW
{
dialenvOptCardNewFields
DIALENV_OPTCARD_NEW, *P_DIALENV_OPTCARD_NEW;
Comments A client may add the dialing environment option card to its stack of of option cards, and create it in
reponse to msgOptionProvideCard via this message. Clients may create multiple cards and insert them
into any window. The cards needn't be part of an option card stack.
NOTES: It is possible for one or more clients to create multiple dial environment option cards. Because
of this, dialing environment option cards observe the dialing environment. When the dialing
environment changes, all dialing environment cards get refreshed with current dialing environment
settings.
The requestor must fill in the pArgs->dialEnv with the name
of the location which will supply the option card with dialing
environment settings.
Error Return Values: percolated up from other classes, stsDialEnvOptCardBadEnvironment.
388 PEN POINT API REFERENCE
Part 10 I Connectivity
msgNewDefaults
Initializes the DIALENV_OPTCARD_NEW structure to default values.
Takes P_DIALENV_OPTCARD_NEW, returns STATUS. Category: class message.
Me$$@ge typedef struct DIALENV_OPTCARD_NEW
ArgsHl'lent$ {
dialenvOptCardNewFields
DIALENV_OPTCARD_NEW, *P_DIALENV_OPTCARD_NEW;
(cm,mefli'$ Sets:
memset(pArgs->dialenvOptCard.dialEnv.name, Nil(CHAR),
sizeof(pArgs->dialenvOptCard.dialEnv.name));
Message definitions
msgNew
Creates an instance of a dialing environment field.
Takes P_DIALENV_FIELD_NEW, returns STATUS. Category: class message.
fdefine dialenvFieldNewFields \
fieldNewFields
typedef struct DIALENV_FIELD_NEW.
{
dialenvFieldNewFields
DIALENV_FIELD_NEW, *P_DIALENV_FIELD_NEW;
clsDialEnvField logic within its msgInit method:
DIALENV_MACRO_IDS macroIds;
CHAR fieldCharList[20+numDialEnvMacroCodes+1];
XTM ARGS template;
P STRING fieldChars = "0123456789 () -, *f; !";
DIALENV.H 389
Class Messages
II
II If the client hasn't modified the default field template value,
II establish a template to coerce dialing environment field input.
II
II Query clsDialEnv to obtain the symbols identifying macro
II codes. Append them to base dialing type characters.
II
if (pArgs->field.xlate.pTemplate == pNul1 &&
pArgs->field.style.xlateType == fstXlateTemplate)
macroIds.symbols[O] = Nil(CHAR);
ObjCaIIWarn(msgDiaIEnvGetMacroIds, clsDialEnv, ¯oIds);
strcpy(fieldCharList, fieldChars);
strcat(fieldCharList, macroIds.symbols);
template.xtmType = xtmTypeCharList; II Char list type template.
template.xtmMode = xtmModeDefault; II No special template mode.
template.pXtmData = fieldCharList; II The character list.
pArgs->field.xlate.pTemplate = &template;
}
II Call our ancestor to create the object.
return ObjectCaIIAncestor(msg, self, pArgs, ctx);
Error Return Values: percolated up from other classes,
msgNewDefaults
Initializes the DlALENV_FIELD_NEW structure to default values.
Takes P_DlALENV_FIELD_NEW, returns STATUS. Category: class message.
Messoge typedef struct DIALENV_FIELD_NEW
Arguments {
dialenvFieldNewFields
DIALENV_FIELD_NEW, *P_DIALENV_FIELD_NEW;
Comments Sets:
II
II Establish defaults for an instance of clsDialEnvField.
II
pArgs->field.style.veto
pArgs->field. style. noSpace
pArgs->field.style.upperCase = true;
pArgs->field.style.xlateType fstXlateTemplate;
pArgs->field.xlate.pTemplate &template;
pArgs->label.style.numCols
pArgs->label.style.numRows IsNumAbsolute;
pArgs->label.cols 12;
pArgs->label.rows 1;
pArgs->border.style.edge = bsEdgeBottom;
pArgs->border.style.topMargin
pArgs->border.style.bottomMargin= bsMarginMedium;
pArgs->border.style.borderInk = bsInkGray66;
FLAP.H
msgNew
creates a new flap object.
Takes P_FLAP_NEW, returns STATUS.
*define flapNewFields \
milServiceNewFields \
typedef struct FLAP_NEW
flapNewFields
} FLAP_NEW, *P_FLAP_NEW;
STATUS EXPORTED ClsFLAPInit(void);
HSLINK.H
This file contains the definition and methods for clsALAPHighSpeed.
clsALAPHighSpeed inherits from clsLink (see link.h).
#ifndef HSLINK INCLUDED
#define HSLINK INCLUDED
#define alapHighSpeedNewFields serviceNewFields
typedef struct ALAP_HSLINK_NEW
{
alapHighSpeedNewFields
ALAP_HS LINK_NEW , *P_ALAP_HSLINK_NEW;
STATUS EXPORTED ClsALAPHSLinklnit(void);
HSPKT.H
msgHSPacketStatus
Returns the current status of the high speed packet device.
Takes P_HS_PACKET_STATUS, returns SfATUS.
#define msgHSPacketStatus MakeMsg(clsHighSpeedPacket, 3)
#define hsPktStsBusy flagO II status
396 PENPOINT API REFERENCE
Part 10I Connectivity
msgHSPacketSendPacket
Sends one packet through high speed packet device.
Takes P_HS_PACKET_SEND_PACKET, returns STATUS.
fdefine msgHSPacketSendPacket MakeMsg(clsHighSpeedPacket, 9)
typedef struct HS_PACKET_SEND_PACKET
{
P UNKNOWN pBufi
U32 numBytesi
U16 firstBytei
HS_PACKET_SEND_PACKET, *P_HS_PACKET_SEND_PACKETi
IfleadInChar (in metrics) is zero, firstByte is used as lead in character. If both are zero, no lead in
character is sent.
msgHSPacketSetCharHandler
Installs character receive handler.
U32 userData)i
typedef struct HS_PACKET_CHAR_HANDLER
{
P_HS_PACKET_RX_HANDLER pRxHandleri
U32 userDatai
HS_PACKET_CHAR_HANDLER, *P_HS_PACKET_CHAR_HANDLERi
HSPacket calls the user-defined function when a character is received. The called fucntion must collect
the provided character and return either true if the packet is complete, false otherwise.
userData in HS_PACKET_RX_HANDLER is the user-provided userData U32 in
HS_PACKET_CHAR_HANDLER.
IfleadInChar (in metrics) is zero, the first character received is contained in both the firstByte and the
receivedByte parameters to P_HS_PACKET_RX_HANDLERO.
The received character handler will not be installed if one already is. See
msgHSPacketFreeCharHandler.
The character handler is automatically freed when the service is dosed.
msgHSPacketFreeCharHandler
Deinstalls a previously installed character receive handler.
Takes P_HS_PACKET_CHAR_HANDLER, returns STATUS.
tdefine msgHSPacketFreeCharHandler MakeMsg(clsHighSpeedPacket,ll)
Messcge typedef struct HS_PACKET_CHAR_HANDLER
Ar~ument$ {
P_HS_PACKET_RX_HANDLER pRxHandleri
U32 userDatai
HS_PACKET_CHAR_HANDLER, *P_HS_PACKET_CHAR_HANDLERi
HSPKT.H 397
Fu nction prototypes
msgHSPacketEnable
Starts the continuous function which tests for connection and make ourselves "visible" to others.
Takes nothing, returns STATUS.
fdefine msgHSPacketEnable MakeMsg(clsHighSpeedPacket, 12)
msgHSPacketDisable
Stops the continuous function (started by msgHSPacketEnable) which tests for connection and become
"invisible" .
Takes nothing, returns STATUS.
fdefine msgHSPacketDisable MakeMsg(clsHighSpeedPacket, 13)
msgNew
Creates a new hspkt object.
Takes P_HS_PACKET_NEW, returns STATUS.
fdefine hspktNewFields \
milServiceNewFields
typedef struct HS_PACKET_NEW {
hspktNewFields
} HS_PACKET_NEW, *P_HS_PACKET_NEW;
Function prototypes
Fune;tion Prototype STATUS EXPORTED ClsHSPacketlnit (void) ;
INBxsve.H
This file contains the API definition for clsINBXService.
clsINBXService inherits from clsIOBXService.
Provides default behavior for Inbox Services.
#ifndef INBXSVC INCLUDED
#define INBXSVC INCLUDED
#ifndef IOBXSVC INCLUDED
#include <iobxsvc.h>
#endif
Introduction
In PenPoint, input operations are handled by a special class of services known as the "inbox services."
While most input operations are triggered by an external event such as an incoming fax image from a
remote fax machine, some input operations may require that the PenPoint computer be one that
initiates the communication process. For example, a fax input service may wish to periodically "poll" a
"store-and-forward" facility in order to receive a fax image. Thus, an inbox service implements the
"deferred input" feature in PenPoint: This concept permits a user to specify input operations regardless
of the readiness of input devices. If the input device (e.g., a data/fax modem, a LAN connection, etc.) is
not available or not connected, the input process is deferred until the input device becomes ready.
Some inbox services may want to actively" solicitate" input from a remote agent. For example, a service
that queries a remote database will have to establish the communication link between the PenPoint
computer and the remote database server. For this type of services, clsINBXService provides default
behaviors to manage the state of the I/O device (connected or disconnected), the permission to initiate
input operation (whether the service is enabled or disabled), as well as automatic polling behavior
similar to that of an outbox service. Thus, the user can "defer" the input operation until it becomes
possible to establish a communication link with a remote agent. See the API for clsOBXService for a
detailed discussion of the deferred input/output protocol. Note, however, that to enable such
outbox-like behavior, the polling flag must be turned on when the service is created. I.e., in
msgNewDefaults, you should set
pArgs->iobxsvc.in.autoPoll = true;
400 PENPOINT API REFERENCE
Part 10 / Connectivity
Inbox Documents
Normally, documents can be automatically created in an inbox section as the end result of an input
event. For example, a fax inbox section may create a document containing the fax images receieved in
the fax modem. Such documents are normal PenPoint documents. Their contents have nothing to do
with the input device or where the document came from.
Sometimes an inbox document contains not only data, but also some control information about the
input operation to be performed. For example, taking advantage of the "deferred input" feature, the user
may construct a specific query statement for an online database and put it into the appropriate inbox
section before the PenPoint machine is physically connected to the remote database. When the input
service becomes ready, the query statement is sent to the remote database, and the result is put into
either another document or the same document containing the query statements. This type of inbox
documents is very similar to the outbox document that controls the actual output operation. Again, for
more information about the deferred input/output protocol, see obxsvc.h.
Note that the deferred I/O protocol implemented by clsINBXService assumes that an input operation is
controlled by an inbox document: an assumption that may be too cumbersome and confusing for many
services. If such is the case, an in box service can simply store the input control information (e.g., a
database query statement) with the service itself. When the service receives
msgINBXSvcPolIDocuments, it simply handles the input operation directly and bypasses the rest of the
protocol.
Class Messages
msgNewDefaults
Initializes the P_INBXSVC_NEW structure to default values.
Takes P_INBXSVC_NEW, returns STATUS. Category: class message.
typedef struct INBXSVC NEW ONLY {
OBJECT sectionClassi - II class of the inbox section
II This must be clsNBToc or a subclass of it.
U32 unusedli
U32 unused2i
U32 unused3 i
INBXSVC_NEW_ONLY, *P_INBXSVC NEW ONLYi
#define inbxServiceNewFields \
ioSvcNewFields \
INBXSVC NEW ONLY inbxsvci
typedef struct INBXSVC_NEW
inbxServiceNewFields
} INBXSVC_NEW, *P_INBXSVC_NEWi
Zeroes out pArgs->inbxsvc and sets ... >iobxsvc.in.autoPoll = false;>inbxsvc.sectionClass
clsNBToc;
INBXSVC.H 401
Class Messages
msgNew
Creates a new inbox service object.
Takes P_INBXSVC_NEW, returns STATUS. Category: class message.
MeS1H'JSJ0 typedef struct INBXSVC_NEW {
ArgIJM0nts inbxServiceNewFields
} INBXSVC_NEW, *P_INBXSVC_NEW;
msgINBXSvcSwitchIcon
Toggles the inbox icon (to empty or filled) if neccessary.
Takes nothing, returns STATUS. Category: class message.
#define msgINBXSvcSwitchIcon msgIOBXSvcSwitchIcon
Check the content of the inbox notebook. Show the "filled" icon if any document is found. Show the
"emtpy" icon otherwise.
msgINBXDocGetService
Gets the service name.
Takes P_INBX_DOC_GET_SERVICE, returns STATUS. Category: class message.
#define msgINBXDocGetService msgIOBXDocGetService
typedef struct INBX_DOC_GET_SERVICE
OBJECT document; II In: document uid
CHAR svcName[nameBufLength]; II Out: service name
INBX_DOC_GET_SERVICE, *P_INBX_DOC_GET_SERVICE;
Get the name of the service associated with an inbox document. If the document has not been placed
into an inbox section, stsFailed is returned.
Note that the document must be at the top level of an inbox section. That is, if the document is
embedded within another document, which is in an inbox section, stsFailed will be returned.
msgINBXDoclnlnbox
Checks if a document is in a section in the Inbox.
Takes P _INBX_DOC_IN_INBOX, returns STATUS. Category: class message.
#define msgINBXDocInInbox msgIOBXDocInIOBox
typedef struct INBX DOC IN INBOX
UUID uuid; II In: document uuid
CLASS svcClass; II In: service class to check for
INBX DOC_IN_INBOX, *P_INBX_DOC_IN_INBOX;
COMments This message can be sent to clsINBXService to check if a PenPoint document represented by
pArgs->uuid is already in the input queue of an inbox service inheriting from pArgs->svcClass. stsOK is
returned if it is, stsFailed otherwise. If pArgs->svcClass is objNull, stsOK is returned if the document is
anywhere in the Inbox notebook.
~~-- ..-.
-~----- ---==~
402 PEN POINT API REFERENCE
Part 10 / Connectivity
msgINBXSvcMoveInDoc
Moves a document into the inbox section.
msgINBXSvcCopyInDoc
Copies a document into the Inbox section.
Takes P_INBXSVC_MOVE_COPY_DOC, returns STATUS.
fdefine msgINBXSvcCopyInDoc msgIOBXSvcCopyInDoc
Mos5Z1ge typedef struct INBXSVC_MOVE_COPY_DOC {
Arguments FS_LOCATOR source; II In: Location of source document.
U16 sequence; II In: Sequence number to move/copy
II in front of.
INBXSVC_MOVE_COPY_DOC, *P_INBXSVC_MOVE_COPY_DOC;
C©mrmmf$ Same as msgINBXSvcMoveInDoc, except that the document is copied to the input queue.
msgINBXSvcGeifempDir
Passes back a handle for a temporary directory.
Takes P_OBJECT, returns STATUS.
fdefine msgINBXSvcGetTempDir msgIOBXSvcGetTempDir
This message is provided for clients who may want ot prepare their input document before moving it
into the input queue. The handle of an "official" temporary directory is passed back and it can be used
as temporary storage for documents, data, etc. Clients are responsible for deleting temporary files when
they are done. The directory will be flushed after a warm boot.
msgINBXSvcPollDocuments
Polls all documents in an input queue and input those who are ready.
Takes nothing, returns STATUS.
fdefine msgINBXSvcPollDocuments msgIOBXSvcPollDocuments
INBXSVC.H 403
Messages Sent to an Inbox Service Instance
Comments This message tells the inbox service to look through its input queue and send out the first document
ready for input. The service will first make sure that it is enabled and is connected to the designated
input port. If these conditions are met, it will then self-send msgINBXSvcNextDocument to locate the
next document ready for input.
If msgINBXSvcNextDocument returns stsOK, indicating that a document is ready for input, this
message proceeds to self-send msgINBXSvcLockDocument to lock the document, and finally
msgINBXSvcInputStart to initiate the input process.
If msgINBXSvcNextDocument returns stsINBXSvcDocReady, indicating that the section is not empty
but none of the documents are ready for input, this message self-sends
msgINBXSvcScheduleDocument to schedule the document passed back in pArgs at a later time.
Subclasses normally do not process this message.
msgINBXSvcNextDocument
msgINBXSvcNextDocument
Passes back the next document ready for input.
Takes P_INBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
#define msgINBXSvcNextDocument msgIOBXSvcNextDocument
typedef struct INBXSVC DOCUMENT
OBJECT uidi II uid of the doc
OBJECT diri II app dir of the doc
OBJECT docClassi II class of the doc
U16 sequence; II sequence of the doc
CHAR pName[nameBufLength]i II name of this doc
P UNKNOWN pDocData; II subclass's private data
INBXSVC_DOCUMENT, *P_INBXSVC_DOCUMENT;
Superclass behavior is to start from the top of the input queue and locate the first document ready for
input. If one is found, information about the document is passed back in pArgs. The same pArgs will be
passed to messages msgINBXSvcLockDocument and msgINBXSvclnputStart. By default, a document
is ready for input when it is closed. If the document is open, it will receive msgINBXDoclnputStartOK
and it should return stsOK to indicate that it is ready for input.
Subclasses can provide their own behavior if they wish. Return stsINBXSvcSectionEmpty to give the
superclass an opportunity to change the inbox icon from filled to empty.
stsOK A document is ready for input.
stsINBXSvcSectionEmpty The input queue is empty.
stsINBXSvcDocNotReady No document in the input queue is ready.
Service-Specific Error Returns.
msgINBXSvcPollDocuments
msgINBXSvcLockDocument
Locks the document in preparation for input.
Takes P_INBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
#define msgINBXSvcLockDocument msgIOBXSvcLockDocument
404 PEN POINT API REFERENCE
Part 10 I Connectivity
msgINBXSvcUnlockDocument
Unlocks a document that was previously locked.
Takes P _INBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
#define msgINBXSvcUnlockDocument msgIOBXSvcUnlockDocument
ii/l,essDi i1 e typedef struct INBXSVC DOCUMENT
.fhtgunnt~nts OBJECT uid; II uid of the doc
OBJECT dir; II app dir of the doc
OBJECT docClass; II class of the doc
U16 sequence; II sequence of the doc
CHAR pName[nameBufLength]; II name of this doc
P UNKNOWN pDocData; II subclass's private data
INBXSVC_DOCUMENT, *P_INBXSVC_DOCUMENT;
This message is a place holder for subclasses that may require additional "cleanup" work to be
performed on a document before it is put back to the input queue.
The superclass behavior for this message is to remove the iobxsvcDocInputlnProgress stamp on the
document directory.
msgINBXSvcLockDocument
msgINBXSvcScheduleDocument
Schedules a document that is not ready for input
Takes P_INBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
#define msgINBXSvcScheduleDocument msgIOBXSvcScheduleDocument
Nt*)S,SCi~Je typedef struct INBXSVC DOCUMENT
Arguments OBJECT uid; II uid of the doc
OBJECT dir; II app dir of the doc
OBJECT docClass; II class of the doc
U16 sequence; II sequence of the doc
CHAR pName[nameBufLength]; II name of this doc
P_UNKNOWN pDocData; II subclass's private data
INBXSVC_DOCUMENT, *P_INBXSVC_DOCUMENT;
INBXSVC.H 405
Messages Sent to an Inbox Service Instance
Comments This message is sent when msgINBXSvcNextDocument locates a document in the input queue but the
document is not ready for input.
Subclasses should provide their own behavior. The default behavior is to release the ownership of the
target service (i.e., become disabled), with the expectation that the user must manually schedule the
document later on (by re-~nabling the section.)
msgINBXSvcNextDocument
msgINBXSvclnputStart
Starts the input process for a document in the input queue.
Takes P _INBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
*define msgINBXSvclnputStart msgIOBXSvcIOStart
Messuge typedef struct INBXSVC DOCUMENT
Arguments OBJECT uid; II uid of the doc
OBJECT dir; II app dir of the doc
OBJECT docClass; II class of the doc
U16 sequence; II sequence of the doc
CHAR pName[nameBufLength]; II name of this doc
P UNKNOWN pDocData; II subclass's private data
INBXSVC_DOCUMENT, *P_INBXSVC_DOCUMENT;
Comments Superclass behavior is to activate the inbox document if it isn't already active, and then send
msgINBXDoclnputStart to the document instance.
Subclasses can provide their own behavior if they wish.
msgINBXSvclnputCancel
Cancels the input process.
Takes nothing, returns STATUS.
*define msgINBXSvclnputCancel msgIOBXSvcIOCancel
This message is sent to the service when the caller wishes to cancel any input operation in progress. The
service responds to this message by sending msgINBXDoclnputCancel to an active inbox document.
After the document is cancelled, the service will post an error note to the user if there are other
documents waiting to be processed. The user then decides whether or not the service should proceed to
send the remaining documents.
Subclasses do not normally process this message.
msgINBXSvclnputCleanUp
Cleans up after the current input is done.
Takes P _INBX_DOC_INPUT_DONE, returns STATUS. Category: self-post..
*define msgINBXSvclnputCleanUp msgIOBXSvcIOCleanUp
Enum32 (INBX_DOC_EXIT_BEHAVIOR)
inbxDocExitDoNothing,
inbxDocExitDelete,
inbxDocExitMarkAsFailed,
inbxDocExitMarkAsCancelled
};
406 PENPOINT API REFERENCE
Part 10 / Connectivity
msgINBXSvcStateChanged
Tells observers that the service state just changed.
Takes OBJECT, returns STATUS. Category: observer notification ..
#define msgINBXSvcStateChanged msgIOBXSvcStateChanged
Informs observers that the state of a service has just changed. pArgs is the UID of the service.
msgINBXSvcQueryState
Passes back the state of the service.
Takes P_INBXSVC_QUERY_STATE, returns STATUS.
#define msgINBXSvcQueryState msgIOBXSvcQueryState
typedef struct
BOOLEAN enabled; II
true if the service is enabled.
CHAR status [nameBuf Length]; II
text describing the status of
II
the service.
CHAR docName[nameBufLength]; II
document being processed
P UNKNOWN pStateData; II
subclass's private data
INBXSVC_QUERY_STATE, *P_INBXSVC_QUERY_STATE;
This message is typically used to query what state, the service instance is in.
msgINBXSvcGetEnabled
Gets the enabled state of the service.
Takes P_BOOLEAN, returns STATUS.
#define msgINBXSvcGetEnabled msgIOBXSvcGetEnabled
Subclasses can override this message and redefine the notion of" enabled." The default behavior of the
superclass is to equate "enabled" with the ownership of the target service (i.e., input device). That is, the
service is "enabled" when it owns the target service. By appending to or replacing the default behavior, a
subclass can define additional conditions which must be met before a service is considered enabled.
msgINBXSvcSetEnabled
Sets the enabled state of the service.
Takes BOOLEAN, returns STATUS.
#define msgINBXSvcSetEnabled msgIOBXSvcSetEnabled
INBXSVC.H 407
Inbox Document Messages
Comments This message is sent to the service in response to service notification messages msgSvcOwnerAcquired
and msgSvcOwnerReleased. Subclasses can provide their own behavior and thereby redefine the notion
of" enabled" for the service. If they do, they must pass this message up to the ancestor so that observers
of the inbox service will be properly notified.
msgINBXDoclnputStartOK
Asks the inbox document if it is OK to start the input process
Takes nothing, returns STATUS.
tdefine msgINBXDoclnputStartOK msgIOBXDocIOStartOK
When an inbox service finds an opened document in the inbox section, it sends this message to the
document instance, asking whether it's OK to start the input operation while the document remains
open. When the document receives this message, it should return stsOK to give the service permission
to begin the input process. An error status, including stsNotUnderstood, is taken to mean that the
document instance vetos the request and the service will not start the input process.
msgINBXDoclnputStart
Tells an inbox document to start the input process.
Takes nothing, returns STATUS.
tdefine msgINBXDoclnputStart msgIOBXDocIOStart
Comments This message is sent by the inbox service to a document. The document should respond to this message
by starting the input process.
msgINBXDoclnputDone
Tells the inbox service that input is finished.
Takes P_INBX_DOC_INPUT_DONE, returns STATUS. Category: client responsibility.
tdefine msgINBXDoclnputDone msgIOBXDocIODone
Message typedef struct INBX_DOC_INPUT_DONE
ArgumtmfS INBX_DOC_EXIT_BEHAVIOR behavior; II exit behavior
P UNKNOWN pDocData; II Unused: document specific data
INBX_DOC_INPUT_DONE, *P_INBX_DOC_INPUT_DONE;
When the input process is finished, the inbox document in charge of the input should send this message
to the inbox service. This message must be sent even if the input process has been aborted. The pArgs
for this message tells the inbox service what to do with the inbox document. If inbxDocExitDelete is
specified, the document will be removed from the inbox. In all other cases the document will be
unlocked and left in the inbox. If either inbxDocExitMarkAsCancelled or inbxDocExitMarkAsFailed
are specified, the name of the document will be altered to provide visual indication for the user that the
input process has not completed successfully.
msgINBXDocGetService
408 PENPOINT API REFERENCE
Part 10 / Connectivity
msgINBXDoclnputCancel
Tells an inbox document to cancel the input process.
Takes nothing, returns STATUS.
tdefine msgINBXDoclnputCancel msgIOBXDbcIOCancel
This message is used by the inbox service to inform a document that it should cancel the input process.
The document should handle this message by terminating its input operation and then sending
msgINBXDoclnputDone to the service with pArgs->behavior set to inbxDocExistMarkAsCancelled.
msgINBXDocStatusChanged
Tells the inbox service that the document status is changed.
Takes P_INBX_DOC_STATUS_CHANGED, returns STATUS. Category: client responsibility.
tdefine msgINBXDocStatusChanged msgIOBXDocStatusChanged
typedef struct INBX_DOC_STATUS_CHANGED {
CHAR status [nameBuf Length]; II Text describing document state
P UNKNOWN pDocData; II Unused: document-specific data
INBX_DOC_STATUS_CHANGED, *P_INBX_DOC_STATUS_CHANGEDi
This message is sent by the inbox document to the service whenever its status has just changed. This
status is displayed on Status column for the inbox section, in the Inbox notebook.
IOBXSYC.H
Introduction
clsIOBXService implements most of the behavior of its two subclasses: clsOBXService (Outbox service
class) and clsINBXService (Inbox service class). While its subclasses deal with either the system Inbox or
the system Outbox, clsIOBXService allows a service to access both the Inbox and the Outbox at the
same time. For details about the two subclasses of clsIOBXService, see inbxsvc.h and obxsvc.h.
subclass from either clsINBXService or clsOBXService and avoid the complexity of dealing with two
separte sections in the system Inbox and Outbox. Second, the input and output operations can be
divided into two services, one inheriting from clsINBXService and one inheriting from clsOBXService.
Third, the service can inherit directly from clsIOBXService and deal with both an Inbox section and an
Outbox section at the same time. Both sections will have the same name as the service itself, and
enabling one of them will automatically enable the other.
Filesystem AHributes
The state of a document in the inbox/outbox.
#define iobxsvcAttrDocState FSMakeFix32Attr(clsIOBXService, 1)
Enum32 (IOBXSVC_ATTR_DOC_STATE)
iobxsvcDocNotScheduled 0, II Document hasn't been scheduled
II Same as no attribute.
iobxsvcDocOutputInProgress 1, II Output started, not finished yet
iobxsvcDocUserCancelled 2, II Cancelled by user
iobxsvcDocError 3, II Unable to finish due to errors
iobxsvcDocInputInProgress 4, II Input started, not finished yet
iobxsvcDocReserved5 5, II Reserved for future expansion
iobxsvcDocReserved6 6, II Reserved for future expansion
iobxsvcDocReserved7 7, II Reserved for future expansion
iobxsvcDocReserved8 8, II Reserved for future expansion
iobxsvcDocReserved9 9, II Reserved for future expansion
iobxsvcDocReserved10 10, II Reserved for future expansion
iobxsvcDocReserved11 11, II Reserved for future expansion
iobxsvcDocReserved12 12, II Reserved for future expansion
iobxsvcDocReserved13 13, II Reserved for future expansion
iobxsvcDocReserved14 14, II Reserved for future expansion
iobxsvcDocReserved15 15 II Reserved for future expansion
};
IOBXSVC.H 411
Class Messages
Class Messages
msgNewDefaults
Initializes the P_I 0 BXSVC_N EW structure to default values.
Takes P_IOBXSVC_NEW, returns STATUS. Category: class message.
Arguments typedef struct IOBXSVC SECTION METRICS {
BOOLEAN autopoll; - II True if svc should poll documents when
II it's both enabled and connected.
CLASS sectionClass; II Section Class. Must be clsNBToc or
II a subclass of it, or objNull for none.
U32 reserved[2]; II Reserved.
IOBXSVC SECTION METRICS, *P_IOBXSVC_SECTION_METRICS;
typedef struct IOBXSVC_NEW_ONLY {
IOBXSVC_SECTION_METRICS in; II Inbox section spec
IOBXSVC_SECTION_METRICS out; II Outbox section spec
U32 reserved[3];
IOBXSVC_NEW_ONLY, *P_IOBXSVC_NEW_ONLY;
*define ioSvcNewFields \
serviceNewFields \
IOBXSVC NEW ONLY iobxsvc;
typedef struct IOBXSVC_NEW
ioSvcNewFields
} IOBXSVC_NEW, *P_IOBXSVC_NEW;
Zeroes out pArgs->iobxsvc.
msgNew
Creates a new inbox/outbox service object.
Takes P_IOBXSVC_NEW, returns STATUS. Category: class message.
Message typedef struct IOBXSVC_NEW {
Arguments ioSvcNewFields
} IOBXSVC_NEW, *P_IOBXSVC_NEW;
msgIOBXSvcSwitchlcon
Toggles the inbox or outbox icon (to empty or filled) if neccessary.
Takes nothing, returns STATUS. Category: class message.
*define msgIOBXSvcSwitchIcon MakeMsg(clsIOBXService, 1)
Check the content of the inbox or outbox notebook. For outbox, show the "filled" icon if any document
is found. For inbox, show the "filled" icon if there is at least one document that has not been opened.
msgIOBXDocGetService
Gets the service name.
Takes P_IOBX_DOC_GET_SERVICE, returns STATUS. Category: class message.
*define msgIOBXDocGetService MakeMsg(clsIOBXService, 2)
typedef struct IOBX_DOC_GET_SERVICE
OBJECT document; II In: document uid
CHAR svcName[nameBufLength]i II Out: service name
IOBX DOC GET_SERVICE, *P_IOBX_DOC_GET_SERVICEi
412 PENPOINT API REFERENCE
Part 10 / Connectivity
Get the name of the service associated with an inbox/outbox document. If the document has not been
placed into an inbox/outbox section, stsFailed is returned.
Note that the document must be at the top level within an inbox/outbox section. That is, if the
document is embedded in another document, stsFailed will be returned even if its embeddor is within
an inbox/outbox section.
msgIOBXDoclnIOBox
Checks if a document is in a section in the Inbox/Outbox notebook.
Takes P_IOBX_DOC_IN_IOBOX, returns STATUS. Category: class message.
#define msgIOBXDocInIOBox MakeMsg(clsIOBXService, 3)
typedef struct IOBX_DOC_IN_IOBOX {
ANM_AUX_NOTEBOOK notebook; II In: Which notebook?
UUID uuid; II In: document uuid
CLASS svcClass; II In: service class to check for
IOBX DOC_IN_IOBOX, *p IOBX DOC_IN_IOBOX;
msgIOBXSvcMovelnDoc
Moves a document into the outbox section.
Takes P_IOBXSVC_MOVE_COPY_DOC, returns STATUS.
#define msgIOBXSvcMoveInDoc MakeMsg(clsIOBXService, 4)
typedef struct IOBXSVC MOVE COpy DOC {
ANM_AUX_NOTEBOOK - notebook; II In: Which notebook?
FS LOCATOR source; II In: Location of source document.
U16 sequence; II In: Sequence number to move/copy
II in front of.
IOBXSVC MOVE_COPY_DOC, *P_IOBXSVC_MOVE_COPY_DOC;
Superclass behavior is to move the document located at pArgs->source into the input! output queue
associated with the inbox/outbox service. For example, set pArgs->sequence to 1 to move the document
to the top of the queue. Set it to maxU16 to move the document to the bottom of the queue.
After the document is moved (or copied) to the input/output queue, it is considered to be in a state
ready for input/output, even though the service may not be connected at the time. Client should not
alter the document in any way once it has been moved to the input/output queue.
Subclasses can provide their own behavior if they wish. Remember to use the class message
msgIOBXSvcSwitchIcon to change the inbox/outbox icon.
msgIOBXSvcCopylnDoc
Copies a document into the InboxiOutbox section.
Takes P_IOBXSVC_MOVE_COPY_DOC, returns STATUS.
#define msgIOBXSvcCopyInDoc MakeMsg(clsIOBXService, 5)
IOBXSVC.H 413
Messages Sent to an Outbox Service Instance
msgIOBXSvcGetTempDir
Passes back a handle for a temporary directory.
Takes P_OBJECT, returns STATUS.
#define msgIOBXSvcGetTempDir MakeMsg(clsIOBXService, 6)
This message is provided for clients who may want to prepare their input/output document before
moving it into the input/output queue. The handle of an "official" temporary directory is passed back
and it can be used as temporary storage for documents, data, etc. Clients are responsible for deleting
temporary files they created when done. This temporary directory will be flushed after a warm boot.
msgIOBXSvcPollDocuments
Polls all documents waiting for input/output.
Takes nothing, returns SfATUS.
#define msgIOBXSvcPollDocuments MakeMsg(clsIOBXService, 7)
This message tells the inbox/outbox service to look through its queue and initiate the input/output
process for the first document ready to do so. The service will first make sure that it is enabled and is
connected to the designated input! output port. If these conditions are met, it will then self-send
msgIOBXSvcNextDocument to locate the next document ready forrinput/output.
If msgIOBXSvcNextDocument returns stsOK, indicating that a document is ready, this message
proceeds to self-send msgIOBXSvcLockDocument to lock the document, and finally
msgIOBXSvcIOStart to initiate the input/output process.
If msgIOBXSvcNextDocument returns stsOBXSvcDocNotReady, indicating that the section is not
empty but none of the documents are ready for input/output, this message self-sends
msgIOBXSvcScheduleDocument to schedule the document passed back in pArgs at a later time.
Subclasses normally do not process this message.
msgIOBXSvcNextDocument
msgIOBXSvcNextDocument
Passes back the next document ready for input/output.
Takes P_IOBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
#define msgIOBXSvcNextDocument MakeMsg(clsIOBXService, 8)
typedef struct IOBXSVC DOCUMENT
OBJECT uid; II uid of the doc
OBJECT dir; II app dir of the doc
OBJECT docClass; II class of the doc
U16 sequence; II sequence of the doc
CHAR pName[nameBufLength]; II name of this doc
P UNKNOWN pDocData; II subclass's private data
IOBXSVC_DOCUMENT, *P_IOBXSVC_DOCUMENT;
414 PENPOINT API REFERENCE
Part 10 / Connectivity
Superclass behavior is to start from the top of the queue and locate the first document ready for
input/ output. If one is found, information about the document is passed back in pArgs. The same
pArgs will be passed to messages msgIOBXSvcLockDocument and msgIOBXSvclOStart. By default, a
document is ready for input/output when it is closed. If the document is open, it will receive
msgIOBXDoclOStartOK and it should return stsOK to indicate that it is ready for input/output.
Subclasses can provide their own behavior if they wish. Return stsOBXSvcSectionEmpty to give the
superclass an opportunity to change the inbox/outbox icon from filled to empty. Or refresh the look of
the icon by sending msgIOBXSvcSwitchIcon to the service class.
stsOK A document is ready for input/output.
stsOBXSvcSectionEmpty The input!output queue is empty.
stsOBXSvcDocNotReady No document in the input/output queue is ready.
Service-Specific ~rror Returns.
msgIOBXSvcPollDocuments
msgIOBXSvcUnlockDocument
Unlocks a document that was previously locked.
Takes P_IOBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
#define msgIOBXSvcUn!ockDocument MakeMsg(c!sIOBXService, 10)
IOBXSVC.H 415
Messages Sent to an Out box Service Instance
msgIOBXSvcScheduleDocument
Schedules a document that is not ready for input/output
Takes P _IOBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
*define msgIOBXSvcScheduleDocument MakeMsg(clsIOBXService, 11)
Message typedef struct IOBXSVC DOCUMENT
ArgtJrnet~r5 OBJECT uid; II uid of the doc
OBJECT dir; II app dir of the doc
OBJECT docClass; II class of the doc
U16 sequence; II sequence of the doc
CHAR pName[nameBufLength]; II name of this doc
P UNKNOWN pDocData; II subclass's private data
IOBXSVC_DOCUMENT, *P_IOBXSVC_DOCUMENT;
This message is sent when msgIOBXSvcNextDocument locates a document in the input/output queue
but the document is not ready for input/output.
Subclasses should provide their own behavior. The default behavior is to release the ownership of the
target service (i.e., become disabled), with the expectation that the user must manually schedule the
document later on (by re-enabling the section.)
msgIOBXSvcNextDocument
msgIOBXSvcIOStart
Starts the input/output process for a document in the input/output queue.
Takes P_IOBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
*define msgIOBXSvcIOStart MakeMsg(clsIOBXService, 12)
MeSS(Jg0 typedef struct IOBXSVC DOCUMENT
AvgtJments OBJECT uid; II uid of the doc
OBJEC.T dir; II app dir of the doc
OBJECT docClass; II class of the doc
U16 sequence; . II sequence of the doc
CHAR pName[nameBufLength]; II name of this doc
P UNKNOWN pDocData; II subclass'S private data
IOBXSVC_DOCUMENT, *P_IOBXSVC_DOCUMENT;
Superclass behavior is to activate the inbox/outbox document if it isn't already active, and then send
msgIOBXDoclOStart to the document instance.
Subclasses can provide their own behavior if they wish.
-------_._._------
416 PENPOINT API REFERENCE
Part 10 I Connectivity
msgIOBXSvcIOCleanUp
Cleans up after the current input/output is done.
Takes P_IOBX_DOC_OUTPUT_DONE, returns STATUS. Category: self-post ..
#define msgIOBXSvcIOCleanUp MakeMsg(clsIOBXService, 14)
II What to do after a document
II is processed
iobxDocExitDoNothing 0,
iobxDocExitDelete 1,
iobxDocExitMarkAsFailed 2,
iobxDocExitMarkAsCancelled 3
};
msgIOBXSvcStateChanged
Tells observers that the service state just changed.
Takes OBJECT, returns STATUS. Category: observer notification ..
#define msgIOBXSvcStateChanged MakeMsg(clsIOBXService, 15)
Informs observers that the state of a service has just changed. pArgs is the UID of the service.
msgIOBXSvcQueryState
Passes back the state of the service.
Takes P _IOBXSVC_QUERY_STATE, returns STATUS.
#define msgIOBXSvcQueryState MakeMsg(clsIOBXService, 16)
IOBXSVC.H 417
Inbox/Outbox Document Messages
typedef struct
BOOLEAN enabled; II
is the service enabled?
CHAR status [nameBuf Length]; II
text describing the status of
II
the service.
CHAR docName[nameBufLength]; II
document being processed
P UNKNOWN pStateData; II
subclass's private data
IOBXSVC QUERY STATE, *p IOBXSVC QUERY_STATE;
msgIOBXSvcGetEnabled
Gets the enabled state of the service.
Takes P_BOOLEAN, returns STATUS .
• define msgIOBXSvcGetEnab!ed MakeMsg(c!sIOBXService, 17)
Subclasses can override this message and redefine the notion of" enabled." The default behavior of the
superclass is to equate "enabled" with the ownership of the target service (i.e., input/output device).
That is, the service is "enabled" when it owns the target service. By appending to or replacing the default
behavior, a subclass can define additional conditions which must be met before a service is considered
enabled.
msgIOBXSvcSetEnabled
Sets the enabled state of the service.
Takes BOOLEAN, returns STATUS.
*define msgIOBXSvcSetEnab!ed MakeMsg(c!sIOBXService, 18)
This message is sent to the service in response to service notification messages msgSvcOwnerAcquired
and msgSvcOwnerReleased. Subclasses can provide their own behavior and thereby redefine the notion
of "enabled" for the service. If they do, they must pass this message up to the ancestor so that observers
of the inbox/outbox service will be properly notified.
msgIOBXDocIOStartOK
Asks the inbox/outbox document if it is OK to start the input!output process
Takes nothing, returns STATUS .
• define msgIOBXDocIOStartOK MakeMsg(c!sIOBXService, 19)
Comments When an inbox/outbox service finds an opened document in the inbox/outbox section, it sends this
message to the document instance, asking whether it's OK to start the input/output operation while the
document remains open. When the document receives this message, it should return stsOK to give the
service permission to begin the input/output process. An error status, including stsNotUnderstood, is
taken to mean that the document instance vetos the request and the service will not start the
input/ output process.
This message is sent by the inbox/outbox service to a document. The document should respond to this
message by starting the input/output process.
msgIOBXDocIODone
Tells the inbox/outbox service that input/output is finished.
Takes P_IOBX_DOC_OUTPUT_DONE, returns STATUS. Category: client responsibility.
fdefine msgIOBXDocIODone MakeMsg(clsIOBXService, 21)
Mf?$$CI£jC typedef struct IOBX_DOC_OUTPUT_DONE
Argumcnts IOBX_DOC_EXIT_BEHAVIOR behavior; II exit behavior
P UNKNOWN pDocData;11 Unused: document specific data
IOBX_DOC_OUTPUT_DONE, *P_IOBX_DOC_OUTPUT_DONEi
When the input/output process is finished, the inboxloutbox document in charge of the input/output
should send this message to the inbox/outbox service. This message must be sent even if the
input/output process has been aborted. The pArgs for this message tells the inbox/outbox service what
to do with the inbox/outbox document. If obxDocExitDeIete is specified, the document will be
removed from the inbox/outbox. In all other cases the document will be unlocked and left in the
inbox/outbox. If either obxDocExitMarkAsCancelled or obxDocExitMarkAsFailed are specified, the
name of the document will be altered to provide visual indication for the user that the input/output
process has not completed successfully.
msgIOBXDocGetService
msgIOBXDocIOCancel
Tells an inbox/outbox document to cancel the input/output process.
Takes nothing, returns STATUS.
fdefine msgIOBXDocIOCancel MakeMsg(clsIOBXService, 22)
Comments This message is used by the inboxl outbox service to inform a document that it should cancel the
input/output process. The document should handle this message by terminating its input/output
operation and then sending msgIOBXDoclODone to the service with pArgs->behavior set to
obxDocExistMarkAsCancelled.
msgIOBXDocStatusChanged
Tells the inbox/outbox service that the document status is changed.
Takes P_IOBX_DOC_STATUS_CHANGED, returns STATUS. Category: client responsibility.
fdefine msgIOBXDocStatusChanged MakeMsg(clsIOBXService, 23)
typedef struct IOBX_DOC_STATUS_CHANGED {
CHAR status[nameBufLength]i II Text describing document state
P UNKNOWN pDocDatai II Unused: document-specific data
IOBX_DOC_STATUS_CHANGED, *P_IOBX_DOC_STATUS_CHANGEDi
This message is sent by the inbox/outbox document to the service whenever its status has just changed.
This status is displayed on Status column for the inbox/outbox section, in the Inbox/Outbox notebook.
LINK.H
Link layer API definition.
This file contains the interface definition for link layer protocols.
1. Link layer protocols must sub-class clsLink.
2. clsLink sub-classes clsService.
#ifndef LINK INCLUDED
#define LINK INCLUDED
typedef struct
{
U16 addrSize; II size of address pointed to
U8 addr[8]; II address
ADDRESS, *P_ADDRESS;
The PROTOCOL_ADDRESS structure contains all the addressing information needed below the transport
leveL Unspecified addresses have null pointers.
typedef struct {
} PROTOCOL_ADDRESS, * P_PROTOCOL_ADDRESS;
The PROTOCOL_INFO structures in the transmit and receive descriptors holds the following
information.
typedef struct
PROTOCOL ADDRESS srci
PROTOCOL ADDRESS desti
PROTOCOL_INFO;
#define sizeRxBuf 608
typedef struct RXBUFDESC
PROTOCOL INFO info;
} RX_DESC, *P_RX_DESC;
typedef struct {
U16 blockLeni
U8 *pBlock;
BLOCK, *P_BLOCK;
#define lnkMaxBlocks 8
#define sizeTxImmedData 32
typedef struct {
PROTOCOL INFO info;
BLOCK txBlockTab[lnkMaxBlocks];
U8 immedData[sizeTxImmedData];
TX_DESC, *P_TX_DESC;
#define stsNoTxBuffer MakeStatus(clsLink, 1)
#define stsNoRxBuffer MakeStatus(clsLink, 2)
#define stsTxCollisionOrDefer MakeStatus(clsLink, 3)
#define stsTxTimeout MakeStatus(clsLink, 4)
II A power cycle has happened, the link should be closed and reinitialized
#define stsLinkPowerCycle MakeStatus(clsLink, 5)
II The link cable is not connected.
#define stsLinkNotConnected MakeStatus(clsLink, 6)
typedef U16 LINK_PROTOCOL_TYPEi
420 PENPOINT API REFERENCE
Part 10 / Connectivity
typedef enum
{
linkMulticast flagO, II multicast transmit and receive
linkBroadcast flag1, II broadcast transmit and receive
linkPromiscuous flag2, II promiscuous receive mode
linkLoopback flag3 II loopback of transmit to receive
LINK_SERVICES;
typedef struct
{
U16 tableSize;
U8 linkAddress[2];
*P_BROADCAS T_ADDR , *P_MULTICAST_ADDR;
typedef struct
{
U16 tableSize; II size of link Attributes table
U8 typeName [32]; II ASCIIZ name of LINK type: LocalTalk, Ethernet
II ASYNC, SDLC, etc.
U16 linkAddrLen; II length in bytes of link addresses
U8 linkAddr[16]; II current link address of local station
U32 linkSpeed; II link communication speed in bits per second
U16 maxDataSize; II maximum amount of data that will fit in a link frame
U16 maxFrameSize; II maximum size of a link frame (including link header)
U16 numBuffers; II total number of available link buffers for this
device
LINK SERVICES linkServices; II LINK services supported
ADDRESS broadcast; II broadcast address
P_MULTI CAST_ADDR pMulticastTable; II pointer to multicast address table
II add additional fields here
LINK_ATTRIBUTES, *P_LINK_ATTRIBUTESi
typedef enum
{
linkOperational,
linkHardwareFailure,
linkConfigurationFailure,
linkHardwareNotInstalled
LINK_OPERATING_STATUS;
typedef struct
{
LINK OPERATING STATUS linkStatus;
II additional specific status info goes here
LINK_STATUS, *P_LINK_STATUS;
typedef void (EXPORTED * PF_PROTOCOL_HANDLER) (P_RX_DESC);
structure of the link header
#pragma pack(1) II byte boundary packing for protocol headers
typedef struct
{
U8 destLinkAddr;
U8 srcLinkAddr;
U8 typeLink;
} LINK_HEADER, *p LINK HEADER;
#pragma pack ( ) 1/ back to command line stuff
#define maxRxFrameSize sizeRxBuf
typedef struct TX_FRAME
{
struct TX FRAME * link;
BOOLEAN sent;
U16 length;
U32 physAddr;
unsigned char buf[maxRxFrameSize];
TX_FRAME, *P_TX_FRAME;
#define lnkMaxShortFrameSize 10
LlNK.H 421
msgLINKInstallProtocol
Install a link layer protocol handler to receive frames.
Takes P_INSTALL_PROTOCOL, returns STATUS.
#define rnsgLINKInstallProtocol MakeMsg( clsLink, 1 )
typedef struct INSTALL_PROTOCOL {
LINK_PROTOCOL_TYPE linkProtocolType;
PF_PROTOCOL_HANDLER pNewHandler;
INSTALL_PROTOCOL, * P_INSTALL_PROTOCOL;
msgLINKRemoveProtocol
Remove a link layer protocol handler.
Takes P _REMOVE_PROTOCOL, returns STATUS.
#define rnsgLINKRernoveProtocol MakeMsg( clsLink, 2 )
typedef struct REMOVE_PROTOCOL{
LINK_PROTOCOL_TYPE linkProtocolType;
} REMOVE_PROTOCOL, * P_REMOVE_PROTOCOL;
msgLINKTransmit
Transmit a packet.
Takes P_LINK_TRANSMIT, returns STATUS.
#define rnsgLINKTransrnit MakeMsg( clsLink, 5 )
typedef struct LINK_TRANSMIT {
P TX DESC pTD;
} LINK_TRANSMIT, * P_LINK_TRANSMIT;
msgLINKBufferReturn
Return receive buffer to the link layer.
Takes P_BUFFER_RETURN, returns STATUS.
#define rnsgLINKBufferReturn MakeMsg( clsLink, 6 )
typedef struct BUFFER_RETURN
P RX DESC pRD;
} BUFFER_RETURN, * P_BUFFER_RETURN;
msgLINKAttributesGet
Obtain the link layer attributes.
Takes P_ATTRIBUTES_GET, returns STATUS.
#define rnsgLINKAttributesGet MakeMsg( clsLink, 7 )
422 PENPOINT API REFERENCE
Part 10 I Connectivity
msgLINKStatusGet
Obtain the link layer statistics.
Takes P _STATUS_GET, returns STATUS.
tdefine msgLINKStatusGet MakeMsg( clsLink, 8 )
typedef struct STATUS_GET
P LINK STATUS pStatus;
} STATUS_GET, * P_STATUS_GET;
msgLINKAddressAcquire
Acquire the link layer address.
Takes P _ADDRESS_ACQUIRE, returns STATUS.
tdefine msgLINKAddressAcquire MakeMsg( clsLink, 9 )
typedef struct ADDRESS_ACQUIRE
U16 linkAddrLen; II length in bytes of link addresses
U8 linkAddr[16]; II current link address of local station
BOOLEAN server; I I acquire a server address
ADDRESS_ACQUIRE, * P_ADDRESS_ACQUIRE;
MODEM.H
This file contains the API for clsModem.
clsModem inherits from clsService.
clsModem provides the interface a client uses to communicate via a modem. The modem service is
located, bound to, opened, and closed via standard PenPoint service messages.
The object which opens a modem service becomes its client. After opening a modem service, it is
recommened that a client explicitly reset the modem firmware, initialize the modem 110 port settings,
and then set the modem firmware to the desired state.
The modem firware is reset by sending msgModemReset to an open modem service. Refer to
msgModemReset below for a description of the state to which the modem firmware is reset.
A client obtains current modem 110 port settings by sending msgSioGetMetrics to a modem service.
110 port settings may be altered by sending msgSioSetMetrics to the modem service. These messages in
addition to msgSiolnit, msgSioBreakSend, msgSioControlInStatus, msgSiolnputBufferStatus, and
msgSiolnputBufferFlush are the only clsMlLAsyncSIODevice messages which clsModem handles.
Refer to file "sio.h" for a description of these messages.
After initializing the modem 110 port, a client may then send clsModem messages to initialize the
modem to a desired state. Such initialization may be accomplished via discrete messages, or via
msgSvcSetMetrics.
Upon successfully initializing a modem, the client may then establish a connection, transmit data and/or
receive data via the connection, and finally terminate the connection. Clients send clsStream messages
to read/write data fromlto the modem. Refer to file "stream.h" for a description of clsStream messages.
**** PLEASE NOTE ****
In a future release of PenPoint, the clsModem API will be augmented. Compatibility with the
clsModem API described herein shall be maintained for at least one release.
Defined within this header file for the clsModem API
msgModemConnected
Notification sent to the client indicating the modem has connected with a remote node modem.
Takes nothing, returns N/A. Category: client notification.
*define msgModemConnected MakeMsg(clsModem, 3)
A client may obtain information regarding the connection via msgModemGetConnectionlnfo.
msgModemDisconnected
Notification sent to the client indicating that the current connection has been terminated.
Takes nothing, returns N/A. Category: client notification.
*define msgModemDisconnected MakeMsg(clsModem, 4)
msgModemRingDetected
Notification sent to the client indicating that a ring indication has been received from the modem.
Takes nothing, returns N/A. Category: client notification.
*define msgModemRingDetected MakeMsg(clsModem, 5)
msgModemTransmissionError
Notification sent to the client indicating that an error has been detected during transmission (sending or
receiving) of data.
Takes nothing, returns N/A. Category: client notification.
*define msgModemTransmissionError MakeMsg(clsModem, 6)
This unsolicited message is typically sent as a result of detecting a data framing error, or other low-level
modem link protocol generated error condition.
msgModemErrorDetected
Notification sent to the client indicating that an unexpected error indication has been received from the
modem.
Takes nothing, returns N/A. Category: client notification.
*define msgModernErrorDetected MakeMsg(clsModem, 7)
426 PENPOINT API REFERENCE
Part 10 / Connectivity
Action Messages
msgModemSetResponseBehavior
Set the modem response mode, and command-to-response time-out values.
Takes P_MODEM_RESPONSE_BEHAVIOR, returns STATUS. Category: modem service request.
fdefine msgModemSetResponseBehavior MakeMsg(clsModem, 16)
Enum32 (MODEM_RESPONSE_MODE) II Mode for conveying modem responses.
mdmResponseViaStatus, II Report via status (Default).
mdmResponseViaMessage, II Report via notification msgModemResponse.
mdmResponseTransparent II Don't intercept and process modem responses.
};
fdefine mdmDefaultCommandTimeout 2500 II 2 1/2 second command timeout.
fdefine mdmDefaultConnectTimeout 30000 II 30 second connect timeout.
typedef struct { II Command-to-response timeouts.
OS MILLISECONDS timeoutCommand; II Timeout for all commands
II except connect requests
II (default of 2 1/2 seconds).
OS MILLISECONDS timeoutConnect; II Timeout for connect requests
II (default of 30 seconds).
MODEM_TIMEOUT, *P_MODEM TIMEOUT;
typedef struct { II Modem command-response handling behavior.
MODEM_RESPONSE_MODE mode; II Mode for coveying responses
MODEM TIMEOUT timeout; II Command-to-response timeouts.
MODEM_RESPONSE_BEHAVIOR, *P_MODEM_RESPONSE_BEHAVIOR;
Response mode mdmResponseViaStatus causes the modem service to block and await a response from
the modem. If the modem doesn't return a response within the specified time-out duration, stsTimeOut
is returned.
Response mode mdmResponseViaMessage is useful for clients that wish to ObjectPostAsync their
modem service requests, and hence not block until completion (or timeout) of the request. Modem
responses are reported to the client via msgModemResponse.
Response mode mdmResponseTransparent disables the modem service response processing sub-system.
Modem command responses are left unaltered within the input data stream. The client assumes
responsibility for processing modem responses. All commands successfully sent to the modem return a
status of stsO K.
NOTE: Once a client switches to transparent mode (or sends modem register altering commands via
msgModemSendCommand) they are responsible for the integrity of clsModem. Therefore, it is the
client's responsibility to ensure that the clsModem (and the modem) are reset to a known state upon
switching from transparent mode to a different response mode.
msgModemGetResponseBehavior
Passes back the current modem response mode, and the current command-to-response time-out values.
Takes P_MODEM_RESPONSE_BEHAVIOR, returns STATUS. Category: modem service request.
fdefine msgModemGetResponseBehavior MakeMsg(clsModem, 17)
Mess©ge typedef struct { II Modem command-response handling behavior.
Argumetl?S MODEM_RESPONSE_MODE mode; II Mode for coveying responses
MODEM TIMEOUT timeout; II Command-to-response timeouts.
MODEM_RESPONSE_BEHAVIOR, *P_MODEM_RESPONSE_BEHAVIOR;
MODEM.H 427
Action Messages
msgModemSendCommand
Sends a specified command to the modem.
Takes P_MODEM_SEND_COMMAND, returns STATUS. Category: modem service request.
tdefine msgModemSendCommand MakeMsg(clsModem, 18)
tdefine mdmSizeMaxCommand 80 II Max' command size is 80 bytes.
typedef struct
P U8 pCmdStr; II In: Ptr to command string
II (null terminated).
OS MILLISECONDS timeout; II In: Timeout for cmd response.
MODEM_RESPONSE_INFO responseInfo; II Out: The response to the cmd.
MODEM_SEND_COMMAND, *P_MODEM_SEND_COMMAND;
Comments The timeout value specified within MODEM_SEND_COMMAND supersedes that specified via
msgModemSetResponseBehavior.
NOTE: Clients should only use msgModemSendCommand to perform modem actions unavailable via
the clsModem API described herein.
NOTE: Clients that send commands that alter modem registers are responsible for the integrity of
clsModem. Therefore, it is the client's responsibility to ensure that such commands will not adversely
affect clsModem.
msgModemGetConnectionlnfo
Passes back information about the current connection.
Takes P_MODEM_CONNECTION_INFO, returns STATUS. Category: modem service request.
tdefine msgModemGetConnectionInfo MakeMsg(clsModem, 19)
Enum32 (MODEM_CONNECTION) { II The type of connection established.
mdmConnectionNone, II None; Disconnected.
mdmConnectionStandard, II Standard data.
mdmConnectionMNP, II MNP.
mdmConnectionLAPM I I LAPM.
};
Enum32 (MODEM_LINK_CONTROL) II Link and error control protocols.
mdmLinkControlMNPClass1 4 = flagO, II MNP Levels 1 through 4.
mdmLinkControlMNPClassS flag1, II MNP Level S data compression.
mdmLinkControlMNPClass6 flag2, II MNP Level 6.
mdmLinkControlMNPClass7 flag3, II MNP Level 7 data compression.
mdmLinkControlV42 flag4, II Physical level error detection and
II correction (LAPM link control) .
mdmLinkControlV42bis flagS II V42 data compression.
};
typedef struct { II Information about a connection.
MODEM CONNECTION connection; II The type of connection.
MODEM LINK CONTROL linkControl;11 Link control in use, if any/known.
S32 baudRate; II Baud rate of connection.
U32 spare[2]; II Reserved for future expansion.
MODEM_CONNECTION_INFO, *P_MODEM_CONNECTION_INFO;
msgModemReset
Resets the modem firmware, I/O port, and service state.
Takes nothing, returns STATUS. Category: modem service request.
tdefine msgModemReset MakeMsg(clsModem, 20)
428 PENPOINT API REFERENCE
Part 10 / Connectivity
NOTE: The modem 110 port baud rate is reset to the highest supported data mode baud rate.
Therefore not all implementations will reset the baud rate to 2400. The client may elect to subseqently
change the baud rate for auto- baud detecting modems.
Reset 1/0 port state:
baud 2400;
line.dataBits sioEightBits;
line.stopBits sioOneStopBit;
line.parity sioNoParity;
controlOut.rts = true;
controlOut.dtr = true;
flowChar.xonChar = Oxll;
flowChar.xoffChar = Ox13;
flowType.flowControl = sioNoFlowControl;
Reset modem firmware state:
Speaker control on until carrier detected (*).volume medium (*).detection enabled (*).detection enabled
(*).mode from dialing environment. disabled. on ring zero.character echo disabled. command result
codes.verbal result codes (words).carrier upon connect. code + (ASCII 43).termination code carriage
return (ASCII 13).
(*) or set as per current modem option card setting.
msgModemOflHook
Picks up the phone line.
Takes nothing, returns STATUS. Category: modem service request.
#define msgModemOffHook MakeMsg(clsModem, 21)
msgModemOnline
Forces the modem online into data mode.
Takes nothing, returns STATUS. Category: modem service request.
#define msgModemOnline MakeMsg(clsModem, .22)
msgModemSetDialType
Establishes the mode for dialing telephone numbers.
Takes MODEM_DIAL_MODE, returns STATUS. Category: modem service request.
#define msgModemSetDialType MakeMsg(clsModem, 23)
II
Mode in which the modem is to dial.
mdmPulseDialing, II
Perform pulse dialing.
mdmTouchtoneDialing, II
Peform touch-tone dialing.
mdmDialStringDialing, II
Client supplies the dialing mode
II embedded within the dialString.
mdmDialingEnvironmentDialing/1 If available, use the current dialing
II environment dialing mode, otherwise use
II current modem firmware dialing mode (Default).
};
MODEM.H 429
Action Messages
msgModemDial
Performs dialing and attempts to establish a connection.
Takes P _MODEM_DIAL, returns STATUS. Category: modem service request.
*define msgModemDial MakeMsg(clsModem, 24)
typedef struct { II Dialing and connection type.
DIALENV_DIAL_STRING dialString; II In: Phone number to dial.
U32 spare[2]; II Reserved for future expansion.
MODEM_DIAL, *P_MODEM_DIAL;
msgModemSetAutoAnswer
Disables or enables the modem auto-answer feature.
Takes P_MODEM_SET_AUTO_ANSWER, returns STATUS. Category: modem service request.
*define msgModemSetAutoAnswer MakeMsg(clsModem, 25)
Enum32 (MODEM_AUTO_ANSWER) { II Modem auto-answer capability.
mdrnAutoAnswerDisabled, II Disable auto-answer (Default).
mdrnAutoAnswerEnabled II Enable auto-answer.
};
typedef struct { II Auto-answer settings.
MODEM AUTO ANSWER autoAnswer; II In: Enable/disable auto-answer.
S32 rings; II In: Number of rings before answer.
MODEM_SET_AUTO_ANSWER, *P_MODEM_SET_AUTO_ANSWER;
Comments NOTE: For some modems a value of 0 for rings disables auto-answer.
msgModemSetAnswerMode
Filters the type of calls to answer and connection reporting.
Takes MODEM_ANSWER_MODE, returns STATUS. Category: modem service request.
*define msgModemSetAnswerMode MakeMsg(clsModem, 26)
Enum32 (MODEM_ANSWER_MODE) II Modem answer filter/mode.
mdrnAnswerDataMode flagO, II Answer in data mode.
mdrnAnswerFaxMode flagl, II Answer in fax mode.
mdrnAnswerVoiceMode flag2 II Answer in voice mode.
};
NOTE: Not all modems are capable of discriminating between the type of incoming call.
msgModemAnswer
Immediately answers a telephone call.
Takes nothing, returns STATUS. Category: modem service request.
*define msgModemAnswer MakeMsg(clsModem, 27)
msgModemHangUp
Hang-ups and disconnects to terminate a connection.
Takes nothing, returns STATUS. Category: modem service request.
*define msgModemHangUp MakeMsg(clsModem, 28)
430 PENPOINT API REFERENCE
Part 10 / Connectivity
msgModemSetSignailingModes
Establishes/ restricts the modem to use specific signalling modes/standards.
Takes P_MODEM_SIGNALLING_MODES, returns STATUS. Category: modem service request.
*define msgModemSetSignallingModes MakeMsg(clsModem, 29)
Enum32 (MODEM_SIGNALLING_VOICEBAND) { II Voice-band signalling standards.
mdmVoiceBandBell103J flagO, II 300 BPS.
mdmVoiceBandBell212A flag1, II 1200 BPS.
mdmVoiceBandV21 flag2, II 300 BPS duplex modem on GSTN.
mdmVoiceBandV22 flag3, II 1200 BPS duplex modem on GSTN
II or P-P leased two-wire circuits.
mdmVoiceBandV22bis flag4, II 2400 BPS duplex modem on GSTN
II or P-P two-wire leased circuits.
mdmVoiceBandV23 flag5, II 600/1200 BPS modem on GSTN.
mdmVoiceBandV26 flag6, II 2400 BPS modem on four-wire
II leased circuits.
mdmVoiceBandV26bis flag7, II 2400/1200 BPS modem on GSTN.
mdmVoiceBandV26ter . flag8, II 2400 BPS duplex modem on GSTN
II or P-P two-wire leased circuits.
mdmVoiceBandV27 flag9, II 4800 BPS on leased circuits.
mdmVoiceBandV27bis flag10, II 2400/4800 BPS on leased circuits.
mdmVoiceBandV27ter flag11, II 4800/2400 BPS modem on GSTN.
mdmVoiceBandV29 flag12, II 9600 BPS FDX or HDX modem on
II P-P four-wire leased circuits.
mdmVoiceBandV32 flag13, II 9600/4800 BPS duplex modem on
II GSTN or leased circuits.
mdmVoiceBandV33 flag14 II 14400 BPS modem on P-P
II four-wire leased circuits.
};
Enum32 (MODEM_SIGNALLING_WIDEBAND) II Wide-band signalling standards.
mdmWideBandV35 flagO, II 48 KBPS data transmission on
II 60-108 KHz group band circuits.
mdmWideBandV36 flag1, II 48-72 KBPS sync data transmission
l i o n 60-108 KHz group band circuits.
mdmWideBandV37 flag2 II 72-168 KBPS sync data transmission
l i o n 60-108 KHz group band circuits.
}i
typedef struct { II Modem modulationlsignalling modes.
MODEM_SIGNALLING_VOICEBAND voiceBand; II Voice band signalling.
MODEM_SIGNALLING_WIDEBAND wideBand; II Wide band signalling.
MODEM_SIGNALLING_MODES, *P_MODEM_SIGNALLING_MODESi
NOTE: Not all modems provide support for selecting signalling modes.
msgModemSetToneDetection
Enables or disables busy tone and/or dial tone detection.
Takes MODEM_TONE_DETECTION, returns STATUS. Category: modem service request.
*define msgModemSetToneDetection MakeMsg(clsModem, 30)
Enum32 (MODEM_TONE_DETECTION) II Busy and dial toneCarrier signal on/off.
mdmToneDetectDisable, II Detect neither busy tone or dial tone.
mdmToneDetectBusyOnly, II Detect busy tone, but not dial tone.
mdmToneDetectDialOnly, II Detect dial tone, but not busy tone.
mdmToneDetectBusyAndDial II Detect dial tone and busy tone (Default).
};
MODEM.H 431
Action Messages
msgModemSetSpeakerControl
Enables, disables and controls modem speaker behavior.
Takes MODEM_SPEAKER_CONTROL, returns STATUS. Category: modem service request.
#define msgModemSetSpeakerControl MakeMsg(clsModem, 31)
Enum32 (MODEM_SPEAKER_CONTROL) { II Specifies the modem speaker behavior.
mdmSpeakerOn, II Speaker is always on.
mdmSpeakerOff, II Speaker is always off.
mdmSpeakerOnConnectOff II Speaker on until carrier detected (Default).
};
msgModemSetSpeakerVolume
Sets the volume of the modem speaker.
Takes MODEM_SPEAKER_VOLUME, returns STATUS. Category: modem service request.
#define msgModemSetSpeakerVolume MakeMsg(clsModem, 32)
Enum32 (MODEM_SPEAKER_VOLUME) II Specifies the modem speaker volume.
mdmSpeakerVolumeWhisper, II Lowest volume level.
mdmSpeakerVolumeLow, II Low/reasonable volume level.
mdmSpeakerVolumeMedium, II Normal/average volume level (Default).
mdmSpeakerVolumeHigh II Highest volume level.
};
NOTE: Not all modems are capable of adjusting modem speaker volume.
msgModemSetCommandState
Sets the modem into command mode.
Takes nothing, returns STATUS. Category: modem service request.
#define msgModemSetCommandState MakeMsg(clsModem, 33)
msgModemSetDuplex
Sets the duplex mode for inter-modem communications while on-line.
Takes MODElYCDUPLEX_MODE, returns STATUS. Category: modem service request.
#define msgModemSetDuplex MakeMsg(clsModem, 34)
Enum32 (MODEM_DUPLEX_MODE) II Indicates data transmission line duplex.
mdmDuplexHalf, II Data transmitted in one direction at a
II time ( the line must be turned around).
mdmDuplexFull II Data can be transmitted in both
II directions simultaneously (Default).
};
NOTE: Not all modems are capable of setting the duplex once on-line.
msgModemSetMNPMode
Sets the MNP mode of operation.
Takes MODEM_MNP _MODE, returns STATUS. Category: modem service request.
#define msgModemSetMNPMode MakeMsg(clsModem, 35)
432 PENPOINT API REFERENCE
Part 10 / Connectivity
msgModemSetMNPCompression
Sets MNP class 5 compression on or off.
Takes MODEM_MNP_COMPRESSION, returns STATUS. Category: modem service request.
#define msgModemSetMNPCompression MakeMsg(clsModem, 36)
Enum32 (MODEM_MNP_COMPRESSION) { II Type of compression to use in MNP mode.
mdmMNPCompressionOff, II Disable MNP level 5 compression (default).
mdmMNPCompressionOn II Enable MNP level 5 compression.
};
msgModemSetMNPBreakType
Specify how a break is handled in MNP mode.
Takes MODEM_MNP_BREAK_TYPE, returns STATUS. Category: modem service request.
#define msgModemSetMNPBreakType MakeMsg(clsModem, 37)
Enum32 (MODEM_MNP_BREAK_TYPE) { II How breaks are handled in MNP mode.
mdmMNPSendNoBreak, II Do not send break to remote modem.
mdmMNPEmptyBuffersThenBreak,11 Empty data buffers before sending break.
mdmMNPImmediatelySendBreak, II Send break when received (default).
mdmMNPSendBreakInSequence II Send break relative to data to be sent.
};
msgModemSetMNPFlowControl
Specify the flow control to use in MNP mode.
Takes MODEM_MNP_FLOW_CONTROL, returns STATUS. Category: modem service request.
#define msgModemSetMNPFlowControl MakeMsg(clsModem, 38)
Enum32 (MODEM_MNP_FLOW_CONTROL) {II Indicates the flow control for MNP mode.
mdmMNPFlowControlDisable, II No flow control used (default).
mdmMNPFlowControlXonXoff, II Use Xon/Xoff flow control.
mdmMNPFlowControlHardware II Use RTS/cTS flow control.
};
MODEM.H 433
Superclass Messages
Superclass Messages
msgSvcGetMetrics
Passes back the current modem metrics.
Takes P_SVC_GET_SET_METRICS, returns STATUS. Category: superclass message.
Arguments typedef struct MODEM_METRICS {
MODEM DIAL MODE mdrnDialMode;
MODEM- DUPLEX- MODE mdrnDuplexMode;
MODEM SPEAKER CONTROL mdmSpeakerControl;
MODEM SPEAKER VOLUME mdmSpeakerVolume;
MODEM TONE DETECTION mdmToneDetection; ....>-
MODEM- ANSWER- MODE mdmAnswerMode; :>j:
MODEM AUTO ANSWER mdmAutoAnswer;
~
U32 mdmAutoAnswerRings;
MODEM MNP MODE mdmMNPModei
MODEM MNP COMPRESSION mdmMNPCompression;
MODEM- MNP- BREAK- TYPE mdmMNPBreakTypei
MODEM- MNP- FLOW- CONTROL mdmMNPFlowControl;
MODEM~TRICS, *P_MODEM_METRICS;
The pMetrics field of SVC_GET_SET_METRICS is expected to point to a buffer capable of receiving
MODEM_METRICS as described below.
msgSvcSetMetrics
Sets current modem metrics, and re-initializes the modem with specified metrics.
Takes P_SVC_GET_SET_METRICS, returns STATUS. Category: superclass message.
The pMetrics field of SVC_GET_SET_METRICS is expected to point to a buffer containing
MODEM_METRICS as described above.
msgSvcCharactersticsRequested
Passes back the characteristics of the modem service.
Takes P_SVC_CHARACTERISTICS, returns STATUS. Category: superclass message.
#define mdmHWManufactureNameLength 15
#define mdmHWModelNameLength 15
typedef struct { II Modem hardware manufacturer.
CHAR name[mdmHWManufactureNameLength+1]; II Name of manufacturer.
} MODEM_HARDWARE_MANUFACTURER, *P_MODEM_HARDWARE_MANUFACTURER;
typedef struct { II Model of modem hardware.
CHAR name[mdmHWModelNameLength+1];11 Name of model.
} MODEM_HARDWARE_MODEL, *P_MODEM_HARDWARE_MODEL;
Enum32 (MODEM_HARDWARE_FEATURES) { II Modem hardware capabilities.
mdmHWCapAutoDial flagG, II Auto dialing.
mdmHWCapAutoAnswer flag1, II Auto answer.
mdmHWCapAutoBaudDetect flag2, II Auto baud detection.
mdmHWCapCallTypeDiscrimination = flag3, II Call type discrimination
II (Fax, Data, Voice).
mdmHWCapPhoneJackConnectDetect = flag4, II Phone jack connect and
II disconnect event reporting.
mdmHWCapRingSignalMachineWakeUp= flagS II Ring signal detection
II wakes up dormant machines.
};
434 PEN POINT API REFERENCE
Part 10 / Connectivity
Implementors of dsModem services that wish to provide capabilities not described within
MODEM_CHARACTERISTICS should contact GO Corporation to ensure such dsModem enhancements
are standardized and noted within MODEM_CHARACTERISTICS. Thank you.
Class Messages
msgNew
Creates a new instance of a modem service.
Takes P_MODEM_NEW, returns STATUS. Category: class message.
fdefine modemNewFields serviceNewFields
typedef struct MODEM_NEW
{
modemNewFields
MODEM_NEW, *P_MODEM_NEWi
Error Return Values: percolated up from other classes,
msgNewDefaults
Initializes the MODEM_NEW structure to default values.
Takes P_MODEM_NEW, returns STATUS. Category: class message.
Mcu©t.10' typedef struct MODEM_NEW
Avgurn%mts {
modemNewFields
MODEM_NEW, *P_MODEM_NEW;
pArgs->svc.style.autoOption
pArgs->svc.style.exclusiveOpen = true;
pArgs->svc.style.waitForTarget = false;
pArgs->svc.pManagerList = pManagerList;
pArgs->svc.numManagers sizeof(pManagerList)/sizeof(OBJECT);
static OBJECT pManagerList[]
{
theModems II clsModem is one of theModems.
};
MODEM.H 435
Superclass Messages
I. Introduction
In PenPoint, output operations are handled by a special class of services known as the" outbox services."
An outbox service implements the" deferred output" feature in PenPoint: This concept permits a user to
specify output operations regardless of the readiness of output devices. If the output device (e.g., a
printer, a phone plug, a LAN connection, etc.) is not available or not connected, documents waiting for
output will be placed into an "output queue" associated with the output service. (This output queue is a
special section in the system Outbox notebook.) Thus, the actual output process is deferred until the
output device becomes ready.
The concept of enabling or disabling an outbox service also provides a convenient mechanism for the
user to manage an output device that can not automatically determine whether or not it becomes
connected or disconnected. Because the outbox service will not be informed when its target service is
connected or disconnected, its status will always remain "Connected" regardless of the connection status
of the physical device. Such services can be explicitly disabled to prevent documents from being sent to a
device that is not ready for output.
Outbox Documents
The primary focus of an outbox service is to manage its output queue. An output queue is essentially a
collection of documents located in an outbox section. The primary focus of an outbox document is to
manage a single output job.
An outbox document can be any PenPoint document, i.e., an instance of an application inheriting from
clsApp. It can be created, opened, and closed just like a regular page in the notebook. An example of an
outbox document would be an "address envelope" for an electronic mail service.
An outbox document is also responsible for interacting with the outbox service and controlling the
output process, such as sending out an electronic mail message through a communication link. Thus, in
addition to responding to clsApp messages, an outbox document also understand the following
elsO BXService messages:
msgOBXDocOutputStartOK
For details see the description for each message.
OBXSVC.H 439
1. Introduction
have sophisticated output capabilities, and we only need to ensure not to start the output process until
the device is ready. The obvious disadvantage of this approach is that it requires additional memory if we
have to make a copy of the document in order to put it into the outbox.
A third approach represents a compromise between the two. During the first phase of the output
operation, a "surrogate" document, rather than the real one, is copied into the output queue. This
surrogate document not only understands the outbox output protocol, but also knows how to
communicate with the original document. It is effectively a "pointer" back to the original document.
When the output process begins, the surrogate document communicates with the original one to cause
the device-specific data stream to be sent to the correct output port.
Class Messages
msgNewDefaults
Initializes the P_OBXSVC_NEW structure to default values.
Takes P_OBXSVC_NEW, returns STATUS. Category: class message.
typedef struct OBXSVC_NEW_ONLY
OBJECT sectionClass; II class of the outbox section (for output queue)
II This must be clsNBToc or a subclass of it.
U32 unused1;
U32 unused2;
U32 unused3;
OBXSVC_NEW_ONLY, *P_OBXSVC_NEW ONLY;
#define obxServiceNewFields \
ioSvcNewFields \
OBXSVC NEW ONLY ObXSVCi
typedef struct OBXSVC_NEW {
obxServiceNewFields
} OBXSVC_NEW, *P_OBXSVC_NEW;
Zeroes out pArgs->obxsvc and sets ... >iobxsvc.out.autoPoll = true;>obxsvc.sectionClass
clsNBToc;
msgNew
Creates a new outbox service object.
Takes P_OBXSVC_NEW, returns STATUS. Category: class message.
Mesz©ge typedef struct OBXSVC_NEW {
Arguments obxServiceNewFields
OBXSVC_NEW, *P_OBXSVC_NEWi
OBXSVC.H 441
Messages Sent to an Outbox Service Instance
msgOBXSvcSwitchlcon
Toggles the outbox icon (to empty or filled) if neccessary.
Takes nothing, returns STATUS. Category: class message.
#define msgOBXSvcSwitchlcon msgIOBXSvcSwitchlcon
Check the content of the outbox notebook. Show the" filled" icon if any document is found. Show the
"emtpy" icon otherwise.
msgOBXDocGetService
Gets the service name.
Takes P_OBX_DOC_GET_SERVICE, returns STATUS. Category: class message.
#define msgOBXDocGetService msgIOBXDocGetService
Arguments typedef struct OBX_DOC_GET_SERVICE {
OBJECT document; II In: document uid
CHAR svcName[nameBufLength]i II Out: service name
OBX_DOC_GET_SERVICE, *P_OBX_DOC_GET_SERVICE;
Get the name of the service associated with an outbox document. If the document has not been placed
into an outbox section, stsFailed is returned.
Note that the document must be at the top level of an outbox section. That is, if the document is
embedded within another document which is in an outbox section, stsFailed will be returned because
the document is not at the top level of an outbox section.
msgOBXDoclnOutbox
Checks if a document is in a section in the Outbox.
Takes P _OBX_DOC_IN_OUTBOX, returns STATUS. Category: class message.
#define msgOBXDoclnOutbox msgIOBXDoclnIOBox
typedef struct OBX_DOC_IN_OUTBOX
UUID uuid; II In: document uuid
CLASS svcClassi II In: service class to check for
OBX_DOC_IN_OUTBOX, *P_OBX_DOC_IN_OUTBOX;
This message can be sent to clsOBXService to check if a PenPoint document represented by
pArgs->uuid is already in the output queue of an outbox service inheriting from pArgs->svcClass. stsOK
is returned if it is, stsFailed otherwise. If pArgs->svcClass is objNull, stsOK is returned if the document
is anywhere in the Outbox notebook.
msgOBXSvcCopylnDoc
Copies a document into the Outbox section.
Takes P_OBXSVC_MOVE_COPY_DOC, returns STATUS.
#define msgOBXSvcCopyInDoc msgIOBXSvcCopyInDoc
}v't®SSt1gc typedef struct OBXSVC_MOVE_COPY_DOC
Argvmcntti FS_LOCATOR source; II In: Location of source document.
U16 sequence; II In: Sequence number to move/copy in
II front of.
OBXSVC_MOVE_COPY_DOC, *P_OBXSVC_MOVE_COPY_DOC;
Same as msgOBXSvcMovelnDoc, except that the document is copied to the output queue.
msgOBXSvcGetTempDir
Passes back a handle for a temporary directory.
Takes P_OBJECT, returns STATUS.
#define msgOBXSvcGetTempDir msgIOBXSvcGetTempDir
This message is provided for clients who may want ot prepare their output document before moving it
into the output queue. The handle of an "official" temporary directory is passed back and it can be used
as temporary storage for documents, data, etc. Clients are responsible for deleting temporary files when
they are done. The directory will be flushed after a warm boot.
msgOBXSvcNextDocument
Passes back the next document ready for output.
Takes P_OBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
#define msgOBXSvcNextDocument msgIOBXSvcNextDocument
typedef struct OBXSVC DOCUMENT
OBJECT uid; II uid of the doc
OBJECT dir; II app dir of the doc
OBJECT docClass; II class of the doc
U16 sequence; II sequence of the doc
CHAR pName[nameBufLength]; II name of this doc
P UNKNOWN pDocData; II subclass's private data
OBXSVC_DOCUMENT, *P_OBXSVC_DOCUMENT;
Superclass behavior is to start from the top of the output queue and locate the first document ready for
output. If one is found, information about the document is passed back in pArgs. The same pArgs will
be passed to messages msgO BXSvcLockDocument and msgO BXSvcOutputStart. By default, a
document is ready for output when it is closed. If the document is open, it will receive
msgOBXDocOutputStartOK and it should return stsOK to indicate that it is ready for output.
Subclasses can provide their own behavior if they wish. Return stsOBXSvcSectionEmpty to give the
superclass an opportunity to change the outbox icon from filled to empty.
stsOK A document is ready for output.
stsOBXSvcSectionEmpty The output queue is empty.
stsOBXSvcDocNotReady No document in the output queue is ready.
Service-Specific Error Returns.
msgO BXSvcPollDocuments
purposes as well. For example, an outbox service may decide to store a light-weight "shadow" document
(e.g., a report designator for a database application) in the output queue until it is chosen for output.
The service then handles this message by converting the shadow document to a real one (e.g., the actual
report).
The superclass behavior for this message is to stamp the document directory with the filesystem attribute
iobxsvcDocOutputlnProgress. This stamp will prevent any gestures over the document from being
processed. This means that once a document is locked for output it can not be deleted, renamed, etc. via
gestures.
msgOBXSvcUnlockDocument
msgOBXSvcUnlockDocument
Unlocks a document that was previously locked.
Takes P_OBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
#define msgOBXSvcUnlockDocument msgIOBXSvcUnlockDocument
.l\'lesS!lge typedef struct OBXSVC DOCUMENT
AV9t.Jmellfs OBJECT uid; II uid of the doc
OBJECT dir; II app dir of the doc
OBJECT docClass; II class of the doc
U16 sequence; II sequence of the doc
CHAR pName[nameBufLength]; II name of this doc
P_UNKNOWN pDocData; II subclass's private data
OBXSVC_DOCUMENT, *P_OBXSVC_DOCUMENT;
This message is a place holder for subclasses that may require additional "cleanup" work to be
performed on a document before it is put back to the output queue.
The superclass behavior for this message is to remove the iobxsvcDocOutputlnProgress stamp on the
document directory.
msgOBXSvcLockDocument
msgOBXSvcScheduleDocument
Schedules a document that is not ready for output
Takes P_OBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
#define msgOBXSvcScheduleDocument msgIOBXSvcScheduleDocument
Mess©ge typedef struct OBXSVC DOCUMENT
Avglnnel1ts OBJECT uid; II uid of the doc
OBJECT dir; II app dir of the doc
OBJECT docClass; II class of the doc
U16 sequence; II sequence of the doc
CHAR pName[nameBufLength]; II name of this doc
P_UNKNOWN pDocData; II subclass's private data
OBXSVC_DOCUMENT, *P_OBXSVC_DOCUMENT;
This message is sent when msgOBXSvcNextDocument locates a document in the output queue but the
document is not ready for output.
Subclasses should provide their own behavior. The default behavior is to release the ownership of the
target service (i.e., become disabled), with the expectation that the user must manually schedule the
document later on (by re-enabling the section.)
msgOBXSvcNextDocument
OBXSVC.H 445
Messages Sent to an Outbox Service Instance
msgO BXSvcOutputStart
Starts the output process for a document in the output queue.
Takes P_OBXSVC_DOCUMENT, returns STATUS. Category: self-sent.
#define msgOBXSvcOutputStart msgIOBXSvcIOStart
Message typedef struct OBXSVC DOCUMENT
Argitmenf5 OBJECT uidi II uid of the doc
OBJECT diri II app dir of the doc
OBJECT docClassi II class of the doc
U16 sequencei II sequence of the doc
CHAR pName[nameBufLength]i II name of this doc
P_UNKNOWN pDocDatai II subclass's private data
OBXSVC_DOCUMENT, *P_OBXSVC_DOCUMENTi
Superclass behavior is to activate the outbox document if it isn't already active, and then send
msgOBXDocOutputStart to the document instance.
Subclasses can provide their own behavior if they wish.
msgOBXSvcOutputCleanUp
Cleans up after the current output is done.
Takes P_OBX_DOC_OUTPUT_DONE, returns STATUS. Category: self-post ..
#define msgOBXSvcOutputCleanUp msgIOBXSvcIOCleanUp
Enum32 (OBX_DOC_EXIT_BEHAVIOR)
obxDocExitDoNothing 0,
obxDocExitDelete 1,
obxDocExitMarkAsFailed 2,
obxDocExitMarkAsCancelled 3
}i
typedef struct OBX_DOC_OUTPUT_DONE {
OBX_DOC_EXIT_BEHAVIOR behaviori II exit behavior
P UNKNOWN pDocData; II Unused: document specific data
OBX_DOC_OUTPUT_DONE, *P_OBX_DOC_OUTPUT_DONE;
This message is posted to self as a result of the service receiving msgO BXDocOutputDone, which is
sent by the outbox document when it finishes the output operation. The outbox document will be
either deleted or marked as specified in pArgs, and when everything is properly cleaned up the service
will post msgOBXSvcPollDocuments to self to see if anything else is waiting for output.
Subclasses do not normally process this message.
msgOBXDocOutputDone
446 PENPOINT API REFERENCE
Part 10 I Connectivity
msgOBXSvcStateChanged
Tells observers that the service state just changed.
Takes OBJECT, returns STATUS. Category: observer notification ..
tdefine msgOBXSvcStateChanged msgIOBXSvcStateChanged
Informs observers that the state of a service has just changed. pArgs is the UID of the service.
msgOBXSvcQueryState
Passes back the state of the service.
Takes P _OBXSVC_QUERY_STATE, returns STATUS.
tdefine msgOBXSvcQueryState msgIOBXSvcQueryState
typedef struct
BOOLEAN enabled; II
true if the service is enabled.
CHAR status [nameBuf Length]; II
text describing the status of
II
the service.
CHAR docName[nameBufLength]; II
document being processed
P UNKNOWN pStateData; II
subclass's private data
OBXSVC QUERY_STATE, *P_OBXSVC_QUERY_STATE;
This message is typically used to query what state the service instance is in.
msgOBXSvcGetEnabled
Gets the enabled state of the service.
Takes P _BOOLEAN, returns STATUS.
tdefine msgOBXSvcGetEnabled msgIOBXSvcGetEnabled
Subclasses can override this message and redefine the notion of" enabled." The default behavior of the
superclass is to equate "enabled" with the ownership of the target service (i.e., output device). That is,
the service is "enabled" when it owns the target service. By appending to or replacing the default
behavior, a subclass can define additional conditions which must be met before a service is considered
enabled.
msgOBXSvcSetEnabled
Sets the enabled state of the service.
Takes BOOLEAN, returns STATUS.
tdefine msgOBXSvcSetEnabled msgIOBXSvcSetEnabled
This message is sent to the service in response to service notification messages msgSvcOwnerAcquired
and msgSvcOwnerReleased. Subclasses can provide their own behavior and thereby redefine the notion
of" enabled" for the service. If they do, they must pass this message up to the ancestor so that observers
of the outbox service will be properly notified.
OBXSVC.H 447
Outbox Document Messages
msgOBXDocOutputStartOK
Asks the outbox document if it is OK to start the output process
Takes nothing, returns STATUS.
#define msgOBXDocOutputStartOK msgIOBXDocIOStartOK
When an outbox service finds an opened document in the outbox section, it sends this message to the
document instance, asking whether it's OK to start the output operation while the document remains
open. When the document receives this message, it should return stsO K to give the service permission
to begin the output process. An error status, including stsNotUnderstood, is taken to mean that the
document instance vetos the request and the service will not start the output process.
\
msgOBXDocOutputStart
Tells an outbox document to start the output process.
Takes nothing, returns STATUS.
#define msgOBXDocOutputStart msgIOBXDocIOStart
This message is sent by the outbox service to a document. The document should respond to this
message by starting the output process.
msgOBXDocOutputDone
Tells the outbox service that output is finished.
Takes P_OBX_DOC_OUTPUT_DONE, returns STATUS. Category: client responsibility.
#define msgOBXDocOutputDone msgIOBXDocIODone
tv"iess©ge typedef struct OBX_DOC_OUTPUT_DONE {
A~t9U~nent5 OBX DOC EXIT BEHAVIOR behavior; II exit behavior
P UNKNOWN pDocData; II Unused: document specific data
OBX_DOC_OUTPUT_DONE, *P_OBX_DOC_OUTPUT_DONE;
When the output process is finished, the outbox document in charge of the output should send this
message to the outbox service. This message must be sent even if the output process has been aborted.
The pArgs for this message tells the outbox service what to do with the outbox document. If
obxDocExitDelete is specified, the document will be removed from the outbox. In all other cases the
document will be unlocked and left in the outbox. If either obxDocExitMarkAsCancelled or
obxDocExitMarkAsFailed are specified, the name of the document will be altered to provide visual
indication for the user that the output process has not completed successfully.
msgOBXDocGetService
msgOBXDocOutputCancel
Tells an outbox document to cancel the output process.
Takes nothing, returns STATUS.
#define msgOBXDocOutputCancel msgIOBXDocIOCancel
448 PENPOINT API REFERENCE
Part 10 / Connectivity
This message is used by the outbox service to inform a document that it should cancel the output
process. The document should handle this message by terminating its output operation and then
sending msgOBXDocOutputDone to the service with pArgs->behavior set to
obxDocExistMarkAsCancelled.
msgOBXDocStatusChanged
Tells the outbox service that the document status is changed.
Takes P_OBX_DOC_STATUS_CHANGED, returns STATUS. Category: client responsibility.
#define msgOBXDocStatusChanged msgIOBXDocStatusChanged
typedef struct OBX_DOC_STATUS_CHANGED
CHAR status [nameBufLength]; II Text describing document state
P_UNKNOWN pDocData; II Unused: document-specific data
OBX_DOC_STATUS_CHANGED, *P_OBX_DOC_STATUS_CHANGED;
This message is sent by the outbox document to the service whenever its status has just changed. This
status is displayed on Status column for the outbox section, in the Outbox notebook.
OPENSERV.H
Messages
msgNew
Creates a new service object.
Takes P_0 SO_NEW, returns STATUS. Category: class message.
typedef struct OSO NEW ONLY
OBJECT serviceInstancei II This is filled in by
II clsService at open time.
U32 unused1i
U32 unused2i
U32 unused3i
U32 unused4i
OSO_NEW_ONLY, *P_OSO_NEW_ONLY, OSO_METRICS, *P_OSO_METRICSi
#define openServiceObjectNewFields \
streamNewFields \
OSO NEW ONLY openServiceObjecti
typedef struct OSO_NEW
openServiceObjectNewFields
} OSO_NEW, *P_OSO_NEWi
msgOSOGetServicelnstance
Returns the service instance that this object is associated with.
Takes P_OBJECT, returns STATUS.
#define msgOSOGetServiceInstance MakeMsg(clsOpenServiceObject, 1)
PPORT.H
-------------------,
452 PENPOINT API REFERENCE
Part 10 / Connectivity
msgPPortStatus
returns the current hardware status of the printer.
Takes P_PPORT_STATUS, returns STATUS.
#define msgPPortStatus MakeMsg(clsParallelPort, 3)
#define pportStsBusy flag7 II printer is busy
#define pportStsAcknowledge flag6 II printer acknowledged char.
#define pportStsEndOfPaper flagS II printer out of paper
#define pportStsSelected flag4 II printer on line
#define pportStsIOError flag3 II printer error occurred
#define pportStsInterruptHappened flag2 II printer interrupt occurred
typedef struct PPORT_STATUS
{
U16 pportStatusi
PPORT_STATUS, *P_PPORT_STATUSi
'pportStatus' is the contents of the parallel port status register.
msgPPortStatus
initializes the printer.
Takes P _NULL, returns STATUS.
#define msgPPortInitialize MakeMsg(clsParallelPort, 4)
The printer is initialized by asserting the control"Initialize" to the printer for initDelay microseconds.
msgPPortAutoLineFeedOn
inserts a line feed after each carriage return.
Takes P _NULL, returns STATUS.
#define msgPPortAutoLineFeedOn MakeMsg(clsParallelPort, 5)
The auto line feed signal to the printer is set active.
msgPPortAutoLineFeedOff
disables inserting a line feed after each carriage return.
Takes P _NULL, returns STATUS.
#define msgPPortAutoLineFeedOff MakeMsg(clsParallelPort, 6)
The auto line feed signal to the printer is set inactive.
msgPPortGetTimeDelays
gets the initialization and interrupt time out intervals.
Takes P_PPORT_TIME_DELAYS, returns STATUS.
#define msgPPortGetTimeDelays MakeMsg(clsParallelPort, 7)
typedef struct PPORT TIME DELAYS
{
U32 initDelaYi II initialization delay
U32 interruptTimeOuti II interrupt time out
PPORT_TIME_DELAYS, *P_PPORT_TIME_DELAYSi
PPORT.H 453
Parallel Port Class Messages
The initialization time period is the time the initialization pulseasserted to the printer in microseconds.
The interrupt time outis the maximum time the printer will assert busy before beingto accept
another character in milliseconds.
msgPPortSetTimeDelays
sets the initialization and interrupt time out intervals.
Takes P_PPORT_TIME_DELAYS, returns STATUS.
#define msgPPortSetTimeDelays MakeMsg(clsParallelPort, 8)
Mess(lge typedef struct PPORT TIME DELAYS
Arguments {
U32 initDelay; II initialization delay
U32 interruptTimeOut; II interrupt time out
PPORT TIME_DELAYS, *p PPORT_TIME_DELAYS;
Neither value can be zero. It's best to get the presentbefore changing the time intervals.
msgPPortCancelPrint
cancels the printing of the buffer currently being printed.
Takes P_NULL, returns STATUS.
#define msgPPortCancelPrint MakeMsg(clsParallelPort, 9)
msgNew
creates a new pport object.
Takes P_PPORT_NEW, returns STATUS.
#define pportNewFields \
milServiceNewFields
typedef struct PPORT_NEW
pportNewFields
} PPORT_NEW, *P_PPORT_NEW;
STATUS EXPORTED ClsParallelPortInit(void);
SENDSERV.H
This file contains the class definition and methods for clsSendableService.
clsSendableService inherits from clsService.
Provides the API for the services which appear on the Document Send menu.
clsSendableService is an abstract superclass which defines the sendable services protocol. This protocol is
used by the Send Manager and the address book to interact with services on theSendableServices service
manager. All services on this list *must* implement this protocol.
#ifndef SENDSERV_INCLUDED
#define SENDSERV_INCLUDED
#ifndef ADDRBOOK_INCLUDED
#include <addrbook.h>
#endif
Messages
msgSendServCreateAddrWin
Converts address data into a window displaying the data.
Takes P_SEND_SERV_ADDR_WIN, returns STATUS.
#define msgSendServCreateAddrWin MakeMsg(clsSendableService, 1)
typedef struct SEND_SERV_ADDR_WIN
U16 nurnAttrs;
P_ADDR_BOOK_AT.TR attrs;
P STRING addrSummary;
BOOLEAN errNote;
OBJECT win;
SEND_SERV_ADDR_WIN, *P_SEND_SERV_ADDR_WIN;
This message is sent to a sendable service by the address book. A sendable service should create a display
window(pArgs->win). The sendable service should wait for msgSendServFillAddrWin before it fills in
the fields in the window.
Parameters:
pArgs->numAttrs In: number of attributes in the attrs array.
pArgs->attrs In: an array of size pArgs->numAttrs. pArgs->attrs[x] .value contains what the sendable
service needs to display.
pArgs->win Out: sendable-service-created display window.
456 PEN POINT API REFERENCE
Part 10 / Connectivity
msgSendServGetAddrSummary
given pArgs->attrs, set pArgs->addrSummary to be a displayable string that sums up the address.
Takes P_SEND_SERV_ADDR_WIN, returns STATUS.
#define msgSendServGetAddrSummary MakeMsg(clsSendableService, 9)
Mellsctge typedef struct SEND SERV ADDR WIN
Arguments U16 - nUmAttrs;
P_ADDR_BOOK_ATTR attrs;
P STRING addrSummary;
BOOLEAN errNote;
OBJECT win;
SEND_SERV_ADDR_WIN, *P_SEND_SERV_ADDR_WIN;
Parameters:
pArgs->numAttrs In: number of attributes in the attrs array.
pArgs->attrs In: an array of size pArgs->numAttrs.
pArgs->addrSummary Out: a string that sums up the address information described in attribute-value
form in pArgs->attrs.
msgSendServFillAddrWin
Sendable service refreshes pArgs->win with information in pArgs->attrs.
Takes P_SEND_SERV_ADDR_WIN, returns STATUS.
#define msgSendServFillAddrWin MakeMsg(clsSendableService, 8)
)\'l,,)Sllct£jl;'\ typedef struct SEND SERV ADDR WIN
Argurnent£ U16 - nUmAttrs;
P_ADDR_BOOK_ATTR attrs;
P STRING addrSummary;
BOOLEAN errNote;
OBJECT win;
SEND_SERV_ADDR_WIN, *P_SEND_SERV_ADDR_WIN;
An address book sends a sendable service this message to refresh the window that contains information
described in pArgs->attrs.
Parameters:
pArgs->numAttrs In: number of attributes in the attrs array. If 0, then dear all fields.
pArgs->attrs In: an array of size pArgs->numAttrs. pArgs->attrs[x].value contains what the sendable
service needs to display.
pArgs->win In: uid of sendable-service-created display window.
msgSendServEncodeAddrWin
Converts a window which displays address data into data.
Takes P_SEND_SERV_ADDR_WIN, returns STATUS.
#define msgSendServEncodeAddrWin MakeMsg(clsSendableService, 2)
Mellsctge typedef struct SEND SERV ADDR WIN
Arguments U16 - numAttrs;
P_ADDR_BOOK_ATTR attrs;
P STRING addrSummary;
BOOLEAN errNote;
OBJECT win;
SEND_S ERV_ADDR_W IN , *P_SEND_SERV_ADDR_WIN;
SENDSERV.H 457
Messages
Comments The service must convert the window into an array of attribute-values, as described in
ADDR_BOOK_SERVICE_DESC. Storage for this array should be created by the sendable service from a
global heap. The caller client is responsible for freeing this storage.
Parameters:
pArgs->numAttrs Out: Number of elements in the .attrs array
pArgs->attrs Out: fill in the values of each attribute.
pArgs->errNote In: if TRUE, then the service should display some kind of note on the screen when
error occurs during data collection and validation.
pArgs->win In: the window to get the data from. Presumably the sendable service created this window
in response to a previous msgSendServCreateAddrWin.
stsServiceDataWinEmpty All data element fields are empty.
stsFailed Some error occurs during data collection and validation.
msgSendServEncodeAddrData
Converts serrvice-specific data into ASCII byte array.
Takes P_SEND_SERV_CONVERT_ADDR_DATA, returns STATUS.
*define msgSendServEncodeAddrData MakeMsg(clsSendableService, 3)
Arguments typedef struct SEND SERV CONVERT ADDR DATA
P U8 - pBuf; / / In/Out: Encoded addressing data
U16 bufLen; // In/Out: Length of pBuf
U16 numAttrs;
P_ADDR_BOOK_ATTR attrs;
SEND_SERV_CONVERT_ADDR_DATA, *P_SEND_SERV_CONVERT_ADDR_DATA;
*** This message is obsolete ***
The service converts attributes in .attrs into ASCII. Storage for this array should be created by the
service from osProcessSharedHeapld. The caller is responsible for freeing this storage.
stsServiceDataWinEmpty All data element fields are empty.
msgSendServDecodeAddrData
Converts ASCII data into service-specific data.
Takes P_SEND_SERV_CONVERT_ADDR_DATA, returns STATUS.
*define msgSendServDecodeAddrData MakeMsg(clsSendableService, 4)
Message typedef struct SEND_SERV CONVERT_ADDR_DATA
Arguments P U8 pBuf; // In/Out: Encoded addressing data
U16 bufLen; // In/Out: Length of pBuf
U16 numAttrs;
P ADDR BOOK ATTR attrs;
SEND_SERV_CONVERT_ADDR_DATA, *P_SEND SERV_CONVERT_ADDR DATA;
Comments *** This message is obsolete ***
The resulting data is put into .attrs and update the attribute count in .numAttrs.
458 PEN POINT API REFERENCE
Part 10 / Connectivity
msgAppExecute
Displays a VI for obtaining addressing info and executing the send.
Takes P _APP_EXECUTE, returns STATUS.
This message is a standard clsApp message which is forwarded to the service the user has selected from
the standard "Send" menu. The service should create and display their VI for obtaining addressing
information from the user.
Declaration for the APP_EXECUTE data structure can be found in app.h
msgSendServGetAddrDesc
Responsibility of a sendable service to return its service attribute-value pairs that describe its service
address
Takes P _ADDR_BOOK_SVC_DESC, returns STATUS.
#define msgSendServGetAddrDesc MakeMsg(clsSendableService, 7)
An address book usually send this message to a sendable service as part of of initialization to find out the
service address description.
SERLINK.H
This file contains the definition and methods for clsALAPSerial
*ifndef SERLINK_INCLUDED
*define SERLINK_INCLUDED
ALAP_SERIAL_NEW_ONLY, *P_ALAP_SERIAL_NEW_ONLY;
#define alapSerialNewFields \
serviceNewFields \
ALAP_SERIAL_NEW_ONLY alapSerial;
ALAP SERIAL NEW, *p ALAP_SERIAL_NEW;
STATUS EXPORTED ClsSerLinkInit(void);
SIO.M
This file contains the API for clsMlLAsyncSIODevice.
clsMlLAsyncSIODevice inherits from clsStream.
Provides the serial port interface, see also stream.h for the stream messages.
#ifndef SIO INCLUDED
#define SIO INCLUDED
#include <go.h>
#include <clsmgr.h>
#include <milserv.h>
msgSioLineControlSet
Sets serial port data bits per character, stop bits, and parity.
Takes P_SIO_LINE_CONTROL_SET, returns STATUS.
#define msgSioLineControlSet MakeMsg(clsMILAsyncSIODevice,5)
Enum16 (SIO_DATA_BITS)
sioSixBits = 6,
sioSevenBits 7,
sioEightBits = 8
};
Enum16 (SIO_STOP_BITS)
sioOneStopBit = 0,
sioOneAndAHalfStopBits 1,
sioTwoStopBits 2
};
Enum16 (SIO_PARITY)
sioNoParity = 0,
sioOddParity = 1,
sioEvenParity = 2
};
typedef struct (
SIO DATA BITS dataBits;
SIO STOP BITS stopBits;
SIO PARITY parity;
SIO LINE CONTROL_SET, *P_SIO_LINE_CONTROL SET;
Default setting 8 bits, 1 stop bit, no parity.
msgSioControlOutSet
Controls serial port output lines dtr and rts.
Takes P_SIO_CONTROL_OUT_SET, returns STATUS.
#define msgSioControlOutSet MakeMsg(clsMILAsyncSIODevice,6)
Atgmntmtrs typedef struct
BOOLEAN dtr; II true activates, false deactivates
BOOLEAN rts; II true activates, false deactivates
BOOLEAN out1; II true activates, false deactivates
BOOLEAN out2; II true activates, false deactivates
SIO- CONTROL-OUT SET, *P_SIO_CONTROL_OUT_SET;
-
Default setting dtr active, rts active.
msgSioControllnStatus
Reads the current state of the serial port input control lines.
Takes P_SIO_CONTROL_IN_STATUS, returns STATUS.
#define msgSioControlInStatus MakeMsg(clsMILAsyncSIODevice,7)
f4cgvmefttrs typedef struct
BOOLEAN cts; II out - true = active (Clear To Send)
BOOLEAN dsr; II out - true = active (Data Set Ready)
BOOLEAN dcd; II out - true = active (Data Carrier Detect)
BOOLEAN ri; II out - true = active (Ring Indicator)
SIO- CONTROL- IN_STATUS, *p- SIO_CONTROL_IN_STATUS;
#define rlsd dcd
SIO.H 463
msgSioFlowControlCharSet
Defines serial port XONIXOFF flow control characters.
Takes P _SIO_FLOW_CONTROL_CHAR_SET, returns STATUS.
*define msgSioFlowControlCharSet MakeMsg(clsMILAsyncSIODevice,8)
typedef struct {
U8 xonChar; II xon character (default control-Q)
U8 xoffChar; II xoff character (default control-S)
SIO_FLOW_CONTROL_CHAR_SET, *P_SIO_FLOW_CONTROL_CHAR_SET;
Valid only if xon-xoff flow control is enabled.
Default xon character Oxll (control-q), default xoff character Oxl3 (control-s).
msgSioBreakSend
Sends a break for the specified duration.
Takes P_SIO_BREAK_SENO, returns STATUS.
*define msgSioBreakSend MakeMsg(clsMILAsyncSIODevice,ll)
typedef struct {
OS_MILLISECONDS milliseconds; II break duration
} SIO_BREAK_SEND, *P_SIO_BREAK_SEND;
Constant O's transmitted on the serial line for the specified duration. Typical duratio~s are around
200-400 milliseconds).
msgSioBreakStatus
Sends back the number of breaks received so far.
Takes P _SIO_BREAK_SfATUS, returns SfATUS.
*define msgSioBreakStatus MakeMsg(clsMILAsyncSIODevice,13)
typedef struct {
U32 breaksReceived; II out
} SIO_BREAK_STATUS, *P_SIO_BREAK_STATUS;
Also clears the internal break counter.
msgSioReceiveErrorsStatus
Sends back the number of receive errors and the number of dropped bytes (due to buffer overflows).
Takes P_SIO_RECElVE_ERRORS_STATUS, returns STATUS.
*define msgSioReceiveErrorsStatus MakeMsg(clsMILAsyncSIODevice,36)
typedef struct {
U32 droppedBytes; II out
U32 receiveErrors; II out
SIO_RECEIVE_ERRORS_STATUS, *P_SIO_RECEIVE_ERRORS_STATUS;
Also clears the internal counters.
464 PENPOINT API REFERENCE
Part 10 I Connectivity
msgSiolnputBufferStatus
Provides input buffer status.
Takes P_SIO_INPUT_BUFFER_STATUS, returns STATUS.
tdefine msgSiolnputBufferStatus MakeMsg(clsMlLAsyncSIODevice,16)
typedef struct {
U32 bufferCharSi II out, number of chars in buffer
S32 bufferRoomi II out, amount of empty room in buffer
BOOLEAN receiverFrozen; II out, is receive frozen?
SIO_INPUT_BUFFER_STATUS, * P_SIO_INPUT_BUFFER_STATUSi
Sends back the number of characters in the input buffer and the amount of empty room in the input
buffer.
msgSioOutputBufferStatus
Provides output buffer status.
Takes P _SIO _OUTPUT_BUFFER_STATUS, returns STATUS.
tdefine msgSioOutputBufferStatus MakeMsg(clsMlLAsyncSIODevice,17)
typedef struct {
U32 bufferCharsi II out, number of chars in buffer
S32 bufferRoomi II out, amount of empty room in buffer
BOOLEAN transmitterFrozeni II out, is transmit frozen?
SIO_OUTPUT_BUFFER_STATUS, * P_SIO_OUTPUT_BUFFER_STATUSi
Sends back the number of characters in the output buffer and the amount of empty room in the output
buffer.
msgSiolnputBufferFlush
Flushes the contents of the input buffer.
Takes pNull, returns STATUS.
tdefine msgSiolnputBufferFlush MakeMsg(clsMlLAsyncSIODevice,18)
msgSioOutputBufIerFlush
Flushes the contents of the output buffer.
Takes pNull, returns STATUS.
tdefine msgSioOutputBufferFlush MakeMsg(clsMILAsyncSIODevice,19)
msgSioFlowControlSet
Selects flow control type.
Takes P_SIO_FLOW_CONTROL_SET, returns STATUS.
tdefine msgSioFlowControlSet MakeMsg(clsMILAsyncSIODevice,20)
SIO.H 465
Enum16(SIO_FLOW_TYPE) {
sioNoFlowControl Oxll,
sioXonXoffFlowControl Ox22,
sioHardwareFlowControl Ox44,
II To independently set receive and transmit flow control OR together
II one from each of the following two sets.
II i.e., .flowControl = sioRxXonXoff I sioTxHardwarei
II YOU MUST SET BOTH THE TX AND RX FLOW CONTROL!
II Transmit flow control
sioTxNone OxOl,
sioTxXonXoff Ox02,
sioTxHardware Ox04,
II Receive flow control
sioRxNone OxlO,
sioRxXonXoff Ox20,
sioRxHardware Ox40
}i
typedef struct {
SIO FLOW TYPE flowControli
} SIO_FLOW_CONTROL_SET, *P_SIO_FLOW_CONTROL_SETi
Flow control types: no flow control, XON/XOFF flow control, or hardware flow control. Default:
XON/XOFF flow control.
msgSioEventStatus
Sends back current state of event word, and then clears the event word.
Takes P_SIO_EVENT_STATUS, returns STATUS.
#define msgSioEventStatus MakeMsg (clsMILAsyncSIODevice, 21)
typedef struct {
SIO_EVENT_MASK eventMaski II out
} SIO_EVENT_STATUS, *P_SIO_EVENT_STATUSi
Bit set indicates an event has occurred. Events do not have to be enabled for eventMask to be set.
msgSioEventSet
Enables event notification.
msgSioEventGet
Gets the current sio event setting.
Takes P_SIO_EVENT_SET, returns STATUS.
#define msgSioEventGet MakeMsg(clsMILAsyncSIODevice,29)
466 PEN POINT API REFERENCE
Part 10 / Connectivity
msgSioEventHappened
Notifies client of event occurance.
Takes P_SIO_EVENT_HAPPENED, returns STATUS.
#define msgSioEventHappened MakeMsg(clsMILAsyncSIODevice,23)
typedef struct {
SIO_EVENT_MASK eventMask; II out, bits set indicate event happened.
OBJECT selfi II object which generated message.
SIO EVENT_HAPPENED, *p SIO EVENT_HAPPENED;
Message sent to object to notify it of event occurrance. Possibly, more than one bit will be set in the
event mask (bits may be set from disabled events, although disabled events never cause this message to
be generated. Clears event mask.
msgSiolnit
Initializes the serial device to its default state.
Takes P_SIO_INIT, returns STATUS.
#define msgSioInit MakeMsg(clsMILAsyncSIODevice,26)
typedef struct {
U32 inputSize; II size of the input buffer
U32 outputSize; II size of the output buffer
SIO_INIT, *p SIO_INIT;
msgSioGetMetrics
Sends back the sio metrics.
Takes P_SIO_METRICS, returns STATUS.
#define msgSioGetMetrics MakeMsg(clsMILAsyncSIODevice,24)
typedef struct {
U32 baud; II out/in
SIO LINE CONTROL SET line; II out/in
SIO- CONTROL- OUT
-SET controlOut; II out/in
SIO- FLOW- CONTROL- CHAR
-SET flowChari II out/in
SIO- FLOW- CONTROL- SET flowType; II out/in
II
II Changing the bufferSize fields causes reinitialization of serial
II chip!
SIO INIT bu:fferSize; II out/in
U8 spare[12]i
msgSioSetMetrics
Sets the sio metrics.
Takes P_SIO_METRICS, returns STATUS.
#define msgSioSetMetrics MakeMsg(clsMILAsyncSIODevice,25)
SIO.H 467
msgSioSetReplaceCharProc
Replaces the built in receive character interrupt routine.
Takes P_SIO _REPLACE_CHAR, returns STATUS.
#define msgSioSetReplaceCharProc MakeMsg(clsMILAsyncSIODevice, 72)
U32 handle);
typedef struct SIO_REPLACE_CHAR
{
P_SIO_CHAR_HANDLER pRxHandler; II
address of character handler
U32 handle; II
user data (meaningless to
II
clsMILAsyncSIO)
SIO REPLACE_CHAR, *P_SIO_REPLACE_CHAR;
This message calls the user defined function when a character is received. The procedure has the option
to filter the character or to return and have the character processed normally. The user defined fuction
returns a BOOLEAN indicating whether the function filtered the character or not.
msgNew
Creates a new clsMlLAsyncSIODevice object.
Takes P_SIO_NEW, returns STATUS.
typedef struct SIO_NEW
{
milServiceNewFields
SIO_NEW, *P_SIO_NEW;
Function prototypes
FiJndl©Ti Pr©t©type STATUS EXPORTED ClsSiolni t (void) ;
void EXPORTED SioSernaClear(P_UNKNOWN pHandle);
TP.H
This file contains the class definition and methods for clsTransport.
clsTransport inherits from clsOpenServiceObject.
Provides the API for replaceable transport layer network protocols.
#ifndef TP INCLUDED
#define TP INCLUDED
#ifndef OPENSERV INCLUDED
#include <openserv.h>
#endif
Common typedefscodetypedef U8 TP_SERVICE;
typedef UB TP_QUEUE_SIZEi
typedef UB TP_ADDRESS, * P_TP_ADDRESS;
typedef UB TP_OPTIONS, * P_TP_OPTIONS;
typedef UB TP_BUFFER, * P_TP_BUFFERi
Service Types
#define tpReliableService 1
#define tpDatagramService 2
#define tpTransactionService 3
msgNew
Creates a transport (socket) handle object.
Takes P_TP_NEW, returns STATUS.
typedef struct TP_NEW_ONLY {
TP SERVICE service; II service type
} TP_NEW_ONLY, *P_TP_NEW_ONLYi
typedef struct TP_NEW (
OSO NEW oso;
TP NEW ONLY tp;
TP NEW, * P TP_NEW;
msgDestroy
Destroys a transport handle object.
Takes OBLKEY, returns STATUS.
msgTPAccept
Accepts a connection request from a remote process.
Takes P_TP_ACCEPT, returns STATUS.
#define msgTPAccept MakeMsg( clsTransport, 1 )
typedef struct TP_ACCEPT {
OBJECT newHandlei II Out: uid of transport handle
P TP ADDRESS pAddressi II ptr to protocol dependent address
TP_ACCEPT, *P_TP_ACCEPT;
470 PEN POINT API REFERENCE
Part 10 / Connectivity
msgTPBind
Binds a transport handle to a transport address.
Takes P _ TP_BIND, returns STATUS.
tdefine msgTPBind MakeMsg( clsTransport, 2 )
typedef struct TP_BIND {
P_TP_ADDRESS pAddressi II ptr to protocol dependent address
} TP_BIND, *P_TP_BINDi
msgTPConnect
Establishes a connection with a remote process.
Takes P_ TP_CONNECT, returns STATUS.
tdefine msgTPConnect MakeMsg( clsTransport, 3 )
typedef struct TP_CONNECT {
P TP ADDRESS pAddressi II ptr to protocol dependent address
} TP_CONNECT, *P_TP_CONNECTi
msgTPListen
Allocates space for a queue of incoming connection requests.
Takes P _TP _LISTEN, returns STATUS.
tdefine msgTPListen MakeMsg( clsTransport, 4 )
typedef struct TP_LISTEN {
TP_QUEUE_SIZE queueSizei II max number of connection requests
} TP_LISTEN, *P_TP_LISTEN;
msgTPRecv
Receives a message.
Takes P _TP_RECV, returns STATUS.
tdefine msgTPRecv MakeMsg( clsTransport, 5
typedef struct TP_RECV {
P TP BUFFER pBufferi II ptr to receive data buffer
U16 length; II size of receive buffer in bytes
U16 count; II number of bytes received
P TP OPTIONS pOptionsi II ptr to protocol dependent options
TP RECV, *P_TP_RECV;
msgTPRecvFrom
Receives a datagram.
Takes P _TP _RECVFROM, returns STATUS.
tdefine msgTPRecvFrom MakeMsg( clsTransport, 6 ).
typedef struct TP_RECVFROM {
P_TP_BUFFER pBuffer; II ptr to receive data buffer
U16 length; II size of receive buffer in bytes
U16 counti II number of bytes received
P TP ADDRESS pAddressi II ptr to protocol dependent address
P TP OPTIONS pOptionsi II ptr to protocol dependent options
TP_RECVFROM, *P_TP_RECVFROMi
TP.H 471
msgTPSend
Sends a message.
Takes P_TP_SEND, returns STATUS.
#define msgTPSend MakeMsg( clsTransport, 7 )
typedef struct TP SEND {
P TP BUFFER pBuffer; II ptr to send data buffer
U16 count; II number of bytes to send
P TP OPTIONS pOptions; II ptr to protocol dependent options
TP SEND, *P_TP_SEND;
msgTPSendfo
Sends a datagram.
Takes P_TP _SENDTO, returns STATUS.
#define msgTPSendTo MakeMsg( clsTransport, 8 )
typedef struct TP SENDTO {
P TP BUFFER pBuffer; II ptr to send data buffer
U16 count; II number of bytes to send
P TP OPTIONS pOptions; II ptr to protocol dependent options
P TP ADDRESS pAddress; II ptr to protocol dependent address
TP SENDTO, *P_TP_SENDTO;
msgTPSendRecvTo
Sends a request and waits for a response. For transaction service only.
Takes P_TP_SENDRECvrO, returns STATUS.
#define msgTPSendRecvTo MakeMsg( clsTransport, 9 )
Arguments typedef struct TP SENDRECVTO {
P TP BUFFER pSendBuffer; II ptr to send data buffer
U16 sendCount; II number of bytes to send
P TP BUFFER pRecvBuffer; II ptr to receive data buffer
U16 recvLength; II size of receive buffer in bytes
U16 recvCounti II number of bytes received
P TP OPTIONS
- pOptionsi II ptr to protocol dependent options
P TP ADDRESS pAddressi II ptr to protocol dependent address
TP_SENDRECVTO, *p_TP_SENDRECVTOi
Status Codes
#define stsTPnotSupported MakeStatus(clsTransport,l)
#define stsTPtooMany MakeStatus(clsTransport,2)
#define stsTPbadUser MakeStatus(clsTransport,3)
#define stsTPmaxUsers MakeStatus(clsTransport,4)
#define stsTPnoUser MakeStatus(clsTransport,5)
#define stsTPbadService MakeStatus(clsTransport,6)
#define stsTPnoSocket MakeStatus(clsTransport,7)
#define stsTPnoMemory MakeStatus(clsTransport,8)
#define stsTPlength MakeStatus(clsTransport,9)
#define stsTPnoTransaction MakeStatus(clsTransport,lO)
#define stsTPddpLength MakeStatus(clsTransport,ll)
#define stsTPnoBridge MakeStatus(clsTransport,12)
#define stsTPbadNetwork MakeStatus(clsTransport,13)
#define stsTPbadNode MakeStatus(clsTransport,14)
#define stsTPsocketInUse MakeStatus(clsTransport,15)
#define stsTPpending MakeStatus(clsTransport,16)
472 PEN POINT API REFERENCE
Part 10 / Connectivity
Next up: 28
This file contains the API definition for clsPreferences.
clsPreferences inherits from clsObject.
clsPreferences provides a shell to access system preferences.
theSystemPreferences is a well-known instance of clsPreferences. theSystemPreferences provides access
to read and write system wide preferences.
clsPreferences supports a set of preferences. Preferences are stored as resources in the "current" system
preferences resource file. An instance of clsPreferences, known as theSystemPreferences, is created at
boot time. This should be the only instance of clsPreferences in the system.
Preferences are named by well known resource id's (RES_ID's). This header file contains some predefined
preference id's to simplify things. When defining new preferences, use the class that originated the
preferences.
Clients can get and set preferences by accessing the well known object theSystemPreferences.
Preferences are stored in a resource file. Any request to read or write a preference will force a read or
write to a file. This minimizes the amount of space required to store preferences. theSystemPreferences
will respond to any resource file messaged defined in resfile.h and process them appropriately.
Remember, to read and write system preferences simply use the messages msgResReadData and
msgResWriteData (or msgResUpdateData). theSystemPreferences forwards the msg to the current
system preferences resource file.
As an example of reading a system preference:
U16 lineHeight;
RES_READ_DATA read;
read.resld = prLineHeight;
read. heap = 0;
read.pData = &lineHeight;
read.length = SizeOf(U16);
ObjectCall(msgResReadData, theSystemPreferences, &read);
An example of writing a system preference:
U16 lineHeight;
RES_WRITE_DATA write;
write.resld = prLineHeight;
write.pData = &lineHeight;
write.length = SizeOf(U16);
write.agent = resDefaultResAgent;
ObjectCall(msgResWriteData, theSystemPreferences, &write);
theSystemPreferences "knows" about certain preferences (listed in this file below) and performs
whatever interaction is required to activate the new preference. It also handles certain system wide
notification and actions when certain preferences change. For example, clsPreferences will cause the
system to be re-drawn and re-fonted when the system preference for the font changes.
476 PENPOINT API REFERENCE
Part 11 I Resources
dsPreferences will notify all observers when a preference has (potentially) changed. This will allow
various objects to observe theSystemPreferences, and react to the preference changes.
Whenever a number of preferences are being changed, clients may wish to send msgPrefsWritingMany,
followed by the preference writes, and then msgPrefsWritingDone. dsPreferences will use these
messages to delay any layout that may occur as a result of writing preferences that cause layout.
clsPreferences will also send these messages to observers, allowing them to delay expensive operations
until the preference changes are complete. As an example, when the preference set changes,
msgPrefsWritingMany, followed by msgPrefsPreferenceChanged for each preference, followed by
msgPrefsWritingDone is sent to the observers.
dsPreferences supports the concept of different sets of preferences. A set of preferences is stored in a
single resource file in a well-known preferences directory managed by theInstalledPreferences.
clsPreferences supports messages to change the current preference set to another one that is already filed.
In addition, dsPreferences allows a preference set to start "clean". When PenPoint first starts up (or
during a warm boot), theSystemPreferences will contain the set of preferences associated with the
"current" preference set managed by thelnstalledPreferences. If no current set exists,
theSystemPreferences will start with a "clean" preference set. When a preference set changes,
dsPreferences will notify the observers of the changed preferences. This is because dsPreferences is
notified via msgIMCurrentChanged from the install manager (see instlmgr.h).
To change the set of preference set programmatically, one must communicate with thelntallManager.
An example code fragment to change a preference set. See instlmgr.h for details:
IM_INSTALL install;
install.locator.uid = theBootVolume;
rn.fs.locator.pPath = n\\PenPoint\\prefs\\PREFERENCESET";
install.exist = imExistReactivate;
install.listAttrLabel = 0;
install.listHandle = 0;
ObjectCall(msgIMInstall, theInstalledPrefs, &install);
ObjectCall(msgIMSetCurrent, theInstalledPrefs, install.handle);
#ifndef PREFS INCLUDED
#define PREFS INCLUDED
#ifndef CLSMGR INCLUDED
#include <clsmgr.h>
#endif
#ifndef RESFILE INCLUDED
#include <resfile.h>
#endif
#ifndef SYSGRAF INCLUDED
#include <sysgraf.h>
#endif
#ifndef OS INCLUDED
#include <os.h>
#endif
System Font
prSystemFont is the resource id for the system font. Reads and writes of this id use a
P _PREF_SYSTEM_FONT. This resource will affect the returned value from PrefsSysFontlnfo.
PREFS.H 477
Known Preferences in the System
Changing this resource (via msgResWriteData) will cause the system to layout after notification of
observers, which is expensive. This is done by doing an ObjectPost of msgPrefsLayoutSystem to self. As
a result, c1sPreferences will compare this resource to the previous value to prevent layout and observer
notification if the write did not change the value.
*define tagPrSystemFont MakeWknResld(clsPreferences, 1)
*define prSystemFont tagPrSystemFont
Field Font
prUserFont is the resource id for the field (user) font. Reads and writes of this id use a
P_PREF_SYSTEM_FONT. This preference will affect the returned data from PrefsSysFontlnfo.
Changing this resource (via msgResWriteData) will cause the system to layout after notification of
observers, which is expensive. This is done by doing an ObjectPost of msgPrefsLayoutSystem to self. As
a result, clsPreferences will compare this resource to the previous value to prevent layout and observer
notification if the write did not change the value.
*define tagPrUserFont MakeWknResld(clsPreferences, 2)
*define prUserFont tagPrUserFont
This data structure is the what is read in and written when reading and writing when the resld is
prSystemFont or prUserFont. It contains a font specification, and a font scale to use.
typedef struct PREF_SYSTEM_FONT
SYSDC FONT SPEC spec; II Font spec
SCALE scale; II Scale: same for system and user font
PREF_SYSTEM_FONT, *P_PREF_SYSTEM_FONT;
Orientation
prOrientation is the resource id for the screen orientation. Reads and writes of this id use a a P_U8,
whose values are defined below.
Changing this resource (via msgResWriteData) will cause the system to layout after notification of
observers, which is expensive. This is done by doing an ObjectPost of msgPrefsLayoutSystem to self. As
a result, c1sPreferences will compare this resource to the previous value to prevent layout and observer
notification if the write did not change the value.
*define tagPrOrientation MakeWknResld(clsPreferences, 3)
*define prOrientation tagPrOrientation
*define prPortrait o II Portrait mode
*define prLandscape 1 II Landscape mode
*define prPortraitReversed 2 II Portrait mode (rotated 180 degrees)
*define prLandscapeReversed 3 II Landscape mode (rotated 180 degrees)
Bell
prBell is the resource id for ringing the warning bell. It reads and writes a P_U8, whose values are defined
below. prBell is
*define tagPrBell MakeWknResld(clsPreferences, 5)
*define prBell tagPrBell
*define prBellOn o II Ring the bell
*define prBellOff 1 II Don't ring the bell
478 PEN POINT API REFERENCE
Part 11 I Resources
. Writing Style
prWritingStyle is the resource id for the handwriting preference style. Reads and writes of this id use a
P_U8, whose values are defined below.
fdefine tagPrWritingStyle MakeWknResld(clsPreferences, 6)
fdefine tagPrPrintingStyle MakeWknResld(clsPreferences, 6)
fdefine prWritingStyle tagPrWritingStyle
fdefine prPrintingStyle tagPrPrintingStyle II old name
fdefine prMixedCase o II Mixed case writer
fdefine prCapsOnly 1 II All caps writer
Date Format
prDateFormat is the resource id for the desired date format. Reads and writes use a P_U8, whose values
are defined below. This preference will affect the format of the string returned from PrefsDateToString.
fdefine tagPrDateFormat MakeWknResld(clsPreferences, 7)
fdefine prDateFormat tagPrDateFormat
#define prDateMDYFul1 o II January 15, 1990
fdefine prDateMDYAbbre 1 II Jan. 15, 1990
fdefine prDateMDYSlash 2 1/ 1/15/90
fdefine prDateMDYHyphe 3 1/ 1-15-90
fdefine prDateMDYDot 8 1/ 1.15.90
#define prDateDMYFull 4 1/ 15 January 1990
fdefine prDateDMYAbbre 5 1/ 15 Jan. 1990
fdefine prDateDMYSlash 6 // 15/1/90
fdefine prDateDMYHyphe 7 1/ 15-1-90
fdefine prDateDMYDot 9 // 15.1. 90
Gesture Timeout
prGestureTimeout is the resource id for the gesture timeout, and is measured in 1I100's of a second.
Reads and writes of this id use a P_U16 whose meaning is 1I100's of a second.
fdefine tagPrGestureTimeout MakeWknResld(clsPreferences, 9)
fdefine prGestureTimeout tagPrGestureTimeout
Line Height
prLineHeight is the resource id for the ruled line writing line height in edit pads. Reads and writes of
this id use a P_UI6, whose meaning is 1I100th's of an inch. Changing this preference only affects newly
created ruled pads.
#define tagPrLineHeight MakeWknResld(clsPreferences, 10)
#define prLineHeight tagPrLineHeight
Auto Suspend
tagPrAutoSuspend is the resource id for auto suspend timeout. Reads and writes of this id use a P_UI6,
whose units are minutes. If the value is 0, the machine will not be auto suspended.
Machines that do not support auto suspend use the auto suspend preference for the auto shutdown
timeout.
fdefine tagPrAutoSuspend MakeWknResld(clsPreferences, 11)
PREFS.H 479
Known Preferences in the System
Auto Shutdown
tagPrAutoShutdown is the resource id for auto shutdown timeout. Reads and writes of this id use a
P_UI6, whose units are hundredths of hours. If the value is 0, the machine will not auto shutdown.
Machines that do not support auto suspend use the auto suspend timeout prefrence for auto shutdown.
#define tagPrAutoShutdown MakeWknResld(clsPreferences, 28)
Power Management
prPowerManagement is the resource id that indicates ifPenPoint should attempt to limit the
computer's power consumption by turning off inactive devices
#define tagPrPowerManagement MakeWknResld(clsPreferences, 27)
#define prPowerManagement tagPrPowerManagement
#define prPowerManagementOff o II power management not attempted
#define prPowerManagementOn 1 II power management attempted
Floating Allowed
prDocFloating is the resource id that indicates if documents can be floated. Reads and writes of this id
use a P_U8, whose meaning is defined below.
#define tagPrDocFloating MakeWknResld(clsPreferences, 12)
#define prDocFloating tagPrDocFloating
#define prDocFloatingOff o II document floating not allowed
#define prDocFloatingOn 1 II document floating allowed
Zooming Allowed
prDocZooming is the resource id that indicates if documents can be zoomed. Reads and writes of this id
use a P_U8, whose meaning is defined below.
#define tagPrDocZooming MakeWknResld(clsPreferences, 13)
#define prDocZooming tagPrDocZooming
#define prDocZoomingOff o II document zooming not allowed
#define prDocZoomingOn 1 II document zooming allowed
Left/Right Handed
prHandPreference is the resource id that indicates a left handed or right handed user. Reads and writes
of this id use a P_U8, whose meaning is defined below.
Changing this resource (via msgResWriteData) will cause the system to layout after notification of
observers, which is expensive. This is done by doing an ObjectPost of msgPrefsLayoutSystem to self. As
a result, clsPreferences will compare this resource to the previous value to prevent layout and observer
notification if the write did not change the value.
#define tagPrHandPreference MakeWknResld(clsPreferences, 14)
#define prHandPreference tagPrHandPreference
#define prLeftHanded o II Left Handed writer
#define prRightHanded 1 II Right Handed writer
Changing this resource (via msgResWriteData) will cause the system to layout after notification of
observers, which is expensive. This is done by doing an ObjectPost of msgPrefsLayoutSystem to self. As
a result, clsPreferences will compare this resource to the previous value to prevent layout and observer
notification if the write did not change the value.
#define tagPrScrollMargins MakeWknResId(clsPreferences, 26)
#define prScrollMargins tagPrScrollMargins
#define prScrollMarginsFull o
#define prScrollMarginsLight 1
Hold Timeout
prPenHoldTimeout is the resource id for the press hold timeout. Reads and writes of this id use a P _U16
whose meaning is 11100's of a second.
#define tagPrPenHoldTimeout MakeWknResId(clsPreferences, 19)
#define prPenHoldTirneout tagPrPenHoldTimeout
PREFS.H 481
Known Preferences in the System
Pen Cursor
prPenCursor is the resource id for whether the cursor is off or on. Reads and writes of this id use a P_us,
whose meaning is defined below.
#define tagPrPenCursor MakeWknResId(clsPreferences, 20)
#define prPenCursor tagPrPenCursor
#define prPenCursorOff o II Pen cursor should be off
#define prPenCursorOn 1 II Pen cursor should be on
Time Format
prTimeFormat is the resource id for the preferred time format (military or civilian). Reads and writes of
this id use a P_us, whose meaning is defined below. This preference will affect the returned string from
PrefsTimeToString. '
#define tagPrTimeFormat MakeWknResId(clsPreferences, 21)
#define prTimeFormat tagPrTimeFormat
#define prTime12Hour o II Display 12 hour times
#define prTime24Hour 1 II Display 24 hour times
Display Seconds
prTimeSeconds is the resource id indicating if seconds should be displayed or not. Reads and writes of
this id use a P_us, whose meaning is defined below. This preference will affect the returned string from
Prefs TimeToString.
#define tagPrTimeSeconds MakeWknResId(clsPreferences, 22)
#define prTimeSeconds tagPrTimeSeconds
#define prTimeSecondsDisplay o II Display seconds in time
#define prTimeSecondsOff 1 II Don't display seconds in time
Time
prTime is the resource id for the system time. Reads and writes of this 1D use a P _PREF_TIME_INFO,
containing the current time information.
#define tagPrTime MakeWknResId(clsPreferences, 23)
#define prTime tagPrTime
typedef union PREF_TIME_MODE
OS_SET_TIME_MODE writeMode; II In: which attributes to set (for write only)
} PREF_TIME_MODE;
typedef struct PREF_TIME_INFO
PREF_TIME_MODE mode; II In: read or write mode
OS DATE TIME dateTime; II In/Out: date and time information
PREF_TIME_INFO, *p PREF TIME_INFO;
Primary Input
prPrimaryInput is the resource id defining the primary input device. Reads and writes of this id use a
P_us, whose meaning is defined below.
#define tagPrPrimaryInput MakeWknResId(clsPreferences, 24)
#define prPrimaryInput tagPrPrimaryInput
#define prPrimaryInputPen o II Primary input is with the pen
#define prPrimaryInputKbd 1 II Primary input is with a keyboard
482 PENPOINT API REFERENCE
Part 11 / Resources
Unrecognized Character
prUnrecCharacter is the resource id used for the unrecognized character glyph. Reads and writes of this
id use a P_U8, whose meaning is defined below.
fdefine tagPrUnrecCharacter MakeWknResId(clsPreferences, 25)
fdefine prUnrecCharacter tagPrUnrecCharacter
fdefine prUnrecCharacterQuestion o
fdefine prUnrecCharacterUnder 1
Messages
msgNew
Creates a new preferences object.
Takes P_PREPS_NEW, returns STATUS. Category: class message.
Argmm:mt£ typedef struct PREFS_NEW_ONLY {
P CHAR pPrefSet; II Preference set name
} PREFS_NEW_ONLY, *P_PREFS_NEW_ONLY;
fdefine prefsNewFields \
objectNewFields \
PREFS NEW ONLY prefs;
typedef struct PREFS_NEW
prefsNewFields
} PREFS_NEW, *P_PREFS_NEW;
This message should not be called by clients. Creates a preferences object. If pPrefSet is pNull, the list
will start out empty. Otherwise, pPrefSet is expected to be an already installed file title in the preferences
directory.
msgPrefsPreferenceChanged
Sent to observers when a preference has changed.
Takes P_PREP_CHANGED, returns STATUS. Category: observer notification.
#define msgPrefsPreferenceChanged MsgNoError(MakeMsg(clsPreferences, 1))
typedef struct PREF_CHANGED {
OBJECT manager; II Sender of the notification (theSystemPreferences)
RES ID prefId; II resId of preference that changed
PREF_CHANGED, *P_PREF_CHANGED;
Sent to observers. Notifies observers that a given preference has changed. Notifies with the manager
(usually theSystemPreferences, as there are no other pre-defined instances of clsPreferences), and the
RES_ID of the preference that has changed.
msgPrefsLayoutSystem
Causes the system to re-Iayout and re-paint.
Takes NULL, returns STATUS.
fdefine msgPrefsLayoutSystem MakeMsg(clsPreferences, 5)
Causes the entire system to layout. If msgPrefSWritingMany has not been called, posted to self when
clsPreferences receives msgResWriteData and a new value has been written for prSystemFont,
prUserFont, prOrientation, prHandPreference, or prScrollMargins. If msgPrefsWritingMany has been
PREFS.H 483
Public Functions
called, the layout will occur when msgPrefsWritingDone is called. Will be sent to observers when
immediately before a layout of the system occurs due to a preference change.
msgPrefsWritingMany
msgPrefsWritingMany
Indicates several preferences are to be written in succession.
Takes NULL, returns STATUS.
#define msgPrefsWritingMany MakeMsg(clsPreferences, 6)
Cornments Causes clsPreferences to delay the self-posting of msgPrefsLayoutSystem until it receives
msgPrefsWritingDone. Useful when writing several preference changes at o'nce, and the client does not
want the system laying out several times. If, after this message is received, a msgResWrite of
prSystemFont, prUserFont, prOrientation, prHandPreference, or prScrollMargins is received,
clsPreferences will self-post msgPrefsLayoutSystem when msgPrefsWritingDone is received. After
msgPrefsWritingDone is received, any other msgResWrite of these preferences will cause an immediate
layout unless this message is sent again. Will be sent to observers to allow them to be aware that several
preferences are being written.
msgPrefsWritingDone
msgPrefsWritingDone
Indicates completion of writing several preferences.
Takes NULL, returns STATUS.
#define msgPrefsWritingDone MakeMsg(clsPreferences, 7)
Comments Causes the system to layout if necessary by self-posting msgPrefsLayoutSystem. You should send this
message in conjunction with msgPrefsWritingMany to indicate that writing of successive preferences is
complete. If a msgResWrite of prSystemFont, prUserFont, prOrientation, prHandPreference, or
prScrollMargins with a new value has been done, layout will occur at this time. Will be sent to observers
to indicate that a series of preferences writes have been completed.
msgPrefsWritingMany
Public Functions
PrefsSysFontlnfo
Passes back the system and user font information.
Returns void.
Arguments typedef struct PREF SYSTEM FONT INFO
U8 scale;
U16 sysFontId;
U16 userFontId;
PREF_SYSTEM_FONT_INFO, *P_PREF_SYSTEM_FONT_INFO;
function Prototype void EXPORTED PrefsSysFontInfo (
P_PREF_SYSTEM_FONT_INFO pFontInfo);
Comments This function can be used to read all font information stored in the preferences file at one time.
Equivalent functionality exists with msgResRead. This function is provided for convenience.
484 PEN POI NT API REFERENCE
Part 11 / Resources
PrefsDateToString
Returns a pointer to the string containing a formatted date.
Returns P_CHAR.
#define prefsMaxDate 19
rum:tlort Prototype P_ CHAR EXPORTED PrefsDateToString
P_OS_DATE_TlME pTime,
P_CHAR pStr);
Co/nmerd's This function will return a string containing the ASCII representation of the formatted date based on
the current user-preference for date. Puts the date into the string passed in. The longest possible string is
18 characters (19 including the terminating 0) given the CURRENT formats. If additional formats are
added, this may increase.
PrefsTimeToString
Returns a pointer to the string containing a formatted time.
Returns P_CHAR.
#define prefsMaxTime 11
0undlort Prototype P_CHAR EXPORTED PrefsTimeToString
P_OS_DATE_TlME pTime,
P_CHAR pStr);
Comments This function will return a string containing the ASCII representation of the time based on the current
user preferences for time. Puts the time into the string passed in, and returns the string pointer. The
longest possible string is 10 characters (11 including the terminating 0) given the current time formats.
If additional formats are added, this may increase.
RESCMPLR.H
Types
Prototype for the client-supplied agent writing routine. If you wish to supply your own agent writing
routine then write a routine of type P_AGENT_TYPE and supply the address to the routine in the field
pAgentWriteProc of RC_INPUT. Your routine should write out (using fwrite to file) its representation of
the data described by pReslnput (and optionally also by pAgentData).
Fundi©n Pr©t©ty~e typedef void (PASCAL * P_AGENT_WRITE) (
P UNKNOWN file, 11 DOS file handle
struct RC INPUT * pRes Input , II Data described below
P UNKNOWN pAgentData, II Res Agent specific data
U32 spare!, II For future
U32 spare2 II For future
);
The resource compiler uses the information supplied by RC_INPUT to create resources. Typically only
the first four or five fields of RC_INPUT are used. At a minimum you should set resld, pData and
dataLen. You do not need to set dataLen if you set agent to resStringResAgent or
resStringArrayResAgent (the resource compiler will infer dataLen from pData). You should set agent if
you do not want the default resource data agent. You should set minSysVersion if it has a non-zero
value. You may set ob;ectData to true in the rare case that an object resource is being created by the
resource compiler. You should set pAgentWriteProc and optionally pAgentWriteData if you are
providing your own routine to write the resource data to the resource file.
typedef struct RC_INPUT {
RES ID resld; II the resource ID
P UNKNOWN pData; II points to data
U16 dataLen; II length of data
UID agent; II usually resDefaultResAgent
U16 minSysVersion; II min sys version for resource
U16 reserved;
BOOLEAN objectData; II usually false
P_AGENT_WRITE pAgentWriteProc; II pNull, unless supplying routine
P UNKNOWN pAgentWriteData; II usually pNull
RC_INPUT, *P_RC_INPUT, **PP_RC_INPUT;
486 PENPOINT API REFERENCE
Part 11I Resources
If you use resTaggedStringArrayResAgent as the agent for a resource. Then the data must be a list of
RC_TAGGED _STRINGs. This is converted into a linear string array and the filed using the
resStringArrayResAgent agent.
idefine resTaggedStringArrayResAgent ((UID)MakeTag(clsResFile, Oxff))
typedef struct RC_TAGGED_STRING {
TAG tag;
P STRING pString;
RC_TAGGED_STRING, *P_RC_TAGGED_STRING;
Example
Here is example input for rescmplr (or rc):
II Resource ids
idefine resldRfANumber MakeWknResld(clsExample, 1)
idefine resldRfAString MakeWknResld(clsExample, 2)
idefine resldRfAStringArray MakeWknResld(clsExample, 3)
idefine resldRfATaggedStringArray MakeWknResld (clsExample, .4)
II A number.
static U16 aNumber 1;
II A string array.
static P CHAR errorTextData []
"This is bogus.",
"You got it wrong.",
"I think you need to try again.",
pNull
};
Overview
Resource files are used in three general ways: filing & unfiling objects, reading theProcessResList for
configuration and customization information, and application specific data storage.
• The most common case of filing & unfiling objects is a page turn, which needs to save the state of a
running process on the disk, and restore the state of another process from the disk. This is done by
(un)filing the application framework, which (if everything is set up correctly) (un)files directly or
indirectly all the objects that make up the state of the process.
Filling of an object is initiated with msgResWriteObject which ends up sending msgSave to the
object. The save procedure uses msgStreamWrite (everything except objects) and msgResPutObject
(objects) to write out its instance data. Unfiling of the object is initiated with msgResReadObject
which sends msgRestore to the (newly created) object. The restore procedure uses msgStreamRead
and msgResGetObject to read its instance data back in.
• theProcessResList is used for several reasons: to allow text to be stored separately from the code, to
store pre-built UI objects, to allow applications to override system provided items, to provide a
central set of system wide preferences, etc. To do this it normally (inside an application) contains
four resource files: DOC.RES (specific to the document), AlP.RES (specific to the application), current
system preferences file, and PENPOINT.RES (system wide resource file). They are searched in the
order listed above. There are some utility functions to access theProcessResList, see RESUTIL.H for
more information on them.
• There are many other ways to use resource ·files, but they are application specific. If you think you
have a use for resource files, it is worth checking out, but do be careful, resource files are designed
and optimized for the first two uses, and do not work well for everything that it at first seems like
they should.
490 PENPOINT API REFERENCE
Part 11 / Resources
You will note that this provides eight bits not provided by a List Resource ID (the index) and is missing
eight bits needed by it (the flags and group).
The eight bits of index allow each list to contain up to 256 items. Actually they can have more, but only
the first 256 can be accessed this way. Since there are four lists for each Well-Known, it is possible to
access up to 1,024 items per group per Well-Known.
We provide the missing bits as follows. Since we always map to a List Resource ID we know that the
flags will be set to Ox2. Which group to use is determined by which API it is used with. Thus, the
passing the same Indexed Resource ID to both Quick help and a TK table will result in different data
items being used.
When an object resource is deleted from a resource file, the other objects it filed are NOT deleted, and
there is no easy way of finding them to delete them. Because of this, repeatedly filing objects will result
in the file growing without bound unless you work very hard to prevent it.
Opening multiple handles on the same resource file has some limitations. It is possible to have as many
read-only handles as desired, as long as there are no writable handles. If there is a writable handle, no
other handles may be opened. This is do to a limitation of the current implementation. It maintains
index information into the file on a per handle basis. If writing was allowed with multiple handles open,
these tables would become invalid resulting in fatal errors of many kinds.
While it is possible to use a resource file as a kind of mini-database, it was not designed or optimized for
such a use. So, don't be surprised if you find it is not up to the task you would like to use it for.
#define MakeWknResld(wkn,i) \
MakeTagWithFlags(wkn, i, resFlagsWkn)
#define MakeDynResld(count) \
MakeTagWithFlags(((U32) (count))»8, ((count)&OxFF), resFlagsDyn)
#define MakeListResld(wkn,grp,lst) \
MakeTagWithFlags(wkn, ((((U32) (grp))«2)+((lst)&Ox03)), resFlagsLists)
#define MakeWknObjResld(obj) ((RES_ID) (obj) I resFlagWknObj)
Extract the pieces from resource IDs.
#define ResWknObjResld(resld) ((OBJECT) ((resld) & -resFlagWknObj))
#define ResDynldCount(resld) (WKNValue(resld)«8 I Tag(resld))
#define ResListGroup(resld) (Tag(resld) » 2)
#define ResListList(resld) (Tag (resld) & Ox3)
Tests on resource ID's
#define WknObjResld(resld) ( (resld) & resFlagWknObj)
#define WknResld(resld) \
(!WknObjResld(resld) && TagFlags(resld) != resFlagsDyn)
#define WknltemResld(resld) \
(!WknObjResId(resId) && TagFlags(resId) resFlagsWkn)
#define WknListResId(resId) \
(!WknObjResId(resld) && TagFlags(resld) resFlagsLists)
#define DynResld(resld) \
(!WknObjResld(resld) && TagFlags(resld) resFlagsDyn)
Constants
#define resNilResld
OBOLETE Resource IDs do NOT use.
#define residRfSystemVersion MakeWknResld(clsResFile, 1)
#define residRfApplicationVersion MakeWknResld(clsResFile, 2)
How to make a Indexed resource ID.
#define MakelndexedResld(wkn,list,index)\
MakeTagWithFlags(wkn,index,list)
The group identifiers used to convert from Indexed resource IDs to normal resource IDs. Values from
OxOO to OxlF are available for use by applications. Values from Ox20 to Ox3F are reserved to the system.
#define resGrpTK Ox20
#define resGrpStdMsg Ox21
#define resGrpQhelp Ox22
Status Codes
#define stsResResourceNotFound MakeStatus(clsResFile, 1)
#define stsResNotDataResource MakeStatus(clsResFile, 2)
#define stsResNotObjectResource MakeStatus(clsResFile, 3)
#define stsResBufferTooSmal1 MakeStatus(clsResFile, 4)
#define stsResNotFullyRead MakeStatus(clsResFile, 5)
#define stsResGetNotFromRestore MakeStatus(clsResFile, 6)
#define stsResPutNotFromSave MakeStatus(clsResFile, 7)
II removed unused MakeStatus(clsResFile, 8)
#define stsResWriteObjDynamicClass MakeStatus(clsResFile, 9)
II removed unused MakeStatus(clsResFile, 10)
#define stsResCompactInReadOrWrite MakeStatus(clsResFile, 11)
#define stsResIncorrectFileType MakeStatus(clsResFile, 12)
#define stsResFileCorrupt MakeStatus(clsResFile, 13)
#define stsResResourceTooBig MakeStatus(clsResFile, 14)
#define stsResOutOfDynResIds MakeStatus(clsResFile, 15)
Types
II Object types.
typedef OBJECT RES_FILE, *P_RES_FILE;
typedef OBJECT RES_LIST, *P_RES_LIST;
NOTE: That RES_ID is already defined in dsmgr.h because it is referenced by msgSave & msgRestore:
typedef TAG II Resource ID
II Modes used in msgNew to control the creation of the resource file.
Enum16(RES NEW MODE) {
II Will the file handle be shared? Also guarantees concurrence
resSharedResFile = flagO,
II Remove "deleted" fields on close
resCompactOnClose = flagl,
II Compact file when ratio of deleted to non-deleted reaches compactRatio.
resCompactAuto = flag2,
II Check to see that system version is new enough for resources.
resVerifyVersions = flag3,
II Allow unsafe opens, internal use only.
resUnsafeOpen = flag4,
II Default - No Concurrence, compact on close, verify versions.
resNewDefault = resCompactOnClose I resVerifyVersions
};
II Duplicate object checking flag for reading objects.
Enum16 (RES_READ_OBJ_MODE) {
resReadObjectOnce 0, II Should object resource be read once?
resReadObjectMany =1 II Should object resource be read many times?
};
II Duplicate object checking flag for writing objects.
Enum16 (RES_WRITE_OBJ_MODE) {
resWriteObjectOnce 0, II Should object resource be written once?
resWriteObjectMany = 1 II Should object resource be written many?
};
IIMode used to control msgResEnumResources.
Enum16 (RES_ENUM_MODE) {
resEnumAII 0, II Enumerate all resource entries?
resEnumByResIdClass 1, II Enumerate by wkn resource ID admin field?
resEnumByObjectClass 2, II Enumerate by object resource's class?
resEnumByObjectUID 3, II Enumerate by object resource's uid?
resEnumByAgent 4, II Enumerate by resource's agent?
resEnumNext flag14, II Or in to enumerate the next item.
resEnumDefault resEnumAlI II Default - all resources.
};
RESFILE.H 495
Class ResFile Messages
msgNewDefaults
Initializes the RES_FILE_NEW structure to default values.
Takes P _RES_FILE_NEW, returns STATUS. Category: class message.
Message typedef struct RES_FILE_NEW {
Arguments resFileNewFields
} RES_FILE_NEW, *P_RES_FILE_NEW;
Zeroes out pArgs->resFile and sets .... mode = resNewDefault;.compactRatio = 33;.compactMinimum = 50;
496 PENPOINT API REFERENCE
Part 11 I Resources
msgResFindResource
Finds a resource in a resource file or a resource list.
Takes P _RES_FIND, returns STATUS.
tdefine msgResFindResource MakeMsg(clsResFile, 1)
typedef struct RES FIND
RES IO resId; II In: Resource to find
RES FILE file; II Out: File location of resource
UIO agent; II Out: Agent of the resource
U32 offset; II Out: Offset in file (Careful!)
U16 minSysVersion; II Out: Min sys vers for the resource
U16 reserved;
RES_FIND, *p RES_FIND;
*** This message is obsolete, you should use msgResGetlnfo instead.
This message may be used to determine if a resource exists and to get information about that resource.
You must use it before writing or deleting a resource if you do not know which resource file (out of a
resource list) contains the resource (Resource lists only act upon non-destructive messages).
stsBadParam resId is a nil resource ID.
stsResResourceNotFound No resource with the given resld exists.
msgResGetlnfo
Gets information on a resource in a resource file or a resource list.
Takes P _RES_INFO, returns STATUS.
tdefine msgResGetInfo MakeMsg(clsResFile, 17)
typedef struct RES INFO
RES IO resId; II In: Resource to find
RES FILE file; II Out: File location of resource
UIO agent; II Out: Agent of the resource
UIO objClass; II Out: Class of object (if is object)
U32 offset; II Out: Offset in file (Careful! )
U32 size; II Out: Size in file (Careful! )
U16 minSysVersion; II Out: Min sys vers for the resource
U16 reserved1;
U32 reserved;
RES_INFO, *p RES_INFO;
This message may be used to determine if a resource exists and to get information about that resource.
You must use it before writing or deleting a resource if you do not know which resource file (out of a
resource list) contains the resource (Resource lists only act upon non-destructive messages). This is an
improved version of msgResFindResource. It gives a more useful set of values for agent (as in exactly
what is in the file), and it returns the size of the resource in the file.
stsBadParam resId is a nil resource ID.
stsResResourceNotFound No resource with the given resld exists.
msgResReadData
Reads resource data from a resource file or resource list.
msgResWriteData
Writes resource data to a file.
Takes P_RES_WRITE_DATA, returns STATUS.
*define msgResWriteData MakeMsg(clsResFile, 3)
typedef struct RES_WRITE_DATA
RES ID resld; II
P UNKNOWN pData; II Data to be written
U32 length; II Optional if agent can compute size
UID agent; II Not used by msgResUpdateData
P UNKNOWN pAgentData; II Agent-specific data
U32 sparel;
RES_WRITE_DATA, *P_RES_WRITE_DATA;
This message writes data to the resource file. If the resource already exists it is marked as deleted and the
new data is written to the end of the file.
stsBadParam resId is a nil resource ID.
stsResResourceTooBig Tried to write resource bigger than resource file can handle (16Meg).
msgResReadData To read data from resource file.
msgResUpdateData To re-write data in a resource file.
msgResWriteObject To write an object to a resource file.
498 PEN POINT API REFERENCE
Part 11 I Resources
msgResReadObject
Reads a resource object from a resource file or resource list.
Takes P_RES_READ_OBJECT, returns STATUS.
#define msgResReadObject MakeMsg(clsResFile, 5)
typedef struct RES_READ_OBJECT
RES_READ_OBJ_MODE mode; II Duplicate checking mode
RES ID resld; II
OBJECT_NEW objectNew; II Object passed back in new.uid
RE S_SAVE_RES TORE_FLAGS sysFlags; II Only for msgResReadObjectWithFlags
U16 appFlags; II Only for msgResReadObjectWithFlags
U32 spare1;
RES_READ_OBJECT, *P_RES_READ_OBJECTi
An object must be initialized before it can be read. You must send msgNewDefault to dsObject.
There are two modes that can be applied to reading an object resource, resReadObjectOnce and
resReadObjectMany.
Setting mode to resReadObjectOnce, passed back the object that is associated with the resource stored
in the resource file (per open). This guarantees that all filed references to a given object refer to the same
object. This is the mode to use if you are unfiling data in a msgRestore procedure. There are other uses
of it, but they can be very tricky, so make sure you read all of the documentation and understand it
thoroughly before you try to use this any place other than a msgSave procedure.
Setting mode to resReadObjectMany, passes back a new copy of the object without regard as to whether
the object has already been read in before or not. This guarantees that each reader gets his own unique
instance of the object. This is the mode to use if you are reading an object resource "tempJate" (the
normal case).
RESFILE.H 499
Class ResFile Messages
msgResWriteObject
Writes a resource object to a file.
Takes P_RES_WRITE_OBJECT, returns STATUS.
#define msgResWriteObject MakeMsg(clsResFile, 6)
Argufnents typedef struct RES_WRITE_OBJECT
RES_WRITE_OBJ_MODE mode; II Duplicate checking mode
RES ID resId; II
OBJECT object; II Object to write
RES_SAVE_RESTORE_FLAGS sysFlags; II Only for msgResWriteObjectWithFlags
U16 appFlags; II Only for msgResWriteObjectWithFlags
U32 spare1;
RES WRITE OBJECT, *P_RES_WRITE_OBJECT;
There are two modes that can be applied to writing an object resource, resWriteObjectOnce and
resWriteObjectMany.
Setting mode to resWriteObjectOnce, will only write the object to the resource file once (per open).
This guarantees that all filed references to a given object refer to the same object. This is the mode is
used by msgResPutObject, and should be used by you if you bypass it and use msgResWriteObject
directly in a msgSave procedure. There are other uses of it, but they can be very tricky, so make sure you
read all of the documentation and understand it thoroughly before you try to use this any place other
than a msgSave procedure.
Setting mode to resWriteObjectMany, will write a new copy of the object to the resource file whether
the object has already been written before or not. This is the mode to use if you are writing an object
resource "template" (the normal case).
stsBadParam resld is a nil resource 10.
stsResWriteObjDynamicClass Class of object cannot be dynamic.
stsResResourceTooBig Tried to write resource bigger than resource file can handle (16Meg).
msgResReadObject To read an object from resource file.
msgResWriteData To write data to a resource file.
- - -....•... _-------
500 PEN POINT API REFERENCE
Part 11 / Resources
msgResGetObject
Reads the filed object resource from the current file position.
Takes P_OBJECT, returns STATUS.
fdefine msgResGetObject MakeMsg(clsResFile, 8)
This should only be called by routines responding to msgRestore. This message is provided as a
convenience. It eliminates the need for everyone to duplicate the same code and guarantees that the
parallel operation (msgResPutObject) will work.
stsResGetN otFromRestore This was sent in a context other than in response to a msgRestore.
This message is equivalent to this pseudo code:
STREAM_READ_WRITE fsRead;
RES READ OBJECT resRead;
STATUS status;
II Read the object's resource ID from the file.
fsRead.numBytes = SizeOf(resRead.resId);
fsRead.pBuf = &resRead.resId;
ObjCallRet(msgStreamRead, pArgs->file, &fsRead, status);
II Set up the read resource object request.
resRead.mode = resReadObjectOnce;
ObjCallRet(msgNewDefaults, clsObject, &resRead.new, status);
II Read the object if one was filed.
if (resRead.resId != resNilResId) {
ObjCallRet(msgResReadObject, pArgs->file, &resRead, status);
msgResPutObject
Writes the object as a filed object resource to the current file position.
Takes OBJECT, returns STATUS.
fdefine msgResPutObject MakeMsg(clsResFile, 9)
This should only be called by routines responding to msgSave. This message is provided as a
convenience. It eliminates the need for everyone to duplicate the same code and guarantees that the
parallel operation (msgResGetObject) is done in the correct order.
stsResPutNotFromSave This was sent in a context other than in response to a msgSave.
This message is equivalent to this pseudo code:
STREAM READ WRITE fsWrite;
RES WRITE OBJECT resWrite;
STATUS status;
if (object != Nil(OBJECT» {
II Assign an appropriate resource 1D to the object.
if (!ObjectIsDynamic(object» {
resWrite.resId = MakeWknObjResId(object);
else {
ObjCallRet (
msgResNextDynResId, pArgs->file, &resWrite.res1d, status
);
}
II Write the object.
resWrite.mode = resWriteObjectOnce;
resWrite.object = object;
ObjCallRet(msgResWriteObject, pArgs->file, &resWrite, sta~us);
RESFILE.H 501
Class ResFile Messages
else {
II No object.
resWrite.resId resNilResId;
msgResReadObjectWithFlags
Reads a resource object, passing the supplied flags.
Takes P _RES_READ_OBJECT, returns STATUS.
*define msgResReadObjectWithFlags MakeMsg(clsResFile, 15)
MessC!ge typedef struct RES_READ_OBJECT {
Ar!juments RES_READ_OBJ_MODE mode; II Duplicate checking mode
RES_ID resId; II
OBJECT_NEW objectNew; II Object passed back in new.uid
RES SAVE RESTORE FLAGS sysFlags; II Only for msgResReadObjectWithFlags
U16- - - appFlags; II Only for msgResReadObjectWithFlags
U32 spare1;
RES_READ_OBJECT, *P_RES_READ_OBJECT;
This is identical to msgResReadObject except that it copies the flag values supplied into all msgRestore
calls done by this or any object reads that are done recursively from this.
The values for the sysFlags field are defined by GO and should be examined by any object that needs
special behavior for any of the defined cases (currently only on copy).
The values for the appFlags field are defined by an application writer. Great care must be used with
setting or testing these flags. If the flags from one application are used with a class of a second
application, disaster can result. E.g. set this field to 0 unless you are very sure you know what you are
doing.
stsBadParam resId is a nil resource ID.
stsResResourceNotFound No resource with the given resld exists.
stsResNotObjectResource The found resource was a data resource.
stsResNotFullyRead The msgRestore routine did not read the same amount of data as the msgSave
wrote.
msgResReadObject Normal message to read an object
msgResWriteObjectWithFlags The matching write call.
msgResWriteObjectWithFlags
Writes a resource object, passing the supplied flags.
Takes P_RES_WRITE_OBJECT, returns STATUS.
*define msgResWriteObjectWithFlags MakeMsg(clsResFile, 16)
Me5SC!ge typedef struct RES_WRITE_OBJECT
Ar!juments RES_WRITE OBJ_MODE mode; II Duplicate checking mode
RES ID resId; II
OBJECT object; II Object to write
RES SAVE RESTORE FLAGS sysFlags; II Only for msgResWriteObjectWithFlags
U16- - - appFlags; II Only for msgResWriteObjectWithFlags
U32 spare1;
RES_WRITE_OBJECT, *P_RES_WRITE_OBJECT;
------------------_._--------
502 PEN POINT API REFERENCE
Part 11 I Resources
This is identical to msgResWriteObject except that it copies the flag values supplied into all msgSave
calls done by this or any object writes that are done recursively from this.
The values for the sysFlags field are defined by GO and should be examined by any object that needs
special behavior for any of the defined cases (currently only on copy).
The values for the appFlags field are defined by an application writer. Great care must be used with
setting or testing these flags. If the flags from one application are used with a class of a second
application, disaster can result. E.g. set this field to 0 unless you are very sure you know what you are
doing.
stsBadParam resId is a nil resource ID.
stsResWriteObjDynamicClass Class of object cannot be dynamic.
stsResResourceTooBig Tried to write resource bigger than resource file can handle (16Meg).
msgResWriteObject Normal message to write an object.
msgResReadObjectWithFlags The matching Read call.
msgResDeleteResource
Deletes the resource identified by RES_ID.
Takes RES_ID, returns STATUS.
fdefine msgResDeleteResource MakeMsg(clsResFile, 10)
This marks the resource deleted in the resource file index. The space taken by the resource is reclaimed
whenever the resource file is compacted. Auto compaction may happen after a resource is deleted.
Note that this may NOT be called during msgSave or msgRestore. It will appear to work, but the read
or write will fail.
stsBadParam resId is a nil resource ID.
stsResResourceNotFound No resource with the given resld exists.
msgResCompact
Compacts the resource file.
Takes void, returns STATUS.
fdefine msgResCompact MakeMsg(clsResFile, 11)
This message removes all deleted entries from the file and frees any unused space that results. This can
be called automatically in a couple of ways. See msgNew for an explanation of them.
stsResCompactlnReadOrWrite Can not compact during read or write. This only happens if
msgCompact is sent during msgSave or msgRestore.
msgResFlush
Flushes the resource file index.
Takes void, returns STATUS.
fdefine msgResFlush MakeMsg(clsResFile, 12)
RESFILE.H 503
Class ResFile Messages
The resource file keeps track of all objects that have filed themselves in the resource file. It needs this
information to implement the resReadObjectOnce / resWriteObjectOnce behavior. If you wish to
override the resReadObjectOnce / resWriteObjectOnce behavior, then flush the resource file.
Clients rarely use this message. Instead, use the resReadObjectMany / resWriteObjectMany modes with
msgResReadObject / msgResWriteObject.
This also sends a msgFSFlush to the file. If all you want to do is flush the file then use msgFSFlush
instead of msgResFlush.
msgResReadObject To get info on read once / read many.
msgResWriteObject To get info on write once/ write many.
msgResEnumResources
Enumerates resources in a resource file or resource list.
Takes RES_ENUM, returns STATUS.
*define msgResEnumResources MakeMsg(clsResFile, 13)
typedef struct RES_ENUM {
U16 max; II size of pRes1d[] and pResFile[] arrays
U16 counti II * to pass back in arrays
II if count> max then memory may be allocated
II Out: * of valid entries in arrays
RES ENUM MODE mode; II Enumerate based on what and first/next.
UID match; II key to match on (i.e. class; agent; etc)
P RES 1D pRes1d; II Out: ptr to array of resource IDs
P RES FILE pResFile; II Out: ptr to array of resource file handles
II Note: if memory was alloc'd for previous 2
II fields, client should heap free the memory
} RES_ENUM, *P_RES_ENUM;
This message will enumerate all resources of a given category (based on mode and match) in either a
single resource file or a resource list. The max and count fields behave as all other enum messages. This
passes back the resource IDs and files that contain the resources in the pResld and pResFile arrays.
Mode must always have resEnumNext clear the first time this is called and set subsequent times. Other
mode flags selectively filter what is being enumerated.
stsBadParam resEnumN ext was specified first time.
Here is some pseudo-code for enumerating:
*define resMaxEnums 12
STATUS status;
RES ENUM rEnum;
RES 1D enumReslds[resMaxEnums]i
RES FILE enumResFiles[resMaxEnums]i
II Enumerate only objects belonging to clsString of the resources.
rEnum.max resMaxEnums;
rEnum.count resMaxEnums;
rEnum.mode resEnumByObjectClass;
rEnum.match clsStringi
rEnum.pResld = enumResldsi
rEnum.pResFile = enumResFilesi
for (status = stsOKi status == stsOK; ) {
status = ObjectCall(msgResEnumResources, resFile, &rEnum)i
for (index = 0; index < rEnum.count; index++) {
II Process the data, etc, etc
rEnum.mode l=resEnumNext;
504 PENPOINT API REFERENCE
Part 11 / Resources
nnsglles~extI>ynllesld
Allocates the next available dynamic resource ID.
Takes P_RES_ID, returns STATUS.
fdefine msgResNextDynResId MakeMsg(clsResFile, 14)
This message may be used to allocate the next dynamic resource ID available, so that the caller can write
dynamic items without using msgResPutObject. WARNING: dynamic IDs are based on a 29 bit
count, and the values are not recycled. If you run out of available counts, this will fail.
stsResOutOfDynReslds ran out of dynamic resIDs
nnsgllesAgent
Message sent by resource file to resource agent when forwarding messages.
Takes P_RES_AGENT, returns STATUS.
fdefine msgResAgent MakeMsg(clsResFile, 20)
typedef struct RES_AGENT
RES FILE file; II File containing the resource
U32 length; II Length of resource entry
MESSAGE msg; II message passed on to agent
P UNKNOWN pArgs; II In-Out: message specific args
U16 sysVersion; II Min sys version if write
U16 spare;
U32 spare1;
U32 spare2;
RES_AGENT, *P_RES_AGENT;
Messages forwarded are msgResReadData, msgResReadObject, msgResWriteData,
msgResUpdateData, msgResWriteObject and msgResUpdateObject.
For reads, current file pointer will be positioned at resource entry and length of the entry will be passed
in length field. For writes, current file pointer will be positioned where write should begin.
nnsg~ew
Creates a resource file (search) list object.
Takes P _RES_LIST_NEW, returns STATUS. Category: class message.
typedef struct RES_LIST_NEW_ONLY
U16 resvd1;
U16 resvd2;
RES_LI ST_NEW_ONLY , *P_RES_LI ST_NEW_ONLY;
fdefine resListNewFields \
listNewFields \
RES- LIST- NEW- ONLY resList;
typedef struct RES_LIST_NEW {
resListNewFields
RES_LIST_NEW, *P_RES_LIST_NEW;
RESFILE.H 505
Class ResList Messages
Comments clsResList adds no additional msgNew parameters to clsList. There are no messages specific to
clsResList. It adds additional behavior.
msgResXxx
Non-destructive resource file messages.
Takes P_RES_XXX, returns STATUS.
Resource lists accept only non-destructive resource file messages (msgResReadData,
msgResReadObject, msgResReadObjectWithFlags, msgResGetObject, msgResFindResource and
msgResEnumResources) and forwards the message to each resource file in the list. Resource files that are
null are skipped and are not considered an error. The resource list stops forwarding the message when
either all resource files in the list have been exhausted or when one of them responds with a status
greater than or equal to stsOK.
Sending msgResEnumResource to a resource file list is special, because it forwards the message to all
resource files in the list until the list is exhausted. Thus the enumerated data is representative of the
entire resource list.
stsRequestNotSupported Msg was not read, find or enum.
stsListEmpty No valid resource files in the list.
stsXXX Return values from the resource file messages that are sent to the resource list.
RESUTIL.H
This file contains the API definition for the Resource Utility procedures. The functions described in this
file are contained in RESFILE.LIB.
#ifndef RESUTIL INCLUDED
#define RESUTIL INCLUDED
#ifndef RESFILE INCLUDED
#include <resfile.h>
#endif
Public functions
ResUtilLoadObject
Loads an object from theProcessResList.
Returns STATUS.
fwm:tktrl Pr©t©type STATUS EXPORTED ResUtilLoadObject (
RES ID resId, // the resource ID of the object
P OBJECT pObject // Out: the object
);
ResUtilLoadString
Loads a string item from theProcessResList.
Returns STATUS.
ftmdi©n f~r©t©type STATUS EXPORTED ResUtilLoadString (
PP CHAR ppString, // In/Out: the pointer to the buffer/string
P U32 pLength, // In/Out: the length of the buffer/string
OS HEAP- ID heap, // Heap to allocate from.
RES ID resId // resId for a string
);
(£wnmenrs This is a short cut to using msgResReadData to read a string in from theProcessResList.
There are two ways of supplying space to load the string into. You can specify a pointer and a length for
the data passed back (heap = null, *ppString = ptr, *pLength = xx) or you can specify a valid heap from
which the resource file will allocate memory for the data (heap = heap ID, *ppString = doesn't matter,
pLength = null or *pLength = doesn't matter). Typically if the size of the data is already known and it is
small and short lived, then the data is "allocated" on the stack. Otherwise, the data is allocated on behalf
of a heap.
508 PENPOINT API REFERENCE
Part 11 / Resources
ResUtilLoadListString
Loads an item from a string list in the application resource list.
Returns STATUS.
FtH'1diztn Prototype STATUS EXPORTED ResUtilLoadListString (
PP CHAR ppString, // In/Out: the pointer to the buffer/string
P U32 pLength, // In/Out: the length of the buffer/string
OS HEAP ID heap, // Heap to allocate from.
U32 listGroup, // The list group to select from
IX RES 1D listResId // Indexed resId for a string
);
This is a short cut to using msgResReadData to read a single string form a string array that is in
theProcessResList.
Works just like ResUtilLoadString, except it uses the group and indexed resource ID to construct the
resource ID of a string list and the index into it.
SEnINGS.H
clsSettingsNB inherits from clsApp . .
This class defines the Settings Notebook.
There is only one instance of the Settings Notebook in the system, on the bookshelf.
The Settings Notebook is an option book. It contains a System Preferences sheet, an Installer sheet, and
a Status sheet.
The Preferences sheet contains a group of Preferences cards. These update the system preferences
resource file (penpoint.res).
The Installer sheet contains one card for each installation category (apps, preferences, services, etc). Each
category has an underlying install manager (see instlmgr.h). A card is automatically created when a new
install manager is created, and deleted when an in~tall manger is destroyed.
The Installer sheet allows a client to display a particular card and select an item within that card. Here's
example code which activates the Settings Notebook from the Bookshelf, turns it to the Installer sheet,
displays a particular card, selects an item within that card, and finally opens the Settings Notebook:
#include <auxnbmgr.h>
#include <instlsht.h>
-----------------------
514 PENPOINT API REFERENCE
Part 12 / Installation API
The application framework will use the Placeholder (MaskApp) class if it tries to start up document with
a missing application.
The following superclass messages are not understood by clsAppInstallMgr:
• msgIMGetCurrent
• msgIMSetCurrent
• msgIMSetName
• msgIMDup
The following notification messages are not sent by clsAppInstallMgr:
• msgIMN ameChanged
• msgIMCurrentChanged
• instlmgr.h
• appmon.h
#ifndef APPIMGR_INCLUDED
#define APPIMGR_INCLUDED
#ifndef CODEMGR_INCLUDED
#include <codemgr.h>
#endif
msgNew
Creates a new application installation manager.
Takes P_AIM_NEW, returns STATUS. Category: class message.
typedef struct AIM_NEW {
installMgrNewFields
} AIM_NEW, *P_AIM_NEW;
There is only one instance of this class, theInstalledApps, in the system. Clients should never send
msgNew.
msgAIMGetMaskClass
Passes back the mask class.
Takes P_CLASS, returns STATUS.
#define msgAIMGetMaskClass MakeMsg(clsAppInstallMgr, 6)
The mask application class is used by the application framework when it tries to start up a document
with an unavailable application.
msgAIMSetMaskClass
Sets the mask class.
Takes CLASS, returns STATUS.
#define msgAIMSetMaskClass MakeMsg(clsAppInstallMgr, 7)
APPIMGR.H 515
Common #defines and typedefs
Comments The mask application class is used by the application framework when it tries to start up a document
with an unavailable application.
This message can be sent at any time; however, the new mask class will only be used for subsequent
switches.
------------ - ---------
AUXNBMGR.H
This file contains the class definition and methods for clsAuxNotebookMgr.
clsAuxNotebookMgr inherits from clsObject.
Manages the system notebooks and documents on the bookshelf.
There is a single instance of clsAuxNotebookMgr in the system; the well-known uid
theAuxNotebookMgr.
The auxiliary notebook manager creates the following items on the bookshelf:
The Help NotebookSettings NotebookAccessories PalleteStationery NotebookKeyboard
InstanceConnections Notebook InstanceInbox NotebookOutbox Notebook
It provides access to those items that are guaranteed to always be on the bookshelf:
The Help NotebookSettings NotebookAccessories PalleteStationery Notebooklnbox NotebookOutbox
Notebook
It allows documents and sections to be created in the Notebooks it manages, and copies documents into
the Notebooks. It also provides several Stationery-specific functions.
theAuxNotebookMgr is usually not used by applications, other than to activate and open one of system
items on the bookshelf.
The document/section creation and copy facilities are used by application installation.
*ifndef AUXNBMGR_INCLUDED
*define AUXNBMGR_INCLUDED
*ifndef GEO_INCLUDED
*include <geo.h>
*endif
*ifndef FS_INCLUDED
*include <fs.h>
*endif
Filesystem AHributes
Should a given piece of stationery be on the stationery menu?
tdefine anmAttrStationeryMenu FSMakeFix32Attr(clsAuxNotebookMgr, 1)
typedef enum ANM ATTR STATIONERY MENU {
anmNotOnMenu- - 0, -II Same as no attribute.
anmOnMenu =1
ANM_ATTR_STATIONERY_MENU;
Should a stationery or tool document not be loaded at install time? This attribute is on the the
document on the external filesystem.
#define anmAttrNoLoad FSMakeFix32Attr(clsAuxNotebookMgr, 2)
typedef enum ANM_ATTR_NO_LOAD {
anmLoad 0, II Same as no attribute.
anmNoLoad =1
ANM_ATTR_NO_LOAOi
Id tag; used to designate stationery or accessory documents.
#define anmAttrId FSMakeFix32Attr(clsAuxNotebookMgr, 3)
Attribute used to tell the difference between an auxiliary notebooks and a data notebooks. Backup
programs take note. Never backup an auxilary notebook!
#define anmAttrAuxNB FSMakeFix32Attr(clsAuxNotebookMgr, 4)
typedef enum ANM_ATTR_AUX_NB {
anmDataNB 0, II Same as no attribute.
anmAuxNB =1
ANM_ATTR_AUX_NB;
Attribute used by clsNBToc to perform special behavior for each auxnb. This attribute is stamped on the
auxnb's Toe at initialization time. The attribute values are specified in the ANM_AUX_NOTEBOOK
enum. Note: ANM_AUX_NOTEBOOK must never have a 0 value; 0 indicates no anmAttrWhichAuxNB
attribute.
#define anmAttrWhichAuxNB FSMakeFix32Attr(clsAuxNotebookMgr, 5)
Used to get auto-expand behavior of stationery sections.
tdefine anmAttrExpandStationerySection FSMakeFix32Attr(clsAuxNotebookMgr, 6)
AUXNBMGR.H 519
Messages
Messages
msgNew
Creates a new auxiliary notebook manager.
Takes P_ANM_NEW, returns STATUS. Category: class message.
#define auxNotebookMgrNewFields \
objectNewFields
typedef struct ANM_NEW {
auxNotebookMgrNewFields
} ANM_NEW, *P_ANM_NEW;
Note: this is done once and only once in the init routine of this dll to create theAuxNotebookMgr. This
message must never be called by anyone else!
msgANMCreateDoc
Create a document in one of the auxiliary notebooks.
Takes P_ANM_CREATE_DOC, returns STATUS.
#define msgANMCreateDoc MakeMsg(clsAuxNotebookMgr, 1)
typedef struct ANM_CREATE_DOC
ANM_AUX_NOTEBOOK notebook; II
Which auxiliary notebook?
CLASS docClass; II
Document class.
P STRING pPath; II
Path to create doc in, relative to
II
base of the aux notebook. pNull
II
says to create at top level.
P STRING pName; II
Name of doc.
U32 sequence; II
Sequence number to create in front of.
P STRING pBookmarkLabel; II pNull for no bookmark.
ANM- EXIST- BEHAVIOR exist; II What to do if the doc existsldoesn't
II exist. Note: doc might exist due to
II warm boot.
BOOLEAN putInMenu; II If type is stationery, should the doc
II initially be in the stationery menu?
P- FS- FLAT- LOCATOR pDestPath; II Out: Location of created doc.
II if pDestPath is pNull then nothing is
II returned.
U32 id; II Id to tag everything with. 0 is no tag.
ANM_CREATE_DOC, *P_ANM_CREATE_DOC;
msgANMCreateSect
Create a section in one of the auxiliary notebooks.
Takes P_ANM_CREATE_SECT, returns STATUS.
#define msgANMCreateSect MakeMsg(clsAuxNotebookMgr, 2)
typedef struct ANM_CREATE_SECT
ANM AUX_NOTEBOOK notebook; II
Which auxiliary notebook?
CLASS sectClass; II
Section class.
P STRING pPath; II
Path to create section in, relative to
II
base of the aux notebook. pNull
II
says to create at top level.
P STRING pName; II
Name of section.
U32 sequence; II
Sequence number to create in front of.
P STRING pBookmarkLabel; II pNull for no bookmark.
ANM EXIST BEHAVIOR exist;
- - II What to do if the sect existsldoesn't
I I exist. Note: sect might exist due to
520 PENPOINT API REFERENCE
Part 12 / Installation API
II warm boot.
P_FS_FLAT_LOCATOR pDestPath; II Out: Location of created section.
II if pDestPath is pNull then nothing is
II returned.
U32 id; II Id to tag everything with. 0 is no tag.
ANM_CREATE_SECT, *P_ANM_CREATE_SECT;
nns~~ovelnI>oc
Move a document into an auxiliary notebook.
Takes P_ANM_MOVE_COPY_DOC, returns STATUS.
#define msgANMMoveInDoc MakeMsg(clsAuxNotebookMgr, 3)
typedef struct ANM_MOVE_COPY_DOC
ANM_AUX_NOTEBOOK notebook; II
Which auxiliary notebook?
FS LOCATOR source; II
Source document.
P STRING pPath; II
Path to move/copy doc to, relative to
II
base of the aux notebook. pNull
II
says to create at top level.
CLASS defaultClass;11 Class to use if source isn't stamped.
U32 sequence; II Sequence number to move/copy in front
II of.
P STRING pBookmarkLabel; II pNull for no bookmark.
ANM_EXIST_BEHAVIORexist; II What to do if the doc existsldoesn't
II exist. Note: doc might exist due to
II warm boot.
BOOLEAN forceInMenu;11 If this is stationery, override
II any local attribute and put it in
II the stationery menu.
P_FS_FLAT_LOCATOR pDestPath; II Out: Location of destination doc.
II if pDestPath is pNull then nothing is
II returned.
U32 id; II Id to tag everything with. 0 is no tag.
ANM MOVE COpy DOC, *P_ANM_MOVE_COPY_DOC;
nns~MCopylnI>oc
Copy a document into an auxiliary notebook.
Takes P_ANM_MOVE_COPY_DOC, returns STATUS.
#define msgANMCopyInDoc MakeMsg(clsAuxNotebookMgr, 4)
Messcge typedef struct ANM_MOVE_COPY_DOC
itdguments ANM_AUX_NOTEBOOK notebook; II
Which auxiliary notebook?
FS LOCATOR source; II
Source document.
P STRING pPath; II
Path to move/copy doc to, relative to
II
base of the aux notebook. pNull
II
says to create at top level.
CLASS defaultClass;11 Class to use if source isn't stamped.
U32 sequence; II Sequence number to move/copy in front
II of.
P STRING pBookmarkLabel; II pNull for no bookmark.
ANM- EXIST- BEHAVIOR exist; II What to do if the doc existsldoesn't
II exist. Note: doc might exist due to
II warm boot.
BOOLEAN forceInMenu;11 If this is stationery, override
II any local attribute and put it in
II the stationery menu.
P_FS_FLAT_LOCATOR pDestPath; II Out: Location of destination doc.
II if pDestPath is pNull then nothing is
II returned.
U32 id; II Id to tag everything with. 0 is no tag.
ANM MOVE_COPY_DOC, *p ANM MOVE_COPY_DOC;
AUXNBMGR.H 521
Messages
~s~~I>elete
Delete a section or document in one of the auxiliary notebooks.
Takes P _ANM_DELETE, returns STATUS.
tdefine msgANMDelete MakeMsg(clsAuxNotebookMgr, 7)
typedef struct ANM_DELETE
ANM_AUX NOTEBOOK notebook; II Which auxiliary notebook?
P STRING pPath; II Path of item to delete.
ANM_DELETE, *P_ANM_DELETE;
~s~~I>eleteAll
Delete all the nodes that are identified by 'id'.
Takes P _ANM_DELETE_ALL, returns STATUS.
tdefine msgANMDeleteAll MakeMsg(clsAuxNotebookMgr, 8)
Arguments typedef struct ANM_DELETE_ALL
ANM_AUX_NOTEBOOK notebook; II Which auxiliary notebook? a::
U32 id; II Id. c(
ANM_DELETE_ALL, *P_ANM_DELETE~LL; z
o
Comments If a node's id attribute or its app class is 'id' then delete it. 5
~s~~GetNotebookPath
Returns the base path of one of the auxiliary notebooks.
Takes P_ANM_GET_NOTEBOOK_PATH, returns STATUS.
tdefine msgANMGetNotebookPath MakeMsg(clsAuxNotebookMgr, 9)
~
typedef struct ANM GET NOTEBOOK PATH {
ANM AUX NOTEBOOK - notebook; II Which auxiliary notebook?
P FS FLAT LOCATOR pLocator; II Out: base location of notebook.
II pNull is returned if the
II notebook does not exist yet.
} ANM_GET_NOTEBOOK_PATH, *P_ANM_GET_NOTEBOOK_PATH;
Note: This will return a path to the table of contents of the notebook. See
msgANMGetNotebookUUID if you want the actual notebook itself.
~s~~GetNotebookUUII>
Returns the uuid of one of the auxiliary notebooks.
Takes P _ANM_GET_NOTEBOOK_UUID, returns STATUS.
tdefine msgANMGetNotebookUUID MakeMsg(clsAuxNotebookMgr, 10)
ArgumenTs typedef struct ANM GET NOTEBOOK UUID {
ANM AUX NOTEBOOK - notebook; II Which auxiliary notebook?
UUID uuid; II Out: uuid of auxiliary notebook.
ANM_GET_NOTEBOOK_UUID, *P_ANM_GET_NOTEBOOK_UUID;
Note: This is the UUID of the actual notebook. Use msgANMGetNotebookPath to get to the table of
contents of the notebook.
522 PEN POINT API REFERENCE
Part 12 / Installation API
msgANMOpenNotebook
Activate and optionally open an auxiliary notebook.
Takes P_ANM_OPEN_NOTEBOOK, returns STATUS.
#define msgANMOpenNotebook MakeMsg(clsAuxNotebookMgr, 11)
typedef struct ANM_OPEN_NOTEBOOK
ANM_AUX_NOTEBOOK notebook; II Which notebook.
BOOLEAN activateOnly; II Only activate; don't open
OBJECT uid; II Out: uid of activated or
II opened auxnb.
Private
msgANMPop UpStationeryMenu
Pop up the stationery menu at the specified location.
Takes P_ANM_POP_UP_MENU, returns STATUS.
#define msgANMPopUpStationeryMenu MakeMsg(clsAuxNotebookMgr, 5)
typedef struct ANM_POP_UP_MENU {
XY32 hotSpot; II Where to pop up menu. Coords are
II relative to destObj.
OBJECT destObj; II Object to create stationery in front
II of.
STAT MENU STYLE style; II Menu style.
ANM_POP_UP_MENU, *P_ANM_POP_UP_MENU;
If the user hits one of the menu items create a stationery document in the destination object at the
hotSpot.
msgANMGetStationeryMenu
Passes back the stationery menu.
Takes P_ANM_GET_MENU, returns STATUS.
#define msgANMGetStationeryMenu MakeMsg(clsAuxNotebookMgr, 6)
typedef struct ANM_GET_MENU {
XY32 hotSpot; II Where to pop up menu. Coords are
II relative to destObj.
OBJECT destObj; II Object to create stationery in front
II of.
STAT MENU STYLE style; II Menu style.
OBJECT menu; II Out: Stationery menu.
ANM_GET_MENU, *P_ANM_GET_MENU;
This message allows the app framework to add the stationery menu to an existing menu bar. When the
stationery menu is invoked, stationery is created in destObj at the hotSpot.
msgANMAddfoStationeryMenu
Add a stationery notebook doc to the stationery menu.
Takes P _ANM_MENU_ADD_REMOVE, returns STATUS.
#define msgANMAddToStationeryMenu MakeMsg(clsAuxNotebookMgr, 12)
AUXNBMGR.H 523
Private
msgANMRemoveFromStationeryMenu
Remove a document from the stationery menu
Takes P_ANM_MENU_ADD_REMOVE, returns STATUS.
#define msgANMRemoveFromStationeryMenu MakeMsg(clsAuxNotebookMgr, 13)
Message typedef struct ANM MENU ADD REMOVE {
Arguments UUID - - - document; II Dir Index of document to remove.
} ANM_MENU_ADD_REMOVE, *P_ANM_MENU_ADD_REMOVE;
msgANMStationeryMenuNameChanged
Informs the stationery menu that one of its documents has changed name.
Takes P_ANM_MENU_NAME_CHANGED, returns STATUS.
#define msgANMStationeryMenuNameChanged MakeMsg(clsAuxNotebookMgr, 17)
Arguments typedef struct ANM_MENU_NAME_CHANGED (
UUID document; II
Dir Index of document whose name
II
changed.
ANM MENU NAME_CHANGED, *P_ANM_MENU_NAME_CHANGED;
Obsolete
#define anmAttrPermanent FSMakeFix32Attr(clsAuxNotebookMgr, 0)
typedef enum ANM_ATTR_PERMANENT {
anmNotPermanent 0, II Same as no attribute.
anmPermanent =1
ANM_ATTR_PERMANENT;
II Next available messsage number: 18
CODEMGR.H
This file contains the API definition for clsCodelnstallMgr.
clsCodelnstallMgr inherits from clslnstallMgr.
Manages installation and deinstallation of code: applications and services.
clsApplnstallMgr and clsServiceInstallMgr inherit from this class.
The following superclass messages are not understood by clsCodelnstallMgr:
• msgIMGetCurrent
• msgIMSetCurrent
• msgIMSet~ame
• msgIMDup
The following notification messages are not sent by clsCodelnstallMgr:
• msgIM~ ameChanged
• msgIMCurrentChanged
instlmgr.h
*ifndef CODEMGR INCLUDED
*define CODEMGR INCLUDED
*ifndef INSTLMGR INCLUDED
*include <instlmgr.h>
*endif
Status Codes
An application or service's name can be a max of nameBufLength - 4 chars.
*define stsCIMNameTooLong MakeStatus(clsCodeInstallMgr, 0)
Should this app or service be seen in the installer? This determines whether the user can configure and
deinstall it.
fdefine cimAttrDeinstallable FSMakeFix32Attr(clsCodelnstallMgr, 4)
typedef enum CIM_ATTR_DEINSTALLABLE {
cimDeinstallable 0, II Same as no attribute
cimNotDeinstallable =1
CIM_ATTR_DEINSTALLABLEi
Dependent application list
fdefine cimAttrAppList FSMakeVarAttr(clsCodelnstallMgr, 6)
Dependent services list
fdefine cimAttrServiceList FSMakeVarAttr(clsCodelnstallMgr, 7)
Common data structure used by msgCIMTerminateVetoed and msgCIMGetTerminateStatus.
typedef struct CIM_TERMINATE_VETOED {
1M_HANDLE handle;
OBJECT vetoer; II Object that vetoed the terminate.
STATUS status; II Veto status.
CIM_TERMINATE_VETOED, *P_CIM_TERMINATE_VETOED;
.Messages
msgCIMGetClassList
Passes back a list of the classes of the installed applications or services.
Takes P_LIST, returns STATUS.
fdefine msgCIMGetClassList l-1akeMsg (clsCodelnstallMgr, 1)
CAUTION: The caller must destroy the list object when it is finished using it.
msgIM GetList (instlmgr.h) Returns a list of handles.
msgCIMGetClass
Given a handle, passes back the class.
Takes P_CIM_GET_CLASS, returns STATUS.
fdefine msgCIMGetClass MakeMsg(clsCodelnstallMgr, 2)
typedef struct CIM GET CLASS
1M HANDLE handle; II Handle to get class on.
CLASS classld; II Out: class.
CIM_GET_CLASS, *P_CIM_GET_CLASS;
msgCIMFindClass
Returns the handle which references the specified class.
Takes P_CIM_FIND_CLASS, returns STATUS.
fdefine msgCIMFindClass MakeMsg(clsCodelnstallMgr, 3)
typedef struct elM FIND CLASS
CLASS classld; II Class to search for.
1M HANDLE handle; II Out: Resulting handle.
CIM_FIND_CLASS, *P_CIM_FIND_CLASS;
stsNoMatch No handle for this class was found.
CODEMGR.H 527
Messages
msgCIMFindProgram
Finds a item's handle, given its program name.
Takes P_CIM_FIND_PROGRAM, returns STATUS.
#define msgCIMFindProgram MakeMsg(clsCodeInstallMgr, 22)
typedef struct CIM FIND PROGRAM
P STRING pName; II Program name to search for
IM HANDLE handle; II Out: Resulting handle
CIM_FIND_PROGRAM, * P_CIM_FIND_PROGRAM;
stsNoMatch Item not found.
msgCIMLoad
Installs code for the item specified.
Takes P_CIM_LOAD, returns STATUS. Category: descendant responsibility.
#define msgCIMLoad MakeMsg(clsCodeInstallMgr, 4)
typedef struct CIM_LOAD
IM HANDLE handlei II Handle of item to load.
} CIM_LOAD, *P_CIM_LOADi
This message is sent to subclasses to do the actual work of installing the item. The working directory is
set to the source. pArgs->handle references the deactivated item to load.
msgCIMTerminateOK
Is this item willing to be terminated?
Takes P_CIM_TERMINATE_OK, returns STATUS. Category: descendant responsibility.
#define msgCIMTerminateOK MakeMsg(clsCodeInstallMgr, 5)
typedef struct CIM TERMINATE OK {
IM HANDLE handle; II Item to ask.
OBJECT vetoer; II Out: Object which vetoed the terminate.
CIM TERMINATE OK, *P_CIM_TERMINATE_OK;
msgCIMTerminate
Unconditionally terminate this item.
Takes P_CIM_TERMINATE, returns STATUS. Category: descendant responsibility.
#define msgCIMTerminate MakeMsg(clsCodeInstallMgr, 6)
typedef struct CIM_TERMINATE
IM_HANDLE handle;
} CIM_TERMINATE, *P_CIM_TERMINATEi
msgCIMTerminateVetoed
Somebody vetoed the termination sequence.
Takes P_CIM_TERMINATE, returns STATUS. Category: descendant responsibility.
#define msgCIMTerminateVetoed MakeMsg(clsCodeInstallMgr, 7)
MCSSC1g8 typedef struct CIM_TERMINATE {
Arg~Jn10nt5 IM HANDLE handlei
CIM_TERMINATE, *P_CIM_TERMINATEi
528 PENPOINT API REFERENCE
Part 12 I Installation API
msgCIMGetTerminateStatus
Gets termination status of last item deinstalled.
Takes P_CIM_TERMINATE_VETOED, returns STATUS.
#define msgC1MGetTerminateStatus MakeMsg(clsCode1nstallMgr, 8)
Mes$@g e typedef struct C1M_TERM1NATE_VETOED
Arguments 1M HANDLE handle;
OBJECT vetoer; II Object that vetoed the terminate.
STATUS status; II veto status.
C1M_TERM1NATE_VETOED, *P_CIM_TERM1NATE_VETOED;
If there was and error then pArgs->vetoer is the object which caused the error; an application instance in
the case of applications and a service instance in the case of services. pArgs->status is the termination
status.
DYNTABLE.H
This file contains the API definition for clsDynamicTableMgr.
clsDynamicTableMgr inherits from clsObject.
It allows a tk table to track the comings and goings of installable items.
Overview
tkTables (see tktable.h) are typically used to display static tables. However, there are times when clients
wish to build a tkTable that views a dynamic structure, such as the installed fonts or the currently
connected filesystem volumes. clsDynamicTableMgr allows a tk table to be dynamically updated as one
of these things changes. Specifically, clsDynamicTableMgr supports viewing the contents of an install
manager (see instlmgr.h) and filesystem volumes (see fs.h).
When the dynamic table manager is first created it generates a tkTable entry for each item in the
dynamic structure. The label of the tkTable entry is set to the name of the item. The tkTable entry is
tagged with the uid of the Install Manager handle or the uid of a volume's root directory handle.
If the specified Install Manager is theInstalledFonts and the entry class inherits from clsButton then the
short font id is also stored in'the entry's data field.
clsDynamicTKTableMgr also supports an optional write-in field that is added to the end of the tk table.
#ifndef DYNTABLE INCLUDED
#define DYNTABLE-INCLUDED
#ifndef CLSMGR INCLUDED
#include <clsmgr.h>
#endif
#ifndef FONT INSTALL INCLUDED
#include <fontmgr.h>-
#endif
#define dynTableNewFields \
objectNewFields \
DYN_TABLE_NEW_ONLY dynTablei
typedef struct DYN_TABLE_NEW {
dynTableNewFields
} DYN_TABLE_NEW, *P_DYN_TABLE_NEWi
Messages
msgNew
Creates a new dynamic table manager.
Takes P_DYN_TABLE_NEW, returns STATUS. Category: class message.
Me$s{1~e typedef struct DYN_TABLE_NEW {
Arguments dynTableNewFields
} DYN_TABLE_NEW, *P_DYN_TABLE_NEWi
msgNewDefaults
Initializes the DYN_TABLE_NEW structure to default values.
Takes P_DYN_TABLE_NEW, returns STATUS. Category: class message.
M¢$s{1~e typedef struct DYN_TABLE_NEW {
Arguments dynTableNewFields
} DYN_TABLE_NEW, *P_DYN_TABLE_NEWi
Sets
dynTable.style.showDeactivated = noShowDeactivatedi
dynTable.style.autoDestroy = truei
dynTable.style.ignoreRamVolume = truei
dynTable.style.putFontIdInData = truei
dynTable.style.addFillInField = falsei
msgDynTableGetTable
Gets the tkTable we are associated with.
Takes P_OBJECT, returns STATUS.
#define msgDynTableGetTable MakeMsg(clsDynamicTableMgr, 1)
DYNTABLE.H 531
Messages
msgDynTableSetTable
Sets our tkTable.
Takes OBJECT, returns SfATUS.
#define msgDynTableSetTable MakeMsg(clsDynamicTableMgr, 2)
This must be done whenever this object is restored. It is the client's responsiblity to relink the tkTable
with the dynamic table manager.
msgDynTableFindButton
Finds a button in the table which has the specified label.
Takes P _DYN_TABLE_FIND_BUTTON, returns STATUS.
#define msgDynTableFindButton MakeMsg(clsDynamicTableMgr, 3)
typedef struct DYN_TABLE_FIND_BUTTON {
P STRING pNamei II Label name of field to find.
OBJECT button; II Out: Found button.
DYN_TABLE_FIND_BUTTON, *P_DYN_TABLE_FIND_BUTTONi
stsN oMatch Label not found.
msgDynTableSetFilllnField
Sets the fill-in field to a text string.
Takes P_STRING, returns STATUS.
#define msgDynTableSetFillInField MakeMsg(clsDynamicTableMgr, 4)
stsBadParam There is no fill-in field in the table.
~---------------"
FONTMGR.H
This file contains the API definition for dsFontlnstallMgr.
dsFontlnstallMgr inherits from dslnstallMgr.
It performs font installation and maintenance.
There is a single instance of dsFontlnstallMgr in the system; the well-known uid theInstalledFonts.
The font manager maintains the installed and deinstalled fonts on the system. The font manager differs
from a generic install manager in the area of font identification and the system font.
A font is a structured file. The system comes with several pre-defined font files that are loaded at cold
boot time.
Font files typically reside in the \penpoint\font directory on a given filesystem volume. This is not a
requirement, however.
Fonts are identified in four ways:
• a font file handle
• a short font ID
• a string font ID
• the name of a font file
Font file handles are open file handles on to the font files. Much of the install manager interface uses
these handles. A short font ID is a pre-defined, 16 bit value that identifies a specific font. It is a
compact, specific reference for a particular font. The window system API uses short font IDs. A string
font ID is a 4 character string version of a short font ID. The font file name is the user-visible name for
the font. Given a handle, you can get the font file name by sending msgIMGetName. Given a short
font ID, you can get the font file name by sending msgFIMGetNameFromld.
NOTE: THE MESSAGES IN THIS CLASS ARE SENT TO THE MANAGER, NOT TO THE
HANDLES.
A list of all the font handles in the system is available via superclass message msgIMGetList. A pruned
list of the fonts that is appropriate for end-user display is available via msgFIMGetlnstalledIDList.
The following messages are not understood by dsFontlnstallMgr:
• msgIMGetCurrent
• msgIMSetCurrent
• msgIMDup
The following notification messages are not sent by dsFontlnstallMgr:
• msgIMCurrentChanged
instlmgr.h
#ifndef FONTMGR INCLUDED
#define FONTMGR-INCLUDED
#ifndef INSTLMGR INCLUDED
#include <instlmgr.h>
#endif
534 PENPOINT API REFERENCE
Part 12 / Installation API
Messages
msgNew
Creates a new font install manager.
Takes P_FIM_NEW, returns STATUS. Category: class message.
typedef struct FIM_NEW {
installMgrNewFields
} FIM_NEW, *P_FIM_NEW;
There is only one instance of this class, theInstalledFonts, in the system. Clients should never send
msgNew.
msgNewDefaults
Initializes the FIM_NEWstructure to default values.
Takes P_FIM_NEW, returns STATUS. Category: class message.
MSS£Og0 typedef struct FIM_NEW {
Ar9umOlti'S installMgrNewFields
} FIM_NEW, *P_FIM_NEW;
Sets
installMgr.fileMode 1= fsReadOnly 1fsSystemFile;
msgFIMGetld
Gets the short and long font IDs, given a handle.
Takes P_FIM_GET_SET_ID, returns STATUS.
fdefine msgFIMGetId MakeMsg(clsFontInstallMgr, 3)
FONTMGR.H 535
Messages
msgFIMSetld
Set the font file's ID.
Takes P _FIM_GET_SET_ID, returns STATUS.
*define msgFIMSetld MakeMsg(clsFontlnstallMgr, 4)
Mes5ug0 typedef struct FIM_GET_SET_ID
ArgtMt1&mts 1M_HANDLE handle; II Font handle to get IDs on.
FIM_SHORT_ID id; II Out: short version of ID.
FIM LONG ID longld; II Out: long ID version.
FIM_GET_SET_ID, *P_FIM_GET_SET_ID;
If the short version of the ID is 0 then the long version of the ID is used.
Note: A font ID is not normally changed. This message is here to allow a tool that edits font IDs to be
written.
msgFIMFindld
Finds a font handle given a short ID.
Takes P _FIM_FIND_ID, returns STATUS.
*define msgFIMFindld MakeMsg(clsFontlnstallMgr, 5)
typedef struct FIM_FIND_ID {
FIM_SHORT_ID id; II ID, short form
1M HANDLE handle; II Out: resulting handle
FIM_FIND_ID, *P_FIM_FIND_ID;
stsNoMatch font handle not found.
msgFIMGetNameFromld
Passes back font name given an short ID.
Takes P_FIM_GET_NAME_FROM_ID, returns STATUS.
*define msgFIMGetNameFromld MakeMsg(clsFontlnstallMgr, 6)
typedef struct FIM_GET_NAME_FROM_ID
FIM_SHORT_ID id;
P STRING pName; II Out: name, max size is nameBufLength
FIM_GET_NAME_FROM_ID, *P_FIM_GET_NAME_FROM_ID;
stsNoMatch short ID not found.
msgIMGetName Gets the name given a handle.
msgFIMGetlnstalledldList
Passes back a list of the short IDs of all installed fonts.
Takes P_FIM_GET_INSTALLED_ID_LIST, returns STATUS.
*define msgFIMGetlnstalledldList MakeMsg(clsFontlnstallMgr, 7)
536 PENPOINT API REFERENCE
Part 12 / Installation API
Status Codes
The hwx engine for this prototype set is not available
#define stsHIMEngineUnavailable MakeStatus(clsHWXProtoInstallMgr, 0)
Messages
msgNew
Creates a new handwriting prototype install manager.
Takes P_HIM_NEW, returns STATUS. Category: class message.
typedef struct HIM_NEW {
installMgrNewFields
} HIM_NEW, *P_HIM_NEW;
There is only one instance of this class, thelnstalledHWXProtos, in the system. Clients should never
send msgN ew.
msgHIMGetEngine
Gets the name and availability of the engine associated with this hwxprot.
Takes P_HIM_GET_SET_ENGINE, returns STATUS.
#define msgHIMGetEngine MakeMsg(clsHWXProtoInstallMgr, 1)
HWXMGR.H 539
Messages
msgHIMSetEngine
Set the hwxproto's engine name.
Takes P_HIM_GET_SET_ENGINE, returns STATUS.
#define msgHIMSetEngine MakeMsg(clsHWXProtoInstallMgr, 2)
Messt1£]e typedef struct HIM GET SET_ENGINE {
Ar9umenfs 1M HANDLE handle; II hwxproto handle to get engine name of.
P STRING pEngineName;11 Out: Name. Must have at least
II nameBufLength bytes allocated.
BOOLEAN available; II Out: Is the engine available?
HIM_GET_SET_ENGINE, *P_HIM_GET_SET_ENGINE; ;:
c(
Note: This message is rarely used. Typically, handwriting prototype sets have the engine attribute z
o
stamped on them when they are created, and it is never changed.
S
msgHlMAvailabilityChanged
An hwx proto's engine availability has changed.
Takes P _HIM_AVAILABILITY_NOTIFY, returns STATUS. Category: observer notification.
[
#define msgHIMAvailabilityChanged MakeMsg(clsHWXProtoInstallMgr, 20)
typedef struct HIM_AVAILABILITY_NOTIFY
OBJECT manager; II manager that sent notification
1M HANDLE handle; II handle that changed
BOOLEAN available; II new engine availability state
HIM_AVAILABILITY_NOTIFY, *P_HIM_AVAILABILITY_NOTIFY;
INIFILE.M
This file contains the API definition for clslniFileHandler.
clslniFileHandler inherits from clsObject.
Reads and processes a .ini file .
.ini files are used to ask the system to install multiple applications, services, or any installable entity. A
.ini file is an ASCII file that contains the path of each item to be installed on a seperate line. Examples
of .ini files include app.ini (applications) and service.ini (services).
To process a .ini file, simply create an instance of clslniFileHandler. The newArgs specify the location of
the .ini file. The .ini file will be completely processed as part of the msgNew. Free the ini file handler
immediately after creating it.
*ifndef INIFILE INCLUDED
*define INIFILE_INCLUDED
*ifndef CLSMGR_INCLUDED
*include <clsmgr.h>
*endif
*ifndef INSTLMGR_INCLUDED
*include <instlmgr.h>
*endif
Messages
msgNew
Creates a new ini file processor.
Takes P_INCFILE_NEW, returns STATUS. Category: class message.
typedef struct INI FILE STYLE
U16 deleteFileWhenDone 1, II Delete file after processing it.
returnInstallErrors 1, II Aborts the install and returns error
II status if true. Keeps going if false.
spare 11; II unused (reserved)
} INI_FILE_STYLE, *P_INI FILE_STYLE;
typedef struct INI_FILE_NEW_ONLY {
INI_FILE STYLE style;
1M- INSTALL- EXIST exist; II What to do if the item already
II exists.
FS LOCATOR locator; II .ini file location.
OBJECT manager; II Install manager to send
II msgIMInstalls to.
FS ATTR LABEL listAttrLabel; II List attr; 0 if not needed.
OBJECT listHandle; II FS handle for list attr; objNull
II if not needed.
OBJECT relDir; II Relative dir for ini file paths.
U8 spare [8];
INI_FILE_NEW_ONLY, *P_INI_FILE_NEW_ONLY;
*define iniFileNewFields \
objectNewFields \
INI_FILE_NEW_ONLY iniFile;
msgNewDefaults
Initializes the INCFILE_NEW structure to default values.
Takes P_INCFILE_NEW, returns STATUS. Category: class message.
M®$£~£Ie typedef struct INI_FILE_NEW {
Ar9ume~ts iniFileNewFields
} INI_FILE_NEW, *P_INI_FILE_NEW;
Sets
iniFile.styIe.returnlnstaliErrors = true;
iniFile.style.deleteFileWhenDone = false;
iniFile.listAttrLabel = 0;
iniFile.listHandle = objN ulI;
iniFile.exist = imExistReactivate;
INSTALL.H
This file contains definitions for IMProgramInstall and IMModuleLoad. The functions described in this
file are contained in INSTALL.LIB.
APPLICATION DEVELOPERS MUST USE THESE FUNCTIONS INSTEAD OF
OSProgramInstall AND OSModuleLoad.
OSProgramInstall and OSModuleLoad do not dispatch messages, because they are Ring 0 routines. This
will cause the system to lock up if the code being loaded needs to send messages to the process that
installed it, as all applications and services do.
#ifndef INSTALL INCLUDED
#define INSTALL_INCLUDED
IMProgramlnstall
Low-level .exe installation routine.
Returns STATUS.
STATUS EXPORTED IMProgramInstall(
P STRING pPath, II WorkingDir relative path of
II .exe or .dlc file
P STRING pWorkingDir,11 WorkingDir relative path of where
II to set the WorkingDir of the
II instance O's process
P OS PROG HANDLE pProgHandle,11 Out: program handle
- -
P STRING
- pBadName, I I Out-: if error, dll/exe that was bad
II Buffer must be nameBufLength
P STRING pBadRef II Out: If error, reference that was bad
); II Buffer must be nameBufLength
IMModuleLoad
Low-level .dll installation routine.
Returns STATUS.
fum:tktn Prototype STATUS EXPORTED IMModuleLoad (
P STRING pPath, II WorkingDir relative path of
II .dll or .dlc file
P STRING pWorkingDir,11 WorkingDir relative path of where
II to set the WorkingDir of the
II DLLMain() process
P- OS- PROG- HANDLE pProgHandle,11 Out: program handle
P STRING pBadName, II Out: if error, dll that was bad
II Buffer must be nameBufLength
P STRING pBadRef II Out: If error, reference that was bad
); II Buffer must be nameBufLength
INSTLMGR.H
This file contains the class definition and methods for clslnstallMgr.
clslnstallMgr inherits from clsObject.
Provides the basic facilities for installing items.
NOTE: THE MESSAGES IN THIS CLASS ARE SENT TO THE INSTALL MANAGER, NOT TO
THE HANDLES.
clslnstallMgr provides almost everything needed to manage installable items. An installable item is
anything that can be installed and deinstalled on a Penpoint machine, such as fonts, applications,
services, handwriting prototype sets, etc. You create an instance of clslnstallMgr for each category of
installable item. Penpoint creates well-known install managers for the following categories at cold boot
time:
• theInstalledHWXProtos: Handwriting prototype sets
• theInstalledPrefs: Preference sets
• theInstalledPDicts: Personal dictionaries
In addition there are several well-known install managers that are created from subclasses of
clslnstallMgr:
• theInstalledApps: Applications (appimgr.h)
• theInstalledServices: Services (servimgr.h)
• theInstalledFonts: Fonts (fontmgr.h)
clslnstallMgr makes use of the filesystem to keep a database of the installed items. Each item is
represented by a file or directory handle. This is a big win for items which *are* files or directories; the
InstallMgr's handle is a handle onto the actual item. There is an extra level of indirection for items
which are not files. The item's ID (whatever that means for a particular type of item) is stored as an
attribute of the handle. An item's name is the name of that item's filesystem node. This means that items
on a given install manager must have unique names.
An install manager has a base directory in which it keeps its items' filesystem nodes. The createlnitial
style bit determines whether the install manager creates an initial set of item handles from whatever is in
this directory when the install manager is first created.
clslnstallMgr provides an API for installing new items and deinstalling existing items. An item is
installed from a location on an external filesystem.
An item can be deinstalled, which removes all traces of the item from the system.
The install manager maintains a bit which specifies if an item has changed. It is the client's responsibility
to maintain this bit by sending msgIMSetModified when it modifies an item. The install manager will
remember the time and date that the item was modified.
Install managers also maintains a "current" item, and provide an API for getting and setting the current
item. This is used by theInstalledHWXProtos, thelnstalledPrefs and thelnstalledPDicts to specify
which handwriting prototype set, preferences, or personal dictionary the system is actively using. A
546 PENPOINT API REFERENCE
Part 12 I Installation API
current item is optional; some install managers (thelnstalledApps, thelnstalledServices) do not make
use of a current item.
An item can be marked as being "in use". This means that the item cannot be deinstalled.The current
item is considered to be in use.
Each install manager can have a verifier object, which it queries whenever installation takes place. The
verifier object makes sure that the item being installed is valid for this install manager.
An InstallMgr sends notification to its observers whenever an item is installed, deinstalled, the current
item changed, etc. Subclasses of clslnstallMgr can turn notification generation on and off with
msgIMSetNotify. Notification is on by default.
A subset of the notification messages are also sent to any observers of an item's handle. This allows
clients who are only interested in a particular item to monitor just that item. The messages sent are:
• msgIMN ameChanged
• msgIMInUseChanged
• msgIMModifiedChanged
• msgIMDeinstalled
• msgIMCurrentChanged (sent to both old and new current handles)
Clients access installable managers via an ObjectCall interface. clslnstallMgr can accommodate
simultaneous access by multiple clients if the "shared" style bit is set true (the default). This causes it to
semaphore all of its operations. This semaphore is available to subclasses via msgIMGetSema, and
should be used to protect all subclass messages if multiple clients will be accommodated. clslnstallMgr
also sets objCapCall on by default.
There is a well-known, shared list object (see list. h) that is a list of all the install managers in the system.
This object is called thelnstallManagers. You can observe this list and get notification when an install
manager is added and removed. See msgListN otifyAddition and msgListN otifyDeIetion.
clsFontlnstallMgr, clsApplnstallMgr, and clsServiceMgr inherit from clslnstallMgr. See fontmgr.h,
appimgr.h and servmgr.h for these classes.
#ifndef INSTLMGR INCLUDED
#define INSTLMGR INCLUDED
#ifndef CLSMGR_INCLUDED
#include <clsmgr.h>
#endif
#ifndef FS_INCLUDED
#include <fs.h>
#endif
#ifndef LIST_INCLUDED
#include <list.h>
#endif
#ifndef TKTABLE_INCLUDED
#include <tktable.h>
#endif
#ifndef OPTION INCLUDED
#include <option.h>
#endif
INSTLMGR.H 547
Common #defines and typedefs
Handle type
t ypede f OBJECT 1M_HANDLE, * P_1M_HANDLE;
Warning Codes
Some install manager request has been user cancelled
*define sts1MRequestCancelled MakeWarning(cls1nstallMgr, 0)
Status Codes
The item is current, so cannot be removed.
*define sts1MCurrent MakeStatus(cls1nstallMgr, 1)
An item to be installed failed verification.
*define sts1M1nvalid1tem MakeStatus(cls1nstallMgr, 2)
A new name cannot be created for this item.
*define sts1MUniqueNameFailed MakeStatus(cls1nstallMgr, 3)
The item is in use, so cannot be removed.
*define sts1M1nUse MakeStatus(cls1nstallMgr, 6)
The item to be installed is already installed.
*define sts1MAlready1nstalled MakeStatus(cls1nstallMgr, 8)
An invalid handle was passed in.
*define sts1MBadHandle MakeStatus(cls1nstallMgr, 20)
Debug Flags
#define installDebugFlag 'I'
Messages
msgNew
Creates a new install manager.
Takes P_1M_NEW, returns STATUS. Category: class message.
Argmnel1ts typedef struct IM STYLE
U16 shared 1, II Provide concurrency protection.
createInitial 1, II Create initial list of handles from
II contents of base directory.
autoSetCurrent 1, II Choose any item as the initial current
II setting if no one has current attr set.
copyOnInstall 1, II Copy nodes to manager's dir or create
II handles directly on Install locator.
addToGlobalList 1, II Add this instlmgr to theInstallManagers.
createIcon 1, II Create an icon for this install manager.
privatel 1, II Always set this to false.
duplicatable 1, II Items in this installmgr can be duplicated.
INSTLMGR.H 549
Messages
msgNewDefaults
Initializes the 1M_NEW structure to default values.
Takes P_1M_NEW, returns STATUS. Category: class message.
Mess@ge typedef struct 1M_NEW {
Arguments installMgrNewFields
} 1M_NEW, *P_IM_NEW;
Clients do not normally change the defaults.
550 PEN POINT API REFERENCE
Part 12 I Installation API
msgDestroy
Frees the install manager.
Takes OBLKEY, returns STATUS.
Note: This message does not destroy the install manager's directory, nor any files/directories in that
directory.
msgDump
Prints out the items in the install manager and their state.
Takes OBJ_KEY, returns STATUS.
msgIMGetStyle
Passes back the current style settings.
Takes P_1M_STYLE, returns STATUS.
fdefine msgIMGetStyle MakeMsg(clsInstaIIMgr, 1)
M©s£Qge typedef struct 1M STYLE
Arguments U16 shared 1, II Provide concurrency protection.
create Initial 1, II Create initial list of handles from
II contents of base directory.
autoSetCurrent 1, II Choose any item as the initial current
II setting if no one has current attr set.
copyOnInstal1 1, II Copy nodes to manager's dir or create
II handles directly on Install locator.
addToGlobalList 1, II Add this instlmgr to theInstallManagers.
createIcon 1, II Create an icon for this install manager.
privatel 1, II Always set this to false.
duplicatable 1, II Items in this installmgr can be duplicated.
usesVersions 1, II Items in this installmgr have versions.
reserved 7;
U16 sizeCol 1, II Show size column in Settings NB card.
hwxTypeCol 1, II Show hwx engine type column.
svcTypeCol 1, II Show service type column.
modifiedCol 1, II Show modified column.
current Col 1, II Show current column.
INSTLMGR.H 551
Message.
msgIMSetStyle
Sets the current style.
Takes P_IM_STYLE, returns STATUS.
*define msgIMSetStyle MakeMsg(clsInstallMgr, 2)
MeS50ge typedef struct 1M_STYLE
ArglJments U16 shared 1, II Provide concurrency protection,
createInitial 1, II Create initial list of handles from
II contents of base directory.
autoSetCurrent . 1, II Choose any item as the initial current
II setting if no one has current attr set.
copyOn1nstall 1, II Copy nodes to manager's dir or create
II handles directly on Install locator.
addToGlobalList 1, II Add this instlmgr to thelnstallManagers.
createIcon 1, II Create an icon for this install manager.
private1 1, II Always set this to false.
duplicatable 1, II Items in this installmgr can be duplicated.·
usesVersions 1, II Items in this installmgr have versions.
reserved 7;
U16 sizeCol 1, II Show size column in Settings NB card.
hwxTypeCol 1, II Show hwx engine type column.
svcTypeCol 1, II Show service type column.
modifiedCol 1, II Show modified column.
currentCol 1, II Show current column.
inUseCol 1, II Show inUse column.
reserved1 10;
U32 help1d; II Help tag for instal~mgr's Settings NB card.
U16 spare1;
U16 spare2;
1M_STYLE, *P_IM_STYLE;
msgIMGetlnstallerName
Passes back the install manager's name.
Takes P_STRING, returns STATUS.
*define msgIMGet1nstallerName MakeMsg(clsInstallMgr, 3)
pArgs must point to a nameBufLength buffer.
The install manager's name was set at msgNew time in installMgr->pName.
msgIMGetlnstallerSingularName
Passes back the install manager's singular name.
Takes P_STRING, returns STATUS.
*define msgIMGetInstallerSingularName MakeMsg(clslnstallMgr, 51)
pArgs must point to a nameBufLength buffer.
The install manager's name was set at msgNew time in installMgr->pName.
552 PENPOINT API REFERENCE
Part 12 / Installation API
msgIMGetCurrent
Passes back the current item's handle.
Takes P_1M_HANDLE, returns STATUS.
tdefine msgIMGetCurrent MakeMsg(clslnstallMgr, 4)
Passes back objNo1l if there is no current handle.
msgIMSetCurrent
Sets the current item.
Takes 1M_HANDLE, returns STATUS.
tdefine msgIMSetCurrent MakeMsg(clslnstallMgr, 5)
«()mments The argument is the handle to be made current. It can be objN 011 to indicate that no handle is the
current one.
If the handle specified in the argument is already current then nothing is done (no observer message is
generated) .
Causes the install manager to notify observers with msgIMCurrentChanged.
msgIMSetlnUse
Changes an item's in use setting.
Takes P_IM_SET_INUSE, returns STATUS.
tdefine msgIMSetlnUse MakeMsg(clslnstallMgr, 6)
typedef struct IM_SET_INUSE {
IM HANDLE handle; II Handle of item to set inUse on.
BOOLEAN inUse; II InUse value.
IM_SET_INUSE, *P_IM_SET_INUSE;
Setting inUse to true means that the item cannot be deinstalled.
Use msgIMGetState to query the value of this field.
Causes the install manager to notify observers with msgIMlnUseChanged.
msgIMSetModified
Changes an item's modified setting.
Takes P_IM_SET_MODIFIED, returns STATUS.
tdefine msgIMSetModified MakeMsg(clslnstallMgr, 7)
typedef struct IM SET MODIFIED
IM HANDLE handle; II Handle of item to set modified on.
BOOLEAN modified; II Modified value.
I~SET_MODIFIED, *P_IM_SET_MODIFIED;
~sgI~{;et~anne
Get the name of a item.
~sgI~SetNanne
Sets the name of a item.
~sgIM{;etVersion
Get the version string for this item.
Takes P_IM_GET_VERSION, returns SfATUS.
#define msgIMGetVersion MakeMsg(clsInstallMgr, 37)
typedef struct 1M GET VERSION
1M HANDLE handle; II Handle of item to get version of.
P STRING pVersion; II Out: Version string. Pointer must
II reference a nameBufLength
II size buffer.
} IM_GET_VERSION, *P_IM_GET_VERSION;
Not all install managers have a version string. pVersion is set to pN ull if there is no version.
~sgIM (;etList
Passes back a list of all the items on this install manager.
Takes P_LIST, returns STATUS.
#define msgIMGetList MakeMsg(clsInstallMgr, 14)
The memory for the list object is allocated out of the caller's local process heap.
CAUTION: Caller must destroy the list object when it is finished using it.
554 PENPOINT API REFERENCE
Part 12 / Installation API
nnsgI~(;etState
Gets the state of a item.
Takes P_IM_GET_STATE, returns STATUS.
tdefine msgIMGetState MakeMsg(clsInstallMgr, 16)
typedef struct IM_GET_STATE {
IM HANDLE handle; II Handle of item to get state on.
BOOLEAN current; II Out: Is it the current item?
BOOLEAN reserved; II Reserved.
BOOLEAN modified; II Out: Is it modified?
BOOLEAN inUse; II Out: Is it in use?
IM_GET_STATE, *P_IM_GET_STATE;
msgI~(;etSize
Returns the size of an item.
Takes P_1M_GET_SIZE, returns STATUS.
tdefine msgIMGetSize MakeMsg(clsInstallMgr, 17)
typedef struct IM_GET_SIZE {
IM HANDLE handle; II Handle of item to get size of.
U32 size; II Out: size.
IM_GET_SIZE, *P_IM_GET_SIZE;
msgI~Install
Installs a new item.
Takes P_1M_INSTALL, returns STATUS.
tdefine msgIMInstall MakeMsg(clsInstallMgr, 18)
typedef enum IM_INSTALL_EXIST {
irnExistUpdate 0, II Copy new over existing.
irnExistReactivate 1, II Deactivate existing, then activate new.
irnExistGenError 2, II Return stsIMAlreadyInstalled.
irnExistGenUnique 3, II Generate a unique name for the new item.
irnExistIncRefCount 4 II Just increment ref count of existing item.
IM INSTALL EXIST, *P_I~INSTALL_EXIST;
typedef struct IM_INSTALL {
FS LOCATOR locator; II Location of item on external
II filesystem.
IM INSTALL EXIST exist; II What to do if item already exists.
FS ATTR LABEL listAttrLabel; II Attr list to add install handle to.
OBJECT listHandle; II filesystem handle to put attr on.
IM HANDLE handle; II Out: Handle of installed item.
IM_INSTALL, *P_IM_INSTALL;
The install manager derives the item's name from the filesystem location specified in pArgs->locator.
pArgs->exist controls what happens if an item of the same name as the item to be installed already exists.
pArgs->listAttrLabel and pArgs->listHandle are used to specify an attr list to which the install handle is
added. This is used to keep track of sub-apps and sub-services. Set these arguments to 0 if this should
not be done.
Causes the install manager to notify observers with msgIMlnstalled. The install manager also sends
msgIMModifiedChanged if the modified states changed due to the install.
INSTLMGR.H 555
Messages
msgIMDeinstall
Deinstalls an item.
Takes P_IM_DEINSTALL, returns SfATUS.
#define msgIMDeinstall MakeMsg(clsInstallMgr, 19)
typedef struct IM_DEINSTALL
1M_HANDLE handle; II Item to delete.
} IM_DEINSTALL, *P_IM_DEINSTALL;
All traces of the item are removed, including the item's handle.
stsIMlnUse Item is in use; cannot be deinstalled.
msgIMDup
Creates a new item that is a duplicate of an existing one.
Takes P_IM_DUP, returns SfATUS.
#define msgIMDup MakeMsg(clsInstallMgr, 23)
typedef struct 1M DUP
1M HANDLE handle; II item to duplicate.
P_STRING pName; II new name. If pNull then a unique name
II is generated.
1M HANDLE newHandle; II Out: Handle to the new item.
IM_DUP, *P_IM_DUP;
Causes the install manager to notify observers with msgIMlnstalled.
stslMAlreadylnstalled An item with pArgs->name already exists.
msgIMFind
Finds a item's handle, given its name.
Takes P_1M_FIND, returns SfATUS.
#define msgIMFind MakeMsg(clsInstallMgr, 24)
Arguments typedef struct 1M FIND
P STRING pName; II Resource name to search for
handle; II Out: Resulting handle
1M_FIND, *P_IM_FIND;
stsN oMatch Item not found.
msgIMGetSema
Gets the concurrency protection semaphore.
Takes P_OS_FAST_SEMA, returns STATUS.
#define msgIMGetSema MakeMsg(clsInstallMgr, 25)
This message is for subclasses that need to do concurrency protection to their messages. Subclasses
should get this semaphore and aquire and release it at the beginning and end of their messages.
Subclasses should use this semaphore instead of creating one of their own in order to avoid race
conditions.
556 PEN POINT API REFERENCE
Part 12 / Installation API
msgIMGetDir
Passes back a directory handle on the install manager's directory.
Takes P_OBJECT, returns STATUS.
tdefine msgIMGetDir MakeMsg(clslnstallMgr, 26)
This dir handle is owned by the install manager; clients must not destroy it!
msgIMGednstallPath
Passes back the install base path.
Takes P_STRING, returns STATUS.
tdefine msgIMGetlnstallPath MakeMsg(clslnstallMgr, 27)
Comments The install base path is an absolute path to the install manager's directory.
pArgs must point to an fsPathBufLength sized buffer.
msgIMGetVerifier
Passes back the current verifier object.
Takes P_OBJECT, returns STATUS.
tdefine msgIMGetVerifier MakeMsg(clslnstallMgr, 33)
This object is sent msgIMVerify whenever an item is attempted to be installed. The verifier should
return stsOK if the item is valid, stsFailed if it isn't.
msgIMSetVerifier
Sets the current verifier object.
Takes OBJECT, returns STATUS.
tdefine msgIMSetVerifier MakeMsg(clslnstallMgr, 34)
Comments This object is sent msgIMVerify whenever an item is attempted to be installed. The verifier should
return stsOK if the item is valid, stsFailed if it isn't.
msgIMVeriry
Verify the validity of an item that is being installed.
Takes OBJECT, returns STATUS.
tdefine msgIMVerify MakeMsg(clslnstallMgr, 35)
This message is sent to an install manager's verifier object whenever an installation is attempted.
pArgs specifies the node being installed. It is either a file handle or a dir handle. The verifier object
should determine if the item to be installed is valid, and return stsOK if so, stsFailed if not.
msgIMExists
Verify the existance of an item that is being installed.
Takes P_1M_EXISTS, returns STATUS.
tdefine msglMExists MakeMsg(clslnstallMgr, 61)
INSTLMGR.H 557
UI Messages
UI Messages
msgIMUllnstall
Installs a new item with a user interface.
Takes P_IM_ UCINSTALL, returns SfATUS.
#define msgIMUIInstall MakeMsg(clsInstallMgr, 38)
typedef struct 1M UI INSTALL a:c(
FS LOCATOR locator; II Location of item on external z
II filesystem. o
1M HANDLE handle;
IM_UI_INSTALL, *P_IM_UI_INSTALL;
II Out: Handle of installed item. 5
Comments Performs msgIMInstall, but lets the user decide exist behavior. Pops up a progress note which allows the
user to cancel the install. Informs the user of successful or unsucessful completion.
Returns msgIMlnstall statuses. II
msgIMUIDeinstall
Deinstalls an item with a user interface.
Takes P_IM_UCDEINSTALL, returns STATUS.
#define msgIMUIDeinstall MakeMsg(clsInstallMgr, 58)
Arguments typedef struct IM_UI_DEINSTALL
1M_HANDLE handle; II Item to deinstall.
} IM_UI_DEINSTALL, *P_IM_UI_DEINSTALL;
Returns msgIMDeinstall statuses.
msgIMUIDup
Duplicates and item with a UI.
Takes P_IM_UCDUP, returns STATUS.
#define msgIMUIDup MakeMsg(clsInstallMgr, 39)
typedef struct IM_UI_DUP {
1M HANDLE handle; II item to duplicate.
P STRING pName; II new name. If pNull then a unique name
II is generated.
1M HANDLE newHandle; II Out: Handle to the new item.
IM_UI_DUP, *P_IM_UI_DUP;
Returns msgIMDup statuses.
558 PENPOINT API REFERENCE
Part 12 / Installation API
Notification Messages
msgIMNameChanged
The name of a item has changed.
Takes P_1M_NOTIFY, returns STATUS. Category: observer notification.
fdefine msgIMNameChanged MakeMsg(clsInstallMgr, 40)
typedef struct 1M NOTIFY
OBJECT manager; II manager that sent notification.
1M HANDLE handle; II handle that changed.
U8 reserved[40];
1M NOTIFY, *P_IM_NOTIFY;
msgIMCurrentChanged
The current item has changed.
Takes P_IM_CURRENT_NOTIFY, returns STATUS. Category: observer notification.
fdefine msgIMCurrentChanged MakeMsg(clsInstallMgr, 42)
typedef struct 1M CURRENT NOTIFY
OBJECT manager; II manager that sent notification
1M HANDLE newHandle; II the new current handle
1M HANDLE oldHandle; II the previous current handle
U8 reserved[40];
IM_CURRENT_NOTIFY, *P_IM_CURRENT_NOTIFY;
msgIMlnUseChanged
An item's inUse attribute has changed.
Takes P_IM_INUSE_NOTIFY, returns STATUS. Category: observer notification.
fdefine msgIMInUseChanged MakeMsg(clsInstallMgr, 43)
typedef struct 1M INUSE NOTIFY
OBJECT manager; I I manager that sent notification
1M HANDLE handle; II handle that changed
BOOLEAN inUse; II new inUse state
U8 reserved[40];
IM_INUSE_NOTIFY, *P_IM_INUSE_NOTIFY;
msgIMModifiedChanged
An item's modified attribute has changed.
Takes P_1M_MODIFIED_NOTIFY, returns STATUS. Category: observer notification.
fdefine msgIMModifiedChanged MakeMsg(clsInstallMgr, 44)
typedef struct 1M MODIFIED NOTIFY
OBJECT manager; II manager that sent notification
1M HANDLE handle; II handle that changed
BOOLEAN modified; II new modified state
U8 reserved[40];
IM_MODIFIED_NOTIFY, *P_IM_MODIFIED_NOTIFY;
INSTLMGR.H 559
Private
msgIMlnstalled
A new item was installed.
Takes P _1M_NOTIFY, returns STATUS. Category: observer notification.
*define msgIMInstalled MakeMsg(clsInstallMgr, 45)
MC$sogc typedef struct 1M NOTIFY
ArgtJments OBJECT manager; II manager that sent notification.
1M HANDLE handle; II handle that changed.
U8 reserved[40];
1M_NOTIFY, *P_IM_NOTIFY;
msgIMDeinstalled
An item has been deinstalled.
Takes P _IM_DEINSTALL_NOTIFY, returns STATUS. Category: observer notification.
*define msgIMDeinstalled MakeMsg(clsInstallMgr, 46)
typedef struct IM_DEINSTALL_NOTIFY
OBJECT manager; II manager that sent notification.
1M HANDLE handle; II handle of item that was deinstalled.
U8 pName[nameBufLength]; II item name.
U8 pVersion[nameBufLength];11 item version.
U8 reserved[40];
IM_DEINSTALL_NOTIFY, *P_IM_DEINSTALL_NOTIFY;
(~{}mments Since the handle is no longer valid when this message is recieved, the pArgs includes all information
about the item.
Private
msgIMDeactivate
Deactivate an item.
Takes P_IM_DEACTIVATE, returns STATUS.
*define msgIMDeactivate MakeMsg(clsInstallMgr, 20)
typedef struct 1M_DEACTIVATE
1M_HANDLE handle; II item to deactivate.
} 1M_DEACTIVATE, *P_IM_DEACTIVATE;
This removes everything but an empty filesytem node with attributes which represents the item. The
item's handle and attributes remain intact.
Returns
stsRequestNotSupported style.copyOnInstall is false. Install mgrs of this style don't support
deactivation.
msglMActivate
Activate an item by copying it in from disk.
Takes P _1M_ACTIVATE, returns STATUS.
*define msgIMActivate MakeMsg(clsInstallMgr, 21)
560 PENPOINT API REFERENCE
Part 12 / Installation API
msgAppMgrGetMetrics
Returns generic icon for this installer.
Takes P_APP_MGR_METRICS, returns STATUS.
Install managers understand this message so they can present an icon for use by the disk manager. Install
managers look for their icons in the system resource file.
Only the iconBitmap, smallIconBitmap, and name fields of pArgs are filled in.
msglMAddCards
Asks the install manager to add option cards for the specified item.
Takes P_IM_ADD_CARDS, returns STATUS.
*define msgIMAddCards MakeMsg(clsInstallMgr, 56)
typedef struct IM_ADD_CARDS
IM_HANDLE handle; II Item to add cards for. Can be objNull.
OPTION_TAG optionTag; II msgOptionAddCards argument.
IM_ADD_CARDS, *P_IM_ADD_CARDS;
The handle argument specifies the currently selected item. It may be objNull if there is no selection.
This message is a superset of msgOptionAddCards. The optionTag argument is exactly the same as that
for msgOptionAddCards.
msgIMSetNotify
Turns notification generation on or off.
Takes BOOLEAN, returns STATUS.
*define msgIMSetNotify MakeMsg(clsInstallMgr, 28)
msgIMGetNotify
Returns notification generation state.
Takes P_BOOLEAN, returns STATUS.
*define msgIMGetNotify MakeMsg(clsInstallMgr, 29)
msgIMRemoveHandle
Removes and frees a handle from our internal list.
Takes OBJECT, returns STATUS.
*define msgIMRemoveHandle MakeMsg(clsInstallMgr, 30)
INSTLMGR.H 561
Private
msgIMRenameUninstalledItem
Renames an item on disk.
Takes P_IM_RENAME_UNINSTALLED, returns STATUS.
#define msgIMRenameUninstalledltem MakeMsg(clslnstaIIMgr, 53)
typedef struct 1M_RENAME UNINSTALLED {
FS LOCATOR locator; II Location of item to rename. Must not
II be an absolute path!
P STRING pOldName; II Old name.
P STRING pNewName; II New name.
IM_RENAME_UNINSTALLED, *P_IM_RENAME_UNINSTALLED;
msgIMGetSettingsMenu
Sets a pointer to the tkTable entries for the Settings NB menu.
Takes PP_TK_TABLE_ENTRY, returns STATUS.
#define msgIMGetSettingsMenu MakeMsg(clslnstaIIMgr, 54)
Comments pArgs must be the address of a P_TK_TABLE_ENTRY pointer.
msgIMGetltemlcon
Gets the icons for a given item.
Takes P_IM_GET_ITEM_ICON, returns STATUS.
#define msgIMGetltemlcon MakeMsg(clslnstaIIMgr, 57)
fl%r9!Jmeni's typedef struct 1M- GET- ITEM- ICON
1M HANDLE handle; II
Handle of item.
OBJECT iconBitmap; II
Out: Icon bitmap.
TAG iconTag; II
Out: Icon's tag in resfile.
BOOLEAN iconlnSystemRes; II
Out: Is this icon in system
II resource file?
OBJECT smalllconBitmap; II
Out: Small icon bitmap.
TAG smalllconTag; II
Out: Icon's tag in resfile.
BOOLEAN smalllconlnSystemRes;11 Out: Is this icon in system
II resource file?
U32 reserved;
1M GET_ITEM_ICON, *P_IM_GET_ITEM ICON;
-------------------------------
I NSTLSHT.H
#ifndef INSTLSHT_INCLUDED
#define INSTLSHT_INCLUDED
#ifndef TKTABLE INCLUDED
#include <tktable.h>
#endif
#ifndef FS_INCLUDED
#include <fs.h>
#endif
#ifndef OPTION INCLUDED
#include <option.h>
#endif
564 PEN POINT API REFERENCE
Part 12 I Installation API
Messages
msgIUIShowCard
Show the specified Installer category card.
Takes P_IUeSHOW_CARD, returns STATUS.
fdefine msgIUIShowCard MakeMsg(clslnstallUISheet, 1)
typedef struct lUI SHOW CARD
CHAR pCardName[nameBufLength]; II Card Name. These names
II correspond to installmgr
II names; ie. Applications,
II Services, Fonts. See
II instlmgr.h.
TAG itemTag; I I If name is of zero length
II use the tag
lUI_SHaW_CARD, * P_IUI_SHOW_CARD;
stsFailed The specified card was not found.
msgIUISelecdtem
Set the selection to an item on the current card.
Takes p_IUeSELECT_ITEM, returns STATUS.
fdefine msgIUISelectltem MakeMsg(clslnstallUISheet, 2)
typedef struct IUI_SELECT_ITEM {
CHAR pltemName[nameBufLength]; II Name of item to select.
TAG itemTag; II If name is of zero length
II use the tag
IUI_SELECT_ITEM, * P_IUI_SELECT_ITEM;
stsFailed The specified item was not found.
msgIUI GetSelectionUID
Gets the UID of the selection on the current card.
Takes P_UID, returns STATUS.
fdefine msgIUIGetSelectionUID MakeMsg(clslnstallUISheet, 5)
stsFailed There is no selection.
msgIUI GetSelectionName
Gets the name of the selection on the current card.
Takes P_CHAR, returns STATUS.
fdefine msgIUIGetSelectionName MakeMsg(clslnstallUISheet, 6)
stsFailed There is no selection.
msgIUIGe~etrics
Get installUI metrics.
Takes p_IUeMETRICS, returns STATUS.
fdefine msgIUIGetMetrics MakeMsg(clslnstallUISheet, 3)
INSTLSHT.H 565
Messages
instlmgr.h
#ifndef PDICTMGR INCLUDED
#define PDICTMGR INCLUDED
#ifndef INSTLMGR_INCLUDED
#include <instlmgr.h>
#endif
Messages
msgNew
Creates a new personal dictionary install manager.
Takes P_PIM_NEW, returns STATUS. Category: class message.
------.----------,~--~~
5ERVIMGR.H
This file contains the API definition for clsServiceInstallMgr.
clsServiceInstallMgr inherits from clsCodeInstallMgr.
Manages installation and deinstallation of services.
There is a single instance of clsServiceInstallMgr in the system; the well-known uid
thelnstalledServices.
thelnstalledServices performs installation and deinstallation of services, allows you to enumerate all of
the services that are currently installed, and find out their classes.
See service.h for the messages that a service implementor needs. See servmgr.h for the messages that a
service client uses to find and open a particular service.
Services provide non-application functionality under PenPoint; typically some form of background
server or device driver. Examples of services include: device drivers, inbox/outbox transfer agents such as
fax and e-mail, network protocol stacks, and databases.
A service is a directory, usually located under \penpoint\service on a given filesystem volume. The name
of the directory is the name of the service. Within this directory are one or more .dlls that make up the
servIce.
If a service includes more than one .dll there must also be a .dIc file which lists all the .dlls. The name of
the .dIc file (or the name of the .dll file if there is only one .dll) must be the same as the name of the
service. If a service is called MAIL, for example, its ,.dIc file must be named MAIL.DLC. You can use the
SfAMP.EXE utility to give a service an extended name. Be sure to stamp the .dIc file as well.
A service can contain an init.dll. This .dll will be loaded, run, and unloaded during service loading. This
can be used to set up or modify the service's resource file programmatically. A handle to the service's
resource file is available to init.dll via msgSvcGetClassMetrics.
When a service is installed, a service directory is created in the RAM filesystem. All of the state for that
service lives in this directory.
A service can have an optional MIse directory. This is very similar to an application's MISe directory.
MIse is used to store static data files that are common to all service instances. The MISe directory will
be copied into the service directory when the service is installed. You can get to the MISe directory
from a service instance by getting class metrics, then specifying a path of "MISe" relative to the service's
directory.
A service can have a resource file, called service.res. This is similar to an application's app.res file. The
resource file is automatically copied to the service directory in RAM when the service is installed, and a
resource file handle is opened on it and stored in the service class metrics. This resource file should
contain the service's VI components and quick-help resources. Each service's resource file handle is
added to the well-known resList theServiceResList. Quick-help searches theServiceResList as part of its
normal operation. Note that theServiceResList is not callable; you must ObjectSend to it.
570 PEN POINT API REFERENCE
Part 12 / Installation API
There is an optional INST directory in a service directory, which contains saved service instance state
nodes. Pre-configured service instances will be created from the nodes in this directory when the service
is loaded (see service.h for details).
There can also be a service.ini and app.ini file in the service directory. These specify any additional
services and applications that should be installed when this service is installed. These services and
applications are deinstalled when the service is deinstalled. If one of these services or applications is
already installed it is reference counted, not installed again.
A service is installed by sending msgIMInstall to theInstalledServices. Services are installed under user
control from the Services card of the Settings Notebook, or via the pop-up quick installer (see
qckinstl.h). \ \boot\penpoint\boot\service.ini specifies services that are automatically loaded when the
system cold-boots.
Each installed service has a service directory in the RAM filesystem, under \penpoint\sys\service. For
example, service MAIL would have \penpoint\sys\service\mail. The instance state nodes for the service
are kept in a directory called INST, under this directory. If the service has preconfigured instances then
they are copied to the INST directory when the service is first installed.
Each installed service is represented by a handle, in a fashion similar to other install managers (see
instlmgr.h). This handle is a directory handle onto the service's directory in the RAM filesystem.
NOTE: THE MESSAGES IN THIS CLASS ARE SENT TO THE MANAGER, NOT TO THE
HANDLES.
A service can be deinstalled. Deinstallation removes all traces of a service and decrements the reference
count for any dependent services or applications. All service instances are removed from their service
managers and freed when a service is deinstalled.
Deinstallation only occurs if the main service and all dependent applications and services agree to
deinstall. A service or application can veto the deinstallation if it chooses. The default behavior for
services is to veto if any service instance is open (in use).
The following superclass messages are not understood by dsServiceInstallMgr:
• msgIMGetCurrent
• msgIMSetCurrent
• msgIMSetName
• msgIMDup
The following notification messages are not sent by dsServicelnstallMgr:
• msgIMN ameChanged
• msgIMCurrentChanged
NOTE: Each service must contain one and only one service class. Don't try and define more than one
service class in a single service.
instlmgr.h
#ifndef SERVIMGR INCLUDED
#define SERVIMGR=INCLUDED
#ifndef SERVICE_INCLUDED
#include <service.h>
#endif
#ifndef CODEMGR_INCLUDED
#include <codemgr.h>
#endif
SERVIMGR.H 571
Messages
Well-known filenames
These are the files created by c1sServicelnstallMgr in a service's directory.
#define svcResFileName "service. res"
Messages
msgNew
Creates a new service installation manager.
Takes P_SIM_NEW, returns STATUS. Category: class message.
typedef struct SIM_NEW {
installMgrNewFields
} SIM_NEW, *P_SIM_NEW;
There is only one instance of this class, thelnstalledServices, in the system. Clients should never send
msgNew.
msgSIMGetMetrics
Gets the specified service class's metrics.
Takes P _SIM_GET_METRICS, returns STATUS.
#define msgSIMGetMetrics MakeMsg(clsServiceInstall~gr, 1)
typedef struct SIM GET METRICS
IM HANDLE handle; II Handle of service class to get metrics
lion.
SVC_CLASS_METRICS metrics; II Out: metrics.
SIM GET METRICS, *P_SIM_GET_METRICS;
See service.h for SVC_CLASS_METRICS.
SYSTEM.H
This file contains the API definition for dsSystem.
dsSystem inherits from clsObject.
Provides information about the system.
There is a single instance of clsSystem, theSystem. You send all clsSystem messages to theSystem.
theSystem manages PenPoint booting. If you need to know when PenPoint booting reaches a certain
stage or is complete then you can observe theSystem and recieve msgBootStateChanged. You can also
send msgSysGetBootState to find out what stage booting is currently at.
PenPoint Booting Sequence
Kernel Kernel
System Dlls Loaded (boot.dlc) System Dll Upgrade
System Apps Installed (sysapp.ini) System Dlls reinitialized
Initial App Installed Instance O's/DLLMain()s rerun
Bookshelf Created App Upgrade
Services Installed (service.ini) Services Upgrade
Apps Installed (app.ini) Run Initial App
Run Initial App Boot Complete
Boot Complete
This header file defines constants for all the interesting PenPoint filesystem locations that you might be
tempted to hard-code. Use these defines instead; for example, to set a string to the location where
PenPoint applications live, use:
strcpy(pFOO, sysBaseDir "\\" syslnstallableAppDir);
PenPoint defines "live" areas for documents on volumes. The live area is where the volume's bookshelf is.
Use msgSysGetLiveRoot to access the live area on a volume.
#ifndef SYSTEM INCLUDED
#define SYSTEM_INCLUDED
#ifndef APPDIR_INCLUDED
#include <appdir.h>
#endif
#ifndef APPMGR_INCLUDED
#include <appmgr.h>
#endif
#ifndef UUID INCLUDED
#include <uuid.h>
#endif
574 PENPOINT API REFERENCE
Part 12 I Installation API
Boot state.
typedef struct SYS_BOOT_STATE {
BOOLEAN booted; II Has booting totally completed?
SYS BOOT PROGRESS progress; II Where are we in the boot cycle?
SYS BOOT TYPE type; II Boot type; warm or cold.
CLASS initialAppClass; II Class of the initial app.
SYS_BOOT_STATE, *P_SYS_BOOT_STATE;
Messages
msgNew
Used by PenPoint to create well-known uid theSystem.
Takes P_SYS_NEW, returns STATUS. Category: class message.
typedef struct SYS_NEW_ONLY {
U32 unused1;
U32 unused2;
U32 unused3;
U32 unused4;
SYS~NEW_ONLY, *P_SYS_NEW_ONLY;
#define systemNewFields \
objectNewFields \
SYS NEW ONLY system;
typedef struct SYS_NEW
systemNewFields
} SYS_NEW, *P_SYS_NEW;
Comments This message should never be called by anybody else.
msgSysGetBootState
What stage of booting is the system in?
Takes P_SYS_BOOT_STATE, returns STATUS.
#define msgSysGetBootState MakeMsg(clsSystem, 1)
Me5S($ge typedef struct SYS_BOOT_STATE
Arguments BOOLEAN booted; II Has booting totally completed?
SYS BOOT PROGRESS progress; II Where are we in the boot cycle?
SYS BOOT TYPE type; II Boot type; warm or cold.
CLASS initialAppClass; II Class of the initial app.
SYS_BOOT_STATE, *P_SYS_BOOT_STATE;
This message allows callers to determine the current state of system booting.
msgSysBootStateChanged Observer message sent at each stage.
msgSysGetRuntimeRoot
Returns a dir handle onto the root of the Penpoint runtime area.
Takes P_OBJECT, returns STATUS.
#define msgSysGetRuntimeRoot MakeMsg(clsSystem, 2)
C($mments Penpoint maintains all of its runtime information in one area of the filesystem on the" selected" volume
(theSelectedVolume). This message returns a directory handle onto the root of this area.
NOTE: Caller must free the handle when finished.
576 PENPOINT API REFERENCE
Part 12 / Installation API
msgSysGetLiveRoot
Returns an appDir handle onto the root of a volume's live document area.
Takes P_SYS_GET_LIVE_ROOT, returns SfATUS.
#define msgSysGetLiveRoot MakeMsg(clsSystem, 3)
typedef struct SYS_GET_LlVE_ROOT {
OBJECT volHandle; II
Handle onto volume in question.
OBJECT liveRoot; II
Out: appDir handle to live root on
II
the volume.
SYS_GET_LlVE_ROOT, *P_SYS_GET_LlVE_ROOT;
Live Penpoint documents (those that can be activated) are stored within the live area of a volume. This
message returns the root of the live area for a given volume.
pArgs->voIHandle is a filesystem handle onto the volume in question. This handle can be on any
location of the volume. You can also use the root directory handle for a volume. Use theSelectedVolume
if you want to get the live area within the filesystem that Penpoint stores its on-machine documents in.
NOTE: Caller must free the pArgs->liveHandle when finished.
stsFSNodeNotFound No live root on this volume.
msgSysIsHandleLive
Determines if a filesystem handle is within the live document area.
Takes P_SYS_IS_HANDLE_LIVE, returns STATUS.
#define msgSysIsHandleLive MakeMsg(clsSystem, 4)
typedef struct SYS_IS_HANDLE_LlVE
OBJECT handle; II Handle onto the node in question.
BOOLEAN live; II Out: Is it in the live area?
SYS_IS_HANDLE_LIVE, *p SYS_IS_HANDLE_LIVE;
Penpoint maintains live documents within a particular point in the directory heirarchy of each volume.
This message determines whether a filesystem handle is within the live area of its volume.
stsFSNodeNotFound Nolive root on the handle's volume.
msgSysCreateLiveRoot
Create a new live root on a volume.
msgSysGetVersion
Returns the system version number.
Takes P_U16, returns STATUS.
#define msgSysGetVersion MakeMsg(clsSystem, 6)
This message allows callers to determine the current PenPoint system version number.
msgSysGetSecurityObject
Gets the current security object.
Takes P_OBJECT, returns STATUS.
#define msgSysGetSecurityObject MakeMsg(clsSystem, 31)
Returns objNull if there is no current security object.
msgSysSetSecurityObject
Sets the current security object.
Takes P_SYS_SET_SECURITY_OBJECT, returns STATUS.
#define msgSysSetSecurityObject MakeMsg(clsSystem, 32)
typedef struct SYS_SET_SECURITY_OBJECT {
OBJECT securityObjecti II New security object.
OBJ KEY oldKeYi II Object key for old security
II object.
SYS_SET_SECURITY_OBJECT, *P_SYS_SET_SECURITY_OBJECTi
If a security object already exists then it is destroyed, using the key specified in the arguments. If it
refuses to be destroyed then the new security object will not be set.
The security object will be sent msgSysPowerOn and msgSysPowerOffwhen the power goes on and
off. At shutdown, msgSysPowerOff is sent to the security object after msgSysPowerOff is sent to power
button observers and after msgAppSave is sent to applications. At power up, msgSysPowerOn is sent to
the security object before msgSysPowerOn is sent to power button observers.
msgSysPowerOn and msgSysPowerOff are sent when the machine is suspended/ resumed, or shutdown
and swap-booted. However, these messages are not sent when a warm-boot occurs. A warm-boot
destroys all processes and objects. The service· or application that owns the security object will be
restarted in the warm-boot case. Security objects must handle the warm-boot case. For example, if the
security object is created by the app monitor, the app monitor will receive msgApplnit when the
application is first installed and msgRestore on all warm-boots.
At power down, anything painted on the screen by the security object will not appear immediately, but
will appear on the screen when it is restored at power on time. If the security object wishes to display a
window on top of all other windows, it should observe the System for msgBootStateChanged to
determine when booting is complete.
At power on, the security object may choose to veto the powering on of the system by sending
msgPMSetPowerState to thePowerMgr to turn off power.
stsProtectionViolation old security object refused to be destroyed.
578 PEN POINT API REFERENCE
Part 12 I Installation API
msgSysGetCorrectiveServiceLevel
Gets the corrective service level.
Takes P_STRING, returns STATUS.
#define msgSysGetCorrectiveServiceLevel MakeMsg(clsSystem, 33)
The corrective service level is a string of up to maxNameLength characters.
msgSysSetCorrectiveServiceLevel
Sets the corrective service level.
Takes P_STRING, returns STATUS.
#define msgSysSetCorrectiveServiceLevel MakeMsg(clsSystem, 34)
The corrective service level is a string of up to maxNameLength characters.
Notification Messages
msgSysBootStateChanged
The system has reached another stage of booting.
Takes P_SYS_BOOT_STATE, returns STATUS. Category: observer notification.
#define msgSysBootStateChanged MakeMsg(clsSystem, 10)
Message typedef struct SYS_BOOT_STATE {
Ar9tHnents BOOLEAN booted; II Has booting totally completed?
SYS BOOT PROGRESS progress; II Where are we in the boot cycle?
SYS BOOT TYPE type; II Boot type; warm or cold.
CLASS initialAppClass; II Class of the initial app.
SYS_BOOT_STATE, *P_SYS_BOOT_STATE;
This message is sent to all observers of theSystem whenever another stage of booting is attained. If you
are just interested in whether the system has completed booting or not, look at the pArgs->booted
boolean.
Part 13 /
Writing PenPoint Services
-------_._-_ .. _--
HWXSERY.H
This file contains the API definition for clsHWXEngineService.
clsHWXEngineService inherits from clsService.
Provides default behavior for handwriting engine services.
#ifndef HWXSERV_INCLUDED
#define HWXSERV_INCLUDED
#ifndef SERVICE_INCLUDED
#include <service.h>
#endif
Messages
msgNew
Creates a new service object.
Takes P_HWX_SVC_NEW, returns STATUS. Category: class message.
Arguments typedef struct HWX_SVC_NEW_ONLY {
U32 unused1;
U32 unused2;
U32 unused3;
U32 unused4;
HWX_SVC_NEW_ONLY, *P_HWX_SVC_NEW_ONLY;
#define hwxServiceNewFields \
serviceNewFields \
HWX_SVC_NEW_ONLY hwxService;
typedef struct HWX_SVC_NEW
hwxServiceNewFields
} HWX_SVC_NEW, *P_HWX_SVC_NEW;
msgHWXSvcCurrentChanged
The current handwriting prototype set has changed.
Takes P _HWX_SVC_CURRENT_CHANGED, returns STATUS.
#define msgHWXSvcCurrentChanged MakeMsg(clsHWXEngineService, 1)
Arguments typedef struct HWX_SVC_CURRENT_CHANGED
OBJECT newHandle;
OBJECT oldHandlei
HWX_SVC_CURRENT_CHANGED, *P_HWX_SVC_CURRENT_CHANGED;
The user has switched to or from a handwriting prototype set that uses this engine. See hwxmgr.h and
instlmgr.h for details on handwriting prototype set management.
pArgs->newHandle and pArgs->oldHandle provide the handles of the new and old prototype sets.
objNull means that the new/former prototype set used some other engine.
------._------
MILSERY.N
This file contains the API definition for dsMILService. The functions described in this file are
contained in milserv.lib.
dsMILService inherits from dsService.
Provides default behavior for MIL services.
MIL services are PenPoint device drivers. They represent a MIL device, which represents a piece of
hardware. A MIL service sits between a MIL device and the rest of PenPoint.
A MIL service is typically composed of a Ring 0 part, which interfaces to the MIL, and a Ring 3 part,
which interfaces to the rest of PenPoint.
MIL service instances are created automatically by PenPoint. Never send msgNew to a MIL Service class
yourself! Each MIL device contains a deviceId, which is the class of the MIL service that should be
created for it. PenPoint scans the MIL at power-up time and whenever a MIL service installed, and
creates one MIL service for each unit of each device.
The MIL service writer can find out the logical id of the device it represents by self-sending
msgMILSvcGetDevice.
A MIL service can install a MIL extension if necessary. The new MIL device is installed into the MIL
when the MIL service is installed, and removed from the MIL when the MIL service is deinstalled. Use
the InstallMILDeviceO function in your DLLMainO to do this.
You must also let the service framework know about a service by sending msgSvcClasslnitService to
your service class in DLLMainO. Here's an example:
STATUS EXPORTED DLLMain(void)
{
SVC INIT SERVICE initServicei
STATUS Si
II Initalize classes.
StsRet(ClsMILServiceInit(), S)i
II Include if it is necessary to install MIL extensions.
InstallMILDevice(&deviceInfo)i
II Initialize service. This creates MIL service instances.
memset(initService.spare, 0, sizeof(initService.spare))i
initService.autoCreate = truei
initService.serviceType = Oi
initService.initServiceFlags = 0;
ObjCallRet(msgSvcClassInitService, clsTestService, &initService, S)i
return stsOKi
II DllMain
See project MILSVC for a template for creating MIL services.
#ifndef MIL_SERVICE_INCLUDED
#define MIL_SERVICE_INCLUDED
#ifndef GO INCLUDED
#include <go.h>
#endif
584 PENPOINT API REFERENCE
Part 13 / Writing Pen Point Services
*ifndef SERVICE_INCLUDED
*include <service.h>
*endif
*ifndef MIL INCLUDED
*include <mil.h>
*endif
Functions
InstallMILDevice
Install a MIL device.
Returns STATUS.
Function Prototype STATUS EXPORTED InstallMILDevice (
P_MIL_DEVICE_INFO pDevicelnfo, II Installable MIL device info.
U32 reserved1, I I Set this to 0
U32 reserved2) ; I I Set this to 0
Comments This routine should used to install one or more MIL devices. These devices will be automatically
deinstalled when the MIL service is deinstalled.
This routine *must* be called in the service's DLLMainO, after the classes are created but before
msgSvcClasslnitService is sent.
Class Messages
msgNew
Creates a new MIL service object.
Takes P_MIL_SVC_NEW, returns STATUS. Category: class message.
msgNewDefaults
Initializes the MIL_SVC_NEW structure to default values.
Takes P_MIL_SVC_NEW, returns STATUS. Category: class message.
Messf)ge typedef struct MIL_SVC_NEW {
Ar!;1tlments milServiceNewFields
} MIL_SVC_NEW, *P_MIL_SVC_NEW;
Comments Sets
pArgs->svc.style.exclusiveOpen = true;
pArgs->svc.style.checkOwner = true;
Note pArgs->svc.style.connectStyle will be set automatically to
reflect underlying MIL device's auto-detection facilities. It will
be set to svcAutoDetect if milDevFlagDetachable is true,
svcNoAutoDetect if milDevFlagDetachable is false.
!
msgSvcSetConnected
Sets connection state of self.
Takes P_SVC_GET_SET_CONNECTED, returns STATUS.
Comments 'p_SVC_GET_SET_CONNECTED' structure is defined in service.h.
This message is self-sent whenever a MIL service thinks that it's connection state has changed. This
message should be sent even when a mil service isn't sure if it is connected (due to possible interference
from other mil services in its conflict group).
If the mil service isn't in a conflict group then the message is sent to ancestor. If it is in a conflict group
then the following will occur:
if (pArgs->connected == true) {
1. msgCGPollConnected is sent to the conflict group manager.
2. The conflict group manager sends msgMILSvcAreYouConnected to allservices in the conflict group
(including the one that self-sent msgSvcSetConnected).
3. The conflict group manager decides which service really shouldbe connected and sends
msgMILSvcConnectionStateResolved to all services. This tells which service (if any) has been
chosen to be the connected one. MIL services should restart their connection detection logic if
nobody is currently connected.
4. Default behavior for msgMILSvcConnectionStateResolved is to sendmsgSvcSetConnected to
ancestor if a change of state is indicated. MIL services must *always* send
msgMILSvcConnectionStateResolved to ancestor.
586 PENPOINT API REFERENCE
Part 13 / Writing Pen Point Services
} else {
1. msgSvcSetConnected is sent to ancestor.
2. msgCGInformDisconnected is sent to the conflict group manager.
3. The conflict group manager sends msgMILSvcConnectionStateResolvedto all mil services except the
mil service that sent the msgSvcSetConnected message. MIL services should restart their connection
detection logic.
msgSMConnectedChanged (servmgr.h)
nnsg~IIJSvcSetDevice
Sets MIL device associated with this service.
Takes P_MIL_SVC_DEVICE, returns STATUS.
#define msgMlLSvcSetDevice MakeMsg(clsMlLService, 2)
Message typedef struct MlL_SVC_DEVlCE
Arguments TAG unitResourceTag; II resource tag into mil.res
UlD conflictGroup; II conflict group mil svc is on
U16 logicalld; II mil device logical id to use
U16 unit; II mil device unit number to use
U8 reserved[12];
} MlL_SVC_DEVlCE, *P_MlL_SVC_DEVlCE;
Note: This message is almost never used. Usually a MIL service is associated with the device that is set at
msgNew time, and never changed. This message is included for completeness and very special
circumstances.
nnsg~ILSvclnstalledMILDevice
Is this MIL service targeting an installed MIL device?
Takes pNull, returns STATUS.
#define msgMlLSvclnstalledMlLDevice MakeMsg(clsMlLService, 3)
Returns stsOK if it is, stsFailed if it is not.
MILSERV.H 587
Descendant Responsibility Messages
msgMIlSvcAddToConflictManager
Add this service instance to a conflict group manager.
Takes P_MIL_SVC_ADD_TO_CONFLICT_MANAGER, returns STATUS.
#define msgMILSvcAddToConflictManager MakeMsg(clsMILService, 8)
typedef struct MIL_SVC_ADD_TO_CONFLICT_MANAGER {
OBJECT manager;
} MIL_SVC~D_TO_CONFLICT_MANAGER, *P_MIL_SVC_ADD_TO_CONFLICT_MANAGER;
Comments This message is used to add a MIL service to a conflict group 'manager.
msgMIlSvcPowerOn
The power has just come on.
Takes pNull, returns STATUS.
#define msgMILSvcPowerOn MakeMsg(clsMILService, 5)
Comments This message is sent before all other power on messages are sent. MIL services must *not* observe the
power button to get power notification.
MIL services should restore any hardware-specific state that was saved when the power was
disconnected.
msgMIlSvcAreYouConnected
Do you think you are connected?
Takes P_MIL_SVC_ARE_YOU_CONNECTED, returns STATUS.
#define msgMILSvcAreYouConnected MakeMsg(clsMILService, 6)
msYes 0,
msMaybe 1,
msNo 2
};
This message is sent to all members of a conflict group whenever any service thinks it has become
connected. It allows all members of the conflict group to participate in deciding who is really connected.
Default superclass behavior is to return msMaybe.
588 PENPOINT API REFERENCE
Part 13 / Writing Pen Point Services
msgMIlSvcConnectionStateResolved
Tells a MIL service who was chosen to be connected.
Takes UI6, returns STATUS.
fdefine msgMILSvcConnectionStateReso!ved MakeMsg(c!sMILService, 7)
The pArgs is the logical id of the service that was chosen to be connected. It is set to maxU16 if nobody
is connected.
Default superdass behavior is to send msgSvcSetConnected to ancestor if a change of state is indicated.
MIL services must always send msgMILSvcConnectionStateResolved to ancestor.
msgMIlSvcStartConnectionProcessing
It is ok to start connection processing.
Takes pNull, returns STATUS.
fdefine msgMILSvcStartConnectionProcessing \
MsgNoError(MakeMsg(c!sMILService, 9))
This message is sent after booting is complete. MIL services should not start their connection processing
until they receive this message.
SERVCONF.H
Messages
msgNew
Creates a new conflict group manager.
Takes P_SM_NEW, returns STATUS. Category: class message.
This message should *never* be called by clients. Conflict group managers are automatically created.
The new args must always be the same as for a service manager.
msgCGGetOwner
Gets the current owner of the conflict group.
Takes P _CG_GET_OWNER, returns STATUS.
#define msgCGGetOwner MakeMsg(clsMILConflictGroupMgr, 1)
typedef struct CG GET OWNER
OBJECT owner; II Out: owner.
U8 reserved[16];
CG_GET_OWNER, *P_CG_GET_OWNER;
Comments If no one owns the conflict group, 'objNull' will be returned in the owner field.
590 PEN POI NT API REFERENCE
Part 13 / Writing Pen Point Services
msgCGSetOwner
Sets a new conflict group owner.
Takes P_CG_SET_OWNER, returns STATUS.
#define rnsgCGSetOwner MakeMsg(clsMILConflictGroupMgr, 2)
typedef struct CG_SET_OWNER
OBJECT owner; II New owner.
} CG_SET_OWNER, *P_CG_SET_OWNER;
"owner" can be objNull to specify that this conflict group has no owner.
Old and new owners will recieve service messages which allow them to veto the ownership change and
informs them that the change has taken effect. The message sequence is as follows:
1. msgSvcOwnerAquireRequested is sent to the new owner. pArgs->ownedService is set to the conflict
group. The new owner can veto the owner change by returning a status of anything other than
stsOK or stsNotUnderstood. msgCGSetOwner returns with the abort status.
2. msgSvcOwnerReleaseRequested is sent to the old owner. pArgs->ownedService is set to the conflict
group. The old owner can can veto the owner change by returning a status of anything other than
stsOK or stsNotUnderstood. msgCGSetOwner returns with the abort status.
3. msgSvcOwnerReleased is sent to the old owner.
4. msgSvcOwnerAquired is sent to the new owner.
5. msgCGOwnerChanged is sent to all observers of this conflict group manager, includding all of the
service instances on this manager.
stsBadObject New owner is not an object.
stsBadAncestor New owner has invalid ancestor.
service.h, for definition of msgSvc... messages.
msgCGPollConnected
Polls all the services in the conflict group to see who is connected.
Takes pNull, returns STATUS.
#define rnsgCGPollConnected MakeMsg(clsMILConflictGroupMgr, 3)
A conflict group manager recieves this message when any service within the conflict group thinks it
might be connected. The conflict group manager sends msgMILSvcAreYouConnected to each service.
It then sends msgSvcConnectionStateResolved to each service, choosing one of the services as the
connected one.
msgCGlnformDisconnected
Tells all the services in the conflict group that a disconnect happened.
Takes pNull, returns STATUS.
#define rnsgCGlnforrnDisconnected MakeMsg(clsMILConflictGroupMgr, 4)
A conflict group manager recieves this message when the connected service within the conflict group
decides it is disconnected. The conflict group manager sends msgSvcConnectionStateResolved to each
service, specifying that nobody is connected.
SERVCONF.H 591
Tags
Notification Messages
msgCGOwnerChanged
A conflict group's owner has changed.
Takes P_CG_OWNER_NOTIFY, returns STATUS. Category: observer notification.
*define msgCGOwnerChanged MakeMsg(clsMILConflictGroupMgr, 10)
Arguments typedef struct CG_OWNER_NOTIFY
OBJECT conflictGrouPi II conflict group whose owner changed.
OBJECT oldOwneri II old owner.
OBJECT owneri II new owner.
CG_OWNER_NOTIFY, *P_CG_OWNER_NOTIFYi
Tags
*define tagConflictChoice MakeTag(clsMILConflictGroupMgr, 1)
5ERVICE.M
Introduction
All non-application functionality under Penpoint is expressed as a service. If what you want to do does
not fit the application model (documents created via Stationery or Accessories, subclass of clsApp, etc)
then it should be a service. Some examples of services are: device drivers, inbox/outbox transfer agents
such as fax and e-mail, network protocol stacks, and device drivers.
Service instances are automatically organized onto service managers. A service manager represents a
category of service, such as Printers or Serial Devices. All of the service instances in a given category are
can be used interchangeably; that is, they all support the API that is required to be in that category.
Clients access service instances via service managers. See servmgr.h for details.
Each service instance has a text name, which is how it is uniquely identified. Clients use this name to
identify a service instance on a service manager. A service instance's name is specified at msgNew time.
Names must be unique for all services on the same service manager, and all services of the same class.
There are two exclusivity models for services: services that require exclusive access by a single client, and
services that allow multiple clients simultaneous access. Services provides default behavior for arbitrating
ownership of exclusive access services.
Multiple access services can either be shared (each client gets back the uid of the service when they open
the service) or multi-user (each client gets back a different object when they open the service).
Service instances can optionally maintain state. By default each service instance has a node in the
filesystem. clsService will automatically recreate service instances from their state files when PenPoint is
rebooted. Also, service instances can be saved and restored from external disks by moving their state
nodes on and off the machine.
A service instance can have an optional "target". A target is some other service instance. If a service has a
target, the service superclass takes care of remembering what the target points at. Typically, data flows
from one service instance to next, going down the target chain. Control information, such as when a
physical device is becomes connected, flows up the target chain.
A service is implemented as an installable DLL. Service instances are either created in the DLLMainO of
the service DLL, created dynamically after the service has been installed, or created from pre-configured
instance state nodes when the service is first installed. See servimgr.h for a description of how services are
installed and deinstalled, and how a service is organized on disk.
594 PENPOINT API REFERENCE
Part 13 / Writing Pen Point Services
Non-hardware services automatically change their connection state when their targets change
connection state. Thus, connection state propogates up from the hardware to all services that are bound
to that hardware.
A hardware service for a device that cannot auto-detect connection is always in the connected state.
Project TESTSVC provides a template for a service that deals with a target.
Advanced Features
Services that can provide both global and service instance option cards. A global option sheet sets
configuration information for the entire service. It is invoked when the user calls for options of a service
from the Service card of the Installer. Services can add additional cards to the global option sheet.
Service instance option sheets allow the user to set the configuration of particular instance. For example,
the serial service provides a card which allows the user to set baud rate, parity, etc. Services should
update their state node when the user applies a change to the option sheet. There is no default service
instance option card.
Services should respond to the standard option sheet protocol (msgOptionAddCards,
msgOptionRefreshCard, etc) if they wish to provide option cards. See option.h for details. The option
sheet messages are either sent as class messages for global options or normal instance messages for
instance options.
A service's configuration information can also be queried and set programmatically via
msgSvcGetMetrics and msgSvcSetMetrics. A service must be able to respond to these messages at any
time, and should update its state node when its metrics are changed. The Get/SetMetrics messages are
generic; they allow a client to save and restore metrics independently of the size or contents of the
metrics. This allows a client to have absolutely no knowledge of the internals of a service. The client can
ask the user to set configuration options, then save and restore these configuration options via the
generic Get/Set messages.
Service instances can have icons associated with them in the same fashion as documents. Create icons
using tagApplconBitmap and tagAppSmallIconBitmap and put them in the service resource file. This is
done in the same manner as applications.
to this handle. Note that msgObjectNew must be sent, not called. Remember, any pointers in the
msgObjectNew pArgs must be in global memory.
StsRet(ClsTestServiceInit(), s);
memset (initService. spare, 0, sizeof(initService.spare»;
initService.autoCreate = true;
initService.serviceType = 0;
initService.initServiceFlags = 0;
ObjCallRet(msgSvcClassInitService, clsTestService, &initService, s);
return stsOK;
II DIIMain
#ifndef SERVICE INCLUDED
#define SERVICE INCLUDED
#ifndef STREAM INCLUDED
#include <stream.h>
#endif
#ifndef FS INCLUDED
#include <fs.h>
#endif
Target
A target references another service.
typedef struct SVC TARGET
OBJECT manager;
U8 pName[nameBufLength];
U8 spare[12];
} SVC_TARGET, *p SVC_TARGET;
.Auxiliary Messages
See servmisc.h for less commonly used (but important!) service messages
#ifndef SERVMISC_INCLUDED
#include <servmisc.h>
#endif
Creation Messages
msgSvcClasslnitService
Initializes the service class.
Takes P _SVC_INIT_SERVICE, returns STATUS. Category: class message.
#define msgSvcClassInitService MakeMsg(clsService, 56)
You must send this message to the service class immediately after it has been created.
initServiceFlags
Don't show this service in the installer. User can't configure or deinstall the service if this flag is set
#define svcNoShow ( (U32) flagO)
Automatically pop up the global service option card the first time this service is installed.
#define svcPopupOptions ((U32) flag!)
Don't copy in the state files from the INST directory when the service is installed.
#define svcNoLoadInstances ( (U32) flag2)
Create a private service manager for instances of this class. All instances of this class will automatically be
added to the private service manager. See SVC_CLASS_METRICS for uid pf the private service manager.
#define svcCreatePrivateServiceMgr ((U32) flag3)
Generate a complete process environment in the DLLMainO process. Right now this means creating
theProcessResList. Also, a service resource file handle will be created even if the service resource file is
empty. Note that a complete process environment takes up significant memory. Only turn this on if you
need it.
#define svcFullEnvironment ((U32) flag4)
typedef struct SVC INIT SERVICE
BOOLEAN autoCreatei II Create an instance for each state
II node at install and warm boot times.
U32 serviceType; II Global service type. See
II svctypes.h. Usually set to O.
U32 initServiceFlags; II Or-in InitService flags.
U8 spare [12] ;
SVC_INIT_SERVICE, *P SVC_INIT_SERVICE;
msgNew
Creates a new service object.
Takes P _SVC_NEW, returns STATUS. Category: class message.
Callers send msgNew to create a new service instance. The instance will add itself to one or more service
managers. Clients should access the service instance via the service manager API after msgNew.
SERVICE.H 599
Creation Messages
Superclass behavior includes associating the service with it's node in the filesystem, adding it to the
specified service managers, and attempting to bind to a target service. If style.waitForTarget is false and
the target isn't found then stsSvcTargetNotFound is returned.
The following parameters are usually set by the caller of msgN ew:
• pServiceName
• target
The following parameters are usually set by the subclass of clsService in msgNewDefaults (after the
ancestor call):
• style (including openClass)
• pManagerList
• numManagers
If a subclass wants to change the handleClass, fsNew, or fsNewExtra parameters it must also execute the
following in its msgNewDefaults method, after sending msgNewDefaults to ancestor:
pNew->svc.handleClass = myFSHandleClass;
ObjCaIIOK(msgNewDefaults, pNew->svc.handleClass, &(pNew->svc.fsNew), s);
Most services will not need to do this.
If a service with the same name as the new service already exists on any relevant service manager, the old
service will be destroyed and the new service will replace it. However, if any of the old services veto the
termination then the new service will not be created and an error status (stsSvcAlreadyExists) is
returned.
stsNoMatch Target not found and style.waitForTarget is false.
stsSvcAlreadyExists Service of this name already exists and can't be terminated.
stsBadParam Illegal target type.
style.connectStyle
#define svcAutoDetect 0 II Can auto-detect hardware connect/disconnect.
#define svcNoAutoDetect 1 II Can't do har~ware auto-detect.
#define svcFollowTarget 2 II Connect state follows target's connect state.
typedef struct SVC STYLE {
U16 waitForTarget 1, II OK if target doesn't exist; wait for it
II to show up.
exclusiveOpen 1, II Allow only one open or QueryLock at a time.
reserved1 1, II Reserved.
autoOwnTarget 1, II Set this service to be the owner of its
II target when it receives
II msgSvcChangeOwnerRequested.
autoOpen 1, II Open/close our target when we are
II opened/closed.
autoMsgPass 1, II Forward all messages that are not
II clsObject, clsService or clsOption
II messages to target.
checkOwner 1, II Only allow the owner to open us;
II return stsNotOwner if opener is wrong.
autoOption 1, II Forward all option sheet messages to
II target. If the target is exclusive open
II and checkOwner, then only forward if
II target is owned by this service instance.
connect Style 2, II Connect detect abilities.
reserved2 6; II Reserved.
600 PENPOINT API REFERENCE
Part 13 / Writing Pen Point Services
msgNewDefaults
Initializes the SVC_NEW structure to default values.
Takes P _SVC_NEW, returns STATUS. Category: class message.
lVhsss",ge typedef struct SVC_NEW
ArgVrt1fN1ts serviceNewFields
} SVC_NEW, *P_SVC_NEW;
Sets
object.cap 1= objCapCall; / / Client must not override this in msgNew
svc.target.manager = objNulI;
strcpy(pNew->svc.target.pName, 1111);
svc. pServiceName = pN ulI;
svc.style.waitForTarget = true;
svc.style.exclusiveOpen = false;
svc.style.autoOwnTarget = true;
svc.style.autoOpen = false;
svc.style.autoMsgPass = false;
svc.style.checkOwner = false;
svc.style.autoOption = false;
svc.style.connectStyle = svcFollowTarget;
SERVICE.H 601
State File Messages
svc.style.openClass = objNull;
svc.handleClass = clsFileHandle;
ObjCallOK(msgNewDefaults, pNew->svc.handleClass, \&(svc.fsNew), s);
svc.fsN ew.fs.exist = fsExistOpen I fsN oExistCreate;
svc.pManagerList = pNull;
svc.numManagers = 0;
msgSvcGetModified
Gets the modified state of this service.
msgSvcSetModified
Sets modified state of self.
Takes P_SVC_GET_SET_MODIFIED, returns STATUS.
fdefine msgSvcSetModified MakeMsg(clsService, 20)
Mes$<:lge typedef struct SVC_GET_SET_MODIFIED
Arguments BOOLEAN modified; II modified state
} SVC_GET_SET_MODIFIED, *P_SVC_GET_SET_MODIFIED;
Comments Service subclasses must send this message with pArgs->modified set to true whenever they change their
state file.
Propogates msgIMModifiedChanged to everyone who has bound to this service and is an observer of all
service managers that this service is on.
msgIMModifiedChanged (insdmgr.h)
602 PENPOINT API REFERENCE
Part 13 I Writing PenPoint Services
Targel Messages
msgSvcOpenTarget
Attain access to the target service for data transfer.
Takes P_SVC_OPEN_CLOSE_TARGET, returns STATUS.
#define msgSvcOpenTarget MakeMsg(clsService, 13)
typedef struct SVC_OPEN_CLOSE_TARGET {
P ARGS pArgs; II Open or close parameters.
} SVC_OPEN_CLOSE_TARGET, *P_SVC_OPEN_CLOSE_TARGET;
Backwards compatibility
typedef SVC_OPEN_CLOSE_TARGET SVC_OPEN_TARGET, *P_SVC_OPEN_TARGET;
This call should be made when the service is ready to actually transfer data to its target. It will cause
msgSMOpen to be sent to the target's service manager. The target service instance can refuse the
subsequent msgSvcOpenRequested request if it wants. The target service should be kept open for the
minimum time possible.
This message is sent automatically if newArgs. style. auto Open is true. Note that pArgs is set to pNull in
this case.
stsFailed target. type is not svcTypeService.
stsSvcNoTarget target. manager is null.
stsSvcNotBound service is still waiting to bind to its target.
stsSvcAlreadyOpen target is already open.
errors from msgSMOpen
target service-specific errors
See Also msgSMOpen (servmgr.h)
msgSvcCloseTarget
Give up data transfer access to the target service.
Takes P_SVC_OPEN_CLOSE_TARGET, returns STATUS.
#define msgSvcCloseTarget MakeMsg(clsService, 14)
Meu@ge typedef struct SVC_OPEN_CLOSE_TARGET
Arguments P_ARGS pArgs; II Open or close parameters.
} SVC_OPEN_CLOSE_TARGET, *P_SVC_OPEN_CLOSE_TARGET;
This will cause msgSMClose to be sent to the target's service manager, resulting in
msgSVCCloseRequested being sent to the target.
This message is sent automatically if newArgs.style.autoOpen is true. Note that pArgs is set to pNull in
this case.
stsFailed target. type is not svcTypeService.
msgSMClose (servmgr.h)
SERVICE.H 603
Connection Messages
msgSvcGetTarget
Returns current target.
Takes P _SVC_GET_TARGET, returns STATUS.
#define msgSvcGetTarget MakeMsg(clsService, 15)
typedef struct SVC GET TARGET
SVC TARGET target; II Out: target
OBJECT targetHandle; II Out: handle to target, if bound
OBJECT targetService;11 Out: target service, if open
SVC_GET_TARGET, *P_SVC_GET_TARGET;
target contains the target that was specified at msgNew time or by the last msgSvcSetTarget.
targetHandle contains the service manager handle onto our target if we have bound with the target, or
objNull if we haven't yet bound.
targetService is the actual service object if the target has been opened, objNull if it isn't open.
msgSvcSetTarget
Change our target.
Takes P _SVC_SET_TARGET, returns STATUS.
#define msgSvcSetTarget MakeMsg(clsService, 16)
typedef struct SVC_SET_TARGET
SVC TARGET target;
} SVC_SET_TARGET, *P_SVC_SET_TARGET;
Comments Closes the old target (if it is open), unbinds the old target (if it is bound) and attempts to bind with the
new target. style.waitForTarget specifies whether we will wait for the target to show up if it does not
exist.
Causes msgSvcTargetChanged to be sent.
stsNoMatch new target doesn't exist and style.waitForTarget is false.
Connection Messages
msgSvcGetConnected
Gets the connected state of this service.
msgSvcSetConnected
Sets connection state of self.
msgSvcUnbindRequested
Client asked to unbind from this service.
Takes P _SVC_BIND, returns STATUS.
#define msgSvcUnbindRequested MakeMsg(clsService, 3)
Message typedef struct SVC BIND
/\rgwmenfs OBJECT caller; II Object making the request.
OBJECT manager; II Service manager the request is
II being made through.
SVC_BIND, *P_SVC_BIND;
A client sent msgSMUnbind to a service manager or a client who was bound to the service was
destroyed.
The service cannot veto this request. The caller is removed from the service instance's bind list before
this message is sent.
Subclasses usually let ancestor handle this message. This message must be passed to ancestor.
SERVICE.H 605
Client Access Messages
msgSvcOpenRequested
Client asked to open this service.
Takes P_SVC_OPEN_CLOSE, returns STATUS.
#define msgSvcOpenRequested MakeMsg(clsService, 4)
typedef struct SVC OPEN CLOSE
OBJECT caller; II Object making the request.
OBJECT manager; II Service manager the request is
II being made through.
P ARGS pArgs; II Service-specific open or close
II parameters.
OBJECT service; II Out (msgSvcOpen): In (msgSvcClose):
II uid of open handle or service.
SVC_OPEN_CLOSE, *P_SVC_OPEN_CLOSE;
A client sent msgSMOpen to a service manager. The service instance can refuse the open request by
returning stsFailed.
The service manager maintains a list of all the objects that have opened this service instance. The caller
is added to this list if this message returns stsOK. This list is available via msgSvcGetOpenList.
The service instance is marked in use when one or more clients have it open. A service that has instances
that are in use cannot be deinstalled.
If the style.exdusiveOpen is true then only one client can have the service open at a time. If
style.checkOwner is true then the owner of the service is the only one that can open the service. Errors
are returned to the client if these conditions aren't true; see servmgr.h for details.
Subclasses usually do some processing, then pass this message to superclass. This message must be passed
toancestor.
msgSvcOpenDefaultsRequested
Client wants open pArgs initialized.
Takes P_SVC_OPEN_CLOSE, returns STATUS.
#define msgSvcOpenDefaultsRequested MakeMsg(clsService, 9)
N\tJssag0 typedef struct SVC_OPEN_CLOSE {
Argurnents OBJECT caller; II Object making the request.
OBJECT manager; II Service manager the request is
II being made through.
P ARGS pArgs; II Service-specific open or close
II parameters.
OBJECT service; II Out (msgSvcOpen): In (msgSvcClose):
II uid of open handle or service.
SVC_OPEN_CLOSE, *P_SVC_OPEN_CLOSE;
A client sent msgSMOpenDefaults to a service manager.
msgSvcCloseRequested
Client asked to close this service.
msgSvcQueryLockRequested
Client asked to QueryLock this service.
Takes pNull, returns STATUS.
fdefine msgSvcQueryLockRequested MakeMsg(clsService, 6)
A client has sent msgSMQueryLock to a service manager. QueryLocking a service lets the client get
access to the service without opening it. However, if style.exclusiveOpen is true then the QueryLock
counts as an open as far as allowing only one open at a time.
Subclasses usually let ancestor handle this message. This message must be passed to ancestor.
msgSvcQueryUnlockRequested
Client asked to QueryUnlock this service.
Takes pNull, returns STATUS.
fdefine msgSvcQueryUnlockRequested MakeMsg(clsService, 7)
A client has sent msgSMQueryUnlock to a service manager. This releases a previous QueryLock.
Subclasses usually let ancestor handle this message. This message must be passed to ancestor.
msgSvcCharactersticsRequested
Client asked to get characteristics of this service.
Takes P_SVC_CHARACTERISTICS, returns STATUS.
fdefine msgSvcCharacteristicsRequested MakeMsg(clsService, 54)
typedef struct SVC_CHARACTERISTICS {
OBJECT handle; II Handle of item to get characteristics of.
P UNKNOWN pBuf; II Out through Ptr: Characterisitics buffer.
U16 len; II In/Out: Buffer size. If 0 then the
II actual size is returned.
SVC_CHARACTERISTICS, *P_SVC_CHARACTERISTICS;
A client sent msgSMGetCharacteristics to a service manager. The service will return service-specific
characteristics via pArgs->pBuf. pArgs->len specifies the maximum size of the client's buffer. If
pArgs->len is 0 then the service should return the actual size of its characteristics in pArgs->len and not
pass back any data.
SERVICE.H 607
Tags
Tags
#define tagServiceClassOptionSheet MakeTag(clsService, 1)
#define tagServiceFirstTime MakeTag(clsService, 2)
II Next message up: 59
II Obsolete, here for backwards compatibility.
STATUS EXPORTED InitService(
P STRING pReserved1, II Set this to pNull.
CLASS serviceClass,11 class id.
BOOLEAN autoCreate, II Create an instance for each state
II node at install and warm boot times.
U32 serviceType, II Global service type. See
II svctypes.h. Usually set to O.
U32 initServiceFlags, II Or-in InitService flags.
U32 reserved2, II Set this to 0
U32 reserved3); II Set this to 0
SERYMGR.H
This file contains the API definition for clsServiceMgr.
clsServiceMgr inherits from clsInstallMgr.
Provides access to a category of PenPoint service instances.
Introduction
A service manager represents a category of services in PenPoint. Service managers have well-known ids so
they can be globally accessed. PenPoint creates several service managers by default. They are:
theModems Modems.
thePrinters Printers.
thePrinterDevices Devices that a printer can talk to.
theSendableServices All services that interface to the Send Manager. See sendserv.h.
theT ransportHandlers Transport level network protocol handlers.
theLinkHandlers Link level network protocol stacks.
theHWXEngines Installable handwriting engines.
theMILDevices All MIL services (device drivers).
theParallelDevices Parallel port devices.
theSerialDevices Serial port devices.
theHighSpeedPacketHandlers High performance packet drivers.
theOutboxServices All outbox services.
thelnboxServices All inbox services.
theDatabases All PIA databases.
Additional service managers can be created on the fly by third parties or by GO.
All of the service instances in a given category are on that service manager. All the instances on a service
manager support the same API, so they can be used interchangeably.
Each service instance on a service manager is identified with a unique string name. For example, there
might be three printers on thePrinters: "MyLaserJet", "MarketingPrinterl", and "LittleDotMatrix".
You can find a particular service instance or enumerate all the instances that are available. You can
observe a service manager and be informed when a new instance is added or an existing one goes away.
Once you know which service instance you want to use you must open it in order to gain access. This
returns the uid of the service. You can then send messages directly to the service object. You must close
the service instance after you are done using it.
610 PENPOINT API REFERENCE
Part 13 / Writing Pen Point Services
If you know the name of a service, you can get its handle with msgIMFind:
find.pName = "Service Instance Name";
ObjectCall(msgIMFind, aServiceManager, &find);
serviceInstanceHandle = find. handle;
The next step in accessing a service instance is binding. Binding tells a service instance that you are
interested in it. After you have bound to a service you will get messages from that service telling you
about changes in its state, such as when it becomes connected or disconnected.
bind. handle = serviceInstanceHandle;
bind. caller = self;
ObjectCall(msgSMBind, aServiceManager, &bind);
Next you become the owner of the service instance. Ownership gives you the right to open the instance.
It is the mechanism used to ensure that only one client is using a exclusive access device (such as a serial
port) at a time. Some services are non-exclusive access (such as network devices). Setting owner is a
no-op for these.
The owner protocol informs the both the new and old owners that an ownership change is being
proposed. Either of them can veto the change. The service instance can also veto the change.
The owner of a service can be set to objNull to signify no owner. You should do this when you want to
give up ownership of a service instance.
Here is an example of requesting an owner change:
setOwner.owner = newOwner;
setOwner.handle = serviceInstanceHandle;
ObjectCall(msgSMSetOwner, aServiceManager, &setOwner);
Now you can open the service. An open request can optionally take pArgs. The format of the pArgs is
service-specific. However, all the service instances on a particular service manager have the same pArgs
format. The pArgs must be set to defaults with msgSMOpenDefaults.
A service that has open instances cannot be deinstalled. An open service instance cannot have its owner
changed. Here is an example of opening a service instance:
open. caller = self;
open.handle = serviceInstanceHandle;
open.pArgs = &openArgs;
ObjectCall(msgSMOpenDefaults, aServiceManager, &open);
ObjectCall(msgSMOpen, aServiceManager, &open);
II open. service contains the service object at this point
Clients should close a service instance when they have completed using it:
close.caller = self;
close.handle = serviceInstanceHandle;
close. service = open. service;
close.pArgs = pNull;
ObjectCall(msgSMClose, aServiceManager, &close);
Clients should unbind from a service instance when they are no longer interested in it.
unBind. handle = serviceInstanceHandle;
unBind. caller = self;
ObjectCall(msgSMUnbind, aServiceManager, &unBind);
612 PENPOINT API REFERENCE
Part 13 I Writing Pen Point Services
Core Messages
msgNew
Creates a new service manager.
Takes P_SM_NEW, returns SfATUS. Category: class message.
typedef struct 8M NEW ONLY
BOOLEAN autoDestroy; II Have the service manager be owned
II by a system process, and have it
II destroy itself when the number of
II service instances on it goes to O.
BOOLEAN noChecks; II Turn off error checking, client
II tracking and binding; a service
lion this list cannot be a target.
II This improves performance but
II is dangerous. Experts only!
U32 unused2;
U32 unused3;
U32 unused4;
8M_NEW_ONLY, *P_8M_NEW_ONLY;
#define serviceManagerNewFields \
installMgrNewFields \
8M NEW ONLY sm;
typedef struct 8M_NEW {
serviceManagerNewFields
} 8M_NEW, *P_8M_NEW;
Clients (other than those who are creating their own service managers) do not call this message. The
well-known service managers are created by the system at cold-boot time.
msgNewDefaults
Initializes the SM_NEW structure to default values.
Takes P_SM_NEW, returns SfATUS. Category: class message.
Mossogo typedef struct 8M_NEW {
Argumortts serviceManagerNewFields
} 8M_NEW, *P_8M_NEW;
Sets
installMgr.style.createlnitial = false;
installMgr.style.copyOnlnstall = false;
installMgr.style.addToGlobalList = false;
installMgr.style.createIcon = false;
sm. auto Destroy = false;
sm.noChecks = false;
msgDump
Prints out the services known by this service manager and their state.
Takes OBLKEY, returns STATUS.
dsServiceManager provides an elaborate response to msgDump. This is very useful for debugging
services!
614 PENPOINT API REFERENCE
Part 13 / Writing Pen Point Services
msgSMAccess
Accesses a service instance, given its name.
Takes P_SM_ACCESS, returns STATUS.
tdefine msgSMAccess MakeMsg(clsServiceMgr, 43)
typedef struct SM ACCESS
P STRING pServiceName; II Service name.
OBJECT caller; II Object making this call,
II typically self.
P ARGS pArgs; II Use this if service requires pArgs.
II Send msgSMAccessDefaults first.
OBJECT handle; II Out: Service handle.
OBJECT service; II Out: Service instance.
SM_ACCESS, *P_SM_ACCESS;
This is a convenience message that performs the sequence most clients do to access a service.
This message performs a find, bind, setOwner, and open for the specified service.
Note: This message cannot be used when you want to provide pArgs to a service.
stsN oMatch Item not found.
stsSvcLocked Someone has this exclusive-open service query locked.
stsSvcNotOwner Someone else is the owner of this owner-checked service.
stsSvcAlreadyOpen Someone already has this exclusive-open service open.
Service-Specific Error Returns.
msgIMFind
msgSMAccessDefaults
Sets pArgs defaults for msgSMAccess.
Takes P_SM_ACCESS, returns STATUS.
tdefine msgSMAccessDefaults MakeMsg(clsServiceMgr, 45)
t\'iesstil$e typedef struct SM_ACCESS {
Ar9UmerlfS P STRING pServiceName; II Service name.
OBJECT caller; I I Object making this call,
II typically self.
P ARGS pArgs; II Use this if service requires pArgs.
II Send msgSMAccessDefaults first.
OBJECT handle; II Out: Service handle.
OBJECT service; II Out: Service instance.
SM_ACCESS, *P_SM_ACCESS;
This message should be used if the service you wish to access takes pArgs. This message sets up the
defaults for the pArgs.
stsN oMatch Item not found.
msgSMAccess
SERVMGR.H 615
Core Messages
msgSMRelease
Releases a service instance.
Takes P_SM_RELEASE, returns STATUS.
#define msgSMRelease MakeMsg(clsServiceMgr, 44)
Arguments typedef struct SM RELEASE
OBJECT caller; II Object making this call,
II typically self.
OBJECT handle; II Service handle.
OBJECT service; II Service instance.
SM_RELEASE, *P_SM_RELEASE;
Call this message when you are finished using a service.
This is a convenience message that performs the sequence most clients do when they are finished with a
servlce.
This message performs a close, sets the owner to objNull, and unbinds.
stsFailed Service is not open by the caller.
Service-Specific Error Returns.
msgSMClose
msgSMBind
Binds to a service.
Takes P_SM_BIND, returns STATUS.
#define msgSMBind MakeMsg(clsServiceMgr, 1)
typedef struct SM BIND
1M HANDLE handle; II Service handle to bind to.
OBJECT caller; II Object making this call.
SM_BIND, *P_SM_BIND;
The caller is made an observer of this service. Service manager notification messages will be sent to the
caller.
The caller is added to the bind list of the service instance.
Sends msgSvcBindRequested to the service being bound to. The service has the right to refuse the bind.
The service-specific error return that indicates a refusal is passed back to the client.
stsBadObject Caller is not an object.
stsBadAncestor Caller has invalid ancestor.
Service-Specific Error Returns.
msgSvcBindRequested (service. h) (service. h)
msgSMUnbind
Unbinds from a service.
Takes P_SM_BIND, returns STATUS.
#define msgSMUnbind MakeMsg(clsServiceMgr, 2)
616 PENPOINT API REFERENCE
Part 13 / Writing PenPoint Services
msgSMGetOwner
Gets the current owner of a service.
msgSMSetOwner
Sets a new service owner.
msgSMOpen
Opens a service, given its handle.
Takes P_SM_OPEN_CLOSE, returns STATUS.
*define msgSMOpen MakeMsg(clsServiceMgr, 4)
Arguments typedef struct SM OPEN CLOSE
IM HANDLE handle; II Handle of service to open.
OBJECT caller; II Object making this call.
P ARGS pArgs; II Service-specific open parameters.
OBJECT service; II In: (SMClose) Out: (SMOpen) Service
II object.
SM_OPEN_CLOSE, *P_SM_OPEN_CLOSE;
Clients should do this only when they are ready to transfer data to the service, and should leave the
service open for as little time as possible.
A bind is automatically performed if the client is not yet bound.
The caller is added to the open list of the service instance.
Sends msgSvcOpenRequested to the service being opened. The service has the right to refuse the open.
The service-specific error return that indicates a refusal is passed back to the client.
stsBadObject Caller is not an object.
stsBadAncestor Caller has invalid ancestor.
stsSvcNotBound Caller is not bound to the service.
stsSvcLocked Someone has this exclusive-open service query locked.
stsSvcNotOwner Someone else is the owner of this owner-checked service.
stsSvcAlreadyOpen Someone already has this exclusive-open service open.
Service-Specific Error Returns
msgSMBind (service.h) (service. h) (service. h)
msgSMOpenDefaults
Initializes SMOpen pArgs to default value.
Takes P_SM_OPEN_CLOSE, returns STATUS.
*define msgSMOpenDefaults MakeMsg(clsServiceMgr, 34)
Mes:1i@ge typedef struct SM OPEN CLOSE
Arguments IM HANDLE handle; II Handle of service to open.
OBJECT caller; II Object making this call.
P ARGS pArgs; II Service-specific open parameters.
OBJECT service; II In: (SMClose) Out: (SMOpen) Service
II object.
SM_OPEN_CLOSE, *P_SM_OPEN_CLOSE;
msgSMOpen (service.h)
618 PENPOINT API REFERENCE
Part 13 / Writing Pen Point Services
msgSMClose
Close an open service.
Takes P_SM_OPEN_CLOSE, returns SfATUS.
fdefine msgSMClose MakeMsg(clsServiceMgr, 5)
M0$$©~e typedef struct SM OPEN CLOSE
Av;umeWl¥s IM HANDLE handle; II Handle of service to open.
OBJECT caller; II Object making this call.
P ARGS pArgs; II Service-specific open parameters.
OBJECT service; II In: (SMClose) Out: (SMOpen) Service
II object.
SM_OPEN_CLOSE, *P_SM_OPEN_CLOSE;
The caller is removed from the open list of the service insta~ce.
Clients should send msgSMClose as soon as they are finished actively transfering data. Clients *must*
first close a service before unbinding from it.
The service manager will automatically send msgSMClose for all services that are held open by a client
when that client object is freed. This means that you must not send msgSMClose from your msgFree
routine; the object freed notification occurs before your msgFree routine is entered.
Sends msgSvcCloseRequested to the service being opened.
stsFailed Service instance is not open by the caller.
msgSM~ue~Lock
Gets the uid of a service and locks out any opens.
Takes P _SM_QUERY_LOCK, returns STATUS.
fdefine msgSMQueryLock MakeMsg(clsServiceMgr, 8)
typedef struct SM_QUERY_LOCK {
IM HANDLE handle; II Handle of service instance to query.
OBJECT service; II Out: Service object.
SM_QUERY_LOCK, *P_SM_QUERY_LOCK;
This message is similar to msgSMOpen, in that it returns a service object, given a handle. However, it is
not seen as an open by the service.
This message is meant for non-data transfer access to a service, for example, generating a service's option
card.
The sender of this message does *not* have to be the owner of the service.
This message will fail if the service instance is exclusive open and currently in use (open). If this message
succeeds then all opens will fail until msgSMQueryUnlock is sent.
This message will return the real uid of the service instance in the case of a multi-user service.
stsSvcLocked Service instance is already query locked.
stsSvcInUse Service instance is open.
SERVMGR.H 619
Core Messages
msgSM QueryUnlock
Unlocks a service that was locked via msgSMQueryLock.
Takes P_SM_QUERY_UNLOCK, returns STATUS.
#define msgSMQueryUnlock MakeMsg(clsServiceMgr, 9)
Arguments typedef struct SM_QUERY_UNLOCK
1M_HANDLE handle; II Handle of service instance to unlock.
} SM_QUERY_UNLOCK, *P_SM_QUERY_UNLOCK;
msgSMQuery
Gets the uid of a service.
Takes P_SM_QUERY_LOCK, returns STATUS.
#define msgSMQuery MakeMsg(clsServiceMgr, 33)
Mess(1Ige typedef struct SM_QUERY_LOCK
Arguments 1M HANDLE handle; II Handle of service instance to query.
OBJECT service; II Out: Service object.
SM_QUERY_LOCK, *P_SM_QUERY_LOCK;
This message gets the uid of a service instance. It must be used very carefully. It bypasses all checking
mechanisms, so the caller can get into trouble if he subsequently sends messages to the service that are
not expected. Use msgSMQueryLock instead of msgSMQuery if at all possible.
msgSMGetCharacteristics
Gets the characteristics of the specified service instance.
Takes P_SM_GET_CHARACTERISTICS, returns STATUS.
#define msgSMGetCharacteristics MakeMsg(clsServiceMgr, 42)
typedef struct SM GET CHARACTERISTICS
1M HANDLE - - handle; II Handle of item to get characteristics of.
P UNKNOWN pBuf; II Out through Ptr: Characterisitics buffer.
U16 len; II In/Out: Buffer size. If 0 then the
II actual size is returned.
SM_GET CHARACTERISTICS, *P_SM_GET_CHARACTERISTICS;
Characterstics are service-specific properties of a particular service. For example, modem services might
pass back whether Fax is supported, maximum baud rate, etc. All the services on a particular service
manager return the same characterstics set.
Callers should first send this message with pArgs->len set to o. This will return the size of the actual
characterisitics buffer. Callers should then allocate this space and make the call again with pArgs->len set
to this size. pArgs->len can be less than the actual size, in which case only the number of bytes specified
by pArgs->len is returned.
msgSMSave
Saves a service instance to a specified external location.
Takes P_SM_SAVE, returns STATUS.
#define msgSMSave MakeMsg(clsServiceMgr, 36)
620 PEN POINT API REFERENCE
Part 13 I Writing Pen Point Services
Auxiliary Messages
msgSMFindHandle
Finds a handle, given a service instance uid.
Takes P_SM_FIND_HANDLE, returns STATUS.
#define msgSMFindHandle MakeMsg(clsServiceMgr, 10)
typedef struct SM FIND HANDLE
OBJECT service; II Service object to look for.
1M HANDLE handle; II Out: resulting handle.
SM_FIND_H~~DLE, *P_SM_FIND_HANDLE;
This message allows you to find the handle of a service if you know its uid.
stsNoMatch Service not found on this service manager list.
msgSMSetOwnerNoVeto
Sets a new service owner without giving owners veto power.
Takes P_SM_SET_OWNER, returns STATUS.
#define msgSMSetOwnerNoVeto MakeMsg(clsServiceMgr, 30)
l\4©ssC!ge typedef struct SM SET OWNER
Arguments 1M HANDLE handle; II Handle of item to set owner on.
OBJECT owner; II New owner.
SM_SET_OWNER, *P_SM_SET_OWNER;
This message is the same as msgSMSetOwner, except the old owner and new owners do not get the
chance to veto. msgSvcReleaseRequest and msgSvcAquireRequest are not sent. This message does the
following:
1. The open status of the service is checked. If it is open (in use) the SetOwner fails, with a return
status of stsSvcInUse.
2. msgSvcChangeOwnerRequested is sent to the service. This informs the service that ownership is
going to be changed and allows it to veto the owner change by returning anything other than stsOK
or stsN otU nderstood. msgSMSetOwner returns with the abort status.
3. msgSMOwnerChanged is sent to everyone who is bound to the service or observing a service
manager that the service is on.
4. msgSvcOwnerReleased is sent to the old owner.
5. msgSvcOwnerAquired is sent to the new owner.
stsSvcInUse Service is open.
SERVMGR.H 621
Auxiliary Messages
msgSMGetState
Gets the state of a service.
Takes P _SM_GET_STATE, returns STATUS.
*define msgSMGetState MakeMsg(clsServiceMgr, 12)
typedef struct SM GET_STATE {
1M HANDLE handle; II In: Handle of service to get state on.
BOOLEAN connected; II Out: Is service connected?
OBJECT owner; II Out: My owner, if any.
OBJECT owned; II Out: The service that I own, if any.
U8 reserved[24];
SM_GET_STATE, *P_SM_GET_STATE;
Comments This message provides service state. There is some additional state (in use, modified) that is gotten via
msgIMGetState. See insdmgr.h for details.
msgSM GetClassMetrics
Gets the service's class metrics.
msgIMDeinstall
Remove and free a service instance.
Takes P_IM_DEINSTALL, returns STATUS.
This will remove the specified service instance from all the service managers that it is on, destroy its state
file, and free it.
Note that a service is initially created by sending msgNew to the service class. Services automatically add
themselves to service manager. Do not use msgIMlnstall for this purpose; msgIMlnstall should
NEVER be used by clients.
Causes observer message msgIMDeinstalled to be propogated to all objects that are bound to the service
instance and to the service managers.
This message causes msgSvcDeinstallRequested to be sent to the service instance. The instance can veto
the deinstall at this point; if it does then the return value from msgIMDeinstall is the status that the
service instance used to veto the deinstall.
msgSvcDeinstallRequested
622 PENPOINT API REFERENCE
Part 13 / Writing Pen Point Services
Notification Messages
msgSMConnectedChanged
A service's connection state changed.
Takes P_SM_CONNECTED_NOTIFY, returns STATUS. Category: observer notification.
fdefine msgSMConnectedChanged MakeMsg(clsServiceMgr, 20)
typedef struct SM_CONNECTED_NOTIFY {
OBJECT manager; II manager that sent notification
IM HANDLE handle; II handle to service
BOOLEAN connected; II new connect state
SM_CONNECTED_NOTIFY, *P_SM_CONNECTED_NOTIFY;
msgSMOwnerChanged
A service's 9wner has changed.
Takes P_SM_OWNER_NOTIFY, returns STATUS. Category: observer notification.
fdefine msgSMOwnerChanged MakeMsg(clsServiceMgr, 21)
typedef struct SM OWNER NOTIFY
OBJECT manager; II manager that sent notification
IM HANDLE handle;. II handle to service
OBJECT oldOwner; II old owner
OBJECT owner; II new owner
SM_OWNER_NOTIFY, *P_SM_OWNER_NOTIFY;
SERYMISC.H
Owner Messages
msgSvcGetMyOwner
Gets the current owner of this service, if any.
Takes P_OBJECT, returns STATUS.
#define msgSvcGetMyOwner MakeMsg(clsService, 21)
Passes back objNull if there is no current owner.
msgSvcGetOwned
Passes back the item that this service owns.
Takes P_OBJECT, returns STATUS.
#define msgSvcGetOwned MakeMsg(clsService, 31)
This message is only valid for autoOwnTarget services (style.autoOwnTarget is true).
If this service has become the owner of its target then this message passes back the item that it owns;
otherwise it returns objNull.
msgSvcOwnerReleaseRequested
Is it OK to remove you as the owner of a service?
Takes P_SVC_OWNED _NOTIFY, returns STATUS.
#define msgSvcOwnerReleaseRequested MakeMsg(clsService, 38)
typedef struct SVC_OWNED_NOTIFY {
OBJECT ownedServicei II The service or MIL conflict
II group which will have its
II owner changed.
OBJECT oldOwneri II The old owner.
OBJECT newOwner i II The proposed new owner.
U8 reserved [16] i
SVC_OWNED_NOTIFY, *p SVC_OWNED_NOTIFYi
A client sent msgSMSetOwner to a service manager for a service you currently own. See
servmgr.h/msgSMSetOwner for details on the entire owner change message protocol.
,
624 PENPOINT API REFERENCE
Part 13 I Writing Pen Point Services
You can veto the ownership change by returning anything other than stsOK or stsNotUnderstood.
The service must not be in use for the owner change to occur. If you have the service open and want to
give up ownership, you should close the service when you receive this message.
This message must be passed to ancestor.
msgSvcOwnerAcquireRequested
Is it OK to make you the new owner of a service?
Takes P_SVC_OWNED_NOTIFY, returns STATUS.
tdefine msgSvcOwnerAcquireRequested MakeMsg(clsService, 39)
Mes,soge typedef struct SVC_OWNED_NOTIFY {
Argumerrts OBJECT ownedService; II The service or MIL conflict
II group which will have its
II owner changed.
OBJECT oldOwner; II The old owner.
OBJECT newOwner; II The proposed new owner.
U8 reserved[16];
SVC_OWNED_NOTIFY, *P_SVC_OWNED_NOTIFY;
A client sent msgSMSetOwner to a service manager, proposing that you be the new owner of a service.
See servmgr.h/msgSMSetOwner for details on the entire owner change message protocol.
You can veto the ownership change by returning anything other than stsOK or stsNotUnderstood.
This message must be passed to ancestor.
msgSvcOwnerAcquired
You are now the new owner of a service.
Takes P_SVC_OWNED_NOTIFY, returns STATUS.
tdefine msgSvcOwnerAcquired MakeMsg(clsService, 29)
MSS50g© typedef struct SVC_OWNED_NOTIFY
t\VgUtt'I©l1tS OBJECT ownedService; II The service or MIL conflict
II group which will have its
II owner changed.
OBJECT oldOwner; II The old owner.
OBJECT newOwneri II The proposed new owner.
U8 reserved[16];
SVC_OWNED_NOTIFY, *p SVC_OWNED_NOTIFYi
A client sent msgSMSetOwner to a service manager and requested that you become the new owner of
the service. This message signifies that you are the new owner of the service. See
servmgr.h/msgSMSetOwner for details on the entire owner change message protocol.
Any saved state that you have for the owned service should be restored (typically via msgSvcSetMetrics).
This message must be passed to ancestor.
msgSvcOwnerReleased
You are no longer the owner of a service.
Takes P_SVC_OWNED _NOTIFY, returns STATUS.
tdefine msgSvcOwnerReleased MakeMsg(clsService, 30)
SERVMISC.H 625
Owner Messages
msgSvcChangeOwnerRequested
Owner change request message.
Takes P _SVC_OWNED_NOTIFY, returns STATUS.
*define msgSvcChangeOwnerRequested MakeMsg(clsService, 40)
Messof$e typedef struct SVC_OWNED_NOTIFY {
Argtm1®nb:; OBJECT ownedService; II The service or MIL conflict
II group which will have its
II owner changed.
OBJECT oldOwner; II The old owner.
OBJECT newOwner; II The proposed new owner.
U8 reserved [16] ;
SVC_OWNED_NOTIFY, *P SVC_OWNED_NOTIFY;
This message is sent to the service instance whose owner is being changed. The service instance can veto
the ownership change by returning anything other than stsOK or stsNotUnderstood.
This message must be passed to ancestor if the service does not want to veto the owner change.
Save Messages
msgSvcSaveRequested
Client asked to save this instance to external media.
Takes P_FS_FlAT_LOCATOR, returns STATUS.
*define msgSvcSaveRequested MakeMsg(clsService, 34)
COnUrNH'1fX A client sent msgSMSave to a service manager.
Default superclass behavior is to save the state file and the current target only. Subclasses should ensure
that their state file is up to date if they wish to make use of this behavior. Alternatively, subclasses can
not pass this message to ancestor and perform whatever form of save they wish.
The pArgs references the parent directory in which this service instance should be saved. If a node with
the same name as the service instance already exists within this directory, default superclass behavior is to
overwrite the destination. Subclasses can perform other forms of behavior if the destination exists before
passing this message to ancestor.
This message does not have to be passed to ancestor.
626 PENPOINT API REFERENCE
Part 13 / Writing PenPoint Services
msgSvcClassLoadlnstance
Loads an instance state file from disk and creates a new instance.
Takes P_SVC_LOAD_INSTANCE, returns STATUS. Category: class message.
#define rnsgSvcClassLoadInstance MakeMsg(clsService, 47)
typedef struct SVC_LOAD_INSTANCE
FS LOCATOR source; II Source state file location . .
} SVC_LOAD_INSTANCE, *P_SVC_LOAD_INSTANCE;
This function copies the state node specified by pArgs->source into the INST directory of the service
and starts up an instance of the service on this state file. This is very similar to what happens when a
warm-boot occurs, or when state nodes are automatically loaded when a service is first installed.
If a service instance with the same name already exists, default behavior is to generate a unique name for
the new service instance.
Subclasses do not normally process this message, but can if they wish to change the exist behavior.
stsFSNodeNotFound source file not found.
msgSMSave
msgSvcSetMetrics
Sets the configuration metrics.
Takes P_SVC_GET_SET_METRICS, returns STATUS.
#define msgSvcSetMetrics MakeMsg(clsService, 33)
Message typedef struct SVC_GET_SET_METRICS
,4r9umenh; P UNKNOWN pMetrics; II
Out through Ptr: Metrics buffer.
U16 len; II
In/Out: Metrics buffer size in
II
bytes. If 0 then the actual
II
size is returned.
} SVC GET_SET_METRICS, *p SVC_GET_SET_METRICS;
Configuration metrics are service specific. The caller should set pArgs->len to the size that was returned
from msgSvcGetMetrics when the metrics were originally gotten. A caller should never try and
synthesize a metrics buffer; he should only pass back a buffer that was gottem from msgSvcGetMetrics.
Subclasses can determine the version of a configuration buffer from its size. Subclasses should make sure
that different versions of configuration information have different sizes.
Subclasses must update their state node when they handle this message.
Subclasses that have configuration metrics must handle this message.
msgSvcllemoveFromManager
Removes this service instance from a service manager.
Takes P_SVC_REMOVE_FROM_MANAGER, returns STATUS.
#define msgSvcRemoveFromManager MakeMsg(clsService, 18)
typedef struct SVC_REMOVE_FROM_MANAGER
OBJECT manager; II Manager to remove self from
} SVC_REMOVE_FROM_MANAGER, *P_SVC_REMOVE_FROM_MANAGER;
This message allows a service to remove itself from a service manager it is currently on.
This results in msgIMDeinstalled being sent to observers of the service manager and any objects which
have bound to this service. It cleans up this service's bind list, removing anyone who bound via the
specified service manager.
Note: service managers automatically remove a service when the service class is deinstalled. There is no
need to do so explicitly.
stsNoMatch Service instance is not on the specified service manager.
628 PEN POINT API REFERENCE
Part 13 / Writing Pen Point Services
msgSvcGetOpenList
Gets a list of all the callers that have opened this service.
Takes P_SVC_GET_LIST, returns STATUS.
ide fine msgSvcGetOpenList MakeMsg(clsService, 27)
M®5SU£j® typedef struct SVC GET LIST
Argumc'tIl'S P OBJECT pList; II Out: list, allocated from process heap.
II CLIENT MUST OSHeapBlockFree WHEN
II FINISHED!
U16 count; II Out: number of elements in list
SVC GET LIST, *P_SVC_GET_LIST;
msgSvcGetOpenObjectList
msgSvcGetOpenObjectList
Gets a list of the open objects which were returned for each open.
Takes P_SVC_GET_LIST, returns STATUS.
idefine msgSvcGetOpenObjectList MakeMsg(clsService, 49)
M0SSCg0 typedef struct SVC_GET_LIST (
Arguments P OBJECT pList; II Out: list, allocated from process heap.
II CLIENT MUST OSHeapBlockFree WHEN
II FINISHED!
U16 count; II Out: number of elements in list
SVC_GET_LIST, *P_SVC_GET_LIST;
This list is ordered the same as the open list. The caller in openlist[i] was given the object in
openObjectList[i] .
msgSvcGetOpenList
msgSvcGetManagerList
Gets a list of all the service managers that this service is on.
Takes P_SVC_GET_LIST, returns STATUS.
idefine msgSvcGetManagerList MakeMsg(clsService, 28)
SERVMISC.H 629
Client List Messages
msgSvcGetManagerHandleList
Gets a list of the svc mgr handles that this service is represented by.
Takes P_SVC_GET_LIST, returns STATUS.
#define msgSvcGetManagerHandleList MakeMsg(clsService, 50)
Mess£lge typedef struct SVC_GET_LIST {
Avgu!'Tlents P OBJECT pList; II Out: list, allocated from process heap.
II CLIENT MUST OSHeapBlockFree WHEN
II FINISHED!
U16 count; II Out: number of elements in list
SVC GET LIST, *P_SVC_GET_LIST;
This list is ordered the same as the manager list. The handle in handleList[i] is this service's handle in
serviceManagerList[i] .
msgSvcGetManagerList
msgSvcGetDependentAppList
Gets a list of thelnstalledApps handles for all dependent apps.
Takes P _SVC_GET_LIST, returns STATUS.
#define msgSvcGetDependentAppList MakeMsg(clsService, 51)
Mes$og* typedef struct SVC_GET_LIST {
Arguments P OBJECT pList; II Out: list, allocated from process heap.
II CLIENT MUST OSHeapBlockFree WHEN
II FINISHED!
U16 count; II Out: number of elements in list
SVC_GET_LIST, *p SVC GET_LIST;
msgSvcGetDependentServiceList
Gets a list of thelnstalledServices handles for all dependent services.
Takes P _SVC_GET_LIST, returns STATUS.
#define msgSvcGetDependentServiceList MakeMsg(clsService, 52)
Messoge typedef struct SVC_GET_LIST {
Arguments P OBJECT pList; II Out: list, allocated from process heap.
II CLIENT MUST OSHeapBlockFree WHEN
II FINISHED!
U16 count; II Out: number of elements in list
SVC GET_LIST, *p SVC GET_LIST;
630 PENPOINT API REFERENCE
Part 13 / Writing Pen Point Services
Deinstallation/Destruction Messages
msgSvcClassTerminateOK
Deinstalls the entire service.
Takes P_OBJECT, returns STATUS. Category: class message.
fdefine msgSvcClassTerminateOK MakeMsg(clsService, 43)
Deinstallation is a two-phase process. The first phase allows any of the services or apps being deinstalled
to cancel the entire deinstall. msgSvcClassTerminateOK is the veto phase. Returning anything other
than stsOK signifies a veto. If anyone vetos the deinstall then msgSvcClassTerminateVetoed is sent to
all services that were sent msgSvcClassTerminateOK. If nobody vetos the deinstall then
msgSvcClassTerminate is sent.
The pArgs to msgSvcClassTerminateOK is used to pass back the object which is responsible for the
veto.
Default superclass behavior is to send msgSvcDeinstallRequested to each instance of the service, and
veto the deinstallation if any service instance vetos the deinstallation. The uid of the instance that vetoed
the deinstall is passed back via the pArgs.
This approach allows multiple services and applications that are dependent on each other to be
deinstalled in a coherent fashion.
Subclasses can override this message if they wish.
msgSvcDeinstall
msgSvcClassTerminateVetoed
Deinstall process was vetoed.
Takes P _SVC_TERMINATE_VETOED, returns STATUS. Category: class message.
fdefine msgSvcClassTerminateVetoed MakeMsg(clsService, 45)
typedef struct SVC_TERMINATE_VETOED {
OBJECT vetoer; II Object that vetoed the deinstall.
STATUS status; II Veto status.
SVC_TERMINATE_VETOED, *P_SVC_TERMINATE_VETOED;
This message informs the service that the deinstallation sequence that started with
msgSvcClassT erminateO K has been vetoed by one of the services or applications that was part of the
deinstall.
pArgs->vetoer gives the uid of the object or class which vetoed the deinstall. pArgs->status gives the
return status of the veto.
Default superclass behavior is to send msgSvcDeinstallVetoed to each instance of the service. .
Subclasses can override this message if they wish.
msgSvcDeinstallVetoed
msgSvcClassTerminate
Terminate the service.
Takes pNull, returns STATUS. Category: class message.
fdefine msgSvcClassTerminate MakeMsg(clsService, 24)
SERVMISC.H 631
Deinstallation/Destruction Messages
Comments Unconditionally terminate the service. All applications and services that are to be deinstalled have agreed
to the deinstallation.
Default superclass behavior is to send msgDestroy to each instance of the service.
Subclasses must pass this message to ancestor.
msgDestroy
msgSvcClientDestroyedEarly
An active client was destroyed.
Takes OBJECT, returns STATUS.
#define msgSvcClientDestroyedEarly MakeMsg(clsService, 48)
This message is sent to the service instance when a caller or service owner terminates unexpectedly. The
pArgs is the uid of the caller or owner.
Superclass behavior is to clean up the service instance by sending msgSMUnbind, msgSMClose and
msgSMSetOwner to self as appropriate.
Services that keep their own per-client information will need to process this message in order to clean up
their state.
This message must be passed to ancestor.
msgSvcDeinstallRequested
Client asked to destroy this service instance.
Takes pNull, returns STATUS.
#define msgSvcDeinstallRequested MakeMsg(clsService, 8)
A client has sent msgSMDeinstall to a service manager (to get rid of just this service instance), or the
entire service class is being deinstalled.
Deinstallation is a two phase process. All service instances that are going to be deinstalled are sent
msgSvcDeinstallRequested. Each service has the chance to veto the deinstall by returning an error
status. If all parties agree to the deinstall then msgFree is sent to each service instance. msgFree cannot
be vetoed. It causes the service to be removed from all service managers.
If anybody vetos the deinstall then msgSvcDeinstallVetoed is sent to each service that is part of the
deinstall process. Services should not accept any new clients while a deinstall is in process.
msgSvcDeinstallVetoed indicates that new clients can once again be accepted.
Default superclass behavior is to veto the de install if the service is in use (open). The superclass will also
handle new client rejection while a deinstall is in process if it gets this message.
This message must be passed to ancestor.
Note: A service might get msgSvcDeinstallRequested more than once for a given deinstallation
sequence.
msgSvcDeinstallVetoed
Deinstallation process was vetoed.
Takes P_SVC_DEINSTALL_VETOED, returns STATUS.
#define msgSvcDeinstallVetoed MakeMsg(clsService, 47)
--~~-------- .. --~---
632 PEN POINT API REFERENCE
Part 13 I Writing Pen Point Services
msgDestroy
Frees a service instance.
Takes OBJ_KEY, returns STATUS.
Subclasses should destroy all dynamic resources. Warning: Do not destroy any clsService resources, such
as the state node handle!
WARNING: Clients must NEVER send msgDestroy directly to a service instance; instead they should
send msgIMDeinstall to a service manager which the service instance is on.
Note that service manager message msgSMRemoveReference allows a service instance to be removed
from a single service manager without removing it from other service managers, or destroying the
instance. See servmgr.h for details on msgIMDeinstall and msgSMRemoveReference.
Miscellenous Messages
msgSvcGetStyle
Returns current style settings.
Takes P_SVC_STILE, returns STATUS.
idefine msgSvcGetStyle MakeMsg(clsService, 10)
msgSvcSetStyle
Changes style settings.
Takes P_SVC_STILE, returns STATUS.
idefine msgSvcSetStyle MakeMsg(clsService, 11)
msgSvcGetFunctions
Passes back a pointer to a table of function entry points.
Takes P_SVC_GET_FUNCTIONS, returns STATUS.
idefine msgSvcGetFunctions MakeMsg(clsService, 1)
typedef struct SVC GET FUNCTIONS
P UNKNOWN pFunctions; II Out: Pointer to function table.
U32 info; II Out: service-specific info.
SVC_GET_FUNCTIONS, *P_SVC_GET_FUNCTIONS;
This is for services that cannot afford the overhead of being accessed via object calls. The format of this
pointer block is up to the subclass. Default superclass behavior is to set pFunctions to pNull, which
means this service doesn't provide a table.
Subclasses should handle this message if they wish to provide a function interface to their service.
Default superclass behavior is to set pArgs->pFunctions to pNull and pArgs->info to O.
SERVMISC.H 633
Deinstallation/Destruction Messages
msgSvcGetName
Gets the name of this service instance.
Takes P_SVC_GET_NAME, returns STATUS.
#define msgSvcGetName MakeMsg(clsService, 22)
typedef struct SVC GET NAME
P STRING pName; II Out: caller must allocate
II nameBufLength buffer here
msgSvcName Change d
The service's name has been changed.
Takes pNull, returns STATUS.
#define msgSvcNameChanged MakeMsg(clsService, 55)
This message is self-sent to the service instance when its name is changed. This occurs when
msgIMSetName is sent to a service manager that this service is on.
The service is already set to the new name when this message is recieved. msgSvcGetN arne can be used
to get the new name.
This message is informational only. It does not have to be passed to ancestor.
msgSvcPropagateMsg
Propagates a service-specific message.
Takes P_SVC_PROPAGATE_MSG, returns STATUS.
#define msgSvcPropagateMsg MakeMsg(clsService, 25)
typedef struct SVC_PROPAGATE_MSG {
P ARGS pArgs;
SIZEOF pArgsSize;
MESSAGE msgi
SVC_PROPAGATE_MSG, *P_SVC_PROPAGATE_MSG;
Comments This message allows services to send their own informational messages to everyone who is bound to the
service and everyone who is an observer of any service manager that this service is on. This is similar to
what the system does wit~ messages like msgSMConnectedChanged.
The first two arguments of the pArgs of your notification message must be:
OBJECT manager; II manager that sent notification_HANDLE handle; I I handle to
serVIce
msgSvcPropagateNotify will fill these in with the correct service manager and handle for all of the
observers. For example:
typedef struct FOO_NOTIFY {
OBJECT manager i II svc manager that sent notification.
OBJECT handle; II handle to service.
FOO newFoo; II new foo.
FOO oldFoo; II old foo.
} FOO'NOTIFY, *p FOO NOTIFY;
FOO NOTIFY - fo(;Notify; SVC PROPAGATE MSG propagate;
propagate.pArqs = fooNotifYi propagate.pArqsSize = SizeOf(fooNotify); propagate.msg = msqFoo;
ObjCaIIRet(msqSvcPropaqateMsq, self, &propagate, s);
634 PENPOINT API REFERENCE
Part 13 / Writing PenPoint Services
msgSvcAutoDetectingHardware
Is the hardware that this service ultimately talks to auto-detecting?
Takes P_BOOLEAN, returns STATUS.
#define msgSvcAutoDetectingHardware MakeMsg(clsService, 37)
This message is propogated to this service's target, then the target's target, etc. until it finds the service
which actually interfaces to hardware (has no target). The hardware interface service is then asked ifit
can auto detect connect/disconnect.
stsSvcValidConnectStyleNotFound target chain ended without reaching hardware service instance.
msgSvcClassPopUpOptionSheet
Creates an option sheet for the service's global options and pops it up.
Takes pNull, returns STATUS. Category: class message.
#define msgSvcClassPopUpOptionSheet MakeMsg(clsService, 57)
The option sheet is only displayed if this is the first time the service is installed.
Subclasses do not normally process this message.
msgSvcClassGetlnstallDir
Creates a directory handle on the service's installation directory.
Takes P_OBJECT, returns STATUS.
#define msgSvcClassGetInstallDir MakeMsg(clsService, 58)
The service class creates a clsDirHandle object which references the location on external media that the
service was installed from. If the external volume is not connected, the user is asked to attach it.
If this service was bundled with PenPoint then there is no valid external volume beyond installation
time. stsFailed is returned in this case.
NOTE: CALLER IS RESPONSIBLE FOR DESTROYING THE DIR HANDLE WHEN DONE.
stsOK The external volume is attached. The user tapped the Cancel button when promptedto attach
the external volume. The external volume cannot be determined becausethis application was
bundled with PenPoint.
Descendants: You normally do not handle this message.
Notification Messages
msgSvcTargetChanged
A service's target has changed.
Takes P_SVC_TARGET_CHANGE_NOTIFY, returns STATUS. Category: observer notification.
#define msgSvcTargetChanged MakeMsg(clsService, 53)
typedef struct SVC TARGET CHANGE NOTIFY
OBJECT - manager;- II svc manager that sent notification.
OBJECT handle; II handle to service.
SVC TARGET oldTarget; II old target.
SVC TARGET newTarget; II new target.
SVC_TARGET_CHANGE_NOTIFY, *P_SVC_TARGET_CHANGE_NOTIFY;
This message is broadcast to all service managers that this service is on.
SYCTYPES.H
This file contains the type tags for services. These tags are used to provide categories of service classes.
This allows VIs like the printer manager VI to decide what types are available.
#ifndef SVCTYPES_INCLUDED
#define SVCTYPES_INCLUDED
#ifndef GO INCLUDED
#include <go.h>
#endif
#define svcTypePrinter MakeTag(clsService, 1)
#define svcTypeEMail MakeTag(clsService, 2)
Pari 14 /
Miscellaneous
BAnERY.H
This file contains the API definition for clsMILPowerDevice.
clsMILPowerDevice inherits from clsService.
theBattery is a well-known instance of clsMILPowerDevice. theBattery provides access to the primary
battery of the computer.
theBatteries is a well-known instance of clsServiceManager. theBatteries is the service manager that
manages the instances of clsMILPowerDevice that represent the computer's batteries (including
theBattery) .
clsMILPowerDevice provides an object interface to the computer's power devices (i.e. batteries).
*ifndef BATTERY_INCLUDED
*define BATTERY_INCLUDED
*ifndef MILSERV_INCLUDED
*include <milserv.h>
*endif
.Messages
msgBatteryGetMetrics
Passes back the battery's metrics.
Takes P_BATTERY_METRICS, returns STATUS.
*define msgBatteryGetMetrics MakeMsg(clsMILPowerDevice, 1)
typedef struct BATTERY_METRICS
U16 batteryFlags; II flags defined above
U16 maxMillivolts;
U16 warnMillivolts;
U16 failMillivolts;
U16 currentMillivolts;
U16 percentOfBatteryLeft;
U16 maxSeconds;
U16 secondsOfBatteryLeft;
BATTERY_METRICS, * P_BATTERY_METRICS;
640 PENPOINT API REFERENCE
Part 14 / Miscellaneous
msgBatterySetLevel
Sets the percentage of battery remaining.
Takes UI6, returns STATUS.
#define msgBatterySetLeve! MakeMsg(c!SMILPowerDevice, 2)
The MIL request milPowerSetBatteryLevel is sent to the MIL device unit represented by the receiver.
msgBatteryLow
Sent when a battery level is dangerously low.
Takes void, returns STATUS. Category: observer notification.
#define msgBatteryLow MakeMsg(c!SMILPowerDevice, 128)
msgBatteryCritical
Sent when a battery drops level below the shutdown level.·
Takes void, returns STATUS. Category: observer notification.
#define msgBatteryCritica! MakeMsg(c!SMILPowerDevice, 129)
DYNARRAY.H
This file contains the API definition for dynarray. Dynarrays provide a set of dynamic array routines.
The functions described in this file are contained in XLIST.LIB.
Implements a dynamic array of elements. Standard interface routines for indexing, inserting, deleting,
and other common operations are provided. This interface is primarily used internally to GO, and is
therefore tailored to meet internal needs.
A dynamic array is a simple data structure that contains some array information fields, and a pointer to a
block of memory. This block of memory is equal to pArray->entries * pArray->elementSize.
The number of entries is specified at initialization time in DynArrayNew, and can be changed via
DynArrayContract, or DynArrayExpand. These are implicitly called from DynArrayInsert and
DynArrayDelete when inserting an item into a list that does not have enough entries available, or when
deleting an item from the list. At any time, the value returned by DynArrayCount, or pArray->entries,
will be equal to the number of entries allocated in the array in pArray->pData. The size of the array in
pArray->pData will be equal to pArray->entries * pArray->elementSize.
The maximum index set in the array at any given time, independent of the number of entries in the
array, is referred to as maxCount. This is equal to the greatest array index number set via DynArraySet
or inserted via DynArrayInsert. It is also updated in DynArrayGetPtr, even if the user is getting the
pointer to a cleared data pointer that has not been set or inserted. DynArrayGetPtr is also used during
binary searches, and hence that function will modify maxCount if the binary search expands to empty
elements in the list. This is necessary because client functions can modify the contents of the element via
DynArrayGetPtr, because they have direct access to the data. Typical users of dynamic arrays will not call
DynArrayGetPtr in such a manner as to modify maxCount.
In summary, entries is the amount of space allocated by the array, and maxCount is the number of
elements set or inserted into the array.
When memory is allocated for entries in the array, via DynArrayInsert, DynArrayNew, or
DynArrayExpand, it is initialized to O.
#ifndef DYNARRAY INCLUDED
#define DYNARRAY INCLUDED
#ifndef GO_INCLUDED
#include <go.h>
#endif
#ifndef OSHEAP INCLUDED
#include <osheap.h>
#endif
642 PENPOINT API REFERENCE
Part 14 / Miscellaneous
Dynamic Array
This data structure is the dynamic array data structure. A dynamic array created and manipulated is
simply a pointer to this data structure that is passed to the dynarray functions. Accessing the fields in
this data structure is possible, but care should be taken as changing their values could have drastic side
affects. This data structure is sometimes referred to as the array header.
typedef struct DYNARRAY {
OS_HEAP_ID heap; II heap used for allocations
U16 entries;
U16 elemSize;
*
II total entries in the array
II size in bytes of individual elements
P_U8 pData; II pointer to the array of values
U16 maxCount; II Max index accessed in the array via
II DynArraySet, DynArrayGetPtr, DynArrayBinSearch
II Updated when inserting, deleting, or contracting
II array.
} DYNARRAY, *P_DYNARRAY;
Public Functions
DynArrayNew
Allocates a new dynamic array. Passes back the P_DYNARRAY header.
Returns STATUS.
fum:tion ?rototype STATUS DynArrayNew (
OS_HEAP_ID heap, II In: heap for memory allocation
II NULL=>osProcessHeapId
U16 elementSize, II In: size in bytes of each array element
U16 startSize, II In: initial array size in number of elements
U16 extraHeader, II In: additional bytes to allocate in the header
P_DYNARRAY *ppArray); II Out: pointer to the header pointer
(omments Allocates memory for the array header, the P_DYNARRAY that is passed to the dynarray functions.
Allocates memory for the initial elements in the array. Parameters include: the allocation heap to
perform memory allocations, the size of an individual element, the initial size of the array
(pArray->elements will the same as this value when this function returns), and any extra space to be
allocated in the P_DYNARRAY pointer. This space can be used by clients to store list-wide information or
flags. Passes back a pointer to the array data structure, P_DYNARRAY.
DynArrayFree
Destroys the dynamic array and frees memory used by the array.
Returns STATUS.
FtH'Idion Prototype STATUS DynArrayFree (
P_DYNARRAY pArray); II In: array header. Will be freed.
Ccwnments Will free all memory allocated by the array to store the header information and the elements. Does not
do anything with the entries in the array.
DYNARRAY.H 643
Public Functions
DynArrayExpand
Expands the array by the specified number of entries.
Returns STATUS.
Fundion Prototype STATUS DynArrayExpand (
P_DYNARRAY pArray, II In: array header
U16 add); II In: Number of elements to add
Expands the array by a number of entries, updating pArray->entries, the returned value of calling
DynArrayCount, and the reallocation of pArray->pData to be equal to pArray->entries *
pArray->elementSize. This function is called when calling DynArrayInsert to add space for one more
entry. It is also called in DynArraySet if the index is greater than the number of entries.
DynArraySet
DynArrayContract
Contracts the array by the number of entries.
Returns STATUS.
WlH1dlon Prototype STATUS DynArrayContract (
P_DYNARRAY pArray, II In: array header
U16 truncate); II In: Number of elements to free
Will contract the number of entries in the array, and free the memory associated with those entries. Will
resize the amount of memory allocated by the array pArray->pData to be pArray->entries *
pArray->elementSize. If the maxCount (return code of DynArrayCount) is greater than the new
number of entries allocated, maxCount will be adjusted. Called from DynArrayDelete to contract the '"::::»
o
array when deleting items. 1&.1
Z
~
DynArrayDelete
DynArrayGet
Passes back the index'th element in the array.
Returns STATUS.
fundlon Prt>h::1type STATUS DynArrayGet (
P_DYNARRAY pArray, II In: array header
U16 index, II In: element index
P_UNKNOWN pData); II Out: pointer to data buffer. Must be elementSize.
Will pass back the contents of the index'th element in the array. Will copy the memory of size
elementSize containing the data for the element into pData. It is the clients responsibility to ensure that
this data pointer is large enough.
DynArraySet
Sets the index'th item to the given value. Update maxCount.
Returns STATUS.
fundicm f:~rQtQtype STATUS DynArraySet (
P_DYNARRAY pArray, II In: array header
U16 index, II In: element index
P_UNKNOWN pData); II In: pointer to data or NULL for zero fill
644 PENPOINT API REFERENCE
Part 14 / Miscellaneous
Sets the contents of the index'th item to the given value. Will copy the contents of the pData pointer to
the memory for the index'th element in the array. It is the clients responsibility to ensure that pData is
correct. If index is greater than maxCount, it will update maxCount. If the index is greater than the
number of entries, the array is expanded via DynArrayExpand to be large enough. Called from
DynArrayInsert to set the value of the new index.
DynArrayInsert
DynArrayGetPtr
Passes back a pointer to the index'th element in the array.
Returns STATUS.
Fttvn:tlf:Hl Pn~)t©typ0 STATUS DynArrayGetPtr (
P_DYNARRAY pArray, II In: array header
U16 index, II In: element index
PP_UNKNOWN pData); II Out: pointer to data buffer
CommentJi Will pass back the direct pointer to the index'th element in the dynamic array. Care should be taken
when accessing this pointer, as it is memory that is allocated and managed by the array. Accessing the
data in this manner WILL cause the maxCount to be increased if maxCount < index. This function is
called during a binary search via DynArrayBinSearch. Hence that function could modifY maxCount.
See t\;s© DynArrayBinSearch
DynArraylnsert
Inserts a new element in the array.
Returns STATUS.
FUfn::Vlon Prcd'ovype STATUS DynArrayInsert (
P_DYNARRAY pArray, II array header
U16 index, II element index
P_UNKNOWN pData II new data to insert or NULL
);
The new element is indexed by index. If the array is not big enough, will expand the atray appropriately.
Elements are copied from the index'th location to the next location.
DynArrayExpand
DynArrayDelete
Deletes the index'th element from the array.
Returns STATUS.
Funcvlon PVOVOty[:H0 STATUS DynArrayDelete (
P_DYNARRAY pArray, II array header
U16 index II element index to delete
);
Will delete the index'th element from the array. If index is > entries, will return stsOK and do nothing.
Will move all elements greater than the index down by one in the array. Will adjust m~Count if
necessary. Will call DynArrayContract with parameter of one.
DYNARRAY.H 645
Public Functions
DynArrayCount
Passes back the number of entries allocated in the array.
Returns STATUS.
fUrldkm Prototype STATUS DynArrayCount (
P_DYNARRAY pArray, II In: array header
P_U16 pCount); II Out: pointer to the count
Passes back the number of entries allocated in the array. This number is the amount of space allocated,
and not the number of items stored in the array. That value is returned by DynArrayMax.
DynArrayMax
Passes back the highest index stored.
Returns STATUS.
Fum;tk~n Pn.>totype STATUS DynArrayMax (
P_DYNARRAY pArray, II In: array header
P_U16 pMax); II Out: pointer to the max index
Comments Will return the highest index stored via DynArraySet or DynArrayGetPtr, plus one. This is the
"maxCount" field, and is used to indicate the highest array entry that has a valid value.
DynArrayElemSize
Passes back the size, in bytes, of each element.
Returns STATUS.
Fundion Pn:tf(:tfype STATUS DynArrayElemSize (
P_DYNARRAY pArray, II In: array header
P_U16 pSize); II Out: pointer to the size
Comments Passes back the size allocate in the array for each element. The pArray->pData size will be the value
passed back by this function * the value passed back by DynArrayCount.
DynArrayGetPtr
P_BIN_PROC is the comparison routine callback. Will be called to test items. Called parameters
containing pointers to an element in the array, and a pointer to a test' element' to check for comparison.
°
Returns for equal, -1 for less, 1 for greater.
DYNARRAY_SEARCH is the parameter into the DynArrayBinSearch function. Takes the search data
pointer to locate, a starting index into the array to search, a stopping index into the array to search, and
a comparison callback function to test the data pointer against elements in the array. If result is 0, passes
back the starting and ending indices that match. If result is -1, the target data pointer was less than both
the starting and ending indices searched. Similarly, if result is 1, the target data pointer was greater than
both indices.
GOSIARCH.H
This file contains the API definition for GO's modified binary search. The function described in this file
is contained in MISC.UB.
The fundamental difference between this binary search and the search that is part of the standard
runtime is that if the search fails, this search indicates where a searched for element should have been
located, thereby aiding insertion of a new element.
#ifndef GO SEARCH_INCLUDED
#define GOSEARCH_INCLUDED $Revision: 1.6 $
#ifndef GO INCLUDED
#include <go.h>
#endif
ttmdlon Pro7©type typedef P_UNKNOWN (CDECL *ACCESS_FUNC) (
const P_UNKNOWN, II context
const U32); II index
tundkm Prototype typedef int (CDECL *COMPARE_FUNC) (
const P_UNKNOWN, II context
const P_UNKNOWN, II key1
const P_UNKNOWN) ; II key2
binarySearch
Performs a binary search for specified key within dataStructure.
Returns SfATUS.
function Prot©type STATUS EXPORTED binarySearch (
const P_UNKNOWN key,
const P_UNKNOWN dataStructure,
const U32 count,
COMPARE FUNC compare,
ACCESS FUNC access,
const U16 itemSize,
PP UNKNOWN pFoundOrInsert,
P U32 pIndex) ;
binarySearch performs a binary search on a sorted, indexed data structure.
The caller provides an count of the number of items in the data structure, an access function that
translates an item index into an address for the item key, and a comparison function to compare a pair
of keys.
A detailed description of the parameters follows.
key key to search for.
dataStructure handle of data structure to search.
count number of items in data structure.
compare pointer to comparison function (see below).
access pointer to access function (see below). IfNi!, dataStructure is assumed to be the address of a
sorted, contiguous array of items (itemSize bytes long) with the item key at the start of each item.
648 PENPOINT API REFERENCE
Part 14 I Miscellaneous
This file contains the Personal Dictionary Class API. This class contains methods that maintain an
ordered ASCII list of words and can produce a compressed list (called the template), which is specially
organized for use with handwriting translation software.
clsPDict inherits from clsObject.
thePersonalDictionary is a well known instance of clsPDict.
The word list maintained by thePersonalDictionary is used by default whenever spelling-assisted
handwriting translation is performed.
spell.h
#ifndef PDICT_INCLUDED
#define PDICT_INCLUDED
#ifndef FS_INCLUDED
#include <uuid.h>
#include <fs.h>
#endif
#ifndef INSTLMGR_INCLUDED
#include <instlmgr.h>
#endif
Common typedefs
Miscellaneous
This structure is used for converting a word index into a word and vice versa. (That is, for example, to
get word #5 from the PDict or to find out which word number in the PDict "PenPoint" is.)
typedef struct POICT_NUM_WORD
U16 number;
P CHAR pWord;
POICT_NOM_WORD, * P_POICT_NUM_WORD;
Messages
nnsgI>I>ictc;e~etrics
Gets a copy of the personal dictionary metrics structure.
Takes P_PDICT_METRICS, returns STATUS.
fdefine msgPOictGetMetrics MakeMsg(clsPOict,l)
Message typedef struct POICT METRICS {
Argt.HllenWS U16 wordCount; II number of words in the personal dictionary (RO)
P UNKNOWN pXTemplate; II pointer to compressed template
POICT_METRICS, * P_POICT_METRICS;
This is mainly useful to find out how many words are in thedictionary.
nnsgI>I>ictEnunnerateWords
Fills a list of pointers to strings with pointers to all the words in the personal dictionary.
Takes PP_CHAR, returns STATUS.
fdefine msgPOictEnumerateWords MakeMsg(clsPOict,2)
The pArgs must be the address of the base of an array of pointers to filled in. This array must have an
entry for every word in thedictionary plus one for the final null (get the metrics toout how many
words are in the PDict. The words will be in ASCIIsequence, and because the pointers all point to
an internalstructure, no memory is allocated. N.B. you must treat thisas strictly read-only!
nnsgI>I>ictAddWord
Adds a word to the personal dictionary.
Takes P_PDICT_NUM_WORD, returns STATUS.
fdefine msgPOictAddWord MakeMsg(clsPOict,3)
Message typedef struct POICT_NUM_WORD
ArgumenTs U16 number;
P CHAR pWord;
POICT_NOM_WORD, * P_POICT_NUM_WORD;
The routine SpellAddWordO, defined in spell.h, is a better way fordients to add words to the Personal
Dictionary, since it has aAPI, strips excess punctuation, checks for duplicates, etc.
msgPDictAddW"ord adds the string from the PDICT_NUM_WORD structure, the zero-based offset of the
new word in the personal, and passes back that offset in the number component
ofPDICT_NUM_WORD structure.
Although the ASCII representation of the Personal Dictionary isimmediately, the compressed template
is not rebuilt until thetime msgPDictUpdateTemplate is called. Handwriting Translationthis
automatically when it needs the template, but spelling does.
PDICT.H 651
Messages
msgPDictDeleteWord
Deletes a word from the personal dictionary.
Takes P_PDICT_NUM_WORD, returns STATUS.
*define msgPDictDeleteWord MakeMsg(clsPDict,4)
Messoge typedef struct PDICT NUM WORD
Argurnenb U16 number;
P CHAR pWord;
PDICT_NUM_WORD, * P_PDICT_NUM_WORD;
The reverse of msgPDictAddWord, this message removes the word frompersonal dictionary and passes
back the zero-based offset of thewhere it formerly was.
Like msgPDictAddW"ord, this only affects the ASCII representation ofPersonal Dictionary. The next
handwriting translation operationrebuild the template, but if you need it built before that (for, to
change the behavior of spelling), send.
msgPDictNumToWord
Locates a word in the personal dictionary by index number, passing back the word at that offset.
Takes P_PDICT_NUM_WORD, returns STATUS.
*define msgPDictNumToWord MakeMsg(clsPDict,5)
Messoge typedef struct PDICT_NUM_WORD
Arguments U16 number;
P CHAR pWord;
PDICT_NUM_WORD, * P_PDICT_NUM_WORD;
Words are indexed in ASCII collating sequence from zero.
msgPDictFindWord
Checks if a word is in the personal dictionary.
Takes P_CHAR, returns STATUS.
*define msgPDictFindWord MakeMsg(clsPDict,6)
stsOK means it was found; stsFailed means it was not.
msgPDictDeleteNum
Locates a word in the personal dictionary by index number and deletes the word at that offset.
Takes P_PDICT_NUM_WORD, returns STATUS.
*define msgPDictDeleteNum MakeMsg(clsPDict,7)
Mess0ge typedef struct PDICT_NUM_WORD
Argui'l1ents U16 number;
P CHAR pWord;
PDICT_NUM_WORD, * P_PDICT_NUM_WORD;
Words are indexed in ASCII collating sequence from zero. The numberthe word to delete is the number
field from the PDICT_NUM_WORD; the actual word deleted is passed back in pWord. (This
MUSTset to point to something by the caller! Max size is+ 1. Setting pWord to Nil(p_CHAR) passes
nothing back.)
652 PEN POINT API REFERENCE
Part 14 / Miscellaneous
msgPDictWordToNum
Given a word, computes its offset within the personal dictionary.
Takes P _PDICT_NUM_WORD, returns STATUS.
#define rnsgPDictWordToNurn MakeMsg(clsPDict,8)
M(Hl$Ci~e typedef struct PDICT NUM WORD
Ar£l!JmeitfS U16 number;
P CHAR pWord;
PDICT_NUM_WORD, * P_PDICT_NUM_WORD;
Words are counted from zero in ASCII collating sequence.
msgPDictUpdateTemplate
Recomputes the compressed template from the word list and updates the pointer.
Takes PP_UNKNOWN, returns STATUS.
#define rnsgPDictUpdateTernplate MakeMsg(clsPDict,9)
When the ASCII form of the personal dictionary i~ modified, thetemplate is not automatically
modified. Since compressionbe time consuming, this is deferred until it is absolutely. This routine is
called by Handwriting Translation at theof every translation.
If the curren! template is not out of date, this just copies old value intoargument.
Miscellaneous
Base of the template of thePersonalDictionary. Handwritingneeds to be able to get at this very quickly,
so it'sas an exported global variable to allow it to avoid the.
extern P_UNKNOWN PASCAL pPDictBase;
#define hlpPDAppBackground MakeTag(clsPDApp,l)
POWER.N
This file contains the API definition for class clsPowerButton.
clsPowerButton inherits from clsObject.
"thePowerButton" is a well known object that provides notification when the machine is turned off and
on.
#ifndef POWER_INCLUDED
#define POWER_INCLUDED
#ifndef GO INCLUDED
#include <go.h>
#endif
#ifndef CLSMGR INCLUDED
#include <clsmgr.h>
#endif
Messages
msgPBMachinePoweringUp
Notifies clients that the machine is powering up.
Takes nothing, returns nothing. Category: observer notification.
#define msgPBMachinePoweringUp MakeMsg(clsPowerButton, 1)
Sent by the system to observers of thePowerButton. Indicates that the machine is in the process of
powering up.
The system will not power up until all observers of the PowerButton are notified. The system will wait
until the notification message has completed for each client.
msgPBMachinePoweringDown
Notifies clients that the machine is powering down.
Takes nothing, returns nothing. Category: observer notification.
#define msgPBMachinePoweringDown MakeMsg(clsPowerButton, 2)
Sent by the system to observers of thePowerButton. Indicates that the machine is in the process of
powering down.
Most applications do not need to observe the power button, since theSystem sends the appropriate
messages to all applications and services when the machine powers down.
The system will not power down until all observers of thePowerButton are notified. The ·system will
wait until the notification message has completed for each client.
POWERMGR.H
This file contains the API definition for class clsPowerMgr.
clsPowerMgr inherits from clsObject.
"thePowerMgr" is a well known object that provides system power management.
#ifndef POWERMGR_INCLUDED
#define POWERMGR INCLUDED
#ifndef GO_INCLUDED
#include <go.h>
#endif
#ifndef CLSMGR_INCLUDED
#include <clsmgr.h>
#endif
Messages
msgPMSetPowerState
Sets the machine power state.
Takes PM_POWER_STATE, returns nothing.
#define msgPMSetPowerState MakeMsg(clsPowerMgr, 1)
#define pmStandby flagO II power down to stand by state.
#define pmPowerOff flag1 II power down to complete off.
#define pmForceBoot flag2 II Force a cold boot on the machine
#define pmQuickestPowerOnState (pmStandby I pmPowerOff)
II quickest allowable power on state.
Initiates the powering down of the machine. The machine can be powered down in "standby" state (i.e.
RAM is maintained, but the rest of the system is shut down) or "complete off' state.
Powering down the machine will force all data to be saved to disk (if applicable) and will notify all
observers of the power button of this event (see power.h).
If the client is unfamiliar with the hardware configurations, use pmQuickestPowerOnState. This mode
will power down the machine to the state that will cause the machine to come up in the quickest
possible time.
pmForceBoot will force the machine to reset and cold boot the software. Caution: Under certain
configurations this may cause loss of datal!! Specifically, under a RAM only configuration, all the
contents of RAM will be lost.
656 PENPOINT API REFERENCE
Part 14 / Miscellaneous
msgPMGetPowerMetrics
Passes back the machine power information.
Takes P _PM_POWER_METRICS, returns STATUS.
#define msgPMGetPowerMetrics MakeMsg(clsPowerMgr, 2)
#define pmStandbyPowerSupported flagO II only ram is alive
#define pmNoPowerSupported flagl II everything is off
#define pmStandbyButtonSupported flag2 II power button usage
#define pmChargerConnectedSupported flag3 II power connection
#define pmldleStateSavesPower flag4 II idle = low power state?
#define pmChargerConnected flagS II is power connected?
#define pmSomeDevicePoweredDown flaglS II something is off
Passes back information on what power states are supported on this machine. The machine can support
either 1) standby or 2) power off or 3) both or 4) none. Setting none indicates that the software is
unable to change the power state of the machine.
This message also returns information on the charger and whether a standby button is supported.
msgPMDevicesPowerOn
Turns power on to all devices in the system.
Takes nothing, returns STATUS.
#define msgPMDevicesPowerOn MakeMsg(clsPowerMgr, 3)
msgPMDevicePoweringOn
Notifies observers that a device is powering up.
Takes U16, returns nothing. Category: observer notification.
#define msgPMDevicePoweringOn MakeMsg(clsPowerMgr, 4)
Sent by the system to observers of thePowerMgr. Indicates that a device (specified by MIL logical Id) is
powenng up.
msgPMDevicePoweringOff
Notifies observers that a device is powering down.
Takes U16, returns nothing. Category: observer notification.
#define msgPMDevicePoweringOff MakeMsg(clsPowerMgr, 5)
Sent by the system to observers of thePowerMgr. Indicates that a device (specified by MIL logical Id) is
powering off.
msgPMAllDevicesPoweredOn
Notifies observers that all devices have powered up.
Takes nothing, returns nothing. Category: observer notification.
#define msgPMAllDevicesPoweredOn MakeMsg(clsPowerMgr, 6)
Sent by the system to observers of thePowerMgr.
API 1 denotes PenPoint API Reference, Volume I API2 denotes PenPoint API Reference, Volume II
msgVSFormatCompleteNotify, API2: 117 msgWinLayoutSelf, APII :303, APII :370, msgXIateModeSet, API 1: 740
msgVSFormatMedia, API2: 117 APIl:447, APIl:469, APIl:489, msgXIateSetFlags, API 1: 742
APIl :529, APII :535, APII :568,
msgVSFormatVolume, API2:116 msgXIateSetHistoryTemplate, API 1: 746
APIl :575, APIl :608, APIl :729
msgVSN arneVol ume, API2: 117 msgXIateSetXlateCaseMetrics, API 1:745
msgWinMoved, APIl:316
msgVSUpdateVolumes, API2: 117 msgXIateStringSet, API 1: 741
msgWinOrphaned, APIl:314
msgWinBeginPaint, API 1:284-285, msgXIateT emplateGet, API 1:744
msgWinRepaint, APII :314, APIl :343,
APIl:310 msgXIateT emplateSet, API 1:744
APIl :448, APIl :529, APIl :535,
msgWinBeginRepaint, APIl:284, APIl:545, APIl:729 msgXShapeRecognize, APIl: 765
APIl:310
msgWinSend, APIl:305 msgXShapeShapeCompatible, API 1: 7 66
msgWinCleanRect, APIl:311
msgWinSetFlags, APIl:306, API1:415, msgXShapeShapeEvaluate, APIl:767
msgWinCopyRect, APIl:285, APIl:311 APIl:545, APIl:568 msgXShapeShapeLearn, APIl: 767
msgWinDelta, APIl:285, APIl:301 msgWinSetLayoutDirty, APIl:305 msgXShapeStrokePreview, API 1:764
msgWinDeltaOK, APIl:315 msgWinSetLayoutDirtyRecursive, msgXTeachCompleted, APIl:771
msgWinDevBindPixelmap, API 1:286, APIl:305 msgXTeachEvaluationGet, APIl:770
APIl:322 msgWinSetPaintable, APIl:310 msgXTeachExecute, API 1: 770
msgWinDevBindPrinter, APIl:321 msgWinSetPopup, API 1:309 msgXTeachSetld, API 1: 770
msgWinDevBindScreen, APIl:321 msgWinSetTag, APIl:307, APIl:430 msgXTeachSetTarget, API 1: 770
msgWinDevGetRootWindow, APIl:321 msgWinSetVisible, APIl:309 msgXTextComplete, API 1:780
msgWinDevPrintPage, APII :323 msgWinSized, APIl:317, APIl:729 msgXT extGetXList, API 1: 780
msgWinDevSetOrientation, API 1:322 msgWinSort, APIl:317 msgXTextModLine, APIl:780
msgWinDevSizePixelmap, API 1:286, msgWinStartPage, APIl:317, APIl:459,
APIl:322 msgXTextNewLine, APIl:780
APIl:685
msgWinDirtyRect, APIl:284, APIl:310 msgXTextWordList, APIl:780
msgWinTransformBounds, APII :285,
msgWinDumpTree, APIl:318 APIl:312 msgXtractComplete, API 1: 783
msgWinEndPaint, APIl:310 msgWinUpdate, APIl :311 msgXtractGetScribble, API 1:782
msgWinEndRepaint, APII :31 0 msgWinVisibilityChanged, API 1:316 msgXtractStrokesClear, APIl:782
msgWinEnum, APIl:312 msgXWordComplete, APIl:785
msgXferGet, API 1: 731
msgWinExtract, API 1:300 msgZIPGetM yZone, API2:367
msgXferGet, API2:336
msgWinExtracted, APII :316
msgWinExtractO K, APII :315
msgWinFindAncestorTag, APII :309
msgWinFindTag, APII :309
msgWinFreeOK, API1:316
msgXferList, API 1: 168, API 1:731
msgXferList, API2:336
msgXferStreamAuxData, API2:338
msgXferStream Connect, API2:338
msgXferStreamFreed, API2:339
-
msgZIPGetZoneList, API2:367
NAME, API2:208
NBP_CONFIRM, API2:366
NBP _LOOKUP, API2:366
msgWinGetBaseline, APIl:304, msgXferStreamSetAuxData, API2:339 NBP_REGISTER, API2:366
APIl:448, APIl:459, APIl:530, msgXferStreamWrite, API2:339
APIl:609 NBP_REMOVE, API2:366
msgXGestureComplete, APIl:736 NBP_TUPLE, API2:366
msgWinGetDesiredSize, APII :304
msgXIateCharConstrainsGet, API 1: 743 Nil, APIl:53
msgWinGetEnv, APIl:318
msgXIateCharConstrainsSet, API 1: 743 NilUUID, API2:83
msgWinGetFlags, APII :306
msgXIateCharMemoryGet, API 1: 744 NOTE_METRICS, APIl:485, APIl:487
msgWinGetMetrics, APIl:285, APIl:306
msgXIateCharMemorySet, API 1: 744 NOTE_NEW, API 1:486-487
msgWinGetPopup, APII :308
msgXIateComplete, API 1: 746 NOTE_NEW_ONLY, API 1:486
msgWinGetTag, APIl:307
msgXlateCompleted, API 1:653, API 1: 728 NOTE_PAPER_DC_INFO, API2:243
msgWinHitDetect, APIl:285, APIl:319
msgXIateCompleted, API 1: 747 NOTE_PAPER_METRICS, API2:242-244
msgWinInsert, APIl:299
msgXlateData, APIl:746, APIl:770 NOTE_PAPER_NEW, API2:242
msgWin Inserted, APII :316
msgXIateFlagsClear, API 1: 743 NOTE_PAPER_NEW_ONLY, API2:242
msgWinInsertOK, APII :314
msgXIateGetFlags, API 1: 743 NOTE_PAPER...SEL_TYPE, API2:244
msgWinInsertSibling, API 1:300
msgXlateGetHistoryTemplate, API 1:745 NOTE_PAPER...STYLE, API2:242, API2:245
msgWinIsDescendant, APIl:308
msgXIateGetXlateCaseMetrics, API 1:745 NOTE_RES_ID, APII :486
msgWinIsVisible, APIl:307
msgXIateMetricsGet, API 1: 741 NP_DATA_ADDED_ITEM, API2:259
msgWinLayout, API 1:302
msgXIateMetricsSet, API 1: 740 NP_DATA_ADDED_NP _ITEM_VIEW,
msgXIateModeGet, API 1: 740 API2:254
INDEX 677
!l!lffilIT
ObjectlsGlobal, API 1: 10 ObjPostDirectWarn, APIl:44-45
ObjectlsGlobalWKN, API 1: 10 ObjPostJmp, APIl:39
OBLANCESTOR_IS_A, APIl:21
ObjectlsLocal, API 1: 10 ObjPostOK, APIl:39
OBLCAPABILITY, APIl:5, APIl:17
ObjectlsPrivateWKN, APIl: 10 ObjPostRet, API 1:39
OBLCAPABILITY_SET, APIl:7, APIl:17
ObjectlsProcessGlobalWKN, APIl: 10 ObjPostTaskWarn, APIl:44-45
OBLCLASS, APIl:21
ObjectlsWellKnown, APIl:10 ObjPostU32Jmp, APIl:39
OBLCOPY, APIl:14
ObjectlsWKN, APIl:I0 ObjPostU320K, APIl :39
OBLCOPY_RESTORE, APIl:14
ObjectMsgAlter, APIl:36 ObjPostU32Ret, APIl:39
OBLDISPATCH_INFO, APIl:35
ObjectMsgDispatch, APIl:35 ObjPostU32Warn, APIl:44-45
OBLENUM_OBSERVERS, APIl :24
ObjectMsgDispatchlnfo, APIl:35 ObjPostWarn, APIl:44-45
OBLEXCEPTION, APIl:15-16
ObjectMsgExtract, APIl:36 ObjSendJmp, APIl:38
OBLFS_LOCATOR, APIl:14
ObjectMsgLoop, APIl:35 ObjSendOK, APIl:38
OBLIS_A, APIl:20
ObjectOwner, APIl:32 ObjSendRet, API 1:38
OBLLOCK_SET, APIl:18
ObjectPeek, API 1:31 ObjSendTaskJmp, APIl:39
OBLMUTATE, APIl :23
ObjectPoke, API 1:31 ObjSendTaskOK, APIl:39
OBLNOTIFY_OBSERVERS, APIl:7, APIl:24
ObjectPost, API 1:28 ObjSendTaskRet, APIl:38
OBLOBSERVER_POS, APIl:7, APIl:23,
ObjectPostAsync, API 1:29 ObjSendTaskWarn, APIl:44-45
APIl:25
ObjectPostAsyncTask, APIl :29 ObjSendU32Jmp, APIl:39
OBLOWNER, APIl:7; APIl:19, APIl:21
ObjectPostAsyncTaskWarning, APIl:43 ObjSendU320K, APIl:39
OBLPROP, APIl:7, APIl:20
ObjectPostAsyncWarning, APIl:42 ObjSendU32Ret, API 1:39
OBLRESTORE, APIl:8, APIl:12-13
ObjectPostDirect, API 1:30 ObjSendU32Warn, APIl:44-45
OBLSAVE, APIl:8, APIl:13
ObjectPostDirectTask, APIl:30 ObjSendUpdateJmp, APIl:38
OBLSTATISTICS, APIl:37
ObjectPostDirectTaskWarning, API 1:43 ObjSendUpdateOK, APIl:38
OBLSUBTASK_FREE, API 1: 16
ObjectPostDirectWarning, APIl:42 ObjSendUpdateRet, APIl:38
ObjCallAncestorChk, APIl:38
ObjectPostTask, APIl:29 ObjSendUpdateTaskJmp, APIl:39
ObjCallAncestorCtxJ mp, API 1:38
ObjectPostTaskWarning, APIl:43 ObjSendUpdateTaskOK, APIl:39
ObjCallAncestorCtxOK, APIl :38
ObjectPostU32, API 1:29 ObjSendUpdateTaskRet, APIl:39
ObjCallAncestorCtxRet, API 1:38
ObjectPostWarning, APIl:42 ObjSendUpdateTaskWarn, APIl:44-45
ObjCallAncestorCtxWarn, APIl:44-45
ObjectRead, APIl :31 ObjSendUpdateWarn, APIl:44-45
ObjCallAncestorFailed, APIl:38
ObjectSend, APIl:27 ObjSendWarn, APIl:44-45
ObjCallAncestorJ mp, API 1:38
ObjectSendTask, APIl:27 OBX_DOC_EXIT_BEHAVIOR, API2:445
ObjCallAncestorOK, APIl:38
ObjectSendTaskWarning, APIl:41 OBX_DOC_GET_SERVICE, API2:441
ObjCallAncestorRet, APIl:38
678 INDEX
-
SVC_LOAD_INSTANCE, API2:626
SysDcFontString, API 1 :280 TBL_NEW_ONLY, API2:313
SVC_NEW, API2:600
TBL_SEARCH_SPEC, API2:318
SVC_NEW_ONLY, API2:600
TBL_STATE, API2:317
SVC_OPEN_CLOSE, API2:605-606 TA_ALIGN_BASE, API2: 12
TBL_STRING, API2:312
SVC_OPEN_CLOSE_TARGET, API2:602 TA_CHAR_ATTRS, API2:12
TBL_TYPES, API2:312
SVC_OWNED_NOTIFY, API2:623-625 TA_CHAR_MASK, API2: 12
TO_METRICS, API2:18, API2:21
SVC_REMOVE_FROM_MANAGER, API2:627 TA_MANY_TABS, API2:14
TO_NEW, API2:18-19
SVC_SET_TARGET, API2:603 TA_PARA_ALIGN, API2:14
TD_NEW_ONLY, API2:18
SVC_STYLE, API2:599 TA_PARA_ATTRS, API2:14
TEACH_DATA, APIl:770
SVC_TARGET, API2:597 TA_PARA_MASK, API2:14
TEACH_STATUS, API1:769
SVC_TARGET_CHANGE_NOTIFY, API2:634 TA_TAB_LEADER, API2: 13
TEIsBlank, API2:4
SVC_TERMINATE_VETOED, API2:630 TA_TAB_STOP, API2:13
TEIsLineBreak, API2:4
SYS_BOOT_PROGRESS, API2:574 TA_TAB_TYPE, API2:13
TEIsSentenceEnd, API2:4
SYS_BOOT_STATE, API2:575, API2:578 T A_TABS, API2: 13
TEIsSpecialPunct, API2:4
SYS_BOOT_TYPE, API2:574 TAB_BAR_NEW, APIl:574
TEIsWord, API2:5
682 INDEX
CLu
I' - - - - - - - - - . J I
~~~-----.--------~
9 780201 608632
ISBN 0-201-60863-4
60863