Nuitka
The Python compiler
Loading...
Searching...
No Matches
constants_blob_spec.h
1// Copyright 2026, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
3#ifndef __NUITKA_CONSTANTS_BLOB_SPEC_H__
4#define __NUITKA_CONSTANTS_BLOB_SPEC_H__
5
6/* Keep these defines in simple numeric form, so Python code can parse this
7 * file directly without a C preprocessor.
8 */
9
10#define NUITKA_CONSTANT_BLOB_TAG_PREVIOUS 0x70 /* 'p' */
11#define NUITKA_CONSTANT_BLOB_TAG_NONE 0x6e /* 'n' */
12#define NUITKA_CONSTANT_BLOB_TAG_TRUE 0x74 /* 't' */
13#define NUITKA_CONSTANT_BLOB_TAG_FALSE 0x46 /* 'F' */
14#define NUITKA_CONSTANT_BLOB_TAG_TUPLE 0x54 /* 'T' */
15#define NUITKA_CONSTANT_BLOB_TAG_LIST 0x4c /* 'L' */
16#define NUITKA_CONSTANT_BLOB_TAG_DICT 0x44 /* 'D' */
17#define NUITKA_CONSTANT_BLOB_TAG_SET 0x53 /* 'S' */
18#define NUITKA_CONSTANT_BLOB_TAG_FROZENSET 0x50 /* 'P' */
19#define NUITKA_CONSTANT_BLOB_TAG_LONG_POSITIVE_SMALL 0x6c /* 'l' */
20#define NUITKA_CONSTANT_BLOB_TAG_LONG_NEGATIVE_SMALL 0x71 /* 'q' */
21#define NUITKA_CONSTANT_BLOB_TAG_LONG_POSITIVE_LARGE 0x67 /* 'g' */
22#define NUITKA_CONSTANT_BLOB_TAG_LONG_NEGATIVE_LARGE 0x47 /* 'G' */
23#define NUITKA_CONSTANT_BLOB_TAG_INT_POSITIVE 0x69 /* 'i' */
24#define NUITKA_CONSTANT_BLOB_TAG_INT_NEGATIVE 0x49 /* 'I' */
25#define NUITKA_CONSTANT_BLOB_TAG_FLOAT_SPECIAL 0x5a /* 'Z' */
26#define NUITKA_CONSTANT_BLOB_TAG_FLOAT 0x66 /* 'f' */
27#define NUITKA_CONSTANT_BLOB_TAG_TEXT_EMPTY 0x73 /* 's' */
28#define NUITKA_CONSTANT_BLOB_TAG_TEXT_SINGLE 0x77 /* 'w' */
29#define NUITKA_CONSTANT_BLOB_TAG_TEXT_UTF8_LENGTH_PREFIXED 0x76 /* 'v' */
30#define NUITKA_CONSTANT_BLOB_TAG_TEXT_UTF8_ZERO_TERMINATED 0x75 /* 'u' */
31#define NUITKA_CONSTANT_BLOB_TAG_ATTRIBUTE_NAME 0x61 /* 'a' */
32#define NUITKA_CONSTANT_BLOB_TAG_BYTES_LENGTH_PREFIXED 0x62 /* 'b' */
33#define NUITKA_CONSTANT_BLOB_TAG_BYTES_ZERO_TERMINATED 0x63 /* 'c' */
34#define NUITKA_CONSTANT_BLOB_TAG_BYTES_SINGLE 0x64 /* 'd' */
35#define NUITKA_CONSTANT_BLOB_TAG_SLICE 0x3a /* ':' */
36#define NUITKA_CONSTANT_BLOB_TAG_RANGE 0x3b /* ';' */
37#define NUITKA_CONSTANT_BLOB_TAG_COMPLEX_SPECIAL 0x4a /* 'J' */
38#define NUITKA_CONSTANT_BLOB_TAG_COMPLEX 0x6a /* 'j' */
39#define NUITKA_CONSTANT_BLOB_TAG_BYTEARRAY 0x42 /* 'B' */
40#define NUITKA_CONSTANT_BLOB_TAG_BUILTIN_ANON 0x4d /* 'M' */
41#define NUITKA_CONSTANT_BLOB_TAG_BUILTIN_SPECIAL 0x51 /* 'Q' */
42#define NUITKA_CONSTANT_BLOB_TAG_BLOB_DATA 0x58 /* 'X' */
43#define NUITKA_CONSTANT_BLOB_TAG_GENERIC_ALIAS 0x41 /* 'A' */
44#define NUITKA_CONSTANT_BLOB_TAG_UNION_TYPE 0x48 /* 'H' */
45#define NUITKA_CONSTANT_BLOB_TAG_BUILTIN_NAMED 0x4f /* 'O' */
46#define NUITKA_CONSTANT_BLOB_TAG_BUILTIN_EXCEPTION 0x45 /* 'E' */
47#define NUITKA_CONSTANT_BLOB_TAG_CODE_OBJECT 0x43 /* 'C' */
48#define NUITKA_CONSTANT_BLOB_TAG_END 0x2e /* '.' */
49
50#define NUITKA_CONSTANT_BLOB_FLOAT_SPECIAL_POS_ZERO 0x00
51#define NUITKA_CONSTANT_BLOB_FLOAT_SPECIAL_NEG_ZERO 0x01
52#define NUITKA_CONSTANT_BLOB_FLOAT_SPECIAL_POS_NAN 0x02
53#define NUITKA_CONSTANT_BLOB_FLOAT_SPECIAL_NEG_NAN 0x03
54#define NUITKA_CONSTANT_BLOB_FLOAT_SPECIAL_POS_INF 0x04
55#define NUITKA_CONSTANT_BLOB_FLOAT_SPECIAL_NEG_INF 0x05
56
57/* Code object flags use fixed bit assignments. Unused version-specific bits
58 * remain clear for runtimes that do not support the corresponding payload.
59 */
60#define NUITKA_CONSTANT_BLOB_CODE_FLAG_QUALNAME 0x0000000000000001ULL
61#define NUITKA_CONSTANT_BLOB_CODE_FLAG_FREE_VARS 0x0000000000000002ULL
62#define NUITKA_CONSTANT_BLOB_CODE_FLAG_KW_ONLY 0x0000000000000004ULL
63#define NUITKA_CONSTANT_BLOB_CODE_FLAG_POS_ONLY 0x0000000000000008ULL
64#define NUITKA_CONSTANT_BLOB_CODE_KIND_MASK 0x0000000000000030ULL
65#define NUITKA_CONSTANT_BLOB_CODE_KIND_GENERATOR 0x0000000000000010ULL
66#define NUITKA_CONSTANT_BLOB_CODE_KIND_COROUTINE 0x0000000000000020ULL
67#define NUITKA_CONSTANT_BLOB_CODE_KIND_ASYNCGEN 0x0000000000000030ULL
68#define NUITKA_CONSTANT_BLOB_CODE_FLAG_OPTIMIZED 0x0000000000000040ULL
69#define NUITKA_CONSTANT_BLOB_CODE_FLAG_NEWLOCALS 0x0000000000000080ULL
70#define NUITKA_CONSTANT_BLOB_CODE_FLAG_VARARGS 0x0000000000000100ULL
71#define NUITKA_CONSTANT_BLOB_CODE_FLAG_VARKEYWORDS 0x0000000000000200ULL
72#define NUITKA_CONSTANT_BLOB_CODE_FLAG_FUTURE_DIVISION 0x0000000000000400ULL
73#define NUITKA_CONSTANT_BLOB_CODE_FLAG_FUTURE_UNICODE_LITERALS 0x0000000000000800ULL
74#define NUITKA_CONSTANT_BLOB_CODE_FLAG_FUTURE_PRINT_FUNCTION 0x0000000000001000ULL
75#define NUITKA_CONSTANT_BLOB_CODE_FLAG_FUTURE_ABSOLUTE_IMPORT 0x0000000000002000ULL
76#define NUITKA_CONSTANT_BLOB_CODE_FLAG_FUTURE_GENERATOR_STOP 0x0000000000004000ULL
77#define NUITKA_CONSTANT_BLOB_CODE_FLAG_FUTURE_ANNOTATIONS 0x0000000000008000ULL
78#define NUITKA_CONSTANT_BLOB_CODE_FLAG_FUTURE_BARRY_AS_BDFL 0x0000000000010000ULL
79
80#endif
81
82// Part of "Nuitka", an optimizing Python compiler that is compatible and
83// integrates with CPython, but also works on its own.
84//
85// Licensed under the GNU Affero General Public License, Version 3 (the "License");
86// you may not use this file except in compliance with the License.
87// You may obtain a copy of the License at
88//
89// http://www.gnu.org/licenses/agpl.txt
90//
91// Unless required by applicable law or agreed to in writing, software
92// distributed under the License is distributed on an "AS IS" BASIS,
93// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
94// See the License for the specific language governing permissions and
95// limitations under the License.