summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-01-10 23:38:16 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-01-15 18:57:33 +0900
commitc1bcfeec38cdc04858ba607eb6f6aaa64dc731c9 (patch)
tree5d3f76308992f1cef5c00479afb7ba02c5bce8ff /internal
parent670f3e6cd7b6ea03810af3606139021471019017 (diff)
Transfer the responsibility for MJIT options to mjit.c
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5448
Diffstat (limited to 'internal')
-rw-r--r--internal/cmdlineopt.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/internal/cmdlineopt.h b/internal/cmdlineopt.h
new file mode 100644
index 0000000000..7419beb649
--- /dev/null
+++ b/internal/cmdlineopt.h
@@ -0,0 +1,61 @@
+#ifndef INTERNAL_CMDLINEOPT_H /*-*-C-*-vi:se ft=c:*/
+#define INTERNAL_CMDLINEOPT_H
+
+#include "mjit.h"
+#include "yjit.h"
+
+typedef struct {
+ unsigned int mask;
+ unsigned int set;
+} ruby_features_t;
+
+typedef struct ruby_cmdline_options {
+ const char *script;
+ VALUE script_name;
+ VALUE e_script;
+ struct {
+ struct {
+ VALUE name;
+ int index;
+ } enc;
+ } src, ext, intern;
+ VALUE req_list;
+ ruby_features_t features;
+ ruby_features_t warn;
+ unsigned int dump;
+#if USE_MJIT
+ struct mjit_options mjit;
+#endif
+#if YJIT_SUPPORTED_P
+ struct rb_yjit_options yjit;
+#endif
+
+ int sflag, xflag;
+ unsigned int warning: 1;
+ unsigned int verbose: 1;
+ unsigned int do_loop: 1;
+ unsigned int do_print: 1;
+ unsigned int do_line: 1;
+ unsigned int do_split: 1;
+ unsigned int do_search: 1;
+ unsigned int setids: 2;
+} ruby_cmdline_options_t;
+
+struct ruby_opt_message {
+ const char *str;
+ unsigned short namelen, secondlen;
+};
+
+#define RUBY_OPT_MESSAGE(shortopt, longopt, desc) { \
+ shortopt " " longopt " " desc, \
+ (unsigned short)sizeof(shortopt), \
+ (unsigned short)sizeof(longopt), \
+}
+
+#define opt_match(s, l, name) \
+ ((((l) > rb_strlen_lit(name)) ? (s)[rb_strlen_lit(name)] == '=' : \
+ (l) == rb_strlen_lit(name)) && \
+ memcmp((s), name, rb_strlen_lit(name)) == 0 && \
+ (((s) += rb_strlen_lit(name)), 1))
+
+#endif