| 618 | } |
| 619 | |
| 620 | void PiuContainer_empty(xsMachine *the) |
| 621 | { |
| 622 | PiuContainer* self = PIU(Container, xsThis); |
| 623 | xsIntegerValue c = xsToInteger(xsArgc); |
| 624 | xsIntegerValue start = 0; |
| 625 | xsIntegerValue stop = 0; |
| 626 | xsIntegerValue length; |
| 627 | xsAssert(self != NULL); |
| 628 | if ((c > 0) && xsTest(xsArg(0))) |
| 629 | start = xsToInteger(xsArg(0)); |
| 630 | if ((c > 1) && xsTest(xsArg(1))) |
| 631 | stop = xsToInteger(xsArg(1)); |
| 632 | length = PiuContainerCount(self); |
| 633 | if (start < 0) { |
| 634 | start += length; |
| 635 | if (start < 0) |
| 636 | start = 0; |
| 637 | } |
| 638 | else if (start > length) |
| 639 | start = length; |
| 640 | if (stop <= 0) { |
| 641 | stop += length; |
| 642 | if (stop < 0) |
| 643 | stop = 0; |
| 644 | } |
| 645 | else if (stop > length) |
| 646 | stop = length; |
| 647 | if (start < stop) { |
| 648 | PiuContent* content = (*self)->first; |
| 649 | PiuContent* previous = NULL; |
| 650 | PiuContent* next = NULL; |
| 651 | xsIntegerValue index = 0; |
| 652 | while (index < start) { |
| 653 | content = (*content)->next; |
| 654 | index++; |
| 655 | } |
| 656 | while (index < stop) { |
| 657 | PiuContentReflow(content, piuSizeChanged); |
| 658 | PiuContentInvalidate(content, NULL); |
| 659 | PiuContainerUnbindContent(self, content); |
| 660 | content = (*content)->next; |
| 661 | index++; |
| 662 | } |
| 663 | content = (*self)->first; |
| 664 | index = 0; |
| 665 | while (index < start) { |
| 666 | previous = content; |
| 667 | content = (*content)->next; |
| 668 | index++; |
| 669 | } |
| 670 | while (index < stop) { |
| 671 | next = (*content)->next; |
| 672 | (*content)->container = NULL; |
| 673 | (*content)->next = NULL; |
| 674 | (*content)->previous = NULL; |
| 675 | content = next; |
| 676 | index++; |
| 677 | } |
nothing calls this directly
no test coverage detected