Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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