mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Undiamond Python headers
This change gets the Python codebase into a state where it conforms to the conventions of this codebase. It's now possible to include headers from Python, without worrying about ordering. Python has traditionally solved that problem by "diamonding" everything in Python.h, but that's problematic since it means any change to any Python header invalidates all the build artifacts. Lastly it makes tooling not work. Since it is hard to explain to Emacs when I press C-c C-h to add an import line it shouldn't add the header that actually defines the symbol, and instead do follow the nonstandard Python convention. Progress has been made on letting Python load source code from the zip executable structure via the standard C library APIs. System calss now recognizes zip!FILENAME alternative URIs as equivalent to zip:FILENAME since Python uses colon as its delimiter. Some progress has been made on embedding the notice license terms into the Python object code. This is easier said than done since Python has an extremely complicated ownership story. - Some termios APIs have been added - Implement rewinddir() dirstream API - GetCpuCount() API added to Cosmopolitan Libc - More bugs in Cosmopolitan Libc have been fixed - zipobj.com now has flags for mangling the path - Fixed bug a priori with sendfile() on certain BSDs - Polyfill F_DUPFD and F_DUPFD_CLOEXEC across platforms - FIOCLEX / FIONCLEX now polyfilled for fast O_CLOEXEC changes - APE now supports a hybrid solution to no-self-modify for builds - Many BSD-only magnums added, e.g. O_SEARCH, O_SHLOCK, SF_NODISKIO
This commit is contained in:
parent
20bb8db9f8
commit
b420ed8248
762 changed files with 18410 additions and 53772 deletions
53
third_party/python/Include/codecs.h
vendored
53
third_party/python/Include/codecs.h
vendored
|
@ -1,5 +1,6 @@
|
|||
#ifndef Py_CODECREGISTRY_H
|
||||
#define Py_CODECREGISTRY_H
|
||||
#include "third_party/python/Include/object.h"
|
||||
COSMOPOLITAN_C_START_
|
||||
/* clang-format off */
|
||||
|
||||
|
@ -22,7 +23,7 @@ Copyright (c) Corporation for National Research Initiatives.
|
|||
|
||||
The search_function's refcount is incremented by this function. */
|
||||
|
||||
PyAPI_FUNC(int) PyCodec_Register(
|
||||
int PyCodec_Register(
|
||||
PyObject *search_function
|
||||
);
|
||||
|
||||
|
@ -45,11 +46,11 @@ PyAPI_FUNC(int) PyCodec_Register(
|
|||
*/
|
||||
|
||||
#ifndef Py_LIMITED_API
|
||||
PyAPI_FUNC(PyObject *) _PyCodec_Lookup(
|
||||
PyObject * _PyCodec_Lookup(
|
||||
const char *encoding
|
||||
);
|
||||
|
||||
PyAPI_FUNC(int) _PyCodec_Forget(
|
||||
int _PyCodec_Forget(
|
||||
const char *encoding
|
||||
);
|
||||
#endif
|
||||
|
@ -61,7 +62,7 @@ PyAPI_FUNC(int) _PyCodec_Forget(
|
|||
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(int) PyCodec_KnownEncoding(
|
||||
int PyCodec_KnownEncoding(
|
||||
const char *encoding
|
||||
);
|
||||
|
||||
|
@ -75,7 +76,7 @@ PyAPI_FUNC(int) PyCodec_KnownEncoding(
|
|||
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_Encode(
|
||||
PyObject * PyCodec_Encode(
|
||||
PyObject *object,
|
||||
const char *encoding,
|
||||
const char *errors
|
||||
|
@ -91,7 +92,7 @@ PyAPI_FUNC(PyObject *) PyCodec_Encode(
|
|||
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_Decode(
|
||||
PyObject * PyCodec_Decode(
|
||||
PyObject *object,
|
||||
const char *encoding,
|
||||
const char *errors
|
||||
|
@ -111,18 +112,18 @@ PyAPI_FUNC(PyObject *) PyCodec_Decode(
|
|||
in Python 3.5+?
|
||||
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) _PyCodec_LookupTextEncoding(
|
||||
PyObject * _PyCodec_LookupTextEncoding(
|
||||
const char *encoding,
|
||||
const char *alternate_command
|
||||
);
|
||||
|
||||
PyAPI_FUNC(PyObject *) _PyCodec_EncodeText(
|
||||
PyObject * _PyCodec_EncodeText(
|
||||
PyObject *object,
|
||||
const char *encoding,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
PyAPI_FUNC(PyObject *) _PyCodec_DecodeText(
|
||||
PyObject * _PyCodec_DecodeText(
|
||||
PyObject *object,
|
||||
const char *encoding,
|
||||
const char *errors
|
||||
|
@ -131,12 +132,12 @@ PyAPI_FUNC(PyObject *) _PyCodec_DecodeText(
|
|||
/* These two aren't actually text encoding specific, but _io.TextIOWrapper
|
||||
* is the only current API consumer.
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalDecoder(
|
||||
PyObject * _PyCodecInfo_GetIncrementalDecoder(
|
||||
PyObject *codec_info,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder(
|
||||
PyObject * _PyCodecInfo_GetIncrementalEncoder(
|
||||
PyObject *codec_info,
|
||||
const char *errors
|
||||
);
|
||||
|
@ -154,33 +155,33 @@ PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder(
|
|||
|
||||
/* Get an encoder function for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_Encoder(
|
||||
PyObject * PyCodec_Encoder(
|
||||
const char *encoding
|
||||
);
|
||||
|
||||
/* Get a decoder function for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_Decoder(
|
||||
PyObject * PyCodec_Decoder(
|
||||
const char *encoding
|
||||
);
|
||||
|
||||
/* Get an IncrementalEncoder object for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder(
|
||||
PyObject * PyCodec_IncrementalEncoder(
|
||||
const char *encoding,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
/* Get an IncrementalDecoder object function for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder(
|
||||
PyObject * PyCodec_IncrementalDecoder(
|
||||
const char *encoding,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
/* Get a StreamReader factory function for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_StreamReader(
|
||||
PyObject * PyCodec_StreamReader(
|
||||
const char *encoding,
|
||||
PyObject *stream,
|
||||
const char *errors
|
||||
|
@ -188,7 +189,7 @@ PyAPI_FUNC(PyObject *) PyCodec_StreamReader(
|
|||
|
||||
/* Get a StreamWriter factory function for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_StreamWriter(
|
||||
PyObject * PyCodec_StreamWriter(
|
||||
const char *encoding,
|
||||
PyObject *stream,
|
||||
const char *errors
|
||||
|
@ -202,35 +203,35 @@ PyAPI_FUNC(PyObject *) PyCodec_StreamWriter(
|
|||
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);
|
||||
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);
|
||||
PyObject * PyCodec_LookupError(const char *name);
|
||||
|
||||
/* raise exc as an exception */
|
||||
PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc);
|
||||
PyObject * PyCodec_StrictErrors(PyObject *exc);
|
||||
|
||||
/* ignore the unicode error, skipping the faulty input */
|
||||
PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc);
|
||||
PyObject * PyCodec_IgnoreErrors(PyObject *exc);
|
||||
|
||||
/* replace the unicode encode error with ? or U+FFFD */
|
||||
PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc);
|
||||
PyObject * PyCodec_ReplaceErrors(PyObject *exc);
|
||||
|
||||
/* replace the unicode encode error with XML character references */
|
||||
PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc);
|
||||
PyObject * PyCodec_XMLCharRefReplaceErrors(PyObject *exc);
|
||||
|
||||
/* replace the unicode encode error with backslash escapes (\x, \u and \U) */
|
||||
PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc);
|
||||
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);
|
||||
PyObject * PyCodec_NameReplaceErrors(PyObject *exc);
|
||||
#endif
|
||||
|
||||
#ifndef Py_LIMITED_API
|
||||
PyAPI_DATA(const char *) Py_hexdigits;
|
||||
extern const char * Py_hexdigits;
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue