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