~ubuntu-branches/ubuntu/wily/parrot/wily-proposed

« back to all changes in this revision

Viewing changes to src/pmc/resizablepmcarray.pmc

  • Committer: Package Import Robot
  • Author(s): Dominique Dumont
  • Date: 2014-04-26 08:41:44 UTC
  • mfrom: (1.1.20)
  • Revision ID: package-import@ubuntu.com-20140426084144-ycocevtjth7nij5s
Tags: 6.3.0-1
ImportedĀ UpstreamĀ versionĀ 6.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
This class, ResizablePMCArray, implements an resizable array which stores PMCs.
11
11
It puts things into Integer, Float, or String PMCs as appropriate.
12
12
 
13
 
=head2 Vtable Functions
 
13
=head2 Internal Functions
14
14
 
15
15
=over 4
16
16
 
57
57
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
58
58
/* HEADERIZER END: static */
59
59
 
 
60
/*
 
61
 
 
62
=item C<inline static void do_shift(ARGIN(PMC *arr))>
 
63
 
 
64
Removes and returns an item from the start of the array.
 
65
Moves the whole rest of the array around.
 
66
 
 
67
=cut
 
68
 
 
69
*/
60
70
PARROT_INLINE
61
71
static void
62
72
do_shift(ARGIN(PMC *arr))
70
80
    item[size] = PMCNULL;
71
81
}
72
82
 
 
83
/*
 
84
 
 
85
=item C<inline static void do_unshift(ARGIN(PMC *arr))>
 
86
 
 
87
Adds an item at the start of the array.
 
88
Moves the whole rest of the array around.
 
89
 
 
90
=cut
 
91
 
 
92
*/
73
93
PARROT_INLINE
74
94
static void
75
95
do_unshift(PARROT_INTERP, ARGIN(PMC *arr), ARGIN(PMC *val))
83
103
    memmove(item + 1, item, size * sizeof (PMC *));
84
104
    item[0] = val;
85
105
}
86
 
 
 
106
/*
 
107
 
 
108
=back
 
109
 
 
110
=head1 Vtable Functions
 
111
 
 
112
=over
 
113
 
 
114
=cut
 
115
 
 
116
*/
87
117
 
88
118
pmclass ResizablePMCArray extends FixedPMCArray auto_attrs provides array {
89
119
    ATTR INTVAL resize_threshold; /* max size before array needs resizing */