summarylogtreecommitdiffstats
path: root/12_float128.patch
blob: df9eaca7730475cbde6aa2db01d89d0914fa3424 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Description: Workaround for usage of math.h including type _Float128
Author: Fabian Brosda <fabi3141@gmx.de>
Last-Update: 2020-07-10

diff --unified --recursive --text --new-file c-wrapper-0.6.1/src/c-lex.c c-wrapper-0.6.1-new/src/c-lex.c
--- c-wrapper-0.6.1/src/c-lex.c	2009-08-08 16:44:50.000000000 +0200
+++ c-wrapper-0.6.1-new/src/c-lex.c	2020-07-10 07:40:13.027501542 +0200
@@ -360,6 +360,7 @@
         "double",
         "void",
         "_Bool",
+        "_Float128",
         NULL,
     };
     int i;
diff --unified --recursive --text --new-file c-wrapper-0.6.1/src/c-parser.c c-wrapper-0.6.1-new/src/c-parser.c
--- c-wrapper-0.6.1/src/c-parser.c	2020-07-10 07:38:23.707643847 +0200
+++ c-wrapper-0.6.1-new/src/c-parser.c	2020-07-10 07:40:13.030834872 +0200
@@ -103,6 +103,7 @@
 DEFINE_SYM(double);
 DEFINE_SYM(void);
 DEFINE_SYM(_Bool);
+DEFINE_SYM(_Float128);
 DEFINE_SYM(__builtin_va_list);
 DEFINE_SYM(U_struct);
 DEFINE_SYM(U_union);
@@ -470,6 +471,8 @@
         SCM_RETURN(SYM(c_void));
     } else if (SCM_EQ(car, SYM(_Bool))) {
         SCM_RETURN(SYM(c_int));
+    } else if (SCM_EQ(car, SYM(_Float128))) {
+        SCM_RETURN(SYM(c_double));
     } else if (SCM_EQ(car, SYM(__builtin_va_list))) {
         SCM_RETURN(SCM_LIST2(SCM_LIST3(SYM(with_module), SYM(c_wrapper_c_ffi), SYM(ptr)), SYM(c_void)));
     } else if (SCM_PAIRP(car) && SCM_EQ(SCM_CAR(car), SYM(U_struct))) {
@@ -1859,6 +1862,7 @@
     INIT_SYM(double, "double");
     INIT_SYM(void, "void");
     INIT_SYM(_Bool, "_Bool");
+    INIT_SYM(_Float128, "_Float128");
     INIT_SYM(__builtin_va_list, "__builtin_va_list");
     INIT_SYM(U_struct, "STRUCT");
     INIT_SYM(U_union, "UNION");
diff --unified --recursive --text --new-file c-wrapper-0.6.1/testsuite/Makefile.in c-wrapper-0.6.1-new/testsuite/Makefile.in
--- c-wrapper-0.6.1/testsuite/Makefile.in	2020-07-10 07:38:23.710977175 +0200
+++ c-wrapper-0.6.1-new/testsuite/Makefile.in	2020-07-10 07:49:39.653986008 +0200
@@ -73,6 +73,7 @@
 	$(GOSH) -I../src -I../lib cwrappertest.scm >> test.log
 	$(GOSH) -I../src -I../lib struct_in_union-test.scm >> test.log
 	$(GOSH) -I../src -I../lib stdio-test.scm >> test.log
+	$(GOSH) -I../src -I../lib math-test.scm >> test.log
 	$(GOSH) -I../src -I../lib inline-test.scm >> test.log
 	$(GOSH) -I../src -I../lib fptr_array-test.scm >> test.log
 	$(GOSH) -I../src -I../lib array_qualifier-test.scm >> test.log
diff --unified --recursive --text --new-file c-wrapper-0.6.1/testsuite/math-test.scm c-wrapper-0.6.1-new/testsuite/math-test.scm
--- c-wrapper-0.6.1/testsuite/math-test.scm	1970-01-01 01:00:00.000000000 +0100
+++ c-wrapper-0.6.1-new/testsuite/math-test.scm	2020-07-10 07:55:35.235796596 +0200
@@ -0,0 +1,25 @@
+;;;
+;;; Test include math.h
+;;;
+
+(use gauche.test)
+
+(test-start "c-wrapper (include math.h)")
+(use c-wrapper)
+
+(c-include "math.h")
+
+(test "trunc"
+      1.0
+      (lambda ()
+        (trunc 1.9)))
+
+(test "pow"
+      625.0
+      (lambda ()
+        (pow 5 4)))
+
+;; epilogue
+(test-end)
+
+