-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathstring.h
More file actions
130 lines (106 loc) Β· 2.18 KB
/
string.h
File metadata and controls
130 lines (106 loc) Β· 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#pragma once
#include "object.h"
#include <cstdint>
namespace pystack {
typedef uint32_t Py_UCS4;
typedef uint16_t Py_UCS2;
typedef uint8_t Py_UCS1;
typedef Py_UCS4 Py_UNICODE;
typedef Py_ssize_t Py_hash_t;
namespace Python3 {
typedef struct
{
PyObject_VAR_HEAD Py_hash_t ob_shash;
char ob_sval[1];
} PyBytesObject;
} // namespace Python3
namespace Python2 {
typedef struct
{
PyObject_HEAD Py_ssize_t length;
Py_UNICODE* str;
long hash;
PyObject* defenc;
} PyUnicodeObject;
typedef struct
{
PyObject_VAR_HEAD long ob_shash;
int ob_sstate;
char ob_sval[1];
} _PyStringObject;
} // namespace Python2
namespace Python3 {
struct _PyUnicode_State
{
unsigned int interned : 2;
unsigned int kind : 3;
unsigned int compact : 1;
unsigned int ascii : 1;
unsigned int ready : 1;
unsigned int : 24;
};
typedef struct
{
PyObject_HEAD Py_ssize_t length;
Py_hash_t hash;
_PyUnicode_State state;
wchar_t* wstr;
} PyASCIIObject;
typedef struct
{
PyASCIIObject _base;
Py_ssize_t utf8_length;
char* utf8;
Py_ssize_t wstr_length;
} PyCompactUnicodeObject;
typedef struct
{
PyCompactUnicodeObject _base;
union {
void* any;
Py_UCS1* latin1;
Py_UCS2* ucs2;
Py_UCS4* ucs4;
} data;
} PyUnicodeObject;
} // namespace Python3
namespace Python3_12 {
using Python3::_PyUnicode_State;
typedef struct
{
PyObject_HEAD Py_ssize_t length;
Py_hash_t hash;
_PyUnicode_State state;
} PyASCIIObject;
typedef struct
{
PyASCIIObject _base;
Py_ssize_t utf8_length;
char* utf8;
} PyCompactUnicodeObject;
typedef struct
{
PyCompactUnicodeObject _base;
union {
void* any;
Py_UCS1* latin1;
Py_UCS2* ucs2;
Py_UCS4* ucs4;
} data;
} PyUnicodeObject;
} // namespace Python3_12
namespace Python3_14t {
struct _PyUnicode_State
{
unsigned char interned;
unsigned int kind : 3;
unsigned int compact : 1;
unsigned int ascii : 1;
unsigned int statically_allocated : 1;
};
} // namespace Python3_14t
union AnyPyUnicodeState {
Python3::_PyUnicode_State python3;
Python3_14t::_PyUnicode_State python3_14t;
};
} // namespace pystack