objc2-core-services 0.3.2

Bindings to the CoreServices framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;

use crate::*;

/// ** LOGICAL OPERATOR CONSTANTS  ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeand?language=objc)
pub const kAEAND: c_uint = 0x414e4420;
/// ** LOGICAL OPERATOR CONSTANTS  ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeor?language=objc)
pub const kAEOR: c_uint = 0x4f522020;
/// ** LOGICAL OPERATOR CONSTANTS  ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaenot?language=objc)
pub const kAENOT: c_uint = 0x4e4f5420;
/// ** ABSOLUTE ORDINAL CONSTANTS  ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaefirst?language=objc)
pub const kAEFirst: c_uint = 0x66697273;
/// ** ABSOLUTE ORDINAL CONSTANTS  ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaelast?language=objc)
pub const kAELast: c_uint = 0x6c617374;
/// ** ABSOLUTE ORDINAL CONSTANTS  ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaemiddle?language=objc)
pub const kAEMiddle: c_uint = 0x6d696464;
/// ** ABSOLUTE ORDINAL CONSTANTS  ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeany?language=objc)
pub const kAEAny: c_uint = 0x616e7920;
/// ** ABSOLUTE ORDINAL CONSTANTS  ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeall?language=objc)
pub const kAEAll: c_uint = 0x616c6c20;
/// ** RELATIVE ORDINAL CONSTANTS  ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaenext?language=objc)
pub const kAENext: c_uint = 0x6e657874;
/// ** RELATIVE ORDINAL CONSTANTS  ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeprevious?language=objc)
pub const kAEPrevious: c_uint = 0x70726576;
/// ** KEYWORD CONSTANT    ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaecompoperator?language=objc)
pub const keyAECompOperator: c_uint = 0x72656c6f;
/// ** KEYWORD CONSTANT    ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaelogicalterms?language=objc)
pub const keyAELogicalTerms: c_uint = 0x7465726d;
/// ** KEYWORD CONSTANT    ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaelogicaloperator?language=objc)
pub const keyAELogicalOperator: c_uint = 0x6c6f6763;
/// ** KEYWORD CONSTANT    ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaeobject1?language=objc)
pub const keyAEObject1: c_uint = 0x6f626a31;
/// ** KEYWORD CONSTANT    ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaeobject2?language=objc)
pub const keyAEObject2: c_uint = 0x6f626a32;
/// ** KEYWORD CONSTANT    ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaedesiredclass?language=objc)
pub const keyAEDesiredClass: c_uint = 0x77616e74;
/// ** KEYWORD CONSTANT    ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaecontainer?language=objc)
pub const keyAEContainer: c_uint = 0x66726f6d;
/// ** KEYWORD CONSTANT    ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaekeyform?language=objc)
pub const keyAEKeyForm: c_uint = 0x666f726d;
/// ** KEYWORD CONSTANT    ***
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaekeydata?language=objc)
pub const keyAEKeyData: c_uint = 0x73656c64;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaerangestart?language=objc)
#[cfg(feature = "AEDataModel")]
pub const keyAERangeStart: AEKeyword = 0x73746172;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaerangestop?language=objc)
#[cfg(feature = "AEDataModel")]
pub const keyAERangeStop: AEKeyword = 0x73746f70;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keydisposetokenproc?language=objc)
#[cfg(feature = "AEDataModel")]
pub const keyDisposeTokenProc: AEKeyword = 0x78746f6b;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaecompareproc?language=objc)
#[cfg(feature = "AEDataModel")]
pub const keyAECompareProc: AEKeyword = 0x636d7072;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaecountproc?language=objc)
#[cfg(feature = "AEDataModel")]
pub const keyAECountProc: AEKeyword = 0x636f6e74;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaemarktokenproc?language=objc)
#[cfg(feature = "AEDataModel")]
pub const keyAEMarkTokenProc: AEKeyword = 0x6d6b6964;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaemarkproc?language=objc)
#[cfg(feature = "AEDataModel")]
pub const keyAEMarkProc: AEKeyword = 0x6d61726b;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaeadjustmarksproc?language=objc)
#[cfg(feature = "AEDataModel")]
pub const keyAEAdjustMarksProc: AEKeyword = 0x61646a6d;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaegeterrdescproc?language=objc)
#[cfg(feature = "AEDataModel")]
pub const keyAEGetErrDescProc: AEKeyword = 0x696e6463;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/formabsoluteposition?language=objc)
pub const formAbsolutePosition: c_uint = 0x696e6478;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/formrelativeposition?language=objc)
pub const formRelativePosition: c_uint = 0x72656c65;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/formtest?language=objc)
pub const formTest: c_uint = 0x74657374;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/formrange?language=objc)
pub const formRange: c_uint = 0x72616e67;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/formpropertyid?language=objc)
pub const formPropertyID: c_uint = 0x70726f70;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/formname?language=objc)
pub const formName: c_uint = 0x6e616d65;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/formuniqueid?language=objc)
pub const formUniqueID: c_uint = 0x49442020;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeobjectspecifier?language=objc)
#[cfg(feature = "AEDataModel")]
pub const typeObjectSpecifier: DescType = 0x6f626a20;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeobjectbeingexamined?language=objc)
#[cfg(feature = "AEDataModel")]
pub const typeObjectBeingExamined: DescType = 0x65786d6e;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecurrentcontainer?language=objc)
#[cfg(feature = "AEDataModel")]
pub const typeCurrentContainer: DescType = 0x63636e74;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typetoken?language=objc)
#[cfg(feature = "AEDataModel")]
pub const typeToken: DescType = 0x746f6b65;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typerelativedescriptor?language=objc)
#[cfg(feature = "AEDataModel")]
pub const typeRelativeDescriptor: DescType = 0x72656c20;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeabsoluteordinal?language=objc)
#[cfg(feature = "AEDataModel")]
pub const typeAbsoluteOrdinal: DescType = 0x6162736f;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeindexdescriptor?language=objc)
#[cfg(feature = "AEDataModel")]
pub const typeIndexDescriptor: DescType = 0x696e6465;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typerangedescriptor?language=objc)
#[cfg(feature = "AEDataModel")]
pub const typeRangeDescriptor: DescType = 0x72616e67;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typelogicaldescriptor?language=objc)
#[cfg(feature = "AEDataModel")]
pub const typeLogicalDescriptor: DescType = 0x6c6f6769;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecompdescriptor?language=objc)
#[cfg(feature = "AEDataModel")]
pub const typeCompDescriptor: DescType = 0x636d7064;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeosltokenlist?language=objc)
#[cfg(feature = "AEDataModel")]
pub const typeOSLTokenList: DescType = 0x6f73746c;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeidominimum?language=objc)
pub const kAEIDoMinimum: c_uint = 0x0000;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeidowhose?language=objc)
pub const kAEIDoWhose: c_uint = 0x0001;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeidomarking?language=objc)
pub const kAEIDoMarking: c_uint = 0x0004;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaepasssubdescs?language=objc)
pub const kAEPassSubDescs: c_uint = 0x0008;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeresolvenestedlists?language=objc)
pub const kAEResolveNestedLists: c_uint = 0x0010;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaehandlesimpleranges?language=objc)
pub const kAEHandleSimpleRanges: c_uint = 0x0020;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeuserelativeiterators?language=objc)
pub const kAEUseRelativeIterators: c_uint = 0x0040;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typewhosedescriptor?language=objc)
pub const typeWhoseDescriptor: c_uint = 0x77686f73;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/formwhose?language=objc)
pub const formWhose: c_uint = 0x77686f73;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typewhoserange?language=objc)
pub const typeWhoseRange: c_uint = 0x77726e67;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaewhoserangestart?language=objc)
pub const keyAEWhoseRangeStart: c_uint = 0x77737472;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaewhoserangestop?language=objc)
pub const keyAEWhoseRangeStop: c_uint = 0x77737470;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaeindex?language=objc)
pub const keyAEIndex: c_uint = 0x6b696478;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaetest?language=objc)
pub const keyAETest: c_uint = 0x6b747374;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/ccnttokenrecord?language=objc)
#[cfg(feature = "AEDataModel")]
#[repr(C, packed(2))]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ccntTokenRecord {
    pub tokenClass: DescType,
    pub token: AEDesc,
}

