2 PSI_STDTYPES="$PSI_STDTYPES
6 # psi_type_pair(type, size)
7 # Output a PSI_T_<TYPE>, \"<TYPENAME>\" tuple.
8 # Uses stdint types when possible.
10 local psi_type_name=`printf "%s" "$1" | tr -cd A-Za-z0-9_`
11 local psi_type_lower=`printf "%s" "$1" | tr A-Z a-z`
12 while expr "$psi_type_lower" : const >/dev/null; do
13 psi_type_lower=`printf "%s" "$psi_type_lower" | cut -d " " -f2-`
15 case $psi_type_lower in
17 local psi_type_upper=`printf "%s" "$psi_type_name" | tr a-z A-Z`
18 local psi_type_bits=`expr $2 \* 8`
19 echo "PSI_T_${psi_type_upper}${psi_type_bits}, \"${psi_type_lower}${psi_type_bits}_t\""
22 echo "PSI_T_STRUCT, \"$2\""
25 echo "PSI_T_UNION, \"$2\""
28 echo "PSI_T_VOID, \"void\""
31 echo "PSI_T_NAME, \"$psi_type_name\""
36 AC_DEFUN(PSI_STDTYPE, [
37 ifdef(AS_TR_CPP(AC_TYPE_$1), AS_TR_CPP(AC_TYPE_$1))
39 if PSI_SH_TEST_SIZEOF($1); then
40 m4_case(ifelse(,[$2],[$1],[$2]),
41 [bool],[psi_add_stdtype "{PSI_T_BOOL, \"bool\", NULL}"],
42 [float],[psi_add_stdtype "{PSI_T_FLOAT, \"float\", NULL}"],
43 [double],[psi_add_stdtype "{PSI_T_DOUBLE, \"double\", NULL}"],
44 [long double],[psi_add_stdtype "{PSI_T_LONG_DOUBLE, \"long double\", NULL}"],
46 AX_CHECK_SIGN($1, psi_basic_type=int, psi_basic_type=uint, PSI_INCLUDES)
47 AS_TR_SH(psi_basic_type_$1)=$psi_basic_type
48 psi_add_stdtype "{`psi_type_pair $psi_basic_type PSI_SH_SIZEOF($1)`, \"$1\"}"
53 dnl PSI_CHECK_STD_TYPES()
54 dnl Checks for standard ANSI-C, stdint and stdbool types.
55 AC_DEFUN(PSI_CHECK_STD_TYPES, [
59 PSI_CHECK_SIZEOF(void *)
60 AC_CHECK_ALIGNOF(void *)
63 AC_CHECK_ALIGNOF(float)
65 AC_CHECK_ALIGNOF(double)
66 PSI_STDTYPE(long double)
67 AC_CHECK_ALIGNOF(long double)
70 AC_CHECK_ALIGNOF(bool, PSI_INCLUDES)
72 PSI_STDTYPE(char, int)
73 AC_CHECK_ALIGNOF(char)
74 PSI_STDTYPE(signed char, int)
75 PSI_STDTYPE(unsigned char, uint)
76 PSI_STDTYPE(short, int)
77 AC_CHECK_ALIGNOF(short)
78 PSI_STDTYPE(short int, int)
79 PSI_STDTYPE(signed short, int)
80 PSI_STDTYPE(signed short int, int)
81 PSI_STDTYPE(short signed, int)
82 PSI_STDTYPE(short signed int, int)
83 PSI_STDTYPE(unsigned short, uint)
84 PSI_STDTYPE(unsigned short int, uint)
85 PSI_STDTYPE(short unsigned, uint)
86 PSI_STDTYPE(short unsigned int, uint)
89 PSI_STDTYPE(signed int, int)
90 PSI_STDTYPE(signed, int)
91 PSI_STDTYPE(unsigned int, uint)
92 PSI_STDTYPE(unsigned, uint)
93 PSI_STDTYPE(long, int)
94 AC_CHECK_ALIGNOF(long)
95 PSI_STDTYPE(long int, int)
96 PSI_STDTYPE(signed long int, int)
97 PSI_STDTYPE(long signed int, int)
98 PSI_STDTYPE(unsigned long, uint)
99 PSI_STDTYPE(unsigned long int, uint)
100 PSI_STDTYPE(long unsigned, uint)
101 PSI_STDTYPE(long unsigned int, uint)
102 PSI_STDTYPE(long long, int)
103 AC_CHECK_ALIGNOF(long long)
104 PSI_STDTYPE(signed long long, int)
105 PSI_STDTYPE(signed long long int, int)
106 PSI_STDTYPE(long signed long, int)
107 PSI_STDTYPE(long signed long int, int)
108 PSI_STDTYPE(long long signed, int)
109 PSI_STDTYPE(long long signed int, int)
110 PSI_STDTYPE(unsigned long long, uint)
111 PSI_STDTYPE(unsigned long long int, uint)
112 PSI_STDTYPE(long unsigned long, uint)
113 PSI_STDTYPE(long unsigned long int, uint)
114 PSI_STDTYPE(long long unsigned, uint)
115 PSI_STDTYPE(long long unsigned int, uint)
116 dnl this must come after the check for "unsigned long long int"; autoconf, wth?
117 PSI_STDTYPE(long long int, int)
119 AC_CHECK_TYPE(__int128, [
120 AC_DEFINE([HAVE_INT128], [1], [ ])
121 AC_CHECK_ALIGNOF(__int128)
122 PSI_STDTYPE(__int128, int)
123 PSI_STDTYPE(signed __int128, int)
124 PSI_STDTYPE(unsigned __int128, uint)
127 PSI_STDTYPE(_Float32)
128 PSI_STDTYPE(_Float32x)
129 PSI_STDTYPE(_Float64)
130 PSI_STDTYPE(_Float64x)
131 PSI_STDTYPE(_Float128)