79f01bc889
Initial changes needed for building Mixbus (with MSVC) as version 5
...
(Mixbus itself will probably need extra changes)
2018-09-10 07:14:59 +01:00
f2ca0c144b
Customize Lua GC, add object-memory-lock API.
...
Add custom API to prevent Lua Objects from being garbage collected.
This is intended to for Ardour LuaBridge bindings (~1MB Objects:
tables, functions and userdata).
The bindings are persistent and the gc can skip them in mark & sweep
phases. This is a significant performance improvement for garbage
collection.
Note. The next version of Lua (5.4) will come with a generational-gc
rather than an incremental, so extending the API at this point in time
is acceptable.
2018-03-19 02:23:09 +01:00
89f0604d89
Allow loadfile in non-rt scripts
2018-03-06 21:47:30 +01:00
b9c9777b9a
When building with MSVC, allow for the fact that Mixbus and Ardour can be using different versions of the SESSION_FILE format
2018-02-15 09:03:32 +00:00
6f019faaa0
Accommodate the change from libtimecode to libtemporal
2018-02-14 10:02:11 +00:00
77d16999b5
Tweak Lua GC
2017-11-29 12:06:42 +01:00
44cf448839
update to lua-5.3.4
2017-11-29 12:06:42 +01:00
e951e68780
Add luaRef is Boolean
2017-08-18 20:42:55 +02:00
0191a9c4c2
Centralize Lua sandboxing
2017-08-10 02:25:49 +02:00
ea8c6e9fc8
Fix hiding Lua __metatable -- prevent setmetatable() override
2017-03-30 05:06:34 +02:00
412b6a4cb9
Lua: make external (static) functions available for const objects.
...
This fixes iterators on const std::lists<>& and const std::map<>&
2017-03-30 04:15:28 +02:00
4a180e68ba
Special case const std::string& Lua binding.
...
since 6dc3bdf
, a const string reference would leave scope with Lua code
fn("text")
calling a C++
fn (const std::string&)
before the C++ function is called.
2017-03-22 16:59:02 +01:00
35dcd46d7d
remove cruft (following 6dc3bdf
)
2017-03-22 16:55:19 +01:00
6dc3bdf252
Fix LuaBindings TypeList copy-ctor
...
Determining the class type copy constructed references.
Const-references passed to C++ functions were copies.
2017-03-18 18:30:51 +01:00
bc300ddab7
Make Lua std::set bindings more generic, (prepare for multiset etc)
2017-03-18 14:35:29 +01:00
51d43c6e14
drop lua documentation for deprecated "sameinstance()"
2017-03-16 20:56:32 +01:00
a2094b6831
Lua: provide instance-equal check as '==' comparator.
...
This deprecated explicit the "sameinstance()" method
2017-03-16 20:08:17 +01:00
71fd94b422
LuaBridge: Dedicated type for pointer-lists and const version
...
"class C*" cannot be defined nor resolved, so STL containers
to class instance pointers need to be special-cased.
2017-02-23 22:32:32 +01:00
37dc93b40a
luaBridge support const references to class-instance pointers
...
Support passing "T*" as as "const T* &" argument
e.g. std::list<T*>::push_back ( const T* & )
2017-02-23 22:32:32 +01:00
226b2a526e
Add Lua bindings for std::list ::front() and ::back()
2017-02-20 00:30:15 +01:00
659701c59b
Fix lua-doc (Null pointer c'tor doc)
2017-02-14 14:44:22 +01:00
6f7f527e1d
Lua add an Empty/Nil shared-pointer constructor
2017-01-21 20:18:27 +01:00
d0b42aee0e
LuaBindings: prefer shared_ptr over weak_ptr
2017-01-21 20:18:27 +01:00
b25cd7683b
Allow Lua bindings up to 10 args
2017-01-20 21:23:05 +01:00
134b69f267
Fix shared-pointer list creation from Lua
2017-01-08 00:30:41 +01:00
86bfe4eff6
Lua binding for std::map<>::at()
2016-10-07 03:39:22 +02:00
0ff233d234
Update our MSVC project files to generate the most recent Ardour session file format (ver 5) rather than the older v3 format
2016-08-30 07:15:00 +01:00
c64b8662a6
fix copy/paste typo in 1d7c14496
2016-08-27 15:53:38 +02:00
a4da0747e1
allow to access data-members in weak/shared ptr classes
2016-08-26 19:01:09 +02:00
1d7c144967
add "sameinstance()" lua binding for all shared/weak ptrs
2016-08-26 18:25:15 +02:00
c9f0657c86
tweak lua GC (once again)
...
fixes OOM with extreme automation in HP/LP.
2016-08-26 01:18:48 +02:00
bc0bb6cae9
extend lua-doc to show properties
2016-08-16 00:25:59 +02:00
3b7dbdfeb8
Re-enable luabridge addProperty()
...
In preparation to expose ARDOUR::SessionConfiguration.
Also change the return-type to bool to match Ardour's set/get API
2016-08-15 22:25:56 +02:00
520dcf8cdf
rework lua-bridge C++ variable references
...
Since lua functions are closures, C++ methods that pass arguments by
reference cannot be used directly. The previous approach (boost::ref)
failed with clang. Assume the following:
void foo (float&) { }
static inline float& bar () {
boost::reference_wrapper<float> r (42);
return r.get ();
}
foo ( bar () );
With gcc, "r" goes out of scope after foo's arguments are processed
and all is well.
But with clang, "r" already leave scope when *inlined* bar() returns.
Solution: allocate some user-data on the lua-stack to hold the reference.
There is no reference to this user-data so lua will eventually
garbage collect it.
(theoretically, creating the table which holds the return-values
could trigger an emergency garbage collection when memory is low and
free the reference just while they're being pushed to the table, then
gain FuncArgs<Params> already dereferenced them all as variable on the
C stack -- probably again compiler specific)
2016-07-18 23:52:40 +02:00
855618eb5f
amend previous commit (forgotten checkin)
2016-07-18 13:11:18 +02:00
c5fb7e1d83
update to lua-5.3.3
2016-07-18 12:28:36 +02:00
44a3f042a7
prepare sharing C++ class instances across lua-interpreters
...
in particular: lua-lifefime (!) C++ instances.
This allows for dynamic allocation of custom user-data, bound to
the lifetime of the allocating lua-context.
2016-07-07 15:37:11 +02:00
a2f249d1d7
tweak lua gc
...
lua C++ bindings require ~400KB worth of tables now; so bump memory
available to rt-safe scripts (full interpreter) to 2MB.
Also switch to incremental GC.
2016-07-06 03:32:08 +02:00
Sam Thursfield
e37b250d4d
Use correct type of std::map::count
...
Compiling Ardour commit ec8a4de015
with GCC
6.1.1 (on Fedora 24) gave this build failure:
In file included from /home/sam/ardour/libs/lua/LuaBridge/LuaBridge.h:154:0,
from ../tools/luadevel/devel.cc:16:
/home/sam/ardour/libs/lua/LuaBridge/detail/Namespace.h: In instantiation of ‘luabridge::Namespace::Class<std::map<K, V> > luabridge::Namespace::beginStdMap(const char*) [with K = std::__cxx11::basic_string<char>; V = std::__cxx11::basic_string<char>]’:
../tools/luadevel/devel.cc:89:60: required from here
/home/sam/ardour/libs/lua/LuaBridge/detail/Namespace.h:1666:30: error: no matches converting function ‘count’ to type ‘void (class std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::*)()’
.addFunction ("count", (void (LT::*)())<::count)
^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/6.1.1/map:61:0,
from /home/sam/ardour/libs/lua/LuaBridge/LuaBridge.h:45,
from ../tools/luadevel/devel.cc:16:
/usr/include/c++/6.1.1/bits/stl_map.h:1131:2: note: candidates are: template<class _Kt> decltype (((const std::map<_Key, _Tp, _Compare, _Alloc>*)this)->std::map<_Key, _Tp, _Compare, _Alloc>::_M_t._M_count_tr(__x)) std::map<_Key, _Tp, _Compare, _Alloc>::count(const _Kt&) const [with _Kt = _Kt; _Key = std::__cxx11::basic_string<char>; _Tp = std::__cxx11::basic_string<char>; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >]
count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x))
^~~~~
/usr/include/c++/6.1.1/bits/stl_map.h:1125:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::size_type std::map<_Key, _Tp, _Compare, _Alloc>::count(const key_type&) const [with _Key = std::__cxx11::basic_string<char>; _Tp = std::__cxx11::basic_string<char>; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >; std::map<_Key, _Tp, _Compare, _Alloc>::size_type = long unsigned int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::__cxx11::basic_string<char>]
count(const key_type& __x) const
^~~~~
Casting std::map::count to the correct type instead of a fake void()
type fixes the compile failure.
2016-06-26 16:18:34 +02:00
67083d65e4
add lua/C++ dynamic_cast<>
2016-06-01 13:59:31 +02:00
f87cd4435d
allow lua binding functions with up to 9 parameters
...
e.g new_midi_track()
2016-05-31 23:51:22 +02:00
50d6f146f4
allow lua to access array at an offset
2016-05-21 15:55:14 +02:00
204c8016c7
allow to compare C class instances from lua
2016-04-14 03:08:02 +02:00
6f7ac64d42
Modify 'getIdentityKey()' function to have LuaBridge_API linkage when building with MSVC (rather than simply 'extern')
2016-04-12 17:55:17 +01:00
e6dcc2d77d
Change LuaBridge_API to be __declspec(dllexport) or __declspec(dllimport, as required
2016-04-12 17:55:16 +01:00
7292989a5a
some more windows bandaids for optimized builds
...
really this is getting UGLY.
2016-04-12 02:18:20 +02:00
8002b2d26e
special case luabridge for windows/MSVC
...
luabridge uses static fn addresses to identify classes.
Windows uses different addresses for *identical* static functions
in libardour.dll and ardour.exe
This solves the issue by moving the all functions from a
header-only implementation into libardour.
2016-04-11 22:19:25 +02:00
c6d4fafcd9
update lua related doc, add missing bindings
2016-04-10 23:01:44 +02:00
40aa4cfe06
Modify our MSVC projects to build liblua as a DLL rather than a static lib
2016-04-04 16:40:20 +01:00
10486fa2cc
#define LUA_DEBUG when making a Debug build with MSVC
2016-04-04 16:40:18 +01:00