#[cfg(all(feature = "AEDataModel", feature = "objc2"))]
unsafe impl Encode for ccntTokenRecord {
    const ENCODING: Encoding = Encoding::Struct(
        "ccntTokenRecord",
        &[<DescType>::ENCODING, <AEDesc>::ENCODING],
    );
}

#[cfg(all(feature = "AEDataModel", feature = "objc2"))]
unsafe impl RefEncode for ccntTokenRecord {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/ccnttokenrecptr?language=objc)
#[cfg(feature = "AEDataModel")]
pub type ccntTokenRecPtr = *mut ccntTokenRecord;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/ccnttokenrechandle?language=objc)
#[cfg(feature = "AEDataModel")]
pub type ccntTokenRecHandle = *mut ccntTokenRecPtr;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslaccessorprocptr?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLAccessorProcPtr = Option<
    unsafe extern "C-unwind" fn(
        DescType,
        *const AEDesc,
        DescType,
        DescType,
        *const AEDesc,
        *mut AEDesc,
        SRefCon,
    ) -> OSErr,
>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslcompareprocptr?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLCompareProcPtr = Option<
    unsafe extern "C-unwind" fn(DescType, *const AEDesc, *const AEDesc, *mut Boolean) -> OSErr,
>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslcountprocptr?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLCountProcPtr =
    Option<unsafe extern "C-unwind" fn(DescType, DescType, *const AEDesc, *mut c_long) -> OSErr>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/osldisposetokenprocptr?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLDisposeTokenProcPtr = Option<unsafe extern "C-unwind" fn(*mut AEDesc) -> OSErr>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslgetmarktokenprocptr?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLGetMarkTokenProcPtr =
    Option<unsafe extern "C-unwind" fn(*const AEDesc, DescType, *mut AEDesc) -> OSErr>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslgeterrdescprocptr?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLGetErrDescProcPtr = Option<unsafe extern "C-unwind" fn(*mut *mut AEDesc) -> OSErr>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslmarkprocptr?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLMarkProcPtr =
    Option<unsafe extern "C-unwind" fn(*const AEDesc, *const AEDesc, c_long) -> OSErr>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/osladjustmarksprocptr?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLAdjustMarksProcPtr =
    Option<unsafe extern "C-unwind" fn(c_long, c_long, *const AEDesc) -> OSErr>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslaccessorupp?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLAccessorUPP = OSLAccessorProcPtr;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslcompareupp?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLCompareUPP = OSLCompareProcPtr;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslcountupp?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLCountUPP = OSLCountProcPtr;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/osldisposetokenupp?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLDisposeTokenUPP = OSLDisposeTokenProcPtr;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslgetmarktokenupp?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLGetMarkTokenUPP = OSLGetMarkTokenProcPtr;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslgeterrdescupp?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLGetErrDescUPP = OSLGetErrDescProcPtr;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/oslmarkupp?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLMarkUPP = OSLMarkProcPtr;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/osladjustmarksupp?language=objc)
