Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/python3.12/internal/pycore_initconfig.h
$ cat -n /usr/include/python3.12/internal/pycore_initconfig.h 1 #ifndef Py_INTERNAL_CORECONFIG_H 2 #define Py_INTERNAL_CORECONFIG_H 3 #ifdef __cplusplus 4 extern "C" { 5 #endif 6 7 #ifndef Py_BUILD_CORE 8 # error "this header requires Py_BUILD_CORE define" 9 #endif 10 11 /* Forward declaration */ 12 struct pyruntimestate; 13 14 /* --- PyStatus ----------------------------------------------- */ 15 16 /* Almost all errors causing Python initialization to fail */ 17 #ifdef _MSC_VER 18 /* Visual Studio 2015 doesn't implement C99 __func__ in C */ 19 # define _PyStatus_GET_FUNC() __FUNCTION__ 20 #else 21 # define _PyStatus_GET_FUNC() __func__ 22 #endif 23 24 #define _PyStatus_OK() \ 25 (PyStatus){._type = _PyStatus_TYPE_OK,} 26 /* other fields are set to 0 */ 27 #define _PyStatus_ERR(ERR_MSG) \ 28 (PyStatus){ \ 29 ._type = _PyStatus_TYPE_ERROR, \ 30 .func = _PyStatus_GET_FUNC(), \ 31 .err_msg = (ERR_MSG)} 32 /* other fields are set to 0 */ 33 #define _PyStatus_NO_MEMORY() _PyStatus_ERR("memory allocation failed") 34 #define _PyStatus_EXIT(EXITCODE) \ 35 (PyStatus){ \ 36 ._type = _PyStatus_TYPE_EXIT, \ 37 .exitcode = (EXITCODE)} 38 #define _PyStatus_IS_ERROR(err) \ 39 ((err)._type == _PyStatus_TYPE_ERROR) 40 #define _PyStatus_IS_EXIT(err) \ 41 ((err)._type == _PyStatus_TYPE_EXIT) 42 #define _PyStatus_EXCEPTION(err) \ 43 ((err)._type != _PyStatus_TYPE_OK) 44 #define _PyStatus_UPDATE_FUNC(err) \ 45 do { (err).func = _PyStatus_GET_FUNC(); } while (0) 46 47 /* --- PyWideStringList ------------------------------------------------ */ 48 49 #define _PyWideStringList_INIT (PyWideStringList){.length = 0, .items = NULL} 50 51 #ifndef NDEBUG 52 PyAPI_FUNC(int) _PyWideStringList_CheckConsistency(const PyWideStringList *list); 53 #endif 54 PyAPI_FUNC(void) _PyWideStringList_Clear(PyWideStringList *list); 55 PyAPI_FUNC(int) _PyWideStringList_Copy(PyWideStringList *list, 56 const PyWideStringList *list2); 57 PyAPI_FUNC(PyStatus) _PyWideStringList_Extend(PyWideStringList *list, 58 const PyWideStringList *list2); 59 PyAPI_FUNC(PyObject*) _PyWideStringList_AsList(const PyWideStringList *list); 60 61 62 /* --- _PyArgv ---------------------------------------------------- */ 63 64 typedef struct _PyArgv { 65 Py_ssize_t argc; 66 int use_bytes_argv; 67 char * const *bytes_argv; 68 wchar_t * const *wchar_argv; 69 } _PyArgv; 70 71 PyAPI_FUNC(PyStatus) _PyArgv_AsWstrList(const _PyArgv *args, 72 PyWideStringList *list); 73 74 75 /* --- Helper functions ------------------------------------------- */ 76 77 PyAPI_FUNC(int) _Py_str_to_int( 78 const char *str, 79 int *result); 80 PyAPI_FUNC(const wchar_t*) _Py_get_xoption( 81 const PyWideStringList *xoptions, 82 const wchar_t *name); 83 PyAPI_FUNC(const char*) _Py_GetEnv( 84 int use_environment, 85 const char *name); 86 PyAPI_FUNC(void) _Py_get_env_flag( 87 int use_environment, 88 int *flag, 89 const char *name); 90 91 /* Py_GetArgcArgv() helper */ 92 PyAPI_FUNC(void) _Py_ClearArgcArgv(void); 93 94 95 /* --- _PyPreCmdline ------------------------------------------------- */ 96 97 typedef struct { 98 PyWideStringList argv; 99 PyWideStringList xoptions; /* "-X value" option */ 100 int isolated; /* -I option */ 101 int use_environment; /* -E option */ 102 int dev_mode; /* -X dev and PYTHONDEVMODE */ 103 int warn_default_encoding; /* -X warn_default_encoding and PYTHONWARNDEFAULTENCODING */ 104 } _PyPreCmdline; 105 106 #define _PyPreCmdline_INIT \ 107 (_PyPreCmdline){ \ 108 .use_environment = -1, \ 109 .isolated = -1, \ 110 .dev_mode = -1} 111 /* Note: _PyPreCmdline_INIT sets other fields to 0/NULL */ 112 113 extern void _PyPreCmdline_Clear(_PyPreCmdline *cmdline); 114 extern PyStatus _PyPreCmdline_SetArgv(_PyPreCmdline *cmdline, 115 const _PyArgv *args); 116 extern PyStatus _PyPreCmdline_SetConfig( 117 const _PyPreCmdline *cmdline, 118 PyConfig *config); 119 extern PyStatus _PyPreCmdline_Read(_PyPreCmdline *cmdline, 120 const PyPreConfig *preconfig); 121 122 123 /* --- PyPreConfig ----------------------------------------------- */ 124 125 PyAPI_FUNC(void) _PyPreConfig_InitCompatConfig(PyPreConfig *preconfig); 126 extern void _PyPreConfig_InitFromConfig( 127 PyPreConfig *preconfig, 128 const PyConfig *config); 129 extern PyStatus _PyPreConfig_InitFromPreConfig( 130 PyPreConfig *preconfig, 131 const PyPreConfig *config2); 132 extern PyObject* _PyPreConfig_AsDict(const PyPreConfig *preconfig); 133 extern void _PyPreConfig_GetConfig(PyPreConfig *preconfig, 134 const PyConfig *config); 135 extern PyStatus _PyPreConfig_Read(PyPreConfig *preconfig, 136 const _PyArgv *args); 137 extern PyStatus _PyPreConfig_Write(const PyPreConfig *preconfig); 138 139 140 /* --- PyConfig ---------------------------------------------- */ 141 142 typedef enum { 143 /* Py_Initialize() API: backward compatibility with Python 3.6 and 3.7 */ 144 _PyConfig_INIT_COMPAT = 1, 145 _PyConfig_INIT_PYTHON = 2, 146 _PyConfig_INIT_ISOLATED = 3 147 } _PyConfigInitEnum; 148 149 PyAPI_FUNC(void) _PyConfig_InitCompatConfig(PyConfig *config); 150 extern PyStatus _PyConfig_Copy( 151 PyConfig *config, 152 const PyConfig *config2); 153 extern PyStatus _PyConfig_InitPathConfig( 154 PyConfig *config, 155 int compute_path_config); 156 extern PyStatus _PyConfig_InitImportConfig(PyConfig *config); 157 extern PyStatus _PyConfig_Read(PyConfig *config, int compute_path_config); 158 extern PyStatus _PyConfig_Write(const PyConfig *config, 159 struct pyruntimestate *runtime); 160 extern PyStatus _PyConfig_SetPyArgv( 161 PyConfig *config, 162 const _PyArgv *args); 163 164 PyAPI_FUNC(PyObject*) _PyConfig_AsDict(const PyConfig *config); 165 PyAPI_FUNC(int) _PyConfig_FromDict(PyConfig *config, PyObject *dict); 166 167 extern void _Py_DumpPathConfig(PyThreadState *tstate); 168 169 PyAPI_FUNC(PyObject*) _Py_Get_Getpath_CodeObject(void); 170 171 172 /* --- Function used for testing ---------------------------------- */ 173 174 PyAPI_FUNC(PyObject*) _Py_GetConfigsAsDict(void); 175 176 #ifdef __cplusplus 177 } 178 #endif 179 #endif /* !Py_INTERNAL_CORECONFIG_H */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™