ocamllabs/ocaml-ctypes — pull request #66 by yallop (2013-08-19 10:33:47+00:00)
Title: First order refactoring

The C bindings for reading, writing, and formatting primitive values are now first order (implemented with a switch) rather than higher-order (implemented with function pointers). There's now one binding for each function (read/write/format) rather than one for each primitive type.

Primitive type names are now retrieved from a function generated at configure time, not stored inside the type representation.

All the libffi bindings have been moved to the Ffi module. The Memory module (formerly 'Dynamic') is now just for memory access. The libffi stubs are in the Ffi_stubs module, and the C stubs have been renamed accordingly. The arg_type function has been moved from Static to Ffi.

We no longer pass libffi values around in OCaml, except at the point of function construction.

The libffi portion of struct type creation is now performed when the struct type is used in a function binding or closure type, not incrementally during struct type construction. The code for computing struct layout has been simplified and moved entirely to OCaml. (Previously struct layout and stack frame layout were both written in C and shared common code paths.)

Struct type equality is now structural, not physical (as a useful side effect of the elimination of C values from the type structure).

Type representations for union and struct types now share common components.

Macros for testing sizes are now based on the limits of sized C99 types in rather than on literal values. For example, we now have

#if UINT_MAX == UINT16_MAX

rather than

#if UINT_MAX == 65535U