Leonardo de Moura
09bed4786c
feat(lua): add semantic attachments for builtin arithmetical values to Lua API, improve mk_constant
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 15:15:04 -08:00
Leonardo de Moura
b5f0185729
fix(lua): replace lua_pushfstring with lua_pushstring
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 12:14:55 -08:00
Leonardo de Moura
450128e28b
refactor(lua): cleanup Lua bindings, and add accessor/tester to expr Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 11:46:09 -08:00
Leonardo de Moura
d257156b88
fix(lua): memory leaks, we should not use luaL_error because it does not unwind C++ stack
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 21:45:13 -08:00
Leonardo de Moura
cc17be1ef1
feat(lua): add is_* predicates
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-08 12:40:28 -08:00
Leonardo de Moura
c8b0c10c88
refactor(lua): make Lua a required (non-optional) package
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-08 10:56:29 -08:00
Leonardo de Moura
fb09fc9fe6
feat(lua): add set_global_function template, and to_name_ext function
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 21:54:57 -08:00
Leonardo de Moura
e7d508043b
fix(lua/numerics): errors when cross-compiling for Windows
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-05 13:35:34 -08:00
Leonardo de Moura
0ac8f2d8d9
feat(lua/sexpr): improve sexpr Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 21:28:17 -08:00
Leonardo de Moura
1e12ddc7a9
refactor(lua): add goodies for accessing Lean values on the Lua stack
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 19:45:15 -08:00
Leonardo de Moura
32d3990fc7
fix(lua): problem when compiling with clang++
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 15:05:04 -08:00
Leonardo de Moura
543aea65c9
chore(lua): rename init_* functions to open_*
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 13:54:51 -08:00
Leonardo de Moura
fd7e85f0bb
feat(lua): add safe_function template that catches Lean and C++ exceptions and convert them into Lua errors
...
I'm using the approach described at:
http://stackoverflow.com/questions/4615890/how-to-handle-c-exceptions-when-calling-functions-from-lua
BTW, in some Lua versions, the C++ exceptions are correctly propagated.
I think we should not rely on features of particular implementations.
For example, LuaJIT does not propagate C++ exceptions.
Whenever an exception is thrown from C++ code invoked from LuaJit, LuaJit interrupts the execution and converts it to an error "C++ exception".
On the other hand, Lua 5.2 PUC-Rio interpreter (for Ubuntu) seem to propagate the C++ exceptions.
The template safe_function solves the issue. It will also produce a Lua error whenever the function being wrapped throws an exception. The error message is based on the "what()" method.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-03 14:42:57 -08:00
Leonardo de Moura
df7dbe17b5
feat(lua/util): remove dependency on luaL_setfuncs
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-03 12:16:23 -08:00
Leonardo de Moura
e2da8c1f4d
feat(lua/numerics): expose mpz and mpq numbers in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-03 12:05:54 -08:00