* Ann: ada binding to v8(google javascript engine)
@ 2012-01-23 11:44 Kylix
2012-01-23 11:47 ` Kylix
0 siblings, 1 reply; 2+ messages in thread
From: Kylix @ 2012-01-23 11:44 UTC (permalink / raw)
I made a binding to v8(google javascript engine), with some examples,
such as a simple shell:
procedure Shell is
p : v8.Class_Handle_Scope.Handle_Scope;
pragma Unreferenced (p);
c : v8.Class_Context.Handles.Persistent :=
v8.Class_Context.Create;
cs : v8.Class_Context.Scope (c.As_Object);
ver : v8.Class_String.Pointer := v8.Class_String.Create
(v8.Class_V8.Get_Version);
tc : v8.Class_Try_Catch.Holder;
pragma Warnings (Off);
begin
loop
Ada.Text_IO.Put("input code to execute or enter exit:");
declare
code : String := Ada.Text_IO.Get_Line;
bin : v8.Class_Script_Data.Pointer;
begin
exit when code = "exit";
bin := v8.Class_Script_Data.Pre_Compile (code);
if not bin.Has_Error then
declare
js : v8.CLass_Script.Pointer :=
v8.Class_Script.Compile (source => v8.Class_String.Create (code),
pre_data => bin);
result : v8.Class_Value.Pointer := js.Run;
use type v8.Class_Value.Pointer;
begin
if result /= null then
Show_Result(result);
else
Ada.Text_IO.Put_Line
(int'Image(tc.Message.Get_Line_Number));
tc.Reset;
end if;
end;
end if;
bin.Free;
end;
end loop;
end Shell;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-23 12:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-23 11:44 Ann: ada binding to v8(google javascript engine) Kylix
2012-01-23 11:47 ` Kylix
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox