comp.lang.ada
 help / color / mirror / Atom feed
From: reinkor <reinkor@gmail.com>
Subject: Re: Where to find good/simple examples for gnatcoll (python)?
Date: Fri, 21 Oct 2016 01:27:12 -0700 (PDT)
Date: 2016-10-21T01:27:12-07:00	[thread overview]
Message-ID: <14d731a6-a231-482c-8f6d-b907933520c0@googlegroups.com> (raw)
In-Reply-To: <174e458e-70b8-411b-b1aa-b888838145d1@googlegroups.com>

Thanks so far. 

My up to date debian jessie seems not yet to include these new features.
However, I tried the program below. It builds, but I get 
"raised CONSTRAINT_ERROR : t1.adb:10 access check failed"

(something goes wring at the line 
"Data   : Callback_Data'Class := Create (Python, 2);")

Any help in my attempt to learn fast is appreciated.


with Ada.Text_IO;             use Ada.Text_IO;
with GNATCOLL.Scripts;        use GNATCOLL.Scripts;
with GNATCOLL.Scripts.Python; use GNATCOLL.Scripts.Python;
with GNATCOLL.Scripts.Shell;  use GNATCOLL.Scripts.Shell;

procedure T1 is

   Repo   : Scripts_Repository  := new Scripts_Repository_Record;
   Python : Scripting_Language  := Lookup_Scripting_Language (Repo, "python");
   Data   : Callback_Data'Class := Create (Python, 2);
   Result : Integer;

begin

   Data.Set_Nth_Arg (1, 2);
   Data.Set_Nth_Arg (2, 3);
   Data.Execute_Command ("./test1.py");   --  newer versions of gnatcoll
   Result := Data.Return_Value;

end T1;

Here is the project file for it:

with "gnatcoll_python";
with "gnatcoll_gmp";
project T1 is
    for Source_Dirs use ("src");
    for Object_Dir use "obj";
    for Exec_Dir use ".";
    for Main use ("t1.adb");
end T1;

reinert

  reply	other threads:[~2016-10-21  8:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18 17:48 Where to find good/simple examples for gnatcoll (python)? reinkor
2016-10-19  8:15 ` Vratislav Podzimek
2016-10-19 12:01   ` reinkor
2016-10-20  7:57     ` briot.emmanuel
2016-10-21  8:27       ` reinkor [this message]
2016-10-31  8:40         ` briot.emmanuel
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox