Subversion Repositories tendra.SVN

Rev

Rev 2 | Go to most recent revision | 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
/**** c-check.c --- Routines to check grammar.
32
 *
33
 ** Author: Steve Folkes <smf@hermes.mod.uk>
34
 *
35
 **** Commentary:
36
 *
37
 * This file contains routines to check that all actions and basic result
38
 * extraction functions are defined.
39
 *
40
 **** Change Log:
41
 * $Log: c-check.c,v $
42
 * Revision 1.1.1.1  1998/01/17  15:57:42  release
43
 * First version to be checked into rolling release.
44
 *
45
 * Revision 1.2  1994/12/15  09:55:53  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:12  smf
50
 * Initial import of SID 1.8 non shared files.
51
 *
52
**/
53
 
54
/****************************************************************************/
55
 
56
#include "c-check.h"
57
#include "action.h"
58
#include "basic.h"
59
#include "entry.h"
60
#include "gen-errors.h"
61
#include "table.h"
62
 
63
/*--------------------------------------------------------------------------*/
64
 
65
static void
66
c_check_grammar_1 PROTO_N ((entry, gclosure))
67
		  PROTO_T (EntryP   entry X
68
			   GenericP gclosure)
69
{
70
    TypeP type;
71
 
72
    UNUSED (gclosure);
73
    switch (entry_type (entry)) EXHAUSTIVE {
74
      case ET_RULE:
75
	break;
76
      case ET_BASIC: {
77
	  BasicP basic = entry_get_basic (entry);
78
 
79
	  if ((!types_equal_zero_tuple (basic_result (basic))) &&
80
	      (basic_get_result_code (basic) == NIL (GenericP))) {
81
	      E_basic_result_code_not_defined (entry_key (entry));
82
	  }
83
      }
84
	break;
85
      case ET_ACTION:
86
	if (action_get_code (entry_get_action (entry)) == NIL (GenericP)) {
87
	    E_action_code_not_defined (entry_key (entry));
88
	}
89
	break;
90
      case ET_TYPE:
91
	type = entry_get_type (entry);
92
	if (((type_get_assign_code (type) != NIL (GenericP)) ||
93
	     (type_get_param_assign_code (type) != NIL (GenericP)) ||
94
	     (type_get_result_assign_code (type) != NIL (GenericP))) &&
95
	    ((type_get_assign_code (type) == NIL (GenericP)) ||
96
	     (type_get_param_assign_code (type) == NIL (GenericP)) ||
97
	     (type_get_result_assign_code (type) == NIL (GenericP)))) {
98
	    E_type_code_not_defined (entry_key (entry));
99
	}
100
	break;
101
      case ET_NON_LOCAL:
102
      case ET_NAME:
103
      case ET_RENAME:
104
	break;
105
      case ET_PREDICATE:
106
	UNREACHED;
107
    }
108
}
109
 
110
/*--------------------------------------------------------------------------*/
111
 
112
void
113
c_check_grammar PROTO_N ((grammar))
114
		PROTO_T (GrammarP grammar)
115
{
116
    table_iter (grammar_table (grammar), c_check_grammar_1, NIL (GenericP));
117
}
118
 
119
/*
120
 * Local variables(smf):
121
 * eval: (include::add-path-entry "../os-interface" "../library")
122
 * eval: (include::add-path-entry "../transforms" "../output")
123
 * eval: (include::add-path-entry "../c-output" "../generated")
124
 * end:
125
**/