factor/vm/strings.hpp

24 lines
604 B
C++
Raw Normal View History

inline static CELL string_capacity(F_STRING *str)
2009-05-02 05:04:19 -04:00
{
return untag_fixnum(str->length);
2009-05-02 05:04:19 -04:00
}
inline static CELL string_size(CELL size)
2009-05-02 05:04:19 -04:00
{
return sizeof(F_STRING) + size;
}
F_STRING* allot_string_internal(CELL capacity);
F_STRING* allot_string(CELL capacity, CELL fill);
PRIMITIVE(string);
2009-05-02 05:04:19 -04:00
F_STRING *reallot_string(F_STRING *string, CELL capacity);
PRIMITIVE(resize_string);
2009-05-02 05:04:19 -04:00
/* String getters and setters */
CELL string_nth(F_STRING* string, CELL index);
void set_string_nth(F_STRING* string, CELL index, CELL value);
PRIMITIVE(string_nth);
PRIMITIVE(set_string_nth_slow);
PRIMITIVE(set_string_nth_fast);