mit neuen venv und exe-Files

This commit is contained in:
2024-11-03 17:26:54 +01:00
parent 07c05a338a
commit 0c373ff593
15115 changed files with 1998469 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
//-----------------------------------------------------------------------------
// cx_Logging.h
// Include file for managing logging.
//-----------------------------------------------------------------------------
#include <Python.h>
#include <osdefs.h>
// define platform specific variables
#ifdef MS_WINDOWS
#include <share.h>
#include <windows.h>
#define LOCK_TYPE CRITICAL_SECTION
#ifdef __GNUC__
#ifdef CX_LOGGING_CORE
#define CX_LOGGING_API(t) __declspec(dllexport) __stdcall t
#else
#define CX_LOGGING_API(t) __declspec(dllimport) __stdcall t
#endif
#else
#ifdef CX_LOGGING_CORE
#define CX_LOGGING_API(t) __declspec(dllexport) t __stdcall
#else
#define CX_LOGGING_API(t) __declspec(dllimport) t __stdcall
#endif
#endif
#else
#include <pthread.h>
#include <semaphore.h>
#define LOCK_TYPE sem_t
#define CX_LOGGING_API(t) t
#endif
// define structure for managing exception information
typedef struct {
char message[MAXPATHLEN + 1024];
} ExceptionInfo;
// define structure for managing logging state
typedef struct {
FILE *fp;
char *fileName;
char *fileNameMask;
char *prefix;
unsigned long level;
unsigned long maxFiles;
unsigned long maxFileSize;
unsigned long seqNum;
int reuseExistingFiles;
int rotateFiles;
int fileOwned;
ExceptionInfo exceptionInfo;
} LoggingState;
// define structure for managing logging state for Python
typedef struct {
PyObject_HEAD
LoggingState *state;
LOCK_TYPE lock;
} udt_LoggingState;
// define logging levels
#define LOG_LEVEL_DEBUG 10
#define LOG_LEVEL_INFO 20
#define LOG_LEVEL_WARNING 30
#define LOG_LEVEL_ERROR 40
#define LOG_LEVEL_CRITICAL 50
#define LOG_LEVEL_NONE 100
// define defaults
#define DEFAULT_MAX_FILE_SIZE 1024 * 1024
#define DEFAULT_PREFIX "%t"
// declarations of methods exported
CX_LOGGING_API(int) StartLogging(const char*, unsigned long, unsigned long,
unsigned long, const char *);
CX_LOGGING_API(int) StartLoggingEx(const char*, unsigned long, unsigned long,
unsigned long, const char *, int, int, ExceptionInfo*);
CX_LOGGING_API(int) StartLoggingForPythonThread(const char*, unsigned long,
unsigned long, unsigned long, const char *);
CX_LOGGING_API(int) StartLoggingForPythonThreadEx(const char*, unsigned long,
unsigned long, unsigned long, const char *, int, int);
CX_LOGGING_API(int) StartLoggingStderr(unsigned long, const char *);
CX_LOGGING_API(int) StartLoggingStderrEx(unsigned long, const char *,
ExceptionInfo*);
CX_LOGGING_API(int) StartLoggingStdout(unsigned long, const char *);
CX_LOGGING_API(int) StartLoggingStdoutEx(unsigned long, const char *,
ExceptionInfo*);
CX_LOGGING_API(int) StartLoggingFromEnvironment(void);
CX_LOGGING_API(void) StopLogging(void);
CX_LOGGING_API(void) StopLoggingForPythonThread(void);
CX_LOGGING_API(int) LogMessage(unsigned long, const char*);
CX_LOGGING_API(int) LogMessageV(unsigned long, const char*, ...);
CX_LOGGING_API(int) LogMessageVaList(unsigned long, const char*, va_list);
CX_LOGGING_API(int) LogMessageForPythonV(unsigned long, const char*, ...);
CX_LOGGING_API(int) WriteMessageForPython(unsigned long, PyObject*);
CX_LOGGING_API(int) LogDebug(const char*);
CX_LOGGING_API(int) LogInfo(const char*);
CX_LOGGING_API(int) LogWarning(const char*);
CX_LOGGING_API(int) LogError(const char*);
CX_LOGGING_API(int) LogCritical(const char*);
CX_LOGGING_API(int) LogTrace(const char*);
CX_LOGGING_API(unsigned long) GetLoggingLevel(void);
CX_LOGGING_API(int) SetLoggingLevel(unsigned long);
CX_LOGGING_API(int) LogPythonObject(unsigned long, const char*, const char*,
PyObject*);
CX_LOGGING_API(int) LogPythonException(const char*);
CX_LOGGING_API(int) LogPythonExceptionWithTraceback(const char*, PyObject*,
PyObject*, PyObject*);
CX_LOGGING_API(int) LogConfiguredException(PyObject*, const char*);
CX_LOGGING_API(udt_LoggingState*) GetLoggingState(void);
CX_LOGGING_API(int) SetLoggingState(udt_LoggingState*);
CX_LOGGING_API(int) IsLoggingStarted(void);
CX_LOGGING_API(int) IsLoggingAtLevelForPython(unsigned long);
#if defined MS_WINDOWS && !defined UNDER_CE
CX_LOGGING_API(int) LogWin32Error(DWORD, const char*);
CX_LOGGING_API(int) LogGUID(unsigned long, const char*, const IID*);
#endif
#ifdef MS_WINDOWS
CX_LOGGING_API(int) StartLoggingW(const WCHAR*, unsigned long, unsigned long,
unsigned long, const WCHAR*);
CX_LOGGING_API(int) StartLoggingExW(const WCHAR*, unsigned long,
unsigned long, unsigned long, const WCHAR*, int, int,
ExceptionInfo*);
CX_LOGGING_API(int) LogMessageW(unsigned long, const WCHAR*);
CX_LOGGING_API(int) LogDebugW(const WCHAR*);
CX_LOGGING_API(int) LogInfoW(const WCHAR*);
CX_LOGGING_API(int) LogWarningW(const WCHAR*);
CX_LOGGING_API(int) LogErrorW(const WCHAR*);
CX_LOGGING_API(int) LogCriticalW(const WCHAR*);
CX_LOGGING_API(int) LogTraceW(const WCHAR*);
#endif

