Skip to content

Commit

Permalink
Remove "internal/encoding.h" and "ruby/encoding.h"
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed Apr 14, 2023
1 parent c27bd8b commit 8f5b699
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions external/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ typedef struct rb_parser_config_struct {
VALUE (*debug_output_stdout)(void);
VALUE (*debug_output_stderr)(void);

/* Encoding */
// rb_encoding *enc
int (*is_usascii_enc)(void *enc);

/* Ractor */
VALUE (*ractor_make_shareable)(VALUE obj);

Expand Down
6 changes: 4 additions & 2 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ struct lex_context;
#include "ruby/internal/config.h"

#include "internal.h"
#include "internal/encoding.h"
#include "internal/imemo.h"
#include "internal/variable.h"
#include "probes.h"
#include "ruby/encoding.h"
#include "ruby/st.h"
#include "ruby/util.h"
#include "symbol.h"
Expand All @@ -52,6 +50,7 @@ struct lex_context;
#include "internal/compile.h"
#include "internal/compilers.h"
#include "internal/complex.h"
#include "internal/encoding.h"
#include "internal/error.h"
#include "internal/numeric.h"
#include "internal/hash.h"
Expand All @@ -61,6 +60,7 @@ struct lex_context;
#include "internal/symbol.h"
#include "internal/thread.h"

#include "ruby/encoding.h"
#include "ruby/ractor.h"
#include "ruby/regex.h"
#include "ruby/ruby.h"
Expand Down Expand Up @@ -157,6 +157,8 @@ RBIMPL_WARNING_POP()
#define rb_ractor_stdout p->config.debug_output_stdout
#define rb_ractor_stderr p->config.debug_output_stderr

#define rb_is_usascii_enc p->config.is_usascii_enc

#define rb_ractor_make_shareable p->config.ractor_make_shareable

#define ruby_vm_keep_script_lines p->config.vm_keep_script_lines()
Expand Down
9 changes: 9 additions & 0 deletions ruby_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "internal/bignum.h"
#include "internal/compile.h"
#include "internal/complex.h"
#include "internal/encoding.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/io.h"
Expand Down Expand Up @@ -157,6 +158,12 @@ literal_hash(VALUE a)
return rb_iseq_cdhash_hash(a);
}

static int
is_usascii_enc(void *enc)
{
return rb_is_usascii_enc((rb_encoding *)enc);
}

void
rb_parser_config_initialize(rb_parser_config_t *config)
{
Expand Down Expand Up @@ -218,6 +225,8 @@ rb_parser_config_initialize(rb_parser_config_t *config)
config->debug_output_stdout = rb_ractor_stdout;
config->debug_output_stderr = rb_ractor_stderr;

config->is_usascii_enc = is_usascii_enc;

config->ractor_make_shareable = rb_ractor_make_shareable;

config->vm_keep_script_lines = vm_keep_script_lines;
Expand Down

0 comments on commit 8f5b699

Please sign in to comment.