DEADSOFTWARE

OpenBSD HostFiles64 implementation
[bbcp.git] / BlackBox / _LinuxOpenBSD_ / Lin / Mod / gen-Libc / sizeofs.c
1 #include <sys/types.h>
2 #include <sys/signal.h>
3 #include <setjmp.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <time.h>
8 #define TABS "\t\t"
10 #define FALSE (0)
11 #define TRUE (1)
13 static void D (const char *s, int sz, int set, int export)
14 {
15 int res;
17 res = printf("%s%s", TABS, s);
18 if (export) {
19 res = printf("*");
20 }
21 res = printf(" = ");
22 if (sz == 1) {
23 res = printf("SHORTCHAR");
24 } else if (sz == 2) {
25 res = printf("SHORTINT");
26 } else if (sz == 4) {
27 if (set) {
28 res = printf("SET");
29 } else {
30 res = printf("INTEGER");
31 }
32 } else if (sz == 8) {
33 if (set) {
34 res = printf("ARRAY [untagged] 2 OF SET");
35 } else {
36 res = printf("LONGINT");
37 }
38 } else {
39 res = printf("ARRAY [untagged] ");
40 if (sz % 4 == 0) {
41 if (set) {
42 res = printf("%d OF SET", sz / 4);
43 } else {
44 res = printf("%d OF INTEGER", sz / 4);
45 }
46 } else {
47 res = printf("%d OF SHORTCHAR", sz);
48 }
49 }
50 res = printf(";\n");
51 }
53 int main ()
54 {
55 D("PtrVoid", sizeof(void *), FALSE, TRUE);
56 D("int", sizeof(int), FALSE, TRUE);
57 D("long", sizeof(long), FALSE, TRUE);
58 D("ulong", sizeof(unsigned long), FALSE, TRUE);
59 D("size_t", sizeof(size_t), FALSE, TRUE);
60 D("ssize_t", sizeof(ssize_t), FALSE, TRUE);
61 D("off_t", sizeof(off_t), FALSE, TRUE);
62 D("clock_t", sizeof(clock_t), FALSE, TRUE);
63 D("clockid_t", sizeof(clockid_t), FALSE, TRUE);
64 D("time_t", sizeof(time_t), FALSE, TRUE);
65 D("mode_t", sizeof(mode_t), TRUE, TRUE);
66 D("pid_t", sizeof(pid_t), FALSE, TRUE);
67 D("uid_t", sizeof(uid_t), FALSE, TRUE);
68 D("gid_t", sizeof(gid_t), FALSE, TRUE);
69 D("dev_t", sizeof(dev_t), FALSE, TRUE);
70 D("ino_t", sizeof(ino_t), FALSE, TRUE);
71 D("nlink_t", sizeof(nlink_t), FALSE, TRUE);
72 D("blkcnt_t", sizeof(blkcnt_t), FALSE, FALSE);
73 D("blksize_t", sizeof(blksize_t), FALSE, FALSE);
74 D("int8_t", sizeof(int8_t), FALSE, TRUE);
75 D("u_int8_t", sizeof(u_int8_t), FALSE, TRUE);
76 D("int16_t", sizeof(int16_t), FALSE, TRUE);
77 D("u_int16_t", sizeof(u_int16_t), FALSE, TRUE);
78 D("int32_t", sizeof(int32_t), FALSE, TRUE);
79 D("u_int32_t", sizeof(u_int32_t), FALSE, TRUE);
80 D("int64_t", sizeof(int64_t), FALSE, TRUE);
81 D("u_int64_t", sizeof(u_int64_t), FALSE, TRUE);
82 D("wchar_t", sizeof(wchar_t), FALSE, TRUE);
83 D("sigjmp_buf", sizeof(sigjmp_buf), FALSE, TRUE);
84 D("intFlags", sizeof(int), TRUE, TRUE);
85 D("FILE", sizeof(FILE), FALSE, FALSE);
87 printf("%ssigset_t* = ARRAY [untagged] %d OF BYTE;\n", TABS, (int)sizeof(sigset_t));
88 printf("%sPtrSigset_t* = POINTER [untagged] TO sigset_t;\n", TABS);
90 return 0;
91 }