/
arcsym.pmc
48 lines (39 loc) · 901 Bytes
/
arcsym.pmc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
pmclass ArcSym
extends ArcT
need_ext
dynpmc
group primitivearc_group
hll Arc {
ATTR STRING *repr;
VTABLE void init() {
Parrot_ArcSym_attributes *u = mem_allocate_zeroed_typed(Parrot_ArcSym_attributes);
PMC_data(SELF) = u;
PObj_custom_mark_destroy_SETALL(SELF);
}
VTABLE void mark() {
Parrot_ArcSym_attributes *s = PARROT_ARCSYM(SELF);
if (s->repr)
pobject_lives(INTERP, (PObj *)s->repr);
}
VTABLE void destroy() {
Parrot_ArcSym_attributes *s = PARROT_ARCSYM(SELF);
if (s) {
mem_sys_free(s);
PMC_data(SELF) = NULL;
}
}
VTABLE STRING* name() {
return Parrot_str_new_constant(INTERP, "sym");
}
METHOD pr_repr() {
STRING *res = PARROT_ARCSYM(SELF)->repr;
RETURN(STRING *res);
}
METHOD to_string() {
STRING *res = PARROT_ARCSYM(SELF)->repr;
RETURN(STRING *res);
}
METHOD set_repr(STRING *repr) {
PARROT_ARCSYM(SELF)->repr = repr;
}
}