moving string to parfait
using parfait::word also rename builtins string to word
This commit is contained in:
@ -144,7 +144,7 @@ module Register
|
||||
end
|
||||
|
||||
def assemble_String( str )
|
||||
str = str.string if str.is_a? Virtual::StringConstant
|
||||
str = str.string if str.is_a? Parfait::Word
|
||||
str = str.to_s if str.is_a? Symbol
|
||||
word = (str.length + 7) / 32 # all object are multiple of 8 words (7 for header)
|
||||
raise "String too long (implement split string!) #{word}" if word > 15
|
||||
|
@ -28,7 +28,7 @@ module Builtin
|
||||
def putint context
|
||||
putint_function = Virtual::CompiledMethod.new(:putint , [] , Virtual::Integer ,Virtual::Integer )
|
||||
return putint_function
|
||||
buffer = Virtual::StringConstant.new(" ") # create a buffer
|
||||
buffer = Parfait::Word.new(" ") # create a buffer
|
||||
context.object_space.add_object buffer # and save it (function local variable: a no no)
|
||||
int = putint_function.receiver
|
||||
moved_int = putint_function.new_local
|
||||
|
@ -76,6 +76,6 @@ module Builtin
|
||||
end
|
||||
end
|
||||
require_relative "integer"
|
||||
require_relative "string"
|
||||
require_relative "word"
|
||||
require_relative "array"
|
||||
require_relative "kernel"
|
||||
|
@ -1,5 +1,5 @@
|
||||
module Builtin
|
||||
class String
|
||||
class Word
|
||||
module ClassMethods
|
||||
def get context , index = Virtual::Integer
|
||||
get_function = Virtual::CompiledMethod.new(:get , [ Virtual::Integer] , Virtual::Integer , Virtual::Integer )
|
||||
@ -9,11 +9,11 @@ module Builtin
|
||||
set_function = Virtual::CompiledMethod.new(:set , [Virtual::Integer, Virtual::Integer] , Virtual::Integer ,Virtual::Integer )
|
||||
return set_function
|
||||
end
|
||||
def puts context
|
||||
def puts context
|
||||
puts_function = Virtual::CompiledMethod.new(:puts , [] )
|
||||
return puts_function
|
||||
end
|
||||
end
|
||||
extend ClassMethods
|
||||
extend ClassMethods
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user