2 * Copyright 1996, 1997, 1998 Computing Research Labs,
3 * New Mexico State University
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
20 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 static char rcsid
[] __attribute__ ((unused
)) = "$Id: ucdata.c,v 1.1 1999/01/08 00:19:11 ftang%netscape.com Exp $";
27 static char rcsid
[] = "$Id: ucdata.c,v 1.1 1999/01/08 00:19:11 ftang%netscape.com Exp $";
40 /**************************************************************************
42 * Miscellaneous types, data, and support functions.
44 **************************************************************************/
51 unsigned short len
[2];
56 * A simple array of 32-bit masks for lookup.
58 static unsigned long masks32
[32] = {
59 0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020,
60 0x00000040, 0x00000080, 0x00000100, 0x00000200, 0x00000400, 0x00000800,
61 0x00001000, 0x00002000, 0x00004000, 0x00008000, 0x00010000, 0x00020000,
62 0x00040000, 0x00080000, 0x00100000, 0x00200000, 0x00400000, 0x00800000,
63 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000,
64 0x40000000, 0x80000000
67 #define endian_short(cc) (((cc) >> 8) | (((cc) & 0xff) << 8))
68 #define endian_long(cc) ((((cc) & 0xff) << 24)|((((cc) >> 8) & 0xff) << 16)|\
69 ((((cc) >> 16) & 0xff) << 8)|((cc) >> 24))
73 _ucopenfile(char *paths
, char *filename
, char *mode
)
75 _ucopenfile(paths
, filename
, mode
)
76 char *paths
, *filename
, *mode
;
80 char *fp
, *dp
, *pp
, path
[BUFSIZ
];
82 if (filename
== 0 || *filename
== 0)
88 while (*dp
&& *dp
!= ':')
97 if ((f
= fopen(path
, mode
)) != 0)
107 /**************************************************************************
109 * Support for the character properties.
111 **************************************************************************/
113 static unsigned long _ucprop_size
;
114 static unsigned short *_ucprop_offsets
;
115 static unsigned long *_ucprop_ranges
;
119 _ucprop_load(char *paths
, int reload
)
121 _ucprop_load(paths
, reload
)
127 unsigned long size
, i
;
130 if (_ucprop_size
> 0) {
133 * The character properties have already been loaded.
138 * Unload the current character property data in preparation for
139 * loading a new copy. Only the first array has to be deallocated
140 * because all the memory for the arrays is allocated as a single
143 free((char *) _ucprop_offsets
);
147 if ((in
= _ucopenfile(paths
, "ctype.dat", "rb")) == 0)
153 fread((char *) &hdr
, sizeof(_ucheader_t
), 1, in
);
155 if (hdr
.bom
== 0xfffe) {
156 hdr
.cnt
= endian_short(hdr
.cnt
);
157 hdr
.size
.bytes
= endian_long(hdr
.size
.bytes
);
160 if ((_ucprop_size
= hdr
.cnt
) == 0) {
166 * Allocate all the storage needed for the lookup table.
168 _ucprop_offsets
= (unsigned short *) malloc(hdr
.size
.bytes
);
171 * Calculate the offset into the storage for the ranges. The offsets
172 * array is on a 4-byte boundary and one larger than the value provided in
173 * the header count field. This means the offset to the ranges must be
174 * calculated after aligning the count to a 4-byte boundary.
176 if ((size
= ((hdr
.cnt
+ 1) * sizeof(unsigned short))) & 3)
177 size
+= 4 - (size
& 3);
179 _ucprop_ranges
= (unsigned long *) (_ucprop_offsets
+ size
);
182 * Load the offset array.
184 fread((char *) _ucprop_offsets
, sizeof(unsigned short), size
, in
);
187 * Do an endian swap if necessary. Don't forget there is an extra node on
188 * the end with the final index.
190 if (hdr
.bom
== 0xfffe) {
191 for (i
= 0; i
<= _ucprop_size
; i
++)
192 _ucprop_offsets
[i
] = endian_short(_ucprop_offsets
[i
]);
196 * Load the ranges. The number of elements is in the last array position
199 fread((char *) _ucprop_ranges
, sizeof(unsigned long),
200 _ucprop_offsets
[_ucprop_size
], in
);
205 * Do an endian swap if necessary.
207 if (hdr
.bom
== 0xfffe) {
208 for (i
= 0; i
< _ucprop_offsets
[_ucprop_size
]; i
++)
209 _ucprop_ranges
[i
] = endian_long(_ucprop_ranges
[i
]);
220 if (_ucprop_size
== 0)
224 * Only need to free the offsets because the memory is allocated as a
227 free((char *) _ucprop_offsets
);
233 _ucprop_lookup(unsigned long code
, unsigned long n
)
235 _ucprop_lookup(code
, n
)
236 unsigned long code
, n
;
242 * There is an extra node on the end of the offsets to allow this routine
243 * to work right. If the index is 0xffff, then there are no nodes for the
246 if ((l
= _ucprop_offsets
[n
]) == 0xffff)
250 * Locate the next offset that is not 0xffff. The sentinel at the end of
251 * the array is the max index value.
254 n
+ m
< _ucprop_size
&& _ucprop_offsets
[n
+ m
] == 0xffff; m
++) ;
256 r
= _ucprop_offsets
[n
+ m
] - 1;
260 * Determine a "mid" point and adjust to make sure the mid point is at
261 * the beginning of a range pair.
265 if (code
> _ucprop_ranges
[m
+ 1])
267 else if (code
< _ucprop_ranges
[m
])
269 else if (code
>= _ucprop_ranges
[m
] && code
<= _ucprop_ranges
[m
+ 1])
277 ucisprop(unsigned long code
, unsigned long mask1
, unsigned long mask2
)
279 ucisprop(code
, mask1
, mask2
)
280 unsigned long code
, mask1
, mask2
;
285 if (mask1
== 0 && mask2
== 0)
288 for (i
= 0; mask1
&& i
< 32; i
++) {
289 if ((mask1
& masks32
[i
]) && _ucprop_lookup(code
, i
))
293 for (i
= 32; mask2
&& i
< _ucprop_size
; i
++) {
294 if ((mask2
& masks32
[i
& 31]) && _ucprop_lookup(code
, i
))
301 /**************************************************************************
303 * Support for case mapping.
305 **************************************************************************/
307 static unsigned long _uccase_size
;
308 static unsigned short _uccase_len
[2];
309 static unsigned long *_uccase_map
;
313 _uccase_load(char *paths
, int reload
)
315 _uccase_load(paths
, reload
)
324 if (_uccase_size
> 0) {
327 * The case mappings have already been loaded.
331 free((char *) _uccase_map
);
335 if ((in
= _ucopenfile(paths
, "case.dat", "rb")) == 0)
341 fread((char *) &hdr
, sizeof(_ucheader_t
), 1, in
);
343 if (hdr
.bom
== 0xfffe) {
344 hdr
.cnt
= endian_short(hdr
.cnt
);
345 hdr
.size
.len
[0] = endian_short(hdr
.size
.len
[0]);
346 hdr
.size
.len
[1] = endian_short(hdr
.size
.len
[1]);
350 * Set the node count and lengths of the upper and lower case mapping
353 _uccase_size
= hdr
.cnt
* 3;
354 _uccase_len
[0] = hdr
.size
.len
[0] * 3;
355 _uccase_len
[1] = hdr
.size
.len
[1] * 3;
357 _uccase_map
= (unsigned long *)
358 malloc(_uccase_size
* sizeof(unsigned long));
361 * Load the case mapping table.
363 fread((char *) _uccase_map
, sizeof(unsigned long), _uccase_size
, in
);
366 * Do an endian swap if necessary.
368 if (hdr
.bom
== 0xfffe) {
369 for (i
= 0; i
< _uccase_size
; i
++)
370 _uccase_map
[i
] = endian_long(_uccase_map
[i
]);
381 if (_uccase_size
== 0)
384 free((char *) _uccase_map
);
390 _uccase_lookup(unsigned long code
, long l
, long r
, int field
)
392 _uccase_lookup(code
, l
, r
, field
)
401 * Do the binary search.
405 * Determine a "mid" point and adjust to make sure the mid point is at
406 * the beginning of a case mapping triple.
410 if (code
> _uccase_map
[m
])
412 else if (code
< _uccase_map
[m
])
414 else if (code
== _uccase_map
[m
])
415 return _uccase_map
[m
+ field
];
423 uctoupper(unsigned long code
)
435 if (ucislower(code
)) {
437 * The character is lower case.
441 r
= (l
+ _uccase_len
[1]) - 1;
444 * The character is title case.
447 l
= _uccase_len
[0] + _uccase_len
[1];
448 r
= _uccase_size
- 1;
450 return _uccase_lookup(code
, l
, r
, field
);
455 uctolower(unsigned long code
)
467 if (ucisupper(code
)) {
469 * The character is upper case.
473 r
= _uccase_len
[0] - 1;
476 * The character is title case.
479 l
= _uccase_len
[0] + _uccase_len
[1];
480 r
= _uccase_size
- 1;
482 return _uccase_lookup(code
, l
, r
, field
);
487 uctotitle(unsigned long code
)
500 * The offset will always be the same for converting to title case.
504 if (ucisupper(code
)) {
506 * The character is upper case.
509 r
= _uccase_len
[0] - 1;
512 * The character is lower case.
515 r
= (l
+ _uccase_len
[1]) - 1;
517 return _uccase_lookup(code
, l
, r
, field
);
520 /**************************************************************************
522 * Support for decompositions.
524 **************************************************************************/
526 static unsigned long _ucdcmp_size
;
527 static unsigned long *_ucdcmp_nodes
;
528 static unsigned long *_ucdcmp_decomp
;
532 _ucdcmp_load(char *paths
, int reload
)
534 _ucdcmp_load(paths
, reload
)
540 unsigned long size
, i
;
543 if (_ucdcmp_size
> 0) {
546 * The decompositions have already been loaded.
550 free((char *) _ucdcmp_nodes
);
554 if ((in
= _ucopenfile(paths
, "decomp.dat", "rb")) == 0)
560 fread((char *) &hdr
, sizeof(_ucheader_t
), 1, in
);
562 if (hdr
.bom
== 0xfffe) {
563 hdr
.cnt
= endian_short(hdr
.cnt
);
564 hdr
.size
.bytes
= endian_long(hdr
.size
.bytes
);
567 _ucdcmp_size
= hdr
.cnt
<< 1;
568 _ucdcmp_nodes
= (unsigned long *) malloc(hdr
.size
.bytes
);
569 _ucdcmp_decomp
= _ucdcmp_nodes
+ (_ucdcmp_size
+ 1);
572 * Read the decomposition data in.
574 size
= hdr
.size
.bytes
/ sizeof(unsigned long);
575 fread((char *) _ucdcmp_nodes
, sizeof(unsigned long), size
, in
);
578 * Do an endian swap if necessary.
580 if (hdr
.bom
== 0xfffe) {
581 for (i
= 0; i
< size
; i
++)
582 _ucdcmp_nodes
[i
] = endian_long(_ucdcmp_nodes
[i
]);
593 if (_ucdcmp_size
== 0)
597 * Only need to free the offsets because the memory is allocated as a
600 free((char *) _ucdcmp_nodes
);
606 ucdecomp(unsigned long code
, unsigned long *num
, unsigned long **decomp
)
608 ucdecomp(code
, num
, decomp
)
609 unsigned long code
, *num
, **decomp
;
615 r
= _ucdcmp_nodes
[_ucdcmp_size
] - 1;
619 * Determine a "mid" point and adjust to make sure the mid point is at
620 * the beginning of a code+offset pair.
624 if (code
> _ucdcmp_nodes
[m
])
626 else if (code
< _ucdcmp_nodes
[m
])
628 else if (code
== _ucdcmp_nodes
[m
]) {
629 *num
= _ucdcmp_nodes
[m
+ 3] - _ucdcmp_nodes
[m
+ 1];
630 *decomp
= &_ucdcmp_decomp
[_ucdcmp_nodes
[m
+ 1]];
639 ucdecomp_hangul(unsigned long code
, unsigned long *num
, unsigned long decomp
[])
641 ucdecomp_hangul(code
, num
, decomp
)
642 unsigned long code
, *num
, decomp
[];
645 if (!ucishangul(code
))
649 decomp
[0] = 0x1100 + (unsigned long) (code
/ 588);
650 decomp
[1] = 0x1161 + (unsigned long) ((code
% 588) / 28);
651 decomp
[2] = 0x11a7 + (unsigned long) (code
% 28);
652 *num
= (decomp
[2] != 0x11a7) ? 3 : 2;
657 /**************************************************************************
659 * Support for combining classes.
661 **************************************************************************/
663 static unsigned long _uccmcl_size
;
664 static unsigned long *_uccmcl_nodes
;
668 _uccmcl_load(char *paths
, int reload
)
670 _uccmcl_load(paths
, reload
)
679 if (_uccmcl_size
> 0) {
682 * The combining classes have already been loaded.
686 free((char *) _uccmcl_nodes
);
690 if ((in
= _ucopenfile(paths
, "cmbcl.dat", "rb")) == 0)
696 fread((char *) &hdr
, sizeof(_ucheader_t
), 1, in
);
698 if (hdr
.bom
== 0xfffe) {
699 hdr
.cnt
= endian_short(hdr
.cnt
);
700 hdr
.size
.bytes
= endian_long(hdr
.size
.bytes
);
703 _uccmcl_size
= hdr
.cnt
* 3;
704 _uccmcl_nodes
= (unsigned long *) malloc(hdr
.size
.bytes
);
707 * Read the combining classes in.
709 fread((char *) _uccmcl_nodes
, sizeof(unsigned long), _uccmcl_size
, in
);
712 * Do an endian swap if necessary.
714 if (hdr
.bom
== 0xfffe) {
715 for (i
= 0; i
< _uccmcl_size
; i
++)
716 _uccmcl_nodes
[i
] = endian_long(_uccmcl_nodes
[i
]);
727 if (_uccmcl_size
== 0)
730 free((char *) _uccmcl_nodes
);
736 uccombining_class(unsigned long code
)
738 uccombining_class(code
)
745 r
= _uccmcl_size
- 1;
750 if (code
> _uccmcl_nodes
[m
+ 1])
752 else if (code
< _uccmcl_nodes
[m
])
754 else if (code
>= _uccmcl_nodes
[m
] && code
<= _uccmcl_nodes
[m
+ 1])
755 return _uccmcl_nodes
[m
+ 2];
760 /**************************************************************************
762 * Support for numeric values.
764 **************************************************************************/
766 static unsigned long *_ucnum_nodes
;
767 static unsigned long _ucnum_size
;
768 static short *_ucnum_vals
;
772 _ucnumb_load(char *paths
, int reload
)
774 _ucnumb_load(paths
, reload
)
780 unsigned long size
, i
;
783 if (_ucnum_size
> 0) {
786 * The numbers have already been loaded.
790 free((char *) _ucnum_nodes
);
794 if ((in
= _ucopenfile(paths
, "num.dat", "rb")) == 0)
800 fread((char *) &hdr
, sizeof(_ucheader_t
), 1, in
);
802 if (hdr
.bom
== 0xfffe) {
803 hdr
.cnt
= endian_short(hdr
.cnt
);
804 hdr
.size
.bytes
= endian_long(hdr
.size
.bytes
);
807 _ucnum_size
= hdr
.cnt
;
808 _ucnum_nodes
= (unsigned long *) malloc(hdr
.size
.bytes
);
809 _ucnum_vals
= (short *) (_ucnum_nodes
+ _ucnum_size
);
812 * Read the combining classes in.
814 fread((char *) _ucnum_nodes
, sizeof(unsigned char), hdr
.size
.bytes
, in
);
817 * Do an endian swap if necessary.
819 if (hdr
.bom
== 0xfffe) {
820 for (i
= 0; i
< _ucnum_size
; i
++)
821 _ucnum_nodes
[i
] = endian_long(_ucnum_nodes
[i
]);
824 * Determine the number of values that have to be adjusted.
826 size
= (hdr
.size
.bytes
-
827 (_ucnum_size
* (sizeof(unsigned long) << 1))) /
830 for (i
= 0; i
< size
; i
++)
831 _ucnum_vals
[i
] = endian_short(_ucnum_vals
[i
]);
842 if (_ucnum_size
== 0)
845 free((char *) _ucnum_nodes
);
851 ucnumber_lookup(unsigned long code
, struct ucnumber
*num
)
853 ucnumber_lookup(code
, num
)
855 struct ucnumber
*num
;
865 * Determine a "mid" point and adjust to make sure the mid point is at
866 * the beginning of a code+offset pair.
870 if (code
> _ucnum_nodes
[m
])
872 else if (code
< _ucnum_nodes
[m
])
875 vp
= _ucnum_vals
+ _ucnum_nodes
[m
+ 1];
876 num
->numerator
= (int) *vp
++;
877 num
->denominator
= (int) *vp
;
886 ucdigit_lookup(unsigned long code
, int *digit
)
888 ucdigit_lookup(code
, digit
)
900 * Determine a "mid" point and adjust to make sure the mid point is at
901 * the beginning of a code+offset pair.
905 if (code
> _ucnum_nodes
[m
])
907 else if (code
< _ucnum_nodes
[m
])
910 vp
= _ucnum_vals
+ _ucnum_nodes
[m
+ 1];
911 if (*vp
== *(vp
+ 1)) {
923 ucgetnumber(unsigned long code
)
932 * Initialize with some arbitrary value, because the caller simply cannot
933 * tell for sure if the code is a number without calling the ucisnumber()
934 * macro before calling this function.
936 num
.numerator
= num
.denominator
= -111;
938 (void) ucnumber_lookup(code
, &num
);
945 ucgetdigit(unsigned long code
)
954 * Initialize with some arbitrary value, because the caller simply cannot
955 * tell for sure if the code is a number without calling the ucisdigit()
956 * macro before calling this function.
960 (void) ucdigit_lookup(code
, &dig
);
965 /**************************************************************************
967 * Setup and cleanup routines.
969 **************************************************************************/
973 ucdata_load(char *paths
, int masks
)
975 ucdata_load(paths
, masks
)
980 if (masks
& UCDATA_CTYPE
)
981 _ucprop_load(paths
, 0);
982 if (masks
& UCDATA_CASE
)
983 _uccase_load(paths
, 0);
984 if (masks
& UCDATA_DECOMP
)
985 _ucdcmp_load(paths
, 0);
986 if (masks
& UCDATA_CMBCL
)
987 _uccmcl_load(paths
, 0);
988 if (masks
& UCDATA_NUM
)
989 _ucnumb_load(paths
, 0);
994 ucdata_unload(int masks
)
1000 if (masks
& UCDATA_CTYPE
)
1002 if (masks
& UCDATA_CASE
)
1004 if (masks
& UCDATA_DECOMP
)
1006 if (masks
& UCDATA_CMBCL
)
1008 if (masks
& UCDATA_NUM
)
1014 ucdata_reload(char *paths
, int masks
)
1016 ucdata_reload(paths
, masks
)
1021 if (masks
& UCDATA_CTYPE
)
1022 _ucprop_load(paths
, 1);
1023 if (masks
& UCDATA_CASE
)
1024 _uccase_load(paths
, 1);
1025 if (masks
& UCDATA_DECOMP
)
1026 _ucdcmp_load(paths
, 1);
1027 if (masks
& UCDATA_CMBCL
)
1028 _uccmcl_load(paths
, 1);
1029 if (masks
& UCDATA_NUM
)
1030 _ucnumb_load(paths
, 1);
1043 unsigned long i
, lo
, *dec
;
1044 struct ucnumber num
;
1051 printf("NOT WEAK\n");
1053 printf("LOWER 0x%04lX\n", uctolower(0xff3a));
1054 printf("UPPER 0x%04lX\n", uctoupper(0xff5a));
1056 if (ucisalpha(0x1d5))
1059 printf("NOT ALPHA\n");
1061 if (ucisupper(0x1d5)) {
1063 lo
= uctolower(0x1d5);
1064 printf("0x%04lx\n", lo
);
1065 lo
= uctotitle(0x1d5);
1066 printf("0x%04lx\n", lo
);
1068 printf("NOT UPPER\n");
1070 if (ucistitle(0x1d5))
1073 printf("NOT TITLE\n");
1075 if (uciscomposite(0x1d5))
1076 printf("COMPOSITE\n");
1078 printf("NOT COMPOSITE\n");
1080 if (ucdecomp(0x1d5, &lo
, &dec
)) {
1081 for (i
= 0; i
< lo
; i
++)
1082 printf("0x%04lx ", dec
[i
]);
1086 if ((lo
= uccombining_class(0x41)) != 0)
1087 printf("0x41 CCL %ld\n", lo
);
1089 if (ucisxdigit(0xfeff))
1090 printf("0xFEFF HEX DIGIT\n");
1092 printf("0xFEFF NOT HEX DIGIT\n");
1094 if (ucisdefined(0x10000))
1095 printf("0x10000 DEFINED\n");
1097 printf("0x10000 NOT DEFINED\n");
1099 if (ucnumber_lookup(0x30, &num
)) {
1100 if (num
.numerator
!= num
.denominator
)
1101 printf("UCNUMBER: 0x30 = %d/%d\n", num
.numerator
, num
.denominator
);
1103 printf("UCNUMBER: 0x30 = %d\n", num
.numerator
);
1105 printf("UCNUMBER: 0x30 NOT A NUMBER\n");
1107 if (ucnumber_lookup(0xbc, &num
)) {
1108 if (num
.numerator
!= num
.denominator
)
1109 printf("UCNUMBER: 0xbc = %d/%d\n", num
.numerator
, num
.denominator
);
1111 printf("UCNUMBER: 0xbc = %d\n", num
.numerator
);
1113 printf("UCNUMBER: 0xbc NOT A NUMBER\n");
1116 if (ucnumber_lookup(0xff19, &num
)) {
1117 if (num
.numerator
!= num
.denominator
)
1118 printf("UCNUMBER: 0xff19 = %d/%d\n", num
.numerator
, num
.denominator
);
1120 printf("UCNUMBER: 0xff19 = %d\n", num
.numerator
);
1122 printf("UCNUMBER: 0xff19 NOT A NUMBER\n");
1124 if (ucnumber_lookup(0x4e00, &num
)) {
1125 if (num
.numerator
!= num
.denominator
)
1126 printf("UCNUMBER: 0x4e00 = %d/%d\n", num
.numerator
, num
.denominator
);
1128 printf("UCNUMBER: 0x4e00 = %d\n", num
.numerator
);
1130 printf("UCNUMBER: 0x4e00 NOT A NUMBER\n");
1132 if (ucdigit_lookup(0x06f9, &dig
))
1133 printf("UCDIGIT: 0x6f9 = %d\n", dig
);
1135 printf("UCDIGIT: 0x6f9 NOT A NUMBER\n");
1137 dig
= ucgetdigit(0x0969);
1138 printf("UCGETDIGIT: 0x969 = %d\n", dig
);
1140 num
= ucgetnumber(0x30);
1141 if (num
.numerator
!= num
.denominator
)
1142 printf("UCGETNUMBER: 0x30 = %d/%d\n", num
.numerator
, num
.denominator
);
1144 printf("UCGETNUMBER: 0x30 = %d\n", num
.numerator
);
1146 num
= ucgetnumber(0xbc);
1147 if (num
.numerator
!= num
.denominator
)
1148 printf("UCGETNUMBER: 0xbc = %d/%d\n", num
.numerator
, num
.denominator
);
1150 printf("UCGETNUMBER: 0xbc = %d\n", num
.numerator
);
1152 num
= ucgetnumber(0xff19);
1153 if (num
.numerator
!= num
.denominator
)
1154 printf("UCGETNUMBER: 0xff19 = %d/%d\n", num
.numerator
, num
.denominator
);
1156 printf("UCGETNUMBER: 0xff19 = %d\n", num
.numerator
);