renamed method definition to compiled method

This commit is contained in:
Torsten Ruger
2014-08-28 08:10:33 +03:00
parent e09d3c2f65
commit 7d35732923
15 changed files with 31 additions and 31 deletions

View File

@ -7,7 +7,7 @@ module Salama
# As we write before we recurse (save a push) we write the number backwards
# arguments: string address , integer
def self.utoa context
utoa_function = Virtual::MethodDefinition.new(:utoa , [ Virtual::Integer ] , Virtual::Integer ,Virtual::Integer )
utoa_function = Virtual::CompiledMethod.new(:utoa , [ Virtual::Integer ] , Virtual::Integer ,Virtual::Integer )
return utoa_function
str_addr = utoa_function.receiver
number = utoa_function.args.first
@ -25,7 +25,7 @@ module Salama
end
def self.putint context
putint_function = Virtual::MethodDefinition.new(:putint , [] , Virtual::Integer ,Virtual::Integer )
putint_function = Virtual::CompiledMethod.new(:putint , [] , Virtual::Integer ,Virtual::Integer )
return putint_function
buffer = Virtual::StringConstant.new(" ") # create a buffer
context.object_space.add_object buffer # and save it (function local variable: a no no)
@ -52,7 +52,7 @@ module Salama
# a hand coded version of the fibonachi numbers
# not my hand off course, found in the net http://www.peter-cockerell.net/aalp/html/ch-5.html
def self.fibo context
fibo_function = Virtual::MethodDefinition.new(:fibo , [] , Virtual::Integer ,Virtual::Integer )
fibo_function = Virtual::CompiledMethod.new(:fibo , [] , Virtual::Integer ,Virtual::Integer )
return fibo_function
result = fibo_function.return_type
int = fibo_function.receiver

View File

@ -6,7 +6,7 @@ module Salama
# set/get instance variable use it.
# This is just a placeholder, as we code this in ruby, but the instance methods need the definition before.
def index_of context , name = Virtual::Integer
index_function = Virtual::MethodDefinition.new(:index_of , Virtual::Reference , [Virtual::Reference] , Virtual::Integer )
index_function = Virtual::CompiledMethod.new(:index_of , Virtual::Reference , [Virtual::Reference] , Virtual::Integer )
return index_function
end
@ -23,7 +23,7 @@ module Salama
# end
# The at_index is just "below" the api, something we need but don't want to expose, so we can't code the above in ruby
def _get_instance_variable context , name = Virtual::Integer
get_function = Virtual::MethodDefinition.new(:_get_instance_variable , [ Virtual::Reference ] , Virtual::Reference ,Virtual::Mystery )
get_function = Virtual::CompiledMethod.new(:_get_instance_variable , [ Virtual::Reference ] , Virtual::Reference ,Virtual::Mystery )
return get_function
me = get_function.receiver
var_name = get_function.args.first
@ -44,7 +44,7 @@ module Salama
end
def _set_instance_variable(context , name = Virtual::Integer , value = Virtual::Integer )
set_function = Virtual::MethodDefinition.new(:_set_instance_variable ,[Virtual::Reference ,Virtual::Reference], Virtual::Reference ,Virtual::Mystery )
set_function = Virtual::CompiledMethod.new(:_set_instance_variable ,[Virtual::Reference ,Virtual::Reference], Virtual::Reference ,Virtual::Mystery )
return set_function
receiver set_function
me = set_function.receiver

View File

@ -1,7 +1,7 @@
module Salama
module Kernel
def self.putstring context
function = Virtual::MethodDefinition.new(:putstring , [] )
function = Virtual::CompiledMethod.new(:putstring , [] )
return function
ret = Virtual::RegisterMachine.instance.write_stdout(function)
function.set_return ret
@ -11,15 +11,15 @@ module Salama
class String
module ClassMethods
def get context , index = Virtual::Integer
get_function = Virtual::MethodDefinition.new(:get , [ Virtual::Integer] , Virtual::Integer , Virtual::Integer )
get_function = Virtual::CompiledMethod.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 )
set_function = Virtual::CompiledMethod.new(:set , [Virtual::Integer, Virtual::Integer] , Virtual::Integer ,Virtual::Integer )
return set_function
end
def puts context
puts_function = Virtual::MethodDefinition.new(:puts , [] )
puts_function = Virtual::CompiledMethod.new(:puts , [] )
return puts_function
end
end

View File

@ -1,7 +1,7 @@
module Salama
module Kernel
def self.exit context
function = Virtual::MethodDefinition.new(:exit , [] , Virtual::Integer)
function = Virtual::CompiledMethod.new(:exit , [] , Virtual::Integer)
return function
ret = Virtual::RegisterMachine.instance.exit(function)
function.set_return ret