mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Add Conway's Game of Life
This commit is contained in:
parent
db33973e0a
commit
dba7552c1e
22 changed files with 664 additions and 186 deletions
|
@ -16,10 +16,10 @@ LIBC_CALLS_ARTIFACTS += LIBC_CALLS_A
|
|||
LIBC_CALLS = $(LIBC_CALLS_A_DEPS) $(LIBC_CALLS_A)
|
||||
LIBC_CALLS_A = o/$(MODE)/libc/calls/syscalls.a
|
||||
LIBC_CALLS_A_FILES := \
|
||||
$(wildcard libc/calls/*) \
|
||||
$(wildcard libc/calls/typedef/*) \
|
||||
$(wildcard libc/calls/thunks/*) \
|
||||
$(wildcard libc/calls/struct/*)
|
||||
$(wildcard libc/calls/struct/*) \
|
||||
$(wildcard libc/calls/*)
|
||||
LIBC_CALLS_A_HDRS = $(filter %.h,$(LIBC_CALLS_A_FILES))
|
||||
LIBC_CALLS_A_SRCS_S = $(filter %.S,$(LIBC_CALLS_A_FILES))
|
||||
LIBC_CALLS_A_SRCS_C = $(filter %.c,$(LIBC_CALLS_A_FILES))
|
||||
|
|
|
@ -43,22 +43,22 @@ static textwindows int64_t ParseInt(char16_t **p) {
|
|||
return x;
|
||||
}
|
||||
|
||||
static textwindows void WriteAll(int64_t h, void *buf, size_t n) {
|
||||
static noinline textwindows void DoAll(int64_t h, void *buf, size_t n,
|
||||
bool32 (*f)()) {
|
||||
char *p;
|
||||
size_t i;
|
||||
uint32_t wrote;
|
||||
for (p = buf, i = 0; i < n; i += wrote) {
|
||||
WriteFile(h, p + i, n - i, &wrote, NULL);
|
||||
uint32_t x;
|
||||
for (p = buf, i = 0; i < n; i += x) {
|
||||
f(h, p + i, n - i, &x, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static textwindows void ReadAll(int64_t h, void *buf, size_t n) {
|
||||
char *p;
|
||||
size_t i;
|
||||
uint32_t got;
|
||||
for (p = buf, i = 0; i < n; i += got) {
|
||||
ReadFile(h, p + i, n - i, &got, NULL);
|
||||
}
|
||||
static noinline textwindows void WriteAll(int64_t h, void *buf, size_t n) {
|
||||
DoAll(h, buf, n, WriteFile);
|
||||
}
|
||||
|
||||
static noinline textwindows void ReadAll(int64_t h, void *buf, size_t n) {
|
||||
DoAll(h, buf, n, ReadFile);
|
||||
}
|
||||
|
||||
textwindows void WinMainForked(void) {
|
||||
|
|
|
@ -16,9 +16,6 @@ int ioctl(int, uint64_t, void *);
|
|||
#include "libc/macros.h"
|
||||
#include "libc/sysv/consts/termios.h"
|
||||
|
||||
struct termios;
|
||||
struct winsize;
|
||||
|
||||
#define ioctl(FD, REQUEST, MEMORY) ioctl$dispatch(FD, REQUEST, MEMORY)
|
||||
|
||||
#define __IOCTL_DISPATCH(CMP, FD, REQUEST, MEMORY) \
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
#define COSMOPOLITAN_LIBC_CALLS_TERMIOS_INTERNAL_H_
|
||||
#ifndef __STRICT_ANSI__
|
||||
#include "libc/bits/safemacros.h"
|
||||
#include "libc/calls/struct/metatermios.h"
|
||||
#include "libc/calls/struct/termios.h"
|
||||
#include "libc/str/str.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct termios;
|
||||
union metatermios;
|
||||
|
||||
#define COPY_TERMIOS(TO, FROM) \
|
||||
do { \
|
||||
memset((TO), 0, sizeof(*(TO))); \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue