cosmopolitan/third_party/lua/cosmo.h
Justine Tunney fa20edc44d
Reduce header complexity
- Remove most __ASSEMBLER__ __LINKER__ ifdefs
- Rename libc/intrin/bits.h to libc/serialize.h
- Block pthread cancelation in fchmodat() polyfill
- Remove `clang-format off` statements in third_party
2023-11-28 14:39:42 -08:00

41 lines
1.3 KiB
C

#ifndef COSMOPOLITAN_THIRD_PARTY_LUA_COSMO_H_
#define COSMOPOLITAN_THIRD_PARTY_LUA_COSMO_H_
#include "net/http/http.h"
#include "net/http/url.h"
#include "third_party/lua/lauxlib.h"
#include "third_party/lua/visitor.h"
COSMOPOLITAN_C_START_
struct EncoderConfig {
short maxdepth;
bool sorted;
bool pretty;
const char *indent;
};
struct Serializer {
struct LuaVisited visited;
struct EncoderConfig conf;
const char *reason;
char *strbuf;
size_t strbuflen;
};
bool LuaHasMultipleItems(lua_State *);
char *LuaFormatStack(lua_State *) __wur;
int LuaCallWithTrace(lua_State *, int, int, lua_State *);
int LuaEncodeJsonData(lua_State *, char **, int, struct EncoderConfig);
int LuaEncodeLuaData(lua_State *, char **, int, struct EncoderConfig);
int LuaEncodeUrl(lua_State *);
int LuaParseUrl(lua_State *);
int LuaPushHeader(lua_State *, struct HttpMessage *, const char *, int);
int LuaPushHeaders(lua_State *, struct HttpMessage *, const char *);
void LuaPrintStack(lua_State *);
void LuaPushLatin1(lua_State *, const char *, size_t);
void LuaPushUrlParams(lua_State *, struct UrlParams *);
int SerializeObjectStart(char **, struct Serializer *, int, bool);
int SerializeObjectEnd(char **, struct Serializer *, int, bool);
int SerializeObjectIndent(char **, struct Serializer *, int);
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_THIRD_PARTY_LUA_COSMO_H_ */