Leonardo de Moura
ac6c18321a
fix(lua): make sure environment objects can be safely accessed/updated from current threads
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:29:53 -08:00
Leonardo de Moura
cc7b5b7e50
fix(lua): disable custom allocation for Lua, it is crashing
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 18:20:52 -08:00
Leonardo de Moura
7d49df3985
style(lua): fix cpplint.py warnings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 17:46:39 -08:00
Leonardo de Moura
69b41eae70
feat(lua): add support for multiple execution threads in the Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 16:25:17 -08:00
Leonardo de Moura
95785c7aaa
feat(lua): add State objects, it allows us to create several Lua State objects in a lua script
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 15:05:50 -08:00
Leonardo de Moura
7cc6c35eee
feat(lua/name): add hash method to name objects
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 13:32:56 -08:00
Leonardo de Moura
8dd85ebc15
fix(lua): typos and a bug in the expr Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 13:11:06 -08:00
Leonardo de Moura
b227775a07
test(lua): add tests for format object
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 12:58:47 -08:00
Leonardo de Moura
dbdb9a41af
style(lua): use C++-style cast
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
8c140ff86f
feat(lua): allow lua scripts (embedded in Lean files) to access the environment
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
9d61fcf85b
feat(lua): expose environment objects in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
119e0ba5e6
feat(lua): add to_nonnull_expr
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
8dd62e76be
feat(lua): add mk_metavar to Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
6b71fb346c
fix(lua): add missing files for local_context
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-09 12:47:52 -08:00
Leonardo de Moura
554defe89d
feat(lua): expose local_context objects in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-09 12:18:46 -08:00
Leonardo de Moura
ad2de3b53c
feat(lua): expose level objects in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-08 17:08:24 -08:00
Leonardo de Moura
5a97f730af
feat(lua): add Type function
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-08 15:52:58 -08:00
Leonardo de Moura
32605d8266
feat(lua): expose level objects in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-08 15:38:00 -08:00
Leonardo de Moura
bbab454b6c
fix(lua): cpplint.py does not like multiline strings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-08 13:27:20 -08:00
Leonardo de Moura
ec56ba72ea
fix(lua): cygwing compilation problem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-08 13:27:20 -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
5c35a9ad0a
feat(lua): add Consts function
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-08 12:09:46 -08:00
Leonardo de Moura
b7d8391306
refactor(lua): remove duplicate code, separate lua_exception, add missing #pragma once
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-08 11:59:47 -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
a10aa0880f
fix(build): add CheckLuaObjlen.cc test, not every Lua version has the function lua_objlen
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-08 08:26:04 -08:00
Leonardo de Moura
b57ad80d5e
feat(lua): expose basic API for Lean expressions in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 21:54:57 -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
db8b16641c
chore(build): check if the Lua installed in the system supports lua_newstate
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 21:54:57 -08:00
Leonardo de Moura
9000c7c2fa
feat(lua): expose format objects in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 21:54:42 -08:00
Leonardo de Moura
6f432b4094
feat(lua): make Lua use our malloc/realloc, catch error when initializing Lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 15:52:39 -08:00
Leonardo de Moura
57b9657bf0
feat(lua): add lua_exception for wrapping lua errors, and improve Lua error messages in the Lean frontend
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 15:19:26 -08:00
Leonardo de Moura
a9b2be0b9c
feat(frontends/lean): add support for embedded Lua scripts in Lean files
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 13:56:04 -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
0cc475e581
fix(lua/sexpr): make sexpr bindings robust
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-05 13:03:32 -08:00
Leonardo de Moura
055cc7f957
fix(lua): make testudata compatible with Lua 5.1
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-05 11:35:09 -08:00
Leonardo de Moura
5a01f167df
fix(lua): expose missing functions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 21:33:33 -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
f13a97397f
feat(lua): expose s-expressions in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 19:58:32 -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
47c289a24b
refactor(lua/name): improve name bindings for Lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 18:48:21 -08:00
Leonardo de Moura
3c475e890d
refactor(lua/options): improve options bindings for Lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 18:46:58 -08:00
Leonardo de Moura
7b77863507
refactor(lua/name): improve name bindings for Lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 18:44:20 -08:00
Leonardo de Moura
f488e6bbfc
fix(lua): safe_function_wrapper
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 18:12:53 -08:00
Leonardo de Moura
92b2591a6f
style(lua): add missing include
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 16:29:47 -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
0579970fc5
feat(lua): expose options object in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 14:38:49 -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
Leonardo de Moura
ccd95a9b66
fix(lua/name): fix memory leak
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-02 20:57:41 -07:00
Leonardo de Moura
dbf2d56c77
feat(lua/name): expose hierarchical names in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-02 20:49:42 -07:00