/home/mdboom/Work/builds/cpython/Include/internal/pycore_global_strings.h
Line | Count | Source |
1 | #ifndef Py_INTERNAL_GLOBAL_STRINGS_H |
2 | #define Py_INTERNAL_GLOBAL_STRINGS_H |
3 | #ifdef __cplusplus |
4 | extern "C" { |
5 | #endif |
6 | |
7 | #ifndef Py_BUILD_CORE |
8 | # error "this header requires Py_BUILD_CORE define" |
9 | #endif |
10 | |
11 | // The data structure & init here are inspired by Tools/scripts/deepfreeze.py. |
12 | |
13 | // All field names generated by ASCII_STR() have a common prefix, |
14 | // to help avoid collisions with keywords, etc. |
15 | |
16 | #define STRUCT_FOR_ASCII_STR(LITERAL) \ |
17 | struct { \ |
18 | PyASCIIObject _ascii; \ |
19 | uint8_t _data[sizeof(LITERAL)]; \ |
20 | } |
21 | #define STRUCT_FOR_STR(NAME, LITERAL) \ |
22 | STRUCT_FOR_ASCII_STR(LITERAL) _ ## NAME; |
23 | #define STRUCT_FOR_ID(NAME) \ |
24 | STRUCT_FOR_ASCII_STR(#NAME) _ ## NAME; |
25 | |
26 | // XXX Order by frequency of use? |
27 | |
28 | /* The following is auto-generated by Tools/scripts/generate_global_objects.py. */ |
29 | struct _Py_global_strings { |
30 | struct { |
31 | STRUCT_FOR_STR(anon_dictcomp, "<dictcomp>") |
32 | STRUCT_FOR_STR(anon_genexpr, "<genexpr>") |
33 | STRUCT_FOR_STR(anon_lambda, "<lambda>") |
34 | STRUCT_FOR_STR(anon_listcomp, "<listcomp>") |
35 | STRUCT_FOR_STR(anon_module, "<module>") |
36 | STRUCT_FOR_STR(anon_setcomp, "<setcomp>") |
37 | STRUCT_FOR_STR(anon_string, "<string>") |
38 | STRUCT_FOR_STR(anon_unknown, "<unknown>") |
39 | STRUCT_FOR_STR(close_br, "}") |
40 | STRUCT_FOR_STR(comma_sep, ", ") |
41 | STRUCT_FOR_STR(dbl_close_br, "}}") |
42 | STRUCT_FOR_STR(dbl_open_br, "{{") |
43 | STRUCT_FOR_STR(dbl_percent, "%%") |
44 | STRUCT_FOR_STR(dot, ".") |
45 | STRUCT_FOR_STR(dot_locals, ".<locals>") |
46 | STRUCT_FOR_STR(empty, "") |
47 | STRUCT_FOR_STR(list_err, "list index out of range") |
48 | STRUCT_FOR_STR(newline, "\n") |
49 | STRUCT_FOR_STR(open_br, "{") |
50 | STRUCT_FOR_STR(percent, "%") |
51 | STRUCT_FOR_STR(utf_8, "utf-8") |
52 | } literals; |
53 | |
54 | struct { |
55 | STRUCT_FOR_ID(False) |
56 | STRUCT_FOR_ID(Py_Repr) |
57 | STRUCT_FOR_ID(TextIOWrapper) |
58 | STRUCT_FOR_ID(True) |
59 | STRUCT_FOR_ID(WarningMessage) |
60 | STRUCT_FOR_ID(_) |
61 | STRUCT_FOR_ID(__IOBase_closed) |
62 | STRUCT_FOR_ID(__abc_tpflags__) |
63 | STRUCT_FOR_ID(__abs__) |
64 | STRUCT_FOR_ID(__abstractmethods__) |
65 | STRUCT_FOR_ID(__add__) |
66 | STRUCT_FOR_ID(__aenter__) |
67 | STRUCT_FOR_ID(__aexit__) |
68 | STRUCT_FOR_ID(__aiter__) |
69 | STRUCT_FOR_ID(__all__) |
70 | STRUCT_FOR_ID(__and__) |
71 | STRUCT_FOR_ID(__anext__) |
72 | STRUCT_FOR_ID(__annotations__) |
73 | STRUCT_FOR_ID(__args__) |
74 | STRUCT_FOR_ID(__await__) |
75 | STRUCT_FOR_ID(__bases__) |
76 | STRUCT_FOR_ID(__bool__) |
77 | STRUCT_FOR_ID(__build_class__) |
78 | STRUCT_FOR_ID(__builtins__) |
79 | STRUCT_FOR_ID(__bytes__) |
80 | STRUCT_FOR_ID(__call__) |
81 | STRUCT_FOR_ID(__cantrace__) |
82 | STRUCT_FOR_ID(__class__) |
83 | STRUCT_FOR_ID(__class_getitem__) |
84 | STRUCT_FOR_ID(__classcell__) |
85 | STRUCT_FOR_ID(__complex__) |
86 | STRUCT_FOR_ID(__contains__) |
87 | STRUCT_FOR_ID(__copy__) |
88 | STRUCT_FOR_ID(__del__) |
89 | STRUCT_FOR_ID(__delattr__) |
90 | STRUCT_FOR_ID(__delete__) |
91 | STRUCT_FOR_ID(__delitem__) |
92 | STRUCT_FOR_ID(__dict__) |
93 | STRUCT_FOR_ID(__dictoffset__) |
94 | STRUCT_FOR_ID(__dir__) |
95 | STRUCT_FOR_ID(__divmod__) |
96 | STRUCT_FOR_ID(__doc__) |
97 | STRUCT_FOR_ID(__enter__) |
98 | STRUCT_FOR_ID(__eq__) |
99 | STRUCT_FOR_ID(__exit__) |
100 | STRUCT_FOR_ID(__file__) |
101 | STRUCT_FOR_ID(__float__) |
102 | STRUCT_FOR_ID(__floordiv__) |
103 | STRUCT_FOR_ID(__format__) |
104 | STRUCT_FOR_ID(__fspath__) |
105 | STRUCT_FOR_ID(__ge__) |
106 | STRUCT_FOR_ID(__get__) |
107 | STRUCT_FOR_ID(__getattr__) |
108 | STRUCT_FOR_ID(__getattribute__) |
109 | STRUCT_FOR_ID(__getinitargs__) |
110 | STRUCT_FOR_ID(__getitem__) |
111 | STRUCT_FOR_ID(__getnewargs__) |
112 | STRUCT_FOR_ID(__getnewargs_ex__) |
113 | STRUCT_FOR_ID(__getstate__) |
114 | STRUCT_FOR_ID(__gt__) |
115 | STRUCT_FOR_ID(__hash__) |
116 | STRUCT_FOR_ID(__iadd__) |
117 | STRUCT_FOR_ID(__iand__) |
118 | STRUCT_FOR_ID(__ifloordiv__) |
119 | STRUCT_FOR_ID(__ilshift__) |
120 | STRUCT_FOR_ID(__imatmul__) |
121 | STRUCT_FOR_ID(__imod__) |
122 | STRUCT_FOR_ID(__import__) |
123 | STRUCT_FOR_ID(__imul__) |
124 | STRUCT_FOR_ID(__index__) |
125 | STRUCT_FOR_ID(__init__) |
126 | STRUCT_FOR_ID(__init_subclass__) |
127 | STRUCT_FOR_ID(__instancecheck__) |
128 | STRUCT_FOR_ID(__int__) |
129 | STRUCT_FOR_ID(__invert__) |
130 | STRUCT_FOR_ID(__ior__) |
131 | STRUCT_FOR_ID(__ipow__) |
132 | STRUCT_FOR_ID(__irshift__) |
133 | STRUCT_FOR_ID(__isabstractmethod__) |
134 | STRUCT_FOR_ID(__isub__) |
135 | STRUCT_FOR_ID(__iter__) |
136 | STRUCT_FOR_ID(__itruediv__) |
137 | STRUCT_FOR_ID(__ixor__) |
138 | STRUCT_FOR_ID(__le__) |
139 | STRUCT_FOR_ID(__len__) |
140 | STRUCT_FOR_ID(__length_hint__) |
141 | STRUCT_FOR_ID(__lltrace__) |
142 | STRUCT_FOR_ID(__loader__) |
143 | STRUCT_FOR_ID(__lshift__) |
144 | STRUCT_FOR_ID(__lt__) |
145 | STRUCT_FOR_ID(__main__) |
146 | STRUCT_FOR_ID(__matmul__) |
147 | STRUCT_FOR_ID(__missing__) |
148 | STRUCT_FOR_ID(__mod__) |
149 | STRUCT_FOR_ID(__module__) |
150 | STRUCT_FOR_ID(__mro_entries__) |
151 | STRUCT_FOR_ID(__mul__) |
152 | STRUCT_FOR_ID(__name__) |
153 | STRUCT_FOR_ID(__ne__) |
154 | STRUCT_FOR_ID(__neg__) |
155 | STRUCT_FOR_ID(__new__) |
156 | STRUCT_FOR_ID(__newobj__) |
157 | STRUCT_FOR_ID(__newobj_ex__) |
158 | STRUCT_FOR_ID(__next__) |
159 | STRUCT_FOR_ID(__notes__) |
160 | STRUCT_FOR_ID(__or__) |
161 | STRUCT_FOR_ID(__orig_class__) |
162 | STRUCT_FOR_ID(__origin__) |
163 | STRUCT_FOR_ID(__package__) |
164 | STRUCT_FOR_ID(__parameters__) |
165 | STRUCT_FOR_ID(__path__) |
166 | STRUCT_FOR_ID(__pos__) |
167 | STRUCT_FOR_ID(__pow__) |
168 | STRUCT_FOR_ID(__prepare__) |
169 | STRUCT_FOR_ID(__qualname__) |
170 | STRUCT_FOR_ID(__radd__) |
171 | STRUCT_FOR_ID(__rand__) |
172 | STRUCT_FOR_ID(__rdivmod__) |
173 | STRUCT_FOR_ID(__reduce__) |
174 | STRUCT_FOR_ID(__reduce_ex__) |
175 | STRUCT_FOR_ID(__repr__) |
176 | STRUCT_FOR_ID(__reversed__) |
177 | STRUCT_FOR_ID(__rfloordiv__) |
178 | STRUCT_FOR_ID(__rlshift__) |
179 | STRUCT_FOR_ID(__rmatmul__) |
180 | STRUCT_FOR_ID(__rmod__) |
181 | STRUCT_FOR_ID(__rmul__) |
182 | STRUCT_FOR_ID(__ror__) |
183 | STRUCT_FOR_ID(__round__) |
184 | STRUCT_FOR_ID(__rpow__) |
185 | STRUCT_FOR_ID(__rrshift__) |
186 | STRUCT_FOR_ID(__rshift__) |
187 | STRUCT_FOR_ID(__rsub__) |
188 | STRUCT_FOR_ID(__rtruediv__) |
189 | STRUCT_FOR_ID(__rxor__) |
190 | STRUCT_FOR_ID(__set__) |
191 | STRUCT_FOR_ID(__set_name__) |
192 | STRUCT_FOR_ID(__setattr__) |
193 | STRUCT_FOR_ID(__setitem__) |
194 | STRUCT_FOR_ID(__setstate__) |
195 | STRUCT_FOR_ID(__sizeof__) |
196 | STRUCT_FOR_ID(__slotnames__) |
197 | STRUCT_FOR_ID(__slots__) |
198 | STRUCT_FOR_ID(__spec__) |
199 | STRUCT_FOR_ID(__str__) |
200 | STRUCT_FOR_ID(__sub__) |
201 | STRUCT_FOR_ID(__subclasscheck__) |
202 | STRUCT_FOR_ID(__subclasshook__) |
203 | STRUCT_FOR_ID(__truediv__) |
204 | STRUCT_FOR_ID(__trunc__) |
205 | STRUCT_FOR_ID(__typing_is_unpacked_typevartuple__) |
206 | STRUCT_FOR_ID(__typing_prepare_subst__) |
207 | STRUCT_FOR_ID(__typing_subst__) |
208 | STRUCT_FOR_ID(__typing_unpacked_tuple_args__) |
209 | STRUCT_FOR_ID(__warningregistry__) |
210 | STRUCT_FOR_ID(__weaklistoffset__) |
211 | STRUCT_FOR_ID(__weakref__) |
212 | STRUCT_FOR_ID(__xor__) |
213 | STRUCT_FOR_ID(_abc_impl) |
214 | STRUCT_FOR_ID(_annotation) |
215 | STRUCT_FOR_ID(_blksize) |
216 | STRUCT_FOR_ID(_bootstrap) |
217 | STRUCT_FOR_ID(_dealloc_warn) |
218 | STRUCT_FOR_ID(_finalizing) |
219 | STRUCT_FOR_ID(_find_and_load) |
220 | STRUCT_FOR_ID(_fix_up_module) |
221 | STRUCT_FOR_ID(_get_sourcefile) |
222 | STRUCT_FOR_ID(_handle_fromlist) |
223 | STRUCT_FOR_ID(_initializing) |
224 | STRUCT_FOR_ID(_is_text_encoding) |
225 | STRUCT_FOR_ID(_lock_unlock_module) |
226 | STRUCT_FOR_ID(_showwarnmsg) |
227 | STRUCT_FOR_ID(_shutdown) |
228 | STRUCT_FOR_ID(_slotnames) |
229 | STRUCT_FOR_ID(_uninitialized_submodules) |
230 | STRUCT_FOR_ID(_warn_unawaited_coroutine) |
231 | STRUCT_FOR_ID(_xoptions) |
232 | STRUCT_FOR_ID(add) |
233 | STRUCT_FOR_ID(append) |
234 | STRUCT_FOR_ID(big) |
235 | STRUCT_FOR_ID(buffer) |
236 | STRUCT_FOR_ID(builtins) |
237 | STRUCT_FOR_ID(c_call) |
238 | STRUCT_FOR_ID(c_exception) |
239 | STRUCT_FOR_ID(c_return) |
240 | STRUCT_FOR_ID(call) |
241 | STRUCT_FOR_ID(clear) |
242 | STRUCT_FOR_ID(close) |
243 | STRUCT_FOR_ID(closed) |
244 | STRUCT_FOR_ID(code) |
245 | STRUCT_FOR_ID(copy) |
246 | STRUCT_FOR_ID(copyreg) |
247 | STRUCT_FOR_ID(decode) |
248 | STRUCT_FOR_ID(default) |
249 | STRUCT_FOR_ID(defaultaction) |
250 | STRUCT_FOR_ID(dictcomp) |
251 | STRUCT_FOR_ID(difference_update) |
252 | STRUCT_FOR_ID(dispatch_table) |
253 | STRUCT_FOR_ID(displayhook) |
254 | STRUCT_FOR_ID(encode) |
255 | STRUCT_FOR_ID(encoding) |
256 | STRUCT_FOR_ID(end_lineno) |
257 | STRUCT_FOR_ID(end_offset) |
258 | STRUCT_FOR_ID(errors) |
259 | STRUCT_FOR_ID(excepthook) |
260 | STRUCT_FOR_ID(exception) |
261 | STRUCT_FOR_ID(extend) |
262 | STRUCT_FOR_ID(filename) |
263 | STRUCT_FOR_ID(fileno) |
264 | STRUCT_FOR_ID(fillvalue) |
265 | STRUCT_FOR_ID(filters) |
266 | STRUCT_FOR_ID(find_class) |
267 | STRUCT_FOR_ID(flush) |
268 | STRUCT_FOR_ID(genexpr) |
269 | STRUCT_FOR_ID(get) |
270 | STRUCT_FOR_ID(get_source) |
271 | STRUCT_FOR_ID(getattr) |
272 | STRUCT_FOR_ID(getstate) |
273 | STRUCT_FOR_ID(ignore) |
274 | STRUCT_FOR_ID(importlib) |
275 | STRUCT_FOR_ID(inf) |
276 | STRUCT_FOR_ID(intersection) |
277 | STRUCT_FOR_ID(isatty) |
278 | STRUCT_FOR_ID(isinstance) |
279 | STRUCT_FOR_ID(items) |
280 | STRUCT_FOR_ID(iter) |
281 | STRUCT_FOR_ID(join) |
282 | STRUCT_FOR_ID(keys) |
283 | STRUCT_FOR_ID(lambda) |
284 | STRUCT_FOR_ID(last_traceback) |
285 | STRUCT_FOR_ID(last_type) |
286 | STRUCT_FOR_ID(last_value) |
287 | STRUCT_FOR_ID(latin1) |
288 | STRUCT_FOR_ID(len) |
289 | STRUCT_FOR_ID(line) |
290 | STRUCT_FOR_ID(lineno) |
291 | STRUCT_FOR_ID(listcomp) |
292 | STRUCT_FOR_ID(little) |
293 | STRUCT_FOR_ID(locale) |
294 | STRUCT_FOR_ID(match) |
295 | STRUCT_FOR_ID(metaclass) |
296 | STRUCT_FOR_ID(mode) |
297 | STRUCT_FOR_ID(modules) |
298 | STRUCT_FOR_ID(mro) |
299 | STRUCT_FOR_ID(msg) |
300 | STRUCT_FOR_ID(n_fields) |
301 | STRUCT_FOR_ID(n_sequence_fields) |
302 | STRUCT_FOR_ID(n_unnamed_fields) |
303 | STRUCT_FOR_ID(name) |
304 | STRUCT_FOR_ID(newlines) |
305 | STRUCT_FOR_ID(next) |
306 | STRUCT_FOR_ID(obj) |
307 | STRUCT_FOR_ID(offset) |
308 | STRUCT_FOR_ID(onceregistry) |
309 | STRUCT_FOR_ID(opcode) |
310 | STRUCT_FOR_ID(open) |
311 | STRUCT_FOR_ID(parent) |
312 | STRUCT_FOR_ID(path) |
313 | STRUCT_FOR_ID(peek) |
314 | STRUCT_FOR_ID(persistent_id) |
315 | STRUCT_FOR_ID(persistent_load) |
316 | STRUCT_FOR_ID(print_file_and_line) |
317 | STRUCT_FOR_ID(ps1) |
318 | STRUCT_FOR_ID(ps2) |
319 | STRUCT_FOR_ID(raw) |
320 | STRUCT_FOR_ID(read) |
321 | STRUCT_FOR_ID(read1) |
322 | STRUCT_FOR_ID(readable) |
323 | STRUCT_FOR_ID(readall) |
324 | STRUCT_FOR_ID(readinto) |
325 | STRUCT_FOR_ID(readinto1) |
326 | STRUCT_FOR_ID(readline) |
327 | STRUCT_FOR_ID(reducer_override) |
328 | STRUCT_FOR_ID(reload) |
329 | STRUCT_FOR_ID(replace) |
330 | STRUCT_FOR_ID(reset) |
331 | STRUCT_FOR_ID(return) |
332 | STRUCT_FOR_ID(reversed) |
333 | STRUCT_FOR_ID(seek) |
334 | STRUCT_FOR_ID(seekable) |
335 | STRUCT_FOR_ID(send) |
336 | STRUCT_FOR_ID(setcomp) |
337 | STRUCT_FOR_ID(setstate) |
338 | STRUCT_FOR_ID(sort) |
339 | STRUCT_FOR_ID(stderr) |
340 | STRUCT_FOR_ID(stdin) |
341 | STRUCT_FOR_ID(stdout) |
342 | STRUCT_FOR_ID(strict) |
343 | STRUCT_FOR_ID(symmetric_difference_update) |
344 | STRUCT_FOR_ID(tell) |
345 | STRUCT_FOR_ID(text) |
346 | STRUCT_FOR_ID(threading) |
347 | STRUCT_FOR_ID(throw) |
348 | STRUCT_FOR_ID(top) |
349 | STRUCT_FOR_ID(truncate) |
350 | STRUCT_FOR_ID(unraisablehook) |
351 | STRUCT_FOR_ID(values) |
352 | STRUCT_FOR_ID(version) |
353 | STRUCT_FOR_ID(warnings) |
354 | STRUCT_FOR_ID(warnoptions) |
355 | STRUCT_FOR_ID(writable) |
356 | STRUCT_FOR_ID(write) |
357 | } identifiers; |
358 | struct { |
359 | PyASCIIObject _ascii; |
360 | uint8_t _data[2]; |
361 | } ascii[128]; |
362 | struct { |
363 | PyCompactUnicodeObject _latin1; |
364 | uint8_t _data[2]; |
365 | } latin1[128]; |
366 | }; |
367 | /* End auto-generated code */ |
368 | |
369 | #undef ID |
370 | #undef STR |
371 | |
372 | |
373 | #define _Py_ID(NAME) \ |
374 | (_Py_SINGLETON(strings.identifiers._ ## NAME._ascii.ob_base)) |
375 | #define _Py_STR(NAME) \ |
376 | (_Py_SINGLETON(strings.literals._ ## NAME._ascii.ob_base)) |
377 | |
378 | /* _Py_DECLARE_STR() should precede all uses of _Py_STR() in a function. |
379 | |
380 | This is true even if the same string has already been declared |
381 | elsewhere, even in the same file. Mismatched duplicates are detected |
382 | by Tools/scripts/generate-global-objects.py. |
383 | |
384 | Pairing _Py_DECLARE_STR() with every use of _Py_STR() makes sure the |
385 | string keeps working even if the declaration is removed somewhere |
386 | else. It also makes it clear what the actual string is at every |
387 | place it is being used. */ |
388 | #define _Py_DECLARE_STR(name, str) |
389 | |
390 | #ifdef __cplusplus |
391 | } |
392 | #endif |
393 | #endif /* !Py_INTERNAL_GLOBAL_STRINGS_H */ |