Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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