DEADSOFTWARE

synchronized with https://github.com/aixp/BlackBox
[bbcp.git] / BlackBox / _FreeBSD_ / 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>
7 #define TABS "\t\t"
9 #define FALSE (0)
10 #define TRUE (1)
12 static void D (const char *s, int sz, int set, int export)
13 {
14 int res;
16 res = printf("%s%s", TABS, s);
17 if (export) {
18 res = printf("*");
19 }
20 res = printf(" = ");
21 if (sz == 1) {
22 res = printf("SHORTCHAR");
23 } else if (sz == 2) {
24 res = printf("SHORTINT");
25 } else if (sz == 4) {
26 if (set) {
27 res = printf("SET");
28 } else {
29 res = printf("INTEGER");
30 }
31 } else if (sz == 8) {
32 if (set) {
33 res = printf("ARRAY [untagged] 2 OF SET");
34 } else {
35 res = printf("LONGINT");
36 }
37 } else {
38 res = printf("ARRAY [untagged] ");
39 if (sz % 4 == 0) {
40 if (set) {
41 res = printf("%d OF SET", sz / 4);
42 } else {
43 res = printf("%d OF INTEGER", sz / 4);
44 }
45 } else {
46 res = printf("%d OF SHORTCHAR", sz);
47 }
48 }
49 res = printf(";\n");
50 }
52 int main ()
53 {
54 D("PtrVoid", sizeof(void *), FALSE, TRUE);
55 D("int", sizeof(int), FALSE, TRUE);
56 D("long", sizeof(long), FALSE, TRUE);
57 D("ulong", sizeof(unsigned long), FALSE, TRUE);
58 D("size_t", sizeof(size_t), FALSE, TRUE);
59 D("ssize_t", sizeof(ssize_t), FALSE, TRUE);
60 D("off_t", sizeof(off_t), FALSE, TRUE);
61 D("clock_t", sizeof(clock_t), FALSE, TRUE);
62 D("clockid_t", sizeof(clockid_t), FALSE, TRUE);
63 D("time_t", sizeof(time_t), FALSE, TRUE);
64 D("mode_t", sizeof(mode_t), TRUE, TRUE);
65 D("pid_t", sizeof(pid_t), FALSE, TRUE);
66 D("uid_t", sizeof(uid_t), FALSE, TRUE);
67 D("gid_t", sizeof(gid_t), FALSE, TRUE);
68 D("dev_t", sizeof(dev_t), FALSE, TRUE);
69 D("ino_t", sizeof(ino_t), FALSE, TRUE);
70 D("nlink_t", sizeof(nlink_t), FALSE, TRUE);
71 D("int8_t", sizeof(int8_t), FALSE, TRUE);
72 D("uint8_t", sizeof(u_int8_t), FALSE, TRUE);
73 D("int16_t", sizeof(int16_t), FALSE, TRUE);
74 D("uint16_t", sizeof(u_int16_t), FALSE, TRUE);
75 D("int32_t", sizeof(int32_t), FALSE, TRUE);
76 D("uint32_t", sizeof(u_int32_t), FALSE, TRUE);
77 D("int64_t", sizeof(int64_t), FALSE, TRUE);
78 D("uint64_t", sizeof(u_int64_t), FALSE, TRUE);
79 D("wchar_t", sizeof(wchar_t), FALSE, TRUE);
80 D("sigset_t", sizeof(sigset_t), TRUE, TRUE);
81 D("sigjmp_buf", sizeof(sigjmp_buf), FALSE, TRUE);
82 D("intFlags", sizeof(int), TRUE, TRUE);
83 /* D("FILE", sizeof(FILE), FALSE, FALSE); */
84 D("blkcnt_t", sizeof(blkcnt_t), FALSE, TRUE);
85 D("blksize_t", sizeof(blksize_t), FALSE, TRUE);
86 D("fflags_t", sizeof(fflags_t), TRUE, TRUE);
88 return 0;
89 }