From: reinert <reinkor@gmail.com>
Subject: Re: Question about sets and expression
Date: Mon, 8 May 2017 22:48:59 -0700 (PDT)
Date: 2017-05-08T22:48:59-07:00 [thread overview]
Message-ID: <f6b949c7-7cd8-4d17-914f-0569152e0a20@googlegroups.com> (raw)
In-Reply-To: <2c53a9f3-6cd7-49b3-b69f-300d682bc2a1@googlegroups.com>
Could anybody try this simple program below?
I get the output (debian, gnat-4.9):
--------------------------------------------------------------------------
** A:
** B:
raised PROGRAM_ERROR : test1b.adb:29 finalize/adjust raised exception
--------------------------------------------------------------------------
Why "finalize/adjust raised exception" ?
reinert
https://korsnesbiocomputing.no/
with Ada.Numerics;
use Ada.Numerics;
with Ada.Numerics.Generic_Real_Arrays;
with Ada.Containers.Ordered_Sets;
with Text_IO;use Text_IO;
procedure test1b is
subtype real is Float;
subtype degree_t is real range 0.0 .. 360.0;
package gra is new Ada.Numerics.Generic_Real_Arrays (real);
use gra;
subtype real_vector2d is gra.real_vector (1 .. 2);
type target_t is (cnil,C000,C001,C002,C003,C004);
package cell_names_sets is new Ada.Containers.Ordered_Sets (target_t);
type cell_state_t is
(live,
apoptosis,
necrotic,
dead,
mitosis,
mitotic_catastrophe,
refusion,
unknown,
out_of_scene,
ghost);
type cell_observation_t is record
id : target_t;
state : cell_state_t := live;
r, dr : real_vector2d := (0.0, 0.0);
axis : degree_t;
children1 : cell_names_sets.set := cell_names_sets.empty_set;
pre_cell, next_cell : target_t := cnil;
end record;
function "<"
(left, right : cell_observation_t) return Boolean is
(left.id < right.id);
function "="
(left, right : cell_observation_t) return Boolean is
(left.id = right.id);
package cell_observation_set is new Ada.Containers.Ordered_Sets
(Element_Type => cell_observation_t);
use cell_observation_set;
os : cell_observation_set.set := to_set((id => C003,others => <>));
c : cell_observation_t;
d : cell_observation_t := (id => Cnil,others => <>);
begin
Put_Line(" ** A: ");
c := (if not os.is_empty then os.first_element else d);
Put_Line(" ** B: ");
c := (if not os.is_empty then os.first_element else (id => Cnil, others => <>));
Put_Line(" ** C ");
end test1b;
next prev parent reply other threads:[~2017-05-09 5:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-08 15:53 Question about sets and expression reinert
2017-05-08 16:06 ` Robert Eachus
2017-05-08 17:03 ` reinert
2017-05-08 17:04 ` reinert
2017-05-08 19:00 ` Simon Wright
2017-05-09 3:58 ` reinert
2017-05-09 5:48 ` reinert [this message]
2017-05-09 6:23 ` Niklas Holsti
2017-05-09 6:29 ` G.B.
2017-05-09 7:14 ` reinert
2017-05-09 9:28 ` gautier_niouzes
2017-05-09 11:15 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox