| File: | src/pmc/packfilerawsegment.c |
| Coverage: | 95.7% |
| line | stmt | code |
|---|---|---|
| 1 | /* ex: set ro ft=c: | |
| 2 | * !!!!!!! DO NOT EDIT THIS FILE !!!!!!! | |
| 3 | * | |
| 4 | * This file is generated automatically from './src/pmc/packfilerawsegment.pmc' | |
| 5 | * by tools/build/pmc2c.pl. | |
| 6 | * | |
| 7 | * Any changes made here will be lost! | |
| 8 | * | |
| 9 | */ | |
| 10 | ||
| 11 | /* HEADERIZER HFILE: none */ | |
| 12 | /* HEADERIZER STOP */ | |
| 13 | ||
| 14 | #include "parrot/parrot.h" | |
| 15 | #include "parrot/extend.h" | |
| 16 | #include "parrot/dynext.h" | |
| 17 | #include "pmc_fixedintegerarray.h" | |
| 18 | #include "pmc_packfilerawsegment.h" | |
| 19 | #include "pmc_packfilesegment.h" | |
| 20 | #include "pmc_default.h" | |
| 21 | #include "packfilerawsegment.str" | |
| 22 | #include "pmc_continuation.h" | |
| 23 | #include "pmc_callcontext.h" | |
| 24 | /* LINE 1 "./src/pmc/packfilerawsegment.pmc" */ | |
| 25 | /* | |
| 26 | Copyright (C) 2001-2011, Parrot Foundation. | |
| 27 | ||
| 28 - 46 | =head1 NAME src/pmc/packfilerawsegment.pmc - PackfileRawSegment PMC =head1 DESCRIPTION This class implements a PackfileRawSegment object, a low level view of a segment that just splits it into an array of integers. See packfile.pmc for the toplevel Packfile interface, see packfilesegment.pmc for the list of common methods every packfile segment pmc must implement; see PDD13 for the design spec. =head2 Methods =over 4 =cut | |
| 47 | ||
| 48 | */ | |
| 49 | ||
| 50 | /* HEADERIZER HFILE: none */ | |
| 51 | /* HEADERIZER BEGIN: static */ | |
| 52 | /* HEADERIZER END: static */ | |
| 53 | /* LINE 53 "./src/pmc/packfilerawsegment.c" */ | |
| 54 | static INTVAL Parrot_PackfileRawSegment_elements(PARROT_INTERP, ARGMOD(PMC *_self)); | |
| 55 | static INTVAL Parrot_PackfileRawSegment_get_integer(PARROT_INTERP, ARGMOD(PMC *_self)); | |
| 56 | static INTVAL Parrot_PackfileRawSegment_get_integer_keyed_int(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL key); | |
| 57 | static FLOATVAL Parrot_PackfileRawSegment_get_number(PARROT_INTERP, ARGMOD(PMC *_self)); | |
| 58 | static PMC * Parrot_PackfileRawSegment_get_pmc_keyed(PARROT_INTERP, ARGMOD(PMC *_self), PMC *key); | |
| 59 | static PMC * Parrot_PackfileRawSegment_get_pmc_keyed_int(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL index); | |
| 60 | static void * Parrot_PackfileRawSegment_get_pointer(PARROT_INTERP, ARGMOD(PMC *_self)); | |
| 61 | static void Parrot_PackfileRawSegment_init(PARROT_INTERP, ARGMOD(PMC *_self)); | |
| 62 | static void Parrot_PackfileRawSegment_mark(PARROT_INTERP, ARGMOD(PMC *_self)); | |
| 63 | static void Parrot_PackfileRawSegment_push_integer(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL value); | |
| 64 | static void Parrot_PackfileRawSegment_push_pmc(PARROT_INTERP, ARGMOD(PMC *_self), PMC *value); | |
| 65 | static void Parrot_PackfileRawSegment_set_integer_keyed_int(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL key, INTVAL value); | |
| 66 | static void Parrot_PackfileRawSegment_set_pmc_keyed(PARROT_INTERP, ARGMOD(PMC *_self), PMC *key, PMC *value); | |
| 67 | static void Parrot_PackfileRawSegment_set_pointer(PARROT_INTERP, ARGMOD(PMC *_self), void *pointer); | |
| 68 | static void Parrot_PackfileRawSegment_nci_type(PARROT_INTERP, ARGMOD(PMC *_self)); | |
| 69 | static void Parrot_PackfileRawSegment_init_orig(PARROT_INTERP, ARGMOD(PMC *_self)); | |
| 70 | static void Parrot_PackfileRawSegment_push_integer_orig(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL value); | |
| 71 | static void Parrot_PackfileRawSegment_push_pmc_orig(PARROT_INTERP, ARGMOD(PMC *_self), PMC *value); | |
| 72 | static void Parrot_PackfileRawSegment_set_integer_keyed_int_orig(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL key, INTVAL value); | |
| 73 | static void Parrot_PackfileRawSegment_set_pmc_keyed_orig(PARROT_INTERP, ARGMOD(PMC *_self), PMC *key, PMC *value); | |
| 74 | static void Parrot_PackfileRawSegment_set_pointer_orig(PARROT_INTERP, ARGMOD(PMC *_self), void *pointer); | |
| 75 | void Parrot_PackfileRawSegment_class_init(PARROT_INTERP, int, int); | |
| 76 | PARROT_EXPORT VTABLE* Parrot_PackfileRawSegment_update_vtable(ARGMOD(VTABLE*)); | |
| 77 | PARROT_EXPORT VTABLE* Parrot_PackfileRawSegment_get_vtable(PARROT_INTERP); | |
| 78 | void Parrot_PackfileRawSegment_ro_class_init(PARROT_INTERP, int, int); | |
| 79 | PARROT_EXPORT VTABLE* Parrot_PackfileRawSegment_ro_update_vtable(ARGMOD(VTABLE*)); | |
| 80 | PARROT_EXPORT VTABLE* Parrot_PackfileRawSegment_ro_get_vtable(PARROT_INTERP); | |
| 81 | static INTVAL | |
| 82 | Parrot_PackfileRawSegment_elements(PARROT_INTERP, ARGMOD(PMC *_self)) | |
| 83 | 12 | { |
| 84 | /* LINE 144 "./src/pmc/packfilerawsegment.pmc" */ | |
| 85 | ||
| 86 | 12 | return VTABLE_elements(interp, |
| 87 | PARROT_PACKFILERAWSEGMENT(_self)->opcodes); | |
| 88 | /* LINE 88 "./src/pmc/packfilerawsegment.c" */ | |
| 89 | } | |
| 90 | static INTVAL | |
| 91 | Parrot_PackfileRawSegment_get_integer(PARROT_INTERP, ARGMOD(PMC *_self)) | |
| 92 | 12 | { |
| 93 | /* LINE 149 "./src/pmc/packfilerawsegment.pmc" */ | |
| 94 | ||
| 95 | 12 | return VTABLE_elements(interp, |
| 96 | PARROT_PACKFILERAWSEGMENT(_self)->opcodes); | |
| 97 | /* LINE 97 "./src/pmc/packfilerawsegment.c" */ | |
| 98 | } | |
| 99 | static INTVAL | |
| 100 | Parrot_PackfileRawSegment_get_integer_keyed_int(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL key) | |
| 101 | 72 | { |
| 102 | /* LINE 172 "./src/pmc/packfilerawsegment.pmc" */ | |
| 103 | ||
| 104 | 72 | return VTABLE_get_integer_keyed_int(interp, |
| 105 | PARROT_PACKFILERAWSEGMENT(_self)->opcodes, key); | |
| 106 | /* LINE 106 "./src/pmc/packfilerawsegment.c" */ | |
| 107 | } | |
| 108 | static FLOATVAL | |
| 109 | Parrot_PackfileRawSegment_get_number(PARROT_INTERP, ARGMOD(PMC *_self)) | |
| 110 | 6 | { |
| 111 | /* LINE 154 "./src/pmc/packfilerawsegment.pmc" */ | |
| 112 | ||
| 113 | 6 | return VTABLE_elements(interp, |
| 114 | PARROT_PACKFILERAWSEGMENT(_self)->opcodes); | |
| 115 | /* LINE 115 "./src/pmc/packfilerawsegment.c" */ | |
| 116 | } | |
| 117 | static PMC * | |
| 118 | Parrot_PackfileRawSegment_get_pmc_keyed(PARROT_INTERP, ARGMOD(PMC *_self), PMC *key) | |
| 119 | 6 | { |
| 120 | /* LINE 181 "./src/pmc/packfilerawsegment.pmc" */ | |
| 121 | ||
| 122 | 6 | return Parrot_PackfileRawSegment_get_pmc_keyed_int(interp, _self, VTABLE_get_integer(interp, key)); |
| 123 | /* LINE 123 "./src/pmc/packfilerawsegment.c" */ | |
| 124 | } | |
| 125 | static PMC * | |
| 126 | Parrot_PackfileRawSegment_get_pmc_keyed_int(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL index) | |
| 127 | 12 | { |
| 128 | /* LINE 177 "./src/pmc/packfilerawsegment.pmc" */ | |
| 129 | ||
| 130 | 12 | return Parrot_pmc_box_integer(interp, Parrot_PackfileRawSegment_get_integer_keyed_int(interp, _self, index)); |
| 131 | /* LINE 131 "./src/pmc/packfilerawsegment.c" */ | |
| 132 | } | |
| 133 | static void * | |
| 134 | Parrot_PackfileRawSegment_get_pointer(PARROT_INTERP, ARGMOD(PMC *_self)) | |
| 135 | 24 | { |
| 136 | /* LINE 116 "./src/pmc/packfilerawsegment.pmc" */ | |
| 137 | ||
| 138 | PackFile_Segment * const pfseg = | |
| 139 | 24 | (PackFile_Segment*)mem_gc_allocate_zeroed_typed(interp, PackFile_ByteCode); |
| 140 | const Parrot_PackfileRawSegment_attributes * const attrs = | |
| 141 | 24 | PARROT_PACKFILERAWSEGMENT(_self); |
| 142 | 24 | PMC * const opcodes = attrs->opcodes; |
| 143 | size_t i; | |
| 144 | ||
| 145 | 24 | pfseg->type = attrs->type; |
| 146 | 24 | pfseg->size = VTABLE_get_integer(interp, opcodes); |
| 147 | 24 | pfseg->data = mem_gc_allocate_n_typed(interp, pfseg->size, opcode_t); |
| 148 | ||
| 149 | /* Not very efficient... */ | |
| 150 | 984 | for (i = 0; i < pfseg->size; ++i) { |
| 151 | 960 | pfseg->data[i] = VTABLE_get_integer_keyed_int(interp, opcodes, i); |
| 152 | } | |
| 153 | ||
| 154 | 24 | return pfseg; |
| 155 | /* LINE 155 "./src/pmc/packfilerawsegment.c" */ | |
| 156 | } | |
| 157 | static void | |
| 158 | Parrot_PackfileRawSegment_init(PARROT_INTERP, ARGMOD(PMC *_self)) | |
| 159 | 284 | { |
| 160 | 284 | Parrot_PackfileRawSegment_init_orig(interp, _self); |
| 161 | 284 | PARROT_GC_WRITE_BARRIER(interp, _self); |
| 162 | 284 | } |
| 163 | static void | |
| 164 | Parrot_PackfileRawSegment_mark(PARROT_INTERP, ARGMOD(PMC *_self)) | |
| 165 | 84 | { |
| 166 | /* LINE 66 "./src/pmc/packfilerawsegment.pmc" */ | |
| 167 | ||
| 168 | Parrot_PackfileRawSegment_attributes * const attrs = | |
| 169 | 84 | PARROT_PACKFILERAWSEGMENT(_self); |
| 170 | ||
| 171 | 84 | Parrot_gc_mark_PMC_alive(interp, attrs->opcodes); |
| 172 | ||
| 173 | 84 | interp->vtables[enum_class_PackfileSegment]->mark(interp, _self); |
| 174 | /* LINE 174 "./src/pmc/packfilerawsegment.c" */ | |
| 175 | 84 | } |
| 176 | static void | |
| 177 | Parrot_PackfileRawSegment_push_integer(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL value) | |
| 178 | 12 | { |
| 179 | 12 | Parrot_PackfileRawSegment_push_integer_orig(interp, _self, value); |
| 180 | 12 | PARROT_GC_WRITE_BARRIER(interp, _self); |
| 181 | 12 | } |
| 182 | static void | |
| 183 | Parrot_PackfileRawSegment_push_pmc(PARROT_INTERP, ARGMOD(PMC *_self), PMC *value) | |
| 184 | 0 | { |
| 185 | 0 | Parrot_PackfileRawSegment_push_pmc_orig(interp, _self, value); |
| 186 | 0 | PARROT_GC_WRITE_BARRIER(interp, _self); |
| 187 | 0 | } |
| 188 | static void | |
| 189 | Parrot_PackfileRawSegment_set_integer_keyed_int(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL key, INTVAL value) | |
| 190 | 12 | { |
| 191 | 12 | Parrot_PackfileRawSegment_set_integer_keyed_int_orig(interp, _self, key, value); |
| 192 | 12 | PARROT_GC_WRITE_BARRIER(interp, _self); |
| 193 | 12 | } |
| 194 | static void | |
| 195 | Parrot_PackfileRawSegment_set_pmc_keyed(PARROT_INTERP, ARGMOD(PMC *_self), PMC *key, PMC *value) | |
| 196 | 6 | { |
| 197 | 6 | Parrot_PackfileRawSegment_set_pmc_keyed_orig(interp, _self, key, value); |
| 198 | 6 | PARROT_GC_WRITE_BARRIER(interp, _self); |
| 199 | 6 | } |
| 200 | static void | |
| 201 | Parrot_PackfileRawSegment_set_pointer(PARROT_INTERP, ARGMOD(PMC *_self), void *pointer) | |
| 202 | 192 | { |
| 203 | 192 | Parrot_PackfileRawSegment_set_pointer_orig(interp, _self, pointer); |
| 204 | 192 | PARROT_GC_WRITE_BARRIER(interp, _self); |
| 205 | 192 | } |
| 206 | static void | |
| 207 | Parrot_PackfileRawSegment_nci_type(PARROT_INTERP, ARGMOD(PMC *_self)) | |
| 208 | 30 | { |
| 209 | /* LINE 364 "/home/jurosz/cover-tt/client-data/Parrot-cover-temp/tools/build/../../lib/Parrot/Pmc2c/PCCMETHOD.pm" */ | |
| 210 | 30 | PMC * const _ctx = CURRENT_CONTEXT(interp); |
| 211 | 30 | PMC * const _call_object = Parrot_pcc_get_signature(interp, _ctx); |
| 212 | ||
| 213 | { /* BEGIN PARMS SCOPE */ | |
| 214 | /* LINE 214 "./src/pmc/packfilerawsegment.pmc" */ | |
| 215 | INTVAL type; | |
| 216 | INTVAL got_type; | |
| 217 | ||
| 218 | /* LINE 372 "/home/jurosz/cover-tt/client-data/Parrot-cover-temp/tools/build/../../lib/Parrot/Pmc2c/PCCMETHOD.pm" */ | |
| 219 | 30 | Parrot_pcc_fill_params_from_c_args(interp, _call_object, "PiIoIp", |
| 220 | &_self, &type, &got_type); | |
| 221 | /* LINE 376 "/home/jurosz/cover-tt/client-data/Parrot-cover-temp/tools/build/../../lib/Parrot/Pmc2c/PCCMETHOD.pm" */ | |
| 222 | { /* BEGIN PMETHOD BODY */ | |
| 223 | /* LINE 238 "./src/pmc/packfilerawsegment.pmc" */ | |
| 224 | ||
| 225 | Parrot_PackfileRawSegment_attributes * const attrs = | |
| 226 | 30 | PARROT_PACKFILERAWSEGMENT(_self); |
| 227 | INTVAL res; | |
| 228 | ||
| 229 | 30 | if (got_type) { |
| 230 | 6 | attrs->type = type; |
| 231 | } | |
| 232 | ||
| 233 | 30 | res = attrs->type; |
| 234 | /* LINE 209 "/home/jurosz/cover-tt/client-data/Parrot-cover-temp/tools/build/../../lib/Parrot/Pmc2c/PCCMETHOD.pm" */ | |
| 235 | { | |
| 236 | /*BEGIN RETURN INTVAL res */ | |
| 237 | /* LINE 217 "/home/jurosz/cover-tt/client-data/Parrot-cover-temp/tools/build/../../lib/Parrot/Pmc2c/PCCMETHOD.pm" */ | |
| 238 | 30 | Parrot_pcc_set_call_from_c_args(interp, _call_object, |
| 239 | "I", (INTVAL)res); | |
| 240 | 30 | PARROT_GC_WRITE_BARRIER(interp, _self); |
| 241 | return; | |
| 242 | /*END RETURN INTVAL res */ | |
| 243 | } | |
| 244 | /* LINE 248 "./src/pmc/packfilerawsegment.pmc" */ | |
| 245 | ||
| 246 | /* LINE 386 "/home/jurosz/cover-tt/client-data/Parrot-cover-temp/tools/build/../../lib/Parrot/Pmc2c/PCCMETHOD.pm" */ | |
| 247 | ||
| 248 | } /* END PMETHOD BODY */ | |
| 249 | ||
| 250 | PARROT_GC_WRITE_BARRIER(interp, _self); | |
| 251 | ||
| 252 | } /* END PARAMS SCOPE */ | |
| 253 | return; | |
| 254 | /* LINE 254 "./src/pmc/packfilerawsegment.c" */ | |
| 255 | } | |
| 256 | static void | |
| 257 | Parrot_PackfileRawSegment_init_orig(PARROT_INTERP, ARGMOD(PMC *_self)) | |
| 258 | 284 | { |
| 259 | /* LINE 46 "./src/pmc/packfilerawsegment.pmc" */ | |
| 260 | ||
| 261 | Parrot_PackfileRawSegment_attributes * const attrs = | |
| 262 | 284 | PMC_data_typed(_self, Parrot_PackfileRawSegment_attributes*); |
| 263 | ||
| 264 | 284 | attrs->opcodes = Parrot_pmc_new(interp, enum_class_ResizableIntegerArray); |
| 265 | 284 | attrs->type = PF_BYTEC_SEG; |
| 266 | ||
| 267 | 284 | PObj_custom_mark_SET(_self); |
| 268 | /* LINE 268 "./src/pmc/packfilerawsegment.c" */ | |
| 269 | 284 | } |
| 270 | static void | |
| 271 | Parrot_PackfileRawSegment_push_integer_orig(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL value) | |
| 272 | 12 | { |
| 273 | /* LINE 215 "./src/pmc/packfilerawsegment.pmc" */ | |
| 274 | ||
| 275 | 12 | VTABLE_push_integer(interp, |
| 276 | PARROT_PACKFILERAWSEGMENT(_self)->opcodes, value); | |
| 277 | /* LINE 277 "./src/pmc/packfilerawsegment.c" */ | |
| 278 | 12 | } |
| 279 | static void | |
| 280 | Parrot_PackfileRawSegment_push_pmc_orig(PARROT_INTERP, ARGMOD(PMC *_self), PMC *value) | |
| 281 | 0 | { |
| 282 | /* LINE 220 "./src/pmc/packfilerawsegment.pmc" */ | |
| 283 | ||
| 284 | 0 | VTABLE_push_integer(interp, |
| 285 | PARROT_PACKFILERAWSEGMENT(_self)->opcodes, | |
| 286 | VTABLE_get_integer(interp, value)); | |
| 287 | /* LINE 287 "./src/pmc/packfilerawsegment.c" */ | |
| 288 | 0 | } |
| 289 | static void | |
| 290 | Parrot_PackfileRawSegment_set_integer_keyed_int_orig(PARROT_INTERP, ARGMOD(PMC *_self), INTVAL key, INTVAL value) | |
| 291 | 12 | { |
| 292 | /* LINE 195 "./src/pmc/packfilerawsegment.pmc" */ | |
| 293 | ||
| 294 | 12 | VTABLE_set_integer_keyed_int(interp, |
| 295 | PARROT_PACKFILERAWSEGMENT(_self)->opcodes, key, value); | |
| 296 | /* LINE 296 "./src/pmc/packfilerawsegment.c" */ | |
| 297 | 12 | } |
| 298 | static void | |
| 299 | Parrot_PackfileRawSegment_set_pmc_keyed_orig(PARROT_INTERP, ARGMOD(PMC *_self), PMC *key, PMC *value) | |
| 300 | 6 | { |
| 301 | /* LINE 200 "./src/pmc/packfilerawsegment.pmc" */ | |
| 302 | ||
| 303 | 6 | VTABLE_set_integer_keyed_int(interp, _self, VTABLE_get_integer(interp, key), |
| 304 | VTABLE_get_integer(interp, value)); | |
| 305 | /* LINE 305 "./src/pmc/packfilerawsegment.c" */ | |
| 306 | 6 | } |
| 307 | static void | |
| 308 | Parrot_PackfileRawSegment_set_pointer_orig(PARROT_INTERP, ARGMOD(PMC *_self), void *pointer) | |
| 309 | 192 | { |
| 310 | /* LINE 86 "./src/pmc/packfilerawsegment.pmc" */ | |
| 311 | ||
| 312 | const PackFile_Segment * const pfseg = | |
| 313 | 192 | (const PackFile_Segment *)pointer; |
| 314 | Parrot_PackfileRawSegment_attributes * const attrs = | |
| 315 | 192 | PARROT_PACKFILERAWSEGMENT(_self); |
| 316 | 192 | PMC * const opcodes = attrs->opcodes; |
| 317 | ||
| 318 | /* Preserve type of unpacked segment */ | |
| 319 | 192 | attrs->type = pfseg->type; |
| 320 | ||
| 321 | 192 | if (pfseg->size) { |
| 322 | size_t i; | |
| 323 | ||
| 324 | /* copy data to own array */ | |
| 325 | 180 | VTABLE_set_integer_native(interp, opcodes, pfseg->size); |
| 326 | /* Not very efficient... */ | |
| 327 | 22344 | for (i = 0; i < pfseg->size; ++i) { |
| 328 | 22164 | VTABLE_set_integer_keyed_int(interp, opcodes, i, pfseg->data[i]); |
| 329 | } | |
| 330 | } | |
| 331 | /* LINE 331 "./src/pmc/packfilerawsegment.c" */ | |
| 332 | 192 | } |
| 333 | #include "pmc_default.h" | |
| 334 | ||
| 335 | PARROT_EXPORT | |
| 336 | 43980 | VTABLE *Parrot_PackfileRawSegment_update_vtable(VTABLE *vt) { |
| 337 | 43980 | vt->elements = Parrot_PackfileRawSegment_elements; |
| 338 | 43980 | vt->get_integer = Parrot_PackfileRawSegment_get_integer; |
| 339 | 43980 | vt->get_integer_keyed_int = Parrot_PackfileRawSegment_get_integer_keyed_int; |
| 340 | 43980 | vt->get_number = Parrot_PackfileRawSegment_get_number; |
| 341 | 43980 | vt->get_pmc_keyed = Parrot_PackfileRawSegment_get_pmc_keyed; |
| 342 | 43980 | vt->get_pmc_keyed_int = Parrot_PackfileRawSegment_get_pmc_keyed_int; |
| 343 | 43980 | vt->get_pointer = Parrot_PackfileRawSegment_get_pointer; |
| 344 | 43980 | vt->init = Parrot_PackfileRawSegment_init; |
| 345 | 43980 | vt->mark = Parrot_PackfileRawSegment_mark; |
| 346 | 43980 | vt->push_integer = Parrot_PackfileRawSegment_push_integer; |
| 347 | 43980 | vt->push_pmc = Parrot_PackfileRawSegment_push_pmc; |
| 348 | 43980 | vt->set_integer_keyed_int = Parrot_PackfileRawSegment_set_integer_keyed_int; |
| 349 | 43980 | vt->set_pmc_keyed = Parrot_PackfileRawSegment_set_pmc_keyed; |
| 350 | 43980 | vt->set_pointer = Parrot_PackfileRawSegment_set_pointer; |
| 351 | 43980 | vt->attr_size = sizeof(Parrot_PackfileRawSegment_attributes); |
| 352 | ||
| 353 | 43980 | return vt; |
| 354 | } | |
| 355 | ||
| 356 | ||
| 357 | PARROT_EXPORT | |
| 358 | 43980 | VTABLE *Parrot_PackfileRawSegment_ro_update_vtable(ARGMOD(VTABLE *vt)) { |
| 359 | 43980 | vt->elements = Parrot_PackfileRawSegment_elements; |
| 360 | 43980 | vt->get_integer = Parrot_PackfileRawSegment_get_integer; |
| 361 | 43980 | vt->get_integer_keyed_int = Parrot_PackfileRawSegment_get_integer_keyed_int; |
| 362 | 43980 | vt->get_number = Parrot_PackfileRawSegment_get_number; |
| 363 | 43980 | vt->get_pmc_keyed = Parrot_PackfileRawSegment_get_pmc_keyed; |
| 364 | 43980 | vt->get_pmc_keyed_int = Parrot_PackfileRawSegment_get_pmc_keyed_int; |
| 365 | 43980 | vt->get_pointer = Parrot_PackfileRawSegment_get_pointer; |
| 366 | 43980 | vt->mark = Parrot_PackfileRawSegment_mark; |
| 367 | 43980 | vt->attr_size = sizeof(Parrot_PackfileRawSegment_attributes); |
| 368 | ||
| 369 | 43980 | return vt; |
| 370 | } | |
| 371 | ||
| 372 | PARROT_EXPORT | |
| 373 | PARROT_CANNOT_RETURN_NULL | |
| 374 | PARROT_WARN_UNUSED_RESULT | |
| 375 | 43980 | VTABLE* Parrot_PackfileRawSegment_get_vtable(PARROT_INTERP) { |
| 376 | VTABLE *vt; | |
| 377 | 43980 | vt = Parrot_PackfileSegment_get_vtable(interp); |
| 378 | 43980 | Parrot_PackfileRawSegment_update_vtable(vt); |
| 379 | ||
| 380 | 43980 | return vt; |
| 381 | } | |
| 382 | ||
| 383 | PARROT_EXPORT | |
| 384 | PARROT_CANNOT_RETURN_NULL | |
| 385 | PARROT_WARN_UNUSED_RESULT | |
| 386 | 43980 | VTABLE* Parrot_PackfileRawSegment_ro_get_vtable(PARROT_INTERP) { |
| 387 | VTABLE *vt; | |
| 388 | 43980 | vt = Parrot_PackfileSegment_ro_get_vtable(interp); |
| 389 | 43980 | Parrot_PackfileRawSegment_ro_update_vtable(vt); |
| 390 | ||
| 391 | 43980 | return vt; |
| 392 | } | |
| 393 | ||
| 394 | PARROT_EXPORT | |
| 395 | PARROT_CANNOT_RETURN_NULL | |
| 396 | PARROT_WARN_UNUSED_RESULT | |
| 397 | 43980 | PMC* Parrot_PackfileRawSegment_get_mro(PARROT_INTERP, ARGMOD(PMC* mro)) { |
| 398 | 43980 | if (PMC_IS_NULL(mro)) { |
| 399 | 14660 | mro = Parrot_pmc_new(interp, enum_class_ResizableStringArray); |
| 400 | } | |
| 401 | 43980 | mro = Parrot_PackfileSegment_get_mro(interp, mro); |
| 402 | ||
| 403 | 43980 | VTABLE_unshift_string(interp, mro, CONST_STRING_GEN(interp, "PackfileRawSegment")); |
| 404 | 43980 | return mro; |
| 405 | } | |
| 406 | ||
| 407 | PARROT_EXPORT | |
| 408 | PARROT_CANNOT_RETURN_NULL | |
| 409 | PARROT_WARN_UNUSED_RESULT | |
| 410 | 43980 | Hash* Parrot_PackfileRawSegment_get_isa(PARROT_INTERP, ARGIN_NULLOK(Hash* isa)) { |
| 411 | 43980 | isa = Parrot_PackfileSegment_get_isa(interp, isa); |
| 412 | 43980 | Parrot_hash_put(interp, isa, (void *)(CONST_STRING_GEN(interp, "PackfileRawSegment")), PMCNULL); |
| 413 | 43980 | return isa; |
| 414 | } | |
| 415 | ||
| 416 | void | |
| 417 | Parrot_PackfileRawSegment_class_init(PARROT_INTERP, int entry, int pass) | |
| 418 | 29320 | { |
| 419 | static const char attr_defs [] = | |
| 420 | "Fdirectory Itype Fopcodes "; | |
| 421 | 29320 | if (pass == 0) { |
| 422 | 14660 | VTABLE * const vt = Parrot_PackfileRawSegment_get_vtable(interp); |
| 423 | 14660 | vt->base_type = enum_class_PackfileRawSegment; |
| 424 | 14660 | vt->flags = 0|VTABLE_HAS_READONLY_FLAG; |
| 425 | 14660 | vt->attribute_defs = attr_defs; |
| 426 | 14660 | interp->vtables[entry] = vt; |
| 427 | ||
| 428 | 14660 | vt->whoami = CONST_STRING_GEN(interp, "PackfileRawSegment"); |
| 429 | 14660 | vt->provides_str = CONST_STRING_GEN(interp, "scalar"); |
| 430 | 14660 | vt->isa_hash = Parrot_PackfileRawSegment_get_isa(interp, NULL); |
| 431 | { | |
| 432 | 14660 | VTABLE * const vt_ro = Parrot_PackfileRawSegment_ro_get_vtable(interp); |
| 433 | 14660 | vt_ro->base_type = enum_class_PackfileRawSegment; |
| 434 | 14660 | vt_ro->flags = 0|VTABLE_IS_READONLY_FLAG; |
| 435 | ||
| 436 | 14660 | vt_ro->attribute_defs = attr_defs; |
| 437 | ||
| 438 | 14660 | vt_ro->base_type = entry; |
| 439 | 14660 | vt_ro->whoami = vt->whoami; |
| 440 | 14660 | vt_ro->provides_str = vt->provides_str; |
| 441 | 14660 | vt->ro_variant_vtable = vt_ro; |
| 442 | 14660 | vt_ro->ro_variant_vtable = vt; |
| 443 | 14660 | vt_ro->isa_hash = vt->isa_hash; |
| 444 | } | |
| 445 | ||
| 446 | } | |
| 447 | else { /* pass */ | |
| 448 | { | |
| 449 | 14660 | VTABLE * const vt = interp->vtables[entry]; |
| 450 | ||
| 451 | 14660 | vt->mro = Parrot_PackfileRawSegment_get_mro(interp, PMCNULL); |
| 452 | ||
| 453 | 14660 | if (vt->ro_variant_vtable) |
| 454 | 14660 | vt->ro_variant_vtable->mro = vt->mro; |
| 455 | } | |
| 456 | ||
| 457 | /* set up MRO and _namespace */ | |
| 458 | 14660 | Parrot_pmc_create_mro(interp, entry); |
| 459 | { | |
| 460 | 14660 | STRING * const method_name = CONST_STRING_GEN(interp, "type"); |
| 461 | 14660 | STRING * const signature = CONST_STRING_GEN(interp, "->"); |
| 462 | 14660 | Parrot_interp_register_native_pcc_method_in_ns(interp, entry, |
| 463 | F2DPTR(Parrot_PackfileRawSegment_nci_type), | |
| 464 | method_name, signature); | |
| 465 | } | |
| 466 | { | |
| 467 | } | |
| 468 | } /* pass */ | |
| 469 | 29320 | } /* Parrot_PackfileRawSegment_class_init */ |
| 470 | /* LINE 250 "./src/pmc/packfilerawsegment.pmc" */ | |
| 471 | ||
| 472 | /* | |
| 473 | ||
| 474 | =back | |
| 475 | ||
| 476 | =cut | |
| 477 | ||
| 478 | */ | |
| 479 | ||
| 480 | /* | |
| 481 | * Local variables: | |
| 482 | * c-file-style: "parrot" | |
| 483 | * End: | |
| 484 | * vim: expandtab shiftwidth=4 cinoptions='\:2=2' : | |
| 485 | */ | |