diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-18 23:48:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-18 23:48:49 +0000 |
commit | e54022001d84d1fa9fa07ecf9faddc7aba40a432 (patch) | |
tree | 05b7cb29e01dca8cc48c81eb6f9fcb783f2975a2 | |
parent | e1c72381c574a948ea6b1b959f3e89052350c25d (diff) |
* indent and tabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | eval.c | 62 | ||||
-rw-r--r-- | string.c | 94 |
2 files changed, 78 insertions, 78 deletions
@@ -733,9 +733,9 @@ struct RVarmap *ruby_dyna_vars; ruby_dyna_vars = 0 #define POP_VARS() \ - if (_old && (ruby_scope->flags & SCOPE_DONT_RECYCLE)) {\ - if (RBASIC(_old)->flags) /* unless it's already recycled */ \ - FL_SET(_old, DVAR_DONT_RECYCLE); \ + if (_old && (ruby_scope->flags & SCOPE_DONT_RECYCLE)) {\ + if (RBASIC(_old)->flags) /* unless it's already recycled */ \ + FL_SET(_old, DVAR_DONT_RECYCLE); \ }\ ruby_dyna_vars = _old; \ } while (0) @@ -981,15 +981,15 @@ static void scope_dup _((struct SCOPE *)); #define POP_SCOPE() \ if (ruby_scope->flags & SCOPE_DONT_RECYCLE) {\ - if (_old) scope_dup(_old); \ + if (_old) scope_dup(_old); \ } \ if (!(ruby_scope->flags & SCOPE_MALLOC)) {\ ruby_scope->local_vars = 0; \ ruby_scope->local_tbl = 0; \ if (!(ruby_scope->flags & SCOPE_DONT_RECYCLE) && \ - ruby_scope != top_scope) { \ + ruby_scope != top_scope) { \ rb_gc_force_recycle((VALUE)ruby_scope);\ - } \ + } \ } \ ruby_scope->flags |= SCOPE_NOSTACK; \ ruby_scope = _old; \ @@ -1029,7 +1029,7 @@ void ruby_set_current_source() { if (ruby_current_node) { - ruby_sourcefile = ruby_current_node->nd_file; + ruby_sourcefile = ruby_current_node->nd_file; ruby_sourceline = nd_line(ruby_current_node); } } @@ -1705,7 +1705,7 @@ rb_eval_cmd(cmd, arg, level) val = eval(ruby_top_self, cmd, Qnil, 0, 0); } if (ruby_scope->flags & SCOPE_DONT_RECYCLE) - scope_dup(saved_scope); + scope_dup(saved_scope); ruby_scope = saved_scope; ruby_safe_level = safe; POP_TAG(); @@ -2086,25 +2086,25 @@ copy_node_scope(node, rval) }\ else if (nd_type(n) == NODE_ARRAY) {\ argc=alen;\ - if (argc > 0) {\ - int i;\ + if (argc > 0) {\ + int i;\ n = anode;\ argv = TMP_ALLOC(argc);\ for (i=0;i<argc;i++) {\ argv[i] = rb_eval(self,n->nd_head);\ n=n->nd_next;\ }\ - }\ - else {\ + }\ + else {\ argc = 0;\ argv = 0;\ - }\ + }\ }\ else {\ - VALUE args = rb_eval(self,n);\ + VALUE args = rb_eval(self,n);\ if (TYPE(args) != T_ARRAY)\ args = rb_ary_to_ary(args);\ - argc = RARRAY(args)->len;\ + argc = RARRAY(args)->len;\ argv = ALLOCA_N(VALUE, argc);\ MEMCPY(argv, RARRAY(args)->ptr, VALUE, argc);\ }\ @@ -2117,7 +2117,7 @@ copy_node_scope(node, rval) int tmp_iter = ruby_iter->iter;\ if (tmp_iter == ITER_PRE) {\ ruby_block = ruby_block->outer;\ - tmp_iter = ITER_NOT;\ + tmp_iter = ITER_NOT;\ }\ PUSH_ITER(tmp_iter) @@ -2143,13 +2143,13 @@ arg_defined(self, node, buf, type) if (!node) return type; /* no args */ if (nd_type(node) == NODE_ARRAY) { argc=node->nd_alen; - if (argc > 0) { + if (argc > 0) { for (i=0;i<argc;i++) { if (!is_defined(self, node->nd_head, buf)) return 0; node = node->nd_next; } - } + } } else if (!is_defined(self, node, buf)) { return 0; @@ -2716,7 +2716,7 @@ rb_eval(self, n) /* nodes for speed-up(literal match) */ case NODE_MATCH3: - { + { VALUE r = rb_eval(self,node->nd_recv); VALUE l = rb_eval(self,node->nd_value); if (TYPE(l) == T_STRING) { @@ -3026,7 +3026,7 @@ rb_eval(self, n) break; case NODE_RESCUE: - { + { volatile VALUE e_info = ruby_errinfo; volatile int rescuing = 0; @@ -3077,7 +3077,7 @@ rb_eval(self, n) goto again; } } - break; + break; case NODE_ENSURE: PUSH_TAG(PROT_NONE); @@ -3619,8 +3619,8 @@ rb_eval(self, n) nd_set_type(node, NODE_LIT); node->nd_lit = result; break; - case NODE_LIT: - /* other thread may replace NODE_DREGX_ONCE to NODE_LIT */ + case NODE_LIT: + /* other thread may replace NODE_DREGX_ONCE to NODE_LIT */ goto again; case NODE_DXSTR: result = rb_funcall(self, '`', 1, str); @@ -3764,8 +3764,8 @@ rb_eval(self, n) rb_raise(rb_eTypeError, "no outer class/module"); } if (node->nd_super) { - super = rb_eval(self, node->nd_super); - rb_check_inheritable(super); + super = rb_eval(self, node->nd_super); + rb_check_inheritable(super); } else { super = 0; @@ -4764,7 +4764,7 @@ rb_yield_0(val, self, klass, flags, avalue) ruby_cref = (NODE*)old_cref; ruby_wrapper = old_wrapper; if (ruby_scope->flags & SCOPE_DONT_RECYCLE) - scope_dup(old_scope); + scope_dup(old_scope); ruby_scope = old_scope; scope_vmode = old_vmode; switch (state) { @@ -6131,7 +6131,7 @@ eval(self, src, scope, file, line) errat = get_backtrace(ruby_errinfo); mesg = rb_attr_get(ruby_errinfo, rb_intern("mesg")); - if (!NIL_P(errat) && TYPE(errat) == T_ARRAY) { + if (!NIL_P(errat) && TYPE(errat) == T_ARRAY) { if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) { rb_str_update(mesg, 0, 0, rb_str_new2(": ")); rb_str_update(mesg, 0, 0, RARRAY(errat)->ptr[0]); @@ -8891,7 +8891,7 @@ method_arity(method) return INT2FIX(0); case NODE_BMETHOD: case NODE_DMETHOD: - return proc_arity(body->nd_cval); + return proc_arity(body->nd_cval); default: body = body->nd_next; /* skip NODE_SCOPE */ if (nd_type(body) == NODE_BLOCK) @@ -10202,9 +10202,9 @@ rb_thread_schedule() th->wait_for = 0; th->select_value = 0; found = 1; - intersect_fds(&readfds, &th->readfds, max); - intersect_fds(&writefds, &th->writefds, max); - intersect_fds(&exceptfds, &th->exceptfds, max); + intersect_fds(&readfds, &th->readfds, max); + intersect_fds(&writefds, &th->writefds, max); + intersect_fds(&exceptfds, &th->exceptfds, max); } } END_FOREACH_FROM(curr, th); @@ -438,7 +438,7 @@ rb_str_format(str, arg) MEMCPY(argv+1, RARRAY(arg)->ptr, VALUE, RARRAY(arg)->len); return rb_f_sprintf(RARRAY(arg)->len+1, argv); } - + argv = ALLOCA_N(VALUE, 2); argv[0] = str; argv[1] = arg; @@ -627,7 +627,7 @@ rb_str_resize(str, len) if (len < 0) { rb_raise(rb_eArgError, "negative string size (or size too big)"); } - + if (len != RSTRING(str)->len) { rb_str_modify(str); if (RSTRING(str)->len < len || RSTRING(str)->len - len > 1024) { @@ -1169,7 +1169,7 @@ rb_str_rindex_m(argc, argv, str) if (rb_scan_args(argc, argv, "11", &sub, &position) == 2) { pos = NUM2LONG(position); - if (pos < 0) { + if (pos < 0) { pos += RSTRING(str)->len; if (pos < 0) { if (TYPE(sub) == T_REGEXP) { @@ -1177,7 +1177,7 @@ rb_str_rindex_m(argc, argv, str) } return Qnil; } - } + } if (pos > RSTRING(str)->len) pos = RSTRING(str)->len; } else { @@ -1355,8 +1355,8 @@ rb_str_succ(orig) sbeg = RSTRING(str)->ptr; s = sbeg + RSTRING(str)->len - 1; c = '\001'; while (sbeg <= s) { - if ((*s += 1) != 0) break; - s--; + if ((*s += 1) != 0) break; + s--; } } if (s < sbeg) { @@ -1455,7 +1455,7 @@ rb_str_subpat(str, re, nth) } return Qnil; } - + static VALUE rb_str_aref(str, indx) VALUE str; @@ -2017,7 +2017,7 @@ str_gsub(argc, argv, str, bang) } pat = get_pat(argv[0], 1); - offset=0; n=0; + offset=0; n=0; beg = rb_reg_search(pat, str, 0, 0); if (beg < 0) { if (bang) return Qnil; /* no match, no substitution */ @@ -2054,7 +2054,7 @@ str_gsub(argc, argv, str, bang) bp += len; memcpy(bp, RSTRING(val)->ptr, RSTRING(val)->len); bp += RSTRING(val)->len; - offset = END(0); + offset = END(0); if (BEG(0) == END(0)) { /* * Always consume at least one character of the input string @@ -2586,7 +2586,7 @@ rb_str_dump(str) case '"': case '\\': case '\n': case '\r': case '\t': case '\f': case '#': - case '\013': case '\007': case '\033': + case '\013': case '\007': case '\033': len += 2; break; @@ -3487,7 +3487,7 @@ rb_str_split_m(argc, argv, str) if (!RSTRING(str)->ptr) { rb_ary_push(result, rb_str_new("", 0)); break; - } + } else if (last_null == 1) { rb_ary_push(result, rb_str_substr(str, beg, mbclen2(RSTRING(str)->ptr[beg],spat))); beg = start; @@ -3651,7 +3651,7 @@ rb_str_each_line(argc, argv, str) } if (s != pend) { - if (p > pend) p = pend; + if (p > pend) p = pend; line = rb_str_new5(str, s, p - s); OBJ_INFECT(line, str); rb_yield(line); @@ -4208,7 +4208,7 @@ rb_str_scan(str, pat) rb_backref_set(match); return ary; } - + while (!NIL_P(result = scan_once(str, pat, &start))) { match = rb_backref_get(); rb_match_busy(match); @@ -4436,45 +4436,45 @@ rb_str_justify(argc, argv, str, jflag) if (RSTRING(pad)->len > 0) { f = RSTRING(pad)->ptr; flen = RSTRING(pad)->len; - } + } } p = RSTRING(res)->ptr; if (jflag != 'l') { - n = width - RSTRING(str)->len; - pend = p + ((jflag == 'r') ? n : n/2); - if (flen <= 1) { - while (p < pend) { - *p++ = *f; - } - } - else { - char *q = f; - while (p + flen <= pend) { - memcpy(p,f,flen); - p += flen; - } - while (p < pend) { - *p++ = *q++; - } - } + n = width - RSTRING(str)->len; + pend = p + ((jflag == 'r') ? n : n/2); + if (flen <= 1) { + while (p < pend) { + *p++ = *f; + } + } + else { + char *q = f; + while (p + flen <= pend) { + memcpy(p,f,flen); + p += flen; + } + while (p < pend) { + *p++ = *q++; + } + } } memcpy(p, RSTRING(str)->ptr, RSTRING(str)->len); if (jflag != 'r') { - p += RSTRING(str)->len; pend = RSTRING(res)->ptr + width; - if (flen <= 1) { - while (p < pend) { - *p++ = *f; - } - } - else { - while (p + flen <= pend) { - memcpy(p,f,flen); - p += flen; - } - while (p < pend) { - *p++ = *f++; - } - } + p += RSTRING(str)->len; pend = RSTRING(res)->ptr + width; + if (flen <= 1) { + while (p < pend) { + *p++ = *f; + } + } + else { + while (p + flen <= pend) { + memcpy(p,f,flen); + p += flen; + } + while (p < pend) { + *p++ = *f++; + } + } } OBJ_INFECT(res, str); if (flen > 0) OBJ_INFECT(res, pad); @@ -4581,7 +4581,7 @@ Init_String() rb_include_module(rb_cString, rb_mEnumerable); rb_define_alloc_func(rb_cString, str_alloc); rb_define_method(rb_cString, "initialize", rb_str_init, -1); - rb_define_method(rb_cString, "initialize_copy", rb_str_replace, 1); + rb_define_method(rb_cString, "initialize_copy", rb_str_replace, 1); rb_define_method(rb_cString, "<=>", rb_str_cmp_m, 1); rb_define_method(rb_cString, "==", rb_str_equal, 1); rb_define_method(rb_cString, "eql?", rb_str_eql, 1); |