PageRenderTime 25ms CodeModel.GetById 12ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/c_src/erlv8_string.cc

http://github.com/beamjs/erlv8
C++ | 30 lines | 27 code | 3 blank | 0 comment | 0 complexity | a8d92aa9730647403d07868edbb1434d MD5 | raw file
 1#include "erlv8.hh"
 2
 3TickHandler(ToStringTickHandler) {
 4  ErlNifEnv *ref_env = enif_alloc_env();
 5  ERL_NIF_TERM to_string_ref = enif_make_copy(ref_env, tick_ref);
 6  SEND(vm->server,
 7       enif_make_tuple3(env,
 8			enif_make_atom(env,"result"),
 9			enif_make_copy(env,to_string_ref),
10			js_to_term(vm->context, vm->isolate, env,term_to_js(vm->context, vm->isolate, vm->env,array[1])->ToString())));
11  enif_free_env(ref_env);
12  TickHandlerResolution result;
13  result.type = DONE;
14  return result;
15};
16
17TickHandler(ToDetailStringTickHandler) {
18  ErlNifEnv *ref_env = enif_alloc_env();
19  ERL_NIF_TERM to_string_ref = enif_make_copy(ref_env, tick_ref);
20  SEND(vm->server,
21       enif_make_tuple3(env,
22			enif_make_atom(env,"result"),
23			enif_make_copy(env,to_string_ref),
24			js_to_term(vm->context, vm->isolate, env,term_to_js(vm->context,vm->isolate,vm->env,array[1])->ToDetailString())));
25  enif_free_env(ref_env);
26  TickHandlerResolution result;
27  result.type = DONE;
28  return result;
29};
30