summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luasocket
diff options
context:
space:
mode:
authorLuigi Scarso <luigi.scarso@gmail.com>2018-09-05 21:30:41 +0000
committerLuigi Scarso <luigi.scarso@gmail.com>2018-09-05 21:30:41 +0000
commit1b8b254a766350291f8e7e19feaf6326ebabe633 (patch)
tree8a20823763635906b94a68b72541a10dc6f91377 /Build/source/texk/web2c/luatexdir/luasocket
parentef7aedbc1cabb3eebb59082e349f9792c9c4d3c1 (diff)
sync with luatex revision 6924.
git-svn-id: svn://tug.org/texlive/trunk@48591 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luasocket')
-rw-r--r--Build/source/texk/web2c/luatexdir/luasocket/src/lua_preload.c1
-rw-r--r--Build/source/texk/web2c/luatexdir/luasocket/src/options.c4
-rw-r--r--Build/source/texk/web2c/luatexdir/luasocket/src/serial.c226
3 files changed, 116 insertions, 115 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luasocket/src/lua_preload.c b/Build/source/texk/web2c/luatexdir/luasocket/src/lua_preload.c
index e9433dfdb12..838871c1d66 100644
--- a/Build/source/texk/web2c/luatexdir/luasocket/src/lua_preload.c
+++ b/Build/source/texk/web2c/luatexdir/luasocket/src/lua_preload.c
@@ -15,6 +15,7 @@ int luatex_http_lua_open(lua_State*);
int luatex_ftp_lua_open(lua_State*);
+extern void luatex_socketlua_open (lua_State *) ;
#include "ftp_lua.c"
#include "headers_lua.c"
#include "http_lua.c"
diff --git a/Build/source/texk/web2c/luatexdir/luasocket/src/options.c b/Build/source/texk/web2c/luatexdir/luasocket/src/options.c
index 20f4c280250..fabfe8ce3e6 100644
--- a/Build/source/texk/web2c/luatexdir/luasocket/src/options.c
+++ b/Build/source/texk/web2c/luatexdir/luasocket/src/options.c
@@ -37,7 +37,7 @@ int opt_meth_setoption(lua_State *L, p_opt opt, p_socket ps)
while (opt->name && strcmp(name, opt->name))
opt++;
if (!opt->func) {
- char msg[45];
+ char msg[57];
sprintf(msg, "unsupported option `%.35s'", name);
luaL_argerror(L, 2, msg);
}
@@ -50,7 +50,7 @@ int opt_meth_getoption(lua_State *L, p_opt opt, p_socket ps)
while (opt->name && strcmp(name, opt->name))
opt++;
if (!opt->func) {
- char msg[45];
+ char msg[57];
sprintf(msg, "unsupported option `%.35s'", name);
luaL_argerror(L, 2, msg);
}
diff --git a/Build/source/texk/web2c/luatexdir/luasocket/src/serial.c b/Build/source/texk/web2c/luatexdir/luasocket/src/serial.c
index f121bbf0a61..b666e61f939 100644
--- a/Build/source/texk/web2c/luatexdir/luasocket/src/serial.c
+++ b/Build/source/texk/web2c/luatexdir/luasocket/src/serial.c
@@ -31,44 +31,44 @@ have only one object type.
/*=========================================================================*\
* Internal function prototypes
\*=========================================================================*/
-static int global_create(lua_State *L);
-static int meth_send(lua_State *L);
-static int meth_receive(lua_State *L);
-static int meth_close(lua_State *L);
-static int meth_settimeout(lua_State *L);
-static int meth_getfd(lua_State *L);
-static int meth_setfd(lua_State *L);
-static int meth_dirty(lua_State *L);
-static int meth_getstats(lua_State *L);
-static int meth_setstats(lua_State *L);
+/*static int global_create(lua_State *L);*/
+/* static int meth_send(lua_State *L); */
+/* static int meth_receive(lua_State *L); */
+/* static int meth_close(lua_State *L); */
+/* static int meth_settimeout(lua_State *L); */
+/* static int meth_getfd(lua_State *L); */
+/* static int meth_setfd(lua_State *L); */
+/* static int meth_dirty(lua_State *L); */
+/* static int meth_getstats(lua_State *L); */
+/* static int meth_setstats(lua_State *L); */
/* serial object methods */
-static luaL_Reg serial_methods[] = {
- {"__gc", meth_close},
- {"__tostring", auxiliar_tostring},
- {"close", meth_close},
- {"dirty", meth_dirty},
- {"getfd", meth_getfd},
- {"getstats", meth_getstats},
- {"setstats", meth_setstats},
- {"receive", meth_receive},
- {"send", meth_send},
- {"setfd", meth_setfd},
- {"settimeout", meth_settimeout},
- {NULL, NULL}
-};
+/* static luaL_Reg serial_methods[] = { */
+/* {"__gc", meth_close}, */
+/* {"__tostring", auxiliar_tostring}, */
+/* {"close", meth_close}, */
+/* {"dirty", meth_dirty}, */
+/* {"getfd", meth_getfd}, */
+/* {"getstats", meth_getstats}, */
+/* {"setstats", meth_setstats}, */
+/* {"receive", meth_receive}, */
+/* {"send", meth_send}, */
+/* {"setfd", meth_setfd}, */
+/* {"settimeout", meth_settimeout}, */
+/* {NULL, NULL} */
+/* }; */
/*-------------------------------------------------------------------------*\
-* Initializes module
+* Initializes module (luatex extension, unused )
\*-------------------------------------------------------------------------*/
-LUASOCKET_API int luaopen_socket_serial(lua_State *L) {
- /* create classes */
- auxiliar_newclass(L, "serial{client}", serial_methods);
- /* create class groups */
- auxiliar_add2group(L, "serial{client}", "serial{any}");
- lua_pushcfunction(L, global_create);
- return 1;
-}
+/* LUASOCKET_API int luaopen_socket_serial(lua_State *L) { */
+/* /\* create classes *\/ */
+/* auxiliar_newclass(L, "serial{client}", serial_methods); */
+/* /\* create class groups *\/ */
+/* auxiliar_add2group(L, "serial{client}", "serial{any}"); */
+/* lua_pushcfunction(L, global_create); */
+/* return 1; */
+/* } */
/*=========================================================================*\
* Lua methods
@@ -76,67 +76,67 @@ LUASOCKET_API int luaopen_socket_serial(lua_State *L) {
/*-------------------------------------------------------------------------*\
* Just call buffered IO methods
\*-------------------------------------------------------------------------*/
-static int meth_send(lua_State *L) {
- p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1);
- return buffer_meth_send(L, &un->buf);
-}
-
-static int meth_receive(lua_State *L) {
- p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1);
- return buffer_meth_receive(L, &un->buf);
-}
-
-static int meth_getstats(lua_State *L) {
- p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1);
- return buffer_meth_getstats(L, &un->buf);
-}
-
-static int meth_setstats(lua_State *L) {
- p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1);
- return buffer_meth_setstats(L, &un->buf);
-}
+/* static int meth_send(lua_State *L) { */
+/* p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1); */
+/* return buffer_meth_send(L, &un->buf); */
+/* } */
+
+/* static int meth_receive(lua_State *L) { */
+/* p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1); */
+/* return buffer_meth_receive(L, &un->buf); */
+/* } */
+
+/* static int meth_getstats(lua_State *L) { */
+/* p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1); */
+/* return buffer_meth_getstats(L, &un->buf); */
+/* } */
+
+/* static int meth_setstats(lua_State *L) { */
+/* p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1); */
+/* return buffer_meth_setstats(L, &un->buf); */
+/* } */
/*-------------------------------------------------------------------------*\
* Select support methods
\*-------------------------------------------------------------------------*/
-static int meth_getfd(lua_State *L) {
- p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1);
- lua_pushnumber(L, (int) un->sock);
- return 1;
-}
-
-/* this is very dangerous, but can be handy for those that are brave enough */
-static int meth_setfd(lua_State *L) {
- p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1);
- un->sock = (t_socket) luaL_checknumber(L, 2);
- return 0;
-}
-
-static int meth_dirty(lua_State *L) {
- p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1);
- lua_pushboolean(L, !buffer_isempty(&un->buf));
- return 1;
-}
+/* static int meth_getfd(lua_State *L) { */
+/* p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); */
+/* lua_pushnumber(L, (int) un->sock); */
+/* return 1; */
+/* } */
+
+/* /\* this is very dangerous, but can be handy for those that are brave enough *\/ */
+/* static int meth_setfd(lua_State *L) { */
+/* p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); */
+/* un->sock = (t_socket) luaL_checknumber(L, 2); */
+/* return 0; */
+/* } */
+
+/* static int meth_dirty(lua_State *L) { */
+/* p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); */
+/* lua_pushboolean(L, !buffer_isempty(&un->buf)); */
+/* return 1; */
+/* } */
/*-------------------------------------------------------------------------*\
* Closes socket used by object
\*-------------------------------------------------------------------------*/
-static int meth_close(lua_State *L)
-{
- p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1);
- socket_destroy(&un->sock);
- lua_pushnumber(L, 1);
- return 1;
-}
+/* static int meth_close(lua_State *L) */
+/* { */
+/* p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); */
+/* socket_destroy(&un->sock); */
+/* lua_pushnumber(L, 1); */
+/* return 1; */
+/* } */
/*-------------------------------------------------------------------------*\
* Just call tm methods
\*-------------------------------------------------------------------------*/
-static int meth_settimeout(lua_State *L) {
- p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1);
- return timeout_meth_settimeout(L, &un->tm);
-}
+/* static int meth_settimeout(lua_State *L) { */
+/* p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); */
+/* return timeout_meth_settimeout(L, &un->tm); */
+/* } */
/*=========================================================================*\
* Library functions
@@ -146,35 +146,35 @@ static int meth_settimeout(lua_State *L) {
/*-------------------------------------------------------------------------*\
* Creates a serial object
\*-------------------------------------------------------------------------*/
-static int global_create(lua_State *L) {
- const char* path = luaL_checkstring(L, 1);
-
- /* allocate unix object */
- p_unix un = (p_unix) lua_newuserdata(L, sizeof(t_unix));
-
- /* open serial device */
-#if defined(_WIN32)
- t_socket sock = open(path, O_RDWR);
-#else
- t_socket sock = open(path, O_NOCTTY|O_RDWR);
-#endif
-
- /*printf("open %s on %d\n", path, sock);*/
-
- if (sock < 0) {
- lua_pushnil(L);
- lua_pushstring(L, socket_strerror(errno));
- lua_pushnumber(L, errno);
- return 3;
- }
- /* set its type as client object */
- auxiliar_setclass(L, "serial{client}", -1);
- /* initialize remaining structure fields */
- socket_setnonblocking(&sock);
- un->sock = sock;
- io_init(&un->io, (p_send) socket_write, (p_recv) socket_read,
- (p_error) socket_ioerror, &un->sock);
- timeout_init(&un->tm, -1, -1);
- buffer_init(&un->buf, &un->io, &un->tm);
- return 1;
-}
+/* static int global_create(lua_State *L) { */
+/* const char* path = luaL_checkstring(L, 1); */
+
+/* /\* allocate unix object *\/ */
+/* p_unix un = (p_unix) lua_newuserdata(L, sizeof(t_unix)); */
+
+/* /\* open serial device *\/ */
+/* #if defined(_WIN32) */
+/* t_socket sock = open(path, O_RDWR); */
+/* #else */
+/* t_socket sock = open(path, O_NOCTTY|O_RDWR); */
+/* #endif */
+
+/* /\*printf("open %s on %d\n", path, sock);*\/ */
+
+/* if (sock < 0) { */
+/* lua_pushnil(L); */
+/* lua_pushstring(L, socket_strerror(errno)); */
+/* lua_pushnumber(L, errno); */
+/* return 3; */
+/* } */
+/* /\* set its type as client object *\/ */
+/* auxiliar_setclass(L, "serial{client}", -1); */
+/* /\* initialize remaining structure fields *\/ */
+/* socket_setnonblocking(&sock); */
+/* un->sock = sock; */
+/* io_init(&un->io, (p_send) socket_write, (p_recv) socket_read, */
+/* (p_error) socket_ioerror, &un->sock); */
+/* timeout_init(&un->tm, -1, -1); */
+/* buffer_init(&un->buf, &un->io, &un->tm); */
+/* return 1; */
+/* } */