[Bug 1039] New: OCL Lua component does not compile with Lua 5.2

http://bugs.orocos.org/show_bug.cgi?id=1039

Summary: OCL Lua component does not compile with Lua 5.2
Product: Toolchain
Version: master
Platform: All
OS/Version: All
Status: NEW
Severity: critical
Priority: P3
Component: Lua
AssignedTo: orocos-dev [..] ...
ReportedBy: ruben [dot] smits [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

Hi,

I'm trying to compile OCL on my OSX Mountain Lion System using Macports to get
all dependencies. Currently Macports contains Lua 5.2 by default. However
building OCL against Lua 5.2 on my system results in the following error:

[ 40%] Building C object lua/CMakeFiles/lua-repl.dir/lua-repl.c.o
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:36:31: error: use
of undeclared identifier
'LUA_PROGNAME'
static const char *progname = LUA_PROGNAME;
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:89:19: error: use
of undeclared identifier
'LUA_GLOBALSINDEX'
lua_getfield(L, LUA_GLOBALSINDEX, "debug");
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:165:19: error: use
of undeclared identifier
'LUA_GLOBALSINDEX'
lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2");
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:167:35: error: use
of undeclared identifier
'LUA_PROMPT'
if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2);
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:167:48: error: use
of undeclared identifier
'LUA_PROMPT2'
if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2);
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:188:15: error: use
of undeclared identifier
'LUA_MAXINPUT'
char buffer[LUA_MAXINPUT];
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:192:7: warning:
implicit declaration of
function 'lua_readline' is invalid in C99
[-Wimplicit-function-declaration]
if (lua_readline(L, b, prmt) == 0)
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:201:3: warning:
implicit declaration of
function 'lua_freeline' is invalid in C99
[-Wimplicit-function-declaration]
lua_freeline(L, b);
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:212:53: warning:
implicit declaration of
function 'lua_strlen' is invalid in C99 [-Wimplicit-function-declaration]
status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1),
"=stdin");
^
/opt/local/include/lauxlib.h:134:56: note: expanded from macro
'luaL_loadbuffer'
#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL)
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:220:3: warning:
implicit declaration of
function 'lua_saveline' is invalid in C99
[-Wimplicit-function-declaration]
lua_saveline(L, 1);
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:334:29: error: use
of undeclared identifier
'LUA_INIT'
const char *init = getenv(LUA_INIT);
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:339:34: error:
expected ')'
return dostring(L, init, "=" LUA_INIT);
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:339:20: note: to
match this '('
return dostring(L, init, "=" LUA_INIT);
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:377:9: warning:
implicit declaration of
function 'lua_stdin_is_tty' is invalid in C99
[-Wimplicit-function-declaration]
if (lua_stdin_is_tty()) {
^
/Users/vm/orocos_ws/src/orocos_toolchain/ocl/lua/lua-repl.c:411:12: warning:
implicit declaration of
function 'lua_cpcall' is invalid in C99 [-Wimplicit-function-declaration]
status = lua_cpcall(L, &pmain, &s);

Apparently the defines of the missing identifiers have been moved into lua.c
and unreachable for OCL's lua-repl.c

Ruben