2 Copyright (C) 2001-2008, Parrot Foundation.
7 src/pmc/packfilefixupentry.pmc - PackfileFixupEntry PMC
11 This class implements a PackfileFixupEntry object. It is an element in the
12 PackfileFixupTable segment of the .pbc file. See PDD13 for a design spec.
22 pmclass PackfileFixupEntry auto_attrs {
32 Initialize PackfileFixupEntry.
38 Parrot_PackfileFixupEntry_attributes * attrs =
39 PMC_data_typed(SELF, Parrot_PackfileFixupEntry_attributes*);
41 attrs->name = Parrot_str_new_noinit(interp, enum_stringrep_one, 0);
43 PObj_custom_mark_SET(SELF);
50 Marks the object as live.
57 Parrot_PackfileFixupEntry_attributes * attrs =
58 PARROT_PACKFILEFIXUPENTRY(SELF);
60 Parrot_gc_mark_STRING_alive(interp, attrs->name);
65 =item C<void set_pointer(void *pointer)>
67 Initialize from PackFile_FixupEntry pointer.
73 VTABLE void set_pointer(void * pointer) {
74 Parrot_PackfileFixupEntry_attributes * attrs =
75 PARROT_PACKFILEFIXUPENTRY(SELF);
76 PackFile_FixupEntry *entry = (PackFile_FixupEntry*)pointer;
78 attrs->type = entry->type;
79 attrs->name = Parrot_str_new_init(interp, entry->name,
80 strlen(entry->name), PARROT_FIXED_8_ENCODING,
81 PARROT_BINARY_CHARSET, 0);
82 attrs->offset = entry->offset;
87 =item C<void *get_pointer()>
89 Create PackFile_FixupEntry* from self.
94 VTABLE void *get_pointer() {
95 Parrot_PackfileFixupEntry_attributes * attrs =
96 PARROT_PACKFILEFIXUPENTRY(SELF);
97 PackFile_FixupEntry * entry =
98 mem_gc_allocate_zeroed_typed(INTERP, PackFile_FixupEntry);
100 entry->type = attrs->type;
101 entry->name = strdup(Parrot_string_cstring(interp, attrs->name));
102 entry->offset = attrs->offset;
109 =item C<STRING *get_string()>
111 Fetch the label field of the fixup entry.
116 VTABLE STRING *get_string() {
117 return PARROT_PACKFILEFIXUPENTRY(SELF)->name;
122 =item C<void set_string_native(STRING *value)>
124 Set the label field of the fixup entry.
129 VTABLE void set_string_native(STRING *value) {
130 SETATTR_PackfileFixupEntry_name(INTERP, SELF, value);
136 =item C<INTVAL get_integer()>
138 Fetch the offset field of the fixup entry.
143 VTABLE INTVAL get_integer() {
144 return PARROT_PACKFILEFIXUPENTRY(SELF)->offset;
150 =item C<void set_integer_native(INTVAL offset)>
152 Set the offset field of the fixup entry.
157 VTABLE void set_integer_native(INTVAL offset) {
158 SETATTR_PackfileFixupEntry_offset(INTERP, SELF, offset);
164 =item C<INTVAL get_type()>
166 Fetch the type field of the fixup entry.
172 INTVAL rv = PARROT_PACKFILEFIXUPENTRY(SELF)->type;
179 =item C<void set_type(INTVAL type)>
181 Set the type field of the fixup entry.
186 METHOD set_type(INTVAL type) {
187 SETATTR_PackfileFixupEntry_type(INTERP, SELF, type);
201 * c-file-style: "parrot"
203 * vim: expandtab shiftwidth=4: