parrotcode: String PMC Class | |
Contents | PMCs |
src/pmc/string.pmc - String PMC Class
String
extends scalar
to provide a string for languages that want a string
type without going to an S register.
It acts as a wrapper for the functions in src/string.c.
void init()
PMC instantiate_str(STRING *rep)
rep
.
void mark()
PMC *clone()
INTVAL get_integer()
FLOATVAL get_number()
PMC *get_bignum()
STRING *get_string()
INTVAL get_bool()
VOID set_integer_native(INTVAL value)
VOID set_bool(INTVAL value)
value
.
VOID set_number_native(FLOATVAL value)
value
.
VOID set_string_native(STRING *value)
string
.
VOID assign_string_native(STRING *value)
string
.
VOID set_string_same(PMC *value)
String
PMC.
VOID set_pmc(PMC *value)
PMC
.
PMC *bitwise_ors(PMC *value, PMC *dest)
PMC *bitwise_ors_str(PMC *value, PMC *dest)
PMC *bitwise_ands(PMC *value, PMC *dest)
PMC *bitwise_ands_str(PMC *value, PMC *dest)
PMC *bitwise_xors(PMC *value, PMC *dest)
PMC *bitwise_xors_str(PMC *value, PMC *dest)
void bitwise_nots(PMC *value)
dest
.
void i_bitwise_ors(PMC *value)
void i_bitwise_ors_str(PMC *value)
void i_bitwise_ands(PMC *value)
void i_bitwise_ands_str(PMC *value)
void i_bitwise_xors(PMC *value)
void i_bitwise_xors_str(PMC *value)
void i_bitwise_nots(PMC *value)
INTVAL is_equal(PMC *value)
value
; returns true if they match.
INTVAL is_equal_num(PMC *value)
value
; returns true if they match.
INTVAL is_equal_string(PMC *value)
value
; returns FALSE if they match.
INTVAL is_same(PMC *value)
value
PMC.
Returns true if this PMC and the one in value
are of the same PMC class and their strings are aliases of the same internal string.(this can only happen if you use the set_string_native method)
INTVAL cmp(PMC *value)
value
; returns -1 if the string is smaller,
0 if they are equal,
and 1 if value
is smaller.
INTVAL cmp_num(PMC *value)
value
; returns -1 if the string is smaller,
0 if they are equal,
and 1 if value
is smaller.
INTVAL cmp_string(PMC *value)
value
; returns -1 if the string is smaller,
0 if they are equal,
and 1 if value
is smaller.
void substr(INTVAL offset, INTVAL length, PMC *dest)
offset
,
with size length
,
and places it in dest
.
STRING *substr_str(INTVAL offset, INTVAL length)
offset
,
with size length
,
and returns it.
INTVAL exists_keyed(PMC *key)
key
'th character in the string exists.
Negative numbers count from the end.
STRING *get_string_keyed(PMC *key)
key
'th character in the string.
Negative numbers count from the end.
INTVAL get_integer_keyed(PMC *key)
*key
.
void set_string_keyed(PMC *key, STRING *val)
key
with value
.
void set_integer_keyed(PMC *key, INTVAL val)
key
with the chr of value
.
void replace(STRING *orig, STRING *_new)
orig
with _new
.
PMC *to_int(INTVAL base)
base
digit string.
The String is assumed to be in an ascii-compatible encoding.
The String is considered being unsigned,
and no + or - chars are processed.
base
has to be within [2..36].If any chars in the String aren't converted,
an exception is thrown.TODO Currently overflow to BigInt is not handled nor detected.PMC *slice(PMC *key, INTVAL f)
key
if f==0.Return a new pythonic slice if f == 1.
PMC *get_iter(PMC *key)
INTVAL elements()
void freeze(visit_info *info)
void thaw(visit_info *info)
PMC *lower()
void trans(STRING *src, PMC *trams_table)
src
with entries from trans_table
.
void reverse(STRING *src)
src
in place.
INTEGER is_integer(STRING *src)
str
is just an integer.
INTEGER reverse_index(STRING *substring, INTVAL start)
substring
,
but not after the start
position.
|