bsdcontrol.rb/ext/hbsdctl.rb/hbsdctl.c

21 lines
824 B
C
Raw Normal View History

2024-03-01 02:29:43 +01:00
#include <ruby.h>
2024-03-07 22:04:44 +01:00
#include "include/ffi.h"
#include "include/feature.h"
2024-03-07 05:34:34 +01:00
2024-03-01 02:29:43 +01:00
void
Init_hbsdctl(void)
{
2024-03-07 05:34:34 +01:00
VALUE rb_mBSD = rb_const_get(rb_cObject, rb_intern("BSD")),
rb_mControl = rb_const_get(rb_mBSD, rb_intern("Control")),
rb_cFeature = rb_const_get(rb_mControl, rb_intern("Feature")),
rb_mFFI = rb_const_get(rb_mControl, rb_intern("FFI"));
2024-03-01 02:29:43 +01:00
2024-03-01 16:05:52 +01:00
rb_define_const(rb_mControl, "Disable", INT2NUM(0));
rb_define_const(rb_mControl, "Enable", INT2NUM(1));
2024-03-01 02:29:43 +01:00
rb_define_singleton_method(rb_mFFI, "available_features", ffi_available_features, 0);
2024-03-01 05:28:54 +01:00
rb_define_singleton_method(rb_mFFI, "library_version", ffi_library_version, 0);
2024-03-07 00:59:54 +01:00
rb_define_singleton_method(rb_mFFI, "reset!", ffi_reset, 2);
2024-03-08 03:41:45 +01:00
rb_define_singleton_method(rb_mFFI, "status", ffi_status, 2);
rb_define_private_method(rb_cFeature, "set!", feature_set, 2);
2024-03-01 02:29:43 +01:00
}