Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 818 lines (626 sloc) 23.628 kb
540a832 James E Keenan [codingstd] Mostly linelength fixes.
jkeenan authored
1 /*
2 Copyright (C) 2010, Parrot Foundation.
3
4 =head1 NAME
5
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
6 src/embed/api.c - The Parrot embedding interface
540a832 James E Keenan [codingstd] Mostly linelength fixes.
jkeenan authored
7
8 =head1 DESCRIPTION
9
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
10 This file implements functions of the Parrot embedding interface.
11
12 =head2 Functions
13
14 =over 4
540a832 James E Keenan [codingstd] Mostly linelength fixes.
jkeenan authored
15
16 =cut
17
18 */
19
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
20 #include "parrot/parrot.h"
704e3c4 Mariano Wahlmann Made another test case pass by putting debug information. Also removed s...
bluescreen10 authored
21 #include "parrot/runcore_api.h"
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
22 #include "parrot/embed.h"
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
23 #include "parrot/api.h"
1b6d1ce Andrew Whitworth start breaking up the embedding stuff into multiple files. Add embed_pri...
Whiteknight authored
24 #include "embed_private.h"
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
25
3f8ed92 Andrew Whitworth fix some file references and run headerizer to see my work so far
Whiteknight authored
26 /* HEADERIZER HFILE: include/parrot/api.h */
27
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
28
29 /*
30
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
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 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
34
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
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 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
39
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
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 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
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 Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
53 PARROT_API
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
54 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
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 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
58 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
59 ASSERT_ARGS(Parrot_api_get_result)
2483c68 Andrew Whitworth implement the new error-handling mechanism. Instead of a string, we pass...
Whiteknight authored
60 EMBED_API_CALLIN(interp_pmc, interp)
be50d63 Mariano Wahlmann Implemented first version of Parrot_get_result, now a lot of failing tes...
bluescreen10 authored
61 *exit_code = interp->exit_code;
2483c68 Andrew Whitworth implement the new error-handling mechanism. Instead of a string, we pass...
Whiteknight authored
62 *exception = interp->final_exception;
73f662d Andrew Whitworth some fixes so libparrot builds with g++
Whiteknight authored
63 if (PMC_IS_NULL(*exception)) {
2483c68 Andrew Whitworth implement the new error-handling mechanism. Instead of a string, we pass...
Whiteknight authored
64 *is_error = 0;
65 *errmsg = STRINGNULL;
9703ef5 James E Keenan [codingstd] C-style coda needed. No cuddled elses.
jkeenan authored
66 }
67 else {
b3af8c9 Andrew Whitworth fix main.c so that we check the is_error flag and only show an error mes...
Whiteknight authored
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 Andrew Whitworth implement the new error-handling mechanism. Instead of a string, we pass...
Whiteknight authored
71 *errmsg = VTABLE_get_string(interp, *exception);
72 }
73 interp->final_exception = PMCNULL;
be50d63 Mariano Wahlmann Implemented first version of Parrot_get_result, now a lot of failing tes...
bluescreen10 authored
74 interp->exit_code = 0;
2483c68 Andrew Whitworth implement the new error-handling mechanism. Instead of a string, we pass...
Whiteknight authored
75 EMBED_API_CALLOUT(interp_pmc, interp)
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
76 }
77
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
78 /*
79
80 =item C<Parrot_Int Parrot_api_get_exception_backtrace(Parrot_PMC interp_pmc,
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
81 Parrot_PMC exception, Parrot_String * bt)>
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
82
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
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 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
86
87 =cut
88
89 */
90
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
91 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
92 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
93 Parrot_api_get_exception_backtrace(Parrot_PMC interp_pmc,
94 Parrot_PMC exception, ARGOUT(Parrot_String * bt))
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
95 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
96 ASSERT_ARGS(Parrot_api_get_exception_backtrace)
2483c68 Andrew Whitworth implement the new error-handling mechanism. Instead of a string, we pass...
Whiteknight authored
97 EMBED_API_CALLIN(interp_pmc, interp)
98 STRING * const bts = Parrot_dbg_get_exception_backtrace(interp, exception);
99 *bt = bts;
100 EMBED_API_CALLOUT(interp_pmc, interp)
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
101 }
102
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
103
104 /*
105
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
106 =item C<Parrot_Int Parrot_api_make_interpreter(Parrot_PMC parent, Parrot_Int
107 flags, Parrot_Init_Args *args, Parrot_PMC *interp)>
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
108
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
109 Creates a new interpreter and stores it in C<interp>. It takes three optional
110 parameters the new interpreter's C<flags>, the initialization paremeters C<args>
111 and the C<parent> interpreter. This function returns a true value if this call
112 is successful and false value otherwise.
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
113
114 =cut
115
116 */
117
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
118 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
119 Parrot_Int
709eae7 Andrew Whitworth add in a handful of additional API functions, though they aren't being u...
Whiteknight authored
120 Parrot_api_make_interpreter(Parrot_PMC parent, Parrot_Int flags,
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
121 ARGIN_NULLOK(Parrot_Init_Args *args), ARGOUT(Parrot_PMC *interp))
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
122 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
123 ASSERT_ARGS(Parrot_api_make_interpreter)
4a128d5 Andrew Whitworth lots of little changes
Whiteknight authored
124 int alt_stacktop;
c1ab56e More fixes, almost there
Mariano Wahlmann authored
125 Parrot_Interp interp_raw;
f2252b4 Andrew Whitworth remove the two-stage initialization dance. We can now initialize an inte...
Whiteknight authored
126 void *stacktop_ptr = &alt_stacktop;
82cbd84 Andrew Whitworth parrot executable compiles, but miniparrot does not link. I need to sort...
Whiteknight authored
127 const Parrot_Interp parent_raw = PMC_IS_NULL(parent) ? NULL : GET_RAW_INTERP(parent);
128 interp_raw = allocate_interpreter(parent_raw, flags);
129 if (args) {
130 if (args->stacktop)
131 stacktop_ptr = args->stacktop;
132 if (args->gc_system)
133 Parrot_gc_set_system_type(interp_raw, args->gc_system);
134 if (args->gc_threshold)
135 interp_raw->gc_threshold = args->gc_threshold;
136 if (args->hash_seed)
137 interp_raw->hash_seed = args->hash_seed;
f2252b4 Andrew Whitworth remove the two-stage initialization dance. We can now initialize an inte...
Whiteknight authored
138 }
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
139 initialize_interpreter(interp_raw, stacktop_ptr);
540a832 James E Keenan [codingstd] Mostly linelength fixes.
jkeenan authored
140 *interp = VTABLE_get_pmc_keyed_int(
141 interp_raw, interp_raw->iglobals, (Parrot_Int)IGLOBALS_INTERPRETER);
f2252b4 Andrew Whitworth remove the two-stage initialization dance. We can now initialize an inte...
Whiteknight authored
142 return !PMC_IS_NULL(*interp);
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
143 }
144
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
145 /*
146
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
147 =item C<Parrot_Int Parrot_api_set_runcore(Parrot_PMC interp_pmc, const char *
148 corename, Parrot_UInt trace)>
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
149
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
150 Sets the C<interp_pmc>'s bytecode running core, the core is specified by the
151 C<corename>. This function returns a true value if this call is successful and
152 false value otherwise.
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
153
154 =cut
155
156 */
157
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
158 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
159 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
160 Parrot_api_set_runcore(Parrot_PMC interp_pmc, ARGIN(const char * corename),
161 Parrot_UInt trace)
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
162 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
163 ASSERT_ARGS(Parrot_api_set_runcore)
3ea891c First round of syntax error fixes
Mariano Wahlmann authored
164 EMBED_API_CALLIN(interp_pmc, interp)
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
165 if (trace) {
704e3c4 Mariano Wahlmann Made another test case pass by putting debug information. Also removed s...
bluescreen10 authored
166 Parrot_pcc_trace_flags_on(interp, interp->ctx, trace);
167 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
9703ef5 James E Keenan [codingstd] C-style coda needed. No cuddled elses.
jkeenan authored
168 }
169 else {
372f8f7 Mariano Wahlmann Make bounds runcore available
bluescreen10 authored
170 if (!strcmp(corename, "slow") || !strcmp(corename, "bounds"))
704e3c4 Mariano Wahlmann Made another test case pass by putting debug information. Also removed s...
bluescreen10 authored
171 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
540a832 James E Keenan [codingstd] Mostly linelength fixes.
jkeenan authored
172 else if (!strcmp(corename, "fast") ||
173 !strcmp(corename, "jit") || !strcmp(corename, "function"))
704e3c4 Mariano Wahlmann Made another test case pass by putting debug information. Also removed s...
bluescreen10 authored
174 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "fast"));
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
175 else if (!strcmp(corename, "exec"))
704e3c4 Mariano Wahlmann Made another test case pass by putting debug information. Also removed s...
bluescreen10 authored
176 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "exec"));
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
177 else if (!strcmp(corename, "trace"))
704e3c4 Mariano Wahlmann Made another test case pass by putting debug information. Also removed s...
bluescreen10 authored
178 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
179 else if (!strcmp(corename, "profiling"))
704e3c4 Mariano Wahlmann Made another test case pass by putting debug information. Also removed s...
bluescreen10 authored
180 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "profiling"));
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
181 else if (!strcmp(corename, "gcdebug"))
704e3c4 Mariano Wahlmann Made another test case pass by putting debug information. Also removed s...
bluescreen10 authored
182 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "gcdebug"));
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
183 else
184 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Invalid runcore type %s", corename);
185 }
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
186 EMBED_API_CALLOUT(interp_pmc, interp)
187 }
188
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
189 /*
190
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
191 =item C<Parrot_Int Parrot_api_debug_flag(Parrot_PMC interp_pmc, Parrot_Int
192 flags, Parrot_Int set)>
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
193
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
194 Sets/Unsets the C<interp_pmc>'s debug flags. If C<set> is in a true value debug
195 flags are set otherwise debug flags are cleared. This function returns a true
196 value if this call is successful and false value otherwise.
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
197
198 =cut
199
200 */
201
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
202 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
203 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
204 Parrot_api_debug_flag(Parrot_PMC interp_pmc, Parrot_Int flags, Parrot_Int set)
f68bf56 Andrew Whitworth add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c inste...
Whiteknight authored
205 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
206 ASSERT_ARGS(Parrot_api_debug_flag)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
207 EMBED_API_CALLIN(interp_pmc, interp)
f68bf56 Andrew Whitworth add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c inste...
Whiteknight authored
208 if (set)
209 interp->debug_flags |= flags;
210 else
211 interp->debug_flags &= ~flags;
212 EMBED_API_CALLOUT(interp_pmc, interp);
213 }
214
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
215 /*
216
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
217 =item C<Parrot_Int Parrot_api_flag(Parrot_PMC interp_pmc, Parrot_Int flags,
218 Parrot_Int set)>
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
219
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
220 Set/Unset the C<interp_pmc>'s general flags. If C<set> is in a true value general
221 flags are set otherwise passed flags are cleared. This function returns a true
222 value if this call is successful and false value otherwise.
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
223
224 =cut
225
226 */
227
f68bf56 Andrew Whitworth add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c inste...
Whiteknight authored
228 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
229 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
230 Parrot_api_flag(Parrot_PMC interp_pmc, Parrot_Int flags, Parrot_Int set)
f68bf56 Andrew Whitworth add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c inste...
Whiteknight authored
231 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
232 ASSERT_ARGS(Parrot_api_flag)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
233 EMBED_API_CALLIN(interp_pmc, interp)
f68bf56 Andrew Whitworth add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c inste...
Whiteknight authored
234 if (set) {
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
235 Interp_flags_SET(interp, flags);
236 if (flags & (PARROT_BOUNDS_FLAG | PARROT_PROFILE_FLAG))
f68bf56 Andrew Whitworth add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c inste...
Whiteknight authored
237 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
238 }
239 else
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
240 Interp_flags_CLEAR(interp, flags);
f68bf56 Andrew Whitworth add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c inste...
Whiteknight authored
241 EMBED_API_CALLOUT(interp_pmc, interp);
242 }
243
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
244 /*
245
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
246 =item C<Parrot_Int Parrot_api_set_executable_name(Parrot_PMC interp_pmc, const
247 char * name)>
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
248
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
249 Sets the executable name for the C<interp_pmc> interpreter. This function returns
250 a true value if this call is successful and false value otherwise.
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
251
252 =cut
253
254 */
255
f68bf56 Andrew Whitworth add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c inste...
Whiteknight authored
256 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
257 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
258 Parrot_api_set_executable_name(Parrot_PMC interp_pmc, ARGIN(const char * name))
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
259 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
260 ASSERT_ARGS(Parrot_api_set_executable_name)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
261 EMBED_API_CALLIN(interp_pmc, interp)
1a692e9 Andrew Whitworth _set_executable_name takes a C string instead of a Parrot string, for co...
Whiteknight authored
262 STRING * const name_str = Parrot_str_new(interp, name, 0);
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
263 PMC * const name_pmc = Parrot_pmc_new(interp, enum_class_String);
1a692e9 Andrew Whitworth _set_executable_name takes a C string instead of a Parrot string, for co...
Whiteknight authored
264 VTABLE_set_string_native(interp, name_pmc, name_str);
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
265 VTABLE_set_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_EXECUTABLE,
266 name_pmc);
4a128d5 Andrew Whitworth lots of little changes
Whiteknight authored
267 EMBED_API_CALLOUT(interp_pmc, interp);
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
268 }
269
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
270 /*
271
272 =item C<Parrot_Int Parrot_api_destroy_interpreter(Parrot_PMC interp_pmc)>
273
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
274 Destroys the C<interp_pmc> interpreter, freeing the memory structures allocated
275 for it. This function returns a true value if this call is successful and false
276 value otherwise.
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
277
278 =cut
279
280 */
281
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
282 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
283 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
284 Parrot_api_destroy_interpreter(Parrot_PMC interp_pmc)
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
285 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
286 ASSERT_ARGS(Parrot_api_destroy_interpreter)
2dc5187 Nick Wellnhofer [embed] Fix segfault with --leak-test option
nwellnhof authored
287 void * _oldtop;
288 Parrot_jump_buff env;
289 Interp * const interp = GET_INTERP(interp_pmc);
290 _oldtop = interp->lo_var_ptr;
291 if (_oldtop == NULL)
292 interp->lo_var_ptr = &_oldtop;
293 interp->api_jmp_buf = &env;
294 if (setjmp(env)) {
295 /* We can't check for potential errors because the interpreter
296 * might have been destroyed. */
297 return 1;
298 }
299 else {
300 Parrot_destroy(interp);
301 Parrot_x_exit(interp, 0);
302 /* Never reached, x_exit calls longjmp */
303 return 1;
304 }
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
305 }
306
307 /*
308
b9cdf9c James E Keenan After fixing C++ comments, I re-ran headerizer and modified these files....
jkeenan authored
309 =item C<Parrot_Int Parrot_api_load_bytecode_file(Parrot_PMC interp_pmc, const
310 char *filename, Parrot_PMC * pbc)>
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
311
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
312 Load a bytecode file and stores the resulting bytecode in C<pbc>. This function
313 returns a true value if this call is successful and false value otherwise.
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
314
315 =cut
316
317 */
318
6be2b4a Andrew Whitworth remove the ASSERT_ARGS stuff, and other things that are borking thebuild...
Whiteknight authored
319 /* TODO: This only works with the inital bytecode. After this we should use
320 Parrot_append_bytecode or something similar */
321
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
322 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
323 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
324 Parrot_api_load_bytecode_file(Parrot_PMC interp_pmc,
325 ARGIN(const char *filename), ARGOUT(Parrot_PMC * pbc))
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
326 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
327 ASSERT_ARGS(Parrot_api_load_bytecode_file)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
328 EMBED_API_CALLIN(interp_pmc, interp)
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
329 PackFile * const pf = Parrot_pbc_read(interp, filename, 0);
330 if (!pf)
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
331 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not load packfile");
734d38f Michael H. Hind linelength problem - missing newline added
mikehh authored
332 do_sub_pragmas(interp, pf->cur_cs, PBC_PBC, NULL);
333 *pbc = Parrot_pmc_new(interp, enum_class_UnManagedStruct);
d4e8708 Andrew Whitworth add a failure macro for when an API call fails. Implement a few more fun...
Whiteknight authored
334 VTABLE_set_pointer(interp, *pbc, pf);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
335 EMBED_API_CALLOUT(interp_pmc, interp)
d4e8708 Andrew Whitworth add a failure macro for when an API call fails. Implement a few more fun...
Whiteknight authored
336 }
337
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
338 /*
339
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
340 =item C<Parrot_Int Parrot_api_load_bytecode_bytes(Parrot_PMC interp_pmc, const
341 unsigned char * const pbc, Parrot_Int bytecode_size, Parrot_PMC * pbcpmc)>
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
342
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
343 Unpacks a bytecode from a buffer C<pbc> of a C<bytecode_size> size, and stores
344 the resulting bytecode in C<pbcpmc>. This function returns a true value if this
345 call is successful and false value otherwise.
3653784 Mariano Wahlmann Embed API Documentation round 1
bluescreen10 authored
346
347 =cut
348
349 */
350
d4e8708 Andrew Whitworth add a failure macro for when an API call fails. Implement a few more fun...
Whiteknight authored
351 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
352 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
353 Parrot_api_load_bytecode_bytes(Parrot_PMC interp_pmc,
354 ARGIN(const unsigned char * const pbc), Parrot_Int bytecode_size,
355 ARGOUT(Parrot_PMC * pbcpmc))
46b7a9d Andrew Whitworth upconvert pbc_to_exe to use the new API. it builds, but segfaults buildi...
Whiteknight authored
356 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
357 ASSERT_ARGS(Parrot_api_load_bytecode_bytes)
99428c2 Make src/embed/pmc.c & src/embed/api.c compile with gcc
Mariano Wahlmann authored
358 EMBED_API_CALLIN(interp_pmc, interp)
46b7a9d Andrew Whitworth upconvert pbc_to_exe to use the new API. it builds, but segfaults buildi...
Whiteknight authored
359 PackFile * const pf = PackFile_new(interp, 0);
360 if (!pf)
361 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not create packfile");
362
363 if (!PackFile_unpack(interp, pf, (const opcode_t *)pbc, bytecode_size))
364 Parrot_ex_throw_from_c_args(interp, NULL, 1, "could not unpack packfile");
39626b8 Léo Grange Some fix. do_sub_pragmas is back public for now
Kristaba authored
365 do_sub_pragmas(interp, pf->cur_cs, PBC_PBC, NULL);
46b7a9d Andrew Whitworth upconvert pbc_to_exe to use the new API. it builds, but segfaults buildi...
Whiteknight authored
366 *pbcpmc = Parrot_pmc_new(interp, enum_class_UnManagedStruct);
367 VTABLE_set_pointer(interp, *pbcpmc, pf);
368 EMBED_API_CALLOUT(interp_pmc, interp);
369 }
370
6be2b4a Andrew Whitworth remove the ASSERT_ARGS stuff, and other things that are borking thebuild...
Whiteknight authored
371 /* Load the bytecode into the interpreter, but don't execute it */
372 /* TODO: This only works with the inital bytecode. After this we should use
373 Parrot_append_bytecode or something similar */
374
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
375 /*
376
377 =item C<Parrot_Int Parrot_api_ready_bytecode(Parrot_PMC interp_pmc, Parrot_PMC
378 pbc, Parrot_PMC *main_sub)>
379
380 Prepares the bytecode C<pbc> to be run and stores the entry point subroutine in
381 C<main_sub>. This function returns a true value if this call is successful and
382 false value otherwise.
383
384 =cut
385
386 */
387
709eae7 Andrew Whitworth add in a handful of additional API functions, though they aren't being u...
Whiteknight authored
388 PARROT_API
389 Parrot_Int
390 Parrot_api_ready_bytecode(Parrot_PMC interp_pmc, Parrot_PMC pbc,
391 ARGOUT(Parrot_PMC *main_sub))
392 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
393 ASSERT_ARGS(Parrot_api_ready_bytecode)
709eae7 Andrew Whitworth add in a handful of additional API functions, though they aren't being u...
Whiteknight authored
394 EMBED_API_CALLIN(interp_pmc, interp)
395 PackFile * const pf = (PackFile *)VTABLE_get_pointer(interp, pbc);
396
397 /* Debugging mode nonsense. */
398 if (Interp_debug_TEST(interp, PARROT_START_DEBUG_FLAG)) {
399 Parrot_io_eprintf(interp, "*** Parrot VM: %Ss core ***\n",
400 interp->run_core->name);
401 }
402
403 if (!pf)
404 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not get packfile");
405 if (pf->cur_cs != NULL)
406 Parrot_pbc_load(interp, pf);
407 PackFile_fixup_subs(interp, PBC_MAIN, NULL);
408 *main_sub = Parrot_pcc_get_sub(interp, CURRENT_CONTEXT(interp));
409 Parrot_pcc_set_constants(interp, interp->ctx, interp->code->const_table);
410 EMBED_API_CALLOUT(interp_pmc, interp)
411 }
412
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
413
414 /*
415
416 =item C<Parrot_Int Parrot_api_run_bytecode(Parrot_PMC interp_pmc, Parrot_PMC
417 pbc, Parrot_PMC mainargs)>
418
419 Runs the bytecode C<pbc> passing optional C<mainargs> parameters. This function
420 returns a true value if this call is successful and false value otherwise.
421
422 =cut
423
424 */
425
46b7a9d Andrew Whitworth upconvert pbc_to_exe to use the new API. it builds, but segfaults buildi...
Whiteknight authored
426 PARROT_API
427 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
428 Parrot_api_run_bytecode(Parrot_PMC interp_pmc, Parrot_PMC pbc,
429 Parrot_PMC mainargs)
d4e8708 Andrew Whitworth add a failure macro for when an API call fails. Implement a few more fun...
Whiteknight authored
430 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
431 ASSERT_ARGS(Parrot_api_run_bytecode)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
432 EMBED_API_CALLIN(interp_pmc, interp)
65bf81a Andrew Whitworth actually run the code, don't just look at it. Miniparrot runs now. parro...
Whiteknight authored
433 PMC * main_sub = NULL;
434
98cd26c Andrew Whitworth don't call Parrot_pbc_load if the PBC comes straight out of IMCC. IMCC d...
Whiteknight authored
435 PackFile * const pf = (PackFile *)VTABLE_get_pointer(interp, pbc);
9f7a94c Andrew Whitworth make sure to set :main() args in the iglobals array. This makes ops2c ru...
Whiteknight authored
436
704e3c4 Mariano Wahlmann Made another test case pass by putting debug information. Also removed s...
bluescreen10 authored
437 /* Debugging mode nonsense. */
438 if (Interp_debug_TEST(interp, PARROT_START_DEBUG_FLAG)) {
439 Parrot_io_eprintf(interp, "*** Parrot VM: %Ss core ***\n",
440 interp->run_core->name);
709eae7 Andrew Whitworth add in a handful of additional API functions, though they aren't being u...
Whiteknight authored
441 }
704e3c4 Mariano Wahlmann Made another test case pass by putting debug information. Also removed s...
bluescreen10 authored
442
d4e8708 Andrew Whitworth add a failure macro for when an API call fails. Implement a few more fun...
Whiteknight authored
443 if (!pf)
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
444 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not get packfile");
98cd26c Andrew Whitworth don't call Parrot_pbc_load if the PBC comes straight out of IMCC. IMCC d...
Whiteknight authored
445 if (pf->cur_cs != NULL)
446 Parrot_pbc_load(interp, pf);
d4e8708 Andrew Whitworth add a failure macro for when an API call fails. Implement a few more fun...
Whiteknight authored
447 PackFile_fixup_subs(interp, PBC_MAIN, NULL);
65bf81a Andrew Whitworth actually run the code, don't just look at it. Miniparrot runs now. parro...
Whiteknight authored
448 main_sub = Parrot_pcc_get_sub(interp, CURRENT_CONTEXT(interp));
449
450 /* if no sub was marked being :main, we create a dummy sub with offset 0 */
451
452 if (!main_sub)
453 main_sub = set_current_sub(interp);
454
455 Parrot_pcc_set_sub(interp, CURRENT_CONTEXT(interp), NULL);
456 Parrot_pcc_set_constants(interp, interp->ctx, interp->code->const_table);
457
9f7a94c Andrew Whitworth make sure to set :main() args in the iglobals array. This makes ops2c ru...
Whiteknight authored
458 VTABLE_set_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_ARGV_LIST, mainargs);
73f662d Andrew Whitworth some fixes so libparrot builds with g++
Whiteknight authored
459 Parrot_pcc_invoke_sub_from_c_args(interp, main_sub, "P->", mainargs);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
460 EMBED_API_CALLOUT(interp_pmc, interp)
687438e Andrew Whitworth add in the prototype embedding API functions I've been playing with
Whiteknight authored
461 }
4a128d5 Andrew Whitworth lots of little changes
Whiteknight authored
462
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
463 /*
464
465 =item C<Parrot_Int Parrot_api_disassemble_bytecode(Parrot_PMC interp_pmc,
466 Parrot_PMC pbc, const char * const outfile, Parrot_Int opts)>
467
468 Disassembles and prints out the C<pbc> bytecode. This function returns a true
469 value if this call is successful and false value otherwise.
470
471 =cut
472
473 */
474
d4e8708 Andrew Whitworth add a failure macro for when an API call fails. Implement a few more fun...
Whiteknight authored
475 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
476 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
477 Parrot_api_disassemble_bytecode(Parrot_PMC interp_pmc, Parrot_PMC pbc,
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
478 ARGIN_NULLOK(const char * const outfile), Parrot_Int opts)
590f387 Andrew Whitworth update pbc_disassemble to the new API. Had to add a new API function to ...
Whiteknight authored
479 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
480 ASSERT_ARGS(Parrot_api_disassemble_bytecode)
e9934d7 Made it compile with gcc
Mariano Wahlmann authored
481 EMBED_API_CALLIN(interp_pmc, interp)
590f387 Andrew Whitworth update pbc_disassemble to the new API. Had to add a new API function to ...
Whiteknight authored
482 PackFile * const pf = (PackFile *)VTABLE_get_pointer(interp, pbc);
483 if (!pf)
484 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not get packfile");
485 if (pf->cur_cs != NULL)
486 Parrot_pbc_load(interp, pf);
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
487 /* TODO: Break up the dependency with emebed.c */
590f387 Andrew Whitworth update pbc_disassemble to the new API. Had to add a new API function to ...
Whiteknight authored
488 Parrot_disassemble(interp, outfile, (Parrot_disassemble_options)opts);
489 EMBED_API_CALLOUT(interp_pmc, interp);
490 }
491
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
492 /*
493
494 =item C<Parrot_Int Parrot_api_set_warnings(Parrot_PMC interp_pmc, Parrot_Int
495 flags)>
496
497 Enables C<inter_pmc>'s warning messages the type of warning information to be
498 print out is specified by C<flags>. This function returns a true value if this
499 call is successful and false value otherwise.
500
501 =cut
502
503 */
504
590f387 Andrew Whitworth update pbc_disassemble to the new API. Had to add a new API function to ...
Whiteknight authored
505 PARROT_API
506 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
507 Parrot_api_set_warnings(Parrot_PMC interp_pmc, Parrot_Int flags)
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
508 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
509 ASSERT_ARGS(Parrot_api_set_warnings)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
510 EMBED_API_CALLIN(interp_pmc, interp)
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
511 /* Activates the given warnings. (Macro from warnings.h.) */
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
512 PARROT_WARNINGS_on(interp, flags);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
513 EMBED_API_CALLOUT(interp_pmc, interp)
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
514 }
515
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
516 /*
517
518 =item C<Parrot_Int Parrot_api_set_output_file(Parrot_PMC interp_pmc, const char
519 * filename)>
520
521 Sets the C<interp_pmc>'s output file name specified by C<filename>. This function
522 returns a true value if this call is successful and false value otherwise.
523
524 =cut
525
526 */
527
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
528 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
529 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
530 Parrot_api_set_output_file(Parrot_PMC interp_pmc,
531 ARGIN_NULLOK(const char * filename))
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
532 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
533 ASSERT_ARGS(Parrot_api_set_output_file)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
534 EMBED_API_CALLIN(interp_pmc, interp)
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
535 if (!filename && !interp->output_file)
536 interp->output_file = "-";
537 else
538 interp->output_file = filename;
c1ab56e More fixes, almost there
Mariano Wahlmann authored
539 EMBED_API_CALLOUT(interp_pmc, interp)
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
540 }
541
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
542 /*
543
544 =item C<Parrot_Int Parrot_api_add_library_search_path(Parrot_PMC interp_pmc,
545 const char *path)>
546
547 Adds C<path> to the C<inter_pmc>'s library search path list. This function
548 returns a true value if this call is successful and false value otherwise.
549
550 =cut
551
552 */
553
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
554 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
555 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
556 Parrot_api_add_library_search_path(Parrot_PMC interp_pmc,
557 ARGIN(const char *path))
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
558 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
559 ASSERT_ARGS(Parrot_api_add_library_search_path)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
560 EMBED_API_CALLIN(interp_pmc, interp)
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
561 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_LIBRARY);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
562 EMBED_API_CALLOUT(interp_pmc, interp)
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
563 }
564
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
565 /*
566
567 =item C<Parrot_Int Parrot_api_add_include_search_path(Parrot_PMC interp_pmc,
568 const char *path)>
569
570 Adds C<path> to the C<inter_pmc>'s include search path list. This function
571 returns a true value if this call is successful and false value otherwise.
572
573 =cut
574
575 */
576
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
577 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
578 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
579 Parrot_api_add_include_search_path(Parrot_PMC interp_pmc,
580 ARGIN(const char *path))
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
581 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
582 ASSERT_ARGS(Parrot_api_add_include_search_path)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
583 EMBED_API_CALLIN(interp_pmc, interp)
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
584 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_INCLUDE);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
585 EMBED_API_CALLOUT(interp_pmc, interp)
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
586 }
587
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
588 /*
589
590 =item C<Parrot_Int Parrot_api_add_dynext_search_path(Parrot_PMC interp_pmc,
591 const char *path)>
592
593 Adds C<path> to the C<inter_pmc>'s dynext search path list. This function
594 returns a true value if this call is successful and false value otherwise.
595
596 =cut
597
598 */
599
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
600 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
601 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
602 Parrot_api_add_dynext_search_path(Parrot_PMC interp_pmc,
603 ARGIN(const char *path))
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
604 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
605 ASSERT_ARGS(Parrot_api_add_dynext_search_path)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
606 EMBED_API_CALLIN(interp_pmc, interp)
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
607 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_DYNEXT);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
608 EMBED_API_CALLOUT(interp_pmc, interp)
9d25cd4 Andrew Whitworth change the imcc_run function to return a PackFile PMC so we can use it w...
Whiteknight authored
609 }
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
610
611 /*
612
c7def2f James E Keenan Run 'perl tools/dev/headerizer.pl src/embed/api.o'.
jkeenan authored
613 =item C<Parrot_Int Parrot_api_set_stdhandles(Parrot_PMC interp_pmc, Parrot_Int
614 in, Parrot_Int out, Parrot_Int err)>
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
615
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
616 Set the C<interp_pmc>'s standard file descriptors STDIN, STDOUT, STDERR. Any
617 file descriptor set to C<PIO_INVALID_HANDLE> is ignored. This function returns
618 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
619
620 =cut
621
622 */
f30aa2f David Czech Added some tests for embed api, get/set compiler and commented set_std_h...
kapace authored
623 /* Whiteknight told me that theres no way to test this for now, so it should be
624 commented out, for now.
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
625
626 PARROT_API
e98ef02 Andrew Whitworth lots of fixes. We still don't build completely, but we are much closer t...
Whiteknight authored
627 Parrot_Int
aef7ea1 Fixed stdin,stdout and stderr Andy++ pointed out
Mariano Wahlmann authored
628 Parrot_api_set_stdhandles(Parrot_PMC interp_pmc, Parrot_Int in,
629 Parrot_Int out, Parrot_Int err)
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
630 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
631 ASSERT_ARGS(Parrot_api_set_stdhandles)
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
632 EMBED_API_CALLIN(interp_pmc, interp)
633 void *dummy;
634
1311cec James E Keenan [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
jkeenan authored
635 if (PIO_INVALID_HANDLE != (PIOHANDLE)in) {
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
636 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
aef7ea1 Fixed stdin,stdout and stderr Andy++ pointed out
Mariano Wahlmann authored
637 Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)in);
1311cec James E Keenan [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
jkeenan authored
638 dummy = (void *)Parrot_io_stdhandle(interp, PIO_STDIN_FILENO, pmc);
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
639 }
640
1311cec James E Keenan [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
jkeenan authored
641 if (PIO_INVALID_HANDLE != (PIOHANDLE)out) {
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
642 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
aef7ea1 Fixed stdin,stdout and stderr Andy++ pointed out
Mariano Wahlmann authored
643 Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)out);
1311cec James E Keenan [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
jkeenan authored
644 dummy = (void *)Parrot_io_stdhandle(interp, PIO_STDOUT_FILENO, pmc);
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
645 }
646
1311cec James E Keenan [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
jkeenan authored
647 if (PIO_INVALID_HANDLE != (PIOHANDLE)err) {
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
648 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
aef7ea1 Fixed stdin,stdout and stderr Andy++ pointed out
Mariano Wahlmann authored
649 Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)err);
1311cec James E Keenan [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
jkeenan authored
650 dummy = (void *)Parrot_io_stdhandle(interp, PIO_STDERR_FILENO, pmc);
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
651 }
16e368d Andrew Whitworth fix several build warnings in src/embed/* in gcc, g++, and icc
Whiteknight authored
652 UNUSED(dummy);
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
653
654 EMBED_API_CALLOUT(interp_pmc, interp)
f30aa2f David Czech Added some tests for embed api, get/set compiler and commented set_std_h...
kapace authored
655 }*/
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
656
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
657 /*
658
659 =item C<Parrot_Int Parrot_api_get_runtime_path(Parrot_PMC interp_pmc,
660 Parrot_String *runtime)>
661
662 Stores in C<runtime> the C<interp_pmc>'s running path. This function returns a
663 true value if this call is successful and false value otherwise.
664
665 =cut
666
667 */
668
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
669 PARROT_API
670 Parrot_Int
1216a51 Andrew Whitworth quick initial pass for codestd
Whiteknight authored
671 Parrot_api_get_runtime_path(Parrot_PMC interp_pmc,
672 ARGOUT(Parrot_String *runtime))
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
673 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
674 ASSERT_ARGS(Parrot_api_get_runtime_path)
e9934d7 Made it compile with gcc
Mariano Wahlmann authored
675 EMBED_API_CALLIN(interp_pmc, interp)
f41cf98 Andrew Whitworth many more fixes. We build main.c now but fail in some of the alternate f...
Whiteknight authored
676 *runtime = Parrot_get_runtime_path(interp);
677 EMBED_API_CALLOUT(interp_pmc, interp);
678 }
679
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
680 /*
681
682 =item C<Parrot_Int Parrot_api_set_configuration_hash(Parrot_PMC interp_pmc,
683 Parrot_PMC confighash)>
684
685 Sets the C<interp_pmc>'s configuration hash passed in C<confighash>. This
686 function returns a true value if this call is successful and false value
687 otherwise.
688
689 =cut
690
691 */
692
c4ccd13 Andrew Whitworth first prototype of a new mechanism for setting the configuration hash as...
Whiteknight authored
693 PARROT_API
694 Parrot_Int
695 Parrot_api_set_configuration_hash(Parrot_PMC interp_pmc, Parrot_PMC confighash)
696 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
697 ASSERT_ARGS(Parrot_api_set_configuration_hash)
e9934d7 Made it compile with gcc
Mariano Wahlmann authored
698 EMBED_API_CALLIN(interp_pmc, interp)
c4ccd13 Andrew Whitworth first prototype of a new mechanism for setting the configuration hash as...
Whiteknight authored
699 Parrot_set_config_hash_pmc(interp, confighash);
5c2c3d4 Andrew Whitworth fix library paths. The build now progresses through all the parts that r...
Whiteknight authored
700 Parrot_lib_update_paths_from_config_hash(interp);
c4ccd13 Andrew Whitworth first prototype of a new mechanism for setting the configuration hash as...
Whiteknight authored
701 EMBED_API_CALLOUT(interp_pmc, interp);
702 }
703
e1ced3e Andrew Whitworth add a note explaining this stupid function
Whiteknight authored
704 /*
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
705
903db1c Nick Wellnhofer [imcc] Switch to PIO and STRING filenames for all input files
nwellnhof authored
706 =item C<Parrot_Int Parrot_api_wrap_imcc_hack(Parrot_PMC interp_pmc,
707 Parrot_String sourcefile, int argc, const char **argv, Parrot_PMC* bytecodepmc,
708 int *result, imcc_hack_func_t func)>
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
709
710 WARNING: This is an evil hack to provide a wrapper around IMCC to catch unhandled
711 exceptions without having to assume IMCC is linked in with libparrot. Delete this
712 as soon as we don't need it anymore.
713
714 This function returns a true value if this call is successful and false value
715 otherwise.
716
717 =cut
718
e1ced3e Andrew Whitworth add a note explaining this stupid function
Whiteknight authored
719 */
720
5b6a239 Andrew Whitworth Add a new, temporary hack API for wrapping up IMCC so we can catch error...
Whiteknight authored
721 PARROT_API
722 Parrot_Int
903db1c Nick Wellnhofer [imcc] Switch to PIO and STRING filenames for all input files
nwellnhof authored
723 Parrot_api_wrap_imcc_hack(Parrot_PMC interp_pmc, ARGIN(Parrot_String sourcefile),
eaf402c Nick Wellnhofer Fix headerizer warnings
nwellnhof authored
724 int argc, ARGIN(const char **argv), ARGMOD(Parrot_PMC* bytecodepmc),
725 ARGOUT(int *result), imcc_hack_func_t func)
5b6a239 Andrew Whitworth Add a new, temporary hack API for wrapping up IMCC so we can catch error...
Whiteknight authored
726 {
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
727 ASSERT_ARGS(Parrot_api_wrap_imcc_hack)
5b6a239 Andrew Whitworth Add a new, temporary hack API for wrapping up IMCC so we can catch error...
Whiteknight authored
728 EMBED_API_CALLIN(interp_pmc, interp)
729 *result = func(interp_pmc, sourcefile, argc, argv, bytecodepmc);
730 EMBED_API_CALLOUT(interp_pmc, interp)
731 }
c4ccd13 Andrew Whitworth first prototype of a new mechanism for setting the configuration hash as...
Whiteknight authored
732
7db7331 James E Keenan Correct C-comment syntax error.
jkeenan authored
733 /*
734
f0bd1e1 First cut of load_language, set_compiler, get compiler
Mariano Wahlmann authored
735 =item C<Parrot_Int Parrot_api_load_language(Parrot_PMC interp_pmc, Parrot_String
d74cf45 Andrew Whitworth fix build warnings in src/embed/api.c
Whiteknight authored
736 lang)>
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
737
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
738 Loads the HLL compiler libraries for C<lang> into the C<interp_pmc>. This
739 function returns a true value if this call is successful and false value
740 otherwise.
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
741
742 =cut
743
744 */
745
746 PARROT_API
747 Parrot_Int
d74cf45 Andrew Whitworth fix build warnings in src/embed/api.c
Whiteknight authored
748 Parrot_api_load_language(Parrot_PMC interp_pmc, Parrot_String lang)
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
749 {
750 ASSERT_ARGS(Parrot_api_load_language)
751 EMBED_API_CALLIN(interp_pmc, interp)
d74cf45 Andrew Whitworth fix build warnings in src/embed/api.c
Whiteknight authored
752 Parrot_load_language(interp, lang);
753 EMBED_API_CALLOUT(interp_pmc, interp);
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
754 }
755
756 /*
757
f0bd1e1 First cut of load_language, set_compiler, get compiler
Mariano Wahlmann authored
758 =item C<Parrot_Int Parrot_api_get_compiler(Parrot_PMC interp_pmc, Parrot_String
d74cf45 Andrew Whitworth fix build warnings in src/embed/api.c
Whiteknight authored
759 type, Parrot_PMC *compiler)>
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
760
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
761 Gets the compiler PMC and stores it in C<compiler>. This function returns a true
762 value if this call is successful and false value otherwise.
763
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
764 =cut
765
766 */
767
768 PARROT_API
769 Parrot_Int
d74cf45 Andrew Whitworth fix build warnings in src/embed/api.c
Whiteknight authored
770 Parrot_api_get_compiler(Parrot_PMC interp_pmc, Parrot_String type,
771 ARGOUT(Parrot_PMC *compiler))
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
772 {
773 ASSERT_ARGS(Parrot_api_get_compiler)
774 EMBED_API_CALLIN(interp_pmc, interp)
d74cf45 Andrew Whitworth fix build warnings in src/embed/api.c
Whiteknight authored
775 *compiler = Parrot_get_compiler(interp, type);
776 EMBED_API_CALLOUT(interp_pmc, interp);
f0bd1e1 First cut of load_language, set_compiler, get compiler
Mariano Wahlmann authored
777 }
778
779 /*
780
781 =item C<Parrot_Int Parrot_api_set_compiler(Parrot_PMC interp_pmc, Parrot_String
d74cf45 Andrew Whitworth fix build warnings in src/embed/api.c
Whiteknight authored
782 type, Parrot_PMC compiler)>
f0bd1e1 First cut of load_language, set_compiler, get compiler
Mariano Wahlmann authored
783
cc0610a Mariano Wahlmann Fixed codigstd tests
bluescreen10 authored
784 Sets the C<compiler> object for the C<type> files. This function returns a true
785 value if this call is successful and false value otherwise.
786
f0bd1e1 First cut of load_language, set_compiler, get compiler
Mariano Wahlmann authored
787 =cut
788
789 */
790
791 PARROT_API
792 Parrot_Int
d74cf45 Andrew Whitworth fix build warnings in src/embed/api.c
Whiteknight authored
793 Parrot_api_set_compiler(Parrot_PMC interp_pmc, Parrot_String type,
794 Parrot_PMC compiler)
f0bd1e1 First cut of load_language, set_compiler, get compiler
Mariano Wahlmann authored
795 {
796 ASSERT_ARGS(Parrot_api_set_compiler)
797 EMBED_API_CALLIN(interp_pmc, interp)
d74cf45 Andrew Whitworth fix build warnings in src/embed/api.c
Whiteknight authored
798 Parrot_set_compiler(interp, type, compiler);
799 EMBED_API_CALLOUT(interp_pmc, interp);
3562b6b Unfished work implemented API functions
Mariano Wahlmann authored
800 }
0814f94 Merged changes with branch
Mariano Wahlmann authored
801
6f90f7d Nolan Lum Add API functions to get a class from an array, and to instantiate a PMC...
nol888 authored
802
0814f94 Merged changes with branch
Mariano Wahlmann authored
803 /*
804
1311cec James E Keenan [codingstd] Fix files so they pass c_operator, c_parens, pod_syntax, and
jkeenan authored
805 =back
806
9703ef5 James E Keenan [codingstd] C-style coda needed. No cuddled elses.
jkeenan authored
807 =cut
0814f94 Merged changes with branch
Mariano Wahlmann authored
808
7db7331 James E Keenan Correct C-comment syntax error.
jkeenan authored
809 */
9703ef5 James E Keenan [codingstd] C-style coda needed. No cuddled elses.
jkeenan authored
810
540a832 James E Keenan [codingstd] Mostly linelength fixes.
jkeenan authored
811 /*
812 * Local variables:
813 * c-file-style: "parrot"
814 * End:
815 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
816 */
0814f94 Merged changes with branch
Mariano Wahlmann authored
817
Something went wrong with that request. Please try again.