Commit graph

516 commits

Author SHA1 Message Date
Simon Hausmann
4b0ae4d5a1 cpp llr: Fix BuiltinFunction::ArrayLength
Evaluate the model only once, and invoke the lambda that tracks the row count and returns it.
2022-01-19 10:02:23 +01:00
Simon Hausmann
3fe33df56b cpp llr: Fix -Werror errors with unused parameters in update_data for repeaters
Fixes three more tests
2022-01-19 10:02:23 +01:00
Simon Hausmann
f9bbe9c3a2 cpp llr: make self_weak accessible to child repeaters 2022-01-19 10:02:23 +01:00
Tobias Hunger
0999e9ccf5 C++: Implement SetFocusItem builtin 2022-01-19 10:02:23 +01:00
Olivier Goffart
708fc0b8a7 C++: Don't rely on the order of struct members
When initializing a Type::Struct, don't use agregate initialization that
relies on the orde of fields.

This is important because the builtin layout struct are not ordered
lexicographicly.
2022-01-19 10:02:23 +01:00
Simon Hausmann
4544e4c7c1 cpp llr: extend comment about public fields in globals 2022-01-19 10:02:23 +01:00
Simon Hausmann
0969130b85 cpp llr: remove diagnostics
Similar to the Rust generator, the C++ generator should not produce any errors;
they should be caught at the llr lowering level if any.
2022-01-19 10:02:23 +01:00
Simon Hausmann
210355b416 cpp llr: clean up some access rights FIXMEs
Let generate_sub_component generate all public members, for easy use within.
Only generate_public_component makes by default everything private except for
public API.
2022-01-19 10:02:23 +01:00
Simon Hausmann
02831d2daa cpp llr: initial implementation of PropertyReference::InParent for access_member 2022-01-19 10:02:23 +01:00
Simon Hausmann
532a3797e3 cpp llr: implement visit of dynamic children 2022-01-19 10:02:23 +01:00
Simon Hausmann
f9db59703e c++ llr: add missing return statement 2022-01-19 10:02:23 +01:00
Simon Hausmann
a9f386c5b8 c++ llr: set the model binding on repeaters 2022-01-19 10:02:23 +01:00
Olivier Goffart
fbea46a13e llr-cpp: more layout_info 2022-01-19 10:02:23 +01:00
Simon Hausmann
bc2d92efdc c++ llr: emit Repeater<C, M> members for repeaters 2022-01-19 10:02:23 +01:00
Simon Hausmann
4d42995321 c++ llr: Generate the repeated component (aka item tree) 2022-01-19 10:02:23 +01:00
Simon Hausmann
eb433bf1da c++ llr: move create() function and destructor into generate_item_tree
That's where it belongs, for re-use also f repeaters in the future.
2022-01-19 10:02:23 +01:00
Olivier Goffart
fee6a26fed llr-cpp: Some layout code
This is still untested
2022-01-19 10:02:23 +01:00
Simon Hausmann
ec6f40083a c++ lrr: add nodes for repeaters to the item tree 2022-01-19 10:02:23 +01:00
Olivier Goffart
fe1e559a94 llr-cpp: initialize two way bindings 2022-01-19 10:02:23 +01:00
Tobias Hunger
8b1ea21ec4 llr-cpp: Implement some builtin functions
Add tests to make sure this actually works:-)
2022-01-19 10:02:23 +01:00
Simon Hausmann
ed60de2f01 c++ llr: add initial support for sub-components
The internal API changes a bit: generate_sub_component populates given struct with what's needed for the sub-component.

Every sub-component (including the main public compo) gets an init() function that,
similar to Rust, takes a root pointer and the tree indices.
2022-01-19 10:02:23 +01:00
Simon Hausmann
76b6e75543 cpp llr: Fix image/resource embedding
Re-enable the old code :-)
2022-01-19 10:02:23 +01:00
Simon Hausmann
abe69aa4a3 c++ llr: implement property assignment and callback calls 2022-01-19 10:02:23 +01:00
Simon Hausmann
fd4ea37ff7 c++ llr: fix support for callback initialization and declaration in the public API 2022-01-19 10:02:23 +01:00
Simon Hausmann
440c15d1b2 cpp llr: Re-add generation of structs (not llr bound) and implement Expression::Array for models 2022-01-19 10:02:23 +01:00
Simon Hausmann
cc580e4476 llr cpp: implement mod
Co-authored-by: Tobias Hunger <hunger@users.noreply.github.com>
2022-01-19 10:02:23 +01:00
Simon Hausmann
52a21ebf2d llr c++: fix generated property getters/setters
Use the new access_member function
2022-01-19 10:02:23 +01:00
Simon Hausmann
da3d97b4bf c++ llr: remove llr_ prefix from ported functions and comment/remove out old ones 2022-01-19 10:02:23 +01:00
Simon Hausmann
9b570c7365 llr cpp: Remove some commented out code that exists also in the origin non-llr method 2022-01-19 10:02:23 +01:00
Simon Hausmann
79ea070bdc cpp llr: Fix -Werror build 2022-01-19 10:02:23 +01:00
Simon Hausmann
010d374c05 Fill out more component vtable stubs to fix linking 2022-01-19 10:02:23 +01:00
Simon Hausmann
f96df74a6f llr cpp: compile the most basic export App := Window {} test case
Linking still fails though
2022-01-19 10:02:23 +01:00
Simon Hausmann
0b7eae426d llr cpp: add rudimentary support for declaring properties/callbacks 2022-01-19 10:02:23 +01:00
Simon Hausmann
eddf176d49 llr cpp: Implement more of llr_compile_expression 2022-01-19 10:02:23 +01:00
Simon Hausmann
90e9829233 cpp llr: implement PropertyReference::Local 2022-01-19 10:02:23 +01:00
Simon Hausmann
62486ed41f Implement more of llr_compile_expression
* PropertyReference
 * BinaryExpression
 * Cast
