Skip to content
This repository
Newer
Older
100644 712 lines (554 sloc) 20.557 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
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
36 information is as follows:
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
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
41 C<exception> the last exception thrown, PMCNULL if none.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
42
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
43 C<exit_code> the exit code of the running program, if it expected to exit
44 now. C<0> for no error.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
45
727e5150 » Whiteknight
2012-05-21 Remove trailing whitespace
46 C<errmsg> contains an string with the last error message if any,
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
47 C<STRINGNULL> if none.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
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),
2f0e851f » petdance
2012-03-22 const a local variable. Minor spacing tweaks
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);
2f0e851f » petdance
2012-03-22 const a local variable. Minor spacing tweaks
69 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 …
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,
2f0e851f » petdance
2012-03-22 const a local variable. Minor spacing tweaks
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
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
84 C<exception> and stores the results in string C<bt>. This function returns a
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
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,
2f0e851f » petdance
2012-03-22 const a local variable. Minor spacing tweaks
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;
86353cc9 » bilalakhtar
2011-12-03 More function renames, now stuck at PIR files
131 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 …
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 }
e85966a7 » bilalakhtar
2011-12-03 Rename functions yet again...
154 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 …
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"));
f5d74c4e » mlschroe
2011-09-07 subprof_fun -> subprof_sub, headerize
191 else if (STREQ(corename, "subprof_sub"))
192 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…
193 else if (STREQ(corename, "subprof_hll") || STREQ(corename, "subprof"))
beef84c3 » mlschroe
2011-09-07 support subprof_fun, subprof_hll, subprof_ops
194 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "subprof_hll"));
195 else if (STREQ(corename, "subprof_ops"))
196 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…
197 else if (STREQ(corename, "exec"))
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, "exec"));
114d897d » petdance
2011-04-03 Use STREQ() for string comparisons, instead of incorrectly using strc…
199 else if (STREQ(corename, "trace"))
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, "slow"));
38e5177f » petdance
2011-04-03 Use STREQ() for string comparisons, instead of incorrectly using strc…
201 else if (STREQ(corename, "profiling"))
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, "profiling"));
38e5177f » petdance
2011-04-03 Use STREQ() for string comparisons, instead of incorrectly using strc…
203 else if (STREQ(corename, "gcdebug"))
704e3c4d » bluescreen10
2010-11-28 Made another test case pass by putting debug information. Also remove…
204 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…
205 else
206 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Invalid runcore type %s", corename);
207 }
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
208 EMBED_API_CALLOUT(interp_pmc, interp)
209 }
210
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
211 /*
212
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
213 =item C<Parrot_Int Parrot_api_debug_flag(Parrot_PMC interp_pmc, Parrot_Int
214 flags, Parrot_Int set)>
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
215
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
216 Sets/Unsets the C<interp_pmc>'s debug flags. If C<set> is in a true value debug
217 flags are set otherwise debug flags are cleared. This function returns a true
218 value if this call is successful and false value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
219
220 =cut
221
222 */
223
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
224 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
225 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
226 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…
227 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
228 ASSERT_ARGS(Parrot_api_debug_flag)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
229 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…
230 if (set)
231 interp->debug_flags |= flags;
232 else
233 interp->debug_flags &= ~flags;
234 EMBED_API_CALLOUT(interp_pmc, interp);
235 }
236
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
237 /*
238
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
239 =item C<Parrot_Int Parrot_api_flag(Parrot_PMC interp_pmc, Parrot_Int flags,
240 Parrot_Int set)>
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
241
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
242 Set/Unset the C<interp_pmc>'s general flags. If C<set> is in a true value general
243 flags are set otherwise passed flags are cleared. This function returns a true
244 value if this call is successful and false value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
245
246 =cut
247
248 */
249
f68bf566 » Whiteknight
2010-11-10 add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
250 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
251 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
252 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…
253 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
254 ASSERT_ARGS(Parrot_api_flag)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
255 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…
256 if (set) {
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
257 Interp_flags_SET(interp, flags);
258 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…
259 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
260 }
261 else
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
262 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…
263 EMBED_API_CALLOUT(interp_pmc, interp);
264 }
265
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
266 /*
267
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
268 =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
269 char *name)>
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
270
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
271 Sets the executable name for the C<interp_pmc> interpreter. This function returns
272 a true value if this call is successful and false value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
273
274 =cut
275
276 */
277
f68bf566 » Whiteknight
2010-11-10 add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
278 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
279 Parrot_Int
2f0e851f » petdance
2012-03-22 const a local variable. Minor spacing tweaks
280 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
281 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
282 ASSERT_ARGS(Parrot_api_set_executable_name)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
283 EMBED_API_CALLIN(interp_pmc, interp)
9cc3acec » plobsing
2011-01-08 allow for unicode names of fakecutables
284 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
285 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…
286 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
287 VTABLE_set_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_EXECUTABLE,
288 name_pmc);
4a128d50 » Whiteknight
2010-11-09 lots of little changes
289 EMBED_API_CALLOUT(interp_pmc, interp);
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
290 }
291
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
292 /*
293
294 =item C<Parrot_Int Parrot_api_destroy_interpreter(Parrot_PMC interp_pmc)>
295
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
296 Destroys the C<interp_pmc> interpreter, freeing the memory structures allocated
297 for it. This function returns a true value if this call is successful and false
298 value otherwise.
36537842 » bluescreen10
2010-12-18 Embed API Documentation round 1
299
300 =cut
301
302 */
303
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
304 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
305 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
306 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
307 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
308 ASSERT_ARGS(Parrot_api_destroy_interpreter)
2dc51874 » nwellnhof
2010-12-25 [embed] Fix segfault with --leak-test option
309 Parrot_jump_buff env;
310 if (setjmp(env)) {
311 /* We can't check for potential errors because the interpreter
312 * might have been destroyed. */
313 return 1;
314 }
315 else {
ced54a52 » NotFound
2011-01-27 Fix remaining 'might be clobbered' warning
316 Interp * const interp = GET_INTERP(interp_pmc);
317 void * _oldtop = interp->lo_var_ptr;
318 if (_oldtop == NULL)
319 interp->lo_var_ptr = &_oldtop;
320 interp->api_jmp_buf = &env;
0b7ccce8 » Whiteknight
2012-05-05 Add a new Parrot_x_execute_on_exit_handlers to call exit handlers. Us…
321 Parrot_x_execute_on_exit_handlers(interp, 0);
e85966a7 » bilalakhtar
2011-12-03 Rename functions yet again...
322 Parrot_interp_destroy(interp);
2dc51874 » nwellnhof
2010-12-25 [embed] Fix segfault with --leak-test option
323 return 1;
324 }
687438ef » Whiteknight
2010-11-08 add in the prototype embedding API functions I've been playing with
325 }
326
327 /*
328
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
329 =item C<Parrot_Int Parrot_api_set_warnings(Parrot_PMC interp_pmc, Parrot_Int
330 flags)>
331
332 Enables C<inter_pmc>'s warning messages the type of warning information to be
333 print out is specified by C<flags>. This function returns a true value if this
334 call is successful and false value otherwise.
335
336 =cut
337
338 */
339
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
340 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
341 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
342 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…
343 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
344 ASSERT_ARGS(Parrot_api_set_warnings)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
345 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…
346 /* 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…
347 PARROT_WARNINGS_on(interp, flags);
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
348 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…
349 }
350
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
351 /*
352
353 =item C<Parrot_Int Parrot_api_add_library_search_path(Parrot_PMC interp_pmc,
354 const char *path)>
355
356 Adds C<path> to the C<inter_pmc>'s library search path list. This function
357 returns a true value if this call is successful and false value otherwise.
358
359 =cut
360
361 */
362
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
363 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
364 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
365 Parrot_api_add_library_search_path(Parrot_PMC interp_pmc,
366 ARGIN(const char *path))
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
367 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
368 ASSERT_ARGS(Parrot_api_add_library_search_path)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
369 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…
370 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…
371
372 /* EXPERIMENTAL. This line has been added experimentally because it is a
373 missing feature, and it may go away at any time without warning. */
374 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_LANG);
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
375 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…
376 }
377
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
378 /*
379
380 =item C<Parrot_Int Parrot_api_add_include_search_path(Parrot_PMC interp_pmc,
381 const char *path)>
382
383 Adds C<path> to the C<inter_pmc>'s include search path list. This function
384 returns a true value if this call is successful and false value otherwise.
385
386 =cut
387
388 */
389
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
390 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
391 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
392 Parrot_api_add_include_search_path(Parrot_PMC interp_pmc,
393 ARGIN(const char *path))
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
394 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
395 ASSERT_ARGS(Parrot_api_add_include_search_path)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
396 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…
397 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_INCLUDE);
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
398 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…
399 }
400
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
401 /*
402
403 =item C<Parrot_Int Parrot_api_add_dynext_search_path(Parrot_PMC interp_pmc,
404 const char *path)>
405
406 Adds C<path> to the C<inter_pmc>'s dynext search path list. This function
407 returns a true value if this call is successful and false value otherwise.
408
409 =cut
410
411 */
412
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
413 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
414 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
415 Parrot_api_add_dynext_search_path(Parrot_PMC interp_pmc,
416 ARGIN(const char *path))
9d25cd4e » Whiteknight
2010-11-10 change the imcc_run function to return a PackFile PMC so we can use i…
417 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
418 ASSERT_ARGS(Parrot_api_add_dynext_search_path)
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
419 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…
420 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_DYNEXT);
c1ab56ef » Mariano Wahlmann
2010-11-15 More fixes, almost there
421 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…
422 }
3259cda3 » Mariano Wahlmann
2010-11-10 First cut of Parrot_api_set_stdhandles API function
423
424 /*
425
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
426 =item C<Parrot_Int Parrot_api_set_stdhandle(Parrot_PMC interp_pmc, Parrot_PMC
427 handle, Parrot_Int fileno, Parrot_PMC *old_handle)>
3259cda3 » Mariano Wahlmann
2010-11-10 First cut of Parrot_api_set_stdhandles API function
428
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
429 Set one of the C<interp_pmc>'s standard IO PMCs. The handle PMC C<handle> is
430 an IO-type PMC (such as FileHandle or StringHandle). The fileno is one of
431 C<0> for stdin, C<1> for stdout and C<2> for stderr. Other values are not
727e5150 » Whiteknight
2012-05-21 Remove trailing whitespace
432 (currently) allowed. The previous PMC for that handle is returned as
433 C<old_handle>. This function returns a true value if this call is successful
da52d96d » Whiteknight
2012-05-21 Some improved docs for the new function
434 and false value otherwise.
3259cda3 » Mariano Wahlmann
2010-11-10 First cut of Parrot_api_set_stdhandles API function
435
436 =cut
437
438 */
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
439
3259cda3 » Mariano Wahlmann
2010-11-10 First cut of Parrot_api_set_stdhandles API function
440
441 PARROT_API
e98ef028 » Whiteknight
2010-11-14 lots of fixes. We still don't build completely, but we are much close…
442 Parrot_Int
727e5150 » Whiteknight
2012-05-21 Remove trailing whitespace
443 Parrot_api_set_stdhandle(Parrot_PMC interp_pmc, Parrot_PMC handle,
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
444 Parrot_Int fileno, ARGOUT(Parrot_PMC *old_handle))
3259cda3 » Mariano Wahlmann
2010-11-10 First cut of Parrot_api_set_stdhandles API function
445 {
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
446 ASSERT_ARGS(Parrot_api_set_stdhandle)
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
447 EMBED_API_CALLIN(interp_pmc, interp)
727e5150 » Whiteknight
2012-05-21 Remove trailing whitespace
448
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
449 switch (fileno) {
450 case PIO_STDIN_FILENO:
451 case PIO_STDOUT_FILENO:
452 case PIO_STDERR_FILENO:
453 *old_handle = Parrot_io_stdhandle(interp, fileno, handle);
454 break;
455 default:
456 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
457 "Cannot set new handle %d. Must be one of 0, 1 or 2", fileno);
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
458 }
727e5150 » Whiteknight
2012-05-21 Remove trailing whitespace
459
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
460 EMBED_API_CALLOUT(interp_pmc, interp)
f7fec052 » Whiteknight
2012-05-21 Add a new Parrot_api_set_stdhandle routine to the embedding API to se…
461 }
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
462
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
463 /*
464
465 =item C<Parrot_Int Parrot_api_get_runtime_path(Parrot_PMC interp_pmc,
466 Parrot_String *runtime)>
467
468 Stores in C<runtime> the C<interp_pmc>'s running path. This function returns a
469 true value if this call is successful and false value otherwise.
470
471 =cut
472
473 */
474
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
475 PARROT_API
476 Parrot_Int
1216a51d » Whiteknight
2010-12-04 quick initial pass for codestd
477 Parrot_api_get_runtime_path(Parrot_PMC interp_pmc,
478 ARGOUT(Parrot_String *runtime))
f41cf98f » Whiteknight
2010-11-17 many more fixes. We build main.c now but fail in some of the alternat…
479 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
480 ASSERT_ARGS(Parrot_api_get_runtime_path)
e9934d79 » Mariano Wahlmann
2010-11-25 Made it compile with gcc
481 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…
482 *runtime = Parrot_get_runtime_path(interp);
483 EMBED_API_CALLOUT(interp_pmc, interp);
484 }
485
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
486 /*
487
488 =item C<Parrot_Int Parrot_api_set_configuration_hash(Parrot_PMC interp_pmc,
489 Parrot_PMC confighash)>
490
491 Sets the C<interp_pmc>'s configuration hash passed in C<confighash>. This
492 function returns a true value if this call is successful and false value
493 otherwise.
494
495 =cut
496
497 */
498
c4ccd134 » Whiteknight
2010-11-22 first prototype of a new mechanism for setting the configuration hash…
499 PARROT_API
500 Parrot_Int
501 Parrot_api_set_configuration_hash(Parrot_PMC interp_pmc, Parrot_PMC confighash)
502 {
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
503 ASSERT_ARGS(Parrot_api_set_configuration_hash)
e9934d79 » Mariano Wahlmann
2010-11-25 Made it compile with gcc
504 EMBED_API_CALLIN(interp_pmc, interp)
c4ccd134 » Whiteknight
2010-11-22 first prototype of a new mechanism for setting the configuration hash…
505 Parrot_set_config_hash_pmc(interp, confighash);
5c2c3d48 » Whiteknight
2010-11-23 fix library paths. The build now progresses through all the parts tha…
506 Parrot_lib_update_paths_from_config_hash(interp);
c4ccd134 » Whiteknight
2010-11-22 first prototype of a new mechanism for setting the configuration hash…
507 EMBED_API_CALLOUT(interp_pmc, interp);
508 }
509
e1ced3e3 » Whiteknight
2010-12-04 add a note explaining this stupid function
510 /*
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
511
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
512 =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
513 lang)>
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
514
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
515 Loads the HLL compiler libraries for C<lang> into the C<interp_pmc>. This
516 function returns a true value if this call is successful and false value
517 otherwise.
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
518
519 =cut
520
521 */
522
523 PARROT_API
524 Parrot_Int
c9c5a00e » leto
2011-06-19 Decorate some embed api functions and rerun headerizer
525 Parrot_api_load_language(Parrot_PMC interp_pmc, ARGIN(Parrot_String lang))
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
526 {
527 ASSERT_ARGS(Parrot_api_load_language)
528 EMBED_API_CALLIN(interp_pmc, interp)
d74cf453 » Whiteknight
2010-12-12 fix build warnings in src/embed/api.c
529 Parrot_load_language(interp, lang);
530 EMBED_API_CALLOUT(interp_pmc, interp);
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
531 }
532
533 /*
534
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
535 =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
536 type, Parrot_PMC *compiler)>
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
537
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
538 Gets the compiler PMC and stores it in C<compiler>. This function returns a true
539 value if this call is successful and false value otherwise.
540
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
541 =cut
542
543 */
544
545 PARROT_API
546 Parrot_Int
c9c5a00e » leto
2011-06-19 Decorate some embed api functions and rerun headerizer
547 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
548 ARGOUT(Parrot_PMC *compiler))
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
549 {
550 ASSERT_ARGS(Parrot_api_get_compiler)
551 EMBED_API_CALLIN(interp_pmc, interp)
86353cc9 » bilalakhtar
2011-12-03 More function renames, now stuck at PIR files
552 *compiler = Parrot_interp_get_compiler(interp, type);
e4b931d2 » Whiteknight
2012-06-05 Throw an exception from Parrot_api_get_compiler if the compiler canno…
553 if (PMC_IS_NULL(*compiler))
554 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
555 "Cannot find compiler '%Ss'", type);
d74cf453 » Whiteknight
2010-12-12 fix build warnings in src/embed/api.c
556 EMBED_API_CALLOUT(interp_pmc, interp);
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
557 }
558
559 /*
560
561 =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
562 type, Parrot_PMC compiler)>
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
563
cc0610ab » bluescreen10
2010-12-19 Fixed codigstd tests
564 Sets the C<compiler> object for the C<type> files. This function returns a true
565 value if this call is successful and false value otherwise.
566
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
567 =cut
568
569 */
570
571 PARROT_API
572 Parrot_Int
c9c5a00e » leto
2011-06-19 Decorate some embed api functions and rerun headerizer
573 Parrot_api_set_compiler(Parrot_PMC interp_pmc, ARGIN(Parrot_String type),
574 ARGIN(Parrot_PMC compiler))
f0bd1e1c » Mariano Wahlmann
2010-12-06 First cut of load_language, set_compiler, get compiler
575 {
576 ASSERT_ARGS(Parrot_api_set_compiler)
577 EMBED_API_CALLIN(interp_pmc, interp)
e85966a7 » bilalakhtar
2011-12-03 Rename functions yet again...
578 Parrot_interp_set_compiler(interp, type, compiler);
255a8d8f » Whiteknight
2011-01-16 move -G commandline argument parsing from IMCC into the frontend
579 EMBED_API_CALLOUT(interp_pmc, interp)
3562b6b4 » Mariano Wahlmann
2010-12-05 Unfished work implemented API functions
580 }
0814f941 » Mariano Wahlmann
2010-12-05 Merged changes with branch
581
255a8d8f » Whiteknight
2011-01-16 move -G commandline argument parsing from IMCC into the frontend
582 /*
583
584 =item C<Parrot_Int Parrot_api_toggle_gc(Parrot_PMC interp_pmc, Parrot_Int on)>
585
586 Turn Parrot's GC on or off.
587
588 =cut
589
590 */
591
592 PARROT_API
593 Parrot_Int
594 Parrot_api_toggle_gc(Parrot_PMC interp_pmc, Parrot_Int on)
595 {
596 ASSERT_ARGS(Parrot_api_toggle_gc)
597 EMBED_API_CALLIN(interp_pmc, interp)
598 if (on) {
599 Parrot_unblock_GC_mark(interp);
600 Parrot_unblock_GC_sweep(interp);
601 }
602 else {
603 Parrot_block_GC_mark(interp);
604 Parrot_block_GC_sweep(interp);
605 }
606 EMBED_API_CALLOUT(interp_pmc, interp)
607 }
6f90f7de » nol888
2010-12-17 Add API functions to get a class from an array, and to instantiate a …
608
c6fa8b73 » mikehh
2011-02-08 fix codetest failures - add c function docs and ASSERT_ARGS
609 /*
610
611 =item C<Parrot_Int Parrot_api_reset_call_signature(Parrot_PMC interp_pmc,
612 Parrot_PMC ctx)>
613
614 Reset the call signature
615
616 =cut
617
618 */
619
f0c28dcd » Whiteknight
2011-02-07 Add in an API function so that we can reset and reuse an existing Cal…
620 PARROT_API
621 Parrot_Int
c9c5a00e » leto
2011-06-19 Decorate some embed api functions and rerun headerizer
622 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…
623 {
c6fa8b73 » mikehh
2011-02-08 fix codetest failures - add c function docs and ASSERT_ARGS
624 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…
625 EMBED_API_CALLIN(interp_pmc, interp)
626 STRING * const callcontext = Parrot_str_new(interp, "CallContext", 0);
627 if (!VTABLE_isa(interp, ctx, callcontext))
628 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
629 "Not a valid CallContext");
630 VTABLE_morph(interp, ctx, PMCNULL);
631 EMBED_API_CALLOUT(interp_pmc, interp)
632 }
633
0814f941 » Mariano Wahlmann
2010-12-05 Merged changes with branch
634 /*
635
027abfaa » Whiteknight
2011-03-02 add two new API functions for dealing with opaque user data pointers
636 =item C<Parrot_Int Parrot_api_wrap_pointer(Parrot_PMC interp_pmc, void *ptr,
637 Parrot_Int size, Parrot_PMC *pmc)>
638
639 Wrap a user data pointer into a Ptr PMC for passing into Parrot. This PMC
640 is designed such that Parrot will treat the pointer as being opaque and will
641 not attempt to dereference, examine, or manipulate it at all.
642
643 Optionally a C<size> parameter can be passed. If C<size> is greater than zero,
644 the size information will be included with the pointer for later use. If
645 C<size> is less than or equal to zero, it will be ignored and will not be
646 included in the PMC object.
647
54d50264 » plobsing
2011-03-02 [codetest] correct format of C function doc =item
648 =item C<Parrot_Int Parrot_api_unwrap_pointer(Parrot_PMC interp_pmc, Parrot_PMC
649 pmc, void ** ptr, Parrot_Int * size)>
027abfaa » Whiteknight
2011-03-02 add two new API functions for dealing with opaque user data pointers
650
651 Return a pointer from a PMC. This is typically used in conjunction with
652 C<Parrot_api_wrap_pointer> to return the original wrapped pointer value from
653 the PMC. Used with other PMC types besides C<Ptr> or C<PtrBuf> will have
654 undefined results, and should not be used or relied upon.
655
656 If the pointer was stored with size information, C<size> will contain that
657 size value. Otherwise, C<size> will be -1.
658
659 Notice that this function does not destroy or alter the data PMC.
660
661 =cut
662
663 */
664
665 PARROT_API
666 Parrot_Int
667 Parrot_api_wrap_pointer(Parrot_PMC interp_pmc, ARGIN_NULLOK(void *ptr),
668 Parrot_Int size, ARGOUT(Parrot_PMC *pmc))
669 {
670 ASSERT_ARGS(Parrot_api_wrap_pointer)
671 EMBED_API_CALLIN(interp_pmc, interp)
672 PMC * ptr_pmc = NULL;
673 if (size > 0) {
674 ptr_pmc = Parrot_pmc_new(interp, enum_class_PtrBuf);
b65a8ba6 » bacek
2011-03-03 Fix braino in api_wrap/unwrap_pointer.
675 VTABLE_set_integer_native(interp, ptr_pmc, size);
edc686b8 » plobsing
2011-03-02 cuddled else
676 }
677 else
027abfaa » Whiteknight
2011-03-02 add two new API functions for dealing with opaque user data pointers
678 ptr_pmc = Parrot_pmc_new(interp, enum_class_Ptr);
b65a8ba6 » bacek
2011-03-03 Fix braino in api_wrap/unwrap_pointer.
679 VTABLE_set_pointer(interp, ptr_pmc, ptr);
027abfaa » Whiteknight
2011-03-02 add two new API functions for dealing with opaque user data pointers
680 *pmc = ptr_pmc;
681 EMBED_API_CALLOUT(interp_pmc, interp)
682 }
683
684 PARROT_API
685 Parrot_Int
686 Parrot_api_unwrap_pointer(Parrot_PMC interp_pmc, Parrot_PMC pmc,
687 ARGOUT(void ** ptr), ARGOUT(Parrot_Int * size))
688 {
689 ASSERT_ARGS(Parrot_api_unwrap_pointer)
690 EMBED_API_CALLIN(interp_pmc, interp)
691 *ptr = VTABLE_get_pointer(interp, pmc);
692 if (pmc->vtable->base_type == enum_class_PtrBuf)
693 *size = VTABLE_get_integer(interp, pmc);
694 else
695 *size = -1;
696 EMBED_API_CALLOUT(interp_pmc, interp);
697 }
698
699 /*
700
1311ceca » jkeenan
2010-12-11 [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
701 =back
702
9703ef55 » jkeenan
2010-12-04 [codingstd] C-style coda needed. No cuddled elses.
703 =cut
0814f941 » Mariano Wahlmann
2010-12-05 Merged changes with branch
704
7db7331c » jkeenan
2010-12-04 Correct C-comment syntax error.
705 */
9703ef55 » jkeenan
2010-12-04 [codingstd] C-style coda needed. No cuddled elses.
706
540a832b » jkeenan
2010-12-04 [codingstd] Mostly linelength fixes.
707 /*
708 * Local variables:
709 * c-file-style: "parrot"
710 * End:
711 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
712 */
0814f941 » Mariano Wahlmann
2010-12-05 Merged changes with branch
713
Something went wrong with that request. Please try again.