/* See LICENSE file for copyright and license details. */ #include "../libsyscalls.h" #include #include #include #include #if defined(__clang__) # pragma clang diagnostic ignored "-Wunsafe-buffer-usage" /* clang is just being silly */ #endif int main(int argc, char **argv) { int os, arch, type; struct libsyscalls_datatype_description desc; enum libsyscalls_error err; size_t i; if (argc != 7) { fprintf(stderr, "usage error\n"); return 3; } os = atoi(argv[1]); arch = atoi(argv[2]); type = atoi(argv[3]); err = libsyscalls_get_datatype_description((enum libsyscalls_os)os, (enum libsyscalls_arch)arch, (enum libsyscalls_datatype)type, &desc); if (err) { fprintf(stderr, "libsyscalls_get_datatype_description %s %s %s: ", argv[4], argv[5], argv[6]); libsyscalls_perror(NULL, err); return 1; } printf("width_in_bits = %u\n", desc.width_in_bits); printf("array_size = %u\n", desc.array_size); printf("relative_position_of_array_size = %i\n", desc.relative_position_of_array_size); printf("absolute_position_of_array_size = %i\n", desc.absolute_position_of_array_size); printf("fill_is_known = %u\n", (unsigned)desc.fill_is_known); printf("is_signed = %u\n", (unsigned)desc.is_signed); printf("is_unsigned = %u\n", (unsigned)desc.is_unsigned); printf("min_is_minus_max = %u\n", (unsigned)desc.min_is_minus_max); printf("sign_representation = %lli\n", (long long int)desc.sign_representation); printf("annotation = %lli\n", (long long int)desc.annotation); printf("section = %lli\n", (long long int)desc.section); printf("byteorder ="); for (i = 0; i < sizeof(desc.byteorder) / sizeof(*desc.byteorder); i++) { if (LIBSYSCALLS_IS_BYTEORDER_END(desc.byteorder[i])) goto end_of_byteorder; printf(" %u", desc.byteorder[i]); } end_of_byteorder: printf("\n"); if (fflush(stdout) || fclose(stdout)) { perror(NULL); return 1; } return 0; }