• R/O
  • HTTP
  • SSH
  • HTTPS

bchanf: Commit

各種ライブラリ


Commit MetaInfo

Revision295826f877a70467fed9122bf9fa6d987546b40a (tree)
Time2015-03-11 00:44:17
Authorornse01 <ornse01@user...>
Commiterornse01

Log Message

fix for latest ruby.

git-svn-id: http://svn.sourceforge.jp/svnroot/bchan/bchanf/trunk@652 20a0b8eb-f62a-4a12-8fe1-b598822500fb

Change Summary

Incremental Difference

--- a/src/tools/hmi_generator.rb
+++ b/src/tools/hmi_generator.rb
@@ -1,7 +1,8 @@
1+# -*- coding: euc-jp -*-
12 #
23 # hmi_generator.rb
34 #
4-# Copyright (c) 2012 project bchan
5+# Copyright (c) 2012-2014 project bchan
56 #
67 # This software is provided 'as-is', without any express or implied
78 # warranty. In no event will the authors be held liable for any damages
@@ -25,12 +26,11 @@
2526
2627 require 'yaml'
2728 require 'erb'
28-require 'jcode'
2929
3030 def conv_euc_to_TCArray(str)
3131 ret = Array.new();
32- str.each_char do |x|
33- i = x.length - 1;
32+ str.encode("EUC-JP").each_char do |x|
33+ i = x.bytesize - 1;
3434 val = 0;
3535 x.each_byte do |ch|
3636 val += ch << (8 * i);
@@ -2849,9 +2849,7 @@ def generate_source(filename, data)
28492849
28502850 end
28512851
2852-$KCODE = "EUC"
2853-
2854-yaml = YAML.load_file(ARGV[0]);
2852+yaml = YAML.load(File.read(ARGV[0], encoding: 'EUC-JP:UTF-8'));
28552853 data = HMIData.new(yaml);
28562854
28572855 fname_header = yaml["generator"]["output_header"]
--- a/src/tools/panel_generator.rb
+++ b/src/tools/panel_generator.rb
@@ -1,3 +1,4 @@
1+# -*- coding: euc-jp -*-
12 #
23 # panel_generator.rb
34 #
@@ -25,12 +26,11 @@
2526
2627 require 'yaml'
2728 require 'erb'
28-require 'jcode'
2929
3030 def conv_euc_to_TCArray(str)
3131 ret = Array.new();
32- str.each_char do |x|
33- i = x.length - 1;
32+ str.encode("EUC-JP").each_char do |x|
33+ i = x.bytesize - 1;
3434 val = 0;
3535 x.each_byte do |ch|
3636 val += ch << (8 * i);
@@ -547,9 +547,7 @@ def generate_source(filename, data)
547547 fd.close
548548 end
549549
550-$KCODE = "EUC"
551-
552-yaml = YAML.load_file(ARGV[0]);
550+yaml = YAML.load(File.read(ARGV[0], encoding: 'EUC-JP:UTF-8'));
553551 data = PanelData.new(yaml);
554552
555553 fname_header = yaml["generator"]["output_header"]
Show on old repository browser