1 /* enums.h
2  *  Copyright (C) 2001-2008, Parrot Foundation.
3  *  Overview:
4  *     enums shared by much of the stack-handling code
5  *  Data Structure and Algorithms:
6  *  History:
7  *  Notes:
8  *  References:
9  */
10 
11 #ifndef PARROT_ENUMS_H_GUARD
12 #define PARROT_ENUMS_H_GUARD
13 
14 typedef enum {
15     NO_STACK_ENTRY_TYPE     = 0,
16     STACK_ENTRY_MARK        = 1,
17     STACK_ENTRY_DESTINATION = 2,
18     STACK_ENTRY_ACTION      = 3,
19     STACK_ENTRY_PMC         = 4
20 } Stack_entry_type;
21 
22 typedef enum {
23     NO_STACK_ENTRY_FLAGS     = 0,
24     STACK_ENTRY_CLEANUP_FLAG = 1 << 0
25 } Stack_entry_flags;
26 
27 typedef enum {
28     NO_STACK_CHUNK_FLAGS     = 0,
29     STACK_CHUNK_COW_FLAG     = 1 << 0
30 } Stack_chunk_flags;
31 
32 
33 /* &gen_from_enum(iterator.pasm) */
34 typedef enum {
35     ITERATE_FROM_START,
36     ITERATE_FROM_START_KEYS,
37     ITERATE_GET_NEXT,
38     ITERATE_GET_PREV,
39     ITERATE_FROM_END
40 } Iterator_action_t;
41 
42 /* &end_gen */
43 
44 /* &gen_from_enum(call_bits.pasm lib/Parrot/Pmc2c/PCCMETHOD_BITS.pm) */
45 typedef enum {
46     /* 4 low bits are argument types */
47     PARROT_ARG_INTVAL           = 0x0000,  /* 0 */
48     PARROT_ARG_STRING           = 0x0001,  /* 1 */
49     PARROT_ARG_PMC              = 0x0002,  /* 2 */
50     PARROT_ARG_FLOATVAL         = 0x0003,  /* 3 */
51     PARROT_ARG_TYPE_MASK        = 0x000f,
52     /* argument meaning and conversion bits */
53     PARROT_ARG_CONSTANT         = 0x0010,  /* 16 */
54     /* bits a user has to define */
55     PARROT_ARG_FLATTEN          = 0x0020,       /* .flatten_arg */
56     PARROT_ARG_SLURPY_ARRAY     = PARROT_ARG_FLATTEN,  /* i.e. foldup  */
57     /* unused - 0x040 */
58     PARROT_ARG_OPTIONAL         = 0x0080, /* 128 */
59     PARROT_ARG_OPT_FLAG         = 0x0100, /* 256 prev optional was set */
60     PARROT_ARG_NAME             = 0x0200, /* 512 this String is an arg name */
61     PARROT_ARG_LOOKAHEAD        = 0x0400, /* 1024 this is a lookahead argument */
62     PARROT_ARG_INVOCANT         = 0x0800,  /* 2048 this PMC is an invocant */
63     PARROT_ARG_CALL_SIG         = 0x1000
64     /* more to come soon */
65 
66 } Call_bits_enum_t;
67 
68 /* &end_gen */
69 
70 #define PARROT_ARG_INTVAL_ISSET(o)        ((o) & PARROT_ARG_INTVAL)
71 #define PARROT_ARG_STRING_ISSET(o)        ((o) & PARROT_ARG_STRING)
72 #define PARROT_ARG_PMC_ISSET(o)           ((o) & PARROT_ARG_PMC)
73 #define PARROT_ARG_FLOATVAL_ISSET(o)      ((o) & PARROT_ARG_FLOATVAL)
74 #define PARROT_ARG_TYPE_MASK_MASK(o)      ((o) & PARROT_ARG_TYPE_MASK)
75 #define PARROT_ARG_TYPE(o)                PARROT_ARG_TYPE_MASK_MASK(o)
76 #define PARROT_ARG_CONSTANT_ISSET(o)      ((o) & PARROT_ARG_CONSTANT)
77 #define PARROT_ARG_FLATTEN_ISSET(o)       ((o) & PARROT_ARG_FLATTEN)
78 #define PARROT_ARG_SLURPY_ARRAY_ISSET(o)  ((o) & PARROT_ARG_SLURPY_ARRAY)
79 #define PARROT_ARG_OPTIONAL_ISSET(o)      ((o) & PARROT_ARG_OPTIONAL)
80 #define PARROT_ARG_OPT_FLAG_ISSET(o)      ((o) & PARROT_ARG_OPT_FLAG)
81 #define PARROT_ARG_NAME_ISSET(o)          ((o) & PARROT_ARG_NAME)
82 #define PARROT_ARG_INVOCANT_ISSET(o)      ((o) & PARROT_ARG_INVOCANT)
83 
84 
85 #endif /* PARROT_ENUMS_H_GUARD */
86 
87 /*
88  * Local variables:
89  *   c-file-style: "parrot"
90  * End:
91  * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
92  */
93