Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 1415 lines (1017 sloc) 29.431 kb
3e1f322 Inline docs update
Michael Scott authored
1 /*
2cb7950 @allisonrandal [cage] Copyright updates in src/ directory.
allisonrandal authored
2 Copyright (C) 2001-2007, Parrot Foundation.
3e1f322 Inline docs update
Michael Scott authored
3 $Id$
4
5 =head1 NAME
6
7 src/extend.c - Parrot extension interface
8
9 =head1 DESCRIPTION
99b337c start of actual extension routines and docs
Dan Sugalski authored
10
3e1f322 Inline docs update
Michael Scott authored
11 These are the functions that parrot extensions (i.e. parrot subroutines
12 written in C, or some other compiled language, rather than in parrot
13 bytecode) may access.
14
15 There is a deliberate distancing from the internals here. Don't go
16 peeking inside -- you've as much access as bytecode does, but no more,
17 so we can provide backwards compatibility for as long as we possibly
18 can.
19
20 =head2 Functions
21
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
22 =over 4
23
24 =cut
25
3e1f322 Inline docs update
Michael Scott authored
26 */
99b337c start of actual extension routines and docs
Dan Sugalski authored
27
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
28 /* Some internal notes. Parrot will die a horrible and bizarre death
e1f3d50 @cotto [gc] replace/remove "DOD" in comments in most files in src/
cotto authored
29 if the stack start pointer's not set and a GC run is
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
30 triggered. The pointer *will* be set by the interpreter if the
31 interpreter calls code which calls these functions, so most
32 extension code is safe, no problem.
33
34 The problem comes in if these routines are called from *outside*
35 an interpreter. This happens when an embedding application calls
36 them to do stuff with PMCs, STRINGS, interpreter contents, and
37 suchlike things. This is perfectly legal -- in fact it's what
38 we've documented should be done -- but the problem is that the
39 stack base pointer will be NULL. This is Very Bad.
40
41 To deal with this there are two macros that are defined to handle
42 the problem.
43
3240c6e @chipdude Consistently name interpreter "interp" instead of "interpreter".
chipdude authored
44 PARROT_CALLIN_START(interp) will figure out if the stack
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
45 anchor needs setting and, if so, will set it. It must *always*
46 come immediately after the last variable declared in the block
47 making the calls into the interpreter, as it declares a variable
48 and has some code.
49
3240c6e @chipdude Consistently name interpreter "interp" instead of "interpreter".
chipdude authored
50 PARROT_CALLIN_END(interp) will put the stack anchor back to
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
51 the way it was, and should always be the last statement before a
52 return. (If you have multiple returns have it in multiple times)
53
54 Not doing this is a good way to introduce bizarre heisenbugs, so
55 just do it. This is the only place they ought to have to be put
56 in, and most of the functions are already written, so it's not
57 like it's an onerous requirement.
58
59 */
60
99b337c start of actual extension routines and docs
Dan Sugalski authored
61 #include "parrot/parrot.h"
62 #include "parrot/extend.h"
63889c2 @cotto [PMC] replace PMC_struct_val and derivatives with ATTR accessors for the...
cotto authored
63 #include "pmc/pmc_sub.h"
68bf472 @bacek Merge context_unify3_simple branch back to trunk.
bacek authored
64 #include "pmc/pmc_callcontext.h"
99b337c start of actual extension routines and docs
Dan Sugalski authored
65
490c1c6 @petdance Changed HEADERIZER TARGET to HEADERIZER HFILE
petdance authored
66 /* HEADERIZER HFILE: include/parrot/extend.h */
df5e1a1 @petdance lie to the headerizer
petdance authored
67
3e1f322 Inline docs update
Michael Scott authored
68 /*
69
4dc854f @coke [cage] run 'make headerizer'
coke authored
70 =item C<int Parrot_vfprintf(PARROT_INTERP, Parrot_PMC pio, const char *s,
71 va_list args)>
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
72
73 Writes a C string format with a varargs list to a PIO.
74
4dc854f @coke [cage] run 'make headerizer'
coke authored
75 =item C<int Parrot_fprintf(PARROT_INTERP, Parrot_PMC pio, const char *s, ...)>
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
76
77 Writes a C string format with varargs to a PIO.
78
4dc854f @coke [cage] run 'make headerizer'
coke authored
79 =item C<int Parrot_printf(NULLOK_INTERP, const char *s, ...)>
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
80
81 Writes a C string format with varargs to C<stdout>.
82
4dc854f @coke [cage] run 'make headerizer'
coke authored
83 =item C<int Parrot_eprintf(NULLOK_INTERP, const char *s, ...)>
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
84
85 Writes a C string format with varargs to C<stderr>.
86
fb2ca1e @NotFound fix lack of cut in a pod comment
NotFound authored
87 =cut
88
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
89 */
90
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
91 PARROT_EXPORT
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
92 int
93 Parrot_vfprintf(PARROT_INTERP, ARGIN(Parrot_PMC pio),
94 ARGIN(const char *s), va_list args)
95 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
96 ASSERT_ARGS(Parrot_vfprintf)
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
97 STRING * str;
98 INTVAL retval;
99
100 PARROT_CALLIN_START(interp);
101 str = Parrot_vsprintf_c(interp, s, args);
9f9cea2 @allisonrandal [pdd22io] Merging the pdd22io_part2 branch into trunk for r32922 to r336...
allisonrandal authored
102 retval = Parrot_io_putps(interp, pio, str);
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
103 PARROT_CALLIN_END(interp);
104
105 return retval;
106 }
107
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
108 PARROT_EXPORT
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
109 int
110 Parrot_fprintf(PARROT_INTERP, ARGIN(Parrot_PMC pio),
111 ARGIN(const char *s), ...)
112 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
113 ASSERT_ARGS(Parrot_fprintf)
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
114 va_list args;
115 INTVAL retval;
116
117 va_start(args, s);
118 retval = Parrot_vfprintf(interp, pio, s, args);
119 va_end(args);
120
121 return retval;
122 }
123
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
124 PARROT_EXPORT
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
125 int
126 Parrot_printf(NULLOK_INTERP, ARGIN(const char *s), ...)
127 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
128 ASSERT_ARGS(Parrot_printf)
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
129 va_list args;
130 INTVAL retval;
131 va_start(args, s);
132
133 if (interp) {
9f9cea2 @allisonrandal [pdd22io] Merging the pdd22io_part2 branch into trunk for r32922 to r336...
allisonrandal authored
134 retval = Parrot_vfprintf(interp, Parrot_io_STDOUT(interp), s, args);
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
135 }
136 else {
137 /* Be nice about this...
9f9cea2 @allisonrandal [pdd22io] Merging the pdd22io_part2 branch into trunk for r32922 to r336...
allisonrandal authored
138 ** XXX BD Should this use the default Parrot_io_STDOUT or something?
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
139 */
140 retval = vfprintf(stdout, s, args);
141 }
142 va_end(args);
143
144 return retval;
145 }
146
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
147 PARROT_EXPORT
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
148 int
149 Parrot_eprintf(NULLOK_INTERP, ARGIN(const char *s), ...)
150 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
151 ASSERT_ARGS(Parrot_eprintf)
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
152 va_list args;
153 INTVAL retval;
154
155 va_start(args, s);
156
157 if (interp) {
9f9cea2 @allisonrandal [pdd22io] Merging the pdd22io_part2 branch into trunk for r32922 to r336...
allisonrandal authored
158 retval = Parrot_vfprintf(interp, Parrot_io_STDERR(interp), s, args);
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
159 }
160 else {
161 /* Be nice about this...
9f9cea2 @allisonrandal [pdd22io] Merging the pdd22io_part2 branch into trunk for r32922 to r336...
allisonrandal authored
162 ** XXX BD Should this use the default Parrot_io_STDOUT or something?
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored
163 */
164 retval=vfprintf(stderr, s, args);
165 }
166
167 va_end(args);
168
169 return retval;
170 }
171
172 /*
173
4dc854f @coke [cage] run 'make headerizer'
coke authored
174 =item C<Parrot_PMC Parrot_get_root_namespace(PARROT_INTERP)>
4429375 @NotFound [core] add functions Parrot_get_root_namespace and Parrot_PMC_get_pmc_st...
NotFound authored
175
176 Return the root namespace
177
178 =cut
179
180 */
181
182 PARROT_EXPORT
183 Parrot_PMC
184 Parrot_get_root_namespace(PARROT_INTERP)
185 {
186 ASSERT_ARGS(Parrot_get_root_namespace)
187 return interp->root_namespace;
188 }
189
190 /*
191
4dc854f @coke [cage] run 'make headerizer'
coke authored
192 =item C<Parrot_String Parrot_PMC_get_string_intkey(PARROT_INTERP, Parrot_PMC
193 pmc, Parrot_Int key)>
9b7e2b7 Add missing Parrot_PMC_get_string_intkey function
Simon Glover authored
194
195 Return the integer keyed string value of the passed-in PMC
196
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
197 =cut
198
9b7e2b7 Add missing Parrot_PMC_get_string_intkey function
Simon Glover authored
199 */
200
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
201 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
202 Parrot_String
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
203 Parrot_PMC_get_string_intkey(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
204 Parrot_PMC pmc, Parrot_Int key)
205 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
206 ASSERT_ARGS(Parrot_PMC_get_string_intkey)
ef4c70a @chromatic Sanitize external interface, mostly by changing Parrot_STRING to Parrot_...
chromatic authored
207 Parrot_String retval;
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
208 PARROT_CALLIN_START(interp);
209 retval = VTABLE_get_string_keyed_int(interp, pmc, key);
210 PARROT_CALLIN_END(interp);
211 return retval;
9b7e2b7 Add missing Parrot_PMC_get_string_intkey function
Simon Glover authored
212 }
213
214
215 /*
216
4dc854f @coke [cage] run 'make headerizer'
coke authored
217 =item C<void * Parrot_PMC_get_pointer_intkey(PARROT_INTERP, Parrot_PMC pmc,
218 Parrot_Int key)>
3e1f322 Inline docs update
Michael Scott authored
219
faaf609 @bschmalhofer Correct documentation of Parrot_PMC_get_pointer_intkey()
bschmalhofer authored
220 Return a pointer to the PMC indicated by an integer key.
3e1f322 Inline docs update
Michael Scott authored
221
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
222 =cut
223
3e1f322 Inline docs update
Michael Scott authored
224 */
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
225
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
226 PARROT_EXPORT
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
227 PARROT_WARN_UNUSED_RESULT
228 PARROT_CAN_RETURN_NULL
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
229 void *
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
230 Parrot_PMC_get_pointer_intkey(PARROT_INTERP,
1d5d0f2 @petdance Fixed declaration of Parrot_PMC_get_pointer_intkey
petdance authored
231 Parrot_PMC pmc, Parrot_Int key)
232 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
233 ASSERT_ARGS(Parrot_PMC_get_pointer_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
234 void *retval;
235 PARROT_CALLIN_START(interp);
236 retval = VTABLE_get_pointer_keyed_int(interp, pmc, key);
237 PARROT_CALLIN_END(interp);
238 return retval;
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
239 }
240
3e1f322 Inline docs update
Michael Scott authored
241 /*
242
4dc854f @coke [cage] run 'make headerizer'
coke authored
243 =item C<Parrot_PMC Parrot_PMC_get_pmc_intkey(PARROT_INTERP, Parrot_PMC pmc,
244 Parrot_Int key)>
3e1f322 Inline docs update
Michael Scott authored
245
246 Return the integer keyed PMC value of the passed-in PMC
247
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
248 =cut
249
3e1f322 Inline docs update
Michael Scott authored
250 */
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
251
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
252 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
253 Parrot_PMC
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
254 Parrot_PMC_get_pmc_intkey(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
255 Parrot_PMC pmc, Parrot_Int key)
256 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
257 ASSERT_ARGS(Parrot_PMC_get_pmc_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
258 Parrot_PMC retval;
259 PARROT_CALLIN_START(interp);
260 retval = VTABLE_get_pmc_keyed_int(interp, pmc, key);
261 PARROT_CALLIN_END(interp);
262 return retval;
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
263 }
264
3e1f322 Inline docs update
Michael Scott authored
265 /*
266
4dc854f @coke [cage] run 'make headerizer'
coke authored
267 =item C<Parrot_PMC Parrot_PMC_get_pmc_strkey(PARROT_INTERP, Parrot_PMC pmc,
268 Parrot_String key)>
4429375 @NotFound [core] add functions Parrot_get_root_namespace and Parrot_PMC_get_pmc_st...
NotFound authored
269
270 Return the string keyed PMC value of the passed-in PMC
271
272 =cut
273
274 */
275
276 PARROT_EXPORT
277 Parrot_PMC
278 Parrot_PMC_get_pmc_strkey(PARROT_INTERP,
279 Parrot_PMC pmc, Parrot_String key)
280 {
281 ASSERT_ARGS(Parrot_PMC_get_pmc_strkey)
282 Parrot_PMC retval;
283 PARROT_CALLIN_START(interp);
284 retval = VTABLE_get_pmc_keyed_str(interp, pmc, key);
285 PARROT_CALLIN_END(interp);
286 return retval;
287 }
288
289 /*
290
4dc854f @coke [cage] run 'make headerizer'
coke authored
291 =item C<Parrot_Int Parrot_PMC_get_intval(PARROT_INTERP, Parrot_PMC pmc)>
3e1f322 Inline docs update
Michael Scott authored
292
293 Return the signed integer value of the value in the PMC.
294
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
295 =cut
296
3e1f322 Inline docs update
Michael Scott authored
297 */
99b337c start of actual extension routines and docs
Dan Sugalski authored
298
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
299 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
300 Parrot_Int
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
301 Parrot_PMC_get_intval(PARROT_INTERP, Parrot_PMC pmc)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
302 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
303 ASSERT_ARGS(Parrot_PMC_get_intval)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
304 Parrot_Int retval;
305 PARROT_CALLIN_START(interp);
306 retval = VTABLE_get_integer(interp, pmc);
307 PARROT_CALLIN_END(interp);
308 return retval;
99b337c start of actual extension routines and docs
Dan Sugalski authored
309 }
310
3e1f322 Inline docs update
Michael Scott authored
311 /*
312
4dc854f @coke [cage] run 'make headerizer'
coke authored
313 =item C<Parrot_Int Parrot_PMC_get_intval_intkey(PARROT_INTERP, Parrot_PMC pmc,
314 Parrot_Int key)>
3e1f322 Inline docs update
Michael Scott authored
315
316 Return the keyed, signed integer value of the value in the PMC.
317
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
318 =cut
319
3e1f322 Inline docs update
Michael Scott authored
320 */
808faf0 Add integer keyed get/set for ints, for Ponie
Dan Sugalski authored
321
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
322 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
323 Parrot_Int
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
324 Parrot_PMC_get_intval_intkey(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
325 Parrot_PMC pmc, Parrot_Int key)
326 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
327 ASSERT_ARGS(Parrot_PMC_get_intval_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
328 Parrot_Int retval;
329 PARROT_CALLIN_START(interp);
330 retval = VTABLE_get_integer_keyed_int(interp, pmc, key);
331 PARROT_CALLIN_END(interp);
332 return retval;
808faf0 Add integer keyed get/set for ints, for Ponie
Dan Sugalski authored
333 }
334
3e1f322 Inline docs update
Michael Scott authored
335 /*
336
4dc854f @coke [cage] run 'make headerizer'
coke authored
337 =item C<Parrot_Int Parrot_PMC_get_intval_pmckey(PARROT_INTERP, Parrot_PMC pmc,
338 Parrot_PMC key)>
5a3984a Expose VTABLE_get_integer_keyed, VTABLE_set_pmc_keyed and VTABLE_delete_...
Nicholas Clark authored
339
340 Return the keyed, signed integer value of the value in the PMC.
341
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
342 =cut
343
5a3984a Expose VTABLE_get_integer_keyed, VTABLE_set_pmc_keyed and VTABLE_delete_...
Nicholas Clark authored
344 */
345
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
346 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
347 Parrot_Int
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
348 Parrot_PMC_get_intval_pmckey(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
349 Parrot_PMC pmc, Parrot_PMC key)
350 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
351 ASSERT_ARGS(Parrot_PMC_get_intval_pmckey)
5a3984a Expose VTABLE_get_integer_keyed, VTABLE_set_pmc_keyed and VTABLE_delete_...
Nicholas Clark authored
352 Parrot_Int retval;
353 PARROT_CALLIN_START(interp);
354 retval = VTABLE_get_integer_keyed(interp, pmc, key);
355 PARROT_CALLIN_END(interp);
356 return retval;
357 }
358
359 /*
360
4dc854f @coke [cage] run 'make headerizer'
coke authored
361 =item C<Parrot_Float Parrot_PMC_get_numval(PARROT_INTERP, Parrot_PMC pmc)>
3e1f322 Inline docs update
Michael Scott authored
362
363 Return the floating-point value of the PMC.
364
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
365 =cut
366
3e1f322 Inline docs update
Michael Scott authored
367 */
99b337c start of actual extension routines and docs
Dan Sugalski authored
368
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
369 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
370 Parrot_Float
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
371 Parrot_PMC_get_numval(PARROT_INTERP, Parrot_PMC pmc)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
372 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
373 ASSERT_ARGS(Parrot_PMC_get_numval)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
374 Parrot_Float retval;
375 PARROT_CALLIN_START(interp);
43202f8 @kjs [src] align "=" and declarations. remove some spaces where they don't ma...
kjs authored
376 retval = VTABLE_get_number(interp, pmc);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
377 PARROT_CALLIN_END(interp);
378 return retval;
fa999b0 First chunk of extension code done
Dan Sugalski authored
379 }
380
3e1f322 Inline docs update
Michael Scott authored
381 /*
382
4dc854f @coke [cage] run 'make headerizer'
coke authored
383 =item C<Parrot_Float Parrot_PMC_get_numval_intkey(PARROT_INTERP, Parrot_PMC pmc,
384 Parrot_Int key)>
3e1f322 Inline docs update
Michael Scott authored
385
386 Return the keyed, signed integer value of the value in the PMC.
387
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
388 =cut
389
3e1f322 Inline docs update
Michael Scott authored
390 */
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
391
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
392 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
393 Parrot_Float
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
394 Parrot_PMC_get_numval_intkey(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
395 Parrot_PMC pmc, Parrot_Int key)
396 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
397 ASSERT_ARGS(Parrot_PMC_get_numval_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
398 Parrot_Float retval;
399 PARROT_CALLIN_START(interp);
43202f8 @kjs [src] align "=" and declarations. remove some spaces where they don't ma...
kjs authored
400 retval = VTABLE_get_number_keyed_int(interp, pmc, key);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
401 PARROT_CALLIN_END(interp);
402 return retval;
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
403 }
404
3e1f322 Inline docs update
Michael Scott authored
405 /*
406
4dc854f @coke [cage] run 'make headerizer'
coke authored
407 =item C<char * Parrot_PMC_get_cstring_intkey(PARROT_INTERP, Parrot_PMC pmc,
408 Parrot_Int key)>
3e1f322 Inline docs update
Michael Scott authored
409
410 Return a null-terminated string that represents the string value of the PMC.
411
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
412 Note that you must free this string with C<Parrot_str_free_cstring()>!
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
413
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
414 =cut
415
3e1f322 Inline docs update
Michael Scott authored
416 */
417
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
418 PARROT_EXPORT
5fd22eb @petdance Converted vast numbers of old-style WARN_UNUSED, CONST, PURE decorations...
petdance authored
419 PARROT_MALLOC
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
420 PARROT_CAN_RETURN_NULL
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
421 char *
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
422 Parrot_PMC_get_cstring_intkey(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
423 Parrot_PMC pmc, Parrot_Int key)
424 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
425 ASSERT_ARGS(Parrot_PMC_get_cstring_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
426 STRING *intermediate;
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
427 char *retval;
428
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
429 PARROT_CALLIN_START(interp);
430 intermediate = VTABLE_get_string_keyed_int(interp, pmc, key);
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
431 retval = Parrot_str_to_cstring(interp, intermediate);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
432 PARROT_CALLIN_END(interp);
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
433
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
434 return retval;
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
435 }
436
3e1f322 Inline docs update
Michael Scott authored
437 /*
438
4dc854f @coke [cage] run 'make headerizer'
coke authored
439 =item C<char * Parrot_PMC_get_cstring(PARROT_INTERP, Parrot_PMC pmc)>
3e1f322 Inline docs update
Michael Scott authored
440
441 Return a null-terminated string that represents the string value of the PMC.
442
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
443 Note that you must free this string with C<Parrot_str_free_cstring()>!
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
444
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
445 =cut
446
3e1f322 Inline docs update
Michael Scott authored
447 */
448
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
449 PARROT_EXPORT
5fd22eb @petdance Converted vast numbers of old-style WARN_UNUSED, CONST, PURE decorations...
petdance authored
450 PARROT_MALLOC
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
451 PARROT_CAN_RETURN_NULL
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
452 char *
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
453 Parrot_PMC_get_cstring(PARROT_INTERP, Parrot_PMC pmc)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
454 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
455 ASSERT_ARGS(Parrot_PMC_get_cstring)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
456 STRING *intermediate;
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
457 char *retval;
458
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
459 PARROT_CALLIN_START(interp);
460 intermediate = VTABLE_get_string(interp, pmc);
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
461 retval = Parrot_str_to_cstring(interp, intermediate);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
462 PARROT_CALLIN_END(interp);
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
463
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
464 return retval;
fa999b0 First chunk of extension code done
Dan Sugalski authored
465 }
466
3e1f322 Inline docs update
Michael Scott authored
467 /*
468
4dc854f @coke [cage] run 'make headerizer'
coke authored
469 =item C<char * Parrot_PMC_get_cstringn(PARROT_INTERP, Parrot_PMC pmc, Parrot_Int
470 *length)>
3e1f322 Inline docs update
Michael Scott authored
471
472 Return a null-terminated string for the PMC, along with the length.
473
474 Yes, right now this is a bit of a cheat. It needs fixing, but without
475 disturbing the interface.
476
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
477 Note that you must free the string with C<Parrot_str_free_cstring()>.
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
478
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
479 =cut
480
3e1f322 Inline docs update
Michael Scott authored
481 */
482
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
483 PARROT_EXPORT
5fd22eb @petdance Converted vast numbers of old-style WARN_UNUSED, CONST, PURE decorations...
petdance authored
484 PARROT_MALLOC
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
485 PARROT_CAN_RETURN_NULL
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
486 char *
3de5a81 @petdance Headerized events.c and the rest of gc/*
petdance authored
487 Parrot_PMC_get_cstringn(PARROT_INTERP, ARGIN(Parrot_PMC pmc),
488 ARGOUT(Parrot_Int *length))
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
489 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
490 ASSERT_ARGS(Parrot_PMC_get_cstringn)
fa999b0 First chunk of extension code done
Dan Sugalski authored
491 char *retval;
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
492
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
493 PARROT_CALLIN_START(interp);
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
494 retval = Parrot_str_to_cstring(interp, VTABLE_get_string(interp, pmc));
fa999b0 First chunk of extension code done
Dan Sugalski authored
495 *length = strlen(retval);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
496 PARROT_CALLIN_END(interp);
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
497
fa999b0 First chunk of extension code done
Dan Sugalski authored
498 return retval;
499 }
500
3e1f322 Inline docs update
Michael Scott authored
501 /*
502
4dc854f @coke [cage] run 'make headerizer'
coke authored
503 =item C<char * Parrot_PMC_get_cstringn_intkey(PARROT_INTERP, Parrot_PMC pmc,
504 Parrot_Int *length, Parrot_Int key)>
3e1f322 Inline docs update
Michael Scott authored
505
506 Return a null-terminated string for the PMC, along with the length.
507
508 Yes, right now this is a bit of a cheat. It needs fixing, but without
509 disturbing the interface.
510
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
511 Note that you must free this string with C<Parrot_str_free_cstring()>.
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
512
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
513 =cut
514
3e1f322 Inline docs update
Michael Scott authored
515 */
516
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
517 PARROT_EXPORT
5fd22eb @petdance Converted vast numbers of old-style WARN_UNUSED, CONST, PURE decorations...
petdance authored
518 PARROT_MALLOC
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
519 PARROT_CAN_RETURN_NULL
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
520 char *
3de5a81 @petdance Headerized events.c and the rest of gc/*
petdance authored
521 Parrot_PMC_get_cstringn_intkey(PARROT_INTERP, ARGIN(Parrot_PMC pmc),
522 ARGOUT(Parrot_Int *length), Parrot_Int key)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
523 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
524 ASSERT_ARGS(Parrot_PMC_get_cstringn_intkey)
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
525 char *retval;
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
526
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
527 PARROT_CALLIN_START(interp);
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
528 retval = Parrot_str_to_cstring(interp,
d067bc6 @ambs 80's cuts.
ambs authored
529 VTABLE_get_string_keyed_int(interp, pmc, key));
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
530 *length = strlen(retval);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
531 PARROT_CALLIN_END(interp);
13ad730 @chromatic Free strings allocated with string_to_cstring().
chromatic authored
532
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
533 return retval;
534 }
535
3e1f322 Inline docs update
Michael Scott authored
536 /*
537
4dc854f @coke [cage] run 'make headerizer'
coke authored
538 =item C<void Parrot_PMC_set_string(PARROT_INTERP, Parrot_PMC pmc, Parrot_String
539 value)>
3e1f322 Inline docs update
Michael Scott authored
540
541 Assign the passed-in Parrot string to the passed-in PMC.
542
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
543 =cut
544
3e1f322 Inline docs update
Michael Scott authored
545 */
546
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
547 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
548 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
549 Parrot_PMC_set_string(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
550 Parrot_PMC pmc, Parrot_String value)
551 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
552 ASSERT_ARGS(Parrot_PMC_set_string)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
553 PARROT_CALLIN_START(interp);
fa999b0 First chunk of extension code done
Dan Sugalski authored
554 VTABLE_set_string_native(interp, pmc, value);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
555 PARROT_CALLIN_END(interp);
fa999b0 First chunk of extension code done
Dan Sugalski authored
556 }
557
3e1f322 Inline docs update
Michael Scott authored
558 /*
559
4dc854f @coke [cage] run 'make headerizer'
coke authored
560 =item C<void Parrot_PMC_set_string_intkey(PARROT_INTERP, Parrot_PMC pmc,
561 Parrot_Int key, Parrot_String value)>
3e1f322 Inline docs update
Michael Scott authored
562
563 Assign the passed-in Parrot string to the passed-in PMC.
564
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
565 =cut
566
3e1f322 Inline docs update
Michael Scott authored
567 */
568
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
569 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
570 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
571 Parrot_PMC_set_string_intkey(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
572 Parrot_PMC pmc, Parrot_Int key, Parrot_String value)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c headers...
petdance authored
573 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
574 ASSERT_ARGS(Parrot_PMC_set_string_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
575 PARROT_CALLIN_START(interp);
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
576 VTABLE_set_string_keyed_int(interp, pmc, key, value);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
577 PARROT_CALLIN_END(interp);
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
578 }
579
3e1f322 Inline docs update
Michael Scott authored
580 /*
581
4dc854f @coke [cage] run 'make headerizer'
coke authored
582 =item C<void Parrot_PMC_set_pmc_intkey(PARROT_INTERP, Parrot_PMC pmc, Parrot_Int
583 key, Parrot_PMC value)>
3e1f322 Inline docs update
Michael Scott authored
584
a2516e7 Transpose Parrot_PMC_set_pointer and Parrot_PMC_set_pmc_intkey to give a...
Nicholas Clark authored
585 Assign the passed-in pmc to the passed-in slot of the passed-in PMC.
3e1f322 Inline docs update
Michael Scott authored
586
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
587 =cut
588
3e1f322 Inline docs update
Michael Scott authored
589 */
590
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
591 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
592 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
593 Parrot_PMC_set_pmc_intkey(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
594 Parrot_PMC pmc, Parrot_Int key, Parrot_PMC value)
595 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
596 ASSERT_ARGS(Parrot_PMC_set_pmc_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
597 PARROT_CALLIN_START(interp);
a2516e7 Transpose Parrot_PMC_set_pointer and Parrot_PMC_set_pmc_intkey to give a...
Nicholas Clark authored
598 VTABLE_set_pmc_keyed_int(interp, pmc, key, value);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
599 PARROT_CALLIN_END(interp);
cf4fa0b expose get/set pointer functions
Dan Sugalski authored
600 }
601
3e1f322 Inline docs update
Michael Scott authored
602 /*
603
4dc854f @coke [cage] run 'make headerizer'
coke authored
604 =item C<void Parrot_PMC_set_pmc_strkey(PARROT_INTERP, Parrot_PMC pmc,
605 Parrot_String key, Parrot_PMC value)>
b2d6b52 @NotFound [core] add function Parrot_PMC_set_pmc_strkey to extend.h
NotFound authored
606
607 Assign the passed-in pmc to the passed-in slot of the passed-in PMC.
608
609 =cut
610
611 */
612
613 PARROT_EXPORT
614 void
615 Parrot_PMC_set_pmc_strkey(PARROT_INTERP,
616 Parrot_PMC pmc, Parrot_String key, Parrot_PMC value)
617 {
618 ASSERT_ARGS(Parrot_PMC_set_pmc_strkey)
619 PARROT_CALLIN_START(interp);
620 VTABLE_set_pmc_keyed_str(interp, pmc, key, value);
621 PARROT_CALLIN_END(interp);
622 }
623
624 /*
625
4dc854f @coke [cage] run 'make headerizer'
coke authored
626 =item C<void Parrot_PMC_set_pmc_pmckey(PARROT_INTERP, Parrot_PMC pmc, Parrot_PMC
627 key, Parrot_PMC value)>
5a3984a Expose VTABLE_get_integer_keyed, VTABLE_set_pmc_keyed and VTABLE_delete_...
Nicholas Clark authored
628
629 Assign the passed-in pmc to the passed-in slot of the passed-in PMC.
630
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
631 =cut
632
5a3984a Expose VTABLE_get_integer_keyed, VTABLE_set_pmc_keyed and VTABLE_delete_...
Nicholas Clark authored
633 */
634
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
635 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
636 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
637 Parrot_PMC_set_pmc_pmckey(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
638 Parrot_PMC pmc, Parrot_PMC key, Parrot_PMC value)
639 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
640 ASSERT_ARGS(Parrot_PMC_set_pmc_pmckey)
5a3984a Expose VTABLE_get_integer_keyed, VTABLE_set_pmc_keyed and VTABLE_delete_...
Nicholas Clark authored
641 PARROT_CALLIN_START(interp);
642 VTABLE_set_pmc_keyed(interp, pmc, key, value);
643 PARROT_CALLIN_END(interp);
644 }
645
646 /*
647
4dc854f @coke [cage] run 'make headerizer'
coke authored
648 =item C<void Parrot_PMC_set_pointer_intkey(PARROT_INTERP, Parrot_PMC pmc,
649 Parrot_Int key, void *value)>
3e1f322 Inline docs update
Michael Scott authored
650
651 Assign the passed-in pointer to the passed-in PMC.
652
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
653 =cut
654
3e1f322 Inline docs update
Michael Scott authored
655 */
656
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
657 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
658 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
659 Parrot_PMC_set_pointer_intkey(PARROT_INTERP,
3de5a81 @petdance Headerized events.c and the rest of gc/*
petdance authored
660 ARGIN(Parrot_PMC pmc), Parrot_Int key, ARGIN_NULLOK(void *value))
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
661 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
662 ASSERT_ARGS(Parrot_PMC_set_pointer_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
663 PARROT_CALLIN_START(interp);
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
664 VTABLE_set_pointer_keyed_int(interp, pmc, key, value);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
665 PARROT_CALLIN_END(interp);
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
666 }
667
3e1f322 Inline docs update
Michael Scott authored
668 /*
669
4dc854f @coke [cage] run 'make headerizer'
coke authored
670 =item C<void Parrot_PMC_set_intval(PARROT_INTERP, Parrot_PMC pmc, Parrot_Int
671 value)>
3e1f322 Inline docs update
Michael Scott authored
672
673 Assign the passed-in Parrot integer to the passed-in PMC.
674
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
675 =cut
676
3e1f322 Inline docs update
Michael Scott authored
677 */
678
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
679 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
680 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
681 Parrot_PMC_set_intval(PARROT_INTERP, Parrot_PMC pmc, Parrot_Int value)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
682 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
683 ASSERT_ARGS(Parrot_PMC_set_intval)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
684 PARROT_CALLIN_START(interp);
fa999b0 First chunk of extension code done
Dan Sugalski authored
685 VTABLE_set_integer_native(interp, pmc, value);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
686 PARROT_CALLIN_END(interp);
fa999b0 First chunk of extension code done
Dan Sugalski authored
687 }
688
3e1f322 Inline docs update
Michael Scott authored
689 /*
690
4dc854f @coke [cage] run 'make headerizer'
coke authored
691 =item C<void Parrot_PMC_set_intval_intkey(PARROT_INTERP, Parrot_PMC pmc,
692 Parrot_Int key, Parrot_Int value)>
3e1f322 Inline docs update
Michael Scott authored
693
694 Assign the passed-in Parrot integer to the passed-in PMC.
695
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
696 =cut
697
3e1f322 Inline docs update
Michael Scott authored
698 */
699
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
700 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
701 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
702 Parrot_PMC_set_intval_intkey(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
703 Parrot_PMC pmc, Parrot_Int key, Parrot_Int value)
704 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
705 ASSERT_ARGS(Parrot_PMC_set_intval_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
706 PARROT_CALLIN_START(interp);
808faf0 Add integer keyed get/set for ints, for Ponie
Dan Sugalski authored
707 VTABLE_set_integer_keyed_int(interp, pmc, key, value);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
708 PARROT_CALLIN_END(interp);
808faf0 Add integer keyed get/set for ints, for Ponie
Dan Sugalski authored
709 }
710
3e1f322 Inline docs update
Michael Scott authored
711 /*
712
4dc854f @coke [cage] run 'make headerizer'
coke authored
713 =item C<void Parrot_PMC_set_numval(PARROT_INTERP, Parrot_PMC pmc, Parrot_Float
714 value)>
3e1f322 Inline docs update
Michael Scott authored
715
716 Assign the passed-in Parrot number to the passed-in PMC.
717
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
718 =cut
719
3e1f322 Inline docs update
Michael Scott authored
720 */
721
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
722 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
723 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
724 Parrot_PMC_set_numval(PARROT_INTERP, Parrot_PMC pmc, Parrot_Float value)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
725 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
726 ASSERT_ARGS(Parrot_PMC_set_numval)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
727 PARROT_CALLIN_START(interp);
fa999b0 First chunk of extension code done
Dan Sugalski authored
728 VTABLE_set_number_native(interp, pmc, value);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
729 PARROT_CALLIN_END(interp);
fa999b0 First chunk of extension code done
Dan Sugalski authored
730 }
731
3e1f322 Inline docs update
Michael Scott authored
732 /*
733
4dc854f @coke [cage] run 'make headerizer'
coke authored
734 =item C<void Parrot_PMC_set_numval_intkey(PARROT_INTERP, Parrot_PMC pmc,
735 Parrot_Int key, Parrot_Float value)>
3e1f322 Inline docs update
Michael Scott authored
736
737 Assign the passed-in Parrot number to the passed-in PMC.
738
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
739 =cut
740
3e1f322 Inline docs update
Michael Scott authored
741 */
742
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
743 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
744 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
745 Parrot_PMC_set_numval_intkey(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
746 Parrot_PMC pmc, Parrot_Int key, Parrot_Float value)
747 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
748 ASSERT_ARGS(Parrot_PMC_set_numval_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
749 PARROT_CALLIN_START(interp);
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
750 VTABLE_set_number_keyed_int(interp, pmc, key, value);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
751 PARROT_CALLIN_END(interp);
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
752 }
753
3e1f322 Inline docs update
Michael Scott authored
754 /*
755
4dc854f @coke [cage] run 'make headerizer'
coke authored
756 =item C<void Parrot_PMC_set_cstring(PARROT_INTERP, Parrot_PMC pmc, const char
757 *value)>
3e1f322 Inline docs update
Michael Scott authored
758
759 Assign the passed-in null-terminated C string to the passed-in PMC.
760
06fb631 @paultcochrane [core] Added function documentation.
paultcochrane authored
761 =cut
762
3e1f322 Inline docs update
Michael Scott authored
763 */
764
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
765 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
766 void
802efc1 @petdance If something is NULLOK(const...) it is by definition ARGIN_NULLOK(const....
petdance authored
767 Parrot_PMC_set_cstring(PARROT_INTERP, Parrot_PMC pmc, ARGIN_NULLOK(const char *value))
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
768 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
769 ASSERT_ARGS(Parrot_PMC_set_cstring)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
770 PARROT_CALLIN_START(interp);
bf41b66 @particle [PDD07]: ws cleanup in src/, src/dynpmc/, and src/pmc/
particle authored
771 VTABLE_set_string_native(interp, pmc,
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
772 Parrot_str_new(interp, value, 0));
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
773 PARROT_CALLIN_END(interp);
fa999b0 First chunk of extension code done
Dan Sugalski authored
774 }
775
3e1f322 Inline docs update
Michael Scott authored
776 /*
777
4dc854f @coke [cage] run 'make headerizer'
coke authored
778 =item C<void Parrot_PMC_set_cstring_intkey(PARROT_INTERP, Parrot_PMC pmc,
779 Parrot_Int key, const char *value)>
3e1f322 Inline docs update
Michael Scott authored
780
781 Assign the passed-in null-terminated C string to the passed-in PMC.
782
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
783 =cut
784
3e1f322 Inline docs update
Michael Scott authored
785 */
786
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
787 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
788 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
789 Parrot_PMC_set_cstring_intkey(PARROT_INTERP,
802efc1 @petdance If something is NULLOK(const...) it is by definition ARGIN_NULLOK(const....
petdance authored
790 Parrot_PMC pmc, Parrot_Int key, ARGIN_NULLOK(const char *value))
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
791 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
792 ASSERT_ARGS(Parrot_PMC_set_cstring_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
793 PARROT_CALLIN_START(interp);
bf41b66 @particle [PDD07]: ws cleanup in src/, src/dynpmc/, and src/pmc/
particle authored
794 VTABLE_set_string_keyed_int(interp, pmc, key,
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
795 Parrot_str_new(interp, value, 0));
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
796 PARROT_CALLIN_END(interp);
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
797 }
798
3e1f322 Inline docs update
Michael Scott authored
799 /*
800
4dc854f @coke [cage] run 'make headerizer'
coke authored
801 =item C<void Parrot_PMC_set_cstringn(PARROT_INTERP, Parrot_PMC pmc, const char
802 *value, Parrot_UInt length)>
3e1f322 Inline docs update
Michael Scott authored
803
c03ee10 @chromatic r20350@windwheel: chromatic | 2006-08-19 13:49:15 -0700
chromatic authored
804 Assign the passed-in length-noted string to the passed-in PMC.
3e1f322 Inline docs update
Michael Scott authored
805
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
806 =cut
807
3e1f322 Inline docs update
Michael Scott authored
808 */
809
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
810 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
811 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
812 Parrot_PMC_set_cstringn(PARROT_INTERP,
258de48 @chromatic [src] Cleaned up some conversion and signedness warnings.
chromatic authored
813 Parrot_PMC pmc, ARGIN_NULLOK(const char *value), Parrot_UInt length)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
814 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
815 ASSERT_ARGS(Parrot_PMC_set_cstringn)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
816 PARROT_CALLIN_START(interp);
bf41b66 @particle [PDD07]: ws cleanup in src/, src/dynpmc/, and src/pmc/
particle authored
817 VTABLE_set_string_native(interp, pmc,
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
818 Parrot_str_new(interp, value, length));
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
819 PARROT_CALLIN_END(interp);
fa999b0 First chunk of extension code done
Dan Sugalski authored
820 }
821
3e1f322 Inline docs update
Michael Scott authored
822 /*
823
4dc854f @coke [cage] run 'make headerizer'
coke authored
824 =item C<void Parrot_PMC_push_intval(PARROT_INTERP, Parrot_PMC pmc, Parrot_Int
825 value)>
8bb4c95 Add 4 types of push to extend.h
Nicholas Clark authored
826
827 Push the passed-in Parrot integer onto the passed in PMC
828
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
829 =cut
830
8bb4c95 Add 4 types of push to extend.h
Nicholas Clark authored
831 */
832
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
833 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
834 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
835 Parrot_PMC_push_intval(PARROT_INTERP,
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
836 Parrot_PMC pmc, Parrot_Int value)
837 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
838 ASSERT_ARGS(Parrot_PMC_push_intval)
8bb4c95 Add 4 types of push to extend.h
Nicholas Clark authored
839 PARROT_CALLIN_START(interp);
840 VTABLE_push_integer(interp, pmc, value);
841 PARROT_CALLIN_END(interp);
842 }
843
844 /*
845
4dc854f @coke [cage] run 'make headerizer'
coke authored
846 =item C<void Parrot_PMC_push_numval(PARROT_INTERP, Parrot_PMC pmc, Parrot_Float
847 value)>
8bb4c95 Add 4 types of push to extend.h
Nicholas Clark authored
848
849 Push the passed-in Parrot number onto the passed in PMC
850
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
851 =cut
852
8bb4c95 Add 4 types of push to extend.h
Nicholas Clark authored
853 */
854
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
855 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
856 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
857 Parrot_PMC_push_numval(PARROT_INTERP, Parrot_PMC pmc, Parrot_Float value)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
858 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
859 ASSERT_ARGS(Parrot_PMC_push_numval)
8bb4c95 Add 4 types of push to extend.h
Nicholas Clark authored
860 PARROT_CALLIN_START(interp);
861 VTABLE_push_float(interp, pmc, value);
862 PARROT_CALLIN_END(interp);
863 }
864
865 /*
866
4dc854f @coke [cage] run 'make headerizer'
coke authored
867 =item C<void Parrot_PMC_push_pmcval(PARROT_INTERP, Parrot_PMC pmc, Parrot_PMC
868 value)>
6d4f4cf @NotFound [core] add Parrot_PMC_push_pmcval and Parrot_PMC_newclass to the extend ...
NotFound authored
869
870 Push the passed-in Parrot PMC onto the passed in PMC
871
872 =cut
873
874 */
875
876 PARROT_EXPORT
877 void
878 Parrot_PMC_push_pmcval(PARROT_INTERP, Parrot_PMC pmc, Parrot_PMC value)
879 {
880 ASSERT_ARGS(Parrot_PMC_push_pmcval)
881 PARROT_CALLIN_START(interp);
882 VTABLE_push_pmc(interp, pmc, value);
883 PARROT_CALLIN_END(interp);
884 }
885
886 /*
887
4dc854f @coke [cage] run 'make headerizer'
coke authored
888 =item C<void Parrot_PMC_delete_pmckey(PARROT_INTERP, Parrot_PMC pmc, Parrot_PMC
889 key)>
5a3984a Expose VTABLE_get_integer_keyed, VTABLE_set_pmc_keyed and VTABLE_delete_...
Nicholas Clark authored
890
891 Deletes the value associated with the passed-in PMC from the PMC.
892
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
893 =cut
894
5a3984a Expose VTABLE_get_integer_keyed, VTABLE_set_pmc_keyed and VTABLE_delete_...
Nicholas Clark authored
895 */
896
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
897 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
898 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
899 Parrot_PMC_delete_pmckey(PARROT_INTERP, Parrot_PMC pmc, Parrot_PMC key)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
900 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
901 ASSERT_ARGS(Parrot_PMC_delete_pmckey)
5a3984a Expose VTABLE_get_integer_keyed, VTABLE_set_pmc_keyed and VTABLE_delete_...
Nicholas Clark authored
902 PARROT_CALLIN_START(interp);
903 VTABLE_delete_keyed(interp, pmc, key);
904 PARROT_CALLIN_END(interp);
905 }
906
907 /*
908
4dc854f @coke [cage] run 'make headerizer'
coke authored
909 =item C<void Parrot_PMC_set_cstringn_intkey(PARROT_INTERP, Parrot_PMC pmc,
910 Parrot_Int key, const char *value, Parrot_UInt length)>
3e1f322 Inline docs update
Michael Scott authored
911
912 Assign the passed-in length-noted string to the passed-in PMC.
913
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
914 =cut
915
3e1f322 Inline docs update
Michael Scott authored
916 */
917
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
918 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
919 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
920 Parrot_PMC_set_cstringn_intkey(PARROT_INTERP,
258de48 @chromatic [src] Cleaned up some conversion and signedness warnings.
chromatic authored
921 Parrot_PMC pmc, Parrot_Int key, ARGIN_NULLOK(const char *value),
922 Parrot_UInt length)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
923 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
924 ASSERT_ARGS(Parrot_PMC_set_cstringn_intkey)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
925 PARROT_CALLIN_START(interp);
d067bc6 @ambs 80's cuts.
ambs authored
926 VTABLE_set_string_keyed_int(interp, pmc, key,
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
927 Parrot_str_new(interp, value, length));
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
928 PARROT_CALLIN_END(interp);
6b2d2bf get/set intkey stuff for embedding
Dan Sugalski authored
929 }
930
3e1f322 Inline docs update
Michael Scott authored
931 /*
932
4dc854f @coke [cage] run 'make headerizer'
coke authored
933 =item C<Parrot_PMC Parrot_PMC_new(PARROT_INTERP, Parrot_Int type)>
3e1f322 Inline docs update
Michael Scott authored
934
935 Create and return a new PMC.
936
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
937 =cut
938
3e1f322 Inline docs update
Michael Scott authored
939 */
940
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
941 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
942 Parrot_PMC
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
943 Parrot_PMC_new(PARROT_INTERP, Parrot_Int type)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
944 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
945 ASSERT_ARGS(Parrot_PMC_new)
fa999b0 First chunk of extension code done
Dan Sugalski authored
946 Parrot_PMC newpmc;
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
947 PARROT_CALLIN_START(interp);
083213a @Whiteknight start rename of pmc_new to Parrot_pmc_new
Whiteknight authored
948 newpmc = Parrot_pmc_new_noinit(interp, type);
fa999b0 First chunk of extension code done
Dan Sugalski authored
949 VTABLE_init(interp, newpmc);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
950 PARROT_CALLIN_END(interp);
fa999b0 First chunk of extension code done
Dan Sugalski authored
951 return newpmc;
952 }
953
3e1f322 Inline docs update
Michael Scott authored
954 /*
955
4dc854f @coke [cage] run 'make headerizer'
coke authored
956 =item C<Parrot_Int Parrot_PMC_typenum(PARROT_INTERP, const char *_class)>
3e1f322 Inline docs update
Michael Scott authored
957
958 Returns the internal identifier that represents the named class.
959
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
960 =cut
961
3e1f322 Inline docs update
Michael Scott authored
962 */
963
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
964 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
965 Parrot_Int
802efc1 @petdance If something is NULLOK(const...) it is by definition ARGIN_NULLOK(const....
petdance authored
966 Parrot_PMC_typenum(PARROT_INTERP, ARGIN_NULLOK(const char *_class))
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
967 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
968 ASSERT_ARGS(Parrot_PMC_typenum)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
969 Parrot_Int retval;
970 PARROT_CALLIN_START(interp);
847522f @Whiteknight rename the rest of the functions in pmc.c, start updating the rest of th...
Whiteknight authored
971 retval = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, _class, 0));
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored
972 PARROT_CALLIN_END(interp);
973 return retval;
fa999b0 First chunk of extension code done
Dan Sugalski authored
974 }
975
3e1f322 Inline docs update
Michael Scott authored
976 /*
977
4dc854f @coke [cage] run 'make headerizer'
coke authored
978 =item C<Parrot_PMC Parrot_PMC_null(void)>
3e1f322 Inline docs update
Michael Scott authored
979
980 Returns the special C<NULL> PMC.
981
06fb631 @paultcochrane [core] Added function documentation.
paultcochrane authored
982 =cut
983
3e1f322 Inline docs update
Michael Scott authored
984 */
985
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
986 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
987 Parrot_PMC
988 Parrot_PMC_null(void)
989 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
990 ASSERT_ARGS(Parrot_PMC_null)
8deb08e Expose PMCNULL to extension API.
Melvin Smith authored
991 return PMCNULL;
992 }
993
3e1f322 Inline docs update
Michael Scott authored
994 /*
995
4dc854f @coke [cage] run 'make headerizer'
coke authored
996 =item C<void Parrot_free_cstring(char *string)>
3e1f322 Inline docs update
Michael Scott authored
997
998 Deallocate a C string that the interpreter has handed to you.
999
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
1000 =cut
1001
3e1f322 Inline docs update
Michael Scott authored
1002 */
8deb08e Expose PMCNULL to extension API.
Melvin Smith authored
1003
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
1004 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
1005 void
3de5a81 @petdance Headerized events.c and the rest of gc/*
petdance authored
1006 Parrot_free_cstring(ARGIN_NULLOK(char *string))
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
1007 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
1008 ASSERT_ARGS(Parrot_free_cstring)
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored
1009 Parrot_str_free_cstring(string);
99b337c start of actual extension routines and docs
Dan Sugalski authored
1010 }
1011
3e1f322 Inline docs update
Michael Scott authored
1012 /*
1013
6c743be @allisonrandal [pcc] Add a generic extend/embed interface function for invoking Parrot
allisonrandal authored
1014 =item C<void Parrot_ext_call(PARROT_INTERP, Parrot_PMC sub_pmc, const char
1015 *signature, ...)>
1016
1017 Call a Parrot subroutine or method with the given function signature. The
1018 function signature holds one type character for each argument or return, these
1019 are:
1020
1021 I ... Parrot_Int
1022 N ... Parrot_Float
1023 S ... Parrot_String
1024 P ... Parrot_PMC
1025
1026 Returns come after the arguments, separated by an arrow, so "PN->S" takes a PMC
1027 and a float as arguments and returns a string.
1028
1029 Pass the variables for the arguments and returns in the same order as the
1030 signature, with returns as reference to the variable (so it can be modified).
1031
1032 Parrot_ext_call(interp, sub, "P->S", pmc_arg, &string_result);
1033
1034 To call a method, pass the object for the method as the first argument, and
1035 mark it in the signature as "Pi" ("i" stands for "invocant").
1036
1037 Parrot_ext_call(interp, sub, "PiP->S", object_arg, pmc_arg, &string_result);
1038
1039 =cut
1040
1041 */
1042
1043 PARROT_EXPORT
1044 void
1045 Parrot_ext_call(PARROT_INTERP, ARGIN(Parrot_PMC sub_pmc),
1046 ARGIN(const char *signature), ...)
1047 {
1048 ASSERT_ARGS(Parrot_ext_call)
1049 va_list args;
1050 PMC *sig_object;
1051
1052 va_start(args, signature);
1053 sig_object = Parrot_pcc_build_sig_object_from_varargs(interp, PMCNULL, signature, args);
1054 va_end(args);
1055
1056 Parrot_pcc_invoke_from_sig_object(interp, sub_pmc, sig_object);
1057 }
1058
1059 /*
1060
4dc854f @coke [cage] run 'make headerizer'
coke authored
1061 =item C<Parrot_Int Parrot_get_intreg(PARROT_INTERP, Parrot_Int regnum)>
3e1f322 Inline docs update
Michael Scott authored
1062
1063 Return the value of an integer register.
1064
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
1065 =cut
1066
3e1f322 Inline docs update
Michael Scott authored
1067 */
3b31e02 More extension stuff at least partially stubbed out
Dan Sugalski authored
1068
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
1069 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
1070 Parrot_Int
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
1071 Parrot_get_intreg(PARROT_INTERP, Parrot_Int regnum)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c headers...
petdance authored
1072 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
1073 ASSERT_ARGS(Parrot_get_intreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variable,...
petdance authored
1074 return REG_INT(interp, regnum);
b4bdfa8 Stub in some new object manipulation methods, and some extension routine...
Dan Sugalski authored
1075 }
1076
3e1f322 Inline docs update
Michael Scott authored
1077 /*
1078
4dc854f @coke [cage] run 'make headerizer'
coke authored
1079 =item C<Parrot_Float Parrot_get_numreg(PARROT_INTERP, Parrot_Int regnum)>
3e1f322 Inline docs update
Michael Scott authored
1080
1081 Return the value of a numeric register.
1082
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
1083 =cut
1084
3e1f322 Inline docs update
Michael Scott authored
1085 */
1086
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
1087 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
1088 Parrot_Float
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
1089 Parrot_get_numreg(PARROT_INTERP, Parrot_Int regnum)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c headers...
petdance authored
1090 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
1091 ASSERT_ARGS(Parrot_get_numreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variable,...
petdance authored
1092 return REG_NUM(interp, regnum);
b4bdfa8 Stub in some new object manipulation methods, and some extension routine...
Dan Sugalski authored
1093 }
1094
3e1f322 Inline docs update
Michael Scott authored
1095 /*
1096
4dc854f @coke [cage] run 'make headerizer'
coke authored
1097 =item C<Parrot_String Parrot_get_strreg(PARROT_INTERP, Parrot_Int regnum)>
3e1f322 Inline docs update
Michael Scott authored
1098
1099 Return the value of a string register.
1100
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
1101 =cut
1102
3e1f322 Inline docs update
Michael Scott authored
1103 */
1104
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
1105 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
1106 Parrot_String
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
1107 Parrot_get_strreg(PARROT_INTERP, Parrot_Int regnum)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c headers...
petdance authored
1108 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
1109 ASSERT_ARGS(Parrot_get_strreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variable,...
petdance authored
1110 return REG_STR(interp, regnum);
b4bdfa8 Stub in some new object manipulation methods, and some extension routine...
Dan Sugalski authored
1111 }
1112
3e1f322 Inline docs update
Michael Scott authored
1113 /*
1114
4dc854f @coke [cage] run 'make headerizer'
coke authored
1115 =item C<Parrot_PMC Parrot_get_pmcreg(PARROT_INTERP, Parrot_Int regnum)>
3e1f322 Inline docs update
Michael Scott authored
1116
1117 Return the value of a PMC register.
1118
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
1119 =cut
1120
3e1f322 Inline docs update
Michael Scott authored
1121 */
1122
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
1123 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
1124 Parrot_PMC
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
1125 Parrot_get_pmcreg(PARROT_INTERP, Parrot_Int regnum)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c headers...
petdance authored
1126 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
1127 ASSERT_ARGS(Parrot_get_pmcreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variable,...
petdance authored
1128 return REG_PMC(interp, regnum);
b4bdfa8 Stub in some new object manipulation methods, and some extension routine...
Dan Sugalski authored
1129 }
1130
3e1f322 Inline docs update
Michael Scott authored
1131 /*
1132
4dc854f @coke [cage] run 'make headerizer'
coke authored
1133 =item C<void Parrot_set_intreg(PARROT_INTERP, Parrot_Int regnum, Parrot_Int
1134 value)>
3e1f322 Inline docs update
Michael Scott authored
1135
1136 Set the value of an I register.
1137
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
1138 =cut
1139
3e1f322 Inline docs update
Michael Scott authored
1140 */
1141
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
1142 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
1143 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
1144 Parrot_set_intreg(PARROT_INTERP, Parrot_Int regnum,
d067bc6 @ambs 80's cuts.
ambs authored
1145 Parrot_Int value)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c headers...
petdance authored
1146 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
1147 ASSERT_ARGS(Parrot_set_intreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variable,...
petdance authored
1148 REG_INT(interp, regnum) = value;
b4bdfa8 Stub in some new object manipulation methods, and some extension routine...
Dan Sugalski authored
1149 }
1150
3e1f322 Inline docs update
Michael Scott authored
1151 /*
1152
4dc854f @coke [cage] run 'make headerizer'
coke authored
1153 =item C<void Parrot_set_numreg(PARROT_INTERP, Parrot_Int regnum, Parrot_Float
1154 value)>
3e1f322 Inline docs update
Michael Scott authored
1155
1156 Set the value of an N register.
1157
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
1158 =cut
1159
3e1f322 Inline docs update
Michael Scott authored
1160 */
1161
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
1162 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
1163 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
1164 Parrot_set_numreg(PARROT_INTERP, Parrot_Int regnum,
d067bc6 @ambs 80's cuts.
ambs authored
1165 Parrot_Float value)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c headers...
petdance authored
1166 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
1167 ASSERT_ARGS(Parrot_set_numreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variable,...
petdance authored
1168 REG_NUM(interp, regnum) = value;
b4bdfa8 Stub in some new object manipulation methods, and some extension routine...
Dan Sugalski authored
1169 }
1170
3e1f322 Inline docs update
Michael Scott authored
1171 /*
1172
4dc854f @coke [cage] run 'make headerizer'
coke authored
1173 =item C<void Parrot_set_strreg(PARROT_INTERP, Parrot_Int regnum, Parrot_String
1174 value)>
3e1f322 Inline docs update
Michael Scott authored
1175
1176 Set the value of an S register.
1177
bc4de54 @moritz add '=cut' lines to some POD documents. Closes trac #19, jimmy++
moritz authored
1178 =cut
1179
3e1f322 Inline docs update
Michael Scott authored
1180 */
1181
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
1182 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
1183 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
1184 Parrot_set_strreg(PARROT_INTERP, Parrot_Int regnum,
ef4c70a @chromatic Sanitize external interface, mostly by changing Parrot_STRING to Parrot_...
chromatic authored
1185 Parrot_String value)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c headers...
petdance authored
1186 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
1187 ASSERT_ARGS(Parrot_set_strreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variable,...
petdance authored
1188 REG_STR(interp, regnum) = value;
b4bdfa8 Stub in some new object manipulation methods, and some extension routine...
Dan Sugalski authored
1189 }
1190
3e1f322 Inline docs update
Michael Scott authored
1191 /*
1192
4dc854f @coke [cage] run 'make headerizer'
coke authored
1193 =item C<void Parrot_set_pmcreg(PARROT_INTERP, Parrot_Int regnum, Parrot_PMC
1194 value)>
3e1f322 Inline docs update
Michael Scott authored
1195
1196 Set the value of a P register.
1197
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
1198 =cut
1199
3e1f322 Inline docs update
Michael Scott authored
1200 */
1201
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
1202 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
1203 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
1204 Parrot_set_pmcreg(PARROT_INTERP, Parrot_Int regnum,
d067bc6 @ambs 80's cuts.
ambs authored
1205 Parrot_PMC value)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c headers...
petdance authored
1206 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
1207 ASSERT_ARGS(Parrot_set_pmcreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variable,...
petdance authored
1208 REG_PMC(interp, regnum) = value;
b4bdfa8 Stub in some new object manipulation methods, and some extension routine...
Dan Sugalski authored
1209 }
1210
000d780 Add in some string construction functions
Dan Sugalski authored
1211 /*=for api extend Parrot_new_string
1212 *
1213 */
3e1f322 Inline docs update
Michael Scott authored
1214 /*
1215
4dc854f @coke [cage] run 'make headerizer'
coke authored
1216 =item C<Parrot_String Parrot_new_string(PARROT_INTERP, const char *buffer,
1217 Parrot_UInt length, const char * const encoding_name, Parrot_UInt flags)>
3e1f322 Inline docs update
Michael Scott authored
1218
3a348a0 anchor overflow array immediately
Leopold Toetsch authored
1219 Create a new Parrot string from a passed-in buffer. Pass in a 0 for
e89e713 Here is my (large-ish) patch which integrates ICU into the core of
Dan Sugalski authored
1220 flags for right now.
3e1f322 Inline docs update
Michael Scott authored
1221
1222 A copy of the buffer is made.
1223
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored
1224 =cut
1225
3e1f322 Inline docs update
Michael Scott authored
1226 */
1227
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored
1228 PARROT_EXPORT
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so that s...
petdance authored
1229 PARROT_WARN_UNUSED_RESULT
1230 PARROT_CANNOT_RETURN_NULL
be68e0d @petdance Headerized extend.h and extend.c
petdance authored
1231 Parrot_String
258de48 @chromatic [src] Cleaned up some conversion and signedness warnings.
chromatic authored
1232 Parrot_new_string(PARROT_INTERP, ARGIN_NULLOK(const char *buffer),
1233 Parrot_UInt length, ARGIN_NULLOK(const char * const encoding_name),
1234 Parrot_UInt flags)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c headers...
petdance authored
1235 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored
1236 ASSERT_ARGS(Parrot_new_string)
ef4c70a @chromatic Sanitize external interface, mostly by changing Parrot_STRING to Parrot_...
chromatic authored
1237 Parrot_String retval;
3240c6e @chipdude Consistently name interpreter "interp" instead of "interpreter".
chipdude authored
1238 PARROT_CALLIN_START(interp);
1239