fix resolve and introduce method to chop strings to max
strings are 20 bytes. I want to implement the extension idea, just not now
This commit is contained in:
@ -112,8 +112,14 @@ module Parfait
|
||||
list
|
||||
end
|
||||
|
||||
def self.new_word_max( string )
|
||||
return self.new_word(string) if string.length < 20
|
||||
self.new_word(string[0 ... 20])
|
||||
end
|
||||
|
||||
# Word from string
|
||||
def self.new_word( string )
|
||||
# puts "NEW #{string.length}=#{string}"
|
||||
string = string.to_s if string.is_a? Symbol
|
||||
word = Word.new( string.length )
|
||||
string.codepoints.each_with_index do |code , index |
|
||||
|
@ -11,7 +11,7 @@ module SlotMachine
|
||||
|
||||
def to_risc(compiler)
|
||||
builder = compiler.builder(compiler.source_name)
|
||||
from = compiler.load_object(Parfait.new_word(@name))
|
||||
from = compiler.load_object(Parfait.new_word_max(@name))
|
||||
to = Risc::RegisterValue.new(:r1 , :Word)
|
||||
builder.add_code Risc::Transfer.new(self , from , to)
|
||||
builder.add_code Risc::Syscall.new(self, :died )
|
||||
|
Reference in New Issue
Block a user