Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » Sharing a few small packages
Sharing a few small packages [message #59583] Thu, 09 February 2023 19:42 Go to next message
lindquist is currently offline  lindquist
Messages: 33
Registered: March 2006
Location: Denmark
Member
I've been playing around with U++ again for the past few months after a loooong break having kids and other things.
Some of the things I think are worth sharing I've uploaded to GitHub now:

https://github.com/lindquist/uppcloud

- Provides OpenSSL helpers for handling keys
- Simple JWT class


https://github.com/lindquist/uppduk

- Bindings for Duktape (ECMAScript lib) for U++
- Many things working and missing


https://github.com/lindquist/uppmisc

- Current just a simle OpenIconic -> .iml package


--

I hope these can be useful to someone, and any feedback is much appreciated.
-Tomasl
Re: Sharing a few small packages [message #59599 is a reply to message #59583] Mon, 13 February 2023 09:45 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 693
Registered: December 2005
Location: Budapest, Hungary
Contributor
Thank you.
Are ValueArray and ValueMap also supported in Value by your Duktape binding?
Or is it possible to pass complex structures to the engine? Maybe JSON in String?
Re: Sharing a few small packages [message #59600 is a reply to message #59599] Mon, 13 February 2023 10:25 Go to previous messageGo to next message
lindquist is currently offline  lindquist
Messages: 33
Registered: March 2006
Location: Denmark
Member
Hi thanks for the comment.
Currently I have not added the ValueMap/Array support, but it should be fairly simple so let me take a look tonight.
Right now, you can for sure pass a JSON string.
Re: Sharing a few small packages [message #59601 is a reply to message #59600] Mon, 13 February 2023 10:48 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 693
Registered: December 2005
Location: Budapest, Hungary
Contributor
Thanks, I have to integrate a scripting engine into my app, but I had no idea yet.
I need something widely known language, so this Javascript engine seems to be a very good choice Smile
Re: Sharing a few small packages [message #59603 is a reply to message #59601] Mon, 13 February 2023 20:51 Go to previous messageGo to next message
lindquist is currently offline  lindquist
Messages: 33
Registered: March 2006
Location: Denmark
Member
I pushed an update to uppduk, so now ValueMap and ValueArray are supported.

The following test:
#include <Core/Core.h>
#include <Duktape/Duktape.h>

using namespace Upp;

String func(Value v) {
	String json = AsJSON(v);
	Cout() << "func(v : " << v.GetTypeName() << ") := " << json << EOL;
	return pick(json);
}

CONSOLE_APP_MAIN
{
	StdLogSetup(LOG_COUT);
	Duktape duk;
	
	duk.BindGlobal(&func, "func");
	ASSERT(duk.Eval("func(1)") == "1");
	ASSERT(duk.Eval("func({})") == "{}");
	ASSERT(duk.Eval("func({foo:23,bar:23})") == R"({"foo":23,"bar":23})");
	ASSERT(duk.Eval("func([])") == "[]");
	ASSERT(duk.Eval("func('foo')") == "\"foo\"");
	ASSERT(duk.Eval("func([1,'foo',{bar:[1,2,3]},true])") == R"([1,"foo",{"bar":[1,2,3]},true])");
	
	Cout() << "all ok" << EOL;
}


Produces the following output:
func(v : int) := 1
func(v : N3Upp8ValueMap8NullDataE) := {}
func(v : N3Upp8ValueMap4DataE) := {"foo":23,"bar":23}
func(v : N3Upp10ValueArray8NullDataE) := []
func(v : String) := "foo"
func(v : N3Upp10ValueArray4DataE) := [1,"foo",{"bar":[1,2,3]},true]
all ok

Re: Sharing a few small packages [message #59649 is a reply to message #59603] Tue, 21 February 2023 17:52 Go to previous message
zsolt is currently offline  zsolt
Messages: 693
Registered: December 2005
Location: Budapest, Hungary
Contributor
That's very cool, thank you.
Previous Topic: MessageCtrl: A passive notifications ctrl and manager.
Next Topic: Scatter: DataRange for explicit functions
Goto Forum:
  


Current Time: Fri Mar 29 00:21:02 CET 2024

Total time taken to generate the page: 0.01405 seconds