2022-01-19 10:02:23 +01:00
Simon Hausmann
51d3376731 Begin generating basic property init expressions with the llr in C++ 2022-01-19 10:02:23 +01:00
Tobias Hunger
8150e5271d WIP: Make cpp.rs use LLR 2022-01-19 10:02:23 +01:00
Simon Hausmann
360a3c3b30 Re-evaluate bindings when data in models accessed via index expressions change
Call the new track_row_data_changes function in the model before
retrieving the data.
2022-01-14 13:38:25 +01:00
Olivier Goffart
d3a9437309 Support for writing in the model with the [] syntax 2022-01-14 13:38:25 +01:00
James Blacklock
7ad1ba209d Add support for array index expressions
This is a squash of the changes in
https://github.com/sixtyfpsui/sixtyfps/pull/605
2022-01-14 13:38:25 +01:00
Simon Hausmann
6e2f55e1b8 Fix calls to solve_path_layout
The function takes a reference to the `PathLayoutData` struct, which in
turn had a reference to the path data. The old rust generator had
special knowledge of calling solve_path_layout, so it knew to take a
reference of the path data.

In the llr there's no expression to take a reference. However since
PathData is cheap to move/copy (just holds SharedVector), we can pass it
by value (move) in the PathLayoutData.

This also means a copy in C++, which I *think* is safe, because the
constructor and destructor will be called on the C++ side, and the Rust
side still just operates on references or would try to move out a field
from the struct.
2022-01-12 16:22:35 +01:00
Simon Hausmann
44297bad24 Fix build of generated Rust code for path elements with the llr
* Move the C++ elements back into private_api (despite being generated), so that struct_name_to_tokens can generate the right name in re_exports
* When generating the llr_Expression::Struct for the path elements, make sure
  that all fields are filled out, to avoid an empty value expression in Expression::Struct
  in the Rust generator. Since we don't generate tuples but a named struct, we must provide all fields.
2022-01-12 16:22:35 +01:00
Simon Hausmann
31471fcf89 Complete path support in the llr / rust generator
This patch takes care of the lowering of events/coordinates arrays as
path data, which originates from a `commands: ...` string of SVG path
commands.

In order to minimize the path specific code in the generator, the
compile_paths now generates a Vec<Expression> for the events and
coordinates.
2022-01-12 16:22:35 +01:00
Simon Hausmann
9e61d4168b Fix build of Paths with path elements with rust/llr
A `Path` with `MoveTo`/`LineTo`/etc. sub-elements now maps to an Expression::PathData of type
Type::PathData.

The llr lowering creates an Array of Type::PathElement, which is casted to PathData.

This only covers the element case. The compiled path events are still todo.
2022-01-12 16:22:35 +01:00
Tobias Hunger
79e2456ead Allow for bigger indices in VisitChildrenResult
The indexes stored in `VisitChildrenResult` are unsigned. We have 64
bits to store two values and we need to have one special value as a flag.

So accept any index `< u32::MAX` instead of `< i32::MAX`, which should
allow for more data to be visited;-)
2022-01-08 20:55:22 +01:00
Jared Moulton
c5c139fbc9
Feat: Add math funcs Log10, Log2, Log and Exp (#813)
Implement Math.log and Math.pow
2022-01-07 12:07:58 +01:00
Tobias Hunger
3e448f75eb
janitor: Remove some unnecessary references
These are immediently dereferenced by the compiler according to clippy.

Remove some now unnecessary muts to make things build again.
2022-01-04 18:22:15 +01:00
Tobias Hunger
767704a88b
janitor: Remove some redundant closures 2022-01-04 18:21:07 +01:00
Tobias Hunger
d54e2a642a
Janitor: Change push_str of a one-char str to push 2022-01-04 09:39:41 +01:00