OILS / _gen / asdl / examples / demo_lib.asdl.h View on Github | oilshell.org

156 lines, 96 significant
1// _gen/asdl/examples/demo_lib.asdl.h is generated by asdl_main.py
2
3#ifndef DEMO_LIB_ASDL
4#define DEMO_LIB_ASDL
5
6#include <cstdint>
7
8#include "mycpp/runtime.h"
9#include "_gen/asdl/hnode.asdl.h"
10using hnode_asdl::hnode_t;
11
12namespace demo_lib_asdl {
13
14// use struct instead of namespace so 'using' works consistently
15#define ASDL_NAMES struct
16
17class value_t;
18class t2;
19class t3;
20class t4;
21
22ASDL_NAMES value_e {
23 enum no_name {
24 Str = 1,
25 Array = 2,
26 };
27};
28
29BigStr* value_str(int tag, bool dot = true);
30
31class value_t {
32 protected:
33 value_t() {
34 }
35 public:
36 int tag() const {
37 return ObjHeader::FromObject(this)->type_tag;
38 }
39 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
40 DISALLOW_COPY_AND_ASSIGN(value_t)
41};
42
43class value__Str : public value_t {
44 public:
45 value__Str() {}
46
47 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
48
49 static constexpr ObjHeader obj_header() {
50 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Str), 0);
51 }
52
53
54 DISALLOW_COPY_AND_ASSIGN(value__Str)
55};
56
57class value__Array : public value_t {
58 public:
59 value__Array(int a)
60 : a(a) {
61 }
62
63 static value__Array* CreateNull(bool alloc_lists = false) {
64 return Alloc<value__Array>(-1);
65 }
66
67 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
68
69 static constexpr ObjHeader obj_header() {
70 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Array), 0);
71 }
72
73 int a;
74
75 DISALLOW_COPY_AND_ASSIGN(value__Array)
76};
77
78extern GcGlobal<value__Str> gvalue__Str;
79ASDL_NAMES value {
80 static value__Str* Str;
81 typedef value__Array Array;
82};
83
84class t2 {
85 public:
86 t2(int a, int b)
87 : a(a),
88 b(b) {
89 }
90
91 static t2* CreateNull(bool alloc_lists = false) {
92 return Alloc<t2>(-1, -1);
93 }
94
95 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
96
97 static constexpr ObjHeader obj_header() {
98 return ObjHeader::AsdlClass(64, 0);
99 }
100
101 int a;
102 int b;
103
104 DISALLOW_COPY_AND_ASSIGN(t2)
105};
106
107class t3 {
108 public:
109 t3(int a, int b)
110 : a(a),
111 b(b) {
112 }
113
114 static t3* CreateNull(bool alloc_lists = false) {
115 return Alloc<t3>(-1, -1);
116 }
117
118 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
119
120 static constexpr ObjHeader obj_header() {
121 return ObjHeader::AsdlClass(65, 0);
122 }
123
124 int a;
125 int b;
126
127 DISALLOW_COPY_AND_ASSIGN(t3)
128};
129
130class t4 {
131 public:
132 t4(int a, int b)
133 : a(a),
134 b(b) {
135 }
136
137 static t4* CreateNull(bool alloc_lists = false) {
138 return Alloc<t4>(-1, -1);
139 }
140
141 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
142
143 static constexpr ObjHeader obj_header() {
144 return ObjHeader::AsdlClass(66, 0);
145 }
146
147 int a;
148 int b;
149
150 DISALLOW_COPY_AND_ASSIGN(t4)
151};
152
153
154} // namespace demo_lib_asdl
155
156#endif // DEMO_LIB_ASDL