2
File: HIToolbox/TranslationExtensions.h
4
Contains: Macintosh Easy Open Translation Extension Interfaces.
6
Version: HIToolbox-219.4.81~2
8
Copyright: � 1993-2005 by Apple Computer, Inc., all rights reserved.
10
Bugs?: For bug reports, consult the following page on
13
http://www.freepascal.org/bugs.html
16
{ Pascal Translation Updated: Peter N Lewis, <peter@stairways.com.au>, August 2005 }
18
Modified for use with Free Pascal
20
Please report any bugs to <gpc@microbizz.nl>
29
unit TranslationExtensions;
31
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
32
{$setc GAP_INTERFACES_VERSION := $0210}
34
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
35
{$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
38
{$ifc defined CPUPOWERPC and defined CPUI386}
39
{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
41
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
42
{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
45
{$ifc not defined __ppc__ and defined CPUPOWERPC}
50
{$ifc not defined __i386__ and defined CPUI386}
56
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
57
{$error Conflicting definitions for __ppc__ and __i386__}
60
{$ifc defined __ppc__ and __ppc__}
61
{$setc TARGET_CPU_PPC := TRUE}
62
{$setc TARGET_CPU_X86 := FALSE}
63
{$elifc defined __i386__ and __i386__}
64
{$setc TARGET_CPU_PPC := FALSE}
65
{$setc TARGET_CPU_X86 := TRUE}
67
{$error Neither __ppc__ nor __i386__ is defined.}
69
{$setc TARGET_CPU_PPC_64 := FALSE}
71
{$ifc defined FPC_BIG_ENDIAN}
72
{$setc TARGET_RT_BIG_ENDIAN := TRUE}
73
{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
74
{$elifc defined FPC_LITTLE_ENDIAN}
75
{$setc TARGET_RT_BIG_ENDIAN := FALSE}
76
{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
78
{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
80
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
81
{$setc CALL_NOT_IN_CARBON := FALSE}
82
{$setc OLDROUTINENAMES := FALSE}
83
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
84
{$setc OPAQUE_UPP_TYPES := TRUE}
85
{$setc OTCARBONAPPLICATION := TRUE}
86
{$setc OTKERNEL := FALSE}
87
{$setc PM_USE_SESSION_APIS := TRUE}
88
{$setc TARGET_API_MAC_CARBON := TRUE}
89
{$setc TARGET_API_MAC_OS8 := FALSE}
90
{$setc TARGET_API_MAC_OSX := TRUE}
91
{$setc TARGET_CARBON := TRUE}
92
{$setc TARGET_CPU_68K := FALSE}
93
{$setc TARGET_CPU_MIPS := FALSE}
94
{$setc TARGET_CPU_SPARC := FALSE}
95
{$setc TARGET_OS_MAC := TRUE}
96
{$setc TARGET_OS_UNIX := FALSE}
97
{$setc TARGET_OS_WIN32 := FALSE}
98
{$setc TARGET_RT_MAC_68881 := FALSE}
99
{$setc TARGET_RT_MAC_CFM := FALSE}
100
{$setc TARGET_RT_MAC_MACHO := TRUE}
101
{$setc TYPED_FUNCTION_POINTERS := TRUE}
102
{$setc TYPE_BOOL := FALSE}
103
{$setc TYPE_EXTENDED := FALSE}
104
{$setc TYPE_LONGLONG := TRUE}
105
uses MacTypes,Files,Quickdraw,Components;
111
Translation Extensions are no longer supported. Carbon clients interested in extending translations
112
should use filter services as described in TranslationServices.h. The definitions below will NOT work
113
for Carbon and are only defined for those files that need to build pre-Carbon applications.
116
kSupportsFileTranslation = 1;
117
kSupportsScrapTranslation = 2;
118
kTranslatorCanGenerateFilename = 4;
120
{****************************************************************************************}
121
{ better names for 4-char codes}
124
FileTypePtr = ^FileType;
126
{****************************************************************************************}
128
TranslationAttributes = UInt32;
130
taDstDocNeedsResourceFork = 1;
131
taDstIsAppTranslation = 2;
133
{****************************************************************************************}
135
FileTypeSpecPtr = ^FileTypeSpec;
136
FileTypeSpec = record
139
flags: TranslationAttributes; { taDstDocNeedsResourceFork, taDstIsAppTranslation}
141
catInfoCreator: OSType;
144
FileTranslationList = record
148
{ conceptual declarations:}
150
{ unsigned long group1SrcCount;}
151
{ unsigned long group1SrcEntrySize = sizeof(FileTypeSpec);}
152
{ FileTypeSpec group1SrcTypes[group1SrcCount]}
153
{ unsigned long group1DstCount;}
154
{ unsigned long group1DstEntrySize = sizeof(FileTypeSpec);}
155
{ FileTypeSpec group1DstTypes[group1DstCount]}
157
FileTranslationListPtr = ^FileTranslationList;
158
FileTranslationListHandle = ^FileTranslationListPtr;
159
{****************************************************************************************}
161
ScrapTypeSpecPtr = ^ScrapTypeSpec;
162
ScrapTypeSpec = record
167
ScrapTranslationList = record
171
{ conceptual declarations:}
173
{ unsigned long group1SrcCount;}
174
{ unsigned long group1SrcEntrySize = sizeof(ScrapTypeSpec);}
175
{ ScrapTypeSpec group1SrcTypes[group1SrcCount]}
176
{ unsigned long group1DstCount;}
177
{ unsigned long group1DstEntrySize = sizeof(ScrapTypeSpec);}
178
{ ScrapTypeSpec group1DstTypes[group1DstCount]}
180
ScrapTranslationListPtr = ^ScrapTranslationList;
181
ScrapTranslationListHandle = ^ScrapTranslationListPtr;
182
{******************************************************************************************
184
definition of callbacks to update progress dialog
186
******************************************************************************************}
188
TranslationRefNum = SInt32;
189
{******************************************************************************************
191
This routine sets the advertisement in the top half of the progress dialog.
192
It is called once at the beginning of your DoTranslateFile routine.
194
Enter : refNum Translation reference supplied to DoTranslateFile.
195
advertisement A handle to the picture to display. This must be non-purgable.
196
Before returning from DoTranslateFile, you should dispose
197
of the memory. (Normally, it is in the temp translation heap
198
so it is cleaned up for you.)
200
Exit : returns noErr, paramErr, or memFullErr
202
******************************************************************************************}
204
* SetTranslationAdvertisement() *** DEPRECATED ***
207
* There is no direct replacement at this time.
209
* Mac OS X threading:
213
* Mac OS X: in version 10.0 and later in Carbon.framework but deprecated in 10.3
214
* CarbonLib: in CarbonLib 1.0 thru 1.0.2
215
* Non-Carbon CFM: in Translation 1.0 and later
217
function SetTranslationAdvertisement( refNum: TranslationRefNum; advertisement: PicHandle ): OSErr; external name '_SetTranslationAdvertisement';
218
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
221
{******************************************************************************************
223
This routine updates the progress bar in the progress dialog.
224
It is called repeatedly from within your DoTranslateFile routine.
225
It should be called often, so that the user will get feedback if
228
Enter : refNum translation reference supplied to DoTranslateFile.
229
progress percent complete (0-100)
231
Exit : canceled TRUE if the user clicked the Cancel button, FALSE otherwise
233
Return : noErr, paramErr, or memFullErr
235
******************************************************************************************}
237
* UpdateTranslationProgress() *** DEPRECATED ***
240
* There is no direct replacement at this time.
242
* Mac OS X threading:
246
* Mac OS X: in version 10.0 and later in Carbon.framework but deprecated in 10.3
247
* CarbonLib: in CarbonLib 1.0 thru 1.0.2
248
* Non-Carbon CFM: in Translation 1.0 and later
250
function UpdateTranslationProgress( refNum: TranslationRefNum; percentDone: SInt16; var canceled: Boolean ): OSErr; external name '_UpdateTranslationProgress';
251
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
254
{******************************************************************************************
256
Component Manager component selectors for translation extension routines
258
******************************************************************************************}
260
kTranslateGetFileTranslationList = 0;
261
kTranslateIdentifyFile = 1;
262
kTranslateTranslateFile = 2;
263
kTranslateGetTranslatedFilename = 3;
264
kTranslateGetScrapTranslationList = 10;
265
kTranslateIdentifyScrap = 11;
266
kTranslateTranslateScrap = 12;
267
kTranslateGetScrapTranslationListConsideringData = 13;
270
{******************************************************************************************
272
routines which implement translation extensions
274
******************************************************************************************}
276
DoGetFileTranslationListProcPtr = function( self: ComponentInstance; translationList: FileTranslationListHandle ): ComponentResult;
277
DoIdentifyFileProcPtr = function( self: ComponentInstance; const (*var*) theDocument: FSSpec; var docType: FileType ): ComponentResult;
278
DoTranslateFileProcPtr = function( self: ComponentInstance; refNum: TranslationRefNum; const (*var*) sourceDocument: FSSpec; srcType: FileType; srcTypeHint: SInt32; const (*var*) dstDoc: FSSpec; dstType: FileType; dstTypeHint: SInt32 ): ComponentResult;
279
DoGetTranslatedFilenameProcPtr = function( self: ComponentInstance; dstType: FileType; dstTypeHint: SInt32; var theDocument: FSSpec ): ComponentResult;
280
DoGetScrapTranslationListProcPtr = function( self: ComponentInstance; list: ScrapTranslationListHandle ): ComponentResult;
281
DoIdentifyScrapProcPtr = function( self: ComponentInstance; dataPtr: {const} UnivPtr; dataLength: Size; var dataFormat: ScrapType ): ComponentResult;
282
DoTranslateScrapProcPtr = function( self: ComponentInstance; refNum: TranslationRefNum; srcDataPtr: {const} UnivPtr; srcDataLength: Size; srcType: ScrapType; srcTypeHint: SInt32; dstData: Handle; dstType: ScrapType; dstTypeHint: SInt32 ): ComponentResult;