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
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/desctype?language=objc)
pub type DescType = ResType;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aekeyword?language=objc)
pub type AEKeyword = FourCharCode;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeboolean?language=objc)
pub const typeBoolean: DescType = 0x626f6f6c;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typechar?language=objc)
pub const typeChar: DescType = 0x54455854;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typestyledunicodetext?language=objc)
pub const typeStyledUnicodeText: DescType = 0x73757478;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeencodedstring?language=objc)
pub const typeEncodedString: DescType = 0x656e6373;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeunicodetext?language=objc)
pub const typeUnicodeText: DescType = 0x75747874;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecstring?language=objc)
pub const typeCString: DescType = 0x63737472;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typepstring?language=objc)
pub const typePString: DescType = 0x70737472;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeutf16externalrepresentation?language=objc)
pub const typeUTF16ExternalRepresentation: DescType = 0x75743136;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeutf8text?language=objc)
pub const typeUTF8Text: DescType = 0x75746638;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typesint16?language=objc)
pub const typeSInt16: DescType = 0x73686f72;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeuint16?language=objc)
pub const typeUInt16: DescType = 0x75736872;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typesint32?language=objc)
pub const typeSInt32: DescType = 0x6c6f6e67;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeuint32?language=objc)
pub const typeUInt32: DescType = 0x6d61676e;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typesint64?language=objc)
pub const typeSInt64: DescType = 0x636f6d70;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeuint64?language=objc)
pub const typeUInt64: DescType = 0x75636f6d;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeieee32bitfloatingpoint?language=objc)
pub const typeIEEE32BitFloatingPoint: DescType = 0x73696e67;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeieee64bitfloatingpoint?language=objc)
pub const typeIEEE64BitFloatingPoint: DescType = 0x646f7562;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/type128bitfloatingpoint?language=objc)
pub const type128BitFloatingPoint: DescType = 0x6c64626c;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typedecimalstruct?language=objc)
pub const typeDecimalStruct: DescType = 0x6465636d;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeaelist?language=objc)
pub const typeAEList: DescType = 0x6c697374;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeaerecord?language=objc)
pub const typeAERecord: DescType = 0x7265636f;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeappleevent?language=objc)
pub const typeAppleEvent: DescType = 0x61657674;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeeventrecord?language=objc)
pub const typeEventRecord: DescType = 0x65767263;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typetrue?language=objc)
pub const typeTrue: DescType = 0x74727565;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typefalse?language=objc)
pub const typeFalse: DescType = 0x66616c73;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typealias?language=objc)
pub const typeAlias: DescType = 0x616c6973;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeenumerated?language=objc)
pub const typeEnumerated: DescType = 0x656e756d;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typetype?language=objc)
pub const typeType: DescType = 0x74797065;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeappparameters?language=objc)
pub const typeAppParameters: DescType = 0x61707061;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeproperty?language=objc)
pub const typeProperty: DescType = 0x70726f70;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typefsref?language=objc)
pub const typeFSRef: DescType = 0x66737266;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typefileurl?language=objc)
pub const typeFileURL: DescType = 0x6675726c;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typebookmarkdata?language=objc)
pub const typeBookmarkData: DescType = 0x626d726b;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typekeyword?language=objc)
pub const typeKeyword: DescType = 0x6b657977;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typesectionh?language=objc)
pub const typeSectionH: DescType = 0x73656374;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typewildcard?language=objc)
pub const typeWildCard: DescType = 0x2a2a2a2a;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeapplsignature?language=objc)
pub const typeApplSignature: DescType = 0x7369676e;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeqdrectangle?language=objc)
pub const typeQDRectangle: DescType = 0x71647274;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typefixed?language=objc)
pub const typeFixed: DescType = 0x66697864;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeprocessserialnumber?language=objc)
pub const typeProcessSerialNumber: DescType = 0x70736e20;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeapplicationurl?language=objc)
pub const typeApplicationURL: DescType = 0x6170726c;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typenull?language=objc)
pub const typeNull: DescType = 0x6e756c6c;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecfattributedstringref?language=objc)
pub const typeCFAttributedStringRef: DescType = 0x63666173;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecfmutableattributedstringref?language=objc)
pub const typeCFMutableAttributedStringRef: DescType = 0x63666161;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecfstringref?language=objc)
pub const typeCFStringRef: DescType = 0x63667374;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecfmutablestringref?language=objc)
pub const typeCFMutableStringRef: DescType = 0x63666d73;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecfarrayref?language=objc)
pub const typeCFArrayRef: DescType = 0x63666172;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecfmutablearrayref?language=objc)
pub const typeCFMutableArrayRef: DescType = 0x63666d61;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecfdictionaryref?language=objc)
pub const typeCFDictionaryRef: DescType = 0x63666463;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecfmutabledictionaryref?language=objc)
pub const typeCFMutableDictionaryRef: DescType = 0x63666d64;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecfnumberref?language=objc)
pub const typeCFNumberRef: DescType = 0x63666e62;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecfbooleanref?language=objc)
pub const typeCFBooleanRef: DescType = 0x63667466;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typecftyperef?language=objc)
pub const typeCFTypeRef: DescType = 0x63667479;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typekernelprocessid?language=objc)
pub const typeKernelProcessID: DescType = 0x6b706964;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typemachport?language=objc)
pub const typeMachPort: DescType = 0x706f7274;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeaudittoken?language=objc)
pub const typeAuditToken: DescType = 0x746f6b6e;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/typeapplicationbundleid?language=objc)
pub const typeApplicationBundleID: DescType = 0x62756e64;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keytransactionidattr?language=objc)
pub const keyTransactionIDAttr: AEKeyword = 0x7472616e;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyreturnidattr?language=objc)
pub const keyReturnIDAttr: AEKeyword = 0x72746964;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyeventclassattr?language=objc)
pub const keyEventClassAttr: AEKeyword = 0x6576636c;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyeventidattr?language=objc)
pub const keyEventIDAttr: AEKeyword = 0x65766964;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaddressattr?language=objc)
pub const keyAddressAttr: AEKeyword = 0x61646472;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyoptionalkeywordattr?language=objc)
pub const keyOptionalKeywordAttr: AEKeyword = 0x6f70746b;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keytimeoutattr?language=objc)
pub const keyTimeoutAttr: AEKeyword = 0x74696d6f;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyinteractlevelattr?language=objc)
pub const keyInteractLevelAttr: AEKeyword = 0x696e7465;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyeventsourceattr?language=objc)
pub const keyEventSourceAttr: AEKeyword = 0x65737263;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keymissedkeywordattr?language=objc)
pub const keyMissedKeywordAttr: AEKeyword = 0x6d697373;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyoriginaladdressattr?language=objc)
pub const keyOriginalAddressAttr: AEKeyword = 0x66726f6d;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaccepttimeoutattr?language=objc)
pub const keyAcceptTimeoutAttr: AEKeyword = 0x6163746d;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyreplyrequestedattr?language=objc)
pub const keyReplyRequestedAttr: AEKeyword = 0x72657071;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysendereuidattr?language=objc)
pub const keySenderEUIDAttr: AEKeyword = 0x73656964;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysenderegidattr?language=objc)
pub const keySenderEGIDAttr: AEKeyword = 0x73676964;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysenderuidattr?language=objc)
pub const keySenderUIDAttr: AEKeyword = 0x75696473;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysendergidattr?language=objc)
pub const keySenderGIDAttr: AEKeyword = 0x67696473;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysenderpidattr?language=objc)
pub const keySenderPIDAttr: AEKeyword = 0x73706964;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysenderaudittokenattr?language=objc)
pub const keySenderAuditTokenAttr: AEKeyword = 0x746f6b6e;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysenderapplescriptentitlementsattr?language=objc)
pub const keySenderApplescriptEntitlementsAttr: AEKeyword = 0x656e746c;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysenderapplicationidentifierentitlementattr?language=objc)
pub const keySenderApplicationIdentifierEntitlementAttr: AEKeyword = 0x61696561;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysenderapplicationsandboxed?language=objc)
pub const keySenderApplicationSandboxed: AEKeyword = 0x73737362;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyactualsenderaudittoken?language=objc)
pub const keyActualSenderAuditToken: AEKeyword = 0x61636174;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedebugpostheader?language=objc)
pub const kAEDebugPOSTHeader: c_int = 1 << 0;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedebugreplyheader?language=objc)
pub const kAEDebugReplyHeader: c_int = 1 << 1;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedebugxmlrequest?language=objc)
pub const kAEDebugXMLRequest: c_int = 1 << 2;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedebugxmlresponse?language=objc)
pub const kAEDebugXMLResponse: c_int = 1 << 3;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedebugxmldebugall?language=objc)
pub const kAEDebugXMLDebugAll: c_int = -1;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/ksoap1999schema?language=objc)
pub const kSOAP1999Schema: c_uint = 0x73733939;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/ksoap2001schema?language=objc)
pub const kSOAP2001Schema: c_uint = 0x73733031;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyusernameattr?language=objc)
pub const keyUserNameAttr: AEKeyword = 0x756e616d;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyuserpasswordattr?language=objc)
pub const keyUserPasswordAttr: AEKeyword = 0x70617373;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keydisableauthenticationattr?language=objc)
pub const keyDisableAuthenticationAttr: AEKeyword = 0x61757468;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyxmldebuggingattr?language=objc)
pub const keyXMLDebuggingAttr: AEKeyword = 0x78646267;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaerpcclass?language=objc)
pub const kAERPCClass: AEKeyword = 0x72706320;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaexmlrpcscheme?language=objc)
pub const kAEXMLRPCScheme: AEKeyword = 0x52504332;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaesoapscheme?language=objc)
pub const kAESOAPScheme: AEKeyword = 0x534f4150;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaesharedscripthandler?language=objc)
pub const kAESharedScriptHandler: AEKeyword = 0x77736370;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyrpcmethodname?language=objc)
pub const keyRPCMethodName: AEKeyword = 0x6d657468;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyrpcmethodparam?language=objc)
pub const keyRPCMethodParam: AEKeyword = 0x7061726d;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyrpcmethodparamorder?language=objc)
pub const keyRPCMethodParamOrder: AEKeyword = 0x2f6f7264;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaepostheaderdata?language=objc)
pub const keyAEPOSTHeaderData: AEKeyword = 0x70686564;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaereplyheaderdata?language=objc)
pub const keyAEReplyHeaderData: AEKeyword = 0x72686564;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaexmlrequestdata?language=objc)
pub const keyAEXMLRequestData: AEKeyword = 0x78726571;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyaexmlreplydata?language=objc)
pub const keyAEXMLReplyData: AEKeyword = 0x78726570;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keyadditionalhttpheaders?language=objc)
pub const keyAdditionalHTTPHeaders: AEKeyword = 0x61686564;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysoapaction?language=objc)
pub const keySOAPAction: AEKeyword = 0x73616374;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysoapmethodnamespace?language=objc)
pub const keySOAPMethodNameSpace: AEKeyword = 0x6d737063;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysoapmethodnamespaceuri?language=objc)
pub const keySOAPMethodNameSpaceURI: AEKeyword = 0x6d737075;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysoapschemaversion?language=objc)
pub const keySOAPSchemaVersion: AEKeyword = 0x73736368;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysoapstructuremetadata?language=objc)
pub const keySOAPStructureMetaData: AEKeyword = 0x2f736d64;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysoapsmdnamespace?language=objc)
pub const keySOAPSMDNamespace: AEKeyword = 0x73736e73;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysoapsmdnamespaceuri?language=objc)
pub const keySOAPSMDNamespaceURI: AEKeyword = 0x73736e75;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/keysoapsmdtype?language=objc)
pub const keySOAPSMDType: AEKeyword = 0x73737470;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeusehttpproxyattr?language=objc)
pub const kAEUseHTTPProxyAttr: c_uint = 0x78757072;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaehttpproxyportattr?language=objc)
pub const kAEHTTPProxyPortAttr: c_uint = 0x78687470;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaehttpproxyhostattr?language=objc)
pub const kAEHTTPProxyHostAttr: c_uint = 0x78687468;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaesocks4protocol?language=objc)
pub const kAESocks4Protocol: c_uint = 4;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaesocks5protocol?language=objc)
pub const kAESocks5Protocol: c_uint = 5;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeusesocksattr?language=objc)
pub const kAEUseSocksAttr: c_uint = 0x78736373;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaesocksproxyattr?language=objc)
pub const kAESocksProxyAttr: c_uint = 0x78736f6b;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaesockshostattr?language=objc)
pub const kAESocksHostAttr: c_uint = 0x78736873;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaesocksportattr?language=objc)
pub const kAESocksPortAttr: c_uint = 0x78736870;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaesocksuserattr?language=objc)
pub const kAESocksUserAttr: c_uint = 0x78736875;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaesockspasswordattr?language=objc)
pub const kAESocksPasswordAttr: c_uint = 0x78736877;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedesclistfactornone?language=objc)
pub const kAEDescListFactorNone: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedesclistfactortype?language=objc)
pub const kAEDescListFactorType: c_uint = 4;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedesclistfactortypeandsize?language=objc)
pub const kAEDescListFactorTypeAndSize: c_uint = 8;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kautogeneratereturnid?language=objc)
pub const kAutoGenerateReturnID: c_int = -1;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kanytransactionid?language=objc)
pub const kAnyTransactionID: c_int = 0;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/opaqueaedatastoragetype?language=objc)
#[repr(C)]
#[derive(Debug)]
pub struct OpaqueAEDataStorageType {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for OpaqueAEDataStorageType {
    const ENCODING_REF: Encoding =
        Encoding::Pointer(&Encoding::Struct("OpaqueAEDataStorageType", &[]));
}

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aedatastoragetype?language=objc)
pub type AEDataStorageType = *mut OpaqueAEDataStorageType;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aedatastorage?language=objc)
pub type AEDataStorage = *mut AEDataStorageType;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aedesc?language=objc)
#[repr(C, packed(2))]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AEDesc {
    pub descriptorType: DescType,
    pub dataHandle: AEDataStorage,
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aedescptr?language=objc)
pub type AEDescPtr = *mut AEDesc;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aekeydesc?language=objc)
#[repr(C, packed(2))]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AEKeyDesc {
    pub descKey: AEKeyword,
    pub descContent: AEDesc,
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aedesclist?language=objc)
pub type AEDescList = AEDesc;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aerecord?language=objc)
pub type AERecord = AEDescList;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aeaddressdesc?language=objc)
pub type AEAddressDesc = AEDesc;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/appleevent?language=objc)
pub type AppleEvent = AERecord;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/appleeventptr?language=objc)
pub type AppleEventPtr = *mut AppleEvent;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aereturnid?language=objc)
pub type AEReturnID = i16;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aetransactionid?language=objc)
pub type AETransactionID = i32;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aeeventclass?language=objc)
pub type AEEventClass = FourCharCode;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aeeventid?language=objc)
pub type AEEventID = FourCharCode;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aearraytype?language=objc)
pub type AEArrayType = i8;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedataarray?language=objc)
pub const kAEDataArray: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaepackedarray?language=objc)
pub const kAEPackedArray: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedescarray?language=objc)
pub const kAEDescArray: c_uint = 3;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaekeydescarray?language=objc)
pub const kAEKeyDescArray: c_uint = 4;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaehandlearray?language=objc)
pub const kAEHandleArray: c_uint = 2;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aearraydata?language=objc)
#[repr(C, packed(2))]
#[derive(Clone, Copy)]
pub union AEArrayData {
    pub kAEDataArray: [i16; 1],
    pub kAEPackedArray: [c_char; 1],
    pub kAEHandleArray: [Handle; 1],
    pub kAEDescArray: [AEDesc; 1],
    pub kAEKeyDescArray: [AEKeyDesc; 1],
}

