Questions tagged [duktape]

Duktape is a highly optimized embedded JavaScript engine for C/C++

Duktape is an MIT-licensed embedded engine for /.
Its main features are :

  • Embeddable, portable, compact:
    • 200kB code
    • 46kB startup RAM (x86, default options)
    • 22kB startup RAM (x86, lowmem options)
    • 42kLoC source (excluding comments etc)
    • Can run on platforms with 256kB flash and 96kB system RAM
  • Ecmascript E5/E5.1 compliant, some features borrowed from E6 draft
  • Built-in regular expression engine
  • Built-in Unicode support
  • Minimal platform dependencies
  • Combined reference counting and mark-and-sweep garbage collection with finalization
  • Custom features like coroutines, built-in logging framework, and built-in CommonJS-based module loading framework
  • Property virtualization using a subset of Ecmascript E6 Proxy object
93 questions
0
votes
1 answer

duktape, modify variable argument in native C code

I'm trying to modify a variable passed in an argument in a native function like this: var MyVar = 'foo'; myNativeFunc(MyVar); and inside my native, I can read the content of MyVar, with : std::string(duk_to_string(ctx, 0)); but, I need to modify…
jerome
  • 3
  • 1
0
votes
1 answer

how to execute shell commands from duktape

I need to build a javascript engine (duktape or jerryscript) for a embedded device which should be capable of executing shell commands. how can this be achieved?
Ram
  • 11
0
votes
1 answer

build new DUKTAPE js object from c with native-c construstor

i'm trying to build JS object fully in C, similar as the following JS: var _a = function(p){ this.p = p; } _a.prototype.myFunction= function(){ ...; } var _b = function(){ this.sub = new _a(p); } exports.A = A; exports.B =…
0
votes
1 answer

HowTo get unique ID for any DukTape "thing" including array or object?

I am working on a (limited) C++ pickling/serialiser for (some) JavaScript/DukTape objects. I want to keep track of which objects have been written. For "normal" objects I (think that I) can mark them with a hidden \xFF field/property (maybe) and use…
pal
  • 942
  • 1
  • 9
  • 19
0
votes
1 answer

How to add, modify or delete a property of an object in duktape

I'm trying to write a C function with 1 passed parameter. This parameter has to be an object. And I'd like to modify this object in the C code like this: var modifyObject = function (obj) { obj.new_param = 123; obj.existing_param2 = 456;; …
0
votes
2 answers

How to run javascript in android and pass in a map as argument

I'm trying to run javascript in android and found out Rhino and Duktape provides the functionality to run without a WebView. But it seems like neither of them have a clear way of passing a variable number of key-value pairs as argument into my js…
0
votes
1 answer

duktape modSearch. Native implementation in C

I have trying to implement a native-C duktape modSearch and I am stuck. I read DUKtape documentation and looked at https://github.com/svaarala/duktape/issues/194 but still I am not able to make it work. I created a simple test that I am using the…
Rene V
  • 11
  • 1
0
votes
1 answer

Gettings json properties duktape

everybody interested in a duktape framework. How could one integrate json properties with cpp code? Assume we got following json: { "name" : "duktape", "surname" : "duktapovich", "values" : [1,10] } If one would like to get…
0
votes
0 answers

Expose C++ class using duktape

I am currently in the midst of building a simple game engine/basic library. Right now, i'm working on scripting support. Since i've always liked JavaScript more than, say, Lua or Python, i thought about using that as my principle scripting language.…
tubberd
  • 540
  • 5
  • 15
0
votes
1 answer

Porting duktape, getting duk_create_heap error during JS compilation of builtin initjs

This question might be too detailed for this forum, but I could not find a mailing list for duktape. Maybe this question will be useful for others trying to get duktape running on more obscure hardware. I am trying to get duktape to work on an old…
ofdm
  • 61
  • 6
0
votes
1 answer

inttypes.h file not found compiling Duktape with C++ Builder and Clang

I have created a simple Duktape example using C++ Builder Seattle and follow the code in "Initialize a context" from Duktape. It compiles fine when using classic mode. If I switch to clang via unchecking Project->Options->C++ Compiler->Use…
Gary
  • 1
  • 2
0
votes
1 answer

duktape startup duk_create_heap_default panic exit

I tried to compile Duktape with IAR compiler for STM32F4 micro. I have build a first minimal sample program but ends in panic #include "duktape.h" int main() { duk_context *ctx = duk_create_heap_default(); duk_eval_string(ctx, "print('Hello…
diego
  • 1
  • 1
0
votes
2 answers

Reduced memory options for lots of Duktape contexts

I'm trying to configure a light-weight full-featured JavaScript engine such that I can have tens of thousands of independent contexts simultaneously. Each context is doing very little (mostly event processing, light string manipulation, custom…
mark
  • 5,269
  • 2
  • 21
  • 34
0
votes
1 answer

use duktape on ARM to play audio

I would like to use Duktape on my embedded device (ARM processor) to execute Javascript which will download a music stream and play it. Question 1: Has anyone done that before? Is that possible at all (sound ouput)? Question 2: If it is possible…
Daniel
  • 2,087
  • 3
  • 23
  • 37
0
votes
1 answer

Keeping UINT64 values in V8

I'm looking to integrate a scripting engine in my C/C++ program. Currently, I am looking at Google V8. How do I efficiently handle 64 bit values in V8? My C/C++ program uses 64 bit values extensivly for keeping handlers/pointers. I don't want them…
Jack Wester
  • 5,170
  • 3
  • 28
  • 47