This repository has been archived by the owner. It is now read-only.
Permalink
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (22 sloc) 840 Bytes
require 'ffi'
module RedSnow
# expose function free() to allow release memory allocated by C-interface
module Memory
extend FFI::Library
ffi_lib FFI::Library::LIBC
attach_function :free, [:pointer], :void
end
# C-binding with Snow Crash Library using [FFI](https://github.com/ffi/ffi)
# @see https://github.com/apiaryio/drafter/blob/master/src/cdrafter.h
module Binding
extend FFI::Library
prefix = FFI::Platform.mac? ? '' : 'lib.target/'
ffi_lib File.expand_path("../../../ext/drafter/build/out/Release/#{prefix}libdrafter.#{FFI::Platform::LIBSUFFIX}", __FILE__)
enum :option, [
:render_descriptions_option,
:require_blueprint_name_option,
:export_sourcemap_option
]
attach_function('drafter_c_parse', 'drafter_c_parse', [:string, :option, :pointer], :int)
end
end