M: double-float-regs reg-size drop 8 ;
+M: stack-params reg-size drop "void*" heap-size ;
+
GENERIC: reg-class-variable ( register-class -- symbol )
M: reg-class reg-class-variable ;
M: float-regs reg-class-variable drop float-regs ;
+M: stack-params reg-class-variable drop stack-params ;
+
GENERIC: inc-reg-class ( register-class -- )
M: reg-class inc-reg-class
C-STRUCT: test-struct-12 { "int" "a" } { "double" "x" } ;
-: make-struct-12
+: make-struct-12 ( x -- alien )
"test-struct-12" <c-object>
[ set-test-struct-12-x ] keep ;
[ 1 ] [ callback-9 ffi_test_37 ] unit-test
[ 7 ] [ callback-9 ffi_test_37 ] unit-test
+
+C-STRUCT: test_struct_13
+{ "float" "x1" }
+{ "float" "x2" }
+{ "float" "x3" }
+{ "float" "x4" }
+{ "float" "x5" }
+{ "float" "x6" } ;
+
+: make-test-struct-13 ( -- alien )
+ "test_struct_13" <c-object>
+ 1.0 over set-test_struct_13-x1
+ 2.0 over set-test_struct_13-x2
+ 3.0 over set-test_struct_13-x3
+ 4.0 over set-test_struct_13-x4
+ 5.0 over set-test_struct_13-x5
+ 6.0 over set-test_struct_13-x6 ;
+
+FUNCTION: int ffi_test_39 ( long a, long b, test_struct_13 s ) ;
+
+[ 21 ] [ 12347 12347 make-test-struct-13 ffi_test_39 ] unit-test
M: stack-params param-reg drop ;
+M: stack-params param-regs drop f ;
+
GENERIC: v>operand ( obj -- operand )
M: integer v>operand tag-fixnum ;
return x * y;
}
-
+int ffi_test_39(long a, long b, struct test_struct_13 s)
+{
+ printf("ffi_test_39(%ld,%ld,%f,%f,%f,%f,%f,%f)\n",a,b,s.x1,s.x2,s.x3,s.x4,s.x5,s.x6);
+ if(a != b) abort();
+ return s.x1 + s.x2 + s.x3 + s.x4 + s.x5 + s.x6;
+}
DLLEXPORT int ffi_test_37(int (*f)(int, int, int));
DLLEXPORT unsigned long long ffi_test_38(unsigned long long x, unsigned long long y);
+
+struct test_struct_13 { float x1, x2, x3, x4, x5, x6; };
+
+DLLEXPORT int ffi_test_39(long a, long b, struct test_struct_13 s);