#[cfg(feature = "objc2")]
unsafe impl Encode for AEArrayData {
    const ENCODING: Encoding = Encoding::Union(
        "AEArrayData",
        &[
            <[i16; 1]>::ENCODING,
            <[c_char; 1]>::ENCODING,
            <[Handle; 1]>::ENCODING,
            <[AEDesc; 1]>::ENCODING,
            <[AEKeyDesc; 1]>::ENCODING,
        ],
    );
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aearraydatapointer?language=objc)
pub type AEArrayDataPointer = *mut AEArrayData;

/// ************************************************************************
/// These constants are used by AEMach and AEInteraction APIs.  They are not
/// strictly part of the data format, but are declared here due to layering.
/// ************************************************************************
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/aesendpriority?language=objc)
pub type AESendPriority = i16;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaenormalpriority?language=objc)
pub const kAENormalPriority: c_uint = 0x00000000;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaehighpriority?language=objc)
pub const kAEHighPriority: c_uint = 0x00000001;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aesendmode?language=objc)
pub type AESendMode = i32;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaenoreply?language=objc)
pub const kAENoReply: c_uint = 0x00000001;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaequeuereply?language=objc)
pub const kAEQueueReply: c_uint = 0x00000002;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaewaitreply?language=objc)
pub const kAEWaitReply: c_uint = 0x00000003;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedontreconnect?language=objc)
pub const kAEDontReconnect: c_uint = 0x00000080;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaewantreceipt?language=objc)
pub const kAEWantReceipt: c_uint = 0x00000200;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeneverinteract?language=objc)
pub const kAENeverInteract: c_uint = 0x00000010;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaecaninteract?language=objc)
pub const kAECanInteract: c_uint = 0x00000020;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaealwaysinteract?language=objc)
pub const kAEAlwaysInteract: c_uint = 0x00000030;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaecanswitchlayer?language=objc)
pub const kAECanSwitchLayer: c_uint = 0x00000040;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedontrecord?language=objc)
pub const kAEDontRecord: c_uint = 0x00001000;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedontexecute?language=objc)
pub const kAEDontExecute: c_uint = 0x00002000;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaeprocessnonreplyevents?language=objc)
pub const kAEProcessNonReplyEvents: c_uint = 0x00008000;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedonotautomaticallyaddannotationstoevent?language=objc)
pub const kAEDoNotAutomaticallyAddAnnotationsToEvent: c_uint = 0x00010000;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kaedefaulttimeout?language=objc)
pub const kAEDefaultTimeout: c_int = -1;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/knotimeout?language=objc)
pub const kNoTimeOut: c_int = -2;

