libkernaux/bindings/mruby/src/version.c

50 lines
1.6 KiB
C
Raw Normal View History

2022-06-13 07:02:05 +00:00
#include "main.h"
#include <mruby/presym.h>
#include <mruby/value.h>
2022-06-13 19:55:05 +00:00
static mrb_value rb_KernAux_Version_with_cmdlineQN(mrb_state *mrb, mrb_value self);
static mrb_value rb_KernAux_Version_with_ntoaQN(mrb_state *mrb, mrb_value self);
static mrb_value rb_KernAux_Version_with_printfQN(mrb_state *mrb, mrb_value self);
2022-06-13 07:02:05 +00:00
void init_version(mrb_state *const mrb)
{
struct RClass *const rb_KernAux = mrb_module_get_id(mrb, MRB_SYM(KernAux));
struct RClass *const rb_KernAux_Version =
mrb_define_module_under_id(mrb, rb_KernAux, MRB_SYM(Version));
2022-06-13 19:55:05 +00:00
mrb_define_class_method(mrb, rb_KernAux_Version, "with_cmdline?",
rb_KernAux_Version_with_cmdlineQN, MRB_ARGS_REQ(0));
mrb_define_class_method(mrb, rb_KernAux_Version, "with_ntoa?",
rb_KernAux_Version_with_ntoaQN, MRB_ARGS_REQ(0));
mrb_define_class_method(mrb, rb_KernAux_Version, "with_printf?",
rb_KernAux_Version_with_printfQN, MRB_ARGS_REQ(0));
2022-06-13 07:02:05 +00:00
}
2022-06-13 19:55:05 +00:00
mrb_value rb_KernAux_Version_with_cmdlineQN(mrb_state *const mrb, const mrb_value self)
2022-06-13 07:02:05 +00:00
{
2022-06-13 19:55:05 +00:00
#ifdef KERNAUX_VERSION_WITH_CMDLINE
2022-06-13 07:02:05 +00:00
return mrb_true_value();
#else
return mrb_false_value();
#endif
}
2022-06-13 19:55:05 +00:00
mrb_value rb_KernAux_Version_with_ntoaQN(mrb_state *const mrb, const mrb_value self)
2022-06-13 07:02:05 +00:00
{
2022-06-13 19:55:05 +00:00
#ifdef KERNAUX_VERSION_WITH_NTOA
2022-06-13 07:02:05 +00:00
return mrb_true_value();
#else
return mrb_false_value();
#endif
}
2022-06-13 19:55:05 +00:00
mrb_value rb_KernAux_Version_with_printfQN(mrb_state *const mrb, const mrb_value self)
2022-06-13 07:02:05 +00:00
{
2022-06-13 19:55:05 +00:00
#ifdef KERNAUX_VERSION_WITH_PRINTF
2022-06-13 07:02:05 +00:00
return mrb_true_value();
#else
return mrb_false_value();
#endif
}