#[cfg(feature = "AEDataModel")]
pub type OSLAdjustMarksUPP = OSLAdjustMarksProcPtr;

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn NewOSLAccessorUPP(user_routine: OSLAccessorProcPtr) -> OSLAccessorUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn NewOSLCompareUPP(user_routine: OSLCompareProcPtr) -> OSLCompareUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn NewOSLCountUPP(user_routine: OSLCountProcPtr) -> OSLCountUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn NewOSLDisposeTokenUPP(user_routine: OSLDisposeTokenProcPtr) -> OSLDisposeTokenUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn NewOSLGetMarkTokenUPP(user_routine: OSLGetMarkTokenProcPtr) -> OSLGetMarkTokenUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn NewOSLGetErrDescUPP(user_routine: OSLGetErrDescProcPtr) -> OSLGetErrDescUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn NewOSLMarkUPP(user_routine: OSLMarkProcPtr) -> OSLMarkUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn NewOSLAdjustMarksUPP(user_routine: OSLAdjustMarksProcPtr) -> OSLAdjustMarksUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn DisposeOSLAccessorUPP(user_upp: OSLAccessorUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn DisposeOSLCompareUPP(user_upp: OSLCompareUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn DisposeOSLCountUPP(user_upp: OSLCountUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn DisposeOSLDisposeTokenUPP(user_upp: OSLDisposeTokenUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn DisposeOSLGetMarkTokenUPP(user_upp: OSLGetMarkTokenUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn DisposeOSLGetErrDescUPP(user_upp: OSLGetErrDescUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn DisposeOSLMarkUPP(user_upp: OSLMarkUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn DisposeOSLAdjustMarksUPP(user_upp: OSLAdjustMarksUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `container` must be a valid pointer.
    /// - `selection_data` must be a valid pointer.
    /// - `value` must be a valid pointer.
    /// - `accessor_refcon` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn InvokeOSLAccessorUPP(
        desired_class: DescType,
        container: *const AEDesc,
        container_class: DescType,
        form: DescType,
        selection_data: *const AEDesc,
        value: *mut AEDesc,
        accessor_refcon: SRefCon,
        user_upp: OSLAccessorUPP,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `obj1` must be a valid pointer.
    /// - `obj2` must be a valid pointer.
    /// - `result` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn InvokeOSLCompareUPP(
        oper: DescType,
        obj1: *const AEDesc,
        obj2: *const AEDesc,
        result: *mut Boolean,
        user_upp: OSLCompareUPP,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `container` must be a valid pointer.
    /// - `result` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn InvokeOSLCountUPP(
        desired_type: DescType,
        container_class: DescType,
        container: *const AEDesc,
        result: *mut c_long,
        user_upp: OSLCountUPP,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `unneeded_token` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn InvokeOSLDisposeTokenUPP(
        unneeded_token: *mut AEDesc,
        user_upp: OSLDisposeTokenUPP,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `d_container_token` must be a valid pointer.
    /// - `result` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn InvokeOSLGetMarkTokenUPP(
        d_container_token: *const AEDesc,
        container_class: DescType,
        result: *mut AEDesc,
        user_upp: OSLGetMarkTokenUPP,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `app_desc_ptr` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn InvokeOSLGetErrDescUPP(
        app_desc_ptr: *mut *mut AEDesc,
        user_upp: OSLGetErrDescUPP,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `d_token` must be a valid pointer.
    /// - `mark_token` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn InvokeOSLMarkUPP(
        d_token: *const AEDesc,
        mark_token: *const AEDesc,
        index: c_long,
        user_upp: OSLMarkUPP,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `mark_token` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn InvokeOSLAdjustMarksUPP(
        new_start: c_long,
        new_stop: c_long,
        mark_token: *const AEDesc,
        user_upp: OSLAdjustMarksUPP,
    ) -> OSErr;
}

extern "C-unwind" {
    pub fn AEObjectInit() -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `my_compare_proc` must be implemented correctly.
    /// - `my_count_proc` must be implemented correctly.
    /// - `my_dispose_token_proc` must be implemented correctly.
    /// - `my_get_mark_token_proc` must be implemented correctly.
    /// - `my_mark_proc` must be implemented correctly.
    /// - `my_adjust_marks_proc` must be implemented correctly.
    /// - `my_get_err_desc_proc_ptr` must be implemented correctly.
    #[cfg(feature = "AEDataModel")]
    pub fn AESetObjectCallbacks(
        my_compare_proc: OSLCompareUPP,
        my_count_proc: OSLCountUPP,
        my_dispose_token_proc: OSLDisposeTokenUPP,
        my_get_mark_token_proc: OSLGetMarkTokenUPP,
        my_mark_proc: OSLMarkUPP,
        my_adjust_marks_proc: OSLAdjustMarksUPP,
        my_get_err_desc_proc_ptr: OSLGetErrDescUPP,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `object_specifier` must be a valid pointer.
    /// - `the_token` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEResolve(
        object_specifier: *const AEDesc,
        callback_flags: c_short,
        the_token: *mut AEDesc,
    ) -> OSErr;
}

/// # Safety
///
/// - `the_accessor` must be implemented correctly.
/// - `accessor_refcon` must be a valid pointer.
#[cfg(feature = "AEDataModel")]
#[inline]
pub unsafe extern "C-unwind" fn AEInstallObjectAccessor(
    desired_class: DescType,
    container_type: DescType,
    the_accessor: OSLAccessorUPP,
    accessor_refcon: SRefCon,
    is_sys_handler: bool,
) -> OSErr {
    extern "C-unwind" {
        fn AEInstallObjectAccessor(
            desired_class: DescType,
            container_type: DescType,
            the_accessor: OSLAccessorUPP,
            accessor_refcon: SRefCon,
            is_sys_handler: Boolean,
        ) -> OSErr;
    }
    unsafe {
        AEInstallObjectAccessor(
            desired_class,
            container_type,
            the_accessor,
            accessor_refcon,
            is_sys_handler as _,
        )
    }
}

/// # Safety
///
/// `the_accessor` must be implemented correctly.
#[cfg(feature = "AEDataModel")]
#[inline]
pub unsafe extern "C-unwind" fn AERemoveObjectAccessor(
    desired_class: DescType,
    container_type: DescType,
    the_accessor: OSLAccessorUPP,
    is_sys_handler: bool,
) -> OSErr {
    extern "C-unwind" {
        fn AERemoveObjectAccessor(
            desired_class: DescType,
            container_type: DescType,
            the_accessor: OSLAccessorUPP,
            is_sys_handler: Boolean,
        ) -> OSErr;
    }
    unsafe {
        AERemoveObjectAccessor(
            desired_class,
            container_type,
            the_accessor,
            is_sys_handler as _,
        )
    }
}

/// # Safety
///
/// - `accessor` must be a valid pointer.
/// - `accessor_refcon` must be a valid pointer.
#[cfg(feature = "AEDataModel")]
#[inline]
pub unsafe extern "C-unwind" fn AEGetObjectAccessor(
    desired_class: DescType,
    container_type: DescType,
    accessor: *mut OSLAccessorUPP,
    accessor_refcon: *mut SRefCon,
    is_sys_handler: bool,
) -> OSErr {
    extern "C-unwind" {
        fn AEGetObjectAccessor(
            desired_class: DescType,
            container_type: DescType,
            accessor: *mut OSLAccessorUPP,
            accessor_refcon: *mut SRefCon,
            is_sys_handler: Boolean,
        ) -> OSErr;
    }
    unsafe {
        AEGetObjectAccessor(
            desired_class,
            container_type,
            accessor,
            accessor_refcon,
            is_sys_handler as _,
        )
    }
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `the_token` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEDisposeToken(the_token: *mut AEDesc) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `container_token` must be a valid pointer.
    /// - `key_data` must be a valid pointer.
    /// - `token` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AECallObjectAccessor(
        desired_class: DescType,
        container_token: *const AEDesc,
        container_class: DescType,
        key_form: DescType,
        key_data: *const AEDesc,
        token: *mut AEDesc,
    ) -> OSErr;
}