Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 481 lines (300 sloc) 9.298 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
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
22 pmclass FixedFloatArray need_ext 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 init()>
35
36 Initializes 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 init() {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
43 Parrot_FixedFloatArray_attributes* attrs =
44 mem_allocate_zeroed_typed(Parrot_FixedFloatArray_attributes);
45 PMC_data(SELF) = attrs;
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
46 }
47
48 /*
49
50 =item C<void destroy()>
51
52 Destroys the array.
53
54 =cut
55
56 */
57
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
58 VTABLE void destroy() {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
59 FLOATVAL *float_array;
60 GET_ATTR_float_array(INTERP, SELF, float_array);
61 if (float_array)
62 mem_sys_free(float_array);
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
63
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
64 mem_sys_free(PMC_data(SELF));
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
65 }
66
67 /*
68
69 =item C<PMC *clone()>
70
71 Creates and returns a copy of the array.
72
73 =cut
74
75 */
76
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
77 VTABLE PMC *clone() {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
78 INTVAL size;
79 FLOATVAL *self_float_array, *dest_float_array;
cc7c3b2 @pmichaud [core]:
pmichaud authored
80 size_t mem_size;
a35f6fd @petdance consting & localizing
petdance authored
81 PMC * const dest = pmc_new(INTERP, SELF->vtable->base_type);
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
82 GET_ATTR_float_array(INTERP, SELF, self_float_array);
7298186 @particle pmc: convert Fixed*Array and Resizable*Array internal_exceptions to real...
particle authored
83
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
84 if (!self_float_array)
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
85 return dest;
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
86
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
87 GET_ATTR_size(INTERP, SELF, size);
88 SET_ATTR_size(INTERP, dest, size);
cc7c3b2 @pmichaud [core]:
pmichaud authored
89 mem_size = size * sizeof (FLOATVAL);
7298186 @particle pmc: convert Fixed*Array and Resizable*Array internal_exceptions to real...
particle authored
90
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
91 dest_float_array = (FLOATVAL*)mem_sys_allocate(mem_size);
92 mem_sys_memcopy(dest_float_array, self_float_array, mem_size);
93 SET_ATTR_float_array(INTERP, dest, dest_float_array);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
94 PObj_active_destroy_SET(dest);
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
95
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
96 return dest;
97 }
98
99 /*
100
c2b50bf @cotto [PMC] add get_iter + tests to *FloatArray
cotto authored
101 =item C<PMC *get_iter()>
102
103 Return an Iterator for this PMC.
104
105 =cut
106
107 */
108
109 VTABLE PMC *get_iter() {
110 STRING *name = CONST_STRING(interp, "set_key");
111 PMC * const iter = pmc_new_init(INTERP, enum_class_Iterator, SELF);
112 PMC * const key = pmc_new(INTERP, enum_class_Key);
113
114 Parrot_PCCINVOKE(interp, iter, name, "P->", key);
115 PObj_get_FLAGS(key) |= KEY_integer_FLAG;
116
117 if (SELF.get_integer() == 0)
118 VTABLE_set_integer_native(INTERP, key, -1);
119 else
120 VTABLE_set_integer_native(INTERP, key, 0);
121
122 return iter;
123 }
124
125 /*
126
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
127 =item C<INTVAL get_bool()>
128
129 Returns whether the array has any elements (meaning been initialized, for a
130 fixed sized array).
131
132 =cut
133
134 */
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
135 VTABLE INTVAL get_bool() {
a35f6fd @petdance consting & localizing
petdance authored
136 const INTVAL size = SELF.elements();
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
137 return (INTVAL)(size != 0);
138 }
139
140 /*
141
142 =item C<INTVAL elements()>
143
144 =cut
145
146 */
147
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
148 VTABLE INTVAL elements() {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
149 INTVAL size;
150 GET_ATTR_size(INTERP, SELF, size);
151 return size;
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
152 }
153
154 /*
155
156 =item C<INTVAL get_integer()>
157
158 Returns the number of elements in the array.
159
160 =cut
161
162 */
163
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
164 VTABLE INTVAL get_integer() {
ae8baa5 @bschmalhofer DYNDYNSELF in the Fixed*Array PMC looks like a typo. Using SELF propably
bschmalhofer authored
165 return SELF.elements();
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
166 }
167
168
169 /*
170
171 =item C<INTVAL get_integer_keyed_int(INTVAL key)>
172
173 Returns the integer value of the element at index C<key>.
174
175 =cut
176
177 */
178
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
179 VTABLE INTVAL get_integer_keyed_int(INTVAL key) {
180 const FLOATVAL f = SELF.get_number_keyed_int(key);
8275ff5 @chromatic [PMC] Fixed a couple of casting warnings of function return values.
chromatic authored
181 return (INTVAL)f;
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
182 }
183
184 /*
185
186 =item C<INTVAL get_integer_keyed(PMC *key)>
187
188 Returns the integer value of the element at index C<*key>.
189
190 =cut
191
192 */
193
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
194 VTABLE INTVAL get_integer_keyed(PMC *key) {
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
195 /* simple int keys only */
757f3a8 @chromatic [PMC] Replaced all uses of key_integer() outside of Key PMC and src/key....
chromatic authored
196 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
197 return SELF.get_integer_keyed_int(k);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
198 }
199
200
201 /*
202
203 =item C<FLOATVAL get_number_keyed_int(INTVAL key)>
204
205 Returns the floating-point value of the element at index C<key>.
206
207 =cut
208
209 */
210
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
211 VTABLE FLOATVAL get_number_keyed_int(INTVAL key) {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
212 FLOATVAL *float_array;
213 INTVAL size;
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
214
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
215 GET_ATTR_size(INTERP, SELF, size);
216 if (key < 0 || key >= size)
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored
217 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
218 "FixedFloatArray: index out of bounds!");
7298186 @particle pmc: convert Fixed*Array and Resizable*Array internal_exceptions to real...
particle authored
219
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
220 GET_ATTR_float_array(INTERP, SELF, float_array);
221 return float_array[key];
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
222 }
223
224 /*
225
95e3676 @Infinoid [pmc] PDD07-ize function signatures in src/pmc/[b-f]*.pmc
Infinoid authored
226 =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
227
228 Returns the floating-point value of the element at index C<*key>.
229
230 =cut
231
232 */
233
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
234 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
235 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
236 return SELF.get_number_keyed_int(k);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
237 }
238
239 /*
240
241 =item C<STRING *get_string_keyed_int(INTVAL key)>
242
243 Returns the Parrot string value of the element at index C<key>.
244
245 =cut
246
247 */
248
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
249 VTABLE STRING *get_string_keyed_int(INTVAL key) {
250 PMC * const e = SELF.get_pmc_keyed_int(key);
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
251 return VTABLE_get_string(INTERP, e);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
252 }
253
254 /*
255
256 =item C<STRING *get_string_keyed(PMC *key)>
257
258 Returns the Parrot string value of the element at index C<*key>.
259
260 =cut
261
262 */
263
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
264 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
265 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
266 return SELF.get_string_keyed_int(k);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
267 }
268
269
270 /*
271
272 =item C<PMC *get_pmc_keyed_int(INTVAL key)>
273
274 Returns the PMC value of the element at index C<key>.
275
276 =cut
277
278 */
279
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
280 VTABLE PMC *get_pmc_keyed_int(INTVAL key) {
281 PMC * const ret = pmc_new(INTERP, enum_class_Float);
282 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
283
284 VTABLE_set_number_native(INTERP, ret, val);
285 return ret;
286 }
287
288 /*
289
290 =item C<PMC *get_pmc_keyed(PMC *key)>
291
292 Returns the PMC value of the element at index C<*key>.
293
294 =cut
295
296 */
297
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
298 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
299 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
300 return SELF.get_pmc_keyed_int(k);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
301 }
302
303 /*
304
305 =item C<void set_integer_native(INTVAL size)>
306
307 Resizes the array to C<size> elements.
308
309 =cut
310
311 */
312
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
313 VTABLE void set_integer_native(INTVAL new_size) {
314 INTVAL old_size;
315 GET_ATTR_size(INTERP, SELF, old_size);
316 if (old_size || new_size < 1)
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored
317 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
318 "FixedFloatArray: Can't resize!");
f6d5c3e @chromatic [PMC] More minor cleanups and reformattings.
chromatic authored
319
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
320 SET_ATTR_size(INTERP, SELF, new_size);
1bc2b58 @bschmalhofer [codingstd] trailing_space.t
bschmalhofer authored
321 SET_ATTR_float_array(INTERP, SELF,
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
322 mem_allocate_n_typed(new_size, FLOATVAL));
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
323 PObj_active_destroy_SET(SELF);
324 }
325
326 /*
327
328 =item C<void set_integer_keyed_int(INTVAL key, INTVAL value)>
329
330 Sets the integer value of the element at index C<key> to C<value>.
331
332 =cut
333
334 */
335
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
336 VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) {
337 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
338 }
339
340 /*
341
342 =item C<void set_integer_keyed(PMC *key, INTVAL value)>
343
344 Sets the integer value of the element at index C<key> to C<value>.
345
346 =cut
347
348 */
349
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
350 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
351 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
352 SELF.set_integer_keyed_int(k, value);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
353 }
354
355 /*
356
357 =item C<void set_number_keyed_int(INTVAL key, FLOATVAL value)>
358
359 Sets the floating-point value of the element at index C<key> to
360 C<value>.
361
362 =cut
363
364 */
365
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
366 VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL value) {
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
367 FLOATVAL *float_array;
368 INTVAL size;
369
370 GET_ATTR_size(INTERP, SELF, size);
371 if (key < 0 || key >= size)
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored
372 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
373 "FixedFloatArray: index out of bounds!");
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
374
a638c12 @cotto [pmc] get rid of UnionVal in *FloatArray
cotto authored
375 GET_ATTR_float_array(INTERP, SELF, float_array);
376 float_array[key] = value;
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
377 }
378
379 /*
380
381 =item C<void set_number_keyed(PMC *key, FLOATVAL value)>
382
383 Sets the floating-point value of the element at index C<key> to
384 C<value>.
385
386 =cut
387
388 */
389
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
390 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
391 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
392 SELF.set_number_keyed_int(k, value);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
393 }
7298186 @particle pmc: convert Fixed*Array and Resizable*Array internal_exceptions to real...
particle authored
394
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
395 /*
396
397 =item C<void set_string_keyed_int(INTVAL key, STRING *value)>
398
399 Sets the Parrot string value of the element at index C<key> to C<value>.
400
401 =cut
402
403 */
404
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
405 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
406 FLOATVAL tempNum;
a35f6fd @petdance consting & localizing
petdance authored
407 PMC * const tempPMC = pmc_new(INTERP, enum_class_Float);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
408
409 VTABLE_set_string_native(INTERP, tempPMC, value);
410 tempNum = VTABLE_get_number(INTERP, tempPMC);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
411 SELF.set_number_keyed_int(key, tempNum);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
412 }
413
414 /*
415
95e3676 @Infinoid [pmc] PDD07-ize function signatures in src/pmc/[b-f]*.pmc
Infinoid authored
416 =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
417
418 Sets the string value of the element at index C<key> to
419 C<value>.
420
421 =cut
422
423 */
424
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
425 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
426 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
427 SELF.set_string_keyed_int(k, value);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
428 }
429
430 /*
431
432 =item C<void set_pmc_keyed_int(INTVAL key, PMC *src)>
433
434 Sets the PMC value of the element at index C<key> to C<*src>.
435
436 =cut
437
438 */
439
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
440 VTABLE void set_pmc_keyed_int(INTVAL key, PMC *src) {
a35f6fd @petdance consting & localizing
petdance authored
441 const FLOATVAL tempNum = VTABLE_get_number(INTERP, src);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
442 SELF.set_number_keyed_int(key, tempNum);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
443 }
444
445 /*
446
95e3676 @Infinoid [pmc] PDD07-ize function signatures in src/pmc/[b-f]*.pmc
Infinoid authored
447 =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
448
449 Sets the string value of the element at index C<key> to
450 C<value>.
451
452 =cut
453
454 */
455
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
456 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
457 const INTVAL k = VTABLE_get_integer(INTERP, key);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
458 SELF.set_pmc_keyed_int(k, value);
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
459 }
460
461 }
462
463 /*
464
465 =back
466
467 =head1 SEE ALSO
468
1e8a4ab this patch adds some relevant 'push' ops to the resizable PMCs, describe...
Dan Sugalski authored
469 F<docs/pdds/pdd17_basic_types.pod>.
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
470
471 =cut
472
473 */
474
475 /*
476 * Local variables:
72575ae @bschmalhofer #40481: [PATCH] C-code coda in pmc files
bschmalhofer authored
477 * c-file-style: "parrot"
4498fea This patch adds the above Fixed*Array classes. They are basic tests for
Dan Sugalski authored
478 * End:
479 * vim: expandtab shiftwidth=4:
72575ae @bschmalhofer #40481: [PATCH] C-code coda in pmc files
bschmalhofer authored
480 */
Something went wrong with that request. Please try again.