/// ************************************************************************
/// These calls are used to set up and modify the coercion dispatch table.
/// ************************************************************************
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/aecoercedescprocptr?language=objc)
pub type AECoerceDescProcPtr =
    Option<unsafe extern "C-unwind" fn(*const AEDesc, DescType, SRefCon, *mut AEDesc) -> OSErr>;

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

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aecoercedescupp?language=objc)
pub type AECoerceDescUPP = AECoerceDescProcPtr;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aecoerceptrupp?language=objc)
pub type AECoercePtrUPP = AECoercePtrProcPtr;

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    pub fn NewAECoerceDescUPP(user_routine: AECoerceDescProcPtr) -> AECoerceDescUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    pub fn NewAECoercePtrUPP(user_routine: AECoercePtrProcPtr) -> AECoercePtrUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    pub fn DisposeAECoerceDescUPP(user_upp: AECoerceDescUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    pub fn DisposeAECoercePtrUPP(user_upp: AECoercePtrUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `from_desc` must be a valid pointer.
    /// - `handler_refcon` must be a valid pointer.
    /// - `to_desc` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    pub fn InvokeAECoerceDescUPP(
        from_desc: *const AEDesc,
        to_type: DescType,
        handler_refcon: SRefCon,
        to_desc: *mut AEDesc,
        user_upp: AECoerceDescUPP,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `data_ptr` must be a valid pointer.
    /// - `handler_refcon` must be a valid pointer.
    /// - `result` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    pub fn InvokeAECoercePtrUPP(
        type_code: DescType,
        data_ptr: *const c_void,
        data_size: Size,
        to_type: DescType,
        handler_refcon: SRefCon,
        result: *mut AEDesc,
        user_upp: AECoercePtrUPP,
    ) -> OSErr;
}

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aecoercionhandlerupp?language=objc)
pub type AECoercionHandlerUPP = AECoerceDescUPP;

