diff --git a/src/lprocess.c b/src/lprocess.c index 293ad4d..5d9e040 100644 --- a/src/lprocess.c +++ b/src/lprocess.c @@ -5,7 +5,7 @@ #include "lua.h" #include "lualib.h" #include "lutil.h" - +#include "stream.h" #include #include @@ -15,7 +15,6 @@ #include #include #endif -//#include "stream.h" passed from spawn.h /* proc -- pid */ static int process_pid(lua_State *L) { diff --git a/src/stdioChannel.h b/src/stdioChannel.h index af93d41..267a760 100644 --- a/src/stdioChannel.h +++ b/src/stdioChannel.h @@ -1,6 +1,7 @@ #ifndef STDIO_CHANNEL_H_ #define STDIO_CHANNEL_H_ +#include "lauxlib.h" #include "stream.h" #define STDIO_STDIN 0 diff --git a/src/stream.h b/src/stream.h index 7805d92..058e9c4 100644 --- a/src/stream.h +++ b/src/stream.h @@ -1,34 +1,38 @@ -#include "lua.h" - -#ifdef _WIN32 -#include -#else -#include -#endif - -#define ELI_STREAM_R_METATABLE "ELI_STREAM_R_METATABLE" -#define ELI_STREAM_W_METATABLE "ELI_STREAM_W_METATABLE" -#define ELI_STREAM_RW_METATABLE "ELI_STREAM_RW_METATABLE" - -typedef struct ELI_STREAM { - int fd; - int closed; - int nonblocking; - int notDisposable; -} ELI_STREAM; - -typedef enum ELI_STREAM_KIND { - ELI_STREAM_R_KIND, - ELI_STREAM_W_KIND, - ELI_STREAM_RW_KIND, - ELI_STREAM_INVALID_KIND -} ELI_STREAM_KIND; - -int stream_read(lua_State *L, int fd, const char *opt, int nonblocking); -int stream_read_bytes(lua_State *L, int fd, size_t length, int nonblocking); -int stream_write(lua_State *L, int fd, const char *data, size_t datasize); -int stream_is_nonblocking(int fd); -int stream_set_nonblocking(int fd, int nonblocking); -int stream_as_filestream(lua_State *L, int fd, const char *mode); -int stream_close(int fd); -ELI_STREAM *new_stream(); +#ifndef ELI_STREAM_EXTRA_H_ +#define ELI_STREAM_EXTRA_H_ + +#include "lua.h" + +#ifdef _WIN32 +#include +#else +#include +#endif + +#define ELI_STREAM_R_METATABLE "ELI_STREAM_R_METATABLE" +#define ELI_STREAM_W_METATABLE "ELI_STREAM_W_METATABLE" +#define ELI_STREAM_RW_METATABLE "ELI_STREAM_RW_METATABLE" + +typedef struct ELI_STREAM { + int fd; + int closed; + int nonblocking; + int notDisposable; +} ELI_STREAM; + +typedef enum ELI_STREAM_KIND { + ELI_STREAM_R_KIND, + ELI_STREAM_W_KIND, + ELI_STREAM_RW_KIND, + ELI_STREAM_INVALID_KIND +} ELI_STREAM_KIND; + +int stream_read(lua_State *L, int fd, const char *opt, int nonblocking); +int stream_read_bytes(lua_State *L, int fd, size_t length, int nonblocking); +int stream_write(lua_State *L, int fd, const char *data, size_t datasize); +int stream_is_nonblocking(int fd); +int stream_set_nonblocking(int fd, int nonblocking); +int stream_as_filestream(lua_State *L, int fd, const char *mode); +int stream_close(int fd); +ELI_STREAM *new_stream(); +#endif \ No newline at end of file