1 | #ifndef Py_LIMITED_API |
2 | #ifndef Py_INTERNAL_ACCU_H |
3 | #define Py_INTERNAL_ACCU_H |
4 | #ifdef __cplusplus |
5 | extern "C" { |
6 | #endif |
7 | |
8 | /*** This is a private API for use by the interpreter and the stdlib. |
9 | *** Its definition may be changed or removed at any moment. |
10 | ***/ |
11 | |
12 | #ifndef Py_BUILD_CORE |
13 | # error "this header requires Py_BUILD_CORE define" |
14 | #endif |
15 | |
16 | /* |
17 | * A two-level accumulator of unicode objects that avoids both the overhead |
18 | * of keeping a huge number of small separate objects, and the quadratic |
19 | * behaviour of using a naive repeated concatenation scheme. |
20 | */ |
21 | |
22 | #undef small /* defined by some Windows headers */ |
23 | |
24 | typedef struct { |
25 | PyObject *large; /* A list of previously accumulated large strings */ |
26 | PyObject *small; /* Pending small strings */ |
27 | } _PyAccu; |
28 | |
29 | PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc); |
30 | PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode); |
31 | PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc); |
32 | PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc); |
33 | PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc); |
34 | |
35 | #ifdef __cplusplus |
36 | } |
37 | #endif |
38 | #endif /* !Py_INTERNAL_ACCU_H */ |
39 | #endif /* !Py_LIMITED_API */ |
40 | |