/// # Safety
///
/// - `handler` must be implemented correctly.
/// - `handler_refcon` must be a valid pointer.
#[inline]
pub unsafe extern "C-unwind" fn AEInstallCoercionHandler(
    from_type: DescType,
    to_type: DescType,
    handler: AECoercionHandlerUPP,
    handler_refcon: SRefCon,
    from_type_is_desc: bool,
    is_sys_handler: bool,
) -> OSErr {
    extern "C-unwind" {
        fn AEInstallCoercionHandler(
            from_type: DescType,
            to_type: DescType,
            handler: AECoercionHandlerUPP,
            handler_refcon: SRefCon,
            from_type_is_desc: Boolean,
            is_sys_handler: Boolean,
        ) -> OSErr;
    }
    unsafe {
        AEInstallCoercionHandler(
            from_type,
            to_type,
            handler,
            handler_refcon,
            from_type_is_desc as _,
            is_sys_handler as _,
        )
    }
}

/// # Safety
///
/// `handler` must be implemented correctly.
#[inline]
pub unsafe extern "C-unwind" fn AERemoveCoercionHandler(
    from_type: DescType,
    to_type: DescType,
    handler: AECoercionHandlerUPP,
    is_sys_handler: bool,
) -> OSErr {
    extern "C-unwind" {
        fn AERemoveCoercionHandler(
            from_type: DescType,
            to_type: DescType,
            handler: AECoercionHandlerUPP,
            is_sys_handler: Boolean,
        ) -> OSErr;
    }
    unsafe { AERemoveCoercionHandler(from_type, to_type, handler, is_sys_handler as _) }
}

