13
0
Commit Graph

81 Commits

Author SHA1 Message Date
John Emmas
b625461132 Guard some code which isn't currently buildable with VS2019
For some unknown reason, VC++2019 won't let us take the address of std::list::unique() - although other std::list members seem okay. I've spent weeks tracking this down but there's no fix available AFAICT.

I've flagged it up to the MSVC development team - just don't hold your breath !!
2021-03-06 11:12:02 +00:00
038307fef6
Allow Lua bindings up to 11 args 2021-01-08 22:50:37 +01:00
7c6eadd84a
Fix some doxygen warnings 2020-03-02 17:58:03 +01:00
34c4602e61
Lua Array, assert indices > 0 2020-02-06 17:30:21 +01:00
fbacb13d2d
Extend Lua binding for static methods
This add support for Lua bindings for static member
functions in weak/share ptr class bindings.
2020-02-06 17:30:21 +01:00
bca825e515
NO-OP: whitespace 2020-01-14 00:52:24 +01:00
5e1a73a28c
Add Lua typecast from C++ vector to C-Array
This is useful for MIDI bytes amongst other things
2019-12-01 21:32:10 +01:00
78cf0e5235
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.
2019-10-29 05:45:43 +01:00
130211a4bd
Update Lua to upstream 5.3.5 2019-10-29 05:36:24 +01:00
0301c47f6b
Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
bed2eb2e33
Fix std::list<hared_ptr<>> front/back methods
Shared pointer reference accessors can't be const
2019-05-17 12:09:07 +02:00
3da07e6736
Special case Lua copy-construction of trackable instances
This fixes an crashing issue with ArdourUI.SelectionList a bug
introduced in 6dc3bdf252 and 35dcd46d7d.

Since removal of the special cases in 35dcd46d7d, when using
a C-pointer in a std::list<>,
  std::list<class*>::push_back(TypeListValue)
TypeListValues<>'s Head was expanded to  "class*& const"
implied by void ::push_back(const T& value);

This resulted in lifetime issues with a classes that derive
from sigc::trackable (e.g. Ardour's Selection).
The reference leaves scope and isn't duplicated when it is pushed back
to the std::list<>.

The script scripts/select_every_2nd_region.lua crashed because entries
in the SelectionList were no longer valid.

Previously (before 6dc3bdf252) TypeListValues explicitly
copy-constructed the value to work around the lifetime issue.
This new solution bypasses the issue by directly using the c-pointer
without dereferencing it.
2019-04-12 05:45:27 +02:00
8ed33f1bc7 remove use of hardcoded -fPIC compiler flag, and use compiler flag dict instead 2018-10-14 22:06:11 -04:00
9506a294c7 Adapt our remaining MSVC projects for 'boost::atomic' (in case it later gets extended to the other libs)
Stage 1 of 3 (more to follow)
2018-09-30 08:56:12 +01:00
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