Ticket #1357: capture.pmc.patch
File capture.pmc.patch, 22.4 KB (added by jimmy, 12 years ago) |
---|
-
src/pmc/capture.pmc
19 19 */ 20 20 21 21 #define CAPTURE_array_CREATE(i, obj) \ 22 if (!PARROT_CAPTURE(obj)->array) \ 23 PARROT_CAPTURE(obj)->array = pmc_new((i), enum_class_ResizablePMCArray); 22 do { \ 23 GETATTR_Capture_array((i), (obj), array); \ 24 if (!array) \ 25 SETATTR_Capture_array((i), (obj), pmc_new((i), enum_class_ResizablePMCArray)); \ 26 } while (0) 24 27 #define CAPTURE_hash_CREATE(i, obj) \ 25 if (!PARROT_CAPTURE(obj)->hash) \ 26 PARROT_CAPTURE(obj)->hash = pmc_new((i), enum_class_Hash); 28 do { \ 29 GETATTR_Capture_hash((i), (obj), hash); \ 30 if (!hash) \ 31 SETATTR_Capture_hash((i), (obj), pmc_new((i), enum_class_Hash)); \ 32 } while (0) 27 33 28 34 pmclass Capture auto_attrs { 29 35 ATTR PMC *array; … … 85 91 */ 86 92 87 93 VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL value) { 94 PMC *array; 95 88 96 CAPTURE_array_CREATE(INTERP, SELF); 89 VTABLE_set_number_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,90 97 GET_ATTR_array(INTERP, SELF, array); 98 VTABLE_set_number_keyed_int(INTERP, array, key, value); 91 99 } 92 100 93 101 VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) { 102 PMC *array; 103 94 104 CAPTURE_array_CREATE(INTERP, SELF); 95 VTABLE_set_integer_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,96 105 GET_ATTR_array(INTERP, SELF, array); 106 VTABLE_set_integer_keyed_int(INTERP, array, key, value); 97 107 } 98 108 99 109 VTABLE void set_pmc_keyed_int(INTVAL key, PMC *value) { 110 PMC *array; 111 100 112 CAPTURE_array_CREATE(INTERP, SELF); 101 VTABLE_set_pmc_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,102 113 GET_ATTR_array(INTERP, SELF, array); 114 VTABLE_set_pmc_keyed_int(INTERP, array, key, value); 103 115 } 104 116 105 117 VTABLE void set_string_keyed_int(INTVAL key, STRING *value) { 118 PMC *array; 119 106 120 CAPTURE_array_CREATE(INTERP, SELF); 107 VTABLE_set_string_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,108 121 GET_ATTR_array(INTERP, SELF, array); 122 VTABLE_set_string_keyed_int(INTERP, array, key, value); 109 123 } 110 124 111 125 /* … … 125 139 */ 126 140 127 141 VTABLE FLOATVAL get_number_keyed_int(INTVAL key) { 128 if (!(PARROT_CAPTURE(SELF)->array)) 142 PMC *array; 143 144 GET_ATTR_array(INTERP, SELF, array); 145 146 if (!array) 129 147 return 0.0; 130 return VTABLE_get_number_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 131 148 149 return VTABLE_get_number_keyed_int(INTERP, array, key); 132 150 } 133 151 134 152 VTABLE INTVAL get_integer_keyed_int(INTVAL key) { 135 if (!(PARROT_CAPTURE(SELF)->array)) 153 PMC *array; 154 155 GET_ATTR_array(INTERP, SELF, array); 156 157 if (!array) 136 158 return 0; 137 return VTABLE_get_integer_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 138 159 160 return VTABLE_get_integer_keyed_int(INTERP, array, key); 139 161 } 140 162 141 163 VTABLE PMC *get_pmc_keyed_int(INTVAL key) { 142 if (!(PARROT_CAPTURE(SELF)->array)) 164 PMC *array; 165 166 GET_ATTR_array(INTERP, SELF, array); 167 168 if (!array) 143 169 return PMCNULL; 144 return VTABLE_get_pmc_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 145 170 171 return VTABLE_get_pmc_keyed_int(INTERP, array, key); 146 172 } 147 173 148 174 VTABLE STRING *get_string_keyed_int(INTVAL key) { 149 if (!(PARROT_CAPTURE(SELF)->array)) 175 PMC *array; 176 177 GET_ATTR_array(INTERP, SELF, array); 178 179 if (!array) 150 180 return CONST_STRING(INTERP, ""); 151 return VTABLE_get_string_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 152 181 182 return VTABLE_get_string_keyed_int(INTERP, array, key); 153 183 } 154 184 155 185 /* … … 179 209 */ 180 210 181 211 VTABLE void push_float(FLOATVAL value) { 212 PMC *array; 213 182 214 CAPTURE_array_CREATE(INTERP, SELF); 183 VTABLE_push_float(INTERP, PARROT_CAPTURE(SELF)->array, value); 215 GET_ATTR_array(INTERP, SELF, array); 216 217 VTABLE_push_float(INTERP, array, value); 184 218 } 185 219 186 220 VTABLE void push_integer(INTVAL value) { 221 PMC *array; 222 187 223 CAPTURE_array_CREATE(INTERP, SELF); 188 VTABLE_push_integer(INTERP, PARROT_CAPTURE(SELF)->array, value); 224 GET_ATTR_array(INTERP, SELF, array); 225 226 VTABLE_push_integer(INTERP, array, value); 189 227 } 190 228 191 229 VTABLE void push_pmc(PMC *value) { 230 PMC *array; 231 192 232 CAPTURE_array_CREATE(INTERP, SELF); 193 VTABLE_push_pmc(INTERP, PARROT_CAPTURE(SELF)->array, value); 233 GET_ATTR_array(INTERP, SELF, array); 234 235 VTABLE_push_pmc(INTERP, array, value); 194 236 } 195 237 196 238 VTABLE void push_string(STRING *value) { 239 PMC *array; 240 197 241 CAPTURE_array_CREATE(INTERP, SELF); 198 VTABLE_push_string(INTERP, PARROT_CAPTURE(SELF)->array, value); 242 GET_ATTR_array(INTERP, SELF, array); 243 244 VTABLE_push_string(INTERP, array, value); 199 245 } 200 246 201 247 VTABLE void unshift_float(FLOATVAL value) { 248 PMC *array; 249 202 250 CAPTURE_array_CREATE(INTERP, SELF); 203 VTABLE_unshift_float(INTERP, PARROT_CAPTURE(SELF)->array, value); 251 GET_ATTR_array(INTERP, SELF, array); 252 253 VTABLE_unshift_float(INTERP, array, value); 204 254 } 205 255 206 256 VTABLE void unshift_integer(INTVAL value) { 257 PMC *array; 258 207 259 CAPTURE_array_CREATE(INTERP, SELF); 208 VTABLE_unshift_integer(INTERP, PARROT_CAPTURE(SELF)->array, value); 260 GET_ATTR_array(INTERP, SELF, array); 261 262 VTABLE_unshift_integer(INTERP, array, value); 209 263 } 210 264 211 265 VTABLE void unshift_pmc(PMC *value) { 266 PMC *array; 267 212 268 CAPTURE_array_CREATE(INTERP, SELF); 213 VTABLE_unshift_pmc(INTERP, PARROT_CAPTURE(SELF)->array, value); 269 GET_ATTR_array(INTERP, SELF, array); 270 271 VTABLE_unshift_pmc(INTERP, array, value); 214 272 } 215 273 216 274 VTABLE void unshift_string(STRING *value) { 275 PMC *array; 276 217 277 CAPTURE_array_CREATE(INTERP, SELF); 218 VTABLE_unshift_string(INTERP, PARROT_CAPTURE(SELF)->array, value); 278 GET_ATTR_array(INTERP, SELF, array); 279 280 VTABLE_unshift_string(INTERP, array, value); 219 281 } 220 282 221 283 /* … … 245 307 */ 246 308 247 309 VTABLE FLOATVAL pop_float() { 310 PMC *array; 311 248 312 CAPTURE_array_CREATE(INTERP, SELF); 249 return VTABLE_pop_float(INTERP, PARROT_CAPTURE(SELF)->array); 313 GET_ATTR_array(INTERP, SELF, array); 314 315 return VTABLE_pop_float(INTERP, array); 250 316 } 251 317 252 318 VTABLE INTVAL pop_integer() { 319 PMC *array; 320 253 321 CAPTURE_array_CREATE(INTERP, SELF); 254 return VTABLE_pop_integer(INTERP, PARROT_CAPTURE(SELF)->array); 322 GET_ATTR_array(INTERP, SELF, array); 323 324 return VTABLE_pop_integer(INTERP, array); 255 325 } 256 326 257 327 VTABLE PMC *pop_pmc() { 328 PMC *array; 329 258 330 CAPTURE_array_CREATE(INTERP, SELF); 259 return VTABLE_pop_pmc(INTERP, PARROT_CAPTURE(SELF)->array); 331 GET_ATTR_array(INTERP, SELF, array); 332 333 return VTABLE_pop_pmc(INTERP, array); 260 334 } 261 335 262 336 VTABLE STRING *pop_string() { 337 PMC *array; 338 263 339 CAPTURE_array_CREATE(INTERP, SELF); 264 return VTABLE_pop_string(INTERP, PARROT_CAPTURE(SELF)->array); 340 GET_ATTR_array(INTERP, SELF, array); 341 342 return VTABLE_pop_string(INTERP, array); 265 343 } 266 344 267 345 VTABLE FLOATVAL shift_float() { 346 PMC *array; 347 268 348 CAPTURE_array_CREATE(INTERP, SELF); 269 return VTABLE_shift_float(INTERP, PARROT_CAPTURE(SELF)->array); 349 GET_ATTR_array(INTERP, SELF, array); 350 351 return VTABLE_shift_float(INTERP, array); 270 352 } 271 353 272 354 VTABLE INTVAL shift_integer() { 355 PMC *array; 356 273 357 CAPTURE_array_CREATE(INTERP, SELF); 274 return VTABLE_shift_integer(INTERP, PARROT_CAPTURE(SELF)->array); 358 GET_ATTR_array(INTERP, SELF, array); 359 360 return VTABLE_shift_integer(INTERP, array); 275 361 } 276 362 277 363 VTABLE PMC *shift_pmc() { 364 PMC *array; 365 278 366 CAPTURE_array_CREATE(INTERP, SELF); 279 return VTABLE_shift_pmc(INTERP, PARROT_CAPTURE(SELF)->array); 367 GET_ATTR_array(INTERP, SELF, array); 368 369 return VTABLE_shift_pmc(INTERP, array); 280 370 } 281 371 282 372 VTABLE STRING *shift_string() { 373 PMC *array; 374 283 375 CAPTURE_array_CREATE(INTERP, SELF); 284 return VTABLE_shift_string(INTERP, PARROT_CAPTURE(SELF)->array); 376 GET_ATTR_array(INTERP, SELF, array); 377 378 return VTABLE_shift_string(INTERP, array); 285 379 } 286 380 287 381 /* … … 307 401 */ 308 402 309 403 VTABLE INTVAL elements() { 310 if (!PARROT_CAPTURE(SELF)->array) return 0; 311 return VTABLE_elements(INTERP, PARROT_CAPTURE(SELF)->array); 404 PMC *array; 405 406 GET_ATTR_array(INTERP, SELF, array); 407 408 if (!array) 409 return 0; 410 411 return VTABLE_elements(INTERP, array); 312 412 } 313 413 314 414 VTABLE INTVAL defined_keyed_int(INTVAL key) { 315 if (!PARROT_CAPTURE(SELF)->array) 415 PMC *array; 416 417 GET_ATTR_array(INTERP, SELF, array); 418 419 if (!array) 316 420 return 0; 317 421 318 return VTABLE_defined_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 319 key); 422 return VTABLE_defined_keyed_int(INTERP, array, key); 320 423 } 321 424 322 425 VTABLE INTVAL exists_keyed_int(INTVAL key) { 323 if (!PARROT_CAPTURE(SELF)->array) 426 PMC *array; 427 428 GET_ATTR_array(INTERP, SELF, array); 429 430 if (!array) 324 431 return 0; 325 432 326 return VTABLE_exists_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 327 key); 433 return VTABLE_exists_keyed_int(INTERP, array, key); 328 434 } 329 435 330 436 VTABLE void delete_keyed_int(INTVAL key) { 331 if (PARROT_CAPTURE(SELF)->array) 332 VTABLE_delete_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, key); 437 PMC *array; 438 439 GET_ATTR_array(INTERP, SELF, array); 440 441 if (array) 442 VTABLE_delete_keyed_int(INTERP, array, key); 333 443 } 334 444 335 445 /* … … 349 459 */ 350 460 351 461 VTABLE void set_number_keyed(PMC *key, FLOATVAL value) { 462 PMC *hash; 463 352 464 CAPTURE_hash_CREATE(INTERP, SELF); 353 VTABLE_set_number_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key, value); 465 GET_ATTR_hash(INTERP, SELF, hash); 466 467 VTABLE_set_number_keyed(INTERP, hash, key, value); 354 468 } 355 469 356 470 VTABLE void set_integer_keyed(PMC *key, INTVAL value) { 471 PMC *hash; 472 357 473 CAPTURE_hash_CREATE(INTERP, SELF); 358 VTABLE_set_integer_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, 359 key, value); 474 GET_ATTR_hash(INTERP, SELF, hash); 475 476 VTABLE_set_integer_keyed(INTERP, hash, key, value); 360 477 } 361 478 362 479 VTABLE void set_pmc_keyed(PMC *key, PMC *value) { 480 PMC *hash; 481 363 482 CAPTURE_hash_CREATE(INTERP, SELF); 364 VTABLE_set_pmc_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key, value); 483 GET_ATTR_hash(INTERP, SELF, hash); 484 485 VTABLE_set_pmc_keyed(INTERP, hash, key, value); 365 486 } 366 487 367 488 VTABLE void set_string_keyed(PMC *key, STRING *value) { 489 PMC *hash; 490 368 491 CAPTURE_hash_CREATE(INTERP, SELF); 369 VTABLE_set_string_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key, value); 492 GET_ATTR_hash(INTERP, SELF, hash); 493 494 VTABLE_set_string_keyed(INTERP, hash, key, value); 370 495 } 371 496 372 497 /* … … 386 511 */ 387 512 388 513 VTABLE FLOATVAL get_number_keyed(PMC *key) { 389 if (!(PARROT_CAPTURE(SELF)->hash)) 514 PMC *hash; 515 516 GET_ATTR_hash(INTERP, SELF, hash); 517 518 if (!hash) 390 519 return 0.0; 391 return VTABLE_get_number_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 520 521 return VTABLE_get_number_keyed(INTERP, hash, key); 392 522 } 393 523 394 524 VTABLE INTVAL get_integer_keyed(PMC *key) { 395 if (!(PARROT_CAPTURE(SELF)->hash)) 525 PMC *hash; 526 527 GET_ATTR_hash(INTERP, SELF, hash); 528 529 if (!hash) 396 530 return 0; 397 return VTABLE_get_integer_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, 398 531 532 return VTABLE_get_integer_keyed(INTERP, hash, key); 399 533 } 400 534 401 535 VTABLE PMC *get_pmc_keyed(PMC *key) { 402 if (!(PARROT_CAPTURE(SELF)->hash)) 536 PMC *hash; 537 538 GET_ATTR_hash(INTERP, SELF, hash); 539 540 if (!hash) 403 541 return PMCNULL; 404 return VTABLE_get_pmc_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 542 543 return VTABLE_get_pmc_keyed(INTERP, hash, key); 405 544 } 406 545 407 546 VTABLE STRING *get_string_keyed(PMC *key) { 408 if (!(PARROT_CAPTURE(SELF)->hash)) 547 PMC *hash; 548 549 GET_ATTR_hash(INTERP, SELF, hash); 550 551 if (!hash) 409 552 return CONST_STRING(INTERP, ""); 410 return VTABLE_get_string_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 553 554 return VTABLE_get_string_keyed(INTERP, hash, key); 411 555 } 412 556 413 557 /* … … 427 571 */ 428 572 429 573 VTABLE void set_number_keyed_str(STRING *key, FLOATVAL value) { 574 PMC *hash; 575 430 576 CAPTURE_hash_CREATE(INTERP, SELF); 431 VTABLE_set_number_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 432 key, value); 577 GET_ATTR_hash(INTERP, SELF, hash); 578 579 VTABLE_set_number_keyed_str(INTERP, hash, key, value); 433 580 } 434 581 435 582 VTABLE void set_integer_keyed_str(STRING *key, INTVAL value) { 583 PMC *hash; 584 436 585 CAPTURE_hash_CREATE(INTERP, SELF); 437 VTABLE_set_integer_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 438 key, value); 586 GET_ATTR_hash(INTERP, SELF, hash); 587 588 VTABLE_set_integer_keyed_str(INTERP, hash, key, value); 439 589 } 440 590 441 591 VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) { 592 PMC *hash; 593 442 594 CAPTURE_hash_CREATE(INTERP, SELF); 443 VTABLE_set_pmc_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 444 key, value); 595 GET_ATTR_hash(INTERP, SELF, hash); 596 597 VTABLE_set_pmc_keyed_str(INTERP, hash, key, value); 445 598 } 446 599 447 600 VTABLE void set_string_keyed_str(STRING *key, STRING *value) { 601 PMC *hash; 602 448 603 CAPTURE_hash_CREATE(INTERP, SELF); 449 VTABLE_set_string_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 450 key, value); 604 GET_ATTR_hash(INTERP, SELF, hash); 605 606 VTABLE_set_string_keyed_str(INTERP, hash, key, value); 451 607 } 452 608 453 609 /* … … 467 623 */ 468 624 469 625 VTABLE FLOATVAL get_number_keyed_str(STRING *key) { 470 if (!(PARROT_CAPTURE(SELF)->hash)) 626 PMC *hash; 627 628 GET_ATTR_hash(INTERP, SELF, hash); 629 630 if (!hash) 471 631 return 0.0; 472 return VTABLE_get_number_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 473 632 633 return VTABLE_get_number_keyed_str(INTERP, hash, key); 474 634 } 475 635 476 636 VTABLE INTVAL get_integer_keyed_str(STRING *key) { 477 if (!(PARROT_CAPTURE(SELF)->hash)) 637 PMC *hash; 638 639 GET_ATTR_hash(INTERP, SELF, hash); 640 641 if (!hash) 478 642 return 0; 479 return VTABLE_get_integer_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 480 643 644 return VTABLE_get_integer_keyed_str(INTERP, hash, key); 481 645 } 482 646 483 647 VTABLE PMC *get_pmc_keyed_str(STRING *key) { 484 if (!(PARROT_CAPTURE(SELF)->hash)) 648 PMC *hash; 649 650 GET_ATTR_hash(INTERP, SELF, hash); 651 652 if (!hash) 485 653 return PMCNULL; 486 return VTABLE_get_pmc_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 487 654 655 return VTABLE_get_pmc_keyed_str(INTERP, hash, key); 488 656 } 489 657 490 658 VTABLE STRING *get_string_keyed_str(STRING *key) { 491 if (!(PARROT_CAPTURE(SELF)->hash)) 659 PMC *hash; 660 661 GET_ATTR_hash(INTERP, SELF, hash); 662 663 if (!hash) 492 664 return CONST_STRING(INTERP, ""); 493 return VTABLE_get_string_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 494 key); 665 return VTABLE_get_string_keyed_str(INTERP, hash, key); 495 666 } 496 667 497 668 /* … … 513 684 */ 514 685 515 686 VTABLE INTVAL defined_keyed(PMC *key) { 516 if (!PARROT_CAPTURE(SELF)->hash) return 0; 517 return VTABLE_defined_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 687 PMC *hash; 688 689 GET_ATTR_hash(INTERP, SELF, hash); 690 691 if (!hash) 692 return 0; 693 694 return VTABLE_defined_keyed(INTERP, hash, key); 518 695 } 519 696 520 697 VTABLE INTVAL exists_keyed(PMC *key) { 521 if (!PARROT_CAPTURE(SELF)->hash) return 0; 522 return VTABLE_exists_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 698 PMC *hash; 699 700 GET_ATTR_hash(INTERP, SELF, hash); 701 702 if (!hash) 703 return 0; 704 705 return VTABLE_exists_keyed(INTERP, hash, key); 523 706 } 524 707 525 708 VTABLE void delete_keyed(PMC *key) { 526 if (PARROT_CAPTURE(SELF)->hash) 527 VTABLE_delete_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 709 PMC *hash; 710 711 GET_ATTR_hash(INTERP, SELF, hash); 712 713 if (hash) 714 VTABLE_delete_keyed(INTERP, hash, key); 528 715 } 529 716 530 717 /* … … 546 733 */ 547 734 548 735 VTABLE INTVAL defined_keyed_str(STRING *key) { 549 if (!PARROT_CAPTURE(SELF)->hash) return 0; 550 return VTABLE_defined_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, key); 736 PMC *hash; 737 738 GET_ATTR_hash(INTERP, SELF, hash); 739 740 if (!hash) 741 return 0; 742 return VTABLE_defined_keyed_str(INTERP, hash, key); 551 743 } 552 744 553 745 VTABLE INTVAL exists_keyed_str(STRING *key) { 554 if (!PARROT_CAPTURE(SELF)->hash) return 0; 555 return VTABLE_exists_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, key); 746 PMC *hash; 747 748 GET_ATTR_hash(INTERP, SELF, hash); 749 750 if (!hash) 751 return 0; 752 return VTABLE_exists_keyed_str(INTERP, hash, key); 556 753 } 557 754 558 755 VTABLE void delete_keyed_str(STRING *key) { 559 if (PARROT_CAPTURE(SELF)->hash) 560 VTABLE_delete_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, key); 756 PMC *hash; 757 758 GET_ATTR_hash(INTERP, SELF, hash); 759 760 if (hash) 761 VTABLE_delete_keyed_str(INTERP, hash, key); 561 762 } 562 763 563 764 /* … … 573 774 574 775 VTABLE void set_pmc(PMC *capture) { 575 776 if (PMC_IS_NULL(capture)) { 576 PARROT_CAPTURE(SELF)->array = NULL;577 PARROT_CAPTURE(SELF)->hash = NULL;777 SET_ATTR_array(INTERP, SELF, NULL); 778 SET_ATTR_hash(INTERP, SELF, NULL); 578 779 } 579 780 else if (VTABLE_isa(INTERP, capture, CONST_STRING(INTERP, "Capture"))) { 580 PARROT_CAPTURE(SELF)->array = PARROT_CAPTURE(capture)->array; 581 PARROT_CAPTURE(SELF)->hash = PARROT_CAPTURE(capture)->hash; 781 PMC *array, *hash; 782 GET_ATTR_array(INTERP, capture, array); 783 GET_ATTR_hash(INTERP, capture, hash); 784 SET_ATTR_array(INTERP, SELF, array); 785 SET_ATTR_hash(INTERP, SELF, hash); 582 786 } 583 787 else 584 788 Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION, … … 597 801 */ 598 802 599 803 VTABLE STRING *get_string() { 600 STRING *classname = VTABLE_name(INTERP, SELF);804 const STRING * const classname = VTABLE_name(INTERP, SELF); 601 805 return Parrot_sprintf_c(INTERP, "%S[0x%x]", classname, SELF); 602 806 } 603 807 … … 612 816 */ 613 817 614 818 VTABLE void mark() { 615 Parrot_Capture_attributes * const data = PARROT_CAPTURE(SELF); 616 if (!data) 617 return; 618 Parrot_gc_mark_PMC_alive(INTERP, data->array); 619 Parrot_gc_mark_PMC_alive(INTERP, data->hash); 819 PMC *array, *hash; 820 821 GET_ATTR_array(INTERP, SELF, array); 822 GET_ATTR_hash(INTERP, SELF, hash); 823 824 Parrot_gc_mark_PMC_alive(INTERP, array); 825 Parrot_gc_mark_PMC_alive(INTERP, hash); 620 826 } 621 827 622 828 /* … … 632 838 */ 633 839 634 840 METHOD list() { 635 PMC * capt_array;841 PMC *array; 636 842 PMC *capt = SELF; 843 637 844 /* XXX: This workaround is for when we get here as 638 845 part of a subclass of Capture */ 639 846 if (PObj_is_object_TEST(SELF)) { 640 STRING *attribute = CONST_STRING(interp, "proxy");641 847 PMC *classobj; 642 PMC *ns = INTERP->root_namespace; 643 ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "parrot")); 644 ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "Capture")); 645 classobj = Parrot_oo_get_class(INTERP, ns); 646 capt = VTABLE_get_attr_keyed(interp, SELF, classobj, attribute); 848 PMC *ns = INTERP->root_namespace; 849 STRING *attribute = CONST_STRING(INTERP, "proxy"); 850 851 ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "parrot")); 852 ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "Capture")); 853 classobj = Parrot_oo_get_class(INTERP, ns); 854 capt = VTABLE_get_attr_keyed(INTERP, SELF, classobj, attribute); 647 855 } 648 856 649 857 CAPTURE_array_CREATE(INTERP, capt); 650 capt_array = PARROT_CAPTURE(capt)->array;858 GET_ATTR_array(INTERP, capt, array); 651 859 652 RETURN(PMC * capt_array);860 RETURN(PMC *array); 653 861 } 654 862 655 863 METHOD hash() { 656 PMC * capt_hash;864 PMC *hash; 657 865 PMC *capt = SELF; 658 866 /* XXX: This workaround is for when we get here as 659 867 part of a subclass of Capture */ 660 868 if (PObj_is_object_TEST(SELF)) { 661 STRING *classname = CONST_STRING(INTERP, "Capture"); 662 PMC *classobj = Parrot_oo_get_class_str(INTERP, classname); 663 STRING *attribute = CONST_STRING(interp, "proxy"); 664 capt = VTABLE_get_attr_keyed(interp, SELF, classobj, attribute); 869 STRING * const classname = CONST_STRING(INTERP, "Capture"); 870 STRING *attribute = CONST_STRING(INTERP, "proxy"); 871 PMC *classobj = Parrot_oo_get_class_str(INTERP, classname); 872 873 capt = VTABLE_get_attr_keyed(INTERP, SELF, classobj, attribute); 665 874 } 875 666 876 CAPTURE_hash_CREATE(INTERP, capt); 667 capt_hash = PARROT_CAPTURE(capt)->hash; 668 RETURN(PMC *capt_hash); 877 GET_ATTR_hash(INTERP, capt, hash); 878 879 RETURN(PMC *hash); 669 880 } 670 881 671 882 }