Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/*** rule-names.c --- Recompute alternative names.
32
 *
33
 ** Author: Steve Folkes <smf@hermes.mod.uk>
34
 *
35
 *** Commentary:
36
 *
37
 * This file implements the functions that recompute the names defined in each
38
 * alternative of a rule (including the exception handler alternative).
39
 *
40
 *** Change Log:
41
 * $Log: rule-names.c,v $
42
 * Revision 1.1.1.1  1998/01/17  15:57:47  release
43
 * First version to be checked into rolling release.
44
 *
45
 * Revision 1.2  1994/12/15  09:58:50  smf
46
 * Brought into line with OSSG C Coding Standards Document, as per
47
 * "CR94_178.sid+tld-update".
48
 *
49
 * Revision 1.1.1.1  1994/07/25  16:04:41  smf
50
 * Initial import of SID 1.8 non shared files.
51
 *
52
**/
53
 
54
/****************************************************************************/
55
 
56
#include "rule.h"
57
#include "action.h"
58
#include "basic.h"
59
#include "name.h"
60
#include "type.h"
61
#include "types.h"
62
 
63
/*--------------------------------------------------------------------------*/
64
 
65
static void
66
rule_recompute_alt_names_2 PROTO_N ((alt, predicate_id))
67
			   PROTO_T (AltP   alt X
68
				    EntryP predicate_id)
69
{
70
    TypeTupleP names = alt_names (alt);
71
    ItemP      item;
72
 
73
    types_destroy (names);
74
    types_init (names);
75
    for (item = alt_item_head (alt); item; item = item_next (item)) {
76
	types_add_new_names (names, item_result (item), predicate_id);
77
    }
78
}
79
 
80
static void
81
rule_recompute_alt_names_1 PROTO_N ((rule, predicate_id))
82
			   PROTO_T (RuleP  rule X
83
				    EntryP predicate_id)
84
{
85
    AltP alt;
86
 
87
    if ((alt = rule_get_handler (rule)) != NIL (AltP)) {
88
	rule_recompute_alt_names_2 (alt, predicate_id);
89
    }
90
    for (alt = rule_alt_head (rule); alt; alt = alt_next (alt)) {
91
	rule_recompute_alt_names_2 (alt, predicate_id);
92
    }
93
}
94
 
95
/*--------------------------------------------------------------------------*/
96
 
97
void
98
rule_recompute_alt_names PROTO_N ((entry, gclosure))
99
			 PROTO_T (EntryP   entry X
100
				  GenericP gclosure)
101
{
102
    if (entry_is_rule (entry)) {
103
	RuleP  rule         = entry_get_rule (entry);
104
	EntryP predicate_id = (EntryP) gclosure;
105
 
106
	rule_recompute_alt_names_1 (rule, predicate_id);
107
    }
108
}
109
 
110
/*
111
 * Local variables(smf):
112
 * eval: (include::add-path-entry "../os-interface" "../library")
113
 * eval: (include::add-path-entry "../generated")
114
 * end:
115
**/