Skip to content
This repository
Newer
Older
100644 711 lines (552 sloc) 20.193 kb
540a832b » jkeenan
2010-12-04 [codingstd] Mostly linelength fixes.
1 /*
ced54a52 » NotFound
2011-01-27 Fix remaining 'might be clobbered' warning
2 Copyright (C) 2010-2011, Parrot Foundation.
540a832b » jkeenan
2010-12-04 [codingstd] Mostly linelength fixes.
3
4 =head1 NAME
5
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
6 src/embed/api.c - The Parrot embedding interface
540a832b » jkeenan
2010-12-04 [codingstd] Mostly linelength fixes.
7
8 =head1 DESCRIPTION
9
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
10 This file implements functions of the Parrot embedding interface.
11
12 =head2 Functions
13
14 =over 4
540a832b » jkeenan
2010-12-04 [codingstd] Mostly linelength fixes.
15
16 =cut
17
18 */
19
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
20 #include "parrot/parrot.h"
704e3c4d » bluescreen10
2010-11-28 Made another test case pass by putting debug information. Also remove…
21 #include "parrot/runcore_api.h"
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
22 #include "parrot/embed.h"
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
23 #include "parrot/api.h"
1b6d1ced » Whiteknight
2010-11-10 start breaking up the embedding stuff into multiple files. Add embed_…
24 #include "embed_private.h"
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
25
3f8ed92a » Whiteknight
2010-11-10 fix some file references and run headerizer to see my work so far
26 /* HEADERIZER HFILE: include/parrot/api.h */
27
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
28
29 /*
30
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
31 =item C<Parrot_Int Parrot_api_get_result(Parrot_PMC interp_pmc, Parrot_Int
32 *is_error, Parrot_PMC * exception, Parrot_Int *exit_code, Parrot_String *
33 errmsg)>
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
34
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
35 Gets the results of the last API function call and stores the results in
36 C<is_error>, C<exception>, C<exit_code> and C<errmsg>. This function returns
37 a true value if this call is successful and false value otherwise. The stored
38 information is as follow:
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
39
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
40 C<is_error> a true value if an unhandled exception was thrown or the program
41 terminated with an error condition and a false value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
42
43 C<exception> the last exception thrown.
44
45 C<exit_code> the exit code of the running program.
46
47 C<errmsg> contains an string with the last error message.
48
49 =cut
50
51 */
52
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
53 PARROT_API
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
54 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
55 Parrot_api_get_result(Parrot_PMC interp_pmc, ARGOUT(Parrot_Int *is_error),
56 ARGOUT(Parrot_PMC * exception), ARGOUT(Parrot_Int *exit_code),
57 ARGOUT(Parrot_String * errmsg))
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
58 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
59 ASSERT_ARGS(Parrot_api_get_result)
2483c688 » Whiteknight
2010-12-02 implement the new error-handling mechanism. Instead of a string, we p…
60 EMBED_API_CALLIN(interp_pmc, interp)
be50d63d » bluescreen10
2010-11-27 Implemented first version of Parrot_get_result, now a lot of failing …
61 *exit_code = interp->exit_code;
2483c688 » Whiteknight
2010-12-02 implement the new error-handling mechanism. Instead of a string, we p…
62 *exception = interp->final_exception;
73f662d6 » Whiteknight
2010-12-05 some fixes so libparrot builds with g++
63 if (PMC_IS_NULL(*exception)) {
2483c688 » Whiteknight
2010-12-02 implement the new error-handling mechanism. Instead of a string, we p…
64 *is_error = 0;
65 *errmsg = STRINGNULL;
9703ef55 » jkeenan
2010-12-04 [codingstd] C-style coda needed. No cuddled elses.
66 }
67 else {
b3af8c93 » Whiteknight
2010-12-28 fix main.c so that we check the is_error flag and only show an error …
68 STRING * const severity_str = Parrot_str_new(interp, "severity", 0);
69 INTVAL severity = VTABLE_get_integer_keyed_str(interp, *exception, severity_str);
70 *is_error = (severity != EXCEPT_exit);
2483c688 » Whiteknight
2010-12-02 implement the new error-handling mechanism. Instead of a string, we p…
71 *errmsg = VTABLE_get_string(interp, *exception);
72 }
73 interp->final_exception = PMCNULL;
be50d63d » bluescreen10
2010-11-27 Implemented first version of Parrot_get_result, now a lot of failing …
74 interp->exit_code = 0;
2483c688 » Whiteknight
2010-12-02 implement the new error-handling mechanism. Instead of a string, we p…
75 EMBED_API_CALLOUT(interp_pmc, interp)
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
76 }
77
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
78 /*
79
80 =item C<Parrot_Int Parrot_api_get_exception_backtrace(Parrot_PMC interp_pmc,
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
81 Parrot_PMC exception, Parrot_String * bt)>
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
82
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
83 Gets the backtrace of the interpreter's call chain for the given exception
84 C<expcetion> and stores the results in string C<bt>. This function returns a
85 true value if this call is successful and false value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
86
87 =cut
88
89 */
90
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
91 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
92 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
93 Parrot_api_get_exception_backtrace(Parrot_PMC interp_pmc,
94 Parrot_PMC exception, ARGOUT(Parrot_String * bt))
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
95 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
96 ASSERT_ARGS(Parrot_api_get_exception_backtrace)
2483c688 » Whiteknight
2010-12-02 implement the new error-handling mechanism. Instead of a string, we p…
97 EMBED_API_CALLIN(interp_pmc, interp)
3c6f7d0e » Whiteknight
2011-01-10 rethrow caches the old backtrace.
98 if (PMC_IS_NULL(exception))
99 *bt = STRINGNULL;
100 else
0a4f0934 » Whiteknight
2011-01-10 build fixes
101 *bt = Parrot_ex_build_complete_backtrace_string(interp, exception);
2483c688 » Whiteknight
2010-12-02 implement the new error-handling mechanism. Instead of a string, we p…
102 EMBED_API_CALLOUT(interp_pmc, interp)
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
103 }
104
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
105
106 /*
107
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
108 =item C<Parrot_Int Parrot_api_make_interpreter(Parrot_PMC parent, Parrot_Int
109 flags, Parrot_Init_Args *args, Parrot_PMC *interp)>
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
110
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
111 Creates a new interpreter and stores it in C<interp>. It takes three optional
112 parameters the new interpreter's C<flags>, the initialization paremeters C<args>
113 and the C<parent> interpreter. This function returns a true value if this call
114 is successful and false value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
115
116 =cut
117
118 */
119
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
120 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
121 Parrot_Int
709eae7a » Whiteknight
2010-12-04 add in a handful of additional API functions, though they aren't bein…
122 Parrot_api_make_interpreter(Parrot_PMC parent, Parrot_Int flags,
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
123 ARGIN_NULLOK(Parrot_Init_Args *args), ARGOUT(Parrot_PMC *interp))
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
124 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
125 ASSERT_ARGS(Parrot_api_make_interpreter)
4a128d50 » Whiteknight
2010-11-09 lots of little changes
126 int alt_stacktop;
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
127 Parrot_Interp interp_raw;
9b2b6564 » nwellnhof
2010-12-24 Add minimum GC threshold option
128 Parrot_GC_Init_Args gc_args;
82cbd84b » Whiteknight
2010-11-18 parrot executable compiles, but miniparrot does not link. I need to s…
129 const Parrot_Interp parent_raw = PMC_IS_NULL(parent) ? NULL : GET_RAW_INTERP(parent);
7a315db9 » Whiteknight
2011-05-10 set an api jump buffer in Parrot_api_make_interpreter, so we can try …
130 Parrot_jump_buff env;
0eef3cde » NotFound
2011-05-11 fix C90 compliance
131 interp_raw = allocate_interpreter(parent_raw, flags);
7a315db9 » Whiteknight
2011-05-10 set an api jump buffer in Parrot_api_make_interpreter, so we can try …
132 if (setjmp(env)) {
133 interp_raw->api_jmp_buf = NULL;
69ee1281 » Whiteknight
2011-05-10 if we don't have an interp, print out an error message. If we do, try…
134 *interp = NULL;
7a315db9 » Whiteknight
2011-05-10 set an api jump buffer in Parrot_api_make_interpreter, so we can try …
135 return !interp_raw->exit_code;
f2252b40 » Whiteknight
2010-11-09 remove the two-stage initialization dance. We can now initialize an i…
136 }
400feaed » nwellnhof
2011-01-23 Merge branch 'master' into nwellnhof/gc_dynamic_threshold
137 else {
7a315db9 » Whiteknight
2011-05-10 set an api jump buffer in Parrot_api_make_interpreter, so we can try …
138 interp_raw->api_jmp_buf = &env;
139 if (args) {
140 gc_args.stacktop = args->stacktop
141 ? args->stacktop : &alt_stacktop;
142 gc_args.system = args->gc_system;
143 gc_args.nursery_size = args->gc_nursery_size;
144 gc_args.dynamic_threshold = args->gc_dynamic_threshold;
145 gc_args.min_threshold = args->gc_min_threshold;
146
147 if (args->hash_seed)
148 interp_raw->hash_seed = args->hash_seed;
149 }
150 else {
151 memset(&gc_args, 0, sizeof (Parrot_GC_Init_Args));
152 gc_args.stacktop = &alt_stacktop;
153 }
154 initialize_interpreter(interp_raw, &gc_args);
155 *interp = VTABLE_get_pmc_keyed_int(
156 interp_raw, interp_raw->iglobals, (Parrot_Int)IGLOBALS_INTERPRETER);
400feaed » nwellnhof
2011-01-23 Merge branch 'master' into nwellnhof/gc_dynamic_threshold
157 }
7a315db9 » Whiteknight
2011-05-10 set an api jump buffer in Parrot_api_make_interpreter, so we can try …
158 interp_raw->api_jmp_buf = NULL;
f2252b40 » Whiteknight
2010-11-09 remove the two-stage initialization dance. We can now initialize an i…
159 return !PMC_IS_NULL(*interp);
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
160 }
161
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
162 /*
163
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
164 =item C<Parrot_Int Parrot_api_set_runcore(Parrot_PMC interp_pmc, const char *
165 corename, Parrot_UInt trace)>
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
166
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
167 Sets the C<interp_pmc>'s bytecode running core, the core is specified by the
168 C<corename>. This function returns a true value if this call is successful and
169 false value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
170
171 =cut
172
173 */
174
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
175 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
176 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
177 Parrot_api_set_runcore(Parrot_PMC interp_pmc, ARGIN(const char * corename),
178 Parrot_UInt trace)
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
179 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
180 ASSERT_ARGS(Parrot_api_set_runcore)
3ea891ca » Mariano Wahlmann
2010-11-11 First round of syntax error fixes
181 EMBED_API_CALLIN(interp_pmc, interp)
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
182 if (trace) {
c510c5cf » Whiteknight
2011-02-04 fix the trace core, so when we use the -t, --trace, or -Rtrace flags,…
183 Interp_trace_SET(interp, PARROT_TRACE_OPS_FLAG);
704e3c4d » bluescreen10
2010-11-28 Made another test case pass by putting debug information. Also remove…
184 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
9703ef55 » jkeenan
2010-12-04 [codingstd] C-style coda needed. No cuddled elses.
185 }
186 else {
38e5177f » petdance
2011-04-03 Use STREQ() for string comparisons, instead of incorrectly using strc…
187 if (STREQ(corename, "slow") || STREQ(corename, "bounds"))
704e3c4d » bluescreen10
2010-11-28 Made another test case pass by putting debug information. Also remove…
188 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
38e5177f » petdance
2011-04-03 Use STREQ() for string comparisons, instead of incorrectly using strc…
189 else if (STREQ(corename, "fast") || STREQ(corename, "jit") || STREQ(corename, "function"))
704e3c4d » bluescreen10
2010-11-28 Made another test case pass by putting debug information. Also remove…
190 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "fast"));
38e5177f » petdance
2011-04-03 Use STREQ() for string comparisons, instead of incorrectly using strc…
191 else if (STREQ(corename, "exec"))
704e3c4d » bluescreen10
2010-11-28 Made another test case pass by putting debug information. Also remove…
192 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "exec"));
114d897d » petdance
2011-04-03 Use STREQ() for string comparisons, instead of incorrectly using strc…
193 else if (STREQ(corename, "trace"))
704e3c4d » bluescreen10
2010-11-28 Made another test case pass by putting debug information. Also remove…
194 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
38e5177f » petdance
2011-04-03 Use STREQ() for string comparisons, instead of incorrectly using strc…
195 else if (STREQ(corename, "profiling"))
704e3c4d » bluescreen10
2010-11-28 Made another test case pass by putting debug information. Also remove…
196 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "profiling"));
38e5177f » petdance
2011-04-03 Use STREQ() for string comparisons, instead of incorrectly using strc…
197 else if (STREQ(corename, "gcdebug"))
704e3c4d » bluescreen10
2010-11-28 Made another test case pass by putting debug information. Also remove…
198 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "gcdebug"));
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
199 else
200 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Invalid runcore type %s", corename);
201 }
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
202 EMBED_API_CALLOUT(interp_pmc, interp)
203 }
204
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
205 /*
206
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
207 =item C<Parrot_Int Parrot_api_debug_flag(Parrot_PMC interp_pmc, Parrot_Int
208 flags, Parrot_Int set)>
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
209
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
210 Sets/Unsets the C<interp_pmc>'s debug flags. If C<set> is in a true value debug
211 flags are set otherwise debug flags are cleared. This function returns a true
212 value if this call is successful and false value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
213
214 =cut
215
216 */
217
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
218 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
219 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
220 Parrot_api_debug_flag(Parrot_PMC interp_pmc, Parrot_Int flags, Parrot_Int set)
f68bf566 » Whiteknight
2010-11-10 add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
221 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
222 ASSERT_ARGS(Parrot_api_debug_flag)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
223 EMBED_API_CALLIN(interp_pmc, interp)
f68bf566 » Whiteknight
2010-11-10 add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
224 if (set)
225 interp->debug_flags |= flags;
226 else
227 interp->debug_flags &= ~flags;
228 EMBED_API_CALLOUT(interp_pmc, interp);
229 }
230
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
231 /*
232
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
233 =item C<Parrot_Int Parrot_api_flag(Parrot_PMC interp_pmc, Parrot_Int flags,
234 Parrot_Int set)>
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
235
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
236 Set/Unset the C<interp_pmc>'s general flags. If C<set> is in a true value general
237 flags are set otherwise passed flags are cleared. This function returns a true
238 value if this call is successful and false value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
239
240 =cut
241
242 */
243
f68bf566 » Whiteknight
2010-11-10 add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
244 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
245 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
246 Parrot_api_flag(Parrot_PMC interp_pmc, Parrot_Int flags, Parrot_Int set)
f68bf566 » Whiteknight
2010-11-10 add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
247 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
248 ASSERT_ARGS(Parrot_api_flag)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
249 EMBED_API_CALLIN(interp_pmc, interp)
f68bf566 » Whiteknight
2010-11-10 add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
250 if (set) {
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
251 Interp_flags_SET(interp, flags);
252 if (flags & (PARROT_BOUNDS_FLAG | PARROT_PROFILE_FLAG))
f68bf566 » Whiteknight
2010-11-10 add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
253 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
254 }
255 else
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
256 Interp_flags_CLEAR(interp, flags);
f68bf566 » Whiteknight
2010-11-10 add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
257 EMBED_API_CALLOUT(interp_pmc, interp);
258 }
259
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
260 /*
261
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
262 =item C<Parrot_Int Parrot_api_set_executable_name(Parrot_PMC interp_pmc, const
263 char * name)>
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
264
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
265 Sets the executable name for the C<interp_pmc> interpreter. This function returns
266 a true value if this call is successful and false value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
267
268 =cut
269
270 */
271
f68bf566 » Whiteknight
2010-11-10 add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
272 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
273 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
274 Parrot_api_set_executable_name(Parrot_PMC interp_pmc, ARGIN(const char * name))
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
275 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
276 ASSERT_ARGS(Parrot_api_set_executable_name)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
277 EMBED_API_CALLIN(interp_pmc, interp)
9cc3acec » plobsing
2011-01-08 allow for unicode names of fakecutables
278 STRING * const name_str = Parrot_str_from_platform_cstring(interp, name);
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
279 PMC * const name_pmc = Parrot_pmc_new(interp, enum_class_String);
1a692e98 » Whiteknight
2010-11-10 _set_executable_name takes a C string instead of a Parrot string, for…
280 VTABLE_set_string_native(interp, name_pmc, name_str);
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
281 VTABLE_set_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_EXECUTABLE,
282 name_pmc);
4a128d50 » Whiteknight
2010-11-09 lots of little changes
283 EMBED_API_CALLOUT(interp_pmc, interp);
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
284 }
285
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
286 /*
287
288 =item C<Parrot_Int Parrot_api_destroy_interpreter(Parrot_PMC interp_pmc)>
289
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
290 Destroys the C<interp_pmc> interpreter, freeing the memory structures allocated
291 for it. This function returns a true value if this call is successful and false
292 value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
293
294 =cut
295
296 */
297
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
298 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
299 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
300 Parrot_api_destroy_interpreter(Parrot_PMC interp_pmc)
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
301 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
302 ASSERT_ARGS(Parrot_api_destroy_interpreter)
2dc51874 » nwellnhof
2010-12-25 [embed] Fix segfault with --leak-test option
303 Parrot_jump_buff env;
304 if (setjmp(env)) {
305 /* We can't check for potential errors because the interpreter
306 * might have been destroyed. */
307 return 1;
308 }
309 else {
ced54a52 » NotFound
2011-01-27 Fix remaining 'might be clobbered' warning
310 Interp * const interp = GET_INTERP(interp_pmc);
311 void * _oldtop = interp->lo_var_ptr;
312 if (_oldtop == NULL)
313 interp->lo_var_ptr = &_oldtop;
314 interp->api_jmp_buf = &env;
2dc51874 » nwellnhof
2010-12-25 [embed] Fix segfault with --leak-test option
315 Parrot_destroy(interp);
316 Parrot_x_exit(interp, 0);
317 /* Never reached, x_exit calls longjmp */
318 return 1;
319 }
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
320 }
321
322 /*
323
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
324 =item C<Parrot_Int Parrot_api_set_warnings(Parrot_PMC interp_pmc, Parrot_Int
325 flags)>
326
327 Enables C<inter_pmc>'s warning messages the type of warning information to be
328 print out is specified by C<flags>. This function returns a true value if this
329 call is successful and false value otherwise.
330
331 =cut
332
333 */
334
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
335 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
336 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
337 Parrot_api_set_warnings(Parrot_PMC interp_pmc, Parrot_Int flags)
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
338 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
339 ASSERT_ARGS(Parrot_api_set_warnings)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
340 EMBED_API_CALLIN(interp_pmc, interp)
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
341 /* Activates the given warnings. (Macro from warnings.h.) */
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
342 PARROT_WARNINGS_on(interp, flags);
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
343 EMBED_API_CALLOUT(interp_pmc, interp)
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
344 }
345
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
346 /*
347
348 =item C<Parrot_Int Parrot_api_add_library_search_path(Parrot_PMC interp_pmc,
349 const char *path)>
350
351 Adds C<path> to the C<inter_pmc>'s library search path list. This function
352 returns a true value if this call is successful and false value otherwise.
353
354 =cut
355
356 */
357
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
358 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
359 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
360 Parrot_api_add_library_search_path(Parrot_PMC interp_pmc,
361 ARGIN(const char *path))
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
362 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
363 ASSERT_ARGS(Parrot_api_add_library_search_path)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
364 EMBED_API_CALLIN(interp_pmc, interp)
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
365 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_LIBRARY);
229a7813 » Whiteknight
2011-04-18 Add experimental ability to modify PARROT_LIB_PATH_LANG with the -L c…
366
367 /* EXPERIMENTAL. This line has been added experimentally because it is a
368 missing feature, and it may go away at any time without warning. */
369 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_LANG);
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
370 EMBED_API_CALLOUT(interp_pmc, interp)
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
371 }
372
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
373 /*
374
375 =item C<Parrot_Int Parrot_api_add_include_search_path(Parrot_PMC interp_pmc,
376 const char *path)>
377
378 Adds C<path> to the C<inter_pmc>'s include search path list. This function
379 returns a true value if this call is successful and false value otherwise.
380
381 =cut
382
383 */
384
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
385 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
386 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
387 Parrot_api_add_include_search_path(Parrot_PMC interp_pmc,
388 ARGIN(const char *path))
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
389 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
390 ASSERT_ARGS(Parrot_api_add_include_search_path)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
391 EMBED_API_CALLIN(interp_pmc, interp)
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
392 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_INCLUDE);
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
393 EMBED_API_CALLOUT(interp_pmc, interp)
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
394 }
395
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
396 /*
397
398 =item C<Parrot_Int Parrot_api_add_dynext_search_path(Parrot_PMC interp_pmc,
399 const char *path)>
400
401 Adds C<path> to the C<inter_pmc>'s dynext search path list. This function
402 returns a true value if this call is successful and false value otherwise.
403
404 =cut
405
406 */
407
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
408 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
409 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
410 Parrot_api_add_dynext_search_path(Parrot_PMC interp_pmc,
411 ARGIN(const char *path))
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
412 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
413 ASSERT_ARGS(Parrot_api_add_dynext_search_path)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
414 EMBED_API_CALLIN(interp_pmc, interp)
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
415 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_DYNEXT);
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
416 EMBED_API_CALLOUT(interp_pmc, interp)
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
417 }
3259cda3 » Mariano Wahlmann
2010-11-10 First cut of Parrot_api_set_stdhandles API function
418
419 /*
420
c7def2f5 » jkeenan
2010-12-06 Run 'perl tools/dev/headerizer.pl src/embed/api.o'.
421 =item C<Parrot_Int Parrot_api_set_stdhandles(Parrot_PMC interp_pmc, Parrot_Int
422 in, Parrot_Int out, Parrot_Int err)>
3259cda3 » Mariano Wahlmann
2010-11-10 First cut of Parrot_api_set_stdhandles API function
423
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
424 Set the C<interp_pmc>'s standard file descriptors STDIN, STDOUT, STDERR. Any
425 file descriptor set to C<PIO_INVALID_HANDLE> is ignored. This function returns
426 a true value if this call is successful and false value otherwise.
3259cda3 » Mariano Wahlmann
2010-11-10 First cut of Parrot_api_set_stdhandles API function
427
428 =cut
429
430 */
f30aa2fb » kapace
2011-01-07 Added some tests for embed api, get/set compiler and commented set_st…
431 /* Whiteknight told me that theres no way to test this for now, so it should be
432 commented out, for now.
3259cda3 » Mariano Wahlmann
2010-11-10 First cut of Parrot_api_set_stdhandles API function
433
434 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
435 Parrot_Int
aef7ea18 » Mariano Wahlmann
2010-12-06 Fixed stdin,stdout and stderr Andy++ pointed out
436 Parrot_api_set_stdhandles(Parrot_PMC interp_pmc, Parrot_Int in,
437 Parrot_Int out, Parrot_Int err)
3259cda3 » Mariano Wahlmann
2010-11-10 First cut of Parrot_api_set_stdhandles API function
438 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
439 ASSERT_ARGS(Parrot_api_set_stdhandles)
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
440 EMBED_API_CALLIN(interp_pmc, interp)
441 void *dummy;
442
1311ceca » jkeenan
2010-12-11 [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
443 if (PIO_INVALID_HANDLE != (PIOHANDLE)in) {
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
444 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
aef7ea18 » Mariano Wahlmann
2010-12-06 Fixed stdin,stdout and stderr Andy++ pointed out
445 Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)in);
1311ceca » jkeenan
2010-12-11 [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
446 dummy = (void *)Parrot_io_stdhandle(interp, PIO_STDIN_FILENO, pmc);
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
447 }
448
1311ceca » jkeenan
2010-12-11 [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
449 if (PIO_INVALID_HANDLE != (PIOHANDLE)out) {
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
450 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
aef7ea18 » Mariano Wahlmann
2010-12-06 Fixed stdin,stdout and stderr Andy++ pointed out
451 Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)out);
1311ceca » jkeenan
2010-12-11 [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
452 dummy = (void *)Parrot_io_stdhandle(interp, PIO_STDOUT_FILENO, pmc);
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
453 }
454
1311ceca » jkeenan
2010-12-11 [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
455 if (PIO_INVALID_HANDLE != (PIOHANDLE)err) {
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
456 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
aef7ea18 » Mariano Wahlmann
2010-12-06 Fixed stdin,stdout and stderr Andy++ pointed out
457 Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)err);
1311ceca » jkeenan
2010-12-11 [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
458 dummy = (void *)Parrot_io_stdhandle(interp, PIO_STDERR_FILENO, pmc);
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
459 }
16e368de » Whiteknight
2010-12-13 fix several build warnings in src/embed/* in gcc, g++, and icc
460 UNUSED(dummy);
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
461
462 EMBED_API_CALLOUT(interp_pmc, interp)
f30aa2fb » kapace
2011-01-07 Added some tests for embed api, get/set compiler and commented set_st…
463 }*/
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
464
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
465 /*
466
467 =item C<Parrot_Int Parrot_api_get_runtime_path(Parrot_PMC interp_pmc,
468 Parrot_String *runtime)>
469
470 Stores in C<runtime> the C<interp_pmc>'s running path. This function returns a
471 true value if this call is successful and false value otherwise.
472
473 =cut
474
475 */
476
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
477 PARROT_API
478 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
479 Parrot_api_get_runtime_path(Parrot_PMC interp_pmc,
480 ARGOUT(Parrot_String *runtime))
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
481 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
482 ASSERT_ARGS(Parrot_api_get_runtime_path)
e9934d79 » Mariano Wahlmann
2010-11-25 Made it compile with gcc
483 EMBED_API_CALLIN(interp_pmc, interp)
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
484 *runtime = Parrot_get_runtime_path(interp);
485 EMBED_API_CALLOUT(interp_pmc, interp);
486 }
487
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
488 /*
489
490 =item C<Parrot_Int Parrot_api_set_configuration_hash(Parrot_PMC interp_pmc,
491 Parrot_PMC confighash)>
492
493 Sets the C<interp_pmc>'s configuration hash passed in C<confighash>. This
494 function returns a true value if this call is successful and false value
495 otherwise.
496
497 =cut
498
499 */
500
c4ccd134 » Whiteknight
2010-11-22 first prototype of a new mechanism for setting the configuration hash…
501 PARROT_API
502 Parrot_Int
503 Parrot_api_set_configuration_hash(Parrot_PMC interp_pmc, Parrot_PMC confighash)
504 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
505 ASSERT_ARGS(Parrot_api_set_configuration_hash)
e9934d79 » Mariano Wahlmann
2010-11-25 Made it compile with gcc
506 EMBED_API_CALLIN(interp_pmc, interp)
c4ccd134 » Whiteknight
2010-11-22 first prototype of a new mechanism for setting the configuration hash…
507 Parrot_set_config_hash_pmc(interp, confighash);
5c2c3d48 » Whiteknight
2010-11-23 fix library paths. The build now progresses through all the parts tha…
508 Parrot_lib_update_paths_from_config_hash(interp);
c4ccd134 » Whiteknight
2010-11-22 first prototype of a new mechanism for setting the configuration hash…
509 EMBED_API_CALLOUT(interp_pmc, interp);
510 }
511
e1ced3e3 » Whiteknight
2010-12-04 add a note explaining this stupid function
512 /*
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
513
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
514 =item C<Parrot_Int Parrot_api_load_language(Parrot_PMC interp_pmc, Parrot_String
d74cf453 » Whiteknight
2010-12-12 fix build warnings in src/embed/api.c
515 lang)>
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
516
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
517 Loads the HLL compiler libraries for C<lang> into the C<interp_pmc>. This
518 function returns a true value if this call is successful and false value
519 otherwise.
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
520
521 =cut
522
523 */
524
525 PARROT_API
526 Parrot_Int
c9c5a00e » leto
2011-06-19 Decorate some embed api functions and rerun headerizer
527 Parrot_api_load_language(Parrot_PMC interp_pmc, ARGIN(Parrot_String lang))
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
528 {
529 ASSERT_ARGS(Parrot_api_load_language)
530 EMBED_API_CALLIN(interp_pmc, interp)
d74cf453 » Whiteknight
2010-12-12 fix build warnings in src/embed/api.c
531 Parrot_load_language(interp, lang);
532 EMBED_API_CALLOUT(interp_pmc, interp);
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
533 }
534
535 /*
536
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
537 =item C<Parrot_Int Parrot_api_get_compiler(Parrot_PMC interp_pmc, Parrot_String
d74cf453 » Whiteknight
2010-12-12 fix build warnings in src/embed/api.c
538 type, Parrot_PMC *compiler)>
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
539
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
540 Gets the compiler PMC and stores it in C<compiler>. This function returns a true
541 value if this call is successful and false value otherwise.
542
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
543 =cut
544
545 */
546
547 PARROT_API
548 Parrot_Int
c9c5a00e » leto
2011-06-19 Decorate some embed api functions and rerun headerizer
549 Parrot_api_get_compiler(Parrot_PMC interp_pmc, ARGIN(Parrot_String type),
d74cf453 » Whiteknight
2010-12-12 fix build warnings in src/embed/api.c
550 ARGOUT(Parrot_PMC *compiler))
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
551 {
552 ASSERT_ARGS(Parrot_api_get_compiler)
553 EMBED_API_CALLIN(interp_pmc, interp)
d74cf453 » Whiteknight
2010-12-12 fix build warnings in src/embed/api.c
554 *compiler = Parrot_get_compiler(interp, type);
555 EMBED_API_CALLOUT(interp_pmc, interp);
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
556 }
557
558 /*
559
560 =item C<Parrot_Int Parrot_api_set_compiler(Parrot_PMC interp_pmc, Parrot_String
d74cf453 » Whiteknight
2010-12-12 fix build warnings in src/embed/api.c
561 type, Parrot_PMC compiler)>
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
562
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
563 Sets the C<compiler> object for the C<type> files. This function returns a true
564 value if this call is successful and false value otherwise.
565
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
566 =cut
567
568 */
569
570 PARROT_API
571 Parrot_Int
c9c5a00e » leto
2011-06-19 Decorate some embed api functions and rerun headerizer
572 Parrot_api_set_compiler(Parrot_PMC interp_pmc, ARGIN(Parrot_String type),
573 ARGIN(Parrot_PMC compiler))
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
574 {
575 ASSERT_ARGS(Parrot_api_set_compiler)
576 EMBED_API_CALLIN(interp_pmc, interp)
d74cf453 » Whiteknight
2010-12-12 fix build warnings in src/embed/api.c
577 Parrot_set_compiler(interp, type, compiler);
255a8d8f » Whiteknight
2011-01-16 move -G commandline argument parsing from IMCC into the frontend
578 EMBED_API_CALLOUT(interp_pmc, interp)
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
579 }
0814f941 » Mariano Wahlmann
2010-12-05 Merged changes with branch
580
255a8d8f » Whiteknight
2011-01-16 move -G commandline argument parsing from IMCC into the frontend
581 /*
582
583 =item C<Parrot_Int Parrot_api_toggle_gc(Parrot_PMC interp_pmc, Parrot_Int on)>
584
585 Turn Parrot's GC on or off.
586
587 =cut
588
589 */
590
591 PARROT_API
592 Parrot_Int
593 Parrot_api_toggle_gc(Parrot_PMC interp_pmc, Parrot_Int on)
594 {
595 ASSERT_ARGS(Parrot_api_toggle_gc)
596 EMBED_API_CALLIN(interp_pmc, interp)
597 if (on) {
598 Parrot_unblock_GC_mark(interp);
599 Parrot_unblock_GC_sweep(interp);
600 }
601 else {
602 Parrot_block_GC_mark(interp);
603 Parrot_block_GC_sweep(interp);
604 }
605 EMBED_API_CALLOUT(interp_pmc, interp)
606 }
6f90f7de » nol888
2010-12-17 Add API functions to get a class from an array, and to instantiate a …
607
c6fa8b73 » mikehh
2011-02-08 fix codetest failures - add c function docs and ASSERT_ARGS
608 /*
609
610 =item C<Parrot_Int Parrot_api_reset_call_signature(Parrot_PMC interp_pmc,
611 Parrot_PMC ctx)>
612
613 Reset the call signature
614
615 =cut
616
617 */
618
f0c28dcd » Whiteknight
2011-02-07 Add in an API function so that we can reset and reuse an existing Cal…
619 PARROT_API
620 Parrot_Int
c9c5a00e » leto
2011-06-19 Decorate some embed api functions and rerun headerizer
621 Parrot_api_reset_call_signature(Parrot_PMC interp_pmc, ARGMOD(Parrot_PMC ctx))
f0c28dcd » Whiteknight
2011-02-07 Add in an API function so that we can reset and reuse an existing Cal…
622 {
c6fa8b73 » mikehh
2011-02-08 fix codetest failures - add c function docs and ASSERT_ARGS
623 ASSERT_ARGS(Parrot_api_reset_call_signature)
f0c28dcd » Whiteknight
2011-02-07 Add in an API function so that we can reset and reuse an existing Cal…
624 EMBED_API_CALLIN(interp_pmc, interp)
625 STRING * const callcontext = Parrot_str_new(interp, "CallContext", 0);
626 if (!VTABLE_isa(interp, ctx, callcontext))
627 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
628 "Not a valid CallContext");
629 VTABLE_morph(interp, ctx, PMCNULL);
630 EMBED_API_CALLOUT(interp_pmc, interp)
631 }
632
0814f941 » Mariano Wahlmann
2010-12-05 Merged changes with branch
633 /*
634
027abfaa » Whiteknight
2011-03-02 add two new API functions for dealing with opaque user data pointers
635 =item C<Parrot_Int Parrot_api_wrap_pointer(Parrot_PMC interp_pmc, void *ptr,
636 Parrot_Int size, Parrot_PMC *pmc)>
637
638 Wrap a user data pointer into a Ptr PMC for passing into Parrot. This PMC
639 is designed such that Parrot will treat the pointer as being opaque and will
640 not attempt to dereference, examine, or manipulate it at all.
641
642 Optionally a C<size> parameter can be passed. If C<size> is greater than zero,
643 the size information will be included with the pointer for later use. If
644 C<size> is less than or equal to zero, it will be ignored and will not be
645 included in the PMC object.
646
54d50264 » plobsing
2011-03-02 [codetest] correct format of C function doc =item
647 =item C<Parrot_Int Parrot_api_unwrap_pointer(Parrot_PMC interp_pmc, Parrot_PMC
648 pmc, void ** ptr, Parrot_Int * size)>
027abfaa » Whiteknight
2011-03-02 add two new API functions for dealing with opaque user data pointers
649
650 Return a pointer from a PMC. This is typically used in conjunction with
651 C<Parrot_api_wrap_pointer> to return the original wrapped pointer value from
652 the PMC. Used with other PMC types besides C<Ptr> or C<PtrBuf> will have
653 undefined results, and should not be used or relied upon.
654
655 If the pointer was stored with size information, C<size> will contain that
656 size value. Otherwise, C<size> will be -1.
657
658 Notice that this function does not destroy or alter the data PMC.
659
660 =cut
661
662 */
663
664 PARROT_API
665 Parrot_Int
666 Parrot_api_wrap_pointer(Parrot_PMC interp_pmc, ARGIN_NULLOK(void *ptr),
667 Parrot_Int size, ARGOUT(Parrot_PMC *pmc))
668 {
669 ASSERT_ARGS(Parrot_api_wrap_pointer)
670 EMBED_API_CALLIN(interp_pmc, interp)
671 PMC * ptr_pmc = NULL;
672 if (size > 0) {
673 ptr_pmc = Parrot_pmc_new(interp, enum_class_PtrBuf);
b65a8ba6 » bacek
2011-03-03 Fix braino in api_wrap/unwrap_pointer.
674 VTABLE_set_integer_native(interp, ptr_pmc, size);
edc686b8 » plobsing
2011-03-02 cuddled else
675 }
676 else
027abfaa » Whiteknight
2011-03-02 add two new API functions for dealing with opaque user data pointers
677 ptr_pmc = Parrot_pmc_new(interp, enum_class_Ptr);
b65a8ba6 » bacek
2011-03-03 Fix braino in api_wrap/unwrap_pointer.
678 VTABLE_set_pointer(interp, ptr_pmc, ptr);
027abfaa » Whiteknight
2011-03-02 add two new API functions for dealing with opaque user data pointers
679 *pmc = ptr_pmc;
680 EMBED_API_CALLOUT(interp_pmc, interp)
681 }
682
683 PARROT_API
684 Parrot_Int
685 Parrot_api_unwrap_pointer(Parrot_PMC interp_pmc, Parrot_PMC pmc,
686 ARGOUT(void ** ptr), ARGOUT(Parrot_Int * size))
687 {
688 ASSERT_ARGS(Parrot_api_unwrap_pointer)
689 EMBED_API_CALLIN(interp_pmc, interp)
690 *ptr = VTABLE_get_pointer(interp, pmc);
691 if (pmc->vtable->base_type == enum_class_PtrBuf)
692 *size = VTABLE_get_integer(interp, pmc);
693 else
694 *size = -1;
695 EMBED_API_CALLOUT(interp_pmc, interp);
696 }
697
698 /*
699
1311ceca » jkeenan
2010-12-11 [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
700 =back
701
9703ef55 » jkeenan
2010-12-04 [codingstd] C-style coda needed. No cuddled elses.
702 =cut
0814f941 » Mariano Wahlmann
2010-12-05 Merged changes with branch
703
7db7331c » jkeenan
2010-12-04 Correct C-comment syntax error.
704 */
9703ef55 » jkeenan
2010-12-04 [codingstd] C-style coda needed. No cuddled elses.
705
540a832b » jkeenan
2010-12-04 [codingstd] Mostly linelength fixes.
706 /*
707 * Local variables:
708 * c-file-style: "parrot"
709 * End:
710 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
711 */
0814f941 » Mariano Wahlmann
2010-12-05 Merged changes with branch
712
Something went wrong with that request. Please try again.