2 Copyright (C) 2010, Parrot Foundation.
7 src/pmc/imageiosize.pmc - ImageIOStrings PMC
11 Get a list of strings in an object graph. Used in packfile creation.
17 /* HEADERIZER HFILE: none */
18 /* HEADERIZER BEGIN: static */
19 /* HEADERIZER END: static */
21 pmclass ImageIOStrings auto_attrs {
22 ATTR PMC *seen; /* seen hash */
23 ATTR PMC *todo; /* todo list */
24 ATTR PMC *list; /* list of strings seen */
46 PARROT_IMAGEIOSTRINGS(SELF)->todo = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
48 PARROT_IMAGEIOSTRINGS(SELF)->seen = Parrot_pmc_new(INTERP, enum_class_Hash);
49 VTABLE_set_pointer(INTERP, PARROT_IMAGEIOSTRINGS(SELF)->seen,
50 parrot_new_intval_hash(INTERP));
52 PARROT_IMAGEIOSTRINGS(SELF)->list = Parrot_pmc_new(INTERP, enum_class_ResizableStringArray);
54 PObj_custom_mark_SET(SELF);
61 Marks the PMC as alive.
67 Parrot_gc_mark_PMC_alive(INTERP, PARROT_IMAGEIOSTRINGS(SELF)->todo);
68 Parrot_gc_mark_PMC_alive(INTERP, PARROT_IMAGEIOSTRINGS(SELF)->seen);
69 Parrot_gc_mark_PMC_alive(INTERP, PARROT_IMAGEIOSTRINGS(SELF)->list);
74 =item C<VTABLE PMC *get_pmc()>
76 Gets the result PMC after a thaw.
82 VTABLE PMC *get_pmc() {
83 return PARROT_IMAGEIOSTRINGS(SELF)->list;
88 =item C<VTABLE PMC *get_iter()>
90 Get the C<todo> list for this freeze/thaw for iterating over.
96 VTABLE PMC *get_iter() {
97 return PARROT_IMAGEIOSTRINGS(SELF)->todo;
102 =item C<VTABLE INTVAL get_integer()>
104 Returns the flags describing the visit action
110 VTABLE INTVAL get_integer() {
111 return VISIT_FREEZE_NORMAL;
117 =item C<VTABLE void push_integer(INTVAL v)>
125 VTABLE void push_integer(INTVAL v) { }
130 =item C<VTABLE void push_float(FLOATVAL v)>
138 VTABLE void push_float(FLOATVAL v) { }
143 =item C<VTABLE void push_string(STRING *v)>
145 Adds the string to the list of strings.
151 VTABLE void push_string(STRING *v)
153 VTABLE_push_string(INTERP, PARROT_IMAGEIOSTRINGS(SELF)->list, v);
158 =item C<VTABLE void push_pmc(PMC *v)>
160 Checks new pmcs for strings.
166 VTABLE void push_pmc(PMC *v) {
167 if (!PMC_IS_NULL(v)) {
168 Hash * const hash = (Hash *)VTABLE_get_pointer(INTERP,
169 PARROT_IMAGEIOSTRINGS(SELF)->seen);
170 HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, v);
173 parrot_hash_put(INTERP, hash, v, v);
174 VTABLE_push_pmc(INTERP, PARROT_IMAGEIOSTRINGS(SELF)->todo, v);
179 VTABLE void set_pmc(PMC *p)
181 STATICSELF.push_pmc(p);
182 Parrot_visit_loop_visit(INTERP, SELF);
197 * c-file-style: "parrot"
199 * vim: expandtab shiftwidth=4: