~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to packages/extra/univint/Translation.pas

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
     File:       HIToolbox/Translation.h
 
3
 
 
4
     Contains:   Translation Manager (Macintosh Easy Open) Interfaces.
 
5
 
 
6
     Version:    HIToolbox-219.4.81~2
 
7
 
 
8
     Copyright:  � 1991-2005 by Apple Computer, Inc., all rights reserved.
 
9
 
 
10
     Bugs?:      For bug reports, consult the following page on
 
11
                 the World Wide Web:
 
12
 
 
13
                     http://www.freepascal.org/bugs.html
 
14
 
 
15
}
 
16
{       Pascal Translation Updated:  Peter N Lewis, <peter@stairways.com.au>, August 2005 }
 
17
{
 
18
    Modified for use with Free Pascal
 
19
    Version 200
 
20
    Please report any bugs to <gpc@microbizz.nl>
 
21
}
 
22
 
 
23
{$mode macpas}
 
24
{$packenum 1}
 
25
{$macro on}
 
26
{$inline on}
 
27
{$CALLING MWPASCAL}
 
28
 
 
29
unit Translation;
 
30
interface
 
31
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
 
32
{$setc GAP_INTERFACES_VERSION := $0200}
 
33
 
 
34
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
 
35
    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
 
36
{$endc}
 
37
 
 
38
{$ifc defined CPUPOWERPC and defined CPUI386}
 
39
        {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
 
40
{$endc}
 
41
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
 
42
        {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
 
43
{$endc}
 
44
 
 
45
{$ifc not defined __ppc__ and defined CPUPOWERPC}
 
46
        {$setc __ppc__ := 1}
 
47
{$elsec}
 
48
        {$setc __ppc__ := 0}
 
49
{$endc}
 
50
{$ifc not defined __i386__ and defined CPUI386}
 
51
        {$setc __i386__ := 1}
 
52
{$elsec}
 
53
        {$setc __i386__ := 0}
 
54
{$endc}
 
55
 
 
56
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
 
57
        {$error Conflicting definitions for __ppc__ and __i386__}
 
58
{$endc}
 
59
 
 
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}
 
66
{$elsec}
 
67
        {$error Neither __ppc__ nor __i386__ is defined.}
 
68
{$endc}
 
69
{$setc TARGET_CPU_PPC_64 := FALSE}
 
70
 
 
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}
 
77
{$elsec}
 
