Ruby: ext/psych/psych.c Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

psych.c
Go to the documentation of this file.
1#include <psych.h>
2
3/* call-seq: Psych.libyaml_version
4 *
5 * Returns the version of libyaml being used
6 */
7static VALUE libyaml_version(VALUE module)
8{
9 int major, minor, patch;
10 VALUE list[3];
11
12 yaml_get_version(&major, &minor, &patch);
13
14 list[0] = INT2NUM(major);
15 list[1] = INT2NUM(minor);
16 list[2] = INT2NUM(patch);
17
18 return rb_ary_new4((long)3, list);
19}
20
21 VALUE mPsych;
22
23 void Init_psych(void)
24{
25 #ifdef HAVE_RB_EXT_RACTOR_SAFE
26 RB_EXT_RACTOR_SAFE(true);
27 #endif
28 mPsych = rb_define_module("Psych");
29
30 rb_define_singleton_method(mPsych, "libyaml_version", libyaml_version, 0);
31
32 Init_psych_parser();
33 Init_psych_emitter();
34 Init_psych_to_ruby();
35 Init_psych_yaml_tree();
36}
37/* vim: set noet sws=4 sw=4: */
rb_define_singleton_method
#define rb_define_singleton_method(klass, mid, func, arity)
Defines klass.mid.
Definition: cxxanyargs.hpp:668
rb_define_module
VALUE rb_define_module(const char *name)
Definition: class.c:871
rb_ary_new4
#define rb_ary_new4
Definition: array.h:74
RB_EXT_RACTOR_SAFE
#define RB_EXT_RACTOR_SAFE(f)
Definition: load.h:39
INT2NUM
#define INT2NUM
Definition: int.h:43
mPsych
VALUE mPsych
Definition: psych.c:21
Init_psych
void Init_psych(void)
Definition: psych.c:23
psych.h
Init_psych_emitter
void Init_psych_emitter(void)
Definition: psych_emitter.c:522
Init_psych_parser
void Init_psych_parser(void)
Definition: psych_parser.c:537
Init_psych_to_ruby
void Init_psych_to_ruby(void)
Definition: psych_to_ruby.c:27
Init_psych_yaml_tree
void Init_psych_yaml_tree(void)
Definition: psych_yaml_tree.c:5
VALUE
unsigned long VALUE
Definition: value.h:38