Commit graph

680 commits

Author SHA1 Message Date
Olivier Goffart
a3d0f3155d Fix double delete of the Value in Struct::get_field 2021-03-18 14:20:30 +01:00
Simon Hausmann
c6740fe592 Move field accessors from Value to Struct in C++ 2021-03-18 13:33:50 +01:00
Olivier Goffart
3335ff8da5 C++ API to put a model in the interpreter::Value 2021-03-18 12:17:01 +01:00
Simon Hausmann
02c1150fa7 Add the boilerplate for Struct in C++ 2021-03-18 12:12:48 +01:00
Simon Hausmann
533b7f05ce Remove the Value(Type) C++ constructor again
This theoretically makes sense for types that have default values, but
for example Value::Model requires a pointer Rc. But since we provide concrete constructors this
should not be needed.
2021-03-17 17:36:55 +01:00
Simon Hausmann
e539d03007 Add C++ Value Brush support 2021-03-17 17:22:57 +01:00
Olivier Goffart
d5823f2b42 Don't forget to destroy the previous value when assigning a new one 2021-03-17 17:11:23 +01:00
Simon Hausmann
79612d7354 Add C++ Value Array construction/extraction 2021-03-17 16:52:30 +01:00
Simon Hausmann
dc30106037 Add SharedVector<T>::empty() and a constructor that takes an initializer list 2021-03-17 15:19:59 +01:00
Simon Hausmann
ffb1d7bd83 Reformat sharedvector.h with clang-format 2021-03-17 15:03:48 +01:00
Simon Hausmann
831bf58baa Add Value bool conversion to C++ 2021-03-17 14:15:48 +01:00
Simon Hausmann
0877f0c82a Add C++ Value number construction & conversion 2021-03-17 14:07:49 +01:00
Simon Hausmann
f5fb0bf297 Prospective Qt linkage fix for macOS
Try adding an LC_RPATH command to the cdylib that we're building (for example libsixtyfps_cpp.dylib),
to fix linkage against Qt, which uses `@rpath/QtCore.framework/XXX` for inter-library linkage dependencies.
2021-03-17 14:02:33 +01:00
Simon Hausmann
8e72d29669 Expose Value::to_string() conversion and construction in C++ 2021-03-17 13:28:53 +01:00
Olivier Goffart
6e9d4f9e8d Fix linking of the interpreter
I don't know why, byt the 'crate-type = "lib"' seem to fix the problem
2021-03-17 12:38:05 +01:00
Simon Hausmann
cf2b02c9fa Add the initial C++ header file for the interpreter with the start of Value 2021-03-17 12:10:12 +01:00
Simon Hausmann
a06f0b22fa Add a debug message to see what's set in the CI 2021-03-17 11:57:19 +01:00
Olivier Goffart
dbf06f73cc Link the C++ lib against the interpreter 2021-03-17 11:44:45 +01:00
Simon Hausmann
372ba09741 Prospective fix for ctest on macOS in the CI
Try manually to propagate the local environment variable for the dyld framework path

It might not get propagated across the process boundaries by itself the way github actions set it in the local environment.
2021-03-17 11:34:34 +01:00
Simon Hausmann
c68405d4dd Prospective fix for macos ctest not finding Qt
Not sure how this could happen, but we should be able to limit the rpath workaround to Linux
2021-03-17 08:52:52 +01:00
Olivier Goffart
29f930d733 Workaround test problem
Looks like the test executable need to be run from the cmake root build directory,
because it hardcodes a relative path to the library  api/sixtyfps-cpp/libsixtyfps_cpp.so
This might actually be a corrosion bug.
2021-03-16 19:49:29 +01:00
Olivier Goffart
35cce45cbc Add a fii feature so that we don't compile in the ffi code if not required 2021-03-16 18:09:57 +01:00
Simon Hausmann
cff1e7751d Link against SixtyFPS in the C++ unit tests 2021-03-16 16:51:01 +01:00
Olivier Goffart
ca93d12cf8 Fix cpack 2021-03-16 16:47:03 +01:00
Olivier Goffart
0e351de1a6 Create a new crate to expose the C++ 2021-03-16 16:34:02 +01:00
Simon Hausmann
ec1775f9ae Add skeleton for C++ API tests 2021-03-16 16:30:54 +01:00
Simon Hausmann
3391aa0312 Remove the import resolve callback from the compiler configuration
Re-apply commit 2dcbc45cd6 but now do the
resolution from a relative import path to either an absolute path or url
in the compiler itself.
2021-03-16 14:21:33 +01:00
Olivier Goffart
ad75d41e20 Rename struct priperties to fields 2021-03-16 12:50:33 +01:00
Olivier Goffart
3db3400951 Rename the Object type to Struct in the compiler 2021-03-16 12:38:53 +01:00
Simon Hausmann
e3a33dffe0 Revert "Remove the import resolve callback from the compiler configuration"
This reverts commit 2dcbc45cd6.

