home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1996-05-01 | 7.5 KB | 173 lines | [ TEXT/MPS ]
{ File: TextObjects.p Contains: Text object Interfaces. Version: Technology: System 8 Release: Universal Interfaces 3.0d3 on Copland DR1 Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved. Bugs?: If you find a problem with this file, send the file and version information (from above) and the problem description to: Internet: apple.bugs@applelink.apple.com AppleLink: APPLE.BUGS } {$IFC UNDEFINED UsingIncludes} {$SETC UsingIncludes := 0} {$ENDC} {$IFC NOT UsingIncludes} UNIT TextObjects; INTERFACE {$ENDC} {$IFC UNDEFINED __TEXTOBJECTS__} {$SETC __TEXTOBJECTS__ := 1} {$I+} {$SETC TextObjectsIncludes := UsingIncludes} {$SETC UsingIncludes := 1} {$IFC UNDEFINED __CONDITIONALMACROS__} {$I ConditionalMacros.p} {$ENDC} {$IFC UNDEFINED __TYPES__} {$I Types.p} {$ENDC} {$IFC UNDEFINED __UNICODE__} {$I Unicode.p} {$ENDC} {$IFC UNDEFINED __TEXTCOMMON__} {$I TextCommon.p} {$ENDC} {$PUSH} {$ALIGN MAC68K} {$LibExport+} {$IFC FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE } { Basic data types } TYPE TextObjectUnit = UInt32; TextObject = ^TextObjectUnit; TextObjectPtr = ^TextObject; ConstTextObject = ^TextObjectUnit; { Indices into text objects } TextObjectIndex = UInt32; CONST kTextObjectStart = 0; kTextObjectEnd = $FFFFFFFF; { Option flags } TYPE TextObjectOptions = OptionBits; { The default or standard OptionBits are all zero by convention. The following symbolic constant is provided for code readability. } CONST kTextObjStandardOptions = 0; kTextObjNormalizeOptBit = 0; kTextObjDontNormalizeOpt = $00; kTextObjNormalizeOpt = $01; { Creation and destruction } FUNCTION NewTextObject(VAR newTextObject: TextObject): OSStatus; C; FUNCTION InitPersistentTextObject(VAR textObjectSpace: TextObjectUnit; sizeInBytes: ByteCount): OSStatus; C; FUNCTION DisposeTextObject(textObject: TextObject): OSStatus; C; FUNCTION CreateTextObjectFromTextObject(oldTextObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; VAR newTextObject: TextObject; optionBits: TextObjectOptions): OSStatus; C; { Text content manipulation } FUNCTION InstallTextIntoTextObject(srcText: ConstCStringPtr; srcLengthInBytes: ByteCount; srcEncoding: TextEncoding; language: LocaleIdentifier; destTextObject: TextObject; optionBits: TextObjectOptions): OSStatus; C; FUNCTION AppendTextToTextObject(srcText: ConstCStringPtr; srcLengthInBytes: ByteCount; srcEncoding: TextEncoding; language: LocaleIdentifier; destTextObject: TextObject; optionBits: TextObjectOptions): OSStatus; C; FUNCTION ExtractTextFromTextObject(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; destText: CStringPtr; destMaxSizeInBytes: ByteCount; destEncoding: TextEncoding; VAR language: LocaleIdentifier; VAR destSizeInBytes: ByteCount; VAR nextSrcIndex: TextObjectIndex): OSStatus; C; FUNCTION ReplaceInTextObject(destText: TextObject; destStartIndex: TextObjectIndex; destEndIndex: TextObjectIndex; srcText: ConstTextObject; srcStartIndex: TextObjectIndex; srcEndIndex: TextObjectIndex; VAR newStartIndex: TextObjectIndex; VAR newEndIndex: TextObjectIndex): OSStatus; C; { Text object information } FUNCTION IsPersistentTextObject(textObject: ConstTextObject): BOOLEAN; C; FUNCTION IsTextObjectEmpty(textObject: ConstTextObject): BOOLEAN; C; FUNCTION GetTextObjectSize(textObject: ConstTextObject): ByteCount; C; FUNCTION GetTextObjectMaxSize(textObject: ConstTextObject): ByteCount; C; FUNCTION GetTextObjectEndIndex(textObject: ConstTextObject): TextObjectIndex; C; FUNCTION ComputePersistentTextObjectSize(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; optionBits: TextObjectOptions): ByteCount; C; FUNCTION ComputePersistentTextObjectFromTextSize(text: ConstCStringPtr; textByteLength: ByteCount; textEncoding: TextEncoding; language: LocaleIdentifier; optionBits: TextObjectOptions): ByteCount; C; FUNCTION ComputeTextObjectExtractedTextSize(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; destMaxSizeInBytes: ByteCount; destEncoding: TextEncoding; VAR language: LocaleIdentifier; VAR destResultLengthInBytes: ByteCount; VAR nextSrcIndex: TextObjectIndex): OSStatus; C; FUNCTION GetTextObjectTextTags(textObject: ConstTextObject; index: TextObjectIndex; VAR encoding: TextEncoding; VAR language: LocaleIdentifier): OSStatus; C; { This is equivalent to the preceding function. The preceding name is preferred. } FUNCTION GetTextObjectEncodingAndLocaleIdentifier(textObject: ConstTextObject; index: TextObjectIndex; VAR encoding: TextEncoding; VAR language: LocaleIdentifier): OSStatus; C; { Bulk access to text content } TYPE TextObjectTextInfoPtr = ^TextObjectTextInfo; TextObjectTextInfo = RECORD encoding: TextEncoding; language: LocaleIdentifier; startIndex: TextObjectIndex; endIndex: TextObjectIndex; textLength: ByteCount; text: ConstCStringPtr; END; FUNCTION CountTextObjectTextRuns(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; VAR numTextRuns: ItemCount): OSStatus; C; FUNCTION GetTextObjectTextRuns(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; runArraySize: ItemCount; VAR runInfo: TextObjectTextInfo; VAR actualNumTextRuns: ItemCount): OSStatus; C; { Comparison functions are in TextUtils } { Annotations } { Annotation types are given by the traditional four-character codes } TYPE TextObjectAnnotationTag = FourCharCode; { A wildcard tag to specify all annotations } CONST kTextObjAnyAnnotationType = '****'; { Annotation attributes } TYPE TextObjectAnnotationAttributes = OptionBits; { Annotation attribute bits } CONST kTextObjAnnotationChangedMask = $01; kTextObjTextChangedMask = $02; FUNCTION AnnotateTextObject(textObject: TextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; annotationType: TextObjectAnnotationTag; dataLength: ByteCount; data: UNIV Ptr; annotationOptions: TextObjectAnnotationAttributes): OSStatus; C; FUNCTION DeleteTextObjectAnnotations(textObject: TextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; annotationType: TextObjectAnnotationTag): OSStatus; C; { Accessing annotations } TYPE TextObjectAnnotationInfoPtr = ^TextObjectAnnotationInfo; TextObjectAnnotationInfo = RECORD annotationType: TextObjectAnnotationTag; rangeStart: TextObjectIndex; rangeEnd: TextObjectIndex; attributes: TextObjectAnnotationAttributes; dataSize: ByteCount; data: Ptr; END; FUNCTION CountTextObjectAnnotations(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; annotationType: TextObjectAnnotationTag; VAR numAnnotations: ItemCount): OSStatus; C; FUNCTION GetTextObjectAnnotations(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; annotationType: TextObjectAnnotationTag; infoArraySize: ItemCount; VAR annotationInfo: TextObjectAnnotationInfo; VAR actualNumAnnotations: ItemCount): OSStatus; C; FUNCTION SetAnnotationAttributes(textObject: TextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; annotationType: TextObjectAnnotationTag; annotationOptions: TextObjectAnnotationAttributes): OSStatus; C; { Miscellaneous } FUNCTION VerifyTextObject(textObject: ConstTextObject): OSStatus; C; FUNCTION NormalizeTextObject(textObject: TextObject): OSStatus; C; {$ENDC} {$ALIGN RESET} {$POP} {$SETC UsingIncludes := TextObjectsIncludes} {$ENDC} {__TEXTOBJECTS__} {$IFC NOT UsingIncludes} END. {$ENDC}