1 /* api.h
2  *  Copyright (C) 2001-2012, Parrot Foundation.
3  *  Overview:
4  *     Parrot's external embedding API. This functionality is only to be used
5  *     by embedding applications, and only this functionality may be used by
6  *     them.
7  */
8 
9 #ifndef PARROT_API_H_GUARD
10 #define PARROT_API_H_GUARD
11 
12 #include <stdlib.h>
13 #include <wchar.h>
14 #include "parrot/compiler.h"
15 #include "parrot/config.h"
16 #include "parrot/core_types.h"
17 
18 typedef Parrot_PMC (*imcc_hack_func_t)(Parrot_PMC, Parrot_String, int, const char **);
19 
20 PARROT_EXPORT
21 PARROT_WARN_UNUSED_RESULT
22 PARROT_CONST_FUNCTION
23 const unsigned char * get_program_code(void);
24 
25 PARROT_EXPORT
26 PARROT_WARN_UNUSED_RESULT
27 PARROT_CONST_FUNCTION
28 size_t get_program_code_size(void);
29 
30 /* Forward declaration of Parrot_confess. We can't include exceptions.h yet */
31 PARROT_EXPORT
32 PARROT_DOES_NOT_RETURN
33 PARROT_COLD
34 void
35 Parrot_confess(ARGIN(const char *cond), ARGIN(const char *file), unsigned int line);
36 
37 #define PARROT_API PARROT_EXPORT
38 
39 /* having a modified version of PARROT_ASSERT which resolves as an integer
40  * rvalue lets us put ASSERT_ARGS() at the top of the list of local variables.
41  * Thus, we can catch bad pointers before any of the local initialization
42  * logic is run.  And it always returns 0, so headerizer can chain them in
43  * ASSERT_ARGS_* macros like:
44  * int _ASSERT_ARGS = PARROT_ASSERT_ARG(a) || PARROT_ASSERT_ARG(b) || ...
45  */
46 #ifdef NDEBUG
47 #  define PARROT_ASSERT(x) /*@-noeffect@*/((void)0)/*@=noeffect@*/
48 #  define PARROT_ASSERT_ARG(x) (0)
49 #  define PARROT_FAILURE(x) /*@-noeffect@*/((void)0)/*@=noeffect@*/
50 #  define PARROT_ASSERT_MSG(x, s) /*@-noeffect@*/((void)0)/*@=noeffect@*/
51 #  define ASSERT_ARGS(a)
52 #else
53 #  define PARROT_ASSERTS_ON 1
54 #  define PARROT_ASSERT(x) (x) ? ((void)0) : Parrot_confess(#x, __FILE__, __LINE__)
55 #  define PARROT_ASSERT_ARG(x) ((x) ? (0) : (Parrot_confess(#x, __FILE__, __LINE__), 0))
56 #  define PARROT_FAILURE(x) Parrot_confess((x), __FILE__, __LINE__)
57 #  define PARROT_ASSERT_MSG(x, s) ((x) ? (0) : (Parrot_confess(s, __FILE__, __LINE__), 0))
58 
59 #  ifdef __GNUC__
60 #    define ASSERT_ARGS(a) ASSERT_ARGS_ ## a ;
61 #  else
62 #    define ASSERT_ARGS(a)
63 #  endif /* __GNUC__ */
64 
65 #endif /* NDEBUG */
66 
67 /* Static assertions are checked at compile type */
68 #define PARROT_STATIC_ASSERT_HELPER(COND, MSG)  typedef char static_assertion_##MSG[(!!(COND))*2-1]
69 #define PARROT_STATIC_ASSERT3(X, L)             PARROT_STATIC_ASSERT_HELPER(X, at_line_##L)
70 #define PARROT_STATIC_ASSERT2(X, L)             PARROT_STATIC_ASSERT3(X, L)
71 #define PARROT_STATIC_ASSERT(X)                 PARROT_STATIC_ASSERT2((X), __LINE__)
72 
73 typedef struct _Parrot_Init_Args {
74     void *stacktop;
75     const char *gc_system;
76     Parrot_Float4 gc_nursery_size;
77     Parrot_Int gc_dynamic_threshold;
78     Parrot_Int gc_min_threshold;
79     Parrot_UInt hash_seed;
80     Parrot_UInt numthreads;
81     Parrot_UInt debug_flags;
82 } Parrot_Init_Args;
83 
84 #define GET_INIT_STRUCT(i) do {\
85         void * __stacktop = NULL; \
86         (i) = (Parrot_Init_Args*)calloc(1, sizeof (Parrot_Init_Args)); \
87         (i)->stacktop = &__stacktop; \
88     } while (0)
89 
90 /* HEADERIZER BEGIN: src/embed/api.c */
91 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
92 
93 PARROT_API
94 Parrot_Int Parrot_api_add_dynext_search_path(
95     Parrot_PMC interp_pmc,
96     ARGIN(const char *path))
97         __attribute__nonnull__(2);
98 
99 PARROT_API
100 Parrot_Int Parrot_api_add_include_search_path(
101     Parrot_PMC interp_pmc,
102     ARGIN(const char *path))
103         __attribute__nonnull__(2);
104 
105 PARROT_API
106 Parrot_Int Parrot_api_add_library_search_path(
107     Parrot_PMC interp_pmc,
108     ARGIN(const char *path))
109         __attribute__nonnull__(2);
110 
111 PARROT_API
112 Parrot_Int Parrot_api_debug_flag(
113     Parrot_PMC interp_pmc,
114     Parrot_Int flags,
115     Parrot_Int set);
116 
117 PARROT_API
118 Parrot_Int Parrot_api_destroy_interpreter(Parrot_PMC interp_pmc);
119 
120 PARROT_API
121 Parrot_Int Parrot_api_flag(
122     Parrot_PMC interp_pmc,
123     Parrot_Int flags,
124     Parrot_Int set);
125 
126 PARROT_API
127 Parrot_Int Parrot_api_get_compiler(
128     Parrot_PMC interp_pmc,
129     ARGIN(Parrot_String type),
130     ARGOUT(Parrot_PMC *compiler))
131         __attribute__nonnull__(2)
132         __attribute__nonnull__(3)
133         FUNC_MODIFIES(*compiler);
134 
135 PARROT_API
136 Parrot_Int Parrot_api_get_exception_backtrace(
137     Parrot_PMC interp_pmc,
138     Parrot_PMC exception,
139     ARGOUT(Parrot_String *bt))
140         __attribute__nonnull__(3)
141         FUNC_MODIFIES(*bt);
142 
143 PARROT_API
144 Parrot_Int Parrot_api_get_result(
145     Parrot_PMC interp_pmc,
146     ARGOUT(Parrot_Int *is_error),
147     ARGOUT(Parrot_PMC *exception),
148     ARGOUT(Parrot_Int *exit_code),
149     ARGOUT(Parrot_String *errmsg))
150         __attribute__nonnull__(2)
151         __attribute__nonnull__(3)
152         __attribute__nonnull__(4)
153         __attribute__nonnull__(5)
154         FUNC_MODIFIES(*is_error)
155         FUNC_MODIFIES(*exception)
156         FUNC_MODIFIES(*exit_code)
157         FUNC_MODIFIES(*errmsg);
158 
159 PARROT_API
160 Parrot_Int Parrot_api_get_runtime_path(
161     Parrot_PMC interp_pmc,
162     ARGOUT(Parrot_String *runtime))
163         __attribute__nonnull__(2)
164         FUNC_MODIFIES(*runtime);
165 
166 PARROT_API
167 Parrot_Int Parrot_api_load_language(
168     Parrot_PMC interp_pmc,
169     ARGIN(Parrot_String lang))
170         __attribute__nonnull__(2);
171 
172 PARROT_API
173 Parrot_Int Parrot_api_make_interpreter(
174     Parrot_PMC parent,
175     Parrot_Int flags,
176     ARGIN_NULLOK(Parrot_Init_Args *args),
177     ARGOUT(Parrot_PMC *interp))
178         __attribute__nonnull__(4)
179         FUNC_MODIFIES(*interp);
180 
181 PARROT_API
182 Parrot_Int Parrot_api_reset_call_signature(
183     Parrot_PMC interp_pmc,
184     ARGMOD(Parrot_PMC ctx))
185         __attribute__nonnull__(2)
186         FUNC_MODIFIES(ctx);
187 
188 PARROT_API
189 Parrot_Int Parrot_api_set_compiler(
190     Parrot_PMC interp_pmc,
191     ARGIN(Parrot_String type),
192     ARGIN(Parrot_PMC compiler))
193         __attribute__nonnull__(2)
194         __attribute__nonnull__(3);
195 
196 PARROT_API
197 Parrot_Int Parrot_api_set_configuration_hash(
198     Parrot_PMC interp_pmc,
199     Parrot_PMC confighash);
200 
201 PARROT_API
202 Parrot_Int Parrot_api_set_executable_name(
203     Parrot_PMC interp_pmc,
204     ARGIN(const char *name))
205         __attribute__nonnull__(2);
206 
207 PARROT_API
208 Parrot_Int Parrot_api_set_runcore(
209     Parrot_PMC interp_pmc,
210     ARGIN(const char * corename),
211     Parrot_UInt trace)
212         __attribute__nonnull__(2);
213 
214 PARROT_API
215 Parrot_Int Parrot_api_set_stdhandle(
216     Parrot_PMC interp_pmc,
217     Parrot_PMC handle,
218     Parrot_Int fileno,
219     ARGOUT(Parrot_PMC *old_handle))
220         __attribute__nonnull__(4)
221         FUNC_MODIFIES(*old_handle);
222 
223 PARROT_API
224 Parrot_Int Parrot_api_set_warnings(Parrot_PMC interp_pmc, Parrot_Int flags);
225 
226 PARROT_API
227 Parrot_Int Parrot_api_toggle_gc(Parrot_PMC interp_pmc, Parrot_Int on);
228 
229 PARROT_API
230 Parrot_Int Parrot_api_unwrap_pointer(
231     Parrot_PMC interp_pmc,
232     Parrot_PMC pmc,
233     ARGOUT(void ** ptr),
234     ARGOUT(Parrot_Int * size))
235         __attribute__nonnull__(3)
236         __attribute__nonnull__(4)
237         FUNC_MODIFIES(* ptr)
238         FUNC_MODIFIES(* size);
239 
240 PARROT_API
241 Parrot_Int Parrot_api_wrap_pointer(
242     Parrot_PMC interp_pmc,
243     ARGIN_NULLOK(void *ptr),
244     Parrot_Int size,
245     ARGOUT(Parrot_PMC *pmc))
246         __attribute__nonnull__(4)
247         FUNC_MODIFIES(*pmc);
248 
249 #define ASSERT_ARGS_Parrot_api_add_dynext_search_path \
250      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
251        PARROT_ASSERT_ARG(path))
252 #define ASSERT_ARGS_Parrot_api_add_include_search_path \
253      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
254        PARROT_ASSERT_ARG(path))
255 #define ASSERT_ARGS_Parrot_api_add_library_search_path \
256      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
257        PARROT_ASSERT_ARG(path))
258 #define ASSERT_ARGS_Parrot_api_debug_flag __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
259 #define ASSERT_ARGS_Parrot_api_destroy_interpreter \
260      __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
261 #define ASSERT_ARGS_Parrot_api_flag __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
262 #define ASSERT_ARGS_Parrot_api_get_compiler __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
263        PARROT_ASSERT_ARG(type) \
264     , PARROT_ASSERT_ARG(compiler))
265 #define ASSERT_ARGS_Parrot_api_get_exception_backtrace \
266      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
267        PARROT_ASSERT_ARG(bt))
268 #define ASSERT_ARGS_Parrot_api_get_result __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
269        PARROT_ASSERT_ARG(is_error) \
270     , PARROT_ASSERT_ARG(exception) \
271     , PARROT_ASSERT_ARG(exit_code) \
272     , PARROT_ASSERT_ARG(errmsg))
273 #define ASSERT_ARGS_Parrot_api_get_runtime_path __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
274        PARROT_ASSERT_ARG(runtime))
275 #define ASSERT_ARGS_Parrot_api_load_language __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
276        PARROT_ASSERT_ARG(lang))
277 #define ASSERT_ARGS_Parrot_api_make_interpreter __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
278        PARROT_ASSERT_ARG(interp))
279 #define ASSERT_ARGS_Parrot_api_reset_call_signature \
280      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
281        PARROT_ASSERT_ARG(ctx))
282 #define ASSERT_ARGS_Parrot_api_set_compiler __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
283        PARROT_ASSERT_ARG(type) \
284     , PARROT_ASSERT_ARG(compiler))
285 #define ASSERT_ARGS_Parrot_api_set_configuration_hash \
286      __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
287 #define ASSERT_ARGS_Parrot_api_set_executable_name \
288      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
289        PARROT_ASSERT_ARG(name))
290 #define ASSERT_ARGS_Parrot_api_set_runcore __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
291        PARROT_ASSERT_ARG(corename))
292 #define ASSERT_ARGS_Parrot_api_set_stdhandle __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
293        PARROT_ASSERT_ARG(old_handle))
294 #define ASSERT_ARGS_Parrot_api_set_warnings __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
295 #define ASSERT_ARGS_Parrot_api_toggle_gc __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
296 #define ASSERT_ARGS_Parrot_api_unwrap_pointer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
297        PARROT_ASSERT_ARG(ptr) \
298     , PARROT_ASSERT_ARG(size))
299 #define ASSERT_ARGS_Parrot_api_wrap_pointer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
300        PARROT_ASSERT_ARG(pmc))
301 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
302 /* HEADERIZER END: src/embed/api.c */
303 
304 /* HEADERIZER BEGIN: src/embed/bytecode.c */
305 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
306 
307 PARROT_API
308 Parrot_Int Parrot_api_disassemble_bytecode(
309     Parrot_PMC interp_pmc,
310     Parrot_PMC pbc,
311     ARGIN_NULLOK(const char * const outfile),
312     Parrot_Int opts);
313 
314 PARROT_API
315 Parrot_Int Parrot_api_load_bytecode_bytes(
316     Parrot_PMC interp_pmc,
317     ARGIN(const unsigned char * const pbc),
318     Parrot_Int bytecode_size,
319     ARGOUT(Parrot_PMC * pbcpmc))
320         __attribute__nonnull__(2)
321         __attribute__nonnull__(4)
322         FUNC_MODIFIES(* pbcpmc);
323 
324 PARROT_API
325 Parrot_Int Parrot_api_load_bytecode_file(
326     Parrot_PMC interp_pmc,
327     ARGIN(Parrot_String filename),
328     ARGOUT(Parrot_PMC * pbc))
329         __attribute__nonnull__(2)
330         __attribute__nonnull__(3)
331         FUNC_MODIFIES(* pbc);
332 
333 PARROT_API
334 Parrot_Int Parrot_api_ready_bytecode(
335     Parrot_PMC interp_pmc,
336     Parrot_PMC pbc,
337     ARGOUT(Parrot_PMC *main_sub))
338         __attribute__nonnull__(3)
339         FUNC_MODIFIES(*main_sub);
340 
341 PARROT_API
342 Parrot_Int Parrot_api_run_bytecode(
343     Parrot_PMC interp_pmc,
344     Parrot_PMC pbc,
345     Parrot_PMC args);
346 
347 PARROT_API
348 Parrot_Int Parrot_api_serialize_bytecode_pmc(
349     Parrot_PMC interp_pmc,
350     Parrot_PMC pbc,
351     ARGOUT(Parrot_String * bc))
352         __attribute__nonnull__(3)
353         FUNC_MODIFIES(* bc);
354 
355 PARROT_API
356 Parrot_Int Parrot_api_write_bytecode_to_file(
357     Parrot_PMC interp_pmc,
358     Parrot_PMC pbc,
359     Parrot_String filename);
360 
361 #define ASSERT_ARGS_Parrot_api_disassemble_bytecode \
362      __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
363 #define ASSERT_ARGS_Parrot_api_load_bytecode_bytes \
364      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
365        PARROT_ASSERT_ARG(pbc) \
366     , PARROT_ASSERT_ARG(pbcpmc))
367 #define ASSERT_ARGS_Parrot_api_load_bytecode_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
368        PARROT_ASSERT_ARG(filename) \
369     , PARROT_ASSERT_ARG(pbc))
370 #define ASSERT_ARGS_Parrot_api_ready_bytecode __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
371        PARROT_ASSERT_ARG(main_sub))
372 #define ASSERT_ARGS_Parrot_api_run_bytecode __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
373 #define ASSERT_ARGS_Parrot_api_serialize_bytecode_pmc \
374      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
375        PARROT_ASSERT_ARG(bc))
376 #define ASSERT_ARGS_Parrot_api_write_bytecode_to_file \
377      __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
378 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
379 /* HEADERIZER END: src/embed/bytecode.c */
380 
381 /* HEADERIZER BEGIN: src/embed/strings.c */
382 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
383 
384 PARROT_API
385 Parrot_Int Parrot_api_string_byte_length(
386     Parrot_PMC interp_pmc,
387     Parrot_String str,
388     ARGOUT(Parrot_Int * len))
389         __attribute__nonnull__(3)
390         FUNC_MODIFIES(* len);
391 
392 PARROT_API
393 Parrot_Int Parrot_api_string_export_ascii(
394     ARGIN(Parrot_PMC interp_pmc),
395     ARGIN(Parrot_String string),
396     ARGOUT(char ** strout))
397         __attribute__nonnull__(1)
398         __attribute__nonnull__(2)
399         __attribute__nonnull__(3)
400         FUNC_MODIFIES(* strout);
401 
402 PARROT_API
403 Parrot_Int Parrot_api_string_export_wchar(
404     ARGIN(Parrot_PMC interp_pmc),
405     ARGIN(Parrot_String string),
406     ARGOUT(wchar_t ** strout))
407         __attribute__nonnull__(1)
408         __attribute__nonnull__(2)
409         __attribute__nonnull__(3)
410         FUNC_MODIFIES(* strout);
411 
412 PARROT_API
413 Parrot_Int Parrot_api_string_free_exported_ascii(
414     ARGIN(Parrot_PMC interp_pmc),
415     ARGIN(char * const str))
416         __attribute__nonnull__(1)
417         __attribute__nonnull__(2);
418 
419 PARROT_API
420 Parrot_Int Parrot_api_string_free_exported_wchar(
421     ARGIN(Parrot_PMC interp_pmc),
422     ARGIN(wchar_t * const str))
423         __attribute__nonnull__(1)
424         __attribute__nonnull__(2);
425 
426 PARROT_API
427 Parrot_Int Parrot_api_string_import(
428     ARGIN(Parrot_PMC interp_pmc),
429     ARGIN(const char * str),
430     ARGOUT(Parrot_String * out))
431         __attribute__nonnull__(1)
432         __attribute__nonnull__(2)
433         __attribute__nonnull__(3)
434         FUNC_MODIFIES(* out);
435 
436 PARROT_API
437 Parrot_Int Parrot_api_string_import_ascii(
438     ARGIN(Parrot_PMC interp_pmc),
439     ARGIN(const char * str),
440     ARGOUT(Parrot_String * out))
441         __attribute__nonnull__(1)
442         __attribute__nonnull__(2)
443         __attribute__nonnull__(3)
444         FUNC_MODIFIES(* out);
445 
446 PARROT_API
447 Parrot_Int Parrot_api_string_import_binary(
448     ARGIN(Parrot_PMC interp_pmc),
449     ARGIN(const unsigned char *bytes),
450     Parrot_Int length,
451     ARGIN(const char *encoding_name),
452     ARGOUT(Parrot_String *out))
453         __attribute__nonnull__(1)
454         __attribute__nonnull__(2)
455         __attribute__nonnull__(4)
456         __attribute__nonnull__(5)
457         FUNC_MODIFIES(*out);
458 
459 PARROT_API
460 Parrot_Int Parrot_api_string_import_wchar(
461     ARGIN(Parrot_PMC interp_pmc),
462     ARGIN(wchar_t * str),
463     ARGOUT(Parrot_String * out))
464         __attribute__nonnull__(1)
465         __attribute__nonnull__(2)
466         __attribute__nonnull__(3)
467         FUNC_MODIFIES(* out);
468 
469 #define ASSERT_ARGS_Parrot_api_string_byte_length __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
470        PARROT_ASSERT_ARG(len))
471 #define ASSERT_ARGS_Parrot_api_string_export_ascii \
472      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
473        PARROT_ASSERT_ARG(interp_pmc) \
474     , PARROT_ASSERT_ARG(string) \
475     , PARROT_ASSERT_ARG(strout))
476 #define ASSERT_ARGS_Parrot_api_string_export_wchar \
477      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
478        PARROT_ASSERT_ARG(interp_pmc) \
479     , PARROT_ASSERT_ARG(string) \
480     , PARROT_ASSERT_ARG(strout))
481 #define ASSERT_ARGS_Parrot_api_string_free_exported_ascii \
482      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
483        PARROT_ASSERT_ARG(interp_pmc) \
484     , PARROT_ASSERT_ARG(str))
485 #define ASSERT_ARGS_Parrot_api_string_free_exported_wchar \
486      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
487        PARROT_ASSERT_ARG(interp_pmc) \
488     , PARROT_ASSERT_ARG(str))
489 #define ASSERT_ARGS_Parrot_api_string_import __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
490        PARROT_ASSERT_ARG(interp_pmc) \
491     , PARROT_ASSERT_ARG(str) \
492     , PARROT_ASSERT_ARG(out))
493 #define ASSERT_ARGS_Parrot_api_string_import_ascii \
494      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
495        PARROT_ASSERT_ARG(interp_pmc) \
496     , PARROT_ASSERT_ARG(str) \
497     , PARROT_ASSERT_ARG(out))
498 #define ASSERT_ARGS_Parrot_api_string_import_binary \
499      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
500        PARROT_ASSERT_ARG(interp_pmc) \
501     , PARROT_ASSERT_ARG(bytes) \
502     , PARROT_ASSERT_ARG(encoding_name) \
503     , PARROT_ASSERT_ARG(out))
504 #define ASSERT_ARGS_Parrot_api_string_import_wchar \
505      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
506        PARROT_ASSERT_ARG(interp_pmc) \
507     , PARROT_ASSERT_ARG(str) \
508     , PARROT_ASSERT_ARG(out))
509 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
510 /* HEADERIZER END: src/embed/strings.c */
511 
512 /* HEADERIZER BEGIN: src/embed/pmc.c */
513 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
514 
515 PARROT_API
516 Parrot_Int Parrot_api_pmc_box_float(
517     Parrot_PMC interp_pmc,
518     Parrot_Float value,
519     ARGOUT(Parrot_PMC * float_pmc))
520         __attribute__nonnull__(3)
521         FUNC_MODIFIES(* float_pmc);
522 
523 PARROT_API
524 Parrot_Int Parrot_api_pmc_box_integer(
525     Parrot_PMC interp_pmc,
526     Parrot_Int value,
527     ARGOUT(Parrot_PMC * int_pmc))
528         __attribute__nonnull__(3)
529         FUNC_MODIFIES(* int_pmc);
530 
531 PARROT_API
532 Parrot_Int Parrot_api_pmc_box_string(
533     ARGIN(Parrot_PMC interp_pmc),
534     ARGIN(Parrot_String str),
535     ARGOUT(Parrot_PMC * str_pmc))
536         __attribute__nonnull__(1)
537         __attribute__nonnull__(2)
538         __attribute__nonnull__(3)
539         FUNC_MODIFIES(* str_pmc);
540 
541 PARROT_API
542 Parrot_Int Parrot_api_pmc_deserialize(
543     ARGIN(Parrot_PMC interp_pmc),
544     ARGIN(Parrot_String fpmc),
545     ARGOUT(Parrot_PMC * pmc))
546         __attribute__nonnull__(1)
547         __attribute__nonnull__(2)
548         __attribute__nonnull__(3)
549         FUNC_MODIFIES(* pmc);
550 
551 PARROT_API
552 Parrot_Int Parrot_api_pmc_deserialize_bytes(
553     ARGIN(Parrot_PMC interp_pmc),
554     ARGIN(const unsigned char *fpmc),
555     Parrot_Int length,
556     ARGOUT(Parrot_PMC *pmc))
557         __attribute__nonnull__(1)
558         __attribute__nonnull__(2)
559         __attribute__nonnull__(4)
560         FUNC_MODIFIES(*pmc);
561 
562 PARROT_API
563 Parrot_Int Parrot_api_pmc_find_method(
564     Parrot_PMC interp_pmc,
565     Parrot_PMC object,
566     Parrot_String name,
567     ARGOUT(Parrot_PMC *method))
568         __attribute__nonnull__(4)
569         FUNC_MODIFIES(*method);
570 
571 PARROT_API
572 Parrot_Int Parrot_api_pmc_get_class(
573     ARGIN(Parrot_PMC interp_pmc),
574     ARGIN(Parrot_PMC key),
575     ARGOUT(Parrot_PMC *class_pmc))
576         __attribute__nonnull__(1)
577         __attribute__nonnull__(2)
578         __attribute__nonnull__(3)
579         FUNC_MODIFIES(*class_pmc);
580 
581 PARROT_API
582 Parrot_Int Parrot_api_pmc_get_float(
583     ARGIN(Parrot_PMC interp_pmc),
584     ARGIN(Parrot_PMC pmc),
585     ARGOUT(Parrot_Float * value))
586         __attribute__nonnull__(1)
587         __attribute__nonnull__(2)
588         __attribute__nonnull__(3)
589         FUNC_MODIFIES(* value);
590 
591 PARROT_API
592 Parrot_Int Parrot_api_pmc_get_integer(
593     ARGIN(Parrot_PMC interp_pmc),
594     ARGIN(Parrot_PMC pmc),
595     ARGOUT(Parrot_Int * value))
596         __attribute__nonnull__(1)
597         __attribute__nonnull__(2)
598         __attribute__nonnull__(3)
599         FUNC_MODIFIES(* value);
600 
601 PARROT_API
602 Parrot_Int Parrot_api_pmc_get_keyed(
603     Parrot_PMC interp_pmc,
604     Parrot_PMC pmc,
605     Parrot_PMC key,
606     ARGOUT(Parrot_PMC * value))
607         __attribute__nonnull__(4)
608         FUNC_MODIFIES(* value);
609 
610 PARROT_API
611 Parrot_Int Parrot_api_pmc_get_keyed_int(
612     ARGIN(Parrot_PMC interp_pmc),
613     ARGIN(Parrot_PMC pmc),
614     Parrot_Int key,
615     ARGOUT(Parrot_PMC *value))
616         __attribute__nonnull__(1)
617         __attribute__nonnull__(2)
618         __attribute__nonnull__(4)
619         FUNC_MODIFIES(*value);
620 
621 PARROT_API
622 Parrot_Int Parrot_api_pmc_get_keyed_string(
623     ARGIN(Parrot_PMC interp_pmc),
624     ARGIN(Parrot_PMC pmc),
625     ARGIN(Parrot_String key),
626     ARGOUT(Parrot_PMC * value))
627         __attribute__nonnull__(1)
628         __attribute__nonnull__(2)
629         __attribute__nonnull__(3)
630         __attribute__nonnull__(4)
631         FUNC_MODIFIES(* value);
632 
633 PARROT_API
634 Parrot_Int Parrot_api_pmc_get_string(
635     ARGIN(Parrot_PMC interp_pmc),
636     ARGIN(Parrot_PMC pmc),
637     ARGOUT(Parrot_String * str))
638         __attribute__nonnull__(1)
639         __attribute__nonnull__(2)
640         __attribute__nonnull__(3)
641         FUNC_MODIFIES(* str);
642 
643 PARROT_API
644 Parrot_Int Parrot_api_pmc_invoke(
645     ARGIN(Parrot_PMC interp_pmc),
646     ARGIN(Parrot_PMC sub),
647     ARGIN(Parrot_PMC signature))
648         __attribute__nonnull__(1)
649         __attribute__nonnull__(2)
650         __attribute__nonnull__(3);
651 
652 PARROT_API
653 Parrot_Int Parrot_api_pmc_keep_alive(
654     Parrot_PMC interp_pmc,
655     Parrot_PMC pmc,
656     Parrot_Int alive);
657 
658 PARROT_API
659 Parrot_Int Parrot_api_pmc_new_call_object(
660     Parrot_PMC interp_pmc,
661     ARGOUT(Parrot_PMC *cc))
662         __attribute__nonnull__(2)
663         FUNC_MODIFIES(*cc);
664 
665 PARROT_API
666 Parrot_Int Parrot_api_pmc_new_from_class(
667     ARGIN(Parrot_PMC interp_pmc),
668     ARGIN(Parrot_PMC class_pmc),
669     ARGIN_NULLOK(Parrot_PMC init),
670     ARGOUT(Parrot_PMC * pmc))
671         __attribute__nonnull__(1)
672         __attribute__nonnull__(2)
673         __attribute__nonnull__(4)
674         FUNC_MODIFIES(* pmc);
675 
676 PARROT_API
677 Parrot_Int Parrot_api_pmc_null(
678     ARGIN(Parrot_PMC interp_pmc),
679     ARGOUT(Parrot_PMC *pmctonull))
680         __attribute__nonnull__(1)
681         __attribute__nonnull__(2)
682         FUNC_MODIFIES(*pmctonull);
683 
684 PARROT_API
685 Parrot_Int Parrot_api_pmc_push(
686     Parrot_PMC interp_pmc,
687     Parrot_PMC pmc,
688     Parrot_PMC item);
689 
690 PARROT_API
691 Parrot_Int Parrot_api_pmc_serialize(
692     Parrot_PMC interp_pmc,
693     Parrot_PMC object,
694     ARGOUT(Parrot_String *frozen))
695         __attribute__nonnull__(3)
696         FUNC_MODIFIES(*frozen);
697 
698 PARROT_API
699 Parrot_Int Parrot_api_pmc_set_float(
700     ARGIN(Parrot_PMC interp_pmc),
701     ARGIN(Parrot_PMC pmc),
702     Parrot_Float value)
703         __attribute__nonnull__(1)
704         __attribute__nonnull__(2);
705 
706 PARROT_API
707 Parrot_Int Parrot_api_pmc_set_integer(
708     ARGIN(Parrot_PMC interp_pmc),
709     ARGIN(Parrot_PMC pmc),
710     Parrot_Int value)
711         __attribute__nonnull__(1)
712         __attribute__nonnull__(2);
713 
714 PARROT_API
715 Parrot_Int Parrot_api_pmc_set_keyed(
716     Parrot_PMC interp_pmc,
717     Parrot_PMC pmc,
718     Parrot_PMC key,
719     Parrot_PMC value);
720 
721 PARROT_API
722 Parrot_Int Parrot_api_pmc_set_keyed_int(
723     ARGIN(Parrot_PMC interp_pmc),
724     ARGIN(Parrot_PMC pmc),
725     Parrot_Int key,
726     ARGIN(Parrot_PMC value))
727         __attribute__nonnull__(1)
728         __attribute__nonnull__(2)
729         __attribute__nonnull__(4);
730 
731 PARROT_API
732 Parrot_Int Parrot_api_pmc_set_keyed_string(
733     ARGIN(Parrot_PMC interp_pmc),
734     ARGIN(Parrot_PMC pmc),
735     ARGIN(Parrot_String key),
736     ARGIN(Parrot_PMC value))
737         __attribute__nonnull__(1)
738         __attribute__nonnull__(2)
739         __attribute__nonnull__(3)
740         __attribute__nonnull__(4);
741 
742 PARROT_API
743 Parrot_Int Parrot_api_pmc_set_string(
744     ARGIN(Parrot_PMC interp_pmc),
745     ARGIN(Parrot_PMC pmc),
746     ARGIN(Parrot_String value))
747         __attribute__nonnull__(1)
748         __attribute__nonnull__(2)
749         __attribute__nonnull__(3);
750 
751 PARROT_API
752 Parrot_Int Parrot_api_pmc_setup_signature(
753     Parrot_PMC interp_pmc,
754     Parrot_PMC callcontext,
755     ARGIN(const char * const signature),
756     ...)
757         __attribute__nonnull__(3);
758 
759 PARROT_API
760 Parrot_Int Parrot_api_pmc_wrap_string_array(
761     ARGIN(Parrot_PMC interp_pmc),
762     Parrot_Int argc,
763     ARGIN(const char ** argv),
764     ARGOUT(Parrot_PMC * args))
765         __attribute__nonnull__(1)
766         __attribute__nonnull__(3)
767         __attribute__nonnull__(4)
768         FUNC_MODIFIES(* args);
769 
770 #define ASSERT_ARGS_Parrot_api_pmc_box_float __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
771        PARROT_ASSERT_ARG(float_pmc))
772 #define ASSERT_ARGS_Parrot_api_pmc_box_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
773        PARROT_ASSERT_ARG(int_pmc))
774 #define ASSERT_ARGS_Parrot_api_pmc_box_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
775        PARROT_ASSERT_ARG(interp_pmc) \
776     , PARROT_ASSERT_ARG(str) \
777     , PARROT_ASSERT_ARG(str_pmc))
778 #define ASSERT_ARGS_Parrot_api_pmc_deserialize __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
779        PARROT_ASSERT_ARG(interp_pmc) \
780     , PARROT_ASSERT_ARG(fpmc) \
781     , PARROT_ASSERT_ARG(pmc))
782 #define ASSERT_ARGS_Parrot_api_pmc_deserialize_bytes \
783      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
784        PARROT_ASSERT_ARG(interp_pmc) \
785     , PARROT_ASSERT_ARG(fpmc) \
786     , PARROT_ASSERT_ARG(pmc))
787 #define ASSERT_ARGS_Parrot_api_pmc_find_method __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
788        PARROT_ASSERT_ARG(method))
789 #define ASSERT_ARGS_Parrot_api_pmc_get_class __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
790        PARROT_ASSERT_ARG(interp_pmc) \
791     , PARROT_ASSERT_ARG(key) \
792     , PARROT_ASSERT_ARG(class_pmc))
793 #define ASSERT_ARGS_Parrot_api_pmc_get_float __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
794        PARROT_ASSERT_ARG(interp_pmc) \
795     , PARROT_ASSERT_ARG(pmc) \
796     , PARROT_ASSERT_ARG(value))
797 #define ASSERT_ARGS_Parrot_api_pmc_get_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
798        PARROT_ASSERT_ARG(interp_pmc) \
799     , PARROT_ASSERT_ARG(pmc) \
800     , PARROT_ASSERT_ARG(value))
801 #define ASSERT_ARGS_Parrot_api_pmc_get_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
802        PARROT_ASSERT_ARG(value))
803 #define ASSERT_ARGS_Parrot_api_pmc_get_keyed_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
804        PARROT_ASSERT_ARG(interp_pmc) \
805     , PARROT_ASSERT_ARG(pmc) \
806     , PARROT_ASSERT_ARG(value))
807 #define ASSERT_ARGS_Parrot_api_pmc_get_keyed_string \
808      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
809        PARROT_ASSERT_ARG(interp_pmc) \
810     , PARROT_ASSERT_ARG(pmc) \
811     , PARROT_ASSERT_ARG(key) \
812     , PARROT_ASSERT_ARG(value))
813 #define ASSERT_ARGS_Parrot_api_pmc_get_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
814        PARROT_ASSERT_ARG(interp_pmc) \
815     , PARROT_ASSERT_ARG(pmc) \
816     , PARROT_ASSERT_ARG(str))
817 #define ASSERT_ARGS_Parrot_api_pmc_invoke __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
818        PARROT_ASSERT_ARG(interp_pmc) \
819     , PARROT_ASSERT_ARG(sub) \
820     , PARROT_ASSERT_ARG(signature))
821 #define ASSERT_ARGS_Parrot_api_pmc_keep_alive __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
822 #define ASSERT_ARGS_Parrot_api_pmc_new_call_object \
823      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
824        PARROT_ASSERT_ARG(cc))
825 #define ASSERT_ARGS_Parrot_api_pmc_new_from_class __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
826        PARROT_ASSERT_ARG(interp_pmc) \
827     , PARROT_ASSERT_ARG(class_pmc) \
828     , PARROT_ASSERT_ARG(pmc))
829 #define ASSERT_ARGS_Parrot_api_pmc_null __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
830        PARROT_ASSERT_ARG(interp_pmc) \
831     , PARROT_ASSERT_ARG(pmctonull))
832 #define ASSERT_ARGS_Parrot_api_pmc_push __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
833 #define ASSERT_ARGS_Parrot_api_pmc_serialize __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
834        PARROT_ASSERT_ARG(frozen))
835 #define ASSERT_ARGS_Parrot_api_pmc_set_float __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
836        PARROT_ASSERT_ARG(interp_pmc) \
837     , PARROT_ASSERT_ARG(pmc))
838 #define ASSERT_ARGS_Parrot_api_pmc_set_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
839        PARROT_ASSERT_ARG(interp_pmc) \
840     , PARROT_ASSERT_ARG(pmc))
841 #define ASSERT_ARGS_Parrot_api_pmc_set_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
842 #define ASSERT_ARGS_Parrot_api_pmc_set_keyed_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
843        PARROT_ASSERT_ARG(interp_pmc) \
844     , PARROT_ASSERT_ARG(pmc) \
845     , PARROT_ASSERT_ARG(value))
846 #define ASSERT_ARGS_Parrot_api_pmc_set_keyed_string \
847      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
848        PARROT_ASSERT_ARG(interp_pmc) \
849     , PARROT_ASSERT_ARG(pmc) \
850     , PARROT_ASSERT_ARG(key) \
851     , PARROT_ASSERT_ARG(value))
852 #define ASSERT_ARGS_Parrot_api_pmc_set_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
853        PARROT_ASSERT_ARG(interp_pmc) \
854     , PARROT_ASSERT_ARG(pmc) \
855     , PARROT_ASSERT_ARG(value))
856 #define ASSERT_ARGS_Parrot_api_pmc_setup_signature \
857      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
858        PARROT_ASSERT_ARG(signature))
859 #define ASSERT_ARGS_Parrot_api_pmc_wrap_string_array \
860      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
861        PARROT_ASSERT_ARG(interp_pmc) \
862     , PARROT_ASSERT_ARG(argv) \
863     , PARROT_ASSERT_ARG(args))
864 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
865 /* HEADERIZER END: src/embed/pmc.c */
866 
867 #endif /* PARROT_API_H_GUARD */
868 
869 /*
870  * Local variables:
871  *   c-file-style: "parrot"
872  * End:
873  * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
874  */
875