Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

re-added comments

  • Loading branch information...
commit 58ffa8c52f9f7838457ca23933d92d776ca5f9d1 1 parent ca43c9d
@justinfreitag justinfreitag authored
Showing with 9 additions and 0 deletions.
  1. BIN  lib/.ffi.js.swp
  2. +9 −0 lib/type.js
View
BIN  lib/.ffi.js.swp
Binary file not shown
View
9 lib/type.js
@@ -4,6 +4,11 @@ var debug = require('debug')('ffi:types')
var Struct = require('ref-struct')
var bindings = require('./bindings')
+/**
+ * Define the `ffi_type` struct (see deps/libffi/include/ffi.h) for use in JS.
+ * This struct type is used internally to define custom struct rtn/arg types.
+ */
+
exports.FFI_TYPE = FFI_TYPE = Struct()
FFI_TYPE.defineProperty('size', ref.types.size_t)
FFI_TYPE.defineProperty('alignment', ref.types.ushort)
@@ -13,6 +18,10 @@ var ffi_type_ptr_array = ref.refType(ref.refType(FFI_TYPE))
FFI_TYPE.defineProperty('elements', ffi_type_ptr_array)
assert.equal(bindings.FFI_TYPE_SIZE, FFI_TYPE.size)
+/**
+ * Returns a `ffi_type *` Buffer appropriate for the given "type".
+ */
+
exports.Type = function Type (type) {
debug('Type()', type.name || type)
type = ref.coerceType(type)
Please sign in to comment.
Something went wrong with that request. Please try again.