Skip to content
Newer
Older
100644 663 lines (527 sloc) 19.4 KB
540a832 @jkeenan [codingstd] Mostly linelength fixes.
jkeenan authored
1 /*
2 Copyright (C) 2010, Parrot Foundation.
3
4 =head1 NAME
5
6 src/embed/api.c - TO COME
7
8 =head1 DESCRIPTION
9
10 TO COME.
11
12 =cut
13
14 */
15
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
16 #include "parrot/parrot.h"
704e3c4 @bluescreen10 Made another test case pass by putting debug information. Also remove…
bluescreen10 authored
17 #include "parrot/runcore_api.h"
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
18 #include "parrot/embed.h"
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
19 #include "parrot/api.h"
1b6d1ce @Whiteknight start breaking up the embedding stuff into multiple files. Add embed_…
Whiteknight authored
20 #include "embed_private.h"
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
21
3f8ed92 @Whiteknight fix some file references and run headerizer to see my work so far
Whiteknight authored
22 /* HEADERIZER HFILE: include/parrot/api.h */
23
3653784 @bluescreen10 Embed API Documentation round 1
bluescreen10 authored
24
25 /*
26
27 =item C<Parrot_Int Parrot_api_get_result(Parrot_PMC interp_pmc, ARGOUT(Parrot_Int *is_error),
28 ARGOUT(Parrot_PMC * exception), ARGOUT(Parrot_Int *exit_code), ARGOUT(Parrot_String * errmsg))>
29
30 Gets the results of the last API function call and stores the results in C<is_error>,
31 C<exception>, C<exit_code> and C<errmsg>. This function returns a true value if this
32 call is successful and false value otherwise. The stored information is as follow:
33
34 C<is_error> a true value if an unhandled exception was thrown or the program terminated
35 with an error condition and a false value otherwise.
36
37 C<exception> the last exception thrown.
38
39 C<exit_code> the exit code of the running program.
40
41 C<errmsg> contains an string with the last error message.
42
43 =cut
44
45 */
46
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
47 PARROT_API
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
48 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
49 Parrot_api_get_result(Parrot_PMC interp_pmc, ARGOUT(Parrot_Int *is_error),
50 ARGOUT(Parrot_PMC * exception), ARGOUT(Parrot_Int *exit_code),
51 ARGOUT(Parrot_String * errmsg))
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
52 {
2483c68 @Whiteknight implement the new error-handling mechanism. Instead of a string, we p…
Whiteknight authored
53 EMBED_API_CALLIN(interp_pmc, interp)
be50d63 @bluescreen10 Implemented first version of Parrot_get_result, now a lot of failing …
bluescreen10 authored
54 *exit_code = interp->exit_code;
2483c68 @Whiteknight implement the new error-handling mechanism. Instead of a string, we p…
Whiteknight authored
55 *exception = interp->final_exception;
73f662d @Whiteknight some fixes so libparrot builds with g++
Whiteknight authored
56 if (PMC_IS_NULL(*exception)) {
2483c68 @Whiteknight implement the new error-handling mechanism. Instead of a string, we p…
Whiteknight authored
57 *is_error = 0;
58 *errmsg = STRINGNULL;
9703ef5 @jkeenan [codingstd] C-style coda needed. No cuddled elses.
jkeenan authored
59 }
60 else {
2483c68 @Whiteknight implement the new error-handling mechanism. Instead of a string, we p…
Whiteknight authored
61 *is_error = !interp->exit_code;
62 *errmsg = VTABLE_get_string(interp, *exception);
63 }
64 interp->final_exception = PMCNULL;
be50d63 @bluescreen10 Implemented first version of Parrot_get_result, now a lot of failing …
bluescreen10 authored
65 interp->exit_code = 0;
2483c68 @Whiteknight implement the new error-handling mechanism. Instead of a string, we p…
Whiteknight authored
66 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
67 }
68
3653784 @bluescreen10 Embed API Documentation round 1
bluescreen10 authored
69 /*
70
71 =item C<Parrot_Int Parrot_api_get_exception_backtrace(Parrot_PMC interp_pmc,
72 Parrot_PMC exception, ARGOUT(Parrot_String * bt))>
73
74 Gets the backtrace of the interpreter's call chain for the given exception C<expcetion>
75 and stores the results in string C<bt>. This function returns a true value if this
76 call is successful and false value otherwise.
77
78 =cut
79
80 */
81
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
82 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
83 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
84 Parrot_api_get_exception_backtrace(Parrot_PMC interp_pmc,
85 Parrot_PMC exception, ARGOUT(Parrot_String * bt))
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
86 {
2483c68 @Whiteknight implement the new error-handling mechanism. Instead of a string, we p…
Whiteknight authored
87 EMBED_API_CALLIN(interp_pmc, interp)
88 STRING * const bts = Parrot_dbg_get_exception_backtrace(interp, exception);
89 *bt = bts;
90 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
91 }
92
3653784 @bluescreen10 Embed API Documentation round 1
bluescreen10 authored
93
94 /*
95
96 =item C<Parrot_Int Parrot_api_make_interpreter(Parrot_PMC parent, Parrot_Int flags,
97 ARGIN_NULLOK(Parrot_Init_Args *args), ARGOUT(Parrot_PMC *interp))>
98
99 Creates a new interpreter and stores it in C<interp>. It takes three optional parameters
100 the new interpreter's C<flags>, the initialization paremeters C<args> and the C<parent>
101 interpreter. This function returns a true value if this call is successful and false
102 value otherwise.
103
104 =cut
105
106 */
107
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
108 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
109 Parrot_Int
709eae7 @Whiteknight add in a handful of additional API functions, though they aren't bein…
Whiteknight authored
110 Parrot_api_make_interpreter(Parrot_PMC parent, Parrot_Int flags,
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
111 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
112 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
113 //ASSERT_ARGS(Parrot_api_make_interpreter)
4a128d5 @Whiteknight lots of little changes
Whiteknight authored
114 int alt_stacktop;
c1ab56e More fixes, almost there
Mariano Wahlmann authored
115 Parrot_Interp interp_raw;
f2252b4 @Whiteknight remove the two-stage initialization dance. We can now initialize an i…
Whiteknight authored
116 void *stacktop_ptr = &alt_stacktop;
82cbd84 @Whiteknight parrot executable compiles, but miniparrot does not link. I need to s…
Whiteknight authored
117 const Parrot_Interp parent_raw = PMC_IS_NULL(parent) ? NULL : GET_RAW_INTERP(parent);
118 interp_raw = allocate_interpreter(parent_raw, flags);
119 if (args) {
120 if (args->stacktop)
121 stacktop_ptr = args->stacktop;
122 if (args->gc_system)
123 Parrot_gc_set_system_type(interp_raw, args->gc_system);
124 if (args->gc_threshold)
125 interp_raw->gc_threshold = args->gc_threshold;
126 if (args->hash_seed)
127 interp_raw->hash_seed = args->hash_seed;
f2252b4 @Whiteknight remove the two-stage initialization dance. We can now initialize an i…
Whiteknight authored
128 }
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
129 initialize_interpreter(interp_raw, stacktop_ptr);
540a832 @jkeenan [codingstd] Mostly linelength fixes.
jkeenan authored
130 *interp = VTABLE_get_pmc_keyed_int(
131 interp_raw, interp_raw->iglobals, (Parrot_Int)IGLOBALS_INTERPRETER);
f2252b4 @Whiteknight remove the two-stage initialization dance. We can now initialize an i…
Whiteknight authored
132 return !PMC_IS_NULL(*interp);
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
133 }
134
3653784 @bluescreen10 Embed API Documentation round 1
bluescreen10 authored
135 /*
136
137 =item C<Parrot_Int Parrot_api_set_runcore(Parrot_PMC interp_pmc, ARGIN(const char * corename),
138 Parrot_UInt trace)>
139
140 Sets the C<interp_pmc>'s bytecode running core, the core is specified by the C<corename>
141 parameter. This function returns a true value if this call is successful and false value
142 otherwise.
143
144 =cut
145
146 */
147
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
148 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
149 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
150 Parrot_api_set_runcore(Parrot_PMC interp_pmc, ARGIN(const char * corename),
151 Parrot_UInt trace)
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
152 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
153 //ASSERT_ARGS(Parrot_api_set_runcore)
3ea891c First round of syntax error fixes
Mariano Wahlmann authored
154 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
155 if (trace) {
704e3c4 @bluescreen10 Made another test case pass by putting debug information. Also remove…
bluescreen10 authored
156 Parrot_pcc_trace_flags_on(interp, interp->ctx, trace);
157 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
9703ef5 @jkeenan [codingstd] C-style coda needed. No cuddled elses.
jkeenan authored
158 }
159 else {
372f8f7 @bluescreen10 Make bounds runcore available
bluescreen10 authored
160 if (!strcmp(corename, "slow") || !strcmp(corename, "bounds"))
704e3c4 @bluescreen10 Made another test case pass by putting debug information. Also remove…
bluescreen10 authored
161 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
540a832 @jkeenan [codingstd] Mostly linelength fixes.
jkeenan authored
162 else if (!strcmp(corename, "fast") ||
163 !strcmp(corename, "jit") || !strcmp(corename, "function"))
704e3c4 @bluescreen10 Made another test case pass by putting debug information. Also remove…
bluescreen10 authored
164 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "fast"));
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
165 else if (!strcmp(corename, "exec"))
704e3c4 @bluescreen10 Made another test case pass by putting debug information. Also remove…
bluescreen10 authored
166 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "exec"));
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
167 else if (!strcmp(corename, "trace"))
704e3c4 @bluescreen10 Made another test case pass by putting debug information. Also remove…
bluescreen10 authored
168 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
169 else if (!strcmp(corename, "profiling"))
704e3c4 @bluescreen10 Made another test case pass by putting debug information. Also remove…
bluescreen10 authored
170 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "profiling"));
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
171 else if (!strcmp(corename, "gcdebug"))
704e3c4 @bluescreen10 Made another test case pass by putting debug information. Also remove…
bluescreen10 authored
172 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
173 else
174 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Invalid runcore type %s", corename);
175 }
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
176 EMBED_API_CALLOUT(interp_pmc, interp)
177 }
178
3653784 @bluescreen10 Embed API Documentation round 1
bluescreen10 authored
179 /*
180
181 =item C<Parrot_Int Parrot_api_debug_flag(Parrot_PMC interp_pmc, Parrot_Int flags, Parrot_Int set)>
182
183 Set/Unset the C<interp_pmc>'s debug flags. If C<set> is in a true value debug flags are set
184 otherwise debug flags are cleared. This function returns a true value if this call is successful
185 and false value otherwise.
186
187 =cut
188
189 */
190
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
191 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
192 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
193 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
194 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
195 //ASSERT_ARGS(Parrot_api_debug_flag)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
196 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
197 if (set)
198 interp->debug_flags |= flags;
199 else
200 interp->debug_flags &= ~flags;
201 EMBED_API_CALLOUT(interp_pmc, interp);
202 }
203
3653784 @bluescreen10 Embed API Documentation round 1
bluescreen10 authored
204 /*
205
206 =item C<Parrot_Int Parrot_api_flag(Parrot_PMC interp_pmc, Parrot_Int flags, Parrot_Int set)>
207
208 Set/Unset the C<interp_pmc>'s general flags. If C<set> is in a true value general flags are
209 set otherwise passed flags are cleared. This function returns a true value if this call is
210 successful and false value otherwise.
211
212 =cut
213
214 */
215
f68bf56 @Whiteknight add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
Whiteknight authored
216 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
217 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
218 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
219 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
220 //ASSERT_ARGS(Parrot_api_flag)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
221 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
222 if (set) {
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
223 Interp_flags_SET(interp, flags);
224 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
225 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
226 }
227 else
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
228 Interp_flags_CLEAR(interp, flags);
f68bf56 @Whiteknight add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
Whiteknight authored
229 EMBED_API_CALLOUT(interp_pmc, interp);
230 }
231
3653784 @bluescreen10 Embed API Documentation round 1
bluescreen10 authored
232 /*
233
234 =item C<Parrot_Int Parrot_api_set_executable_name(Parrot_PMC interp_pmc, ARGIN(const char * name))>
235
236 Sets the executable name for the C<interp_pmc> interpreter. This function returns a true
237 value if this call is successful and false value otherwise.
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
243 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
244 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
245 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
246 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
247 //ASSERT_ARGS(Parrot_api_set_executable_name)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
248 EMBED_API_CALLIN(interp_pmc, interp)
1a692e9 @Whiteknight _set_executable_name takes a C string instead of a Parrot string, for…
Whiteknight authored
249 STRING * const name_str = Parrot_str_new(interp, name, 0);
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
250 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
251 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
252 VTABLE_set_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_EXECUTABLE,
253 name_pmc);
4a128d5 @Whiteknight lots of little changes
Whiteknight authored
254 EMBED_API_CALLOUT(interp_pmc, interp);
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
255 }
256
3653784 @bluescreen10 Embed API Documentation round 1
bluescreen10 authored
257 /*
258
259 =item C<Parrot_Int Parrot_api_destroy_interpreter(Parrot_PMC interp_pmc)>
260
261 Destroys the C<interp_pmc> interpreter, freeing the memory structures allocated for it.
262 This function returns a true value if this call is successful and false value otherwise.
263
264 =cut
265
266 */
267
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
268 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
269 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
270 Parrot_api_destroy_interpreter(Parrot_PMC interp_pmc)
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
271 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
272 //ASSERT_ARGS(Parrot_api_destroy_interpreter)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
273 EMBED_API_CALLIN(interp_pmc, interp)
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
274 Parrot_destroy(interp);
ae620cc @Whiteknight changes necessary so we build. Run fails horribly, but we build
Whiteknight authored
275 Parrot_x_exit(interp, 0);
4a128d5 @Whiteknight lots of little changes
Whiteknight authored
276 EMBED_API_CALLOUT(interp_pmc, interp);
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
277 }
278
279 /*
280
b9cdf9c @jkeenan After fixing C++ comments, I re-ran headerizer and modified these fil…
jkeenan authored
281 =item C<Parrot_Int Parrot_api_load_bytecode_file(Parrot_PMC interp_pmc, const
282 char *filename, Parrot_PMC * pbc)>
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
283
3653784 @bluescreen10 Embed API Documentation round 1
bluescreen10 authored
284 Load a bytecode file and return a bytecode PMC. This function returns a true value
285 if this call is successful and false value otherwise.
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
286
287 =cut
288
289 */
290
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
291 /* TODO: This only works with the inital bytecode. After this we should use
292 Parrot_append_bytecode or something similar */
293
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
294 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
295 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
296 Parrot_api_load_bytecode_file(Parrot_PMC interp_pmc,
297 ARGIN(const char *filename), ARGOUT(Parrot_PMC * pbc))
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
298 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
299 //ASSERT_ARGS(Parrot_api_load_bytecode_file)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
300 EMBED_API_CALLIN(interp_pmc, interp)
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
301 PackFile * const pf = Parrot_pbc_read(interp, filename, 0);
302 if (!pf)
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
303 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not load packfile");
46b7a9d @Whiteknight upconvert pbc_to_exe to use the new API. it builds, but segfaults bui…
Whiteknight authored
304 do_sub_pragmas(interp, pf->cur_cs, PBC_PBC, NULL);
950d701 @Whiteknight Packfile PMCs don't do what I need them to do (yet). Use UnManagedStr…
Whiteknight authored
305 *pbc = Parrot_pmc_new(interp, enum_class_UnManagedStruct);
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
306 VTABLE_set_pointer(interp, *pbc, pf);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
307 EMBED_API_CALLOUT(interp_pmc, interp)
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
308 }
309
3653784 @bluescreen10 Embed API Documentation round 1
bluescreen10 authored
310 /*
311
312 =item C<Parrot_Int Parrot_api_load_bytecode_bytes(Parrot_PMC interp_pmc,
313 ARGIN(const unsigned char * const pbc), Parrot_Int bytecode_size,
314 ARGOUT(Parrot_PMC * pbcpmc))>
315
316
317 This function returns a true value if this call is successful and false value otherwise.
318
319 =cut
320
321 */
322
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
323 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
324 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
325 Parrot_api_load_bytecode_bytes(Parrot_PMC interp_pmc,
326 ARGIN(const unsigned char * const pbc), Parrot_Int bytecode_size,
327 ARGOUT(Parrot_PMC * pbcpmc))
46b7a9d @Whiteknight upconvert pbc_to_exe to use the new API. it builds, but segfaults bui…
Whiteknight authored
328 {
99428c2 Make src/embed/pmc.c & src/embed/api.c compile with gcc
Mariano Wahlmann authored
329 EMBED_API_CALLIN(interp_pmc, interp)
46b7a9d @Whiteknight upconvert pbc_to_exe to use the new API. it builds, but segfaults bui…
Whiteknight authored
330 PackFile * const pf = PackFile_new(interp, 0);
331 if (!pf)
332 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not create packfile");
333
334 if (!PackFile_unpack(interp, pf, (const opcode_t *)pbc, bytecode_size))
335 Parrot_ex_throw_from_c_args(interp, NULL, 1, "could not unpack packfile");
336 do_sub_pragmas(interp, pf->cur_cs, PBC_PBC, NULL);
337 *pbcpmc = Parrot_pmc_new(interp, enum_class_UnManagedStruct);
338 VTABLE_set_pointer(interp, *pbcpmc, pf);
339 EMBED_API_CALLOUT(interp_pmc, interp);
340 }
341
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
342 /* Load the bytecode into the interpreter, but don't execute it */
343 /* TODO: This only works with the inital bytecode. After this we should use
344 Parrot_append_bytecode or something similar */
345
709eae7 @Whiteknight add in a handful of additional API functions, though they aren't bein…
Whiteknight authored
346 PARROT_API
347 Parrot_Int
348 Parrot_api_ready_bytecode(Parrot_PMC interp_pmc, Parrot_PMC pbc,
349 ARGOUT(Parrot_PMC *main_sub))
350 {
351 EMBED_API_CALLIN(interp_pmc, interp)
352 PackFile * const pf = (PackFile *)VTABLE_get_pointer(interp, pbc);
353
354 /* Debugging mode nonsense. */
355 if (Interp_debug_TEST(interp, PARROT_START_DEBUG_FLAG)) {
356 Parrot_io_eprintf(interp, "*** Parrot VM: %Ss core ***\n",
357 interp->run_core->name);
358 }
359
360 if (!pf)
361 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not get packfile");
362 if (pf->cur_cs != NULL)
363 Parrot_pbc_load(interp, pf);
364 PackFile_fixup_subs(interp, PBC_IMMEDIATE, NULL);
365 PackFile_fixup_subs(interp, PBC_POSTCOMP, NULL);
366 PackFile_fixup_subs(interp, PBC_MAIN, NULL);
367 *main_sub = Parrot_pcc_get_sub(interp, CURRENT_CONTEXT(interp));
368 Parrot_pcc_set_constants(interp, interp->ctx, interp->code->const_table);
369 EMBED_API_CALLOUT(interp_pmc, interp)
370 }
371
46b7a9d @Whiteknight upconvert pbc_to_exe to use the new API. it builds, but segfaults bui…
Whiteknight authored
372 PARROT_API
373 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
374 Parrot_api_run_bytecode(Parrot_PMC interp_pmc, Parrot_PMC pbc,
375 Parrot_PMC mainargs)
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
376 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
377 //ASSERT_ARGS(Parrot_api_run_bytecode)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
378 EMBED_API_CALLIN(interp_pmc, interp)
65bf81a @Whiteknight actually run the code, don't just look at it. Miniparrot runs now. pa…
Whiteknight authored
379 PMC * main_sub = NULL;
380
98cd26c @Whiteknight don't call Parrot_pbc_load if the PBC comes straight out of IMCC. IMC…
Whiteknight authored
381 PackFile * const pf = (PackFile *)VTABLE_get_pointer(interp, pbc);
9f7a94c @Whiteknight make sure to set :main() args in the iglobals array. This makes ops2c…
Whiteknight authored
382
704e3c4 @bluescreen10 Made another test case pass by putting debug information. Also remove…
bluescreen10 authored
383 /* Debugging mode nonsense. */
384 if (Interp_debug_TEST(interp, PARROT_START_DEBUG_FLAG)) {
385 Parrot_io_eprintf(interp, "*** Parrot VM: %Ss core ***\n",
386 interp->run_core->name);
709eae7 @Whiteknight add in a handful of additional API functions, though they aren't bein…
Whiteknight authored
387 }
704e3c4 @bluescreen10 Made another test case pass by putting debug information. Also remove…
bluescreen10 authored
388
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
389 if (!pf)
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
390 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not get packfile");
98cd26c @Whiteknight don't call Parrot_pbc_load if the PBC comes straight out of IMCC. IMC…
Whiteknight authored
391 if (pf->cur_cs != NULL)
392 Parrot_pbc_load(interp, pf);
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
393 PackFile_fixup_subs(interp, PBC_IMMEDIATE, NULL);
394 PackFile_fixup_subs(interp, PBC_POSTCOMP, NULL);
395 PackFile_fixup_subs(interp, PBC_MAIN, NULL);
65bf81a @Whiteknight actually run the code, don't just look at it. Miniparrot runs now. pa…
Whiteknight authored
396 main_sub = Parrot_pcc_get_sub(interp, CURRENT_CONTEXT(interp));
397
398 /* if no sub was marked being :main, we create a dummy sub with offset 0 */
399
400 if (!main_sub)
401 main_sub = set_current_sub(interp);
402
403 Parrot_pcc_set_sub(interp, CURRENT_CONTEXT(interp), NULL);
404 Parrot_pcc_set_constants(interp, interp->ctx, interp->code->const_table);
405
9f7a94c @Whiteknight make sure to set :main() args in the iglobals array. This makes ops2c…
Whiteknight authored
406 VTABLE_set_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_ARGV_LIST, mainargs);
73f662d @Whiteknight some fixes so libparrot builds with g++
Whiteknight authored
407 Parrot_pcc_invoke_sub_from_c_args(interp, main_sub, "P->", mainargs);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
408 EMBED_API_CALLOUT(interp_pmc, interp)
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
409 }
4a128d5 @Whiteknight lots of little changes
Whiteknight authored
410
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
411 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
412 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
413 Parrot_api_disassemble_bytecode(Parrot_PMC interp_pmc, Parrot_PMC pbc,
414 ARGIN(const char * const outfile), Parrot_Int opts)
590f387 @Whiteknight update pbc_disassemble to the new API. Had to add a new API function …
Whiteknight authored
415 {
e9934d7 Made it compile with gcc
Mariano Wahlmann authored
416 EMBED_API_CALLIN(interp_pmc, interp)
590f387 @Whiteknight update pbc_disassemble to the new API. Had to add a new API function …
Whiteknight authored
417 PackFile * const pf = (PackFile *)VTABLE_get_pointer(interp, pbc);
418 if (!pf)
419 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not get packfile");
420 if (pf->cur_cs != NULL)
421 Parrot_pbc_load(interp, pf);
422 Parrot_disassemble(interp, outfile, (Parrot_disassemble_options)opts);
423 EMBED_API_CALLOUT(interp_pmc, interp);
424 }
425
426 PARROT_API
427 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
428 Parrot_api_build_argv_array(Parrot_PMC interp_pmc, Parrot_Int argc,
73f662d @Whiteknight some fixes so libparrot builds with g++
Whiteknight authored
429 ARGIN(const char ** argv), ARGOUT(Parrot_PMC * args))
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
430 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
431 //ASSERT_ARGS(Parrot_api_build_argv_array)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
432 EMBED_API_CALLIN(interp_pmc, interp)
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
433 PMC * const userargv = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
434 Parrot_Int i;
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
435
436 for (i = 0; i < argc; ++i) {
437 /* Run through argv, adding everything to the array */
438 STRING * const arg = Parrot_str_new_init(interp, argv[i], strlen(argv[i]),
439 Parrot_utf8_encoding_ptr, PObj_external_FLAG);
440 VTABLE_push_string(interp, userargv, arg);
441 }
442 *args = userargv;
c1ab56e More fixes, almost there
Mariano Wahlmann authored
443 EMBED_API_CALLOUT(interp_pmc, interp)
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
444 }
9d25cd4 @Whiteknight change the imcc_run function to return a PackFile PMC so we can use i…
Whiteknight authored
445
446 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
447 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
448 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
449 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
450 //ASSERT_ARGS(Parrot_api_set_warnings)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
451 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
452 /* 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
453 PARROT_WARNINGS_on(interp, flags);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
454 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
455 }
456
457 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
458 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
459 Parrot_api_set_output_file(Parrot_PMC interp_pmc,
460 ARGIN_NULLOK(const char * filename))
9d25cd4 @Whiteknight change the imcc_run function to return a PackFile PMC so we can use i…
Whiteknight authored
461 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
462 //ASSERT_ARGS(Parrot_api_set_output_file)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
463 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
464 if (!filename && !interp->output_file)
465 interp->output_file = "-";
466 else
467 interp->output_file = filename;
c1ab56e More fixes, almost there
Mariano Wahlmann authored
468 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
469 }
470
471 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
472 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
473 Parrot_api_add_library_search_path(Parrot_PMC interp_pmc,
474 ARGIN(const char *path))
9d25cd4 @Whiteknight change the imcc_run function to return a PackFile PMC so we can use i…
Whiteknight authored
475 {
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
476 //ASSERT_ARGS(Parrot_api_add_library_search_path)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
477 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
478 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_LIBRARY);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
479 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
480 }
481
482 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
483 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
484 Parrot_api_add_include_search_path(Parrot_PMC interp_pmc,
485 ARGIN(const char *path))
9d25cd4 @Whiteknight change the imcc_run function to return a PackFile PMC so we can use i…
Whiteknight authored
486 {
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
487 //ASSERT_ARGS(Parrot_api_add_include_search_path)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
488 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
489 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_INCLUDE);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
490 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
491 }
492
493 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
494 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
495 Parrot_api_add_dynext_search_path(Parrot_PMC interp_pmc,
496 ARGIN(const char *path))
9d25cd4 @Whiteknight change the imcc_run function to return a PackFile PMC so we can use i…
Whiteknight authored
497 {
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
498 //ASSERT_ARGS(Parrot_api_add_dynext_search_path)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
499 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
500 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_DYNEXT);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
501 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
502 }
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
503
504 /*
505
c7def2f @jkeenan Run 'perl tools/dev/headerizer.pl src/embed/api.o'.
jkeenan authored
506 =item C<Parrot_Int Parrot_api_set_stdhandles(Parrot_PMC interp_pmc, Parrot_Int
507 in, Parrot_Int out, Parrot_Int err)>
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
508
509 Set the std file descriptors for the embedded interpreter. Any file descriptor
510 passed as argument and set to C<PIO_INVALID_HANDLE> is ignored.
511
512 =cut
513
514 */
515
516 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
517 Parrot_Int
aef7ea1 Fixed stdin,stdout and stderr Andy++ pointed out
Mariano Wahlmann authored
518 Parrot_api_set_stdhandles(Parrot_PMC interp_pmc, Parrot_Int in,
519 Parrot_Int out, Parrot_Int err)
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
520 {
6be2b4a @Whiteknight remove the ASSERT_ARGS stuff, and other things that are borking thebu…
Whiteknight authored
521 //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
522 EMBED_API_CALLIN(interp_pmc, interp)
523 void *dummy;
524
1311cec @jkeenan [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
jkeenan authored
525 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
526 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
aef7ea1 Fixed stdin,stdout and stderr Andy++ pointed out
Mariano Wahlmann authored
527 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
528 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
529 }
530
1311cec @jkeenan [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
jkeenan authored
531 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
532 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
aef7ea1 Fixed stdin,stdout and stderr Andy++ pointed out
Mariano Wahlmann authored
533 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
534 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
535 }
536
1311cec @jkeenan [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
jkeenan authored
537 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
538 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
aef7ea1 Fixed stdin,stdout and stderr Andy++ pointed out
Mariano Wahlmann authored
539 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
540 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
541 }
16e368d @Whiteknight fix several build warnings in src/embed/* in gcc, g++, and icc
Whiteknight authored
542 UNUSED(dummy);
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
543
544 EMBED_API_CALLOUT(interp_pmc, interp)
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
545 }
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
546
547 PARROT_API
548 Parrot_Int
1216a51 @Whiteknight quick initial pass for codestd
Whiteknight authored
549 Parrot_api_get_runtime_path(Parrot_PMC interp_pmc,
550 ARGOUT(Parrot_String *runtime))
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
551 {
e9934d7 Made it compile with gcc
Mariano Wahlmann authored
552 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
553 *runtime = Parrot_get_runtime_path(interp);
554 EMBED_API_CALLOUT(interp_pmc, interp);
555 }
556
c4ccd13 @Whiteknight first prototype of a new mechanism for setting the configuration hash…
Whiteknight authored
557 PARROT_API
558 Parrot_Int
559 Parrot_api_set_configuration_hash(Parrot_PMC interp_pmc, Parrot_PMC confighash)
560 {
e9934d7 Made it compile with gcc
Mariano Wahlmann authored
561 EMBED_API_CALLIN(interp_pmc, interp)
c4ccd13 @Whiteknight first prototype of a new mechanism for setting the configuration hash…
Whiteknight authored
562 Parrot_set_config_hash_pmc(interp, confighash);
5c2c3d4 @Whiteknight fix library paths. The build now progresses through all the parts tha…
Whiteknight authored
563 Parrot_lib_update_paths_from_config_hash(interp);
c4ccd13 @Whiteknight first prototype of a new mechanism for setting the configuration hash…
Whiteknight authored
564 EMBED_API_CALLOUT(interp_pmc, interp);
565 }
566
e1ced3e @Whiteknight add a note explaining this stupid function
Whiteknight authored
567 /*
568 This is an evil hack to provide a wrapper around IMCC to catch unhandled
569 exceptions without having to assume IMCC is linked in with libparrot. Delete
570 this as soon as we don't need it anymore.
571 */
572
5b6a239 @Whiteknight Add a new, temporary hack API for wrapping up IMCC so we can catch er…
Whiteknight authored
573 PARROT_API
574 Parrot_Int
e1ced3e @Whiteknight add a note explaining this stupid function
Whiteknight authored
575 Parrot_api_wrap_imcc_hack(Parrot_PMC interp_pmc, const char * sourcefile,
576 int argc, const char **argv, Parrot_PMC* bytecodepmc, int *result,
577 imcc_hack_func_t func)
5b6a239 @Whiteknight Add a new, temporary hack API for wrapping up IMCC so we can catch er…
Whiteknight authored
578 {
579 EMBED_API_CALLIN(interp_pmc, interp)
580 *result = func(interp_pmc, sourcefile, argc, argv, bytecodepmc);
581 EMBED_API_CALLOUT(interp_pmc, interp)
582 }
c4ccd13 @Whiteknight first prototype of a new mechanism for setting the configuration hash…
Whiteknight authored
583
7db7331 @jkeenan Correct C-comment syntax error.
jkeenan authored
584 /*
585
f0bd1e1 First cut of load_language, set_compiler, get compiler
Mariano Wahlmann authored
586 =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
587 lang)>
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
588
589 Load the compiler libraries for a given high-level language into the
590 interpreter.
591
592 =cut
593
594 */
595
596 PARROT_API
597 Parrot_Int
d74cf45 @Whiteknight fix build warnings in src/embed/api.c
Whiteknight authored
598 Parrot_api_load_language(Parrot_PMC interp_pmc, Parrot_String lang)
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
599 {
600 ASSERT_ARGS(Parrot_api_load_language)
601 EMBED_API_CALLIN(interp_pmc, interp)
d74cf45 @Whiteknight fix build warnings in src/embed/api.c
Whiteknight authored
602 Parrot_load_language(interp, lang);
603 EMBED_API_CALLOUT(interp_pmc, interp);
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
604 }
605
606
607 /*
608
f0bd1e1 First cut of load_language, set_compiler, get compiler
Mariano Wahlmann authored
609 =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
610 type, Parrot_PMC *compiler)>
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
611
612 =cut
613
614 */
615
616 PARROT_API
617 Parrot_Int
d74cf45 @Whiteknight fix build warnings in src/embed/api.c
Whiteknight authored
618 Parrot_api_get_compiler(Parrot_PMC interp_pmc, Parrot_String type,
619 ARGOUT(Parrot_PMC *compiler))
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
620 {
621 ASSERT_ARGS(Parrot_api_get_compiler)
622 EMBED_API_CALLIN(interp_pmc, interp)
d74cf45 @Whiteknight fix build warnings in src/embed/api.c
Whiteknight authored
623 *compiler = Parrot_get_compiler(interp, type);
624 EMBED_API_CALLOUT(interp_pmc, interp);
f0bd1e1 First cut of load_language, set_compiler, get compiler
Mariano Wahlmann authored
625 }
626
627
628 /*
629
630 =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
631 type, Parrot_PMC compiler)>
f0bd1e1 First cut of load_language, set_compiler, get compiler
Mariano Wahlmann authored
632
633 =cut
634
635 */
636
637 PARROT_API
638 Parrot_Int
d74cf45 @Whiteknight fix build warnings in src/embed/api.c
Whiteknight authored
639 Parrot_api_set_compiler(Parrot_PMC interp_pmc, Parrot_String type,
640 Parrot_PMC compiler)
f0bd1e1 First cut of load_language, set_compiler, get compiler
Mariano Wahlmann authored
641 {
642 ASSERT_ARGS(Parrot_api_set_compiler)
643 EMBED_API_CALLIN(interp_pmc, interp)
d74cf45 @Whiteknight fix build warnings in src/embed/api.c
Whiteknight authored
644 Parrot_set_compiler(interp, type, compiler);
645 EMBED_API_CALLOUT(interp_pmc, interp);
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
646 }
0814f94 Merged changes with branch
Mariano Wahlmann authored
647
648 /*
649
1311cec @jkeenan [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
jkeenan authored
650 =back
651
9703ef5 @jkeenan [codingstd] C-style coda needed. No cuddled elses.
jkeenan authored
652 =cut
0814f94 Merged changes with branch
Mariano Wahlmann authored
653
7db7331 @jkeenan Correct C-comment syntax error.
jkeenan authored
654 */
9703ef5 @jkeenan [codingstd] C-style coda needed. No cuddled elses.
jkeenan authored
655
540a832 @jkeenan [codingstd] Mostly linelength fixes.
jkeenan authored
656 /*
657 * Local variables:
658 * c-file-style: "parrot"
659 * End:
660 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
661 */
0814f94 Merged changes with branch
Mariano Wahlmann authored
662
Something went wrong with that request. Please try again.