1 /*
2  * Copyright (C) 2001-2015, Parrot Foundation.
3  */
4 
5 /* packfile.h
6 *
7 *
8 * History:
9 *  Rework by Melvin; new bytecode format, make bytecode portable.
10 *   (Do endian conversion and wordsize transforms on the fly.)
11 */
12 
13 #ifndef PARROT_PACKFILE_H_GUARD
14 #define PARROT_PACKFILE_H_GUARD
15 
16 #include "parrot/parrot.h"
17 
18 #define DIRECTORY_SEGMENT_NAME   Parrot_str_new_constant(interp, "DIRECTORY")
19 #define FIXUP_TABLE_SEGMENT_NAME Parrot_str_new_constant(interp, "FIXUP")
20 #define CONSTANT_SEGMENT_NAME    Parrot_str_new_constant(interp, "CONSTANT")
21 #define BYTE_CODE_SEGMENT_NAME   Parrot_str_new_constant(interp, "BYTECODE")
22 
23 #define FLOATTYPE_8           0
24 #define FLOATTYPE_8_NAME      "IEEE-754 8 byte double"
25 #define FLOATTYPE_12          1
26 #define FLOATTYPE_12_NAME     "x86 little endian 12 byte long double"
27 #define FLOATTYPE_16          2
28 #define FLOATTYPE_16_NAME     "IEEE-754 16 byte long double"
29 /* Supported until here. */
30 #define FLOATTYPE_MAX         2
31 /* Non IEEE-754 versions, yet unsupported. */
32 /* NaN difference, but patches welcome */
33 #define FLOATTYPE_16MIPS      3
34 #define FLOATTYPE_16MIPS_NAME "MIPS 16 byte long double"
35 /* See http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/IBMp690/IBM/usr/share/ ...
36  * man/info/en_US/a_doc_lib/aixprggd/genprogc/128bit_long_double_floating-point_datatype.htm */
37 #define FLOATTYPE_16AIX       4
38 #define FLOATTYPE_16AIX_NAME  "AIX 16 byte long double"
39 /* IEEE-754 old and tiny, yet unsupported */
40 #define FLOATTYPE_4           5
41 #define FLOATTYPE_4_NAME      "4-byte float"
42 
43 /*
44 ** Parrot_pbc_read() options:
45 **   parrot, pbc_merge, parrot_debugger use 0
46 **   pbc_dump, pbc_disassemble use 1 to skip the version check
47 **   pbc_dump -h requires 2
48 */
49 #define PFOPT_NONE            0
50 #define PFOPT_UTILS           1
51 #define PFOPT_HEADERONLY      2
52 #define PFOPT_PMC_FREEZE_ONLY 4
53 
54 /*
55 ** Enumerated constants
56 ** Changes here require update PBC_COMPAT
57 ** The preferred way to eliminate a value is just to stop using it without
58 ** renumbering others, that helps to keep backward compatibility.
59 */
60 
61 /* Packfile segment types */
62 
63 /* &gen_from_enum(packfile_segments.pasm) */
64 
65 typedef enum {
66     PF_DIR_SEG          = 0,
67     PF_UNKNOWN_SEG      = 1,
68     PF_CONST_SEG        = 2,
69     PF_BYTEC_SEG        = 3,
70     PF_DEBUG_SEG        = 4,
71     PF_ANNOTATIONS_SEG  = 5,
72 
73     PF_MAX_SEG          = 6
74 } pack_file_types;
75 
76 /* &end_gen */
77 
78 #define PF_DIR_FORMAT 1
79 
80 /*
81 ** Structure Definitions:
82 */
83 
84 
85 /*
86 ** The number of bytes in the packfile header that we can read/write
87 ** directly. This excludes the final element in the struct, which holds a
88 ** pointer to the UUID data, if there is any.
89 */
90 #define PACKFILE_HEADER_BYTES 18
91 
92 typedef struct PackFile_Header {
93     /* Magic string to identify the PBC file. */
94     unsigned char magic[8];
95 
96     /* Word size, byte ordering and floating point number format. */
97     unsigned char wordsize;
98     unsigned char byteorder;
99     unsigned char floattype;
100 
101     /* Version of Parrot that wrote the bytecode file. */
102     unsigned char major;
103     unsigned char minor;
104     unsigned char patch;
105 
106     /* Bytecode format version. */
107     unsigned char bc_major;
108     unsigned char bc_minor;
109 
110     /* UUID type and length. */
111     unsigned char uuid_type;
112     unsigned char uuid_size;
113 
114     /* The UUID data. */
115     unsigned char *uuid_data;
116 
117     /* Directory format. */
118     opcode_t dir_format;
119 } PackFile_Header;
120 
121 /*
122 ** PackFile Segment:
123 *    The base type of every section
124 *    include it as first element of every derivated Segment
125 */
126 
127 typedef struct PackFile_Segment * (*PackFile_Segment_new_func_t)(PARROT_INTERP);
128 
129 typedef void (*PackFile_Segment_destroy_func_t)
130     (PARROT_INTERP, ARGMOD(struct PackFile_Segment *segp));
131 
132 typedef size_t (*PackFile_Segment_packed_size_func_t)
133     (PARROT_INTERP, ARGMOD(struct PackFile_Segment *segp));
134 
135 typedef opcode_t * (*PackFile_Segment_pack_func_t)
136     (PARROT_INTERP, ARGMOD(struct PackFile_Segment *segp), ARGOUT(opcode_t *dest));
137 
138 typedef const opcode_t * (*PackFile_Segment_unpack_func_t)
139     (PARROT_INTERP, ARGMOD(struct PackFile_Segment *segp), ARGIN(const opcode_t *packed));
140 
141 typedef void (*PackFile_Segment_dump_func_t)
142     (PARROT_INTERP, ARGIN(const struct PackFile_Segment *));
143 
144 typedef struct PackFile_funcs {
145     PackFile_Segment_new_func_t         new_seg;
146     PackFile_Segment_destroy_func_t     destroy;
147     PackFile_Segment_packed_size_func_t packed_size;
148     PackFile_Segment_pack_func_t        pack;
149     PackFile_Segment_unpack_func_t      unpack;
150     PackFile_Segment_dump_func_t        dump;
151 } PackFile_funcs;
152 
153 typedef struct PackFile_Segment {
154     struct PackFile           * pf;
155     struct PackFile_Directory * dir;
156 
157     /* directory information */
158     UINTVAL             type;           /* one of above defined types */
159     STRING             *name;
160     size_t              op_count;       /* external size in ops */
161     size_t              file_offset;    /* offset in ops */
162     /* common payload of all bytecode chunks
163      * with the size above these four items are aligned to 16 byte */
164     opcode_t            itype;          /* internal type/version */
165     opcode_t            id;             /* internal id */
166     size_t              size;           /* internal oparray size */
167     opcode_t           *data;           /* oparray e.g. bytecode */
168 } PackFile_Segment;
169 
170 typedef INTVAL (*PackFile_map_segments_func_t)(PARROT_INTERP,
171         ARGMOD(PackFile_Segment *seg), ARGIN_NULLOK(void *user_data));
172 
173 typedef struct PackFile_ConstTagPair {
174     opcode_t tag_idx;
175     opcode_t const_idx;
176 } PackFile_ConstTagPair;
177 
178 typedef struct PackFile_ConstTable {
179     PackFile_Segment           base;
180     struct {
181         opcode_t        const_count;
182         FLOATVAL       *constants;
183     } num;
184     struct {
185         opcode_t        const_count;
186         STRING        **constants;
187     } str;
188     struct {
189         opcode_t        const_count;
190         PMC           **constants;
191     } pmc;
192     PackFile_ByteCode     *code;        /* where this segment belongs to */
193     Hash                  *string_hash; /* Hash for lookup of string indices */
194     Hash                  *pmc_hash;    /* Hash for lookup of pmc indices */
195     PackFile_ConstTagPair *tag_map;     /* n-m Mapping pmc constants to string tags */
196     opcode_t               ntags;       /* Number of tags */
197 } PackFile_ConstTable;
198 
199 typedef struct PackFile_ByteCode_OpMappingEntry {
200     op_lib_t *lib;       /* library for this entry */
201     opcode_t  n_ops;     /* number of ops used */
202     opcode_t *lib_ops;   /* indices of ops within the library */
203     opcode_t *table_ops; /* indices of ops within the op table */
204 } PackFile_ByteCode_OpMappingEntry;
205 
206 typedef struct PackFile_ByteCode_OpMapping {
207     opcode_t                          n_libs; /* number of library entries */
208     PackFile_ByteCode_OpMappingEntry *libs;   /* opcode libraries used by this segment */
209 } PackFile_ByteCode_OpMapping;
210 
211 struct PackFile_ByteCode {
212     PackFile_Segment              base;
213     struct PackFile_Debug        *debugs;
214     PackFile_ConstTable          *const_table;
215     INTVAL                        main_sub;        /* index into constant table of main sub */
216     struct PackFile_Annotations  *annotations;
217     PackFile_ByteCode_OpMapping   op_mapping;      /* opcode mapping information */
218     size_t                        op_count;        /* number of ops in the func table */
219     op_func_t                    *op_func_table;   /* opcode dispatch table */
220     op_func_t                    *save_func_table; /* for when we hijack op_func_table */
221     op_info_t                   **op_info_table;
222     size_t                        n_libdeps;       /* number of library dependancies */
223     STRING                      **libdeps;         /* names of prerequisite libraries */
224 };
225 
226 typedef struct PackFile_DebugFilenameMapping {
227     opcode_t offset;
228     opcode_t filename;
229 } PackFile_DebugFilenameMapping;
230 
231 typedef struct PackFile_Debug {
232     PackFile_Segment        base;
233     opcode_t                num_mappings;
234     PackFile_DebugFilenameMapping *mappings;
235     PackFile_ByteCode      *code;   /* where this segment belongs to */
236 } PackFile_Debug;
237 
238 #define ANN_ENTRY_OFF 0
239 #define ANN_ENTRY_VAL 1
240 
241 /* &gen_from_def(packfile_annotation_keytype.pasm) */
242 
243 /* Key types for annotation segment. */
244 typedef enum {
245     PF_ANNOTATION_KEY_TYPE_INT = 1,
246     PF_ANNOTATION_KEY_TYPE_STR = 2,
247     PF_ANNOTATION_KEY_TYPE_PMC = 3
248 } pf_ann_key_type_t;
249 
250 /* &end_gen */
251 
252 typedef struct PackFile_Annotations_Key {
253     UINTVAL           name;
254     pf_ann_key_type_t type;
255     UINTVAL           start;
256     UINTVAL           len;
257 } PackFile_Annotations_Key;
258 
259 typedef struct PackFile_Annotations {
260     PackFile_Segment             base;
261     PackFile_ByteCode           *code;
262     opcode_t                     num_keys;
263     PackFile_Annotations_Key    *keys;
264 } PackFile_Annotations;
265 
266 typedef struct PackFile_Directory {
267     PackFile_Segment   base;
268     size_t             num_segments;
269     PackFile_Segment **segments;
270 } PackFile_Directory;
271 
272 
273 typedef opcode_t (*packfile_fetch_op_t)(ARGIN(const unsigned char *));
274 typedef INTVAL   (*packfile_fetch_iv_t)(ARGIN(const unsigned char *));
275 typedef void     (*packfile_fetch_nv_t)(ARGOUT(unsigned char *), ARGIN(const unsigned char *));
276 
277 typedef struct PackFile {
278     /* the packfile is its own directory */
279     PackFile_Directory   directory;
280     PackFile_Directory  *dirp;        /* for freeing */
281     const opcode_t      *src;         /* possible mmap()ed start of the PF */
282     size_t               size;        /* size in bytes */
283     INTVAL               is_mmap_ped; /* don't free it, munmap it at destroy */
284 
285     PackFile_Header     *header;
286 
287     /* directory hold all Segments */
288     PackFile_funcs       PackFuncs[PF_MAX_SEG];
289 
290     PackFile_ByteCode   *cur_cs;   /* used during PF loading */
291 
292     PMC                 *view; /* cached PMC used to reference this packfile */
293 
294     INTVAL               options;
295     INTVAL               need_wordsize;
296     INTVAL               need_endianize;
297 
298     packfile_fetch_op_t  fetch_op;
299     packfile_fetch_iv_t  fetch_iv;
300     packfile_fetch_nv_t  fetch_nv;
301 } PackFile;
302 
303 
304 typedef enum {
305     PBC_MAIN   = 1,
306     PBC_LOADED = 2,
307     PBC_IMMEDIATE = 8,
308     PBC_POSTCOMP  = 16,
309     PBC_INIT  = 32
310 } pbc_action_enum_t;
311 
312 
313 /* HEADERIZER BEGIN: src/packfile/pf_items.c */
314 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
315 
316 void PackFile_assign_transforms(ARGMOD(PackFile *pf))
317         __attribute__nonnull__(1)
318         FUNC_MODIFIES(*pf);
319 
320 PARROT_WARN_UNUSED_RESULT
321 PARROT_CANNOT_RETURN_NULL
322 STRING * PF_fetch_buf(PARROT_INTERP,
323     ARGIN_NULLOK(PackFile *pf),
324     ARGIN(const opcode_t **cursor))
325         __attribute__nonnull__(1)
326         __attribute__nonnull__(3);
327 
328 PARROT_MALLOC
329 PARROT_CANNOT_RETURN_NULL
330 char * PF_fetch_cstring(PARROT_INTERP,
331     ARGIN(PackFile *pf),
332     ARGIN(const opcode_t **cursor))
333         __attribute__nonnull__(1)
334         __attribute__nonnull__(2)
335         __attribute__nonnull__(3);
336 
337 PARROT_WARN_UNUSED_RESULT
338 INTVAL PF_fetch_integer(ARGIN(PackFile *pf), ARGIN(const opcode_t **stream))
339         __attribute__nonnull__(1)
340         __attribute__nonnull__(2);
341 
342 PARROT_WARN_UNUSED_RESULT
343 FLOATVAL PF_fetch_number(
344     ARGIN_NULLOK(PackFile *pf),
345     ARGIN(const opcode_t **stream))
346         __attribute__nonnull__(2);
347 
348 opcode_t PF_fetch_opcode(
349     ARGIN_NULLOK(const PackFile *pf),
350     ARGMOD(const opcode_t **stream))
351         __attribute__nonnull__(2)
352         FUNC_MODIFIES(*stream);
353 
354 PARROT_WARN_UNUSED_RESULT
355 PARROT_CANNOT_RETURN_NULL
356 STRING * PF_fetch_string(PARROT_INTERP,
357     ARGIN_NULLOK(PackFile *pf),
358     ARGIN(const opcode_t **cursor))
359         __attribute__nonnull__(1)
360         __attribute__nonnull__(3);
361 
362 PARROT_PURE_FUNCTION
363 size_t PF_size_buf(ARGIN(const STRING *s))
364         __attribute__nonnull__(1);
365 
366 PARROT_PURE_FUNCTION
367 size_t PF_size_cstring(ARGIN(const char *s))
368         __attribute__nonnull__(1);
369 
370 PARROT_CONST_FUNCTION
371 size_t PF_size_integer(void);
372 
373 PARROT_CONST_FUNCTION
374 size_t PF_size_number(void);
375 
376 PARROT_CONST_FUNCTION
377 PARROT_WARN_UNUSED_RESULT
378 size_t PF_size_opcode(void);
379 
380 PARROT_PURE_FUNCTION
381 size_t PF_size_string(ARGIN(const STRING *s))
382         __attribute__nonnull__(1);
383 
384 PARROT_CONST_FUNCTION
385 PARROT_WARN_UNUSED_RESULT
386 size_t PF_size_strlen(const UINTVAL len);
387 
388 PARROT_WARN_UNUSED_RESULT
389 PARROT_CANNOT_RETURN_NULL
390 opcode_t* PF_store_buf(ARGOUT(opcode_t *cursor), ARGIN(const STRING *s))
391         __attribute__nonnull__(1)
392         __attribute__nonnull__(2)
393         FUNC_MODIFIES(*cursor);
394 
395 PARROT_WARN_UNUSED_RESULT
396 PARROT_CANNOT_RETURN_NULL
397 opcode_t* PF_store_cstring(ARGOUT(opcode_t *cursor), ARGIN(const char *s))
398         __attribute__nonnull__(1)
399         __attribute__nonnull__(2)
400         FUNC_MODIFIES(*cursor);
401 
402 PARROT_WARN_UNUSED_RESULT
403 PARROT_CANNOT_RETURN_NULL
404 opcode_t* PF_store_integer(ARGOUT(opcode_t *cursor), INTVAL val)
405         __attribute__nonnull__(1)
406         FUNC_MODIFIES(*cursor);
407 
408 PARROT_WARN_UNUSED_RESULT
409 PARROT_CANNOT_RETURN_NULL
410 opcode_t* PF_store_number(
411     ARGOUT(opcode_t *cursor),
412     ARGIN(const FLOATVAL *val))
413         __attribute__nonnull__(1)
414         __attribute__nonnull__(2)
415         FUNC_MODIFIES(*cursor);
416 
417 PARROT_WARN_UNUSED_RESULT
418 PARROT_CANNOT_RETURN_NULL
419 opcode_t* PF_store_opcode(ARGOUT(opcode_t *cursor), opcode_t val)
420         __attribute__nonnull__(1)
421         FUNC_MODIFIES(*cursor);
422 
423 PARROT_WARN_UNUSED_RESULT
424 PARROT_CANNOT_RETURN_NULL
425 opcode_t* PF_store_string(ARGOUT(opcode_t *cursor), ARGIN(const STRING *s))
426         __attribute__nonnull__(1)
427         __attribute__nonnull__(2)
428         FUNC_MODIFIES(*cursor);
429 
430 #define ASSERT_ARGS_PackFile_assign_transforms __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
431        PARROT_ASSERT_ARG(pf))
432 #define ASSERT_ARGS_PF_fetch_buf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
433        PARROT_ASSERT_ARG(interp) \
434     , PARROT_ASSERT_ARG(cursor))
435 #define ASSERT_ARGS_PF_fetch_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
436        PARROT_ASSERT_ARG(interp) \
437     , PARROT_ASSERT_ARG(pf) \
438     , PARROT_ASSERT_ARG(cursor))
439 #define ASSERT_ARGS_PF_fetch_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
440        PARROT_ASSERT_ARG(pf) \
441     , PARROT_ASSERT_ARG(stream))
442 #define ASSERT_ARGS_PF_fetch_number __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
443        PARROT_ASSERT_ARG(stream))
444 #define ASSERT_ARGS_PF_fetch_opcode __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
445        PARROT_ASSERT_ARG(stream))
446 #define ASSERT_ARGS_PF_fetch_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
447        PARROT_ASSERT_ARG(interp) \
448     , PARROT_ASSERT_ARG(cursor))
449 #define ASSERT_ARGS_PF_size_buf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
450        PARROT_ASSERT_ARG(s))
451 #define ASSERT_ARGS_PF_size_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
452        PARROT_ASSERT_ARG(s))
453 #define ASSERT_ARGS_PF_size_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
454 #define ASSERT_ARGS_PF_size_number __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
455 #define ASSERT_ARGS_PF_size_opcode __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
456 #define ASSERT_ARGS_PF_size_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
457        PARROT_ASSERT_ARG(s))
458 #define ASSERT_ARGS_PF_size_strlen __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
459 #define ASSERT_ARGS_PF_store_buf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
460        PARROT_ASSERT_ARG(cursor) \
461     , PARROT_ASSERT_ARG(s))
462 #define ASSERT_ARGS_PF_store_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
463        PARROT_ASSERT_ARG(cursor) \
464     , PARROT_ASSERT_ARG(s))
465 #define ASSERT_ARGS_PF_store_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
466        PARROT_ASSERT_ARG(cursor))
467 #define ASSERT_ARGS_PF_store_number __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
468        PARROT_ASSERT_ARG(cursor) \
469     , PARROT_ASSERT_ARG(val))
470 #define ASSERT_ARGS_PF_store_opcode __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
471        PARROT_ASSERT_ARG(cursor))
472 #define ASSERT_ARGS_PF_store_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
473        PARROT_ASSERT_ARG(cursor) \
474     , PARROT_ASSERT_ARG(s))
475 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
476 /* HEADERIZER END: src/packfile/pf_items.c */
477 
478 /* HEADERIZER BEGIN: frontend/pbc_dump/packdump.c */
479 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
480 
481 void pf_const_dump(PARROT_INTERP, ARGIN(const PackFile_ConstTable *self))
482         __attribute__nonnull__(1)
483         __attribute__nonnull__(2);
484 
485 #define ASSERT_ARGS_pf_const_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
486        PARROT_ASSERT_ARG(interp) \
487     , PARROT_ASSERT_ARG(self))
488 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
489 /* HEADERIZER END: frontend/pbc_dump/packdump.c */
490 
491 /* HEADERIZER BEGIN: src/packfile/api.c */
492 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
493 
494 PARROT_EXPORT
495 PARROT_DEPRECATED
496 void do_sub_pragmas(PARROT_INTERP,
497     ARGIN(PMC *pfpmc),
498     pbc_action_enum_t action,
499     PMC *eval_pmc)
500         __attribute__nonnull__(1)
501         __attribute__nonnull__(2);
502 
503 PARROT_EXPORT
504 PARROT_DEPRECATED
505 void PackFile_Annotations_add_entry(PARROT_INTERP,
506     ARGMOD(PackFile_Annotations *self),
507     opcode_t offset,
508     opcode_t key,
509     opcode_t type,
510     opcode_t value)
511         __attribute__nonnull__(1)
512         __attribute__nonnull__(2)
513         FUNC_MODIFIES(*self);
514 
515 PARROT_EXPORT
516 PARROT_DEPRECATED
517 void PackFile_destroy(PARROT_INTERP, ARGMOD(PackFile *pf))
518         __attribute__nonnull__(1)
519         __attribute__nonnull__(2)
520         FUNC_MODIFIES(*pf);
521 
522 PARROT_EXPORT
523 PARROT_DEPRECATED
524 void PackFile_fixup_subs(PARROT_INTERP, pbc_action_enum_t what, PMC *eval)
525         __attribute__nonnull__(1);
526 
527 PARROT_EXPORT
528 PARROT_WARN_UNUSED_RESULT
529 PARROT_CANNOT_RETURN_NULL
530 PARROT_DEPRECATED
531 PackFile * PackFile_new(PARROT_INTERP, INTVAL is_mapped)
532         __attribute__nonnull__(1);
533 
534 PARROT_EXPORT
535 PARROT_WARN_UNUSED_RESULT
536 PARROT_DEPRECATED
537 opcode_t PackFile_unpack(PARROT_INTERP,
538     ARGMOD(PackFile *self),
539     ARGIN(const opcode_t *packed),
540     size_t packed_size)
541         __attribute__nonnull__(1)
542         __attribute__nonnull__(2)
543         __attribute__nonnull__(3)
544         FUNC_MODIFIES(*self);
545 
546 PARROT_EXPORT
547 PARROT_DEPRECATED
548 void Parrot_debug_add_mapping(PARROT_INTERP,
549     ARGMOD(PackFile_Debug *debug),
550     opcode_t offset,
551     ARGIN(STRING *filename))
552         __attribute__nonnull__(1)
553         __attribute__nonnull__(2)
554         __attribute__nonnull__(4)
555         FUNC_MODIFIES(*debug);
556 
557 PARROT_EXPORT
558 PARROT_WARN_UNUSED_RESULT
559 PARROT_CANNOT_RETURN_NULL
560 PARROT_DEPRECATED
561 STRING * Parrot_debug_pc_to_filename(PARROT_INTERP,
562     ARGIN(const PackFile_Debug *debug),
563     opcode_t pc)
564         __attribute__nonnull__(1)
565         __attribute__nonnull__(2);
566 
567 PARROT_EXPORT
568 void Parrot_load_bytecode(PARROT_INTERP,
569     ARGIN_NULLOK(Parrot_String file_str))
570         __attribute__nonnull__(1);
571 
572 PARROT_EXPORT
573 void Parrot_load_language(PARROT_INTERP, ARGIN_NULLOK(STRING *lang_name))
574         __attribute__nonnull__(1);
575 
576 PARROT_EXPORT
577 PARROT_WARN_UNUSED_RESULT
578 PARROT_CANNOT_RETURN_NULL
579 PARROT_DEPRECATED
580 PackFile_Debug * Parrot_new_debug_seg(PARROT_INTERP,
581     ARGMOD(PackFile_ByteCode *cs),
582     size_t size)
583         __attribute__nonnull__(1)
584         __attribute__nonnull__(2)
585         FUNC_MODIFIES(*cs);
586 
587 PARROT_EXPORT
588 void Parrot_pf_annotations_add_entry(PARROT_INTERP,
589     ARGMOD(PackFile_Annotations *self),
590     opcode_t offset,
591     opcode_t key,
592     opcode_t type,
593     opcode_t value)
594         __attribute__nonnull__(1)
595         __attribute__nonnull__(2)
596         FUNC_MODIFIES(*self);
597 
598 PARROT_EXPORT
599 PARROT_WARN_UNUSED_RESULT
600 PARROT_CANNOT_RETURN_NULL
601 PackFile_ByteCode * Parrot_pf_create_default_segments(PARROT_INTERP,
602     ARGIN(PMC * const pf_pmc),
603     ARGIN(STRING * file_name),
604     int add)
605         __attribute__nonnull__(1)
606         __attribute__nonnull__(2)
607         __attribute__nonnull__(3);
608 
609 PARROT_EXPORT
610 void Parrot_pf_debug_add_mapping(PARROT_INTERP,
611     ARGMOD(PackFile_Debug *debug),
612     opcode_t offset,
613     ARGIN(STRING *filename))
614         __attribute__nonnull__(1)
615         __attribute__nonnull__(2)
616         __attribute__nonnull__(4)
617         FUNC_MODIFIES(*debug);
618 
619 PARROT_EXPORT
620 PARROT_WARN_UNUSED_RESULT
621 PARROT_CANNOT_RETURN_NULL
622 STRING * Parrot_pf_debug_pc_to_filename(PARROT_INTERP,
623     ARGIN(const PackFile_Debug *debug),
624     opcode_t pc)
625         __attribute__nonnull__(1)
626         __attribute__nonnull__(2);
627 
628 PARROT_EXPORT
629 PARROT_CANNOT_RETURN_NULL
630 PackFile * Parrot_pf_deserialize(PARROT_INTERP, ARGIN(STRING *str))
631         __attribute__nonnull__(1)
632         __attribute__nonnull__(2);
633 
634 PARROT_EXPORT
635 void Parrot_pf_destroy(PARROT_INTERP, ARGMOD(PackFile *pf))
636         __attribute__nonnull__(1)
637         __attribute__nonnull__(2)
638         FUNC_MODIFIES(*pf);
639 
640 PARROT_EXPORT
641 void Parrot_pf_execute_bytecode_program(PARROT_INTERP,
642     ARGMOD(PMC *pbc),
643     ARGMOD(PMC *args))
644         __attribute__nonnull__(1)
645         __attribute__nonnull__(2)
646         __attribute__nonnull__(3)
647         FUNC_MODIFIES(*pbc)
648         FUNC_MODIFIES(*args);
649 
650 PARROT_EXPORT
651 void Parrot_pf_fixup_subs(PARROT_INTERP, pbc_action_enum_t what, PMC *eval)
652         __attribute__nonnull__(1);
653 
654 PARROT_EXPORT
655 PARROT_CANNOT_RETURN_NULL
656 PackFile_Annotations * Parrot_pf_get_annotations_segment(PARROT_INTERP,
657     ARGMOD(PackFile *pf),
658     ARGMOD_NULLOK(PackFile_ByteCode *bc))
659         __attribute__nonnull__(1)
660         __attribute__nonnull__(2)
661         FUNC_MODIFIES(*pf)
662         FUNC_MODIFIES(*bc);
663 
664 PARROT_EXPORT
665 PARROT_CANNOT_RETURN_NULL
666 PMC * Parrot_pf_get_packfile_pmc(PARROT_INTERP,
667     ARGIN(PackFile *pf),
668     ARGIN(STRING *path))
669         __attribute__nonnull__(1)
670         __attribute__nonnull__(2)
671         __attribute__nonnull__(3);
672 
673 PARROT_EXPORT
674 PARROT_CANNOT_RETURN_NULL
675 STRING * Parrot_pf_get_version_string(PARROT_INTERP, ARGIN(PMC * pbc))
676         __attribute__nonnull__(1)
677         __attribute__nonnull__(2);
678 
679 PARROT_EXPORT
680 PARROT_CANNOT_RETURN_NULL
681 PMC * Parrot_pf_load_bytecode_search(PARROT_INTERP, ARGIN(STRING *file))
682         __attribute__nonnull__(1)
683         __attribute__nonnull__(2);
684 
685 PARROT_EXPORT
686 PARROT_WARN_UNUSED_RESULT
687 PARROT_CANNOT_RETURN_NULL
688 PackFile * Parrot_pf_new(PARROT_INTERP, INTVAL is_mapped)
689         __attribute__nonnull__(1);
690 
691 PARROT_EXPORT
692 PARROT_WARN_UNUSED_RESULT
693 PARROT_CANNOT_RETURN_NULL
694 PackFile_Debug * Parrot_pf_new_debug_segment(PARROT_INTERP,
695     ARGMOD(PackFile_ByteCode *cs),
696     size_t size)
697         __attribute__nonnull__(1)
698         __attribute__nonnull__(2)
699         FUNC_MODIFIES(*cs);
700 
701 PARROT_EXPORT
702 void Parrot_pf_prepare_packfile_init(PARROT_INTERP,
703     ARGIN(PMC * const pfpmc))
704         __attribute__nonnull__(1)
705         __attribute__nonnull__(2);
706 
707 PARROT_EXPORT
708 void Parrot_pf_prepare_packfile_load(PARROT_INTERP,
709     ARGIN(PMC * const pfpmc))
710         __attribute__nonnull__(1)
711         __attribute__nonnull__(2);
712 
713 PARROT_EXPORT
714 PARROT_CANNOT_RETURN_NULL
715 PackFile * Parrot_pf_read_pbc_file(PARROT_INTERP,
716     ARGIN_NULLOK(STRING * const fullname))
717         __attribute__nonnull__(1);
718 
719 PARROT_EXPORT
720 PARROT_CANNOT_RETURN_NULL
721 STRING * Parrot_pf_serialize(PARROT_INTERP, ARGIN(PackFile * const pf))
722         __attribute__nonnull__(1)
723         __attribute__nonnull__(2);
724 
725 PARROT_EXPORT
726 INTVAL Parrot_pf_serialized_size(PARROT_INTERP, ARGMOD(PackFile *pf))
727         __attribute__nonnull__(1)
728         __attribute__nonnull__(2)
729         FUNC_MODIFIES(*pf);
730 
731 PARROT_EXPORT
732 void Parrot_pf_set_current_packfile(PARROT_INTERP, ARGIN(PMC *pbc))
733         __attribute__nonnull__(1)
734         __attribute__nonnull__(2);
735 
736 PARROT_EXPORT
737 PARROT_CANNOT_RETURN_NULL
738 PMC * Parrot_pf_single_sub_by_tag(PARROT_INTERP,
739     ARGIN(PMC * pfpmc),
740     ARGIN(STRING * flag))
741         __attribute__nonnull__(1)
742         __attribute__nonnull__(2)
743         __attribute__nonnull__(3);
744 
745 PARROT_EXPORT
746 PARROT_CANNOT_RETURN_NULL
747 PMC * Parrot_pf_subs_by_tag(PARROT_INTERP,
748     ARGIN(PMC * pfpmc),
749     ARGIN(STRING * flag))
750         __attribute__nonnull__(1)
751         __attribute__nonnull__(2)
752         __attribute__nonnull__(3);
753 
754 PARROT_EXPORT
755 PARROT_IGNORABLE_RESULT
756 PARROT_CANNOT_RETURN_NULL
757 PackFile_ByteCode * Parrot_pf_switch_to_cs(PARROT_INTERP,
758     ARGIN(PackFile_ByteCode *new_cs),
759     int really)
760         __attribute__nonnull__(1)
761         __attribute__nonnull__(2);
762 
763 PARROT_EXPORT
764 void Parrot_pf_tag_constant(PARROT_INTERP,
765     ARGIN(PackFile_ConstTable *ct),
766     const int tag_idx,
767     const int const_idx)
768         __attribute__nonnull__(1)
769         __attribute__nonnull__(2);
770 
771 PARROT_EXPORT
772 PARROT_WARN_UNUSED_RESULT
773 opcode_t Parrot_pf_unpack(PARROT_INTERP,
774     ARGMOD(PackFile *self),
775     ARGIN(const opcode_t *packed),
776     size_t packed_size)
777         __attribute__nonnull__(1)
778         __attribute__nonnull__(2)
779         __attribute__nonnull__(3)
780         FUNC_MODIFIES(*self);
781 
782 PARROT_EXPORT
783 void Parrot_pf_write_pbc_file(PARROT_INTERP,
784     ARGIN(PMC *pf_pmc),
785     ARGIN(STRING *filename))
786         __attribute__nonnull__(1)
787         __attribute__nonnull__(2)
788         __attribute__nonnull__(3);
789 
790 PARROT_EXPORT
791 PARROT_IGNORABLE_RESULT
792 PARROT_CANNOT_RETURN_NULL
793 PARROT_DEPRECATED
794 PackFile_ByteCode * Parrot_switch_to_cs(PARROT_INTERP,
795     ARGIN(PackFile_ByteCode *new_cs),
796     int really)
797         __attribute__nonnull__(1)
798         __attribute__nonnull__(2);
799 
800 PARROT_CANNOT_RETURN_NULL
801 PARROT_WARN_UNUSED_RESULT
802 PMC * Parrot_pf_all_subs(PARROT_INTERP, ARGIN(PMC *pfpmc))
803         __attribute__nonnull__(1)
804         __attribute__nonnull__(2);
805 
806 PARROT_CANNOT_RETURN_NULL
807 PARROT_WARN_UNUSED_RESULT
808 PMC * Parrot_pf_all_tagged_pmcs(PARROT_INTERP, ARGIN(PMC * pfpmc))
809         __attribute__nonnull__(1)
810         __attribute__nonnull__(2);
811 
812 PARROT_CANNOT_RETURN_NULL
813 PARROT_WARN_UNUSED_RESULT
814 PMC * Parrot_pf_all_tags_list(PARROT_INTERP, ARGIN(PMC * pfpmc))
815         __attribute__nonnull__(1)
816         __attribute__nonnull__(2);
817 
818 PARROT_CANNOT_RETURN_NULL
819 PMC * Parrot_pf_annotations_lookup(PARROT_INTERP,
820     ARGIN(PackFile_Annotations *self),
821     opcode_t offset,
822     ARGIN_NULLOK(STRING *name))
823         __attribute__nonnull__(1)
824         __attribute__nonnull__(2);
825 
826 PARROT_PURE_FUNCTION
827 PARROT_CAN_RETURN_NULL
828 PackFile_ByteCode * Parrot_pf_get_current_code_segment(PARROT_INTERP)
829         __attribute__nonnull__(1);
830 
831 PARROT_PURE_FUNCTION
832 PARROT_CANNOT_RETURN_NULL
833 PMC * Parrot_pf_get_current_packfile(PARROT_INTERP)
834         __attribute__nonnull__(1);
835 
836 PARROT_CANNOT_RETURN_NULL
837 PMC * Parrot_pf_get_packfile_main_sub(PARROT_INTERP, ARGIN(PMC * pbc))
838         __attribute__nonnull__(1)
839         __attribute__nonnull__(2);
840 
841 void Parrot_pf_mark_packfile(PARROT_INTERP, ARGMOD_NULLOK(PackFile * pf))
842         __attribute__nonnull__(1)
843         FUNC_MODIFIES(* pf);
844 
845 #define ASSERT_ARGS_do_sub_pragmas __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
846        PARROT_ASSERT_ARG(interp) \
847     , PARROT_ASSERT_ARG(pfpmc))
848 #define ASSERT_ARGS_PackFile_Annotations_add_entry \
849      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
850        PARROT_ASSERT_ARG(interp) \
851     , PARROT_ASSERT_ARG(self))
852 #define ASSERT_ARGS_PackFile_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
853        PARROT_ASSERT_ARG(interp) \
854     , PARROT_ASSERT_ARG(pf))
855 #define ASSERT_ARGS_PackFile_fixup_subs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
856        PARROT_ASSERT_ARG(interp))
857 #define ASSERT_ARGS_PackFile_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
858        PARROT_ASSERT_ARG(interp))
859 #define ASSERT_ARGS_PackFile_unpack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
860        PARROT_ASSERT_ARG(interp) \
861     , PARROT_ASSERT_ARG(self) \
862     , PARROT_ASSERT_ARG(packed))
863 #define ASSERT_ARGS_Parrot_debug_add_mapping __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
864        PARROT_ASSERT_ARG(interp) \
865     , PARROT_ASSERT_ARG(debug) \
866     , PARROT_ASSERT_ARG(filename))
867 #define ASSERT_ARGS_Parrot_debug_pc_to_filename __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
868        PARROT_ASSERT_ARG(interp) \
869     , PARROT_ASSERT_ARG(debug))
870 #define ASSERT_ARGS_Parrot_load_bytecode __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
871        PARROT_ASSERT_ARG(interp))
872 #define ASSERT_ARGS_Parrot_load_language __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
873        PARROT_ASSERT_ARG(interp))
874 #define ASSERT_ARGS_Parrot_new_debug_seg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
875        PARROT_ASSERT_ARG(interp) \
876     , PARROT_ASSERT_ARG(cs))
877 #define ASSERT_ARGS_Parrot_pf_annotations_add_entry \
878      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
879        PARROT_ASSERT_ARG(interp) \
880     , PARROT_ASSERT_ARG(self))
881 #define ASSERT_ARGS_Parrot_pf_create_default_segments \
882      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
883        PARROT_ASSERT_ARG(interp) \
884     , PARROT_ASSERT_ARG(pf_pmc) \
885     , PARROT_ASSERT_ARG(file_name))
886 #define ASSERT_ARGS_Parrot_pf_debug_add_mapping __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
887        PARROT_ASSERT_ARG(interp) \
888     , PARROT_ASSERT_ARG(debug) \
889     , PARROT_ASSERT_ARG(filename))
890 #define ASSERT_ARGS_Parrot_pf_debug_pc_to_filename \
891      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
892        PARROT_ASSERT_ARG(interp) \
893     , PARROT_ASSERT_ARG(debug))
894 #define ASSERT_ARGS_Parrot_pf_deserialize __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
895        PARROT_ASSERT_ARG(interp) \
896     , PARROT_ASSERT_ARG(str))
897 #define ASSERT_ARGS_Parrot_pf_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
898        PARROT_ASSERT_ARG(interp) \
899     , PARROT_ASSERT_ARG(pf))
900 #define ASSERT_ARGS_Parrot_pf_execute_bytecode_program \
901      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
902        PARROT_ASSERT_ARG(interp) \
903     , PARROT_ASSERT_ARG(pbc) \
904     , PARROT_ASSERT_ARG(args))
905 #define ASSERT_ARGS_Parrot_pf_fixup_subs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
906        PARROT_ASSERT_ARG(interp))
907 #define ASSERT_ARGS_Parrot_pf_get_annotations_segment \
908      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
909        PARROT_ASSERT_ARG(interp) \
910     , PARROT_ASSERT_ARG(pf))
911 #define ASSERT_ARGS_Parrot_pf_get_packfile_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
912        PARROT_ASSERT_ARG(interp) \
913     , PARROT_ASSERT_ARG(pf) \
914     , PARROT_ASSERT_ARG(path))
915 #define ASSERT_ARGS_Parrot_pf_get_version_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
916        PARROT_ASSERT_ARG(interp) \
917     , PARROT_ASSERT_ARG(pbc))
918 #define ASSERT_ARGS_Parrot_pf_load_bytecode_search \
919      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
920        PARROT_ASSERT_ARG(interp) \
921     , PARROT_ASSERT_ARG(file))
922 #define ASSERT_ARGS_Parrot_pf_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
923        PARROT_ASSERT_ARG(interp))
924 #define ASSERT_ARGS_Parrot_pf_new_debug_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
925        PARROT_ASSERT_ARG(interp) \
926     , PARROT_ASSERT_ARG(cs))
927 #define ASSERT_ARGS_Parrot_pf_prepare_packfile_init \
928      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
929        PARROT_ASSERT_ARG(interp) \
930     , PARROT_ASSERT_ARG(pfpmc))
931 #define ASSERT_ARGS_Parrot_pf_prepare_packfile_load \
932      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
933        PARROT_ASSERT_ARG(interp) \
934     , PARROT_ASSERT_ARG(pfpmc))
935 #define ASSERT_ARGS_Parrot_pf_read_pbc_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
936        PARROT_ASSERT_ARG(interp))
937 #define ASSERT_ARGS_Parrot_pf_serialize __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
938        PARROT_ASSERT_ARG(interp) \
939     , PARROT_ASSERT_ARG(pf))
940 #define ASSERT_ARGS_Parrot_pf_serialized_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
941        PARROT_ASSERT_ARG(interp) \
942     , PARROT_ASSERT_ARG(pf))
943 #define ASSERT_ARGS_Parrot_pf_set_current_packfile \
944      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
945        PARROT_ASSERT_ARG(interp) \
946     , PARROT_ASSERT_ARG(pbc))
947 #define ASSERT_ARGS_Parrot_pf_single_sub_by_tag __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
948        PARROT_ASSERT_ARG(interp) \
949     , PARROT_ASSERT_ARG(pfpmc) \
950     , PARROT_ASSERT_ARG(flag))
951 #define ASSERT_ARGS_Parrot_pf_subs_by_tag __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
952        PARROT_ASSERT_ARG(interp) \
953     , PARROT_ASSERT_ARG(pfpmc) \
954     , PARROT_ASSERT_ARG(flag))
955 #define ASSERT_ARGS_Parrot_pf_switch_to_cs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
956        PARROT_ASSERT_ARG(interp) \
957     , PARROT_ASSERT_ARG(new_cs))
958 #define ASSERT_ARGS_Parrot_pf_tag_constant __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
959        PARROT_ASSERT_ARG(interp) \
960     , PARROT_ASSERT_ARG(ct))
961 #define ASSERT_ARGS_Parrot_pf_unpack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
962        PARROT_ASSERT_ARG(interp) \
963     , PARROT_ASSERT_ARG(self) \
964     , PARROT_ASSERT_ARG(packed))
965 #define ASSERT_ARGS_Parrot_pf_write_pbc_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
966        PARROT_ASSERT_ARG(interp) \
967     , PARROT_ASSERT_ARG(pf_pmc) \
968     , PARROT_ASSERT_ARG(filename))
969 #define ASSERT_ARGS_Parrot_switch_to_cs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
970        PARROT_ASSERT_ARG(interp) \
971     , PARROT_ASSERT_ARG(new_cs))
972 #define ASSERT_ARGS_Parrot_pf_all_subs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
973        PARROT_ASSERT_ARG(interp) \
974     , PARROT_ASSERT_ARG(pfpmc))
975 #define ASSERT_ARGS_Parrot_pf_all_tagged_pmcs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
976        PARROT_ASSERT_ARG(interp) \
977     , PARROT_ASSERT_ARG(pfpmc))
978 #define ASSERT_ARGS_Parrot_pf_all_tags_list __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
979        PARROT_ASSERT_ARG(interp) \
980     , PARROT_ASSERT_ARG(pfpmc))
981 #define ASSERT_ARGS_Parrot_pf_annotations_lookup __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
982        PARROT_ASSERT_ARG(interp) \
983     , PARROT_ASSERT_ARG(self))
984 #define ASSERT_ARGS_Parrot_pf_get_current_code_segment \
985      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
986        PARROT_ASSERT_ARG(interp))
987 #define ASSERT_ARGS_Parrot_pf_get_current_packfile \
988      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
989        PARROT_ASSERT_ARG(interp))
990 #define ASSERT_ARGS_Parrot_pf_get_packfile_main_sub \
991      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
992        PARROT_ASSERT_ARG(interp) \
993     , PARROT_ASSERT_ARG(pbc))
994 #define ASSERT_ARGS_Parrot_pf_mark_packfile __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
995        PARROT_ASSERT_ARG(interp))
996 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
997 /* HEADERIZER END: src/packfile/api.c */
998 
999 /* HEADERIZER BEGIN: src/packfile/output.c */
1000 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
1001 
1002 PARROT_EXPORT
1003 PARROT_DEPRECATED
1004 PARROT_WARN_UNUSED_RESULT
1005 PARROT_CANNOT_RETURN_NULL
1006 opcode_t * PackFile_ConstTable_pack(PARROT_INTERP,
1007     ARGMOD(PackFile_Segment *seg),
1008     ARGOUT(opcode_t *cursor))
1009         __attribute__nonnull__(1)
1010         __attribute__nonnull__(2)
1011         __attribute__nonnull__(3)
1012         FUNC_MODIFIES(*seg)
1013         FUNC_MODIFIES(*cursor);
1014 
1015 PARROT_EXPORT
1016 PARROT_DEPRECATED
1017 size_t PackFile_ConstTable_pack_size(PARROT_INTERP,
1018     ARGMOD(PackFile_Segment *seg))
1019         __attribute__nonnull__(1)
1020         __attribute__nonnull__(2)
1021         FUNC_MODIFIES(*seg);
1022 
1023 PARROT_EXPORT
1024 PARROT_DEPRECATED
1025 int PackFile_ConstTable_rlookup_num(PARROT_INTERP,
1026     ARGIN(const PackFile_ConstTable *ct),
1027     FLOATVAL n)
1028         __attribute__nonnull__(2);
1029 
1030 PARROT_EXPORT
1031 PARROT_DEPRECATED
1032 int PackFile_ConstTable_rlookup_pmc(PARROT_INTERP,
1033     ARGIN(PackFile_ConstTable *ct),
1034     ARGIN(PMC *v),
1035     ARGOUT(INTVAL *constno),
1036     ARGOUT(INTVAL *idx))
1037         __attribute__nonnull__(1)
1038         __attribute__nonnull__(2)
1039         __attribute__nonnull__(3)
1040         __attribute__nonnull__(4)
1041         __attribute__nonnull__(5)
1042         FUNC_MODIFIES(*constno)
1043         FUNC_MODIFIES(*idx);
1044 
1045 PARROT_EXPORT
1046 PARROT_DEPRECATED
1047 int PackFile_ConstTable_rlookup_str(PARROT_INTERP,
1048     ARGIN(const PackFile_ConstTable *ct),
1049     ARGIN(STRING *s))
1050         __attribute__nonnull__(1)
1051         __attribute__nonnull__(2)
1052         __attribute__nonnull__(3);
1053 
1054 PARROT_EXPORT
1055 PARROT_DEPRECATED
1056 void PackFile_pack(PARROT_INTERP,
1057     ARGMOD(PackFile *self),
1058     ARGOUT(opcode_t *cursor))
1059         __attribute__nonnull__(1)
1060         __attribute__nonnull__(2)
1061         __attribute__nonnull__(3)
1062         FUNC_MODIFIES(*self)
1063         FUNC_MODIFIES(*cursor);
1064 
1065 PARROT_EXPORT
1066 PARROT_DEPRECATED
1067 size_t PackFile_pack_size(PARROT_INTERP, ARGMOD(PackFile *self))
1068         __attribute__nonnull__(1)
1069         __attribute__nonnull__(2)
1070         FUNC_MODIFIES(*self);
1071 
1072 PARROT_EXPORT
1073 PARROT_WARN_UNUSED_RESULT
1074 PARROT_CANNOT_RETURN_NULL
1075 opcode_t * Parrot_pf_ConstTable_pack(PARROT_INTERP,
1076     ARGMOD(PackFile_Segment *seg),
1077     ARGOUT(opcode_t *cursor))
1078         __attribute__nonnull__(1)
1079         __attribute__nonnull__(2)
1080         __attribute__nonnull__(3)
1081         FUNC_MODIFIES(*seg)
1082         FUNC_MODIFIES(*cursor);
1083 
1084 PARROT_EXPORT
1085 size_t Parrot_pf_ConstTable_pack_size(PARROT_INTERP,
1086     ARGMOD(PackFile_Segment *seg))
1087         __attribute__nonnull__(1)
1088         __attribute__nonnull__(2)
1089         FUNC_MODIFIES(*seg);
1090 
1091 PARROT_EXPORT
1092 int Parrot_pf_ConstTable_rlookup_num(PARROT_INTERP,
1093     ARGIN(const PackFile_ConstTable *ct),
1094     FLOATVAL n)
1095         __attribute__nonnull__(2);
1096 
1097 PARROT_EXPORT
1098 int Parrot_pf_ConstTable_rlookup_pmc(PARROT_INTERP,
1099     ARGIN(PackFile_ConstTable *ct),
1100     ARGIN(PMC *v),
1101     ARGOUT(INTVAL *constno),
1102     ARGOUT(INTVAL *idx))
1103         __attribute__nonnull__(1)
1104         __attribute__nonnull__(2)
1105         __attribute__nonnull__(3)
1106         __attribute__nonnull__(4)
1107         __attribute__nonnull__(5)
1108         FUNC_MODIFIES(*constno)
1109         FUNC_MODIFIES(*idx);
1110 
1111 PARROT_EXPORT
1112 int Parrot_pf_ConstTable_rlookup_str(PARROT_INTERP,
1113     ARGIN(const PackFile_ConstTable *ct),
1114     ARGIN(STRING *s))
1115         __attribute__nonnull__(1)
1116         __attribute__nonnull__(2)
1117         __attribute__nonnull__(3);
1118 
1119 PARROT_EXPORT
1120 void Parrot_pf_pack(PARROT_INTERP,
1121     ARGMOD(PackFile *self),
1122     ARGOUT(opcode_t *cursor))
1123         __attribute__nonnull__(1)
1124         __attribute__nonnull__(2)
1125         __attribute__nonnull__(3)
1126         FUNC_MODIFIES(*self)
1127         FUNC_MODIFIES(*cursor);
1128 
1129 PARROT_EXPORT
1130 size_t Parrot_pf_pack_size(PARROT_INTERP, ARGMOD(PackFile *self))
1131         __attribute__nonnull__(1)
1132         __attribute__nonnull__(2)
1133         FUNC_MODIFIES(*self);
1134 
1135 #define ASSERT_ARGS_PackFile_ConstTable_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1136        PARROT_ASSERT_ARG(interp) \
1137     , PARROT_ASSERT_ARG(seg) \
1138     , PARROT_ASSERT_ARG(cursor))
1139 #define ASSERT_ARGS_PackFile_ConstTable_pack_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1140        PARROT_ASSERT_ARG(interp) \
1141     , PARROT_ASSERT_ARG(seg))
1142 #define ASSERT_ARGS_PackFile_ConstTable_rlookup_num \
1143      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1144        PARROT_ASSERT_ARG(ct))
1145 #define ASSERT_ARGS_PackFile_ConstTable_rlookup_pmc \
1146      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1147        PARROT_ASSERT_ARG(interp) \
1148     , PARROT_ASSERT_ARG(ct) \
1149     , PARROT_ASSERT_ARG(v) \
1150     , PARROT_ASSERT_ARG(constno) \
1151     , PARROT_ASSERT_ARG(idx))
1152 #define ASSERT_ARGS_PackFile_ConstTable_rlookup_str \
1153      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1154        PARROT_ASSERT_ARG(interp) \
1155     , PARROT_ASSERT_ARG(ct) \
1156     , PARROT_ASSERT_ARG(s))
1157 #define ASSERT_ARGS_PackFile_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1158        PARROT_ASSERT_ARG(interp) \
1159     , PARROT_ASSERT_ARG(self) \
1160     , PARROT_ASSERT_ARG(cursor))
1161 #define ASSERT_ARGS_PackFile_pack_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1162        PARROT_ASSERT_ARG(interp) \
1163     , PARROT_ASSERT_ARG(self))
1164 #define ASSERT_ARGS_Parrot_pf_ConstTable_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1165        PARROT_ASSERT_ARG(interp) \
1166     , PARROT_ASSERT_ARG(seg) \
1167     , PARROT_ASSERT_ARG(cursor))
1168 #define ASSERT_ARGS_Parrot_pf_ConstTable_pack_size \
1169      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1170        PARROT_ASSERT_ARG(interp) \
1171     , PARROT_ASSERT_ARG(seg))
1172 #define ASSERT_ARGS_Parrot_pf_ConstTable_rlookup_num \
1173      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1174        PARROT_ASSERT_ARG(ct))
1175 #define ASSERT_ARGS_Parrot_pf_ConstTable_rlookup_pmc \
1176      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1177        PARROT_ASSERT_ARG(interp) \
1178     , PARROT_ASSERT_ARG(ct) \
1179     , PARROT_ASSERT_ARG(v) \
1180     , PARROT_ASSERT_ARG(constno) \
1181     , PARROT_ASSERT_ARG(idx))
1182 #define ASSERT_ARGS_Parrot_pf_ConstTable_rlookup_str \
1183      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1184        PARROT_ASSERT_ARG(interp) \
1185     , PARROT_ASSERT_ARG(ct) \
1186     , PARROT_ASSERT_ARG(s))
1187 #define ASSERT_ARGS_Parrot_pf_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1188        PARROT_ASSERT_ARG(interp) \
1189     , PARROT_ASSERT_ARG(self) \
1190     , PARROT_ASSERT_ARG(cursor))
1191 #define ASSERT_ARGS_Parrot_pf_pack_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1192        PARROT_ASSERT_ARG(interp) \
1193     , PARROT_ASSERT_ARG(self))
1194 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
1195 /* HEADERIZER END: src/packfile/output.c */
1196 
1197 /* HEADERIZER BEGIN: src/packfile/segments.c */
1198 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
1199 
1200 PARROT_EXPORT
1201 PARROT_DEPRECATED
1202 void PackFile_add_segment(PARROT_INTERP,
1203     ARGMOD(PackFile_Directory *dir),
1204     ARGMOD(PackFile_Segment *seg))
1205         __attribute__nonnull__(1)
1206         __attribute__nonnull__(2)
1207         __attribute__nonnull__(3)
1208         FUNC_MODIFIES(*dir)
1209         FUNC_MODIFIES(*seg);
1210 
1211 PARROT_EXPORT
1212 PARROT_WARN_UNUSED_RESULT
1213 PARROT_CAN_RETURN_NULL
1214 PARROT_DEPRECATED
1215 PackFile_Segment * PackFile_find_segment(PARROT_INTERP,
1216     ARGIN_NULLOK(PackFile_Directory *dir),
1217     ARGIN(const STRING *name),
1218     int sub_dir)
1219         __attribute__nonnull__(1)
1220         __attribute__nonnull__(3);
1221 
1222 PARROT_EXPORT
1223 PARROT_DEPRECATED
1224 INTVAL PackFile_map_segments(PARROT_INTERP,
1225     ARGIN(const PackFile_Directory *dir),
1226     PackFile_map_segments_func_t callback,
1227     ARGIN_NULLOK(void *user_data))
1228         __attribute__nonnull__(1)
1229         __attribute__nonnull__(2);
1230 
1231 PARROT_EXPORT
1232 PARROT_DEPRECATED
1233 void PackFile_Segment_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
1234         __attribute__nonnull__(1)
1235         __attribute__nonnull__(2)
1236         FUNC_MODIFIES(*self);
1237 
1238 PARROT_EXPORT
1239 PARROT_DEPRECATED
1240 void PackFile_Segment_dump(PARROT_INTERP,
1241     ARGIN(const PackFile_Segment *self))
1242         __attribute__nonnull__(1)
1243         __attribute__nonnull__(2);
1244 
1245 PARROT_EXPORT
1246 PARROT_DEPRECATED
1247 PARROT_WARN_UNUSED_RESULT
1248 PARROT_CANNOT_RETURN_NULL
1249 PackFile_Segment * PackFile_Segment_new(PARROT_INTERP)
1250         __attribute__nonnull__(1);
1251 
1252 PARROT_EXPORT
1253 PARROT_DEPRECATED
1254 PARROT_WARN_UNUSED_RESULT
1255 PARROT_CANNOT_RETURN_NULL
1256 PackFile_Segment * PackFile_Segment_new_seg(PARROT_INTERP,
1257     ARGMOD(PackFile_Directory *dir),
1258     UINTVAL type,
1259     ARGIN(STRING *name),
1260     int add)
1261         __attribute__nonnull__(1)
1262         __attribute__nonnull__(2)
1263         __attribute__nonnull__(4)
1264         FUNC_MODIFIES(*dir);
1265 
1266 PARROT_EXPORT
1267 PARROT_DEPRECATED
1268 PARROT_WARN_UNUSED_RESULT
1269 PARROT_CANNOT_RETURN_NULL
1270 opcode_t * PackFile_Segment_pack(PARROT_INTERP,
1271     ARGIN(PackFile_Segment *self),
1272     ARGIN(opcode_t *cursor))
1273         __attribute__nonnull__(1)
1274         __attribute__nonnull__(2)
1275         __attribute__nonnull__(3);
1276 
1277 PARROT_EXPORT
1278 PARROT_DEPRECATED
1279 size_t PackFile_Segment_packed_size(PARROT_INTERP,
1280     ARGIN(PackFile_Segment *self))
1281         __attribute__nonnull__(1)
1282         __attribute__nonnull__(2);
1283 
1284 PARROT_EXPORT
1285 PARROT_DEPRECATED
1286 PARROT_WARN_UNUSED_RESULT
1287 PARROT_CAN_RETURN_NULL
1288 const opcode_t * PackFile_Segment_unpack(PARROT_INTERP,
1289     ARGMOD(PackFile_Segment *self),
1290     ARGIN(const opcode_t *cursor))
1291         __attribute__nonnull__(1)
1292         __attribute__nonnull__(2)
1293         __attribute__nonnull__(3)
1294         FUNC_MODIFIES(*self);
1295 
1296 PARROT_EXPORT
1297 void Parrot_pf_add_segment(PARROT_INTERP,
1298     ARGMOD(PackFile_Directory *dir),
1299     ARGMOD(PackFile_Segment *seg))
1300         __attribute__nonnull__(1)
1301         __attribute__nonnull__(2)
1302         __attribute__nonnull__(3)
1303         FUNC_MODIFIES(*dir)
1304         FUNC_MODIFIES(*seg);
1305 
1306 PARROT_EXPORT
1307 void Parrot_pf_destroy_segment(PARROT_INTERP,
1308     ARGMOD(PackFile_Segment *self))
1309         __attribute__nonnull__(1)
1310         __attribute__nonnull__(2)
1311         FUNC_MODIFIES(*self);
1312 
1313 PARROT_EXPORT
1314 void Parrot_pf_dump_segment(PARROT_INTERP,
1315     ARGIN(const PackFile_Segment *self))
1316         __attribute__nonnull__(1)
1317         __attribute__nonnull__(2);
1318 
1319 PARROT_EXPORT
1320 PARROT_WARN_UNUSED_RESULT
1321 PARROT_CAN_RETURN_NULL
1322 PackFile_Segment * Parrot_pf_find_segment(PARROT_INTERP,
1323     ARGIN_NULLOK(PackFile_Directory *dir),
1324     ARGIN(const STRING *name),
1325     int sub_dir)
1326         __attribute__nonnull__(1)
1327         __attribute__nonnull__(3);
1328 
1329 PARROT_EXPORT
1330 INTVAL Parrot_pf_map_segments(PARROT_INTERP,
1331     ARGIN(const PackFile_Directory *dir),
1332     PackFile_map_segments_func_t callback,
1333     ARGIN_NULLOK(void *user_data))
1334         __attribute__nonnull__(1)
1335         __attribute__nonnull__(2);
1336 
1337 PARROT_EXPORT
1338 PARROT_WARN_UNUSED_RESULT
1339 PARROT_CANNOT_RETURN_NULL
1340 PackFile_Segment * Parrot_pf_new_segment(PARROT_INTERP,
1341     ARGMOD(PackFile_Directory *dir),
1342     UINTVAL type,
1343     ARGIN(STRING *name),
1344     int add)
1345         __attribute__nonnull__(1)
1346         __attribute__nonnull__(2)
1347         __attribute__nonnull__(4)
1348         FUNC_MODIFIES(*dir);
1349 
1350 void default_dump_header(PARROT_INTERP, ARGIN(const PackFile_Segment *self))
1351         __attribute__nonnull__(1)
1352         __attribute__nonnull__(2);
1353 
1354 void pf_register_standard_funcs(ARGMOD(PackFile *pf))
1355         __attribute__nonnull__(1)
1356         FUNC_MODIFIES(*pf);
1357 
1358 PARROT_WARN_UNUSED_RESULT
1359 PARROT_CANNOT_RETURN_NULL
1360 opcode_t * pf_segment_pack(PARROT_INTERP,
1361     ARGIN(PackFile_Segment *self),
1362     ARGIN(opcode_t *cursor))
1363         __attribute__nonnull__(1)
1364         __attribute__nonnull__(2)
1365         __attribute__nonnull__(3);
1366 
1367 size_t pf_segment_packed_size(PARROT_INTERP, ARGIN(PackFile_Segment *self))
1368         __attribute__nonnull__(1)
1369         __attribute__nonnull__(2);
1370 
1371 PARROT_WARN_UNUSED_RESULT
1372 PARROT_CAN_RETURN_NULL
1373 const opcode_t * pf_segment_unpack(PARROT_INTERP,
1374     ARGMOD(PackFile_Segment *self),
1375     ARGIN(const opcode_t *cursor))
1376         __attribute__nonnull__(1)
1377         __attribute__nonnull__(2)
1378         __attribute__nonnull__(3)
1379         FUNC_MODIFIES(*self);
1380 
1381 #define ASSERT_ARGS_PackFile_add_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1382        PARROT_ASSERT_ARG(interp) \
1383     , PARROT_ASSERT_ARG(dir) \
1384     , PARROT_ASSERT_ARG(seg))
1385 #define ASSERT_ARGS_PackFile_find_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1386        PARROT_ASSERT_ARG(interp) \
1387     , PARROT_ASSERT_ARG(name))
1388 #define ASSERT_ARGS_PackFile_map_segments __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1389        PARROT_ASSERT_ARG(interp) \
1390     , PARROT_ASSERT_ARG(dir))
1391 #define ASSERT_ARGS_PackFile_Segment_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1392        PARROT_ASSERT_ARG(interp) \
1393     , PARROT_ASSERT_ARG(self))
1394 #define ASSERT_ARGS_PackFile_Segment_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1395        PARROT_ASSERT_ARG(interp) \
1396     , PARROT_ASSERT_ARG(self))
1397 #define ASSERT_ARGS_PackFile_Segment_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1398        PARROT_ASSERT_ARG(interp))
1399 #define ASSERT_ARGS_PackFile_Segment_new_seg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1400        PARROT_ASSERT_ARG(interp) \
1401     , PARROT_ASSERT_ARG(dir) \
1402     , PARROT_ASSERT_ARG(name))
1403 #define ASSERT_ARGS_PackFile_Segment_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1404        PARROT_ASSERT_ARG(interp) \
1405     , PARROT_ASSERT_ARG(self) \
1406     , PARROT_ASSERT_ARG(cursor))
1407 #define ASSERT_ARGS_PackFile_Segment_packed_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1408        PARROT_ASSERT_ARG(interp) \
1409     , PARROT_ASSERT_ARG(self))
1410 #define ASSERT_ARGS_PackFile_Segment_unpack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1411        PARROT_ASSERT_ARG(interp) \
1412     , PARROT_ASSERT_ARG(self) \
1413     , PARROT_ASSERT_ARG(cursor))
1414 #define ASSERT_ARGS_Parrot_pf_add_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1415        PARROT_ASSERT_ARG(interp) \
1416     , PARROT_ASSERT_ARG(dir) \
1417     , PARROT_ASSERT_ARG(seg))
1418 #define ASSERT_ARGS_Parrot_pf_destroy_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1419        PARROT_ASSERT_ARG(interp) \
1420     , PARROT_ASSERT_ARG(self))
1421 #define ASSERT_ARGS_Parrot_pf_dump_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1422        PARROT_ASSERT_ARG(interp) \
1423     , PARROT_ASSERT_ARG(self))
1424 #define ASSERT_ARGS_Parrot_pf_find_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1425        PARROT_ASSERT_ARG(interp) \
1426     , PARROT_ASSERT_ARG(name))
1427 #define ASSERT_ARGS_Parrot_pf_map_segments __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1428        PARROT_ASSERT_ARG(interp) \
1429     , PARROT_ASSERT_ARG(dir))
1430 #define ASSERT_ARGS_Parrot_pf_new_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1431        PARROT_ASSERT_ARG(interp) \
1432     , PARROT_ASSERT_ARG(dir) \
1433     , PARROT_ASSERT_ARG(name))
1434 #define ASSERT_ARGS_default_dump_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1435        PARROT_ASSERT_ARG(interp) \
1436     , PARROT_ASSERT_ARG(self))
1437 #define ASSERT_ARGS_pf_register_standard_funcs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1438        PARROT_ASSERT_ARG(pf))
1439 #define ASSERT_ARGS_pf_segment_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1440        PARROT_ASSERT_ARG(interp) \
1441     , PARROT_ASSERT_ARG(self) \
1442     , PARROT_ASSERT_ARG(cursor))
1443 #define ASSERT_ARGS_pf_segment_packed_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1444        PARROT_ASSERT_ARG(interp) \
1445     , PARROT_ASSERT_ARG(self))
1446 #define ASSERT_ARGS_pf_segment_unpack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
1447        PARROT_ASSERT_ARG(interp) \
1448     , PARROT_ASSERT_ARG(self) \
1449     , PARROT_ASSERT_ARG(cursor))
1450 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
1451 /* HEADERIZER END: src/packfile/segments.c */
1452 
1453 
1454 #endif /* PARROT_PACKFILE_H_GUARD */
1455 
1456 /*
1457  * Local variables:
1458  *   c-file-style: "parrot"
1459  * End:
1460  * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
1461  */
1462