more dead code goes

This commit is contained in:
Torsten Ruger 2015-07-21 20:24:31 +03:00
parent 074f3af174
commit 2f409ea4e1
5 changed files with 57 additions and 81 deletions

View File

@ -30,10 +30,10 @@ module Parfait
# Get class works on the type. The value's type is stored by the machine.
# So this function is not overriden in derived classes, because it is used
# to espablish what class a value has! (it's that "fake" oo i mentioned)
def get_class()
type = self.get_type()
return Integer if( type == INTEGER_VALUE )
raise "invalid type"
end
# def get_class()
# type = self.get_type()
# return Integer if( type == INTEGER_VALUE )
# raise "invalid type"
# end
end
end

View File

@ -9,25 +9,25 @@ module Register
# then check if were done and recurse if neccessary
# As we write before we recurse (save a push) we write the number backwards
# arguments: string address , integer
def utoa context
utoa_function = Virtual::MethodSource.create_method(:Integer ,:utoa , [ Virtual::Integer ] )
function.source.return_type = Virtual::Integer
function.source.receiver = Virtual::Integer
return utoa_function
# str_addr = utoa_function.receiver
# number = utoa_function.args.first
# remainder = utoa_function.new_local
# Virtual::RegisterMachine.instance.div10( utoa_function , number , remainder )
# # make char out of digit (by using ascii encoding) 48 == "0"
# utoa_function.instance_eval do
# add( remainder , remainder , 48)
# strb( remainder, str_addr )
# sub( str_addr, str_addr , 1 )
# cmp( number , 0 )
# callne( utoa_function )
# end
# return utoa_function
end
# def utoa context
# utoa_function = Virtual::MethodSource.create_method(:Integer ,:utoa , [ Virtual::Integer ] )
# function.source.return_type = Virtual::Integer
# function.source.receiver = Virtual::Integer
# return utoa_function
# # str_addr = utoa_function.receiver
# # number = utoa_function.args.first
# # remainder = utoa_function.new_local
# # Virtual::RegisterMachine.instance.div10( utoa_function , number , remainder )
# # # make char out of digit (by using ascii encoding) 48 == "0"
# # utoa_function.instance_eval do
# # add( remainder , remainder , 48)
# # strb( remainder, str_addr )
# # sub( str_addr, str_addr , 1 )
# # cmp( number , 0 )
# # callne( utoa_function )
# # end
# # return utoa_function
# end
def putint context
putint_function = Virtual::MethodSource.create_method(:Integer,:putint , [] )

View File

@ -1,23 +0,0 @@
module Register
module Builtin
# This is all fantasy at the moment. Not even required, not tested, just an idea
# Most likely wrong, in fact so old as to predate the internal_XX stuff
class List
module ClassMethods
def get context , index = Virtual::Integer
get_function = Virtual::MethodSource.create_method(:get , [ Virtual::Integer] , Virtual::Integer , Virtual::Integer )
return get_function
end
def set context , index = Virtual::Integer , object = Virtual::Reference
set_function = Virtual::MethodSource.create_method(:set , [Virtual::Integer, Virtual::Reference] )
return set_function
end
def push context , object = Virtual::Reference
push_function = Virtual::MethodSource.create_method(:push , [Virtual::Reference] )
return push_function
end
end
extend ClassMethods
end
end
end

View File

@ -20,41 +20,41 @@ module Register
def _get_instance_variable context , name = Virtual::Integer
get_function = Virtual::MethodSource.create_method(:Object,:_get_instance_variable , [ ] )
return get_function
me = get_function.receiver
var_name = get_function.args.first
return_to = get_function.return_type
index_function = ::Virtual.machine.space.get_class_by_name(:Object).resolve_method(:index_of)
# get_function.push( [me] )
# index = get_function.call( index_function )
after_body = get_function.new_block("after_index")
get_function.current after_body
# get_function.pop([me])
# return_to.at_index( get_function , me , return_to )
# get_function.set_return return_to
return get_function
# me = get_function.receiver
# var_name = get_function.args.first
# return_to = get_function.return_type
#
# index_function = ::Virtual.machine.space.get_class_by_name(:Object).resolve_method(:index_of)
# # get_function.push( [me] )
# # index = get_function.call( index_function )
#
# after_body = get_function.new_block("after_index")
# get_function.current after_body
#
# # get_function.pop([me])
# # return_to.at_index( get_function , me , return_to )
#
# # get_function.set_return return_to
# return get_function
end
def _set_instance_variable(context , name = Virtual::Integer , value = Virtual::Integer )
set_function = Virtual::MethodSource.create_method(:Object,:_set_instance_variable ,[] )
return set_function
receiver set_function
me = set_function.receiver
var_name = set_function.args.first
return_to = set_function.return_type
index_function = context.object_space.get_class_by_name(:Object).resolve_method(:index_of)
set_function.push( [me] )
set_function.call( index_function )
after_body = set_function.new_block("after_index")
set_function.current after_body
set_function.pop([me])
return_to.at_index( set_function , me , return_to )
set_function.set_return return_to
return set_function
# receiver set_function
# me = set_function.receiver
# var_name = set_function.args.first
# return_to = set_function.return_type
# index_function = context.object_space.get_class_by_name(:Object).resolve_method(:index_of)
# set_function.push( [me] )
# set_function.call( index_function )
# after_body = set_function.new_block("after_index")
#
# set_function.current after_body
# set_function.pop([me])
# return_to.at_index( set_function , me , return_to )
# set_function.set_return return_to
# return set_function
end
def _get_singleton_method(context , name )
@ -73,6 +73,5 @@ module Register
end
require_relative "integer"
require_relative "list"
require_relative "kernel"
require_relative "word"

View File

@ -3,14 +3,14 @@ module Virtual
# attr_reader :values
def self.compile_array expession, context
to.do
# to.do
end
# attr_reader :key , :value
def self.compile_association context
to.do
# to.do
end
def self.compile_hash context
to.do
# to.do
end
end
end