summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-07-27 22:03:45 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-07-27 22:03:45 (GMT)
commitca5c7b0a957e651b12083a43e700a19d54fd1016 (patch)
treec781f240380368950df5335aab32978cd7121b0e /3rdParty/Lua/luasocket/src/io.c
parent6f26d9aa86f0909af13b23b1a925b8d492e74154 (diff)
downloadswift-contrib-ca5c7b0a957e651b12083a43e700a19d54fd1016.zip
swift-contrib-ca5c7b0a957e651b12083a43e700a19d54fd1016.tar.bz2
First bash at integrating luasocket into Sluift
Diffstat (limited to '3rdParty/Lua/luasocket/src/io.c')
-rw-r--r--3rdParty/Lua/luasocket/src/io.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/3rdParty/Lua/luasocket/src/io.c b/3rdParty/Lua/luasocket/src/io.c
new file mode 100644
index 0000000..06dc50e
--- /dev/null
+++ b/3rdParty/Lua/luasocket/src/io.c
@@ -0,0 +1,32 @@
+/*=========================================================================*\
+* Input/Output abstraction
+* LuaSocket toolkit
+*
+* RCS ID: $Id: io.c,v 1.6 2005/09/29 06:11:41 diego Exp $
+\*=========================================================================*/
+#include "io.h"
+
+/*=========================================================================*\
+* Exported functions
+\*=========================================================================*/
+/*-------------------------------------------------------------------------*\
+* Initializes C structure
+\*-------------------------------------------------------------------------*/
+void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx) {
+ io->send = send;
+ io->recv = recv;
+ io->error = error;
+ io->ctx = ctx;
+}
+
+/*-------------------------------------------------------------------------*\
+* I/O error strings
+\*-------------------------------------------------------------------------*/
+const char *io_strerror(int err) {
+ switch (err) {
+ case IO_DONE: return NULL;
+ case IO_CLOSED: return "closed";
+ case IO_TIMEOUT: return "timeout";
+ default: return "unknown error";
+ }
+}