2014-08-28 18:27:04 +03:00
|
|
|
module Builtin
|
2014-06-14 00:19:12 +03:00
|
|
|
module Kernel
|
|
|
|
def self.putstring context
|
2014-08-28 08:10:33 +03:00
|
|
|
function = Virtual::CompiledMethod.new(:putstring , [] )
|
2014-07-12 21:59:17 +03:00
|
|
|
return function
|
2014-06-26 17:52:15 +03:00
|
|
|
ret = Virtual::RegisterMachine.instance.write_stdout(function)
|
2014-06-14 00:19:12 +03:00
|
|
|
function.set_return ret
|
|
|
|
function
|
|
|
|
end
|
|
|
|
end
|
2014-08-24 00:25:15 +03:00
|
|
|
class String
|
|
|
|
module ClassMethods
|
|
|
|
def get context , index = Virtual::Integer
|
2014-08-28 08:10:33 +03:00
|
|
|
get_function = Virtual::CompiledMethod.new(:get , [ Virtual::Integer] , Virtual::Integer , Virtual::Integer )
|
2014-08-24 00:25:15 +03:00
|
|
|
return get_function
|
|
|
|
end
|
|
|
|
def set context , index = Virtual::Integer , char = Virtual::Integer
|
2014-08-28 08:10:33 +03:00
|
|
|
set_function = Virtual::CompiledMethod.new(:set , [Virtual::Integer, Virtual::Integer] , Virtual::Integer ,Virtual::Integer )
|
2014-08-24 00:25:15 +03:00
|
|
|
return set_function
|
|
|
|
end
|
|
|
|
def puts context
|
2014-08-28 08:10:33 +03:00
|
|
|
puts_function = Virtual::CompiledMethod.new(:puts , [] )
|
2014-08-24 00:25:15 +03:00
|
|
|
return puts_function
|
|
|
|
end
|
|
|
|
end
|
|
|
|
extend ClassMethods
|
|
|
|
end
|
2014-06-14 00:19:12 +03:00
|
|
|
end
|