2 def self.template(size, str)
3 Ruby.primitive :string_template
4 raise PrimitiveFailure, "String.template primitive failed"
8 Ruby.primitive :symbol_lookup
9 raise PrimitiveFailure, "Unable to symbolize: #{self.dump}"
16 def to_sexp_full(name, line, newlines)
17 Ruby.primitive :string_to_sexp
18 raise PrimitiveFailure, "primitive failed"
22 Ruby.primitive :string_to_f
23 raise PrimitiveFailure, "primitive failed"
26 def __crypt__(other_str)
27 Ruby.primitive :str_crypt
28 raise PrimitiveFailure, "primitive failed"
32 Ruby.primitive :string_append
33 raise TypeError, "only a String instance is accepted"
37 Ruby.primitive :string_dup
38 raise PrimitiveFailure, "primitive failed"
45 def copy_from(other, start, size, dest)
46 Ruby.primitive :string_copy_from
47 raise PrimitiveFailure, "String#copy_from primitive failed"
50 def substring(start, count)
51 return if count < 0 || start > @bytes || -start > @bytes
53 start += @bytes if start < 0
54 count = @bytes - start if start + count > @bytes
55 count = 0 if count < 0
57 str = self.class.template count, 0
58 str.copy_from self, start, count, 0
59 str.taint if self.tainted?
65 Ruby.primitive :string_equal