PyCyBase 0.1.8.post4__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cbase/__infra__.pxd +6 -0
- cbase/__init__.pxd +6 -0
- cbase/__init__.py +28 -0
- cbase/allocator_protocol/__infra__.pxd +58 -0
- cbase/allocator_protocol/__init__.pxd +58 -0
- cbase/allocator_protocol/__init__.py +45 -0
- cbase/allocator_protocol/c_allocator_protocol.c +31818 -0
- cbase/allocator_protocol/c_allocator_protocol.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_allocator_protocol.h +352 -0
- cbase/allocator_protocol/c_allocator_protocol.pxd +64 -0
- cbase/allocator_protocol/c_allocator_protocol.pyi +144 -0
- cbase/allocator_protocol/c_allocator_protocol.pyx +209 -0
- cbase/allocator_protocol/c_heap_allocator.c +38144 -0
- cbase/allocator_protocol/c_heap_allocator.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_heap_allocator.h +444 -0
- cbase/allocator_protocol/c_heap_allocator.pxd +97 -0
- cbase/allocator_protocol/c_heap_allocator.pyi +161 -0
- cbase/allocator_protocol/c_heap_allocator.pyx +300 -0
- cbase/allocator_protocol/c_nt_shm_allocator.c +33399 -0
- cbase/allocator_protocol/c_nt_shm_allocator.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_nt_shm_allocator.h +996 -0
- cbase/allocator_protocol/c_nt_shm_allocator.pxd +102 -0
- cbase/allocator_protocol/c_nt_shm_allocator.pyx +223 -0
- cbase/allocator_protocol/c_shm_allocator.h +1168 -0
- cbase/allocator_protocol/c_shm_allocator.pxd +142 -0
- cbase/allocator_protocol/c_shm_allocator.pyi +299 -0
- cbase/allocator_protocol/c_shm_allocator.pyx +442 -0
- cbase/allocator_protocol/c_shm_comp.c +4643 -0
- cbase/allocator_protocol/c_shm_comp.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_shm_comp.h +49 -0
- cbase/allocator_protocol/c_shm_comp.pxd +38 -0
- cbase/allocator_protocol/c_shm_comp.pyx +1 -0
- cbase/backports/__infra__.pxd +17 -0
- cbase/backports/__init__.pxd +17 -0
- cbase/backports/__init__.py +9 -0
- cbase/backports/pydict.h +55 -0
- cbase/backports/pydict.pxd +5 -0
- cbase/backports/pylong.c +9946 -0
- cbase/backports/pylong.cp313-win_amd64.pyd +0 -0
- cbase/backports/pylong.h +79 -0
- cbase/backports/pylong.pxd +23 -0
- cbase/backports/pylong.pyx +61 -0
- cbase/bytemap/__infra__.pxd +42 -0
- cbase/bytemap/__init__.pxd +42 -0
- cbase/bytemap/__init__.py +21 -0
- cbase/bytemap/c_bytemap.c +52076 -0
- cbase/bytemap/c_bytemap.cp313-win_amd64.pyd +0 -0
- cbase/bytemap/c_bytemap.h +867 -0
- cbase/bytemap/c_bytemap.pxd +370 -0
- cbase/bytemap/c_bytemap.pyx +1758 -0
- cbase/bytemap/xxh3.h +55 -0
- cbase/bytemap/xxhash.c +42 -0
- cbase/bytemap/xxhash.h +7487 -0
- cbase/env.c +11109 -0
- cbase/env.cp313-win_amd64.pyd +0 -0
- cbase/env.pxd +8 -0
- cbase/env.pyi +48 -0
- cbase/env.pyx +46 -0
- cbase/includes/cbase/allocator_protocol/c_allocator_protocol.c +31818 -0
- cbase/includes/cbase/allocator_protocol/c_allocator_protocol.h +352 -0
- cbase/includes/cbase/allocator_protocol/c_heap_allocator.c +38144 -0
- cbase/includes/cbase/allocator_protocol/c_heap_allocator.h +444 -0
- cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.c +33399 -0
- cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.h +996 -0
- cbase/includes/cbase/allocator_protocol/c_shm_allocator.h +1168 -0
- cbase/includes/cbase/allocator_protocol/c_shm_comp.c +4643 -0
- cbase/includes/cbase/allocator_protocol/c_shm_comp.h +49 -0
- cbase/includes/cbase/backports/pydict.h +55 -0
- cbase/includes/cbase/backports/pylong.c +9946 -0
- cbase/includes/cbase/backports/pylong.h +79 -0
- cbase/includes/cbase/bytemap/c_bytemap.c +52076 -0
- cbase/includes/cbase/bytemap/c_bytemap.h +867 -0
- cbase/includes/cbase/bytemap/xxh3.h +55 -0
- cbase/includes/cbase/bytemap/xxhash.c +42 -0
- cbase/includes/cbase/bytemap/xxhash.h +7487 -0
- cbase/includes/cbase/env.c +11109 -0
- cbase/includes/cbase/int128.h +81 -0
- cbase/includes/cbase/intern_string/c_intern_string.c +28081 -0
- cbase/includes/cbase/intern_string/c_intern_string.h +614 -0
- cbase/includes/cbase/nt/pthread_nt_compat.h +102 -0
- cbase/includes/cbase/nt/regex_nt_compat.h +133 -0
- cbase/includes/cbase/nt/time_sched_nt_compat.h +32 -0
- cbase/int128.h +81 -0
- cbase/int128.pxd +15 -0
- cbase/intern_string/BENCHMARK.md +157 -0
- cbase/intern_string/__infra__.pxd +11 -0
- cbase/intern_string/__init__.pxd +11 -0
- cbase/intern_string/__init__.py +19 -0
- cbase/intern_string/c_intern_string.c +28081 -0
- cbase/intern_string/c_intern_string.cp313-win_amd64.pyd +0 -0
- cbase/intern_string/c_intern_string.h +614 -0
- cbase/intern_string/c_intern_string.pxd +118 -0
- cbase/intern_string/c_intern_string.pyi +376 -0
- cbase/intern_string/c_intern_string.pyx +765 -0
- cbase/nt/pthread_nt_compat.h +102 -0
- cbase/nt/regex_nt_compat.h +133 -0
- cbase/nt/time_sched_nt_compat.h +32 -0
- pycybase-0.1.8.post4.dist-info/METADATA +180 -0
- pycybase-0.1.8.post4.dist-info/RECORD +101 -0
- pycybase-0.1.8.post4.dist-info/WHEEL +5 -0
- pycybase-0.1.8.post4.dist-info/top_level.txt +1 -0
|
Binary file
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#ifndef C_SHM_COMP_H
|
|
2
|
+
#define C_SHM_COMP_H
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* c_shm_comp.h -- Platform-dispatch compatibility header for SHM allocators.
|
|
6
|
+
*
|
|
7
|
+
* On POSIX: includes c_shm_allocator.h directly.
|
|
8
|
+
* On Windows: includes c_nt_shm_allocator.h and aliases nt_shm_* -> shm_*.
|
|
9
|
+
*
|
|
10
|
+
* This header exists so that Cython .pxd / .pyx files can declare SHM types
|
|
11
|
+
* via a single `cdef extern from "cbase/allocator_protocol/c_shm_comp.h"`
|
|
12
|
+
* without IF UNAME_SYSNAME branching.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
#ifdef _WIN32
|
|
16
|
+
#include "cbase/allocator_protocol/c_nt_shm_allocator.h"
|
|
17
|
+
|
|
18
|
+
typedef nt_shm_allocator shm_allocator;
|
|
19
|
+
typedef nt_shm_allocator_ctx shm_allocator_ctx;
|
|
20
|
+
typedef nt_shm_page shm_page;
|
|
21
|
+
typedef nt_shm_page_ctx shm_page_ctx;
|
|
22
|
+
typedef nt_shm_memory_block shm_memory_block;
|
|
23
|
+
|
|
24
|
+
// Static inline wrappers -- visible to Cython .pxd files (unlike #define macros).
|
|
25
|
+
static inline shm_allocator_ctx* c_shm_allocator_new(size_t region_size, const char* shm_prefix) {
|
|
26
|
+
return (shm_allocator_ctx*) c_nt_shm_allocator_new(region_size, shm_prefix);
|
|
27
|
+
}
|
|
28
|
+
static inline void c_shm_allocator_free(shm_allocator_ctx* ctx) {
|
|
29
|
+
c_nt_shm_allocator_free((nt_shm_allocator_ctx*) ctx);
|
|
30
|
+
}
|
|
31
|
+
static inline void* c_shm_calloc(shm_allocator_ctx* ctx, size_t size, pthread_mutex_t* lock) {
|
|
32
|
+
return c_nt_shm_calloc((nt_shm_allocator_ctx*) ctx, size, lock);
|
|
33
|
+
}
|
|
34
|
+
static inline void* c_shm_request(shm_allocator_ctx* ctx, size_t size, int scan_all_pages, pthread_mutex_t* lock) {
|
|
35
|
+
return c_nt_shm_request((nt_shm_allocator_ctx*) ctx, size, scan_all_pages, lock);
|
|
36
|
+
}
|
|
37
|
+
static inline void c_shm_free(void* ptr, pthread_mutex_t* lock) {
|
|
38
|
+
c_nt_shm_free(ptr, lock);
|
|
39
|
+
}
|
|
40
|
+
static inline void c_shm_reclaim(shm_allocator_ctx* ctx, pthread_mutex_t* lock) {
|
|
41
|
+
c_nt_shm_reclaim((nt_shm_allocator_ctx*) ctx, lock);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#else
|
|
45
|
+
#include "cbase/allocator_protocol/c_shm_allocator.h"
|
|
46
|
+
// Functions are already defined in c_shm_allocator.h -- no wrappers needed.
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
#endif // C_SHM_COMP_H
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
cdef extern from "cbase/allocator_protocol/c_shm_comp.h":
|
|
3
|
+
# -- Constants -----------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
const size_t AP_SHM_AUTOPAGE_CAPACITY
|
|
6
|
+
const size_t AP_SHM_AUTOPAGE_CAPACITY_MAX
|
|
7
|
+
const size_t AP_SHM_AUTOPAGE_ALIGNMENT
|
|
8
|
+
const char* AP_SHM_ALLOCATOR_PREFIX
|
|
9
|
+
const size_t AP_SHM_ALLOCATOR_DEFAULT_REGION_SIZE
|
|
10
|
+
|
|
11
|
+
# -- Types ---------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
ctypedef struct pthread_mutex_t:
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
ctypedef struct shm_allocator:
|
|
17
|
+
char shm_name[256]
|
|
18
|
+
size_t pid
|
|
19
|
+
pthread_mutex_t lock
|
|
20
|
+
size_t autopage_capacity
|
|
21
|
+
size_t autopage_capacity_max
|
|
22
|
+
size_t autopage_alignment
|
|
23
|
+
char shm_prefix[64]
|
|
24
|
+
|
|
25
|
+
ctypedef struct shm_allocator_ctx:
|
|
26
|
+
shm_allocator* shm_allocator
|
|
27
|
+
|
|
28
|
+
# -- Functions (static inline wrappers on Windows, real on POSIX) --------
|
|
29
|
+
|
|
30
|
+
shm_allocator_ctx* c_shm_allocator_new(size_t region_size, const char* shm_prefix)
|
|
31
|
+
void c_shm_allocator_free(shm_allocator_ctx* ctx)
|
|
32
|
+
void* c_shm_calloc(shm_allocator_ctx* ctx, size_t size, pthread_mutex_t* lock)
|
|
33
|
+
void* c_shm_request(shm_allocator_ctx* ctx, size_t size, int scan_all_pages, pthread_mutex_t* lock)
|
|
34
|
+
void c_shm_free(void* ptr, pthread_mutex_t* lock)
|
|
35
|
+
void c_shm_reclaim(shm_allocator_ctx* ctx, pthread_mutex_t* lock)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
cdef shm_allocator_ctx* C_SHM_COMP
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cdef shm_allocator_ctx* C_SHM_COMP = c_shm_allocator_new(AP_SHM_ALLOCATOR_DEFAULT_REGION_SIZE, AP_SHM_ALLOCATOR_PREFIX)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from .pydict cimport BP_PyDict_Pop
|
|
2
|
+
|
|
3
|
+
from .pylong cimport (
|
|
4
|
+
PyLong_FromUInt128,
|
|
5
|
+
PyLong_FromInt128,
|
|
6
|
+
PyLong_AsUInt128,
|
|
7
|
+
PyLong_AsInt128,
|
|
8
|
+
|
|
9
|
+
_UINT128_MAX,
|
|
10
|
+
_INT128_MAX,
|
|
11
|
+
_INT128_MIN,
|
|
12
|
+
|
|
13
|
+
pylong_from_uint128,
|
|
14
|
+
pylong_from_int128,
|
|
15
|
+
pylong_as_uint128,
|
|
16
|
+
pylong_as_int128,
|
|
17
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from .pydict cimport BP_PyDict_Pop
|
|
2
|
+
|
|
3
|
+
from .pylong cimport (
|
|
4
|
+
PyLong_FromUInt128,
|
|
5
|
+
PyLong_FromInt128,
|
|
6
|
+
PyLong_AsUInt128,
|
|
7
|
+
PyLong_AsInt128,
|
|
8
|
+
|
|
9
|
+
_UINT128_MAX,
|
|
10
|
+
_INT128_MAX,
|
|
11
|
+
_INT128_MIN,
|
|
12
|
+
|
|
13
|
+
pylong_from_uint128,
|
|
14
|
+
pylong_from_int128,
|
|
15
|
+
pylong_as_uint128,
|
|
16
|
+
pylong_as_int128,
|
|
17
|
+
)
|
cbase/backports/pydict.h
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#ifndef PY_BACKPORTS_DICT_H
|
|
2
|
+
#define PY_BACKPORTS_DICT_H
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* dict.h -- Python C API backports for dict operations.
|
|
6
|
+
*
|
|
7
|
+
* Provides shims so that Cython extensions can call a single function
|
|
8
|
+
* regardless of the target Python version. Each shim is exposed as a
|
|
9
|
+
* ``static inline`` function when the target Python lacks the native API,
|
|
10
|
+
* and as a thin ``#define`` alias when the native API is available.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
#include <Python.h>
|
|
14
|
+
|
|
15
|
+
/* ===================================================================
|
|
16
|
+
* BP_PyDict_Pop (native since Python 3.13 / PY_VERSION_HEX >= 0x030D0000)
|
|
17
|
+
* ===================================================================
|
|
18
|
+
*
|
|
19
|
+
* int BP_PyDict_Pop(PyObject *op, PyObject *key, PyObject **result)
|
|
20
|
+
*
|
|
21
|
+
* Remove *key* from dictionary *op* and return the value (a new strong
|
|
22
|
+
* reference) in **result*.
|
|
23
|
+
*
|
|
24
|
+
* Returns: 0 -- success (key found and removed)
|
|
25
|
+
* 1 -- key not present
|
|
26
|
+
* -1 -- error (exception set, *result is NULL)
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
#if PY_VERSION_HEX >= 0x030D0000
|
|
30
|
+
#define BP_PyDict_Pop PyDict_Pop
|
|
31
|
+
#else
|
|
32
|
+
static inline int BP_PyDict_Pop(PyObject* op, PyObject* key, PyObject** result) {
|
|
33
|
+
PyObject* value = PyDict_GetItemWithError(op, key);
|
|
34
|
+
if (!value) {
|
|
35
|
+
/* NULL + exception -> error */
|
|
36
|
+
if (PyErr_Occurred()) {
|
|
37
|
+
*result = NULL;
|
|
38
|
+
return -1;
|
|
39
|
+
}
|
|
40
|
+
/* NULL + no exception -> key not present */
|
|
41
|
+
*result = NULL;
|
|
42
|
+
return 1;
|
|
43
|
+
}
|
|
44
|
+
Py_INCREF(value);
|
|
45
|
+
if (PyDict_DelItem(op, key) < 0) {
|
|
46
|
+
Py_DECREF(value);
|
|
47
|
+
*result = NULL;
|
|
48
|
+
return -1;
|
|
49
|
+
}
|
|
50
|
+
*result = value;
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
#endif /* PY_VERSION_HEX >= 0x030D0000 */
|
|
54
|
+
|
|
55
|
+
#endif /* PY_BACKPORTS_DICT_H */
|