Class: String

Inherits:
Object show all
Defined in:
lib/upl/inter.rb

Instance Method Summary collapse

Instance Method Details

#to_term_tObject



156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/upl/inter.rb', line 156

def to_term_t
  rv = Upl::Extern.PL_put_chars \
    (term_t = Upl::Extern.PL_new_term_ref),
    (Upl::Extern::PL_STRING | Upl::Extern::Convert::REP_UTF8),
    # swipl PL_chars_t struct uses number of octets | or number of wide chars.
    # So use bytesize of string here.
    bytesize,
    Fiddle::Pointer[self]

  rv == 1 or raise "can't convert #{self} to term"

  term_t
end