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