Make Cosmopolitan ANSI C89 compatible

You can now use cosmopolitan.h with an ANSI C89 compiler like MSVC. The
Cosmopolitan codebase itself won't support being compiled that way. But
you can build objects that link against Cosmopolitan using any compiler
and you can furthermore use tools like IntelliSense that can't even GNU

See also #40
This commit is contained in:
Justine Tunney 2021-02-03 17:48:59 -08:00
parent 46085797b6
commit a8d7195777
34 changed files with 262 additions and 9561 deletions

View file

@ -10,19 +10,19 @@ COSMOPOLITAN_C_START_
*/
typedef struct FILE {
uint8_t bufmode; // 0x00 _IOFBF, etc. (ignored if fd=-1)
bool noclose; // 0x01 for fake dup()
uint32_t iomode; // 0x04 O_RDONLY, etc. (ignored if fd=-1)
int32_t state; // 0x08 0=OK, -1=EOF, >0=errno
int fd; // 0x0c ≥0=fd, -1=closed|buffer
uint32_t beg; // 0x10
uint32_t end; // 0x14
uint8_t *buf; // 0x18
uint32_t size; // 0x20
uint32_t nofree; // 0x24
int (*reader)(struct FILE *); // 0x28
int (*writer)(struct FILE *); // 0x30
int pid; // 0x34
uint8_t bufmode; /* 0x00 _IOFBF, etc. (ignored if fd=-1) */
bool noclose; /* 0x01 for fake dup() */
uint32_t iomode; /* 0x04 O_RDONLY, etc. (ignored if fd=-1) */
int32_t state; /* 0x08 0=OK, -1=EOF, >0=errno */
int fd; /* 0x0c ≥0=fd, -1=closed|buffer */
uint32_t beg; /* 0x10 */
uint32_t end; /* 0x14 */
uint8_t *buf; /* 0x18 */
uint32_t size; /* 0x20 */
uint32_t nofree; /* 0x24 */
int (*reader)(struct FILE *); /* 0x28 */
int (*writer)(struct FILE *); /* 0x30 */
int pid; /* 0x34 */
} FILE;
extern FILE *stdin;