* sysdeps/m68k/fpu/bits/mathinline.h: Don't define log2 as inline.
[glibc/pb-stable.git] / localedata / tests-mbwc / tst_types.h
blob2bf5a4f0792a24607f292aac97793239d1cbf04c
1 /*
2 * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
4 * FILE: tst_types.h
6 * Definitions of data types for each test function
7 */
10 #ifndef TST_TYPES_H
11 #define TST_TYPES_H
13 #include <stdio.h>
14 #include <wchar.h>
15 #include <wctype.h>
16 #include "tst_funcs.h"
17 #include "tgn_funcdef.h"
19 #define MBSSIZE 24
20 #define WCSSIZE 12
21 #define MONFMTSIZE 16
22 #define MONSIZE 32
23 #define USE_MBCURMAX 99 /* well, but ... */
24 #define TST_DBL_EPS 2.22153e-16
25 #define WCSTOK_SEQNUM 3
26 #define MBLEN_SEQNUM 3
27 #define MBTOWC_SEQNUM 3
28 #define MBSTOWCS_SEQNUM 3
29 #define WCTOMB_SEQNUM 3
30 #define WCSTOMBS_SEQNUM 3
31 #define MBRLEN_SEQNUM 3
32 #define MBRTOWC_SEQNUM 3
33 #define MBSRTOWCS_SEQNUM 3
34 #define WCRTOMB_SEQNUM 3
35 #define WCSRTOMBS_SEQNUM 3
37 /* Maximum numbers of test in one of the _loc arrays. */
38 #define MAX_LOC_TEST 300
41 /*----------------------------------------------------------------------*/
42 /* FUNCTION */
43 /*----------------------------------------------------------------------*/
45 typedef struct
47 char *func_str;
48 int func_id;
50 TST_FID;
52 typedef struct
54 int func_id;
55 const char *locale;
57 TST_HEAD;
59 typedef struct
61 TST_HEAD *head;
63 TST_FUNCS;
66 /*----------------------------------------------------------------------*/
67 /* ISW*: int isw* (wchar_t wc) */
68 /*----------------------------------------------------------------------*/
70 TST_ISW_STRUCT (ALNUM, alnum);
71 TST_ISW_STRUCT (ALPHA, alpha);
72 TST_ISW_STRUCT (CNTRL, cntrl);
73 TST_ISW_STRUCT (DIGIT, digit);
74 TST_ISW_STRUCT (GRAPH, graph);
75 TST_ISW_STRUCT (LOWER, lower);
76 TST_ISW_STRUCT (PRINT, print);
77 TST_ISW_STRUCT (PUNCT, punct);
78 TST_ISW_STRUCT (SPACE, space);
79 TST_ISW_STRUCT (UPPER, upper);
80 TST_ISW_STRUCT (XDIGIT, xdigit);
82 typedef struct
84 wint_t wc;
85 const char *ts;
87 TIN_ISWCTYPE_REC;
89 typedef
90 TEX_ERRET_REC (int)
91 TEX_ISWCTYPE_REC;
92 TMD_RECHEAD (ISWCTYPE);
95 /*----------------------------------------------------------------------*/
96 /* MBLEN: int mblen (const char *s, size_t n) */
97 /*----------------------------------------------------------------------*/
99 typedef struct
101 char s_flg;
102 char s[MBSSIZE];
103 size_t n;
105 TIN_MBLEN_REC;
107 typedef TEX_ERRET_REC (int) TEX_MBLEN_REC;
108 TMD_RECHEAD (MBLEN);
111 /*----------------------------------------------------------------------*/
112 /* MBRLEN: size_t mbrlen (const char *s, size_t n, mbstate_t *ps) */
113 /*----------------------------------------------------------------------*/
115 typedef struct
117 struct
119 int s_flg;
120 char s[MBSSIZE];
121 size_t n;
122 int t_flg;
123 int t_init;
125 seq[WCSTOK_SEQNUM];
127 TIN_MBRLEN_REC;
129 typedef TEX_ERRET_REC_SEQ (size_t, MBRLEN_SEQNUM) TEX_MBRLEN_REC;
130 TMD_RECHEAD (MBRLEN);
133 /*----------------------------------------------------------------------*/
134 /* MBRTOWC: size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, */
135 /* mbstate_t *ps) */
136 /*----------------------------------------------------------------------*/
138 typedef struct
140 struct
142 int w_flg;
143 int s_flg;
144 char s[MBSSIZE];
145 size_t n;
146 int t_flg;
147 int t_init;
149 seq[MBRTOWC_SEQNUM];
151 TIN_MBRTOWC_REC;
153 typedef struct
155 struct
157 TMD_ERRET (size_t);
158 wchar_t wc;
160 seq[MBRTOWC_SEQNUM];
162 TEX_MBRTOWC_REC;
164 TMD_RECHEAD (MBRTOWC);
167 /*----------------------------------------------------------------------*/
168 /* MBSRTOWCS: size_t mbsrtowcs (wchar_t *ws, const char **s, size_t n, */
169 /* mbstate_t *ps ) */
170 /*----------------------------------------------------------------------*/
172 typedef struct
174 struct
176 int w_flg;
177 char s[MBSSIZE];
178 size_t n;
179 int t_flg;
180 int t_init;
182 seq[MBSRTOWCS_SEQNUM];
184 TIN_MBSRTOWCS_REC;
186 typedef struct
188 struct
190 TMD_ERRET (size_t);
191 wchar_t ws[WCSSIZE];
193 seq[MBSRTOWCS_SEQNUM];
195 TEX_MBSRTOWCS_REC;
197 TMD_RECHEAD (MBSRTOWCS);
200 /*----------------------------------------------------------------------*/
201 /* MBSTOWCS: size_t mbstowcs (wchar_t *ws, const char *s, size_t n) */
202 /*----------------------------------------------------------------------*/
204 typedef struct
206 struct
208 int w_flg;
209 int s_flg;
210 const char *s;
211 size_t n;
213 seq[MBSTOWCS_SEQNUM];
215 TIN_MBSTOWCS_REC;
217 typedef TEX_MBSRTOWCS_REC TEX_MBSTOWCS_REC;
218 /* MBSRTOWCS_SEQNUM == MBSTOWCS_SEQNUM */
219 TMD_RECHEAD (MBSTOWCS);
222 /*----------------------------------------------------------------------*/
223 /* MBTOWC: int mbtowc (wchar_t *wc, const char *s, size_t n) */
224 /*----------------------------------------------------------------------*/
226 typedef TIN_MBSTOWCS_REC TIN_MBTOWC_REC;
227 /* MBTOWC_SEQNUM == MBSTOWCS_SEQNUM */
229 typedef struct
231 struct
233 TMD_ERRET (int);
234 wchar_t wc;
236 seq[MBTOWC_SEQNUM];
238 TEX_MBTOWC_REC;
240 TMD_RECHEAD (MBTOWC);
243 /*----------------------------------------------------------------------*/
244 /* STRCOLL: int strcoll (const char *s1, const char *s2) */
245 /*----------------------------------------------------------------------*/
247 typedef struct
249 char s1[MBSSIZE];
250 char s2[MBSSIZE];
252 TIN_STRCOLL_REC;
254 typedef TEX_ERRET_REC (int) TEX_STRCOLL_REC;
255 TMD_RECHEAD (STRCOLL);
258 /*----------------------------------------------------------------------*/
259 /* STRFMON: size_t strfmon (char *buf, size_t nbytes, */
260 /* const char *fmt, ... ) */
261 /*----------------------------------------------------------------------*/
263 typedef struct
265 int nbytes;
266 char fmt[MONFMTSIZE];
267 double val;
269 TIN_STRFMON_REC;
271 typedef struct
273 TMD_ERRET (size_t);
274 char mon[MONSIZE];
276 TEX_STRFMON_REC;
278 TMD_RECHEAD (STRFMON);
281 /*----------------------------------------------------------------------*/
282 /* STRXFRM: size_t strxfrm (char *s1, const char *s2, size_t n) */
283 /*----------------------------------------------------------------------*/
285 typedef struct
287 char org1[MBSSIZE];
288 char org2[MBSSIZE];
289 size_t n1, n2;
291 TIN_STRXFRM_REC;
293 typedef TEX_ERRET_REC (size_t) TEX_STRXFRM_REC; /* only for org2[] */
294 TMD_RECHEAD (STRXFRM);
297 /*----------------------------------------------------------------------*/
298 /* SWSCANF: int swscanf (const wchar_t *ws, const wchar_t *fmt, ...) */
299 /*----------------------------------------------------------------------*/
301 typedef struct
303 wchar_t ws[WCSSIZE * 3];
304 wchar_t fmt[WCSSIZE * 3];
305 int wch;
307 TIN_SWSCANF_REC;
309 typedef struct
311 TMD_ERRET (int);
312 int val_int; /* %d */
313 unsigned val_uns; /* %u */
314 float val_flt; /* %f */
315 int val_c; /* %c */
316 char val_s[MBSSIZE * 2]; /* %s */
317 wchar_t val_S[WCSSIZE * 2]; /* %lc, %ls, %C, %S */
319 TEX_SWSCANF_REC;
321 TMD_RECHEAD (SWSCANF);
324 /*----------------------------------------------------------------------*/
325 /* TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t desc) */
326 /*----------------------------------------------------------------------*/
328 typedef TIN_ISWCTYPE_REC TIN_TOWCTRANS_REC;
329 typedef TEX_ERRET_REC (wint_t) TEX_TOWCTRANS_REC;
330 TMD_RECHEAD (TOWCTRANS);
333 /*----------------------------------------------------------------------*/
334 /* TOW*ER: wint_t tow*er (wint_t wc) */
335 /*----------------------------------------------------------------------*/
337 TST_TOW_STRUCT (LOWER, lower);
338 TST_TOW_STRUCT (UPPER, upper);
341 /*----------------------------------------------------------------------*/
342 /* WCRTOMB: wchar_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps) */
343 /*----------------------------------------------------------------------*/
345 typedef struct
347 int s_flg;
348 wchar_t wc;
349 int t_flg;
350 int t_init;
352 TIN_WCRTOMB_REC;
354 typedef struct
356 TMD_ERRET (wchar_t);
357 char s[MBSSIZE];
359 TEX_WCRTOMB_REC;
361 TMD_RECHEAD (WCRTOMB);
364 /*----------------------------------------------------------------------*/
365 /* WCSCAT: wchar_t *wcscat (wchar_t *ws1, wchar_t *ws2) */
366 /*----------------------------------------------------------------------*/
368 typedef struct
370 wchar_t ws1[WCSSIZE];
371 wchar_t ws2[WCSSIZE];
373 TIN_WCSCAT_REC;
375 typedef struct
377 TMD_ERRET (wchar_t *);
378 wchar_t ws[WCSSIZE];
380 TEX_WCSCAT_REC;
382 TMD_RECHEAD (WCSCAT);
385 /*----------------------------------------------------------------------*/
386 /* WCSCHR: wchar_t *wcschr (wchar_t *ws, wchar_t wc); */
387 /*----------------------------------------------------------------------*/
389 typedef struct
391 wchar_t ws[WCSSIZE];
392 wchar_t wc;
394 TIN_WCSCHR_REC;
396 typedef TEX_ERRET_REC (wchar_t *) TEX_WCSCHR_REC;
397 TMD_RECHEAD (WCSCHR);
400 /*----------------------------------------------------------------------*/
401 /* WCSCMP: int wcscmp (const wchar_t *ws1, const wchar_t *ws2) */
402 /*----------------------------------------------------------------------*/
404 typedef TIN_WCSCAT_REC TIN_WCSCMP_REC;
405 typedef TEX_ERRET_REC (int) TEX_WCSCMP_REC;
406 TMD_RECHEAD (WCSCMP);
409 /*----------------------------------------------------------------------*/
410 /* WCSCOLL: int wcscoll (const wchar_t *ws1, const wchar_t *ws2) */
411 /*----------------------------------------------------------------------*/
413 typedef TIN_WCSCMP_REC TIN_WCSCOLL_REC;
414 typedef struct
416 TMD_ERRET (int);
417 int cmp_flg;
419 TEX_WCSCOLL_REC;
420 TMD_RECHEAD (WCSCOLL);
423 /*----------------------------------------------------------------------*/
424 /* WCSCPY: wchar_t *wcscpy (wchar_t *ws1, const wchar_t *ws2) */
425 /*----------------------------------------------------------------------*/
427 typedef struct
429 wchar_t ws[WCSSIZE]; /* ws2: original string */
431 TIN_WCSCPY_REC;
433 typedef TEX_WCSCAT_REC TEX_WCSCPY_REC;
434 TMD_RECHEAD (WCSCPY);
437 /*----------------------------------------------------------------------*/
438 /* WCSCSPN: size_t wcscspn (const wchar_t *ws1, const wchar_t *ws2) */
439 /*----------------------------------------------------------------------*/
441 typedef TIN_WCSCAT_REC TIN_WCSCSPN_REC;
442 typedef TEX_ERRET_REC (size_t) TEX_WCSCSPN_REC;
443 TMD_RECHEAD (WCSCSPN);
446 /*----------------------------------------------------------------------*/
447 /* WCSLEN: size_t wcslen (const wchar_t *ws) */
448 /*----------------------------------------------------------------------*/
450 typedef TIN_WCSCPY_REC TIN_WCSLEN_REC;
451 typedef TEX_ERRET_REC (size_t) TEX_WCSLEN_REC;
452 TMD_RECHEAD (WCSLEN);
455 /*----------------------------------------------------------------------*/
456 /* WCSNCAT: wchar_t *wcsncat (wchar_t *ws1, const wchar_t *ws2, */
457 /* size_t n) */
458 /*----------------------------------------------------------------------*/
460 typedef struct
462 wchar_t ws1[WCSSIZE];
463 wchar_t ws2[WCSSIZE];
464 size_t n;
466 TIN_WCSNCAT_REC;
468 typedef TEX_WCSCAT_REC TEX_WCSNCAT_REC;
469 TMD_RECHEAD (WCSNCAT);
472 /*----------------------------------------------------------------------*/
473 /* WCSNCMP: int *wcsncmp (const wchar_t *ws1, const wchar_t *ws2, */
474 /* size_t n) */
475 /*----------------------------------------------------------------------*/
477 typedef TIN_WCSNCAT_REC TIN_WCSNCMP_REC;
478 typedef TEX_ERRET_REC (int) TEX_WCSNCMP_REC;
479 TMD_RECHEAD (WCSNCMP);
482 /*----------------------------------------------------------------------*/
483 /* WCSNCPY: wchar_t *wcsncpy (wchar_t *ws1, const wchar_t *ws2, */
484 /* size_t n) */
485 /*----------------------------------------------------------------------*/
487 typedef struct
489 wchar_t ws[WCSSIZE]; /* ws2: original string */
490 size_t n;
492 TIN_WCSNCPY_REC;
494 typedef TEX_WCSCPY_REC TEX_WCSNCPY_REC;
495 TMD_RECHEAD (WCSNCPY);
498 /*----------------------------------------------------------------------*/
499 /* WCSPBRK: wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2) */
500 /*----------------------------------------------------------------------*/
502 typedef TIN_WCSCSPN_REC TIN_WCSPBRK_REC;
504 typedef struct
506 TMD_ERRET (wchar_t *);
507 wchar_t wc;
509 TEX_WCSPBRK_REC;
511 TMD_RECHEAD (WCSPBRK);
514 /*----------------------------------------------------------------------*/
515 /* WCSRTOMBS: size_t wcsrtombs (char *s, const wchar_t **ws, size_t n, */
516 /* mbstate_t *ps) */
517 /*----------------------------------------------------------------------*/
519 typedef struct
521 int s_flg;
522 int w_flg; /* don't need this */
523 wchar_t ws[WCSSIZE];
524 size_t n;
525 int t_flg;
526 int t_init;
528 TIN_WCSRTOMBS_REC;
530 typedef struct
532 TMD_ERRET (size_t);
533 char s[MBSSIZE];
535 TEX_WCSRTOMBS_REC;
537 TMD_RECHEAD (WCSRTOMBS);
540 /*----------------------------------------------------------------------*/
541 /* WCSSPN: size_t wcsspn (const wchar_t *ws1, const wchar_t *ws2) */
542 /*----------------------------------------------------------------------*/
544 typedef TIN_WCSCSPN_REC TIN_WCSSPN_REC;
545 typedef TEX_WCSCSPN_REC TEX_WCSSPN_REC;
546 TMD_RECHEAD (WCSSPN);
549 /*----------------------------------------------------------------------*/
550 /* WCSSTR: wchar_t *wcsstr (const wchar_t *ws1, const wchar_t *ws2) */
551 /*----------------------------------------------------------------------*/
553 typedef TIN_WCSCSPN_REC TIN_WCSSTR_REC;
554 typedef TEX_ERRET_REC (wchar_t *) TEX_WCSSTR_REC;
555 TMD_RECHEAD (WCSSTR);
558 /*----------------------------------------------------------------------*/
559 /* WCSTOD: double wcstod (const wchar_t *np, wchar_t **endp) */
560 /*----------------------------------------------------------------------*/
562 typedef struct
564 wchar_t np[WCSSIZE];
566 TIN_WCSTOD_REC;
568 typedef struct
570 TMD_ERRET (double);
571 double val;
572 wchar_t fwc;
574 TEX_WCSTOD_REC;
576 TMD_RECHEAD (WCSTOD);
579 /*----------------------------------------------------------------------*/
580 /* WCSTOK: wchar_t *wcstok (wchar_t *ws, const wchar_t *dlm, */
581 /* wchar_t **pt) */
582 /*----------------------------------------------------------------------*/
584 typedef struct
586 struct
588 int w_flg;
589 wchar_t ws[WCSSIZE];
590 wchar_t dt[WCSSIZE]; /* delimiter */
592 seq[WCSTOK_SEQNUM];
594 TIN_WCSTOK_REC;
596 typedef struct
598 struct
600 TMD_ERRET (wchar_t *);
601 wchar_t ws[WCSSIZE];
603 seq[WCSTOK_SEQNUM];
605 TEX_WCSTOK_REC;
607 TMD_RECHEAD (WCSTOK);
610 /*----------------------------------------------------------------------*/
611 /* WCSTOMBS: size_t wcstombs (char s, const wchar_t *ws, size_t n) */
612 /*----------------------------------------------------------------------*/
614 typedef struct
616 int s_flg;
617 int w_flg; /* currently we don't need it. */
618 wchar_t ws[WCSSIZE];
619 size_t n;
621 TIN_WCSTOMBS_REC;
623 typedef struct
625 TMD_ERRET (size_t);
626 char s[MBSSIZE];
628 TEX_WCSTOMBS_REC;
630 TMD_RECHEAD (WCSTOMBS);
633 /*----------------------------------------------------------------------*/
634 /* WCSWIDTH: int wcswidth (const wchar_t *ws, size_t n) */
635 /*----------------------------------------------------------------------*/
637 typedef TIN_WCSNCPY_REC TIN_WCSWIDTH_REC;
638 typedef TEX_ERRET_REC (int) TEX_WCSWIDTH_REC;
639 TMD_RECHEAD (WCSWIDTH);
642 /*----------------------------------------------------------------------*/
643 /* WCSXFRM: size_t wcsxfrm (wchar_t *ws1, const wchar_t *ws2, size_t n)*/
644 /*----------------------------------------------------------------------*/
646 typedef struct
648 wchar_t org1[WCSSIZE];
649 wchar_t org2[WCSSIZE];
650 int n1, n2;
652 TIN_WCSXFRM_REC;
654 typedef TEX_ERRET_REC (size_t) TEX_WCSXFRM_REC; /* only for org2[] */
655 TMD_RECHEAD (WCSXFRM);
658 /*----------------------------------------------------------------------*/
659 /* WCTOB: int wctob (wint_t wc) */
660 /*----------------------------------------------------------------------*/
662 typedef struct
664 wint_t wc;
666 TIN_WCTOB_REC;
668 typedef TEX_ERRET_REC (int) TEX_WCTOB_REC;
669 TMD_RECHEAD (WCTOB);
672 /*----------------------------------------------------------------------*/
673 /* WCTOMB: int wctomb (char *s, wchar_t wc) */
674 /*----------------------------------------------------------------------*/
676 typedef struct
678 int s_flg;
679 wchar_t wc;
681 TIN_WCTOMB_REC;
683 typedef struct
685 TMD_ERRET (int);
686 char s[MBSSIZE];
688 TEX_WCTOMB_REC;
690 TMD_RECHEAD (WCTOMB);
693 /*----------------------------------------------------------------------*/
694 /* WCTRANS: wctrans_t wctrans (const char *charclass) */
695 /*----------------------------------------------------------------------*/
697 typedef struct
699 char class[MBSSIZE];
701 TIN_WCTRANS_REC;
703 typedef TEX_ERRET_REC (wctrans_t) TEX_WCTRANS_REC;
704 TMD_RECHEAD (WCTRANS);
707 /*----------------------------------------------------------------------*/
708 /* WCTYPE: wctype_t wctype (const char *class) */
709 /*----------------------------------------------------------------------*/
711 typedef TIN_WCTRANS_REC TIN_WCTYPE_REC;
712 typedef TEX_ERRET_REC (wctype_t) TEX_WCTYPE_REC;
713 TMD_RECHEAD (WCTYPE);
716 /*----------------------------------------------------------------------*/
717 /* WCWIDTH: int wcwidth (wchar_t wc) */
718 /*----------------------------------------------------------------------*/
720 typedef struct
722 wchar_t wc;
724 TIN_WCWIDTH_REC;
726 typedef TEX_ERRET_REC (int) TEX_WCWIDTH_REC;
727 TMD_RECHEAD (WCWIDTH);
729 #endif /* TST_TYPES_H */