File: examples

package info (click to toggle)
libgnatcoll-bindings 18-2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 980 kB
  • sloc: ada: 6,581; ansic: 722; python: 687; makefile: 48; sh: 46
file content (54 lines) | stat: -rw-r--r-- 1,215 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
set -C -e -u

cp gmp/examples/* "$ADTTMP"
cd "$ADTTMP"

mkdir obj
gprbuild -v gmp_examples.gpr
./isprime > result1 <<EOF
7
6

EOF
diff result1 - <<EOF
Enter candidate number (return to quit): 7 is a prime
Enter candidate number (return to quit): 6 is not a prime
Enter candidate number (return to quit): 
EOF

cat > t.adb <<EOF
with Ada.Command_Line;
with Ada.Text_IO;
with GNATCOLL.Iconv;
with GNATCOLL.Python;
with GNATCOLL.Readline;
with GNATCOLL.Traces.Syslog;
procedure T is
begin
   Ada.Text_IO.Put_Line (Boolean'Image (GNATCOLL.Iconv.Has_Iconv));

   GNATCOLL.Python.Py_SetProgramNAme (Ada.Command_Line.Command_Name);
   GNATCOLL.Python.Py_Initialize;
   Ada.Text_IO.Put_Line (GNATCOLL.Python.PyString_AsString
                         (GNATCOLL.Python.PyObject_Str
                          (GNATCOLL.Python.Py_None)));
   GNATCOLL.Python.Py_finalize;

   GNATCOLL.Readline.Initialize;
   GNATCOLL.Readline.Finalize;

   Ada.Text_IO.Put_Line (GNATCOLL.Traces.Syslog.Stream_Syslog);
end T;
EOF
cat > t.gpr <<EOF
with "gnatcoll_iconv.gpr";
with "gnatcoll_python.gpr";
with "gnatcoll_readline.gpr";
with "gnatcoll_syslog.gpr";
project T is
   for Main use ("t.adb");
end T;
EOF
gprbuild -v t.gpr
./t