Skip to content
Newer
Older
100644 774 lines (568 sloc) 17.9 KB
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
1 /*
c9f655c @chromatic [src] Fixed yet another Parrot_pcc_split_signature_string() memory le…
chromatic authored Mar 25, 2010
2 Copyright (C) 2001-2010, Parrot Foundation.
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
3
4 =head1 NAME
5
6 src/extend.c - Parrot extension interface
7
8 =head1 DESCRIPTION
99b337c start of actual extension routines and docs
Dan Sugalski authored Oct 3, 2003
9
37fe0b3 @Whiteknight update some docs in src/extend.c
Whiteknight authored Jun 12, 2011
10 These are utility functions which extension code may use, but which are
11 typically not used by Parrot internally. These functions are for EXTENDING
12 use only, not for EMBEDDING. Embedding should be handed through the embedding
13 API in src/embed/*.c.
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
14
37fe0b3 @Whiteknight update some docs in src/extend.c
Whiteknight authored Jun 13, 2011
15 Extending situations are things like NCI function libraries, dyn-pmc and
16 dyn-op libraries which are loaded into Parrot and called from Parrot (as
17 opposed to embedding, where an external program calls into Parrot). These
18 functions assume the existance of an interpreter, memory management through
19 GC and stackwalking, and the presence of an exception-handling infrastructure.
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
20
21 =head2 Functions
22
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
23 =over 4
24
25 =cut
26
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
27 */
99b337c start of actual extension routines and docs
Dan Sugalski authored Oct 3, 2003
28
37fe0b3 @Whiteknight update some docs in src/extend.c
Whiteknight authored Jun 13, 2011
29 /* DO NOT CALL THESE FUNCTIONS WITHOUT LIBPARROT, OR FROM OUTSIDE LIBPARROT!!
30
31 These functions presume that GC is available and is properly configured
32 (setting the stacktop for stack walking, etc) and that there is an active
33 exception-handling infrastructure. Calling these functions when there is
34 no exception handlers available, including a default top-level handler, or
35 when the GC is not properly initialized can lead to big problems. Be sure
36 to understand the difference between an embedding and an extending
37 situation. Using the wrong kind of function in the wrong situation, or
38 combining some functions from the Embedding API with functions from the
39 extending API is a recipe for disaster. We (Parrot developers) will not be
40 held responsible if you insist on making these kinds of mistakes.
41
42 If there are utility functions that *YOU* as a user of parrot need from
43 either the extending or the embedding API, please request them or attempt
44 to write them yourself. Blindly mixing things from the wrong API, or
45 calling a function in the wrong context will cause you problems.
46
47 You have been warned.
48
49 Notice that the "Extending API" is a loosely-defined concept which is
50 currently understood to mean the sum of public APIs for various subsystems.
51 This definition may change in the future, but this is what we mean by the
52 phrase right now.
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored Aug 18, 2004
53
54 The problem comes in if these routines are called from *outside*
55 an interpreter. This happens when an embedding application calls
56 them to do stuff with PMCs, STRINGS, interpreter contents, and
57 suchlike things. This is perfectly legal -- in fact it's what
58 we've documented should be done -- but the problem is that the
59 stack base pointer will be NULL. This is Very Bad.
60
61 To deal with this there are two macros that are defined to handle
62 the problem.
63
3240c6e @chipdude Consistently name interpreter "interp" instead of "interpreter".
chipdude authored Nov 12, 2006
64 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 Aug 18, 2004
65 anchor needs setting and, if so, will set it. It must *always*
66 come immediately after the last variable declared in the block
67 making the calls into the interpreter, as it declares a variable
68 and has some code.
69
3240c6e @chipdude Consistently name interpreter "interp" instead of "interpreter".
chipdude authored Nov 12, 2006
70 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 Aug 18, 2004
71 the way it was, and should always be the last statement before a
72 return. (If you have multiple returns have it in multiple times)
73
74 Not doing this is a good way to introduce bizarre heisenbugs, so
75 just do it. This is the only place they ought to have to be put
76 in, and most of the functions are already written, so it's not
77 like it's an onerous requirement.
78
79 */
80
99b337c start of actual extension routines and docs
Dan Sugalski authored Oct 3, 2003
81 #include "parrot/parrot.h"
82 #include "parrot/extend.h"
63889c2 @cotto [PMC] replace PMC_struct_val and derivatives with ATTR accessors for …
cotto authored Feb 26, 2009
83 #include "pmc/pmc_sub.h"
68bf472 @bacek Merge context_unify3_simple branch back to trunk.
bacek authored Dec 20, 2009
84 #include "pmc/pmc_callcontext.h"
99b337c start of actual extension routines and docs
Dan Sugalski authored Oct 3, 2003
85
490c1c6 @petdance Changed HEADERIZER TARGET to HEADERIZER HFILE
petdance authored Jul 2, 2007
86 /* HEADERIZER HFILE: include/parrot/extend.h */
df5e1a1 @petdance lie to the headerizer
petdance authored Jun 15, 2007
87
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
88 /*
89
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
90 =item C<int Parrot_vfprintf(PARROT_INTERP, Parrot_PMC pio, const char *s,
91 va_list args)>
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
92
93 Writes a C string format with a varargs list to a PIO.
94
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
95 =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 Jul 8, 2008
96
97 Writes a C string format with varargs to a PIO.
98
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
99 =item C<int Parrot_printf(NULLOK_INTERP, const char *s, ...)>
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
100
101 Writes a C string format with varargs to C<stdout>.
102
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
103 =item C<int Parrot_eprintf(NULLOK_INTERP, const char *s, ...)>
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
104
105 Writes a C string format with varargs to C<stderr>.
106
fb2ca1e @NotFound fix lack of cut in a pod comment
NotFound authored Aug 28, 2008
107 =cut
108
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
109 */
110
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
111 PARROT_EXPORT
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
112 int
113 Parrot_vfprintf(PARROT_INTERP, ARGIN(Parrot_PMC pio),
114 ARGIN(const char *s), va_list args)
115 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
116 ASSERT_ARGS(Parrot_vfprintf)
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
117 STRING * str;
118 INTVAL retval;
119
120 PARROT_CALLIN_START(interp);
121 str = Parrot_vsprintf_c(interp, s, args);
9f9cea2 @allisonrandal [pdd22io] Merging the pdd22io_part2 branch into trunk for r32922 to r…
allisonrandal authored Dec 9, 2008
122 retval = Parrot_io_putps(interp, pio, str);
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
123 PARROT_CALLIN_END(interp);
124
125 return retval;
126 }
127
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
128 PARROT_EXPORT
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
129 int
130 Parrot_fprintf(PARROT_INTERP, ARGIN(Parrot_PMC pio),
131 ARGIN(const char *s), ...)
132 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
133 ASSERT_ARGS(Parrot_fprintf)
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
134 va_list args;
135 INTVAL retval;
136
137 va_start(args, s);
138 retval = Parrot_vfprintf(interp, pio, s, args);
139 va_end(args);
140
141 return retval;
142 }
143
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
144 PARROT_EXPORT
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
145 int
146 Parrot_printf(NULLOK_INTERP, ARGIN(const char *s), ...)
147 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
148 ASSERT_ARGS(Parrot_printf)
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
149 va_list args;
150 INTVAL retval;
151 va_start(args, s);
152
153 if (interp) {
9f9cea2 @allisonrandal [pdd22io] Merging the pdd22io_part2 branch into trunk for r32922 to r…
allisonrandal authored Dec 9, 2008
154 retval = Parrot_vfprintf(interp, Parrot_io_STDOUT(interp), s, args);
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
155 }
156 else {
157 /* Be nice about this...
9f9cea2 @allisonrandal [pdd22io] Merging the pdd22io_part2 branch into trunk for r32922 to r…
allisonrandal authored Dec 9, 2008
158 ** 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 Jul 8, 2008
159 */
160 retval = vfprintf(stdout, s, args);
161 }
162 va_end(args);
163
164 return retval;
165 }
166
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
167 PARROT_EXPORT
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
168 int
169 Parrot_eprintf(NULLOK_INTERP, ARGIN(const char *s), ...)
170 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
171 ASSERT_ARGS(Parrot_eprintf)
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
172 va_list args;
173 INTVAL retval;
174
175 va_start(args, s);
176
177 if (interp) {
9f9cea2 @allisonrandal [pdd22io] Merging the pdd22io_part2 branch into trunk for r32922 to r…
allisonrandal authored Dec 9, 2008
178 retval = Parrot_vfprintf(interp, Parrot_io_STDERR(interp), s, args);
87909b3 @NotFound Add Parrot_printf and Parrot_eprintf to the extend API
NotFound authored Jul 8, 2008
179 }
180 else {
181 /* Be nice about this...
9f9cea2 @allisonrandal [pdd22io] Merging the pdd22io_part2 branch into trunk for r32922 to r…
allisonrandal authored Dec 9, 2008
182 ** 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 Jul 8, 2008
183 */
184 retval=vfprintf(stderr, s, args);
185 }
186
187 va_end(args);
188
189 return retval;
190 }
191
192 /*
193
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
194 =item C<Parrot_PMC Parrot_get_root_namespace(PARROT_INTERP)>
4429375 @NotFound [core] add functions Parrot_get_root_namespace and Parrot_PMC_get_pmc…
NotFound authored Feb 18, 2009
195
196 Return the root namespace
197
198 =cut
199
200 */
201
202 PARROT_EXPORT
b12ac0b @petdance function annotations
petdance authored Jun 30, 2010
203 PARROT_PURE_FUNCTION
4429375 @NotFound [core] add functions Parrot_get_root_namespace and Parrot_PMC_get_pmc…
NotFound authored Feb 18, 2009
204 Parrot_PMC
205 Parrot_get_root_namespace(PARROT_INTERP)
206 {
207 ASSERT_ARGS(Parrot_get_root_namespace)
208 return interp->root_namespace;
209 }
210
211 /*
212
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
213 =item C<Parrot_PMC Parrot_PMC_new(PARROT_INTERP, Parrot_Int type)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
214
215 Create and return a new PMC.
216
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
217 =cut
218
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
219 */
220
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
221 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
222 Parrot_PMC
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
223 Parrot_PMC_new(PARROT_INTERP, Parrot_Int type)
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
224 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
225 ASSERT_ARGS(Parrot_PMC_new)
fa999b0 First chunk of extension code done
Dan Sugalski authored Oct 3, 2003
226 Parrot_PMC newpmc;
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored Aug 18, 2004
227 PARROT_CALLIN_START(interp);
083213a @Whiteknight start rename of pmc_new to Parrot_pmc_new
Whiteknight authored Feb 16, 2010
228 newpmc = Parrot_pmc_new_noinit(interp, type);
fa999b0 First chunk of extension code done
Dan Sugalski authored Oct 3, 2003
229 VTABLE_init(interp, newpmc);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored Aug 18, 2004
230 PARROT_CALLIN_END(interp);
fa999b0 First chunk of extension code done
Dan Sugalski authored Oct 3, 2003
231 return newpmc;
232 }
233
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
234 /*
235
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
236 =item C<Parrot_Int Parrot_PMC_typenum(PARROT_INTERP, const char *_class)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
237
238 Returns the internal identifier that represents the named class.
239
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
240 =cut
241
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
242 */
243
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
244 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
245 Parrot_Int
802efc1 @petdance If something is NULLOK(const...) it is by definition ARGIN_NULLOK(con…
petdance authored Dec 12, 2007
246 Parrot_PMC_typenum(PARROT_INTERP, ARGIN_NULLOK(const char *_class))
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
247 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
248 ASSERT_ARGS(Parrot_PMC_typenum)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored Aug 18, 2004
249 Parrot_Int retval;
250 PARROT_CALLIN_START(interp);
847522f @Whiteknight rename the rest of the functions in pmc.c, start updating the rest of…
Whiteknight authored Feb 16, 2010
251 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 Aug 18, 2004
252 PARROT_CALLIN_END(interp);
253 return retval;
fa999b0 First chunk of extension code done
Dan Sugalski authored Oct 3, 2003
254 }
255
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
256 /*
257
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
258 =item C<Parrot_PMC Parrot_PMC_null(void)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
259
260 Returns the special C<NULL> PMC.
261
06fb631 @paultcochrane [core] Added function documentation.
paultcochrane authored Nov 5, 2007
262 =cut
263
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
264 */
265
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
266 PARROT_EXPORT
b12ac0b @petdance function annotations
petdance authored Jun 30, 2010
267 PARROT_PURE_FUNCTION
11323f5 @petdance fixing null/not-null annotations
petdance authored Mar 26, 2011
268 PARROT_CAN_RETURN_NULL
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
269 Parrot_PMC
270 Parrot_PMC_null(void)
271 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
272 ASSERT_ARGS(Parrot_PMC_null)
8deb08e Expose PMCNULL to extension API.
Melvin Smith authored Oct 28, 2003
273 return PMCNULL;
274 }
275
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
276 /*
277
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
278 =item C<void Parrot_free_cstring(char *string)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
279
280 Deallocate a C string that the interpreter has handed to you.
281
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
282 =cut
283
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
284 */
8deb08e Expose PMCNULL to extension API.
Melvin Smith authored Oct 28, 2003
285
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
286 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
287 void
172bc90 @petdance updating annotations
petdance authored Apr 10, 2010
288 Parrot_free_cstring(ARGFREE(char *string))
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
289 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
290 ASSERT_ARGS(Parrot_free_cstring)
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored Feb 3, 2009
291 Parrot_str_free_cstring(string);
99b337c start of actual extension routines and docs
Dan Sugalski authored Oct 3, 2003
292 }
293
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
294 /*
295
6c743be @allisonrandal [pcc] Add a generic extend/embed interface function for invoking Parrot
allisonrandal authored Oct 21, 2009
296 =item C<void Parrot_ext_call(PARROT_INTERP, Parrot_PMC sub_pmc, const char
297 *signature, ...)>
298
299 Call a Parrot subroutine or method with the given function signature. The
300 function signature holds one type character for each argument or return, these
301 are:
302
303 I ... Parrot_Int
304 N ... Parrot_Float
305 S ... Parrot_String
306 P ... Parrot_PMC
307
308 Returns come after the arguments, separated by an arrow, so "PN->S" takes a PMC
309 and a float as arguments and returns a string.
310
311 Pass the variables for the arguments and returns in the same order as the
312 signature, with returns as reference to the variable (so it can be modified).
313
314 Parrot_ext_call(interp, sub, "P->S", pmc_arg, &string_result);
315
316 To call a method, pass the object for the method as the first argument, and
317 mark it in the signature as "Pi" ("i" stands for "invocant").
318
319 Parrot_ext_call(interp, sub, "PiP->S", object_arg, pmc_arg, &string_result);
320
321 =cut
322
323 */
324
325 PARROT_EXPORT
326 void
327 Parrot_ext_call(PARROT_INTERP, ARGIN(Parrot_PMC sub_pmc),
328 ARGIN(const char *signature), ...)
329 {
330 ASSERT_ARGS(Parrot_ext_call)
331 va_list args;
363ca41 @chromatic Merged pcc_hackathon_6Mar10 into trunk. Because this changed op numbe…
chromatic authored Mar 22, 2010
332 PMC *call_obj;
f3faadb @bacek Fix build with g++
bacek authored Mar 27, 2010
333 const char *arg_sig, *ret_sig;
c9f655c @chromatic [src] Fixed yet another Parrot_pcc_split_signature_string() memory le…
chromatic authored Mar 25, 2010
334
f084166 @petdance Removed an unused argument. Fixed consting.
petdance authored Apr 9, 2010
335 PMC * const old_call_obj = Parrot_pcc_get_signature(interp,
c9f655c @chromatic [src] Fixed yet another Parrot_pcc_split_signature_string() memory le…
chromatic authored Mar 25, 2010
336 CURRENT_CONTEXT(interp));
f084166 @petdance Removed an unused argument. Fixed consting.
petdance authored Apr 9, 2010
337 Parrot_pcc_split_signature_string(signature, &arg_sig, &ret_sig);
6c743be @allisonrandal [pcc] Add a generic extend/embed interface function for invoking Parrot
allisonrandal authored Oct 21, 2009
338
339 va_start(args, signature);
c9f655c @chromatic [src] Fixed yet another Parrot_pcc_split_signature_string() memory le…
chromatic authored Mar 25, 2010
340 call_obj = Parrot_pcc_build_call_from_varargs(interp, PMCNULL,
341 arg_sig, &args);
6c743be @allisonrandal [pcc] Add a generic extend/embed interface function for invoking Parrot
allisonrandal authored Oct 21, 2009
342
363ca41 @chromatic Merged pcc_hackathon_6Mar10 into trunk. Because this changed op numbe…
chromatic authored Mar 22, 2010
343 Parrot_pcc_invoke_from_sig_object(interp, sub_pmc, call_obj);
344 call_obj = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
345 Parrot_pcc_fill_params_from_varargs(interp, call_obj, ret_sig, &args,
346 PARROT_ERRORS_RESULT_COUNT_FLAG);
347 va_end(args);
112c28e @bacek Restore old CallContext in Parrot_ext_call. Spotted by fperrad++
bacek authored Mar 23, 2010
348 Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), old_call_obj);
6c743be @allisonrandal [pcc] Add a generic extend/embed interface function for invoking Parrot
allisonrandal authored Oct 21, 2009
349 }
350
668635f @NotFound add function Parrot_ext_try and use it in extend_vtable tests
NotFound authored Feb 4, 2011
351 /*
352
353 =item C<void Parrot_ext_try(PARROT_INTERP, void (*cfunction(Parrot_Interp, void
354 *)), void (*chandler(Parrot_Interp, PMC *, void *)), void *data)>
355
356 Executes the cfunction argument wrapped in a exception handler.
357 If the function throws, the provided handler function is invoked
358
359 =cut
360
361 */
362
363 PARROT_EXPORT
364 void
365 Parrot_ext_try(PARROT_INTERP,
366 ARGIN_NULLOK(void (*cfunction)(Parrot_Interp, void *)),
367 ARGIN_NULLOK(void (*chandler)(Parrot_Interp, PMC *, void *)),
368 ARGIN_NULLOK(void *data))
369 {
370 ASSERT_ARGS(Parrot_ext_try)
371 if (cfunction) {
372 Parrot_runloop jmp;
8bf9b75 @NotFound restore initial context in Parrot_ext_try
NotFound authored Feb 10, 2011
373 Parrot_Context *initialctx, *curctx;
668635f @NotFound add function Parrot_ext_try and use it in extend_vtable tests
NotFound authored Feb 4, 2011
374 PARROT_CALLIN_START(interp);
8bf9b75 @NotFound restore initial context in Parrot_ext_try
NotFound authored Feb 10, 2011
375 initialctx = CONTEXT(interp);
668635f @NotFound add function Parrot_ext_try and use it in extend_vtable tests
NotFound authored Feb 4, 2011
376 switch (setjmp(jmp.resume)) {
377 case 0: /* try */
378 Parrot_ex_add_c_handler(interp, &jmp);
379 (*cfunction)(interp, data);
8bf9b75 @NotFound restore initial context in Parrot_ext_try
NotFound authored Feb 10, 2011
380 curctx = CONTEXT(interp);
381 if (curctx != initialctx) {
382 Parrot_warn(interp, PARROT_WARNINGS_NONE_FLAG,
383 "popping context in Parrot_ext_try");
384 do {
385 if (curctx == NULL)
386 do_panic(interp,
387 "cannot restore context", __FILE__, __LINE__);
388 } while ((curctx = CONTEXT(interp)) != initialctx);
389 }
668635f @NotFound add function Parrot_ext_try and use it in extend_vtable tests
NotFound authored Feb 4, 2011
390 Parrot_cx_delete_handler_local(interp, STRINGNULL);
391 break;
392 default: /* catch */
393 {
394 PMC *exception = jmp.exception;
b03561f @NotFound initialize curctx in the catch part of Parrot_ext_try
NotFound authored Feb 11, 2011
395 curctx = CONTEXT(interp);
8bf9b75 @NotFound restore initial context in Parrot_ext_try
NotFound authored Feb 10, 2011
396 if (curctx != initialctx) {
397 Parrot_warn(interp, PARROT_WARNINGS_NONE_FLAG,
398 "popping context in Parrot_ext_try");
399 do {
400 if (curctx == NULL)
401 do_panic(interp,
402 "cannot restore context", __FILE__, __LINE__);
403 } while ((curctx = CONTEXT(interp)) != initialctx);
404 }
668635f @NotFound add function Parrot_ext_try and use it in extend_vtable tests
NotFound authored Feb 4, 2011
405 Parrot_cx_delete_handler_local(interp, STRINGNULL);
406 if (chandler)
407 (*chandler)(interp, exception, data);
408 }
409 }
410 PARROT_CALLIN_END(interp);
411 }
412 }
c9f655c @chromatic [src] Fixed yet another Parrot_pcc_split_signature_string() memory le…
chromatic authored Mar 25, 2010
413
6c743be @allisonrandal [pcc] Add a generic extend/embed interface function for invoking Parrot
allisonrandal authored Oct 21, 2009
414 /*
415
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
416 =item C<Parrot_Int Parrot_get_intreg(PARROT_INTERP, Parrot_Int regnum)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
417
418 Return the value of an integer register.
419
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
420 =cut
421
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
422 */
3b31e02 More extension stuff at least partially stubbed out
Dan Sugalski authored Oct 9, 2003
423
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
424 PARROT_EXPORT
b12ac0b @petdance function annotations
petdance authored Jun 30, 2010
425 PARROT_PURE_FUNCTION
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
426 Parrot_Int
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
427 Parrot_get_intreg(PARROT_INTERP, Parrot_Int regnum)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c heade…
petdance authored Jun 13, 2006
428 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
429 ASSERT_ARGS(Parrot_get_intreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variab…
petdance authored Jul 9, 2007
430 return REG_INT(interp, regnum);
b4bdfa8 Stub in some new object manipulation methods, and some extension rout…
Dan Sugalski authored Oct 9, 2003
431 }
432
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
433 /*
434
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
435 =item C<Parrot_Float Parrot_get_numreg(PARROT_INTERP, Parrot_Int regnum)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
436
437 Return the value of a numeric register.
438
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
439 =cut
440
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
441 */
442
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
443 PARROT_EXPORT
b12ac0b @petdance function annotations
petdance authored Jun 30, 2010
444 PARROT_PURE_FUNCTION
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
445 Parrot_Float
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
446 Parrot_get_numreg(PARROT_INTERP, Parrot_Int regnum)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c heade…
petdance authored Jun 13, 2006
447 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
448 ASSERT_ARGS(Parrot_get_numreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variab…
petdance authored Jul 9, 2007
449 return REG_NUM(interp, regnum);
b4bdfa8 Stub in some new object manipulation methods, and some extension rout…
Dan Sugalski authored Oct 9, 2003
450 }
451
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
452 /*
453
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
454 =item C<Parrot_String Parrot_get_strreg(PARROT_INTERP, Parrot_Int regnum)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
455
456 Return the value of a string register.
457
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
458 =cut
459
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
460 */
461
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
462 PARROT_EXPORT
b12ac0b @petdance function annotations
petdance authored Jun 30, 2010
463 PARROT_PURE_FUNCTION
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
464 Parrot_String
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
465 Parrot_get_strreg(PARROT_INTERP, Parrot_Int regnum)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c heade…
petdance authored Jun 13, 2006
466 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
467 ASSERT_ARGS(Parrot_get_strreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variab…
petdance authored Jul 9, 2007
468 return REG_STR(interp, regnum);
b4bdfa8 Stub in some new object manipulation methods, and some extension rout…
Dan Sugalski authored Oct 9, 2003
469 }
470
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
471 /*
472
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
473 =item C<Parrot_PMC Parrot_get_pmcreg(PARROT_INTERP, Parrot_Int regnum)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
474
475 Return the value of a PMC register.
476
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
477 =cut
478
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
479 */
480
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
481 PARROT_EXPORT
b12ac0b @petdance function annotations
petdance authored Jun 30, 2010
482 PARROT_PURE_FUNCTION
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
483 Parrot_PMC
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
484 Parrot_get_pmcreg(PARROT_INTERP, Parrot_Int regnum)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c heade…
petdance authored Jun 13, 2006
485 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
486 ASSERT_ARGS(Parrot_get_pmcreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variab…
petdance authored Jul 9, 2007
487 return REG_PMC(interp, regnum);
b4bdfa8 Stub in some new object manipulation methods, and some extension rout…
Dan Sugalski authored Oct 9, 2003
488 }
489
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
490 /*
491
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
492 =item C<void Parrot_set_intreg(PARROT_INTERP, Parrot_Int regnum, Parrot_Int
493 value)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
494
495 Set the value of an I register.
496
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
497 =cut
498
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
499 */
500
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
501 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
502 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
503 Parrot_set_intreg(PARROT_INTERP, Parrot_Int regnum,
d067bc6 @ambs 80's cuts.
ambs authored Aug 20, 2006
504 Parrot_Int value)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c heade…
petdance authored Jun 13, 2006
505 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
506 ASSERT_ARGS(Parrot_set_intreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variab…
petdance authored Jul 9, 2007
507 REG_INT(interp, regnum) = value;
b4bdfa8 Stub in some new object manipulation methods, and some extension rout…
Dan Sugalski authored Oct 9, 2003
508 }
509
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
510 /*
511
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
512 =item C<void Parrot_set_numreg(PARROT_INTERP, Parrot_Int regnum, Parrot_Float
513 value)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
514
515 Set the value of an N register.
516
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
517 =cut
518
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
519 */
520
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
521 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
522 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
523 Parrot_set_numreg(PARROT_INTERP, Parrot_Int regnum,
d067bc6 @ambs 80's cuts.
ambs authored Aug 20, 2006
524 Parrot_Float value)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c heade…
petdance authored Jun 13, 2006
525 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
526 ASSERT_ARGS(Parrot_set_numreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variab…
petdance authored Jul 9, 2007
527 REG_NUM(interp, regnum) = value;
b4bdfa8 Stub in some new object manipulation methods, and some extension rout…
Dan Sugalski authored Oct 9, 2003
528 }
529
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
530 /*
531
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
532 =item C<void Parrot_set_strreg(PARROT_INTERP, Parrot_Int regnum, Parrot_String
533 value)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
534
535 Set the value of an S register.
536
bc4de54 @moritz add '=cut' lines to some POD documents. Closes trac #19, jimmy++
moritz authored Dec 6, 2008
537 =cut
538
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
539 */
540
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
541 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
542 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
543 Parrot_set_strreg(PARROT_INTERP, Parrot_Int regnum,
ef4c70a @chromatic Sanitize external interface, mostly by changing Parrot_STRING to Parr…
chromatic authored May 2, 2007
544 Parrot_String value)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c heade…
petdance authored Jun 13, 2006
545 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
546 ASSERT_ARGS(Parrot_set_strreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variab…
petdance authored Jul 9, 2007
547 REG_STR(interp, regnum) = value;
5f1d8d9 @bacek Add write barrier to Parrot_set_strreg
bacek authored Feb 17, 2011
548 PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp));
b4bdfa8 Stub in some new object manipulation methods, and some extension rout…
Dan Sugalski authored Oct 9, 2003
549 }
550
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
551 /*
552
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
553 =item C<void Parrot_set_pmcreg(PARROT_INTERP, Parrot_Int regnum, Parrot_PMC
554 value)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
555
556 Set the value of a P register.
557
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
558 =cut
559
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
560 */
561
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
562 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
563 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
564 Parrot_set_pmcreg(PARROT_INTERP, Parrot_Int regnum,
d067bc6 @ambs 80's cuts.
ambs authored Aug 20, 2006
565 Parrot_PMC value)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c heade…
petdance authored Jun 13, 2006
566 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
567 ASSERT_ARGS(Parrot_set_pmcreg)
db561ab @petdance Changed REG_(INT|NUM|PMC|STR) to explicitly pass in the interp variab…
petdance authored Jul 9, 2007
568 REG_PMC(interp, regnum) = value;
2f168ec @bacek Add write barrier to Parrot_set_pmcreg.
bacek authored Feb 17, 2011
569 PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp));
b4bdfa8 Stub in some new object manipulation methods, and some extension rout…
Dan Sugalski authored Oct 9, 2003
570 }
571
000d780 Add in some string construction functions
Dan Sugalski authored Oct 17, 2003
572 /*=for api extend Parrot_new_string
573 *
574 */
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
575 /*
576
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
577 =item C<Parrot_String Parrot_new_string(PARROT_INTERP, const char *buffer,
578 Parrot_UInt length, const char * const encoding_name, Parrot_UInt flags)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
579
3a348a0 anchor overflow array immediately
Leopold Toetsch authored May 3, 2004
580 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 Apr 9, 2004
581 flags for right now.
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
582
583 A copy of the buffer is made.
584
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
585 =cut
586
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
587 */
588
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
589 PARROT_EXPORT
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
590 PARROT_WARN_UNUSED_RESULT
591 PARROT_CANNOT_RETURN_NULL
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
592 Parrot_String
258de48 @chromatic [src] Cleaned up some conversion and signedness warnings.
chromatic authored Oct 14, 2008
593 Parrot_new_string(PARROT_INTERP, ARGIN_NULLOK(const char *buffer),
594 Parrot_UInt length, ARGIN_NULLOK(const char * const encoding_name),
595 Parrot_UInt flags)
831ff97 @petdance Added check to headerizer to check sanity of parms. Tweaked *.c heade…
petdance authored Jun 13, 2006
596 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
597 ASSERT_ARGS(Parrot_new_string)
ef4c70a @chromatic Sanitize external interface, mostly by changing Parrot_STRING to Parr…
chromatic authored May 2, 2007
598 Parrot_String retval;
456db43 @nwellnhof [str] Prepare deprecation of string_* functions
nwellnhof authored Oct 3, 2010
599 const STR_VTABLE *encoding;
600
3240c6e @chipdude Consistently name interpreter "interp" instead of "interpreter".
chipdude authored Nov 12, 2006
601 PARROT_CALLIN_START(interp);
456db43 @nwellnhof [str] Prepare deprecation of string_* functions
nwellnhof authored Oct 3, 2010
602
603 if (encoding_name) {
604 encoding = Parrot_find_encoding(interp, encoding_name);
605 if (!encoding)
606 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
607 "Can't make '%s' encoding strings", encoding_name);
608 }
609 else
610 encoding = Parrot_default_encoding_ptr;
611
612 retval = Parrot_str_new_init(interp, buffer, length, encoding, flags);
613
3240c6e @chipdude Consistently name interpreter "interp" instead of "interpreter".
chipdude authored Nov 12, 2006
614 PARROT_CALLIN_END(interp);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored Aug 18, 2004
615 return retval;
000d780 Add in some string construction functions
Dan Sugalski authored Oct 17, 2003
616 }
617
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
618 /*
619
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
620 =item C<void Parrot_register_pmc(PARROT_INTERP, Parrot_PMC pmc)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
621
e1f3d50 @cotto [gc] replace/remove "DOD" in comments in most files in src/
cotto authored Feb 12, 2009
622 Add a reference of the PMC to the interpreter's GC registry. This prevents PMCs
623 only known to extension from getting destroyed during GC runs.
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
624
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
625 =cut
626
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
627 */
9b7b3de register ops
Leopold Toetsch authored Dec 31, 2003
628
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
629 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
630 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
631 Parrot_register_pmc(PARROT_INTERP, Parrot_PMC pmc)
9b7b3de register ops
Leopold Toetsch authored Dec 31, 2003
632 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
633 ASSERT_ARGS(Parrot_register_pmc)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored Aug 18, 2004
634 PARROT_CALLIN_START(interp);
847522f @Whiteknight rename the rest of the functions in pmc.c, start updating the rest of…
Whiteknight authored Feb 16, 2010
635 Parrot_pmc_gc_register(interp, pmc);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored Aug 18, 2004
636 PARROT_CALLIN_END(interp);
9b7b3de register ops
Leopold Toetsch authored Dec 31, 2003
637 }
638
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
639 /*
640
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
641 =item C<void Parrot_unregister_pmc(PARROT_INTERP, Parrot_PMC pmc)>
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
642
e1f3d50 @cotto [gc] replace/remove "DOD" in comments in most files in src/
cotto authored Feb 12, 2009
643 Remove a reference of the PMC from the interpreter's GC registry. If the
644 reference count reaches zero, the PMC will be destroyed during the next GC run.
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
645
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
646 =cut
647
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
648 */
9b7b3de register ops
Leopold Toetsch authored Dec 31, 2003
649
42d0af3 @particle #60624: [DEPRECATED] PARROT_API changes to PARROT_EXPORT
particle authored Nov 19, 2008
650 PARROT_EXPORT
be68e0d @petdance Headerized extend.h and extend.c
petdance authored Jun 20, 2007
651 void
c4b44b0 @petdance Putting PARROT_INTERP in all the typedefs instead of Interp *, so tha…
petdance authored Jul 22, 2007
652 Parrot_unregister_pmc(PARROT_INTERP, Parrot_PMC pmc)
9b7b3de register ops
Leopold Toetsch authored Dec 31, 2003
653 {
00f1c24 @Infinoid [cage] Attempt to work around MSVC warnings related to ASSERT_ARGS().
Infinoid authored Jan 5, 2009
654 ASSERT_ARGS(Parrot_unregister_pmc)
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored Aug 18, 2004
655 PARROT_CALLIN_START(interp);
847522f @Whiteknight rename the rest of the functions in pmc.c, start updating the rest of…
Whiteknight authored Feb 16, 2010
656 Parrot_pmc_gc_unregister(interp, pmc);
ffd5c6d Make the extension interface set stacktop right when it needs to so
Dan Sugalski authored Aug 18, 2004
657 PARROT_CALLIN_END(interp);
9b7b3de register ops
Leopold Toetsch authored Dec 31, 2003
658 }
659
06fb631 @paultcochrane [core] Added function documentation.
paultcochrane authored Nov 5, 2007
660 /*
661
859b8a9 @cotto [extend] add functions for string registering and unregistering for e…
cotto authored Oct 7, 2010
662 =item C<void Parrot_register_string(PARROT_INTERP, Parrot_String s)>
663
664 Add a reference of the string to the interpreter's GC registry. This prevents
665 strings only known to extension from getting destroyed during GC runs.
666
667 =cut
668
669 */
670
671 PARROT_EXPORT
672 void
673 Parrot_register_string(PARROT_INTERP, Parrot_String s)
674 {
675 ASSERT_ARGS(Parrot_register_string)
676 PARROT_CALLIN_START(interp);
677 Parrot_str_gc_register(interp, s);
678 PARROT_CALLIN_END(interp);
679 }
680
681 /*
682
683 =item C<void Parrot_unregister_string(PARROT_INTERP, Parrot_String s)>
684
685 Remove a reference of the string from the interpreter's GC registry. If the
686 reference count reaches zero, the string will be destroyed during the next GC
687 run.
688
689 =cut
690
691 */
692
693 PARROT_EXPORT
694 void
695 Parrot_unregister_string(PARROT_INTERP, Parrot_String s)
696 {
697 ASSERT_ARGS(Parrot_unregister_string)
698 PARROT_CALLIN_START(interp);
699 Parrot_str_gc_unregister(interp, s);
700 PARROT_CALLIN_END(interp);
701 }
702
703 /*
704
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
705 =item C<Parrot_PMC Parrot_sub_new_from_c_func(PARROT_INTERP, void (*func(void)),
706 const char * signature)>
50f5936 @NotFound [core] add Parrot_sub_new_from_c_func to extend.h
NotFound authored Feb 19, 2009
707
6d4f4cf @NotFound [core] add Parrot_PMC_push_pmcval and Parrot_PMC_newclass to the exte…
NotFound authored Mar 8, 2009
708 Returns a PMC sub wrapper for a c function.
50f5936 @NotFound [core] add Parrot_sub_new_from_c_func to extend.h
NotFound authored Feb 19, 2009
709
710 =cut
711
712 */
713
714 PARROT_EXPORT
715 Parrot_PMC
716 Parrot_sub_new_from_c_func(PARROT_INTERP,
969837b @Infinoid [cage] Add ARGIN() to some new function arguments.
Infinoid authored Mar 25, 2009
717 ARGIN(void (*func)(void)), ARGIN(const char * signature))
50f5936 @NotFound [core] add Parrot_sub_new_from_c_func to extend.h
NotFound authored Feb 19, 2009
718 {
6b45a4c @NotFound [cage] add missed ASSERT_ARGS
NotFound authored Feb 24, 2009
719 ASSERT_ARGS(Parrot_sub_new_from_c_func)
50f5936 @NotFound [core] add Parrot_sub_new_from_c_func to extend.h
NotFound authored Feb 19, 2009
720 Parrot_String sig = Parrot_new_string(interp, signature, strlen(signature),
721 (char *) NULL, 0);
083213a @Whiteknight start rename of pmc_new to Parrot_pmc_new
Whiteknight authored Feb 16, 2010
722 Parrot_PMC sub = Parrot_pmc_new(interp, enum_class_NCI);
50f5936 @NotFound [core] add Parrot_sub_new_from_c_func to extend.h
NotFound authored Feb 19, 2009
723 VTABLE_set_pointer_keyed_str(interp, sub, sig, F2DPTR(func));
724 return sub;
725 }
726
727 /*
728
4dc854f @coke [cage] run 'make headerizer'
coke authored Apr 1, 2009
729 =item C<Parrot_PMC Parrot_PMC_newclass(PARROT_INTERP, Parrot_PMC classtype)>
6d4f4cf @NotFound [core] add Parrot_PMC_push_pmcval and Parrot_PMC_newclass to the exte…
NotFound authored Mar 8, 2009
730
731 Create a class with the type given
732
733 =cut
734
735 */
736
737 PARROT_EXPORT
738 Parrot_PMC
739 Parrot_PMC_newclass(PARROT_INTERP, Parrot_PMC classtype)
740 {
741 ASSERT_ARGS(Parrot_PMC_newclass)
742 Parrot_PMC result;
743 PARROT_CALLIN_START(interp);
744
083213a @Whiteknight start rename of pmc_new to Parrot_pmc_new
Whiteknight authored Feb 16, 2010
745 result = Parrot_pmc_new_init(interp, enum_class_Class, classtype);
6d4f4cf @NotFound [core] add Parrot_PMC_push_pmcval and Parrot_PMC_newclass to the exte…
NotFound authored Mar 8, 2009
746
747 PARROT_CALLIN_END(interp);
748 return result;
749 }
750
751 /*
752
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
753 =back
754
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
755 =head1 SEE ALSO
756
0ba0e8a Remove extend.pod; superseded by PDD11
Simon Glover authored Feb 23, 2004
757 See F<include/parrot/extend.h> and F<docs/pdds/pdd11_extending.pod>.
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
758
759 =head1 HISTORY
760
761 Initial version by Dan Sugalski.
762
bc15dd5 @paultcochrane [core] Converted FUNCDOCs to POD and tidied the POD up a bit.
paultcochrane authored Sep 22, 2007
763 =cut
764
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
765 */
766
2a130ef @particle [PDD07]:
particle authored Sep 22, 2006
767
3e1f322 Inline docs update
Michael Scott authored Jan 26, 2004
768 /*
99b337c start of actual extension routines and docs
Dan Sugalski authored Oct 3, 2003
769 * Local variables:
2a130ef @particle [PDD07]:
particle authored Sep 22, 2006
770 * c-file-style: "parrot"
99b337c start of actual extension routines and docs
Dan Sugalski authored Oct 3, 2003
771 * End:
1d7dded @plobsing update C file vim modelines
plobsing authored Nov 29, 2010
772 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
99b337c start of actual extension routines and docs
Dan Sugalski authored Oct 3, 2003
773 */
Something went wrong with that request. Please try again.