~ubuntu-branches/ubuntu/lucid/fpc/lucid-proposed

« back to all changes in this revision

Viewing changes to fpcsrc/packages/univint/src/TranslationExtensions.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-10-09 23:29:00 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081009232900-553f61m37jkp6upv
Tags: 2.2.2-4
[ Torsten Werner ]
* Update ABI version in fpc-depends automatically.
* Remove empty directories from binary package fpc-source.

[ Mazen Neifer ]
* Removed leading path when calling update-alternatives to remove a Linitian
  error.
* Fixed clean target.
* Improved description of packages. (Closes: #498882)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
     File:       HIToolbox/TranslationExtensions.h
 
3
 
 
4
     Contains:   Macintosh Easy Open Translation Extension Interfaces.
 
5
 
 
6
     Version:    HIToolbox-219.4.81~2
 
7
 
 
8
     Copyright:  � 1993-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 210
 
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 TranslationExtensions;
 
30
interface
 
31
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
 
32
{$setc GAP_INTERFACES_VERSION := $0210}
 
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,Quickdraw,Components;
 
106
 
 
107
 
 
108
{$ALIGN MAC68K}
 
109
 
 
110
{
 
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.
 
114
}
 
115
const
 
116
        kSupportsFileTranslation = 1;
 
117
        kSupportsScrapTranslation = 2;
 
118
        kTranslatorCanGenerateFilename = 4;
 
119
 
 
120
{****************************************************************************************}
 
121
{ better names for 4-char codes}
 
122
type
 
123
        FileType = OSType;
 
124
        FileTypePtr = ^FileType;
 
125
        ScrapType = ResType;
 
126
{****************************************************************************************}
 
127
type
 
128
        TranslationAttributes = UInt32;
 
129
const
 
130
        taDstDocNeedsResourceFork = 1;
 
131
        taDstIsAppTranslation = 2;
 
132
 
 
133
{****************************************************************************************}
 
134
type
 
135
        FileTypeSpecPtr = ^FileTypeSpec;
 
136
        FileTypeSpec = record
 
137
                format: FileType;
 
138
                hint: SInt32;
 
139
                flags: TranslationAttributes;               { taDstDocNeedsResourceFork, taDstIsAppTranslation}
 
140
                catInfoType: OSType;
 
141
                catInfoCreator: OSType;
 
142
        end;
 
143
type
 
144
        FileTranslationList = record
 
145
                modDate: UInt32;
 
146
                groupCount: UInt32;
 
147
 
 
148
                                              { conceptual declarations:}
 
149
 
 
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]}
 
156
        end;
 
157
        FileTranslationListPtr = ^FileTranslationList;
 
158
        FileTranslationListHandle = ^FileTranslationListPtr;
 
159
{****************************************************************************************}
 
160
type
 
161
        ScrapTypeSpecPtr = ^ScrapTypeSpec;
 
162
        ScrapTypeSpec = record
 
163
                format: ScrapType;
 
164
                hint: SInt32;
 
165
        end;
 
166
type
 
167
        ScrapTranslationList = record
 
168
                modDate: UInt32;
 
169
                groupCount: UInt32;
 
170
 
 
171
                                              { conceptual declarations:}
 
172
 
 
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]}
 
179
        end;
 
180
        ScrapTranslationListPtr = ^ScrapTranslationList;
 
181
        ScrapTranslationListHandle = ^ScrapTranslationListPtr;
 
182
{******************************************************************************************
 
183
 
 
184
    definition of callbacks to update progress dialog
 
185
 
 
186
******************************************************************************************}
 
187
type
 
188
        TranslationRefNum = SInt32;
 
189
{******************************************************************************************
 
190
 
 
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.
 
193
 
 
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.)
 
199
 
 
200
    Exit    :   returns         noErr, paramErr, or memFullErr
 
201
 
 
202
******************************************************************************************}
 
203
{
 
204
 *  SetTranslationAdvertisement()   *** DEPRECATED ***
 
205
 *  
 
206
 *  Deprecated:
 
207
 *    There is no direct replacement at this time.
 
208
 *  
 
209
 *  Mac OS X threading:
 
210
 *    Not thread safe
 
211
 *  
 
212
 *  Availability:
 
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
 
216
 }
 
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 *)
 
219
 
 
220
 
 
221
{******************************************************************************************
 
222
 
 
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
 
226
    he tries to cancel.
 
227
 
 
228
    Enter   :   refNum      translation reference supplied to DoTranslateFile.
 
229
                progress    percent complete (0-100)
 
230
 
 
231
    Exit    :   canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
 
232
 
 
233
    Return  :   noErr, paramErr, or memFullErr
 
234
 
 
235
******************************************************************************************}
 
236
{
 
237
 *  UpdateTranslationProgress()   *** DEPRECATED ***
 
238
 *  
 
239
 *  Deprecated:
 
240
 *    There is no direct replacement at this time.
 
241
 *  
 
242
 *  Mac OS X threading:
 
243
 *    Not thread safe
 
244
 *  
 
245
 *  Availability:
 
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
 
249
 }
 
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 *)
 
252
 
 
253
 
 
254
{******************************************************************************************
 
255
 
 
256
    Component Manager component selectors for translation extension routines
 
257
 
 
258
******************************************************************************************}
 
259
const
 
260
        kTranslateGetFileTranslationList = 0;
 
261
        kTranslateIdentifyFile = 1;
 
262
        kTranslateTranslateFile = 2;
 
263
        kTranslateGetTranslatedFilename = 3;
 
264
        kTranslateGetScrapTranslationList = 10;
 
265
        kTranslateIdentifyScrap = 11;
 
266
        kTranslateTranslateScrap = 12;
 
267
        kTranslateGetScrapTranslationListConsideringData = 13;
 
268
 
 
269
 
 
270
{******************************************************************************************
 
271
 
 
272
    routines which implement translation extensions
 
273
 
 
274
******************************************************************************************}
 
275
type
 
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;
 
283
 
 
284
 
 
285
 
 
286
end.