It breaks loading of the printer demo in the editor because in
import_file we fail to return the absolute path and thus end up
importing common.60 too many times.
2021-03-16 11:43:33 +01:00
Simon Hausmann
2dcbc45cd6 Remove the import resolve callback from the compiler configuration
It turns out that this isn't really needed with the current
implementation.
2021-03-15 20:02:46 +01:00
Olivier Goffart
fef4a10ebd Use the new API for the interpreter in wasm
Improve the ComponenetDefinition::from_source
2021-03-15 17:57:46 +01:00
Olivier Goffart
48333370a6 Use the new interpreter API in things that depends on it 2021-03-15 17:29:27 +01:00
Simon Hausmann
8372d3f6d8 Rename call_* to invoke_* for callbacks
Fixes #187
2021-03-15 17:01:05 +01:00
Simon Hausmann
b27034efa5 Rename sixtyfps::IntoWeak into sixtyfps::ComponentHandle and remove Clone from generated components
`ComponentHandle` offers a richer API of common functions, such as
`show()`/`hide()` as well as the new `clone_strong()` - that should help
to prevent mistakely created strong reference that may cause leaks.

Fixes #188
2021-03-15 16:01:13 +01:00
Simon Hausmann
9034bd3d1a Move the refined eval::Value API to api::Value
This is the new public value representation for the interpreter
2021-03-15 15:12:34 +01:00
Simon Hausmann
c2c3e00cd7 Remove ModelPtr from the interpreter
Instead stick a straight `Rc<dyn ...>` into the `Value` enum
2021-03-15 14:43:01 +01:00
Simon Hausmann
a4c196df60 Use api::Struct in Value::Struct, replacing Value::Object 2021-03-15 12:55:39 +01:00
Olivier Goffart
41f52f9ad4 Remove Value::Color 2021-03-15 12:33:47 +01:00
Olivier Goffart
5a416d0fc7 Make the Value non_exhaustive 2021-03-15 12:07:52 +01:00
Olivier Goffart
cae88f0823 Create a Diagnostic quen the main .60 file can't be loaded 2021-03-15 11:44:20 +01:00
Simon Hausmann
2ae5b8413a Fix wasm build
Re-add the compiler configuration internal API. When `from_string` is complete then we can switch to the new public
compiler config API.

And use diagnostics accessor functions.
2021-03-15 11:25:48 +01:00
Simon Hausmann
41f77b2a27 Use SharedVector for Value::Array instead of Vec
That will make it more efficient to pass data into the interpreter in the future,
especially from C++.
2021-03-15 10:19:35 +01:00
Olivier Goffart
730b1ccff2 Refactor diagnostic: Merge BuildDiagnostic and FileDiagnostic 2021-03-12 19:32:50 +01:00
Olivier Goffart
968dfaae87 Put what is the FileDiagnostics into the SourceFile so the SourceFile has the content 2021-03-11 16:23:46 +01:00
Olivier Goffart
4f115edb87 Fix cmake install 2021-03-11 11:34:09 +01:00
Olivier Goffart
933c1bbf59 Rename Value::Resource to Value::Image 2021-03-11 10:15:53 +01:00
Olivier Goffart
6f88d78303 Rename Resource to ImageReference in the runtime 2021-03-11 10:06:23 +01:00
Olivier Goffart
c840b046ae Rename the "resource" type to "image" 2021-03-10 17:24:31 +01:00
Olivier Goffart
44e81a40d6 Fixup C++ build 2021-03-10 17:24:31 +01:00