libk  Check-in [04ed009476]

Overview
Comment:comment out non-standard use of enums pending rewrite with #defines :(
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 04ed0094760ed6c7692f1abccff6033c8188cd6f92b6818c0a3f699ec3c2eea8
User & Date: lexi on 2019-08-25 04:15:40
Other Links: manifest | tags
Context
2019-08-26
19:49
minor tweaks; update docs to explain error handling check-in: 55dc614190 user: lexi tags: trunk
2019-08-25
04:15
comment out non-standard use of enums pending rewrite with #defines :( check-in: 04ed009476 user: lexi tags: trunk
03:55
remove useless script, delete junk files, credit contributors, add documentation for typesize.c check-in: 312e446cfc user: lexi tags: trunk
Changes

Modified mod/kcore/type.h.m from [b30ab22689] to [efe9d86768].

88
89
90
91
92
93
94
95


96
97









98
99
100
101
102
103
104
105
106
107
108
109
110
111
...
123
124
125
126
127
128
129

130
131
132
133
134
135
136
define(“cat”, “$1$2”)
typedef enum kcendian {
	kcendian_high,
	kcendian_low,
	kcendian_system = cat(kcendian_,prop_endian), 
} kcendian;

enum /* max-min values of each type */ {


	byte_bits = arch_byte_bits,










	  u8_min = 0,   u8_max = ((u8)-1),
	 u16_min = 0,  u16_max = ((u16)-1),
	 u32_min = 0,  u32_max = ((u32)-1),
	 u64_min = 0,  u64_max = ((u64)-1),
	u128_min = 0, u128_max = ((u128)-1),

	/* assuming two's complement. TODO: check math */
	define(“sspec”,“
		$1_min = 0 - ((1 << sizeof($1) * byte_bits) / 2),
		$1_max =      (1 << sizeof($1) * byte_bits) / 2 - 1”)dnl

	sspec(s8), sspec(s16), sspec(s32),
	sspec(s64), sspec(s128),

................................................................................

	ubig_min = u128_min, ubig_max = u128_max,
	sbig_min = s128_min, sbig_max = s128_max,

	ubyte_min = kc_uchar_min, ubyte_max = kc_uchar_max,
	sbyte_min = kc_schar_min, sbyte_max = kc_schar_max,
};


ifdef(“type_sz”,“
	typedef type_sz sz;
”,“dnl
#	ifdef __cplusplus
 	   /* C++ gives us a clean, standardized way to do this */
 	   typedef decltype (sizeof(char)) sz;







|
>
>
|

>
>
>
>
>
>
>
>
>






|







 







>







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
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
define(“cat”, “$1$2”)
typedef enum kcendian {
	kcendian_high,
	kcendian_low,
	kcendian_system = cat(kcendian_,prop_endian), 
} kcendian;

define(“defval”,“#define $1 $2
”)

defval(byte_bits,arch_byte_bits)


/* this section was originally defined with enums so
 * as to avoid creating extraneous macros; however,
 * enum in C is limited to values of type int, when
 * we need values that are considerably longer. the
 * section has been commented out until someone has
 * the energy to convert it to #defines.

enum {
	  u8_min = 0,   u8_max = ((u8)-1),
	 u16_min = 0,  u16_max = ((u16)-1),
	 u32_min = 0,  u32_max = ((u32)-1),
	 u64_min = 0,  u64_max = ((u64)-1),
	u128_min = 0, u128_max = ((u128)-1),

	// assuming two's complement. TODO: check math 
	define(“sspec”,“
		$1_min = 0 - ((1 << sizeof($1) * byte_bits) / 2),
		$1_max =      (1 << sizeof($1) * byte_bits) / 2 - 1”)dnl

	sspec(s8), sspec(s16), sspec(s32),
	sspec(s64), sspec(s128),

................................................................................

	ubig_min = u128_min, ubig_max = u128_max,
	sbig_min = s128_min, sbig_max = s128_max,

	ubyte_min = kc_uchar_min, ubyte_max = kc_uchar_max,
	sbyte_min = kc_schar_min, sbyte_max = kc_schar_max,
};
*/

ifdef(“type_sz”,“
	typedef type_sz sz;
”,“dnl
#	ifdef __cplusplus
 	   /* C++ gives us a clean, standardized way to do this */
 	   typedef decltype (sizeof(char)) sz;