rubyx/lib/soml/parfait/word.soml

30 lines
525 B
Plaintext
Raw Normal View History

2015-11-07 23:54:47 +01:00
class Word < Object
2015-11-10 18:08:48 +01:00
int correct_index(int index)
return index + 8
end
2015-11-10 18:08:48 +01:00
int char_at(int index)
index = correct_index(index)
return get_internal_byte(index)
2015-11-08 16:11:03 +01:00
end
2015-11-10 18:08:48 +01:00
int set_length(int i)
set_internal_word( 2 , i)
2015-11-10 18:08:48 +01:00
return i
end
int set_char_at( int index , int val)
index = correct_index(index)
return set_internal_byte(index , val)
end
Word push_char(int char)
int index = self.char_length + 1
self.set_length(index)
set_char_at(index , char)
2015-11-08 16:11:03 +01:00
return self
end
2015-11-07 23:54:47 +01:00
end