id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
24,507
pyexpat.h
relativty_Relativty/Relativty_Driver/include/Python/pyexpat.h
/* Stuff to export relevant 'expat' entry points from pyexpat to other * parser modules, such as cElementTree. */ /* note: you must import expat.h before importing this module! */ #define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.1" #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" struct PyExpat_CAPI { char* magic; /* set to PyExpat_CAPI_MAGIC */ int size; /* set to sizeof(struct PyExpat_CAPI) */ int MAJOR_VERSION; int MINOR_VERSION; int MICRO_VERSION; /* pointers to selected expat functions. add new functions at the end, if needed */ const XML_LChar * (*ErrorString)(enum XML_Error code); enum XML_Error (*GetErrorCode)(XML_Parser parser); XML_Size (*GetErrorColumnNumber)(XML_Parser parser); XML_Size (*GetErrorLineNumber)(XML_Parser parser); enum XML_Status (*Parse)( XML_Parser parser, const char *s, int len, int isFinal); XML_Parser (*ParserCreate_MM)( const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator); void (*ParserFree)(XML_Parser parser); void (*SetCharacterDataHandler)( XML_Parser parser, XML_CharacterDataHandler handler); void (*SetCommentHandler)( XML_Parser parser, XML_CommentHandler handler); void (*SetDefaultHandlerExpand)( XML_Parser parser, XML_DefaultHandler handler); void (*SetElementHandler)( XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); void (*SetNamespaceDeclHandler)( XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); void (*SetProcessingInstructionHandler)( XML_Parser parser, XML_ProcessingInstructionHandler handler); void (*SetUnknownEncodingHandler)( XML_Parser parser, XML_UnknownEncodingHandler handler, void *encodingHandlerData); void (*SetUserData)(XML_Parser parser, void *userData); void (*SetStartDoctypeDeclHandler)(XML_Parser parser, XML_StartDoctypeDeclHandler start); enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding); int (*DefaultUnknownEncodingHandler)( void *encodingHandlerData, const XML_Char *name, XML_Encoding *info); /* might be none for expat < 2.1.0 */ int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt); /* always add new stuff to the end! */ };
2,450
C++
.h
51
41.72549
80
0.707724
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,508
compile.h
relativty_Relativty/Relativty_Driver/include/Python/compile.h
#ifndef Py_COMPILE_H #define Py_COMPILE_H #ifndef Py_LIMITED_API #include "code.h" #ifdef __cplusplus extern "C" { #endif /* Public interface */ struct _node; /* Declare the existence of this type */ PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); /* XXX (ncoghlan): Unprefixed type name in a public API! */ #define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \ CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \ CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS) #define PyCF_MASK_OBSOLETE (CO_NESTED) /* bpo-39562: CO_FUTURE_ and PyCF_ constants must be kept unique. PyCF_ constants can use bits from 0x0100 to 0x10000. CO_FUTURE_ constants use bits starting at 0x20000. */ #define PyCF_SOURCE_IS_UTF8 0x0100 #define PyCF_DONT_IMPLY_DEDENT 0x0200 #define PyCF_ONLY_AST 0x0400 #define PyCF_IGNORE_COOKIE 0x0800 #define PyCF_TYPE_COMMENTS 0x1000 #define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000 #define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \ PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT) #ifndef Py_LIMITED_API typedef struct { int cf_flags; /* bitmask of CO_xxx flags relevant to future */ int cf_feature_version; /* minor Python version (PyCF_ONLY_AST) */ } PyCompilerFlags; #define _PyCompilerFlags_INIT \ (PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION} #endif /* Future feature support */ typedef struct { int ff_features; /* flags set by future statements */ int ff_lineno; /* line number of last future statement */ } PyFutureFeatures; #define FUTURE_NESTED_SCOPES "nested_scopes" #define FUTURE_GENERATORS "generators" #define FUTURE_DIVISION "division" #define FUTURE_ABSOLUTE_IMPORT "absolute_import" #define FUTURE_WITH_STATEMENT "with_statement" #define FUTURE_PRINT_FUNCTION "print_function" #define FUTURE_UNICODE_LITERALS "unicode_literals" #define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL" #define FUTURE_GENERATOR_STOP "generator_stop" #define FUTURE_ANNOTATIONS "annotations" struct _mod; /* Declare the existence of this type */ #define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar) PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx( struct _mod *mod, const char *filename, /* decoded from the filesystem encoding */ PyCompilerFlags *flags, int optimize, PyArena *arena); PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject( struct _mod *mod, PyObject *filename, PyCompilerFlags *flags, int optimize, PyArena *arena); PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST( struct _mod * mod, const char *filename /* decoded from the filesystem encoding */ ); PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject( struct _mod * mod, PyObject *filename ); /* _Py_Mangle is defined in compile.c */ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); #define PY_INVALID_STACK_EFFECT INT_MAX PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg); PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump); PyAPI_FUNC(int) _PyAST_Optimize(struct _mod *, PyArena *arena, int optimize); #ifdef __cplusplus } #endif #endif /* !Py_LIMITED_API */ /* These definitions must match corresponding definitions in graminit.h. */ #define Py_single_input 256 #define Py_file_input 257 #define Py_eval_input 258 #define Py_func_type_input 345 #endif /* !Py_COMPILE_H */
3,582
C++
.h
88
37.522727
85
0.730725
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,509
symtable.h
relativty_Relativty/Relativty_Driver/include/Python/symtable.h
#ifndef Py_LIMITED_API #ifndef Py_SYMTABLE_H #define Py_SYMTABLE_H #ifdef __cplusplus extern "C" { #endif #include "Python-ast.h" /* mod_ty */ /* XXX(ncoghlan): This is a weird mix of public names and interpreter internal * names. */ typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock } _Py_block_ty; struct _symtable_entry; struct symtable { PyObject *st_filename; /* name of file being compiled, decoded from the filesystem encoding */ struct _symtable_entry *st_cur; /* current symbol table entry */ struct _symtable_entry *st_top; /* symbol table entry for module */ PyObject *st_blocks; /* dict: map AST node addresses * to symbol table entries */ PyObject *st_stack; /* list: stack of namespace info */ PyObject *st_global; /* borrowed ref to st_top->ste_symbols */ int st_nblocks; /* number of blocks used. kept for consistency with the corresponding compiler structure */ PyObject *st_private; /* name of current class or NULL */ PyFutureFeatures *st_future; /* module's future features that affect the symbol table */ int recursion_depth; /* current recursion depth */ int recursion_limit; /* recursion limit */ }; typedef struct _symtable_entry { PyObject_HEAD PyObject *ste_id; /* int: key in ste_table->st_blocks */ PyObject *ste_symbols; /* dict: variable names to flags */ PyObject *ste_name; /* string: name of current block */ PyObject *ste_varnames; /* list of function parameters */ PyObject *ste_children; /* list of child blocks */ PyObject *ste_directives;/* locations of global and nonlocal statements */ _Py_block_ty ste_type; /* module, class, or function */ int ste_nested; /* true if block is nested */ unsigned ste_free : 1; /* true if block has free variables */ unsigned ste_child_free : 1; /* true if a child block has free vars, including free refs to globals */ unsigned ste_generator : 1; /* true if namespace is a generator */ unsigned ste_coroutine : 1; /* true if namespace is a coroutine */ unsigned ste_comprehension : 1; /* true if namespace is a list comprehension */ unsigned ste_varargs : 1; /* true if block has varargs */ unsigned ste_varkeywords : 1; /* true if block has varkeywords */ unsigned ste_returns_value : 1; /* true if namespace uses return with an argument */ unsigned ste_needs_class_closure : 1; /* for class scopes, true if a closure over __class__ should be created */ unsigned ste_comp_iter_target : 1; /* true if visiting comprehension target */ int ste_comp_iter_expr; /* non-zero if visiting a comprehension range expression */ int ste_lineno; /* first line of block */ int ste_col_offset; /* offset of first line of block */ int ste_opt_lineno; /* lineno of last exec or import * */ int ste_opt_col_offset; /* offset of last exec or import * */ struct symtable *ste_table; } PySTEntryObject; PyAPI_DATA(PyTypeObject) PySTEntry_Type; #define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type) PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *); PyAPI_FUNC(struct symtable *) PySymtable_Build( mod_ty mod, const char *filename, /* decoded from the filesystem encoding */ PyFutureFeatures *future); PyAPI_FUNC(struct symtable *) PySymtable_BuildObject( mod_ty mod, PyObject *filename, PyFutureFeatures *future); PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); PyAPI_FUNC(void) PySymtable_Free(struct symtable *); /* Flags for def-use information */ #define DEF_GLOBAL 1 /* global stmt */ #define DEF_LOCAL 2 /* assignment in code block */ #define DEF_PARAM 2<<1 /* formal parameter */ #define DEF_NONLOCAL 2<<2 /* nonlocal stmt */ #define USE 2<<3 /* name is used */ #define DEF_FREE 2<<4 /* name used but not defined in nested block */ #define DEF_FREE_CLASS 2<<5 /* free variable from class's method */ #define DEF_IMPORT 2<<6 /* assignment occurred via import */ #define DEF_ANNOT 2<<7 /* this name is annotated */ #define DEF_COMP_ITER 2<<8 /* this name is a comprehension iteration variable */ #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) /* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol table. GLOBAL is returned from PyST_GetScope() for either of them. It is stored in ste_symbols at bits 12-15. */ #define SCOPE_OFFSET 11 #define SCOPE_MASK (DEF_GLOBAL | DEF_LOCAL | DEF_PARAM | DEF_NONLOCAL) #define LOCAL 1 #define GLOBAL_EXPLICIT 2 #define GLOBAL_IMPLICIT 3 #define FREE 4 #define CELL 5 #define GENERATOR 1 #define GENERATOR_EXPRESSION 2 #ifdef __cplusplus } #endif #endif /* !Py_SYMTABLE_H */ #endif /* !Py_LIMITED_API */
5,308
C++
.h
105
44.238095
87
0.630858
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,510
sliceobject.h
relativty_Relativty/Relativty_Driver/include/Python/sliceobject.h
#ifndef Py_SLICEOBJECT_H #define Py_SLICEOBJECT_H #ifdef __cplusplus extern "C" { #endif /* The unique ellipsis object "..." */ PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */ #define Py_Ellipsis (&_Py_EllipsisObject) /* Slice object interface */ /* A slice object containing start, stop, and step data members (the names are from range). After much talk with Guido, it was decided to let these be any arbitrary python type. Py_None stands for omitted values. */ #ifndef Py_LIMITED_API typedef struct { PyObject_HEAD PyObject *start, *stop, *step; /* not NULL */ } PySliceObject; #endif PyAPI_DATA(PyTypeObject) PySlice_Type; PyAPI_DATA(PyTypeObject) PyEllipsis_Type; #define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type) PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop, PyObject* step); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop); PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length, PyObject **start_ptr, PyObject **stop_ptr, PyObject **step_ptr); #endif PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); Py_DEPRECATED(3.7) PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength); #if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100 #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? \ ((*(slicelen) = 0), -1) : \ ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ 0)) PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step); #endif #ifdef __cplusplus } #endif #endif /* !Py_SLICEOBJECT_H */
2,517
C++
.h
54
38.166667
131
0.597879
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,511
setobject.h
relativty_Relativty/Relativty_Driver/include/Python/setobject.h
/* Set object interface */ #ifndef Py_SETOBJECT_H #define Py_SETOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API /* There are three kinds of entries in the table: 1. Unused: key == NULL and hash == 0 2. Dummy: key == dummy and hash == -1 3. Active: key != NULL and key != dummy and hash != -1 The hash field of Unused slots is always zero. The hash field of Dummy slots are set to -1 meaning that dummy entries can be detected by either entry->key==dummy or by entry->hash==-1. */ #define PySet_MINSIZE 8 typedef struct { PyObject *key; Py_hash_t hash; /* Cached hash code of the key */ } setentry; /* The SetObject data structure is shared by set and frozenset objects. Invariant for sets: - hash is -1 Invariants for frozensets: - data is immutable. - hash is the hash of the frozenset or -1 if not computed yet. */ typedef struct { PyObject_HEAD Py_ssize_t fill; /* Number active and dummy entries*/ Py_ssize_t used; /* Number active entries */ /* The table contains mask + 1 slots, and that's a power of 2. * We store the mask instead of the size because the mask is more * frequently needed. */ Py_ssize_t mask; /* The table points to a fixed-size smalltable for small tables * or to additional malloc'ed memory for bigger tables. * The table pointer is never NULL which saves us from repeated * runtime null-tests. */ setentry *table; Py_hash_t hash; /* Only used by frozenset objects */ Py_ssize_t finger; /* Search finger for pop() */ setentry smalltable[PySet_MINSIZE]; PyObject *weakreflist; /* List of weak references */ } PySetObject; #define PySet_GET_SIZE(so) (assert(PyAnySet_Check(so)),(((PySetObject *)(so))->used)) PyAPI_DATA(PyObject *) _PySet_Dummy; PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_hash_t *hash); PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable); PyAPI_FUNC(int) PySet_ClearFreeList(void); #endif /* Section excluded by Py_LIMITED_API */ PyAPI_DATA(PyTypeObject) PySet_Type; PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; PyAPI_DATA(PyTypeObject) PySetIter_Type; PyAPI_FUNC(PyObject *) PySet_New(PyObject *); PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *); PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key); PyAPI_FUNC(int) PySet_Clear(PyObject *set); PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key); PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key); PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set); PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset); #define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) #define PyAnySet_CheckExact(ob) \ (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) #define PyAnySet_Check(ob) \ (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) #define PySet_Check(ob) \ (Py_TYPE(ob) == &PySet_Type || \ PyType_IsSubtype(Py_TYPE(ob), &PySet_Type)) #define PyFrozenSet_Check(ob) \ (Py_TYPE(ob) == &PyFrozenSet_Type || \ PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) #ifdef __cplusplus } #endif #endif /* !Py_SETOBJECT_H */
3,362
C++
.h
82
38.121951
98
0.696681
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,512
intrcheck.h
relativty_Relativty/Relativty_Driver/include/Python/intrcheck.h
#ifndef Py_INTRCHECK_H #define Py_INTRCHECK_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(int) PyOS_InterruptOccurred(void); PyAPI_FUNC(void) PyOS_InitInterrupts(void); #ifdef HAVE_FORK #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 PyAPI_FUNC(void) PyOS_BeforeFork(void); PyAPI_FUNC(void) PyOS_AfterFork_Parent(void); PyAPI_FUNC(void) PyOS_AfterFork_Child(void); #endif #endif /* Deprecated, please use PyOS_AfterFork_Child() instead */ Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyOS_AfterFork(void); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyOS_IsMainThread(void); PyAPI_FUNC(void) _PySignal_AfterFork(void); #ifdef MS_WINDOWS /* windows.h is not included by Python.h so use void* instead of HANDLE */ PyAPI_FUNC(void*) _PyOS_SigintEvent(void); #endif #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_INTRCHECK_H */
861
C++
.h
28
29.571429
74
0.764493
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,513
graminit.h
relativty_Relativty/Relativty_Driver/include/Python/graminit.h
/* Generated by Parser/pgen */ #define single_input 256 #define file_input 257 #define eval_input 258 #define decorator 259 #define decorators 260 #define decorated 261 #define async_funcdef 262 #define funcdef 263 #define parameters 264 #define typedargslist 265 #define tfpdef 266 #define varargslist 267 #define vfpdef 268 #define stmt 269 #define simple_stmt 270 #define small_stmt 271 #define expr_stmt 272 #define annassign 273 #define testlist_star_expr 274 #define augassign 275 #define del_stmt 276 #define pass_stmt 277 #define flow_stmt 278 #define break_stmt 279 #define continue_stmt 280 #define return_stmt 281 #define yield_stmt 282 #define raise_stmt 283 #define import_stmt 284 #define import_name 285 #define import_from 286 #define import_as_name 287 #define dotted_as_name 288 #define import_as_names 289 #define dotted_as_names 290 #define dotted_name 291 #define global_stmt 292 #define nonlocal_stmt 293 #define assert_stmt 294 #define compound_stmt 295 #define async_stmt 296 #define if_stmt 297 #define while_stmt 298 #define for_stmt 299 #define try_stmt 300 #define with_stmt 301 #define with_item 302 #define except_clause 303 #define suite 304 #define namedexpr_test 305 #define test 306 #define test_nocond 307 #define lambdef 308 #define lambdef_nocond 309 #define or_test 310 #define and_test 311 #define not_test 312 #define comparison 313 #define comp_op 314 #define star_expr 315 #define expr 316 #define xor_expr 317 #define and_expr 318 #define shift_expr 319 #define arith_expr 320 #define term 321 #define factor 322 #define power 323 #define atom_expr 324 #define atom 325 #define testlist_comp 326 #define trailer 327 #define subscriptlist 328 #define subscript 329 #define sliceop 330 #define exprlist 331 #define testlist 332 #define dictorsetmaker 333 #define classdef 334 #define arglist 335 #define argument 336 #define comp_iter 337 #define sync_comp_for 338 #define comp_for 339 #define comp_if 340 #define encoding_decl 341 #define yield_expr 342 #define yield_arg 343 #define func_body_suite 344 #define func_type_input 345 #define func_type 346 #define typelist 347
2,118
C++
.h
93
21.763441
30
0.825593
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,514
pyfpe.h
relativty_Relativty/Relativty_Driver/include/Python/pyfpe.h
#ifndef Py_PYFPE_H #define Py_PYFPE_H /* These macros used to do something when Python was built with --with-fpectl, * but support for that was dropped in 3.7. We continue to define them though, * to avoid breaking API users. */ #define PyFPE_START_PROTECT(err_string, leave_stmt) #define PyFPE_END_PROTECT(v) #endif /* !Py_PYFPE_H */
341
C++
.h
9
36.222222
78
0.74772
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,515
frameobject.h
relativty_Relativty/Relativty_Driver/include/Python/frameobject.h
/* Frame object interface */ #ifndef Py_LIMITED_API #ifndef Py_FRAMEOBJECT_H #define Py_FRAMEOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { int b_type; /* what kind of block this is */ int b_handler; /* where to jump to find handler */ int b_level; /* value stack level to pop to */ } PyTryBlock; typedef struct _frame { PyObject_VAR_HEAD struct _frame *f_back; /* previous frame, or NULL */ PyCodeObject *f_code; /* code segment */ PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ PyObject *f_globals; /* global symbol table (PyDictObject) */ PyObject *f_locals; /* local symbol table (any mapping) */ PyObject **f_valuestack; /* points after the last local */ /* Next free slot in f_valuestack. Frame creation sets to f_valuestack. Frame evaluation usually NULLs it, but a frame that yields sets it to the current stack top. */ PyObject **f_stacktop; PyObject *f_trace; /* Trace function */ char f_trace_lines; /* Emit per-line trace events? */ char f_trace_opcodes; /* Emit per-opcode trace events? */ /* Borrowed reference to a generator, or NULL */ PyObject *f_gen; int f_lasti; /* Last instruction if called */ /* Call PyFrame_GetLineNumber() instead of reading this field directly. As of 2.3 f_lineno is only valid when tracing is active (i.e. when f_trace is set). At other times we use PyCode_Addr2Line to calculate the line from the current bytecode index. */ int f_lineno; /* Current line number */ int f_iblock; /* index in f_blockstack */ char f_executing; /* whether the frame is still executing */ PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ } PyFrameObject; /* Standard object interface */ PyAPI_DATA(PyTypeObject) PyFrame_Type; #define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type) PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, PyObject *, PyObject *); /* only internal use */ PyFrameObject* _PyFrame_New_NoTrack(PyThreadState *, PyCodeObject *, PyObject *, PyObject *); /* The rest of the interface is specific for frame objects */ /* Block management functions */ PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); /* Extend the value stack */ PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int); /* Conversions between "fast locals" and locals in dictionary */ PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f); PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); PyAPI_FUNC(int) PyFrame_ClearFreeList(void); PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out); /* Return the line of code the frame is currently executing. */ PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *); #ifdef __cplusplus } #endif #endif /* !Py_FRAMEOBJECT_H */ #endif /* Py_LIMITED_API */
3,317
C++
.h
68
44.279412
76
0.665116
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,516
funcobject.h
relativty_Relativty/Relativty_Driver/include/Python/funcobject.h
/* Function object interface */ #ifndef Py_LIMITED_API #ifndef Py_FUNCOBJECT_H #define Py_FUNCOBJECT_H #ifdef __cplusplus extern "C" { #endif /* Function objects and code objects should not be confused with each other: * * Function objects are created by the execution of the 'def' statement. * They reference a code object in their __code__ attribute, which is a * purely syntactic object, i.e. nothing more than a compiled version of some * source code lines. There is one code object per source code "fragment", * but each code object can be referenced by zero or many function objects * depending only on how many times the 'def' statement in the source was * executed so far. */ typedef struct { PyObject_HEAD PyObject *func_code; /* A code object, the __code__ attribute */ PyObject *func_globals; /* A dictionary (other mappings won't do) */ PyObject *func_defaults; /* NULL or a tuple */ PyObject *func_kwdefaults; /* NULL or a dict */ PyObject *func_closure; /* NULL or a tuple of cell objects */ PyObject *func_doc; /* The __doc__ attribute, can be anything */ PyObject *func_name; /* The __name__ attribute, a string object */ PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */ PyObject *func_weakreflist; /* List of weak references */ PyObject *func_module; /* The __module__ attribute, can be anything */ PyObject *func_annotations; /* Annotations, a dict or NULL */ PyObject *func_qualname; /* The qualified name */ vectorcallfunc vectorcall; /* Invariant: * func_closure contains the bindings for func_code->co_freevars, so * PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code) * (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0). */ } PyFunctionObject; PyAPI_DATA(PyTypeObject) PyFunction_Type; #define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type) PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_NewWithQualName(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetKwDefaults(PyObject *); PyAPI_FUNC(int) PyFunction_SetKwDefaults(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *); PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyFunction_FastCallDict( PyObject *func, PyObject *const *args, Py_ssize_t nargs, PyObject *kwargs); PyAPI_FUNC(PyObject *) _PyFunction_Vectorcall( PyObject *func, PyObject *const *stack, size_t nargsf, PyObject *kwnames); #endif /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #define PyFunction_GET_CODE(func) \ (((PyFunctionObject *)func) -> func_code) #define PyFunction_GET_GLOBALS(func) \ (((PyFunctionObject *)func) -> func_globals) #define PyFunction_GET_MODULE(func) \ (((PyFunctionObject *)func) -> func_module) #define PyFunction_GET_DEFAULTS(func) \ (((PyFunctionObject *)func) -> func_defaults) #define PyFunction_GET_KW_DEFAULTS(func) \ (((PyFunctionObject *)func) -> func_kwdefaults) #define PyFunction_GET_CLOSURE(func) \ (((PyFunctionObject *)func) -> func_closure) #define PyFunction_GET_ANNOTATIONS(func) \ (((PyFunctionObject *)func) -> func_annotations) /* The classmethod and staticmethod types lives here, too */ PyAPI_DATA(PyTypeObject) PyClassMethod_Type; PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *); PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); #ifdef __cplusplus } #endif #endif /* !Py_FUNCOBJECT_H */ #endif /* Py_LIMITED_API */
4,200
C++
.h
91
43.032967
86
0.7146
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,517
floatobject.h
relativty_Relativty/Relativty_Driver/include/Python/floatobject.h
/* Float object interface */ /* PyFloatObject represents a (double precision) floating point number. */ #ifndef Py_FLOATOBJECT_H #define Py_FLOATOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API typedef struct { PyObject_HEAD double ob_fval; } PyFloatObject; #endif PyAPI_DATA(PyTypeObject) PyFloat_Type; #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) #define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type) #ifdef Py_NAN #define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN) #endif #define Py_RETURN_INF(sign) do \ if (copysign(1., sign) == 1.) { \ return PyFloat_FromDouble(Py_HUGE_VAL); \ } else { \ return PyFloat_FromDouble(-Py_HUGE_VAL); \ } while(0) PyAPI_FUNC(double) PyFloat_GetMax(void); PyAPI_FUNC(double) PyFloat_GetMin(void); PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void); /* Return Python float from string PyObject. */ PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*); /* Return Python float from C double. */ PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double); /* Extract C double from Python float. The macro version trades safety for speed. */ PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *); #ifndef Py_LIMITED_API #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) #endif #ifndef Py_LIMITED_API /* _PyFloat_{Pack,Unpack}{4,8} * * The struct and pickle (at least) modules need an efficient platform- * independent way to store floating-point values as byte strings. * The Pack routines produce a string from a C double, and the Unpack * routines produce a C double from such a string. The suffix (4 or 8) * specifies the number of bytes in the string. * * On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats * these functions work by copying bits. On other platforms, the formats the * 4- byte format is identical to the IEEE-754 single precision format, and * the 8-byte format to the IEEE-754 double precision format, although the * packing of INFs and NaNs (if such things exist on the platform) isn't * handled correctly, and attempting to unpack a string containing an IEEE * INF or NaN will raise an exception. * * On non-IEEE platforms with more precision, or larger dynamic range, than * 754 supports, not all values can be packed; on non-IEEE platforms with less * precision, or smaller dynamic range, not all values can be unpacked. What * happens in such cases is partly accidental (alas). */ /* The pack routines write 2, 4 or 8 bytes, starting at p. le is a bool * argument, true if you want the string in little-endian format (exponent * last, at p+1, p+3 or p+7), false if you want big-endian format (exponent * first, at p). * Return value: 0 if all is OK, -1 if error (and an exception is * set, most likely OverflowError). * There are two problems on non-IEEE platforms: * 1): What this does is undefined if x is a NaN or infinity. * 2): -0.0 and +0.0 produce the same string. */ PyAPI_FUNC(int) _PyFloat_Pack2(double x, unsigned char *p, int le); PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le); PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le); /* Needed for the old way for marshal to store a floating point number. Returns the string length copied into p, -1 on error. */ PyAPI_FUNC(int) _PyFloat_Repr(double x, char *p, size_t len); /* Used to get the important decimal digits of a double */ PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum); PyAPI_FUNC(void) _PyFloat_DigitsInit(void); /* The unpack routines read 2, 4 or 8 bytes, starting at p. le is a bool * argument, true if the string is in little-endian format (exponent * last, at p+1, p+3 or p+7), false if big-endian (exponent first, at p). * Return value: The unpacked double. On error, this is -1.0 and * PyErr_Occurred() is true (and an exception is set, most likely * OverflowError). Note that on a non-IEEE platform this will refuse * to unpack a string that represents a NaN or infinity. */ PyAPI_FUNC(double) _PyFloat_Unpack2(const unsigned char *p, int le); PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le); PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le); /* free list api */ PyAPI_FUNC(int) PyFloat_ClearFreeList(void); PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter( _PyUnicodeWriter *writer, PyObject *obj, PyObject *format_spec, Py_ssize_t start, Py_ssize_t end); #endif /* Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_FLOATOBJECT_H */
4,794
C++
.h
109
41.853211
78
0.727273
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,518
pystrhex.h
relativty_Relativty/Relativty_Driver/include/Python/pystrhex.h
#ifndef Py_STRHEX_H #define Py_STRHEX_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API /* Returns a str() containing the hex representation of argbuf. */ PyAPI_FUNC(PyObject*) _Py_strhex(const char* argbuf, const Py_ssize_t arglen); /* Returns a bytes() containing the ASCII hex representation of argbuf. */ PyAPI_FUNC(PyObject*) _Py_strhex_bytes(const char* argbuf, const Py_ssize_t arglen); /* These variants include support for a separator between every N bytes: */ PyAPI_FUNC(PyObject*) _Py_strhex_with_sep(const char* argbuf, const Py_ssize_t arglen, const PyObject* sep, const int bytes_per_group); PyAPI_FUNC(PyObject*) _Py_strhex_bytes_with_sep(const char* argbuf, const Py_ssize_t arglen, const PyObject* sep, const int bytes_per_group); #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_STRHEX_H */
849
C++
.h
18
45.944444
141
0.750907
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,519
pydtrace.h
relativty_Relativty/Relativty_Driver/include/Python/pydtrace.h
/* Static DTrace probes interface */ #ifndef Py_DTRACE_H #define Py_DTRACE_H #ifdef __cplusplus extern "C" { #endif #ifdef WITH_DTRACE #include "pydtrace_probes.h" /* pydtrace_probes.h, on systems with DTrace, is auto-generated to include `PyDTrace_{PROBE}` and `PyDTrace_{PROBE}_ENABLED()` macros for every probe defined in pydtrace_provider.d. Calling these functions must be guarded by a `PyDTrace_{PROBE}_ENABLED()` check to minimize performance impact when probing is off. For example: if (PyDTrace_FUNCTION_ENTRY_ENABLED()) PyDTrace_FUNCTION_ENTRY(f); */ #else /* Without DTrace, compile to nothing. */ static inline void PyDTrace_LINE(const char *arg0, const char *arg1, int arg2) {} static inline void PyDTrace_FUNCTION_ENTRY(const char *arg0, const char *arg1, int arg2) {} static inline void PyDTrace_FUNCTION_RETURN(const char *arg0, const char *arg1, int arg2) {} static inline void PyDTrace_GC_START(int arg0) {} static inline void PyDTrace_GC_DONE(Py_ssize_t arg0) {} static inline void PyDTrace_INSTANCE_NEW_START(int arg0) {} static inline void PyDTrace_INSTANCE_NEW_DONE(int arg0) {} static inline void PyDTrace_INSTANCE_DELETE_START(int arg0) {} static inline void PyDTrace_INSTANCE_DELETE_DONE(int arg0) {} static inline void PyDTrace_IMPORT_FIND_LOAD_START(const char *arg0) {} static inline void PyDTrace_IMPORT_FIND_LOAD_DONE(const char *arg0, int arg1) {} static inline void PyDTrace_AUDIT(const char *arg0, void *arg1) {} static inline int PyDTrace_LINE_ENABLED(void) { return 0; } static inline int PyDTrace_FUNCTION_ENTRY_ENABLED(void) { return 0; } static inline int PyDTrace_FUNCTION_RETURN_ENABLED(void) { return 0; } static inline int PyDTrace_GC_START_ENABLED(void) { return 0; } static inline int PyDTrace_GC_DONE_ENABLED(void) { return 0; } static inline int PyDTrace_INSTANCE_NEW_START_ENABLED(void) { return 0; } static inline int PyDTrace_INSTANCE_NEW_DONE_ENABLED(void) { return 0; } static inline int PyDTrace_INSTANCE_DELETE_START_ENABLED(void) { return 0; } static inline int PyDTrace_INSTANCE_DELETE_DONE_ENABLED(void) { return 0; } static inline int PyDTrace_IMPORT_FIND_LOAD_START_ENABLED(void) { return 0; } static inline int PyDTrace_IMPORT_FIND_LOAD_DONE_ENABLED(void) { return 0; } static inline int PyDTrace_AUDIT_ENABLED(void) { return 0; } #endif /* !WITH_DTRACE */ #ifdef __cplusplus } #endif #endif /* !Py_DTRACE_H */
2,413
C++
.h
47
49.446809
92
0.762532
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,520
complexobject.h
relativty_Relativty/Relativty_Driver/include/Python/complexobject.h
/* Complex number structure */ #ifndef Py_COMPLEXOBJECT_H #define Py_COMPLEXOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API typedef struct { double real; double imag; } Py_complex; /* Operations on complex numbers from complexmodule.c */ PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex); PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex); PyAPI_FUNC(double) _Py_c_abs(Py_complex); #endif /* Complex object interface */ /* PyComplexObject represents a complex number with double-precision real and imaginary parts. */ #ifndef Py_LIMITED_API typedef struct { PyObject_HEAD Py_complex cval; } PyComplexObject; #endif PyAPI_DATA(PyTypeObject) PyComplex_Type; #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) #define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type) #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); #endif PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op); PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op); #ifndef Py_LIMITED_API PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); #endif /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyComplex_FormatAdvancedWriter( _PyUnicodeWriter *writer, PyObject *obj, PyObject *format_spec, Py_ssize_t start, Py_ssize_t end); #endif #ifdef __cplusplus } #endif #endif /* !Py_COMPLEXOBJECT_H */
1,807
C++
.h
57
29.807018
71
0.767549
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,521
object.h
relativty_Relativty/Relativty_Driver/include/Python/object.h
#ifndef Py_OBJECT_H #define Py_OBJECT_H #include "pymem.h" /* _Py_tracemalloc_config */ #ifdef __cplusplus extern "C" { #endif /* Object and type object interface */ /* Objects are structures allocated on the heap. Special rules apply to the use of objects to ensure they are properly garbage-collected. Objects are never allocated statically or on the stack; they must be accessed through special macros and functions only. (Type objects are exceptions to the first rule; the standard types are represented by statically initialized type objects, although work on type/class unification for Python 2.2 made it possible to have heap-allocated type objects too). An object has a 'reference count' that is increased or decreased when a pointer to the object is copied or deleted; when the reference count reaches zero there are no references to the object left and it can be removed from the heap. An object has a 'type' that determines what it represents and what kind of data it contains. An object's type is fixed when it is created. Types themselves are represented as objects; an object contains a pointer to the corresponding type object. The type itself has a type pointer pointing to the object representing the type 'type', which contains a pointer to itself!. Objects do not float around in memory; once allocated an object keeps the same size and address. Objects that must hold variable-size data can contain pointers to variable-size parts of the object. Not all objects of the same type have the same size; but the size cannot change after allocation. (These restrictions are made so a reference to an object can be simply a pointer -- moving an object would require updating all the pointers, and changing an object's size would require moving it if there was another object right next to it.) Objects are always accessed through pointers of the type 'PyObject *'. The type 'PyObject' is a structure that only contains the reference count and the type pointer. The actual memory allocated for an object contains other data that can only be accessed after casting the pointer to a pointer to a longer structure type. This longer type must start with the reference count and type fields; the macro PyObject_HEAD should be used for this (to accommodate for future changes). The implementation of a particular object type can cast the object pointer to the proper type and back. A standard interface exists for objects that contain an array of items whose size is determined when the object is allocated. */ /* Py_DEBUG implies Py_REF_DEBUG. */ #if defined(Py_DEBUG) && !defined(Py_REF_DEBUG) #define Py_REF_DEBUG #endif #if defined(Py_LIMITED_API) && defined(Py_REF_DEBUG) #error Py_LIMITED_API is incompatible with Py_DEBUG, Py_TRACE_REFS, and Py_REF_DEBUG #endif #ifdef Py_TRACE_REFS /* Define pointers to support a doubly-linked list of all live heap objects. */ #define _PyObject_HEAD_EXTRA \ struct _object *_ob_next; \ struct _object *_ob_prev; #define _PyObject_EXTRA_INIT 0, 0, #else #define _PyObject_HEAD_EXTRA #define _PyObject_EXTRA_INIT #endif /* PyObject_HEAD defines the initial segment of every PyObject. */ #define PyObject_HEAD PyObject ob_base; #define PyObject_HEAD_INIT(type) \ { _PyObject_EXTRA_INIT \ 1, type }, #define PyVarObject_HEAD_INIT(type, size) \ { PyObject_HEAD_INIT(type) size }, /* PyObject_VAR_HEAD defines the initial segment of all variable-size * container objects. These end with a declaration of an array with 1 * element, but enough space is malloc'ed so that the array actually * has room for ob_size elements. Note that ob_size is an element count, * not necessarily a byte count. */ #define PyObject_VAR_HEAD PyVarObject ob_base; #define Py_INVALID_SIZE (Py_ssize_t)-1 /* Nothing is actually declared to be a PyObject, but every pointer to * a Python object can be cast to a PyObject*. This is inheritance built * by hand. Similarly every pointer to a variable-size Python object can, * in addition, be cast to PyVarObject*. */ typedef struct _object { _PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt; struct _typeobject *ob_type; } PyObject; /* Cast argument to PyObject* type. */ #define _PyObject_CAST(op) ((PyObject*)(op)) typedef struct { PyObject ob_base; Py_ssize_t ob_size; /* Number of items in variable part */ } PyVarObject; /* Cast argument to PyVarObject* type. */ #define _PyVarObject_CAST(op) ((PyVarObject*)(op)) #define Py_REFCNT(ob) (_PyObject_CAST(ob)->ob_refcnt) #define Py_TYPE(ob) (_PyObject_CAST(ob)->ob_type) #define Py_SIZE(ob) (_PyVarObject_CAST(ob)->ob_size) /* Type objects contain a string containing the type name (to help somewhat in debugging), the allocation parameters (see PyObject_New() and PyObject_NewVar()), and methods for accessing objects of the type. Methods are optional, a nil pointer meaning that particular kind of access is not available for this type. The Py_DECREF() macro uses the tp_dealloc method without checking for a nil pointer; it should always be implemented except if the implementation can guarantee that the reference count will never reach zero (e.g., for statically allocated type objects). NB: the methods for certain type groups are now contained in separate method blocks. */ typedef PyObject * (*unaryfunc)(PyObject *); typedef PyObject * (*binaryfunc)(PyObject *, PyObject *); typedef PyObject * (*ternaryfunc)(PyObject *, PyObject *, PyObject *); typedef int (*inquiry)(PyObject *); typedef Py_ssize_t (*lenfunc)(PyObject *); typedef PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t); typedef PyObject *(*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t); typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *); typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *); typedef int (*objobjproc)(PyObject *, PyObject *); typedef int (*visitproc)(PyObject *, void *); typedef int (*traverseproc)(PyObject *, visitproc, void *); typedef void (*freefunc)(void *); typedef void (*destructor)(PyObject *); typedef PyObject *(*getattrfunc)(PyObject *, char *); typedef PyObject *(*getattrofunc)(PyObject *, PyObject *); typedef int (*setattrfunc)(PyObject *, char *, PyObject *); typedef int (*setattrofunc)(PyObject *, PyObject *, PyObject *); typedef PyObject *(*reprfunc)(PyObject *); typedef Py_hash_t (*hashfunc)(PyObject *); typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int); typedef PyObject *(*getiterfunc) (PyObject *); typedef PyObject *(*iternextfunc) (PyObject *); typedef PyObject *(*descrgetfunc) (PyObject *, PyObject *, PyObject *); typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *); typedef int (*initproc)(PyObject *, PyObject *, PyObject *); typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *); typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t); #ifdef Py_LIMITED_API /* In Py_LIMITED_API, PyTypeObject is an opaque structure. */ typedef struct _typeobject PyTypeObject; #else /* PyTypeObject is defined in cpython/object.h */ #endif typedef struct{ int slot; /* slot id, see below */ void *pfunc; /* function pointer */ } PyType_Slot; typedef struct{ const char* name; int basicsize; int itemsize; unsigned int flags; PyType_Slot *slots; /* terminated by slot==0. */ } PyType_Spec; PyAPI_FUNC(PyObject*) PyType_FromSpec(PyType_Spec*); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyType_FromSpecWithBases(PyType_Spec*, PyObject*); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(void*) PyType_GetSlot(struct _typeobject*, int); #endif /* Generic type check */ PyAPI_FUNC(int) PyType_IsSubtype(struct _typeobject *, struct _typeobject *); #define PyObject_TypeCheck(ob, tp) \ (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp))) PyAPI_DATA(struct _typeobject) PyType_Type; /* built-in 'type' */ PyAPI_DATA(struct _typeobject) PyBaseObject_Type; /* built-in 'object' */ PyAPI_DATA(struct _typeobject) PySuper_Type; /* built-in 'super' */ PyAPI_FUNC(unsigned long) PyType_GetFlags(struct _typeobject*); #define PyType_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS) #define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type) PyAPI_FUNC(int) PyType_Ready(struct _typeobject *); PyAPI_FUNC(PyObject *) PyType_GenericAlloc(struct _typeobject *, Py_ssize_t); PyAPI_FUNC(PyObject *) PyType_GenericNew(struct _typeobject *, PyObject *, PyObject *); PyAPI_FUNC(unsigned int) PyType_ClearCache(void); PyAPI_FUNC(void) PyType_Modified(struct _typeobject *); /* Generic operations on objects */ PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); PyAPI_FUNC(PyObject *) PyObject_ASCII(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Bytes(PyObject *); PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *); PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *); PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *); PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *); PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, PyObject *, PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyObject_GenericSetDict(PyObject *, PyObject *, void *); #endif PyAPI_FUNC(Py_hash_t) PyObject_Hash(PyObject *); PyAPI_FUNC(Py_hash_t) PyObject_HashNotImplemented(PyObject *); PyAPI_FUNC(int) PyObject_IsTrue(PyObject *); PyAPI_FUNC(int) PyObject_Not(PyObject *); PyAPI_FUNC(int) PyCallable_Check(PyObject *); PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *); /* PyObject_Dir(obj) acts like Python builtins.dir(obj), returning a list of strings. PyObject_Dir(NULL) is like builtins.dir(), returning the names of the current locals. In this case, if there are no current locals, NULL is returned, and PyErr_Occurred() is false. */ PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *); /* Helpers for printing recursive container types */ PyAPI_FUNC(int) Py_ReprEnter(PyObject *); PyAPI_FUNC(void) Py_ReprLeave(PyObject *); /* Flag bits for printing: */ #define Py_PRINT_RAW 1 /* No string quotes etc. */ /* Type flags (tp_flags) These flags are used to change expected features and behavior for a particular type. Arbitration of the flag bit positions will need to be coordinated among all extension writers who publicly release their extensions (this will be fewer than you might expect!). Most flags were removed as of Python 3.0 to make room for new flags. (Some flags are not for backwards compatibility but to indicate the presence of an optional feature; these flags remain of course.) Type definitions should use Py_TPFLAGS_DEFAULT for their tp_flags value. Code can use PyType_HasFeature(type_ob, flag_value) to test whether the given type object has a specified feature. */ /* Set if the type object is dynamically allocated */ #define Py_TPFLAGS_HEAPTYPE (1UL << 9) /* Set if the type allows subclassing */ #define Py_TPFLAGS_BASETYPE (1UL << 10) /* Set if the type implements the vectorcall protocol (PEP 590) */ #ifndef Py_LIMITED_API #define _Py_TPFLAGS_HAVE_VECTORCALL (1UL << 11) #endif /* Set if the type is 'ready' -- fully initialized */ #define Py_TPFLAGS_READY (1UL << 12) /* Set while the type is being 'readied', to prevent recursive ready calls */ #define Py_TPFLAGS_READYING (1UL << 13) /* Objects support garbage collection (see objimpl.h) */ #define Py_TPFLAGS_HAVE_GC (1UL << 14) /* These two bits are preserved for Stackless Python, next after this is 17 */ #ifdef STACKLESS #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3UL << 15) #else #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 #endif /* Objects behave like an unbound method */ #define Py_TPFLAGS_METHOD_DESCRIPTOR (1UL << 17) /* Objects support type attribute cache */ #define Py_TPFLAGS_HAVE_VERSION_TAG (1UL << 18) #define Py_TPFLAGS_VALID_VERSION_TAG (1UL << 19) /* Type is abstract and cannot be instantiated */ #define Py_TPFLAGS_IS_ABSTRACT (1UL << 20) /* These flags are used to determine if a type is a subclass. */ #define Py_TPFLAGS_LONG_SUBCLASS (1UL << 24) #define Py_TPFLAGS_LIST_SUBCLASS (1UL << 25) #define Py_TPFLAGS_TUPLE_SUBCLASS (1UL << 26) #define Py_TPFLAGS_BYTES_SUBCLASS (1UL << 27) #define Py_TPFLAGS_UNICODE_SUBCLASS (1UL << 28) #define Py_TPFLAGS_DICT_SUBCLASS (1UL << 29) #define Py_TPFLAGS_BASE_EXC_SUBCLASS (1UL << 30) #define Py_TPFLAGS_TYPE_SUBCLASS (1UL << 31) #define Py_TPFLAGS_DEFAULT ( \ Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \ Py_TPFLAGS_HAVE_VERSION_TAG | \ 0) /* NOTE: The following flags reuse lower bits (removed as part of the * Python 3.0 transition). */ /* The following flag is kept for compatibility. Starting with 3.8, * binary compatibility of C extensions accross feature releases of * Python is not supported anymore, except when using the stable ABI. */ /* Type structure has tp_finalize member (3.4) */ #define Py_TPFLAGS_HAVE_FINALIZE (1UL << 0) #ifdef Py_LIMITED_API # define PyType_HasFeature(t,f) ((PyType_GetFlags(t) & (f)) != 0) #endif #define PyType_FastSubclass(t,f) PyType_HasFeature(t,f) /* The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement reference counts. Py_DECREF calls the object's deallocator function when the refcount falls to 0; for objects that don't contain references to other objects or heap memory this can be the standard function free(). Both macros can be used wherever a void expression is allowed. The argument must not be a NULL pointer. If it may be NULL, use Py_XINCREF/Py_XDECREF instead. The macro _Py_NewReference(op) initialize reference counts to 1, and in special builds (Py_REF_DEBUG, Py_TRACE_REFS) performs additional bookkeeping appropriate to the special build. We assume that the reference count field can never overflow; this can be proven when the size of the field is the same as the pointer size, so we ignore the possibility. Provided a C int is at least 32 bits (which is implicitly assumed in many parts of this code), that's enough for about 2**31 references to an object. XXX The following became out of date in Python 2.2, but I'm not sure XXX what the full truth is now. Certainly, heap-allocated type objects XXX can and should be deallocated. Type objects should never be deallocated; the type pointer in an object is not considered to be a reference to the type object, to save complications in the deallocation function. (This is actually a decision that's up to the implementer of each new type so if you want, you can count such references to the type object.) */ /* First define a pile of simple helper macros, one set per special * build symbol. These either expand to the obvious things, or to * nothing at all when the special mode isn't in effect. The main * macros can later be defined just once then, yet expand to different * things depending on which special build options are and aren't in effect. * Trust me <wink>: while painful, this is 20x easier to understand than, * e.g, defining _Py_NewReference five different times in a maze of nested * #ifdefs (we used to do that -- it was impenetrable). */ #ifdef Py_REF_DEBUG PyAPI_DATA(Py_ssize_t) _Py_RefTotal; PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno, PyObject *op); PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); #define _Py_INC_REFTOTAL _Py_RefTotal++ #define _Py_DEC_REFTOTAL _Py_RefTotal-- /* Py_REF_DEBUG also controls the display of refcounts and memory block * allocations at the interactive prompt and at interpreter shutdown */ PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void); #else #define _Py_INC_REFTOTAL #define _Py_DEC_REFTOTAL #endif /* Py_REF_DEBUG */ #ifdef COUNT_ALLOCS PyAPI_FUNC(void) _Py_inc_count(struct _typeobject *); PyAPI_FUNC(void) _Py_dec_count(struct _typeobject *); #define _Py_INC_TPALLOCS(OP) _Py_inc_count(Py_TYPE(OP)) #define _Py_INC_TPFREES(OP) _Py_dec_count(Py_TYPE(OP)) #define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees-- #define _Py_COUNT_ALLOCS_COMMA , #else #define _Py_INC_TPALLOCS(OP) #define _Py_INC_TPFREES(OP) #define _Py_DEC_TPFREES(OP) #define _Py_COUNT_ALLOCS_COMMA #endif /* COUNT_ALLOCS */ /* Update the Python traceback of an object. This function must be called when a memory block is reused from a free list. */ PyAPI_FUNC(int) _PyTraceMalloc_NewReference(PyObject *op); #ifdef Py_TRACE_REFS /* Py_TRACE_REFS is such major surgery that we call external routines. */ PyAPI_FUNC(void) _Py_NewReference(PyObject *); PyAPI_FUNC(void) _Py_ForgetReference(PyObject *); PyAPI_FUNC(void) _Py_PrintReferences(FILE *); PyAPI_FUNC(void) _Py_PrintReferenceAddresses(FILE *); PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force); #else /* Without Py_TRACE_REFS, there's little enough to do that we expand code inline. */ static inline void _Py_NewReference(PyObject *op) { if (_Py_tracemalloc_config.tracing) { _PyTraceMalloc_NewReference(op); } _Py_INC_TPALLOCS(op); _Py_INC_REFTOTAL; Py_REFCNT(op) = 1; } static inline void _Py_ForgetReference(PyObject *op) { (void)op; /* may be unused, shut up -Wunused-parameter */ _Py_INC_TPFREES(op); } #endif /* !Py_TRACE_REFS */ PyAPI_FUNC(void) _Py_Dealloc(PyObject *); static inline void _Py_INCREF(PyObject *op) { _Py_INC_REFTOTAL; op->ob_refcnt++; } #define Py_INCREF(op) _Py_INCREF(_PyObject_CAST(op)) static inline void _Py_DECREF(const char *filename, int lineno, PyObject *op) { (void)filename; /* may be unused, shut up -Wunused-parameter */ (void)lineno; /* may be unused, shut up -Wunused-parameter */ _Py_DEC_REFTOTAL; if (--op->ob_refcnt != 0) { #ifdef Py_REF_DEBUG if (op->ob_refcnt < 0) { _Py_NegativeRefcount(filename, lineno, op); } #endif } else { _Py_Dealloc(op); } } #define Py_DECREF(op) _Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op)) /* Safely decref `op` and set `op` to NULL, especially useful in tp_clear * and tp_dealloc implementations. * * Note that "the obvious" code can be deadly: * * Py_XDECREF(op); * op = NULL; * * Typically, `op` is something like self->containee, and `self` is done * using its `containee` member. In the code sequence above, suppose * `containee` is non-NULL with a refcount of 1. Its refcount falls to * 0 on the first line, which can trigger an arbitrary amount of code, * possibly including finalizers (like __del__ methods or weakref callbacks) * coded in Python, which in turn can release the GIL and allow other threads * to run, etc. Such code may even invoke methods of `self` again, or cause * cyclic gc to trigger, but-- oops! --self->containee still points to the * object being torn down, and it may be in an insane state while being torn * down. This has in fact been a rich historic source of miserable (rare & * hard-to-diagnose) segfaulting (and other) bugs. * * The safe way is: * * Py_CLEAR(op); * * That arranges to set `op` to NULL _before_ decref'ing, so that any code * triggered as a side-effect of `op` getting torn down no longer believes * `op` points to a valid object. * * There are cases where it's safe to use the naive code, but they're brittle. * For example, if `op` points to a Python integer, you know that destroying * one of those can't cause problems -- but in part that relies on that * Python integers aren't currently weakly referencable. Best practice is * to use Py_CLEAR() even if you can't think of a reason for why you need to. */ #define Py_CLEAR(op) \ do { \ PyObject *_py_tmp = _PyObject_CAST(op); \ if (_py_tmp != NULL) { \ (op) = NULL; \ Py_DECREF(_py_tmp); \ } \ } while (0) /* Function to use in case the object pointer can be NULL: */ static inline void _Py_XINCREF(PyObject *op) { if (op != NULL) { Py_INCREF(op); } } #define Py_XINCREF(op) _Py_XINCREF(_PyObject_CAST(op)) static inline void _Py_XDECREF(PyObject *op) { if (op != NULL) { Py_DECREF(op); } } #define Py_XDECREF(op) _Py_XDECREF(_PyObject_CAST(op)) /* These are provided as conveniences to Python runtime embedders, so that they can have object code that is not dependent on Python compilation flags. */ PyAPI_FUNC(void) Py_IncRef(PyObject *); PyAPI_FUNC(void) Py_DecRef(PyObject *); /* _Py_NoneStruct is an object of undefined type which can be used in contexts where NULL (nil) is not suitable (since NULL often means 'error'). Don't forget to apply Py_INCREF() when returning this value!!! */ PyAPI_DATA(PyObject) _Py_NoneStruct; /* Don't use this directly */ #define Py_None (&_Py_NoneStruct) /* Macro for returning Py_None from a function */ #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None /* Py_NotImplemented is a singleton used to signal that an operation is not implemented for a given type combination. */ PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */ #define Py_NotImplemented (&_Py_NotImplementedStruct) /* Macro for returning Py_NotImplemented from a function */ #define Py_RETURN_NOTIMPLEMENTED \ return Py_INCREF(Py_NotImplemented), Py_NotImplemented /* Rich comparison opcodes */ #define Py_LT 0 #define Py_LE 1 #define Py_EQ 2 #define Py_NE 3 #define Py_GT 4 #define Py_GE 5 /* * Macro for implementing rich comparisons * * Needs to be a macro because any C-comparable type can be used. */ #define Py_RETURN_RICHCOMPARE(val1, val2, op) \ do { \ switch (op) { \ case Py_EQ: if ((val1) == (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ case Py_NE: if ((val1) != (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ case Py_LT: if ((val1) < (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ case Py_GT: if ((val1) > (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ case Py_LE: if ((val1) <= (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ case Py_GE: if ((val1) >= (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ default: \ Py_UNREACHABLE(); \ } \ } while (0) /* More conventions ================ Argument Checking ----------------- Functions that take objects as arguments normally don't check for nil arguments, but they do check the type of the argument, and return an error if the function doesn't apply to the type. Failure Modes ------------- Functions may fail for a variety of reasons, including running out of memory. This is communicated to the caller in two ways: an error string is set (see errors.h), and the function result differs: functions that normally return a pointer return NULL for failure, functions returning an integer return -1 (which could be a legal return value too!), and other functions return 0 for success and -1 for failure. Callers should always check for errors before using the result. If an error was set, the caller must either explicitly clear it, or pass the error on to its caller. Reference Counts ---------------- It takes a while to get used to the proper usage of reference counts. Functions that create an object set the reference count to 1; such new objects must be stored somewhere or destroyed again with Py_DECREF(). Some functions that 'store' objects, such as PyTuple_SetItem() and PyList_SetItem(), don't increment the reference count of the object, since the most frequent use is to store a fresh object. Functions that 'retrieve' objects, such as PyTuple_GetItem() and PyDict_GetItemString(), also don't increment the reference count, since most frequently the object is only looked at quickly. Thus, to retrieve an object and store it again, the caller must call Py_INCREF() explicitly. NOTE: functions that 'consume' a reference count, like PyList_SetItem(), consume the reference even if the object wasn't successfully stored, to simplify error handling. It seems attractive to make other functions that take an object as argument consume a reference count; however, this may quickly get confusing (even the current practice is already confusing). Consider it carefully, it may save lots of calls to Py_INCREF() and Py_DECREF() at times. */ /* Trashcan mechanism, thanks to Christian Tismer. When deallocating a container object, it's possible to trigger an unbounded chain of deallocations, as each Py_DECREF in turn drops the refcount on "the next" object in the chain to 0. This can easily lead to stack overflows, especially in threads (which typically have less stack space to work with). A container object can avoid this by bracketing the body of its tp_dealloc function with a pair of macros: static void mytype_dealloc(mytype *p) { ... declarations go here ... PyObject_GC_UnTrack(p); // must untrack first Py_TRASHCAN_BEGIN(p, mytype_dealloc) ... The body of the deallocator goes here, including all calls ... ... to Py_DECREF on contained objects. ... Py_TRASHCAN_END // there should be no code after this } CAUTION: Never return from the middle of the body! If the body needs to "get out early", put a label immediately before the Py_TRASHCAN_END call, and goto it. Else the call-depth counter (see below) will stay above 0 forever, and the trashcan will never get emptied. How it works: The BEGIN macro increments a call-depth counter. So long as this counter is small, the body of the deallocator is run directly without further ado. But if the counter gets large, it instead adds p to a list of objects to be deallocated later, skips the body of the deallocator, and resumes execution after the END macro. The tp_dealloc routine then returns without deallocating anything (and so unbounded call-stack depth is avoided). When the call stack finishes unwinding again, code generated by the END macro notices this, and calls another routine to deallocate all the objects that may have been added to the list of deferred deallocations. In effect, a chain of N deallocations is broken into (N-1)/(PyTrash_UNWIND_LEVEL-1) pieces, with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. Since the tp_dealloc of a subclass typically calls the tp_dealloc of the base class, we need to ensure that the trashcan is only triggered on the tp_dealloc of the actual class being deallocated. Otherwise we might end up with a partially-deallocated object. To check this, the tp_dealloc function must be passed as second argument to Py_TRASHCAN_BEGIN(). */ /* The new thread-safe private API, invoked by the macros below. */ PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*); PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void); #define PyTrash_UNWIND_LEVEL 50 #define Py_TRASHCAN_BEGIN_CONDITION(op, cond) \ do { \ PyThreadState *_tstate = NULL; \ /* If "cond" is false, then _tstate remains NULL and the deallocator \ * is run normally without involving the trashcan */ \ if (cond) { \ _tstate = PyThreadState_GET(); \ if (_tstate->trash_delete_nesting >= PyTrash_UNWIND_LEVEL) { \ /* Store the object (to be deallocated later) and jump past \ * Py_TRASHCAN_END, skipping the body of the deallocator */ \ _PyTrash_thread_deposit_object(_PyObject_CAST(op)); \ break; \ } \ ++_tstate->trash_delete_nesting; \ } /* The body of the deallocator is here. */ #define Py_TRASHCAN_END \ if (_tstate) { \ --_tstate->trash_delete_nesting; \ if (_tstate->trash_delete_later && _tstate->trash_delete_nesting <= 0) \ _PyTrash_thread_destroy_chain(); \ } \ } while (0); #define Py_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN_CONDITION(op, \ Py_TYPE(op)->tp_dealloc == (destructor)(dealloc)) /* For backwards compatibility, these macros enable the trashcan * unconditionally */ #define Py_TRASHCAN_SAFE_BEGIN(op) Py_TRASHCAN_BEGIN_CONDITION(op, 1) #define Py_TRASHCAN_SAFE_END(op) Py_TRASHCAN_END #ifndef Py_LIMITED_API # define Py_CPYTHON_OBJECT_H # include "cpython/object.h" # undef Py_CPYTHON_OBJECT_H #endif #ifdef __cplusplus } #endif #endif /* !Py_OBJECT_H */
29,599
C++
.h
627
44.550239
84
0.71795
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,522
moduleobject.h
relativty_Relativty/Relativty_Driver/include/Python/moduleobject.h
/* Module object interface */ #ifndef Py_MODULEOBJECT_H #define Py_MODULEOBJECT_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyModule_Type; #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_NewObject( PyObject *name ); #endif PyAPI_FUNC(PyObject *) PyModule_New( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *); #endif PyAPI_FUNC(const char *) PyModule_GetName(PyObject *); Py_DEPRECATED(3.2) PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *); PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyModule_Clear(PyObject *); PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *); PyAPI_FUNC(int) _PyModuleSpec_IsInitializing(PyObject *); #endif PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*); PyAPI_FUNC(void*) PyModule_GetState(PyObject*); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* New in 3.5 */ PyAPI_FUNC(PyObject *) PyModuleDef_Init(struct PyModuleDef*); PyAPI_DATA(PyTypeObject) PyModuleDef_Type; #endif typedef struct PyModuleDef_Base { PyObject_HEAD PyObject* (*m_init)(void); Py_ssize_t m_index; PyObject* m_copy; } PyModuleDef_Base; #define PyModuleDef_HEAD_INIT { \ PyObject_HEAD_INIT(NULL) \ NULL, /* m_init */ \ 0, /* m_index */ \ NULL, /* m_copy */ \ } struct PyModuleDef_Slot; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* New in 3.5 */ typedef struct PyModuleDef_Slot{ int slot; void *value; } PyModuleDef_Slot; #define Py_mod_create 1 #define Py_mod_exec 2 #ifndef Py_LIMITED_API #define _Py_mod_LAST_SLOT 2 #endif #endif /* New in 3.5 */ typedef struct PyModuleDef{ PyModuleDef_Base m_base; const char* m_name; const char* m_doc; Py_ssize_t m_size; PyMethodDef *m_methods; struct PyModuleDef_Slot* m_slots; traverseproc m_traverse; inquiry m_clear; freefunc m_free; } PyModuleDef; #ifdef __cplusplus } #endif #endif /* !Py_MODULEOBJECT_H */
2,362
C++
.h
76
29
77
0.722271
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,523
pytime.h
relativty_Relativty/Relativty_Driver/include/Python/pytime.h
#ifndef Py_LIMITED_API #ifndef Py_PYTIME_H #define Py_PYTIME_H #include "pyconfig.h" /* include for defines */ #include "object.h" /************************************************************************** Symbols and macros to supply platform-independent interfaces to time related functions and constants **************************************************************************/ #ifdef __cplusplus extern "C" { #endif /* _PyTime_t: Python timestamp with subsecond precision. It can be used to store a duration, and so indirectly a date (related to another date, like UNIX epoch). */ typedef int64_t _PyTime_t; #define _PyTime_MIN INT64_MIN #define _PyTime_MAX INT64_MAX typedef enum { /* Round towards minus infinity (-inf). For example, used to read a clock. */ _PyTime_ROUND_FLOOR=0, /* Round towards infinity (+inf). For example, used for timeout to wait "at least" N seconds. */ _PyTime_ROUND_CEILING=1, /* Round to nearest with ties going to nearest even integer. For example, used to round from a Python float. */ _PyTime_ROUND_HALF_EVEN=2, /* Round away from zero For example, used for timeout. _PyTime_ROUND_CEILING rounds -1e-9 to 0 milliseconds which causes bpo-31786 issue. _PyTime_ROUND_UP rounds -1e-9 to -1 millisecond which keeps the timeout sign as expected. select.poll(timeout) must block for negative values." */ _PyTime_ROUND_UP=3, /* _PyTime_ROUND_TIMEOUT (an alias for _PyTime_ROUND_UP) should be used for timeouts. */ _PyTime_ROUND_TIMEOUT = _PyTime_ROUND_UP } _PyTime_round_t; /* Convert a time_t to a PyLong. */ PyAPI_FUNC(PyObject *) _PyLong_FromTime_t( time_t sec); /* Convert a PyLong to a time_t. */ PyAPI_FUNC(time_t) _PyLong_AsTime_t( PyObject *obj); /* Convert a number of seconds, int or float, to time_t. */ PyAPI_FUNC(int) _PyTime_ObjectToTime_t( PyObject *obj, time_t *sec, _PyTime_round_t); /* Convert a number of seconds, int or float, to a timeval structure. usec is in the range [0; 999999] and rounded towards zero. For example, -1.2 is converted to (-2, 800000). */ PyAPI_FUNC(int) _PyTime_ObjectToTimeval( PyObject *obj, time_t *sec, long *usec, _PyTime_round_t); /* Convert a number of seconds, int or float, to a timespec structure. nsec is in the range [0; 999999999] and rounded towards zero. For example, -1.2 is converted to (-2, 800000000). */ PyAPI_FUNC(int) _PyTime_ObjectToTimespec( PyObject *obj, time_t *sec, long *nsec, _PyTime_round_t); /* Create a timestamp from a number of seconds. */ PyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int seconds); /* Macro to create a timestamp from a number of seconds, no integer overflow. Only use the macro for small values, prefer _PyTime_FromSeconds(). */ #define _PYTIME_FROMSECONDS(seconds) \ ((_PyTime_t)(seconds) * (1000 * 1000 * 1000)) /* Create a timestamp from a number of nanoseconds. */ PyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(_PyTime_t ns); /* Create a timestamp from nanoseconds (Python int). */ PyAPI_FUNC(int) _PyTime_FromNanosecondsObject(_PyTime_t *t, PyObject *obj); /* Convert a number of seconds (Python float or int) to a timetamp. Raise an exception and return -1 on error, return 0 on success. */ PyAPI_FUNC(int) _PyTime_FromSecondsObject(_PyTime_t *t, PyObject *obj, _PyTime_round_t round); /* Convert a number of milliseconds (Python float or int, 10^-3) to a timetamp. Raise an exception and return -1 on error, return 0 on success. */ PyAPI_FUNC(int) _PyTime_FromMillisecondsObject(_PyTime_t *t, PyObject *obj, _PyTime_round_t round); /* Convert a timestamp to a number of seconds as a C double. */ PyAPI_FUNC(double) _PyTime_AsSecondsDouble(_PyTime_t t); /* Convert timestamp to a number of milliseconds (10^-3 seconds). */ PyAPI_FUNC(_PyTime_t) _PyTime_AsMilliseconds(_PyTime_t t, _PyTime_round_t round); /* Convert timestamp to a number of microseconds (10^-6 seconds). */ PyAPI_FUNC(_PyTime_t) _PyTime_AsMicroseconds(_PyTime_t t, _PyTime_round_t round); /* Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int object. */ PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t); /* Create a timestamp from a timeval structure. Raise an exception and return -1 on overflow, return 0 on success. */ PyAPI_FUNC(int) _PyTime_FromTimeval(_PyTime_t *tp, struct timeval *tv); /* Convert a timestamp to a timeval structure (microsecond resolution). tv_usec is always positive. Raise an exception and return -1 if the conversion overflowed, return 0 on success. */ PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t, struct timeval *tv, _PyTime_round_t round); /* Similar to _PyTime_AsTimeval(), but don't raise an exception on error. */ PyAPI_FUNC(int) _PyTime_AsTimeval_noraise(_PyTime_t t, struct timeval *tv, _PyTime_round_t round); /* Convert a timestamp to a number of seconds (secs) and microseconds (us). us is always positive. This function is similar to _PyTime_AsTimeval() except that secs is always a time_t type, whereas the timeval structure uses a C long for tv_sec on Windows. Raise an exception and return -1 if the conversion overflowed, return 0 on success. */ PyAPI_FUNC(int) _PyTime_AsTimevalTime_t( _PyTime_t t, time_t *secs, int *us, _PyTime_round_t round); #if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE) /* Create a timestamp from a timespec structure. Raise an exception and return -1 on overflow, return 0 on success. */ PyAPI_FUNC(int) _PyTime_FromTimespec(_PyTime_t *tp, struct timespec *ts); /* Convert a timestamp to a timespec structure (nanosecond resolution). tv_nsec is always positive. Raise an exception and return -1 on error, return 0 on success. */ PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts); #endif /* Compute ticks * mul / div. The caller must ensure that ((div - 1) * mul) cannot overflow. */ PyAPI_FUNC(_PyTime_t) _PyTime_MulDiv(_PyTime_t ticks, _PyTime_t mul, _PyTime_t div); /* Get the current time from the system clock. The function cannot fail. _PyTime_Init() ensures that the system clock works. */ PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void); /* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. The clock is not affected by system clock updates. The reference point of the returned value is undefined, so that only the difference between the results of consecutive calls is valid. The function cannot fail. _PyTime_Init() ensures that a monotonic clock is available and works. */ PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void); /* Structure used by time.get_clock_info() */ typedef struct { const char *implementation; int monotonic; int adjustable; double resolution; } _Py_clock_info_t; /* Get the current time from the system clock. * Fill clock information if info is not NULL. * Raise an exception and return -1 on error, return 0 on success. */ PyAPI_FUNC(int) _PyTime_GetSystemClockWithInfo( _PyTime_t *t, _Py_clock_info_t *info); /* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. The clock is not affected by system clock updates. The reference point of the returned value is undefined, so that only the difference between the results of consecutive calls is valid. Fill info (if set) with information of the function used to get the time. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_GetMonotonicClockWithInfo( _PyTime_t *t, _Py_clock_info_t *info); /* Initialize time. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_Init(void); /* Converts a timestamp to the Gregorian time, using the local time zone. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm *tm); /* Converts a timestamp to the Gregorian time, assuming UTC. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm); /* Get the performance counter: clock with the highest available resolution to measure a short duration. The function cannot fail. _PyTime_Init() ensures that the system clock works. */ PyAPI_FUNC(_PyTime_t) _PyTime_GetPerfCounter(void); /* Get the performance counter: clock with the highest available resolution to measure a short duration. Fill info (if set) with information of the function used to get the time. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_GetPerfCounterWithInfo( _PyTime_t *t, _Py_clock_info_t *info); #ifdef __cplusplus } #endif #endif /* Py_PYTIME_H */ #endif /* Py_LIMITED_API */
8,926
C++
.h
197
41.979695
79
0.711636
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,524
context.h
relativty_Relativty/Relativty_Driver/include/Python/context.h
#ifndef Py_CONTEXT_H #define Py_CONTEXT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API PyAPI_DATA(PyTypeObject) PyContext_Type; typedef struct _pycontextobject PyContext; PyAPI_DATA(PyTypeObject) PyContextVar_Type; typedef struct _pycontextvarobject PyContextVar; PyAPI_DATA(PyTypeObject) PyContextToken_Type; typedef struct _pycontexttokenobject PyContextToken; #define PyContext_CheckExact(o) (Py_TYPE(o) == &PyContext_Type) #define PyContextVar_CheckExact(o) (Py_TYPE(o) == &PyContextVar_Type) #define PyContextToken_CheckExact(o) (Py_TYPE(o) == &PyContextToken_Type) PyAPI_FUNC(PyObject *) PyContext_New(void); PyAPI_FUNC(PyObject *) PyContext_Copy(PyObject *); PyAPI_FUNC(PyObject *) PyContext_CopyCurrent(void); PyAPI_FUNC(int) PyContext_Enter(PyObject *); PyAPI_FUNC(int) PyContext_Exit(PyObject *); /* Create a new context variable. default_value can be NULL. */ PyAPI_FUNC(PyObject *) PyContextVar_New( const char *name, PyObject *default_value); /* Get a value for the variable. Returns -1 if an error occurred during lookup. Returns 0 if value either was or was not found. If value was found, *value will point to it. If not, it will point to: - default_value, if not NULL; - the default value of "var", if not NULL; - NULL. '*value' will be a new ref, if not NULL. */ PyAPI_FUNC(int) PyContextVar_Get( PyObject *var, PyObject *default_value, PyObject **value); /* Set a new value for the variable. Returns NULL if an error occurs. */ PyAPI_FUNC(PyObject *) PyContextVar_Set(PyObject *var, PyObject *value); /* Reset a variable to its previous value. Returns 0 on success, -1 on error. */ PyAPI_FUNC(int) PyContextVar_Reset(PyObject *var, PyObject *token); /* This method is exposed only for CPython tests. Don not use it. */ PyAPI_FUNC(PyObject *) _PyContext_NewHamtForTests(void); PyAPI_FUNC(int) PyContext_ClearFreeList(void); #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_CONTEXT_H */
2,014
C++
.h
53
35.641509
73
0.75544
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,525
pyhash.h
relativty_Relativty/Relativty_Driver/include/Python/pyhash.h
#ifndef Py_HASH_H #define Py_HASH_H #ifdef __cplusplus extern "C" { #endif /* Helpers for hash functions */ #ifndef Py_LIMITED_API PyAPI_FUNC(Py_hash_t) _Py_HashDouble(double); PyAPI_FUNC(Py_hash_t) _Py_HashPointer(void*); PyAPI_FUNC(Py_hash_t) _Py_HashBytes(const void*, Py_ssize_t); #endif /* Prime multiplier used in string and various other hashes. */ #define _PyHASH_MULTIPLIER 1000003UL /* 0xf4243 */ /* Parameters used for the numeric hash implementation. See notes for _Py_HashDouble in Python/pyhash.c. Numeric hashes are based on reduction modulo the prime 2**_PyHASH_BITS - 1. */ #if SIZEOF_VOID_P >= 8 # define _PyHASH_BITS 61 #else # define _PyHASH_BITS 31 #endif #define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1) #define _PyHASH_INF 314159 #define _PyHASH_NAN 0 #define _PyHASH_IMAG _PyHASH_MULTIPLIER /* hash secret * * memory layout on 64 bit systems * cccccccc cccccccc cccccccc uc -- unsigned char[24] * pppppppp ssssssss ........ fnv -- two Py_hash_t * k0k0k0k0 k1k1k1k1 ........ siphash -- two uint64_t * ........ ........ ssssssss djbx33a -- 16 bytes padding + one Py_hash_t * ........ ........ eeeeeeee pyexpat XML hash salt * * memory layout on 32 bit systems * cccccccc cccccccc cccccccc uc * ppppssss ........ ........ fnv -- two Py_hash_t * k0k0k0k0 k1k1k1k1 ........ siphash -- two uint64_t (*) * ........ ........ ssss.... djbx33a -- 16 bytes padding + one Py_hash_t * ........ ........ eeee.... pyexpat XML hash salt * * (*) The siphash member may not be available on 32 bit platforms without * an unsigned int64 data type. */ #ifndef Py_LIMITED_API typedef union { /* ensure 24 bytes */ unsigned char uc[24]; /* two Py_hash_t for FNV */ struct { Py_hash_t prefix; Py_hash_t suffix; } fnv; /* two uint64 for SipHash24 */ struct { uint64_t k0; uint64_t k1; } siphash; /* a different (!) Py_hash_t for small string optimization */ struct { unsigned char padding[16]; Py_hash_t suffix; } djbx33a; struct { unsigned char padding[16]; Py_hash_t hashsalt; } expat; } _Py_HashSecret_t; PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret; #endif #ifdef Py_DEBUG PyAPI_DATA(int) _Py_HashSecret_Initialized; #endif /* hash function definition */ #ifndef Py_LIMITED_API typedef struct { Py_hash_t (*const hash)(const void *, Py_ssize_t); const char *name; const int hash_bits; const int seed_bits; } PyHash_FuncDef; PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void); #endif /* cutoff for small string DJBX33A optimization in range [1, cutoff). * * About 50% of the strings in a typical Python application are smaller than * 6 to 7 chars. However DJBX33A is vulnerable to hash collision attacks. * NEVER use DJBX33A for long strings! * * A Py_HASH_CUTOFF of 0 disables small string optimization. 32 bit platforms * should use a smaller cutoff because it is easier to create colliding * strings. A cutoff of 7 on 64bit platforms and 5 on 32bit platforms should * provide a decent safety margin. */ #ifndef Py_HASH_CUTOFF # define Py_HASH_CUTOFF 0 #elif (Py_HASH_CUTOFF > 7 || Py_HASH_CUTOFF < 0) # error Py_HASH_CUTOFF must in range 0...7. #endif /* Py_HASH_CUTOFF */ /* hash algorithm selection * * The values for Py_HASH_SIPHASH24 and Py_HASH_FNV are hard-coded in the * configure script. * * - FNV is available on all platforms and architectures. * - SIPHASH24 only works on platforms that don't require aligned memory for integers. * - With EXTERNAL embedders can provide an alternative implementation with:: * * PyHash_FuncDef PyHash_Func = {...}; * * XXX: Figure out __declspec() for extern PyHash_FuncDef. */ #define Py_HASH_EXTERNAL 0 #define Py_HASH_SIPHASH24 1 #define Py_HASH_FNV 2 #ifndef Py_HASH_ALGORITHM # ifndef HAVE_ALIGNED_REQUIRED # define Py_HASH_ALGORITHM Py_HASH_SIPHASH24 # else # define Py_HASH_ALGORITHM Py_HASH_FNV # endif /* uint64_t && uint32_t && aligned */ #endif /* Py_HASH_ALGORITHM */ #ifdef __cplusplus } #endif #endif /* !Py_HASH_H */
4,140
C++
.h
126
30.293651
86
0.685607
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,526
osmodule.h
relativty_Relativty/Relativty_Driver/include/Python/osmodule.h
/* os module interface */ #ifndef Py_OSMODULE_H #define Py_OSMODULE_H #ifdef __cplusplus extern "C" { #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(PyObject *) PyOS_FSPath(PyObject *path); #endif #ifdef __cplusplus } #endif #endif /* !Py_OSMODULE_H */
291
C++
.h
13
21.076923
62
0.729927
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,527
ucnhash.h
relativty_Relativty/Relativty_Driver/include/Python/ucnhash.h
/* Unicode name database interface */ #ifndef Py_LIMITED_API #ifndef Py_UCNHASH_H #define Py_UCNHASH_H #ifdef __cplusplus extern "C" { #endif /* revised ucnhash CAPI interface (exported through a "wrapper") */ #define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI" typedef struct { /* Size of this struct */ int size; /* Get name for a given character code. Returns non-zero if success, zero if not. Does not set Python exceptions. If self is NULL, data come from the default version of the database. If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */ int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen, int with_alias_and_seq); /* Get character code for a given name. Same error handling as for getname. */ int (*getcode)(PyObject *self, const char* name, int namelen, Py_UCS4* code, int with_named_seq); } _PyUnicode_Name_CAPI; #ifdef __cplusplus } #endif #endif /* !Py_UCNHASH_H */ #endif /* !Py_LIMITED_API */
1,056
C++
.h
28
33.214286
80
0.681373
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,528
codecs.h
relativty_Relativty/Relativty_Driver/include/Python/codecs.h
#ifndef Py_CODECREGISTRY_H #define Py_CODECREGISTRY_H #ifdef __cplusplus extern "C" { #endif /* ------------------------------------------------------------------------ Python Codec Registry and support functions Written by Marc-Andre Lemburg (mal@lemburg.com). Copyright (c) Corporation for National Research Initiatives. ------------------------------------------------------------------------ */ /* Register a new codec search function. As side effect, this tries to load the encodings package, if not yet done, to make sure that it is always first in the list of search functions. The search_function's refcount is incremented by this function. */ PyAPI_FUNC(int) PyCodec_Register( PyObject *search_function ); /* Codec registry lookup API. Looks up the given encoding and returns a CodecInfo object with function attributes which implement the different aspects of processing the encoding. The encoding string is looked up converted to all lower-case characters. This makes encodings looked up through this mechanism effectively case-insensitive. If no codec is found, a KeyError is set and NULL returned. As side effect, this tries to load the encodings package, if not yet done. This is part of the lazy load strategy for the encodings package. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyCodec_Lookup( const char *encoding ); PyAPI_FUNC(int) _PyCodec_Forget( const char *encoding ); #endif /* Codec registry encoding check API. Returns 1/0 depending on whether there is a registered codec for the given encoding. */ PyAPI_FUNC(int) PyCodec_KnownEncoding( const char *encoding ); /* Generic codec based encoding API. object is passed through the encoder function found for the given encoding using the error handling method defined by errors. errors may be NULL to use the default method defined for the codec. Raises a LookupError in case no encoder can be found. */ PyAPI_FUNC(PyObject *) PyCodec_Encode( PyObject *object, const char *encoding, const char *errors ); /* Generic codec based decoding API. object is passed through the decoder function found for the given encoding using the error handling method defined by errors. errors may be NULL to use the default method defined for the codec. Raises a LookupError in case no encoder can be found. */ PyAPI_FUNC(PyObject *) PyCodec_Decode( PyObject *object, const char *encoding, const char *errors ); #ifndef Py_LIMITED_API /* Text codec specific encoding and decoding API. Checks the encoding against a list of codecs which do not implement a str<->bytes encoding before attempting the operation. Please note that these APIs are internal and should not be used in Python C extensions. XXX (ncoghlan): should we make these, or something like them, public in Python 3.5+? */ PyAPI_FUNC(PyObject *) _PyCodec_LookupTextEncoding( const char *encoding, const char *alternate_command ); PyAPI_FUNC(PyObject *) _PyCodec_EncodeText( PyObject *object, const char *encoding, const char *errors ); PyAPI_FUNC(PyObject *) _PyCodec_DecodeText( PyObject *object, const char *encoding, const char *errors ); /* These two aren't actually text encoding specific, but _io.TextIOWrapper * is the only current API consumer. */ PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalDecoder( PyObject *codec_info, const char *errors ); PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder( PyObject *codec_info, const char *errors ); #endif /* --- Codec Lookup APIs -------------------------------------------------- All APIs return a codec object with incremented refcount and are based on _PyCodec_Lookup(). The same comments w/r to the encoding name also apply to these APIs. */ /* Get an encoder function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_Encoder( const char *encoding ); /* Get a decoder function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_Decoder( const char *encoding ); /* Get an IncrementalEncoder object for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder( const char *encoding, const char *errors ); /* Get an IncrementalDecoder object function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder( const char *encoding, const char *errors ); /* Get a StreamReader factory function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_StreamReader( const char *encoding, PyObject *stream, const char *errors ); /* Get a StreamWriter factory function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_StreamWriter( const char *encoding, PyObject *stream, const char *errors ); /* Unicode encoding error handling callback registry API */ /* Register the error handling callback function error under the given name. This function will be called by the codec when it encounters unencodable characters/undecodable bytes and doesn't know the callback name, when name is specified as the error parameter in the call to the encode/decode function. Return 0 on success, -1 on error */ PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error); /* Lookup the error handling callback function registered under the given name. As a special case NULL can be passed, in which case the error handling callback for "strict" will be returned. */ PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name); /* raise exc as an exception */ PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc); /* ignore the unicode error, skipping the faulty input */ PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc); /* replace the unicode encode error with ? or U+FFFD */ PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc); /* replace the unicode encode error with XML character references */ PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc); /* replace the unicode encode error with backslash escapes (\x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_NameReplaceErrors(PyObject *exc); #endif #ifndef Py_LIMITED_API PyAPI_DATA(const char *) Py_hexdigits; #endif #ifdef __cplusplus } #endif #endif /* !Py_CODECREGISTRY_H */
6,793
C++
.h
171
35.444444
81
0.71204
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,529
typeslots.h
relativty_Relativty/Relativty_Driver/include/Python/typeslots.h
/* Do not renumber the file; these numbers are part of the stable ABI. */ /* Disabled, see #10181 */ #undef Py_bf_getbuffer #undef Py_bf_releasebuffer #define Py_mp_ass_subscript 3 #define Py_mp_length 4 #define Py_mp_subscript 5 #define Py_nb_absolute 6 #define Py_nb_add 7 #define Py_nb_and 8 #define Py_nb_bool 9 #define Py_nb_divmod 10 #define Py_nb_float 11 #define Py_nb_floor_divide 12 #define Py_nb_index 13 #define Py_nb_inplace_add 14 #define Py_nb_inplace_and 15 #define Py_nb_inplace_floor_divide 16 #define Py_nb_inplace_lshift 17 #define Py_nb_inplace_multiply 18 #define Py_nb_inplace_or 19 #define Py_nb_inplace_power 20 #define Py_nb_inplace_remainder 21 #define Py_nb_inplace_rshift 22 #define Py_nb_inplace_subtract 23 #define Py_nb_inplace_true_divide 24 #define Py_nb_inplace_xor 25 #define Py_nb_int 26 #define Py_nb_invert 27 #define Py_nb_lshift 28 #define Py_nb_multiply 29 #define Py_nb_negative 30 #define Py_nb_or 31 #define Py_nb_positive 32 #define Py_nb_power 33 #define Py_nb_remainder 34 #define Py_nb_rshift 35 #define Py_nb_subtract 36 #define Py_nb_true_divide 37 #define Py_nb_xor 38 #define Py_sq_ass_item 39 #define Py_sq_concat 40 #define Py_sq_contains 41 #define Py_sq_inplace_concat 42 #define Py_sq_inplace_repeat 43 #define Py_sq_item 44 #define Py_sq_length 45 #define Py_sq_repeat 46 #define Py_tp_alloc 47 #define Py_tp_base 48 #define Py_tp_bases 49 #define Py_tp_call 50 #define Py_tp_clear 51 #define Py_tp_dealloc 52 #define Py_tp_del 53 #define Py_tp_descr_get 54 #define Py_tp_descr_set 55 #define Py_tp_doc 56 #define Py_tp_getattr 57 #define Py_tp_getattro 58 #define Py_tp_hash 59 #define Py_tp_init 60 #define Py_tp_is_gc 61 #define Py_tp_iter 62 #define Py_tp_iternext 63 #define Py_tp_methods 64 #define Py_tp_new 65 #define Py_tp_repr 66 #define Py_tp_richcompare 67 #define Py_tp_setattr 68 #define Py_tp_setattro 69 #define Py_tp_str 70 #define Py_tp_traverse 71 #define Py_tp_members 72 #define Py_tp_getset 73 #define Py_tp_free 74 #define Py_nb_matrix_multiply 75 #define Py_nb_inplace_matrix_multiply 76 #define Py_am_await 77 #define Py_am_aiter 78 #define Py_am_anext 79 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* New in 3.5 */ #define Py_tp_finalize 80 #endif
2,253
C++
.h
85
25.505882
73
0.777675
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,530
node.h
relativty_Relativty/Relativty_Driver/include/Python/node.h
/* Parse tree node interface */ #ifndef Py_NODE_H #define Py_NODE_H #ifdef __cplusplus extern "C" { #endif typedef struct _node { short n_type; char *n_str; int n_lineno; int n_col_offset; int n_nchildren; struct _node *n_child; int n_end_lineno; int n_end_col_offset; } node; PyAPI_FUNC(node *) PyNode_New(int type); PyAPI_FUNC(int) PyNode_AddChild(node *n, int type, char *str, int lineno, int col_offset, int end_lineno, int end_col_offset); PyAPI_FUNC(void) PyNode_Free(node *n); #ifndef Py_LIMITED_API PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n); #endif /* Node access functions */ #define NCH(n) ((n)->n_nchildren) #define CHILD(n, i) (&(n)->n_child[i]) #define RCHILD(n, i) (CHILD(n, NCH(n) + i)) #define TYPE(n) ((n)->n_type) #define STR(n) ((n)->n_str) #define LINENO(n) ((n)->n_lineno) /* Assert that the type of a node is what we expect */ #define REQ(n, type) assert(TYPE(n) == (type)) PyAPI_FUNC(void) PyNode_ListTree(node *); void _PyNode_FinalizeEndPos(node *n); // helper also used in parsetok.c #ifdef __cplusplus } #endif #endif /* !Py_NODE_H */
1,328
C++
.h
39
30.358974
72
0.564844
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,531
pyport.h
relativty_Relativty/Relativty_Driver/include/Python/pyport.h
#ifndef Py_PYPORT_H #define Py_PYPORT_H #include "pyconfig.h" /* include for defines */ #include <inttypes.h> /* Defines to build Python and its standard library: * * - Py_BUILD_CORE: Build Python core. Give access to Python internals, but * should not be used by third-party modules. * - Py_BUILD_CORE_BUILTIN: Build a Python stdlib module as a built-in module. * - Py_BUILD_CORE_MODULE: Build a Python stdlib module as a dynamic library. * * Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE imply Py_BUILD_CORE. * * On Windows, Py_BUILD_CORE_MODULE exports "PyInit_xxx" symbol, whereas * Py_BUILD_CORE_BUILTIN does not. */ #if defined(Py_BUILD_CORE_BUILTIN) && !defined(Py_BUILD_CORE) # define Py_BUILD_CORE #endif #if defined(Py_BUILD_CORE_MODULE) && !defined(Py_BUILD_CORE) # define Py_BUILD_CORE #endif /************************************************************************** Symbols and macros to supply platform-independent interfaces to basic C language & library operations whose spellings vary across platforms. Please try to make documentation here as clear as possible: by definition, the stuff here is trying to illuminate C's darkest corners. Config #defines referenced here: SIGNED_RIGHT_SHIFT_ZERO_FILLS Meaning: To be defined iff i>>j does not extend the sign bit when i is a signed integral type and i < 0. Used in: Py_ARITHMETIC_RIGHT_SHIFT Py_DEBUG Meaning: Extra checks compiled in for debug mode. Used in: Py_SAFE_DOWNCAST **************************************************************************/ /* typedefs for some C9X-defined synonyms for integral types. * * The names in Python are exactly the same as the C9X names, except with a * Py_ prefix. Until C9X is universally implemented, this is the only way * to ensure that Python gets reliable names that don't conflict with names * in non-Python code that are playing their own tricks to define the C9X * names. * * NOTE: don't go nuts here! Python has no use for *most* of the C9X * integral synonyms. Only define the ones we actually need. */ /* long long is required. Ensure HAVE_LONG_LONG is defined for compatibility. */ #ifndef HAVE_LONG_LONG #define HAVE_LONG_LONG 1 #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG long long /* If LLONG_MAX is defined in limits.h, use that. */ #define PY_LLONG_MIN LLONG_MIN #define PY_LLONG_MAX LLONG_MAX #define PY_ULLONG_MAX ULLONG_MAX #endif #define PY_UINT32_T uint32_t #define PY_UINT64_T uint64_t /* Signed variants of the above */ #define PY_INT32_T int32_t #define PY_INT64_T int64_t /* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all the necessary integer types are available, and we're on a 64-bit platform (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */ #ifndef PYLONG_BITS_IN_DIGIT #if SIZEOF_VOID_P >= 8 #define PYLONG_BITS_IN_DIGIT 30 #else #define PYLONG_BITS_IN_DIGIT 15 #endif #endif /* uintptr_t is the C9X name for an unsigned integral type such that a * legitimate void* can be cast to uintptr_t and then back to void* again * without loss of information. Similarly for intptr_t, wrt a signed * integral type. */ typedef uintptr_t Py_uintptr_t; typedef intptr_t Py_intptr_t; /* Py_ssize_t is a signed integral type such that sizeof(Py_ssize_t) == * sizeof(size_t). C99 doesn't define such a thing directly (size_t is an * unsigned integral type). See PEP 353 for details. */ #ifdef HAVE_SSIZE_T typedef ssize_t Py_ssize_t; #elif SIZEOF_VOID_P == SIZEOF_SIZE_T typedef Py_intptr_t Py_ssize_t; #else # error "Python needs a typedef for Py_ssize_t in pyport.h." #endif /* Py_hash_t is the same size as a pointer. */ #define SIZEOF_PY_HASH_T SIZEOF_SIZE_T typedef Py_ssize_t Py_hash_t; /* Py_uhash_t is the unsigned equivalent needed to calculate numeric hash. */ #define SIZEOF_PY_UHASH_T SIZEOF_SIZE_T typedef size_t Py_uhash_t; /* Only used for compatibility with code that may not be PY_SSIZE_T_CLEAN. */ #ifdef PY_SSIZE_T_CLEAN typedef Py_ssize_t Py_ssize_clean_t; #else typedef int Py_ssize_clean_t; #endif /* Largest possible value of size_t. */ #define PY_SIZE_MAX SIZE_MAX /* Largest positive value of type Py_ssize_t. */ #define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) /* Smallest negative value of type Py_ssize_t. */ #define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1) /* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf * format to convert an argument with the width of a size_t or Py_ssize_t. * C99 introduced "z" for this purpose, but not all platforms support that; * e.g., MS compilers use "I" instead. * * These "high level" Python format functions interpret "z" correctly on * all platforms (Python interprets the format string itself, and does whatever * the platform C requires to convert a size_t/Py_ssize_t argument): * * PyBytes_FromFormat * PyErr_Format * PyBytes_FromFormatV * PyUnicode_FromFormatV * * Lower-level uses require that you interpolate the correct format modifier * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for * example, * * Py_ssize_t index; * fprintf(stderr, "index %" PY_FORMAT_SIZE_T "d sucks\n", index); * * That will expand to %ld, or %Id, or to something else correct for a * Py_ssize_t on the platform. */ #ifndef PY_FORMAT_SIZE_T # if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__) # define PY_FORMAT_SIZE_T "" # elif SIZEOF_SIZE_T == SIZEOF_LONG # define PY_FORMAT_SIZE_T "l" # elif defined(MS_WINDOWS) # define PY_FORMAT_SIZE_T "I" # else # error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T" # endif #endif /* Py_LOCAL can be used instead of static to get the fastest possible calling * convention for functions that are local to a given module. * * Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining, * for platforms that support that. * * If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more * "aggressive" inlining/optimization is enabled for the entire module. This * may lead to code bloat, and may slow things down for those reasons. It may * also lead to errors, if the code relies on pointer aliasing. Use with * care. * * NOTE: You can only use this for functions that are entirely local to a * module; functions that are exported via method tables, callbacks, etc, * should keep using static. */ #if defined(_MSC_VER) # if defined(PY_LOCAL_AGGRESSIVE) /* enable more aggressive optimization for visual studio */ # pragma optimize("agtw", on) #endif /* ignore warnings if the compiler decides not to inline a function */ # pragma warning(disable: 4710) /* fastest possible local call under MSVC */ # define Py_LOCAL(type) static type __fastcall # define Py_LOCAL_INLINE(type) static __inline type __fastcall #else # define Py_LOCAL(type) static type # define Py_LOCAL_INLINE(type) static inline type #endif /* Py_MEMCPY is kept for backwards compatibility, * see https://bugs.python.org/issue28126 */ #define Py_MEMCPY memcpy #include <stdlib.h> #ifdef HAVE_IEEEFP_H #include <ieeefp.h> /* needed for 'finite' declaration on some platforms */ #endif #include <math.h> /* Moved here from the math section, before extern "C" */ /******************************************** * WRAPPER FOR <time.h> and/or <sys/time.h> * ********************************************/ #ifdef TIME_WITH_SYS_TIME #include <sys/time.h> #include <time.h> #else /* !TIME_WITH_SYS_TIME */ #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #else /* !HAVE_SYS_TIME_H */ #include <time.h> #endif /* !HAVE_SYS_TIME_H */ #endif /* !TIME_WITH_SYS_TIME */ /****************************** * WRAPPER FOR <sys/select.h> * ******************************/ /* NB caller must include <sys/types.h> */ #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif /* !HAVE_SYS_SELECT_H */ /******************************* * stat() and fstat() fiddling * *******************************/ #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #elif defined(HAVE_STAT_H) #include <stat.h> #endif #ifndef S_IFMT /* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */ #define S_IFMT 0170000 #endif #ifndef S_IFLNK /* Windows doesn't define S_IFLNK but posixmodule.c maps * IO_REPARSE_TAG_SYMLINK to S_IFLNK */ # define S_IFLNK 0120000 #endif #ifndef S_ISREG #define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) #endif #ifndef S_ISDIR #define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) #endif #ifndef S_ISCHR #define S_ISCHR(x) (((x) & S_IFMT) == S_IFCHR) #endif #ifdef __cplusplus /* Move this down here since some C++ #include's don't like to be included inside an extern "C" */ extern "C" { #endif /* Py_ARITHMETIC_RIGHT_SHIFT * C doesn't define whether a right-shift of a signed integer sign-extends * or zero-fills. Here a macro to force sign extension: * Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) * Return I >> J, forcing sign extension. Arithmetically, return the * floor of I/2**J. * Requirements: * I should have signed integer type. In the terminology of C99, this can * be either one of the five standard signed integer types (signed char, * short, int, long, long long) or an extended signed integer type. * J is an integer >= 0 and strictly less than the number of bits in the * type of I (because C doesn't define what happens for J outside that * range either). * TYPE used to specify the type of I, but is now ignored. It's been left * in for backwards compatibility with versions <= 2.6 or 3.0. * Caution: * I may be evaluated more than once. */ #ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS #define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \ ((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J)) #else #define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J)) #endif /* Py_FORCE_EXPANSION(X) * "Simply" returns its argument. However, macro expansions within the * argument are evaluated. This unfortunate trickery is needed to get * token-pasting to work as desired in some cases. */ #define Py_FORCE_EXPANSION(X) X /* Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) * Cast VALUE to type NARROW from type WIDE. In Py_DEBUG mode, this * assert-fails if any information is lost. * Caution: * VALUE may be evaluated more than once. */ #ifdef Py_DEBUG #define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \ (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE)) #else #define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE) #endif /* Py_SET_ERRNO_ON_MATH_ERROR(x) * If a libm function did not set errno, but it looks like the result * overflowed or not-a-number, set errno to ERANGE or EDOM. Set errno * to 0 before calling a libm function, and invoke this macro after, * passing the function result. * Caution: * This isn't reliable. See Py_OVERFLOWED comments. * X is evaluated more than once. */ #if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64)) #define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM; #else #define _Py_SET_EDOM_FOR_NAN(X) ; #endif #define Py_SET_ERRNO_ON_MATH_ERROR(X) \ do { \ if (errno == 0) { \ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ errno = ERANGE; \ else _Py_SET_EDOM_FOR_NAN(X) \ } \ } while(0) /* Py_SET_ERANGE_IF_OVERFLOW(x) * An alias of Py_SET_ERRNO_ON_MATH_ERROR for backward-compatibility. */ #define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X) /* Py_ADJUST_ERANGE1(x) * Py_ADJUST_ERANGE2(x, y) * Set errno to 0 before calling a libm function, and invoke one of these * macros after, passing the function result(s) (Py_ADJUST_ERANGE2 is useful * for functions returning complex results). This makes two kinds of * adjustments to errno: (A) If it looks like the platform libm set * errno=ERANGE due to underflow, clear errno. (B) If it looks like the * platform libm overflowed but didn't set errno, force errno to ERANGE. In * effect, we're trying to force a useful implementation of C89 errno * behavior. * Caution: * This isn't reliable. See Py_OVERFLOWED comments. * X and Y may be evaluated more than once. */ #define Py_ADJUST_ERANGE1(X) \ do { \ if (errno == 0) { \ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ errno = ERANGE; \ } \ else if (errno == ERANGE && (X) == 0.0) \ errno = 0; \ } while(0) #define Py_ADJUST_ERANGE2(X, Y) \ do { \ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL || \ (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) { \ if (errno == 0) \ errno = ERANGE; \ } \ else if (errno == ERANGE) \ errno = 0; \ } while(0) /* The functions _Py_dg_strtod and _Py_dg_dtoa in Python/dtoa.c (which are * required to support the short float repr introduced in Python 3.1) require * that the floating-point unit that's being used for arithmetic operations * on C doubles is set to use 53-bit precision. It also requires that the * FPU rounding mode is round-half-to-even, but that's less often an issue. * * If your FPU isn't already set to 53-bit precision/round-half-to-even, and * you want to make use of _Py_dg_strtod and _Py_dg_dtoa, then you should * * #define HAVE_PY_SET_53BIT_PRECISION 1 * * and also give appropriate definitions for the following three macros: * * _PY_SET_53BIT_PRECISION_START : store original FPU settings, and * set FPU to 53-bit precision/round-half-to-even * _PY_SET_53BIT_PRECISION_END : restore original FPU settings * _PY_SET_53BIT_PRECISION_HEADER : any variable declarations needed to * use the two macros above. * * The macros are designed to be used within a single C function: see * Python/pystrtod.c for an example of their use. */ /* get and set x87 control word for gcc/x86 */ #ifdef HAVE_GCC_ASM_FOR_X87 #define HAVE_PY_SET_53BIT_PRECISION 1 /* _Py_get/set_387controlword functions are defined in Python/pymath.c */ #define _Py_SET_53BIT_PRECISION_HEADER \ unsigned short old_387controlword, new_387controlword #define _Py_SET_53BIT_PRECISION_START \ do { \ old_387controlword = _Py_get_387controlword(); \ new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \ if (new_387controlword != old_387controlword) \ _Py_set_387controlword(new_387controlword); \ } while (0) #define _Py_SET_53BIT_PRECISION_END \ if (new_387controlword != old_387controlword) \ _Py_set_387controlword(old_387controlword) #endif /* get and set x87 control word for VisualStudio/x86 */ #if defined(_MSC_VER) && !defined(_WIN64) && !defined(_M_ARM) /* x87 not supported in 64-bit or ARM */ #define HAVE_PY_SET_53BIT_PRECISION 1 #define _Py_SET_53BIT_PRECISION_HEADER \ unsigned int old_387controlword, new_387controlword, out_387controlword /* We use the __control87_2 function to set only the x87 control word. The SSE control word is unaffected. */ #define _Py_SET_53BIT_PRECISION_START \ do { \ __control87_2(0, 0, &old_387controlword, NULL); \ new_387controlword = \ (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \ if (new_387controlword != old_387controlword) \ __control87_2(new_387controlword, _MCW_PC | _MCW_RC, \ &out_387controlword, NULL); \ } while (0) #define _Py_SET_53BIT_PRECISION_END \ do { \ if (new_387controlword != old_387controlword) \ __control87_2(old_387controlword, _MCW_PC | _MCW_RC, \ &out_387controlword, NULL); \ } while (0) #endif #ifdef HAVE_GCC_ASM_FOR_MC68881 #define HAVE_PY_SET_53BIT_PRECISION 1 #define _Py_SET_53BIT_PRECISION_HEADER \ unsigned int old_fpcr, new_fpcr #define _Py_SET_53BIT_PRECISION_START \ do { \ __asm__ ("fmove.l %%fpcr,%0" : "=g" (old_fpcr)); \ /* Set double precision / round to nearest. */ \ new_fpcr = (old_fpcr & ~0xf0) | 0x80; \ if (new_fpcr != old_fpcr) \ __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (new_fpcr)); \ } while (0) #define _Py_SET_53BIT_PRECISION_END \ do { \ if (new_fpcr != old_fpcr) \ __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (old_fpcr)); \ } while (0) #endif /* default definitions are empty */ #ifndef HAVE_PY_SET_53BIT_PRECISION #define _Py_SET_53BIT_PRECISION_HEADER #define _Py_SET_53BIT_PRECISION_START #define _Py_SET_53BIT_PRECISION_END #endif /* If we can't guarantee 53-bit precision, don't use the code in Python/dtoa.c, but fall back to standard code. This means that repr of a float will be long (17 sig digits). Realistically, there are two things that could go wrong: (1) doubles aren't IEEE 754 doubles, or (2) we're on x86 with the rounding precision set to 64-bits (extended precision), and we don't know how to change the rounding precision. */ #if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \ !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \ !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754) #define PY_NO_SHORT_FLOAT_REPR #endif /* double rounding is symptomatic of use of extended precision on x86. If we're seeing double rounding, and we don't have any mechanism available for changing the FPU rounding precision, then don't use Python/dtoa.c. */ #if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION) #define PY_NO_SHORT_FLOAT_REPR #endif /* Py_DEPRECATED(version) * Declare a variable, type, or function deprecated. * The macro must be placed before the declaration. * Usage: * Py_DEPRECATED(3.3) extern int old_var; * Py_DEPRECATED(3.4) typedef int T1; * Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void); */ #if defined(__GNUC__) \ && ((__GNUC__ >= 4) || (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) #elif defined(_MSC_VER) #define Py_DEPRECATED(VERSION) __declspec(deprecated( \ "deprecated in " #VERSION)) #else #define Py_DEPRECATED(VERSION_UNUSED) #endif /* _Py_HOT_FUNCTION * The hot attribute on a function is used to inform the compiler that the * function is a hot spot of the compiled program. The function is optimized * more aggressively and on many target it is placed into special subsection of * the text section so all hot functions appears close together improving * locality. * * Usage: * int _Py_HOT_FUNCTION x(void) { return 3; } * * Issue #28618: This attribute must not be abused, otherwise it can have a * negative effect on performance. Only the functions were Python spend most of * its time must use it. Use a profiler when running performance benchmark * suite to find these functions. */ #if defined(__GNUC__) \ && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) #define _Py_HOT_FUNCTION __attribute__((hot)) #else #define _Py_HOT_FUNCTION #endif /* _Py_NO_INLINE * Disable inlining on a function. For example, it helps to reduce the C stack * consumption. * * Usage: * int _Py_NO_INLINE x(void) { return 3; } */ #if defined(_MSC_VER) # define _Py_NO_INLINE __declspec(noinline) #elif defined(__GNUC__) || defined(__clang__) # define _Py_NO_INLINE __attribute__ ((noinline)) #else # define _Py_NO_INLINE #endif /************************************************************************** Prototypes that are missing from the standard include files on some systems (and possibly only some versions of such systems.) Please be conservative with adding new ones, document them and enclose them in platform-specific #ifdefs. **************************************************************************/ #ifdef SOLARIS /* Unchecked */ extern int gethostname(char *, int); #endif #ifdef HAVE__GETPTY #include <sys/types.h> /* we need to import mode_t */ extern char * _getpty(int *, int, mode_t, int); #endif /* On QNX 6, struct termio must be declared by including sys/termio.h if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must be included before termios.h or it will generate an error. */ #if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux) #include <sys/termio.h> #endif /* On 4.4BSD-descendants, ctype functions serves the whole range of * wchar_t character set rather than single byte code points only. * This characteristic can break some operations of string object * including str.upper() and str.split() on UTF-8 locales. This * workaround was provided by Tim Robbins of FreeBSD project. */ #if defined(__APPLE__) # define _PY_PORT_CTYPE_UTF8_ISSUE #endif #ifdef _PY_PORT_CTYPE_UTF8_ISSUE #ifndef __cplusplus /* The workaround below is unsafe in C++ because * the <locale> defines these symbols as real functions, * with a slightly different signature. * See issue #10910 */ #include <ctype.h> #include <wctype.h> #undef isalnum #define isalnum(c) iswalnum(btowc(c)) #undef isalpha #define isalpha(c) iswalpha(btowc(c)) #undef islower #define islower(c) iswlower(btowc(c)) #undef isspace #define isspace(c) iswspace(btowc(c)) #undef isupper #define isupper(c) iswupper(btowc(c)) #undef tolower #define tolower(c) towlower(btowc(c)) #undef toupper #define toupper(c) towupper(btowc(c)) #endif #endif /* Declarations for symbol visibility. PyAPI_FUNC(type): Declares a public Python API function and return type PyAPI_DATA(type): Declares public Python data and its type PyMODINIT_FUNC: A Python module init function. If these functions are inside the Python core, they are private to the core. If in an extension module, it may be declared with external linkage depending on the platform. As a number of platforms support/require "__declspec(dllimport/dllexport)", we support a HAVE_DECLSPEC_DLL macro to save duplication. */ /* All windows ports, except cygwin, are handled in PC/pyconfig.h. Cygwin is the only other autoconf platform requiring special linkage handling and it uses __declspec(). */ #if defined(__CYGWIN__) # define HAVE_DECLSPEC_DLL #endif /* only get special linkage if built as shared or platform is Cygwin */ #if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) # if defined(HAVE_DECLSPEC_DLL) # if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE # define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE /* module init functions inside the core need no external linkage */ /* except for Cygwin to handle embedding */ # if defined(__CYGWIN__) # define PyMODINIT_FUNC __declspec(dllexport) PyObject* # else /* __CYGWIN__ */ # define PyMODINIT_FUNC PyObject* # endif /* __CYGWIN__ */ # else /* Py_BUILD_CORE */ /* Building an extension module, or an embedded situation */ /* public Python functions and data are imported */ /* Under Cygwin, auto-import functions to prevent compilation */ /* failures similar to those described at the bottom of 4.1: */ /* http://docs.python.org/extending/windows.html#a-cookbook-approach */ # if !defined(__CYGWIN__) # define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE # endif /* !__CYGWIN__ */ # define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE /* module init functions outside the core must be exported */ # if defined(__cplusplus) # define PyMODINIT_FUNC extern "C" __declspec(dllexport) PyObject* # else /* __cplusplus */ # define PyMODINIT_FUNC __declspec(dllexport) PyObject* # endif /* __cplusplus */ # endif /* Py_BUILD_CORE */ # endif /* HAVE_DECLSPEC_DLL */ #endif /* Py_ENABLE_SHARED */ /* If no external linkage macros defined by now, create defaults */ #ifndef PyAPI_FUNC # define PyAPI_FUNC(RTYPE) RTYPE #endif #ifndef PyAPI_DATA # define PyAPI_DATA(RTYPE) extern RTYPE #endif #ifndef PyMODINIT_FUNC # if defined(__cplusplus) # define PyMODINIT_FUNC extern "C" PyObject* # else /* __cplusplus */ # define PyMODINIT_FUNC PyObject* # endif /* __cplusplus */ #endif /* limits.h constants that may be missing */ #ifndef INT_MAX #define INT_MAX 2147483647 #endif #ifndef LONG_MAX #if SIZEOF_LONG == 4 #define LONG_MAX 0X7FFFFFFFL #elif SIZEOF_LONG == 8 #define LONG_MAX 0X7FFFFFFFFFFFFFFFL #else #error "could not set LONG_MAX in pyport.h" #endif #endif #ifndef LONG_MIN #define LONG_MIN (-LONG_MAX-1) #endif #ifndef LONG_BIT #define LONG_BIT (8 * SIZEOF_LONG) #endif #if LONG_BIT != 8 * SIZEOF_LONG /* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent * 32-bit platforms using gcc. We try to catch that here at compile-time * rather than waiting for integer multiplication to trigger bogus * overflows. */ #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." #endif #ifdef __cplusplus } #endif /* * Hide GCC attributes from compilers that don't support them. */ #if (!defined(__GNUC__) || __GNUC__ < 2 || \ (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) #define Py_GCC_ATTRIBUTE(x) #else #define Py_GCC_ATTRIBUTE(x) __attribute__(x) #endif /* * Specify alignment on compilers that support it. */ #if defined(__GNUC__) && __GNUC__ >= 3 #define Py_ALIGNED(x) __attribute__((aligned(x))) #else #define Py_ALIGNED(x) #endif /* Eliminate end-of-loop code not reached warnings from SunPro C * when using do{...}while(0) macros */ #ifdef __SUNPRO_C #pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) #endif #ifndef Py_LL #define Py_LL(x) x##LL #endif #ifndef Py_ULL #define Py_ULL(x) Py_LL(x##U) #endif #define Py_VA_COPY va_copy /* * Convenient macros to deal with endianness of the platform. WORDS_BIGENDIAN is * detected by configure and defined in pyconfig.h. The code in pyconfig.h * also takes care of Apple's universal builds. */ #ifdef WORDS_BIGENDIAN #define PY_BIG_ENDIAN 1 #define PY_LITTLE_ENDIAN 0 #else #define PY_BIG_ENDIAN 0 #define PY_LITTLE_ENDIAN 1 #endif #ifdef Py_BUILD_CORE /* * Macros to protect CRT calls against instant termination when passed an * invalid parameter (issue23524). */ #if defined _MSC_VER && _MSC_VER >= 1900 extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler; #define _Py_BEGIN_SUPPRESS_IPH { _invalid_parameter_handler _Py_old_handler = \ _set_thread_local_invalid_parameter_handler(_Py_silent_invalid_parameter_handler); #define _Py_END_SUPPRESS_IPH _set_thread_local_invalid_parameter_handler(_Py_old_handler); } #else #define _Py_BEGIN_SUPPRESS_IPH #define _Py_END_SUPPRESS_IPH #endif /* _MSC_VER >= 1900 */ #endif /* Py_BUILD_CORE */ #ifdef __ANDROID__ /* The Android langinfo.h header is not used. */ # undef HAVE_LANGINFO_H # undef CODESET #endif /* Maximum value of the Windows DWORD type */ #define PY_DWORD_MAX 4294967295U /* This macro used to tell whether Python was built with multithreading * enabled. Now multithreading is always enabled, but keep the macro * for compatibility. */ #ifndef WITH_THREAD # define WITH_THREAD #endif /* Check that ALT_SOABI is consistent with Py_TRACE_REFS: ./configure --with-trace-refs should must be used to define Py_TRACE_REFS */ #if defined(ALT_SOABI) && defined(Py_TRACE_REFS) # error "Py_TRACE_REFS ABI is not compatible with release and debug ABI" #endif #if defined(__ANDROID__) || defined(__VXWORKS__) /* Ignore the locale encoding: force UTF-8 */ # define _Py_FORCE_UTF8_LOCALE #endif #if defined(_Py_FORCE_UTF8_LOCALE) || defined(__APPLE__) /* Use UTF-8 as filesystem encoding */ # define _Py_FORCE_UTF8_FS_ENCODING #endif /* Mark a function which cannot return. Example: PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void); */ #if defined(__clang__) || \ (defined(__GNUC__) && \ ((__GNUC__ >= 3) || \ (__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))) # define _Py_NO_RETURN __attribute__((__noreturn__)) #elif defined(_MSC_VER) # define _Py_NO_RETURN __declspec(noreturn) #else # define _Py_NO_RETURN #endif #endif /* Py_PYPORT_H */
30,221
C++
.h
737
38.466757
102
0.642198
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,532
sysmodule.h
relativty_Relativty/Relativty_Driver/include/Python/sysmodule.h
/* System module interface */ #ifndef Py_SYSMODULE_H #define Py_SYSMODULE_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(PyObject *) PySys_GetObject(const char *); PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *); PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **); PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int); PyAPI_FUNC(void) PySys_SetPath(const wchar_t *); PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...); PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...); PyAPI_FUNC(void) PySys_ResetWarnOptions(void); PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *); PyAPI_FUNC(void) PySys_AddWarnOptionUnicode(PyObject *); PyAPI_FUNC(int) PySys_HasWarnOptions(void); PyAPI_FUNC(void) PySys_AddXOption(const wchar_t *); PyAPI_FUNC(PyObject *) PySys_GetXOptions(void); #ifndef Py_LIMITED_API # define Py_CPYTHON_SYSMODULE_H # include "cpython/sysmodule.h" # undef Py_CPYTHON_SYSMODULE_H #endif #ifdef __cplusplus } #endif #endif /* !Py_SYSMODULE_H */
1,242
C++
.h
32
36.46875
61
0.731057
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,533
grammar.h
relativty_Relativty/Relativty_Driver/include/Python/grammar.h
/* Grammar interface */ #ifndef Py_GRAMMAR_H #define Py_GRAMMAR_H #ifdef __cplusplus extern "C" { #endif #include "bitset.h" /* Sigh... */ /* A label of an arc */ typedef struct { int lb_type; const char *lb_str; } label; #define EMPTY 0 /* Label number 0 is by definition the empty label */ /* A list of labels */ typedef struct { int ll_nlabels; const label *ll_label; } labellist; /* An arc from one state to another */ typedef struct { short a_lbl; /* Label of this arc */ short a_arrow; /* State where this arc goes to */ } arc; /* A state in a DFA */ typedef struct { int s_narcs; const arc *s_arc; /* Array of arcs */ /* Optional accelerators */ int s_lower; /* Lowest label index */ int s_upper; /* Highest label index */ int *s_accel; /* Accelerator */ int s_accept; /* Nonzero for accepting state */ } state; /* A DFA */ typedef struct { int d_type; /* Non-terminal this represents */ char *d_name; /* For printing */ int d_nstates; state *d_state; /* Array of states */ bitset d_first; } dfa; /* A grammar */ typedef struct { int g_ndfas; const dfa *g_dfa; /* Array of DFAs */ const labellist g_ll; int g_start; /* Start symbol of the grammar */ int g_accel; /* Set if accelerators present */ } grammar; /* FUNCTIONS */ const dfa *PyGrammar_FindDFA(grammar *g, int type); const char *PyGrammar_LabelRepr(label *lb); void PyGrammar_AddAccelerators(grammar *g); void PyGrammar_RemoveAccelerators(grammar *); #ifdef __cplusplus } #endif #endif /* !Py_GRAMMAR_H */
1,821
C++
.h
58
28.482759
77
0.572821
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,534
pystrcmp.h
relativty_Relativty/Relativty_Driver/include/Python/pystrcmp.h
#ifndef Py_STRCMP_H #define Py_STRCMP_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(int) PyOS_mystrnicmp(const char *, const char *, Py_ssize_t); PyAPI_FUNC(int) PyOS_mystricmp(const char *, const char *); #ifdef MS_WINDOWS #define PyOS_strnicmp strnicmp #define PyOS_stricmp stricmp #else #define PyOS_strnicmp PyOS_mystrnicmp #define PyOS_stricmp PyOS_mystricmp #endif #ifdef __cplusplus } #endif #endif /* !Py_STRCMP_H */
436
C++
.h
18
22.944444
72
0.772397
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,535
odictobject.h
relativty_Relativty/Relativty_Driver/include/Python/odictobject.h
#ifndef Py_ODICTOBJECT_H #define Py_ODICTOBJECT_H #ifdef __cplusplus extern "C" { #endif /* OrderedDict */ /* This API is optional and mostly redundant. */ #ifndef Py_LIMITED_API typedef struct _odictobject PyODictObject; PyAPI_DATA(PyTypeObject) PyODict_Type; PyAPI_DATA(PyTypeObject) PyODictIter_Type; PyAPI_DATA(PyTypeObject) PyODictKeys_Type; PyAPI_DATA(PyTypeObject) PyODictItems_Type; PyAPI_DATA(PyTypeObject) PyODictValues_Type; #define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) #define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type) #define PyODict_SIZE(op) PyDict_GET_SIZE((op)) PyAPI_FUNC(PyObject *) PyODict_New(void); PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item); PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key); /* wrappers around PyDict* functions */ #define PyODict_GetItem(od, key) PyDict_GetItem(_PyObject_CAST(od), key) #define PyODict_GetItemWithError(od, key) \ PyDict_GetItemWithError(_PyObject_CAST(od), key) #define PyODict_Contains(od, key) PyDict_Contains(_PyObject_CAST(od), key) #define PyODict_Size(od) PyDict_Size(_PyObject_CAST(od)) #define PyODict_GetItemString(od, key) \ PyDict_GetItemString(_PyObject_CAST(od), key) #endif #ifdef __cplusplus } #endif #endif /* !Py_ODICTOBJECT_H */
1,300
C++
.h
33
37.848485
77
0.778043
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,536
classobject.h
relativty_Relativty/Relativty_Driver/include/Python/classobject.h
/* Former class object interface -- now only bound methods are here */ /* Revealing some structures (not for general use) */ #ifndef Py_LIMITED_API #ifndef Py_CLASSOBJECT_H #define Py_CLASSOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_HEAD PyObject *im_func; /* The callable object implementing the method */ PyObject *im_self; /* The instance it is bound to */ PyObject *im_weakreflist; /* List of weak references */ vectorcallfunc vectorcall; } PyMethodObject; PyAPI_DATA(PyTypeObject) PyMethod_Type; #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #define PyMethod_GET_FUNCTION(meth) \ (((PyMethodObject *)meth) -> im_func) #define PyMethod_GET_SELF(meth) \ (((PyMethodObject *)meth) -> im_self) PyAPI_FUNC(int) PyMethod_ClearFreeList(void); typedef struct { PyObject_HEAD PyObject *func; } PyInstanceMethodObject; PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type; #define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type) PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *); PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #define PyInstanceMethod_GET_FUNCTION(meth) \ (((PyInstanceMethodObject *)meth) -> func) #ifdef __cplusplus } #endif #endif /* !Py_CLASSOBJECT_H */ #endif /* Py_LIMITED_API */
1,710
C++
.h
44
36.204545
76
0.731678
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,537
cellobject.h
relativty_Relativty/Relativty_Driver/include/Python/cellobject.h
/* Cell object interface */ #ifndef Py_LIMITED_API #ifndef Py_CELLOBJECT_H #define Py_CELLOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_HEAD PyObject *ob_ref; /* Content of the cell or NULL when empty */ } PyCellObject; PyAPI_DATA(PyTypeObject) PyCell_Type; #define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type) PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) #define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v) #ifdef __cplusplus } #endif #endif /* !Py_TUPLEOBJECT_H */ #endif /* Py_LIMITED_API */
713
C++
.h
23
29.391304
72
0.707602
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,538
pythread.h
relativty_Relativty/Relativty_Driver/include/Python/pythread.h
#ifndef Py_PYTHREAD_H #define Py_PYTHREAD_H typedef void *PyThread_type_lock; typedef void *PyThread_type_sema; #ifdef __cplusplus extern "C" { #endif /* Return status codes for Python lock acquisition. Chosen for maximum * backwards compatibility, ie failure -> 0, success -> 1. */ typedef enum PyLockStatus { PY_LOCK_FAILURE = 0, PY_LOCK_ACQUIRED = 1, PY_LOCK_INTR } PyLockStatus; #ifndef Py_LIMITED_API #define PYTHREAD_INVALID_THREAD_ID ((unsigned long)-1) #endif PyAPI_FUNC(void) PyThread_init_thread(void); PyAPI_FUNC(unsigned long) PyThread_start_new_thread(void (*)(void *), void *); PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void); PyAPI_FUNC(unsigned long) PyThread_get_thread_ident(void); #if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(_WIN32) || defined(_AIX) #define PY_HAVE_THREAD_NATIVE_ID PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void); #endif PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); #define WAIT_LOCK 1 #define NOWAIT_LOCK 0 /* PY_TIMEOUT_T is the integral type used to specify timeouts when waiting on a lock (see PyThread_acquire_lock_timed() below). PY_TIMEOUT_MAX is the highest usable value (in microseconds) of that type, and depends on the system threading API. NOTE: this isn't the same value as `_thread.TIMEOUT_MAX`. The _thread module exposes a higher-level API, with timeouts expressed in seconds and floating-point numbers allowed. */ #define PY_TIMEOUT_T long long #if defined(_POSIX_THREADS) /* PyThread_acquire_lock_timed() uses _PyTime_FromNanoseconds(us * 1000), convert microseconds to nanoseconds. */ # define PY_TIMEOUT_MAX (PY_LLONG_MAX / 1000) #elif defined (NT_THREADS) /* In the NT API, the timeout is a DWORD and is expressed in milliseconds */ # if 0xFFFFFFFFLL * 1000 < PY_LLONG_MAX # define PY_TIMEOUT_MAX (0xFFFFFFFFLL * 1000) # else # define PY_TIMEOUT_MAX PY_LLONG_MAX # endif #else # define PY_TIMEOUT_MAX PY_LLONG_MAX #endif /* If microseconds == 0, the call is non-blocking: it returns immediately even when the lock can't be acquired. If microseconds > 0, the call waits up to the specified duration. If microseconds < 0, the call waits until success (or abnormal failure) microseconds must be less than PY_TIMEOUT_MAX. Behaviour otherwise is undefined. If intr_flag is true and the acquire is interrupted by a signal, then the call will return PY_LOCK_INTR. The caller may reattempt to acquire the lock. */ PyAPI_FUNC(PyLockStatus) PyThread_acquire_lock_timed(PyThread_type_lock, PY_TIMEOUT_T microseconds, int intr_flag); PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); PyAPI_FUNC(size_t) PyThread_get_stacksize(void); PyAPI_FUNC(int) PyThread_set_stacksize(size_t); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyThread_GetInfo(void); #endif /* Thread Local Storage (TLS) API TLS API is DEPRECATED. Use Thread Specific Storage (TSS) API. The existing TLS API has used int to represent TLS keys across all platforms, but it is not POSIX-compliant. Therefore, the new TSS API uses opaque data type to represent TSS keys to be compatible (see PEP 539). */ Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_create_key(void); Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_delete_key(int key); Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key, void *value); Py_DEPRECATED(3.7) PyAPI_FUNC(void *) PyThread_get_key_value(int key); Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_delete_key_value(int key); /* Cleanup after a fork */ Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_ReInitTLS(void); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 /* New in 3.7 */ /* Thread Specific Storage (TSS) API */ typedef struct _Py_tss_t Py_tss_t; /* opaque */ #ifndef Py_LIMITED_API #if defined(_POSIX_THREADS) /* Darwin needs pthread.h to know type name the pthread_key_t. */ # include <pthread.h> # define NATIVE_TSS_KEY_T pthread_key_t #elif defined(NT_THREADS) /* In Windows, native TSS key type is DWORD, but hardcode the unsigned long to avoid errors for include directive. */ # define NATIVE_TSS_KEY_T unsigned long #else # error "Require native threads. See https://bugs.python.org/issue31370" #endif /* When Py_LIMITED_API is not defined, the type layout of Py_tss_t is exposed to allow static allocation in the API clients. Even in this case, you must handle TSS keys through API functions due to compatibility. */ struct _Py_tss_t { int _is_initialized; NATIVE_TSS_KEY_T _key; }; #undef NATIVE_TSS_KEY_T /* When static allocation, you must initialize with Py_tss_NEEDS_INIT. */ #define Py_tss_NEEDS_INIT {0} #endif /* !Py_LIMITED_API */ PyAPI_FUNC(Py_tss_t *) PyThread_tss_alloc(void); PyAPI_FUNC(void) PyThread_tss_free(Py_tss_t *key); /* The parameter key must not be NULL. */ PyAPI_FUNC(int) PyThread_tss_is_created(Py_tss_t *key); PyAPI_FUNC(int) PyThread_tss_create(Py_tss_t *key); PyAPI_FUNC(void) PyThread_tss_delete(Py_tss_t *key); PyAPI_FUNC(int) PyThread_tss_set(Py_tss_t *key, void *value); PyAPI_FUNC(void *) PyThread_tss_get(Py_tss_t *key); #endif /* New in 3.7 */ #ifdef __cplusplus } #endif #endif /* !Py_PYTHREAD_H */
5,660
C++
.h
128
40.804688
151
0.717039
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,539
descrobject.h
relativty_Relativty/Relativty_Driver/include/Python/descrobject.h
/* Descriptors */ #ifndef Py_DESCROBJECT_H #define Py_DESCROBJECT_H #ifdef __cplusplus extern "C" { #endif typedef PyObject *(*getter)(PyObject *, void *); typedef int (*setter)(PyObject *, PyObject *, void *); typedef struct PyGetSetDef { const char *name; getter get; setter set; const char *doc; void *closure; } PyGetSetDef; #ifndef Py_LIMITED_API typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, void *wrapped); typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds); struct wrapperbase { const char *name; int offset; void *function; wrapperfunc wrapper; const char *doc; int flags; PyObject *name_strobj; }; /* Flags for above struct */ #define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */ /* Various kinds of descriptor objects */ typedef struct { PyObject_HEAD PyTypeObject *d_type; PyObject *d_name; PyObject *d_qualname; } PyDescrObject; #define PyDescr_COMMON PyDescrObject d_common #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) typedef struct { PyDescr_COMMON; PyMethodDef *d_method; vectorcallfunc vectorcall; } PyMethodDescrObject; typedef struct { PyDescr_COMMON; struct PyMemberDef *d_member; } PyMemberDescrObject; typedef struct { PyDescr_COMMON; PyGetSetDef *d_getset; } PyGetSetDescrObject; typedef struct { PyDescr_COMMON; struct wrapperbase *d_base; void *d_wrapped; /* This can be any function pointer */ } PyWrapperDescrObject; #endif /* Py_LIMITED_API */ PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type; PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; PyAPI_DATA(PyTypeObject) PyMethodDescr_Type; PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; PyAPI_DATA(PyTypeObject) PyDictProxy_Type; #ifndef Py_LIMITED_API PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type; #endif /* Py_LIMITED_API */ PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); struct PyMemberDef; /* forward declaration for following prototype */ PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, struct PyMemberDef *); PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, struct PyGetSetDef *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); #define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) #endif PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); PyAPI_DATA(PyTypeObject) PyProperty_Type; #ifdef __cplusplus } #endif #endif /* !Py_DESCROBJECT_H */
3,019
C++
.h
88
29.477273
78
0.70079
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,540
structseq.h
relativty_Relativty/Relativty_Driver/include/Python/structseq.h
/* Named tuple object interface */ #ifndef Py_STRUCTSEQ_H #define Py_STRUCTSEQ_H #ifdef __cplusplus extern "C" { #endif typedef struct PyStructSequence_Field { const char *name; const char *doc; } PyStructSequence_Field; typedef struct PyStructSequence_Desc { const char *name; const char *doc; struct PyStructSequence_Field *fields; int n_in_sequence; } PyStructSequence_Desc; extern char* PyStructSequence_UnnamedField; #ifndef Py_LIMITED_API PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc); PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc); #endif PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc); PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); #ifndef Py_LIMITED_API typedef PyTupleObject PyStructSequence; /* Macro, *only* to be used to fill in brand new objects */ #define PyStructSequence_SET_ITEM(op, i, v) PyTuple_SET_ITEM(op, i, v) #define PyStructSequence_GET_ITEM(op, i) PyTuple_GET_ITEM(op, i) #endif PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*); PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t); #ifdef __cplusplus } #endif #endif /* !Py_STRUCTSEQ_H */
1,377
C++
.h
37
32.918919
80
0.736446
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,541
pyerrors.h
relativty_Relativty/Relativty_Driver/include/Python/pyerrors.h
#ifndef Py_ERRORS_H #define Py_ERRORS_H #ifdef __cplusplus extern "C" { #endif /* Error handling definitions */ PyAPI_FUNC(void) PyErr_SetNone(PyObject *); PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *); PyAPI_FUNC(void) PyErr_SetString( PyObject *exception, const char *string /* decoded from utf-8 */ ); PyAPI_FUNC(PyObject *) PyErr_Occurred(void); PyAPI_FUNC(void) PyErr_Clear(void); PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *); #endif /* Defined in Python/pylifecycle.c */ PyAPI_FUNC(void) _Py_NO_RETURN Py_FatalError(const char *message); #if defined(Py_DEBUG) || defined(Py_LIMITED_API) #define _PyErr_OCCURRED() PyErr_Occurred() #else #define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type) #endif /* Error testing and normalization */ PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *); PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *); PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); /* Traceback manipulation (PEP 3134) */ PyAPI_FUNC(int) PyException_SetTraceback(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyException_GetTraceback(PyObject *); /* Cause manipulation (PEP 3134) */ PyAPI_FUNC(PyObject *) PyException_GetCause(PyObject *); PyAPI_FUNC(void) PyException_SetCause(PyObject *, PyObject *); /* Context manipulation (PEP 3134) */ PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *); PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *); /* */ #define PyExceptionClass_Check(x) \ (PyType_Check((x)) && \ PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)) #define PyExceptionInstance_Check(x) \ PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS) PyAPI_FUNC(const char *) PyExceptionClass_Name(PyObject *); #define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type)) /* Predefined exceptions */ PyAPI_DATA(PyObject *) PyExc_BaseException; PyAPI_DATA(PyObject *) PyExc_Exception; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration; #endif PyAPI_DATA(PyObject *) PyExc_StopIteration; PyAPI_DATA(PyObject *) PyExc_GeneratorExit; PyAPI_DATA(PyObject *) PyExc_ArithmeticError; PyAPI_DATA(PyObject *) PyExc_LookupError; PyAPI_DATA(PyObject *) PyExc_AssertionError; PyAPI_DATA(PyObject *) PyExc_AttributeError; PyAPI_DATA(PyObject *) PyExc_BufferError; PyAPI_DATA(PyObject *) PyExc_EOFError; PyAPI_DATA(PyObject *) PyExc_FloatingPointError; PyAPI_DATA(PyObject *) PyExc_OSError; PyAPI_DATA(PyObject *) PyExc_ImportError; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_DATA(PyObject *) PyExc_ModuleNotFoundError; #endif PyAPI_DATA(PyObject *) PyExc_IndexError; PyAPI_DATA(PyObject *) PyExc_KeyError; PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt; PyAPI_DATA(PyObject *) PyExc_MemoryError; PyAPI_DATA(PyObject *) PyExc_NameError; PyAPI_DATA(PyObject *) PyExc_OverflowError; PyAPI_DATA(PyObject *) PyExc_RuntimeError; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_RecursionError; #endif PyAPI_DATA(PyObject *) PyExc_NotImplementedError; PyAPI_DATA(PyObject *) PyExc_SyntaxError; PyAPI_DATA(PyObject *) PyExc_IndentationError; PyAPI_DATA(PyObject *) PyExc_TabError; PyAPI_DATA(PyObject *) PyExc_ReferenceError; PyAPI_DATA(PyObject *) PyExc_SystemError; PyAPI_DATA(PyObject *) PyExc_SystemExit; PyAPI_DATA(PyObject *) PyExc_TypeError; PyAPI_DATA(PyObject *) PyExc_UnboundLocalError; PyAPI_DATA(PyObject *) PyExc_UnicodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError; PyAPI_DATA(PyObject *) PyExc_ValueError; PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_DATA(PyObject *) PyExc_BlockingIOError; PyAPI_DATA(PyObject *) PyExc_BrokenPipeError; PyAPI_DATA(PyObject *) PyExc_ChildProcessError; PyAPI_DATA(PyObject *) PyExc_ConnectionError; PyAPI_DATA(PyObject *) PyExc_ConnectionAbortedError; PyAPI_DATA(PyObject *) PyExc_ConnectionRefusedError; PyAPI_DATA(PyObject *) PyExc_ConnectionResetError; PyAPI_DATA(PyObject *) PyExc_FileExistsError; PyAPI_DATA(PyObject *) PyExc_FileNotFoundError; PyAPI_DATA(PyObject *) PyExc_InterruptedError; PyAPI_DATA(PyObject *) PyExc_IsADirectoryError; PyAPI_DATA(PyObject *) PyExc_NotADirectoryError; PyAPI_DATA(PyObject *) PyExc_PermissionError; PyAPI_DATA(PyObject *) PyExc_ProcessLookupError; PyAPI_DATA(PyObject *) PyExc_TimeoutError; #endif /* Compatibility aliases */ PyAPI_DATA(PyObject *) PyExc_EnvironmentError; PyAPI_DATA(PyObject *) PyExc_IOError; #ifdef MS_WINDOWS PyAPI_DATA(PyObject *) PyExc_WindowsError; #endif /* Predefined warning categories */ PyAPI_DATA(PyObject *) PyExc_Warning; PyAPI_DATA(PyObject *) PyExc_UserWarning; PyAPI_DATA(PyObject *) PyExc_DeprecationWarning; PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning; PyAPI_DATA(PyObject *) PyExc_SyntaxWarning; PyAPI_DATA(PyObject *) PyExc_RuntimeWarning; PyAPI_DATA(PyObject *) PyExc_FutureWarning; PyAPI_DATA(PyObject *) PyExc_ImportWarning; PyAPI_DATA(PyObject *) PyExc_UnicodeWarning; PyAPI_DATA(PyObject *) PyExc_BytesWarning; PyAPI_DATA(PyObject *) PyExc_ResourceWarning; /* Convenience functions */ PyAPI_FUNC(int) PyErr_BadArgument(void); PyAPI_FUNC(PyObject *) PyErr_NoMemory(void); PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyObject *, PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObjects( PyObject *, PyObject *, PyObject *); #endif PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( PyObject *exc, const char *filename /* decoded from the filesystem encoding */ ); PyAPI_FUNC(PyObject *) PyErr_Format( PyObject *exception, const char *format, /* ASCII-encoded string */ ... ); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyErr_FormatV( PyObject *exception, const char *format, va_list vargs); #endif #ifdef MS_WINDOWS PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename( int ierr, const char *filename /* decoded from the filesystem encoding */ ); PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject( PyObject *,int, PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObjects( PyObject *,int, PyObject *, PyObject *); #endif PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( PyObject *exc, int ierr, const char *filename /* decoded from the filesystem encoding */ ); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); #endif /* MS_WINDOWS */ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(PyObject *) PyErr_SetImportErrorSubclass(PyObject *, PyObject *, PyObject *, PyObject *); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *, PyObject *); #endif /* Export the old function so that the existing API remains available: */ PyAPI_FUNC(void) PyErr_BadInternalCall(void); PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno); /* Mask the old API with a call to the new API for code compiled under Python 2.0: */ #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) /* Function to create a new exception */ PyAPI_FUNC(PyObject *) PyErr_NewException( const char *name, PyObject *base, PyObject *dict); PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc( const char *name, const char *doc, PyObject *base, PyObject *dict); PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); /* In signalmodule.c */ PyAPI_FUNC(int) PyErr_CheckSignals(void); PyAPI_FUNC(void) PyErr_SetInterrupt(void); /* Support for adding program text to SyntaxErrors */ PyAPI_FUNC(void) PyErr_SyntaxLocation( const char *filename, /* decoded from the filesystem encoding */ int lineno); PyAPI_FUNC(void) PyErr_SyntaxLocationEx( const char *filename, /* decoded from the filesystem encoding */ int lineno, int col_offset); PyAPI_FUNC(PyObject *) PyErr_ProgramText( const char *filename, /* decoded from the filesystem encoding */ int lineno); /* The following functions are used to create and modify unicode exceptions from C */ /* create a UnicodeDecodeError object */ PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create( const char *encoding, /* UTF-8 encoded string */ const char *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason /* UTF-8 encoded string */ ); /* get the encoding attribute */ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *); /* get the object attribute */ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *); /* get the value of the start attribute (the int * may not be NULL) return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *); /* assign a new value to the start attribute return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t); /* get the value of the end attribute (the int *may not be NULL) return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *); /* assign a new value to the end attribute return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t); /* get the value of the reason attribute */ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *); /* assign a new value to the reason attribute return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason( PyObject *exc, const char *reason /* UTF-8 encoded string */ ); PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason( PyObject *exc, const char *reason /* UTF-8 encoded string */ ); PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( PyObject *exc, const char *reason /* UTF-8 encoded string */ ); /* These APIs aren't really part of the error implementation, but often needed to format error messages; the native C lib APIs are not available on all platforms, which is why we provide emulations for those platforms in Python/mysnprintf.c, WARNING: The return value of snprintf varies across platforms; do not rely on any particular behavior; eventually the C99 defn may be reliable. */ #if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) # define HAVE_SNPRINTF # define snprintf _snprintf # define vsnprintf _vsnprintf #endif #include <stdarg.h> PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 3, 4))); PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) Py_GCC_ATTRIBUTE((format(printf, 3, 0))); #ifndef Py_LIMITED_API # define Py_CPYTHON_ERRORS_H # include "cpython/pyerrors.h" # undef Py_CPYTHON_ERRORS_H #endif #ifdef __cplusplus } #endif #endif /* !Py_ERRORS_H */
12,786
C++
.h
289
42.038062
87
0.750301
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,542
picklebufobject.h
relativty_Relativty/Relativty_Driver/include/Python/picklebufobject.h
/* PickleBuffer object. This is built-in for ease of use from third-party * C extensions. */ #ifndef Py_PICKLEBUFOBJECT_H #define Py_PICKLEBUFOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API PyAPI_DATA(PyTypeObject) PyPickleBuffer_Type; #define PyPickleBuffer_Check(op) (Py_TYPE(op) == &PyPickleBuffer_Type) /* Create a PickleBuffer redirecting to the given buffer-enabled object */ PyAPI_FUNC(PyObject *) PyPickleBuffer_FromObject(PyObject *); /* Get the PickleBuffer's underlying view to the original object * (NULL if released) */ PyAPI_FUNC(const Py_buffer *) PyPickleBuffer_GetBuffer(PyObject *); /* Release the PickleBuffer. Returns 0 on success, -1 on error. */ PyAPI_FUNC(int) PyPickleBuffer_Release(PyObject *); #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_PICKLEBUFOBJECT_H */
847
C++
.h
24
33.833333
74
0.767157
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,543
objimpl.h
relativty_Relativty/Relativty_Driver/include/Python/objimpl.h
/* The PyObject_ memory family: high-level object memory interfaces. See pymem.h for the low-level PyMem_ family. */ #ifndef Py_OBJIMPL_H #define Py_OBJIMPL_H #include "pymem.h" #ifdef __cplusplus extern "C" { #endif /* BEWARE: Each interface exports both functions and macros. Extension modules should use the functions, to ensure binary compatibility across Python versions. Because the Python implementation is free to change internal details, and the macros may (or may not) expose details for speed, if you do use the macros you must recompile your extensions with each Python release. Never mix calls to PyObject_ memory functions with calls to the platform malloc/realloc/ calloc/free, or with calls to PyMem_. */ /* Functions and macros for modules that implement new object types. - PyObject_New(type, typeobj) allocates memory for a new object of the given type, and initializes part of it. 'type' must be the C structure type used to represent the object, and 'typeobj' the address of the corresponding type object. Reference count and type pointer are filled in; the rest of the bytes of the object are *undefined*! The resulting expression type is 'type *'. The size of the object is determined by the tp_basicsize field of the type object. - PyObject_NewVar(type, typeobj, n) is similar but allocates a variable-size object with room for n items. In addition to the refcount and type pointer fields, this also fills in the ob_size field. - PyObject_Del(op) releases the memory allocated for an object. It does not run a destructor -- it only frees the memory. PyObject_Free is identical. - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't allocate memory. Instead of a 'type' parameter, they take a pointer to a new object (allocated by an arbitrary allocator), and initialize its object header fields. Note that objects created with PyObject_{New, NewVar} are allocated using the specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is enabled. In addition, a special debugging allocator is used if PYMALLOC_DEBUG is also #defined. In case a specific form of memory management is needed (for example, if you must use the platform malloc heap(s), or shared memory, or C++ local storage or operator new), you must first allocate the object with your custom allocator, then pass its pointer to PyObject_{Init, InitVar} for filling in its Python- specific fields: reference count, type pointer, possibly others. You should be aware that Python has no control over these objects because they don't cooperate with the Python memory manager. Such objects may not be eligible for automatic garbage collection and you have to make sure that they are released accordingly whenever their destructor gets called (cf. the specific form of memory management you're using). Unless you have specific memory management requirements, use PyObject_{New, NewVar, Del}. */ /* * Raw object memory interface * =========================== */ /* Functions to call the same malloc/realloc/free as used by Python's object allocator. If WITH_PYMALLOC is enabled, these may differ from the platform malloc/realloc/free. The Python object allocator is designed for fast, cache-conscious allocation of many "small" objects, and with low hidden memory overhead. PyObject_Malloc(0) returns a unique non-NULL pointer if possible. PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n). PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory at p. Returned pointers must be checked for NULL explicitly; no action is performed on failure other than to return NULL (no warning it printed, no exception is set, etc). For allocating objects, use PyObject_{New, NewVar} instead whenever possible. The PyObject_{Malloc, Realloc, Free} family is exposed so that you can exploit Python's small-block allocator for non-object uses. If you must use these routines to allocate object memory, make sure the object gets initialized via PyObject_{Init, InitVar} after obtaining the raw memory. */ PyAPI_FUNC(void *) PyObject_Malloc(size_t size); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(void *) PyObject_Calloc(size_t nelem, size_t elsize); #endif PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyObject_Free(void *ptr); /* Macros */ #define PyObject_MALLOC PyObject_Malloc #define PyObject_REALLOC PyObject_Realloc #define PyObject_FREE PyObject_Free #define PyObject_Del PyObject_Free #define PyObject_DEL PyObject_Free /* * Generic object allocator interface * ================================== */ /* Functions */ PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *); PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *, PyTypeObject *, Py_ssize_t); PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *); PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); #define PyObject_New(type, typeobj) \ ( (type *) _PyObject_New(typeobj) ) #define PyObject_NewVar(type, typeobj, n) \ ( (type *) _PyObject_NewVar((typeobj), (n)) ) /* Inline functions trading binary compatibility for speed: PyObject_INIT() is the fast version of PyObject_Init(), and PyObject_INIT_VAR() is the fast version of PyObject_InitVar. See also pymem.h. These inline functions expect non-NULL object pointers. */ static inline PyObject* _PyObject_INIT(PyObject *op, PyTypeObject *typeobj) { assert(op != NULL); Py_TYPE(op) = typeobj; if (PyType_GetFlags(typeobj) & Py_TPFLAGS_HEAPTYPE) { Py_INCREF(typeobj); } _Py_NewReference(op); return op; } #define PyObject_INIT(op, typeobj) \ _PyObject_INIT(_PyObject_CAST(op), (typeobj)) static inline PyVarObject* _PyObject_INIT_VAR(PyVarObject *op, PyTypeObject *typeobj, Py_ssize_t size) { assert(op != NULL); Py_SIZE(op) = size; PyObject_INIT((PyObject *)op, typeobj); return op; } #define PyObject_INIT_VAR(op, typeobj, size) \ _PyObject_INIT_VAR(_PyVarObject_CAST(op), (typeobj), (size)) #define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize ) /* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a vrbl-size object with nitems items, exclusive of gc overhead (if any). The value is rounded up to the closest multiple of sizeof(void *), in order to ensure that pointer fields at the end of the object are correctly aligned for the platform (this is of special importance for subclasses of, e.g., str or int, so that pointers can be stored after the embedded data). Note that there's no memory wastage in doing this, as malloc has to return (at worst) pointer-aligned memory anyway. */ #if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0 # error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2" #endif #define _PyObject_VAR_SIZE(typeobj, nitems) \ _Py_SIZE_ROUND_UP((typeobj)->tp_basicsize + \ (nitems)*(typeobj)->tp_itemsize, \ SIZEOF_VOID_P) #define PyObject_NEW(type, typeobj) \ ( (type *) PyObject_Init( \ (PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) ) #define PyObject_NEW_VAR(type, typeobj, n) \ ( (type *) PyObject_InitVar( \ (PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj),(n)) ),\ (typeobj), (n)) ) /* This example code implements an object constructor with a custom allocator, where PyObject_New is inlined, and shows the important distinction between two steps (at least): 1) the actual allocation of the object storage; 2) the initialization of the Python specific fields in this storage with PyObject_{Init, InitVar}. PyObject * YourObject_New(...) { PyObject *op; op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct)); if (op == NULL) return PyErr_NoMemory(); PyObject_Init(op, &YourTypeStruct); op->ob_field = value; ... return op; } Note that in C++, the use of the new operator usually implies that the 1st step is performed automatically for you, so in a C++ class constructor you would start directly with PyObject_Init/InitVar */ /* * Garbage Collection Support * ========================== */ /* C equivalent of gc.collect() which ignores the state of gc.enabled. */ PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void); /* Test if a type has a GC head */ #define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t); #define PyObject_GC_Resize(type, op, n) \ ( (type *) _PyObject_GC_Resize(_PyVarObject_CAST(op), (n)) ) PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *); PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t); /* Tell the GC to track this object. * * See also private _PyObject_GC_TRACK() macro. */ PyAPI_FUNC(void) PyObject_GC_Track(void *); /* Tell the GC to stop tracking this object. * * See also private _PyObject_GC_UNTRACK() macro. */ PyAPI_FUNC(void) PyObject_GC_UnTrack(void *); PyAPI_FUNC(void) PyObject_GC_Del(void *); #define PyObject_GC_New(type, typeobj) \ ( (type *) _PyObject_GC_New(typeobj) ) #define PyObject_GC_NewVar(type, typeobj, n) \ ( (type *) _PyObject_GC_NewVar((typeobj), (n)) ) /* Utility macro to help write tp_traverse functions. * To use this macro, the tp_traverse function must name its arguments * "visit" and "arg". This is intended to keep tp_traverse functions * looking as much alike as possible. */ #define Py_VISIT(op) \ do { \ if (op) { \ int vret = visit(_PyObject_CAST(op), arg); \ if (vret) \ return vret; \ } \ } while (0) #ifndef Py_LIMITED_API # define Py_CPYTHON_OBJIMPL_H # include "cpython/objimpl.h" # undef Py_CPYTHON_OBJIMPL_H #endif #ifdef __cplusplus } #endif #endif /* !Py_OBJIMPL_H */
10,537
C++
.h
224
43.303571
79
0.689749
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,544
methodobject.h
relativty_Relativty/Relativty_Driver/include/Python/methodobject.h
/* Method object interface */ #ifndef Py_METHODOBJECT_H #define Py_METHODOBJECT_H #ifdef __cplusplus extern "C" { #endif /* This is about the type 'builtin_function_or_method', not Python methods in user-defined classes. See classobject.h for the latter. */ PyAPI_DATA(PyTypeObject) PyCFunction_Type; #define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); typedef PyObject *(*_PyCFunctionFast) (PyObject *, PyObject *const *, Py_ssize_t); typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, PyObject *); typedef PyObject *(*_PyCFunctionFastWithKeywords) (PyObject *, PyObject *const *, Py_ssize_t, PyObject *); typedef PyObject *(*PyNoArgsFunction)(PyObject *); PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #ifndef Py_LIMITED_API #define PyCFunction_GET_FUNCTION(func) \ (((PyCFunctionObject *)func) -> m_ml -> ml_meth) #define PyCFunction_GET_SELF(func) \ (((PyCFunctionObject *)func) -> m_ml -> ml_flags & METH_STATIC ? \ NULL : ((PyCFunctionObject *)func) -> m_self) #define PyCFunction_GET_FLAGS(func) \ (((PyCFunctionObject *)func) -> m_ml -> ml_flags) #endif PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyCFunction_FastCallDict(PyObject *func, PyObject *const *args, Py_ssize_t nargs, PyObject *kwargs); #endif struct PyMethodDef { const char *ml_name; /* The name of the built-in function/method */ PyCFunction ml_meth; /* The C function that implements it */ int ml_flags; /* Combination of METH_xxx flags, which mostly describe the args expected by the C func */ const char *ml_doc; /* The __doc__ attribute, or NULL */ }; typedef struct PyMethodDef PyMethodDef; #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, PyObject *); /* Flag passed to newmethodobject */ /* #define METH_OLDARGS 0x0000 -- unsupported now */ #define METH_VARARGS 0x0001 #define METH_KEYWORDS 0x0002 /* METH_NOARGS and METH_O must not be combined with the flags above. */ #define METH_NOARGS 0x0004 #define METH_O 0x0008 /* METH_CLASS and METH_STATIC are a little different; these control the construction of methods for a class. These cannot be used for functions in modules. */ #define METH_CLASS 0x0010 #define METH_STATIC 0x0020 /* METH_COEXIST allows a method to be entered even though a slot has already filled the entry. When defined, the flag allows a separate method, "__contains__" for example, to coexist with a defined slot like sq_contains. */ #define METH_COEXIST 0x0040 #ifndef Py_LIMITED_API #define METH_FASTCALL 0x0080 #endif /* This bit is preserved for Stackless Python */ #ifdef STACKLESS #define METH_STACKLESS 0x0100 #else #define METH_STACKLESS 0x0000 #endif #ifndef Py_LIMITED_API typedef struct { PyObject_HEAD PyMethodDef *m_ml; /* Description of the C function to call */ PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ PyObject *m_module; /* The __module__ attribute, can be anything */ PyObject *m_weakreflist; /* List of weak references */ vectorcallfunc vectorcall; } PyCFunctionObject; PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallDict( PyMethodDef *method, PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwargs); PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallKeywords( PyMethodDef *method, PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames); #endif PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyCFunction_DebugMallocStats(FILE *out); PyAPI_FUNC(void) _PyMethod_DebugMallocStats(FILE *out); #endif #ifdef __cplusplus } #endif #endif /* !Py_METHODOBJECT_H */
4,406
C++
.h
108
36.175926
82
0.692632
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,545
marshal.h
relativty_Relativty/Relativty_Driver/include/Python/marshal.h
/* Interface for marshal.c */ #ifndef Py_MARSHAL_H #define Py_MARSHAL_H #ifdef __cplusplus extern "C" { #endif #define Py_MARSHAL_VERSION 4 PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int); PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int); PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int); #ifndef Py_LIMITED_API PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *); PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); #endif PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *, Py_ssize_t); #ifdef __cplusplus } #endif #endif /* !Py_MARSHAL_H */
803
C++
.h
22
32.772727
70
0.726452
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,546
pyarena.h
relativty_Relativty/Relativty_Driver/include/Python/pyarena.h
/* An arena-like memory interface for the compiler. */ #ifndef Py_LIMITED_API #ifndef Py_PYARENA_H #define Py_PYARENA_H #ifdef __cplusplus extern "C" { #endif typedef struct _arena PyArena; /* PyArena_New() and PyArena_Free() create a new arena and free it, respectively. Once an arena has been created, it can be used to allocate memory via PyArena_Malloc(). Pointers to PyObject can also be registered with the arena via PyArena_AddPyObject(), and the arena will ensure that the PyObjects stay alive at least until PyArena_Free() is called. When an arena is freed, all the memory it allocated is freed, the arena releases internal references to registered PyObject*, and none of its pointers are valid. XXX (tim) What does "none of its pointers are valid" mean? Does it XXX mean that pointers previously obtained via PyArena_Malloc() are XXX no longer valid? (That's clearly true, but not sure that's what XXX the text is trying to say.) PyArena_New() returns an arena pointer. On error, it returns a negative number and sets an exception. XXX (tim): Not true. On error, PyArena_New() actually returns NULL, XXX and looks like it may or may not set an exception (e.g., if the XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on XXX and an exception is set; OTOH, if the internal XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but XXX an exception is not set in that case). */ PyAPI_FUNC(PyArena *) PyArena_New(void); PyAPI_FUNC(void) PyArena_Free(PyArena *); /* Mostly like malloc(), return the address of a block of memory spanning * `size` bytes, or return NULL (without setting an exception) if enough * new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with * size=0 does not guarantee to return a unique pointer (the pointer * returned may equal one or more other pointers obtained from * PyArena_Malloc()). * Note that pointers obtained via PyArena_Malloc() must never be passed to * the system free() or realloc(), or to any of Python's similar memory- * management functions. PyArena_Malloc()-obtained pointers remain valid * until PyArena_Free(ar) is called, at which point all pointers obtained * from the arena `ar` become invalid simultaneously. */ PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size); /* This routine isn't a proper arena allocation routine. It takes * a PyObject* and records it so that it can be DECREFed when the * arena is freed. */ PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *); #ifdef __cplusplus } #endif #endif /* !Py_PYARENA_H */ #endif /* Py_LIMITED_API */
2,744
C++
.h
55
45.890909
77
0.723507
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,547
osdefs.h
relativty_Relativty/Relativty_Driver/include/Python/osdefs.h
#ifndef Py_OSDEFS_H #define Py_OSDEFS_H #ifdef __cplusplus extern "C" { #endif /* Operating system dependencies */ #ifdef MS_WINDOWS #define SEP L'\\' #define ALTSEP L'/' #define MAXPATHLEN 256 #define DELIM L';' #endif #ifdef __VXWORKS__ #define DELIM L';' #endif /* Filename separator */ #ifndef SEP #define SEP L'/' #endif /* Max pathname length */ #ifdef __hpux #include <sys/param.h> #include <limits.h> #ifndef PATH_MAX #define PATH_MAX MAXPATHLEN #endif #endif #ifndef MAXPATHLEN #if defined(PATH_MAX) && PATH_MAX > 1024 #define MAXPATHLEN PATH_MAX #else #define MAXPATHLEN 1024 #endif #endif /* Search path entry delimiter */ #ifndef DELIM #define DELIM L':' #endif #ifdef __cplusplus } #endif #endif /* !Py_OSDEFS_H */
737
C++
.h
42
16.333333
40
0.747813
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,549
py_curses.h
relativty_Relativty/Relativty_Driver/include/Python/py_curses.h
#ifndef Py_CURSES_H #define Py_CURSES_H #ifdef __APPLE__ /* ** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards ** against multiple definition of wchar_t. */ #ifdef _BSD_WCHAR_T_DEFINED_ #define _WCHAR_T #endif #endif /* __APPLE__ */ /* On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards against multiple definition of wchar_t and wint_t. */ #if defined(__FreeBSD__) && defined(_XOPEN_SOURCE_EXTENDED) # ifndef __wchar_t # define __wchar_t # endif # ifndef __wint_t # define __wint_t # endif #endif #if !defined(HAVE_CURSES_IS_PAD) && defined(WINDOW_HAS_FLAGS) /* The following definition is necessary for ncurses 5.7; without it, some of [n]curses.h set NCURSES_OPAQUE to 1, and then Python can't get at the WINDOW flags field. */ #define NCURSES_OPAQUE 0 #endif #ifdef HAVE_NCURSES_H #include <ncurses.h> #else #include <curses.h> #endif #ifdef HAVE_NCURSES_H /* configure was checking <curses.h>, but we will use <ncurses.h>, which has some or all these features. */ #if !defined(WINDOW_HAS_FLAGS) && !(NCURSES_OPAQUE+0) #define WINDOW_HAS_FLAGS 1 #endif #if !defined(HAVE_CURSES_IS_PAD) && NCURSES_VERSION_PATCH+0 >= 20090906 #define HAVE_CURSES_IS_PAD 1 #endif #ifndef MVWDELCH_IS_EXPRESSION #define MVWDELCH_IS_EXPRESSION 1 #endif #endif #ifdef __cplusplus extern "C" { #endif #define PyCurses_API_pointers 4 /* Type declarations */ typedef struct { PyObject_HEAD WINDOW *win; char *encoding; } PyCursesWindowObject; #define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type) #define PyCurses_CAPSULE_NAME "_curses._C_API" #ifdef CURSES_MODULE /* This section is used when compiling _cursesmodule.c */ #else /* This section is used in modules that use the _cursesmodule API */ static void **PyCurses_API; #define PyCursesWindow_Type (*(PyTypeObject *) PyCurses_API[0]) #define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;} #define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;} #define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;} #define import_curses() \ PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1); #endif /* general error messages */ static const char catchall_ERR[] = "curses function returned ERR"; static const char catchall_NULL[] = "curses function returned NULL"; #ifdef __cplusplus } #endif #endif /* !defined(Py_CURSES_H) */
2,477
C++
.h
76
30.907895
91
0.72907
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,550
tracemalloc.h
relativty_Relativty/Relativty_Driver/include/Python/tracemalloc.h
#ifndef Py_TRACEMALLOC_H #define Py_TRACEMALLOC_H #ifndef Py_LIMITED_API /* Track an allocated memory block in the tracemalloc module. Return 0 on success, return -1 on error (failed to allocate memory to store the trace). Return -2 if tracemalloc is disabled. If memory block is already tracked, update the existing trace. */ PyAPI_FUNC(int) PyTraceMalloc_Track( unsigned int domain, uintptr_t ptr, size_t size); /* Untrack an allocated memory block in the tracemalloc module. Do nothing if the block was not tracked. Return -2 if tracemalloc is disabled, otherwise return 0. */ PyAPI_FUNC(int) PyTraceMalloc_Untrack( unsigned int domain, uintptr_t ptr); /* Get the traceback where a memory block was allocated. Return a tuple of (filename: str, lineno: int) tuples. Return None if the tracemalloc module is disabled or if the memory block is not tracked by tracemalloc. Raise an exception and return NULL on error. */ PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback( unsigned int domain, uintptr_t ptr); #endif #endif /* !Py_TRACEMALLOC_H */
1,114
C++
.h
28
36.357143
78
0.752788
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,551
import.h
relativty_Relativty/Relativty_Driver/include/Python/import.h
/* Module definition and import interface */ #ifndef Py_IMPORT_H #define Py_IMPORT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API PyMODINIT_FUNC PyInit__imp(void); #endif /* !Py_LIMITED_API */ PyAPI_FUNC(long) PyImport_GetMagicNumber(void); PyAPI_FUNC(const char *) PyImport_GetMagicTag(void); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule( const char *name, /* UTF-8 encoded string */ PyObject *co ); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx( const char *name, /* UTF-8 encoded string */ PyObject *co, const char *pathname /* decoded from the filesystem encoding */ ); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames( const char *name, /* UTF-8 encoded string */ PyObject *co, const char *pathname, /* decoded from the filesystem encoding */ const char *cpathname /* decoded from the filesystem encoding */ ); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( PyObject *name, PyObject *co, PyObject *pathname, PyObject *cpathname ); #endif PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 PyAPI_FUNC(PyObject *) PyImport_GetModule(PyObject *name); #endif #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *); PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(struct _Py_Identifier *name); PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *name, PyObject *modules); PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module); PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( PyObject *name ); #endif PyAPI_FUNC(PyObject *) PyImport_AddModule( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyImport_ImportModule( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel( const char *name, /* UTF-8 encoded string */ PyObject *globals, PyObject *locals, PyObject *fromlist, int level ); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject( PyObject *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level ); #endif #define PyImport_ImportModuleEx(n, g, l, f) \ PyImport_ImportModuleLevel(n, g, l, f, 0) PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path); PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); PyAPI_FUNC(void) PyImport_Cleanup(void); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject( PyObject *name ); #endif PyAPI_FUNC(int) PyImport_ImportFrozenModule( const char *name /* UTF-8 encoded string */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyImport_AcquireLock(void); PyAPI_FUNC(int) _PyImport_ReleaseLock(void); PyAPI_FUNC(void) _PyImport_ReInitLock(void); PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin( const char *name, /* UTF-8 encoded string */ PyObject *modules ); PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObjectEx(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(int) _PyImport_FixupBuiltin( PyObject *mod, const char *name, /* UTF-8 encoded string */ PyObject *modules ); PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *, PyObject *); struct _inittab { const char *name; /* ASCII encoded string */ PyObject* (*initfunc)(void); }; PyAPI_DATA(struct _inittab *) PyImport_Inittab; PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); #endif /* Py_LIMITED_API */ PyAPI_DATA(PyTypeObject) PyNullImporter_Type; PyAPI_FUNC(int) PyImport_AppendInittab( const char *name, /* ASCII encoded string */ PyObject* (*initfunc)(void) ); #ifndef Py_LIMITED_API struct _frozen { const char *name; /* ASCII encoded string */ const unsigned char *code; int size; }; /* Embedding apps may change this pointer to point to their favorite collection of frozen modules: */ PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules; #endif #ifdef __cplusplus } #endif #endif /* !Py_IMPORT_H */
4,926
C++
.h
134
32.798507
78
0.684949
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,552
interpreteridobject.h
relativty_Relativty/Relativty_Driver/include/Python/interpreteridobject.h
#ifndef Py_INTERPRETERIDOBJECT_H #define Py_INTERPRETERIDOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API # define Py_CPYTHON_INTERPRETERIDOBJECT_H # include "cpython/interpreteridobject.h" # undef Py_CPYTHON_INTERPRETERIDOBJECT_H #endif #ifdef __cplusplus } #endif #endif /* !Py_INTERPRETERIDOBJECT_H */
334
C++
.h
14
22.642857
43
0.801262
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,553
traceback.h
relativty_Relativty/Relativty_Driver/include/Python/traceback.h
#ifndef Py_TRACEBACK_H #define Py_TRACEBACK_H #ifdef __cplusplus extern "C" { #endif struct _frame; /* Traceback interface */ PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); /* Reveal traceback type so we can typecheck traceback objects */ PyAPI_DATA(PyTypeObject) PyTraceBack_Type; #define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type) #ifndef Py_LIMITED_API # define Py_CPYTHON_TRACEBACK_H # include "cpython/traceback.h" # undef Py_CPYTHON_TRACEBACK_H #endif #ifdef __cplusplus } #endif #endif /* !Py_TRACEBACK_H */
601
C++
.h
21
27.285714
65
0.762653
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,554
bitset.h
relativty_Relativty/Relativty_Driver/include/Python/bitset.h
#ifndef Py_BITSET_H #define Py_BITSET_H #ifdef __cplusplus extern "C" { #endif /* Bitset interface */ #define BYTE char typedef BYTE *bitset; #define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0) #define BITSPERBYTE (8*sizeof(BYTE)) #define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE) #define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE) #define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit)) #ifdef __cplusplus } #endif #endif /* !Py_BITSET_H */
468
C++
.h
17
26.176471
72
0.692135
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,555
listobject.h
relativty_Relativty/Relativty_Driver/include/Python/listobject.h
/* List object interface */ /* Another generally useful object type is a list of object pointers. This is a mutable type: the list items can be changed, and items can be added or removed. Out-of-range indices or non-list objects are ignored. *** WARNING *** PyList_SetItem does not increment the new item's reference count, but does decrement the reference count of the item it replaces, if not nil. It does *decrement* the reference count if it is *not* inserted in the list. Similarly, PyList_GetItem does not increment the returned item's reference count. */ #ifndef Py_LISTOBJECT_H #define Py_LISTOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API typedef struct { PyObject_VAR_HEAD /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */ PyObject **ob_item; /* ob_item contains space for 'allocated' elements. The number * currently in use is ob_size. * Invariants: * 0 <= ob_size <= allocated * len(list) == ob_size * ob_item == NULL implies ob_size == allocated == 0 * list.sort() temporarily sets allocated to -1 to detect mutations. * * Items must normally not be NULL, except during construction when * the list is not yet visible outside the function that builds it. */ Py_ssize_t allocated; } PyListObject; #endif PyAPI_DATA(PyTypeObject) PyList_Type; PyAPI_DATA(PyTypeObject) PyListIter_Type; PyAPI_DATA(PyTypeObject) PyListRevIter_Type; PyAPI_DATA(PyTypeObject) PySortWrapper_Type; #define PyList_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) #define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type) PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size); PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *); PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); PyAPI_FUNC(int) PyList_Sort(PyObject *); PyAPI_FUNC(int) PyList_Reverse(PyObject *); PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); PyAPI_FUNC(int) PyList_ClearFreeList(void); PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out); #endif /* Macro, trading safety for speed */ #ifndef Py_LIMITED_API #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i]) #define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v)) #define PyList_GET_SIZE(op) (assert(PyList_Check(op)),Py_SIZE(op)) #define _PyList_ITEMS(op) (((PyListObject *)(op))->ob_item) #endif #ifdef __cplusplus } #endif #endif /* !Py_LISTOBJECT_H */
2,927
C++
.h
69
40.173913
80
0.726634
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,556
pymath.h
relativty_Relativty/Relativty_Driver/include/Python/pymath.h
#ifndef Py_PYMATH_H #define Py_PYMATH_H #include "pyconfig.h" /* include for defines */ /************************************************************************** Symbols and macros to supply platform-independent interfaces to mathematical functions and constants **************************************************************************/ /* Python provides implementations for copysign, round and hypot in * Python/pymath.c just in case your math library doesn't provide the * functions. * *Note: PC/pyconfig.h defines copysign as _copysign */ #ifndef HAVE_COPYSIGN extern double copysign(double, double); #endif #ifndef HAVE_ROUND extern double round(double); #endif #ifndef HAVE_HYPOT extern double hypot(double, double); #endif /* extra declarations */ #ifndef _MSC_VER #ifndef __STDC__ extern double fmod (double, double); extern double frexp (double, int *); extern double ldexp (double, int); extern double modf (double, double *); extern double pow(double, double); #endif /* __STDC__ */ #endif /* _MSC_VER */ /* High precision definition of pi and e (Euler) * The values are taken from libc6's math.h. */ #ifndef Py_MATH_PIl #define Py_MATH_PIl 3.1415926535897932384626433832795029L #endif #ifndef Py_MATH_PI #define Py_MATH_PI 3.14159265358979323846 #endif #ifndef Py_MATH_El #define Py_MATH_El 2.7182818284590452353602874713526625L #endif #ifndef Py_MATH_E #define Py_MATH_E 2.7182818284590452354 #endif /* Tau (2pi) to 40 digits, taken from tauday.com/tau-digits. */ #ifndef Py_MATH_TAU #define Py_MATH_TAU 6.2831853071795864769252867665590057683943L #endif /* On x86, Py_FORCE_DOUBLE forces a floating-point number out of an x87 FPU register and into a 64-bit memory location, rounding from extended precision to double precision in the process. On other platforms it does nothing. */ /* we take double rounding as evidence of x87 usage */ #ifndef Py_LIMITED_API #ifndef Py_FORCE_DOUBLE # ifdef X87_DOUBLE_ROUNDING PyAPI_FUNC(double) _Py_force_double(double); # define Py_FORCE_DOUBLE(X) (_Py_force_double(X)) # else # define Py_FORCE_DOUBLE(X) (X) # endif #endif #endif #ifndef Py_LIMITED_API #ifdef HAVE_GCC_ASM_FOR_X87 PyAPI_FUNC(unsigned short) _Py_get_387controlword(void); PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); #endif #endif /* Py_IS_NAN(X) * Return 1 if float or double arg is a NaN, else 0. * Caution: * X is evaluated more than once. * This may not work on all platforms. Each platform has *some* * way to spell this, though -- override in pyconfig.h if you have * a platform where it doesn't work. * Note: PC/pyconfig.h defines Py_IS_NAN as _isnan */ #ifndef Py_IS_NAN #if defined HAVE_DECL_ISNAN && HAVE_DECL_ISNAN == 1 #define Py_IS_NAN(X) isnan(X) #else #define Py_IS_NAN(X) ((X) != (X)) #endif #endif /* Py_IS_INFINITY(X) * Return 1 if float or double arg is an infinity, else 0. * Caution: * X is evaluated more than once. * This implementation may set the underflow flag if |X| is very small; * it really can't be implemented correctly (& easily) before C99. * Override in pyconfig.h if you have a better spelling on your platform. * Py_FORCE_DOUBLE is used to avoid getting false negatives from a * non-infinite value v sitting in an 80-bit x87 register such that * v becomes infinite when spilled from the register to 64-bit memory. * Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf */ #ifndef Py_IS_INFINITY # if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1 # define Py_IS_INFINITY(X) isinf(X) # else # define Py_IS_INFINITY(X) ((X) && \ (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X))) # endif #endif /* Py_IS_FINITE(X) * Return 1 if float or double arg is neither infinite nor NAN, else 0. * Some compilers (e.g. VisualStudio) have intrisics for this, so a special * macro for this particular test is useful * Note: PC/pyconfig.h defines Py_IS_FINITE as _finite */ #ifndef Py_IS_FINITE #if defined HAVE_DECL_ISFINITE && HAVE_DECL_ISFINITE == 1 #define Py_IS_FINITE(X) isfinite(X) #elif defined HAVE_FINITE #define Py_IS_FINITE(X) finite(X) #else #define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X)) #endif #endif /* HUGE_VAL is supposed to expand to a positive double infinity. Python * uses Py_HUGE_VAL instead because some platforms are broken in this * respect. We used to embed code in pyport.h to try to worm around that, * but different platforms are broken in conflicting ways. If you're on * a platform where HUGE_VAL is defined incorrectly, fiddle your Python * config to #define Py_HUGE_VAL to something that works on your platform. */ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif /* Py_NAN * A value that evaluates to a NaN. On IEEE 754 platforms INF*0 or * INF/INF works. Define Py_NO_NAN in pyconfig.h if your platform * doesn't support NaNs. */ #if !defined(Py_NAN) && !defined(Py_NO_NAN) #if !defined(__INTEL_COMPILER) #define Py_NAN (Py_HUGE_VAL * 0.) #else /* __INTEL_COMPILER */ #if defined(ICC_NAN_STRICT) #pragma float_control(push) #pragma float_control(precise, on) #pragma float_control(except, on) #if defined(_MSC_VER) __declspec(noinline) #else /* Linux */ __attribute__((noinline)) #endif /* _MSC_VER */ static double __icc_nan() { return sqrt(-1.0); } #pragma float_control (pop) #define Py_NAN __icc_nan() #else /* ICC_NAN_RELAXED as default for Intel Compiler */ static const union { unsigned char buf[8]; double __icc_nan; } __nan_store = {0,0,0,0,0,0,0xf8,0x7f}; #define Py_NAN (__nan_store.__icc_nan) #endif /* ICC_NAN_STRICT */ #endif /* __INTEL_COMPILER */ #endif /* Py_OVERFLOWED(X) * Return 1 iff a libm function overflowed. Set errno to 0 before calling * a libm function, and invoke this macro after, passing the function * result. * Caution: * This isn't reliable. C99 no longer requires libm to set errno under * any exceptional condition, but does require +- HUGE_VAL return * values on overflow. A 754 box *probably* maps HUGE_VAL to a * double infinity, and we're cool if that's so, unless the input * was an infinity and an infinity is the expected result. A C89 * system sets errno to ERANGE, so we check for that too. We're * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or * if the returned result is a NaN, or if a C89 box returns HUGE_VAL * in non-overflow cases. * X is evaluated more than once. * Some platforms have better way to spell this, so expect some #ifdef'ery. * * OpenBSD uses 'isinf()' because a compiler bug on that platform causes * the longer macro version to be mis-compiled. This isn't optimal, and * should be removed once a newer compiler is available on that platform. * The system that had the failure was running OpenBSD 3.2 on Intel, with * gcc 2.95.3. * * According to Tim's checkin, the FreeBSD systems use isinf() to work * around a FPE bug on that platform. */ #if defined(__FreeBSD__) || defined(__OpenBSD__) #define Py_OVERFLOWED(X) isinf(X) #else #define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \ (X) == Py_HUGE_VAL || \ (X) == -Py_HUGE_VAL)) #endif /* Return whether integral type *type* is signed or not. */ #define _Py_IntegralTypeSigned(type) ((type)(-1) < 0) /* Return the maximum value of integral type *type*. */ #define _Py_IntegralTypeMax(type) ((_Py_IntegralTypeSigned(type)) ? (((((type)1 << (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0) /* Return the minimum value of integral type *type*. */ #define _Py_IntegralTypeMin(type) ((_Py_IntegralTypeSigned(type)) ? -_Py_IntegralTypeMax(type) - 1 : 0) /* Check whether *v* is in the range of integral type *type*. This is most * useful if *v* is floating-point, since demoting a floating-point *v* to an * integral type that cannot represent *v*'s integral part is undefined * behavior. */ #define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type)) #endif /* Py_PYMATH_H */
8,312
C++
.h
208
37.1875
139
0.682752
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,557
warnings.h
relativty_Relativty/Relativty_Driver/include/Python/warnings.h
#ifndef Py_WARNINGS_H #define Py_WARNINGS_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyWarnings_Init(void); #endif PyAPI_FUNC(int) PyErr_WarnEx( PyObject *category, const char *message, /* UTF-8 encoded string */ Py_ssize_t stack_level); PyAPI_FUNC(int) PyErr_WarnFormat( PyObject *category, Py_ssize_t stack_level, const char *format, /* ASCII-encoded string */ ...); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 /* Emit a ResourceWarning warning */ PyAPI_FUNC(int) PyErr_ResourceWarning( PyObject *source, Py_ssize_t stack_level, const char *format, /* ASCII-encoded string */ ...); #endif #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyErr_WarnExplicitObject( PyObject *category, PyObject *message, PyObject *filename, int lineno, PyObject *module, PyObject *registry); #endif PyAPI_FUNC(int) PyErr_WarnExplicit( PyObject *category, const char *message, /* UTF-8 encoded string */ const char *filename, /* decoded from the filesystem encoding */ int lineno, const char *module, /* UTF-8 encoded string */ PyObject *registry); #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyErr_WarnExplicitFormat(PyObject *category, const char *filename, int lineno, const char *module, PyObject *registry, const char *format, ...); #endif /* DEPRECATED: Use PyErr_WarnEx() instead. */ #ifndef Py_LIMITED_API #define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) #endif #ifndef Py_LIMITED_API void _PyErr_WarnUnawaitedCoroutine(PyObject *coro); #endif #ifdef __cplusplus } #endif #endif /* !Py_WARNINGS_H */
1,776
C++
.h
59
26.135593
74
0.674664
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,558
eval.h
relativty_Relativty/Relativty_Driver/include/Python/eval.h
/* Interface to execute compiled code */ #ifndef Py_EVAL_H #define Py_EVAL_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co, PyObject *globals, PyObject *locals, PyObject *const *args, int argc, PyObject *const *kwds, int kwdc, PyObject *const *defs, int defc, PyObject *kwdefs, PyObject *closure); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyEval_EvalCodeWithName( PyObject *co, PyObject *globals, PyObject *locals, PyObject *const *args, Py_ssize_t argcount, PyObject *const *kwnames, PyObject *const *kwargs, Py_ssize_t kwcount, int kwstep, PyObject *const *defs, Py_ssize_t defcount, PyObject *kwdefs, PyObject *closure, PyObject *name, PyObject *qualname); PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); #endif #ifdef __cplusplus } #endif #endif /* !Py_EVAL_H */
1,209
C++
.h
30
29.8
78
0.585324
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,559
pymacconfig.h
relativty_Relativty/Relativty_Driver/include/Python/pymacconfig.h
#ifndef PYMACCONFIG_H #define PYMACCONFIG_H /* * This file moves some of the autoconf magic to compile-time * when building on MacOSX. This is needed for building 4-way * universal binaries and for 64-bit universal binaries because * the values redefined below aren't configure-time constant but * only compile-time constant in these scenarios. */ #if defined(__APPLE__) # undef SIZEOF_LONG # undef SIZEOF_PTHREAD_T # undef SIZEOF_SIZE_T # undef SIZEOF_TIME_T # undef SIZEOF_VOID_P # undef SIZEOF__BOOL # undef SIZEOF_UINTPTR_T # undef SIZEOF_PTHREAD_T # undef WORDS_BIGENDIAN # undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 # undef DOUBLE_IS_BIG_ENDIAN_IEEE754 # undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 # undef HAVE_GCC_ASM_FOR_X87 # undef VA_LIST_IS_ARRAY # if defined(__LP64__) && defined(__x86_64__) # define VA_LIST_IS_ARRAY 1 # endif # undef HAVE_LARGEFILE_SUPPORT # ifndef __LP64__ # define HAVE_LARGEFILE_SUPPORT 1 # endif # undef SIZEOF_LONG # ifdef __LP64__ # define SIZEOF__BOOL 1 # define SIZEOF__BOOL 1 # define SIZEOF_LONG 8 # define SIZEOF_PTHREAD_T 8 # define SIZEOF_SIZE_T 8 # define SIZEOF_TIME_T 8 # define SIZEOF_VOID_P 8 # define SIZEOF_UINTPTR_T 8 # define SIZEOF_PTHREAD_T 8 # else # ifdef __ppc__ # define SIZEOF__BOOL 4 # else # define SIZEOF__BOOL 1 # endif # define SIZEOF_LONG 4 # define SIZEOF_PTHREAD_T 4 # define SIZEOF_SIZE_T 4 # define SIZEOF_TIME_T 4 # define SIZEOF_VOID_P 4 # define SIZEOF_UINTPTR_T 4 # define SIZEOF_PTHREAD_T 4 # endif # if defined(__LP64__) /* MacOSX 10.4 (the first release to support 64-bit code * at all) only supports 64-bit in the UNIX layer. * Therefore suppress the toolbox-glue in 64-bit mode. */ /* In 64-bit mode setpgrp always has no arguments, in 32-bit * mode that depends on the compilation environment */ # undef SETPGRP_HAVE_ARG # endif #ifdef __BIG_ENDIAN__ #define WORDS_BIGENDIAN 1 #define DOUBLE_IS_BIG_ENDIAN_IEEE754 #else #define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 #endif /* __BIG_ENDIAN */ #ifdef __i386__ # define HAVE_GCC_ASM_FOR_X87 #endif /* * The definition in pyconfig.h is only valid on the OS release * where configure ran on and not necessarily for all systems where * the executable can be used on. * * Specifically: OSX 10.4 has limited supported for '%zd', while * 10.5 has full support for '%zd'. A binary built on 10.5 won't * work properly on 10.4 unless we suppress the definition * of PY_FORMAT_SIZE_T */ #undef PY_FORMAT_SIZE_T #endif /* defined(_APPLE__) */ #endif /* PYMACCONFIG_H */
2,989
C++
.h
88
31.363636
71
0.625216
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,560
weakrefobject.h
relativty_Relativty/Relativty_Driver/include/Python/weakrefobject.h
/* Weak references objects for Python. */ #ifndef Py_WEAKREFOBJECT_H #define Py_WEAKREFOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct _PyWeakReference PyWeakReference; /* PyWeakReference is the base struct for the Python ReferenceType, ProxyType, * and CallableProxyType. */ #ifndef Py_LIMITED_API struct _PyWeakReference { PyObject_HEAD /* The object to which this is a weak reference, or Py_None if none. * Note that this is a stealth reference: wr_object's refcount is * not incremented to reflect this pointer. */ PyObject *wr_object; /* A callable to invoke when wr_object dies, or NULL if none. */ PyObject *wr_callback; /* A cache for wr_object's hash code. As usual for hashes, this is -1 * if the hash code isn't known yet. */ Py_hash_t hash; /* If wr_object is weakly referenced, wr_object has a doubly-linked NULL- * terminated list of weak references to it. These are the list pointers. * If wr_object goes away, wr_object is set to Py_None, and these pointers * have no meaning then. */ PyWeakReference *wr_prev; PyWeakReference *wr_next; }; #endif PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; #define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType) #define PyWeakref_CheckRefExact(op) \ (Py_TYPE(op) == &_PyWeakref_RefType) #define PyWeakref_CheckProxy(op) \ ((Py_TYPE(op) == &_PyWeakref_ProxyType) || \ (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) #define PyWeakref_Check(op) \ (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, PyObject *callback); PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, PyObject *callback); PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); #ifndef Py_LIMITED_API PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head); PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); #endif /* Explanation for the Py_REFCNT() check: when a weakref's target is part of a long chain of deallocations which triggers the trashcan mechanism, clearing the weakrefs can be delayed long after the target's refcount has dropped to zero. In the meantime, code accessing the weakref will be able to "see" the target object even though it is supposed to be unreachable. See issue #16602. */ #define PyWeakref_GET_OBJECT(ref) \ (Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0 \ ? ((PyWeakReference *)(ref))->wr_object \ : Py_None) #ifdef __cplusplus } #endif #endif /* !Py_WEAKREFOBJECT_H */
2,866
C++
.h
67
37.865672
78
0.693885
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,561
enumobject.h
relativty_Relativty/Relativty_Driver/include/Python/enumobject.h
#ifndef Py_ENUMOBJECT_H #define Py_ENUMOBJECT_H /* Enumerate Object */ #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyEnum_Type; PyAPI_DATA(PyTypeObject) PyReversed_Type; #ifdef __cplusplus } #endif #endif /* !Py_ENUMOBJECT_H */
253
C++
.h
12
19.666667
41
0.771186
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,562
pystate.h
relativty_Relativty/Relativty_Driver/include/Python/pystate.h
/* Thread and interpreter state structures and their interfaces */ #ifndef Py_PYSTATE_H #define Py_PYSTATE_H #ifdef __cplusplus extern "C" { #endif #include "pythread.h" /* This limitation is for performance and simplicity. If needed it can be removed (with effort). */ #define MAX_CO_EXTRA_USERS 255 /* Forward declarations for PyFrameObject, PyThreadState and PyInterpreterState */ struct _frame; struct _ts; struct _is; /* struct _ts is defined in cpython/pystate.h */ typedef struct _ts PyThreadState; /* struct _is is defined in internal/pycore_pystate.h */ typedef struct _is PyInterpreterState; PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03080000 /* New in 3.8 */ PyAPI_FUNC(PyObject *) PyInterpreterState_GetDict(PyInterpreterState *); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 /* New in 3.7 */ PyAPI_FUNC(int64_t) PyInterpreterState_GetID(PyInterpreterState *); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* State unique per thread */ /* New in 3.3 */ PyAPI_FUNC(int) PyState_AddModule(PyObject*, struct PyModuleDef*); PyAPI_FUNC(int) PyState_RemoveModule(struct PyModuleDef*); #endif PyAPI_FUNC(PyObject*) PyState_FindModule(struct PyModuleDef*); PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *); PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *); PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); /* Get the current thread state. When the current thread state is NULL, this issues a fatal error (so that the caller needn't check for NULL). The caller must hold the GIL. See also PyThreadState_GET() and _PyThreadState_GET(). */ PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void); /* Get the current Python thread state. Macro using PyThreadState_Get() or _PyThreadState_GET() depending if pycore_pystate.h is included or not (this header redefines the macro). If PyThreadState_Get() is used, issue a fatal error if the current thread state is NULL. See also PyThreadState_Get() and _PyThreadState_GET(). */ #define PyThreadState_GET() PyThreadState_Get() PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *); PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void); PyAPI_FUNC(int) PyThreadState_SetAsyncExc(unsigned long, PyObject *); typedef enum {PyGILState_LOCKED, PyGILState_UNLOCKED} PyGILState_STATE; /* Ensure that the current thread is ready to call the Python C API, regardless of the current state of Python, or of its thread lock. This may be called as many times as desired by a thread so long as each call is matched with a call to PyGILState_Release(). In general, other thread-state APIs may be used between _Ensure() and _Release() calls, so long as the thread-state is restored to its previous state before the Release(). For example, normal use of the Py_BEGIN_ALLOW_THREADS/ Py_END_ALLOW_THREADS macros are acceptable. The return value is an opaque "handle" to the thread state when PyGILState_Ensure() was called, and must be passed to PyGILState_Release() to ensure Python is left in the same state. Even though recursive calls are allowed, these handles can *not* be shared - each unique call to PyGILState_Ensure must save the handle for its call to PyGILState_Release. When the function returns, the current thread will hold the GIL. Failure is a fatal error. */ PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void); /* Release any resources previously acquired. After this call, Python's state will be the same as it was prior to the corresponding PyGILState_Ensure() call (but generally this state will be unknown to the caller, hence the use of the GILState API.) Every call to PyGILState_Ensure must be matched by a call to PyGILState_Release on the same thread. */ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); /* Helper/diagnostic function - get the current thread state for this thread. May return NULL if no GILState API has been used on the current thread. Note that the main thread always has such a thread-state, even if no auto-thread-state call has been made on the main thread. */ PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); #ifndef Py_LIMITED_API # define Py_CPYTHON_PYSTATE_H # include "cpython/pystate.h" # undef Py_CPYTHON_PYSTATE_H #endif #ifdef __cplusplus } #endif #endif /* !Py_PYSTATE_H */
4,686
C++
.h
103
43.038835
76
0.77033
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,563
opcode.h
relativty_Relativty/Relativty_Driver/include/Python/opcode.h
/* Auto-generated by Tools/scripts/generate_opcode_h.py from Lib/opcode.py */ #ifndef Py_OPCODE_H #define Py_OPCODE_H #ifdef __cplusplus extern "C" { #endif /* Instruction opcodes for compiled code */ #define POP_TOP 1 #define ROT_TWO 2 #define ROT_THREE 3 #define DUP_TOP 4 #define DUP_TOP_TWO 5 #define ROT_FOUR 6 #define NOP 9 #define UNARY_POSITIVE 10 #define UNARY_NEGATIVE 11 #define UNARY_NOT 12 #define UNARY_INVERT 15 #define BINARY_MATRIX_MULTIPLY 16 #define INPLACE_MATRIX_MULTIPLY 17 #define BINARY_POWER 19 #define BINARY_MULTIPLY 20 #define BINARY_MODULO 22 #define BINARY_ADD 23 #define BINARY_SUBTRACT 24 #define BINARY_SUBSCR 25 #define BINARY_FLOOR_DIVIDE 26 #define BINARY_TRUE_DIVIDE 27 #define INPLACE_FLOOR_DIVIDE 28 #define INPLACE_TRUE_DIVIDE 29 #define GET_AITER 50 #define GET_ANEXT 51 #define BEFORE_ASYNC_WITH 52 #define BEGIN_FINALLY 53 #define END_ASYNC_FOR 54 #define INPLACE_ADD 55 #define INPLACE_SUBTRACT 56 #define INPLACE_MULTIPLY 57 #define INPLACE_MODULO 59 #define STORE_SUBSCR 60 #define DELETE_SUBSCR 61 #define BINARY_LSHIFT 62 #define BINARY_RSHIFT 63 #define BINARY_AND 64 #define BINARY_XOR 65 #define BINARY_OR 66 #define INPLACE_POWER 67 #define GET_ITER 68 #define GET_YIELD_FROM_ITER 69 #define PRINT_EXPR 70 #define LOAD_BUILD_CLASS 71 #define YIELD_FROM 72 #define GET_AWAITABLE 73 #define INPLACE_LSHIFT 75 #define INPLACE_RSHIFT 76 #define INPLACE_AND 77 #define INPLACE_XOR 78 #define INPLACE_OR 79 #define WITH_CLEANUP_START 81 #define WITH_CLEANUP_FINISH 82 #define RETURN_VALUE 83 #define IMPORT_STAR 84 #define SETUP_ANNOTATIONS 85 #define YIELD_VALUE 86 #define POP_BLOCK 87 #define END_FINALLY 88 #define POP_EXCEPT 89 #define HAVE_ARGUMENT 90 #define STORE_NAME 90 #define DELETE_NAME 91 #define UNPACK_SEQUENCE 92 #define FOR_ITER 93 #define UNPACK_EX 94 #define STORE_ATTR 95 #define DELETE_ATTR 96 #define STORE_GLOBAL 97 #define DELETE_GLOBAL 98 #define LOAD_CONST 100 #define LOAD_NAME 101 #define BUILD_TUPLE 102 #define BUILD_LIST 103 #define BUILD_SET 104 #define BUILD_MAP 105 #define LOAD_ATTR 106 #define COMPARE_OP 107 #define IMPORT_NAME 108 #define IMPORT_FROM 109 #define JUMP_FORWARD 110 #define JUMP_IF_FALSE_OR_POP 111 #define JUMP_IF_TRUE_OR_POP 112 #define JUMP_ABSOLUTE 113 #define POP_JUMP_IF_FALSE 114 #define POP_JUMP_IF_TRUE 115 #define LOAD_GLOBAL 116 #define SETUP_FINALLY 122 #define LOAD_FAST 124 #define STORE_FAST 125 #define DELETE_FAST 126 #define RAISE_VARARGS 130 #define CALL_FUNCTION 131 #define MAKE_FUNCTION 132 #define BUILD_SLICE 133 #define LOAD_CLOSURE 135 #define LOAD_DEREF 136 #define STORE_DEREF 137 #define DELETE_DEREF 138 #define CALL_FUNCTION_KW 141 #define CALL_FUNCTION_EX 142 #define SETUP_WITH 143 #define EXTENDED_ARG 144 #define LIST_APPEND 145 #define SET_ADD 146 #define MAP_ADD 147 #define LOAD_CLASSDEREF 148 #define BUILD_LIST_UNPACK 149 #define BUILD_MAP_UNPACK 150 #define BUILD_MAP_UNPACK_WITH_CALL 151 #define BUILD_TUPLE_UNPACK 152 #define BUILD_SET_UNPACK 153 #define SETUP_ASYNC_WITH 154 #define FORMAT_VALUE 155 #define BUILD_CONST_KEY_MAP 156 #define BUILD_STRING 157 #define BUILD_TUPLE_UNPACK_WITH_CALL 158 #define LOAD_METHOD 160 #define CALL_METHOD 161 #define CALL_FINALLY 162 #define POP_FINALLY 163 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here as we want it to be available to both frameobject.c and ceval.c, while remaining private.*/ #define EXCEPT_HANDLER 257 enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD}; #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) #ifdef __cplusplus } #endif #endif /* !Py_OPCODE_H */
5,164
C++
.h
141
35.255319
77
0.585925
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,564
asdl.h
relativty_Relativty/Relativty_Driver/include/Python/asdl.h
#ifndef Py_ASDL_H #define Py_ASDL_H typedef PyObject * identifier; typedef PyObject * string; typedef PyObject * bytes; typedef PyObject * object; typedef PyObject * singleton; typedef PyObject * constant; /* It would be nice if the code generated by asdl_c.py was completely independent of Python, but it is a goal the requires too much work at this stage. So, for example, I'll represent identifiers as interned Python strings. */ /* XXX A sequence should be typed so that its use can be typechecked. */ typedef struct { Py_ssize_t size; void *elements[1]; } asdl_seq; typedef struct { Py_ssize_t size; int elements[1]; } asdl_int_seq; asdl_seq *_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena); asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena); #define asdl_seq_GET(S, I) (S)->elements[(I)] #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size) #ifdef Py_DEBUG #define asdl_seq_SET(S, I, V) \ do { \ Py_ssize_t _asdl_i = (I); \ assert((S) != NULL); \ assert(0 <= _asdl_i && _asdl_i < (S)->size); \ (S)->elements[_asdl_i] = (V); \ } while (0) #else #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V) #endif #endif /* !Py_ASDL_H */
1,229
C++
.h
38
29.421053
72
0.659341
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,565
pylifecycle.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/pylifecycle.h
#ifndef Py_CPYTHON_PYLIFECYCLE_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif /* Only used by applications that embed the interpreter and need to * override the standard encoding determination mechanism */ PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding, const char *errors); /* PEP 432 Multi-phase initialization API (Private while provisional!) */ PyAPI_FUNC(PyStatus) Py_PreInitialize( const PyPreConfig *src_config); PyAPI_FUNC(PyStatus) Py_PreInitializeFromBytesArgs( const PyPreConfig *src_config, Py_ssize_t argc, char **argv); PyAPI_FUNC(PyStatus) Py_PreInitializeFromArgs( const PyPreConfig *src_config, Py_ssize_t argc, wchar_t **argv); PyAPI_FUNC(int) _Py_IsCoreInitialized(void); /* Initialization and finalization */ PyAPI_FUNC(PyStatus) Py_InitializeFromConfig( const PyConfig *config); PyAPI_FUNC(PyStatus) _Py_InitializeFromArgs( const PyConfig *config, Py_ssize_t argc, char * const *argv); PyAPI_FUNC(PyStatus) _Py_InitializeFromWideArgs( const PyConfig *config, Py_ssize_t argc, wchar_t * const *argv); PyAPI_FUNC(PyStatus) _Py_InitializeMain(void); PyAPI_FUNC(int) Py_RunMain(void); PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err); /* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level * exit functions. */ PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(PyObject *), PyObject *); /* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */ PyAPI_FUNC(void) _Py_RestoreSignals(void); PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *); PyAPI_FUNC(void) _Py_SetProgramFullPath(const wchar_t *); PyAPI_FUNC(const char *) _Py_gitidentifier(void); PyAPI_FUNC(const char *) _Py_gitversion(void); PyAPI_FUNC(int) _Py_IsFinalizing(void); /* Random */ PyAPI_FUNC(int) _PyOS_URandom(void *buffer, Py_ssize_t size); PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size); /* Legacy locale support */ PyAPI_FUNC(int) _Py_CoerceLegacyLocale(int warn); PyAPI_FUNC(int) _Py_LegacyLocaleDetected(int warn); PyAPI_FUNC(char *) _Py_SetLocaleFromEnv(int category); #ifdef __cplusplus } #endif
2,263
C++
.h
58
35.862069
76
0.743707
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,566
tupleobject.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/tupleobject.h
#ifndef Py_CPYTHON_TUPLEOBJECT_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_VAR_HEAD /* ob_item contains space for 'ob_size' elements. Items must normally not be NULL, except during construction when the tuple is not yet visible outside the function that builds it. */ PyObject *ob_item[1]; } PyTupleObject; PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); /* Macros trading safety for speed */ /* Cast argument to PyTupleObject* type. */ #define _PyTuple_CAST(op) (assert(PyTuple_Check(op)), (PyTupleObject *)(op)) #define PyTuple_GET_SIZE(op) Py_SIZE(_PyTuple_CAST(op)) #define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i]) /* Macro, *only* to be used to fill in brand new tuples */ #define PyTuple_SET_ITEM(op, i, v) (_PyTuple_CAST(op)->ob_item[i] = v) PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out); #ifdef __cplusplus } #endif
1,036
C++
.h
26
37.461538
76
0.724
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,568
abstract.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/abstract.h
#ifndef Py_CPYTHON_ABSTRACTOBJECT_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif /* === Object Protocol ================================================== */ #ifdef PY_SSIZE_T_CLEAN # define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT #endif /* Convert keyword arguments from the FASTCALL (stack: C array, kwnames: tuple) format to a Python dictionary ("kwargs" dict). The type of kwnames keys is not checked. The final function getting arguments is responsible to check if all keys are strings, for example using PyArg_ParseTupleAndKeywords() or PyArg_ValidateKeywordArguments(). Duplicate keys are merged using the last value. If duplicate keys must raise an exception, the caller is responsible to implement an explicit keys on kwnames. */ PyAPI_FUNC(PyObject *) _PyStack_AsDict( PyObject *const *values, PyObject *kwnames); /* Convert (args, nargs, kwargs: dict) into a (stack, nargs, kwnames: tuple). Return 0 on success, raise an exception and return -1 on error. Write the new stack into *p_stack. If *p_stack is differen than args, it must be released by PyMem_Free(). The stack uses borrowed references. The type of keyword keys is not checked, these checks should be done later (ex: _PyArg_ParseStackAndKeywords). */ PyAPI_FUNC(int) _PyStack_UnpackDict( PyObject *const *args, Py_ssize_t nargs, PyObject *kwargs, PyObject *const **p_stack, PyObject **p_kwnames); /* Suggested size (number of positional arguments) for arrays of PyObject* allocated on a C stack to avoid allocating memory on the heap memory. Such array is used to pass positional arguments to call functions of the _PyObject_Vectorcall() family. The size is chosen to not abuse the C stack and so limit the risk of stack overflow. The size is also chosen to allow using the small stack for most function calls of the Python standard library. On 64-bit CPU, it allocates 40 bytes on the stack. */ #define _PY_FASTCALL_SMALL_STACK 5 PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable, PyObject *result, const char *where); /* === Vectorcall protocol (PEP 590) ============================= */ /* Call callable using tp_call. Arguments are like _PyObject_Vectorcall() or _PyObject_FastCallDict() (both forms are supported), except that nargs is plainly the number of arguments without flags. */ PyAPI_FUNC(PyObject *) _PyObject_MakeTpCall( PyObject *callable, PyObject *const *args, Py_ssize_t nargs, PyObject *keywords); #define PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) static inline Py_ssize_t PyVectorcall_NARGS(size_t n) { return n & ~PY_VECTORCALL_ARGUMENTS_OFFSET; } static inline vectorcallfunc _PyVectorcall_Function(PyObject *callable) { PyTypeObject *tp = Py_TYPE(callable); Py_ssize_t offset = tp->tp_vectorcall_offset; vectorcallfunc *ptr; if (!PyType_HasFeature(tp, _Py_TPFLAGS_HAVE_VECTORCALL)) { return NULL; } assert(PyCallable_Check(callable)); assert(offset > 0); ptr = (vectorcallfunc*)(((char *)callable) + offset); return *ptr; } /* Call the callable object 'callable' with the "vectorcall" calling convention. args is a C array for positional arguments. nargsf is the number of positional arguments plus optionally the flag PY_VECTORCALL_ARGUMENTS_OFFSET which means that the caller is allowed to modify args[-1]. kwnames is a tuple of keyword names. The values of the keyword arguments are stored in "args" after the positional arguments (note that the number of keyword arguments does not change nargsf). kwnames can also be NULL if there are no keyword arguments. keywords must only contains str strings (no subclass), and all keys must be unique. Return the result on success. Raise an exception and return NULL on error. */ static inline PyObject * _PyObject_Vectorcall(PyObject *callable, PyObject *const *args, size_t nargsf, PyObject *kwnames) { PyObject *res; vectorcallfunc func; assert(kwnames == NULL || PyTuple_Check(kwnames)); assert(args != NULL || PyVectorcall_NARGS(nargsf) == 0); func = _PyVectorcall_Function(callable); if (func == NULL) { Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); return _PyObject_MakeTpCall(callable, args, nargs, kwnames); } res = func(callable, args, nargsf, kwnames); return _Py_CheckFunctionResult(callable, res, NULL); } /* Same as _PyObject_Vectorcall except that keyword arguments are passed as dict, which may be NULL if there are no keyword arguments. */ PyAPI_FUNC(PyObject *) _PyObject_FastCallDict( PyObject *callable, PyObject *const *args, size_t nargsf, PyObject *kwargs); /* Call "callable" (which must support vectorcall) with positional arguments "tuple" and keyword arguments "dict". "dict" may also be NULL */ PyAPI_FUNC(PyObject *) PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *dict); /* Same as _PyObject_Vectorcall except without keyword arguments */ static inline PyObject * _PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs) { return _PyObject_Vectorcall(func, args, (size_t)nargs, NULL); } /* Call a callable without any arguments */ static inline PyObject * _PyObject_CallNoArg(PyObject *func) { return _PyObject_Vectorcall(func, NULL, 0, NULL); } PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend( PyObject *callable, PyObject *obj, PyObject *args, PyObject *kwargs); PyAPI_FUNC(PyObject *) _PyObject_FastCall_Prepend( PyObject *callable, PyObject *obj, PyObject *const *args, Py_ssize_t nargs); /* Like PyObject_CallMethod(), but expect a _Py_Identifier* as the method name. */ PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name, const char *format, ...); PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj, _Py_Identifier *name, const char *format, ...); PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs( PyObject *obj, struct _Py_Identifier *name, ...); PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o); /* Guess the size of object 'o' using len(o) or o.__length_hint__(). If neither of those return a non-negative value, then return the default value. If one of the calls fails, this function returns -1. */ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t); /* === New Buffer API ============================================ */ /* Return 1 if the getbuffer function is available, otherwise return 0. */ #define PyObject_CheckBuffer(obj) \ (((obj)->ob_type->tp_as_buffer != NULL) && \ ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL)) /* This is a C-API version of the getbuffer function call. It checks to make sure object has the required function pointer and issues the call. Returns -1 and raises an error on failure and returns 0 on success. */ PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags); /* Get the memory area pointed to by the indices for the buffer given. Note that view->ndim is the assumed size of indices. */ PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices); /* Return the implied itemsize of the data-format area from a struct-style description. */ PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *); /* Implementation in memoryobject.c */ PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char order); PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char order); /* Copy len bytes of data from the contiguous chunk of memory pointed to by buf into the buffer exported by obj. Return 0 on success and return -1 and raise a PyBuffer_Error on error (i.e. the object does not have a buffer interface or it is not working). If fort is 'F', then if the object is multi-dimensional, then the data will be copied into the array in Fortran-style (first dimension varies the fastest). If fort is 'C', then the data will be copied into the array in C-style (last dimension varies the fastest). If fort is 'A', then it does not matter and the copy will be made in whatever way is more efficient. */ PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src); /* Copy the data from the src buffer to the buffer of destination. */ PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char fort); /*Fill the strides array with byte-strides of a contiguous (Fortran-style if fort is 'F' or C-style otherwise) array of the given shape with the given number of bytes per element. */ PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, Py_ssize_t *shape, Py_ssize_t *strides, int itemsize, char fort); /* Fills in a buffer-info structure correctly for an exporter that can only share a contiguous chunk of memory of "unsigned bytes" of the given length. Returns 0 on success and -1 (with raising an error) on error. */ PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf, Py_ssize_t len, int readonly, int flags); /* Releases a Py_buffer obtained from getbuffer ParseTuple's "s*". */ PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view); /* ==== Iterators ================================================ */ #define PyIter_Check(obj) \ ((obj)->ob_type->tp_iternext != NULL && \ (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) /* === Number Protocol ================================================== */ #define PyIndex_Check(obj) \ ((obj)->ob_type->tp_as_number != NULL && \ (obj)->ob_type->tp_as_number->nb_index != NULL) /* === Sequence protocol ================================================ */ /* Assume tp_as_sequence and sq_item exist and that 'i' does not need to be corrected for a negative index. */ #define PySequence_ITEM(o, i)\ ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) #define PY_ITERSEARCH_COUNT 1 #define PY_ITERSEARCH_INDEX 2 #define PY_ITERSEARCH_CONTAINS 3 /* Iterate over seq. Result depends on the operation: PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if error. PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of obj in seq; set ValueError and return -1 if none found; also return -1 on error. PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on error. */ PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, PyObject *obj, int operation); /* === Mapping protocol ================================================= */ PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls); PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls); PyAPI_FUNC(char *const *) _PySequence_BytesToCharpArray(PyObject* self); PyAPI_FUNC(void) _Py_FreeCharPArray(char *const array[]); /* For internal use by buffer API functions */ PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index, const Py_ssize_t *shape); PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index, const Py_ssize_t *shape); /* Convert Python int to Py_ssize_t. Do nothing if the argument is None. */ PyAPI_FUNC(int) _Py_convert_optional_to_ssize_t(PyObject *, void *); #ifdef __cplusplus } #endif
12,295
C++
.h
250
42.644
94
0.658818
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,569
dictobject.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/dictobject.h
#ifndef Py_CPYTHON_DICTOBJECT_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif typedef struct _dictkeysobject PyDictKeysObject; /* The ma_values pointer is NULL for a combined table * or points to an array of PyObject* for a split table */ typedef struct { PyObject_HEAD /* Number of items in the dictionary */ Py_ssize_t ma_used; /* Dictionary version: globally unique, value change each time the dictionary is modified */ uint64_t ma_version_tag; PyDictKeysObject *ma_keys; /* If ma_values is NULL, the table is "combined": keys and values are stored in ma_keys. If ma_values is not NULL, the table is splitted: keys are stored in ma_keys and values are stored in ma_values */ PyObject **ma_values; } PyDictObject; PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key, Py_hash_t hash); PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp, struct _Py_Identifier *key); PyAPI_FUNC(PyObject *) _PyDict_GetItemStringWithError(PyObject *, const char *); PyAPI_FUNC(PyObject *) PyDict_SetDefault( PyObject *mp, PyObject *key, PyObject *defaultobj); PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject *mp, PyObject *key, PyObject *item, Py_hash_t hash); PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key, Py_hash_t hash); PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key, int (*predicate)(PyObject *value)); PyDictKeysObject *_PyDict_NewKeysForClass(void); PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *); PyAPI_FUNC(int) _PyDict_Next( PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash); /* Get the number of items of a dictionary. */ #define PyDict_GET_SIZE(mp) (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used) PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash); PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp); Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys); PyAPI_FUNC(Py_ssize_t) _PyDict_SizeOf(PyDictObject *); PyAPI_FUNC(PyObject *) _PyDict_Pop(PyObject *, PyObject *, PyObject *); PyObject *_PyDict_Pop_KnownHash(PyObject *, PyObject *, Py_hash_t, PyObject *); PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *); #define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL) PyAPI_FUNC(int) PyDict_ClearFreeList(void); /* Like PyDict_Merge, but override can be 0, 1 or 2. If override is 0, the first occurrence of a key wins, if override is 1, the last occurrence of a key wins, if override is 2, a KeyError with conflicting key as argument is raised. */ PyAPI_FUNC(int) _PyDict_MergeEx(PyObject *mp, PyObject *other, int override); PyAPI_FUNC(PyObject *) _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key); PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item); PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key); PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out); int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value); PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *); /* _PyDictView */ typedef struct { PyObject_HEAD PyDictObject *dv_dict; } _PyDictViewObject; PyAPI_FUNC(PyObject *) _PyDictView_New(PyObject *, PyTypeObject *); PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other); #ifdef __cplusplus } #endif
3,845
C++
.h
76
45.486842
97
0.704346
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,570
pymem.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/pymem.h
#ifndef Py_CPYTHON_PYMEM_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(void *) PyMem_RawMalloc(size_t size); PyAPI_FUNC(void *) PyMem_RawCalloc(size_t nelem, size_t elsize); PyAPI_FUNC(void *) PyMem_RawRealloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyMem_RawFree(void *ptr); /* Try to get the allocators name set by _PyMem_SetupAllocators(). */ PyAPI_FUNC(const char*) _PyMem_GetCurrentAllocatorName(void); PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); /* strdup() using PyMem_RawMalloc() */ PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str); /* strdup() using PyMem_Malloc() */ PyAPI_FUNC(char *) _PyMem_Strdup(const char *str); /* wcsdup() using PyMem_RawMalloc() */ PyAPI_FUNC(wchar_t*) _PyMem_RawWcsdup(const wchar_t *str); typedef enum { /* PyMem_RawMalloc(), PyMem_RawRealloc() and PyMem_RawFree() */ PYMEM_DOMAIN_RAW, /* PyMem_Malloc(), PyMem_Realloc() and PyMem_Free() */ PYMEM_DOMAIN_MEM, /* PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() */ PYMEM_DOMAIN_OBJ } PyMemAllocatorDomain; typedef enum { PYMEM_ALLOCATOR_NOT_SET = 0, PYMEM_ALLOCATOR_DEFAULT = 1, PYMEM_ALLOCATOR_DEBUG = 2, PYMEM_ALLOCATOR_MALLOC = 3, PYMEM_ALLOCATOR_MALLOC_DEBUG = 4, #ifdef WITH_PYMALLOC PYMEM_ALLOCATOR_PYMALLOC = 5, PYMEM_ALLOCATOR_PYMALLOC_DEBUG = 6, #endif } PyMemAllocatorName; typedef struct { /* user context passed as the first argument to the 4 functions */ void *ctx; /* allocate a memory block */ void* (*malloc) (void *ctx, size_t size); /* allocate a memory block initialized by zeros */ void* (*calloc) (void *ctx, size_t nelem, size_t elsize); /* allocate or resize a memory block */ void* (*realloc) (void *ctx, void *ptr, size_t new_size); /* release a memory block */ void (*free) (void *ctx, void *ptr); } PyMemAllocatorEx; /* Get the memory block allocator of the specified domain. */ PyAPI_FUNC(void) PyMem_GetAllocator(PyMemAllocatorDomain domain, PyMemAllocatorEx *allocator); /* Set the memory block allocator of the specified domain. The new allocator must return a distinct non-NULL pointer when requesting zero bytes. For the PYMEM_DOMAIN_RAW domain, the allocator must be thread-safe: the GIL is not held when the allocator is called. If the new allocator is not a hook (don't call the previous allocator), the PyMem_SetupDebugHooks() function must be called to reinstall the debug hooks on top on the new allocator. */ PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain, PyMemAllocatorEx *allocator); /* Setup hooks to detect bugs in the following Python memory allocator functions: - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree() - PyMem_Malloc(), PyMem_Realloc(), PyMem_Free() - PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() Newly allocated memory is filled with the byte 0xCB, freed memory is filled with the byte 0xDB. Additional checks: - detect API violations, ex: PyObject_Free() called on a buffer allocated by PyMem_Malloc() - detect write before the start of the buffer (buffer underflow) - detect write after the end of the buffer (buffer overflow) The function does nothing if Python is not compiled is debug mode. */ PyAPI_FUNC(void) PyMem_SetupDebugHooks(void); #ifdef __cplusplus } #endif
3,511
C++
.h
79
40.291139
79
0.714664
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,571
fileobject.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/fileobject.h
#ifndef Py_CPYTHON_FILEOBJECT_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors; #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 PyAPI_DATA(int) Py_UTF8Mode; #endif /* The std printer acts as a preliminary sys.stderr until the new io infrastructure is in place. */ PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int); PyAPI_DATA(PyTypeObject) PyStdPrinter_Type; typedef PyObject * (*Py_OpenCodeHookFunction)(PyObject *, void *); PyAPI_FUNC(PyObject *) PyFile_OpenCode(const char *utf8path); PyAPI_FUNC(PyObject *) PyFile_OpenCodeObject(PyObject *path); PyAPI_FUNC(int) PyFile_SetOpenCodeHook(Py_OpenCodeHookFunction hook, void *userData); #ifdef __cplusplus } #endif
951
C++
.h
24
38.166667
85
0.775843
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,572
object.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/object.h
#ifndef Py_CPYTHON_OBJECT_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif /********************* String Literals ****************************************/ /* This structure helps managing static strings. The basic usage goes like this: Instead of doing r = PyObject_CallMethod(o, "foo", "args", ...); do _Py_IDENTIFIER(foo); ... r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...); PyId_foo is a static variable, either on block level or file level. On first usage, the string "foo" is interned, and the structures are linked. On interpreter shutdown, all strings are released (through _PyUnicode_ClearStaticStrings). Alternatively, _Py_static_string allows choosing the variable name. _PyUnicode_FromId returns a borrowed reference to the interned string. _PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*. */ typedef struct _Py_Identifier { struct _Py_Identifier *next; const char* string; PyObject *object; } _Py_Identifier; #define _Py_static_string_init(value) { .next = NULL, .string = value, .object = NULL } #define _Py_static_string(varname, value) static _Py_Identifier varname = _Py_static_string_init(value) #define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname) /* buffer interface */ typedef struct bufferinfo { void *buf; PyObject *obj; /* owned reference */ Py_ssize_t len; Py_ssize_t itemsize; /* This is Py_ssize_t so it can be pointed to by strides in simple case.*/ int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); typedef PyObject *(*vectorcallfunc)(PyObject *callable, PyObject *const *args, size_t nargsf, PyObject *kwnames); /* Maximum number of dimensions */ #define PyBUF_MAX_NDIM 64 /* Flags for getting buffers */ #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 /* we used to include an E, backwards compatible alias */ #define PyBUF_WRITEABLE PyBUF_WRITABLE #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE) #define PyBUF_CONTIG_RO (PyBUF_ND) #define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE) #define PyBUF_STRIDED_RO (PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT) #define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT) #define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT) #define PyBUF_READ 0x100 #define PyBUF_WRITE 0x200 /* End buffer interface */ typedef struct { /* Number implementations must check *both* arguments for proper type and implement the necessary conversions in the slot functions themselves. */ binaryfunc nb_add; binaryfunc nb_subtract; binaryfunc nb_multiply; binaryfunc nb_remainder; binaryfunc nb_divmod; ternaryfunc nb_power; unaryfunc nb_negative; unaryfunc nb_positive; unaryfunc nb_absolute; inquiry nb_bool; unaryfunc nb_invert; binaryfunc nb_lshift; binaryfunc nb_rshift; binaryfunc nb_and; binaryfunc nb_xor; binaryfunc nb_or; unaryfunc nb_int; void *nb_reserved; /* the slot formerly known as nb_long */ unaryfunc nb_float; binaryfunc nb_inplace_add; binaryfunc nb_inplace_subtract; binaryfunc nb_inplace_multiply; binaryfunc nb_inplace_remainder; ternaryfunc nb_inplace_power; binaryfunc nb_inplace_lshift; binaryfunc nb_inplace_rshift; binaryfunc nb_inplace_and; binaryfunc nb_inplace_xor; binaryfunc nb_inplace_or; binaryfunc nb_floor_divide; binaryfunc nb_true_divide; binaryfunc nb_inplace_floor_divide; binaryfunc nb_inplace_true_divide; unaryfunc nb_index; binaryfunc nb_matrix_multiply; binaryfunc nb_inplace_matrix_multiply; } PyNumberMethods; typedef struct { lenfunc sq_length; binaryfunc sq_concat; ssizeargfunc sq_repeat; ssizeargfunc sq_item; void *was_sq_slice; ssizeobjargproc sq_ass_item; void *was_sq_ass_slice; objobjproc sq_contains; binaryfunc sq_inplace_concat; ssizeargfunc sq_inplace_repeat; } PySequenceMethods; typedef struct { lenfunc mp_length; binaryfunc mp_subscript; objobjargproc mp_ass_subscript; } PyMappingMethods; typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } PyAsyncMethods; typedef struct { getbufferproc bf_getbuffer; releasebufferproc bf_releasebuffer; } PyBufferProcs; /* Allow printfunc in the tp_vectorcall_offset slot for * backwards-compatibility */ typedef Py_ssize_t printfunc; typedef struct _typeobject { PyObject_VAR_HEAD const char *tp_name; /* For printing, in format "<module>.<name>" */ Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ /* Methods to implement standard operations */ destructor tp_dealloc; Py_ssize_t tp_vectorcall_offset; getattrfunc tp_getattr; setattrfunc tp_setattr; PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2) or tp_reserved (Python 3) */ reprfunc tp_repr; /* Method suites for standard classes */ PyNumberMethods *tp_as_number; PySequenceMethods *tp_as_sequence; PyMappingMethods *tp_as_mapping; /* More standard operations (here for binary compatibility) */ hashfunc tp_hash; ternaryfunc tp_call; reprfunc tp_str; getattrofunc tp_getattro; setattrofunc tp_setattro; /* Functions to access object as input/output buffer */ PyBufferProcs *tp_as_buffer; /* Flags to define presence of optional/expanded features */ unsigned long tp_flags; const char *tp_doc; /* Documentation string */ /* Assigned meaning in release 2.0 */ /* call function for all accessible objects */ traverseproc tp_traverse; /* delete references to contained objects */ inquiry tp_clear; /* Assigned meaning in release 2.1 */ /* rich comparisons */ richcmpfunc tp_richcompare; /* weak reference enabler */ Py_ssize_t tp_weaklistoffset; /* Iterators */ getiterfunc tp_iter; iternextfunc tp_iternext; /* Attribute descriptor and subclassing stuff */ struct PyMethodDef *tp_methods; struct PyMemberDef *tp_members; struct PyGetSetDef *tp_getset; struct _typeobject *tp_base; PyObject *tp_dict; descrgetfunc tp_descr_get; descrsetfunc tp_descr_set; Py_ssize_t tp_dictoffset; initproc tp_init; allocfunc tp_alloc; newfunc tp_new; freefunc tp_free; /* Low-level free-memory routine */ inquiry tp_is_gc; /* For PyObject_IS_GC */ PyObject *tp_bases; PyObject *tp_mro; /* method resolution order */ PyObject *tp_cache; PyObject *tp_subclasses; PyObject *tp_weaklist; destructor tp_del; /* Type attribute cache version tag. Added in version 2.6 */ unsigned int tp_version_tag; destructor tp_finalize; vectorcallfunc tp_vectorcall; /* bpo-37250: kept for backwards compatibility in CPython 3.8 only */ Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int); #ifdef COUNT_ALLOCS /* these must be last and never explicitly initialized */ Py_ssize_t tp_allocs; Py_ssize_t tp_frees; Py_ssize_t tp_maxalloc; struct _typeobject *tp_prev; struct _typeobject *tp_next; #endif } PyTypeObject; /* The *real* layout of a type object when allocated on the heap */ typedef struct _heaptypeobject { /* Note: there's a dependency on the order of these members in slotptr() in typeobject.c . */ PyTypeObject ht_type; PyAsyncMethods as_async; PyNumberMethods as_number; PyMappingMethods as_mapping; PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, so that the mapping wins when both the mapping and the sequence define a given operator (e.g. __getitem__). see add_operators() in typeobject.c . */ PyBufferProcs as_buffer; PyObject *ht_name, *ht_slots, *ht_qualname; struct _dictkeysobject *ht_cached_keys; /* here are optional user slots, followed by the members. */ } PyHeapTypeObject; /* access macro to the members which are floating "behind" the object */ #define PyHeapType_GET_MEMBERS(etype) \ ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize)) PyAPI_FUNC(const char *) _PyType_Name(PyTypeObject *); PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); PyAPI_FUNC(PyObject *) _PyType_LookupId(PyTypeObject *, _Py_Identifier *); PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, _Py_Identifier *); PyAPI_FUNC(PyTypeObject *) _PyType_CalculateMetaclass(PyTypeObject *, PyObject *); PyAPI_FUNC(PyObject *) _PyType_GetDocFromInternalDoc(const char *, const char *); PyAPI_FUNC(PyObject *) _PyType_GetTextSignatureFromInternalDoc(const char *, const char *); struct _Py_Identifier; PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); PyAPI_FUNC(void) _Py_BreakPoint(void); PyAPI_FUNC(void) _PyObject_Dump(PyObject *); PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *); PyAPI_FUNC(int) _PyObject_IsAbstract(PyObject *); PyAPI_FUNC(PyObject *) _PyObject_GetAttrId(PyObject *, struct _Py_Identifier *); PyAPI_FUNC(int) _PyObject_SetAttrId(PyObject *, struct _Py_Identifier *, PyObject *); PyAPI_FUNC(int) _PyObject_HasAttrId(PyObject *, struct _Py_Identifier *); /* Replacements of PyObject_GetAttr() and _PyObject_GetAttrId() which don't raise AttributeError. Return 1 and set *result != NULL if an attribute is found. Return 0 and set *result == NULL if an attribute is not found; an AttributeError is silenced. Return -1 and set *result == NULL if an error other than AttributeError is raised. */ PyAPI_FUNC(int) _PyObject_LookupAttr(PyObject *, PyObject *, PyObject **); PyAPI_FUNC(int) _PyObject_LookupAttrId(PyObject *, struct _Py_Identifier *, PyObject **); PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *); PyAPI_FUNC(void) PyObject_CallFinalizer(PyObject *); PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject *); /* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes dict as the last parameter. */ PyAPI_FUNC(PyObject *) _PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *, int); PyAPI_FUNC(int) _PyObject_GenericSetAttrWithDict(PyObject *, PyObject *, PyObject *, PyObject *); #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) static inline void _Py_Dealloc_inline(PyObject *op) { destructor dealloc = Py_TYPE(op)->tp_dealloc; #ifdef Py_TRACE_REFS _Py_ForgetReference(op); #else _Py_INC_TPFREES(op); #endif (*dealloc)(op); } #define _Py_Dealloc(op) _Py_Dealloc_inline(op) /* Safely decref `op` and set `op` to `op2`. * * As in case of Py_CLEAR "the obvious" code can be deadly: * * Py_DECREF(op); * op = op2; * * The safe way is: * * Py_SETREF(op, op2); * * That arranges to set `op` to `op2` _before_ decref'ing, so that any code * triggered as a side-effect of `op` getting torn down no longer believes * `op` points to a valid object. * * Py_XSETREF is a variant of Py_SETREF that uses Py_XDECREF instead of * Py_DECREF. */ #define Py_SETREF(op, op2) \ do { \ PyObject *_py_tmp = _PyObject_CAST(op); \ (op) = (op2); \ Py_DECREF(_py_tmp); \ } while (0) #define Py_XSETREF(op, op2) \ do { \ PyObject *_py_tmp = _PyObject_CAST(op); \ (op) = (op2); \ Py_XDECREF(_py_tmp); \ } while (0) PyAPI_DATA(PyTypeObject) _PyNone_Type; PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type; /* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE. * Defined in object.c. */ PyAPI_DATA(int) _Py_SwappedOp[]; /* This is the old private API, invoked by the macros before 3.2.4. Kept for binary compatibility of extensions using the stable ABI. */ PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); PyAPI_FUNC(void) _PyTrash_destroy_chain(void); PyAPI_FUNC(void) _PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks, size_t sizeof_block); PyAPI_FUNC(void) _PyObject_DebugTypeStats(FILE *out); /* Define a pair of assertion macros: _PyObject_ASSERT_FROM(), _PyObject_ASSERT_WITH_MSG() and _PyObject_ASSERT(). These work like the regular C assert(), in that they will abort the process with a message on stderr if the given condition fails to hold, but compile away to nothing if NDEBUG is defined. However, before aborting, Python will also try to call _PyObject_Dump() on the given object. This may be of use when investigating bugs in which a particular object is corrupt (e.g. buggy a tp_visit method in an extension module breaking the garbage collector), to help locate the broken objects. The WITH_MSG variant allows you to supply an additional message that Python will attempt to print to stderr, after the object dump. */ #ifdef NDEBUG /* No debugging: compile away the assertions: */ # define _PyObject_ASSERT_FROM(obj, expr, msg, filename, lineno, func) \ ((void)0) #else /* With debugging: generate checks: */ # define _PyObject_ASSERT_FROM(obj, expr, msg, filename, lineno, func) \ ((expr) \ ? (void)(0) \ : _PyObject_AssertFailed((obj), Py_STRINGIFY(expr), \ (msg), (filename), (lineno), (func))) #endif #define _PyObject_ASSERT_WITH_MSG(obj, expr, msg) \ _PyObject_ASSERT_FROM(obj, expr, msg, __FILE__, __LINE__, __func__) #define _PyObject_ASSERT(obj, expr) \ _PyObject_ASSERT_WITH_MSG(obj, expr, NULL) #define _PyObject_ASSERT_FAILED_MSG(obj, msg) \ _PyObject_AssertFailed((obj), NULL, (msg), __FILE__, __LINE__, __func__) /* Declare and define _PyObject_AssertFailed() even when NDEBUG is defined, to avoid causing compiler/linker errors when building extensions without NDEBUG against a Python built with NDEBUG defined. msg, expr and function can be NULL. */ PyAPI_FUNC(void) _PyObject_AssertFailed( PyObject *obj, const char *expr, const char *msg, const char *file, int line, const char *function); /* Check if an object is consistent. For example, ensure that the reference counter is greater than or equal to 1, and ensure that ob_type is not NULL. Call _PyObject_AssertFailed() if the object is inconsistent. If check_content is zero, only check header fields: reduce the overhead. The function always return 1. The return value is just here to be able to write: assert(_PyObject_CheckConsistency(obj, 1)); */ PyAPI_FUNC(int) _PyObject_CheckConsistency( PyObject *op, int check_content); #ifdef __cplusplus } #endif
15,691
C++
.h
386
36.15285
104
0.692399
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,573
sysmodule.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/sysmodule.h
#ifndef Py_CPYTHON_SYSMODULE_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key); PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *); PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *); typedef int(*Py_AuditHookFunction)(const char *, PyObject *, void *); PyAPI_FUNC(int) PySys_Audit(const char*, const char *, ...); PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*); #ifdef __cplusplus } #endif
547
C++
.h
15
35.066667
69
0.752852
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,574
pyerrors.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/pyerrors.h
#ifndef Py_CPYTHON_ERRORS_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif /* Error objects */ /* PyException_HEAD defines the initial segment of every exception class. */ #define PyException_HEAD PyObject_HEAD PyObject *dict;\ PyObject *args; PyObject *traceback;\ PyObject *context; PyObject *cause;\ char suppress_context; typedef struct { PyException_HEAD } PyBaseExceptionObject; typedef struct { PyException_HEAD PyObject *msg; PyObject *filename; PyObject *lineno; PyObject *offset; PyObject *text; PyObject *print_file_and_line; } PySyntaxErrorObject; typedef struct { PyException_HEAD PyObject *msg; PyObject *name; PyObject *path; } PyImportErrorObject; typedef struct { PyException_HEAD PyObject *encoding; PyObject *object; Py_ssize_t start; Py_ssize_t end; PyObject *reason; } PyUnicodeErrorObject; typedef struct { PyException_HEAD PyObject *code; } PySystemExitObject; typedef struct { PyException_HEAD PyObject *myerrno; PyObject *strerror; PyObject *filename; PyObject *filename2; #ifdef MS_WINDOWS PyObject *winerror; #endif Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */ } PyOSErrorObject; typedef struct { PyException_HEAD PyObject *value; } PyStopIterationObject; /* Compatibility typedefs */ typedef PyOSErrorObject PyEnvironmentErrorObject; #ifdef MS_WINDOWS typedef PyOSErrorObject PyWindowsErrorObject; #endif /* Error handling definitions */ PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *); _PyErr_StackItem *_PyErr_GetTopmostException(PyThreadState *tstate); /* Context manipulation (PEP 3134) */ PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); /* */ #define PyExceptionClass_Name(x) (((PyTypeObject*)(x))->tp_name) /* Convenience functions */ #ifdef MS_WINDOWS Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( PyObject *, const Py_UNICODE *); #endif /* MS_WINDOWS */ /* Like PyErr_Format(), but saves current exception as __context__ and __cause__. */ PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause( PyObject *exception, const char *format, /* ASCII-encoded string */ ... ); #ifdef MS_WINDOWS /* XXX redeclare to use WSTRING */ Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( int, const Py_UNICODE *); Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( PyObject *,int, const Py_UNICODE *); #endif /* In exceptions.c */ /* Helper that attempts to replace the current exception with one of the * same type but with a prefix added to the exception text. The resulting * exception description looks like: * * prefix (exc_type: original_exc_str) * * Only some exceptions can be safely replaced. If the function determines * it isn't safe to perform the replacement, it will leave the original * unmodified exception in place. * * Returns a borrowed reference to the new exception (if any), NULL if the * existing exception was left in place. */ PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause( const char *prefix_format, /* ASCII-encoded string */ ... ); /* In signalmodule.c */ int PySignal_SetWakeupFd(int fd); PyAPI_FUNC(int) _PyErr_CheckSignals(void); /* Support for adding program text to SyntaxErrors */ PyAPI_FUNC(void) PyErr_SyntaxLocationObject( PyObject *filename, int lineno, int col_offset); PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject( PyObject *filename, int lineno); /* Create a UnicodeEncodeError object */ Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create( const char *encoding, /* UTF-8 encoded string */ const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason /* UTF-8 encoded string */ ); /* Create a UnicodeTranslateError object */ Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create( const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create( PyObject *object, Py_ssize_t start, Py_ssize_t end, const char *reason /* UTF-8 encoded string */ ); PyAPI_FUNC(void) _PyErr_WriteUnraisableMsg( const char *err_msg, PyObject *obj); #ifdef __cplusplus } #endif
4,607
C++
.h
150
27.426667
76
0.724746
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,575
objimpl.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/objimpl.h
#ifndef Py_CPYTHON_OBJIMPL_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif /* This function returns the number of allocated memory blocks, regardless of size */ PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void); /* Macros */ #ifdef WITH_PYMALLOC PyAPI_FUNC(int) _PyObject_DebugMallocStats(FILE *out); #endif typedef struct { /* user context passed as the first argument to the 2 functions */ void *ctx; /* allocate an arena of size bytes */ void* (*alloc) (void *ctx, size_t size); /* free an arena */ void (*free) (void *ctx, void *ptr, size_t size); } PyObjectArenaAllocator; /* Get the arena allocator. */ PyAPI_FUNC(void) PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator); /* Set the arena allocator. */ PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator); PyAPI_FUNC(Py_ssize_t) _PyGC_CollectNoFail(void); PyAPI_FUNC(Py_ssize_t) _PyGC_CollectIfEnabled(void); /* Test if an object has a GC head */ #define PyObject_IS_GC(o) \ (PyType_IS_GC(Py_TYPE(o)) \ && (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) /* GC information is stored BEFORE the object structure. */ typedef struct { // Pointer to next object in the list. // 0 means the object is not tracked uintptr_t _gc_next; // Pointer to previous object in the list. // Lowest two bits are used for flags documented later. uintptr_t _gc_prev; } PyGC_Head; #define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) /* True if the object is currently tracked by the GC. */ #define _PyObject_GC_IS_TRACKED(o) (_Py_AS_GC(o)->_gc_next != 0) /* True if the object may be tracked by the GC in the future, or already is. This can be useful to implement some optimizations. */ #define _PyObject_GC_MAY_BE_TRACKED(obj) \ (PyObject_IS_GC(obj) && \ (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj))) /* Bit flags for _gc_prev */ /* Bit 0 is set when tp_finalize is called */ #define _PyGC_PREV_MASK_FINALIZED (1) /* Bit 1 is set when the object is in generation which is GCed currently. */ #define _PyGC_PREV_MASK_COLLECTING (2) /* The (N-2) most significant bits contain the real address. */ #define _PyGC_PREV_SHIFT (2) #define _PyGC_PREV_MASK (((uintptr_t) -1) << _PyGC_PREV_SHIFT) // Lowest bit of _gc_next is used for flags only in GC. // But it is always 0 for normal code. #define _PyGCHead_NEXT(g) ((PyGC_Head*)(g)->_gc_next) #define _PyGCHead_SET_NEXT(g, p) ((g)->_gc_next = (uintptr_t)(p)) // Lowest two bits of _gc_prev is used for _PyGC_PREV_MASK_* flags. #define _PyGCHead_PREV(g) ((PyGC_Head*)((g)->_gc_prev & _PyGC_PREV_MASK)) #define _PyGCHead_SET_PREV(g, p) do { \ assert(((uintptr_t)p & ~_PyGC_PREV_MASK) == 0); \ (g)->_gc_prev = ((g)->_gc_prev & ~_PyGC_PREV_MASK) \ | ((uintptr_t)(p)); \ } while (0) #define _PyGCHead_FINALIZED(g) \ (((g)->_gc_prev & _PyGC_PREV_MASK_FINALIZED) != 0) #define _PyGCHead_SET_FINALIZED(g) \ ((g)->_gc_prev |= _PyGC_PREV_MASK_FINALIZED) #define _PyGC_FINALIZED(o) \ _PyGCHead_FINALIZED(_Py_AS_GC(o)) #define _PyGC_SET_FINALIZED(o) \ _PyGCHead_SET_FINALIZED(_Py_AS_GC(o)) PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t size); PyAPI_FUNC(PyObject *) _PyObject_GC_Calloc(size_t size); /* Test if a type supports weak references */ #define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0) #define PyObject_GET_WEAKREFS_LISTPTR(o) \ ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) #ifdef __cplusplus } #endif
3,600
C++
.h
83
40.662651
85
0.679667
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,576
initconfig.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/initconfig.h
#ifndef Py_PYCORECONFIG_H #define Py_PYCORECONFIG_H #ifndef Py_LIMITED_API #ifdef __cplusplus extern "C" { #endif /* --- PyStatus ----------------------------------------------- */ typedef struct { enum { _PyStatus_TYPE_OK=0, _PyStatus_TYPE_ERROR=1, _PyStatus_TYPE_EXIT=2 } _type; const char *func; const char *err_msg; int exitcode; } PyStatus; PyAPI_FUNC(PyStatus) PyStatus_Ok(void); PyAPI_FUNC(PyStatus) PyStatus_Error(const char *err_msg); PyAPI_FUNC(PyStatus) PyStatus_NoMemory(void); PyAPI_FUNC(PyStatus) PyStatus_Exit(int exitcode); PyAPI_FUNC(int) PyStatus_IsError(PyStatus err); PyAPI_FUNC(int) PyStatus_IsExit(PyStatus err); PyAPI_FUNC(int) PyStatus_Exception(PyStatus err); /* --- PyWideStringList ------------------------------------------------ */ typedef struct { /* If length is greater than zero, items must be non-NULL and all items strings must be non-NULL */ Py_ssize_t length; wchar_t **items; } PyWideStringList; PyAPI_FUNC(PyStatus) PyWideStringList_Append(PyWideStringList *list, const wchar_t *item); PyAPI_FUNC(PyStatus) PyWideStringList_Insert(PyWideStringList *list, Py_ssize_t index, const wchar_t *item); /* --- PyPreConfig ----------------------------------------------- */ typedef struct { int _config_init; /* _PyConfigInitEnum value */ /* Parse Py_PreInitializeFromBytesArgs() arguments? See PyConfig.parse_argv */ int parse_argv; /* If greater than 0, enable isolated mode: sys.path contains neither the script's directory nor the user's site-packages directory. Set to 1 by the -I command line option. If set to -1 (default), inherit Py_IsolatedFlag value. */ int isolated; /* If greater than 0: use environment variables. Set to 0 by -E command line option. If set to -1 (default), it is set to !Py_IgnoreEnvironmentFlag. */ int use_environment; /* Set the LC_CTYPE locale to the user preferred locale? If equals to 0, set coerce_c_locale and coerce_c_locale_warn to 0. */ int configure_locale; /* Coerce the LC_CTYPE locale if it's equal to "C"? (PEP 538) Set to 0 by PYTHONCOERCECLOCALE=0. Set to 1 by PYTHONCOERCECLOCALE=1. Set to 2 if the user preferred LC_CTYPE locale is "C". If it is equal to 1, LC_CTYPE locale is read to decide if it should be coerced or not (ex: PYTHONCOERCECLOCALE=1). Internally, it is set to 2 if the LC_CTYPE locale must be coerced. Disable by default (set to 0). Set it to -1 to let Python decide if it should be enabled or not. */ int coerce_c_locale; /* Emit a warning if the LC_CTYPE locale is coerced? Set to 1 by PYTHONCOERCECLOCALE=warn. Disable by default (set to 0). Set it to -1 to let Python decide if it should be enabled or not. */ int coerce_c_locale_warn; #ifdef MS_WINDOWS /* If greater than 1, use the "mbcs" encoding instead of the UTF-8 encoding for the filesystem encoding. Set to 1 if the PYTHONLEGACYWINDOWSFSENCODING environment variable is set to a non-empty string. If set to -1 (default), inherit Py_LegacyWindowsFSEncodingFlag value. See PEP 529 for more details. */ int legacy_windows_fs_encoding; #endif /* Enable UTF-8 mode? (PEP 540) Disabled by default (equals to 0). Set to 1 by "-X utf8" and "-X utf8=1" command line options. Set to 1 by PYTHONUTF8=1 environment variable. Set to 0 by "-X utf8=0" and PYTHONUTF8=0. If equals to -1, it is set to 1 if the LC_CTYPE locale is "C" or "POSIX", otherwise it is set to 0. Inherit Py_UTF8Mode value value. */ int utf8_mode; int dev_mode; /* Development mode. PYTHONDEVMODE, -X dev */ /* Memory allocator: PYTHONMALLOC env var. See PyMemAllocatorName for valid values. */ int allocator; } PyPreConfig; PyAPI_FUNC(void) PyPreConfig_InitPythonConfig(PyPreConfig *config); PyAPI_FUNC(void) PyPreConfig_InitIsolatedConfig(PyPreConfig *config); /* --- PyConfig ---------------------------------------------- */ typedef struct { int _config_init; /* _PyConfigInitEnum value */ int isolated; /* Isolated mode? see PyPreConfig.isolated */ int use_environment; /* Use environment variables? see PyPreConfig.use_environment */ int dev_mode; /* Development mode? See PyPreConfig.dev_mode */ /* Install signal handlers? Yes by default. */ int install_signal_handlers; int use_hash_seed; /* PYTHONHASHSEED=x */ unsigned long hash_seed; /* Enable faulthandler? Set to 1 by -X faulthandler and PYTHONFAULTHANDLER. -1 means unset. */ int faulthandler; /* Enable tracemalloc? Set by -X tracemalloc=N and PYTHONTRACEMALLOC. -1 means unset */ int tracemalloc; int import_time; /* PYTHONPROFILEIMPORTTIME, -X importtime */ int show_ref_count; /* -X showrefcount */ int show_alloc_count; /* -X showalloccount */ int dump_refs; /* PYTHONDUMPREFS */ int malloc_stats; /* PYTHONMALLOCSTATS */ /* Python filesystem encoding and error handler: sys.getfilesystemencoding() and sys.getfilesystemencodeerrors(). Default encoding and error handler: * if Py_SetStandardStreamEncoding() has been called: they have the highest priority; * PYTHONIOENCODING environment variable; * The UTF-8 Mode uses UTF-8/surrogateescape; * If Python forces the usage of the ASCII encoding (ex: C locale or POSIX locale on FreeBSD or HP-UX), use ASCII/surrogateescape; * locale encoding: ANSI code page on Windows, UTF-8 on Android and VxWorks, LC_CTYPE locale encoding on other platforms; * On Windows, "surrogateescape" error handler; * "surrogateescape" error handler if the LC_CTYPE locale is "C" or "POSIX"; * "surrogateescape" error handler if the LC_CTYPE locale has been coerced (PEP 538); * "strict" error handler. Supported error handlers: "strict", "surrogateescape" and "surrogatepass". The surrogatepass error handler is only supported if Py_DecodeLocale() and Py_EncodeLocale() use directly the UTF-8 codec; it's only used on Windows. initfsencoding() updates the encoding to the Python codec name. For example, "ANSI_X3.4-1968" is replaced with "ascii". On Windows, sys._enablelegacywindowsfsencoding() sets the encoding/errors to mbcs/replace at runtime. See Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors. */ wchar_t *filesystem_encoding; wchar_t *filesystem_errors; wchar_t *pycache_prefix; /* PYTHONPYCACHEPREFIX, -X pycache_prefix=PATH */ int parse_argv; /* Parse argv command line arguments? */ /* Command line arguments (sys.argv). Set parse_argv to 1 to parse argv as Python command line arguments and then strip Python arguments from argv. If argv is empty, an empty string is added to ensure that sys.argv always exists and is never empty. */ PyWideStringList argv; /* Program name: - If Py_SetProgramName() was called, use its value. - On macOS, use PYTHONEXECUTABLE environment variable if set. - If WITH_NEXT_FRAMEWORK macro is defined, use __PYVENV_LAUNCHER__ environment variable is set. - Use argv[0] if available and non-empty. - Use "python" on Windows, or "python3 on other platforms. */ wchar_t *program_name; PyWideStringList xoptions; /* Command line -X options */ /* Warnings options: lowest to highest priority. warnings.filters is built in the reverse order (highest to lowest priority). */ PyWideStringList warnoptions; /* If equal to zero, disable the import of the module site and the site-dependent manipulations of sys.path that it entails. Also disable these manipulations if site is explicitly imported later (call site.main() if you want them to be triggered). Set to 0 by the -S command line option. If set to -1 (default), it is set to !Py_NoSiteFlag. */ int site_import; /* Bytes warnings: * If equal to 1, issue a warning when comparing bytes or bytearray with str or bytes with int. * If equal or greater to 2, issue an error. Incremented by the -b command line option. If set to -1 (default), inherit Py_BytesWarningFlag value. */ int bytes_warning; /* If greater than 0, enable inspect: when a script is passed as first argument or the -c option is used, enter interactive mode after executing the script or the command, even when sys.stdin does not appear to be a terminal. Incremented by the -i command line option. Set to 1 if the PYTHONINSPECT environment variable is non-empty. If set to -1 (default), inherit Py_InspectFlag value. */ int inspect; /* If greater than 0: enable the interactive mode (REPL). Incremented by the -i command line option. If set to -1 (default), inherit Py_InteractiveFlag value. */ int interactive; /* Optimization level. Incremented by the -O command line option. Set by the PYTHONOPTIMIZE environment variable. If set to -1 (default), inherit Py_OptimizeFlag value. */ int optimization_level; /* If greater than 0, enable the debug mode: turn on parser debugging output (for expert only, depending on compilation options). Incremented by the -d command line option. Set by the PYTHONDEBUG environment variable. If set to -1 (default), inherit Py_DebugFlag value. */ int parser_debug; /* If equal to 0, Python won't try to write ``.pyc`` files on the import of source modules. Set to 0 by the -B command line option and the PYTHONDONTWRITEBYTECODE environment variable. If set to -1 (default), it is set to !Py_DontWriteBytecodeFlag. */ int write_bytecode; /* If greater than 0, enable the verbose mode: print a message each time a module is initialized, showing the place (filename or built-in module) from which it is loaded. If greater or equal to 2, print a message for each file that is checked for when searching for a module. Also provides information on module cleanup at exit. Incremented by the -v option. Set by the PYTHONVERBOSE environment variable. If set to -1 (default), inherit Py_VerboseFlag value. */ int verbose; /* If greater than 0, enable the quiet mode: Don't display the copyright and version messages even in interactive mode. Incremented by the -q option. If set to -1 (default), inherit Py_QuietFlag value. */ int quiet; /* If greater than 0, don't add the user site-packages directory to sys.path. Set to 0 by the -s and -I command line options , and the PYTHONNOUSERSITE environment variable. If set to -1 (default), it is set to !Py_NoUserSiteDirectory. */ int user_site_directory; /* If non-zero, configure C standard steams (stdio, stdout, stderr): - Set O_BINARY mode on Windows. - If buffered_stdio is equal to zero, make streams unbuffered. Otherwise, enable streams buffering if interactive is non-zero. */ int configure_c_stdio; /* If equal to 0, enable unbuffered mode: force the stdout and stderr streams to be unbuffered. Set to 0 by the -u option. Set by the PYTHONUNBUFFERED environment variable. If set to -1 (default), it is set to !Py_UnbufferedStdioFlag. */ int buffered_stdio; /* Encoding of sys.stdin, sys.stdout and sys.stderr. Value set from PYTHONIOENCODING environment variable and Py_SetStandardStreamEncoding() function. See also 'stdio_errors' attribute. */ wchar_t *stdio_encoding; /* Error handler of sys.stdin and sys.stdout. Value set from PYTHONIOENCODING environment variable and Py_SetStandardStreamEncoding() function. See also 'stdio_encoding' attribute. */ wchar_t *stdio_errors; #ifdef MS_WINDOWS /* If greater than zero, use io.FileIO instead of WindowsConsoleIO for sys standard streams. Set to 1 if the PYTHONLEGACYWINDOWSSTDIO environment variable is set to a non-empty string. If set to -1 (default), inherit Py_LegacyWindowsStdioFlag value. See PEP 528 for more details. */ int legacy_windows_stdio; #endif /* Value of the --check-hash-based-pycs command line option: - "default" means the 'check_source' flag in hash-based pycs determines invalidation - "always" causes the interpreter to hash the source file for invalidation regardless of value of 'check_source' bit - "never" causes the interpreter to always assume hash-based pycs are valid The default value is "default". See PEP 552 "Deterministic pycs" for more details. */ wchar_t *check_hash_pycs_mode; /* --- Path configuration inputs ------------ */ /* If greater than 0, suppress _PyPathConfig_Calculate() warnings on Unix. The parameter has no effect on Windows. If set to -1 (default), inherit !Py_FrozenFlag value. */ int pathconfig_warnings; wchar_t *pythonpath_env; /* PYTHONPATH environment variable */ wchar_t *home; /* PYTHONHOME environment variable, see also Py_SetPythonHome(). */ /* --- Path configuration outputs ----------- */ int module_search_paths_set; /* If non-zero, use module_search_paths */ PyWideStringList module_search_paths; /* sys.path paths. Computed if module_search_paths_set is equal to zero. */ wchar_t *executable; /* sys.executable */ wchar_t *base_executable; /* sys._base_executable */ wchar_t *prefix; /* sys.prefix */ wchar_t *base_prefix; /* sys.base_prefix */ wchar_t *exec_prefix; /* sys.exec_prefix */ wchar_t *base_exec_prefix; /* sys.base_exec_prefix */ /* --- Parameter only used by Py_Main() ---------- */ /* Skip the first line of the source ('run_filename' parameter), allowing use of non-Unix forms of "#!cmd". This is intended for a DOS specific hack only. Set by the -x command line option. */ int skip_source_first_line; wchar_t *run_command; /* -c command line argument */ wchar_t *run_module; /* -m command line argument */ wchar_t *run_filename; /* Trailing command line argument without -c or -m */ /* --- Private fields ---------------------------- */ /* Install importlib? If set to 0, importlib is not initialized at all. Needed by freeze_importlib. */ int _install_importlib; /* If equal to 0, stop Python initialization before the "main" phase */ int _init_main; } PyConfig; PyAPI_FUNC(void) PyConfig_InitPythonConfig(PyConfig *config); PyAPI_FUNC(void) PyConfig_InitIsolatedConfig(PyConfig *config); PyAPI_FUNC(void) PyConfig_Clear(PyConfig *); PyAPI_FUNC(PyStatus) PyConfig_SetString( PyConfig *config, wchar_t **config_str, const wchar_t *str); PyAPI_FUNC(PyStatus) PyConfig_SetBytesString( PyConfig *config, wchar_t **config_str, const char *str); PyAPI_FUNC(PyStatus) PyConfig_Read(PyConfig *config); PyAPI_FUNC(PyStatus) PyConfig_SetBytesArgv( PyConfig *config, Py_ssize_t argc, char * const *argv); PyAPI_FUNC(PyStatus) PyConfig_SetArgv(PyConfig *config, Py_ssize_t argc, wchar_t * const *argv); PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config, PyWideStringList *list, Py_ssize_t length, wchar_t **items); #ifdef __cplusplus } #endif #endif /* !Py_LIMITED_API */ #endif /* !Py_PYCORECONFIG_H */
16,028
C++
.h
326
42.714724
102
0.672951
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,577
interpreteridobject.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/interpreteridobject.h
#ifndef Py_CPYTHON_INTERPRETERIDOBJECT_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif /* Interpreter ID Object */ PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type; PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t); PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *); PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *); #ifdef __cplusplus } #endif
456
C++
.h
14
31.214286
77
0.798627
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,578
traceback.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/traceback.h
#ifndef Py_CPYTHON_TRACEBACK_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif typedef struct _traceback { PyObject_HEAD struct _traceback *tb_next; struct _frame *tb_frame; int tb_lasti; int tb_lineno; } PyTracebackObject; PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int); PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int); #ifdef __cplusplus } #endif
473
C++
.h
18
23.944444
72
0.733925
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,579
pystate.h
relativty_Relativty/Relativty_Driver/include/Python/cpython/pystate.h
#ifndef Py_CPYTHON_PYSTATE_H # error "this header file must not be included directly" #endif #ifdef __cplusplus extern "C" { #endif #include "cpython/initconfig.h" PyAPI_FUNC(int) _PyInterpreterState_RequiresIDRef(PyInterpreterState *); PyAPI_FUNC(void) _PyInterpreterState_RequireIDRef(PyInterpreterState *, int); PyAPI_FUNC(PyObject *) _PyInterpreterState_GetMainModule(PyInterpreterState *); /* State unique per thread */ /* Py_tracefunc return -1 when raising an exception, or 0 for success. */ typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *); /* The following values are used for 'what' for tracefunc functions * * To add a new kind of trace event, also update "trace_init" in * Python/sysmodule.c to define the Python level event name */ #define PyTrace_CALL 0 #define PyTrace_EXCEPTION 1 #define PyTrace_LINE 2 #define PyTrace_RETURN 3 #define PyTrace_C_CALL 4 #define PyTrace_C_EXCEPTION 5 #define PyTrace_C_RETURN 6 #define PyTrace_OPCODE 7 typedef struct _err_stackitem { /* This struct represents an entry on the exception stack, which is a * per-coroutine state. (Coroutine in the computer science sense, * including the thread and generators). * This ensures that the exception state is not impacted by "yields" * from an except handler. */ PyObject *exc_type, *exc_value, *exc_traceback; struct _err_stackitem *previous_item; } _PyErr_StackItem; // The PyThreadState typedef is in Include/pystate.h. struct _ts { /* See Python/ceval.c for comments explaining most fields */ struct _ts *prev; struct _ts *next; PyInterpreterState *interp; /* Borrowed reference to the current frame (it can be NULL) */ struct _frame *frame; int recursion_depth; char overflowed; /* The stack has overflowed. Allow 50 more calls to handle the runtime error. */ char recursion_critical; /* The current calls must not cause a stack overflow. */ int stackcheck_counter; /* 'tracing' keeps track of the execution depth when tracing/profiling. This is to prevent the actual trace/profile code from being recorded in the trace/profile. */ int tracing; int use_tracing; Py_tracefunc c_profilefunc; Py_tracefunc c_tracefunc; PyObject *c_profileobj; PyObject *c_traceobj; /* The exception currently being raised */ PyObject *curexc_type; PyObject *curexc_value; PyObject *curexc_traceback; /* The exception currently being handled, if no coroutines/generators * are present. Always last element on the stack referred to be exc_info. */ _PyErr_StackItem exc_state; /* Pointer to the top of the stack of the exceptions currently * being handled */ _PyErr_StackItem *exc_info; PyObject *dict; /* Stores per-thread state */ int gilstate_counter; PyObject *async_exc; /* Asynchronous exception to raise */ unsigned long thread_id; /* Thread id where this tstate was created */ int trash_delete_nesting; PyObject *trash_delete_later; /* Called when a thread state is deleted normally, but not when it * is destroyed after fork(). * Pain: to prevent rare but fatal shutdown errors (issue 18808), * Thread.join() must wait for the join'ed thread's tstate to be unlinked * from the tstate chain. That happens at the end of a thread's life, * in pystate.c. * The obvious way doesn't quite work: create a lock which the tstate * unlinking code releases, and have Thread.join() wait to acquire that * lock. The problem is that we _are_ at the end of the thread's life: * if the thread holds the last reference to the lock, decref'ing the * lock will delete the lock, and that may trigger arbitrary Python code * if there's a weakref, with a callback, to the lock. But by this time * _PyRuntime.gilstate.tstate_current is already NULL, so only the simplest * of C code can be allowed to run (in particular it must not be possible to * release the GIL). * So instead of holding the lock directly, the tstate holds a weakref to * the lock: that's the value of on_delete_data below. Decref'ing a * weakref is harmless. * on_delete points to _threadmodule.c's static release_sentinel() function. * After the tstate is unlinked, release_sentinel is called with the * weakref-to-lock (on_delete_data) argument, and release_sentinel releases * the indirectly held lock. */ void (*on_delete)(void *); void *on_delete_data; int coroutine_origin_tracking_depth; PyObject *async_gen_firstiter; PyObject *async_gen_finalizer; PyObject *context; uint64_t context_ver; /* Unique thread state id. */ uint64_t id; /* XXX signal handlers should also be here */ }; /* Get the current interpreter state. Issue a fatal error if there no current Python thread state or no current interpreter. It cannot return NULL. The caller must hold the GIL.*/ PyAPI_FUNC(PyInterpreterState *) _PyInterpreterState_Get(void); PyAPI_FUNC(int) _PyState_AddModule(PyObject*, struct PyModuleDef*); PyAPI_FUNC(void) _PyState_ClearModules(void); PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *); /* Similar to PyThreadState_Get(), but don't issue a fatal error * if it is NULL. */ PyAPI_FUNC(PyThreadState *) _PyThreadState_UncheckedGet(void); /* PyGILState */ /* Helper/diagnostic function - return 1 if the current thread currently holds the GIL, 0 otherwise. The function returns 1 if _PyGILState_check_enabled is non-zero. */ PyAPI_FUNC(int) PyGILState_Check(void); /* Get the single PyInterpreterState used by this process' GILState implementation. This function doesn't check for error. Return NULL before _PyGILState_Init() is called and after _PyGILState_Fini() is called. See also _PyInterpreterState_Get() and _PyInterpreterState_GET_UNSAFE(). */ PyAPI_FUNC(PyInterpreterState *) _PyGILState_GetInterpreterStateUnsafe(void); /* The implementation of sys._current_frames() Returns a dict mapping thread id to that thread's current frame. */ PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void); /* Routines for advanced debuggers, requested by David Beazley. Don't use unless you know what you are doing! */ PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Main(void); PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); /* cross-interpreter data */ struct _xid; // _PyCrossInterpreterData is similar to Py_buffer as an effectively // opaque struct that holds data outside the object machinery. This // is necessary to pass safely between interpreters in the same process. typedef struct _xid { // data is the cross-interpreter-safe derivation of a Python object // (see _PyObject_GetCrossInterpreterData). It will be NULL if the // new_object func (below) encodes the data. void *data; // obj is the Python object from which the data was derived. This // is non-NULL only if the data remains bound to the object in some // way, such that the object must be "released" (via a decref) when // the data is released. In that case the code that sets the field, // likely a registered "crossinterpdatafunc", is responsible for // ensuring it owns the reference (i.e. incref). PyObject *obj; // interp is the ID of the owning interpreter of the original // object. It corresponds to the active interpreter when // _PyObject_GetCrossInterpreterData() was called. This should only // be set by the cross-interpreter machinery. // // We use the ID rather than the PyInterpreterState to avoid issues // with deleted interpreters. Note that IDs are never re-used, so // each one will always correspond to a specific interpreter // (whether still alive or not). int64_t interp; // new_object is a function that returns a new object in the current // interpreter given the data. The resulting object (a new // reference) will be equivalent to the original object. This field // is required. PyObject *(*new_object)(struct _xid *); // free is called when the data is released. If it is NULL then // nothing will be done to free the data. For some types this is // okay (e.g. bytes) and for those types this field should be set // to NULL. However, for most the data was allocated just for // cross-interpreter use, so it must be freed when // _PyCrossInterpreterData_Release is called or the memory will // leak. In that case, at the very least this field should be set // to PyMem_RawFree (the default if not explicitly set to NULL). // The call will happen with the original interpreter activated. void (*free)(void *); } _PyCrossInterpreterData; PyAPI_FUNC(int) _PyObject_GetCrossInterpreterData(PyObject *, _PyCrossInterpreterData *); PyAPI_FUNC(PyObject *) _PyCrossInterpreterData_NewObject(_PyCrossInterpreterData *); PyAPI_FUNC(void) _PyCrossInterpreterData_Release(_PyCrossInterpreterData *); PyAPI_FUNC(int) _PyObject_CheckCrossInterpreterData(PyObject *); /* cross-interpreter data registry */ typedef int (*crossinterpdatafunc)(PyObject *, struct _xid *); PyAPI_FUNC(int) _PyCrossInterpreterData_RegisterClass(PyTypeObject *, crossinterpdatafunc); PyAPI_FUNC(crossinterpdatafunc) _PyCrossInterpreterData_Lookup(PyObject *); #ifdef __cplusplus } #endif
9,810
C++
.h
198
45.333333
91
0.734463
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,580
pycore_getopt.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_getopt.h
#ifndef Py_INTERNAL_PYGETOPT_H #define Py_INTERNAL_PYGETOPT_H #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif extern int _PyOS_opterr; extern Py_ssize_t _PyOS_optind; extern const wchar_t *_PyOS_optarg; extern void _PyOS_ResetGetOpt(void); typedef struct { const wchar_t *name; int has_arg; int val; } _PyOS_LongOption; extern int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex); #endif /* !Py_INTERNAL_PYGETOPT_H */
490
C++
.h
16
28.5
80
0.747863
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,581
pycore_fileutils.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_fileutils.h
#ifndef Py_INTERNAL_FILEUTILS_H #define Py_INTERNAL_FILEUTILS_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "Py_BUILD_CORE must be defined to include this header" #endif #include <locale.h> /* struct lconv */ PyAPI_DATA(int) _Py_HasFileSystemDefaultEncodeErrors; PyAPI_FUNC(int) _Py_DecodeUTF8Ex( const char *arg, Py_ssize_t arglen, wchar_t **wstr, size_t *wlen, const char **reason, _Py_error_handler errors); PyAPI_FUNC(int) _Py_EncodeUTF8Ex( const wchar_t *text, char **str, size_t *error_pos, const char **reason, int raw_malloc, _Py_error_handler errors); PyAPI_FUNC(wchar_t*) _Py_DecodeUTF8_surrogateescape( const char *arg, Py_ssize_t arglen, size_t *wlen); PyAPI_FUNC(int) _Py_GetForceASCII(void); /* Reset "force ASCII" mode (if it was initialized). This function should be called when Python changes the LC_CTYPE locale, so the "force ASCII" mode can be detected again on the new locale encoding. */ PyAPI_FUNC(void) _Py_ResetForceASCII(void); PyAPI_FUNC(int) _Py_GetLocaleconvNumeric( struct lconv *lc, PyObject **decimal_point, PyObject **thousands_sep); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_FILEUTILS_H */
1,254
C++
.h
42
26.642857
74
0.7175
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,582
pycore_gil.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_gil.h
#ifndef Py_INTERNAL_GIL_H #define Py_INTERNAL_GIL_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "pycore_condvar.h" #include "pycore_atomic.h" #ifndef Py_HAVE_CONDVAR # error You need either a POSIX-compatible or a Windows system! #endif /* Enable if you want to force the switching of threads at least every `interval`. */ #undef FORCE_SWITCHING #define FORCE_SWITCHING struct _gil_runtime_state { /* microseconds (the Python API uses seconds, though) */ unsigned long interval; /* Last PyThreadState holding / having held the GIL. This helps us know whether anyone else was scheduled after we dropped the GIL. */ _Py_atomic_address last_holder; /* Whether the GIL is already taken (-1 if uninitialized). This is atomic because it can be read without any lock taken in ceval.c. */ _Py_atomic_int locked; /* Number of GIL switches since the beginning. */ unsigned long switch_number; /* This condition variable allows one or several threads to wait until the GIL is released. In addition, the mutex also protects the above variables. */ PyCOND_T cond; PyMUTEX_T mutex; #ifdef FORCE_SWITCHING /* This condition variable helps the GIL-releasing thread wait for a GIL-awaiting thread to be scheduled and take the GIL. */ PyCOND_T switch_cond; PyMUTEX_T switch_mutex; #endif }; #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_GIL_H */
1,520
C++
.h
44
31.272727
74
0.729932
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,583
pycore_ceval.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_ceval.h
#ifndef Py_INTERNAL_CEVAL_H #define Py_INTERNAL_CEVAL_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "pycore_atomic.h" #include "pycore_pystate.h" #include "pythread.h" PyAPI_FUNC(void) _Py_FinishPendingCalls(_PyRuntimeState *runtime); PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *); PyAPI_FUNC(void) _PyEval_FiniThreads( struct _ceval_runtime_state *ceval); PyAPI_FUNC(void) _PyEval_SignalReceived( struct _ceval_runtime_state *ceval); PyAPI_FUNC(int) _PyEval_AddPendingCall( PyThreadState *tstate, struct _ceval_runtime_state *ceval, int (*func)(void *), void *arg); PyAPI_FUNC(void) _PyEval_SignalAsyncExc( struct _ceval_runtime_state *ceval); PyAPI_FUNC(void) _PyEval_ReInitThreads( _PyRuntimeState *runtime); /* Private function */ void _PyEval_Fini(void); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_CEVAL_H */
966
C++
.h
32
28.03125
67
0.751346
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,584
pycore_pyerrors.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_pyerrors.h
#ifndef Py_INTERNAL_PYERRORS_H #define Py_INTERNAL_PYERRORS_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif static inline PyObject* _PyErr_Occurred(PyThreadState *tstate) { return tstate == NULL ? NULL : tstate->curexc_type; } PyAPI_FUNC(void) _PyErr_Fetch( PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **traceback); PyAPI_FUNC(int) _PyErr_ExceptionMatches( PyThreadState *tstate, PyObject *exc); PyAPI_FUNC(void) _PyErr_Restore( PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *traceback); PyAPI_FUNC(void) _PyErr_SetObject( PyThreadState *tstate, PyObject *type, PyObject *value); PyAPI_FUNC(void) _PyErr_Clear(PyThreadState *tstate); PyAPI_FUNC(void) _PyErr_SetNone(PyThreadState *tstate, PyObject *exception); PyAPI_FUNC(void) _PyErr_SetString( PyThreadState *tstate, PyObject *exception, const char *string); PyAPI_FUNC(PyObject *) _PyErr_Format( PyThreadState *tstate, PyObject *exception, const char *format, ...); PyAPI_FUNC(void) _PyErr_NormalizeException( PyThreadState *tstate, PyObject **exc, PyObject **val, PyObject **tb); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_PYERRORS_H */
1,329
C++
.h
49
23.816327
76
0.726125
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,585
pycore_hamt.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_hamt.h
#ifndef Py_INTERNAL_HAMT_H #define Py_INTERNAL_HAMT_H #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #define _Py_HAMT_MAX_TREE_DEPTH 7 #define PyHamt_Check(o) (Py_TYPE(o) == &_PyHamt_Type) /* Abstract tree node. */ typedef struct { PyObject_HEAD } PyHamtNode; /* An HAMT immutable mapping collection. */ typedef struct { PyObject_HEAD PyHamtNode *h_root; PyObject *h_weakreflist; Py_ssize_t h_count; } PyHamtObject; /* A struct to hold the state of depth-first traverse of the tree. HAMT is an immutable collection. Iterators will hold a strong reference to it, and every node in the HAMT has strong references to its children. So for iterators, we can implement zero allocations and zero reference inc/dec depth-first iteration. - i_nodes: an array of seven pointers to tree nodes - i_level: the current node in i_nodes - i_pos: an array of positions within nodes in i_nodes. */ typedef struct { PyHamtNode *i_nodes[_Py_HAMT_MAX_TREE_DEPTH]; Py_ssize_t i_pos[_Py_HAMT_MAX_TREE_DEPTH]; int8_t i_level; } PyHamtIteratorState; /* Base iterator object. Contains the iteration state, a pointer to the HAMT tree, and a pointer to the 'yield function'. The latter is a simple function that returns a key/value tuple for the 'Items' iterator, just a key for the 'Keys' iterator, and a value for the 'Values' iterator. */ typedef struct { PyObject_HEAD PyHamtObject *hi_obj; PyHamtIteratorState hi_iter; binaryfunc hi_yield; } PyHamtIterator; PyAPI_DATA(PyTypeObject) _PyHamt_Type; PyAPI_DATA(PyTypeObject) _PyHamt_ArrayNode_Type; PyAPI_DATA(PyTypeObject) _PyHamt_BitmapNode_Type; PyAPI_DATA(PyTypeObject) _PyHamt_CollisionNode_Type; PyAPI_DATA(PyTypeObject) _PyHamtKeys_Type; PyAPI_DATA(PyTypeObject) _PyHamtValues_Type; PyAPI_DATA(PyTypeObject) _PyHamtItems_Type; /* Create a new HAMT immutable mapping. */ PyHamtObject * _PyHamt_New(void); /* Return a new collection based on "o", but with an additional key/val pair. */ PyHamtObject * _PyHamt_Assoc(PyHamtObject *o, PyObject *key, PyObject *val); /* Return a new collection based on "o", but without "key". */ PyHamtObject * _PyHamt_Without(PyHamtObject *o, PyObject *key); /* Find "key" in the "o" collection. Return: - -1: An error occurred. - 0: "key" wasn't found in "o". - 1: "key" is in "o"; "*val" is set to its value (a borrowed ref). */ int _PyHamt_Find(PyHamtObject *o, PyObject *key, PyObject **val); /* Check if "v" is equal to "w". Return: - 0: v != w - 1: v == w - -1: An error occurred. */ int _PyHamt_Eq(PyHamtObject *v, PyHamtObject *w); /* Return the size of "o"; equivalent of "len(o)". */ Py_ssize_t _PyHamt_Len(PyHamtObject *o); /* Return a Keys iterator over "o". */ PyObject * _PyHamt_NewIterKeys(PyHamtObject *o); /* Return a Values iterator over "o". */ PyObject * _PyHamt_NewIterValues(PyHamtObject *o); /* Return a Items iterator over "o". */ PyObject * _PyHamt_NewIterItems(PyHamtObject *o); int _PyHamt_Init(void); void _PyHamt_Fini(void); #endif /* !Py_INTERNAL_HAMT_H */
3,128
C++
.h
84
34.535714
76
0.723772
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,586
pycore_context.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_context.h
#ifndef Py_INTERNAL_CONTEXT_H #define Py_INTERNAL_CONTEXT_H #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "pycore_hamt.h" struct _pycontextobject { PyObject_HEAD PyContext *ctx_prev; PyHamtObject *ctx_vars; PyObject *ctx_weakreflist; int ctx_entered; }; struct _pycontextvarobject { PyObject_HEAD PyObject *var_name; PyObject *var_default; PyObject *var_cached; uint64_t var_cached_tsid; uint64_t var_cached_tsver; Py_hash_t var_hash; }; struct _pycontexttokenobject { PyObject_HEAD PyContext *tok_ctx; PyContextVar *tok_var; PyObject *tok_oldval; int tok_used; }; int _PyContext_Init(void); void _PyContext_Fini(void); #endif /* !Py_INTERNAL_CONTEXT_H */
779
C++
.h
32
20.90625
52
0.724559
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,587
pycore_traceback.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_traceback.h
#ifndef Py_INTERNAL_TRACEBACK_H #define Py_INTERNAL_TRACEBACK_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "pystate.h" /* PyInterpreterState */ /* Write the Python traceback into the file 'fd'. For example: Traceback (most recent call first): File "xxx", line xxx in <xxx> File "xxx", line xxx in <xxx> ... File "xxx", line xxx in <xxx> This function is written for debug purpose only, to dump the traceback in the worst case: after a segmentation fault, at fatal error, etc. That's why, it is very limited. Strings are truncated to 100 characters and encoded to ASCII with backslashreplace. It doesn't write the source code, only the function name, filename and line number of each frame. Write only the first 100 frames: if the traceback is truncated, write the line " ...". This function is signal safe. */ PyAPI_FUNC(void) _Py_DumpTraceback( int fd, PyThreadState *tstate); /* Write the traceback of all threads into the file 'fd'. current_thread can be NULL. Return NULL on success, or an error message on error. This function is written for debug purpose only. It calls _Py_DumpTraceback() for each thread, and so has the same limitations. It only write the traceback of the first 100 threads: write "..." if there are more threads. If current_tstate is NULL, the function tries to get the Python thread state of the current thread. It is not an error if the function is unable to get the current Python thread state. If interp is NULL, the function tries to get the interpreter state from the current Python thread state, or from _PyGILState_GetInterpreterStateUnsafe() in last resort. It is better to pass NULL to interp and current_tstate, the function tries different options to retrieve these informations. This function is signal safe. */ PyAPI_FUNC(const char*) _Py_DumpTracebackThreads( int fd, PyInterpreterState *interp, PyThreadState *current_tstate); /* Write a Unicode object into the file descriptor fd. Encode the string to ASCII using the backslashreplace error handler. Do nothing if text is not a Unicode object. The function accepts Unicode string which is not ready (PyUnicode_WCHAR_KIND). This function is signal safe. */ PyAPI_FUNC(void) _Py_DumpASCII(int fd, PyObject *text); /* Format an integer as decimal into the file descriptor fd. This function is signal safe. */ PyAPI_FUNC(void) _Py_DumpDecimal( int fd, unsigned long value); /* Format an integer as hexadecimal into the file descriptor fd with at least width digits. The maximum width is sizeof(unsigned long)*2 digits. This function is signal safe. */ PyAPI_FUNC(void) _Py_DumpHexadecimal( int fd, unsigned long value, Py_ssize_t width); PyAPI_FUNC(PyObject*) _PyTraceBack_FromFrame( PyObject *tb_next, struct _frame *frame); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_TRACEBACK_H */
3,076
C++
.h
71
39.422535
79
0.739597
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,588
pycore_pymem.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_pymem.h
#ifndef Py_INTERNAL_PYMEM_H #define Py_INTERNAL_PYMEM_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "objimpl.h" #include "pymem.h" /* GC runtime state */ /* If we change this, we need to change the default value in the signature of gc.collect. */ #define NUM_GENERATIONS 3 /* NOTE: about the counting of long-lived objects. To limit the cost of garbage collection, there are two strategies; - make each collection faster, e.g. by scanning fewer objects - do less collections This heuristic is about the latter strategy. In addition to the various configurable thresholds, we only trigger a full collection if the ratio long_lived_pending / long_lived_total is above a given value (hardwired to 25%). The reason is that, while "non-full" collections (i.e., collections of the young and middle generations) will always examine roughly the same number of objects -- determined by the aforementioned thresholds --, the cost of a full collection is proportional to the total number of long-lived objects, which is virtually unbounded. Indeed, it has been remarked that doing a full collection every <constant number> of object creations entails a dramatic performance degradation in workloads which consist in creating and storing lots of long-lived objects (e.g. building a large list of GC-tracked objects would show quadratic performance, instead of linear as expected: see issue #4074). Using the above ratio, instead, yields amortized linear performance in the total number of objects (the effect of which can be summarized thusly: "each full garbage collection is more and more costly as the number of objects grows, but we do fewer and fewer of them"). This heuristic was suggested by Martin von Löwis on python-dev in June 2008. His original analysis and proposal can be found at: http://mail.python.org/pipermail/python-dev/2008-June/080579.html */ /* NOTE: about untracking of mutable objects. Certain types of container cannot participate in a reference cycle, and so do not need to be tracked by the garbage collector. Untracking these objects reduces the cost of garbage collections. However, determining which objects may be untracked is not free, and the costs must be weighed against the benefits for garbage collection. There are two possible strategies for when to untrack a container: i) When the container is created. ii) When the container is examined by the garbage collector. Tuples containing only immutable objects (integers, strings etc, and recursively, tuples of immutable objects) do not need to be tracked. The interpreter creates a large number of tuples, many of which will not survive until garbage collection. It is therefore not worthwhile to untrack eligible tuples at creation time. Instead, all tuples except the empty tuple are tracked when created. During garbage collection it is determined whether any surviving tuples can be untracked. A tuple can be untracked if all of its contents are already not tracked. Tuples are examined for untracking in all garbage collection cycles. It may take more than one cycle to untrack a tuple. Dictionaries containing only immutable objects also do not need to be tracked. Dictionaries are untracked when created. If a tracked item is inserted into a dictionary (either as a key or value), the dictionary becomes tracked. During a full garbage collection (all generations), the collector will untrack any dictionaries whose contents are not tracked. The module provides the python function is_tracked(obj), which returns the CURRENT tracking status of the object. Subsequent garbage collections may change the tracking status of the object. Untracking of certain containers was introduced in issue #4688, and the algorithm was refined in response to issue #14775. */ struct gc_generation { PyGC_Head head; int threshold; /* collection threshold */ int count; /* count of allocations or collections of younger generations */ }; /* Running stats per generation */ struct gc_generation_stats { /* total number of collections */ Py_ssize_t collections; /* total number of collected objects */ Py_ssize_t collected; /* total number of uncollectable objects (put into gc.garbage) */ Py_ssize_t uncollectable; }; struct _gc_runtime_state { /* List of objects that still need to be cleaned up, singly linked * via their gc headers' gc_prev pointers. */ PyObject *trash_delete_later; /* Current call-stack depth of tp_dealloc calls. */ int trash_delete_nesting; int enabled; int debug; /* linked lists of container objects */ struct gc_generation generations[NUM_GENERATIONS]; PyGC_Head *generation0; /* a permanent generation which won't be collected */ struct gc_generation permanent_generation; struct gc_generation_stats generation_stats[NUM_GENERATIONS]; /* true if we are currently running the collector */ int collecting; /* list of uncollectable objects */ PyObject *garbage; /* a list of callbacks to be invoked when collection is performed */ PyObject *callbacks; /* This is the number of objects that survived the last full collection. It approximates the number of long lived objects tracked by the GC. (by "full collection", we mean a collection of the oldest generation). */ Py_ssize_t long_lived_total; /* This is the number of objects that survived all "non-full" collections, and are awaiting to undergo a full collection for the first time. */ Py_ssize_t long_lived_pending; }; PyAPI_FUNC(void) _PyGC_Initialize(struct _gc_runtime_state *); /* Set the memory allocator of the specified domain to the default. Save the old allocator into *old_alloc if it's non-NULL. Return on success, or return -1 if the domain is unknown. */ PyAPI_FUNC(int) _PyMem_SetDefaultAllocator( PyMemAllocatorDomain domain, PyMemAllocatorEx *old_alloc); /* Special bytes broadcast into debug memory blocks at appropriate times. Strings of these are unlikely to be valid addresses, floats, ints or 7-bit ASCII. - PYMEM_CLEANBYTE: clean (newly allocated) memory - PYMEM_DEADBYTE dead (newly freed) memory - PYMEM_FORBIDDENBYTE: untouchable bytes at each end of a block Byte patterns 0xCB, 0xDB and 0xFB have been replaced with 0xCD, 0xDD and 0xFD to use the same values than Windows CRT debug malloc() and free(). If modified, _PyMem_IsPtrFreed() should be updated as well. */ #define PYMEM_CLEANBYTE 0xCD #define PYMEM_DEADBYTE 0xDD #define PYMEM_FORBIDDENBYTE 0xFD /* Heuristic checking if a pointer value is newly allocated (uninitialized), newly freed or NULL (is equal to zero). The pointer is not dereferenced, only the pointer value is checked. The heuristic relies on the debug hooks on Python memory allocators which fills newly allocated memory with CLEANBYTE (0xCD) and newly freed memory with DEADBYTE (0xDD). Detect also "untouchable bytes" marked with FORBIDDENBYTE (0xFD). */ static inline int _PyMem_IsPtrFreed(void *ptr) { uintptr_t value = (uintptr_t)ptr; #if SIZEOF_VOID_P == 8 return (value == 0 || value == (uintptr_t)0xCDCDCDCDCDCDCDCD || value == (uintptr_t)0xDDDDDDDDDDDDDDDD || value == (uintptr_t)0xFDFDFDFDFDFDFDFD); #elif SIZEOF_VOID_P == 4 return (value == 0 || value == (uintptr_t)0xCDCDCDCD || value == (uintptr_t)0xDDDDDDDD || value == (uintptr_t)0xFDFDFDFD); #else # error "unknown pointer size" #endif } PyAPI_FUNC(int) _PyMem_GetAllocatorName( const char *name, PyMemAllocatorName *allocator); /* Configure the Python memory allocators. Pass PYMEM_ALLOCATOR_DEFAULT to use default allocators. PYMEM_ALLOCATOR_NOT_SET does nothing. */ PyAPI_FUNC(int) _PyMem_SetupAllocators(PyMemAllocatorName allocator); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_PYMEM_H */
8,217
C++
.h
174
43.017241
79
0.747033
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,589
pycore_code.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_code.h
#ifndef Py_INTERNAL_CODE_H #define Py_INTERNAL_CODE_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject *ptr; /* Cached pointer (borrowed reference) */ uint64_t globals_ver; /* ma_version of global dict */ uint64_t builtins_ver; /* ma_version of builtin dict */ } _PyOpcache_LoadGlobal; struct _PyOpcache { union { _PyOpcache_LoadGlobal lg; } u; char optimized; }; /* Private API */ int _PyCode_InitOpcache(PyCodeObject *co); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_CODE_H */
542
C++
.h
22
21.909091
61
0.694553
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,590
pycore_object.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_object.h
#ifndef Py_INTERNAL_OBJECT_H #define Py_INTERNAL_OBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "pycore_pystate.h" /* _PyRuntime */ PyAPI_FUNC(int) _PyType_CheckConsistency(PyTypeObject *type); PyAPI_FUNC(int) _PyDict_CheckConsistency(PyObject *mp, int check_content); /* Tell the GC to track this object. * * NB: While the object is tracked by the collector, it must be safe to call the * ob_traverse method. * * Internal note: _PyRuntime.gc.generation0->_gc_prev doesn't have any bit flags * because it's not object header. So we don't use _PyGCHead_PREV() and * _PyGCHead_SET_PREV() for it to avoid unnecessary bitwise operations. * * The PyObject_GC_Track() function is the public version of this macro. */ static inline void _PyObject_GC_TRACK_impl(const char *filename, int lineno, PyObject *op) { _PyObject_ASSERT_FROM(op, !_PyObject_GC_IS_TRACKED(op), "object already tracked by the garbage collector", filename, lineno, "_PyObject_GC_TRACK"); PyGC_Head *gc = _Py_AS_GC(op); _PyObject_ASSERT_FROM(op, (gc->_gc_prev & _PyGC_PREV_MASK_COLLECTING) == 0, "object is in generation which is garbage collected", filename, lineno, "_PyObject_GC_TRACK"); PyGC_Head *last = (PyGC_Head*)(_PyRuntime.gc.generation0->_gc_prev); _PyGCHead_SET_NEXT(last, gc); _PyGCHead_SET_PREV(gc, last); _PyGCHead_SET_NEXT(gc, _PyRuntime.gc.generation0); _PyRuntime.gc.generation0->_gc_prev = (uintptr_t)gc; } #define _PyObject_GC_TRACK(op) \ _PyObject_GC_TRACK_impl(__FILE__, __LINE__, _PyObject_CAST(op)) /* Tell the GC to stop tracking this object. * * Internal note: This may be called while GC. So _PyGC_PREV_MASK_COLLECTING * must be cleared. But _PyGC_PREV_MASK_FINALIZED bit is kept. * * The object must be tracked by the GC. * * The PyObject_GC_UnTrack() function is the public version of this macro. */ static inline void _PyObject_GC_UNTRACK_impl(const char *filename, int lineno, PyObject *op) { _PyObject_ASSERT_FROM(op, _PyObject_GC_IS_TRACKED(op), "object not tracked by the garbage collector", filename, lineno, "_PyObject_GC_UNTRACK"); PyGC_Head *gc = _Py_AS_GC(op); PyGC_Head *prev = _PyGCHead_PREV(gc); PyGC_Head *next = _PyGCHead_NEXT(gc); _PyGCHead_SET_NEXT(prev, next); _PyGCHead_SET_PREV(next, prev); gc->_gc_next = 0; gc->_gc_prev &= _PyGC_PREV_MASK_FINALIZED; } #define _PyObject_GC_UNTRACK(op) \ _PyObject_GC_UNTRACK_impl(__FILE__, __LINE__, _PyObject_CAST(op)) #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_OBJECT_H */
2,896
C++
.h
70
35.071429
80
0.646181
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,591
pycore_atomic.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_atomic.h
#ifndef Py_ATOMIC_H #define Py_ATOMIC_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "dynamic_annotations.h" #include "pyconfig.h" #if defined(HAVE_STD_ATOMIC) #include <stdatomic.h> #endif #if defined(_MSC_VER) #include <intrin.h> #if defined(_M_IX86) || defined(_M_X64) # include <immintrin.h> #endif #endif /* This is modeled after the atomics interface from C1x, according to * the draft at * http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1425.pdf. * Operations and types are named the same except with a _Py_ prefix * and have the same semantics. * * Beware, the implementations here are deep magic. */ #if defined(HAVE_STD_ATOMIC) typedef enum _Py_memory_order { _Py_memory_order_relaxed = memory_order_relaxed, _Py_memory_order_acquire = memory_order_acquire, _Py_memory_order_release = memory_order_release, _Py_memory_order_acq_rel = memory_order_acq_rel, _Py_memory_order_seq_cst = memory_order_seq_cst } _Py_memory_order; typedef struct _Py_atomic_address { atomic_uintptr_t _value; } _Py_atomic_address; typedef struct _Py_atomic_int { atomic_int _value; } _Py_atomic_int; #define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \ atomic_signal_fence(ORDER) #define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \ atomic_thread_fence(ORDER) #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ atomic_store_explicit(&((ATOMIC_VAL)->_value), NEW_VAL, ORDER) #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ atomic_load_explicit(&((ATOMIC_VAL)->_value), ORDER) /* Use builtin atomic operations in GCC >= 4.7 */ #elif defined(HAVE_BUILTIN_ATOMIC) typedef enum _Py_memory_order { _Py_memory_order_relaxed = __ATOMIC_RELAXED, _Py_memory_order_acquire = __ATOMIC_ACQUIRE, _Py_memory_order_release = __ATOMIC_RELEASE, _Py_memory_order_acq_rel = __ATOMIC_ACQ_REL, _Py_memory_order_seq_cst = __ATOMIC_SEQ_CST } _Py_memory_order; typedef struct _Py_atomic_address { uintptr_t _value; } _Py_atomic_address; typedef struct _Py_atomic_int { int _value; } _Py_atomic_int; #define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \ __atomic_signal_fence(ORDER) #define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \ __atomic_thread_fence(ORDER) #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ (assert((ORDER) == __ATOMIC_RELAXED \ || (ORDER) == __ATOMIC_SEQ_CST \ || (ORDER) == __ATOMIC_RELEASE), \ __atomic_store_n(&((ATOMIC_VAL)->_value), NEW_VAL, ORDER)) #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ (assert((ORDER) == __ATOMIC_RELAXED \ || (ORDER) == __ATOMIC_SEQ_CST \ || (ORDER) == __ATOMIC_ACQUIRE \ || (ORDER) == __ATOMIC_CONSUME), \ __atomic_load_n(&((ATOMIC_VAL)->_value), ORDER)) /* Only support GCC (for expression statements) and x86 (for simple * atomic semantics) and MSVC x86/x64/ARM */ #elif defined(__GNUC__) && (defined(__i386__) || defined(__amd64)) typedef enum _Py_memory_order { _Py_memory_order_relaxed, _Py_memory_order_acquire, _Py_memory_order_release, _Py_memory_order_acq_rel, _Py_memory_order_seq_cst } _Py_memory_order; typedef struct _Py_atomic_address { uintptr_t _value; } _Py_atomic_address; typedef struct _Py_atomic_int { int _value; } _Py_atomic_int; static __inline__ void _Py_atomic_signal_fence(_Py_memory_order order) { if (order != _Py_memory_order_relaxed) __asm__ volatile("":::"memory"); } static __inline__ void _Py_atomic_thread_fence(_Py_memory_order order) { if (order != _Py_memory_order_relaxed) __asm__ volatile("mfence":::"memory"); } /* Tell the race checker about this operation's effects. */ static __inline__ void _Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order) { (void)address; /* shut up -Wunused-parameter */ switch(order) { case _Py_memory_order_release: case _Py_memory_order_acq_rel: case _Py_memory_order_seq_cst: _Py_ANNOTATE_HAPPENS_BEFORE(address); break; case _Py_memory_order_relaxed: case _Py_memory_order_acquire: break; } switch(order) { case _Py_memory_order_acquire: case _Py_memory_order_acq_rel: case _Py_memory_order_seq_cst: _Py_ANNOTATE_HAPPENS_AFTER(address); break; case _Py_memory_order_relaxed: case _Py_memory_order_release: break; } } #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ __extension__ ({ \ __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \ __typeof__(atomic_val->_value) new_val = NEW_VAL;\ volatile __typeof__(new_val) *volatile_data = &atomic_val->_value; \ _Py_memory_order order = ORDER; \ _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \ \ /* Perform the operation. */ \ _Py_ANNOTATE_IGNORE_WRITES_BEGIN(); \ switch(order) { \ case _Py_memory_order_release: \ _Py_atomic_signal_fence(_Py_memory_order_release); \ /* fallthrough */ \ case _Py_memory_order_relaxed: \ *volatile_data = new_val; \ break; \ \ case _Py_memory_order_acquire: \ case _Py_memory_order_acq_rel: \ case _Py_memory_order_seq_cst: \ __asm__ volatile("xchg %0, %1" \ : "+r"(new_val) \ : "m"(atomic_val->_value) \ : "memory"); \ break; \ } \ _Py_ANNOTATE_IGNORE_WRITES_END(); \ }) #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ __extension__ ({ \ __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \ __typeof__(atomic_val->_value) result; \ volatile __typeof__(result) *volatile_data = &atomic_val->_value; \ _Py_memory_order order = ORDER; \ _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \ \ /* Perform the operation. */ \ _Py_ANNOTATE_IGNORE_READS_BEGIN(); \ switch(order) { \ case _Py_memory_order_release: \ case _Py_memory_order_acq_rel: \ case _Py_memory_order_seq_cst: \ /* Loads on x86 are not releases by default, so need a */ \ /* thread fence. */ \ _Py_atomic_thread_fence(_Py_memory_order_release); \ break; \ default: \ /* No fence */ \ break; \ } \ result = *volatile_data; \ switch(order) { \ case _Py_memory_order_acquire: \ case _Py_memory_order_acq_rel: \ case _Py_memory_order_seq_cst: \ /* Loads on x86 are automatically acquire operations so */ \ /* can get by with just a compiler fence. */ \ _Py_atomic_signal_fence(_Py_memory_order_acquire); \ break; \ default: \ /* No fence */ \ break; \ } \ _Py_ANNOTATE_IGNORE_READS_END(); \ result; \ }) #elif defined(_MSC_VER) /* _Interlocked* functions provide a full memory barrier and are therefore enough for acq_rel and seq_cst. If the HLE variants aren't available in hardware they will fall back to a full memory barrier as well. This might affect performance but likely only in some very specific and hard to meassure scenario. */ #if defined(_M_IX86) || defined(_M_X64) typedef enum _Py_memory_order { _Py_memory_order_relaxed, _Py_memory_order_acquire, _Py_memory_order_release, _Py_memory_order_acq_rel, _Py_memory_order_seq_cst } _Py_memory_order; typedef struct _Py_atomic_address { volatile uintptr_t _value; } _Py_atomic_address; typedef struct _Py_atomic_int { volatile int _value; } _Py_atomic_int; #if defined(_M_X64) #define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) \ switch (ORDER) { \ case _Py_memory_order_acquire: \ _InterlockedExchange64_HLEAcquire((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \ break; \ case _Py_memory_order_release: \ _InterlockedExchange64_HLERelease((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \ break; \ default: \ _InterlockedExchange64((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \ break; \ } #else #define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) ((void)0); #endif #define _Py_atomic_store_32bit(ATOMIC_VAL, NEW_VAL, ORDER) \ switch (ORDER) { \ case _Py_memory_order_acquire: \ _InterlockedExchange_HLEAcquire((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \ break; \ case _Py_memory_order_release: \ _InterlockedExchange_HLERelease((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \ break; \ default: \ _InterlockedExchange((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \ break; \ } #if defined(_M_X64) /* This has to be an intptr_t for now. gil_created() uses -1 as a sentinel value, if this returns a uintptr_t it will do an unsigned compare and crash */ inline intptr_t _Py_atomic_load_64bit_impl(volatile uintptr_t* value, int order) { __int64 old; switch (order) { case _Py_memory_order_acquire: { do { old = *value; } while(_InterlockedCompareExchange64_HLEAcquire((volatile __int64*)value, old, old) != old); break; } case _Py_memory_order_release: { do { old = *value; } while(_InterlockedCompareExchange64_HLERelease((volatile __int64*)value, old, old) != old); break; } case _Py_memory_order_relaxed: old = *value; break; default: { do { old = *value; } while(_InterlockedCompareExchange64((volatile __int64*)value, old, old) != old); break; } } return old; } #define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) \ _Py_atomic_load_64bit_impl((volatile uintptr_t*)&((ATOMIC_VAL)->_value), (ORDER)) #else #define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) ((ATOMIC_VAL)->_value) #endif inline int _Py_atomic_load_32bit_impl(volatile int* value, int order) { long old; switch (order) { case _Py_memory_order_acquire: { do { old = *value; } while(_InterlockedCompareExchange_HLEAcquire((volatile long*)value, old, old) != old); break; } case _Py_memory_order_release: { do { old = *value; } while(_InterlockedCompareExchange_HLERelease((volatile long*)value, old, old) != old); break; } case _Py_memory_order_relaxed: old = *value; break; default: { do { old = *value; } while(_InterlockedCompareExchange((volatile long*)value, old, old) != old); break; } } return old; } #define _Py_atomic_load_32bit(ATOMIC_VAL, ORDER) \ _Py_atomic_load_32bit_impl((volatile int*)&((ATOMIC_VAL)->_value), (ORDER)) #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ if (sizeof((ATOMIC_VAL)->_value) == 8) { \ _Py_atomic_store_64bit((ATOMIC_VAL), NEW_VAL, ORDER) } else { \ _Py_atomic_store_32bit((ATOMIC_VAL), NEW_VAL, ORDER) } #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ ( \ sizeof((ATOMIC_VAL)->_value) == 8 ? \ _Py_atomic_load_64bit((ATOMIC_VAL), ORDER) : \ _Py_atomic_load_32bit((ATOMIC_VAL), ORDER) \ ) #elif defined(_M_ARM) || defined(_M_ARM64) typedef enum _Py_memory_order { _Py_memory_order_relaxed, _Py_memory_order_acquire, _Py_memory_order_release, _Py_memory_order_acq_rel, _Py_memory_order_seq_cst } _Py_memory_order; typedef struct _Py_atomic_address { volatile uintptr_t _value; } _Py_atomic_address; typedef struct _Py_atomic_int { volatile int _value; } _Py_atomic_int; #if defined(_M_ARM64) #define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) \ switch (ORDER) { \ case _Py_memory_order_acquire: \ _InterlockedExchange64_acq((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \ break; \ case _Py_memory_order_release: \ _InterlockedExchange64_rel((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \ break; \ default: \ _InterlockedExchange64((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \ break; \ } #else #define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) ((void)0); #endif #define _Py_atomic_store_32bit(ATOMIC_VAL, NEW_VAL, ORDER) \ switch (ORDER) { \ case _Py_memory_order_acquire: \ _InterlockedExchange_acq((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \ break; \ case _Py_memory_order_release: \ _InterlockedExchange_rel((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \ break; \ default: \ _InterlockedExchange((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \ break; \ } #if defined(_M_ARM64) /* This has to be an intptr_t for now. gil_created() uses -1 as a sentinel value, if this returns a uintptr_t it will do an unsigned compare and crash */ inline intptr_t _Py_atomic_load_64bit_impl(volatile uintptr_t* value, int order) { uintptr_t old; switch (order) { case _Py_memory_order_acquire: { do { old = *value; } while(_InterlockedCompareExchange64_acq(value, old, old) != old); break; } case _Py_memory_order_release: { do { old = *value; } while(_InterlockedCompareExchange64_rel(value, old, old) != old); break; } case _Py_memory_order_relaxed: old = *value; break; default: { do { old = *value; } while(_InterlockedCompareExchange64(value, old, old) != old); break; } } return old; } #define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) \ _Py_atomic_load_64bit_impl((volatile uintptr_t*)&((ATOMIC_VAL)->_value), (ORDER)) #else #define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) ((ATOMIC_VAL)->_value) #endif inline int _Py_atomic_load_32bit_impl(volatile int* value, int order) { int old; switch (order) { case _Py_memory_order_acquire: { do { old = *value; } while(_InterlockedCompareExchange_acq(value, old, old) != old); break; } case _Py_memory_order_release: { do { old = *value; } while(_InterlockedCompareExchange_rel(value, old, old) != old); break; } case _Py_memory_order_relaxed: old = *value; break; default: { do { old = *value; } while(_InterlockedCompareExchange(value, old, old) != old); break; } } return old; } #define _Py_atomic_load_32bit(ATOMIC_VAL, ORDER) \ _Py_atomic_load_32bit_impl((volatile int*)&((ATOMIC_VAL)->_value), (ORDER)) #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ if (sizeof((ATOMIC_VAL)->_value) == 8) { \ _Py_atomic_store_64bit((ATOMIC_VAL), (NEW_VAL), (ORDER)) } else { \ _Py_atomic_store_32bit((ATOMIC_VAL), (NEW_VAL), (ORDER)) } #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ ( \ sizeof((ATOMIC_VAL)->_value) == 8 ? \ _Py_atomic_load_64bit((ATOMIC_VAL), (ORDER)) : \ _Py_atomic_load_32bit((ATOMIC_VAL), (ORDER)) \ ) #endif #else /* !gcc x86 !_msc_ver */ typedef enum _Py_memory_order { _Py_memory_order_relaxed, _Py_memory_order_acquire, _Py_memory_order_release, _Py_memory_order_acq_rel, _Py_memory_order_seq_cst } _Py_memory_order; typedef struct _Py_atomic_address { uintptr_t _value; } _Py_atomic_address; typedef struct _Py_atomic_int { int _value; } _Py_atomic_int; /* Fall back to other compilers and processors by assuming that simple volatile accesses are atomic. This is false, so people should port this. */ #define _Py_atomic_signal_fence(/*memory_order*/ ORDER) ((void)0) #define _Py_atomic_thread_fence(/*memory_order*/ ORDER) ((void)0) #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ ((ATOMIC_VAL)->_value = NEW_VAL) #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ ((ATOMIC_VAL)->_value) #endif /* Standardized shortcuts. */ #define _Py_atomic_store(ATOMIC_VAL, NEW_VAL) \ _Py_atomic_store_explicit((ATOMIC_VAL), (NEW_VAL), _Py_memory_order_seq_cst) #define _Py_atomic_load(ATOMIC_VAL) \ _Py_atomic_load_explicit((ATOMIC_VAL), _Py_memory_order_seq_cst) /* Python-local extensions */ #define _Py_atomic_store_relaxed(ATOMIC_VAL, NEW_VAL) \ _Py_atomic_store_explicit((ATOMIC_VAL), (NEW_VAL), _Py_memory_order_relaxed) #define _Py_atomic_load_relaxed(ATOMIC_VAL) \ _Py_atomic_load_explicit((ATOMIC_VAL), _Py_memory_order_relaxed) #ifdef __cplusplus } #endif #endif /* Py_ATOMIC_H */
16,944
C++
.h
494
29.269231
106
0.628585
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,592
pycore_pyhash.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_pyhash.h
#ifndef Py_INTERNAL_HASH_H #define Py_INTERNAL_HASH_H #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif uint64_t _Py_KeyedHash(uint64_t, const char *, Py_ssize_t); #endif
206
C++
.h
7
28
59
0.770408
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,593
pycore_accu.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_accu.h
#ifndef Py_LIMITED_API #ifndef Py_INTERNAL_ACCU_H #define Py_INTERNAL_ACCU_H #ifdef __cplusplus extern "C" { #endif /*** This is a private API for use by the interpreter and the stdlib. *** Its definition may be changed or removed at any moment. ***/ #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif /* * A two-level accumulator of unicode objects that avoids both the overhead * of keeping a huge number of small separate objects, and the quadratic * behaviour of using a naive repeated concatenation scheme. */ #undef small /* defined by some Windows headers */ typedef struct { PyObject *large; /* A list of previously accumulated large strings */ PyObject *small; /* Pending small strings */ } _PyAccu; PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc); PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode); PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc); PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc); PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_ACCU_H */ #endif /* !Py_LIMITED_API */
1,126
C++
.h
32
33.53125
75
0.74333
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,594
pycore_condvar.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_condvar.h
#ifndef Py_INTERNAL_CONDVAR_H #define Py_INTERNAL_CONDVAR_H #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #ifndef _POSIX_THREADS /* This means pthreads are not implemented in libc headers, hence the macro not present in unistd.h. But they still can be implemented as an external library (e.g. gnu pth in pthread emulation) */ # ifdef HAVE_PTHREAD_H # include <pthread.h> /* _POSIX_THREADS */ # endif #endif #ifdef _POSIX_THREADS /* * POSIX support */ #define Py_HAVE_CONDVAR #include <pthread.h> #define PyMUTEX_T pthread_mutex_t #define PyCOND_T pthread_cond_t #elif defined(NT_THREADS) /* * Windows (XP, 2003 server and later, as well as (hopefully) CE) support * * Emulated condition variables ones that work with XP and later, plus * example native support on VISTA and onwards. */ #define Py_HAVE_CONDVAR /* include windows if it hasn't been done before */ #define WIN32_LEAN_AND_MEAN #include <windows.h> /* options */ /* non-emulated condition variables are provided for those that want * to target Windows Vista. Modify this macro to enable them. */ #ifndef _PY_EMULATED_WIN_CV #define _PY_EMULATED_WIN_CV 1 /* use emulated condition variables */ #endif /* fall back to emulation if not targeting Vista */ #if !defined NTDDI_VISTA || NTDDI_VERSION < NTDDI_VISTA #undef _PY_EMULATED_WIN_CV #define _PY_EMULATED_WIN_CV 1 #endif #if _PY_EMULATED_WIN_CV typedef CRITICAL_SECTION PyMUTEX_T; /* The ConditionVariable object. From XP onwards it is easily emulated with a Semaphore. Semaphores are available on Windows XP (2003 server) and later. We use a Semaphore rather than an auto-reset event, because although an auto-resent event might appear to solve the lost-wakeup bug (race condition between releasing the outer lock and waiting) because it maintains state even though a wait hasn't happened, there is still a lost wakeup problem if more than one thread are interrupted in the critical place. A semaphore solves that, because its state is counted, not Boolean. Because it is ok to signal a condition variable with no one waiting, we need to keep track of the number of waiting threads. Otherwise, the semaphore's state could rise without bound. This also helps reduce the number of "spurious wakeups" that would otherwise happen. */ typedef struct _PyCOND_T { HANDLE sem; int waiting; /* to allow PyCOND_SIGNAL to be a no-op */ } PyCOND_T; #else /* !_PY_EMULATED_WIN_CV */ /* Use native Win7 primitives if build target is Win7 or higher */ /* SRWLOCK is faster and better than CriticalSection */ typedef SRWLOCK PyMUTEX_T; typedef CONDITION_VARIABLE PyCOND_T; #endif /* _PY_EMULATED_WIN_CV */ #endif /* _POSIX_THREADS, NT_THREADS */ #endif /* Py_INTERNAL_CONDVAR_H */
2,809
C++
.h
75
35.306667
76
0.75829
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,595
pycore_pystate.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_pystate.h
#ifndef Py_INTERNAL_PYSTATE_H #define Py_INTERNAL_PYSTATE_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "cpython/initconfig.h" #include "fileobject.h" #include "pystate.h" #include "pythread.h" #include "sysmodule.h" #include "pycore_gil.h" /* _gil_runtime_state */ #include "pycore_pathconfig.h" #include "pycore_pymem.h" #include "pycore_warnings.h" /* ceval state */ struct _pending_calls { int finishing; PyThread_type_lock lock; /* Request for running pending calls. */ _Py_atomic_int calls_to_do; /* Request for looking at the `async_exc` field of the current thread state. Guarded by the GIL. */ int async_exc; #define NPENDINGCALLS 32 struct { int (*func)(void *); void *arg; } calls[NPENDINGCALLS]; int first; int last; }; struct _ceval_runtime_state { int recursion_limit; /* Records whether tracing is on for any thread. Counts the number of threads for which tstate->c_tracefunc is non-NULL, so if the value is 0, we know we don't have to check this thread's c_tracefunc. This speeds up the if statement in PyEval_EvalFrameEx() after fast_next_opcode. */ int tracing_possible; /* This single variable consolidates all requests to break out of the fast path in the eval loop. */ _Py_atomic_int eval_breaker; /* Request for dropping the GIL */ _Py_atomic_int gil_drop_request; struct _pending_calls pending; /* Request for checking signals. */ _Py_atomic_int signals_pending; struct _gil_runtime_state gil; }; /* interpreter state */ typedef PyObject* (*_PyFrameEvalFunction)(struct _frame *, int); // The PyInterpreterState typedef is in Include/pystate.h. struct _is { struct _is *next; struct _ts *tstate_head; int64_t id; int64_t id_refcount; int requires_idref; PyThread_type_lock id_mutex; int finalizing; PyObject *modules; PyObject *modules_by_index; PyObject *sysdict; PyObject *builtins; PyObject *importlib; /* Used in Python/sysmodule.c. */ int check_interval; /* Used in Modules/_threadmodule.c. */ long num_threads; /* Support for runtime thread stack size tuning. A value of 0 means using the platform's default stack size or the size specified by the THREAD_STACK_SIZE macro. */ /* Used in Python/thread.c. */ size_t pythread_stacksize; PyObject *codec_search_path; PyObject *codec_search_cache; PyObject *codec_error_registry; int codecs_initialized; /* fs_codec.encoding is initialized to NULL. Later, it is set to a non-NULL string by _PyUnicode_InitEncodings(). */ struct { char *encoding; /* Filesystem encoding (encoded to UTF-8) */ char *errors; /* Filesystem errors (encoded to UTF-8) */ _Py_error_handler error_handler; } fs_codec; PyConfig config; #ifdef HAVE_DLOPEN int dlopenflags; #endif PyObject *dict; /* Stores per-interpreter state */ PyObject *builtins_copy; PyObject *import_func; /* Initialized to PyEval_EvalFrameDefault(). */ _PyFrameEvalFunction eval_frame; Py_ssize_t co_extra_user_count; freefunc co_extra_freefuncs[MAX_CO_EXTRA_USERS]; #ifdef HAVE_FORK PyObject *before_forkers; PyObject *after_forkers_parent; PyObject *after_forkers_child; #endif /* AtExit module */ void (*pyexitfunc)(PyObject *); PyObject *pyexitmodule; uint64_t tstate_next_unique_id; struct _warnings_runtime_state warnings; PyObject *audit_hooks; }; PyAPI_FUNC(struct _is*) _PyInterpreterState_LookUpID(PY_INT64_T); PyAPI_FUNC(int) _PyInterpreterState_IDInitref(struct _is *); PyAPI_FUNC(void) _PyInterpreterState_IDIncref(struct _is *); PyAPI_FUNC(void) _PyInterpreterState_IDDecref(struct _is *); /* cross-interpreter data registry */ /* For now we use a global registry of shareable classes. An alternative would be to add a tp_* slot for a class's crossinterpdatafunc. It would be simpler and more efficient. */ struct _xidregitem; struct _xidregitem { PyTypeObject *cls; crossinterpdatafunc getdata; struct _xidregitem *next; }; /* runtime audit hook state */ typedef struct _Py_AuditHookEntry { struct _Py_AuditHookEntry *next; Py_AuditHookFunction hookCFunction; void *userData; } _Py_AuditHookEntry; /* GIL state */ struct _gilstate_runtime_state { int check_enabled; /* Assuming the current thread holds the GIL, this is the PyThreadState for the current thread. */ _Py_atomic_address tstate_current; PyThreadFrameGetter getframe; /* The single PyInterpreterState used by this process' GILState implementation */ /* TODO: Given interp_main, it may be possible to kill this ref */ PyInterpreterState *autoInterpreterState; Py_tss_t autoTSSkey; }; /* hook for PyEval_GetFrame(), requested for Psyco */ #define _PyThreadState_GetFrame _PyRuntime.gilstate.getframe /* Issue #26558: Flag to disable PyGILState_Check(). If set to non-zero, PyGILState_Check() always return 1. */ #define _PyGILState_check_enabled _PyRuntime.gilstate.check_enabled /* Full Python runtime state */ typedef struct pyruntimestate { /* Is running Py_PreInitialize()? */ int preinitializing; /* Is Python preinitialized? Set to 1 by Py_PreInitialize() */ int preinitialized; /* Is Python core initialized? Set to 1 by _Py_InitializeCore() */ int core_initialized; /* Is Python fully initialized? Set to 1 by Py_Initialize() */ int initialized; /* Set by Py_FinalizeEx(). Only reset to NULL if Py_Initialize() is called again. */ PyThreadState *finalizing; struct pyinterpreters { PyThread_type_lock mutex; PyInterpreterState *head; PyInterpreterState *main; /* _next_interp_id is an auto-numbered sequence of small integers. It gets initialized in _PyInterpreterState_Init(), which is called in Py_Initialize(), and used in PyInterpreterState_New(). A negative interpreter ID indicates an error occurred. The main interpreter will always have an ID of 0. Overflow results in a RuntimeError. If that becomes a problem later then we can adjust, e.g. by using a Python int. */ int64_t next_id; } interpreters; // XXX Remove this field once we have a tp_* slot. struct _xidregistry { PyThread_type_lock mutex; struct _xidregitem *head; } xidregistry; unsigned long main_thread; #define NEXITFUNCS 32 void (*exitfuncs[NEXITFUNCS])(void); int nexitfuncs; struct _gc_runtime_state gc; struct _ceval_runtime_state ceval; struct _gilstate_runtime_state gilstate; PyPreConfig preconfig; Py_OpenCodeHookFunction open_code_hook; void *open_code_userdata; _Py_AuditHookEntry *audit_hook_head; // XXX Consolidate globals found via the check-c-globals script. } _PyRuntimeState; #define _PyRuntimeState_INIT \ {.preinitialized = 0, .core_initialized = 0, .initialized = 0} /* Note: _PyRuntimeState_INIT sets other fields to 0/NULL */ PyAPI_DATA(_PyRuntimeState) _PyRuntime; PyAPI_FUNC(PyStatus) _PyRuntimeState_Init(_PyRuntimeState *runtime); PyAPI_FUNC(void) _PyRuntimeState_Fini(_PyRuntimeState *runtime); PyAPI_FUNC(void) _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime); /* Initialize _PyRuntimeState. Return NULL on success, or return an error message on failure. */ PyAPI_FUNC(PyStatus) _PyRuntime_Initialize(void); PyAPI_FUNC(void) _PyRuntime_Finalize(void); #define _Py_CURRENTLY_FINALIZING(runtime, tstate) \ (runtime->finalizing == tstate) /* Variable and macro for in-line access to current thread and interpreter state */ #define _PyRuntimeState_GetThreadState(runtime) \ ((PyThreadState*)_Py_atomic_load_relaxed(&(runtime)->gilstate.tstate_current)) /* Get the current Python thread state. Efficient macro reading directly the 'gilstate.tstate_current' atomic variable. The macro is unsafe: it does not check for error and it can return NULL. The caller must hold the GIL. See also PyThreadState_Get() and PyThreadState_GET(). */ #define _PyThreadState_GET() _PyRuntimeState_GetThreadState(&_PyRuntime) /* Redefine PyThreadState_GET() as an alias to _PyThreadState_GET() */ #undef PyThreadState_GET #define PyThreadState_GET() _PyThreadState_GET() /* Get the current interpreter state. The macro is unsafe: it does not check for error and it can return NULL. The caller must hold the GIL. See also _PyInterpreterState_Get() and _PyGILState_GetInterpreterStateUnsafe(). */ #define _PyInterpreterState_GET_UNSAFE() (_PyThreadState_GET()->interp) /* Other */ PyAPI_FUNC(void) _PyThreadState_Init( _PyRuntimeState *runtime, PyThreadState *tstate); PyAPI_FUNC(void) _PyThreadState_DeleteExcept( _PyRuntimeState *runtime, PyThreadState *tstate); PyAPI_FUNC(PyThreadState *) _PyThreadState_Swap( struct _gilstate_runtime_state *gilstate, PyThreadState *newts); PyAPI_FUNC(PyStatus) _PyInterpreterState_Enable(_PyRuntimeState *runtime); PyAPI_FUNC(void) _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime); PyAPI_FUNC(void) _PyGILState_Reinit(_PyRuntimeState *runtime); PyAPI_FUNC(int) _PyOS_InterruptOccurred(PyThreadState *tstate); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_PYSTATE_H */
9,560
C++
.h
247
34.283401
82
0.720598
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,596
pycore_tupleobject.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_tupleobject.h
#ifndef Py_INTERNAL_TUPLEOBJECT_H #define Py_INTERNAL_TUPLEOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "tupleobject.h" #define _PyTuple_ITEMS(op) (_PyTuple_CAST(op)->ob_item) PyAPI_FUNC(PyObject *) _PyTuple_FromArray(PyObject *const *, Py_ssize_t); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_TUPLEOBJECT_H */
418
C++
.h
15
26.6
73
0.756892
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,597
pycore_pylifecycle.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_pylifecycle.h
#ifndef Py_INTERNAL_LIFECYCLE_H #define Py_INTERNAL_LIFECYCLE_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "pycore_initconfig.h" /* _PyArgv */ #include "pycore_pystate.h" /* _PyRuntimeState */ /* True if the main interpreter thread exited due to an unhandled * KeyboardInterrupt exception, suggesting the user pressed ^C. */ PyAPI_DATA(int) _Py_UnhandledKeyboardInterrupt; extern int _Py_SetFileSystemEncoding( const char *encoding, const char *errors); extern void _Py_ClearFileSystemEncoding(void); extern PyStatus _PyUnicode_InitEncodings(PyThreadState *tstate); #ifdef MS_WINDOWS extern int _PyUnicode_EnableLegacyWindowsFSEncoding(void); #endif PyAPI_FUNC(void) _Py_ClearStandardStreamEncoding(void); PyAPI_FUNC(int) _Py_IsLocaleCoercionTarget(const char *ctype_loc); /* Various one-time initializers */ extern PyStatus _PyUnicode_Init(void); extern int _PyStructSequence_Init(void); extern int _PyLong_Init(void); extern PyStatus _PyFaulthandler_Init(int enable); extern int _PyTraceMalloc_Init(int enable); extern PyObject * _PyBuiltin_Init(void); extern PyStatus _PySys_Create( _PyRuntimeState *runtime, PyInterpreterState *interp, PyObject **sysmod_p); extern PyStatus _PySys_SetPreliminaryStderr(PyObject *sysdict); extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options); extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config); extern int _PySys_InitMain( _PyRuntimeState *runtime, PyInterpreterState *interp); extern PyStatus _PyImport_Init(PyInterpreterState *interp); extern PyStatus _PyExc_Init(void); extern PyStatus _PyErr_Init(void); extern PyStatus _PyBuiltins_AddExceptions(PyObject * bltinmod); extern PyStatus _PyImportHooks_Init(void); extern int _PyFloat_Init(void); extern PyStatus _Py_HashRandomization_Init(const PyConfig *); extern PyStatus _PyTypes_Init(void); extern PyStatus _PyImportZip_Init(PyInterpreterState *interp); /* Various internal finalizers */ extern void PyMethod_Fini(void); extern void PyFrame_Fini(void); extern void PyCFunction_Fini(void); extern void PyDict_Fini(void); extern void PyTuple_Fini(void); extern void PyList_Fini(void); extern void PySet_Fini(void); extern void PyBytes_Fini(void); extern void PyFloat_Fini(void); extern void PyOS_FiniInterrupts(void); extern void PySlice_Fini(void); extern void PyAsyncGen_Fini(void); extern void _PyExc_Fini(void); extern void _PyImport_Fini(void); extern void _PyImport_Fini2(void); extern void _PyGC_Fini(_PyRuntimeState *runtime); extern void _PyType_Fini(void); extern void _Py_HashRandomization_Fini(void); extern void _PyUnicode_Fini(void); extern void PyLong_Fini(void); extern void _PyFaulthandler_Fini(void); extern void _PyHash_Fini(void); extern void _PyTraceMalloc_Fini(void); extern void _PyWarnings_Fini(PyInterpreterState *interp); extern void _PyGILState_Init( _PyRuntimeState *runtime, PyInterpreterState *interp, PyThreadState *tstate); extern void _PyGILState_Fini(_PyRuntimeState *runtime); PyAPI_FUNC(void) _PyGC_DumpShutdownStats(_PyRuntimeState *runtime); PyAPI_FUNC(PyStatus) _Py_PreInitializeFromPyArgv( const PyPreConfig *src_config, const _PyArgv *args); PyAPI_FUNC(PyStatus) _Py_PreInitializeFromConfig( const PyConfig *config, const _PyArgv *args); PyAPI_FUNC(int) _Py_HandleSystemExit(int *exitcode_p); PyAPI_FUNC(PyObject*) _PyErr_WriteUnraisableDefaultHook(PyObject *unraisable); PyAPI_FUNC(void) _PyErr_Print(PyThreadState *tstate); PyAPI_FUNC(void) _PyErr_Display(PyObject *file, PyObject *exception, PyObject *value, PyObject *tb); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_LIFECYCLE_H */
3,758
C++
.h
95
37.4
78
0.790774
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,598
pycore_initconfig.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_initconfig.h
#ifndef Py_INTERNAL_CORECONFIG_H #define Py_INTERNAL_CORECONFIG_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "pycore_pystate.h" /* _PyRuntimeState */ /* --- PyStatus ----------------------------------------------- */ /* Almost all errors causing Python initialization to fail */ #ifdef _MSC_VER /* Visual Studio 2015 doesn't implement C99 __func__ in C */ # define _PyStatus_GET_FUNC() __FUNCTION__ #else # define _PyStatus_GET_FUNC() __func__ #endif #define _PyStatus_OK() \ (PyStatus){._type = _PyStatus_TYPE_OK,} /* other fields are set to 0 */ #define _PyStatus_ERR(ERR_MSG) \ (PyStatus){ \ ._type = _PyStatus_TYPE_ERROR, \ .func = _PyStatus_GET_FUNC(), \ .err_msg = (ERR_MSG)} /* other fields are set to 0 */ #define _PyStatus_NO_MEMORY() _PyStatus_ERR("memory allocation failed") #define _PyStatus_EXIT(EXITCODE) \ (PyStatus){ \ ._type = _PyStatus_TYPE_EXIT, \ .exitcode = (EXITCODE)} #define _PyStatus_IS_ERROR(err) \ (err._type == _PyStatus_TYPE_ERROR) #define _PyStatus_IS_EXIT(err) \ (err._type == _PyStatus_TYPE_EXIT) #define _PyStatus_EXCEPTION(err) \ (err._type != _PyStatus_TYPE_OK) #define _PyStatus_UPDATE_FUNC(err) \ do { err.func = _PyStatus_GET_FUNC(); } while (0) /* --- PyWideStringList ------------------------------------------------ */ #define _PyWideStringList_INIT (PyWideStringList){.length = 0, .items = NULL} #ifndef NDEBUG PyAPI_FUNC(int) _PyWideStringList_CheckConsistency(const PyWideStringList *list); #endif PyAPI_FUNC(void) _PyWideStringList_Clear(PyWideStringList *list); PyAPI_FUNC(int) _PyWideStringList_Copy(PyWideStringList *list, const PyWideStringList *list2); PyAPI_FUNC(PyStatus) _PyWideStringList_Extend(PyWideStringList *list, const PyWideStringList *list2); PyAPI_FUNC(PyObject*) _PyWideStringList_AsList(const PyWideStringList *list); /* --- _PyArgv ---------------------------------------------------- */ typedef struct { Py_ssize_t argc; int use_bytes_argv; char * const *bytes_argv; wchar_t * const *wchar_argv; } _PyArgv; PyAPI_FUNC(PyStatus) _PyArgv_AsWstrList(const _PyArgv *args, PyWideStringList *list); /* --- Helper functions ------------------------------------------- */ PyAPI_FUNC(int) _Py_str_to_int( const char *str, int *result); PyAPI_FUNC(const wchar_t*) _Py_get_xoption( const PyWideStringList *xoptions, const wchar_t *name); PyAPI_FUNC(const char*) _Py_GetEnv( int use_environment, const char *name); PyAPI_FUNC(void) _Py_get_env_flag( int use_environment, int *flag, const char *name); /* Py_GetArgcArgv() helper */ PyAPI_FUNC(void) _Py_ClearArgcArgv(void); /* --- _PyPreCmdline ------------------------------------------------- */ typedef struct { PyWideStringList argv; PyWideStringList xoptions; /* "-X value" option */ int isolated; /* -I option */ int use_environment; /* -E option */ int dev_mode; /* -X dev and PYTHONDEVMODE */ } _PyPreCmdline; #define _PyPreCmdline_INIT \ (_PyPreCmdline){ \ .use_environment = -1, \ .isolated = -1, \ .dev_mode = -1} /* Note: _PyPreCmdline_INIT sets other fields to 0/NULL */ extern void _PyPreCmdline_Clear(_PyPreCmdline *cmdline); extern PyStatus _PyPreCmdline_SetArgv(_PyPreCmdline *cmdline, const _PyArgv *args); extern PyStatus _PyPreCmdline_SetConfig( const _PyPreCmdline *cmdline, PyConfig *config); extern PyStatus _PyPreCmdline_Read(_PyPreCmdline *cmdline, const PyPreConfig *preconfig); /* --- PyPreConfig ----------------------------------------------- */ PyAPI_FUNC(void) _PyPreConfig_InitCompatConfig(PyPreConfig *preconfig); extern void _PyPreConfig_InitFromConfig( PyPreConfig *preconfig, const PyConfig *config); extern PyStatus _PyPreConfig_InitFromPreConfig( PyPreConfig *preconfig, const PyPreConfig *config2); extern PyObject* _PyPreConfig_AsDict(const PyPreConfig *preconfig); extern void _PyPreConfig_GetConfig(PyPreConfig *preconfig, const PyConfig *config); extern PyStatus _PyPreConfig_Read(PyPreConfig *preconfig, const _PyArgv *args); extern PyStatus _PyPreConfig_Write(const PyPreConfig *preconfig); /* --- PyConfig ---------------------------------------------- */ typedef enum { /* Py_Initialize() API: backward compatibility with Python 3.6 and 3.7 */ _PyConfig_INIT_COMPAT = 1, _PyConfig_INIT_PYTHON = 2, _PyConfig_INIT_ISOLATED = 3 } _PyConfigInitEnum; PyAPI_FUNC(void) _PyConfig_InitCompatConfig(PyConfig *config); extern PyStatus _PyConfig_Copy( PyConfig *config, const PyConfig *config2); extern PyStatus _PyConfig_InitPathConfig(PyConfig *config); extern void _PyConfig_Write(const PyConfig *config, _PyRuntimeState *runtime); extern PyStatus _PyConfig_SetPyArgv( PyConfig *config, const _PyArgv *args); /* --- Function used for testing ---------------------------------- */ PyAPI_FUNC(PyObject*) _Py_GetConfigsAsDict(void); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_CORECONFIG_H */
5,168
C++
.h
134
35.30597
81
0.656138
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
24,599
pycore_pathconfig.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_pathconfig.h
#ifndef Py_INTERNAL_PATHCONFIG_H #define Py_INTERNAL_PATHCONFIG_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif typedef struct _PyPathConfig { /* Full path to the Python program */ wchar_t *program_full_path; wchar_t *prefix; wchar_t *exec_prefix; /* Set by Py_SetPath(), or computed by _PyConfig_InitPathConfig() */ wchar_t *module_search_path; /* Python program name */ wchar_t *program_name; /* Set by Py_SetPythonHome() or PYTHONHOME environment variable */ wchar_t *home; #ifdef MS_WINDOWS /* isolated and site_import are used to set Py_IsolatedFlag and Py_NoSiteFlag flags on Windows in read_pth_file(). These fields are ignored when their value are equal to -1 (unset). */ int isolated; int site_import; /* Set when a venv is detected */ wchar_t *base_executable; #endif } _PyPathConfig; #ifdef MS_WINDOWS # define _PyPathConfig_INIT \ {.module_search_path = NULL, \ .isolated = -1, \ .site_import = -1} #else # define _PyPathConfig_INIT \ {.module_search_path = NULL} #endif /* Note: _PyPathConfig_INIT sets other fields to 0/NULL */ PyAPI_DATA(_PyPathConfig) _Py_path_config; #ifdef MS_WINDOWS PyAPI_DATA(wchar_t*) _Py_dll_path; #endif extern void _PyPathConfig_ClearGlobal(void); extern PyStatus _PyPathConfig_SetGlobal( const struct _PyPathConfig *pathconfig); extern PyStatus _PyPathConfig_Calculate( _PyPathConfig *pathconfig, const PyConfig *config); extern int _PyPathConfig_ComputeSysPath0( const PyWideStringList *argv, PyObject **path0); extern int _Py_FindEnvConfigValue( FILE *env_file, const wchar_t *key, wchar_t *value, size_t value_size); #ifdef MS_WINDOWS extern wchar_t* _Py_GetDLLPath(void); #endif extern PyStatus _PyConfig_WritePathConfig(const PyConfig *config); extern void _Py_DumpPathConfig(PyThreadState *tstate); #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_PATHCONFIG_H */
2,037
C++
.h
66
27.666667
72
0.721713
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,600
pycore_warnings.h
relativty_Relativty/Relativty_Driver/include/Python/internal/pycore_warnings.h
#ifndef Py_INTERNAL_WARNINGS_H #define Py_INTERNAL_WARNINGS_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "object.h" struct _warnings_runtime_state { /* Both 'filters' and 'onceregistry' can be set in warnings.py; get_warnings_attr() will reset these variables accordingly. */ PyObject *filters; /* List */ PyObject *once_registry; /* Dict */ PyObject *default_action; /* String */ long filters_version; }; #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_WARNINGS_H */
591
C++
.h
21
25.666667
69
0.713781
relativty/Relativty
6,445
342
29
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
24,602
maximizer.cpp
wwmm_easyeffects/src/maximizer.cpp
/* * Copyright © 2017-2024 Wellington Wallace * * This file is part of Easy Effects. * * Easy Effects is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Easy Effects is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Easy Effects. If not, see <https://www.gnu.org/licenses/>. */ #include "maximizer.hpp" #include <sys/types.h> #include <algorithm> #include <memory> #include <span> #include <string> #include "lv2_wrapper.hpp" #include "pipe_manager.hpp" #include "plugin_base.hpp" #include "tags_plugin_name.hpp" #include "util.hpp" Maximizer::Maximizer(const std::string& tag, const std::string& schema, const std::string& schema_path, PipeManager* pipe_manager, PipelineType pipe_type) : PluginBase(tag, tags::plugin_name::maximizer, tags::plugin_package::zam, schema, schema_path, pipe_manager, pipe_type) { lv2_wrapper = std::make_unique<lv2::Lv2Wrapper>("urn:zamaudio:ZaMaximX2"); package_installed = lv2_wrapper->found_plugin; if (!package_installed) { util::debug(log_tag + "urn:zamaudio:ZaMaximX2 is not installed"); } lv2_wrapper->bind_key_double<"thresh", "threshold">(settings); lv2_wrapper->bind_key_double<"rel", "release">(settings); setup_input_output_gain(); // g_timeout_add_seconds(1, GSourceFunc(+[](Maximizer* self) { // if (!self->lv2_wrapper->has_ui()) { // self->lv2_wrapper->load_ui(); // } else { // self->lv2_wrapper->notify_ui(); // self->lv2_wrapper->update_ui(); // } // return 1; // }), // this); } Maximizer::~Maximizer() { if (connected_to_pw) { disconnect_from_pw(); } util::debug(log_tag + name + " destroyed"); } void Maximizer::setup() { if (!lv2_wrapper->found_plugin) { return; } lv2_wrapper->set_n_samples(n_samples); if (lv2_wrapper->get_rate() != rate) { lv2_wrapper->create_instance(rate); } } void Maximizer::process(std::span<float>& left_in, std::span<float>& right_in, std::span<float>& left_out, std::span<float>& right_out) { if (!lv2_wrapper->found_plugin || !lv2_wrapper->has_instance() || bypass) { std::copy(left_in.begin(), left_in.end(), left_out.begin()); std::copy(right_in.begin(), right_in.end(), right_out.begin()); return; } if (input_gain != 1.0F) { apply_gain(left_in, right_in, input_gain); } lv2_wrapper->connect_data_ports(left_in, right_in, left_out, right_out); lv2_wrapper->run(); if (output_gain != 1.0F) { apply_gain(left_out, right_out, output_gain); } /* This plugin gives the latency in number of samples */ const auto lv = static_cast<uint>(lv2_wrapper->get_control_port_value("lv2_latency")); if (latency_n_frames != lv) { latency_n_frames = lv; latency_value = static_cast<float>(latency_n_frames) / static_cast<float>(rate); util::debug(log_tag + name + " latency: " + util::to_string(latency_value, "") + " s"); util::idle_add([this]() { if (!post_messages || latency.empty()) { return; } latency.emit(); }); update_filter_params(); } if (post_messages) { get_peaks(left_in, right_in, left_out, right_out); if (send_notifications) { // reduction needed as double for levelbar widget ui, so we convert it here reduction_port_value = static_cast<double>(lv2_wrapper->get_control_port_value("gr")); reduction.emit(reduction_port_value); notify(); } } } auto Maximizer::get_latency_seconds() -> float { return latency_value; }
4,398
C++
.cpp
121
31.041322
92
0.604761
wwmm/easyeffects
6,414
268
211
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,603
autogain.cpp
wwmm_easyeffects/src/autogain.cpp
/* * Copyright © 2017-2024 Wellington Wallace * * This file is part of Easy Effects. * * Easy Effects is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Easy Effects is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Easy Effects. If not, see <https://www.gnu.org/licenses/>. */ #include "autogain.hpp" #include <ebur128.h> #include <gio/gio.h> #include <glib-object.h> #include <glib.h> #include <sys/types.h> #include <algorithm> #include <cmath> #include <cstddef> #include <mutex> #include <span> #include <string> #include "pipe_manager.hpp" #include "plugin_base.hpp" #include "tags_plugin_name.hpp" #include "util.hpp" AutoGain::AutoGain(const std::string& tag, const std::string& schema, const std::string& schema_path, PipeManager* pipe_manager, PipelineType pipe_type) : PluginBase(tag, tags::plugin_name::autogain, tags::plugin_package::ebur128, schema, schema_path, pipe_manager, pipe_type), target(g_settings_get_double(settings, "target")), silence_threshold(g_settings_get_double(settings, "silence-threshold")) { reference = parse_reference_key(util::gsettings_get_string(settings, "reference")); gconnections.push_back(g_signal_connect(settings, "changed::target", G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) { auto* self = static_cast<AutoGain*>(user_data); self->target = g_settings_get_double(settings, key); }), this)); gconnections.push_back(g_signal_connect(settings, "changed::silence-threshold", G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) { auto* self = static_cast<AutoGain*>(user_data); self->silence_threshold = g_settings_get_double(settings, key); }), this)); gconnections.push_back(g_signal_connect(settings, "changed::maximum-history", G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) { auto* self = static_cast<AutoGain*>(user_data); std::scoped_lock<std::mutex> lock(self->data_mutex); self->set_maximum_history(g_settings_get_int(settings, key)); }), this)); gconnections.push_back(g_signal_connect( settings, "changed::reset-history", G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) { auto* self = static_cast<AutoGain*>(user_data); self->mythreads.emplace_back([self]() { // Using emplace_back here makes sense self->data_mutex.lock(); self->ebur128_ready = false; self->data_mutex.unlock(); auto status = self->init_ebur128(); self->data_mutex.lock(); self->ebur128_ready = status; self->data_mutex.unlock(); }); }), this)); gconnections.push_back(g_signal_connect( settings, "changed::reference", G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) { auto* self = static_cast<AutoGain*>(user_data); self->reference = parse_reference_key(util::gsettings_get_string(settings, key)); }), this)); setup_input_output_gain(); } AutoGain::~AutoGain() { if (connected_to_pw) { disconnect_from_pw(); } for (auto& t : mythreads) { t.join(); } mythreads.clear(); std::scoped_lock<std::mutex> lock(data_mutex); if (ebur_state != nullptr) { ebur128_destroy(&ebur_state); } util::debug(log_tag + name + " destroyed"); } auto AutoGain::init_ebur128() -> bool { if (n_samples == 0U || rate == 0U) { return false; } internal_output_gain = 1.0; if (ebur_state != nullptr) { ebur128_destroy(&ebur_state); ebur_state = nullptr; } ebur_state = ebur128_init(2U, rate, EBUR128_MODE_S | EBUR128_MODE_I | EBUR128_MODE_LRA | EBUR128_MODE_SAMPLE_PEAK); ebur128_set_channel(ebur_state, 0U, EBUR128_LEFT); ebur128_set_channel(ebur_state, 1U, EBUR128_RIGHT); set_maximum_history(g_settings_get_int(settings, "maximum-history")); return ebur_state != nullptr; } auto AutoGain::parse_reference_key(const std::string& key) -> Reference { if (key == "Momentary") { return Reference::momentary; } if (key == "Shortterm") { return Reference::shortterm; } if (key == "Integrated") { return Reference::integrated; } if (key == "Geometric Mean (MS)") { return Reference::geometric_mean_ms; } if (key == "Geometric Mean (MI)") { return Reference::geometric_mean_mi; } if (key == "Geometric Mean (SI)") { return Reference::geometric_mean_si; } return Reference::geometric_mean_msi; } void AutoGain::set_maximum_history(const int& seconds) { if (ebur_state == nullptr) { return; } // The value given to ebur128_set_max_history must be in milliseconds ebur128_set_max_history(ebur_state, static_cast<ulong>(seconds) * 1000UL); } void AutoGain::setup() { if (2U * static_cast<size_t>(n_samples) != data.size()) { data.resize(static_cast<size_t>(n_samples) * 2U); } if (rate != old_rate) { data_mutex.lock(); ebur128_ready = false; data_mutex.unlock(); mythreads.emplace_back([this]() { // Using emplace_back here makes sense if (ebur128_ready) { return; } auto status = true; old_rate = rate; status = init_ebur128(); data_mutex.lock(); ebur128_ready = status; data_mutex.unlock(); }); } } void AutoGain::process(std::span<float>& left_in, std::span<float>& right_in, std::span<float>& left_out, std::span<float>& right_out) { std::scoped_lock<std::mutex> lock(data_mutex); if (bypass || !ebur128_ready) { std::copy(left_in.begin(), left_in.end(), left_out.begin()); std::copy(right_in.begin(), right_in.end(), right_out.begin()); return; } if (input_gain != 1.0F) { apply_gain(left_in, right_in, input_gain); } for (size_t n = 0U; n < n_samples; n++) { data[2U * n] = left_in[n]; data[2U * n + 1U] = right_in[n]; } ebur128_add_frames_float(ebur_state, data.data(), n_samples); auto failed = false; if (EBUR128_SUCCESS != ebur128_loudness_momentary(ebur_state, &momentary)) { failed = true; } if (EBUR128_SUCCESS != ebur128_loudness_shortterm(ebur_state, &shortterm)) { failed = true; } if (EBUR128_SUCCESS != ebur128_loudness_global(ebur_state, &global)) { failed = true; } if (std::isinf(momentary) || std::isnan(momentary)) { /* Assuming zero so that the output gain is negative. This should avoid undesirably high amplification in case a bad resutla comes from libebur128 */ momentary = 0.0; } if (shortterm > 10.0 || std::isinf(shortterm) || std::isnan(shortterm)) { /* Sometimes when a stream is started right after Easy Effects has been initialized a very large shorterm value is calculated. Probably because of some weird high intensity transient. So it is better to ignore unresonable large values. When they happen we just set the shorterm value to the momentary loudness. */ shortterm = momentary; } if (global > 10.0 || std::isinf(global) || std::isnan(global)) { /* Sometimes when a stream is started right after Easy Effects has been initialized a very large integrated value is calculated. Probably because of some weird high intensity transient. So it is better to ignore unresonable large values. When they happen we just set the global value to the momentary loudness. */ global = momentary; } if (EBUR128_SUCCESS != ebur128_relative_threshold(ebur_state, &relative)) { failed = true; } if (EBUR128_SUCCESS != ebur128_loudness_range(ebur_state, &range)) { failed = true; } if (momentary > silence_threshold && !failed) { double peak_L = 0.0; double peak_R = 0.0; if (EBUR128_SUCCESS != ebur128_prev_sample_peak(ebur_state, 0U, &peak_L)) { failed = true; } if (EBUR128_SUCCESS != ebur128_prev_sample_peak(ebur_state, 1U, &peak_R)) { failed = true; } if (!failed) { switch (reference) { case Reference::momentary: { loudness = momentary; break; } case Reference::shortterm: { loudness = shortterm; break; } case Reference::integrated: { loudness = global; break; } case Reference::geometric_mean_msi: { loudness = std::cbrt(momentary * shortterm * global); break; } case Reference::geometric_mean_ms: { loudness = std::sqrt(std::fabs(momentary * shortterm)); if (momentary < 0 && shortterm < 0) { loudness *= -1; } break; } case Reference::geometric_mean_mi: { loudness = std::sqrt(std::fabs(momentary * global)); if (momentary < 0 && global < 0) { loudness *= -1; } break; } case Reference::geometric_mean_si: { loudness = std::sqrt(std::fabs(shortterm * global)); if (shortterm < 0 && global < 0) { loudness *= -1; } break; } } const double diff = target - loudness; // 10^(diff/20). The way below should be faster than using pow const double gain = std::exp((diff / 20.0) * std::log(10.0)); const double peak = (peak_L > peak_R) ? peak_L : peak_R; const auto db_peak = util::linear_to_db(peak); if (db_peak > util::minimum_db_level) { if (gain * peak < 1.0) { internal_output_gain = gain; } } } } std::copy(left_in.begin(), left_in.end(), left_out.begin()); std::copy(right_in.begin(), right_in.end(), right_out.begin()); if (internal_output_gain != 1.0F) { apply_gain(left_out, right_out, static_cast<float>(internal_output_gain)); } if (output_gain != 1.0F) { apply_gain(left_out, right_out, output_gain); } if (post_messages) { get_peaks(left_in, right_in, left_out, right_out); if (send_notifications) { results.emit(loudness, internal_output_gain, momentary, shortterm, global, relative, range); notify(); } } } auto AutoGain::get_latency_seconds() -> float { return 0.0F; }
11,495
C++
.cpp
305
29.662295
119
0.597602
wwmm/easyeffects
6,414
268
211
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,604
stereo_tools_ui.cpp
wwmm_easyeffects/src/stereo_tools_ui.cpp
/* * Copyright © 2017-2024 Wellington Wallace * * This file is part of Easy Effects. * * Easy Effects is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Easy Effects is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Easy Effects. If not, see <https://www.gnu.org/licenses/>. */ #include "stereo_tools_ui.hpp" #include <STTypes.h> #include <gio/gio.h> #include <glib.h> #include <glibconfig.h> #include <gobject/gobject.h> #include <gtk/gtk.h> #include <gtk/gtkdropdown.h> #include <sigc++/connection.h> #include <memory> #include <string> #include <vector> #include "stereo_tools.hpp" #include "tags_resources.hpp" #include "tags_schema.hpp" #include "ui_helpers.hpp" #include "util.hpp" namespace ui::stereo_tools_box { struct Data { public: ~Data() { util::debug("data struct destroyed"); } uint serial = 0U; std::shared_ptr<StereoTools> stereo_tools; std::vector<sigc::connection> connections; std::vector<gulong> gconnections; }; struct _StereoToolsBox { GtkBox parent_instance; GtkScale *input_gain, *output_gain; GtkLevelBar *input_level_left, *input_level_right, *output_level_left, *output_level_right; GtkLabel *input_level_left_label, *input_level_right_label, *output_level_left_label, *output_level_right_label, *plugin_credit; GtkDropDown* mode; GtkSpinButton *balance_in, *balance_out, *slev, *sbal, *mlev, *mpan, *stereo_base, *delay, *sc_level, *stereo_phase, *dry, *wet; GtkToggleButton *softclip, *mutel, *muter, *phasel, *phaser; GSettings* settings; Data* data; }; // NOLINTNEXTLINE G_DEFINE_TYPE(StereoToolsBox, stereo_tools_box, GTK_TYPE_BOX) void on_reset(StereoToolsBox* self, GtkButton* btn) { util::reset_all_keys_except(self->settings); } void setup(StereoToolsBox* self, std::shared_ptr<StereoTools> stereo_tools, const std::string& schema_path) { auto serial = get_new_filter_serial(); self->data->serial = serial; g_object_set_data(G_OBJECT(self), "serial", GUINT_TO_POINTER(serial)); set_ignore_filter_idle_add(serial, false); self->data->stereo_tools = stereo_tools; self->settings = g_settings_new_with_path(tags::schema::stereo_tools::id, schema_path.c_str()); stereo_tools->set_post_messages(true); self->data->connections.push_back(stereo_tools->input_level.connect([=](const float left, const float right) { g_object_ref(self); util::idle_add( [=]() { if (get_ignore_filter_idle_add(serial)) { return; } update_level(self->input_level_left, self->input_level_left_label, self->input_level_right, self->input_level_right_label, left, right); }, [=]() { g_object_unref(self); }); })); self->data->connections.push_back(stereo_tools->output_level.connect([=](const float left, const float right) { g_object_ref(self); util::idle_add( [=]() { if (get_ignore_filter_idle_add(serial)) { return; } update_level(self->output_level_left, self->output_level_left_label, self->output_level_right, self->output_level_right_label, left, right); }, [=]() { g_object_unref(self); }); })); gtk_label_set_text(self->plugin_credit, ui::get_plugin_credit_translated(self->data->stereo_tools->package).c_str()); gsettings_bind_widgets<"input-gain", "output-gain">(self->settings, self->input_gain, self->output_gain); g_settings_bind(self->settings, "balance-in", gtk_spin_button_get_adjustment(self->balance_in), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "balance-out", gtk_spin_button_get_adjustment(self->balance_out), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "slev", gtk_spin_button_get_adjustment(self->slev), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "sbal", gtk_spin_button_get_adjustment(self->sbal), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "mlev", gtk_spin_button_get_adjustment(self->mlev), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "mpan", gtk_spin_button_get_adjustment(self->mpan), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "stereo-base", gtk_spin_button_get_adjustment(self->stereo_base), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "delay", gtk_spin_button_get_adjustment(self->delay), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "sc-level", gtk_spin_button_get_adjustment(self->sc_level), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "stereo-phase", gtk_spin_button_get_adjustment(self->stereo_phase), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "dry", gtk_spin_button_get_adjustment(self->dry), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "wet", gtk_spin_button_get_adjustment(self->wet), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "softclip", self->softclip, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "mutel", self->mutel, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "muter", self->muter, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "phasel", self->phasel, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "phaser", self->phaser, "active", G_SETTINGS_BIND_DEFAULT); ui::gsettings_bind_enum_to_combo_widget(self->settings, "mode", self->mode); } void dispose(GObject* object) { auto* self = EE_STEREO_TOOLS_BOX(object); set_ignore_filter_idle_add(self->data->serial, true); for (auto& c : self->data->connections) { c.disconnect(); } for (auto& handler_id : self->data->gconnections) { g_signal_handler_disconnect(self->settings, handler_id); } self->data->connections.clear(); self->data->gconnections.clear(); g_object_unref(self->settings); util::debug("disposed"); G_OBJECT_CLASS(stereo_tools_box_parent_class)->dispose(object); } void finalize(GObject* object) { auto* self = EE_STEREO_TOOLS_BOX(object); delete self->data; util::debug("finalized"); G_OBJECT_CLASS(stereo_tools_box_parent_class)->finalize(object); } void stereo_tools_box_class_init(StereoToolsBoxClass* klass) { auto* object_class = G_OBJECT_CLASS(klass); auto* widget_class = GTK_WIDGET_CLASS(klass); object_class->dispose = dispose; object_class->finalize = finalize; gtk_widget_class_set_template_from_resource(widget_class, tags::resources::stereo_tools_ui); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, input_gain); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, output_gain); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, input_level_left); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, input_level_right); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, output_level_left); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, output_level_right); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, input_level_left_label); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, input_level_right_label); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, output_level_left_label); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, output_level_right_label); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, plugin_credit); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, mode); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, balance_in); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, balance_out); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, slev); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, sbal); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, mlev); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, mpan); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, stereo_base); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, delay); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, sc_level); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, stereo_phase); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, softclip); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, mutel); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, muter); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, phasel); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, phaser); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, dry); gtk_widget_class_bind_template_child(widget_class, StereoToolsBox, wet); gtk_widget_class_bind_template_callback(widget_class, on_reset); } void stereo_tools_box_init(StereoToolsBox* self) { gtk_widget_init_template(GTK_WIDGET(self)); self->data = new Data(); prepare_scales<"dB">(self->input_gain, self->output_gain); prepare_spinbuttons<"dB">(self->slev, self->mlev); prepare_spinbuttons<"ms">(self->delay); prepare_spinbuttons<"">(self->balance_in, self->balance_out, self->sc_level, self->sbal, self->mpan, self->stereo_base, self->stereo_phase); // The following spinbuttons can assume -inf prepare_spinbuttons<"dB", false>(self->dry, self->wet); } auto create() -> StereoToolsBox* { return static_cast<StereoToolsBox*>(g_object_new(EE_TYPE_STEREO_TOOLS_BOX, nullptr)); } } // namespace ui::stereo_tools_box
10,344
C++
.cpp
194
48.948454
120
0.724484
wwmm/easyeffects
6,414
268
211
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,605
delay.cpp
wwmm_easyeffects/src/delay.cpp
/* * Copyright © 2017-2024 Wellington Wallace * * This file is part of Easy Effects. * * Easy Effects is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Easy Effects is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Easy Effects. If not, see <https://www.gnu.org/licenses/>. */ #include "delay.hpp" #include <sys/types.h> #include <algorithm> #include <memory> #include <span> #include <string> #include "lv2_wrapper.hpp" #include "pipe_manager.hpp" #include "plugin_base.hpp" #include "tags_plugin_name.hpp" #include "util.hpp" Delay::Delay(const std::string& tag, const std::string& schema, const std::string& schema_path, PipeManager* pipe_manager, PipelineType pipe_type) : PluginBase(tag, tags::plugin_name::delay, tags::plugin_package::lsp, schema, schema_path, pipe_manager, pipe_type) { lv2_wrapper = std::make_unique<lv2::Lv2Wrapper>("http://lsp-plug.in/plugins/lv2/comp_delay_x2_stereo"); package_installed = lv2_wrapper->found_plugin; if (!package_installed) { util::debug(log_tag + "http://lsp-plug.in/plugins/lv2/comp_delay_x2_stereo is not installed"); } lv2_wrapper->set_control_port_value("mode_l", 2); lv2_wrapper->set_control_port_value("mode_r", 2); lv2_wrapper->bind_key_double<"time_l", "time-l">(settings); lv2_wrapper->bind_key_double<"time_r", "time-r">(settings); lv2_wrapper->bind_key_bool<"phase_l", "invert-phase-l">(settings); lv2_wrapper->bind_key_bool<"phase_r", "invert-phase-r">(settings); // The following controls can assume -inf lv2_wrapper->bind_key_double_db<"dry_l", "dry-l", false>(settings); lv2_wrapper->bind_key_double_db<"dry_r", "dry-r", false>(settings); lv2_wrapper->bind_key_double_db<"wet_l", "wet-l", false>(settings); lv2_wrapper->bind_key_double_db<"wet_r", "wet-r", false>(settings); setup_input_output_gain(); } Delay::~Delay() { if (connected_to_pw) { disconnect_from_pw(); } util::debug(log_tag + name + " destroyed"); } void Delay::setup() { if (!lv2_wrapper->found_plugin) { return; } lv2_wrapper->set_n_samples(n_samples); if (lv2_wrapper->get_rate() != rate) { lv2_wrapper->create_instance(rate); } } void Delay::process(std::span<float>& left_in, std::span<float>& right_in, std::span<float>& left_out, std::span<float>& right_out) { if (!lv2_wrapper->found_plugin || !lv2_wrapper->has_instance() || bypass) { std::copy(left_in.begin(), left_in.end(), left_out.begin()); std::copy(right_in.begin(), right_in.end(), right_out.begin()); return; } if (input_gain != 1.0F) { apply_gain(left_in, right_in, input_gain); } lv2_wrapper->connect_data_ports(left_in, right_in, left_out, right_out); lv2_wrapper->run(); if (output_gain != 1.0F) { apply_gain(left_out, right_out, output_gain); } /* This plugin gives the latency in number of samples */ const auto lv = static_cast<uint>(lv2_wrapper->get_control_port_value("out_latency")); if (latency_n_frames != lv) { latency_n_frames = lv; latency_value = static_cast<float>(latency_n_frames) / static_cast<float>(rate); util::debug(log_tag + name + " latency: " + util::to_string(latency_value, "") + " s"); util::idle_add([this]() { if (!post_messages || latency.empty()) { return; } latency.emit(); }); update_filter_params(); } if (post_messages) { get_peaks(left_in, right_in, left_out, right_out); if (send_notifications) { notify(); } } } auto Delay::get_latency_seconds() -> float { return latency_value; }
4,229
C++
.cpp
117
31.264957
105
0.648616
wwmm/easyeffects
6,414
268
211
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,606
deesser_ui.cpp
wwmm_easyeffects/src/deesser_ui.cpp
/* * Copyright © 2017-2024 Wellington Wallace * * This file is part of Easy Effects. * * Easy Effects is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Easy Effects is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Easy Effects. If not, see <https://www.gnu.org/licenses/>. */ #include "deesser_ui.hpp" #include <STTypes.h> #include <fmt/core.h> #include <gio/gio.h> #include <glib-object.h> #include <glib.h> #include <glibconfig.h> #include <gobject/gobject.h> #include <gtk/gtk.h> #include <gtk/gtkdropdown.h> #include <sigc++/connection.h> #include <memory> #include <string> #include <vector> #include "deesser.hpp" #include "tags_resources.hpp" #include "tags_schema.hpp" #include "ui_helpers.hpp" #include "util.hpp" namespace ui::deesser_box { struct Data { public: ~Data() { util::debug("data struct destroyed"); } uint serial = 0U; std::shared_ptr<Deesser> deesser; std::vector<sigc::connection> connections; std::vector<gulong> gconnections; }; struct _DeesserBox { GtkBox parent_instance; GtkScale *input_gain, *output_gain; GtkLevelBar *input_level_left, *input_level_right, *output_level_left, *output_level_right; GtkLabel *input_level_left_label, *input_level_right_label, *output_level_left_label, *output_level_right_label, *plugin_credit; GtkLevelBar *compression, *detected; GtkLabel *compression_label, *detected_label; GtkSpinButton *f1_freq, *f2_freq, *f1_level, *f2_level, *f2_q, *threshold, *ratio, *laxity, *makeup; GtkToggleButton* sc_listen; GtkDropDown *detection, *mode; GSettings* settings; Data* data; }; // NOLINTNEXTLINE G_DEFINE_TYPE(DeesserBox, deesser_box, GTK_TYPE_BOX) void on_reset(DeesserBox* self, GtkButton* btn) { util::reset_all_keys_except(self->settings); } void setup(DeesserBox* self, std::shared_ptr<Deesser> deesser, const std::string& schema_path) { auto serial = get_new_filter_serial(); self->data->serial = serial; g_object_set_data(G_OBJECT(self), "serial", GUINT_TO_POINTER(serial)); set_ignore_filter_idle_add(serial, false); self->data->deesser = deesser; self->settings = g_settings_new_with_path(tags::schema::deesser::id, schema_path.c_str()); deesser->set_post_messages(true); self->data->connections.push_back(deesser->input_level.connect([=](const float left, const float right) { g_object_ref(self); util::idle_add( [=]() { if (get_ignore_filter_idle_add(serial)) { return; } update_level(self->input_level_left, self->input_level_left_label, self->input_level_right, self->input_level_right_label, left, right); }, [=]() { g_object_unref(self); }); })); self->data->connections.push_back(deesser->output_level.connect([=](const float left, const float right) { g_object_ref(self); util::idle_add( [=]() { if (get_ignore_filter_idle_add(serial)) { return; } update_level(self->output_level_left, self->output_level_left_label, self->output_level_right, self->output_level_right_label, left, right); }, [=]() { g_object_unref(self); }); })); self->data->connections.push_back(deesser->detected.connect([=](const double value) { g_object_ref(self); util::idle_add( [=]() { if (get_ignore_filter_idle_add(serial)) { return; } if (!GTK_IS_LEVEL_BAR(self->compression) || !GTK_IS_LABEL(self->compression_label)) { return; } gtk_level_bar_set_value(self->compression, 1.0 - value); gtk_label_set_text(self->compression_label, fmt::format("{0:.0f}", util::linear_to_db(value)).c_str()); }, [=]() { g_object_unref(self); }); })); self->data->connections.push_back(deesser->compression.connect([=](const double value) { g_object_ref(self); util::idle_add( [=]() { if (get_ignore_filter_idle_add(serial)) { return; } if (!GTK_IS_LEVEL_BAR(self->detected) || !GTK_IS_LABEL(self->detected_label)) { return; } gtk_level_bar_set_value(self->detected, value); gtk_label_set_text(self->detected_label, fmt::format("{0:.0f}", util::linear_to_db(value)).c_str()); }, [=]() { g_object_unref(self); }); })); gtk_label_set_text(self->plugin_credit, ui::get_plugin_credit_translated(self->data->deesser->package).c_str()); gsettings_bind_widgets<"input-gain", "output-gain">(self->settings, self->input_gain, self->output_gain); g_settings_bind(self->settings, "makeup", gtk_spin_button_get_adjustment(self->makeup), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "ratio", gtk_spin_button_get_adjustment(self->ratio), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "threshold", gtk_spin_button_get_adjustment(self->threshold), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "f1-freq", gtk_spin_button_get_adjustment(self->f1_freq), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "f2-freq", gtk_spin_button_get_adjustment(self->f2_freq), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "f1-level", gtk_spin_button_get_adjustment(self->f1_level), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "f2-level", gtk_spin_button_get_adjustment(self->f2_level), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "f2-q", gtk_spin_button_get_adjustment(self->f2_q), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "laxity", gtk_spin_button_get_adjustment(self->laxity), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, "sc-listen", self->sc_listen, "active", G_SETTINGS_BIND_DEFAULT); ui::gsettings_bind_enum_to_combo_widget(self->settings, "detection", self->detection); ui::gsettings_bind_enum_to_combo_widget(self->settings, "mode", self->mode); } void dispose(GObject* object) { auto* self = EE_DEESSER_BOX(object); set_ignore_filter_idle_add(self->data->serial, true); for (auto& c : self->data->connections) { c.disconnect(); } for (auto& handler_id : self->data->gconnections) { g_signal_handler_disconnect(self->settings, handler_id); } self->data->connections.clear(); self->data->gconnections.clear(); g_object_unref(self->settings); util::debug("disposed"); G_OBJECT_CLASS(deesser_box_parent_class)->dispose(object); } void finalize(GObject* object) { auto* self = EE_DEESSER_BOX(object); delete self->data; util::debug("finalized"); G_OBJECT_CLASS(deesser_box_parent_class)->finalize(object); } void deesser_box_class_init(DeesserBoxClass* klass) { auto* object_class = G_OBJECT_CLASS(klass); auto* widget_class = GTK_WIDGET_CLASS(klass); object_class->finalize = finalize; object_class->dispose = dispose; gtk_widget_class_set_template_from_resource(widget_class, tags::resources::deesser_ui); gtk_widget_class_bind_template_child(widget_class, DeesserBox, input_gain); gtk_widget_class_bind_template_child(widget_class, DeesserBox, output_gain); gtk_widget_class_bind_template_child(widget_class, DeesserBox, input_level_left); gtk_widget_class_bind_template_child(widget_class, DeesserBox, input_level_right); gtk_widget_class_bind_template_child(widget_class, DeesserBox, output_level_left); gtk_widget_class_bind_template_child(widget_class, DeesserBox, output_level_right); gtk_widget_class_bind_template_child(widget_class, DeesserBox, input_level_left_label); gtk_widget_class_bind_template_child(widget_class, DeesserBox, input_level_right_label); gtk_widget_class_bind_template_child(widget_class, DeesserBox, output_level_left_label); gtk_widget_class_bind_template_child(widget_class, DeesserBox, output_level_right_label); gtk_widget_class_bind_template_child(widget_class, DeesserBox, plugin_credit); gtk_widget_class_bind_template_child(widget_class, DeesserBox, compression); gtk_widget_class_bind_template_child(widget_class, DeesserBox, compression_label); gtk_widget_class_bind_template_child(widget_class, DeesserBox, detected); gtk_widget_class_bind_template_child(widget_class, DeesserBox, detected_label); gtk_widget_class_bind_template_child(widget_class, DeesserBox, sc_listen); gtk_widget_class_bind_template_child(widget_class, DeesserBox, detection); gtk_widget_class_bind_template_child(widget_class, DeesserBox, mode); gtk_widget_class_bind_template_child(widget_class, DeesserBox, f1_freq); gtk_widget_class_bind_template_child(widget_class, DeesserBox, f2_freq); gtk_widget_class_bind_template_child(widget_class, DeesserBox, f1_level); gtk_widget_class_bind_template_child(widget_class, DeesserBox, f2_level); gtk_widget_class_bind_template_child(widget_class, DeesserBox, f2_q); gtk_widget_class_bind_template_child(widget_class, DeesserBox, threshold); gtk_widget_class_bind_template_child(widget_class, DeesserBox, ratio); gtk_widget_class_bind_template_child(widget_class, DeesserBox, laxity); gtk_widget_class_bind_template_child(widget_class, DeesserBox, makeup); gtk_widget_class_bind_template_callback(widget_class, on_reset); } void deesser_box_init(DeesserBox* self) { gtk_widget_init_template(GTK_WIDGET(self)); self->data = new Data(); prepare_spinbuttons<"dB">(self->makeup, self->threshold, self->f1_level, self->f2_level); prepare_spinbuttons<"Hz">(self->f1_freq, self->f2_freq); prepare_spinbuttons<"">(self->f2_q); prepare_scales<"dB">(self->input_gain, self->output_gain); } auto create() -> DeesserBox* { return static_cast<DeesserBox*>(g_object_new(EE_TYPE_DEESSER_BOX, nullptr)); } } // namespace ui::deesser_box
10,429
C++
.cpp
218
42.779817
120
0.698322
wwmm/easyeffects
6,414
268
211
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,607
bass_enhancer_preset.cpp
wwmm_easyeffects/src/bass_enhancer_preset.cpp
/* * Copyright © 2017-2024 Wellington Wallace * * This file is part of Easy Effects. * * Easy Effects is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Easy Effects is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Easy Effects. If not, see <https://www.gnu.org/licenses/>. */ #include "bass_enhancer_preset.hpp" #include <gio/gio.h> #include <nlohmann/json_fwd.hpp> #include "plugin_preset_base.hpp" #include "preset_type.hpp" #include "tags_plugin_name.hpp" #include "tags_schema.hpp" #include "util.hpp" BassEnhancerPreset::BassEnhancerPreset(PresetType preset_type, const int& index) : PluginPresetBase(tags::schema::bass_enhancer::id, tags::schema::bass_enhancer::input_path, tags::schema::bass_enhancer::output_path, preset_type, index) { instance_name.assign(tags::plugin_name::bass_enhancer).append("#").append(util::to_string(index)); } void BassEnhancerPreset::save(nlohmann::json& json) { json[section][instance_name]["bypass"] = g_settings_get_boolean(settings, "bypass") != 0; json[section][instance_name]["input-gain"] = g_settings_get_double(settings, "input-gain"); json[section][instance_name]["output-gain"] = g_settings_get_double(settings, "output-gain"); json[section][instance_name]["amount"] = g_settings_get_double(settings, "amount"); json[section][instance_name]["harmonics"] = g_settings_get_double(settings, "harmonics"); json[section][instance_name]["scope"] = g_settings_get_double(settings, "scope"); json[section][instance_name]["floor"] = g_settings_get_double(settings, "floor"); json[section][instance_name]["blend"] = g_settings_get_double(settings, "blend"); json[section][instance_name]["floor-active"] = g_settings_get_boolean(settings, "floor-active") != 0; } void BassEnhancerPreset::load(const nlohmann::json& json) { update_key<bool>(json.at(section).at(instance_name), settings, "bypass", "bypass"); update_key<double>(json.at(section).at(instance_name), settings, "input-gain", "input-gain"); update_key<double>(json.at(section).at(instance_name), settings, "output-gain", "output-gain"); update_key<double>(json.at(section).at(instance_name), settings, "amount", "amount"); update_key<double>(json.at(section).at(instance_name), settings, "harmonics", "harmonics"); update_key<double>(json.at(section).at(instance_name), settings, "scope", "scope"); update_key<double>(json.at(section).at(instance_name), settings, "floor", "floor"); update_key<double>(json.at(section).at(instance_name), settings, "blend", "blend"); update_key<bool>(json.at(section).at(instance_name), settings, "floor-active", "floor-active"); }
3,192
C++
.cpp
56
52.946429
103
0.713736
wwmm/easyeffects
6,414
268
211
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,608
equalizer_band_box.cpp
wwmm_easyeffects/src/equalizer_band_box.cpp
/* * Copyright © 2017-2024 Wellington Wallace * * This file is part of Easy Effects. * * Easy Effects is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Easy Effects is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Easy Effects. If not, see <https://www.gnu.org/licenses/>. */ #include "equalizer_band_box.hpp" #include <adwaita.h> #include <fmt/core.h> #include <fmt/format.h> #include <gio/gio.h> #include <glib-object.h> #include <glib.h> #include <gobject/gobject.h> #include <gtk/gtk.h> #include "tags_app.hpp" #include "tags_equalizer.hpp" #include "tags_resources.hpp" #include "ui_helpers.hpp" #include "util.hpp" namespace ui::equalizer_band_box { using namespace tags::equalizer; struct Data { public: ~Data() { util::debug("data struct destroyed"); } int index = 0; // index in the gsettings database }; struct _EqualizerBandBox { GtkBox parent_instance; AdwComboRow *band_type, *band_mode, *band_slope; GtkButton *reset_frequency, *reset_quality; GtkSwitch *band_solo, *band_mute; GtkScale* band_scale; GtkSpinButton *band_frequency, *band_gain, *band_quality, *band_width; GtkPopover* popover_menu; GtkLabel* band_number_label; GSettings *settings, *app_settings; Data* data; }; // NOLINTNEXTLINE G_DEFINE_TYPE(EqualizerBandBox, equalizer_band_box, GTK_TYPE_BOX) void on_reset_frequency(EqualizerBandBox* self, GtkButton* btn) { g_settings_reset(self->settings, band_frequency[self->data->index].data()); } void on_reset_gain(EqualizerBandBox* self, GtkButton* btn) { g_settings_reset(self->settings, band_gain[self->data->index].data()); } void on_reset_quality(EqualizerBandBox* self, GtkButton* btn) { g_settings_reset(self->settings, band_q[self->data->index].data()); } void on_reset_width(EqualizerBandBox* self, GtkButton* btn) { g_settings_reset(self->settings, band_width[self->data->index].data()); } auto set_band_label(EqualizerBandBox* self, double value) -> const char* { if (value < 1000.0) { // Show no decimal digits: full integer. No need of locale. return g_strdup(fmt::format("{0:.0f} Hz", value).c_str()); } // Convert in kHz and show hHz as 1 decimal digit. Use locale. return g_strdup(fmt::format(ui::get_user_locale(), "{0:.1Lf} kHz", value / 1000.0).c_str()); } auto set_band_quality_label(EqualizerBandBox* self, double value) -> const char* { return g_strdup(fmt::format(ui::get_user_locale(), "Q {0:.2Lf}", value).c_str()); } auto set_band_gain_sensitive(EqualizerBandBox* self, const guint selected_id) -> gboolean { switch (selected_id) { case 0U: // Off case 2U: // High Pass case 4U: // Low Pass return 0; default: break; } return 1; } auto set_band_width_sensitive(EqualizerBandBox* self, const guint selected_id) -> gboolean { switch (selected_id) { case 9U: // Band Pass case 10U: // Ladder Pass case 11U: // Ladder Rej return 1; default: break; } return 0; } void setup(EqualizerBandBox* self, GSettings* settings) { self->settings = settings; } void bind(EqualizerBandBox* self, int index) { self->data->index = index; gtk_label_set_text(self->band_number_label, util::to_string(index + 1).c_str()); g_settings_bind(self->settings, band_gain[index].data(), gtk_range_get_adjustment(GTK_RANGE(self->band_scale)), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, band_frequency[index].data(), gtk_spin_button_get_adjustment(self->band_frequency), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, band_q[index].data(), gtk_spin_button_get_adjustment(self->band_quality), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, band_width[index].data(), gtk_spin_button_get_adjustment(self->band_width), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, band_solo[index].data(), self->band_solo, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind(self->settings, band_mute[index].data(), self->band_mute, "active", G_SETTINGS_BIND_DEFAULT); ui::gsettings_bind_enum_to_combo_widget(self->settings, band_type[index].data(), self->band_type); ui::gsettings_bind_enum_to_combo_widget(self->settings, band_mode[index].data(), self->band_mode); ui::gsettings_bind_enum_to_combo_widget(self->settings, band_slope[index].data(), self->band_slope); } void dispose(GObject* object) { auto* self = EE_EQUALIZER_BAND_BOX(object); g_object_unref(self->app_settings); util::debug("index: " + util::to_string(self->data->index) + " disposed"); G_OBJECT_CLASS(equalizer_band_box_parent_class)->dispose(object); } void finalize(GObject* object) { auto* self = EE_EQUALIZER_BAND_BOX(object); delete self->data; util::debug("finalized"); G_OBJECT_CLASS(equalizer_band_box_parent_class)->finalize(object); } void equalizer_band_box_class_init(EqualizerBandBoxClass* klass) { auto* object_class = G_OBJECT_CLASS(klass); auto* widget_class = GTK_WIDGET_CLASS(klass); object_class->dispose = dispose; object_class->finalize = finalize; gtk_widget_class_set_template_from_resource(widget_class, tags::resources::equalizer_band_ui); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, band_type); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, band_mode); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, band_slope); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, reset_frequency); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, reset_quality); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, band_solo); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, band_mute); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, band_scale); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, band_frequency); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, band_gain); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, band_quality); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, band_width); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, popover_menu); gtk_widget_class_bind_template_child(widget_class, EqualizerBandBox, band_number_label); gtk_widget_class_bind_template_callback(widget_class, on_reset_frequency); gtk_widget_class_bind_template_callback(widget_class, on_reset_gain); gtk_widget_class_bind_template_callback(widget_class, on_reset_quality); gtk_widget_class_bind_template_callback(widget_class, on_reset_width); gtk_widget_class_bind_template_callback(widget_class, set_band_gain_sensitive); gtk_widget_class_bind_template_callback(widget_class, set_band_width_sensitive); gtk_widget_class_bind_template_callback(widget_class, set_band_label); gtk_widget_class_bind_template_callback(widget_class, set_band_quality_label); } void equalizer_band_box_init(EqualizerBandBox* self) { gtk_widget_init_template(GTK_WIDGET(self)); self->data = new Data(); self->app_settings = g_settings_new(tags::app::id); g_settings_bind(self->app_settings, "autohide-popovers", self->popover_menu, "autohide", G_SETTINGS_BIND_DEFAULT); prepare_scales<"">(self->band_scale); prepare_spinbuttons<"Hz">(self->band_frequency); prepare_spinbuttons<"dB">(self->band_gain); prepare_spinbuttons<"">(self->band_quality); prepare_spinbuttons<"oct">(self->band_width); } auto create() -> EqualizerBandBox* { return static_cast<EqualizerBandBox*>(g_object_new(EE_TYPE_EQUALIZER_BAND_BOX, nullptr)); } } // namespace ui::equalizer_band_box
8,221
C++
.cpp
174
44.04023
118
0.736631
wwmm/easyeffects
6,414
268
211
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24,609
presets_menu.cpp
wwmm_easyeffects/src/presets_menu.cpp
/* * Copyright © 2017-2024 Wellington Wallace * * This file is part of Easy Effects. * * Easy Effects is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Easy Effects is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Easy Effects. If not, see <https://www.gnu.org/licenses/>. */ #include "presets_menu.hpp" #include <STTypes.h> #include <adwaita.h> #include <gio/gio.h> #include <glib.h> #include <glib/gi18n.h> #include <glibconfig.h> #include <gobject/gobject.h> #include <gtk/gtk.h> #include <gtk/gtkexpression.h> #include <gtk/gtkshortcut.h> #include <gtk/gtkstringfilter.h> #include <sigc++/connection.h> #include <regex> #include <string> #include <vector> #include "application.hpp" #include "preset_type.hpp" #include "tags_app.hpp" #include "tags_resources.hpp" #include "util.hpp" namespace ui::presets_menu { struct Data { public: ~Data() { util::debug("data struct destroyed"); } app::Application* application; PresetType preset_type; std::vector<sigc::connection> connections; std::vector<gulong> gconnections; }; struct _PresetsMenu { GtkPopover parent_instance; AdwViewStack* stack; GtkScrolledWindow *scrolled_window_local, *scrolled_window_community; GtkBox* community_main_box; GtkListView *listview_local, *listview_community; AdwStatusPage* status_page_community_list; GtkText* new_preset_name; GtkLabel *last_loaded_preset_title, *last_loaded_preset_value; GtkStringList *presets_list_local, *presets_list_community; GtkSearchEntry* search_community; GtkStringFilter* filter_string_community; GtkButton* refresh_community_list; GSettings* settings; Data* data; }; // NOLINTNEXTLINE G_DEFINE_TYPE(PresetsMenu, presets_menu, GTK_TYPE_POPOVER) auto closure_community_search_filter(PresetsMenu* self, const char* text) -> const char* { const std::string preset_path{text}; static const auto re_preset_name = std::regex(R"([^/]+$)"); std::smatch name_match; std::regex_search(preset_path.cbegin(), preset_path.cend(), name_match, re_preset_name); return (name_match.size() == 1U) ? g_strdup(name_match.str(0).c_str()) : ""; } void create_preset(PresetsMenu* self, GtkButton* button) { std::string name = g_utf8_make_valid(gtk_editable_get_text(GTK_EDITABLE(self->new_preset_name)), -1); // Reset input field. gtk_editable_set_text(GTK_EDITABLE(self->new_preset_name), ""); // Remove leading and trailing whitespaces. util::str_trim(name); static const auto json_ext_re = std::regex(R"((?:\.+json)+$)", std::regex::icase); // Remove the json extension at the end, if present // (it will be added in PresetsManager::add()). if (std::smatch sm; std::regex_search(name, sm, json_ext_re)) { name = std::regex_replace(name, json_ext_re, ""); } // Check if empty. if (name.empty()) { return; } // Truncate if the name is longer than 100 characters. if (const auto max_length = 100U; name.size() > max_length) { name.resize(max_length); } // Check for illegal characters. if (name.find_first_of("\\/") != std::string::npos) { util::warning(" name " + name + " has illegal file name characters. Aborting preset creation!"); return; } self->data->application->presets_manager->add(self->data->preset_type, name); } void import_preset_from_disk(PresetsMenu* self) { auto* active_window = gtk_application_get_active_window(GTK_APPLICATION(self->data->application)); auto* dialog = gtk_file_dialog_new(); gtk_file_dialog_set_title(dialog, _("Import Preset")); gtk_file_dialog_set_accept_label(dialog, _("Open")); // Open the dialog from the user home folder. auto* init_folder = g_file_new_for_path(g_get_home_dir()); gtk_file_dialog_set_initial_folder(dialog, init_folder); g_object_unref(init_folder); GListStore* filters = g_list_store_new(GTK_TYPE_FILE_FILTER); auto* filter = gtk_file_filter_new(); gtk_file_filter_add_pattern(filter, "*.json"); gtk_file_filter_set_name(filter, _("Presets")); g_list_store_append(filters, filter); g_object_unref(filter); gtk_file_dialog_set_filters(dialog, G_LIST_MODEL(filters)); g_object_unref(filters); gtk_file_dialog_open_multiple( dialog, active_window, nullptr, +[](GObject* source_object, GAsyncResult* result, gpointer user_data) { auto* self = static_cast<PresetsMenu*>(user_data); auto* dialog = GTK_FILE_DIALOG(source_object); auto* files_list = gtk_file_dialog_open_multiple_finish(dialog, result, nullptr); if (files_list == nullptr) { return; } for (guint n = 0U; n < g_list_model_get_n_items(files_list); n++) { auto* file = static_cast<GFile*>(g_list_model_get_item(files_list, n)); auto* path = g_file_get_path(file); if (self->data->preset_type == PresetType::output) { self->data->application->presets_manager->import_from_filesystem(PresetType::output, path); } else if (self->data->preset_type == PresetType::input) { self->data->application->presets_manager->import_from_filesystem(PresetType::input, path); } g_free(path); } g_object_unref(files_list); }, self); } template <PresetType preset_type> void setup_community_presets_listview(PresetsMenu* self, GtkListView* listview_community, GtkStringList* presets_list_community) { auto* factory = gtk_signal_list_item_factory_new(); // setting the factory callbacks g_signal_connect( factory, "setup", G_CALLBACK(+[](GtkSignalListItemFactory* factory, GtkListItem* item, PresetsMenu* self) { auto builder = gtk_builder_new_from_resource(tags::resources::preset_row_community_ui); auto* top_box = gtk_builder_get_object(builder, "top_box"); auto* name = gtk_builder_get_object(builder, "name"); auto* package = gtk_builder_get_object(builder, "package"); auto* try_bt = gtk_builder_get_object(builder, "try"); auto* import = gtk_builder_get_object(builder, "import"); g_object_set_data(G_OBJECT(item), "name", name); g_object_set_data(G_OBJECT(item), "package", package); g_object_set_data(G_OBJECT(item), "try", try_bt); g_object_set_data(G_OBJECT(item), "import", import); gtk_list_item_set_activatable(item, 0); gtk_list_item_set_child(item, GTK_WIDGET(top_box)); g_signal_connect(try_bt, "clicked", G_CALLBACK(+[](GtkButton* button, PresetsMenu* self) { auto* string_object_preset = GTK_STRING_OBJECT(g_object_get_data(G_OBJECT(button), "string-object-preset")); auto* label_package = GTK_LABEL(g_object_get_data(G_OBJECT(button), "gtk-label-package-name")); if (string_object_preset == nullptr || label_package == nullptr) { return; } const std::string preset_path = gtk_string_object_get_string(string_object_preset); const std::string preset_package = gtk_label_get_text(label_package); self->data->application->presets_manager->load_community_preset_file( preset_type, preset_path, preset_package); }), self); g_signal_connect(import, "clicked", G_CALLBACK(+[](GtkButton* button, PresetsMenu* self) { auto* string_object_preset = GTK_STRING_OBJECT(g_object_get_data(G_OBJECT(button), "string-object-preset")); auto* label_package = GTK_LABEL(g_object_get_data(G_OBJECT(button), "gtk-label-package-name")); if (string_object_preset == nullptr || label_package == nullptr) { return; } // community presets are indexed by full_path using stem filenames, // so we need to append the json extension. const std::string preset_path = gtk_string_object_get_string(string_object_preset) + self->data->application->presets_manager->json_ext; const std::string preset_package = gtk_label_get_text(label_package); self->data->application->presets_manager->import_from_community_package( preset_type, preset_path, preset_package); }), self); g_object_unref(builder); }), self); g_signal_connect(factory, "bind", G_CALLBACK(+[](GtkSignalListItemFactory* factory, GtkListItem* item, PresetsMenu* self) { auto* name = static_cast<GtkLabel*>(g_object_get_data(G_OBJECT(item), "name")); auto* package = static_cast<GtkLabel*>(g_object_get_data(G_OBJECT(item), "package")); auto* try_bt = static_cast<GtkButton*>(g_object_get_data(G_OBJECT(item), "try")); auto* import = static_cast<GtkButton*>(g_object_get_data(G_OBJECT(item), "import")); // Get the full path of the community preset item. auto* preset_path = GTK_STRING_OBJECT(gtk_list_item_get_item(item)); // Save community preset path in try and import buttons. g_object_set_data(G_OBJECT(try_bt), "string-object-preset", preset_path); g_object_set_data(G_OBJECT(import), "string-object-preset", preset_path); auto* full_cp_path = gtk_string_object_get_string(preset_path); // Extract package name and preset name from the full path. const auto cp_info = self->data->application->presets_manager->get_community_preset_info(preset_type, full_cp_path); // Set labels. gtk_label_set_text(name, cp_info.first.c_str()); gtk_label_set_text(package, cp_info.second.c_str()); // Save community preset package label in try and import buttons. g_object_set_data(G_OBJECT(try_bt), "gtk-label-package-name", package); g_object_set_data(G_OBJECT(import), "gtk-label-package-name", package); }), self); auto refresh_community_listview = +[](GtkButton* button, PresetsMenu* self) { // Empty the list, if it's populated. if (const auto n_items = g_list_model_get_n_items(G_LIST_MODEL(self->presets_list_community)); n_items != 0U) { gtk_string_list_splice(self->presets_list_community, 0U, n_items, nullptr); } const auto cp_paths = self->data->application->presets_manager->get_all_community_presets_paths(preset_type); // If there are no paths, show the AdwStatusPage and exit. if (cp_paths.empty()) { gtk_widget_set_visible(GTK_WIDGET(self->community_main_box), 0); gtk_widget_set_visible(GTK_WIDGET(self->status_page_community_list), 1); return; } // If there are paths, fill the empty list and hide the AdwStatusPage. for (const auto& path : cp_paths) { gtk_string_list_append(self->presets_list_community, path.c_str()); } gtk_widget_set_visible(GTK_WIDGET(self->status_page_community_list), 0); gtk_widget_set_visible(GTK_WIDGET(self->community_main_box), 1); }; g_signal_connect(self->refresh_community_list, "clicked", G_CALLBACK(refresh_community_listview), self); gtk_list_view_set_factory(listview_community, factory); g_object_unref(factory); // Initialize the list refresh_community_listview(self->refresh_community_list, self); } template <PresetType preset_type> void setup_local_presets_listview(PresetsMenu* self, GtkListView* listview_local, GtkStringList* presets_list_local) { auto* factory = gtk_signal_list_item_factory_new(); // setting the factory callbacks g_signal_connect( factory, "setup", G_CALLBACK(+[](GtkSignalListItemFactory* factory, GtkListItem* item, PresetsMenu* self) { auto builder = gtk_builder_new_from_resource(tags::resources::preset_row_ui); auto* top_box = gtk_builder_get_object(builder, "top_box"); auto* apply = gtk_builder_get_object(builder, "apply"); auto* save = gtk_builder_get_object(builder, "save"); auto* remove = gtk_builder_get_object(builder, "remove"); auto* confirmation_box = gtk_builder_get_object(builder, "confirmation_box"); auto* confirmation_label = gtk_builder_get_object(builder, "confirmation_label"); auto* confirmation_yes = gtk_builder_get_object(builder, "confirmation_yes"); auto* confirmation_no = gtk_builder_get_object(builder, "confirmation_no"); g_object_set_data(G_OBJECT(item), "name", gtk_builder_get_object(builder, "name")); g_object_set_data(G_OBJECT(item), "apply", apply); g_object_set_data(G_OBJECT(item), "confirmation_yes", confirmation_yes); g_object_set_data(G_OBJECT(save), "confirmation_box", confirmation_box); g_object_set_data(G_OBJECT(save), "confirmation_label", confirmation_label); g_object_set_data(G_OBJECT(save), "confirmation_yes", confirmation_yes); g_object_set_data(G_OBJECT(remove), "confirmation_box", confirmation_box); g_object_set_data(G_OBJECT(remove), "confirmation_label", confirmation_label); g_object_set_data(G_OBJECT(remove), "confirmation_yes", confirmation_yes); g_object_set_data(G_OBJECT(confirmation_yes), "confirmation_box", confirmation_box); g_object_set_data(G_OBJECT(confirmation_yes), "confirmation_label", confirmation_label); g_object_set_data(G_OBJECT(confirmation_no), "confirmation_label", confirmation_label); gtk_list_item_set_activatable(item, 0); gtk_list_item_set_child(item, GTK_WIDGET(top_box)); g_signal_connect( apply, "clicked", G_CALLBACK(+[](GtkButton* button, PresetsMenu* self) { if (auto* string_object = GTK_STRING_OBJECT(g_object_get_data(G_OBJECT(button), "string-object")); string_object != nullptr) { auto* preset_name = gtk_string_object_get_string(string_object); self->data->application->presets_manager->load_local_preset_file(preset_type, preset_name); } }), self); g_signal_connect( save, "clicked", G_CALLBACK(+[](GtkButton* button, PresetsMenu* self) { auto* confirmation_box = static_cast<GtkBox*>(g_object_get_data(G_OBJECT(button), "confirmation_box")); auto* confirmation_label = static_cast<GtkLabel*>(g_object_get_data(G_OBJECT(button), "confirmation_label")); auto* confirmation_yes = static_cast<GtkLabel*>(g_object_get_data(G_OBJECT(button), "confirmation_yes")); gtk_label_set_text(confirmation_label, _("Save?")); gtk_widget_add_css_class(GTK_WIDGET(confirmation_label), "warning"); gtk_widget_set_visible(GTK_WIDGET(confirmation_box), 1); g_object_set_data(G_OBJECT(confirmation_yes), "operation", GUINT_TO_POINTER(0)); }), self); g_signal_connect( remove, "clicked", G_CALLBACK(+[](GtkButton* button, PresetsMenu* self) { auto* confirmation_box = static_cast<GtkBox*>(g_object_get_data(G_OBJECT(button), "confirmation_box")); auto* confirmation_label = static_cast<GtkLabel*>(g_object_get_data(G_OBJECT(button), "confirmation_label")); auto* confirmation_yes = static_cast<GtkLabel*>(g_object_get_data(G_OBJECT(button), "confirmation_yes")); gtk_label_set_text(confirmation_label, _("Delete?")); gtk_widget_add_css_class(GTK_WIDGET(confirmation_label), "error"); gtk_widget_set_visible(GTK_WIDGET(confirmation_box), 1); g_object_set_data(G_OBJECT(confirmation_yes), "operation", GUINT_TO_POINTER(1)); }), self); g_signal_connect(confirmation_no, "clicked", G_CALLBACK(+[](GtkButton* button, GtkBox* box) { gtk_widget_set_visible(GTK_WIDGET(box), 0); auto* confirmation_label = static_cast<GtkBox*>(g_object_get_data(G_OBJECT(button), "confirmation_label")); gtk_widget_remove_css_class(GTK_WIDGET(confirmation_label), "warning"); gtk_widget_remove_css_class(GTK_WIDGET(confirmation_label), "error"); }), confirmation_box); g_signal_connect( confirmation_yes, "clicked", G_CALLBACK(+[](GtkButton* button, PresetsMenu* self) { if (auto* string_object = GTK_STRING_OBJECT(g_object_get_data(G_OBJECT(button), "string-object")); string_object != nullptr) { auto* preset_name = gtk_string_object_get_string(string_object); const uint operation = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(button), "operation")); auto* confirmation_label = static_cast<GtkBox*>(g_object_get_data(G_OBJECT(button), "confirmation_label")); switch (operation) { case 0U: { // save if constexpr (preset_type == PresetType::output) { self->data->application->presets_manager->save_preset_file(PresetType::output, preset_name); } else if constexpr (preset_type == PresetType::input) { self->data->application->presets_manager->save_preset_file(PresetType::input, preset_name); } gtk_widget_remove_css_class(GTK_WIDGET(confirmation_label), "warning"); break; } case 1U: { // delete if constexpr (preset_type == PresetType::output) { self->data->application->presets_manager->remove(PresetType::output, preset_name); } else if constexpr (preset_type == PresetType::input) { self->data->application->presets_manager->remove(PresetType::input, preset_name); } gtk_widget_remove_css_class(GTK_WIDGET(confirmation_label), "error"); break; } default: break; } } auto* confirmation_box = static_cast<GtkBox*>(g_object_get_data(G_OBJECT(button), "confirmation_box")); gtk_widget_set_visible(GTK_WIDGET(confirmation_box), 0); }), self); g_object_unref(builder); }), self); g_signal_connect( factory, "bind", G_CALLBACK(+[](GtkSignalListItemFactory* factory, GtkListItem* item, PresetsMenu* self) { auto* label = static_cast<GtkLabel*>(g_object_get_data(G_OBJECT(item), "name")); auto* apply = static_cast<GtkButton*>(g_object_get_data(G_OBJECT(item), "apply")); auto* confirmation_yes = static_cast<GtkButton*>(g_object_get_data(G_OBJECT(item), "confirmation_yes")); auto* string_object = GTK_STRING_OBJECT(gtk_list_item_get_item(item)); g_object_set_data(G_OBJECT(apply), "string-object", string_object); g_object_set_data(G_OBJECT(confirmation_yes), "string-object", string_object); auto* name = gtk_string_object_get_string(string_object); gtk_label_set_text(label, name); }), self); gtk_list_view_set_factory(listview_local, factory); g_object_unref(factory); for (const auto& name : self->data->application->presets_manager->get_local_presets_name(preset_type)) { gtk_string_list_append(presets_list_local, name.c_str()); } } void setup(PresetsMenu* self, app::Application* application, PresetType preset_type) { self->data->application = application; self->data->preset_type = preset_type; auto add_to_list = [=](const std::string& preset_name) { if (preset_name.empty()) { util::warning("can't retrieve information about the preset file"); return; } for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->presets_list_local)); n++) { if (preset_name == gtk_string_list_get_string(self->presets_list_local, n)) { return; } } gtk_string_list_append(self->presets_list_local, preset_name.c_str()); }; auto remove_from_list = [=](const std::string& preset_name) { if (preset_name.empty()) { util::warning("can't retrieve information about the preset file"); return; } for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->presets_list_local)); n++) { if (preset_name == gtk_string_list_get_string(self->presets_list_local, n)) { gtk_string_list_remove(self->presets_list_local, n); return; } } }; auto update_last_used_preset_labels = +[](GSettings* settings, const char* key, gpointer user_data) { auto* self = static_cast<PresetsMenu*>(user_data); const std::string preset_name = util::gsettings_get_string(settings, key); if (preset_name.empty()) { gtk_widget_set_visible(GTK_WIDGET(self->last_loaded_preset_value), 0); gtk_label_set_text(self->last_loaded_preset_value, ""); gtk_label_set_text(self->last_loaded_preset_title, _("No Preset Loaded")); return; } gtk_widget_set_visible(GTK_WIDGET(self->last_loaded_preset_value), 1); gtk_label_set_text(self->last_loaded_preset_value, preset_name.c_str()); const auto* lcp_key = (self->data->preset_type == PresetType::input) ? "last-loaded-input-community-package" : "last-loaded-output-community-package"; const std::string community_package = util::gsettings_get_string(settings, lcp_key); const std::string preset_title = ((community_package.empty()) ? _("Last Local Preset Loaded") : _("Last Community Preset Loaded")); gtk_label_set_text(self->last_loaded_preset_title, preset_title.c_str()); }; if (preset_type == PresetType::output) { setup_community_presets_listview<PresetType::output>(self, self->listview_community, self->presets_list_community); setup_local_presets_listview<PresetType::output>(self, self->listview_local, self->presets_list_local); self->data->connections.push_back( self->data->application->presets_manager->user_output_preset_created.connect(add_to_list)); self->data->connections.push_back( self->data->application->presets_manager->user_output_preset_removed.connect(remove_from_list)); self->data->gconnections.push_back(g_signal_connect(self->settings, "changed::last-loaded-output-preset", G_CALLBACK(update_last_used_preset_labels), self)); // reset last loaded preset label const auto names_output = self->data->application->presets_manager->get_local_presets_name(PresetType::output); const std::string preset_name = util::gsettings_get_string(self->settings, "last-loaded-output-preset"); bool reset_key = true; if (!preset_name.empty()) { for (const auto& name : names_output) { if (name == preset_name) { reset_key = false; break; } } } else { reset_key = false; } if (reset_key) { // reset non-empty key and trigger the changed signal g_settings_reset(self->settings, "last-loaded-output-preset"); } else { // no need to reset, just update the labels update_last_used_preset_labels(self->settings, "last-loaded-output-preset", self); } } else if (preset_type == PresetType::input) { setup_community_presets_listview<PresetType::input>(self, self->listview_community, self->presets_list_community); setup_local_presets_listview<PresetType::input>(self, self->listview_local, self->presets_list_local); self->data->connections.push_back( self->data->application->presets_manager->user_input_preset_created.connect(add_to_list)); self->data->connections.push_back( self->data->application->presets_manager->user_input_preset_removed.connect(remove_from_list)); self->data->gconnections.push_back(g_signal_connect(self->settings, "changed::last-loaded-input-preset", G_CALLBACK(update_last_used_preset_labels), self)); // reset last loaded preset label const auto names_input = self->data->application->presets_manager->get_local_presets_name(PresetType::input); const std::string preset_name = util::gsettings_get_string(self->settings, "last-loaded-input-preset"); bool reset_key = true; if (!preset_name.empty()) { for (const auto& name : names_input) { if (name == preset_name) { reset_key = false; break; } } } else { reset_key = false; } if (reset_key) { // reset non-empty key and trigger the changed signal g_settings_reset(self->settings, "last-loaded-input-preset"); } else { // no need to reset, just update the labels update_last_used_preset_labels(self->settings, "last-loaded-input-preset", self); } } } void show(GtkWidget* widget) { auto* self = EE_PRESETS_MENU(widget); auto* active_window = gtk_application_get_active_window(GTK_APPLICATION(self->data->application)); auto active_window_height = gtk_widget_get_height(GTK_WIDGET(active_window)); const int menu_height = static_cast<int>(0.5F * static_cast<float>(active_window_height)); gtk_scrolled_window_set_max_content_height(self->scrolled_window_local, menu_height); GTK_WIDGET_CLASS(presets_menu_parent_class)->show(widget); } void dispose(GObject* object) { auto* self = EE_PRESETS_MENU(object); for (auto& c : self->data->connections) { c.disconnect(); } for (auto& handler_id : self->data->gconnections) { g_signal_handler_disconnect(self->settings, handler_id); } self->data->connections.clear(); self->data->gconnections.clear(); g_object_unref(self->settings); util::debug("disposed"); G_OBJECT_CLASS(presets_menu_parent_class)->dispose(object); } void finalize(GObject* object) { auto* self = EE_PRESETS_MENU(object); delete self->data; util::debug("finalized"); G_OBJECT_CLASS(presets_menu_parent_class)->finalize(object); } void presets_menu_class_init(PresetsMenuClass* klass) { auto* object_class = G_OBJECT_CLASS(klass); auto* widget_class = GTK_WIDGET_CLASS(klass); object_class->dispose = dispose; object_class->finalize = finalize; widget_class->show = show; gtk_widget_class_set_template_from_resource(widget_class, tags::resources::presets_menu_ui); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, presets_list_local); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, presets_list_community); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, scrolled_window_local); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, scrolled_window_community); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, new_preset_name); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, search_community); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, filter_string_community); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, listview_local); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, listview_community); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, community_main_box); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, status_page_community_list); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, refresh_community_list); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, last_loaded_preset_title); gtk_widget_class_bind_template_child(widget_class, PresetsMenu, last_loaded_preset_value); gtk_widget_class_bind_template_callback(widget_class, create_preset); gtk_widget_class_bind_template_callback(widget_class, import_preset_from_disk); gtk_widget_class_bind_template_callback(widget_class, closure_community_search_filter); } void presets_menu_init(PresetsMenu* self) { gtk_widget_init_template(GTK_WIDGET(self)); self->data = new Data(); self->settings = g_settings_new(tags::app::id); } auto create() -> PresetsMenu* { return static_cast<PresetsMenu*>(g_object_new(EE_TYPE_PRESETS_MENU, nullptr)); } } // namespace ui::presets_menu
29,611
C++
.cpp
537
45.705773
120
0.644652
wwmm/easyeffects
6,414
268
211
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false