mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-29 16:52:28 +00:00
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
52 lines
1.6 KiB
C
52 lines
1.6 KiB
C
#ifndef COSMOPOLITAN_LIBC_ZIPOS_ZIPOS_H_
|
|
#define COSMOPOLITAN_LIBC_ZIPOS_ZIPOS_H_
|
|
#include "libc/calls/calls.h"
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
COSMOPOLITAN_C_START_
|
|
|
|
#if 0
|
|
#define ZTRACE(FMT, ...) (dprintf)(2, FMT "\n", ##__VA_ARGS__)
|
|
#else
|
|
#define ZTRACE(FMT, ...) (void)0
|
|
#endif
|
|
|
|
struct stat;
|
|
struct iovec;
|
|
|
|
struct Zipos {
|
|
int fd;
|
|
uint8_t *map;
|
|
uint8_t *cdir;
|
|
};
|
|
|
|
struct ZiposUri {
|
|
const char *path;
|
|
size_t len;
|
|
};
|
|
|
|
struct ZiposHandle {
|
|
uint8_t *mem; /* uncompressed file memory */
|
|
size_t size; /* byte length of file memory */
|
|
size_t pos; /* read/write byte offset state */
|
|
uint32_t cfile; /* central directory entry rva */
|
|
int64_t handle;
|
|
uint8_t *freeme;
|
|
};
|
|
|
|
int __zipos_close(int) hidden;
|
|
struct Zipos *__zipos_get(void) pureconst hidden;
|
|
ssize_t __zipos_parseuri(const char *, struct ZiposUri *) hidden;
|
|
ssize_t __zipos_find(struct Zipos *, const struct ZiposUri *);
|
|
int __zipos_open(const struct ZiposUri *, unsigned, int) hidden;
|
|
int __zipos_stat(const struct ZiposUri *, struct stat *) hidden;
|
|
int __zipos_fstat(const struct ZiposHandle *, struct stat *) hidden;
|
|
int __zipos_stat_impl(struct Zipos *, size_t, struct stat *) hidden;
|
|
ssize_t __zipos_read(struct ZiposHandle *, const struct iovec *, size_t,
|
|
ssize_t) hidden;
|
|
ssize_t __zipos_write(struct ZiposHandle *, const struct iovec *, size_t,
|
|
ssize_t) hidden;
|
|
int64_t __zipos_lseek(struct ZiposHandle *, int64_t, unsigned) hidden;
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_ZIPOS_ZIPOS_H_ */
|