fix codetest failure - trailing whitespace
[parrot.git] / src / pmc / packfilefixupentry.pmc
blobee97cea93243480bd265a07da3f311f490b48a5b
1 /*
2 Copyright (C) 2001-2008, Parrot Foundation.
3 $Id$
5 =head1 NAME
7 src/pmc/packfilefixupentry.pmc - PackfileFixupEntry PMC
9 =head1 DESCRIPTION
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.
14 =head2 Methods
16 =over 4
18 =cut
22 pmclass PackfileFixupEntry auto_attrs {
23     ATTR INTVAL     type;
24     ATTR STRING     *name;
25     ATTR INTVAL     offset;
30 =item C<void init()>
32 Initialize PackfileFixupEntry.
34 =cut
37     VTABLE void init() {
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);
44     }
48 =item C<void mark()>
50 Marks the object as live.
52 =cut
56     VTABLE void mark() {
57         Parrot_PackfileFixupEntry_attributes * attrs =
58                 PARROT_PACKFILEFIXUPENTRY(SELF);
60         Parrot_gc_mark_STRING_alive(interp, attrs->name);
61     }
65 =item C<void set_pointer(void *pointer)>
67 Initialize from PackFile_FixupEntry pointer.
69 =cut
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;
83     }
87 =item C<void *get_pointer()>
89 Create PackFile_FixupEntry* from self.
91 =cut
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;
103         return entry;
104     }
109 =item C<STRING *get_string()>
111 Fetch the label field of the fixup entry.
113 =cut
116     VTABLE STRING *get_string() {
117         return PARROT_PACKFILEFIXUPENTRY(SELF)->name;
118     }
122 =item C<void set_string_native(STRING *value)>
124 Set the label field of the fixup entry.
126 =cut
129     VTABLE void set_string_native(STRING *value) {
130         SETATTR_PackfileFixupEntry_name(INTERP, SELF, value);
131     }
136 =item C<INTVAL get_integer()>
138 Fetch the offset field of the fixup entry.
140 =cut
143     VTABLE INTVAL get_integer() {
144         return PARROT_PACKFILEFIXUPENTRY(SELF)->offset;
145     }
150 =item C<void set_integer_native(INTVAL offset)>
152 Set the offset field of the fixup entry.
154 =cut
157     VTABLE void set_integer_native(INTVAL offset) {
158         SETATTR_PackfileFixupEntry_offset(INTERP, SELF, offset);
159     }
164 =item C<INTVAL get_type()>
166 Fetch the type field of the fixup entry.
168 =cut
171     METHOD get_type() {
172         INTVAL rv = PARROT_PACKFILEFIXUPENTRY(SELF)->type;
173         RETURN(INTVAL rv);
174     }
179 =item C<void set_type(INTVAL type)>
181 Set the type field of the fixup entry.
183 =cut
186     METHOD set_type(INTVAL type) {
187         SETATTR_PackfileFixupEntry_type(INTERP, SELF, type);
188     }
193 =back
195 =cut
200  * Local variables:
201  *   c-file-style: "parrot"
202  * End:
203  * vim: expandtab shiftwidth=4:
204  */