2
Copyright (c) 1999-2005, Apple, Inc. All rights reserved.
4
{ Pascal Translation Updated: Peter N Lewis, <peter@stairways.com.au>, September 2005 }
6
Modified for use with Free Pascal
8
Please report any bugs to <gpc@microbizz.nl>
19
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
20
{$setc GAP_INTERFACES_VERSION := $0200}
22
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
23
{$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
26
{$ifc defined CPUPOWERPC and defined CPUI386}
27
{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
29
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
30
{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
33
{$ifc not defined __ppc__ and defined CPUPOWERPC}
38
{$ifc not defined __i386__ and defined CPUI386}
44
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
45
{$error Conflicting definitions for __ppc__ and __i386__}
48
{$ifc defined __ppc__ and __ppc__}
49
{$setc TARGET_CPU_PPC := TRUE}
50
{$setc TARGET_CPU_X86 := FALSE}
51
{$elifc defined __i386__ and __i386__}
52
{$setc TARGET_CPU_PPC := FALSE}
53
{$setc TARGET_CPU_X86 := TRUE}
55
{$error Neither __ppc__ nor __i386__ is defined.}
57
{$setc TARGET_CPU_PPC_64 := FALSE}
59
{$ifc defined FPC_BIG_ENDIAN}
60
{$setc TARGET_RT_BIG_ENDIAN := TRUE}
61
{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
62
{$elifc defined FPC_LITTLE_ENDIAN}
63
{$setc TARGET_RT_BIG_ENDIAN := FALSE}
64
{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
66
{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
68
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
69
{$setc CALL_NOT_IN_CARBON := FALSE}
70
{$setc OLDROUTINENAMES := FALSE}
71
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
72
{$setc OPAQUE_UPP_TYPES := TRUE}
73
{$setc OTCARBONAPPLICATION := TRUE}
74
{$setc OTKERNEL := FALSE}
75
{$setc PM_USE_SESSION_APIS := TRUE}
76
{$setc TARGET_API_MAC_CARBON := TRUE}
77
{$setc TARGET_API_MAC_OS8 := FALSE}
78
{$setc TARGET_API_MAC_OSX := TRUE}
79
{$setc TARGET_CARBON := TRUE}
80
{$setc TARGET_CPU_68K := FALSE}
81
{$setc TARGET_CPU_MIPS := FALSE}
82
{$setc TARGET_CPU_SPARC := FALSE}
83
{$setc TARGET_OS_MAC := TRUE}
84
{$setc TARGET_OS_UNIX := FALSE}
85
{$setc TARGET_OS_WIN32 := FALSE}
86
{$setc TARGET_RT_MAC_68881 := FALSE}
87
{$setc TARGET_RT_MAC_CFM := FALSE}
88
{$setc TARGET_RT_MAC_MACHO := TRUE}
89
{$setc TYPED_FUNCTION_POINTERS := TRUE}
90
{$setc TYPE_BOOL := FALSE}
91
{$setc TYPE_EXTENDED := FALSE}
92
{$setc TYPE_LONGLONG := TRUE}
93
uses MacTypes,CFPlugIn,CFUUID;
97
{ ================= IUnknown definition (C struct) ================= }
99
{ All interface structs must have an IUnknownStruct at the beginning. }
100
{ The _reserved field is part of the Microsoft COM binary standard on Macintosh. }
101
{ You can declare new C struct interfaces by defining a new struct that includes "IUNKNOWN_C_GUTS;" before the first field of the struct. }
107
REFIID = CFUUIDBytes;
109
{ Macros for more detailed HRESULT analysis }
111
function SUCCEEDED( Status: HRESULT ): Boolean; inline;
112
function FAILED( Status: HRESULT ): Boolean; inline;
113
function IS_ERROR( Status: HRESULT ): Boolean; inline;
114
function HRESULT_CODE( hr: HRESULT ): HRESULT; inline;
115
function HRESULT_FACILITY( hr: HRESULT ): HRESULT; inline;
116
function HRESULT_SEVERITY( hr: HRESULT ): HRESULT; inline;
119
SEVERITY_SUCCESS = 0;
123
{ Creating an HRESULT from its component pieces }
124
function MAKE_HRESULT( sev, fac, code: ULONG ): HRESULT; inline;
126
{ Pre-defined success HRESULTS }
132
{ Common error HRESULTS }
134
E_UNEXPECTED = $8000FFFF;
135
E_NOTIMPL = $80000001;
136
E_OUTOFMEMORY = $80000002;
137
E_INVALIDARG = $80000003;
138
E_NOINTERFACE = $80000004;
139
E_POINTER = $80000005;
140
E_HANDLE = $80000006;
143
E_ACCESSDENIED = $80000009;
145
{ This macro should be used when defining all interface functions (as it is for the IUnknown functions below). }
146
{#define STDMETHODCALLTYPE}
148
{ The __RPC_FAR macro is for COM source compatibility only. This macro is used a lot in COM interface definitions. If your CFPlugIn interfaces need to be COM interfaces as well, you can use this macro to get better source compatibility. It is not used in the IUnknown definition below, because when doing COM, you will be using the Microsoft supplied IUnknown interface anyway. }
151
{ The IUnknown interface }
152
function IUnknownUUID: CFUUIDRef; inline;
155
IUnknownVTbl = record
157
QueryInterface: function( thisPointer: UnivPtr; iid: REFIID; var ppv: LPVOID ): HRESULT;
158
AddRef: function( thisPointer: UnivPtr ): ULONG;
159
Release: function( thisPointer: UnivPtr ): ULONG;
162
{ End of extern "C" stuff }
165
{ C++ specific stuff }
172
function SUCCEEDED( Status: HRESULT ): Boolean; inline;
174
SUCCEEDED := Status >= 0;
177
function FAILED( Status: HRESULT ): Boolean; inline;
179
FAILED := Status < 0;
182
function IS_ERROR( Status: HRESULT ): Boolean; inline;
184
IS_ERROR := Status shr 31 = SEVERITY_ERROR;
187
function HRESULT_CODE( hr: HRESULT ): HRESULT; inline;
189
HRESULT_CODE := hr and $FFFF;
192
function HRESULT_FACILITY( hr: HRESULT ): HRESULT; inline;
194
HRESULT_FACILITY := (hr shr 16) and $1FFF;
197
function HRESULT_SEVERITY( hr: HRESULT ): HRESULT; inline;
199
HRESULT_SEVERITY := (hr shr 31) and $01;
202
function MAKE_HRESULT( sev, fac, code: ULONG ): HRESULT; inline;
204
MAKE_HRESULT := HRESULT((sev shl 31) or (fac shl 16) or code);
207
function IUnknownUUID: CFUUIDRef; inline;
209
IUnknownUUID:= CFUUIDGetConstantUUIDWithBytes( nil, $00, $00, $00, $00, $00, $00, $00, $00, ByteParameter($C0), $00, $00, $00, $00, $00, $00, $46 )