58#define TEST_PATTERN 1.3333
59#ifdef HAVE_LONG_LONG_INT
60#define OFF_T_TEST 0x0102030405060708LL
62#define OFF_T_TEST 0x01020304
64#define LONG_TEST 0x01020304
65#define INT_TEST 0x01020304
66#define SHORT_TEST 0x0102
77static union type_conv u;
80static unsigned char dbl_cmpr[] = {0x3f, 0xf5, 0x55, 0x32,
81 0x61, 0x7c, 0x1b, 0xda};
83static unsigned char flt_cmpr[] = {0x3f, 0xaa, 0xa9, 0x93};
84static unsigned char off_t_cmpr[] = {0x01, 0x02, 0x03, 0x04,
85 0x05, 0x06, 0x07, 0x08};
86static unsigned char lng_cmpr[] = {0x01, 0x02, 0x03, 0x04};
87static unsigned char int_cmpr[] = {0x01, 0x02, 0x03, 0x04};
88static unsigned char shrt_cmpr[] = {0x01, 0x02};
100static int find_offset(
unsigned char *,
unsigned char,
int);
101static int dumpflags(
void);
111 printf(
"\n/* Native machine sizes */\n");
112 printf(
"#define NATIVE_DOUBLE %d\n", (
nat_dbl =
sizeof(
double)));
113 printf(
"#define NATIVE_FLOAT %d\n", (
nat_flt =
sizeof(
float)));
115 printf(
"#define NATIVE_LONG %d\n", (
nat_lng =
sizeof(
long)));
118 printf(
"#define NATIVE_CHAR %d\n", (nat_char =
sizeof(
char)));
181 tmp = find_offset(u.c, flt_cmpr[i],
PORT_FLOAT);
209 tmp = find_offset(u.c, off_t_cmpr[i],
nat_off_t);
234 tmp = find_offset(u.c, lng_cmpr[i],
nat_lng);
259 tmp = find_offset(u.c, int_cmpr[i],
nat_int);
261 fprintf(
stderr,
"ERROR, could not find '%x' in int\n", int_cmpr[i]);
283 tmp = find_offset(u.c, shrt_cmpr[i],
nat_shrt);
305 printf(
"\n/* Native machine byte orders */\n");
313 printf(
"\n\n/* Translation matrices from big endian to native */\n");
328 for (i = 0; i < size; i++)
335static int dumpflags(
void)
339 fprintf(
stdout,
"\n/* Double format: */\nstatic int dbl_cnvrt[] = {");
341 while (i < nat_dbl) {
348 fprintf(
stdout,
"/* Float format : */\nstatic int flt_cnvrt[] = {");
350 while (i < nat_flt) {
357 fprintf(
stdout,
"/* off_t format : */\nstatic int off_t_cnvrt[] = {");
359 while (i < nat_off_t) {
366 fprintf(
stdout,
"/* Long format : */\nstatic int lng_cnvrt[] = {");
368 while (i < nat_lng) {
375 fprintf(
stdout,
"/* Int format : */\nstatic int int_cnvrt[] = {");
377 while (i < nat_int) {
384 fprintf(
stdout,
"/* Short format : */\nstatic int shrt_cnvrt[] = {");
386 while (i < nat_shrt) {
#define PORT_DOUBLE
Sizes of types used in portable format (different names used in Vlib/ and diglib/ for the same thing)
#define ENDIAN_LITTLE
Endian check.
unsigned char flt_cnvrt[sizeof(float)]
unsigned char dbl_cnvrt[sizeof(double)]
unsigned char lng_cnvrt[sizeof(long)]
unsigned char off_t_cnvrt[sizeof(off_t)]
unsigned char shrt_cnvrt[sizeof(short)]
unsigned char int_cnvrt[sizeof(int)]
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)