1 //
2 // aegis - project change supervisor
3 // Copyright (C) 1999, 2003-2008, 2012 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published
7 // by the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18
19 #include <common/ac/assert.h>
20
21 #include <libaegis/change.h>
22
23
24 void
change_architecture_add(change::pointer cp,string_ty * name)25 change_architecture_add(change::pointer cp, string_ty *name)
26 {
27 assert(cp->reference_count >= 1);
28 cstate_ty *cstate_data = cp->cstate_get();
29 if (!cstate_data->architecture)
30 {
31 cstate_data->architecture =
32 (cstate_architecture_list_ty *)
33 cstate_architecture_list_type.alloc();
34 }
35
36 //
37 // We must be careful to suppress duplicates, otherwise the
38 // architecture prerequisites for state transitions are
39 // unsatifiable.
40 //
41 for (size_t j = 0; j < cstate_data->architecture->length; ++j)
42 if (str_equal(name, cstate_data->architecture->list[j]))
43 return;
44
45 meta_type *type_p = 0;
46 string_ty **who_p =
47 (string_ty **)
48 cstate_architecture_list_type.list_parse
49 (
50 cstate_data->architecture,
51 &type_p
52 );
53 assert(type_p == &string_type);
54 *who_p = str_copy(name);
55 }
56
57
58 // vim: set ts=8 sw=4 et :
59