Changeset 231 for trunk/ext

Show
Ignore:
Timestamp:
11/13/2005 17:43:56 (3 years ago)
Author:
why
Message:

Fixes from Ruby 1.8.4 development, patches from matz, nobu, ocean and the guys.

Location:
trunk/ext/ruby
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/ext/ruby/ext/syck/rubyext.c

    r223 r231  
    8484void rb_syck_emitter_handler _((SyckEmitter *, st_data_t)); 
    8585int syck_parser_assign_io _((SyckParser *, VALUE)); 
     86VALUE syck_scalar_alloc _((VALUE class)); 
     87VALUE syck_seq_alloc _((VALUE class)); 
     88VALUE syck_map_alloc _((VALUE class)); 
    8689 
    8790struct parser_xtra { 
     
    775778    } 
    776779    rb_ivar_set(self, s_options, options); 
     780    rb_ivar_set(self, s_input, Qnil); 
    777781    return self; 
    778782} 
     
    13441348VALUE 
    13451349syck_domaintype_initialize( self, domain, type_id, val ) 
    1346     VALUE self, type_id, val; 
     1350    VALUE self, domain, type_id, val; 
    13471351{ 
    13481352    rb_iv_set( self, "@domain", domain ); 
  • trunk/ext/ruby/lib/yaml.rb

    r209 r231  
    1313require 'yaml/tag' 
    1414require 'yaml/stream' 
     15require 'yaml/constants' 
    1516 
    1617# == YAML 
     
    393394require 'yaml/types' 
    394395 
    395 module Kernel # :nodoc: 
     396module Kernel 
    396397    # 
    397398    # ryan:: You know how Kernel.p is a really convenient way to dump ruby 
  • trunk/ext/ruby/lib/yaml/basenode.rb

    r230 r231  
    149149                case pred 
    150150                when /^\.=/ 
    151                     pred = $' 
     151                    pred = $'   # ' 
    152152                    match_nodes.reject! { |n| 
    153153                        n.last.value != pred 
  • trunk/ext/ruby/lib/yaml/rubytypes.rb

    r228 r231  
    185185    def Symbol.yaml_new( klass, tag, val ) 
    186186        if String === val 
     187            val = YAML::load( val ) if val =~ /\A(["']).*\1\z/ 
    187188            val.intern 
    188189        else 
  • trunk/ext/ruby/lib/yaml/tag.rb

    r216 r231  
    5656    # taguris. 
    5757    def yaml_as( tag, sc = true ) 
    58         class_eval <<-"end;" 
    59             attr_accessor :taguri 
     58        verbose, $VERBOSE = $VERBOSE, nil 
     59        class_eval <<-"end;", __FILE__, __LINE__+1 
     60            attr_writer :taguri 
    6061            def taguri 
    6162                if respond_to? :to_yaml_type 
    6263                    YAML::tagurize( to_yaml_type[1..-1] ) 
    6364                else 
    64                     return @taguri if @taguri 
     65                    return @taguri if defined?(@taguri) and @taguri 
    6566                    tag = #{ tag.dump } 
    6667                    if self.class.yaml_tag_subclasses? and self.class != YAML::tagged_classes[tag] 
     
    7374        end; 
    7475        YAML::tag_class tag, self 
     76    ensure 
     77        $VERBOSE = verbose 
    7578    end 
    7679    # Transforms the subclass name into a name suitable for display 
  • trunk/ext/ruby/lib/yaml/types.rb

    r230 r231  
     1# -*- mode: ruby; ruby-indent-level: 4 -*- vim: sw=4 
    12# 
    23# Classes required by the full core typeset 
     
    67module YAML 
    78 
    8         # 
    9         # Default private type 
    10         # 
    11         class PrivateType 
     9    # 
     10    # Default private type 
     11    # 
     12    class PrivateType 
    1213        def self.tag_subclasses?; false; end 
    13         old_init = instance_method(:initialize) 
    14         define_method(:initialize) do |*args| 
    15             old_init.call(*args) 
     14        attr_accessor :type_id, :value 
     15        verbose, $VERBOSE = $VERBOSE, nil 
     16        def initialize( type, val ) 
     17            @type_id = type; @value = val 
    1618            @value.taguri = "x-private:#{ @type_id }" 
    17                 end 
    18                 def to_yaml( opts = {} ) 
     19        end 
     20        def to_yaml( opts = {} ) 
    1921            @value.to_yaml( opts ) 
    20                 end 
    21         end 
     22        end 
     23    ensure 
     24        $VERBOSE = verbose 
     25    end 
    2226 
    2327    # 
     
    2630    class DomainType 
    2731        def self.tag_subclasses?; false; end 
    28                 attr_accessor :domain, :type_id, :value 
    29         old_init = instance_method(:initialize) 
    30         define_method(:initialize) do |*args| 
    31             old_init.call(*args) 
     32        attr_accessor :domain, :type_id, :value 
     33        verbose, $VERBOSE = $VERBOSE, nil 
     34        def initialize( domain, type, val ) 
     35            @domain = domain; @type_id = type; @value = val 
    3236            @value.taguri = "tag:#{ @domain }:#{ @type_id }" 
    33                 end 
    34                 def to_yaml( opts = {} ) 
     37        end 
     38        def to_yaml( opts = {} ) 
    3539            @value.to_yaml( opts ) 
    36                 end 
    37         end 
     40        end 
     41    ensure 
     42        $VERBOSE = verbose 
     43    end 
    3844 
    3945    # 
     
    4248    class Object 
    4349        def self.tag_subclasses?; false; end 
    44                 def to_yaml( opts = {} ) 
     50        def to_yaml( opts = {} ) 
    4551            YAML::quick_emit( object_id, opts ) do |out| 
    4652                out.map( "tag:ruby.yaml.org,2002:object:#{ @class }", to_yaml_style ) do |map| 
     
    5056                end 
    5157            end 
    52                 end 
    53         end 
     58        end 
     59    end 
    5460 
    55         # 
    56         # YAML Hash class to support comments and defaults 
    57         # 
    58         class SpecialHash < ::Hash  
    59                 attr_accessor :default 
     61    # 
     62    # YAML Hash class to support comments and defaults 
     63    # 
     64    class SpecialHash < ::Hash  
     65        attr_accessor :default 
    6066        def inspect 
    6167            self.default.to_s 
    6268        end 
    63                 def to_s 
    64                         self.default.to_s 
    65                 end 
    66                 def update( h ) 
    67                         if YAML::SpecialHash === h 
    68                                 @default = h.default if h.default 
    69                         end 
    70                         super( h ) 
    71                 end 
     69        def to_s 
     70            self.default.to_s 
     71        end 
     72        def update( h ) 
     73            if YAML::SpecialHash === h 
     74                @default = h.default if h.default 
     75            end 
     76            super( h ) 
     77        end 
    7278        def to_yaml( opts = {} ) 
    7379            opts[:DefaultKey] = self.default 
    7480            super( opts ) 
    7581        end 
    76         end 
     82    end 
    7783 
    7884    #