1static void Init_golf(
void);
2static void *goruby_options(
int argc,
char **argv);
3static int goruby_run_node(
void *arg);
4#define ruby_options goruby_options
5#define ruby_run_node goruby_run_node
13#define pipe(p) _pipe(p, 32L, _O_NOINHERIT)
14#elif defined HAVE_UNISTD_H
18RUBY_EXTERN void *ruby_options(
int argc,
char **argv);
20RUBY_EXTERN void ruby_init_ext(
const char *name,
void (*init)(
void));
22#include "golf_prelude.c"
33goruby_options(
int argc,
char **argv)
35 static const char cmd[] =
"END{require 'irb';IRB.start}";
39 if ((isatty(0) && isatty(1) && isatty(2)) && (pipe(rw) == 0)) {
49 n = write(rw[1], cmd,
sizeof(cmd) - 1);
51 ret = n > 0 ? ruby_options(argc, argv) : NULL;
57 return ruby_options(argc, argv);
61goruby_run_node(
void *arg)
64 if (
NIL_P(rb_protect(init_golf,
Qtrue, &state))) {
65 return state == EXIT_SUCCESS ? EXIT_FAILURE : state;
67 return ruby_run_node(arg);
#define RUBY_EXTERN
Declaration of externally visible global variables.
#define Qtrue
Old name of RUBY_Qtrue.
#define NIL_P
Old name of RB_NIL_P.
void rb_provide(const char *feature)
Declares that the given feature is already provided by someone else.
uintptr_t VALUE
Type that represents a Ruby object.