DEADSOFTWARE

проверил папку ubuntu на соответсивиеbb16-core, добавил в README описание сборки
[bbcp.git] / new / _OpenBSD_ / Lin / Mod / gen-Libc / sizeofs.c
index 612bac6cbcfb0dffc0041f03a99db732223ef442..ac3b9255ff4a27cd7216d99b413a0d9ab80a4d6a 100644 (file)
@@ -1,25 +1,85 @@
 #include <sys/types.h>
-
 #include <sys/signal.h>
-
+#include <setjmp.h>
 #include <stdlib.h>
-
 #include <stdio.h>
 
-#define SZ(A, B) printf("%s %d\n", A, sizeof(B));
+#define TABS "\t\t"
 
-int main ()
+#define FALSE (0)
+#define TRUE (1)
+
+static void D (const char *s, int sz, int set, int export)
 {
-       SZ("size_t", size_t);
-       SZ("ssize_t", ssize_t);
-       SZ("off_t", off_t);
-       SZ("clock_t", clock_t);
-       SZ("mode_t", mode_t);
-       SZ("pid_t", pid_t);
-       SZ("uid_t", uid_t);
-       SZ("sigset_t", sigset_t);
+       int res;
 
-       SZ("wchar_t", wchar_t);
+       res = printf("%s%s", TABS, s);
+       if (export) {
+               res = printf("*");
+       }
+       res = printf(" = ");
+       if (sz == 1) {
+               res = printf("SHORTCHAR");
+       } else if (sz == 2) {
+               res = printf("SHORTINT");
+       } else if (sz == 4) {
+               if (set) {
+                       res = printf("SET");
+               } else {
+                       res = printf("INTEGER");
+               }
+       } else if (sz == 8) {
+               if (set) {
+                       res = printf("ARRAY [untagged] 2 OF SET");
+               } else {
+                       res = printf("LONGINT");
+               }
+       } else {
+               res = printf("ARRAY [untagged] ");
+               if (sz % 4 == 0) {
+                       if (set) {
+                               res = printf("%d OF SET", sz / 4);
+                       } else {
+                               res = printf("%d OF INTEGER", sz / 4);
+                       }
+               } else {
+                       res = printf("%d OF SHORTCHAR", sz);
+               }
+       }
+       res = printf(";\n");
+}
+
+int main ()
+{
+       D("PtrVoid", sizeof(void *), FALSE, TRUE);
+       D("int", sizeof(int), FALSE, TRUE);
+       D("long", sizeof(long), FALSE, TRUE);
+       D("ulong", sizeof(unsigned long), FALSE, TRUE);
+       D("size_t", sizeof(size_t), FALSE, TRUE);
+       D("ssize_t", sizeof(ssize_t), FALSE, TRUE);
+       D("off_t", sizeof(off_t), FALSE, TRUE);
+       D("clock_t", sizeof(clock_t), FALSE, TRUE);
+       D("time_t", sizeof(time_t), FALSE, TRUE);
+       D("mode_t", sizeof(mode_t), TRUE, TRUE);
+       D("pid_t", sizeof(pid_t), FALSE, TRUE);
+       D("uid_t", sizeof(uid_t), FALSE, TRUE);
+       D("gid_t", sizeof(gid_t), FALSE, TRUE);
+       D("dev_t", sizeof(dev_t), FALSE, TRUE);
+       D("ino_t", sizeof(ino_t), FALSE, TRUE);
+       D("nlink_t", sizeof(nlink_t), FALSE, TRUE);
+       D("int8_t", sizeof(int8_t), FALSE, TRUE);
+       D("u_int8_t", sizeof(u_int8_t), FALSE, TRUE);
+       D("int16_t", sizeof(int16_t), FALSE, TRUE);
+       D("u_int16_t", sizeof(u_int16_t), FALSE, TRUE);
+       D("int32_t", sizeof(int32_t), FALSE, TRUE);
+       D("u_int32_t", sizeof(u_int32_t), FALSE, TRUE);
+       D("int64_t", sizeof(int64_t), FALSE, TRUE);
+       D("u_int64_t", sizeof(u_int64_t), FALSE, TRUE);
+       D("wchar_t", sizeof(wchar_t), FALSE, TRUE);
+       D("sigset_t", sizeof(sigset_t), TRUE, TRUE);
+       D("sigjmp_buf", sizeof(sigjmp_buf), FALSE, TRUE);
+       D("intFlags", sizeof(int), TRUE, TRUE);
+       D("FILE", sizeof(FILE), FALSE, FALSE);
 
        return 0;
 }