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 |
#ifndef OVERLOAD_INCLUDED
|
|
|
32 |
#define OVERLOAD_INCLUDED
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
/*
|
|
|
36 |
STRUCTURE REPRESENTING A LIST OF OVERLOADED FUNCTIONS
|
|
|
37 |
|
|
|
38 |
During the resolution of overloaded functions, the set of candidate
|
|
|
39 |
functions is formed into a table. Each element of the table consists
|
|
|
40 |
of a function identifier plus a rank for this candidate (see below) and,
|
|
|
41 |
for viable candidates, a list of conversion sequence ranks for each
|
|
|
42 |
argument.
|
|
|
43 |
*/
|
|
|
44 |
|
|
|
45 |
#ifndef CONVERT_INCLUDED
|
|
|
46 |
#include "convert.h"
|
|
|
47 |
#endif
|
|
|
48 |
|
|
|
49 |
typedef struct {
|
|
|
50 |
IDENTIFIER func ;
|
|
|
51 |
IDENTIFIER base ;
|
|
|
52 |
int kind ;
|
|
|
53 |
unsigned rank ;
|
|
|
54 |
CONVERSION *convs ;
|
|
|
55 |
EXP cond ;
|
|
|
56 |
} CANDIDATE ;
|
|
|
57 |
|
|
|
58 |
typedef struct {
|
|
|
59 |
CANDIDATE *elem ;
|
|
|
60 |
unsigned size ;
|
|
|
61 |
unsigned max_size ;
|
|
|
62 |
CONVERSION *convs ;
|
|
|
63 |
unsigned nconvs ;
|
|
|
64 |
} CANDIDATE_LIST ;
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
/*
|
|
|
68 |
FUNCTION OVERLOADING DECLARATIONS
|
|
|
69 |
|
|
|
70 |
The routines in this module are concerned with function overloading.
|
|
|
71 |
*/
|
|
|
72 |
|
|
|
73 |
extern void swap_ptypes PROTO_S ( ( IDENTIFIER ) ) ;
|
|
|
74 |
extern IDENTIFIER resolve_call PROTO_S ( ( IDENTIFIER, LIST ( EXP ), QUALIFIER, int ) ) ;
|
|
|
75 |
extern EXP resolve_cast PROTO_S ( ( TYPE, EXP, ERROR *, int, int, LIST ( IDENTIFIER ) ) ) ;
|
|
|
76 |
extern void add_candidates PROTO_S ( ( CANDIDATE_LIST *, IDENTIFIER, int, int ) ) ;
|
|
|
77 |
extern IDENTIFIER koenig_candidates PROTO_S ( ( CANDIDATE_LIST *, IDENTIFIER, TYPE, int ) ) ;
|
|
|
78 |
extern void swap_candidates PROTO_S ( ( CANDIDATE_LIST *, unsigned ) ) ;
|
|
|
79 |
extern ERROR list_candidates PROTO_S ( ( ERROR, CANDIDATE_LIST *, unsigned ) ) ;
|
|
|
80 |
extern CANDIDATE *resolve_overload PROTO_S ( ( CANDIDATE_LIST *, LIST ( EXP ), TYPE, int ) ) ;
|
|
|
81 |
extern CANDIDATE *resolve_ambiguous PROTO_S ( ( CANDIDATE_LIST *, LIST ( EXP ), TYPE, int ) ) ;
|
|
|
82 |
extern IDENTIFIER make_ambig_func PROTO_S ( ( CANDIDATE_LIST *, IDENTIFIER, LIST ( EXP ), QUALIFIER, ERROR * ) ) ;
|
|
|
83 |
extern IDENTIFIER resolve_func PROTO_S ( ( IDENTIFIER, TYPE, int, int, LIST ( IDENTIFIER ), int * ) ) ;
|
|
|
84 |
extern void free_candidates PROTO_S ( ( CANDIDATE_LIST * ) ) ;
|
|
|
85 |
extern CANDIDATE_LIST candidates ;
|
|
|
86 |
extern unsigned match_no_viable ;
|
|
|
87 |
extern unsigned match_no_args ;
|
|
|
88 |
extern int resolved_kind ;
|
|
|
89 |
extern int match_this ;
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
/*
|
|
|
93 |
RANKING OF CANDIDATES
|
|
|
94 |
|
|
|
95 |
These values give the ranking values for candidate functions. These
|
|
|
96 |
correspond to the candidates with the wrong number of parameters, those
|
|
|
97 |
with the right number of parameters (the plausible candidates), the
|
|
|
98 |
viable candidates, and the best viable candidate. They are is ascending
|
|
|
99 |
order.
|
|
|
100 |
*/
|
|
|
101 |
|
|
|
102 |
#define RANK_IGNORE ( ( unsigned ) 0 )
|
|
|
103 |
#define RANK_NONE ( ( unsigned ) 1 )
|
|
|
104 |
#define RANK_ARGS ( ( unsigned ) 2 )
|
|
|
105 |
#define RANK_VIABLE ( ( unsigned ) 3 )
|
|
|
106 |
#define RANK_TARGET ( ( unsigned ) 4 )
|
|
|
107 |
#define RANK_BEST ( ( unsigned ) 5 )
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
/*
|
|
|
111 |
CANDIDATE KINDS
|
|
|
112 |
|
|
|
113 |
These values give the various kinds of candidate functions, simple
|
|
|
114 |
functions, constructors, user-defined conversions, non-member operators,
|
|
|
115 |
member operators and built-in operators.
|
|
|
116 |
*/
|
|
|
117 |
|
|
|
118 |
#define KIND_FUNC 0
|
|
|
119 |
#define KIND_CONSTR 1
|
|
|
120 |
#define KIND_CONV 2
|
|
|
121 |
#define KIND_OP 3
|
|
|
122 |
#define KIND_MEM_OP 4
|
|
|
123 |
#define KIND_BUILTIN 5
|
|
|
124 |
#define KIND_MARK 8
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
#endif
|