lib/ffi-tk/ffi/tcl/interp.rb in ffi-tk-2010.08.23 vs lib/ffi-tk/ffi/tcl/interp.rb in ffi-tk-2018.02.20

- old
+ new

@@ -1,5 +1,6 @@ +# frozen_string_literal: true module FFI module Tcl class Interp < PrettyStruct layout( :result, :string, @@ -9,11 +10,11 @@ EVAL_GLOBAL = 0x20000 EVAL_DIRECT = 0x40000 def inspect - "Interp" + 'Interp' end def guess_result EvalResult.guess(self, Obj.new(Tcl.get_obj_result(self))) end @@ -29,11 +30,11 @@ Tcl.new_boolean_obj(1) when false Tcl.new_boolean_obj(0) when String Tcl.new_string_obj(ruby_obj, ruby_obj.bytesize) - when Fixnum + when Integer Tcl.new_int_obj(ruby_obj) when Exception string = [ruby_obj.message, *ruby_obj.backtrace].join("\n") Tcl.new_string_obj(string, string.bytesize) else @@ -77,19 +78,21 @@ end def eval(string) if $DEBUG if string =~ /\n/ - puts "eval: %p" % [string] + puts "\neval: %p" % [string] else - puts "eval: %s" % [string] + puts "\neval: %s" % [string] end end code = Tcl.eval_ex(self, string, string.bytesize, EVAL_DIRECT) + puts 'eval= %p' % [code] if $DEBUG return true if code == 0 message = guess_result.to_s + puts 'eval= %p' % [message] if $DEBUG if message.empty? raise 'Failure during eval of: %p' % [string] else raise '%s during eval of: %p' % [message, string]