View File

@@ -0,0 +1,164 @@
/* -*- indent-tabs-mode: nil; tab-width: 4; -*- */
/* Greenlet object interface */
#ifndef Py_GREENLETOBJECT_H
#define Py_GREENLETOBJECT_H
#include <Python.h>
#ifdef __cplusplus
extern "C" {
#endif
/* This is deprecated and undocumented. It does not change. */
#define GREENLET_VERSION "1.0.0"
#ifndef GREENLET_MODULE
#define implementation_ptr_t void*
#endif
typedef struct _greenlet {
PyObject_HEAD
PyObject* weakreflist;
PyObject* dict;
implementation_ptr_t pimpl;
} PyGreenlet;
#define PyGreenlet_Check(op) (op && PyObject_TypeCheck(op, &PyGreenlet_Type))
/* C API functions */
/* Total number of symbols that are exported */
#define PyGreenlet_API_pointers 12
#define PyGreenlet_Type_NUM 0
#define PyExc_GreenletError_NUM 1
#define PyExc_GreenletExit_NUM 2
#define PyGreenlet_New_NUM 3
#define PyGreenlet_GetCurrent_NUM 4
#define PyGreenlet_Throw_NUM 5
#define PyGreenlet_Switch_NUM 6
#define PyGreenlet_SetParent_NUM 7
#define PyGreenlet_MAIN_NUM 8
#define PyGreenlet_STARTED_NUM 9
#define PyGreenlet_ACTIVE_NUM 10
#define PyGreenlet_GET_PARENT_NUM 11
#ifndef GREENLET_MODULE
/* This section is used by modules that uses the greenlet C API */
static void** _PyGreenlet_API = NULL;
# define PyGreenlet_Type \
(*(PyTypeObject*)_PyGreenlet_API[PyGreenlet_Type_NUM])
# define PyExc_GreenletError \
((PyObject*)_PyGreenlet_API[PyExc_GreenletError_NUM])
# define PyExc_GreenletExit \
((PyObject*)_PyGreenlet_API[PyExc_GreenletExit_NUM])
/*
* PyGreenlet_New(PyObject *args)
*
* greenlet.greenlet(run, parent=None)
*/
# define PyGreenlet_New \
(*(PyGreenlet * (*)(PyObject * run, PyGreenlet * parent)) \
_PyGreenlet_API[PyGreenlet_New_NUM])
/*
* PyGreenlet_GetCurrent(void)
*
* greenlet.getcurrent()
*/
# define PyGreenlet_GetCurrent \
(*(PyGreenlet * (*)(void)) _PyGreenlet_API[PyGreenlet_GetCurrent_NUM])
/*
* PyGreenlet_Throw(
* PyGreenlet *greenlet,
* PyObject *typ,
* PyObject *val,
* PyObject *tb)
*
* g.throw(...)
*/
# define PyGreenlet_Throw \
(*(PyObject * (*)(PyGreenlet * self, \
PyObject * typ, \
PyObject * val, \
PyObject * tb)) \
_PyGreenlet_API[PyGreenlet_Throw_NUM])
/*
* PyGreenlet_Switch(PyGreenlet *greenlet, PyObject *args)
*
* g.switch(*args, **kwargs)
*/
# define PyGreenlet_Switch \
(*(PyObject * \
(*)(PyGreenlet * greenlet, PyObject * args, PyObject * kwargs)) \
_PyGreenlet_API[PyGreenlet_Switch_NUM])
/*
* PyGreenlet_SetParent(PyObject *greenlet, PyObject *new_parent)
*
* g.parent = new_parent
*/
# define PyGreenlet_SetParent \
(*(int (*)(PyGreenlet * greenlet, PyGreenlet * nparent)) \
_PyGreenlet_API[PyGreenlet_SetParent_NUM])
/*
* PyGreenlet_GetParent(PyObject* greenlet)
*
* return greenlet.parent;
*
* This could return NULL even if there is no exception active.
* If it does not return NULL, you are responsible for decrementing the
* reference count.
*/
# define PyGreenlet_GetParent \
(*(PyGreenlet* (*)(PyGreenlet*)) \
_PyGreenlet_API[PyGreenlet_GET_PARENT_NUM])
/*
* deprecated, undocumented alias.
*/
# define PyGreenlet_GET_PARENT PyGreenlet_GetParent
# define PyGreenlet_MAIN \
(*(int (*)(PyGreenlet*)) \
_PyGreenlet_API[PyGreenlet_MAIN_NUM])
# define PyGreenlet_STARTED \
(*(int (*)(PyGreenlet*)) \
_PyGreenlet_API[PyGreenlet_STARTED_NUM])
# define PyGreenlet_ACTIVE \
(*(int (*)(PyGreenlet*)) \
_PyGreenlet_API[PyGreenlet_ACTIVE_NUM])
/* Macro that imports greenlet and initializes C API */
/* NOTE: This has actually moved to ``greenlet._greenlet._C_API``, but we
keep the older definition to be sure older code that might have a copy of
the header still works. */
# define PyGreenlet_Import() \
{ \
_PyGreenlet_API = (void**)PyCapsule_Import("greenlet._C_API", 0); \
}
#endif /* GREENLET_MODULE */
#ifdef __cplusplus
}
#endif
#endif /* !Py_GREENLETOBJECT_H */