Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 470 lines (293 sloc) 9.142 kb
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
1 /*
0e36289 @allisonrandal [cage] Updating all copyrights in src/ to Parrot Foundation.
allisonrandal authored
2 Copyright (C) 2001-2009, Parrot Foundation.
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
3 $Id$
4
5 =head1 NAME
6
f474cd7 @bschmalhofer [perl #38235] Rename (dyn)?classes to (dyn)?pmc
bschmalhofer authored
7 src/pmc/fixedfloatarray.pmc - fixed size array for floating point numbers only
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
8
9 =head1 DESCRIPTION
10
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
11 This class, FixedFloatArray, implements an array of fixed size which
12 stored FLOATVALs. It uses Float PMCs to do all necessary conversions.
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
13
14 =head2 Functions
15
16 =over 4
17
18 =cut
19
20 */
21
6b81760 @Whiteknight [pmc] we don't need need_ext anymore, so BALEETED
Whiteknight authored
22 pmclass FixedFloatArray auto_attrs provides array {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
23 ATTR INTVAL size;
24 ATTR FLOATVAL *float_array;
7298186 @particle pmc: convert Fixed*Array and Resizable*Array internal_exceptions to real...
particle authored
25
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
26 /*
27
28 =back
29
30 =head2 Methods
31
32 =over 4
33
34 =item C<void destroy()>
35
36 Destroys the array.
37
38 =cut
39
40 */
41
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
42 VTABLE void destroy() {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
43 FLOATVAL *float_array;
44 GET_ATTR_float_array(INTERP, SELF, float_array);
45 if (float_array)
4833868 @bacek Merge branch 'sys_mem' into trunk
bacek authored
46 mem_gc_free(INTERP, float_array);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
47 }
48
49 /*
50
714df2a @tewk VTABLE_init_int commented out tests
tewk authored
51 =item C<void init_int(INTVAL size)>
52
53 Initializes the array.
54
55 =cut
56
57 */
58
4d64842 @leto [t][TT#1509] Prevent core dumps by preventing negative length array crea...
leto authored
59 VTABLE void init_int(INTVAL size) {
60 if (size < 0)
61 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_OUT_OF_BOUNDS,
62 _("FixedFloatArray: Cannot set array size to a negative number (%d)"), size);
63 SET_ATTR_size(INTERP, SELF, size);
64 SET_ATTR_float_array(INTERP, SELF, mem_gc_allocate_n_typed(INTERP, size, FLOATVAL));
714df2a @tewk VTABLE_init_int commented out tests
tewk authored
65 PObj_custom_destroy_SET(SELF);
66 }
67
68 /*
69
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
70 =item C<PMC *clone()>
71
72 Creates and returns a copy of the array.
73
74 =cut
75
76 */
77
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
78 VTABLE PMC *clone() {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
79 INTVAL size;
80 FLOATVAL *self_float_array, *dest_float_array;
cc7c3b2 @pmichaud [core]:
pmichaud authored
81 size_t mem_size;
083213a @Whiteknight start rename of pmc_new to Parrot_pmc_new
Whiteknight authored
82 PMC * const dest = Parrot_pmc_new(INTERP, SELF->vtable->base_type);
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
83 GET_ATTR_float_array(INTERP, SELF, self_float_array);
7298186 @particle pmc: convert Fixed*Array and Resizable*Array internal_exceptions to real...
particle authored
84
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
85 if (!self_float_array)
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
86 return dest;
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
87
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
88 GET_ATTR_size(INTERP, SELF, size);
89 SET_ATTR_size(INTERP, dest, size);
cc7c3b2 @pmichaud [core]:
pmichaud authored
90 mem_size = size * sizeof (FLOATVAL);
7298186 @particle pmc: convert Fixed*Array and Resizable*Array internal_exceptions to real...
particle authored
91
4833868 @bacek Merge branch 'sys_mem' into trunk
bacek authored
92 dest_float_array = (FLOATVAL*)Parrot_gc_allocate_memory_chunk(INTERP, mem_size);
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
93 mem_sys_memcopy(dest_float_array, self_float_array, mem_size);
94 SET_ATTR_float_array(INTERP, dest, dest_float_array);
4591dbb @chromatic [HLL] Fixed two compilation-breaking typos accidentally committed in r40...
chromatic authored
95 PObj_custom_destroy_SET(dest);
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
96
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
97 return dest;
98 }
99
100 /*
101
c2b50bf @cotto [PMC] add get_iter + tests to *FloatArray
cotto authored
102 =item C<PMC *get_iter()>
103
104 Return an Iterator for this PMC.
105
106 =cut
107
108 */
109
110 VTABLE PMC *get_iter() {
083213a @Whiteknight start rename of pmc_new to Parrot_pmc_new
Whiteknight authored
111 return Parrot_pmc_new_init(INTERP, enum_class_ArrayIterator, SELF);
c2b50bf @cotto [PMC] add get_iter + tests to *FloatArray
cotto authored
112 }
113
114 /*
115
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
116 =item C<INTVAL get_bool()>
117
118 Returns whether the array has any elements (meaning been initialized, for a
119 fixed sized array).
120
121 =cut
122
123 */
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
124 VTABLE INTVAL get_bool() {
a35f6fd @petdance consting & localizing
petdance authored
125 const INTVAL size = SELF.elements();
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
126 return (INTVAL)(size != 0);
127 }
128
129 /*
130
131 =item C<INTVAL elements()>
132
133 =cut
134
135 */
136
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
137 VTABLE INTVAL elements() {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
138 INTVAL size;
139 GET_ATTR_size(INTERP, SELF, size);
140 return size;
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
141 }
142
143 /*
144
145 =item C<INTVAL get_integer()>
146
147 Returns the number of elements in the array.
148
149 =cut
150
151 */
152
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
153 VTABLE INTVAL get_integer() {
ae8baa5 @bschmalhofer DYNDYNSELF in the Fixed*Array PMC looks like a typo. Using SELF propably
bschmalhofer authored
154 return SELF.elements();
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
155 }
156
157
158 /*
159
160 =item C<INTVAL get_integer_keyed_int(INTVAL key)>
161
162 Returns the integer value of the element at index C<key>.
163
164 =cut
165
166 */
167
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
168 VTABLE INTVAL get_integer_keyed_int(INTVAL key) {
169 const FLOATVAL f = SELF.get_number_keyed_int(key);
8275ff5 @chromatic [PMC] Fixed a couple of casting warnings of function return values.
chromatic authored
170 return (INTVAL)f;
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
171 }
172
173 /*
174
175 =item C<INTVAL get_integer_keyed(PMC *key)>
176
177 Returns the integer value of the element at index C<*key>.
178
179 =cut
180
181 */
182
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
183 VTABLE INTVAL get_integer_keyed(PMC *key) {
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
184 /* simple int keys only */
757f3a8 @chromatic [PMC] Replaced all uses of key_integer() outside of Key PMC and src/key....
chromatic authored
185 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
186 return SELF.get_integer_keyed_int(k);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
187 }
188
189
190 /*
191
192 =item C<FLOATVAL get_number_keyed_int(INTVAL key)>
193
194 Returns the floating-point value of the element at index C<key>.
195
196 =cut
197
198 */
199
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
200 VTABLE FLOATVAL get_number_keyed_int(INTVAL key) {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
201 FLOATVAL *float_array;
202 INTVAL size;
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
203
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
204 GET_ATTR_size(INTERP, SELF, size);
205 if (key < 0 || key >= size)
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored
206 Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
d185452 @chromatic Standardize internal exception calls (James deBoer, james at huronbox do...
chromatic authored
207 "FixedFloatArray: index out of bounds!");
7298186 @particle pmc: convert Fixed*Array and Resizable*Array internal_exceptions to real...
particle authored
208
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
209 GET_ATTR_float_array(INTERP, SELF, float_array);
210 return float_array[key];
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
211 }
212
213 /*
214
95e3676 @Infinoid [pmc] PDD07-ize function signatures in src/pmc/[b-f]*.pmc
Infinoid authored
215 =item C<FLOATVAL get_number_keyed(PMC *key)>
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
216
217 Returns the floating-point value of the element at index C<*key>.
218
219 =cut
220
221 */
222
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
223 VTABLE FLOATVAL get_number_keyed(PMC *key) {
757f3a8 @chromatic [PMC] Replaced all uses of key_integer() outside of Key PMC and src/key....
chromatic authored
224 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
225 return SELF.get_number_keyed_int(k);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
226 }
227
228 /*
229
230 =item C<STRING *get_string_keyed_int(INTVAL key)>
231
232 Returns the Parrot string value of the element at index C<key>.
233
234 =cut
235
236 */
237
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
238 VTABLE STRING *get_string_keyed_int(INTVAL key) {
239 PMC * const e = SELF.get_pmc_keyed_int(key);
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
240 return VTABLE_get_string(INTERP, e);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
241 }
242
243 /*
244
245 =item C<STRING *get_string_keyed(PMC *key)>
246
247 Returns the Parrot string value of the element at index C<*key>.
248
249 =cut
250
251 */
252
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
253 VTABLE STRING *get_string_keyed(PMC *key) {
757f3a8 @chromatic [PMC] Replaced all uses of key_integer() outside of Key PMC and src/key....
chromatic authored
254 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
255 return SELF.get_string_keyed_int(k);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
256 }
257
258
259 /*
260
261 =item C<PMC *get_pmc_keyed_int(INTVAL key)>
262
263 Returns the PMC value of the element at index C<key>.
264
265 =cut
266
267 */
268
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
269 VTABLE PMC *get_pmc_keyed_int(INTVAL key) {
083213a @Whiteknight start rename of pmc_new to Parrot_pmc_new
Whiteknight authored
270 PMC * const ret = Parrot_pmc_new(INTERP, enum_class_Float);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
271 const FLOATVAL val = SELF.get_number_keyed_int(key);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
272
273 VTABLE_set_number_native(INTERP, ret, val);
274 return ret;
275 }
276
277 /*
278
279 =item C<PMC *get_pmc_keyed(PMC *key)>
280
281 Returns the PMC value of the element at index C<*key>.
282
283 =cut
284
285 */
286
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
287 VTABLE PMC *get_pmc_keyed(PMC *key) {
757f3a8 @chromatic [PMC] Replaced all uses of key_integer() outside of Key PMC and src/key....
chromatic authored
288 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
289 return SELF.get_pmc_keyed_int(k);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
290 }
291
292 /*
293
294 =item C<void set_integer_native(INTVAL size)>
295
296 Resizes the array to C<size> elements.
297
298 =cut
299
300 */
301
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
302 VTABLE void set_integer_native(INTVAL new_size) {
303 INTVAL old_size;
304 GET_ATTR_size(INTERP, SELF, old_size);
305 if (old_size || new_size < 1)
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored
306 Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
7298186 @particle pmc: convert Fixed*Array and Resizable*Array internal_exceptions to real...
particle authored
307 "FixedFloatArray: Can't resize!");
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
308
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
309 SET_ATTR_size(INTERP, SELF, new_size);
1bc2b58 @bschmalhofer [codingstd] trailing_space.t
bschmalhofer authored
310 SET_ATTR_float_array(INTERP, SELF,
4833868 @bacek Merge branch 'sys_mem' into trunk
bacek authored
311 mem_gc_allocate_n_typed(INTERP, new_size, FLOATVAL));
4591dbb @chromatic [HLL] Fixed two compilation-breaking typos accidentally committed in r40...
chromatic authored
312 PObj_custom_destroy_SET(SELF);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
313 }
314
315 /*
316
317 =item C<void set_integer_keyed_int(INTVAL key, INTVAL value)>
318
319 Sets the integer value of the element at index C<key> to C<value>.
320
321 =cut
322
323 */
324
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
325 VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) {
326 SELF.set_number_keyed_int(key, (FLOATVAL)value);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
327 }
328
329 /*
330
331 =item C<void set_integer_keyed(PMC *key, INTVAL value)>
332
333 Sets the integer value of the element at index C<key> to C<value>.
334
335 =cut
336
337 */
338
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
339 VTABLE void set_integer_keyed(PMC *key, INTVAL value) {
757f3a8 @chromatic [PMC] Replaced all uses of key_integer() outside of Key PMC and src/key....
chromatic authored
340 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
341 SELF.set_integer_keyed_int(k, value);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
342 }
343
344 /*
345
346 =item C<void set_number_keyed_int(INTVAL key, FLOATVAL value)>
347
348 Sets the floating-point value of the element at index C<key> to
349 C<value>.
350
351 =cut
352
353 */
354
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
355 VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL value) {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
356 FLOATVAL *float_array;
357 INTVAL size;
358
359 GET_ATTR_size(INTERP, SELF, size);
360 if (key < 0 || key >= size)
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored
361 Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
d185452 @chromatic Standardize internal exception calls (James deBoer, james at huronbox do...
chromatic authored
362 "FixedFloatArray: index out of bounds!");
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
363
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
364 GET_ATTR_float_array(INTERP, SELF, float_array);
365 float_array[key] = value;
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
366 }
367
368 /*
369
370 =item C<void set_number_keyed(PMC *key, FLOATVAL value)>
371
372 Sets the floating-point value of the element at index C<key> to
373 C<value>.
374
375 =cut
376
377 */
378
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
379 VTABLE void set_number_keyed(PMC *key, FLOATVAL value) {
757f3a8 @chromatic [PMC] Replaced all uses of key_integer() outside of Key PMC and src/key....
chromatic authored
380 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
381 SELF.set_number_keyed_int(k, value);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
382 }
7298186 @particle pmc: convert Fixed*Array and Resizable*Array internal_exceptions to real...
particle authored
383
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
384 /*
385
386 =item C<void set_string_keyed_int(INTVAL key, STRING *value)>
387
388 Sets the Parrot string value of the element at index C<key> to C<value>.
389
390 =cut
391
392 */
393
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
394 VTABLE void set_string_keyed_int(INTVAL key, STRING *value) {
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
395 FLOATVAL tempNum;
083213a @Whiteknight start rename of pmc_new to Parrot_pmc_new
Whiteknight authored
396 PMC * const tempPMC = Parrot_pmc_new(INTERP, enum_class_Float);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
397
398 VTABLE_set_string_native(INTERP, tempPMC, value);
399 tempNum = VTABLE_get_number(INTERP, tempPMC);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
400 SELF.set_number_keyed_int(key, tempNum);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
401 }
402
403 /*
404
95e3676 @Infinoid [pmc] PDD07-ize function signatures in src/pmc/[b-f]*.pmc
Infinoid authored
405 =item C<void set_string_keyed(PMC *key, STRING *value)>
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
406
407 Sets the string value of the element at index C<key> to
408 C<value>.
409
410 =cut
411
412 */
413
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
414 VTABLE void set_string_keyed(PMC *key, STRING *value) {
757f3a8 @chromatic [PMC] Replaced all uses of key_integer() outside of Key PMC and src/key....
chromatic authored
415 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
416 SELF.set_string_keyed_int(k, value);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
417 }
418
419 /*
420
421 =item C<void set_pmc_keyed_int(INTVAL key, PMC *src)>
422
423 Sets the PMC value of the element at index C<key> to C<*src>.
424
425 =cut
426
427 */
428
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
429 VTABLE void set_pmc_keyed_int(INTVAL key, PMC *src) {
a35f6fd @petdance consting & localizing
petdance authored
430 const FLOATVAL tempNum = VTABLE_get_number(INTERP, src);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
431 SELF.set_number_keyed_int(key, tempNum);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
432 }
433
434 /*
435
95e3676 @Infinoid [pmc] PDD07-ize function signatures in src/pmc/[b-f]*.pmc
Infinoid authored
436 =item C<void set_pmc_keyed(PMC *key, PMC *value)>
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
437
438 Sets the string value of the element at index C<key> to
439 C<value>.
440
441 =cut
442
443 */
444
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
445 VTABLE void set_pmc_keyed(PMC *key, PMC *value) {
757f3a8 @chromatic [PMC] Replaced all uses of key_integer() outside of Key PMC and src/key....
chromatic authored
446 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
447 SELF.set_pmc_keyed_int(k, value);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
448 }
449
450 }
451
452 /*
453
454 =back
455
456 =head1 SEE ALSO
457
1e8a4ab this patch adds some relevant 'push' ops to the resizable PMCs, describe...
Dan Sugalski authored
458 F<docs/pdds/pdd17_basic_types.pod>.
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
459
460 =cut
461
462 */
463
464 /*
465 * Local variables:
72575ae @bschmalhofer #40481: [PATCH] C-code coda in pmc files
bschmalhofer authored
466 * c-file-style: "parrot"
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
467 * End:
468 * vim: expandtab shiftwidth=4:
72575ae @bschmalhofer #40481: [PATCH] C-code coda in pmc files
bschmalhofer authored
469 */
Something went wrong with that request. Please try again.