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