Michael Granger avatar Michael Granger committed d7a3b8b Merge

Automated merge with ssh://bitbucket.org/ged/ruby191-porting/

Comments (0)

Files changed (5)

apichanges.textile

 
 h4(structs). Datatype Structs
 
-Some of the most-significant (and thankfully, easily-solved) changes are to the core class structures. They're all named @R<classname>@; @RClass@, @RString@, @RFloat@
+Some of the most-significant (and thankfully, easily-solved) changes are to the core class structures. They're all named @R<classname>@; @RClass@, @RString@, @RFloat@
+
+h3(m17n). Multinationalization (m17n)
+
+Ruby has a new system for handling text encoding that will affect how you use Strings. 
 			:debugmode  => false,
 		})
 
+		self.strategies.each do |strategy_class|
+			strategy_class.add_default_options( options )
+		end
+
 		return options
 	end
 
 		###	CLASS METHODS
 		### 
 
+		### Add any defaults to the given +options+ struct (an OpenStruct object).
+		def self::add_default_options( options )
+			# No-op
+		end
+
+
 		### Add any options the strategy needs to the given +optparser+.
 		def self::add_options( optparser )
 			# No-op

lib/porttool/m17n.rb

+#!/usr/bin/env ruby
+
+require 'porttool'
+
+# Multilingualization strategy for the Ruby 1.9.1 porting tool.
+# 
+# == Authors
+# * Michael Granger <ged@FaerieMUD.org>
+# 
+# == Revision
+# $Rev$
+# 
+#:include: LICENSE
+#
+#---
+#
+# Please see the file LICENSE for licensing details.
+#
+class PortTool::MultilingualizationConversionStrategy < PortTool::Strategy
+
+	# VALUE rb_external_str_new(const char *str, long len);
+	# VALUE rb_external_str_new_cstr(const char *str);)
+	# VALUE rb_locale_str_new(const char *str, long len);
+	# VALUE rb_locale_str_new_cstr(const char *str);
+	# VALUE rb_usascii_str_new(const char *str, long len);
+	# VALUE rb_usascii_str_new_cstr(const char *str);
+	# VALUE rb_enc_str_new(const char *str, long len, rb_encoding *encoding);
+	# VALUE rb_enc_vsprintf(rb_encoding *encoding, const char *format, va_list args)
+
+	### Add the struct option defaults to the +options+ struct.
+	def self::add_default_options( options )
+		options.m17n_strategy_disabled = false
+		options.m17n_macros = true
+	end
+
+
+	### Add the m17n-related options to the optparser.
+	def self::add_options( optparser )
+		optparser.on( '--disable-m17n', FalseClass, "Don't try to add multi-lingualization ",
+		 	"code to strings.") do
+			options.m17n_strategy_disabled = true
+		end
+		optparser.on( '--disable-m17n-macros', FalseClass, "Don't try to maintain backward-",
+		 	"compatibility with Ruby 1.8.6 and earlier with pre-processor macros when ",
+			"multi-lingualizing code." ) do
+			options.m17n_macros = false
+		end
+	end
+
+
+	### Look for R* struct access in the specified source and convert them to
+	### the equivalent macros.
+	def execute( source )
+		fixer = self.fixer
+		fixer.message "Multi-lingualizing strings:"
+
+		
+
+
+		return source
+	end
+
+
+end # class PortTool::MultilingualizationConversionStrategy
+
+

lib/porttool/structs.rb

 	]
 
 
+	### Add the struct option defaults to the +options+ struct.
+	def self::add_default_options( options )
+		options.struct_strategy_disabled = false
+	end
+
+
 	### Add the '--disable-structs' option to the optparser.
 	def self::add_options( optparser )
 		optparser.on( '--disable-structs', FalseClass, "Don't convert R* struct usage to macros." ) do

resources.textile

 ---
 A list of resources you can use to help figure out problems that aren't addressed by this guide.
 
-* Bruce's Slides
+* Bruce's Slides
+
+* Yuki Sonoda's blog post on http://yugui.jp/articles/838
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.