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 » U++ Library support » U++ Core » do upp have an equivalent of "eval()" in Javascript
do upp have an equivalent of "eval()" in Javascript [message #31360] Fri, 25 February 2011 10:39 Go to next message
ratah is currently offline  ratah
Messages: 107
Registered: July 2010
Experienced Member
Hi everybody,

I want to execute some String without writting code.
In Javascript, i can do this.
http://www.w3schools.com/jsref/jsref_eval.asp

I want to know if an equivalent function exists in upp.

Thannk you

[Updated on: Fri, 25 February 2011 10:40]

Report message to a moderator

Re: do upp have an equivalent of "eval()" in Javascript [message #31361 is a reply to message #31360] Fri, 25 February 2011 11:00 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
ratah wrote on Fri, 25 February 2011 04:39

Hi everybody,

I want to execute some String without writting code.
In Javascript, i can do this.
http://www.w3schools.com/jsref/jsref_eval.asp

I want to know if an equivalent function exists in upp.

Thannk you


Depends on what is in the String Smile

However, the first thing in mind is that C++ is _COMPILED_ language.

Mirek
Re: do upp have an equivalent of "eval()" in Javascript [message #31367 is a reply to message #31360] Fri, 25 February 2011 12:47 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

ratah wrote on Fri, 25 February 2011 10:39

Hi everybody,

I want to execute some String without writting code.
In Javascript, i can do this.
http://www.w3schools.com/jsref/jsref_eval.asp

I want to know if an equivalent function exists in upp.

Thannk you

I see two simple ways to do this, but as Mirek said, it depends a lot on the string content.

First option is Esc, U++ native scripting language. It is similar to C, with few interesting distinctions (see help for details).

Second option is compiling C code in the string on the fly, using TCC (turbo C compiler). There is a package with examples in bazaar.

Both methods allow for binding native C++ functions into the executed code/script.

You could also use 3rd party bindings for Lua, Python, etc... but since you asked for native U++ solution, I guess that is not what you want Smile

Best regards,
Honza
Previous Topic: Assertion failed....
Next Topic: Optional serialization techniques
Goto Forum:
  


Current Time: Thu Apr 18 13:46:55 CEST 2024

Total time taken to generate the page: 0.02630 seconds