From 17f705e8cd357158916481eb2a8f13e0f91f2299 Mon Sep 17 00:00:00 2001 From: why Date: Tue, 13 May 2003 22:29:52 +0000 Subject: [PATCH] * lib/yaml/rubytypes.rb, lib/yaml/types.rb: using Object#object_id rather than deprecated Object#id. * ext/token.c: changed ASCII escapes to octal notation. * ext/Setup*: added entries for static linking of Syck extension. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 43 +++++++++++++++++++++++++++++++++++++++++++ ext/Setup | 1 + ext/Setup.atheos | 1 + ext/Setup.dj | 1 + ext/Setup.emx | 1 + ext/Setup.nt | 1 + ext/Setup.x68 | 1 + ext/syck/token.c | 14 +++++++------- lib/yaml/rubytypes.rb | 18 +++++++++++------- lib/yaml/types.rb | 12 ++++++++---- 10 files changed, 75 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 145f428a97..5dae911a97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Tue May 13 22:31:04 2003 why the lucky stiff + + * lib/yaml/rubytypes.rb, lib/yaml/types.rb: using Object#object_id + rather than deprecated Object#id. + + * ext/token.c: changed ASCII escapes to octal notation. + + * ext/Setup*: added entries for static linking of Syck extension. + Tue May 13 20:31:58 2003 WATANABE Hirofumi * configure.in: add '--Wl,--enable-auto-import' to DLDFLAGS @@ -24,6 +33,16 @@ Tue May 13 14:48:07 2003 Yukihiro Matsumoto * eval.c (error_print,error_handle,rb_longjmp,rb_thread_schedule): ditto. +Tue May 13 06:34:19 2003 why the lucky stiff + + * lib/yaml/rubytypes.rb: object and struct loading + + * lib/yaml.rb: YAML::detect_implicit will discover typing for a Ruby + string + + * ext/syck/: Fixed portable comments, misuse of NULL and methods without + return VALUEs. + Mon May 12 18:08:21 2003 Yukihiro Matsumoto * io.c (Init_IO): new variable $deferr which is default output @@ -43,6 +62,26 @@ Sun May 11 13:50:12 2003 Tanaka Akira * lib/pp.rb (PP::ObjectMixin#pretty_print): refine to_s handling. +Sun May 11 06:32:13 2003 why the lucky stiff + + * ext/syck/implicit.c, ext/syck/rubyext.c: transfer methods applied to + native loading + + * ext/syck/token.c: fix for transfer methods on same indentation as nested + mapping + + * lib/yaml/rubytypes.rb: all type names in lowercase + +Sat May 10 19:55:18 2003 why the lucky stiff + + * ext/syck/gram.c ext/syck/handler.c ext/syck/implicit.c + ext/syck/node.c ext/syck/rubyext.c ext/syck/syck.c + ext/syck/syck.h ext/syck/token.c: updated to Syck 0.27 + + * lib/yaml/loader.rb: new YAML::Loader class + + * lib/yaml.rb: loading of type families leverages YAML::DefaultLoader + Sat May 10 19:00:08 2003 Takaaki Uematsu * wince/string.c: file removed. @@ -55,6 +94,10 @@ Sat May 10 16:17:02 2003 Shugo Maeda * lib/net/imap.rb (encode_utf7): new method. +Fri May 9 21:25:50 2003 why the lucky stiff + + * ruby/ext/syck, ruby/lib/yaml: Initial checkin of YAML substances. + Fri May 9 16:38:30 2003 Yukihiro Matsumoto * io.c (rb_io_reopen): It should be possible to reopen closed IO. diff --git a/ext/Setup b/ext/Setup index 6b76bdb0ec..157dd8a85d 100644 --- a/ext/Setup +++ b/ext/Setup @@ -22,6 +22,7 @@ #socket #stringio #strscan +#syck #syslog #tcltklib #tk diff --git a/ext/Setup.atheos b/ext/Setup.atheos index 93be203d65..67c03b9e95 100644 --- a/ext/Setup.atheos +++ b/ext/Setup.atheos @@ -21,6 +21,7 @@ sdbm socket stringio strscan +syck syslog #tcltklib #tk diff --git a/ext/Setup.dj b/ext/Setup.dj index ac3e06fafc..e5a10ffea1 100644 --- a/ext/Setup.dj +++ b/ext/Setup.dj @@ -22,6 +22,7 @@ sdbm #socket stringio strscan +syck #syslog #tcltklib #tk diff --git a/ext/Setup.emx b/ext/Setup.emx index e4a93c55ab..de38b54f55 100644 --- a/ext/Setup.emx +++ b/ext/Setup.emx @@ -22,6 +22,7 @@ racc/cparse socket stringio strscan +#syck #syslog #tcltklib #tk diff --git a/ext/Setup.nt b/ext/Setup.nt index 1840c467a9..d4e2e3adbe 100644 --- a/ext/Setup.nt +++ b/ext/Setup.nt @@ -22,6 +22,7 @@ sdbm socket stringio strscan +#syck #syslog #tcltklib #tk diff --git a/ext/Setup.x68 b/ext/Setup.x68 index ad241ce58b..dd70ea786d 100644 --- a/ext/Setup.x68 +++ b/ext/Setup.x68 @@ -22,6 +22,7 @@ racc/cparse #socket stringio strscan +#syck #syslog #tcltklib #tk diff --git a/ext/syck/token.c b/ext/syck/token.c index 5098cf53f3..dc8802740b 100644 --- a/ext/syck/token.c +++ b/ext/syck/token.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.5 on Tue May 13 00:35:24 2003 */ +/* Generated by re2c 0.5 on Tue May 13 14:03:13 2003 */ #line 1 "token.re" /* * token.re @@ -1231,14 +1231,14 @@ yy156: { char ch = *( YYCURSOR - 1 ); switch ( ch ) { - case 'a': ch = '\a'; break; - case 'b': ch = '\b'; break; - case 'e': ch = '\e'; break; - case 'f': ch = '\f'; break; + case 'a': ch = 7; break; + case 'b': ch = '\010'; break; + case 'e': ch = '\033'; break; + case 'f': ch = '\014'; break; case 'n': ch = '\n'; break; - case 'r': ch = '\r'; break; + case 'r': ch = '\015'; break; case 't': ch = '\t'; break; - case 'v': ch = '\v'; break; + case 'v': ch = '\013'; break; } QUOTECAT(qstr, qcapa, qidx, ch); goto DoubleQuote2; diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb index 3d4992a29f..1a9c4ef67a 100644 --- a/lib/yaml/rubytypes.rb +++ b/lib/yaml/rubytypes.rb @@ -2,6 +2,10 @@ require 'date' # # Type conversions # + +# Ruby 1.6.x Object#object_id +class Object; alias_method :object_id, :id; end unless Object.respond_to? :object_id + class Object def is_complex_yaml? true @@ -13,7 +17,7 @@ class Object instance_variables.sort end def to_yaml( opts = {} ) - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| out.map( self.to_yaml_type ) { |map| to_yaml_properties.each { |m| map.add( m[1..-1], instance_eval( m ) ) @@ -44,7 +48,7 @@ class Hash end def to_yaml( opts = {} ) opts[:DocType] = self.class if Hash === opts - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| hash_type = to_yaml_type if not out.options[:ExplicitTypes] and hash_type == "!map" hash_type = "" @@ -106,7 +110,7 @@ module YAML true end def to_yaml( opts = {} ) - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| out.seq( "!ruby/flexhash" ) { |seq| self.each { |v| if v[1] @@ -145,7 +149,7 @@ class Struct true end def to_yaml( opts = {} ) - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| # # Basic struct is passed as a YAML map # @@ -204,7 +208,7 @@ class Array end def to_yaml( opts = {} ) opts[:DocType] = self.class if Hash === opts - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| array_type = to_yaml_type if not out.options[:ExplicitTypes] and array_type == "!seq" array_type = "" @@ -252,7 +256,7 @@ class String complex = true end end - YAML::quick_emit( complex ? self.id : nil, opts ) { |out| + YAML::quick_emit( complex ? self.object_id : nil, opts ) { |out| if complex if self.is_binary_data? out.binary_base64( self ) @@ -299,7 +303,7 @@ class Symbol def to_yaml( opts = {} ) YAML::quick_emit( nil, opts ) { |out| out << "!ruby/sym " - self.id2name.to_yaml( :Emitter => out ) + self.object_id2name.to_yaml( :Emitter => out ) } end end diff --git a/lib/yaml/types.rb b/lib/yaml/types.rb index 7602c436e7..b34c38fe71 100644 --- a/lib/yaml/types.rb +++ b/lib/yaml/types.rb @@ -1,6 +1,10 @@ # # Classes required by the full core typeset # + +# Ruby 1.6.x Object#object_id +class Object; alias_method :object_id, :id; end unless Object.respond_to? :object_id + module YAML # @@ -12,7 +16,7 @@ module YAML @type_id = type; @value = val end def to_yaml( opts = {} ) - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| out << " !!#{@type_id}" value.to_yaml( :Emitter => out ) } @@ -35,7 +39,7 @@ module YAML "#{dom}/#{@type_id}" end def to_yaml( opts = {} ) - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| out << " !#{to_yaml_type} " value.to_yaml( :Emitter => out ) } @@ -95,7 +99,7 @@ module YAML true end def to_yaml( opts = {} ) - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| out.seq( "!omap" ) { |seq| self.each { |v| seq.add( Hash[ *v ] ) @@ -146,7 +150,7 @@ module YAML true end def to_yaml( opts = {} ) - YAML::quick_emit( self.id, opts ) { |out| + YAML::quick_emit( self.object_id, opts ) { |out| out.seq( "!pairs" ) { |seq| self.each { |v| seq.add( Hash[ *v ] )