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