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