From f389c7fe367c7df6797b1404ff48cecea6729cfa Mon Sep 17 00:00:00 2001 From: ThePhD Date: Wed, 27 Jan 2016 01:07:16 -0500 Subject: [PATCH] True luajit compatibility --- sol/compatibility.hpp | 2 +- sol/compatibility/5.0.0.h | 2 +- sol/compatibility/5.1.0.h | 22 +++++++++++++++++++++- sol/compatibility/5.x.x.h | 2 +- sol/compatibility/5.x.x.inl | 2 +- sol/compatibility/version.hpp | 2 +- sol/proxy.hpp | 4 ---- sol/reference.hpp | 4 ---- sol/stack.hpp | 4 ---- sol/table.hpp | 3 ++- 10 files changed, 28 insertions(+), 19 deletions(-) diff --git a/sol/compatibility.hpp b/sol/compatibility.hpp index cde8d0ab..c6303944 100644 --- a/sol/compatibility.hpp +++ b/sol/compatibility.hpp @@ -1,6 +1,6 @@ // The MIT License (MIT) -// Copyright (c) 2013-2015 Danny Y., Rapptz +// Copyright (c) 2013-2015 Rapptz and contributors // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in diff --git a/sol/compatibility/5.0.0.h b/sol/compatibility/5.0.0.h index 78192d5d..5b8bcac4 100644 --- a/sol/compatibility/5.0.0.h +++ b/sol/compatibility/5.0.0.h @@ -1,6 +1,6 @@ // The MIT License (MIT) -// Copyright (c) 2013-2015 Danny Y., Rapptz +// Copyright (c) 2013-2015 Rapptz and contributors // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in diff --git a/sol/compatibility/5.1.0.h b/sol/compatibility/5.1.0.h index 0154c8b4..054772a9 100644 --- a/sol/compatibility/5.1.0.h +++ b/sol/compatibility/5.1.0.h @@ -1,6 +1,6 @@ // The MIT License (MIT) -// Copyright (c) 2013-2015 Danny Y., Rapptz +// Copyright (c) 2013-2015 Rapptz and contributors // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in @@ -46,6 +46,18 @@ #endif #endif +/* LuaJIT does not have the updated error codes for thread status/function returns */ +#ifndef LUA_ERRGCMM +#define LUA_ERRGCMM (LUA_ERRERR + 1) +#endif // LUA_ERRGCMM + +/* LuaJIT does not support continuation contexts / return error codes? */ +#ifndef LUA_KCONTEXT +#define LUA_KCONTEXT std::ptrdiff_t +typedef LUA_KCONTEXT lua_KContext; +typedef int(*lua_KFunction) (lua_State *L, int status, lua_KContext ctx); +#endif // LUA_KCONTEXT + #define LUA_OPADD 0 #define LUA_OPSUB 1 #define LUA_OPMUL 2 @@ -72,6 +84,14 @@ typedef struct luaL_Buffer_52 { #define lua_rawlen(L, i) lua_objlen(L, i) +void lua_callk(lua_State *L, int nargs, int nresults, lua_KContext, lua_KFunction) { + // should probably warn the user of Lua 5.1 that continuation isn't supported... + lua_call(L, nargs, nresults); +} +int lua_pcallk(lua_State *L, int nargs, int nresults, int errfunc, lua_KContext, lua_KFunction) { + // should probably warn the user of Lua 5.1 that continuation isn't supported... + return lua_pcall(L, nargs, nresults, errfunc); +} void lua_arith(lua_State *L, int op); int lua_compare(lua_State *L, int idx1, int idx2, int op); void lua_pushunsigned(lua_State *L, lua_Unsigned n); diff --git a/sol/compatibility/5.x.x.h b/sol/compatibility/5.x.x.h index 9eb6f5a0..7de1ff8d 100644 --- a/sol/compatibility/5.x.x.h +++ b/sol/compatibility/5.x.x.h @@ -1,6 +1,6 @@ // The MIT License (MIT) -// Copyright (c) 2013-2015 Danny Y., Rapptz +// Copyright (c) 2013-2015 Rapptz and contributors // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in diff --git a/sol/compatibility/5.x.x.inl b/sol/compatibility/5.x.x.inl index 25c0b106..2ada1572 100644 --- a/sol/compatibility/5.x.x.inl +++ b/sol/compatibility/5.x.x.inl @@ -1,6 +1,6 @@ // The MIT License (MIT) -// Copyright (c) 2013-2015 Danny Y., Rapptz +// Copyright (c) 2013-2015 Rapptz and contributors // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in diff --git a/sol/compatibility/version.hpp b/sol/compatibility/version.hpp index e003465a..f69aea85 100644 --- a/sol/compatibility/version.hpp +++ b/sol/compatibility/version.hpp @@ -1,6 +1,6 @@ // The MIT License (MIT) -// Copyright (c) 2013-2015 Danny Y., Rapptz +// Copyright (c) 2013-2015 Rapptz and contributors // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in diff --git a/sol/proxy.hpp b/sol/proxy.hpp index e3076043..e02e0708 100644 --- a/sol/proxy.hpp +++ b/sol/proxy.hpp @@ -1,10 +1,6 @@ // The MIT License (MIT) -<<<<<<< HEAD -// Copyright (c) 2013-2015 Danny Y., Rapptz -======= // Copyright (c) 2013-2015 Rapptz and contributors ->>>>>>> root/develop // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in diff --git a/sol/reference.hpp b/sol/reference.hpp index 1544d712..9c10f553 100644 --- a/sol/reference.hpp +++ b/sol/reference.hpp @@ -1,10 +1,6 @@ // The MIT License (MIT) -<<<<<<< HEAD -// Copyright (c) 2013-2015 Danny Y., Rapptz -======= // Copyright (c) 2013-2015 Rapptz and contributors ->>>>>>> root/develop // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in diff --git a/sol/stack.hpp b/sol/stack.hpp index 203fc332..2a8f231d 100644 --- a/sol/stack.hpp +++ b/sol/stack.hpp @@ -1,10 +1,6 @@ // The MIT License (MIT) -<<<<<<< HEAD -// Copyright (c) 2013-2015 Danny Y., Rapptz -======= // Copyright (c) 2013-2015 Rapptz and contributors ->>>>>>> root/develop // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in diff --git a/sol/table.hpp b/sol/table.hpp index 05557229..622a1a42 100644 --- a/sol/table.hpp +++ b/sol/table.hpp @@ -25,6 +25,7 @@ #include "table_core.hpp" namespace sol { - typedef table_core } // sol + typedef table_core table; +} // sol #endif // SOL_TABLE_HPP