2015-11-07 23:54:47 +01:00
|
|
|
class Word < Object
|
2015-11-10 18:08:48 +01:00
|
|
|
|
2015-11-19 15:40:00 +01:00
|
|
|
int _internal_index(int index)
|
2015-11-20 12:25:49 +01:00
|
|
|
return index + 11
|
2015-11-19 09:09:24 +01:00
|
|
|
end
|
|
|
|
|
2015-11-19 15:40:00 +01:00
|
|
|
int get_char_at(int index)
|
|
|
|
index = _internal_index(index)
|
2015-11-19 09:09:24 +01:00
|
|
|
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)
|
2015-11-18 14:36:43 +01:00
|
|
|
set_internal_word( 2 , i)
|
2015-11-10 18:08:48 +01:00
|
|
|
return i
|
|
|
|
end
|
|
|
|
|
2015-11-19 09:09:24 +01:00
|
|
|
int set_char_at( int index , int val)
|
2015-11-19 15:40:00 +01:00
|
|
|
index = _internal_index(index)
|
2015-11-19 09:09:24 +01:00
|
|
|
return set_internal_byte(index , val)
|
|
|
|
end
|
|
|
|
|
2015-11-11 19:36:07 +01:00
|
|
|
Word push_char(int char)
|
|
|
|
int index = self.char_length + 1
|
|
|
|
self.set_length(index)
|
|
|
|
|
2015-11-19 09:09:24 +01:00
|
|
|
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
|