78
        {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
 
79
{$endc}
 
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,Components,TranslationExtensions;
 
106
 
 
107
 
 
108
{$ALIGN MAC68K}
 
109
 
 
110
{
 
111
   Carbon clients should use Translation Services. The definitions below will NOT work for Carbon and
 
112
   are only defined for those files that need to build pre-Carbon applications.
 
113
}
 
114
 
 
115
{ enumerated types on how a document can be opened}
 
116
type
 
117
        DocOpenMethod = SInt16;
 
118
const
 
119
        domCannot = 0;
 
120
        domNative = 1;
 
121
        domTranslateFirst = 2;
 
122
        domWildcard = 3;
 
123
 
 
124
{ 0L terminated array of OSTypes, or FileTypes}
 
125
type
 
126
        TypesBlock = array [0..63] of OSType;
 
127
        TypesBlockPtr = ^TypesBlock;
 
128
{ Progress dialog resource ID}
 
129
const
 
130
        kTranslationScrapProgressDialogID = -16555;
 
131
 
 
132
{ block of data that describes how to translate}
 
133
type
 
134
        FileTranslationSpecPtr = ^FileTranslationSpec;
 
135
        FileTranslationSpec = record
 
136
                componentSignature: OSType;
 
137
                translationSystemInfo: UnivPtr;
 
138
                src: FileTypeSpec;
 
139
                dst: FileTypeSpec;
 
140
        end;
 
141
type
 
142
        FileTranslationSpecArray = array [0..$7F000000 div SizeOf(FileTranslationSpec)-1] of FileTranslationSpec;
 
143
        FileTranslationSpecArrayPtr = ^FileTranslationSpecArray;
 
144
        FileTranslationSpecArrayHandle = ^FileTranslationSpecArrayPtr;
 
145
 
 
146
{
 
147
 *  GetFileTypesThatAppCanNativelyOpen()   *** DEPRECATED ***
 
148
 *  
 
149
 *  Deprecated:
 
150
 *    There is no direct replacement at this time.
 
151
 *  
 
152
 *  Mac OS X threading:
 
153
 *    Not thread safe
 
154
 *  
 
155
 *  Availability:
 
156
 *    Mac OS X:         in version 10.0 and later in Carbon.framework but deprecated in 10.3
 
157
 *    CarbonLib:        in CarbonLib 1.0 and later
 
158
 *    Non-Carbon CFM:   in Translation 1.0 and later
 
159
 }
 
160
function GetFileTypesThatAppCanNativelyOpen( appVRefNumHint: SInt16; appSignature: OSType; var nativeTypes: TypesBlock ): OSErr; external name '_GetFileTypesThatAppCanNativelyOpen';
 
161
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
162
 
 
163
 
 
164
{
 
165
 *  ExtendFileTypeList()   *** DEPRECATED ***
 
166
 *  
 
167
 *  Deprecated:
 
168
 *    Use TranslationCreateWithSourceArray instead.
 
169
 *  
 
170
 *  Mac OS X threading:
 
171
 *    Not thread safe
 
172
 *  
 
173
 *  Availability:
 
174
 *    Mac OS X:         in version 10.0 and later in Carbon.framework but deprecated in 10.3
 
175
 *    CarbonLib:        in CarbonLib 1.0 and later
 
176
 *    Non-Carbon CFM:   in Translation 1.0 and later
 
177
 }
 
178
function ExtendFileTypeList( originalTypeList: {variable-size-array} FileTypePtr; numberOriginalTypes: SInt16; extendedTypeList: {variable-size-array} FileTypePtr; var numberExtendedTypes: SInt16 ): OSErr; external name '_ExtendFileTypeList';
 
179
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
180
 
 
181
 
 
182
{
 
183
 *  CanDocBeOpened()   *** DEPRECATED ***
 
184
 *  
 
185
 *  Deprecated:
 
186
 *    Use the Launch Services API instead.
 
187
 *  
 
188
 *  Mac OS X threading:
 
189
 *    Not thread safe
 
190
 *  
 
191
 *  Availability:
 
192
 *    Mac OS X:         in version 10.0 and later in Carbon.framework but deprecated in 10.3
 
193
 *    CarbonLib:        in CarbonLib 1.0 and later
 
194
 *    Non-Carbon CFM:   in Translation 1.0 and later
 
195
 }
 
196
function CanDocBeOpened( const (*var*) targetDocument: FSSpec; appVRefNumHint: SInt16; appSignature: OSType; nativeTypes: {variable-size-array} FileTypePtr; onlyNative: Boolean; var howToOpen: DocOpenMethod; var howToTranslate: FileTranslationSpec ): OSErr; external name '_CanDocBeOpened';
 
197
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
198
 
 
199
 
 
200
{
 
201
 *  GetFileTranslationPaths()   *** DEPRECATED ***
 
202
 *  
 
203
 *  Deprecated:
 
204
 *    Use TranslationCreateWithSourceArray instead.
 
205
 *  
 
206
 *  Mac OS X threading:
 
207
 *    Not thread safe
 
208
 *  
 
209
 *  Availability:
 
210
 *    Mac OS X:         in version 10.0 and later in Carbon.framework but deprecated in 10.3
 
211
 *    CarbonLib:        in CarbonLib 1.0 and later
 
212
 *    Non-Carbon CFM:   in Translation 1.0 and later
 
213
 }
 
214
function GetFileTranslationPaths( const (*var*) srcDocument: FSSpec; dstDocType: FileType; maxResultCount: UInt16; resultBuffer: FileTranslationSpecArrayPtr ): SInt16; external name '_GetFileTranslationPaths';
 
215
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
216
 
 
217
 
 
218
{
 
219
 *  GetPathFromTranslationDialog()   *** DEPRECATED ***
 
220
 *  
 
221
 *  Deprecated:
 
222
 *    There is no direct replacement at this time, but all the
 
223
 *    necessary information can be obtained from the Launch Services,
 
224
 *    Translation Services and Uniform Type Identification APIs.
 
225
 *  
 
226
 *  Mac OS X threading:
 
227
 *    Not thread safe
 
228
 *  
 
229
 *  Availability:
 
230
 *    Mac OS X:         in version 10.0 and later in Carbon.framework but deprecated in 10.3
 
231
 *    CarbonLib:        in CarbonLib 1.0 and later
 
232
 *    Non-Carbon CFM:   in Translation 1.0 and later
 
233
 }
 
234
function GetPathFromTranslationDialog( const (*var*) theDocument: FSSpec; const (*var*) theApplication: FSSpec; typeList: TypesBlockPtr; var howToOpen: DocOpenMethod; var howToTranslate: FileTranslationSpec ): OSErr; external name '_GetPathFromTranslationDialog';
 
235
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
236
 
 
237
 
 
238
{
 
239
 *  TranslateFile()   *** DEPRECATED ***
 
240
 *  
 
241
 *  Deprecated:
 
242
 *    Use TranslationPerformForFile or TranslationPerformForURL instead.
 
243
 *  
 
244
 *  Mac OS X threading:
 
245
 *    Not thread safe
 
246
 *  
 
247
 *  Availability:
 
248
 *    Mac OS X:         in version 10.0 and later in Carbon.framework but deprecated in 10.3
 
249
 *    CarbonLib:        in CarbonLib 1.0 and later
 
250
 *    Non-Carbon CFM:   in Translation 1.0 and later
 
251
 }
 
252
function TranslateFile( const (*var*) sourceDocument: FSSpec; const (*var*) destinationDocument: FSSpec; const (*var*) howToTranslate: FileTranslationSpec ): OSErr; external name '_TranslateFile';
 
253
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
254
 
 
255
 
 
256
{
 
257
 *  GetDocumentKindString()   *** DEPRECATED ***
 
258
 *  
 
259
 *  Deprecated:
 
260
 *    Use the Launch Services API instead.
 
261
 *  
 
262
 *  Mac OS X threading:
 
263
 *    Not thread safe
 
264
 *  
 
265
 *  Availability:
 
266
 *    Mac OS X:         in version 10.0 and later in Carbon.framework but deprecated in 10.3
 
267
 *    CarbonLib:        in CarbonLib 1.0 and later
 
268
 *    Non-Carbon CFM:   in Translation 1.0 and later
 
269
 }
 
270
function GetDocumentKindString( docVRefNum: SInt16; docType: OSType; docCreator: OSType; var kindString: Str63 ): OSErr; external name '_GetDocumentKindString';
 
271
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
272
 
 
273
 
 
274
{
 
275
 *  GetTranslationExtensionName()   *** DEPRECATED ***
 
276
 *  
 
277
 *  Deprecated:
 
278
 *    There is no direct replacement at this time, but
 
279
 *    TranslationCopySourceType and TranslationCopyDestinationType in
 
280
 *    conjunction with UTTypeCopyDescription will provide useful user
 
281
 *    level information.
 
282
 *  
 
283
 *  Mac OS X threading:
 
284
 *    Not thread safe
 
285
 *  
 
286
 *  Availability:
 
287
 *    Mac OS X:         in version 10.0 and later in Carbon.framework but deprecated in 10.3
 
288
 *    CarbonLib:        in CarbonLib 1.0 and later
 
289
 *    Non-Carbon CFM:   in Translation 1.0 and later
 
290
 }
 
291
function GetTranslationExtensionName( const (*var*) translationMethod: FileTranslationSpec; var extensionName: Str31 ): OSErr; external name '_GetTranslationExtensionName';
 
292
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
293
 
 
294
 
 
295
{
 
296
 *  GetScrapDataProcPtr
 
297
 }
 
298
type
 
299
        GetScrapDataProcPtr = function( requestedFormat: ScrapType; dataH: Handle; srcDataGetterRefCon: UnivPtr ): OSErr;
 
300
        GetScrapDataUPP = GetScrapDataProcPtr;
 
301
{
 
302
 *  NewGetScrapDataUPP()
 
303
 *  
 
304
 *  Availability:
 
305
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 
306
 *    CarbonLib:        in CarbonLib 1.0 and later
 
307
 *    Non-Carbon CFM:   available as macro/inline
 
308
 }
 
309
function NewGetScrapDataUPP( userRoutine: GetScrapDataProcPtr ): GetScrapDataUPP; external name '_NewGetScrapDataUPP';
 
310
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
311
 
 
312
{
 
313
 *  DisposeGetScrapDataUPP()
 
314
 *  
 
315
 *  Availability:
 
316
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 
317
 *    CarbonLib:        in CarbonLib 1.0 and later
 
318
 *    Non-Carbon CFM:   available as macro/inline
 
319
 }
 
320
procedure DisposeGetScrapDataUPP( userUPP: GetScrapDataUPP ); external name '_DisposeGetScrapDataUPP';
 
321
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
322
 
 
323
{
 
324
 *  InvokeGetScrapDataUPP()
 
325
 *  
 
326
 *  Availability:
 
327
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 
328
 *    CarbonLib:        in CarbonLib 1.0 and later
 
329
 *    Non-Carbon CFM:   available as macro/inline
 
330
 }
 
331
function InvokeGetScrapDataUPP( requestedFormat: ScrapType; dataH: Handle; srcDataGetterRefCon: UnivPtr; userUPP: GetScrapDataUPP ): OSErr; external name '_InvokeGetScrapDataUPP';
 
332
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
333
 
 
334
type
 
335
        GetScrapData = GetScrapDataUPP;
 
336
{
 
337
 *  TranslateScrap()   *** DEPRECATED ***
 
338
 *  
 
339
 *  Deprecated:
 
340
 *    Use TranslationPerformForData instead.
 
341
 *  
 
342
 *  Mac OS X threading:
 
343
 *    Not thread safe
 
344
 *  
 
345
 *  Availability:
 
346
 *    Mac OS X:         in version 10.0 and later in Carbon.framework but deprecated in 10.3
 
347
 *    CarbonLib:        in CarbonLib 1.0 and later
 
348
 *    Non-Carbon CFM:   in Translation 1.0 and later
 
349
 }
 
350
function TranslateScrap( sourceDataGetter: GetScrapDataUPP; sourceDataGetterRefCon: UnivPtr; destinationFormat: ScrapType; destinationData: Handle; progressDialogID: SInt16 ): OSErr; external name '_TranslateScrap';
 
351
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)
 
352
 
 
353
 
 
354
 
 
355
 
 
356
end.