/// # Safety
///
/// - `handler` must be a valid pointer.
/// - `handler_refcon` must be a valid pointer.
/// - `from_type_is_desc` must be a valid pointer.
#[inline]
pub unsafe extern "C-unwind" fn AEGetCoercionHandler(
    from_type: DescType,
    to_type: DescType,
    handler: *mut AECoercionHandlerUPP,
    handler_refcon: *mut SRefCon,
    from_type_is_desc: *mut Boolean,
    is_sys_handler: bool,
) -> OSErr {
    extern "C-unwind" {
        fn AEGetCoercionHandler(
            from_type: DescType,
            to_type: DescType,
            handler: *mut AECoercionHandlerUPP,
            handler_refcon: *mut SRefCon,
            from_type_is_desc: *mut Boolean,
            is_sys_handler: Boolean,
        ) -> OSErr;
    }
    unsafe {
        AEGetCoercionHandler(
            from_type,
            to_type,
            handler,
            handler_refcon,
            from_type_is_desc,
            is_sys_handler as _,
        )
    }
}

extern "C-unwind" {
    /// ************************************************************************
    /// The following calls provide for a coercion interface.
    /// ************************************************************************
    ///
    /// # Safety
    ///
    /// - `data_ptr` must be a valid pointer.
    /// - `result` must be a valid pointer.
    pub fn AECoercePtr(
        type_code: DescType,
        data_ptr: *const c_void,
        data_size: Size,
        to_type: DescType,
        result: *mut AEDesc,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_ae_desc` must be a valid pointer.
    /// - `result` must be a valid pointer.
    pub fn AECoerceDesc(
        the_ae_desc: *const AEDesc,
        to_type: DescType,
        result: *mut AEDesc,
    ) -> OSErr;
}

extern "C-unwind" {
    /// ************************************************************************
    /// The following calls apply to any AEDesc. Every 'result' descriptor is
    /// created for you, so you will be responsible for memory management
    /// (including disposing) of the descriptors so created.
    /// ************************************************************************
    ///
    /// # Safety
    ///
    /// `desc` must be a valid pointer.
    pub fn AEInitializeDesc(desc: *mut AEDesc);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `data_ptr` must be a valid pointer.
    /// - `result` must be a valid pointer.
    pub fn AECreateDesc(
        type_code: DescType,
        data_ptr: *const c_void,
        data_size: Size,
        result: *mut AEDesc,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `the_ae_desc` must be a valid pointer.
    pub fn AEDisposeDesc(the_ae_desc: *mut AEDesc) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_ae_desc` must be a valid pointer.
    /// - `result` must be a valid pointer.
    pub fn AEDuplicateDesc(the_ae_desc: *const AEDesc, result: *mut AEDesc) -> OSErr;
}

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aedisposeexternalprocptr?language=objc)
pub type AEDisposeExternalProcPtr =
    Option<unsafe extern "C-unwind" fn(*const c_void, Size, SRefCon)>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aedisposeexternalupp?language=objc)
pub type AEDisposeExternalUPP = AEDisposeExternalProcPtr;

