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
|
{
File: CarbonCore/UnicodeUtilities.h
Contains: Types, constants, prototypes for Unicode Utilities (Unicode input and text utils)
Version: CarbonCore-859.2~1
Copyright: © 1997-2008 by Apple Computer, Inc., all rights reserved.
Bugs?: For bug reports, consult the following page on
the World Wide Web:
http://www.freepascal.org/bugs.html
}
{ Pascal Translation Updated: Jonas Maebe, <jonas@freepascal.org>, October 2009 }
{
Modified for use with Free Pascal
Version 308
Please report any bugs to <gpc@microbizz.nl>
}
{$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
{$mode macpas}
{$packenum 1}
{$macro on}
{$inline on}
{$calling mwpascal}
unit UnicodeUtilities;
interface
{$setc UNIVERSAL_INTERFACES_VERSION := $0400}
{$setc GAP_INTERFACES_VERSION := $0308}
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
{$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
{$endc}
{$ifc defined CPUPOWERPC and defined CPUI386}
{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
{$endc}
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
{$endc}
{$ifc not defined __ppc__ and defined CPUPOWERPC32}
{$setc __ppc__ := 1}
{$elsec}
{$setc __ppc__ := 0}
{$endc}
{$ifc not defined __ppc64__ and defined CPUPOWERPC64}
{$setc __ppc64__ := 1}
{$elsec}
{$setc __ppc64__ := 0}
{$endc}
{$ifc not defined __i386__ and defined CPUI386}
{$setc __i386__ := 1}
{$elsec}
{$setc __i386__ := 0}
{$endc}
{$ifc not defined __x86_64__ and defined CPUX86_64}
{$setc __x86_64__ := 1}
{$elsec}
{$setc __x86_64__ := 0}
{$endc}
{$ifc not defined __arm__ and defined CPUARM}
{$setc __arm__ := 1}
{$elsec}
{$setc __arm__ := 0}
{$endc}
{$ifc defined cpu64}
{$setc __LP64__ := 1}
{$elsec}
{$setc __LP64__ := 0}
{$endc}
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
{$error Conflicting definitions for __ppc__ and __i386__}
{$endc}
{$ifc defined __ppc__ and __ppc__}
{$setc TARGET_CPU_PPC := TRUE}
{$setc TARGET_CPU_PPC64 := FALSE}
{$setc TARGET_CPU_X86 := FALSE}
{$setc TARGET_CPU_X86_64 := FALSE}
{$setc TARGET_CPU_ARM := FALSE}
{$setc TARGET_OS_MAC := TRUE}
{$setc TARGET_OS_IPHONE := FALSE}
{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$elifc defined __ppc64__ and __ppc64__}
{$setc TARGET_CPU_PPC := FALSE}
{$setc TARGET_CPU_PPC64 := TRUE}
{$setc TARGET_CPU_X86 := FALSE}
{$setc TARGET_CPU_X86_64 := FALSE}
{$setc TARGET_CPU_ARM := FALSE}
{$setc TARGET_OS_MAC := TRUE}
{$setc TARGET_OS_IPHONE := FALSE}
{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$elifc defined __i386__ and __i386__}
{$setc TARGET_CPU_PPC := FALSE}
{$setc TARGET_CPU_PPC64 := FALSE}
{$setc TARGET_CPU_X86 := TRUE}
{$setc TARGET_CPU_X86_64 := FALSE}
{$setc TARGET_CPU_ARM := FALSE}
{$ifc defined(iphonesim)}
{$setc TARGET_OS_MAC := FALSE}
{$setc TARGET_OS_IPHONE := TRUE}
{$setc TARGET_IPHONE_SIMULATOR := TRUE}
{$elsec}
{$setc TARGET_OS_MAC := TRUE}
{$setc TARGET_OS_IPHONE := FALSE}
{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$endc}
{$elifc defined __x86_64__ and __x86_64__}
{$setc TARGET_CPU_PPC := FALSE}
{$setc TARGET_CPU_PPC64 := FALSE}
{$setc TARGET_CPU_X86 := FALSE}
{$setc TARGET_CPU_X86_64 := TRUE}
{$setc TARGET_CPU_ARM := FALSE}
{$setc TARGET_OS_MAC := TRUE}
{$setc TARGET_OS_IPHONE := FALSE}
{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$elifc defined __arm__ and __arm__}
{$setc TARGET_CPU_PPC := FALSE}
{$setc TARGET_CPU_PPC64 := FALSE}
{$setc TARGET_CPU_X86 := FALSE}
{$setc TARGET_CPU_X86_64 := FALSE}
{$setc TARGET_CPU_ARM := TRUE}
{ will require compiler define when/if other Apple devices with ARM cpus ship }
{$setc TARGET_OS_MAC := FALSE}
{$setc TARGET_OS_IPHONE := TRUE}
{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$elsec}
{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.}
{$endc}
{$ifc defined __LP64__ and __LP64__ }
{$setc TARGET_CPU_64 := TRUE}
{$elsec}
{$setc TARGET_CPU_64 := FALSE}
{$endc}
{$ifc defined FPC_BIG_ENDIAN}
{$setc TARGET_RT_BIG_ENDIAN := TRUE}
{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
{$elifc defined FPC_LITTLE_ENDIAN}
{$setc TARGET_RT_BIG_ENDIAN := FALSE}
{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
{$elsec}
{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
{$endc}
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
{$setc CALL_NOT_IN_CARBON := FALSE}
{$setc OLDROUTINENAMES := FALSE}
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
{$setc OPAQUE_UPP_TYPES := TRUE}
{$setc OTCARBONAPPLICATION := TRUE}
{$setc OTKERNEL := FALSE}
{$setc PM_USE_SESSION_APIS := TRUE}
{$setc TARGET_API_MAC_CARBON := TRUE}
{$setc TARGET_API_MAC_OS8 := FALSE}
{$setc TARGET_API_MAC_OSX := TRUE}
{$setc TARGET_CARBON := TRUE}
{$setc TARGET_CPU_68K := FALSE}
{$setc TARGET_CPU_MIPS := FALSE}
{$setc TARGET_CPU_SPARC := FALSE}
{$setc TARGET_OS_UNIX := FALSE}
{$setc TARGET_OS_WIN32 := FALSE}
{$setc TARGET_RT_MAC_68881 := FALSE}
{$setc TARGET_RT_MAC_CFM := FALSE}
{$setc TARGET_RT_MAC_MACHO := TRUE}
{$setc TYPED_FUNCTION_POINTERS := TRUE}
{$setc TYPE_BOOL := FALSE}
{$setc TYPE_EXTENDED := FALSE}
{$setc TYPE_LONGLONG := TRUE}
uses MacTypes,MacLocales,TextCommon,CFBase;
{$endc} {not MACOSALLINCLUDE}
{$ifc TARGET_OS_MAC}
{$ALIGN MAC68K}
{
-------------------------------------------------------------------------------------------------
CONSTANTS & DATA STRUCTURES for UCKeyTranslate & UCKeyboardLayout ('uchr' resource)
-------------------------------------------------------------------------------------------------
}
{
-------------------------------------------------------------------------------------------------
UCKeyOutput & related stuff
The interpretation of UCKeyOutput depends on bits 15-14.
If they are 01, then bits 0-13 are an index in UCKeyStateRecordsIndex (resource-wide list).
If they are 10, then bits 0-13 are an index in UCKeySequenceDataIndex (resource-wide list),
or if UCKeySequenceDataIndex is not present or the index is beyond the end of the list,
then bits 0-15 are a single Unicode character.
Otherwise, bits 0-15 are a single Unicode character; a value of 0xFFFE-0xFFFF means no character
output.
UCKeyCharSeq is similar, but does not support indices in UCKeyStateRecordsIndex. For bits 15-14:
If they are 10, then bits 0-13 are an index in UCKeySequenceDataIndex (resource-wide list),
or if UCKeySequenceDataIndex is not present or the index is beyond the end of the list,
then bits 0-15 are a single Unicode character.
Otherwise, bits 0-15 are a single Unicode character; a value of 0xFFFE-0xFFFF means no character
output.
-------------------------------------------------------------------------------------------------
}
type
UCKeyOutput = UInt16;
UCKeyCharSeq = UInt16;
const
kUCKeyOutputStateIndexMask = $4000;
kUCKeyOutputSequenceIndexMask = $8000;
kUCKeyOutputTestForIndexMask = $C000; { test bits 14-15}
kUCKeyOutputGetIndexMask = $3FFF; { get bits 0-13}
{
-------------------------------------------------------------------------------------------------
UCKeyStateRecord & related stuff
The UCKeyStateRecord information is used as follows. If the current state is zero,
output stateZeroCharData and set the state to stateZeroNextState. If the current state
is non-zero and there is an entry for it in stateEntryData, then output the corresponding
charData and set the state to nextState. Otherwise, output the state terminator from
UCKeyStateTerminators for the current state (or nothing if there is no UCKeyStateTerminators
table or it has no entry for the current state), then output stateZeroCharData and set the
state to stateZeroNextState.
-------------------------------------------------------------------------------------------------
}
type
UCKeyStateRecord = record
stateZeroCharData: UCKeyCharSeq;
stateZeroNextState: UInt16;
stateEntryCount: UInt16;
stateEntryFormat: UInt16;
{ This is followed by an array of stateEntryCount elements}
{ in the specified format. Here we just show a dummy array.}
stateEntryData: array [0..0] of UInt32;
end;
{
Here are the codes for entry formats currently defined.
Each entry maps from curState to charData and nextState.
}
const
kUCKeyStateEntryTerminalFormat = $0001;
kUCKeyStateEntryRangeFormat = $0002;
{
For UCKeyStateEntryTerminal -
nextState is always 0, so we don't have a field for it
}
type
UCKeyStateEntryTerminalPtr = ^UCKeyStateEntryTerminal;
UCKeyStateEntryTerminal = record
curState: UInt16;
charData: UCKeyCharSeq;
end;
{
For UCKeyStateEntryRange -
If curState >= curStateStart and curState <= curStateStart+curStateRange,
then it matches the entry, and we transform charData and nextState as follows:
If charData < 0xFFFE, then charData += (curState-curStateStart)*deltaMultiplier
If nextState != 0, then nextState += (curState-curStateStart)*deltaMultiplier
}
type
UCKeyStateEntryRangePtr = ^UCKeyStateEntryRange;
UCKeyStateEntryRange = record
curStateStart: UInt16;
curStateRange: UInt8;
deltaMultiplier: UInt8;
charData: UCKeyCharSeq;
nextState: UInt16;
end;
{
-------------------------------------------------------------------------------------------------
UCKeyboardLayout & related stuff
The UCKeyboardLayout struct given here is only for the resource header. It specifies
offsets to the various subtables which each have their own structs, given below.
The keyboardTypeHeadList array selects table offsets that depend on keyboardType. The
first entry in keyboardTypeHeadList is the default entry, which will be used if the
keyboardType passed to UCKeyTranslate does not match any other entry - i.e. does not fall
within the range keyboardTypeFirst..keyboardTypeLast for some entry. The first entry
should have keyboardTypeFirst = keyboardTypeLast = 0.
-------------------------------------------------------------------------------------------------
}
type
UCKeyboardTypeHeaderPtr = ^UCKeyboardTypeHeader;
UCKeyboardTypeHeader = record
keyboardTypeFirst: UInt32; { first keyboardType in this entry}
keyboardTypeLast: UInt32; { last keyboardType in this entry}
keyModifiersToTableNumOffset: UInt32; { required}
keyToCharTableIndexOffset: UInt32; { required}
keyStateRecordsIndexOffset: UInt32; { 0 => no table}
keyStateTerminatorsOffset: UInt32; { 0 => no table}
keySequenceDataIndexOffset: UInt32; { 0 => no table}
end;
type
UCKeyboardLayoutPtr = ^UCKeyboardLayout;
UCKeyboardLayout = record
{ header only; other tables accessed via offsets}
keyLayoutHeaderFormat: UInt16; { =kUCKeyLayoutHeaderFormat}
keyLayoutDataVersion: UInt16; { 0x0100 = 1.0, 0x0110 = 1.1, etc.}
keyLayoutFeatureInfoOffset: UInt32; { may be 0 }
keyboardTypeCount: UInt32; { Dimension for keyboardTypeHeadList[] }
keyboardTypeList: array [0..0] of UCKeyboardTypeHeader;
end;
{ -------------------------------------------------------------------------------------------------}
type
UCKeyLayoutFeatureInfoPtr = ^UCKeyLayoutFeatureInfo;
UCKeyLayoutFeatureInfo = record
keyLayoutFeatureInfoFormat: UInt16; { =kUCKeyLayoutFeatureInfoFormat}
reserved: UInt16;
maxOutputStringLength: UInt32; { longest possible output string}
end;
{ -------------------------------------------------------------------------------------------------}
type
UCKeyModifiersToTableNumPtr = ^UCKeyModifiersToTableNum;
UCKeyModifiersToTableNum = record
keyModifiersToTableNumFormat: UInt16; { =kUCKeyModifiersToTableNumFormat}
defaultTableNum: UInt16; { For modifier combos not in tableNum[]}
modifiersCount: UInt32; { Dimension for tableNum[]}
tableNum: array [0..0] of UInt8;
{ Then there is padding to a 4-byte boundary with bytes containing 0, if necessary.}
end;
{ -------------------------------------------------------------------------------------------------}
type
UCKeyToCharTableIndexPtr = ^UCKeyToCharTableIndex;
UCKeyToCharTableIndex = record
keyToCharTableIndexFormat: UInt16; { =kUCKeyToCharTableIndexFormat}
keyToCharTableSize: UInt16; { Max keyCode (128 for ADB keyboards)}
keyToCharTableCount: UInt32; { Dimension for keyToCharTableOffsets[] (usually 6 to 12 tables)}
keyToCharTableOffsets: array [0..0] of ByteOffset;
{ Each offset in keyToCharTableOffsets is from the beginning of the resource to a}
{ table as follows:}
{ UCKeyOutput keyToCharData[keyToCharTableSize];}
{ These tables follow the UCKeyToCharTableIndex.}
{ Then there is padding to a 4-byte boundary with bytes containing 0, if necessary.}
end;
{ -------------------------------------------------------------------------------------------------}
type
UCKeyStateRecordsIndexPtr = ^UCKeyStateRecordsIndex;
UCKeyStateRecordsIndex = record
keyStateRecordsIndexFormat: UInt16; { =kUCKeyStateRecordsIndexFormat}
keyStateRecordCount: UInt16; { Dimension for keyStateRecordOffsets[]}
keyStateRecordOffsets: array [0..0] of ByteOffset;
{ Each offset in keyStateRecordOffsets is from the beginning of the resource to a}
{ UCKeyStateRecord. These UCKeyStateRecords follow the keyStateRecordOffsets[] array.}
{ Then there is padding to a 4-byte boundary with bytes containing 0, if necessary.}
end;
{ -------------------------------------------------------------------------------------------------}
type
UCKeyStateTerminatorsPtr = ^UCKeyStateTerminators;
UCKeyStateTerminators = record
keyStateTerminatorsFormat: UInt16; { =kUCKeyStateTerminatorsFormat}
keyStateTerminatorCount: UInt16; { Dimension for keyStateTerminators[] (# of nonzero states)}
keyStateTerminators: array [0..0] of UCKeyCharSeq;
{ Note: keyStateTerminators[0] is terminator for state 1, etc.}
{ Then there is padding to a 4-byte boundary with bytes containing 0, if necessary.}
end;
{ -------------------------------------------------------------------------------------------------}
type
UCKeySequenceDataIndexPtr = ^UCKeySequenceDataIndex;
UCKeySequenceDataIndex = record
keySequenceDataIndexFormat: UInt16; { =kUCKeySequenceDataIndexFormat}
charSequenceCount: UInt16; { Dimension of charSequenceOffsets[] is charSequenceCount+1}
charSequenceOffsets: array [0..0] of UInt16;
{ Each offset in charSequenceOffsets is in bytes, from the beginning of}
{ UCKeySequenceDataIndex to a sequence of UniChars; the next offset indicates the}
{ end of the sequence. The UniChar sequences follow the UCKeySequenceDataIndex.}
{ Then there is padding to a 4-byte boundary with bytes containing 0, if necessary.}
end;
{ -------------------------------------------------------------------------------------------------}
{ Current format codes for the various tables (bits 12-15 indicate which table)}
const
kUCKeyLayoutHeaderFormat = $1002;
kUCKeyLayoutFeatureInfoFormat = $2001;
kUCKeyModifiersToTableNumFormat = $3001;
kUCKeyToCharTableIndexFormat = $4001;
kUCKeyStateRecordsIndexFormat = $5001;
kUCKeyStateTerminatorsFormat = $6001;
kUCKeySequenceDataIndexFormat = $7001;
{
-------------------------------------------------------------------------------------------------
Constants for keyAction parameter in UCKeyTranslate()
-------------------------------------------------------------------------------------------------
}
const
kUCKeyActionDown = 0; { key is going down}
kUCKeyActionUp = 1; { key is going up}
kUCKeyActionAutoKey = 2; { auto-key down}
kUCKeyActionDisplay = 3; { get information for key display (as in Key Caps) }
{
-------------------------------------------------------------------------------------------------
Bit assignments & masks for keyTranslateOptions parameter in UCKeyTranslate()
-------------------------------------------------------------------------------------------------
}
const
kUCKeyTranslateNoDeadKeysBit = 0; { Prevents setting any new dead-key states}
const
kUCKeyTranslateNoDeadKeysMask = 1 shl kUCKeyTranslateNoDeadKeysBit;
{
-------------------------------------------------------------------------------------------------
CONSTANTS & DATA STRUCTURES for Unicode Collation
-------------------------------------------------------------------------------------------------
}
{ constant for LocaleOperationClass}
const
kUnicodeCollationClass = FourCharCode('ucol');
type
CollatorRef = ^SInt32; { an opaque type }
CollatorRefPtr = ^CollatorRef; { when a var xx:CollatorRef parameter can be nil, it is changed to xx: CollatorRefPtr }
UCCollateOptions = UInt32;
const
{ Sensitivity options}
kUCCollateComposeInsensitiveMask = 1 shl 1;
kUCCollateWidthInsensitiveMask = 1 shl 2;
kUCCollateCaseInsensitiveMask = 1 shl 3;
kUCCollateDiacritInsensitiveMask = 1 shl 4; { Other general options }
kUCCollatePunctuationSignificantMask = 1 shl 15; { Number-handling options }
kUCCollateDigitsOverrideMask = 1 shl 16;
kUCCollateDigitsAsNumberMask = 1 shl 17;
const
kUCCollateStandardOptions = kUCCollateComposeInsensitiveMask or kUCCollateWidthInsensitiveMask;
{
Special values to specify various invariant orders for UCCompareTextNoLocale.
These values use the high 8 bits of UCCollateOptions.
}
const
kUCCollateTypeHFSExtended = 1;
{ These constants are used for masking and shifting the invariant order type.}
const
kUCCollateTypeSourceMask = $000000FF;
kUCCollateTypeShiftBits = 24;
const
kUCCollateTypeMask = kUCCollateTypeSourceMask shl kUCCollateTypeShiftBits;
type
UCCollationValue = UInt32;
UCCollationValuePtr = ^UCCollationValue;
{
-------------------------------------------------------------------------------------------------
CONSTANTS & DATA STRUCTURES for Unicode TypeSelect
-------------------------------------------------------------------------------------------------
}
{
UCTypeSelectRef
This is the single opaque object needed to implement the Unicode TypeSelect
utilities. It is created and initialized via a call to UCTypeSelectCreateSelector
}
type
UCTypeSelectRef = ^SInt32; { an opaque type }
{
UCTypeSelectCompareResult
Used as the return value for UCTypeSelectCompare()
}
type
UCTypeSelectCompareResult = SInt32;
{
UCTSWalkDirection
Used for UCTypeSelectWalkList to determine the direction of the walk
}
type
UCTSWalkDirection = UInt16;
UCTSWalkDirectionPtr = ^UCTSWalkDirection;
const
kUCTSDirectionNext = 0;
kUCTSDirectionPrevious = 1;
{
UCTypeSelectOptions
These constants may be returned from an IndexToUCString callback function
in the location pointed to by the tsOptions parameter. *tsOptions is pre-
initialized to zero before the callback function is called. A callback
function does not need to set *tsOptions unless it wants behavior different
from the default.
kUCTSOptionsReleaseStringMask: indicates that UCTypeSelectFindItem should
release the CFStringRef returned by the IndexToUCString callback function
once it is done with the string. If this bit is not set, the string will
not be released.
kUCTSOptionsDataIsOrderedMask: indicates that the data being returned by the
IndexToUCString callback is already in the correct alphabetical order. If so,
UCTypeSelectFindItem can optimize its search through the data to find the closest
matching item.
}
type
UCTypeSelectOptions = UInt16;
UCTypeSelectOptionsPtr = ^UCTypeSelectOptions;
const
kUCTSOptionsNoneMask = 0;
kUCTSOptionsReleaseStringMask = 1;
kUCTSOptionsDataIsOrderedMask = 2;
{
IndexToUCStringProcPtr
This is the type used to define the user's IndexToUCString callback
}
type
IndexToUCStringProcPtr = function( index: UInt32; listDataPtr: UnivPtr; refcon: UnivPtr; var outString: CFStringRef; var tsOptions: UCTypeSelectOptions ): Boolean;
type
IndexToUCStringUPP = IndexToUCStringProcPtr;
{
* NewIndexToUCStringUPP()
*
* Availability:
* Mac OS X: in version 10.4 and later in CoreServices.framework
* CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
* Non-Carbon CFM: available as macro/inline
}
function NewIndexToUCStringUPP( userRoutine: IndexToUCStringProcPtr ): IndexToUCStringUPP; external name '_NewIndexToUCStringUPP';
(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
{
* DisposeIndexToUCStringUPP()
*
* Availability:
* Mac OS X: in version 10.4 and later in CoreServices.framework
* CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
* Non-Carbon CFM: available as macro/inline
}
procedure DisposeIndexToUCStringUPP( userUPP: IndexToUCStringUPP ); external name '_DisposeIndexToUCStringUPP';
(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
{
* InvokeIndexToUCStringUPP()
*
* Availability:
* Mac OS X: in version 10.4 and later in CoreServices.framework
* CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
* Non-Carbon CFM: available as macro/inline
}
function InvokeIndexToUCStringUPP( index: UInt32; listDataPtr: UnivPtr; refcon: UnivPtr; var outString: CFStringRef; var tsOptions: UCTypeSelectOptions; userUPP: IndexToUCStringUPP ): Boolean; external name '_InvokeIndexToUCStringUPP';
(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
{
kUCTypeSelectMaxListSize can be used for any listSize arguement
when the length of the list is unknown.
}
const
kUCTypeSelectMaxListSize = $FFFFFFFF;
{
-------------------------------------------------------------------------------------------------
CONSTANTS & DATA STRUCTURES for Unicode TextBreak
-------------------------------------------------------------------------------------------------
}
{ constant for LocaleOperationClass}
const
kUnicodeTextBreakClass = FourCharCode('ubrk');
type
TextBreakLocatorRef = ^SInt32; { an opaque type }
TextBreakLocatorRefPtr = ^TextBreakLocatorRef; { when a var xx:TextBreakLocatorRef parameter can be nil, it is changed to xx: TextBreakLocatorRefPtr }
{
* UCTextBreakType
*
* Discussion:
* Specifies kinds of text boundaries.
}
type
UCTextBreakType = UInt32;
const
{
* If the bit specified by this mask is set, boundaries of characters
* may be located (with surrogate pairs treated as a single
* character).
}
kUCTextBreakCharMask = 1 shl 0;
{
* If the bit specified by this mask is set, boundaries of character
* clusters may be located. A cluster is a group of characters that
* should be treated as single text element for editing operations
* such as cursor movement. Typically this includes groups such as a
* base character followed by a sequence of combining characters, for
* example, a Hangul syllable represented as a sequence of conjoining
* jamo characters or an Indic consonant cluster.
}
kUCTextBreakClusterMask = 1 shl 2;
{
* If the bit specified by this mask is set, boundaries of words may
* be located. This can be used to determine what to highlight as the
* result of a double-click.
}
kUCTextBreakWordMask = 1 shl 4;
kUCTextBreakLineMask = 1 shl 6;
{
* If the bit specified by this mask is set, boundaries of paragraphs
* may be located. This just finds the next hard-line break as
* defined by the Unicode standard.
}
kUCTextBreakParagraphMask = 1 shl 8;
type
UCTextBreakOptions = UInt32;
const
kUCTextBreakLeadingEdgeMask = 1 shl 0;
kUCTextBreakGoBackwardsMask = 1 shl 1;
kUCTextBreakIterateMask = 1 shl 2;
{
-------------------------------------------------------------------------------------------------
FUNCTION PROTOTYPES
-------------------------------------------------------------------------------------------------
}
{
* UCKeyTranslate()
*
* Availability:
* Mac OS X: in version 10.0 and later in CoreServices.framework
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in UnicodeUtilitiesCoreLib 8.5 and later
}
function UCKeyTranslate( const (*var*) keyLayoutPtr: UCKeyboardLayout; virtualKeyCode: UInt16; keyAction: UInt16; modifierKeyState: UInt32; keyboardType: UInt32; keyTranslateOptions: OptionBits; var deadKeyState: UInt32; maxStringLength: UniCharCount; var actualStringLength: UniCharCount; unicodeString: {variable-size-array} UniCharPtr ): OSStatus; external name '_UCKeyTranslate';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
{ Standard collation functions}
{
* UCCreateCollator()
*
* Availability:
* Mac OS X: in version 10.0 and later in CoreServices.framework
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in UnicodeUtilitiesLib 8.6 and later
}
function UCCreateCollator( locale: LocaleRef; opVariant: LocaleOperationVariant; options: UCCollateOptions; var collatorRef_: CollatorRef ): OSStatus; external name '_UCCreateCollator';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
{
* UCGetCollationKey()
*
* Availability:
* Mac OS X: in version 10.0 and later in CoreServices.framework
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in UnicodeUtilitiesLib 8.6 and later
}
function UCGetCollationKey( collatorRef_: CollatorRef; textPtr: ConstUniCharPtr; textLength: UniCharCount; maxKeySize: ItemCount; var actualKeySize: ItemCount; collationKey: {variable-size-array} UCCollationValuePtr ): OSStatus; external name '_UCGetCollationKey';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
{
* UCCompareCollationKeys()
*
* Availability:
* Mac OS X: in version 10.0 and later in CoreServices.framework
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in UnicodeUtilitiesCoreLib 8.6 and later
}
function UCCompareCollationKeys( key1Ptr: UCCollationValuePtr; key1Length: ItemCount; key2Ptr: UCCollationValuePtr; key2Length: ItemCount; var equivalent: Boolean; var order: SInt32 ): OSStatus; external name '_UCCompareCollationKeys';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
{
* UCCompareText()
*
* Availability:
* Mac OS X: in version 10.0 and later in CoreServices.framework
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in UnicodeUtilitiesLib 8.6 and later
}
function UCCompareText( collatorRef_: CollatorRef; text1Ptr: ConstUniCharPtr; text1Length: UniCharCount; text2Ptr: ConstUniCharPtr; text2Length: UniCharCount; var equivalent: Boolean; var order: SInt32 ): OSStatus; external name '_UCCompareText';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
{
* UCDisposeCollator()
*
* Availability:
* Mac OS X: in version 10.0 and later in CoreServices.framework
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in UnicodeUtilitiesLib 8.6 and later
}
function UCDisposeCollator( var collatorRef_: CollatorRef ): OSStatus; external name '_UCDisposeCollator';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
{ Simple collation using default locale}
{
* UCCompareTextDefault()
*
* Availability:
* Mac OS X: in version 10.0 and later in CoreServices.framework
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in UnicodeUtilitiesLib 8.6 and later
}
function UCCompareTextDefault( options: UCCollateOptions; text1Ptr: ConstUniCharPtr; text1Length: UniCharCount; text2Ptr: ConstUniCharPtr; text2Length: UniCharCount; var equivalent: Boolean; var order: SInt32 ): OSStatus; external name '_UCCompareTextDefault';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
{ Simple locale-independent collation}
{
* UCCompareTextNoLocale()
*
* Availability:
* Mac OS X: in version 10.0 and later in CoreServices.framework
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in UnicodeUtilitiesCoreLib 8.6 and later
}
function UCCompareTextNoLocale( options: UCCollateOptions; text1Ptr: ConstUniCharPtr; text1Length: UniCharCount; text2Ptr: ConstUniCharPtr; text2Length: UniCharCount; var equivalent: Boolean; var order: SInt32 ): OSStatus; external name '_UCCompareTextNoLocale';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
{
*===============================================================================
* Text break (text boundary) functions
*
* These are deprecated. Replacements are as follows:
*
* 1. To determine locale-sensitive text breaks for word, line, sentence and
* paragraph boundaries, use the CFStringTokenizer functions:
* CFStringTokenizerCreate (balanced by CFRelease), CFStringTokenizerAdvanceToNextToken
* or CFStringTokenizerGoToTokenAtIndex, then CFStringTokenizerGetCurrentTokenRange...
*
* 2. To determine cluster breaks, use CFStringGetRangeOfComposedCharactersAtIndex.
*
* 3. For handling character boundaries / surrogate pairs in UTF16 text, the
* following inline functions are available in CFString.h:
* CFStringIsSurrogateHighCharacter, CFStringIsSurrogateLowCharacter,
* CFStringGetLongCharacterForSurrogatePair, and CFStringGetSurrogatePairForLongCharacter.
* However, CFString clients do not usually need to worry about handling surrogate pairs
* directly.
*
*===============================================================================
}
{
* UCCreateTextBreakLocator() *** DEPRECATED ***
*
* Deprecated:
* Use CFStringTokenizer functions or
* CFStringGetRangeOfComposedCharactersAtIndex, see discussion above
* for details.
*
* Availability:
* Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.6
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in UnicodeUtilitiesLib 9.0 and later
}
function UCCreateTextBreakLocator( locale: LocaleRef; opVariant: LocaleOperationVariant; breakTypes: UCTextBreakType; var breakRef: TextBreakLocatorRef ): OSStatus; external name '_UCCreateTextBreakLocator';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)
{
* UCFindTextBreak() *** DEPRECATED ***
*
* Deprecated:
* Use CFStringTokenizer functions or
* CFStringGetRangeOfComposedCharactersAtIndex, see discussion above
* for details.
*
* Availability:
* Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.6
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in UnicodeUtilitiesLib 9.0 and later
}
function UCFindTextBreak( breakRef: TextBreakLocatorRef; breakType: UCTextBreakType; options: UCTextBreakOptions; textPtr: ConstUniCharPtr; textLength: UniCharCount; startOffset: UniCharArrayOffset; var breakOffset: UniCharArrayOffset ): OSStatus; external name '_UCFindTextBreak';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)
{
* UCDisposeTextBreakLocator() *** DEPRECATED ***
*
* Deprecated:
* Use CFStringTokenizer functions or
* CFStringGetRangeOfComposedCharactersAtIndex, see discussion above
* for details.
*
* Availability:
* Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.6
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in UnicodeUtilitiesLib 9.0 and later
}
function UCDisposeTextBreakLocator( var breakRef: TextBreakLocatorRef ): OSStatus; external name '_UCDisposeTextBreakLocator';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)
{
-------------------------------------------------------------------------------------------------
UNICODE TYPESELECT - FUNCTION APIs
-------------------------------------------------------------------------------------------------
}
{
* UCTypeSelectCreateSelector()
*
* Summary:
* Responsible for creating the opaque UCTypeSelectRef object.
*
* Parameters:
*
* locale:
* LocaleRef obtained by client from a call such as
* LocaleRefFromLangOrRegionCode. This can be set to NULL if the
* default system locale is desired.
*
* opVariant:
* Variant of the locale. Specify 0 if no variant is needed.
*
* options:
* Any collation options the client wishes to specify. These will
* have an impact on the order in which selection will occur.
* Specify kUCCollateStandardOptions for the default options.
*
* newSelector:
* The newly created UCTypeSelectRef object.
*
* Result:
* Will return paramErr if newSelector is NULL, or any other error
* that may be returned by an internal function call.
*
* Availability:
* Mac OS X: in version 10.4 and later in CoreServices.framework
* CarbonLib: not available in CarbonLib 1.x
* Non-Carbon CFM: not available
}
function UCTypeSelectCreateSelector( locale: LocaleRef { can be NULL }; opVariant: LocaleOperationVariant; options: UCCollateOptions; var newSelector: UCTypeSelectRef ): OSStatus; external name '_UCTypeSelectCreateSelector';
(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
{
* UCTypeSelectFlushSelectorData()
*
* Summary:
* Flushes the key list and resets the timeout timer for the
* UCTypeSelectRef.
*
* Parameters:
*
* ref:
* UCTypeSelectRef to be flushed.
*
* Result:
* Returns paramErr if ref is invalid.
*
* Availability:
* Mac OS X: in version 10.4 and later in CoreServices.framework
* CarbonLib: not available in CarbonLib 1.x
* Non-Carbon CFM: not available
}
function UCTypeSelectFlushSelectorData( ref: UCTypeSelectRef ): OSStatus; external name '_UCTypeSelectFlushSelectorData';
(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
{
* UCTypeSelectReleaseSelector()
*
* Summary:
* Cleans up and disposes of any temporary memory acquired by the
* UCTypeSelectRef object.
*
* Parameters:
*
* ref:
* A pointer to the UCTypeSelectRef to be disposed of. On exit,
* the UCTypeSelectRef to which this parameter points will be set
* to NULL.
*
* Result:
* Returns paramErr if ref is invalid.
*
* Availability:
* Mac OS X: in version 10.4 and later in CoreServices.framework
* CarbonLib: not available in CarbonLib 1.x
* Non-Carbon CFM: not available
}
function UCTypeSelectReleaseSelector( var ref: UCTypeSelectRef ): OSStatus; external name '_UCTypeSelectReleaseSelector';
(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
{
* UCTypeSelectWouldResetBuffer()
*
* Summary:
* Indicates whether, if the specified text were added to the
* buffer, the current text in the buffer would be discarded.
*
* Parameters:
*
* inRef:
* The type-selection object.
*
* inText:
* The text that would be added to the buffer. Some text (such as
* Backspace, Enter, and Clear keys) always causes the buffer to
* be reset. May be NULL; in that case, the implementation only
* considers the event time.
*
* inEventTime:
* The time in seconds since boot (as returned by
* GetCurrentEventTime) that the text event occurred. If the event
* occurred at a time greater than the type-select timeout, then
* the current buffered text would be discarded.
*
* Result:
* Whether the current text in the buffer would be discarded while
* processing the specified text.
*
* Availability:
* Mac OS X: in version 10.4 and later in CoreServices.framework
* CarbonLib: not available in CarbonLib 1.x
* Non-Carbon CFM: not available
}
function UCTypeSelectWouldResetBuffer( inRef: UCTypeSelectRef; inText: CFStringRef { can be NULL }; inEventTime: Float64 ): Boolean; external name '_UCTypeSelectWouldResetBuffer';
(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
{
* UCTypeSelectAddKeyToSelector()
*
* Summary:
* Appends the given Unicode values to the selector's internal
* buffer of keystrokes. It also handles timeouts and delete/clear
* keys. If the key sent is a delete/clear/esc code, the key buffer
* will be flushed and false will be returned.
*
* Parameters:
*
* inRef:
* The type-selection object.
*
* inText:
* A CFString that contains the keystroke to be added.
*
* inEventTime:
* The time in seconds since boot (as returned by
* GetCurrentEventTime) that the text event occurred. If zero is
* passed, then the current time is used automatically.
*
* updateFlag:
* On exit, notifies the client if it needs to update its current
* selection, as follows:
*
* TRUE - indicates that the client needs to update its selection
* based on the keystroke passed in. A call to UCTypeSelectCompare
* or UCTypeSelectFindItem should be made to find the new item to
* select based on the new keys added.
*
* FALSE - indicates that the client does not need to update its
* selection. This would occur if a delete/clear/esc key was
* passed in.
*
* Result:
* returns paramErr if ref or textPtr are invalid. Can also return
* other errors from intermediate function calls.
*
* Availability:
* Mac OS X: in version 10.4 and later in CoreServices.framework
* CarbonLib: not available in CarbonLib 1.x
* Non-Carbon CFM: not available
}
function UCTypeSelectAddKeyToSelector( inRef: UCTypeSelectRef; inText: CFStringRef; inEventTime: Float64; var updateFlag: Boolean ): OSStatus; external name '_UCTypeSelectAddKeyToSelector';
(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
{
* UCTypeSelectCompare()
*
* Summary:
* Compares the Unicode text buffer passed in inText with the
* keystroke buffer stored in the UCTypeSelectRef. This function
* works the same as the non-Unicode TypeSelectCompare() call.
*
* Parameters:
*
* ref:
* UCTypeSelectRef to which the Unicode text sent in inText will
* be compared.
*
* inText:
* A reference to the text to be compared
*
* result:
* Just as in TypeSelectCompare(), the following values are
* returned: -1 if characters in UCTypeSelectRefÕs keystroke
* buffer sort before those in inText, 0 if characters in
* UCTypeSelectRefÕs keystroke buffer are the same as those in
* inText, and 1 if the characters in UCTypeSelectRefÕs keystroke
* buffer sort after those in inText.
*
* Result:
* This function can return three different types of values. First,
* it will return paramErr if ref, inText, or result are invalid.
* Second, if there have been no keys added to the UCTypeSelectRef
* via calls to UCTypeSelectAddKeyToSelectorData(),
* kUCTSNoKeysAddedToObjectErr will be returned. Finally, it can
* also return other errors should any be encountered by
* intermediate function calls.
*
* Availability:
* Mac OS X: in version 10.4 and later in CoreServices.framework
* CarbonLib: not available in CarbonLib 1.x
* Non-Carbon CFM: not available
}
function UCTypeSelectCompare( ref: UCTypeSelectRef; inText: CFStringRef; var result: UCTypeSelectCompareResult ): OSStatus; external name '_UCTypeSelectCompare';
(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
{
* UCTypeSelectFindItem()
*
* Summary:
* In a given list, pointed to by listDataPtr, find the closest
* match to the keystrokes stored in the UCTypeSelectRef. The
* closest matchÕs index will be returned in closestItem. The list
* to be searched may be ordered or unordered. In order for this
* call to work, the client needs to provide a an IndexToUCString
* callback UPP. This callback is necessary in order to provide the
* client with data structure independence through client-side
* indexing.
*
* Parameters:
*
* ref:
* UCTypeSelectRef holding the state and keystrokes to be compared.
*
* listSize:
* Size of the list to be searched through. If the size of the
* list is unknown, pass in kUCTypeSelectMaxListSize (0xFFFFFFFF)
* and have the IndexToUCString function return false after it has
* reached the last item in the list.
*
* listDataPtr:
* Pointer to the head or first node of the clientÕs data
* structure. This will be passed into to the clientÕs
* IndexToUCString function. Can be NULL, depending on the
* clientÕs IndexToUCString implementation.
*
* refcon:
* Any parameter the calling function wishes to pass as a
* reference into its IndexToUCString callback function. This
* parameter can be set to NULL if not needed.
*
* userUPP:
* The UPP pointing to the clientÕs IndexToUCString callback
* function.
*
* closestItem:
* Upon return, this will contain the index of the item that
* matches the text in the keystroke buffer of UCTypeSelectRef.
*
* Result:
* This function has four possibilities for return values. First,
* paramErr will be returned if ref or closestItem are invalid.
* Second, if the search list is empty or if the first item cannot
* be read, kUCTSSearchListErr will be returned. Third, if there
* have been no keys added to the UCTypeSelectRef via calls to
* UCTypeSelectAddKeyToSelectorData(), kUCTSNoKeysAddedToObjectErr
* will be returned. Finally, this function can return other OS
* errors should any be encountered by an internal function call.
*
* Availability:
* Mac OS X: in version 10.4 and later in CoreServices.framework
* CarbonLib: not available in CarbonLib 1.x
* Non-Carbon CFM: not available
}
function UCTypeSelectFindItem( ref: UCTypeSelectRef; listSize: UInt32; listDataPtr: UnivPtr { can be NULL }; refcon: UnivPtr { can be NULL }; userUPP: IndexToUCStringUPP; var closestItem: UInt32 ): OSStatus; external name '_UCTypeSelectFindItem';
(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
{
* UCTypeSelectWalkList()
*
* Summary:
* UCTypeSelectWalkList can perform an in-order alphabetical walk of
* an unsorted list. To do this, the client passes a pointer to the
* current selectionÕs text in the currSelect parameter.
* UCTypeSelectWalkList will then search the list pointed to by
* listDataPtr for the closest item that is lexicographically either
* right before or right after the selected item. The client can
* choose which one to be returned by setting the direction
* parameter to kUCTSDirectionPrevious or kUCTSDirectionNext to get
* the item either lexicographically right before or after
* respectively. This call will not walk off the end of the list or
* do any wraparound searching. That is, if the item selected is the
* last item in the list and kUCDirectionNext is specified for the
* direction, that same item will be returned. Likewise for the case
* where the first item is selected nd kUCTSDirectionPrevious is
* specified. In order for this call to work, the client needs to
* provide an IndexToUCString callback UPP. This callback is
* necessary in order to provide the client with data structure
* independence through client-side indexing.
*
* Parameters:
*
* ref:
* UCTypeSelectRef holding state information as well as the
* function pointer needed to call the clientÕs IndexToUCString
* function
*
* currSelect:
* CFString reference to the current selectionÕs text.
*
* direction:
* The direction of the walk. The valid values for this parameter
* are:
*
* kUCTSDirectionNext - find the next item in the list
* kUCTSDirectionPrevious - find the previous item in the list
*
*
* If kUCTSDirectionNext is specified and the selected item is the
* last item in the list or if kUCTSDirectionPrevious is specified
* and the selected item is the first item in the list, the index
* of the selected item will be returned in closestItem.
*
* listSize:
* Size of the list to be searched through. If the size of the
* list is unknown, pass in kUCTypeSelectMaxListSize (0xFFFFFFFF)
* and have the IndexToUCString function return false after it has
* reached the last item in the list.
*
* listDataPtr:
* Pointer to the head or first node of the clientÕs data
* structure. This will be passed into to the clientÕs
* IndexToUCString function. Can be NULL, depending on the
* clientÕs IndexToUCString implementation.
*
* refcon:
* Any parameter the calling function wishes to pass as a
* reference into its IndexToUCString callback function. This
* parameter can be set to NULL if not needed.
*
* userUPP:
* The UPP pointing to the clientÕs IndexToUCString callback
* function.
*
* closestItem:
* Upon return, this will contain the index of the item that
* matches the text in the keystroke buffer of UCTypeSelectRef.
*
* Result:
* This function has three possibilities for return values. First,
* paramErr will be returned if ref, currSelect, or closestItem are
* invalid. Second, if the search list is empty or if the first item
* cannot be read, kUCTSSearchListErr will be returned. Finally,
* this function can return other OS errors should any be
* encountered by an internal function call.
*
* Availability:
* Mac OS X: in version 10.4 and later in CoreServices.framework
* CarbonLib: not available in CarbonLib 1.x
* Non-Carbon CFM: not available
}
function UCTypeSelectWalkList( ref: UCTypeSelectRef; currSelect: CFStringRef; direction: UCTSWalkDirection; listSize: UInt32; listDataPtr: UnivPtr { can be NULL }; refcon: UnivPtr { can be NULL }; userUPP: IndexToUCStringUPP; var closestItem: UInt32 ): OSStatus; external name '_UCTypeSelectWalkList';
(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
{$endc} {TARGET_OS_MAC}
{$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
end.
{$endc} {not MACOSALLINCLUDE}
|