From 6fc752bf7da30898ff8e570f9354cab9419cf3cf Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 7 Sep 2000 06:59:46 +0000 Subject: matz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 36 ++++++++++++++++++++- ToDo | 1 + lib/cgi/session.rb | 9 +++++- lib/finalize.rb | 6 ++-- misc/ruby-mode.el | 95 +++++++++++++++++++----------------------------------- node.h | 1 - regex.c | 3 +- string.c | 10 +++++- time.c | 7 ++-- variable.c | 17 ++++++++-- version.h | 4 +-- 11 files changed, 111 insertions(+), 78 deletions(-) diff --git a/ChangeLog b/ChangeLog index 09d8619903..b26599859b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,41 @@ -Mon Sep 4 12:58:31 2000 Yukihiro Matsumoto +Wed Sep 6 17:06:59 2000 Yukihiro Matsumoto * stable version 1.6.0 released. +Thu Sep 7 14:17:51 2000 Yukihiro Matsumoto + + * string.c (rb_str_cat): should work even for concatenating same + string. + +Wed Sep 6 17:06:38 2000 Yukihiro Matsumoto + + * variable.c (rb_cvar_declare): should check superclass's class + variable first. + +Wed Sep 6 10:42:02 2000 Yukihiro Matsumoto + + * misc/ruby-mode.el (ruby-calculate-indent): shift continuing line + if previous line ends with modifier keyword. + + * misc/ruby-mode.el (ruby-parse-region): should not give up if + modifiers are at the end of line. + + * misc/ruby-mode.el (ruby-expr-beg): indented wrongly if modified + statement was size 1. + +Wed Sep 6 10:41:19 2000 Kenichi Komiya + + * misc/ruby-mode.el (ruby-parse-region): modifier was not handled + well on emacs19. + +Tue Sep 5 17:10:12 2000 Yukihiro Matsumoto + + * time.c (time_to_s): fixed zone string UTC for utc time object. + +Tue Sep 5 00:26:06 2000 Yukihiro Matsumoto + + * regex.c (re_search): range worked wrongly on bm_search(). + Mon Sep 4 13:40:40 2000 WATANABE Hirofumi * configure.in: renamed libruby.a to libruby.{cygwin,mingw32}.a diff --git a/ToDo b/ToDo index a453ee3059..6992c4ccc6 100644 --- a/ToDo +++ b/ToDo @@ -91,6 +91,7 @@ Standard Libraries * introduce Boolean class; super of TrueClass, FalseClass * Process::waitall [ruby-talk:4557] * synchronized method - synchronized{...}, synchronized :foo, :bar +* move Time::times to Process. Extension Libraries diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb index 967603f59c..6940546ab2 100644 --- a/lib/cgi/session.rb +++ b/lib/cgi/session.rb @@ -51,7 +51,14 @@ class CGI @dbman = dbman::new(self, option) request.instance_eval do @output_hidden = {session_key => id} - @output_cookies = [Cookie::new(session_key,id)] + @output_cookies = [ + Cookie::new(session_key => id, + "path" => if ENV["SCRIPT_NAME"] then + File::dirname(ENV["SCRIPT_NAME"]) + else + "" + end) + ] end ObjectSpace::define_finalizer(self, Session::callback(@dbman)) end diff --git a/lib/finalize.rb b/lib/finalize.rb index 3cf79ff92f..598569f52e 100644 --- a/lib/finalize.rb +++ b/lib/finalize.rb @@ -32,7 +32,7 @@ # finalize all dependants connected by dependency R_*(obj, dependtant). # finalize_by_dependant(dependant, method = :finalize) # finalize the dependant connected by dependency R_method(*, dependtant). -# fainalize_all_by_dependant(dependant) +# finalize_all_by_dependant(dependant) # finalize all dependants connected by dependency R_*(*, dependant). # finalize_all # finalize all dependency registered to the Finalizer. @@ -138,7 +138,7 @@ module Finalizer end # finalize all dependants connected by dependency R_*(*, dependtant) - def fainalize_all_by_dependant(dependant) + def finalize_all_by_dependant(dependant) for id in @dependency.keys finalize_all_dependency(id, dependant) end @@ -190,7 +190,7 @@ module Finalizer module_function :finalize_dependency module_function :finalize_all_dependency module_function :finalize_by_dependant - module_function :fainalize_all_by_dependant + module_function :finalize_all_by_dependant module_function :finalize_all module_function :safe diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index 782d049144..e884e06994 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -37,6 +37,10 @@ "and\\|or\\|not" ) +(defconst ruby-block-hanging-re + (concat ruby-modifier-re "\\|" ruby-block-op-re) + ) + (defconst ruby-block-end-re "end") (defconst ruby-delimiter @@ -224,30 +228,30 @@ The variable ruby-indent-level controls the amount of indentation. (defun ruby-expr-beg (&optional option) (save-excursion - (if (looking-at "\\?") - (progn - (or (bolp) (forward-char -1)) - (not (looking-at "\\sw"))) - (store-match-data nil) - (skip-chars-backward " \t") + (store-match-data nil) + (skip-chars-backward " \t") + (cond + ((bolp) t) + ((looking-at "\\?") (or (bolp) (forward-char -1)) - (or (bolp) - (looking-at ruby-operator-re) - (looking-at "[\\[({]") + (not (looking-at "\\sw"))) + (t + (forward-char -1) + (or (looking-at ruby-operator-re) + (looking-at "[\\[({,;]") (and (not (eq option 'modifier)) (looking-at "[!?]")) (and (looking-at ruby-symbol-re) (skip-chars-backward ruby-symbol-chars) - (if (and (not (eq option 'modifier)) (bolp)) - t - (if (or (looking-at ruby-block-beg-re) - (looking-at ruby-block-op-re) - (looking-at ruby-block-mid-re)) - (progn - (goto-char (match-end 0)) - (looking-at "\\>")) - (and (not (eq option 'expr-arg)) - (looking-at "[a-zA-Z][a-zA-z0-9_]* +/[^ \t]"))))))))) + (cond + ((or (looking-at ruby-block-beg-re) + (looking-at ruby-block-op-re) + (looking-at ruby-block-mid-re)) + (goto-char (match-end 0)) + (looking-at "\\>")) + (t + (and (not (eq option 'expr-arg)) + (looking-at "[a-zA-Z][a-zA-z0-9_]* +/[^ \t]")))))))))) (defun ruby-parse-region (start end) (let ((indent-point end) @@ -375,40 +379,12 @@ The variable ruby-indent-level controls the amount of indentation. (setq depth (1+ depth)))) (goto-char (match-end 0))) ((looking-at ruby-block-beg-re) - (and - (or (not (looking-at "do\\>[^_]")) - (save-excursion - (back-to-indentation) - (not (looking-at ruby-non-block-do-re)))) - (or (bolp) - (progn - (forward-char -1) - (setq w (char-after (point))) - (not (or (eq ?_ w) - (eq ?. w))))) - (goto-char pnt) - (setq w (char-after (point))) - (not (eq ?_ w)) - (not (eq ?! w)) - (not (eq ?? w)) - (skip-chars-forward " \t") - (if (not (eolp)) - (progn - (goto-char (match-beginning 0)) - (if (looking-at ruby-modifier-re) - (ruby-expr-beg 'modifier) - t)) - t) - (goto-char pnt) - (setq nest (cons (cons nil pnt) nest)) - (setq depth (1+ depth))) - (goto-char pnt)) - ((looking-at ruby-block-beg-re) - (and - (or (not (looking-at "do\\>[^_]")) - (save-excursion - (back-to-indentation) - (not (looking-at ruby-non-block-do-re)))) + (and + (save-match-data + (or (not (looking-at "do\\>[^_]")) + (save-excursion + (back-to-indentation) + (not (looking-at ruby-non-block-do-re))))) (or (bolp) (progn (forward-char -1) @@ -421,13 +397,9 @@ The variable ruby-indent-level controls the amount of indentation. (not (eq ?! w)) (not (eq ?? w)) (skip-chars-forward " \t") - (if (not (eolp)) - (progn - (goto-char (match-beginning 0)) - (if (looking-at ruby-modifier-re) - (ruby-expr-beg 'modifier) - t)) - t) + (goto-char (match-beginning 0)) + (or (not (looking-at ruby-modifier-re)) + (ruby-expr-beg 'modifier)) (goto-char pnt) (setq nest (cons (cons nil pnt) nest)) (setq depth (1+ depth))) @@ -560,7 +532,8 @@ The variable ruby-indent-level controls the amount of indentation. (and (or (and (looking-at ruby-symbol-re) (skip-chars-backward ruby-symbol-chars) - (looking-at ruby-block-op-re) + (looking-at ruby-block-hanging-re) + (not (eq (point) (nth 3 state))) (save-excursion (goto-char (match-end 0)) (not (looking-at "[a-z_]")))) diff --git a/node.h b/node.h index cf6e23c255..016e2d4f0a 100644 --- a/node.h +++ b/node.h @@ -101,7 +101,6 @@ enum node_type { NODE_SCLASS, NODE_COLON2, NODE_COLON3, - NODE_CNAME, NODE_CREF, NODE_DOT2, NODE_DOT3, diff --git a/regex.c b/regex.c index 5ab57418aa..307b6af1aa 100644 --- a/regex.c +++ b/regex.c @@ -3137,7 +3137,7 @@ re_search(bufp, string, size, startpos, range, regs) /* If the search isn't to be a backwards one, don't waste time in a search for a pattern that must be anchored. */ - if (bufp->used>0) { + if (bufp->used > 0) { switch ((enum regexpcode)bufp->buffer[0]) { case begbuf: begbuf_match: @@ -3196,6 +3196,7 @@ re_search(bufp, string, size, startpos, range, regs) if (range > 0 && (bufp->options & RE_OPTIMIZE_EXACTN)) { startpos += pos; range -= pos; + if (range < 0) return -1; } } diff --git a/string.c b/string.c index 6343a2af5f..5eb5d248ed 100644 --- a/string.c +++ b/string.c @@ -427,10 +427,18 @@ rb_str_cat(str, ptr, len) long len; { if (len > 0) { + int poffset = -1; + rb_str_modify(str); + if (RSTRING(str)->ptr <= ptr && + ptr < RSTRING(str)->ptr + RSTRING(str)->len) { + poffset = ptr - RSTRING(str)->ptr; + } REALLOC_N(RSTRING(str)->ptr, char, RSTRING(str)->len + len + 1); - if (ptr) + if (ptr) { + if (poffset >= 0) ptr = RSTRING(str)->ptr + poffset; memcpy(RSTRING(str)->ptr + RSTRING(str)->len, ptr, len); + } RSTRING(str)->len += len; RSTRING(str)->ptr[RSTRING(str)->len] = '\0'; /* sentinel */ } diff --git a/time.c b/time.c index 78863e0535..cadd72cf19 100644 --- a/time.c +++ b/time.c @@ -633,13 +633,10 @@ time_to_s(time) if (tobj->tm_got == 0) { time_get_tm(time, tobj->gmt); } -#ifndef HAVE_TM_ZONE if (tobj->gmt == 1) { - len = strftime(buf, 128, "%a %b %d %H:%M:%S GMT %Y", &tobj->tm); + len = strftime(buf, 128, "%a %b %d %H:%M:%S UTC %Y", &tobj->tm); } - else -#endif - { + else { len = strftime(buf, 128, "%a %b %d %H:%M:%S %Z %Y", &tobj->tm); } return rb_str_new(buf, len); diff --git a/variable.c b/variable.c index 8ed31ca812..b37c040681 100644 --- a/variable.c +++ b/variable.c @@ -1332,11 +1332,11 @@ rb_cvar_set(klass, id, val) { VALUE tmp; - if (!OBJ_TAINTED(klass) && rb_safe_level() >= 4) - rb_raise(rb_eSecurityError, "Insecure: can't modify class variable"); tmp = klass; while (tmp) { if (RCLASS(tmp)->iv_tbl && st_lookup(RCLASS(tmp)->iv_tbl,id,0)) { + if (!OBJ_TAINTED(tmp) && rb_safe_level() >= 4) + rb_raise(rb_eSecurityError, "Insecure: can't modify class variable"); st_insert(RCLASS(tmp)->iv_tbl,id,val); return; } @@ -1353,6 +1353,19 @@ rb_cvar_declare(klass, id, val) ID id; VALUE val; { + VALUE tmp; + + tmp = klass; + while (tmp) { + if (RCLASS(tmp)->iv_tbl && st_lookup(RCLASS(tmp)->iv_tbl,id,0)) { + if (!OBJ_TAINTED(tmp) && rb_safe_level() >= 4) + rb_raise(rb_eSecurityError, "Insecure: can't modify class variable"); + st_insert(RCLASS(tmp)->iv_tbl,id,val); + return; + } + tmp = RCLASS(tmp)->super; + } + mod_av_set(klass, id, val, "class variable", Qfalse); } diff --git a/version.h b/version.h index b30b0f437a..786af11cd9 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.6.0" -#define RUBY_RELEASE_DATE "2000-09-04" +#define RUBY_RELEASE_DATE "2000-09-07" #define RUBY_VERSION_CODE 160 -#define RUBY_RELEASE_CODE 20000904 +#define RUBY_RELEASE_CODE 20000907 -- cgit v1.2.3