extern "C-unwind" {
    /// # Safety
    ///
    /// - `data_ptr` must be a valid pointer.
    /// - `dispose_callback` must be implemented correctly.
    /// - `dispose_refcon` must be a valid pointer.
    /// - `the_desc` must be a valid pointer.
    pub fn AECreateDescFromExternalPtr(
        descriptor_type: OSType,
        data_ptr: *const c_void,
        data_length: Size,
        dispose_callback: AEDisposeExternalUPP,
        dispose_refcon: SRefCon,
        the_desc: *mut AEDesc,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `desc1` must be a valid pointer.
    /// - `desc2` must be a valid pointer.
    /// - `result_p` must be a valid pointer.
    pub fn AECompareDesc(
        desc1: *const AEDesc,
        desc2: *const AEDesc,
        result_p: *mut Boolean,
    ) -> OSStatus;
}

/// ************************************************************************
/// The following calls apply to AEDescList. Since AEDescList is a subtype of
/// AEDesc, the calls in the previous section can also be used for AEDescList.
/// All list and array indices are 1-based. If the data was greater than
/// maximumSize in the routines below, then actualSize will be greater than
/// maximumSize, but only maximumSize bytes will actually be retrieved.
/// ************************************************************************
///
/// # Safety
///
/// - `factoring_ptr` must be a valid pointer.
/// - `result_list` must be a valid pointer.
#[inline]
pub unsafe extern "C-unwind" fn AECreateList(
    factoring_ptr: *const c_void,
    factored_size: Size,
    is_record: bool,
    result_list: *mut AEDescList,
) -> OSErr {
    extern "C-unwind" {
        fn AECreateList(
            factoring_ptr: *const c_void,
            factored_size: Size,
            is_record: Boolean,
            result_list: *mut AEDescList,
        ) -> OSErr;
    }
    unsafe { AECreateList(factoring_ptr, factored_size, is_record as _, result_list) }
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_ae_desc_list` must be a valid pointer.
    /// - `the_count` must be a valid pointer.
    pub fn AECountItems(the_ae_desc_list: *const AEDescList, the_count: *mut c_long) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_ae_desc_list` must be a valid pointer.
    /// - `data_ptr` must be a valid pointer.
    pub fn AEPutPtr(
        the_ae_desc_list: *mut AEDescList,
        index: c_long,
        type_code: DescType,
        data_ptr: *const c_void,
        data_size: Size,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_ae_desc_list` must be a valid pointer.
    /// - `the_ae_desc` must be a valid pointer.
    pub fn AEPutDesc(
        the_ae_desc_list: *mut AEDescList,
        index: c_long,
        the_ae_desc: *const AEDesc,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_ae_desc_list` must be a valid pointer.
    /// - `the_ae_keyword` must be a valid pointer.
    /// - `type_code` must be a valid pointer.
    /// - `data_ptr` must be a valid pointer.
    /// - `actual_size` must be a valid pointer.
    pub fn AEGetNthPtr(
        the_ae_desc_list: *const AEDescList,
        index: c_long,
        desired_type: DescType,
        the_ae_keyword: *mut AEKeyword,
        type_code: *mut DescType,
        data_ptr: *mut c_void,
        maximum_size: Size,
        actual_size: *mut Size,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_ae_desc_list` must be a valid pointer.
    /// - `the_ae_keyword` must be a valid pointer.
    /// - `result` must be a valid pointer.
    pub fn AEGetNthDesc(
        the_ae_desc_list: *const AEDescList,
        index: c_long,
        desired_type: DescType,
        the_ae_keyword: *mut AEKeyword,
        result: *mut AEDesc,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_ae_desc_list` must be a valid pointer.
    /// - `type_code` must be a valid pointer.
    /// - `data_size` must be a valid pointer.
    pub fn AESizeOfNthItem(
        the_ae_desc_list: *const AEDescList,
        index: c_long,
        type_code: *mut DescType,
        data_size: *mut Size,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_ae_desc_list` must be a valid pointer.
    /// - `array_ptr` must be a valid pointer.
    /// - `item_type` must be a valid pointer.
    /// - `item_size` must be a valid pointer.
    /// - `item_count` must be a valid pointer.
    pub fn AEGetArray(
        the_ae_desc_list: *const AEDescList,
        array_type: AEArrayType,
        array_ptr: AEArrayDataPointer,
        maximum_size: Size,
        item_type: *mut DescType,
        item_size: *mut Size,
        item_count: *mut c_long,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_ae_desc_list` must be a valid pointer.
    /// - `array_ptr` must be a valid pointer.
    pub fn AEPutArray(
        the_ae_desc_list: *mut AEDescList,
        array_type: AEArrayType,
        array_ptr: *const AEArrayData,
        item_type: DescType,
        item_size: Size,
        item_count: c_long,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `the_ae_desc_list` must be a valid pointer.
    pub fn AEDeleteItem(the_ae_desc_list: *mut AEDescList, index: c_long) -> OSErr;
}

/// ************************************************************************
/// The following calls apply to AERecord. Since AERecord is a subtype of
/// AEDescList, the calls in the previous sections can also be used for
/// AERecord an AERecord can be created by using AECreateList with isRecord
/// set to true.
/// ************************************************************************
///
/// ***********************************************************************
/// AERecords can have an abitrary descriptorType.  This allows you to
/// check if desc is truly an AERecord
/// **********************************************************************
///
/// # Safety
///
/// `the_desc` must be a valid pointer.
#[inline]
pub unsafe extern "C-unwind" fn AECheckIsRecord(the_desc: *const AEDesc) -> bool {
    extern "C-unwind" {
        fn AECheckIsRecord(the_desc: *const AEDesc) -> Boolean;
    }
    let ret = unsafe { AECheckIsRecord(the_desc) };
    ret != 0
}

extern "C-unwind" {
    /// ************************************************************************
    /// The following calls create and manipulate the AppleEvent data type.
    /// ************************************************************************
    ///
    /// # Safety
    ///
    /// - `target` must be a valid pointer.
    /// - `result` must be a valid pointer.
    pub fn AECreateAppleEvent(
        the_ae_event_class: AEEventClass,
        the_ae_event_id: AEEventID,
        target: *const AEAddressDesc,
        return_id: AEReturnID,
        transaction_id: AETransactionID,
        result: *mut AppleEvent,
    ) -> OSErr;
}

extern "C-unwind" {
    /// ************************************************************************
    /// The following calls are used to pack and unpack parameters from records
    /// of type AppleEvent. Since AppleEvent is a subtype of AERecord, the calls
    /// in the previous sections can also be used for variables of type
    /// AppleEvent. The next six calls are in fact identical to the six calls
    /// for AERecord.
    /// ************************************************************************
    ///
    /// # Safety
    ///
    /// - `the_apple_event` must be a valid pointer.
    /// - `data_ptr` must be a valid pointer.
    pub fn AEPutParamPtr(
        the_apple_event: *mut AppleEvent,
        the_ae_keyword: AEKeyword,
        type_code: DescType,
        data_ptr: *const c_void,
        data_size: Size,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_apple_event` must be a valid pointer.
    /// - `the_ae_desc` must be a valid pointer.
    pub fn AEPutParamDesc(
        the_apple_event: *mut AppleEvent,
        the_ae_keyword: AEKeyword,
        the_ae_desc: *const AEDesc,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_apple_event` must be a valid pointer.
    /// - `actual_type` must be a valid pointer.
    /// - `data_ptr` must be a valid pointer.
    /// - `actual_size` must be a valid pointer.
    pub fn AEGetParamPtr(
        the_apple_event: *const AppleEvent,
        the_ae_keyword: AEKeyword,
        desired_type: DescType,
        actual_type: *mut DescType,
        data_ptr: *mut c_void,
        maximum_size: Size,
        actual_size: *mut Size,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_apple_event` must be a valid pointer.
    /// - `result` must be a valid pointer.
    pub fn AEGetParamDesc(
        the_apple_event: *const AppleEvent,
        the_ae_keyword: AEKeyword,
        desired_type: DescType,
        result: *mut AEDesc,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_apple_event` must be a valid pointer.
    /// - `type_code` must be a valid pointer.
    /// - `data_size` must be a valid pointer.
    pub fn AESizeOfParam(
        the_apple_event: *const AppleEvent,
        the_ae_keyword: AEKeyword,
        type_code: *mut DescType,
        data_size: *mut Size,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `the_apple_event` must be a valid pointer.
    pub fn AEDeleteParam(the_apple_event: *mut AppleEvent, the_ae_keyword: AEKeyword) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_apple_event` must be a valid pointer.
    /// - `type_code` must be a valid pointer.
    /// - `data_ptr` must be a valid pointer.
    /// - `actual_size` must be a valid pointer.
    pub fn AEGetAttributePtr(
        the_apple_event: *const AppleEvent,
        the_ae_keyword: AEKeyword,
        desired_type: DescType,
        type_code: *mut DescType,
        data_ptr: *mut c_void,
        maximum_size: Size,
        actual_size: *mut Size,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_apple_event` must be a valid pointer.
    /// - `result` must be a valid pointer.
    pub fn AEGetAttributeDesc(
        the_apple_event: *const AppleEvent,
        the_ae_keyword: AEKeyword,
        desired_type: DescType,
        result: *mut AEDesc,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_apple_event` must be a valid pointer.
    /// - `type_code` must be a valid pointer.
    /// - `data_size` must be a valid pointer.
    pub fn AESizeOfAttribute(
        the_apple_event: *const AppleEvent,
        the_ae_keyword: AEKeyword,
        type_code: *mut DescType,
        data_size: *mut Size,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_apple_event` must be a valid pointer.
    /// - `data_ptr` must be a valid pointer.
    pub fn AEPutAttributePtr(
        the_apple_event: *mut AppleEvent,
        the_ae_keyword: AEKeyword,
        type_code: DescType,
        data_ptr: *const c_void,
        data_size: Size,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_apple_event` must be a valid pointer.
    /// - `the_ae_desc` must be a valid pointer.
    pub fn AEPutAttributeDesc(
        the_apple_event: *mut AppleEvent,
        the_ae_keyword: AEKeyword,
        the_ae_desc: *const AEDesc,
    ) -> OSErr;
}

extern "C-unwind" {
    /// ************************************************************************
    /// AppleEvent Serialization Support
    ///
    /// AESizeOfFlattenedDesc, AEFlattenDesc, AEUnflattenDesc
    ///
    /// These calls will work for all AppleEvent data types and between different
    /// versions of the OS (including between Mac OS 9 and X)
    ///
    /// Basic types, AEDesc, AEList and AERecord are OK, but AppleEvent records
    /// themselves may not be reliably flattened for storage.
    /// ************************************************************************
    ///
    /// # Safety
    ///
    /// `the_ae_desc` must be a valid pointer.
    pub fn AESizeOfFlattenedDesc(the_ae_desc: *const AEDesc) -> Size;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_ae_desc` must be a valid pointer.
    /// - `buffer` must be a valid pointer.
    /// - `actual_size` must be a valid pointer.
    pub fn AEFlattenDesc(
        the_ae_desc: *const AEDesc,
        buffer: Ptr,
        buffer_size: Size,
        actual_size: *mut Size,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `buffer` must be a valid pointer.
    /// - `result` must be a valid pointer.
    #[deprecated]
    pub fn AEUnflattenDesc(buffer: *const c_void, result: *mut AEDesc) -> OSStatus;
}

extern "C-unwind" {
    /// Allocates an AEDesc (given a Null Desc) constructed from a flattened data
    /// buffer produced by calling AEFlattenDesc.
    ///
    ///
    /// Parameter `buffer`: A pointer to data produced by `AEFlattenDesc`
    ///
    /// Parameter `bufferLen`: The size of the data referenced by `buffer`
    ///
    /// Parameter `result`: On successful completion, a pointer to an `AEDesc*` containing the unflattened descriptor. The caller is responsible for disposing of it.
    ///
    /// Returns: `noErr` on success, `paramErr` if the buffer could not be parsed, or `memFullErr` for irrational memory sizes.
    ///
    /// # Safety
    ///
    /// - `buffer` must be a valid pointer.
    /// - `result` must be a valid pointer.
    pub fn AEUnflattenDescFromBytes(
        buffer: *const c_void,
        buffer_len: usize,
        result: *mut AEDesc,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// ************************************************************************
    /// The following calls are necessary to deal with opaque data in AEDescs, because the
    /// traditional way of dealing with a basic AEDesc has been to dereference the dataHandle
    /// directly.  This is not supported under Carbon.
    /// ************************************************************************
    ///
    /// # Safety
    ///
    /// - `the_ae_desc` must be a valid pointer.
    /// - `data_ptr` must be a valid pointer.
    pub fn AEGetDescData(
        the_ae_desc: *const AEDesc,
        data_ptr: *mut c_void,
        maximum_size: Size,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `the_ae_desc` must be a valid pointer.
    pub fn AEGetDescDataSize(the_ae_desc: *const AEDesc) -> Size;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `data_ptr` must be a valid pointer.
    /// - `the_ae_desc` must be a valid pointer.
    pub fn AEReplaceDescData(
        type_code: DescType,
        data_ptr: *const c_void,
        data_size: Size,
        the_ae_desc: *mut AEDesc,
    ) -> OSErr;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `data_desc` must be a valid pointer.
    /// - `buffer` must be a valid pointer.
    pub fn AEGetDescDataRange(
        data_desc: *const AEDesc,
        buffer: *mut c_void,
        offset: Size,
        length: Size,
    ) -> OSStatus;
}

/// ************************************************************************
/// A AEEventHandler is installed to process an AppleEvent
/// ************************************************************************
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/aeeventhandlerprocptr?language=objc)
pub type AEEventHandlerProcPtr =
    Option<unsafe extern "C-unwind" fn(*const AppleEvent, *mut AppleEvent, SRefCon) -> OSErr>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aeeventhandlerupp?language=objc)
pub type AEEventHandlerUPP = AEEventHandlerProcPtr;

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    pub fn NewAEDisposeExternalUPP(user_routine: AEDisposeExternalProcPtr) -> AEDisposeExternalUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_routine` must be implemented correctly.
    pub fn NewAEEventHandlerUPP(user_routine: AEEventHandlerProcPtr) -> AEEventHandlerUPP;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    pub fn DisposeAEDisposeExternalUPP(user_upp: AEDisposeExternalUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `user_upp` must be implemented correctly.
    pub fn DisposeAEEventHandlerUPP(user_upp: AEEventHandlerUPP);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `data_ptr` must be a valid pointer.
    /// - `refcon` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    pub fn InvokeAEDisposeExternalUPP(
        data_ptr: *const c_void,
        data_length: Size,
        refcon: SRefCon,
        user_upp: AEDisposeExternalUPP,
    );
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `the_apple_event` must be a valid pointer.
    /// - `reply` must be a valid pointer.
    /// - `handler_refcon` must be a valid pointer.
    /// - `user_upp` must be implemented correctly.
    pub fn InvokeAEEventHandlerUPP(
        the_apple_event: *const AppleEvent,
        reply: *mut AppleEvent,
        handler_refcon: SRefCon,
        user_upp: AEEventHandlerUPP,
    ) -> OSErr;
}