Commit graph

37 commits

Author SHA1 Message Date
cad9f96739 Add a reallocate_fn() to DefConfiguration implemented around new/delete 2020-05-02 23:28:48 +02:00
65189a5575 Move files around
Sample main.cpp is now into examples/greet
2020-05-02 22:55:10 +02:00
3a8285a518 Fix crash when user's foreign_method_fn() returns nil. 2020-05-02 00:05:36 +02:00
f33900b351 Allow users to store a custom pointer into the VM object. 2020-05-01 17:44:09 +02:00
279a34237b I don't see any reason to get a pointer, I want a ref instead 2020-05-01 01:53:53 +02:00
274a2fea11 Update sample code in main(), fix the rest as required 2020-05-01 01:39:11 +02:00
640cc0e493 Reordering things a bit
I currently have meson 0.52.1 and the default_library=static
option has no effect for me, but I'm leaving it there in case
this changes in the future.
2020-05-01 00:14:55 +02:00
a3dcb583d7 Attach licence 2020-04-30 23:33:54 +02:00
6fc3422548 This file also belongs to the wren lib, move it 2020-04-30 22:57:52 +02:00
0f0d149ad2 Move public headers to a separate directory, make a library 2020-04-30 22:50:46 +02:00
7252a6e1ec Remove unneeded function 2020-04-30 22:29:13 +02:00
b1c1ae40f5 Add call() overload that takes a string literal as wren's function name.
Only the function name needs to be passed in and not the full
signature. The implementation will append the appropriate
(_,_,...) part making it at build time.
2020-04-30 21:18:29 +02:00
4f54739ab6 Add substr() method. It looks correct to me. Fingers crossed! 2020-04-30 21:09:53 +02:00
f70899aed1 Import string_bt from duckhandy
Modified to use std::make_index_sequence instead of the
equivalent duckhandy utility.
2020-04-30 20:47:22 +02:00
751667769c Wrap more c functions. 2020-04-30 19:58:26 +02:00
df52fe0fba Add support for calling wren methods from c++ using call() 2020-04-30 19:58:09 +02:00
2755371792 Refactoring.
VM now aims to only wrap Wren's c functions as closely as
possible. All the fun stuff should be put into vm_fun.hpp.
2020-04-30 19:54:51 +02:00
36f2b4393c Remove unnecessary declaration. 2020-04-30 17:11:28 +02:00
4a14d75ddb Add more methods. 2020-04-30 16:45:10 +02:00
dafce95c8f Add setters. 2020-04-28 21:24:01 +02:00
ee587d0b9e Add some more functions, simplify code 2020-04-28 21:05:53 +02:00
2122cb628d Change variables() into a free function. 2020-04-28 20:51:03 +02:00
b5bf777a05 Allow getting variables by handle 2020-04-28 15:15:53 +02:00
59140c6c4b Improve Handle class. 2020-04-28 15:13:29 +02:00
79f59f5d36 Add Handle class. 2020-04-28 14:25:35 +02:00
67a5fab3c4 Add variables() method and supporting code. 2020-04-28 14:24:50 +02:00
b5adc8156f Fix DynafuncMaker::clear() and some other improvements. 2020-04-26 22:29:57 +02:00
0545f26990 Trying to be a bit less platform-specific.
This has only been tested on my amd64 gnu/linux, so take it with
the due suspicions.
2020-04-26 22:06:53 +02:00
3d68124a60 Allow client code to provide their foreign_class_fn() implementation. 2020-04-26 21:25:26 +02:00
2c2d783730 Remove hardcoded binary data, get it from the corresponding assembly instead. 2020-04-26 20:37:12 +02:00
ca067109a2 Rename file 2020-04-26 18:54:01 +02:00
16c4b8cbe5 Allow foreign_method_fn() in the configuration object.
Wren expects this function to return a pointer to a function
that takes a WrenVM*. This is bad news because that type is
wrapped inside wren::VM and client code doesn't know about it.
It would be better for client code to return a pointer to a
function that takes a VM* instead. In order to do the VM* to
WrenVM* translation I make a "handmade" closure, that is I
generate a function at runtime that contains the VM* hardcoded
into it. The same function also contains the hardcoded
address of the callback function client code wanted to use.
By doing this I can pass a different function pointer to Wren
for each foreign method, and that function knows how to forward
the call to the real client callback.
Currently only implemented for amd64 gnu/linux.
2020-04-26 17:20:12 +02:00
d0be115181 Make VM easily movable 2020-04-26 12:26:39 +02:00
ebd455c536 Make code a bit shorter 2020-04-26 10:56:28 +02:00
30975c1405 Implement a generic forwarding function that replaces the manually written ones. 2020-04-26 10:50:33 +02:00
3142e4c4ce Start working on a c++ interface. 2020-04-25 20:45:59 +02:00
257513e72a Sample code that prints a message from wren 2020-04-25 01:49:46 +02:00