Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
// This file: // http://anggtwu.net/LISP/CLA/test.h.html // http://anggtwu.net/LISP/CLA/test.h // (find-angg "LISP/CLA/test.h") // Author: Eduardo Ochs <eduardoochs@gmail.com> // // Based on the "test.h" from here, // https://github.com/rpav/cl-autowrap // but with test blocks: // http://anggtwu.net/eepitch.html#test-blocks typedef struct foo { int a, b; char c[3]; struct { unsigned int b0 : 2, b1 : 3; struct { char x, y; } s; } x[2]; } foo_t; foo_t* get_foo(); void free_foo(foo_t *foo); int* get_int(); /* * (eepitch-sbcl) * (eepitch-kill) * (eepitch-sbcl) ;; (find-quicklisp-links "cl-autowrap") ;; (find-quicklisp-links "c2ffi") (load #P"~/quicklisp/setup.lisp") (ql:quickload "cl-autowrap") (in-package :autowrap) (ql:quickload "c2ffi") (c-include "test.h") ;; ^ Couldn't execute "c2ffi": No such file or directory (let ((foo (get-foo))) (setf (foo-t.a foo) 5) ;; foo.a = 5; (setf (foo-t.x[].b0 foo 0) #b10) ;; foo.x[0].b0 = 2; (print (foo-t.x[].s.x foo 1)) ;; anonymous struct (foo-t.x[].s foo 0) ;; => child wrapper (foo-t.x[].s& foo 0) ;; &(foo.x[0].s) => pointer (free-foo foo)) */