mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c, file.c, etc.: code-cleanup patch from Stefan Huehner
<stefan at huehner.org>. [ruby-core:08029] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
866e083484
commit
1b7465e893
25 changed files with 254 additions and 567 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Jun 21 03:01:10 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c, file.c, etc.: code-cleanup patch from Stefan Huehner
|
||||||
|
<stefan at huehner.org>. [ruby-core:08029]
|
||||||
|
|
||||||
Wed Jun 21 01:40:25 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Jun 21 01:40:25 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* parse.y (reswords): modifier token is no longer returned in fname
|
* parse.y (reswords): modifier token is no longer returned in fname
|
||||||
|
|
48
eval.c
48
eval.c
|
@ -1207,7 +1207,7 @@ error_print(void)
|
||||||
{
|
{
|
||||||
VALUE errat = Qnil; /* OK */
|
VALUE errat = Qnil; /* OK */
|
||||||
volatile VALUE eclass, e;
|
volatile VALUE eclass, e;
|
||||||
char *einfo;
|
const char *einfo;
|
||||||
long elen;
|
long elen;
|
||||||
|
|
||||||
if (NIL_P(ruby_errinfo)) return;
|
if (NIL_P(ruby_errinfo)) return;
|
||||||
|
@ -2519,7 +2519,7 @@ set_trace_func(VALUE obj, VALUE trace)
|
||||||
return trace;
|
return trace;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
get_event_name(rb_event_t event)
|
get_event_name(rb_event_t event)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
@ -2551,7 +2551,7 @@ call_trace_func(rb_event_t event, NODE *node, VALUE self, ID id, VALUE klass /*
|
||||||
struct FRAME *prev;
|
struct FRAME *prev;
|
||||||
NODE *node_save;
|
NODE *node_save;
|
||||||
VALUE srcfile;
|
VALUE srcfile;
|
||||||
char *event_name;
|
const char *event_name;
|
||||||
|
|
||||||
if (!trace_func) return;
|
if (!trace_func) return;
|
||||||
if (tracing) return;
|
if (tracing) return;
|
||||||
|
@ -4575,7 +4575,7 @@ static void
|
||||||
proc_jump_error(int state, VALUE result)
|
proc_jump_error(int state, VALUE result)
|
||||||
{
|
{
|
||||||
char mesg[32];
|
char mesg[32];
|
||||||
char *statement;
|
const char *statement;
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case TAG_BREAK:
|
case TAG_BREAK:
|
||||||
|
@ -5378,7 +5378,7 @@ rb_method_missing(int argc, const VALUE *argv, VALUE obj)
|
||||||
{
|
{
|
||||||
ID id;
|
ID id;
|
||||||
VALUE exc = rb_eNoMethodError;
|
VALUE exc = rb_eNoMethodError;
|
||||||
char *format = 0;
|
const char *format = 0;
|
||||||
NODE *cnode = ruby_current_node;
|
NODE *cnode = ruby_current_node;
|
||||||
|
|
||||||
if (argc == 0 || !SYMBOL_P(argv[0])) {
|
if (argc == 0 || !SYMBOL_P(argv[0])) {
|
||||||
|
@ -9752,8 +9752,7 @@ enum thread_status {
|
||||||
|
|
||||||
#if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
|
#if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
|
||||||
void
|
void
|
||||||
rb_fd_init(fds)
|
rb_fd_init(volatile rb_fdset_t *fds)
|
||||||
volatile rb_fdset_t *fds;
|
|
||||||
{
|
{
|
||||||
fds->maxfd = 0;
|
fds->maxfd = 0;
|
||||||
fds->fdset = ALLOC(fd_set);
|
fds->fdset = ALLOC(fd_set);
|
||||||
|
@ -9761,8 +9760,7 @@ rb_fd_init(fds)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_fd_term(fds)
|
rb_fd_term(rb_fdset_t *fds)
|
||||||
rb_fdset_t *fds;
|
|
||||||
{
|
{
|
||||||
if (fds->fdset) free(fds->fdset);
|
if (fds->fdset) free(fds->fdset);
|
||||||
fds->maxfd = 0;
|
fds->maxfd = 0;
|
||||||
|
@ -9770,8 +9768,7 @@ rb_fd_term(fds)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_fd_zero(fds)
|
rb_fd_zero(rb_fdset_t *fds)
|
||||||
rb_fdset_t *fds;
|
|
||||||
{
|
{
|
||||||
if (fds->fdset) {
|
if (fds->fdset) {
|
||||||
MEMZERO(fds->fdset, fd_mask, howmany(fds->maxfd, NFDBITS));
|
MEMZERO(fds->fdset, fd_mask, howmany(fds->maxfd, NFDBITS));
|
||||||
|
@ -9780,9 +9777,7 @@ rb_fd_zero(fds)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_fd_resize(n, fds)
|
rb_fd_resize(int n, rb_fdset_t *fds)
|
||||||
int n;
|
|
||||||
rb_fdset_t *fds;
|
|
||||||
{
|
{
|
||||||
int m = howmany(n + 1, NFDBITS) * sizeof(fd_mask);
|
int m = howmany(n + 1, NFDBITS) * sizeof(fd_mask);
|
||||||
int o = howmany(fds->maxfd, NFDBITS) * sizeof(fd_mask);
|
int o = howmany(fds->maxfd, NFDBITS) * sizeof(fd_mask);
|
||||||
|
@ -9798,37 +9793,28 @@ rb_fd_resize(n, fds)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_fd_set(n, fds)
|
rb_fd_set(int n, rb_fdset_t *fds)
|
||||||
int n;
|
|
||||||
rb_fdset_t *fds;
|
|
||||||
{
|
{
|
||||||
rb_fd_resize(n, fds);
|
rb_fd_resize(n, fds);
|
||||||
FD_SET(n, fds->fdset);
|
FD_SET(n, fds->fdset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_fd_clr(n, fds)
|
rb_fd_clr(int n, rb_fdset_t *fds)
|
||||||
int n;
|
|
||||||
rb_fdset_t *fds;
|
|
||||||
{
|
{
|
||||||
if (n >= fds->maxfd) return;
|
if (n >= fds->maxfd) return;
|
||||||
FD_CLR(n, fds->fdset);
|
FD_CLR(n, fds->fdset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rb_fd_isset(n, fds)
|
rb_fd_isset(int n, const rb_fdset_t *fds)
|
||||||
int n;
|
|
||||||
const rb_fdset_t *fds;
|
|
||||||
{
|
{
|
||||||
if (n >= fds->maxfd) return 0;
|
if (n >= fds->maxfd) return 0;
|
||||||
return FD_ISSET(n, fds->fdset) != 0; /* "!= 0" avoids FreeBSD PR 91421 */
|
return FD_ISSET(n, fds->fdset) != 0; /* "!= 0" avoids FreeBSD PR 91421 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_fd_copy(dst, src, max)
|
rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int max)
|
||||||
rb_fdset_t *dst;
|
|
||||||
const fd_set *src;
|
|
||||||
int max;
|
|
||||||
{
|
{
|
||||||
int size = howmany(max, NFDBITS) * sizeof(fd_mask);
|
int size = howmany(max, NFDBITS) * sizeof(fd_mask);
|
||||||
|
|
||||||
|
@ -9839,10 +9825,7 @@ rb_fd_copy(dst, src, max)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rb_fd_select(n, readfds, writefds, exceptfds, timeout)
|
rb_fd_select(int n, rb_fdset_t *readfds, rb_fdset_t *writefds, rb_fdset_t *exceptfds, struct timeval *timeout)
|
||||||
int n;
|
|
||||||
rb_fdset_t *readfds, *writefds, *exceptfds;
|
|
||||||
struct timeval *timeout;
|
|
||||||
{
|
{
|
||||||
rb_fd_resize(n - 1, readfds);
|
rb_fd_resize(n - 1, readfds);
|
||||||
rb_fd_resize(n - 1, writefds);
|
rb_fd_resize(n - 1, writefds);
|
||||||
|
@ -11788,8 +11771,7 @@ rb_thread_stop_timer()
|
||||||
}
|
}
|
||||||
#elif defined(HAVE_SETITIMER)
|
#elif defined(HAVE_SETITIMER)
|
||||||
static void
|
static void
|
||||||
catch_timer(sig)
|
catch_timer(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
#if !defined(POSIX_SIGNAL) && !defined(BSD_SIGNAL)
|
#if !defined(POSIX_SIGNAL) && !defined(BSD_SIGNAL)
|
||||||
signal(sig, catch_timer);
|
signal(sig, catch_timer);
|
||||||
|
|
|
@ -1823,7 +1823,7 @@ VpInit(U_LONG BaseVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
VP_EXPORT Real *
|
VP_EXPORT Real *
|
||||||
VpOne()
|
VpOne(void)
|
||||||
{
|
{
|
||||||
return VpConstOne;
|
return VpConstOne;
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ VP_EXPORT void VpFrac(Real *y,Real *x);
|
||||||
VP_EXPORT int VpPower(Real *y,Real *x,S_INT n);
|
VP_EXPORT int VpPower(Real *y,Real *x,S_INT n);
|
||||||
|
|
||||||
/* VP constants */
|
/* VP constants */
|
||||||
VP_EXPORT Real *VpOne();
|
VP_EXPORT Real *VpOne(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ------------------
|
* ------------------
|
||||||
|
|
|
@ -40,8 +40,7 @@ char *getlogin();
|
||||||
* Etc.getlogin -> 'guest'
|
* Etc.getlogin -> 'guest'
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
etc_getlogin(obj)
|
etc_getlogin(VALUE obj)
|
||||||
VALUE obj;
|
|
||||||
{
|
{
|
||||||
char *login;
|
char *login;
|
||||||
|
|
||||||
|
@ -60,8 +59,7 @@ etc_getlogin(obj)
|
||||||
|
|
||||||
#if defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT)
|
#if defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT)
|
||||||
static VALUE
|
static VALUE
|
||||||
safe_setup_str(str)
|
safe_setup_str(const char *str)
|
||||||
const char *str;
|
|
||||||
{
|
{
|
||||||
if (str == 0) str = "";
|
if (str == 0) str = "";
|
||||||
return rb_tainted_str_new2(str);
|
return rb_tainted_str_new2(str);
|
||||||
|
|
|
@ -92,10 +92,7 @@ wait_readable(VALUE p)
|
||||||
=end
|
=end
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
io_wait(argc, argv, io)
|
io_wait(int argc, VALUE *argv, VALUE io)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE io;
|
|
||||||
{
|
{
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
struct wait_readable_arg arg;
|
struct wait_readable_arg arg;
|
||||||
|
|
|
@ -196,7 +196,7 @@ establishShell(int argc, VALUE *argv, struct pty_info *info)
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
char *shellname;
|
const char *shellname;
|
||||||
|
|
||||||
if ((p = getenv("SHELL")) != NULL) {
|
if ((p = getenv("SHELL")) != NULL) {
|
||||||
shellname = p;
|
shellname = p;
|
||||||
|
|
|
@ -67,8 +67,7 @@ static inline long num_to_long _((VALUE n));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static ID
|
static ID
|
||||||
value_to_id(v)
|
value_to_id(VALUE v)
|
||||||
VALUE v;
|
|
||||||
{
|
{
|
||||||
#ifndef SYMBOL_P
|
#ifndef SYMBOL_P
|
||||||
# define SYMBOL_P(v) FIXNUM_P(v)
|
# define SYMBOL_P(v) FIXNUM_P(v)
|
||||||
|
@ -88,8 +87,7 @@ value_to_id(v)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline long
|
static inline long
|
||||||
num_to_long(n)
|
num_to_long(VALUE n)
|
||||||
VALUE n;
|
|
||||||
{
|
{
|
||||||
return NUM2LONG(n);
|
return NUM2LONG(n);
|
||||||
}
|
}
|
||||||
|
@ -106,9 +104,7 @@ static VALUE get_stack_tail _((VALUE stack, long len));
|
||||||
static void cut_stack_tail _((VALUE stack, long len));
|
static void cut_stack_tail _((VALUE stack, long len));
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
get_stack_tail(stack, len)
|
get_stack_tail(VALUE stack, long len)
|
||||||
VALUE stack;
|
|
||||||
long len;
|
|
||||||
{
|
{
|
||||||
if (len < 0) return Qnil; /* system error */
|
if (len < 0) return Qnil; /* system error */
|
||||||
if (len > RARRAY(stack)->len) len = RARRAY(stack)->len;
|
if (len > RARRAY(stack)->len) len = RARRAY(stack)->len;
|
||||||
|
@ -116,9 +112,7 @@ get_stack_tail(stack, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cut_stack_tail(stack, len)
|
cut_stack_tail(VALUE stack, long len)
|
||||||
VALUE stack;
|
|
||||||
long len;
|
|
||||||
{
|
{
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
rb_ary_pop(stack);
|
rb_ary_pop(stack);
|
||||||
|
@ -231,8 +225,7 @@ static VALUE reduce0 _((VALUE block_args, VALUE data, VALUE self));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
racc_cparse(parser, arg, sysdebug)
|
racc_cparse(VALUE parser, VALUE arg, VALUE sysdebug)
|
||||||
VALUE parser, arg, sysdebug;
|
|
||||||
{
|
{
|
||||||
struct cparse_params params;
|
struct cparse_params params;
|
||||||
struct cparse_params *v = ¶ms;
|
struct cparse_params *v = ¶ms;
|
||||||
|
@ -247,8 +240,7 @@ racc_cparse(parser, arg, sysdebug)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
racc_yyparse(parser, lexer, lexmid, arg, sysdebug)
|
racc_yyparse(VALUE parser, VALUE lexer, VALUE lexmid, VALUE arg, VALUE sysdebug)
|
||||||
VALUE parser, lexer, lexmid, arg, sysdebug;
|
|
||||||
{
|
{
|
||||||
struct cparse_params params;
|
struct cparse_params params;
|
||||||
struct cparse_params *v = ¶ms;
|
struct cparse_params *v = ¶ms;
|
||||||
|
@ -269,15 +261,13 @@ racc_yyparse(parser, lexer, lexmid, arg, sysdebug)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
call_lexer(v)
|
call_lexer(struct cparse_params *v)
|
||||||
struct cparse_params *v;
|
|
||||||
{
|
{
|
||||||
rb_iterate(lexer_iter, v->value_v, lexer_i, v->value_v);
|
rb_iterate(lexer_iter, v->value_v, lexer_i, v->value_v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
lexer_iter(data)
|
lexer_iter(VALUE data)
|
||||||
VALUE data;
|
|
||||||
{
|
{
|
||||||
struct cparse_params *v;
|
struct cparse_params *v;
|
||||||
|
|
||||||
|
@ -287,8 +277,7 @@ lexer_iter(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
lexer_i(block_args, data, self)
|
lexer_i(VALUE block_args, VALUE data, VALUE self)
|
||||||
VALUE block_args, data, self;
|
|
||||||
{
|
{
|
||||||
struct cparse_params *v;
|
struct cparse_params *v;
|
||||||
VALUE tok, val;
|
VALUE tok, val;
|
||||||
|
@ -304,32 +293,27 @@ lexer_i(block_args, data, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
assert_array(a)
|
assert_array(VALUE a)
|
||||||
VALUE a;
|
|
||||||
{
|
{
|
||||||
Check_Type(a, T_ARRAY);
|
Check_Type(a, T_ARRAY);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
assert_hash(h)
|
assert_hash(VALUE h)
|
||||||
VALUE h;
|
|
||||||
{
|
{
|
||||||
Check_Type(h, T_HASH);
|
Check_Type(h, T_HASH);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
static long
|
||||||
assert_integer(n)
|
assert_integer(VALUE n)
|
||||||
VALUE n;
|
|
||||||
{
|
{
|
||||||
return NUM2LONG(n);
|
return NUM2LONG(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initialize_params(v, parser, arg, lexer, lexmid)
|
initialize_params(struct cparse_params *v, VALUE parser, VALUE arg, VALUE lexer, VALUE lexmid)
|
||||||
struct cparse_params *v;
|
|
||||||
VALUE parser, arg, lexer, lexmid;
|
|
||||||
{
|
{
|
||||||
v->value_v = Data_Wrap_Struct(CparseParams, 0, 0, v);
|
v->value_v = Data_Wrap_Struct(CparseParams, 0, 0, v);
|
||||||
|
|
||||||
|
@ -380,10 +364,7 @@ initialize_params(v, parser, arg, lexer, lexmid)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
extract_user_token(v, block_args, tok, val)
|
extract_user_token(struct cparse_params *v, VALUE block_args, VALUE *tok, VALUE *val)
|
||||||
struct cparse_params *v;
|
|
||||||
VALUE block_args;
|
|
||||||
VALUE *tok, *val;
|
|
||||||
{
|
{
|
||||||
if (NIL_P(block_args)) {
|
if (NIL_P(block_args)) {
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
@ -426,10 +407,7 @@ extract_user_token(v, block_args, tok, val)
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_main(v, tok, val, resume)
|
parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume)
|
||||||
struct cparse_params *v;
|
|
||||||
VALUE tok, val;
|
|
||||||
int resume;
|
|
||||||
{
|
{
|
||||||
long i; /* table index */
|
long i; /* table index */
|
||||||
long act; /* action type */
|
long act; /* action type */
|
||||||
|
@ -636,10 +614,7 @@ parse_main(v, tok, val, resume)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
shift(v, act, tok, val)
|
shift(struct cparse_params *v, long act, VALUE tok, VALUE val)
|
||||||
struct cparse_params *v;
|
|
||||||
long act;
|
|
||||||
VALUE tok, val;
|
|
||||||
{
|
{
|
||||||
PUSH(v->vstack, val);
|
PUSH(v->vstack, val);
|
||||||
if (v->debug) {
|
if (v->debug) {
|
||||||
|
@ -652,9 +627,7 @@ shift(v, act, tok, val)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
reduce(v, act)
|
reduce(struct cparse_params *v, long act)
|
||||||
struct cparse_params *v;
|
|
||||||
long act;
|
|
||||||
{
|
{
|
||||||
VALUE code;
|
VALUE code;
|
||||||
v->ruleno = -act * 3;
|
v->ruleno = -act * 3;
|
||||||
|
@ -664,15 +637,13 @@ reduce(v, act)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
catch_iter(dummy)
|
catch_iter(VALUE dummy)
|
||||||
VALUE dummy;
|
|
||||||
{
|
{
|
||||||
return rb_funcall(rb_mKernel, id_catch, 1, sym_raccjump);
|
return rb_funcall(rb_mKernel, id_catch, 1, sym_raccjump);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
reduce0(val, data, self)
|
reduce0(VALUE val, VALUE data, VALUE self)
|
||||||
VALUE val, data, self;
|
|
||||||
{
|
{
|
||||||
struct cparse_params *v;
|
struct cparse_params *v;
|
||||||
VALUE reduce_to, reduce_len, method_id;
|
VALUE reduce_to, reduce_len, method_id;
|
||||||
|
|
|
@ -198,8 +198,7 @@ if (pai->ai_flags & AI_CANONNAME) {\
|
||||||
const
|
const
|
||||||
#endif
|
#endif
|
||||||
char *
|
char *
|
||||||
gai_strerror(ecode)
|
gai_strerror(int ecode)
|
||||||
int ecode;
|
|
||||||
{
|
{
|
||||||
if (ecode < 0 || ecode > EAI_MAX)
|
if (ecode < 0 || ecode > EAI_MAX)
|
||||||
ecode = EAI_MAX;
|
ecode = EAI_MAX;
|
||||||
|
@ -207,7 +206,7 @@ gai_strerror(ecode)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
freeaddrinfo(ai)
|
freeaddrinfo(struct addrinfo *ai)
|
||||||
struct addrinfo *ai;
|
struct addrinfo *ai;
|
||||||
{
|
{
|
||||||
struct addrinfo *next;
|
struct addrinfo *next;
|
||||||
|
@ -222,8 +221,7 @@ freeaddrinfo(ai)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
str_isnumber(p)
|
str_isnumber(const char *p)
|
||||||
const char *p;
|
|
||||||
{
|
{
|
||||||
char *q = (char *)p;
|
char *q = (char *)p;
|
||||||
while (*q) {
|
while (*q) {
|
||||||
|
@ -237,10 +235,7 @@ str_isnumber(p)
|
||||||
#ifndef HAVE_INET_PTON
|
#ifndef HAVE_INET_PTON
|
||||||
|
|
||||||
static int
|
static int
|
||||||
inet_pton(af, hostname, pton)
|
inet_pton(int af, const char *hostname, void *pton)
|
||||||
int af;
|
|
||||||
const char *hostname;
|
|
||||||
void *pton;
|
|
||||||
{
|
{
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
|
|
||||||
|
@ -268,10 +263,7 @@ inet_pton(af, hostname, pton)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
getaddrinfo(hostname, servname, hints, res)
|
getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res)
|
||||||
const char *hostname, *servname;
|
|
||||||
const struct addrinfo *hints;
|
|
||||||
struct addrinfo **res;
|
|
||||||
{
|
{
|
||||||
struct addrinfo sentinel;
|
struct addrinfo sentinel;
|
||||||
struct addrinfo *top = NULL;
|
struct addrinfo *top = NULL;
|
||||||
|
@ -538,13 +530,7 @@ getaddrinfo(hostname, servname, hints, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_name(addr, afd, res, numaddr, pai, port0)
|
get_name(const char *addr, const struct aft *afd, struct addrinfo **res, char *numaddr, struct addrinfo *pai, int port0)
|
||||||
const char *addr;
|
|
||||||
const struct afd *afd;
|
|
||||||
struct addrinfo **res;
|
|
||||||
char *numaddr;
|
|
||||||
struct addrinfo *pai;
|
|
||||||
int port0;
|
|
||||||
{
|
{
|
||||||
u_short port = port0 & 0xffff;
|
u_short port = port0 & 0xffff;
|
||||||
struct hostent *hp;
|
struct hostent *hp;
|
||||||
|
@ -584,12 +570,7 @@ get_name(addr, afd, res, numaddr, pai, port0)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_addr(hostname, af, res, pai, port0)
|
get_addr(const char *hostname, int af, struct addrinfo **res, struct addrinfo *pai, int port0)
|
||||||
const char *hostname;
|
|
||||||
int af;
|
|
||||||
struct addrinfo **res;
|
|
||||||
struct addrinfo *pai;
|
|
||||||
int port0;
|
|
||||||
{
|
{
|
||||||
u_short port = port0 & 0xffff;
|
u_short port = port0 & 0xffff;
|
||||||
struct addrinfo sentinel;
|
struct addrinfo sentinel;
|
||||||
|
|
|
@ -115,11 +115,7 @@ static struct afd {
|
||||||
|
|
||||||
#ifndef HAVE_INET_NTOP
|
#ifndef HAVE_INET_NTOP
|
||||||
static const char *
|
static const char *
|
||||||
inet_ntop(af, addr, numaddr, numaddr_len)
|
inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len)
|
||||||
int af;
|
|
||||||
const void *addr;
|
|
||||||
char *numaddr;
|
|
||||||
size_t numaddr_len;
|
|
||||||
{
|
{
|
||||||
#ifdef HAVE_INET_NTOA
|
#ifdef HAVE_INET_NTOA
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
|
@ -136,14 +132,7 @@ inet_ntop(af, addr, numaddr, numaddr_len)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
|
getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags)
|
||||||
const struct sockaddr *sa;
|
|
||||||
size_t salen;
|
|
||||||
char *host;
|
|
||||||
size_t hostlen;
|
|
||||||
char *serv;
|
|
||||||
size_t servlen;
|
|
||||||
int flags;
|
|
||||||
{
|
{
|
||||||
struct afd *afd;
|
struct afd *afd;
|
||||||
struct servent *sp;
|
struct servent *sp;
|
||||||
|
|
|
@ -53,8 +53,7 @@ strio_alloc()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
strio_mark(ptr)
|
strio_mark(struct StringIO *ptr)
|
||||||
struct StringIO *ptr;
|
|
||||||
{
|
{
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
rb_gc_mark(ptr->string);
|
rb_gc_mark(ptr->string);
|
||||||
|
@ -62,8 +61,7 @@ strio_mark(ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
strio_free(ptr)
|
strio_free(struct StringIO *ptr)
|
||||||
struct StringIO *ptr;
|
|
||||||
{
|
{
|
||||||
if (--ptr->count <= 0) {
|
if (--ptr->count <= 0) {
|
||||||
xfree(ptr);
|
xfree(ptr);
|
||||||
|
@ -71,8 +69,7 @@ strio_free(ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct StringIO*
|
static struct StringIO*
|
||||||
check_strio(self)
|
check_strio(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
Check_Type(self, T_DATA);
|
Check_Type(self, T_DATA);
|
||||||
if (!IS_STRIO(self)) {
|
if (!IS_STRIO(self)) {
|
||||||
|
@ -83,8 +80,7 @@ check_strio(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct StringIO*
|
static struct StringIO*
|
||||||
get_strio(self)
|
get_strio(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = check_strio(self);
|
struct StringIO *ptr = check_strio(self);
|
||||||
|
|
||||||
|
@ -101,8 +97,7 @@ get_strio(self)
|
||||||
#define WRITABLE(ptr) ((ptr)->flags & FMODE_WRITABLE)
|
#define WRITABLE(ptr) ((ptr)->flags & FMODE_WRITABLE)
|
||||||
|
|
||||||
static struct StringIO*
|
static struct StringIO*
|
||||||
readable(ptr)
|
readable(struct StringIO *ptr)
|
||||||
struct StringIO *ptr;
|
|
||||||
{
|
{
|
||||||
if (!READABLE(ptr)) {
|
if (!READABLE(ptr)) {
|
||||||
rb_raise(rb_eIOError, "not opened for reading");
|
rb_raise(rb_eIOError, "not opened for reading");
|
||||||
|
@ -111,8 +106,7 @@ readable(ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct StringIO*
|
static struct StringIO*
|
||||||
writable(ptr)
|
writable(struct StringIO *ptr)
|
||||||
struct StringIO *ptr;
|
|
||||||
{
|
{
|
||||||
if (!WRITABLE(ptr)) {
|
if (!WRITABLE(ptr)) {
|
||||||
rb_raise(rb_eIOError, "not opened for writing");
|
rb_raise(rb_eIOError, "not opened for writing");
|
||||||
|
@ -124,8 +118,7 @@ writable(ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_modifiable(ptr)
|
check_modifiable(struct StringIO *ptr)
|
||||||
struct StringIO *ptr;
|
|
||||||
{
|
{
|
||||||
if (OBJ_FROZEN(ptr->string)) {
|
if (OBJ_FROZEN(ptr->string)) {
|
||||||
rb_raise(rb_eIOError, "not modifiable string");
|
rb_raise(rb_eIOError, "not modifiable string");
|
||||||
|
@ -193,10 +186,7 @@ strio_s_allocate(klass)
|
||||||
* returned from the block.
|
* returned from the block.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_s_open(argc, argv, klass)
|
strio_s_open(int argc, VALUE *argv, VALUE klass)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE klass;
|
|
||||||
{
|
{
|
||||||
VALUE obj = rb_class_new_instance(argc, argv, klass);
|
VALUE obj = rb_class_new_instance(argc, argv, klass);
|
||||||
if (!rb_block_given_p()) return obj;
|
if (!rb_block_given_p()) return obj;
|
||||||
|
@ -209,10 +199,7 @@ strio_s_open(argc, argv, klass)
|
||||||
* Creates new StringIO instance from with _string_ and _mode_.
|
* Creates new StringIO instance from with _string_ and _mode_.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_initialize(argc, argv, self)
|
strio_initialize(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = check_strio(self);
|
struct StringIO *ptr = check_strio(self);
|
||||||
VALUE string, mode;
|
VALUE string, mode;
|
||||||
|
@ -257,8 +244,7 @@ strio_initialize(argc, argv, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_finalize(self)
|
strio_finalize(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
ptr->string = Qnil;
|
ptr->string = Qnil;
|
||||||
|
@ -270,8 +256,7 @@ strio_finalize(self)
|
||||||
* Returns +false+. Just for compatibility to IO.
|
* Returns +false+. Just for compatibility to IO.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_false(self)
|
strio_false(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
StringIO(self);
|
StringIO(self);
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
|
@ -281,8 +266,7 @@ strio_false(self)
|
||||||
* Returns +nil+. Just for compatibility to IO.
|
* Returns +nil+. Just for compatibility to IO.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_nil(self)
|
strio_nil(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
StringIO(self);
|
StringIO(self);
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
@ -292,8 +276,7 @@ strio_nil(self)
|
||||||
* Returns *strio* itself. Just for compatibility to IO.
|
* Returns *strio* itself. Just for compatibility to IO.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_self(self)
|
strio_self(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
StringIO(self);
|
StringIO(self);
|
||||||
return self;
|
return self;
|
||||||
|
@ -303,8 +286,7 @@ strio_self(self)
|
||||||
* Returns 0. Just for compatibility to IO.
|
* Returns 0. Just for compatibility to IO.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_0(self)
|
strio_0(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
StringIO(self);
|
StringIO(self);
|
||||||
return INT2FIX(0);
|
return INT2FIX(0);
|
||||||
|
@ -314,8 +296,7 @@ strio_0(self)
|
||||||
* Returns the argument unchanged. Just for compatibility to IO.
|
* Returns the argument unchanged. Just for compatibility to IO.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_first(self, arg)
|
strio_first(VALUE self, VALUE arg)
|
||||||
VALUE self, arg;
|
|
||||||
{
|
{
|
||||||
StringIO(self);
|
StringIO(self);
|
||||||
return arg;
|
return arg;
|
||||||
|
@ -325,10 +306,7 @@ strio_first(self, arg)
|
||||||
* Raises NotImplementedError.
|
* Raises NotImplementedError.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_unimpl(argc, argv, self)
|
strio_unimpl(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
StringIO(self);
|
StringIO(self);
|
||||||
rb_notimplement();
|
rb_notimplement();
|
||||||
|
@ -341,8 +319,7 @@ strio_unimpl(argc, argv, self)
|
||||||
* Returns underlying String object, the subject of IO.
|
* Returns underlying String object, the subject of IO.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_get_string(self)
|
strio_get_string(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
return StringIO(self)->string;
|
return StringIO(self)->string;
|
||||||
}
|
}
|
||||||
|
@ -354,8 +331,7 @@ strio_get_string(self)
|
||||||
* Changes underlying String object, the subject of IO.
|
* Changes underlying String object, the subject of IO.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_set_string(self, string)
|
strio_set_string(VALUE self, VALUE string)
|
||||||
VALUE self, string;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
|
|
||||||
|
@ -376,8 +352,7 @@ strio_set_string(self, string)
|
||||||
* operations; an +IOError+ is raised if such an attempt is made.
|
* operations; an +IOError+ is raised if such an attempt is made.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_close(self)
|
strio_close(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
if (CLOSED(ptr)) {
|
if (CLOSED(ptr)) {
|
||||||
|
@ -395,8 +370,7 @@ strio_close(self)
|
||||||
* *strio* is not readable.
|
* *strio* is not readable.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_close_read(self)
|
strio_close_read(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
if (!READABLE(ptr)) {
|
if (!READABLE(ptr)) {
|
||||||
|
@ -414,8 +388,7 @@ strio_close_read(self)
|
||||||
* *strio* is not writeable.
|
* *strio* is not writeable.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_close_write(self)
|
strio_close_write(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
if (!WRITABLE(ptr)) {
|
if (!WRITABLE(ptr)) {
|
||||||
|
@ -432,8 +405,7 @@ strio_close_write(self)
|
||||||
* Returns +true+ if *strio* is completely closed, +false+ otherwise.
|
* Returns +true+ if *strio* is completely closed, +false+ otherwise.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_closed(self)
|
strio_closed(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
if (!CLOSED(ptr)) return Qfalse;
|
if (!CLOSED(ptr)) return Qfalse;
|
||||||
|
@ -447,8 +419,7 @@ strio_closed(self)
|
||||||
* Returns +true+ if *strio* is not readable, +false+ otherwise.
|
* Returns +true+ if *strio* is not readable, +false+ otherwise.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_closed_read(self)
|
strio_closed_read(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
if (READABLE(ptr)) return Qfalse;
|
if (READABLE(ptr)) return Qfalse;
|
||||||
|
@ -462,8 +433,7 @@ strio_closed_read(self)
|
||||||
* Returns +true+ if *strio* is not writable, +false+ otherwise.
|
* Returns +true+ if *strio* is not writable, +false+ otherwise.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_closed_write(self)
|
strio_closed_write(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
if (WRITABLE(ptr)) return Qfalse;
|
if (WRITABLE(ptr)) return Qfalse;
|
||||||
|
@ -479,8 +449,7 @@ strio_closed_write(self)
|
||||||
* opened for reading or an +IOError+ will be raised.
|
* opened for reading or an +IOError+ will be raised.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_eof(self)
|
strio_eof(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = readable(StringIO(self));
|
struct StringIO *ptr = readable(StringIO(self));
|
||||||
if (ptr->pos < RSTRING(ptr->string)->len) return Qfalse;
|
if (ptr->pos < RSTRING(ptr->string)->len) return Qfalse;
|
||||||
|
@ -516,8 +485,7 @@ strio_copy(VALUE copy, VALUE orig)
|
||||||
* newline. See also the <code>$.</code> variable.
|
* newline. See also the <code>$.</code> variable.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_get_lineno(self)
|
strio_get_lineno(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
return LONG2NUM(StringIO(self)->lineno);
|
return LONG2NUM(StringIO(self)->lineno);
|
||||||
}
|
}
|
||||||
|
@ -530,8 +498,7 @@ strio_get_lineno(self)
|
||||||
* <code>$.</code> is updated only on the next read.
|
* <code>$.</code> is updated only on the next read.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_set_lineno(self, lineno)
|
strio_set_lineno(VALUE self, VALUE lineno)
|
||||||
VALUE self, lineno;
|
|
||||||
{
|
{
|
||||||
StringIO(self)->lineno = NUM2LONG(lineno);
|
StringIO(self)->lineno = NUM2LONG(lineno);
|
||||||
return lineno;
|
return lineno;
|
||||||
|
@ -575,8 +542,7 @@ strio_reopen(int argc, VALUE *argv, VALUE self)
|
||||||
* Returns the current offset (in bytes) of *strio*.
|
* Returns the current offset (in bytes) of *strio*.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_get_pos(self)
|
strio_get_pos(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
return LONG2NUM(StringIO(self)->pos);
|
return LONG2NUM(StringIO(self)->pos);
|
||||||
}
|
}
|
||||||
|
@ -588,9 +554,7 @@ strio_get_pos(self)
|
||||||
* Seeks to the given position (in bytes) in *strio*.
|
* Seeks to the given position (in bytes) in *strio*.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_set_pos(self, pos)
|
strio_set_pos(VALUE self, VALUE pos)
|
||||||
VALUE self;
|
|
||||||
VALUE pos;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
long p = NUM2LONG(pos);
|
long p = NUM2LONG(pos);
|
||||||
|
@ -609,8 +573,7 @@ strio_set_pos(self, pos)
|
||||||
* +lineno+ to zero.
|
* +lineno+ to zero.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_rewind(self)
|
strio_rewind(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
ptr->pos = 0;
|
ptr->pos = 0;
|
||||||
|
@ -626,10 +589,7 @@ strio_rewind(self)
|
||||||
* the value of _whence_ (see IO#seek).
|
* the value of _whence_ (see IO#seek).
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_seek(argc, argv, self)
|
strio_seek(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE whence;
|
VALUE whence;
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
|
@ -663,8 +623,7 @@ strio_seek(argc, argv, self)
|
||||||
* Returns +true+ always.
|
* Returns +true+ always.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_get_sync(self)
|
strio_get_sync(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
StringIO(self);
|
StringIO(self);
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
|
@ -682,8 +641,7 @@ strio_get_sync(self)
|
||||||
* See IO#each_byte.
|
* See IO#each_byte.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_each_byte(self)
|
strio_each_byte(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = readable(StringIO(self));
|
struct StringIO *ptr = readable(StringIO(self));
|
||||||
while (ptr->pos < RSTRING(ptr->string)->len) {
|
while (ptr->pos < RSTRING(ptr->string)->len) {
|
||||||
|
@ -700,8 +658,7 @@ strio_each_byte(self)
|
||||||
* See IO#getc.
|
* See IO#getc.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_getc(self)
|
strio_getc(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = readable(StringIO(self));
|
struct StringIO *ptr = readable(StringIO(self));
|
||||||
int c;
|
int c;
|
||||||
|
@ -740,8 +697,7 @@ strio_extend(struct StringIO *ptr, long pos, long len)
|
||||||
* In other case, there is no limitation for multiple pushbacks.
|
* In other case, there is no limitation for multiple pushbacks.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_ungetc(self, ch)
|
strio_ungetc(VALUE self, VALUE ch)
|
||||||
VALUE self, ch;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = readable(StringIO(self));
|
struct StringIO *ptr = readable(StringIO(self));
|
||||||
int cc = NUM2INT(ch);
|
int cc = NUM2INT(ch);
|
||||||
|
@ -767,8 +723,7 @@ strio_ungetc(self, ch)
|
||||||
* See IO#readchar.
|
* See IO#readchar.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_readchar(self)
|
strio_readchar(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE c = strio_getc(self);
|
VALUE c = strio_getc(self);
|
||||||
if (NIL_P(c)) rb_eof_error();
|
if (NIL_P(c)) rb_eof_error();
|
||||||
|
@ -776,10 +731,7 @@ strio_readchar(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bm_init_skip(skip, pat, m)
|
bm_init_skip(long *skip, const char *pat, long m)
|
||||||
long *skip;
|
|
||||||
const char *pat;
|
|
||||||
long m;
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
@ -792,12 +744,7 @@ bm_init_skip(skip, pat, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
static long
|
||||||
bm_search(little, llen, big, blen, skip)
|
bm_search(const char *little, long llen, const char *big, long blen, const long *skip)
|
||||||
const char *little;
|
|
||||||
long llen;
|
|
||||||
const char *big;
|
|
||||||
long blen;
|
|
||||||
const long *skip;
|
|
||||||
{
|
{
|
||||||
long i, j, k;
|
long i, j, k;
|
||||||
|
|
||||||
|
@ -816,10 +763,7 @@ bm_search(little, llen, big, blen, skip)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_getline(argc, argv, ptr)
|
strio_getline(int argc, VALUE *argv, struct StringIO *ptr)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
struct StringIO *ptr;
|
|
||||||
{
|
{
|
||||||
const char *s, *e, *p;
|
const char *s, *e, *p;
|
||||||
long n;
|
long n;
|
||||||
|
@ -897,10 +841,7 @@ strio_getline(argc, argv, ptr)
|
||||||
* See IO#gets.
|
* See IO#gets.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_gets(argc, argv, self)
|
strio_gets(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE str = strio_getline(argc, argv, readable(StringIO(self)));
|
VALUE str = strio_getline(argc, argv, readable(StringIO(self)));
|
||||||
|
|
||||||
|
@ -915,10 +856,7 @@ strio_gets(argc, argv, self)
|
||||||
* See IO#readline.
|
* See IO#readline.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_readline(argc, argv, self)
|
strio_readline(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE line = strio_getline(argc, argv, readable(StringIO(self)));
|
VALUE line = strio_getline(argc, argv, readable(StringIO(self)));
|
||||||
if (NIL_P(line)) rb_eof_error();
|
if (NIL_P(line)) rb_eof_error();
|
||||||
|
@ -933,10 +871,7 @@ strio_readline(argc, argv, self)
|
||||||
* See IO#each.
|
* See IO#each.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_each(argc, argv, self)
|
strio_each(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
VALUE line;
|
VALUE line;
|
||||||
|
@ -954,10 +889,7 @@ strio_each(argc, argv, self)
|
||||||
* See IO#readlines.
|
* See IO#readlines.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_readlines(argc, argv, self)
|
strio_readlines(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = StringIO(self);
|
struct StringIO *ptr = StringIO(self);
|
||||||
VALUE ary = rb_ary_new(), line;
|
VALUE ary = rb_ary_new(), line;
|
||||||
|
@ -978,8 +910,7 @@ strio_readlines(argc, argv, self)
|
||||||
* Returns the number of bytes written. See IO#write.
|
* Returns the number of bytes written. See IO#write.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_write(self, str)
|
strio_write(VALUE self, VALUE str)
|
||||||
VALUE self, str;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = writable(StringIO(self));
|
struct StringIO *ptr = writable(StringIO(self));
|
||||||
long len, olen;
|
long len, olen;
|
||||||
|
@ -1037,8 +968,7 @@ strio_write(self, str)
|
||||||
* See IO#putc.
|
* See IO#putc.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_putc(self, ch)
|
strio_putc(VALUE self, VALUE ch)
|
||||||
VALUE self, ch;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = writable(StringIO(self));
|
struct StringIO *ptr = writable(StringIO(self));
|
||||||
int c = NUM2CHR(ch);
|
int c = NUM2CHR(ch);
|
||||||
|
@ -1070,10 +1000,7 @@ strio_putc(self, ch)
|
||||||
* See IO#read.
|
* See IO#read.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_read(argc, argv, self)
|
strio_read(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct StringIO *ptr = readable(StringIO(self));
|
struct StringIO *ptr = readable(StringIO(self));
|
||||||
VALUE str = Qnil;
|
VALUE str = Qnil;
|
||||||
|
@ -1178,8 +1105,7 @@ strio_sysread(int argc, VALUE *argv, VALUE self)
|
||||||
* Returns the size of the buffer string.
|
* Returns the size of the buffer string.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_size(self)
|
strio_size(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE string = StringIO(self)->string;
|
VALUE string = StringIO(self)->string;
|
||||||
if (NIL_P(string)) {
|
if (NIL_P(string)) {
|
||||||
|
@ -1196,8 +1122,7 @@ strio_size(self)
|
||||||
* must be opened for writing.
|
* must be opened for writing.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strio_truncate(self, len)
|
strio_truncate(VALUE self, VALUE len)
|
||||||
VALUE self, len;
|
|
||||||
{
|
{
|
||||||
VALUE string = writable(StringIO(self))->string;
|
VALUE string = writable(StringIO(self))->string;
|
||||||
long l = NUM2LONG(len);
|
long l = NUM2LONG(len);
|
||||||
|
|
|
@ -119,18 +119,14 @@ static VALUE inspect2 _((struct strscanner *p));
|
||||||
======================================================================= */
|
======================================================================= */
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
infect(str, p)
|
infect(VALUE str, struct strscanner *p)
|
||||||
VALUE str;
|
|
||||||
struct strscanner *p;
|
|
||||||
{
|
{
|
||||||
OBJ_INFECT(str, p->str);
|
OBJ_INFECT(str, p->str);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
extract_range(p, beg_i, end_i)
|
extract_range(struct strscanner *p, long beg_i, long end_i)
|
||||||
struct strscanner *p;
|
|
||||||
long beg_i, end_i;
|
|
||||||
{
|
{
|
||||||
if (beg_i > S_LEN(p)) return Qnil;
|
if (beg_i > S_LEN(p)) return Qnil;
|
||||||
if (end_i > S_LEN(p))
|
if (end_i > S_LEN(p))
|
||||||
|
@ -139,9 +135,7 @@ extract_range(p, beg_i, end_i)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
extract_beg_len(p, beg_i, len)
|
extract_beg_len(struct strscanner *p, long beg_i, long len)
|
||||||
struct strscanner *p;
|
|
||||||
long beg_i, len;
|
|
||||||
{
|
{
|
||||||
if (beg_i > S_LEN(p)) return Qnil;
|
if (beg_i > S_LEN(p)) return Qnil;
|
||||||
if (beg_i + len > S_LEN(p))
|
if (beg_i + len > S_LEN(p))
|
||||||
|
@ -154,23 +148,20 @@ extract_beg_len(p, beg_i, len)
|
||||||
======================================================================= */
|
======================================================================= */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
strscan_mark(p)
|
strscan_mark(struct strscanner *p)
|
||||||
struct strscanner *p;
|
|
||||||
{
|
{
|
||||||
rb_gc_mark(p->str);
|
rb_gc_mark(p->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
strscan_free(p)
|
strscan_free(struct strscanner *p)
|
||||||
struct strscanner *p;
|
|
||||||
{
|
{
|
||||||
onig_region_free(&(p->regs), 0);
|
onig_region_free(&(p->regs), 0);
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_s_allocate(klass)
|
strscan_s_allocate(VALUE klass)
|
||||||
VALUE klass;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -189,10 +180,7 @@ strscan_s_allocate(klass)
|
||||||
* +dup+ argument is obsolete and not used now.
|
* +dup+ argument is obsolete and not used now.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_initialize(argc, argv, self)
|
strscan_initialize(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
VALUE str, need_dup;
|
VALUE str, need_dup;
|
||||||
|
@ -206,8 +194,7 @@ strscan_initialize(argc, argv, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
check_strscan(obj)
|
check_strscan(VALUE obj)
|
||||||
VALUE obj;
|
|
||||||
{
|
{
|
||||||
if (TYPE(obj) != T_DATA || RDATA(obj)->dmark != (RUBY_DATA_FUNC)strscan_mark) {
|
if (TYPE(obj) != T_DATA || RDATA(obj)->dmark != (RUBY_DATA_FUNC)strscan_mark) {
|
||||||
rb_raise(rb_eTypeError,
|
rb_raise(rb_eTypeError,
|
||||||
|
@ -224,8 +211,7 @@ check_strscan(obj)
|
||||||
* Duplicates a StringScanner object.
|
* Duplicates a StringScanner object.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_init_copy(vself, vorig)
|
strscan_init_copy(VALUE vself, VALUE vorig)
|
||||||
VALUE vself, vorig;
|
|
||||||
{
|
{
|
||||||
struct strscanner *self, *orig;
|
struct strscanner *self, *orig;
|
||||||
|
|
||||||
|
@ -253,8 +239,7 @@ strscan_init_copy(vself, vorig)
|
||||||
* This method is defined for backward compatibility.
|
* This method is defined for backward compatibility.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_s_mustc(self)
|
strscan_s_mustc(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -281,8 +266,7 @@ strscan_reset(VALUE self)
|
||||||
* Set the scan pointer to the end of the string and clear matching data.
|
* Set the scan pointer to the end of the string and clear matching data.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_terminate(self)
|
strscan_terminate(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -297,8 +281,7 @@ strscan_terminate(self)
|
||||||
* This method is obsolete; use #terminate instead.
|
* This method is obsolete; use #terminate instead.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_clear(self)
|
strscan_clear(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
rb_warning("StringScanner#clear is obsolete; use #terminate instead");
|
rb_warning("StringScanner#clear is obsolete; use #terminate instead");
|
||||||
return strscan_terminate(self);
|
return strscan_terminate(self);
|
||||||
|
@ -308,8 +291,7 @@ strscan_clear(self)
|
||||||
* Returns the string being scanned.
|
* Returns the string being scanned.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_get_string(self)
|
strscan_get_string(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -324,8 +306,7 @@ strscan_get_string(self)
|
||||||
* Returns +str+.
|
* Returns +str+.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_set_string(self, str)
|
strscan_set_string(VALUE self, VALUE str)
|
||||||
VALUE self, str;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -353,8 +334,7 @@ strscan_set_string(self, str)
|
||||||
* s.scan(/Dec/) # -> "Dec"
|
* s.scan(/Dec/) # -> "Dec"
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_concat(self, str)
|
strscan_concat(VALUE self, VALUE str)
|
||||||
VALUE self, str;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -379,8 +359,7 @@ strscan_concat(self, str)
|
||||||
* s.pos # -> 11
|
* s.pos # -> 11
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_get_pos(self)
|
strscan_get_pos(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -398,8 +377,7 @@ strscan_get_pos(self)
|
||||||
* s.rest # -> "ring"
|
* s.rest # -> "ring"
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_set_pos(self, v)
|
strscan_set_pos(VALUE self, VALUE v)
|
||||||
VALUE self, v;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
long i;
|
long i;
|
||||||
|
@ -417,9 +395,7 @@ strscan_set_pos(self, v)
|
||||||
#define strscan_prepare_re(re) /* none */
|
#define strscan_prepare_re(re) /* none */
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_do_scan(self, regex, succptr, getstr, headonly)
|
strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
|
||||||
VALUE self, regex;
|
|
||||||
int succptr, getstr, headonly;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -479,8 +455,7 @@ strscan_do_scan(self, regex, succptr, getstr, headonly)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_scan(self, re)
|
strscan_scan(VALUE self, VALUE re)
|
||||||
VALUE self, re;
|
|
||||||
{
|
{
|
||||||
return strscan_do_scan(self, re, 1, 1, 1);
|
return strscan_do_scan(self, re, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
@ -497,8 +472,7 @@ strscan_scan(self, re)
|
||||||
* p s.match?(/\s+/) # -> nil
|
* p s.match?(/\s+/) # -> nil
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_match_p(self, re)
|
strscan_match_p(VALUE self, VALUE re)
|
||||||
VALUE self, re;
|
|
||||||
{
|
{
|
||||||
return strscan_do_scan(self, re, 0, 0, 1);
|
return strscan_do_scan(self, re, 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
@ -521,8 +495,7 @@ strscan_match_p(self, re)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_skip(self, re)
|
strscan_skip(VALUE self, VALUE re)
|
||||||
VALUE self, re;
|
|
||||||
{
|
{
|
||||||
return strscan_do_scan(self, re, 1, 0, 1);
|
return strscan_do_scan(self, re, 1, 0, 1);
|
||||||
}
|
}
|
||||||
|
@ -543,8 +516,7 @@ strscan_skip(self, re)
|
||||||
* Mnemonic: it "checks" to see whether a #scan will return a value.
|
* Mnemonic: it "checks" to see whether a #scan will return a value.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_check(self, re)
|
strscan_check(VALUE self, VALUE re)
|
||||||
VALUE self, re;
|
|
||||||
{
|
{
|
||||||
return strscan_do_scan(self, re, 0, 1, 1);
|
return strscan_do_scan(self, re, 0, 1, 1);
|
||||||
}
|
}
|
||||||
|
@ -560,8 +532,7 @@ strscan_check(self, re)
|
||||||
* "full" means "#scan with full parameters".
|
* "full" means "#scan with full parameters".
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_scan_full(self, re, s, f)
|
strscan_scan_full(VALUE self, VALUE re, VALUE s, VALUE f)
|
||||||
VALUE self, re, s, f;
|
|
||||||
{
|
{
|
||||||
return strscan_do_scan(self, re, RTEST(s), RTEST(f), 1);
|
return strscan_do_scan(self, re, RTEST(s), RTEST(f), 1);
|
||||||
}
|
}
|
||||||
|
@ -579,8 +550,7 @@ strscan_scan_full(self, re, s, f)
|
||||||
* s.scan_until(/XYZ/) # -> nil
|
* s.scan_until(/XYZ/) # -> nil
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_scan_until(self, re)
|
strscan_scan_until(VALUE self, VALUE re)
|
||||||
VALUE self, re;
|
|
||||||
{
|
{
|
||||||
return strscan_do_scan(self, re, 1, 1, 0);
|
return strscan_do_scan(self, re, 1, 1, 0);
|
||||||
}
|
}
|
||||||
|
@ -621,8 +591,7 @@ strscan_exist_p(VALUE self, VALUE re)
|
||||||
* s #
|
* s #
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_skip_until(self, re)
|
strscan_skip_until(VALUE self, VALUE re)
|
||||||
VALUE self, re;
|
|
||||||
{
|
{
|
||||||
return strscan_do_scan(self, re, 1, 0, 0);
|
return strscan_do_scan(self, re, 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -641,8 +610,7 @@ strscan_skip_until(self, re)
|
||||||
* Mnemonic: it "checks" to see whether a #scan_until will return a value.
|
* Mnemonic: it "checks" to see whether a #scan_until will return a value.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_check_until(self, re)
|
strscan_check_until(VALUE self, VALUE re)
|
||||||
VALUE self, re;
|
|
||||||
{
|
{
|
||||||
return strscan_do_scan(self, re, 0, 1, 0);
|
return strscan_do_scan(self, re, 0, 1, 0);
|
||||||
}
|
}
|
||||||
|
@ -657,15 +625,13 @@ strscan_check_until(self, re)
|
||||||
* This method does affect the match register.
|
* This method does affect the match register.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_search_full(self, re, s, f)
|
strscan_search_full(VALUE self, VALUE re, VALUE s, VALUE f)
|
||||||
VALUE self, re, s, f;
|
|
||||||
{
|
{
|
||||||
return strscan_do_scan(self, re, RTEST(s), RTEST(f), 0);
|
return strscan_do_scan(self, re, RTEST(s), RTEST(f), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
adjust_registers_to_matched(p)
|
adjust_registers_to_matched(struct strscanner *p)
|
||||||
struct strscanner *p;
|
|
||||||
{
|
{
|
||||||
onig_region_clear(&(p->regs));
|
onig_region_clear(&(p->regs));
|
||||||
onig_region_set(&(p->regs), 0, 0, p->curr - p->prev);
|
onig_region_set(&(p->regs), 0, 0, p->curr - p->prev);
|
||||||
|
@ -686,8 +652,7 @@ adjust_registers_to_matched(p)
|
||||||
* s.getch # => nil
|
* s.getch # => nil
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_getch(self)
|
strscan_getch(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
long len;
|
long len;
|
||||||
|
@ -726,8 +691,7 @@ strscan_getch(self)
|
||||||
* s.get_byte # => nil
|
* s.get_byte # => nil
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_get_byte(self)
|
strscan_get_byte(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -749,8 +713,7 @@ strscan_get_byte(self)
|
||||||
* This method is obsolete; use #get_byte instead.
|
* This method is obsolete; use #get_byte instead.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_getbyte(self)
|
strscan_getbyte(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
rb_warning("StringScanner#getbyte is obsolete; use #get_byte instead");
|
rb_warning("StringScanner#getbyte is obsolete; use #get_byte instead");
|
||||||
return strscan_get_byte(self);
|
return strscan_get_byte(self);
|
||||||
|
@ -768,8 +731,7 @@ strscan_getbyte(self)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_peek(self, vlen)
|
strscan_peek(VALUE self, VALUE vlen)
|
||||||
VALUE self, vlen;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
long len;
|
long len;
|
||||||
|
@ -790,8 +752,7 @@ strscan_peek(self, vlen)
|
||||||
* This method is obsolete; use #peek instead.
|
* This method is obsolete; use #peek instead.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_peep(self, vlen)
|
strscan_peep(VALUE self, VALUE vlen)
|
||||||
VALUE self, vlen;
|
|
||||||
{
|
{
|
||||||
rb_warning("StringScanner#peep is obsolete; use #peek instead");
|
rb_warning("StringScanner#peep is obsolete; use #peek instead");
|
||||||
return strscan_peek(self, vlen);
|
return strscan_peek(self, vlen);
|
||||||
|
@ -809,8 +770,7 @@ strscan_peep(self, vlen)
|
||||||
* s.unscan # ScanError: unscan failed: previous match record not exist
|
* s.unscan # ScanError: unscan failed: previous match record not exist
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_unscan(self)
|
strscan_unscan(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -835,8 +795,7 @@ strscan_unscan(self)
|
||||||
* s.bol? # => true
|
* s.bol? # => true
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_bol_p(self)
|
strscan_bol_p(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -857,8 +816,7 @@ strscan_bol_p(self)
|
||||||
* p s.eos? # => true
|
* p s.eos? # => true
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_eos_p(self)
|
strscan_eos_p(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -871,8 +829,7 @@ strscan_eos_p(self)
|
||||||
* This method is obsolete, use #eos? instead.
|
* This method is obsolete, use #eos? instead.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_empty_p(self)
|
strscan_empty_p(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
rb_warning("StringScanner#empty? is obsolete; use #eos? instead");
|
rb_warning("StringScanner#empty? is obsolete; use #eos? instead");
|
||||||
return strscan_eos_p(self);
|
return strscan_eos_p(self);
|
||||||
|
@ -887,8 +844,7 @@ strscan_empty_p(self)
|
||||||
* s.rest? # are opposites.
|
* s.rest? # are opposites.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_rest_p(self)
|
strscan_rest_p(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -906,8 +862,7 @@ strscan_rest_p(self)
|
||||||
* s.matched? # => false
|
* s.matched? # => false
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_matched_p(self)
|
strscan_matched_p(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -923,8 +878,7 @@ strscan_matched_p(self)
|
||||||
* s.matched # -> "test"
|
* s.matched # -> "test"
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_matched(self)
|
strscan_matched(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -945,8 +899,7 @@ strscan_matched(self)
|
||||||
* s.matched_size # -> nil
|
* s.matched_size # -> nil
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_matched_size(self)
|
strscan_matched_size(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -981,8 +934,7 @@ strscan_matchedsize(VALUE self)
|
||||||
* s.pre_match # -> ""
|
* s.pre_match # -> ""
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_aref(self, idx)
|
strscan_aref(VALUE self, VALUE idx)
|
||||||
VALUE self, idx;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
long i;
|
long i;
|
||||||
|
@ -1011,8 +963,7 @@ strscan_aref(self, idx)
|
||||||
* s.post_match # -> "string"
|
* s.post_match # -> "string"
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_pre_match(self)
|
strscan_pre_match(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -1031,8 +982,7 @@ strscan_pre_match(self)
|
||||||
* s.post_match # -> "string"
|
* s.post_match # -> "string"
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_post_match(self)
|
strscan_post_match(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -1046,8 +996,7 @@ strscan_post_match(self)
|
||||||
* If there is no more data (eos? = true), it returns <tt>""</tt>.
|
* If there is no more data (eos? = true), it returns <tt>""</tt>.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_rest(self)
|
strscan_rest(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
|
|
||||||
|
@ -1062,8 +1011,7 @@ strscan_rest(self)
|
||||||
* <tt>s.rest_size</tt> is equivalent to <tt>s.rest.size</tt>.
|
* <tt>s.rest_size</tt> is equivalent to <tt>s.rest.size</tt>.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_rest_size(self)
|
strscan_rest_size(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
long i;
|
long i;
|
||||||
|
@ -1102,8 +1050,7 @@ strscan_restsize(VALUE self)
|
||||||
* s.inspect # -> '#<StringScanner 10/21 "...ec 12" @ " 1975...">'
|
* s.inspect # -> '#<StringScanner 10/21 "...ec 12" @ " 1975...">'
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_inspect(self)
|
strscan_inspect(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
char buf[BUFSIZE];
|
char buf[BUFSIZE];
|
||||||
|
@ -1140,8 +1087,7 @@ strscan_inspect(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
inspect1(p)
|
inspect1(struct strscanner *p)
|
||||||
struct strscanner *p;
|
|
||||||
{
|
{
|
||||||
char buf[BUFSIZE];
|
char buf[BUFSIZE];
|
||||||
char *bp = buf;
|
char *bp = buf;
|
||||||
|
@ -1160,8 +1106,7 @@ inspect1(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
inspect2(p)
|
inspect2(struct strscanner *p)
|
||||||
struct strscanner *p;
|
|
||||||
{
|
{
|
||||||
char buf[BUFSIZE];
|
char buf[BUFSIZE];
|
||||||
char *bp = buf;
|
char *bp = buf;
|
||||||
|
|
|
@ -106,7 +106,7 @@ syck_base64dec( char *s, long len )
|
||||||
* Allocate an emitter
|
* Allocate an emitter
|
||||||
*/
|
*/
|
||||||
SyckEmitter *
|
SyckEmitter *
|
||||||
syck_new_emitter()
|
syck_new_emitter(void)
|
||||||
{
|
{
|
||||||
SyckEmitter *e;
|
SyckEmitter *e;
|
||||||
e = S_ALLOC( SyckEmitter );
|
e = S_ALLOC( SyckEmitter );
|
||||||
|
@ -786,8 +786,8 @@ syck_emitter_escape( SyckEmitter *e, char *src, long len )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
syck_emitter_write( e, "x", 1 );
|
syck_emitter_write( e, "x", 1 );
|
||||||
syck_emitter_write( e, (char *)hex_table + ((src[i] & 0xF0) >> 4), 1 );
|
syck_emitter_write( e, (const char *)hex_table + ((src[i] & 0xF0) >> 4), 1 );
|
||||||
syck_emitter_write( e, (char *)hex_table + (src[i] & 0x0F), 1 );
|
syck_emitter_write( e, (const char *)hex_table + (src[i] & 0x0F), 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -97,8 +97,7 @@ struct emitter_xtra {
|
||||||
* Convert YAML to bytecode
|
* Convert YAML to bytecode
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
rb_syck_compile(self, port)
|
rb_syck_compile(VALUE self, VALUE port)
|
||||||
VALUE self, port;
|
|
||||||
{
|
{
|
||||||
SYMID oid;
|
SYMID oid;
|
||||||
int taint;
|
int taint;
|
||||||
|
@ -164,9 +163,7 @@ rb_syck_io_str_read( char *buf, SyckIoStr *str, long max_size, long skip )
|
||||||
* (returns tainted? boolean)
|
* (returns tainted? boolean)
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
syck_parser_assign_io(parser, pport)
|
syck_parser_assign_io(SyckParser *parser, VALUE *pport)
|
||||||
SyckParser *parser;
|
|
||||||
VALUE *pport;
|
|
||||||
{
|
{
|
||||||
int taint = Qtrue;
|
int taint = Qtrue;
|
||||||
VALUE tmp, port = *pport;
|
VALUE tmp, port = *pport;
|
||||||
|
@ -192,8 +189,7 @@ syck_parser_assign_io(parser, pport)
|
||||||
* Get value in hash by key, forcing an empty hash if nil.
|
* Get value in hash by key, forcing an empty hash if nil.
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_get_hash_aref(hsh, key)
|
syck_get_hash_aref(VALUE hsh, VALUE key)
|
||||||
VALUE hsh, key;
|
|
||||||
{
|
{
|
||||||
VALUE val = rb_hash_aref( hsh, key );
|
VALUE val = rb_hash_aref( hsh, key );
|
||||||
if ( NIL_P( val ) )
|
if ( NIL_P( val ) )
|
||||||
|
@ -208,9 +204,7 @@ syck_get_hash_aref(hsh, key)
|
||||||
* creating timestamps
|
* creating timestamps
|
||||||
*/
|
*/
|
||||||
SYMID
|
SYMID
|
||||||
rb_syck_mktime(str, len)
|
rb_syck_mktime(char *str, long len)
|
||||||
char *str;
|
|
||||||
long len;
|
|
||||||
{
|
{
|
||||||
VALUE time;
|
VALUE time;
|
||||||
char *ptr = str;
|
char *ptr = str;
|
||||||
|
@ -315,8 +309,7 @@ rb_syck_mktime(str, len)
|
||||||
* (see http://www.yaml.org/type/merge/)
|
* (see http://www.yaml.org/type/merge/)
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_merge_i( entry, hsh )
|
syck_merge_i(VALUE entry, VALUE hsh )
|
||||||
VALUE entry, hsh;
|
|
||||||
{
|
{
|
||||||
VALUE tmp;
|
VALUE tmp;
|
||||||
if ( !NIL_P(tmp = rb_check_convert_type(entry, T_HASH, "Hash", "to_hash")) )
|
if ( !NIL_P(tmp = rb_check_convert_type(entry, T_HASH, "Hash", "to_hash")) )
|
||||||
|
@ -331,9 +324,7 @@ syck_merge_i( entry, hsh )
|
||||||
* default handler for ruby.yaml.org types
|
* default handler for ruby.yaml.org types
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
yaml_org_handler( n, ref )
|
yaml_org_handler( SyckNode *n, VALUE *ref )
|
||||||
SyckNode *n;
|
|
||||||
VALUE *ref;
|
|
||||||
{
|
{
|
||||||
char *type_id = n->type_id;
|
char *type_id = n->type_id;
|
||||||
int transferred = 0;
|
int transferred = 0;
|
||||||
|
@ -602,9 +593,7 @@ static void syck_node_mark( SyckNode *n );
|
||||||
* - Converts data into native Ruby types
|
* - Converts data into native Ruby types
|
||||||
*/
|
*/
|
||||||
SYMID
|
SYMID
|
||||||
rb_syck_load_handler(p, n)
|
rb_syck_load_handler(SyckParser *p, SyckNode *n)
|
||||||
SyckParser *p;
|
|
||||||
SyckNode *n;
|
|
||||||
{
|
{
|
||||||
VALUE obj = Qnil;
|
VALUE obj = Qnil;
|
||||||
struct parser_xtra *bonus = (struct parser_xtra *)p->bonus;
|
struct parser_xtra *bonus = (struct parser_xtra *)p->bonus;
|
||||||
|
@ -640,9 +629,7 @@ rb_syck_load_handler(p, n)
|
||||||
* friendly errors.
|
* friendly errors.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
rb_syck_err_handler(p, msg)
|
rb_syck_err_handler(SyckParser *p, char *msg)
|
||||||
SyckParser *p;
|
|
||||||
char *msg;
|
|
||||||
{
|
{
|
||||||
char *endl = p->cursor;
|
char *endl = p->cursor;
|
||||||
|
|
||||||
|
@ -661,9 +648,7 @@ rb_syck_err_handler(p, msg)
|
||||||
* provide bad anchor object to the parser.
|
* provide bad anchor object to the parser.
|
||||||
*/
|
*/
|
||||||
SyckNode *
|
SyckNode *
|
||||||
rb_syck_bad_anchor_handler(p, a)
|
rb_syck_bad_anchor_handler(SyckParser *p, char *a)
|
||||||
SyckParser *p;
|
|
||||||
char *a;
|
|
||||||
{
|
{
|
||||||
VALUE anchor_name = rb_str_new2( a );
|
VALUE anchor_name = rb_str_new2( a );
|
||||||
SyckNode *badanc = syck_new_map( rb_str_new2( "name" ), anchor_name );
|
SyckNode *badanc = syck_new_map( rb_str_new2( "name" ), anchor_name );
|
||||||
|
@ -675,8 +660,7 @@ rb_syck_bad_anchor_handler(p, a)
|
||||||
* data loaded based on the model requested.
|
* data loaded based on the model requested.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
syck_set_model( p, input, model )
|
syck_set_model(VALUE p, VALUE input, VALUE model)
|
||||||
VALUE p, input, model;
|
|
||||||
{
|
{
|
||||||
SyckParser *parser;
|
SyckParser *parser;
|
||||||
Data_Get_Struct(p, SyckParser, parser);
|
Data_Get_Struct(p, SyckParser, parser);
|
||||||
|
@ -716,8 +700,7 @@ syck_st_mark_nodes( char *key, SyckNode *n, char *arg )
|
||||||
* mark parser nodes
|
* mark parser nodes
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
syck_mark_parser(parser)
|
syck_mark_parser(SyckParser *parser)
|
||||||
SyckParser *parser;
|
|
||||||
{
|
{
|
||||||
struct parser_xtra *bonus = (struct parser_xtra *)parser->bonus;
|
struct parser_xtra *bonus = (struct parser_xtra *)parser->bonus;
|
||||||
rb_gc_mark_maybe(parser->root);
|
rb_gc_mark_maybe(parser->root);
|
||||||
|
@ -740,8 +723,7 @@ syck_mark_parser(parser)
|
||||||
* Free the parser and any bonus attachment.
|
* Free the parser and any bonus attachment.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
rb_syck_free_parser(p)
|
rb_syck_free_parser(SyckParser *p)
|
||||||
SyckParser *p;
|
|
||||||
{
|
{
|
||||||
S_FREE( p->bonus );
|
S_FREE( p->bonus );
|
||||||
syck_free_parser(p);
|
syck_free_parser(p);
|
||||||
|
@ -752,8 +734,7 @@ rb_syck_free_parser(p)
|
||||||
*/
|
*/
|
||||||
VALUE syck_parser_s_alloc _((VALUE));
|
VALUE syck_parser_s_alloc _((VALUE));
|
||||||
VALUE
|
VALUE
|
||||||
syck_parser_s_alloc(class)
|
syck_parser_s_alloc(VALUE class)
|
||||||
VALUE class;
|
|
||||||
{
|
{
|
||||||
VALUE pobj;
|
VALUE pobj;
|
||||||
SyckParser *parser = syck_new_parser();
|
SyckParser *parser = syck_new_parser();
|
||||||
|
@ -772,10 +753,7 @@ syck_parser_s_alloc(class)
|
||||||
* YAML::Syck::Parser.initialize( resolver, options )
|
* YAML::Syck::Parser.initialize( resolver, options )
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
syck_parser_initialize(argc, argv, self)
|
syck_parser_initialize(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE options;
|
VALUE options;
|
||||||
if (rb_scan_args(argc, argv, "01", &options) == 0)
|
if (rb_scan_args(argc, argv, "01", &options) == 0)
|
||||||
|
@ -795,8 +773,7 @@ syck_parser_initialize(argc, argv, self)
|
||||||
* YAML::Syck::Parser.bufsize = Integer
|
* YAML::Syck::Parser.bufsize = Integer
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
syck_parser_bufsize_set( self, size )
|
syck_parser_bufsize_set(VALUE self, VALUE size)
|
||||||
VALUE self, size;
|
|
||||||
{
|
{
|
||||||
SyckParser *parser;
|
SyckParser *parser;
|
||||||
|
|
||||||
|
@ -812,8 +789,7 @@ syck_parser_bufsize_set( self, size )
|
||||||
* YAML::Syck::Parser.bufsize => Integer
|
* YAML::Syck::Parser.bufsize => Integer
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
syck_parser_bufsize_get( self )
|
syck_parser_bufsize_get(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
SyckParser *parser;
|
SyckParser *parser;
|
||||||
|
|
||||||
|
@ -825,10 +801,7 @@ syck_parser_bufsize_get( self )
|
||||||
* YAML::Syck::Parser.load( IO or String )
|
* YAML::Syck::Parser.load( IO or String )
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_parser_load(argc, argv, self)
|
syck_parser_load(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE port, proc, model, input;
|
VALUE port, proc, model, input;
|
||||||
SyckParser *parser;
|
SyckParser *parser;
|
||||||
|
@ -855,10 +828,7 @@ syck_parser_load(argc, argv, self)
|
||||||
* YAML::Syck::Parser.load_documents( IO or String ) { |doc| }
|
* YAML::Syck::Parser.load_documents( IO or String ) { |doc| }
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_parser_load_documents(argc, argv, self)
|
syck_parser_load_documents(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE port, proc, v, input, model;
|
VALUE port, proc, v, input, model;
|
||||||
SyckParser *parser;
|
SyckParser *parser;
|
||||||
|
@ -899,8 +869,7 @@ syck_parser_load_documents(argc, argv, self)
|
||||||
* YAML::Syck::Parser#set_resolver
|
* YAML::Syck::Parser#set_resolver
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_parser_set_resolver( self, resolver )
|
syck_parser_set_resolver(VALUE self, VALUE resolver)
|
||||||
VALUE self, resolver;
|
|
||||||
{
|
{
|
||||||
rb_ivar_set( self, s_resolver, resolver );
|
rb_ivar_set( self, s_resolver, resolver );
|
||||||
return self;
|
return self;
|
||||||
|
@ -910,8 +879,7 @@ syck_parser_set_resolver( self, resolver )
|
||||||
* YAML::Syck::Resolver.initialize
|
* YAML::Syck::Resolver.initialize
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
syck_resolver_initialize( self )
|
syck_resolver_initialize(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE tags = rb_hash_new();
|
VALUE tags = rb_hash_new();
|
||||||
rb_ivar_set(self, s_tags, rb_hash_new());
|
rb_ivar_set(self, s_tags, rb_hash_new());
|
||||||
|
@ -922,8 +890,7 @@ syck_resolver_initialize( self )
|
||||||
* YAML::Syck::Resolver#add_type
|
* YAML::Syck::Resolver#add_type
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_resolver_add_type( self, taguri, cls )
|
syck_resolver_add_type(VALUE self, VALUE taguri, VALUE cls)
|
||||||
VALUE self, taguri, cls;
|
|
||||||
{
|
{
|
||||||
VALUE tags = rb_attr_get(self, s_tags);
|
VALUE tags = rb_attr_get(self, s_tags);
|
||||||
rb_hash_aset( tags, taguri, cls );
|
rb_hash_aset( tags, taguri, cls );
|
||||||
|
@ -934,8 +901,7 @@ syck_resolver_add_type( self, taguri, cls )
|
||||||
* YAML::Syck::Resolver#use_types_at
|
* YAML::Syck::Resolver#use_types_at
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_resolver_use_types_at( self, hsh )
|
syck_resolver_use_types_at(VALUE self, VALUE hsh)
|
||||||
VALUE self, hsh;
|
|
||||||
{
|
{
|
||||||
rb_ivar_set( self, s_tags, hsh );
|
rb_ivar_set( self, s_tags, hsh );
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
@ -945,8 +911,7 @@ syck_resolver_use_types_at( self, hsh )
|
||||||
* YAML::Syck::Resolver#detect_implicit
|
* YAML::Syck::Resolver#detect_implicit
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_resolver_detect_implicit( self, val )
|
syck_resolver_detect_implicit(VALUE self, VALUE val)
|
||||||
VALUE self, val;
|
|
||||||
{
|
{
|
||||||
char *type_id;
|
char *type_id;
|
||||||
return rb_str_new2( "" );
|
return rb_str_new2( "" );
|
||||||
|
@ -956,8 +921,7 @@ syck_resolver_detect_implicit( self, val )
|
||||||
* YAML::Syck::Resolver#node_import
|
* YAML::Syck::Resolver#node_import
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_resolver_node_import( self, node )
|
syck_resolver_node_import(VALUE self, VALUE node)
|
||||||
VALUE self, node;
|
|
||||||
{
|
{
|
||||||
SyckNode *n;
|
SyckNode *n;
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
@ -1037,8 +1001,7 @@ syck_resolver_node_import( self, node )
|
||||||
* Set instance variables
|
* Set instance variables
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_set_ivars( vars, obj )
|
syck_set_ivars(VALUE vars, VALUE obj)
|
||||||
VALUE vars, obj;
|
|
||||||
{
|
{
|
||||||
VALUE ivname = rb_ary_entry( vars, 0 );
|
VALUE ivname = rb_ary_entry( vars, 0 );
|
||||||
char *ivn;
|
char *ivn;
|
||||||
|
@ -1055,8 +1018,7 @@ syck_set_ivars( vars, obj )
|
||||||
* YAML::Syck::Resolver#const_find
|
* YAML::Syck::Resolver#const_find
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_const_find( const_name )
|
syck_const_find(VALUE const_name)
|
||||||
VALUE const_name;
|
|
||||||
{
|
{
|
||||||
VALUE tclass = rb_cObject;
|
VALUE tclass = rb_cObject;
|
||||||
VALUE tparts = rb_str_split( const_name, "::" );
|
VALUE tparts = rb_str_split( const_name, "::" );
|
||||||
|
@ -1073,8 +1035,7 @@ syck_const_find( const_name )
|
||||||
* YAML::Syck::Resolver#transfer
|
* YAML::Syck::Resolver#transfer
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_resolver_transfer( self, type, val )
|
syck_resolver_transfer(VALUE self, VALUE type, VALUE val)
|
||||||
VALUE self, type, val;
|
|
||||||
{
|
{
|
||||||
if (NIL_P(type) || RSTRING(StringValue(type))->len == 0)
|
if (NIL_P(type) || RSTRING(StringValue(type))->len == 0)
|
||||||
{
|
{
|
||||||
|
@ -1205,8 +1166,7 @@ syck_resolver_transfer( self, type, val )
|
||||||
* YAML::Syck::Resolver#tagurize
|
* YAML::Syck::Resolver#tagurize
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_resolver_tagurize( self, val )
|
syck_resolver_tagurize(VALUE self, VALUE val)
|
||||||
VALUE self, val;
|
|
||||||
{
|
{
|
||||||
VALUE tmp = rb_check_string_type(val);
|
VALUE tmp = rb_check_string_type(val);
|
||||||
|
|
||||||
|
@ -1224,8 +1184,7 @@ syck_resolver_tagurize( self, val )
|
||||||
* YAML::Syck::DefaultResolver#detect_implicit
|
* YAML::Syck::DefaultResolver#detect_implicit
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_defaultresolver_detect_implicit( self, val )
|
syck_defaultresolver_detect_implicit(VALUE self, VALUE val)
|
||||||
VALUE self, val;
|
|
||||||
{
|
{
|
||||||
char *type_id;
|
char *type_id;
|
||||||
VALUE tmp = rb_check_string_type(val);
|
VALUE tmp = rb_check_string_type(val);
|
||||||
|
@ -1244,8 +1203,7 @@ syck_defaultresolver_detect_implicit( self, val )
|
||||||
* YAML::Syck::DefaultResolver#node_import
|
* YAML::Syck::DefaultResolver#node_import
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_defaultresolver_node_import( self, node )
|
syck_defaultresolver_node_import(VALUE self, VALUE node)
|
||||||
VALUE self, node;
|
|
||||||
{
|
{
|
||||||
SyckNode *n;
|
SyckNode *n;
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
@ -1261,8 +1219,7 @@ syck_defaultresolver_node_import( self, node )
|
||||||
* YAML::Syck::GenericResolver#node_import
|
* YAML::Syck::GenericResolver#node_import
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_genericresolver_node_import( self, node )
|
syck_genericresolver_node_import(VALUE self, VALUE node)
|
||||||
VALUE self, node;
|
|
||||||
{
|
{
|
||||||
SyckNode *n;
|
SyckNode *n;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -1339,8 +1296,7 @@ syck_genericresolver_node_import( self, node )
|
||||||
* YAML::Syck::BadAlias.initialize
|
* YAML::Syck::BadAlias.initialize
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_badalias_initialize( self, val )
|
syck_badalias_initialize(VALUE self, VALUE val)
|
||||||
VALUE self, val;
|
|
||||||
{
|
{
|
||||||
rb_iv_set( self, "@name", val );
|
rb_iv_set( self, "@name", val );
|
||||||
return self;
|
return self;
|
||||||
|
@ -1350,8 +1306,7 @@ syck_badalias_initialize( self, val )
|
||||||
* YAML::Syck::BadAlias.<=>
|
* YAML::Syck::BadAlias.<=>
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_badalias_cmp( alias1, alias2 )
|
syck_badalias_cmp(VALUE alias1, VALUE alias2)
|
||||||
VALUE alias1, alias2;
|
|
||||||
{
|
{
|
||||||
VALUE str1 = rb_ivar_get( alias1, s_name );
|
VALUE str1 = rb_ivar_get( alias1, s_name );
|
||||||
VALUE str2 = rb_ivar_get( alias2, s_name );
|
VALUE str2 = rb_ivar_get( alias2, s_name );
|
||||||
|
@ -1363,8 +1318,7 @@ syck_badalias_cmp( alias1, alias2 )
|
||||||
* YAML::DomainType.initialize
|
* YAML::DomainType.initialize
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_domaintype_initialize( self, domain, type_id, val )
|
syck_domaintype_initialize(VALUE self, VALUE domain, VALUE type_id, VALUE val)
|
||||||
VALUE self, domain, type_id, val;
|
|
||||||
{
|
{
|
||||||
rb_iv_set( self, "@domain", domain );
|
rb_iv_set( self, "@domain", domain );
|
||||||
rb_iv_set( self, "@type_id", type_id );
|
rb_iv_set( self, "@type_id", type_id );
|
||||||
|
@ -1376,8 +1330,7 @@ syck_domaintype_initialize( self, domain, type_id, val )
|
||||||
* YAML::Object.initialize
|
* YAML::Object.initialize
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_yobject_initialize( self, klass, ivars )
|
syck_yobject_initialize(VALUE self, VALUE klass, VALUE ivars)
|
||||||
VALUE self, klass, ivars;
|
|
||||||
{
|
{
|
||||||
rb_iv_set( self, "@class", klass );
|
rb_iv_set( self, "@class", klass );
|
||||||
rb_iv_set( self, "@ivars", ivars );
|
rb_iv_set( self, "@ivars", ivars );
|
||||||
|
@ -1388,8 +1341,7 @@ syck_yobject_initialize( self, klass, ivars )
|
||||||
* YAML::PrivateType.initialize
|
* YAML::PrivateType.initialize
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_privatetype_initialize( self, type_id, val )
|
syck_privatetype_initialize(VALUE self, VALUE type_id, VALUE val)
|
||||||
VALUE self, type_id, val;
|
|
||||||
{
|
{
|
||||||
rb_iv_set( self, "@type_id", type_id );
|
rb_iv_set( self, "@type_id", type_id );
|
||||||
rb_iv_set( self, "@value", val );
|
rb_iv_set( self, "@value", val );
|
||||||
|
@ -1400,8 +1352,7 @@ syck_privatetype_initialize( self, type_id, val )
|
||||||
* Mark node contents.
|
* Mark node contents.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
syck_node_mark( n )
|
syck_node_mark(SyckNode *n)
|
||||||
SyckNode *n;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
rb_gc_mark_maybe( n->id );
|
rb_gc_mark_maybe( n->id );
|
||||||
|
@ -1431,8 +1382,7 @@ syck_node_mark( n )
|
||||||
* YAML::Syck::Scalar.allocate
|
* YAML::Syck::Scalar.allocate
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_scalar_alloc( class )
|
syck_scalar_alloc(VALUE class)
|
||||||
VALUE class;
|
|
||||||
{
|
{
|
||||||
SyckNode *node = syck_alloc_str();
|
SyckNode *node = syck_alloc_str();
|
||||||
VALUE obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node );
|
VALUE obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node );
|
||||||
|
@ -1444,8 +1394,7 @@ syck_scalar_alloc( class )
|
||||||
* YAML::Syck::Scalar.initialize
|
* YAML::Syck::Scalar.initialize
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_scalar_initialize( self, type_id, val, style )
|
syck_scalar_initialize(VALUE self, VALUE type_id, VALUE val, VALUE style)
|
||||||
VALUE self, type_id, val, style;
|
|
||||||
{
|
{
|
||||||
rb_iv_set( self, "@kind", sym_scalar );
|
rb_iv_set( self, "@kind", sym_scalar );
|
||||||
rb_funcall( self, s_type_id_set, 1, type_id );
|
rb_funcall( self, s_type_id_set, 1, type_id );
|
||||||
|
@ -1458,8 +1407,7 @@ syck_scalar_initialize( self, type_id, val, style )
|
||||||
* YAML::Syck::Scalar.style=
|
* YAML::Syck::Scalar.style=
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_scalar_style_set( self, style )
|
syck_scalar_style_set(VALUE self, VALUE style)
|
||||||
VALUE self, style;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
Data_Get_Struct( self, SyckNode, node );
|
Data_Get_Struct( self, SyckNode, node );
|
||||||
|
@ -1497,8 +1445,7 @@ syck_scalar_style_set( self, style )
|
||||||
* YAML::Syck::Scalar.value=
|
* YAML::Syck::Scalar.value=
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_scalar_value_set( self, val )
|
syck_scalar_value_set(VALUE self, VALUE val)
|
||||||
VALUE self, val;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
Data_Get_Struct( self, SyckNode, node );
|
Data_Get_Struct( self, SyckNode, node );
|
||||||
|
@ -1516,8 +1463,7 @@ syck_scalar_value_set( self, val )
|
||||||
* YAML::Syck::Seq.allocate
|
* YAML::Syck::Seq.allocate
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_seq_alloc( class )
|
syck_seq_alloc(VALUE class)
|
||||||
VALUE class;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
@ -1531,8 +1477,7 @@ syck_seq_alloc( class )
|
||||||
* YAML::Syck::Seq.initialize
|
* YAML::Syck::Seq.initialize
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_seq_initialize( self, type_id, val, style )
|
syck_seq_initialize(VALUE self, VALUE type_id, VALUE val, VALUE style)
|
||||||
VALUE self, type_id, val, style;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
Data_Get_Struct( self, SyckNode, node );
|
Data_Get_Struct( self, SyckNode, node );
|
||||||
|
@ -1548,8 +1493,7 @@ syck_seq_initialize( self, type_id, val, style )
|
||||||
* YAML::Syck::Seq.value=
|
* YAML::Syck::Seq.value=
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_seq_value_set( self, val )
|
syck_seq_value_set(VALUE self, VALUE val)
|
||||||
VALUE self, val;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
Data_Get_Struct( self, SyckNode, node );
|
Data_Get_Struct( self, SyckNode, node );
|
||||||
|
@ -1572,8 +1516,7 @@ syck_seq_value_set( self, val )
|
||||||
* YAML::Syck::Seq.add
|
* YAML::Syck::Seq.add
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_seq_add_m( self, val )
|
syck_seq_add_m(VALUE self, VALUE val)
|
||||||
VALUE self, val;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
VALUE emitter = rb_ivar_get( self, s_emitter );
|
VALUE emitter = rb_ivar_get( self, s_emitter );
|
||||||
|
@ -1592,8 +1535,7 @@ syck_seq_add_m( self, val )
|
||||||
* YAML::Syck::Seq.style=
|
* YAML::Syck::Seq.style=
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_seq_style_set( self, style )
|
syck_seq_style_set(VALUE self, VALUE style)
|
||||||
VALUE self, style;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
Data_Get_Struct( self, SyckNode, node );
|
Data_Get_Struct( self, SyckNode, node );
|
||||||
|
@ -1615,8 +1557,7 @@ syck_seq_style_set( self, style )
|
||||||
* YAML::Syck::Map.allocate
|
* YAML::Syck::Map.allocate
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_map_alloc( class )
|
syck_map_alloc(VALUE class)
|
||||||
VALUE class;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
@ -1630,8 +1571,7 @@ syck_map_alloc( class )
|
||||||
* YAML::Syck::Map.initialize
|
* YAML::Syck::Map.initialize
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_map_initialize( self, type_id, val, style )
|
syck_map_initialize(VALUE self, VALUE type_id, VALUE val, VALUE style)
|
||||||
VALUE self, type_id, val, style;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
Data_Get_Struct( self, SyckNode, node );
|
Data_Get_Struct( self, SyckNode, node );
|
||||||
|
@ -1665,8 +1605,7 @@ syck_map_initialize( self, type_id, val, style )
|
||||||
* YAML::Syck::Map.value=
|
* YAML::Syck::Map.value=
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_map_value_set( self, val )
|
syck_map_value_set(VALUE self, VALUE val)
|
||||||
VALUE self, val;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
Data_Get_Struct( self, SyckNode, node );
|
Data_Get_Struct( self, SyckNode, node );
|
||||||
|
@ -1698,8 +1637,7 @@ syck_map_value_set( self, val )
|
||||||
* YAML::Syck::Map.add
|
* YAML::Syck::Map.add
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_map_add_m( self, key, val )
|
syck_map_add_m(VALUE self, VALUE key, VALUE val)
|
||||||
VALUE self, key, val;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
VALUE emitter = rb_ivar_get( self, s_emitter );
|
VALUE emitter = rb_ivar_get( self, s_emitter );
|
||||||
|
@ -1719,8 +1657,7 @@ syck_map_add_m( self, key, val )
|
||||||
* YAML::Syck::Map.style=
|
* YAML::Syck::Map.style=
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_map_style_set( self, style )
|
syck_map_style_set(VALUE self, VALUE style)
|
||||||
VALUE self, style;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
Data_Get_Struct( self, SyckNode, node );
|
Data_Get_Struct( self, SyckNode, node );
|
||||||
|
@ -1742,8 +1679,7 @@ syck_map_style_set( self, style )
|
||||||
* Cloning method for all node types
|
* Cloning method for all node types
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_node_init_copy( copy, orig )
|
syck_node_init_copy(VALUE copy, VALUE orig)
|
||||||
VALUE copy, orig;
|
|
||||||
{
|
{
|
||||||
SyckNode *copy_n;
|
SyckNode *copy_n;
|
||||||
SyckNode *orig_n;
|
SyckNode *orig_n;
|
||||||
|
@ -1766,8 +1702,7 @@ syck_node_init_copy( copy, orig )
|
||||||
* YAML::Syck::Node#type_id=
|
* YAML::Syck::Node#type_id=
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_node_type_id_set( self, type_id )
|
syck_node_type_id_set(VALUE self, VALUE type_id)
|
||||||
VALUE self, type_id;
|
|
||||||
{
|
{
|
||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
Data_Get_Struct( self, SyckNode, node );
|
Data_Get_Struct( self, SyckNode, node );
|
||||||
|
@ -1787,8 +1722,7 @@ syck_node_type_id_set( self, type_id )
|
||||||
* YAML::Syck::Node.transform
|
* YAML::Syck::Node.transform
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_node_transform( self )
|
syck_node_transform(VALUE self)
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE t;
|
VALUE t;
|
||||||
SyckNode *n;
|
SyckNode *n;
|
||||||
|
@ -1844,9 +1778,7 @@ syck_node_transform( self )
|
||||||
* No one could possibly object.
|
* No one could possibly object.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
rb_syck_emitter_handler(e, data)
|
rb_syck_emitter_handler(SyckEmitter *e, st_data_t data)
|
||||||
SyckEmitter *e;
|
|
||||||
st_data_t data;
|
|
||||||
{
|
{
|
||||||
SyckNode *n;
|
SyckNode *n;
|
||||||
Data_Get_Struct((VALUE)data, SyckNode, n);
|
Data_Get_Struct((VALUE)data, SyckNode, n);
|
||||||
|
@ -1890,10 +1822,7 @@ rb_syck_emitter_handler(e, data)
|
||||||
* Handle output from the emitter
|
* Handle output from the emitter
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
rb_syck_output_handler( emitter, str, len )
|
rb_syck_output_handler(SyckEmitter * emitter, char *str, long len)
|
||||||
SyckEmitter *emitter;
|
|
||||||
char *str;
|
|
||||||
long len;
|
|
||||||
{
|
{
|
||||||
struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus;
|
struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus;
|
||||||
VALUE dest = bonus->port;
|
VALUE dest = bonus->port;
|
||||||
|
@ -1909,8 +1838,7 @@ rb_syck_output_handler( emitter, str, len )
|
||||||
* symbol table.
|
* symbol table.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
syck_out_mark( emitter, node )
|
syck_out_mark(VALUE emitter, VALUE node)
|
||||||
VALUE emitter, node;
|
|
||||||
{
|
{
|
||||||
SyckEmitter *emitterPtr;
|
SyckEmitter *emitterPtr;
|
||||||
struct emitter_xtra *bonus;
|
struct emitter_xtra *bonus;
|
||||||
|
@ -1927,8 +1855,7 @@ syck_out_mark( emitter, node )
|
||||||
* Mark emitter values.
|
* Mark emitter values.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
syck_mark_emitter(emitter)
|
syck_mark_emitter(SyckEmitter *emitter)
|
||||||
SyckEmitter *emitter;
|
|
||||||
{
|
{
|
||||||
struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus;
|
struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus;
|
||||||
rb_gc_mark( bonus->oid );
|
rb_gc_mark( bonus->oid );
|
||||||
|
@ -1940,8 +1867,7 @@ syck_mark_emitter(emitter)
|
||||||
* Free the emitter and any bonus attachment.
|
* Free the emitter and any bonus attachment.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
rb_syck_free_emitter(e)
|
rb_syck_free_emitter(SyckEmitter *e)
|
||||||
SyckEmitter *e;
|
|
||||||
{
|
{
|
||||||
S_FREE( e->bonus );
|
S_FREE( e->bonus );
|
||||||
syck_free_emitter(e);
|
syck_free_emitter(e);
|
||||||
|
@ -1952,8 +1878,7 @@ rb_syck_free_emitter(e)
|
||||||
*/
|
*/
|
||||||
VALUE syck_emitter_s_alloc _((VALUE));
|
VALUE syck_emitter_s_alloc _((VALUE));
|
||||||
VALUE
|
VALUE
|
||||||
syck_emitter_s_alloc(class)
|
syck_emitter_s_alloc(VALUE class)
|
||||||
VALUE class;
|
|
||||||
{
|
{
|
||||||
VALUE pobj;
|
VALUE pobj;
|
||||||
SyckEmitter *emitter = syck_new_emitter();
|
SyckEmitter *emitter = syck_new_emitter();
|
||||||
|
@ -1973,10 +1898,7 @@ syck_emitter_s_alloc(class)
|
||||||
* YAML::Syck::Emitter.reset( options )
|
* YAML::Syck::Emitter.reset( options )
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_emitter_reset( argc, argv, self )
|
syck_emitter_reset(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE options, tmp;
|
VALUE options, tmp;
|
||||||
SyckEmitter *emitter;
|
SyckEmitter *emitter;
|
||||||
|
@ -2018,10 +1940,7 @@ syck_emitter_reset( argc, argv, self )
|
||||||
* YAML::Syck::Emitter.emit( object_id ) { |out| ... }
|
* YAML::Syck::Emitter.emit( object_id ) { |out| ... }
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_emitter_emit( argc, argv, self )
|
syck_emitter_emit(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE oid, proc;
|
VALUE oid, proc;
|
||||||
char *anchor_name;
|
char *anchor_name;
|
||||||
|
@ -2062,8 +1981,7 @@ syck_emitter_emit( argc, argv, self )
|
||||||
* YAML::Syck::Emitter#node_export
|
* YAML::Syck::Emitter#node_export
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_emitter_node_export( self, node )
|
syck_emitter_node_export(VALUE self, VALUE node)
|
||||||
VALUE self, node;
|
|
||||||
{
|
{
|
||||||
return rb_funcall( node, s_to_yaml, 1, self );
|
return rb_funcall( node, s_to_yaml, 1, self );
|
||||||
}
|
}
|
||||||
|
@ -2072,8 +1990,7 @@ syck_emitter_node_export( self, node )
|
||||||
* YAML::Syck::Emitter#set_resolver
|
* YAML::Syck::Emitter#set_resolver
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_emitter_set_resolver( self, resolver )
|
syck_emitter_set_resolver(VALUE self, VALUE resolver)
|
||||||
VALUE self, resolver;
|
|
||||||
{
|
{
|
||||||
rb_ivar_set( self, s_resolver, resolver );
|
rb_ivar_set( self, s_resolver, resolver );
|
||||||
return self;
|
return self;
|
||||||
|
@ -2083,8 +2000,7 @@ syck_emitter_set_resolver( self, resolver )
|
||||||
* YAML::Syck::Out::initialize
|
* YAML::Syck::Out::initialize
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_out_initialize( self, emitter )
|
syck_out_initialize(VALUE self, VALUE emitter)
|
||||||
VALUE self, emitter;
|
|
||||||
{
|
{
|
||||||
rb_ivar_set( self, s_emitter, emitter );
|
rb_ivar_set( self, s_emitter, emitter );
|
||||||
return self;
|
return self;
|
||||||
|
@ -2094,10 +2010,7 @@ syck_out_initialize( self, emitter )
|
||||||
* YAML::Syck::Out::map
|
* YAML::Syck::Out::map
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_out_map( argc, argv, self )
|
syck_out_map(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE type_id, style, map;
|
VALUE type_id, style, map;
|
||||||
if (rb_scan_args(argc, argv, "11", &type_id, &style) == 1) {
|
if (rb_scan_args(argc, argv, "11", &type_id, &style) == 1) {
|
||||||
|
@ -2113,10 +2026,7 @@ syck_out_map( argc, argv, self )
|
||||||
* YAML::Syck::Out::seq
|
* YAML::Syck::Out::seq
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_out_seq( argc, argv, self )
|
syck_out_seq(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE type_id, style, seq;
|
VALUE type_id, style, seq;
|
||||||
if (rb_scan_args(argc, argv, "11", &type_id, &style) == 1) {
|
if (rb_scan_args(argc, argv, "11", &type_id, &style) == 1) {
|
||||||
|
@ -2134,10 +2044,7 @@ syck_out_scalar( self, type_id, str, style )
|
||||||
VALUE self, type_id, str, style;
|
VALUE self, type_id, str, style;
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
syck_out_scalar( argc, argv, self )
|
syck_out_scalar(int argc, VALUE *argv, VALUE self)
|
||||||
int argc;
|
|
||||||
VALUE *argv;
|
|
||||||
VALUE self;
|
|
||||||
{
|
{
|
||||||
VALUE type_id, str, style, scalar;
|
VALUE type_id, str, style, scalar;
|
||||||
if (rb_scan_args(argc, argv, "21", &type_id, &str, &style) == 2) {
|
if (rb_scan_args(argc, argv, "21", &type_id, &str, &style) == 2) {
|
||||||
|
|
|
@ -363,7 +363,7 @@ long syck_io_file_read( char *, SyckIoFile *, long, long );
|
||||||
long syck_io_str_read( char *, SyckIoStr *, long, long );
|
long syck_io_str_read( char *, SyckIoStr *, long, long );
|
||||||
char *syck_base64enc( char *, long );
|
char *syck_base64enc( char *, long );
|
||||||
char *syck_base64dec( char *, long );
|
char *syck_base64dec( char *, long );
|
||||||
SyckEmitter *syck_new_emitter();
|
SyckEmitter *syck_new_emitter(void);
|
||||||
SYMID syck_emitter_mark_node( SyckEmitter *, st_data_t );
|
SYMID syck_emitter_mark_node( SyckEmitter *, st_data_t );
|
||||||
void syck_emitter_ignore_id( SyckEmitter *, SYMID );
|
void syck_emitter_ignore_id( SyckEmitter *, SYMID );
|
||||||
void syck_output_handler( SyckEmitter *, SyckOutputHandler );
|
void syck_output_handler( SyckEmitter *, SyckOutputHandler );
|
||||||
|
|
|
@ -35,7 +35,7 @@ typedef struct {
|
||||||
long remaining;
|
long remaining;
|
||||||
int printed;
|
int printed;
|
||||||
} bytestring_t;
|
} bytestring_t;
|
||||||
bytestring_t *bytestring_alloc() {
|
bytestring_t *bytestring_alloc(void) {
|
||||||
bytestring_t *ret;
|
bytestring_t *ret;
|
||||||
/*TRACE0("bytestring_alloc()");*/
|
/*TRACE0("bytestring_alloc()");*/
|
||||||
ret = S_ALLOC(bytestring_t);
|
ret = S_ALLOC(bytestring_t);
|
||||||
|
|
|
@ -86,8 +86,7 @@ static DL_HANDLE tcl_dll = (DL_HANDLE)0;
|
||||||
static DL_HANDLE tk_dll = (DL_HANDLE)0;
|
static DL_HANDLE tk_dll = (DL_HANDLE)0;
|
||||||
|
|
||||||
int
|
int
|
||||||
ruby_open_tcl_dll(appname)
|
ruby_open_tcl_dll(char *appname)
|
||||||
char *appname;
|
|
||||||
{
|
{
|
||||||
void (*p_Tcl_FindExecutable)(const char *);
|
void (*p_Tcl_FindExecutable)(const char *);
|
||||||
int n;
|
int n;
|
||||||
|
@ -169,8 +168,7 @@ ruby_open_tk_dll()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ruby_open_tcltk_dll(appname)
|
ruby_open_tcltk_dll(char *appname)
|
||||||
char *appname;
|
|
||||||
{
|
{
|
||||||
return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() );
|
return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() );
|
||||||
}
|
}
|
||||||
|
@ -189,8 +187,7 @@ tk_stubs_init_p()
|
||||||
|
|
||||||
|
|
||||||
Tcl_Interp *
|
Tcl_Interp *
|
||||||
ruby_tcl_create_ip_and_stubs_init(st)
|
ruby_tcl_create_ip_and_stubs_init(int *st)
|
||||||
int *st;
|
|
||||||
{
|
{
|
||||||
Tcl_Interp *tcl_ip;
|
Tcl_Interp *tcl_ip;
|
||||||
|
|
||||||
|
@ -272,8 +269,7 @@ ruby_tcl_stubs_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ruby_tk_stubs_init(tcl_ip)
|
ruby_tk_stubs_init(Tcl_Interp *tcl_ip)
|
||||||
Tcl_Interp *tcl_ip;
|
|
||||||
{
|
{
|
||||||
Tcl_ResetResult(tcl_ip);
|
Tcl_ResetResult(tcl_ip);
|
||||||
|
|
||||||
|
@ -308,8 +304,7 @@ ruby_tk_stubs_init(tcl_ip)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ruby_tk_stubs_safeinit(tcl_ip)
|
ruby_tk_stubs_safeinit(Tcl_Interp *tcl_ip)
|
||||||
Tcl_Interp *tcl_ip;
|
|
||||||
{
|
{
|
||||||
Tcl_ResetResult(tcl_ip);
|
Tcl_ResetResult(tcl_ip);
|
||||||
|
|
||||||
|
@ -395,8 +390,7 @@ static int open_tcl_dll = 0;
|
||||||
static int call_tk_stubs_init = 0;
|
static int call_tk_stubs_init = 0;
|
||||||
|
|
||||||
int
|
int
|
||||||
ruby_open_tcl_dll(appname)
|
ruby_open_tcl_dll(char *appname)
|
||||||
char *appname;
|
|
||||||
{
|
{
|
||||||
if (appname) {
|
if (appname) {
|
||||||
Tcl_FindExecutable(appname);
|
Tcl_FindExecutable(appname);
|
||||||
|
@ -418,8 +412,7 @@ int ruby_open_tk_dll()
|
||||||
return TCLTK_STUBS_OK;
|
return TCLTK_STUBS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ruby_open_tcltk_dll(appname)
|
int ruby_open_tcltk_dll(char *appname)
|
||||||
char *appname;
|
|
||||||
{
|
{
|
||||||
return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() );
|
return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() );
|
||||||
}
|
}
|
||||||
|
@ -437,8 +430,7 @@ tk_stubs_init_p()
|
||||||
}
|
}
|
||||||
|
|
||||||
Tcl_Interp *
|
Tcl_Interp *
|
||||||
ruby_tcl_create_ip_and_stubs_init(st)
|
ruby_tcl_create_ip_and_stubs_init(int *st)
|
||||||
int *st;
|
|
||||||
{
|
{
|
||||||
Tcl_Interp *tcl_ip;
|
Tcl_Interp *tcl_ip;
|
||||||
|
|
||||||
|
@ -466,8 +458,7 @@ ruby_tcl_stubs_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ruby_tk_stubs_init(tcl_ip)
|
ruby_tk_stubs_init(Tcl_Interp *tcl_ip)
|
||||||
Tcl_Interp *tcl_ip;
|
|
||||||
{
|
{
|
||||||
if (Tk_Init(tcl_ip) == TCL_ERROR)
|
if (Tk_Init(tcl_ip) == TCL_ERROR)
|
||||||
return FAIL_Tk_Init;
|
return FAIL_Tk_Init;
|
||||||
|
@ -483,8 +474,7 @@ ruby_tk_stubs_init(tcl_ip)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ruby_tk_stubs_safeinit(tcl_ip)
|
ruby_tk_stubs_safeinit(Tcl_Interp *tcl_ip)
|
||||||
Tcl_Interp *tcl_ip;
|
|
||||||
{
|
{
|
||||||
#if TCL_MAJOR_VERSION >= 8
|
#if TCL_MAJOR_VERSION >= 8
|
||||||
if (Tk_SafeInit(tcl_ip) == TCL_ERROR)
|
if (Tk_SafeInit(tcl_ip) == TCL_ERROR)
|
||||||
|
|
|
@ -124,9 +124,7 @@ static VALUE tk_funcall _((VALUE(), int, VALUE*, VALUE));
|
||||||
|
|
||||||
/* safe Tcl_Eval and Tcl_GlobalEval */
|
/* safe Tcl_Eval and Tcl_GlobalEval */
|
||||||
static int
|
static int
|
||||||
tcl_eval(interp, cmd)
|
tcl_eval(Tcp_Interp interp, const char *cmd)
|
||||||
Tcl_Interp *interp;
|
|
||||||
const char *cmd; /* don't have to be writable */
|
|
||||||
{
|
{
|
||||||
char *buf = strdup(cmd);
|
char *buf = strdup(cmd);
|
||||||
const int ret = Tcl_Eval(interp, buf);
|
const int ret = Tcl_Eval(interp, buf);
|
||||||
|
@ -138,9 +136,7 @@ tcl_eval(interp, cmd)
|
||||||
#define Tcl_Eval tcl_eval
|
#define Tcl_Eval tcl_eval
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tcl_global_eval(interp, cmd)
|
tcl_global_eval(Tcp_Interp *interp, const char *cmd)
|
||||||
Tcl_Interp *interp;
|
|
||||||
const char *cmd; /* don't have to be writable */
|
|
||||||
{
|
{
|
||||||
char *buf = strdup(cmd);
|
char *buf = strdup(cmd);
|
||||||
const int ret = Tcl_GlobalEval(interp, buf);
|
const int ret = Tcl_GlobalEval(interp, buf);
|
||||||
|
|
|
@ -478,7 +478,7 @@ zstream_append_buffer(struct zstream *z, const Bytef *src, int len)
|
||||||
{
|
{
|
||||||
if (NIL_P(z->buf)) {
|
if (NIL_P(z->buf)) {
|
||||||
z->buf = rb_str_buf_new(len);
|
z->buf = rb_str_buf_new(len);
|
||||||
rb_str_buf_cat(z->buf, (char*)src, len);
|
rb_str_buf_cat(z->buf, (const char*)src, len);
|
||||||
z->buf_filled = len;
|
z->buf_filled = len;
|
||||||
z->stream.next_out = (Bytef*)RSTRING(z->buf)->ptr;
|
z->stream.next_out = (Bytef*)RSTRING(z->buf)->ptr;
|
||||||
z->stream.avail_out = 0;
|
z->stream.avail_out = 0;
|
||||||
|
@ -573,11 +573,11 @@ zstream_append_input(struct zstream *z, const Bytef *src, unsigned int len)
|
||||||
|
|
||||||
if (NIL_P(z->input)) {
|
if (NIL_P(z->input)) {
|
||||||
z->input = rb_str_buf_new(len);
|
z->input = rb_str_buf_new(len);
|
||||||
rb_str_buf_cat(z->input, (char*)src, len);
|
rb_str_buf_cat(z->input, (const char*)src, len);
|
||||||
RBASIC(z->input)->klass = 0;
|
RBASIC(z->input)->klass = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_str_buf_cat(z->input, (char*)src, len);
|
rb_str_buf_cat(z->input, (const char*)src, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2995,7 +2995,8 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj)
|
||||||
struct gzfile *gz = get_gzfile(obj);
|
struct gzfile *gz = get_gzfile(obj);
|
||||||
volatile VALUE rs;
|
volatile VALUE rs;
|
||||||
VALUE dst;
|
VALUE dst;
|
||||||
char *rsptr, *p, *res;
|
const char *rsptr;
|
||||||
|
char *p, *res;
|
||||||
long rslen, n;
|
long rslen, n;
|
||||||
int rspara;
|
int rspara;
|
||||||
|
|
||||||
|
|
2
file.c
2
file.c
|
@ -1480,7 +1480,7 @@ rb_file_s_size(VALUE klass, VALUE fname)
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_file_ftype(const struct stat *st)
|
rb_file_ftype(const struct stat *st)
|
||||||
{
|
{
|
||||||
char *t;
|
const char *t;
|
||||||
|
|
||||||
if (S_ISREG(st->st_mode)) {
|
if (S_ISREG(st->st_mode)) {
|
||||||
t = "file";
|
t = "file";
|
||||||
|
|
14
io.c
14
io.c
|
@ -1643,7 +1643,7 @@ rb_io_getline_fast(OpenFile *fptr, unsigned char delim)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rscheck(char *rsptr, long rslen, VALUE rs)
|
rscheck(const char *rsptr, long rslen, VALUE rs)
|
||||||
{
|
{
|
||||||
if (RSTRING(rs)->ptr != rsptr && RSTRING(rs)->len != rslen)
|
if (RSTRING(rs)->ptr != rsptr && RSTRING(rs)->len != rslen)
|
||||||
rb_raise(rb_eRuntimeError, "rs modified");
|
rb_raise(rb_eRuntimeError, "rs modified");
|
||||||
|
@ -1667,7 +1667,7 @@ rb_io_getline(VALUE rs, VALUE io)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int c, newline;
|
int c, newline;
|
||||||
char *rsptr;
|
const char *rsptr;
|
||||||
long rslen;
|
long rslen;
|
||||||
int rspara = 0;
|
int rspara = 0;
|
||||||
|
|
||||||
|
@ -2527,7 +2527,7 @@ rb_io_binmode(VALUE io)
|
||||||
return io;
|
return io;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char*
|
static const char*
|
||||||
rb_io_flags_mode(int flags)
|
rb_io_flags_mode(int flags)
|
||||||
{
|
{
|
||||||
#ifdef O_BINARY
|
#ifdef O_BINARY
|
||||||
|
@ -2666,7 +2666,7 @@ rb_io_mode_modenum(const char *mode)
|
||||||
|
|
||||||
#define MODENUM_MAX 4
|
#define MODENUM_MAX 4
|
||||||
|
|
||||||
static char*
|
static const char*
|
||||||
rb_io_modenum_mode(int flags)
|
rb_io_modenum_mode(int flags)
|
||||||
{
|
{
|
||||||
#ifdef O_BINARY
|
#ifdef O_BINARY
|
||||||
|
@ -3154,7 +3154,7 @@ pipe_open(int argc, VALUE *argv, const char *mode)
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
|
rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
|
||||||
{
|
{
|
||||||
char *mode;
|
const char *mode;
|
||||||
VALUE pname, pmode, port, tmp;
|
VALUE pname, pmode, port, tmp;
|
||||||
|
|
||||||
if (rb_scan_args(argc, argv, "11", &pname, &pmode) == 1) {
|
if (rb_scan_args(argc, argv, "11", &pname, &pmode) == 1) {
|
||||||
|
@ -3199,7 +3199,7 @@ static VALUE
|
||||||
rb_open_file(int argc, VALUE *argv, VALUE io)
|
rb_open_file(int argc, VALUE *argv, VALUE io)
|
||||||
{
|
{
|
||||||
VALUE fname, vmode, perm;
|
VALUE fname, vmode, perm;
|
||||||
char *mode;
|
const char *mode;
|
||||||
int flags, fmode;
|
int flags, fmode;
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "12", &fname, &vmode, &perm);
|
rb_scan_args(argc, argv, "12", &fname, &vmode, &perm);
|
||||||
|
@ -3514,7 +3514,7 @@ static VALUE
|
||||||
rb_io_reopen(int argc, VALUE *argv, VALUE file)
|
rb_io_reopen(int argc, VALUE *argv, VALUE file)
|
||||||
{
|
{
|
||||||
VALUE fname, nmode;
|
VALUE fname, nmode;
|
||||||
char *mode;
|
const char *mode;
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
|
|
2
re.c
2
re.c
|
@ -660,7 +660,7 @@ rb_reg_options_m(VALUE re)
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_reg_kcode_m(VALUE re)
|
rb_reg_kcode_m(VALUE re)
|
||||||
{
|
{
|
||||||
char *kcode;
|
const char *kcode;
|
||||||
|
|
||||||
if (FL_TEST(re, KCODE_FIXED)) {
|
if (FL_TEST(re, KCODE_FIXED)) {
|
||||||
switch (RBASIC(re)->flags & KCODE_MASK) {
|
switch (RBASIC(re)->flags & KCODE_MASK) {
|
||||||
|
|
2
ruby.c
2
ruby.c
|
@ -62,7 +62,7 @@ static VALUE do_loop = Qfalse, do_print = Qfalse;
|
||||||
static VALUE do_check = Qfalse, do_line = Qfalse;
|
static VALUE do_check = Qfalse, do_line = Qfalse;
|
||||||
static VALUE do_split = Qfalse;
|
static VALUE do_split = Qfalse;
|
||||||
|
|
||||||
static char *script;
|
static const char *script;
|
||||||
|
|
||||||
static int origargc;
|
static int origargc;
|
||||||
static char **origargv;
|
static char **origargv;
|
||||||
|
|
|
@ -464,7 +464,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
||||||
{
|
{
|
||||||
volatile VALUE val = GETARG();
|
volatile VALUE val = GETARG();
|
||||||
char fbuf[32], nbuf[64], *s, *t;
|
char fbuf[32], nbuf[64], *s, *t;
|
||||||
char *prefix = 0;
|
const char *prefix = 0;
|
||||||
int sign = 0;
|
int sign = 0;
|
||||||
char sc = 0;
|
char sc = 0;
|
||||||
long v = 0;
|
long v = 0;
|
||||||
|
@ -716,7 +716,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
||||||
|
|
||||||
fval = RFLOAT(rb_Float(val))->value;
|
fval = RFLOAT(rb_Float(val))->value;
|
||||||
if (isnan(fval) || isinf(fval)) {
|
if (isnan(fval) || isinf(fval)) {
|
||||||
char *expr;
|
const char *expr;
|
||||||
|
|
||||||
if (isnan(fval)) {
|
if (isnan(fval)) {
|
||||||
expr = "NaN";
|
expr = "NaN";
|
||||||
|
|
2
string.c
2
string.c
|
@ -3988,7 +3988,7 @@ rb_str_crypt(VALUE str, VALUE salt)
|
||||||
{
|
{
|
||||||
extern char *crypt(const char *, const char *);
|
extern char *crypt(const char *, const char *);
|
||||||
VALUE result;
|
VALUE result;
|
||||||
char *s;
|
const char *s;
|
||||||
|
|
||||||
StringValue(salt);
|
StringValue(salt);
|
||||||
if (RSTRING(salt)->len < 2)
|
if (RSTRING(salt)->len < 2)
|
||||||
|
|
Loading…
Add table
Reference in a new issue