mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Pay off more technical debt
This makes breaking changes to add underscores to many non-standard function names provided by the c library. MODE=tiny is now tinier and we now use smaller locks that are better for tiny apps in this mode. Some headers have been renamed to be in the same folder as the build package, so it'll be easier to know which build dependency is needed. Certain old misguided interfaces have been removed. Intel intrinsics headers are now listed in libc/isystem (but not in the amalgamation) to help further improve open source compatibility. Header complexity has also been reduced. Lastly, more shell scripts are now available.
This commit is contained in:
parent
b69f3d2488
commit
6f7d0cb1c3
960 changed files with 4072 additions and 4873 deletions
|
@ -28,7 +28,7 @@
|
|||
│ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "third_party/python/Modules/_decimal/libmpdec/bits.h"
|
||||
#include "third_party/python/Modules/_decimal/libmpdec/constants.h"
|
||||
#include "third_party/python/Modules/_decimal/libmpdec/mpdecimal.h"
|
||||
|
|
2
third_party/python/Modules/getpath.c
vendored
2
third_party/python/Modules/getpath.c
vendored
|
@ -11,7 +11,7 @@
|
|||
#include "libc/log/log.h"
|
||||
#include "libc/mem/alloca.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/auxv.h"
|
||||
|
|
4
third_party/python/Modules/posixmodule.c
vendored
4
third_party/python/Modules/posixmodule.c
vendored
|
@ -11,6 +11,7 @@
|
|||
#include "libc/calls/makedev.h"
|
||||
#include "libc/calls/struct/dirent.h"
|
||||
#include "libc/calls/struct/iovec.h"
|
||||
#include "libc/calls/struct/rusage.h"
|
||||
#include "libc/calls/struct/sched_param.h"
|
||||
#include "libc/calls/struct/stat.macros.h"
|
||||
#include "libc/calls/struct/statvfs.h"
|
||||
|
@ -25,9 +26,9 @@
|
|||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/mem/alg.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/nt/createfile.h"
|
||||
#include "libc/nt/dll.h"
|
||||
#include "libc/nt/enum/creationdisposition.h"
|
||||
|
@ -36,7 +37,6 @@
|
|||
#include "libc/nt/files.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
#include "libc/runtime/dlfcn.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/pathconf.h"
|
||||
#include "libc/runtime/sysconf.h"
|
||||
#include "libc/sock/sendfile.internal.h"
|
||||
|
|
2
third_party/python/Modules/selectmodule.c
vendored
2
third_party/python/Modules/selectmodule.c
vendored
|
@ -9,7 +9,7 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nt/efi.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/sock/epoll.h"
|
||||
#include "libc/sock/select.h"
|
||||
#include "libc/sock/sock.h"
|
||||
|
|
2
third_party/python/Modules/tlsmodule.c
vendored
2
third_party/python/Modules/tlsmodule.c
vendored
|
@ -20,7 +20,7 @@
|
|||
#include "libc/calls/calls.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "net/https/https.h"
|
||||
#include "third_party/mbedtls/ctr_drbg.h"
|
||||
|
|
10
third_party/python/Modules/unicodedata.c
vendored
10
third_party/python/Modules/unicodedata.c
vendored
|
@ -5,8 +5,8 @@
|
|||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/nexgen32e/kompressor.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
#include "third_party/python/Include/import.h"
|
||||
|
@ -405,7 +405,7 @@ unicodedata_UCD_decomposition_impl(PyObject *self, int chr)
|
|||
|
||||
/* high byte is number of hex bytes (usually one or two), low byte
|
||||
is prefix code (from*/
|
||||
count = bextra(_PyUnicode_Decomp, index, _PyUnicode_DecompBits) >> 8;
|
||||
count = _bextra(_PyUnicode_Decomp, index, _PyUnicode_DecompBits) >> 8;
|
||||
|
||||
/* XXX: could allocate the PyString up front instead
|
||||
(strlen(prefix) + 5 * count + 1 bytes) */
|
||||
|
@ -413,7 +413,7 @@ unicodedata_UCD_decomposition_impl(PyObject *self, int chr)
|
|||
/* Based on how index is calculated above and _PyUnicode_Decomp is
|
||||
generated from Tools/unicode/makeunicodedata.py, it should not be
|
||||
possible to overflow _PyUnicode_DecompPrefix. */
|
||||
prefix_index = bextra(_PyUnicode_Decomp, index, _PyUnicode_DecompBits) & 255;
|
||||
prefix_index = _bextra(_PyUnicode_Decomp, index, _PyUnicode_DecompBits) & 255;
|
||||
assert(prefix_index < Py_ARRAY_LENGTH(_PyUnicode_DecompPrefix));
|
||||
|
||||
/* copy prefix */
|
||||
|
@ -425,8 +425,8 @@ unicodedata_UCD_decomposition_impl(PyObject *self, int chr)
|
|||
decomp[i++] = ' ';
|
||||
assert(i < sizeof(decomp));
|
||||
PyOS_snprintf(decomp + i, sizeof(decomp) - i, "%04X",
|
||||
bextra(_PyUnicode_Decomp, ++index,
|
||||
_PyUnicode_DecompBits));
|
||||
_bextra(_PyUnicode_Decomp, ++index,
|
||||
_PyUnicode_DecompBits));
|
||||
i += strlen(decomp + i);
|
||||
}
|
||||
return PyUnicode_FromStringAndSize(decomp, i);
|
||||
|
|
18
third_party/python/Modules/unicodedata_getcode.c
vendored
18
third_party/python/Modules/unicodedata_getcode.c
vendored
|
@ -4,8 +4,8 @@
|
|||
│ Python 3 │
|
||||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "third_party/python/Include/pyctype.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
|
@ -174,7 +174,7 @@ _PyUnicode_GetCode(PyObject *self, const char *name, int namelen, Py_UCS4 *code,
|
|||
details */
|
||||
h = (unsigned int)_gethash(name, namelen, _PyUnicode_CodeMagic);
|
||||
i = ~h & mask;
|
||||
v = bextra(_PyUnicode_CodeHash, i, _PyUnicode_CodeHashBits);
|
||||
v = _bextra(_PyUnicode_CodeHash, i, _PyUnicode_CodeHashBits);
|
||||
if (!v)
|
||||
return 0;
|
||||
if (_cmpname(self, v, name, namelen))
|
||||
|
@ -184,7 +184,7 @@ _PyUnicode_GetCode(PyObject *self, const char *name, int namelen, Py_UCS4 *code,
|
|||
incr = mask;
|
||||
for (;;) {
|
||||
i = (i + incr) & mask;
|
||||
v = bextra(_PyUnicode_CodeHash, i, _PyUnicode_CodeHashBits);
|
||||
v = _bextra(_PyUnicode_CodeHash, i, _PyUnicode_CodeHashBits);
|
||||
if (!v)
|
||||
return 0;
|
||||
if (_cmpname(self, v, name, namelen))
|
||||
|
@ -247,10 +247,10 @@ _PyUnicode_GetUcName(PyObject *self, Py_UCS4 code, char *buffer, int buflen,
|
|||
}
|
||||
/* get offset into phrasebook */
|
||||
offset = _PyUnicode_PhrasebookOffset1[(code>>_PyUnicode_PhrasebookShift)];
|
||||
offset = bextra(_PyUnicode_PhrasebookOffset2,
|
||||
(offset << _PyUnicode_PhrasebookShift) +
|
||||
(code & ((1 << _PyUnicode_PhrasebookShift) - 1)),
|
||||
_PyUnicode_PhrasebookOffset2Bits);
|
||||
offset = _bextra(_PyUnicode_PhrasebookOffset2,
|
||||
(offset << _PyUnicode_PhrasebookShift) +
|
||||
(code & ((1 << _PyUnicode_PhrasebookShift) - 1)),
|
||||
_PyUnicode_PhrasebookOffset2Bits);
|
||||
if (!offset)
|
||||
return 0;
|
||||
i = 0;
|
||||
|
@ -271,8 +271,8 @@ _PyUnicode_GetUcName(PyObject *self, Py_UCS4 code, char *buffer, int buflen,
|
|||
word has bit 7 set. the last word in a string ends with
|
||||
0x80 */
|
||||
w = (_PyUnicode_Lexicon +
|
||||
bextra(_PyUnicode_LexiconOffset, word,
|
||||
_PyUnicode_LexiconOffsetBits));
|
||||
_bextra(_PyUnicode_LexiconOffset, word,
|
||||
_PyUnicode_LexiconOffsetBits));
|
||||
while (*w < 128) {
|
||||
if (i >= buflen)
|
||||
return 0; /* buffer overflow */
|
||||
|
|
|
@ -31,7 +31,7 @@ _PyUnicode_GetDecompRecord(PyObject *self,
|
|||
}
|
||||
/* high byte is number of hex bytes (usually one or two), low byte
|
||||
is prefix code (from*/
|
||||
decomp = bextra(_PyUnicode_Decomp, *index, _PyUnicode_DecompBits);
|
||||
decomp = _bextra(_PyUnicode_Decomp, *index, _PyUnicode_DecompBits);
|
||||
*count = decomp >> 8;
|
||||
*prefix = decomp & 255;
|
||||
(*index)++;
|
||||
|
|
|
@ -115,10 +115,10 @@ _PyUnicode_NfcNfkc(PyObject *self, PyObject *input, int k)
|
|||
}
|
||||
index = f * UNIDATA_TOTAL_LAST + l;
|
||||
index1 = _PyUnicode_CompIndex[index >> _PyUnicode_CompShift];
|
||||
code = bextra(_PyUnicode_CompData,
|
||||
(index1 << _PyUnicode_CompShift)+
|
||||
(index & ((1 << _PyUnicode_CompShift) - 1)),
|
||||
_PyUnicode_CompDataBits);
|
||||
code = _bextra(_PyUnicode_CompData,
|
||||
(index1 << _PyUnicode_CompShift)+
|
||||
(index & ((1 << _PyUnicode_CompShift) - 1)),
|
||||
_PyUnicode_CompDataBits);
|
||||
if (code == 0)
|
||||
goto not_combinable;
|
||||
/* Replace the original character. */
|
||||
|
|
|
@ -97,9 +97,9 @@ _PyUnicode_NfdNfkd(PyObject *self, PyObject *input, int k)
|
|||
/* Copy decomposition onto the stack, in reverse
|
||||
order. */
|
||||
while(count) {
|
||||
code = bextra(_PyUnicode_Decomp,
|
||||
index + (--count),
|
||||
_PyUnicode_DecompBits);
|
||||
code = _bextra(_PyUnicode_Decomp,
|
||||
index + (--count),
|
||||
_PyUnicode_DecompBits);
|
||||
stack[stackptr++] = code;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue