Test output for bind [ok]
Testing time: 3s
/home/mario/local/chicken-4.8.0.3/bin/csi -script run.scm < /dev/null /home/mario/local/chicken-4.8.0.3/bin/csc -feature compiling-extension -setup-mode tests.scm -debug F -c++ (define My_struct-x (foreign-lambda* integer (((c-pointer (struct "My_struct")) s)) "return(s->x);")) (define My_struct-y (getter-with-setter (foreign-lambda* float (((c-pointer (struct "My_struct")) s)) "return(s->y);") (foreign-lambda* void (((c-pointer (struct "My_struct")) s) (float x)) "s->y = x;"))) (define make-My_struct (foreign-lambda* (c-pointer (struct "My_struct")) ((integer x) (float y)) "struct My_struct *tmp_ = (struct My_struct *)C_malloc(sizeof(struct My_struct));\ntmp_->x = x;\n\ntmp_->y = y;\n\nC_return(tmp_);")) (begin (define make_struct (foreign-lambda (c-pointer (struct "My_struct")) "make_struct" integer float))) (define-constant GLU_TESS_MAX_COORD 1e+150) (define-constant X1_1 1e+150) (define-constant X1_2 -1e+150) (define-constant X1_3 -1e-150) (define-constant X1_4 1e+150) (define-constant X1_5 -1e+150) (define-constant X1_6 -1e-150) (define-constant X2_1 1e+150) (define-constant X2_2 -1e+150) (define-constant X2_3 -1e-150) (define-constant X2_4 1e+150) (define-constant X2_5 -1e+150) (define-constant X2_6 -1e-150) (define-constant X3_1 1) (define-constant X3_2 12) (define-constant X3_3 -1) (define-constant X3_4 -12) (define-constant X4_1 1.0) (define-constant X4_2 12.0) (define-constant X4_3 -1.0) (define-constant X4_4 -12.0) (define-constant X5_1 1.0) (define-constant X5_2 12.0) (define-constant X5_3 -1.0) (define-constant X5_4 -12.0) (begin (declare (hide g118)) (define g118 (foreign-lambda integer "foo" (c-pointer double))) (define (bar g117) (let-location ((g123 double g117)) (let ((g122 (g118 (location g123)))) (values g122 g123))))) (begin (declare (hide g152)) (define g152 (foreign-lambda integer32 "one_two_three" (c-pointer double))) (define (two g151) (let-location ((g157 double g151)) (let ((g156 (g152 (location g157)))) (values g156 g157))))) (begin (declare (hide g187)) (define g187 (foreign-lambda double "modf" double (c-pointer double))) (define (modf g185) (let-location ((g193 double)) (let ((g191 (g187 g185 (location g193)))) (values g191 g193))))) (begin (declare (hide g234)) (define g234 (foreign-lambda double "sumarray" f64vector integer)) (define (sumarray g232) (let-location () (let ((g238 (g234 g232 (f64vector-length g232)))) g238)))) (begin (define fopen (foreign-lambda myfile "fopen" c-string c-string))) (define-constant mylib:SOME_CONST 42) ./tests (0.439999999999998 33.0) #<myfile> /home/mario/local/chicken-4.8.0.3/bin/csc -feature compiling-extension -setup-mode struct-passing-tests.scm -debug F (define vct:point-x (foreign-lambda* float (((c-pointer (struct "vct_point")) s)) "return(s->x);")) (define vct:point-y (foreign-lambda* float (((c-pointer (struct "vct_point")) s)) "return(s->y);")) (define vct:make-point (foreign-lambda* (c-pointer (struct "vct_point")) ((float x) (float y)) "struct vct_point *tmp_ = (struct vct_point *)C_malloc(sizeof(struct vct_point));\ntmp_->x = x;\n\ntmp_->y = y;\n\nC_return(tmp_);")) (define vct:line-a (lambda (s) (let ((blob (location (make-blob (foreign-value "sizeof(struct vct_point)" int)))) (copy-struct! (foreign-lambda* void (((c-pointer (struct "vct_point")) _dest) ((c-pointer (struct "vct_line")) s)) "*_dest = s->a;"))) (copy-struct! blob s) blob))) (define vct:line-b (lambda (s) (let ((blob (location (make-blob (foreign-value "sizeof(struct vct_point)" int)))) (copy-struct! (foreign-lambda* void (((c-pointer (struct "vct_point")) _dest) ((c-pointer (struct "vct_line")) s)) "*_dest = s->b;"))) (copy-struct! blob s) blob))) (define vct:make-line (foreign-lambda* (c-pointer (struct "vct_line")) (((c-pointer (struct "vct_point")) a) ((c-pointer (struct "vct_point")) b)) "struct vct_line *tmp_ = (struct vct_line *)C_malloc(sizeof(struct vct_line));\ntmp_->a = *a;\n\ntmp_->b = *b;\n\nC_return(tmp_);")) (begin (define vct:lensq (foreign-lambda* float (((c-pointer (struct "vct_point")) a0)) "C_return(vct_lensq(*a0));"))) (begin (define vct:len (foreign-lambda* float (((c-pointer (struct "vct_point")) a0)) "C_return(vct_len(*a0));"))) (begin (begin (define vct:normalize/overwrite! (foreign-lambda* void (((c-pointer (struct "vct_point")) dest) ((c-pointer (struct "vct_point")) a0)) "*dest=(vct_normalize(*a0));")) (define (vct:normalize a0) (let ((dest (location (make-blob (foreign-value "sizeof(struct vct_point)" int))))) (vct:normalize/overwrite! dest a0) dest)))) (begin (define vct:point-equal (foreign-lambda* unsigned-short (((c-pointer (struct "vct_point")) a0) ((c-pointer (struct "vct_point")) a1)) "C_return(point_equal(*a0,a1));"))) ./struct-passing-tests testing structs by value .. struct-by-val tests done /home/mario/local/chicken-4.8.0.3/bin/csc -feature compiling-extension -setup-mode cplusplus-test.scm -debug F -c++ (begin (declare (hide g55)) (define-class <Foo> (<c++-object>) ())) (begin (define g55 (foreign-lambda void "delete " (c-pointer "Foo"))) (define-method (destructor (this <Foo>)) (g55 (slot-value this 'this)))) (begin (declare (hide g63)) (define g63 (foreign-lambda (c-pointer "Foo") "new Foo" c-string)) (define-method (constructor (this <Foo>) initargs) (set! (slot-value this 'this) (##sys#apply g63 initargs)))) (begin (declare (hide g65)) (define g65 (foreign-lambda* c-string (((c-pointer "Foo") g66)) "return(g66->name());")) (define-method (name (this <Foo>) #!rest args) (##sys#apply g65 (slot-value this 'this) args))) (begin (declare (hide g68)) (define g68 (foreign-lambda* (instance "Foo" <Foo>) (((c-pointer "Foo") g69) ((instance "Foo" <Foo>) g70)) "return(g69->bar(g70));")) (define-method (bar (this <Foo>) #!rest args) (##sys#apply g68 (slot-value this 'this) args))) (begin (declare (hide g360)) (define-class <Foo2> (<c++-object>) ())) (begin (define g360 (foreign-lambda void "delete " (c-pointer "Foo2"))) (define-method (destructor (this <Foo2>)) (g360 (slot-value this 'this)))) (begin (declare (hide g368)) (define g368 (foreign-lambda* (instance "Foo2" <Foo2>) (((c-pointer "Foo2") g369) (bool g370)) "try { return(g369->bar2(g370)); } catch(...) { return(0); };")) (define-method (bar2 (this <Foo2>) #!rest args) (##sys#apply g368 (slot-value this 'this) args))) (begin (declare (hide g372)) (define g372 (foreign-lambda (c-pointer "Foo2") "new Foo2")) (define-method (constructor (this <Foo2>) initargs) (set! (slot-value this 'this) (##sys#apply g372 initargs)))) (begin (declare (hide g561)) (define g561 (foreign-lambda integer "overloaded" integer)) (define-method (overloaded (g560 <integer>)) (g561 g560))) (begin (declare (hide g569)) (define g569 (foreign-lambda integer "overloaded" c-string)) (define-method (overloaded (g568 <string>)) (g569 g568))) ./cplusplus-test bind class #<Foo foo1> #<Foo foo2> exception handler #<coops instance of `<Foo2>'> #<pointer 0x6753e0> #f full specialization