Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 351 lines (306 sloc) 11.664 kB
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
1 #include "parrot/parrot.h"
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
2 #include "parrot/embed.h"
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
3 #include "parrot/api.h"
1b6d1ce @Whiteknight start breaking up the embedding stuff into multiple files. Add embed_…
Whiteknight authored
4 #include "embed_private.h"
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
5
3f8ed92 @Whiteknight fix some file references and run headerizer to see my work so far
Whiteknight authored
6 /* HEADERIZER HFILE: include/parrot/api.h */
7
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
8 PARROT_API
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
9 Parrot_Int
82cbd84 @Whiteknight parrot executable compiles, but miniparrot does not link. I need to s…
Whiteknight authored
10 Parrot_api_get_last_error(ARGMOD(PMC * interp_pmc), ARGOUT(Parrot_String * errmsg))
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
11 {
12 EMBED_API_CALLIN(interp_pmc, interp);
36fca15 @Whiteknight Finally add in the rudiments of my error reporting mechanism. There i…
Whiteknight authored
13 *errmsg = interp->final_error;
14 interp->final_error = NULL;
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
15 EMBED_API_CALLOUT(interp_pmc, interp);
16 }
17
18 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
19 Parrot_Int
20 Parrot_api_make_interpreter(ARGIN_NULLOK(PMC *parent), Parrot_Int flags, ARGIN_NULLOK(Parrot_Init_Args *args), ARGOUT(PMC **interp))
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
21 {
f2252b4 @Whiteknight remove the two-stage initialization dance. We can now initialize an i…
Whiteknight authored
22 ASSERT_ARGS(Parrot_api_make_interpreter)
4a128d5 @Whiteknight lots of little changes
Whiteknight authored
23 int alt_stacktop;
c1ab56e More fixes, almost there
Mariano Wahlmann authored
24 Parrot_Interp interp_raw;
f2252b4 @Whiteknight remove the two-stage initialization dance. We can now initialize an i…
Whiteknight authored
25 void *stacktop_ptr = &alt_stacktop;
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
26 PMC * iglobals;
82cbd84 @Whiteknight parrot executable compiles, but miniparrot does not link. I need to s…
Whiteknight authored
27 const Parrot_Interp parent_raw = PMC_IS_NULL(parent) ? NULL : GET_RAW_INTERP(parent);
28 interp_raw = allocate_interpreter(parent_raw, flags);
29 if (args) {
30 if (args->stacktop)
31 stacktop_ptr = args->stacktop;
32 if (args->gc_system)
33 Parrot_gc_set_system_type(interp_raw, args->gc_system);
34 if (args->gc_threshold)
35 interp_raw->gc_threshold = args->gc_threshold;
36 if (args->hash_seed)
37 interp_raw->hash_seed = args->hash_seed;
f2252b4 @Whiteknight remove the two-stage initialization dance. We can now initialize an i…
Whiteknight authored
38 }
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
39 initialize_interpreter(interp_raw, stacktop_ptr);
40 iglobals = interp_raw->iglobals;
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
41 *interp = VTABLE_get_pmc_keyed_int(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
42 return !PMC_IS_NULL(*interp);
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
43 }
44
45 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
46 Parrot_Int
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
47 Parrot_api_set_runcore(ARGIN(PMC *interp_pmc), const char * corename, Parrot_UInt trace)
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
48 {
49 ASSERT_ARGS(Parrot_api_set_runcore)
3ea891c First round of syntax error fixes
Mariano Wahlmann authored
50 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
51 if (trace) {
52 Parrot_set_trace(interp, (Parrot_trace_flags)trace);
950d701 @Whiteknight Packfile PMCs don't do what I need them to do (yet). Use UnManagedStr…
Whiteknight authored
53 Parrot_set_run_core(interp, PARROT_SLOW_CORE);
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
54 } else {
55 Parrot_Run_core_t core = PARROT_SLOW_CORE;
56 if (!strcmp(corename, "slow"))
57 core = PARROT_SLOW_CORE;
58 else if (!strcmp(corename, "fast") || !strcmp(corename, "jit") || !strcmp(corename, "function"))
59 core = PARROT_FAST_CORE;
60 else if (!strcmp(corename, "exec"))
61 core = PARROT_EXEC_CORE;
62 else if (!strcmp(corename, "trace"))
63 core = PARROT_SLOW_CORE; // !!!
64 else if (!strcmp(corename, "profiling"))
65 core = PARROT_PROFILING_CORE;
66 else if (!strcmp(corename, "gcdebug"))
67 core = PARROT_GC_DEBUG_CORE;
68 else
69 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Invalid runcore type %s", corename);
70 Parrot_set_trace(interp, (Parrot_trace_flags)trace);
71 Parrot_set_run_core(interp, core);
72 }
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
73 EMBED_API_CALLOUT(interp_pmc, interp)
74 }
75
76 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
77 Parrot_Int
78 Parrot_api_debug_flag(ARGMOD(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
79 {
80 ASSERT_ARGS(Parrot_api_debug_flag)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
81 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
82 if (set)
83 interp->debug_flags |= flags;
84 else
85 interp->debug_flags &= ~flags;
86 EMBED_API_CALLOUT(interp_pmc, interp);
87 }
88
89 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
90 Parrot_Int
91 Parrot_api_flag(ARGMOD(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
92 {
93 ASSERT_ARGS(Parrot_api_flag)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
94 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
95 if (set) {
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
96 Interp_flags_SET(interp, flags);
97 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
98 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
99 }
100 else
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
101 Interp_flags_CLEAR(interp, flags);
f68bf56 @Whiteknight add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
Whiteknight authored
102 EMBED_API_CALLOUT(interp_pmc, interp);
103 }
104
105 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
106 Parrot_Int
f68bf56 @Whiteknight add Parrot_api_flag and Parrot_api_debug_flag. Use these in main.c in…
Whiteknight authored
107 Parrot_api_set_executable_name(ARGMOD(PMC *interp_pmc), ARGIN(const char * name))
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
108 {
109 ASSERT_ARGS(Parrot_api_set_executable_name)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
110 EMBED_API_CALLIN(interp_pmc, interp)
1a692e9 @Whiteknight _set_executable_name takes a C string instead of a Parrot string, for…
Whiteknight authored
111 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
112 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
113 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
114 VTABLE_set_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_EXECUTABLE,
115 name_pmc);
4a128d5 @Whiteknight lots of little changes
Whiteknight authored
116 EMBED_API_CALLOUT(interp_pmc, interp);
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
117 }
118
119 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
120 Parrot_Int
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
121 Parrot_api_destroy_interpreter(ARGIN(PMC *interp_pmc))
122 {
123 ASSERT_ARGS(Parrot_api_destroy_interpreter)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
124 EMBED_API_CALLIN(interp_pmc, interp)
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
125 Parrot_destroy(interp);
1a692e9 @Whiteknight _set_executable_name takes a C string instead of a Parrot string, for…
Whiteknight authored
126 Parrot_exit(interp, 0);
4a128d5 @Whiteknight lots of little changes
Whiteknight authored
127 EMBED_API_CALLOUT(interp_pmc, interp);
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
128 }
129
130 /*
131
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
132 =item C<PARROT_API Parrot_Int Parrot_api_load_bytecode_file(PMC *interp_pmc,
133 const char *filename, PMC **pbc)>
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
134
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
135 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
136
137 =cut
138
139 */
140
141 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
142 Parrot_Int
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
143 Parrot_api_load_bytecode_file(ARGMOD(PMC *interp_pmc), ARGIN(const char *filename), ARGOUT(PMC **pbc))
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
144 {
145 ASSERT_ARGS(Parrot_api_load_bytecode_file)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
146 EMBED_API_CALLIN(interp_pmc, interp)
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
147 PackFile * const pf = Parrot_pbc_read(interp, filename, 0);
148 if (!pf)
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
149 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
150 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
151 *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
152 VTABLE_set_pointer(interp, *pbc, pf);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
153 EMBED_API_CALLOUT(interp_pmc, interp)
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
154 }
155
156 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
157 Parrot_Int
46b7a9d @Whiteknight upconvert pbc_to_exe to use the new API. it builds, but segfaults bui…
Whiteknight authored
158 Parrot_api_load_bytecode_bytes(ARGMOD(PMC *interp_pmc), ARGIN(const unsigned char * const pbc), Parrot_Int bytecode_size, ARGOUT(PMC **pbcpmc))
159 {
160 EMBED_API_CALLIN(interp_pmc, interp);
161 PackFile * const pf = PackFile_new(interp, 0);
162 if (!pf)
163 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not create packfile");
164
165 if (!PackFile_unpack(interp, pf, (const opcode_t *)pbc, bytecode_size))
166 Parrot_ex_throw_from_c_args(interp, NULL, 1, "could not unpack packfile");
167 do_sub_pragmas(interp, pf->cur_cs, PBC_PBC, NULL);
168 *pbcpmc = Parrot_pmc_new(interp, enum_class_UnManagedStruct);
169 VTABLE_set_pointer(interp, *pbcpmc, pf);
170 EMBED_API_CALLOUT(interp_pmc, interp);
171 }
172
173 PARROT_API
174 Parrot_Int
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
175 Parrot_api_run_bytecode(ARGMOD(PMC *interp_pmc), ARGIN(PMC *pbc), ARGIN(PMC *mainargs))
176 {
177 ASSERT_ARGS(Parrot_api_run_bytecode)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
178 EMBED_API_CALLIN(interp_pmc, interp)
65bf81a @Whiteknight actually run the code, don't just look at it. Miniparrot runs now. pa…
Whiteknight authored
179 PMC * main_sub = NULL;
180
98cd26c @Whiteknight don't call Parrot_pbc_load if the PBC comes straight out of IMCC. IMC…
Whiteknight authored
181 PackFile * const pf = (PackFile *)VTABLE_get_pointer(interp, pbc);
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
182 if (!pf)
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
183 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
184 if (pf->cur_cs != NULL)
185 Parrot_pbc_load(interp, pf);
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
186 PackFile_fixup_subs(interp, PBC_IMMEDIATE, NULL);
187 PackFile_fixup_subs(interp, PBC_POSTCOMP, NULL);
188 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
189 main_sub = Parrot_pcc_get_sub(interp, CURRENT_CONTEXT(interp));
190
191 /* if no sub was marked being :main, we create a dummy sub with offset 0 */
192
193 if (!main_sub)
194 main_sub = set_current_sub(interp);
195
196 Parrot_pcc_set_sub(interp, CURRENT_CONTEXT(interp), NULL);
197 Parrot_pcc_set_constants(interp, interp->ctx, interp->code->const_table);
198
199 Parrot_ext_call(interp, main_sub, "P->", mainargs);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
200 EMBED_API_CALLOUT(interp_pmc, interp)
687438e @Whiteknight add in the prototype embedding API functions I've been playing with
Whiteknight authored
201 }
4a128d5 @Whiteknight lots of little changes
Whiteknight authored
202
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
203 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
204 Parrot_Int
590f387 @Whiteknight update pbc_disassemble to the new API. Had to add a new API function …
Whiteknight authored
205 Parrot_api_disassemble_bytecode(ARGMOD(PMC *interp_pmc), ARGIN(PMC *pbc), ARGIN(const char * const outfile), Parrot_Int opts)
206 {
207 EMBED_API_CALLIN(interp_pmc, interp);
208 PackFile * const pf = (PackFile *)VTABLE_get_pointer(interp, pbc);
209 if (!pf)
210 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Could not get packfile");
211 if (pf->cur_cs != NULL)
212 Parrot_pbc_load(interp, pf);
213 Parrot_disassemble(interp, outfile, (Parrot_disassemble_options)opts);
214 EMBED_API_CALLOUT(interp_pmc, interp);
215 }
216
217 PARROT_API
218 Parrot_Int
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
219 Parrot_api_build_argv_array(ARGMOD(PMC *interp_pmc), Parrot_Int argc, ARGIN(char **argv), ARGOUT(PMC **args))
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
220 {
221 ASSERT_ARGS(Parrot_api_build_argv_array)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
222 EMBED_API_CALLIN(interp_pmc, interp)
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
223 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
224 Parrot_Int i;
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
225
226 for (i = 0; i < argc; ++i) {
227 /* Run through argv, adding everything to the array */
228 STRING * const arg = Parrot_str_new_init(interp, argv[i], strlen(argv[i]),
229 Parrot_utf8_encoding_ptr, PObj_external_FLAG);
230 VTABLE_push_string(interp, userargv, arg);
231 }
232 *args = userargv;
c1ab56e More fixes, almost there
Mariano Wahlmann authored
233 EMBED_API_CALLOUT(interp_pmc, interp)
d4e8708 @Whiteknight add a failure macro for when an API call fails. Implement a few more …
Whiteknight authored
234 }
9d25cd4 @Whiteknight change the imcc_run function to return a PackFile PMC so we can use i…
Whiteknight authored
235
236 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
237 Parrot_Int
238 Parrot_api_set_warnings(ARGMOD(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
239 {
240 ASSERT_ARGS(Parrot_api_set_warnings)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
241 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
242 /* 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
243 PARROT_WARNINGS_on(interp, flags);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
244 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
245 }
246
247 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
248 Parrot_Int
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
249 Parrot_api_set_output_file(ARGMOD(PMC *interp_pmc), ARGIN_NULLOK(const char * filename))
9d25cd4 @Whiteknight change the imcc_run function to return a PackFile PMC so we can use i…
Whiteknight authored
250 {
251 ASSERT_ARGS(Parrot_api_set_output_file)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
252 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
253 if (!filename && !interp->output_file)
254 interp->output_file = "-";
255 else
256 interp->output_file = filename;
c1ab56e More fixes, almost there
Mariano Wahlmann authored
257 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
258 }
259
260 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
261 Parrot_Int
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
262 Parrot_api_add_library_search_path(ARGMOD(PMC *interp_pmc), ARGIN(const char *path))
9d25cd4 @Whiteknight change the imcc_run function to return a PackFile PMC so we can use i…
Whiteknight authored
263 {
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
264 //ASSERT_ARGS(Parrot_api_add_library_search_path)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
265 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
266 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_LIBRARY);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
267 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
268 }
269
270 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
271 Parrot_Int
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
272 Parrot_api_add_include_search_path(ARGMOD(PMC *interp_pmc), ARGIN(const char *path))
9d25cd4 @Whiteknight change the imcc_run function to return a PackFile PMC so we can use i…
Whiteknight authored
273 {
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
274 //ASSERT_ARGS(Parrot_api_add_include_search_path)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
275 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
276 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_INCLUDE);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
277 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
278 }
279
280 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
281 Parrot_Int
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
282 Parrot_api_add_dynext_search_path(ARGMOD(PMC *interp_pmc), ARGIN(const char *path))
9d25cd4 @Whiteknight change the imcc_run function to return a PackFile PMC so we can use i…
Whiteknight authored
283 {
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
284 //ASSERT_ARGS(Parrot_api_add_dynext_search_path)
c1ab56e More fixes, almost there
Mariano Wahlmann authored
285 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
286 Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_DYNEXT);
c1ab56e More fixes, almost there
Mariano Wahlmann authored
287 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
288 }
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
289
290 /*
291
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
292 =item C<PARROT_API Parrot_Int Parrot_api_set_stdhandles(PMC *interp_pmc,
293 Parrot_Int stdin, Parrot_Int stdout, Parrot_Int stderr)>
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
294
295 Set the std file descriptors for the embedded interpreter. Any file descriptor
296 passed as argument and set to C<PIO_INVALID_HANDLE> is ignored.
297
298 =cut
299
300 */
301
302 PARROT_API
e98ef02 @Whiteknight lots of fixes. We still don't build completely, but we are much close…
Whiteknight authored
303 Parrot_Int
304 Parrot_api_set_stdhandles(ARGIN(PMC *interp_pmc), Parrot_Int stdin, Parrot_Int stdout, Parrot_Int stderr)
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
305 {
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
306 ASSERT_ARGS(Parrot_api_set_stdhandles)
307 EMBED_API_CALLIN(interp_pmc, interp)
308 void *dummy;
309
310 if(PIO_INVALID_HANDLE != (PIOHANDLE)stdin) {
311 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
312 Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)stdin);
313 dummy = (void *)Parrot_io_stdhandle(interp,PIO_STDIN_FILENO,pmc);
314 }
315
316 if(PIO_INVALID_HANDLE != (PIOHANDLE)stdout) {
317 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
318 Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)stdout);
319 dummy = (void *)Parrot_io_stdhandle(interp,PIO_STDOUT_FILENO,pmc);
320 }
321
322 if(PIO_INVALID_HANDLE != (PIOHANDLE)stderr) {
323 PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
324 Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)stderr);
325 dummy = (void *)Parrot_io_stdhandle(interp,PIO_STDERR_FILENO,pmc);
326 }
327
328 EMBED_API_CALLOUT(interp_pmc, interp)
3259cda First cut of Parrot_api_set_stdhandles API function
Mariano Wahlmann authored
329 }
f41cf98 @Whiteknight many more fixes. We build main.c now but fail in some of the alternat…
Whiteknight authored
330
331 PARROT_API
332 Parrot_Int
333 Parrot_api_get_runtime_path(Parrot_PMC interp_pmc, ARGOUT(Parrot_String *runtime))
334 {
335 EMBED_API_CALLIN(interp_pmc, interp);
336 *runtime = Parrot_get_runtime_path(interp);
337 EMBED_API_CALLOUT(interp_pmc, interp);
338 }
339
c4ccd13 @Whiteknight first prototype of a new mechanism for setting the configuration hash…
Whiteknight authored
340 PARROT_API
341 Parrot_Int
342 Parrot_api_set_configuration_hash(Parrot_PMC interp_pmc, Parrot_PMC confighash)
343 {
344 EMBED_API_CALLIN(interp_pmc, interp);
345 Parrot_set_config_hash_pmc(interp, confighash);
5c2c3d4 @Whiteknight fix library paths. The build now progresses through all the parts tha…
Whiteknight authored
346 Parrot_lib_update_paths_from_config_hash(interp);
c4ccd13 @Whiteknight first prototype of a new mechanism for setting the configuration hash…
Whiteknight authored
347 EMBED_API_CALLOUT(interp_pmc, interp);
348 }
349
350
Something went wrong with that request. Please try again.