Get Cosmopolitan into releasable state

A new rollup tool now exists for flattening out the headers in a way
that works better for our purposes than cpp. A lot of the API clutter
has been removed. APIs that aren't a sure thing in terms of general
recommendation are now marked internal.

There's now a smoke test for the amalgamation archive and gigantic
header file. So we can now guarantee you can use this project on the
easiest difficulty setting without the gigantic repository.

A website is being created, which is currently a work in progress:
https://justine.storage.googleapis.com/cosmopolitan/index.html
This commit is contained in:
Justine Tunney 2020-11-25 08:19:00 -08:00
parent dba7552c1e
commit ea0b5d9d1c
775 changed files with 6864 additions and 3963 deletions

View file

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "dsp/core/core.h"
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/hefty/spawn.h"
#include "libc/calls/ioctl.h"

View file

@ -17,9 +17,9 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/log/color.h"
#include "libc/log/color.internal.h"
#include "libc/log/log.h"
#include "libc/nexgen32e/cpuid4.h"
#include "libc/nexgen32e/cpuid4.internal.h"
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/nexgen32e/rdtscp.h"
#include "libc/nexgen32e/x86feature.h"

View file

@ -1,9 +1,9 @@
#include "dsp/tty/tty.h"
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/termios.h"
#include "libc/log/check.h"
#include "libc/log/color.h"
#include "libc/log/color.internal.h"
#include "libc/log/log.h"
#include "libc/macros.h"
#include "libc/math.h"

View file

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/conv/conv.h"
#include "libc/errno.h"
#include "libc/runtime/runtime.h"

View file

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/conv/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/limits.h"

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_TOOL_VIZ_LIB_CONVOLVE_H_
#define COSMOPOLITAN_TOOL_VIZ_LIB_CONVOLVE_H_
#include "libc/bits/xmmintrin.h"
#include "libc/bits/xmmintrin.internal.h"
#include "libc/str/str.h"
#include "tool/viz/lib/graphic.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)

View file

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/bits/bits.h"
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/conv/itoa.h"
#include "libc/runtime/gc.h"
#include "libc/str/str.h"

View file

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/conv/itoa.h"
#include "tool/viz/lib/formatstringtable.h"

View file

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/unicode/unicode.h"
#include "tool/viz/lib/formatstringtable.h"

View file

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/bits/xmmintrin.h"
#include "libc/bits/xmmintrin.internal.h"
#include "libc/macros.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"

View file

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "dsp/tty/quant.h"
#include "libc/bits/xmmintrin.h"
#include "libc/bits/xmmintrin.internal.h"
#include "libc/macros.h"
#include "tool/viz/lib/graphic.h"

View file

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/bits/bits.h"
#include "libc/bits/initializer.h"
#include "libc/bits/initializer.internal.h"
#include "libc/macros.h"
#include "libc/math.h"
#include "tool/viz/lib/graphic.h"

View file

@ -18,7 +18,7 @@
02110-1301 USA
*/
#include "libc/assert.h"
#include "libc/bits/xmmintrin.h"
#include "libc/bits/xmmintrin.internal.h"
#include "libc/runtime/buffer.h"
#include "tool/viz/lib/graphic.h"

View file

@ -26,7 +26,7 @@
#include "dsp/core/illumination.h"
#include "dsp/core/q.h"
#include "dsp/scale/scale.h"
#include "libc/bits/xmmintrin.h"
#include "libc/bits/xmmintrin.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/sigbits.h"
#include "libc/calls/struct/sigset.h"
@ -36,7 +36,7 @@
#include "libc/macros.h"
#include "libc/math.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/gc.h"
#include "libc/nexgen32e/gc.internal.h"
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/nexgen32e/x86feature.h"
#include "libc/runtime/gc.h"

File diff suppressed because it is too large Load diff

View file

