2014-07-29 17:33:11 +02:00
|
|
|
module Salama
|
2014-06-13 23:19:12 +02:00
|
|
|
module Kernel
|
|
|
|
def self.putstring context
|
2014-07-16 18:24:41 +02:00
|
|
|
function = Virtual::MethodDefinition.new(:putstring , [] )
|
2014-07-12 20:59:17 +02:00
|
|
|
return function
|
2014-06-26 16:52:15 +02:00
|
|
|
ret = Virtual::RegisterMachine.instance.write_stdout(function)
|
2014-06-13 23:19:12 +02:00
|
|
|
function.set_return ret
|
|
|
|
function
|
|
|
|
end
|
|
|
|
end
|
2014-08-23 23:25:15 +02:00
|
|
|
class String
|
|
|
|
module ClassMethods
|
|
|
|
def get context , index = Virtual::Integer
|
|
|
|
get_function = Virtual::MethodDefinition.new(:get , [ Virtual::Integer] , Virtual::Integer , Virtual::Integer )
|
|
|
|
return get_function
|
|
|
|
end
|
|
|
|
def set context , index = Virtual::Integer , char = Virtual::Integer
|
|
|
|
set_function = Virtual::MethodDefinition.new(:set , [Virtual::Integer, Virtual::Integer] , Virtual::Integer ,Virtual::Integer )
|
|
|
|
return set_function
|
|
|
|
end
|
|
|
|
def puts context
|
|
|
|
puts_function = Virtual::MethodDefinition.new(:puts , [] )
|
|
|
|
return puts_function
|
|
|
|
end
|
|
|
|
end
|
|
|
|
extend ClassMethods
|
|
|
|
end
|
2014-06-13 23:19:12 +02:00
|
|
|
end
|