Ruby GTK3移行後のメインリポジトリ
Revisão | fd5fbab09273fa440075895004141974f1e21d4a (tree) |
---|---|
Hora | 2015-05-30 16:55:47 |
Autor | Shyouzou Sugitani <shy@user...> |
Commiter | Shyouzou Sugitani |
assorted fixes(27)
@@ -125,13 +125,13 @@ module Communicate | ||
125 | 125 | end |
126 | 126 | refs = refs.join('\x01') |
127 | 127 | Logging::Logging.debug("NOTIFY OTHER: " \ |
128 | - + on_other_event + ", " \ | |
129 | - + name + ", " \ | |
130 | - + self_name + ", " \ | |
131 | - + flags + ", " \ | |
132 | - + event + ", " \ | |
133 | - + script + ", " \ | |
134 | - + refs) | |
128 | + + on_other_event.to_s + ", " \ | |
129 | + + name.to_s + ", " \ | |
130 | + + selfname.to_s + ", " \ | |
131 | + + flags.to_s + ", " \ | |
132 | + + event.to_s + ", " \ | |
133 | + + script.to_s + ", " \ | |
134 | + + refs.to_s) | |
135 | 135 | args = [name, selfname, flags, event, script, refs] |
136 | 136 | else # XXX: should not reach here |
137 | 137 | return |
@@ -279,10 +279,10 @@ module Sakura | ||
279 | 279 | path = File.join(get_prefix(), 'HISTORY') |
280 | 280 | begin |
281 | 281 | open(path, 'w') do |file| |
282 | - file.write("time, ", @ghost_time.to_s, "\n") | |
283 | - file.write("vanished_count, ", @vanished_count.to_s, "\n") | |
282 | + file.write("time, " + @ghost_time.to_s + "\n") | |
283 | + file.write("vanished_count, " + @vanished_count.to_s + "\n") | |
284 | 284 | end |
285 | - rescue #except IOError as e: | |
285 | + rescue IOError => e | |
286 | 286 | #code, message = e.args |
287 | 287 | Logging::Logging.error('cannot write ' + path) |
288 | 288 | end |
@@ -293,13 +293,13 @@ module Sakura | ||
293 | 293 | begin |
294 | 294 | open(path, 'w') do |file| |
295 | 295 | if @balloon_directory != nil |
296 | - file.write("balloon_directory, ", @balloon_directory, "\n") | |
296 | + file.write("balloon_directory, " + @balloon_directory + "\n") | |
297 | 297 | end |
298 | 298 | if @shell_directory != nil |
299 | - file.write("shell_directory, ", @shell_directory, "\n") | |
299 | + file.write("shell_directory, " + @shell_directory + "\n") | |
300 | 300 | end |
301 | 301 | end |
302 | - rescue #except IOError as e: | |
302 | + rescue IOError => e | |
303 | 303 | #code, message = e.args |
304 | 304 | Logging::Logging.error('cannot write ' + path) |
305 | 305 | end |
@@ -316,23 +316,23 @@ module Sakura | ||
316 | 316 | if not line.include?(',') |
317 | 317 | next |
318 | 318 | end |
319 | - key, value = line.split(',', 1) | |
319 | + key, value = line.split(',', 2) | |
320 | 320 | key = key.strip() |
321 | 321 | if key == 'time' |
322 | 322 | begin |
323 | 323 | ghost_time = value.strip().to_i |
324 | - rescue #except: | |
324 | + rescue | |
325 | 325 | #pass |
326 | 326 | end |
327 | 327 | elsif key == 'vanished_count' |
328 | 328 | begin |
329 | 329 | ghost_vanished_count = value.strip().to_i |
330 | - rescue #except: | |
330 | + rescue | |
331 | 331 | #pass |
332 | 332 | end |
333 | 333 | end |
334 | 334 | end |
335 | - rescue #except IOError as e: | |
335 | + rescue IOError => e | |
336 | 336 | #code, message = e.args |
337 | 337 | Logging::Logging.error('cannot read ' + path) |
338 | 338 | @ghost_time = ghost_time |
@@ -355,7 +355,7 @@ module Sakura | ||
355 | 355 | if not line.include?(',') |
356 | 356 | next |
357 | 357 | end |
358 | - key, value = line.split(',', 1) | |
358 | + key, value = line.split(',', 2) | |
359 | 359 | if key.strip() == 'balloon_directory' |
360 | 360 | balloon_directory = value.strip() |
361 | 361 | end |
@@ -363,7 +363,7 @@ module Sakura | ||
363 | 363 | shell_directory = value.strip() |
364 | 364 | end |
365 | 365 | end |
366 | - rescue #except IOError as e: | |
366 | + rescue IOError => e | |
367 | 367 | #code, message = e.args |
368 | 368 | Logging::Logging.error('cannot read ' + path) |
369 | 369 | end |
@@ -1212,12 +1212,11 @@ module Sakura | ||
1212 | 1212 | script, communication = [default, nil] |
1213 | 1213 | end |
1214 | 1214 | if not script.empty? or (script.empty? and event != 'OnSecondChange') |
1215 | - t = Time.new.localtime.to_a | |
1216 | - m = MONTH_NAMES[t[4] - 1] | |
1217 | - ## FIXME | |
1218 | - #Logging::Logging.debug( | |
1219 | - # '\n[{0:02d}/{1}/{2:d}:{3:02d}:{4:02d}:{5:02d} {6:+05d}]'.format( | |
1220 | - # t[2], m, t[0], t[3], t[4], t[5], (- time.timezone / 36).to_i)) | |
1215 | + t = Time.new.localtime | |
1216 | + m = MONTH_NAMES[t.month - 1] | |
1217 | + Logging::Logging.debug( | |
1218 | + sprintf("\n[%02d/%s/%d:%02d:%02d:%02d %+05d]", | |
1219 | + t.day, m, t.year, t.hour, t.min, t.sec, t.utc_offset / 36)) | |
1221 | 1220 | Logging::Logging.debug('Event: ' + event) |
1222 | 1221 | for n in 0..arglist.length-1 |
1223 | 1222 | value = arglist[n] |
@@ -1380,7 +1379,7 @@ module Sakura | ||
1380 | 1379 | color_r = [0, [255, color_r.to_i].min].max |
1381 | 1380 | color_g = [0, [255, color_g.to_i].min].max |
1382 | 1381 | color_b = [0, [255, color_b.to_i].min].max |
1383 | - rescue #except: | |
1382 | + rescue | |
1384 | 1383 | #pass |
1385 | 1384 | else |
1386 | 1385 | background = [color_r, color_g, color_b] |
@@ -1392,7 +1391,7 @@ module Sakura | ||
1392 | 1391 | color_r = [0, [255, color_r.to_i].min].max |
1393 | 1392 | color_g = [0, [255, color_g.to_i].min].max |
1394 | 1393 | color_b = [0, [255, color_b.to_i].min].max |
1395 | - rescue #except: | |
1394 | + rescue | |
1396 | 1395 | #pass |
1397 | 1396 | else |
1398 | 1397 | foreground = [color_r, color_g, color_b] |
@@ -1945,16 +1944,13 @@ module Sakura | ||
1945 | 1944 | @script_position = 0 |
1946 | 1945 | while true |
1947 | 1946 | begin |
1948 | - #@processed_script.extend(@script_parser.parse(script)) | |
1949 | - @processed_script = @script_parser.parse(script) | |
1947 | + @processed_script.concat(@script_parser.parse(script)) | |
1950 | 1948 | break |
1951 | - rescue #except ninix.script.ParserError as e: | |
1952 | - #logging.error('-' * 50) | |
1953 | - #logging.error('{0}'.format(e)) # 'UTF-8' | |
1954 | - #done, script = e | |
1955 | - #@processed_script.extend(done) | |
1956 | - #else | |
1957 | - # break | |
1949 | + rescue Script::ParserError => e | |
1950 | + Logging::Logging.error('-' * 50) | |
1951 | + Logging::Logging.error(e.format) # 'UTF-8' | |
1952 | + done, script = e.get_item | |
1953 | + @processed_script.concat(done) | |
1958 | 1954 | end |
1959 | 1955 | end |
1960 | 1956 | @script_mode = BROWSE_MODE |
@@ -1964,6 +1960,9 @@ module Sakura | ||
1964 | 1960 | @quick_session = false |
1965 | 1961 | set_synchronized_session(:list => [], :reset => true) |
1966 | 1962 | @balloon.hide_all() |
1963 | + if @processed_script.empty? | |
1964 | + return | |
1965 | + end | |
1967 | 1966 | node = @processed_script[0] |
1968 | 1967 | if node[0] == Script::SCRIPT_TAG and node[1] == '\C' |
1969 | 1968 | @processed_script.shift |
@@ -1999,7 +1998,7 @@ module Sakura | ||
1999 | 1998 | def __yen_p(args) |
2000 | 1999 | begin |
2001 | 2000 | chr_id = args[0].to_i |
2002 | - rescue #except: | |
2001 | + rescue ArgumentError | |
2003 | 2002 | return |
2004 | 2003 | end |
2005 | 2004 | if chr_id >= 0 |
@@ -2089,7 +2088,7 @@ module Sakura | ||
2089 | 2088 | else |
2090 | 2089 | begin |
2091 | 2090 | balloon_id = (args[0].to_i / 2).to_i |
2092 | - rescue #except ValueError: | |
2091 | + rescue ArgumentError | |
2093 | 2092 | balloon_id = 0 |
2094 | 2093 | else |
2095 | 2094 | @balloon.set_balloon(@script_side, balloon_id) |
@@ -2100,7 +2099,7 @@ module Sakura | ||
2100 | 2099 | def __yen__b(args) |
2101 | 2100 | begin |
2102 | 2101 | filename, x, y = expand_meta(args[0]).split(',') |
2103 | - rescue #except: | |
2102 | + rescue ArgumentError | |
2104 | 2103 | filename, param = expand_meta(args[0]).split(',') |
2105 | 2104 | #assert param == 'inline' |
2106 | 2105 | x, y = 0, 0 ## FIXME |
@@ -2132,7 +2131,7 @@ module Sakura | ||
2132 | 2131 | def __set_weight(value, unit) |
2133 | 2132 | begin |
2134 | 2133 | amount = value.to_i * unit - 0.01 |
2135 | - rescue #except ValueError: | |
2134 | + rescue ArgumentError | |
2136 | 2135 | amount = 0 |
2137 | 2136 | end |
2138 | 2137 | if amount > 0 |
@@ -2237,7 +2236,7 @@ module Sakura | ||
2237 | 2236 | def __yen_i(args) |
2238 | 2237 | begin |
2239 | 2238 | actor_id = args[0].to_i |
2240 | - rescue #except ValueError: | |
2239 | + rescue ArgumentError | |
2241 | 2240 | #pass |
2242 | 2241 | else |
2243 | 2242 | @surface.invoke(@script_side, actor_id) |
@@ -2272,7 +2271,7 @@ module Sakura | ||
2272 | 2271 | def __yen_and(args) |
2273 | 2272 | begin |
2274 | 2273 | text = CGI.unescape_html("&" + args[0].to_s + ";") |
2275 | - rescue #except: | |
2274 | + rescue ArgumentError | |
2276 | 2275 | text = nil |
2277 | 2276 | end |
2278 | 2277 | if text == nil |
@@ -2284,7 +2283,7 @@ module Sakura | ||
2284 | 2283 | def __yen__m(args) |
2285 | 2284 | begin |
2286 | 2285 | num = args[0].to_i(16) |
2287 | - rescue #except ValueError: | |
2286 | + rescue ArgumentError | |
2288 | 2287 | num = 0 |
2289 | 2288 | end |
2290 | 2289 | if 0x20 <= num and num <= 0x7e |
@@ -2569,7 +2568,7 @@ module Sakura | ||
2569 | 2568 | begin |
2570 | 2569 | x = args[2].to_i |
2571 | 2570 | y = args[3].to_i |
2572 | - rescue #except: | |
2571 | + rescue ArgumentError | |
2573 | 2572 | #pass |
2574 | 2573 | else |
2575 | 2574 | @surface.set_balloon_offset(@script_side, [x, y]) |
@@ -2598,7 +2597,7 @@ module Sakura | ||
2598 | 2597 | @audio_player.set_state(Gst::State::NULL) |
2599 | 2598 | begin |
2600 | 2599 | track = args[2].to_i |
2601 | - rescue #except: | |
2600 | + rescue ArgumentError | |
2602 | 2601 | return |
2603 | 2602 | end |
2604 | 2603 | @audio_player.set_property( |
@@ -2920,7 +2919,7 @@ module Sakura | ||
2920 | 2919 | end |
2921 | 2920 | begin |
2922 | 2921 | @sstp_handle.send([data, '\n'].join('')) |
2923 | - rescue #except socket.error: | |
2922 | + rescue SystemCallError => e | |
2924 | 2923 | #pass |
2925 | 2924 | end |
2926 | 2925 | end |
@@ -2941,7 +2940,7 @@ module Sakura | ||
2941 | 2940 | ##logging.debug('close_sstp_handle()') |
2942 | 2941 | begin |
2943 | 2942 | @sstp_handle.close() |
2944 | - rescue #except socket.error | |
2943 | + rescue SystemCallError => e | |
2945 | 2944 | #pass |
2946 | 2945 | end |
2947 | 2946 | @sstp_handle = nil |
@@ -28,75 +28,72 @@ module Script | ||
28 | 28 | TEXT_META = 1 |
29 | 29 | TEXT_STRING = 2 |
30 | 30 | |
31 | -# class ParserError < Exception | |
32 | -# | |
33 | -# def initialize(message, error: 'strict', | |
34 | -# script: nil, src: nil, column: nil, length: nil, skip: nil) | |
35 | -# if not ['strict', 'loose'].include?(error) | |
36 | -# raise ValueError('unknown error scheme: {0}'.format(str(error))) | |
37 | -# end | |
38 | -# @message = message | |
39 | -# @error = error | |
40 | -# @script = script or [] | |
41 | -# @src = src or '' | |
42 | -# @column = column | |
43 | -# @length = length or 0 | |
44 | -# @skip = skip or 0 | |
45 | -# end | |
46 | -# | |
47 | -# def __getitem__(n) | |
48 | -# if n == 0 | |
49 | -# if @error == 'strict' | |
50 | -# return [] | |
51 | -# else | |
52 | -# return @script | |
53 | -# end | |
54 | -# elsif n == 1 | |
55 | -# if @error == 'strict' or @column == nil | |
56 | -# return '' | |
57 | -# else | |
58 | -# return @src[@column + @skip, @src.length] | |
59 | -# end | |
60 | -# else | |
61 | -# raise IndexError('tuple index out of range') | |
62 | -# end | |
63 | -# end | |
64 | -# | |
65 | -# def __str__ | |
66 | -# if @column != nil | |
67 | -# column = @column | |
68 | -# if not @src.empty? | |
69 | -# dump = [@src[:column], | |
70 | -# '\x1b[7m', | |
71 | -# (@src[column, column + @length] or ' '), | |
72 | -# '\x1b[m', | |
73 | -# @src[column + @length, @src.length]].join('') | |
74 | -# else | |
75 | -# dump = '' | |
76 | -# end | |
77 | -# else | |
78 | -# column = '??' | |
79 | -# dump = @src | |
80 | -# end | |
81 | -# return 'ParserError: column {0}: {1}\n{2}'.format(column, @message, dump) | |
82 | -# end | |
83 | -# end | |
31 | + class ParserError < StandardError | |
32 | + | |
33 | + def initialize( | |
34 | + error: 'strict', | |
35 | + script: nil, src: nil, column: nil, length: nil, skip: nil) | |
36 | + if not ['strict', 'loose'].include?(error) | |
37 | + raise ValueError('unknown error scheme: {0}'.format(str(error))) | |
38 | + end | |
39 | + @error = error | |
40 | + @script = script or [] | |
41 | + @src = src or '' | |
42 | + @column = column | |
43 | + @length = length or 0 | |
44 | + @skip = skip or 0 | |
45 | + end | |
46 | + | |
47 | + def get_item | |
48 | + if @error == 'strict' | |
49 | + done = [] | |
50 | + else | |
51 | + done = @script | |
52 | + end | |
53 | + if @error == 'strict' or @column == nil | |
54 | + script = '' | |
55 | + else | |
56 | + script = @src[@column + @skip, @src.length] | |
57 | + end | |
58 | + return done, script | |
59 | + end | |
60 | + | |
61 | + def format | |
62 | + if @column != nil | |
63 | + column = @column | |
64 | + if not @src.empty? | |
65 | + dump = [@src[0..@column-1], | |
66 | + '\x1b[7m', | |
67 | + (@src[column, @length] or ' '), | |
68 | + '\x1b[m', | |
69 | + @src[column+@length..@src.length-1]].join('') | |
70 | + else | |
71 | + dump = '' | |
72 | + end | |
73 | + else | |
74 | + column = '??' | |
75 | + dump = @src | |
76 | + end | |
77 | + return 'ParserError: column ' + column.to_s + ': ' + message + "\n" + dump | |
78 | + end | |
79 | + end | |
84 | 80 | |
85 | 81 | class Parser |
86 | 82 | |
87 | 83 | def initialize(error: 'strict') |
88 | 84 | if not ['strict', 'loose'].include?(error) |
89 | -# raise ValueError('unknown error scheme: {0}'.format(str(error))) | |
85 | + raise ArgumentError('unknown error scheme: ' + error.to_s) | |
90 | 86 | end |
91 | 87 | @error = error |
92 | 88 | end |
93 | 89 | |
94 | 90 | def perror(msg, position: 'column', skip: nil) |
91 | + print("PERROR: ", msg, "\n") | |
95 | 92 | if not ['column', 'eol'].include?(position) |
96 | -# raise ValueError('unknown position scheme: ', position.to_s) | |
93 | + raise ArgumentError('unknown position scheme: ', position.to_s) | |
97 | 94 | end |
98 | 95 | if not ['length', 'rest', nil].include?(skip) |
99 | -# raise ValueError('unknown skip scheme: ', skip.to_s) | |
96 | + raise ArgumentError('unknown skip scheme: ', skip.to_s) | |
100 | 97 | end |
101 | 98 | if position == 'column' |
102 | 99 | column = @column |
@@ -113,9 +110,14 @@ module Script | ||
113 | 110 | length = 0 |
114 | 111 | skip = 0 |
115 | 112 | end |
116 | -# return ParserError(msg, :error => @error, | |
117 | -# :script => @script, :src => @src, :column => column, :lenght => length, :skip => skip) | |
118 | - return "" # XXX | |
113 | + raise ParserError.new( \ | |
114 | + :error => @error, \ | |
115 | + :script => @script, \ | |
116 | + :src => @src, \ | |
117 | + :column => column, \ | |
118 | + :length => length, \ | |
119 | + :skip => skip \ | |
120 | + ), msg | |
119 | 121 | end |
120 | 122 | |
121 | 123 | def tokenize(s) |
@@ -137,11 +139,9 @@ module Script | ||
137 | 139 | if match != nil and match.begin(0) == pos |
138 | 140 | break |
139 | 141 | end |
140 | -# else | |
141 | -# raise RuntimeError('should not reach here') | |
142 | 142 | end |
143 | - if match == nil ## FIXME | |
144 | -# raise RuntimeError('should not reach here') | |
143 | + if not match | |
144 | + raise RuntimeError('should not reach here') | |
145 | 145 | end |
146 | 146 | tokens << [token, match.to_s] |
147 | 147 | pos += match.to_s.length |
@@ -152,8 +152,8 @@ module Script | ||
152 | 152 | def next_token |
153 | 153 | begin |
154 | 154 | token, lexeme = @tokens.shift |
155 | - rescue # except IndexError: | |
156 | -# raise perror('unexpected end of script', :position => 'eol') | |
155 | + rescue IndexError | |
156 | + perror('unexpected end of script', :position => 'eol') | |
157 | 157 | end |
158 | 158 | if token == nil |
159 | 159 | return "", "" |
@@ -187,12 +187,12 @@ module Script | ||
187 | 187 | if not text.empty? |
188 | 188 | @script << [SCRIPT_TEXT, text, @column] |
189 | 189 | end |
190 | -# raise perror('unknown tag', :skip => 'length') | |
190 | + perror('unknown tag', :skip => 'length') | |
191 | 191 | elsif token == TOKEN_STRING and lexeme == '%' |
192 | 192 | string_chunks << lexeme |
193 | 193 | text << [TEXT_STRING, string_chunks.join('')] |
194 | 194 | @script << [SCRIPT_TEXT, text, @column] |
195 | -# raise perror('unknown meta string', :skip => 'length') | |
195 | + perror('unknown meta string', :skip => 'length') | |
196 | 196 | return [] |
197 | 197 | end |
198 | 198 | if [TOKEN_NUMBER, TOKEN_OPENED_SBRA, |
@@ -281,11 +281,11 @@ module Script | ||
281 | 281 | if not @tokens.empty? and @tokens[0][0] == TOKEN_OPENED_SBRA |
282 | 282 | args = split_params(read_sbra_text()) |
283 | 283 | if args.length != 2 |
284 | -# raise perror('wrong number of arguments', :skip => 'length') | |
284 | + perror('wrong number of arguments', :skip => 'length') | |
285 | 285 | return [] |
286 | 286 | end |
287 | 287 | if args[1].length != 1 or not args[1][0][1] |
288 | -# raise perror('syntax error (expected an ID)', :skip => 'length') | |
288 | + perror('syntax error (expected an ID)', :skip => 'length') | |
289 | 289 | return [] |
290 | 290 | end |
291 | 291 | arg1 = args[0] |
@@ -322,7 +322,7 @@ module Script | ||
322 | 322 | end |
323 | 323 | @script << [SCRIPT_TAG, lexeme] + args + [@column, ] |
324 | 324 | else |
325 | -# raise perror('unknown tag ({0})'.format(lexeme), :skip => 'length') | |
325 | + perror('unknown tag (' + lexeme + ')', :skip => 'length') | |
326 | 326 | return [] |
327 | 327 | end |
328 | 328 | if anchor != nil |
@@ -332,6 +332,7 @@ module Script | ||
332 | 332 | else |
333 | 333 | @script << [SCRIPT_TAG, '\_a', @column] |
334 | 334 | end |
335 | +## FIXME | |
335 | 336 | # anchor.script = @script |
336 | 337 | # raise anchor |
337 | 338 | return [] |
@@ -349,7 +350,7 @@ module Script | ||
349 | 350 | def read_number |
350 | 351 | token, number = next_token() |
351 | 352 | if token != TOKEN_NUMBER |
352 | -# raise perror('syntax error (expected a number)') | |
353 | + perror('syntax error (expected a number)') | |
353 | 354 | end |
354 | 355 | return number |
355 | 356 | end |
@@ -357,15 +358,15 @@ module Script | ||
357 | 358 | def read_sbra_number |
358 | 359 | token, lexeme = next_token() |
359 | 360 | if token != TOKEN_OPENED_SBRA |
360 | -# raise perror('syntax error (expected a square bracket)') | |
361 | + perror('syntax error (expected a square bracket)') | |
361 | 362 | end |
362 | 363 | token, number = next_token() |
363 | 364 | if token != TOKEN_NUMBER |
364 | -# raise perror('syntax error (expected a number)', :skip => 'length') | |
365 | + perror('syntax error (expected a number)', :skip => 'length') | |
365 | 366 | end |
366 | 367 | token, lexeme = next_token() |
367 | 368 | if token != TOKEN_CLOSED_SBRA |
368 | -# raise perror('syntax error (expected a square bracket)', :skip => 'length') | |
369 | + perror('syntax error (expected a square bracket)', :skip => 'length') | |
369 | 370 | end |
370 | 371 | return number |
371 | 372 | end |
@@ -373,12 +374,12 @@ module Script | ||
373 | 374 | def read_sbra_id |
374 | 375 | text = read_sbra_text() |
375 | 376 | if text.length != 1 |
376 | - #raise perror('syntax error (expected a single ID)', :skip => 'length') | |
377 | + perror('syntax error (expected a single ID)', :skip => 'length') | |
377 | 378 | return [] |
378 | 379 | end |
379 | 380 | begin |
380 | 381 | sbra_id = text[0][1].to_i.to_s |
381 | - rescue # except: | |
382 | + rescue | |
382 | 383 | # pass |
383 | 384 | else |
384 | 385 | return sbra_id |
@@ -389,7 +390,7 @@ module Script | ||
389 | 390 | def read_sbra_text |
390 | 391 | token, lexeme = next_token() |
391 | 392 | if token != TOKEN_OPENED_SBRA |
392 | -# raise perror('syntax error (expected a square bracket)') | |
393 | + perror('syntax error (expected a square bracket)') | |
393 | 394 | end |
394 | 395 | text = [] |
395 | 396 | string_chunks = [] |
@@ -411,9 +412,10 @@ module Script | ||
411 | 412 | elsif token == TOKEN_META |
412 | 413 | text << [TEXT_META, lexeme] |
413 | 414 | else |
414 | - #raise perror('syntax error (wrong type of argument)', :skip => 'length') | |
415 | + perror('syntax error (wrong type of argument)', :skip => 'length') | |
415 | 416 | return [] |
416 | 417 | end |
418 | +## FIXME | |
417 | 419 | # else |
418 | 420 | # raise perror('unexpected end of script', :position => 'eol') |
419 | 421 | end |
@@ -141,7 +141,7 @@ module SSTPLib | ||
141 | 141 | begin |
142 | 142 | sock_domain, remote_port, remote_hostname, remote_ip = @fp.peeraddr |
143 | 143 | return remote_hostname |
144 | - rescue #except: | |
144 | + rescue | |
145 | 145 | return 'localhost' |
146 | 146 | end |
147 | 147 | end |
@@ -151,9 +151,8 @@ module SSTPLib | ||
151 | 151 | 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] |
152 | 152 | t = Time.now.localtime |
153 | 153 | m = month_names[t.month - 1] |
154 | - ## FIXME ## | |
155 | - return t'{0:02d}/{1}/{2:d}:{3:02d}:{4:02d}:{5:02d} {6:+05d}'.format( | |
156 | - t[2], m, t[0], t[3], t[4], t[5], (-time.timezone / 36).to_i) | |
154 | + return sprintf('%02d/%s/%d:%02d:%02d:%02d %+05d', | |
155 | + t.day, m, t.year, t.hour, t.min, t.sec, t.utc_offset / 36) | |
157 | 156 | end |
158 | 157 | end |
159 | 158 | end |