@ -21,7 +21,7 @@
#include "libc/bits/bits.h"
#include "libc/bits/hilbert.h"
#include "libc/bits/morton.h"
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/ioctl.h"
#include "libc/calls/struct/sigaction.h"
@ -55,7 +55,7 @@
#include "third_party/getopt/getopt.h"
#define USAGE \
" [-hznmH] [-p PID] [PATH]\n\
" [-hznmHNW] [-p PID] [PATH]\n\
\n\
DESCRIPTION\n\
\n\
@ -65,10 +65,10 @@ FLAGS\n\
\n\
-h help\n\
-z zoom\n\
-w white bg color\n\
-m morton ordering\n\
-H hilbert ordering\n\
-n natural scrolling\n\
-N natural scrolling\n\
-W white terminal background\n\
-p PID shows process virtual memory\n\
-f INT frames per second [default 10]\n\
\n\
@ -276,7 +276,7 @@ static void SetupCanvas(void) {
munmap(canvas, canvassize);
munmap(buffer, buffersize);
}
displaysize = ROUNDUP(ROUNDUP(tyn * txn * (1ul << zoom), 16), 1ul << zoom);
displaysize = ROUNDUP(ROUNDUP((tyn * txn) << zoom, 16), 1ul << zoom);
canvassize = ROUNDUP(displaysize, FRAMESIZE);
buffersize = ROUNDUP(tyn * txn * 16 + PAGESIZE, FRAMESIZE);
canvas = Allocate(canvassize);
@ -341,7 +341,8 @@ static int GetCurrentRange(void) {
}
static void Move(long d) {
offset = MIN(highest, MAX(lowest, ROUNDDOWN(offset + d, 1L << zoom)));
d <<= zoom;
offset = MIN(highest, MAX(lowest, (offset + d) >> zoom << zoom));
}
static void SetZoom(long y, long x, int d) {
@ -351,7 +352,7 @@ static void SetZoom(long y, long x, int d) {
a = zoom;
b = MIN(MAXZOOM, MAX(0, a + d));
zoom = b;
Move(i * (1L << a) - i * (1L << b));
Move((i << a) - (i << b));
SetupCanvas();
}
}
@ -365,19 +366,19 @@ static void OnUnzoom(long y, long x) {
}
static void OnUp(void) {
Move(-(txn * (1l << zoom)));
Move(-(txn));
}
static void OnDown(void) {
Move(txn * (1l << zoom));
Move(txn);
}
static void OnPageUp(void) {
Move(-(txn * (tyn - 2) * (1l << zoom)));
Move(-(txn * (tyn - 2)));
}
static void OnPageDown(void) {
Move(txn * (tyn - 2) * (1l << zoom));
Move(txn * (tyn - 2));
}
static void OnHome(void) {
@ -385,7 +386,7 @@ static void OnHome(void) {
}
static void OnEnd(void) {
offset = MAX(lowest, highest - txn * tyn * (1l << zoom));
offset = MAX(lowest, highest - txn * tyn);
}
static void OnLinear(void) {
@ -425,7 +426,7 @@ static void OnPrev(void) {
static void OnNextEnd(void) {
long i, n;
if ((i = GetCurrentRange()) != -1) {
n = tyn * txn * (1L << zoom);
n = (tyn * txn) << zoom;
if (offset < ranges.p[i].b - n) {
offset = ranges.p[i].b - n;
} else if (i + 1 < ranges.i) {
@ -437,7 +438,7 @@ static void OnNextEnd(void) {
static void OnPrevEnd(void) {
long i, n;
if ((i = GetCurrentRange()) != -1) {
n = tyn * txn * (1L << zoom);
n = (tyn * txn) << zoom;
if (i) {
offset = MAX(ranges.p[i - 1].a, ranges.p[i - 1].b - n);
}
@ -753,7 +754,7 @@ static void Render(void) {
} while (w);
}
p = stpcpy(p, "\e[0m ");
p += uint64toarray_radix16(offset + y * txn * (1ul << zoom), p);
p += uint64toarray_radix16(offset + ((y * txn) << zoom), p);
p = stpcpy(p, "\e[K\r\n");
}
p = stpcpy(p, "\e[7m\e[K");
@ -772,7 +773,7 @@ static void Render(void) {
p += uint64toarray_radix10(MIN(offset / (long double)size * 100, 100), p);
p = stpcpy(p, "%-");
p += uint64toarray_radix10(
MIN((offset + tyn * txn * (1l << zoom)) / (long double)size * 100, 100),
MIN((offset + ((tyn * txn) << zoom)) / (long double)size * 100, 100),
p);
p = stpcpy(p, "% ");
}
@ -800,7 +801,7 @@ static void Zoom(long have) {
memset(canvas + n, 0, canvassize - n);
}
if (have != -1) {
n = have / (1L << zoom);
n = have >> zoom;
i = n / txn;
r = n % txn;
if (r) ++i;
@ -827,7 +828,7 @@ static void RangesZoom(void) {
LoadRanges();
memset(canvas, 1, canvassize);
a = offset;
b = MIN(highest, offset + tyn * txn * (1ul << zoom));
b = MIN(highest, offset + ((tyn * txn) << zoom));
for (i = 0; i < ranges.i; ++i) {
if ((a >= ranges.p[i].a && a < ranges.p[i].b) ||
(b >= ranges.p[i].a && b < ranges.p[i].b) ||
@ -871,23 +872,23 @@ static void GetOpts(int argc, char *argv[]) {
int opt;
char *p;
fps = 10;
while ((opt = getopt(argc, argv, "hzHnwf:p:")) != -1) {
while ((opt = getopt(argc, argv, "hzHNWf:p:")) != -1) {
switch (opt) {
case 'z':
++zoom;
break;
case 'n':
natural = true;
break;
case 'm':
order = MORTON;
break;
case 'H':
order = HILBERT;
break;
case 'w':
case 'W':
white = true;
break;
case 'N':
natural = true;
break;
case 'f':
fps = strtol(optarg, NULL, 0);
fps = MAX(1, fps);

View file

@ -24,7 +24,7 @@
#include "dsp/tty/tty.h"
#include "libc/assert.h"
#include "libc/bits/bits.h"
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/ioctl.h"
#include "libc/calls/struct/stat.h"

View file

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/dce.h"
@ -133,7 +133,7 @@ void PrintSystemInfo(void) {
#undef X
}
const char *ft2str(enum NtFileType ft) {
const char *ft2str(int ft) {
if (ft == kNtFileTypeUnknown) return "kNtFileTypeUnknown";
if (ft == kNtFileTypeDisk) return "kNtFileTypeDisk";
if (ft == kNtFileTypeChar) return "kNtFileTypeChar";

View file

@ -25,10 +25,10 @@
#include "dsp/tty/quant.h"
#include "dsp/tty/tty.h"
#include "libc/alg/alg.h"
#include "libc/alg/arraylist.h"
#include "libc/alg/arraylist.internal.h"
#include "libc/assert.h"
#include "libc/bits/bits.h"
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/bits/xchg.h"
#include "libc/calls/calls.h"
#include "libc/calls/hefty/spawn.h"

View file

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/alg/arraylist.h"
#include "libc/bits/safemacros.h"
#include "libc/alg/arraylist.internal.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/conv/conv.h"
#include "libc/limits.h"
#include "libc/log/check.h"

View file

@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/macros.h"

View file

@ -32,6 +32,9 @@ TOOL_VIZ_DIRECTDEPS = \
LIBC_NEXGEN32E \
LIBC_NT_KERNEL32 \
LIBC_NT_KERNELBASE \
LIBC_NT_USER32 \
LIBC_NT_GDI32 \
LIBC_NT_COMDLG32 \
LIBC_RUNTIME \
LIBC_TESTLIB \
LIBC_STDIO \