Subversion Repositories tendra.SVN

Rev

Rev 5 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 6
Line 1... Line 1...
1
/*
1
/*
2
    		 Crown Copyright (c) 1997
2
    		 Crown Copyright (c) 1997
3
    
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
11
    shall be deemed to be acceptance of the following conditions:-
12
    
12
 
13
        (1) Its Recipients shall ensure that this Notice is
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
14
        reproduced upon any copies or amended versions of it;
15
    
15
 
16
        (2) Any amended version of it shall be clearly marked to
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
18
        for the relevant amendment or amendments;
19
    
19
 
20
        (3) Its onward transfer from a recipient to another
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
22
        these conditions;
23
    
23
 
24
        (4) DERA gives no warranty or assurance as to its
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
27
        it may be put.
28
*/
28
*/
Line 36... Line 36...
36
#define ASSERT_DEF_H_INCLUDED
36
#define ASSERT_DEF_H_INCLUDED
37
 
37
 
38
/* Assertion function definitions */
38
/* Assertion function definitions */
39
 
39
 
40
#ifndef assert_errors
40
#ifndef assert_errors
41
static void assert_errors
41
static void
42
    PROTO_N ( ( s, fn, ln ) )
42
assert_errors
43
    PROTO_T ( CONST_S char *s X CONST_S char *fn X int ln )
43
(char *s, char *fn, int ln)
44
{
44
{
45
    ( void ) fprintf ( stderr, "Assertion %s failed, %s, line %d.\n", s, fn, ln ) ;
45
    (void)fprintf(stderr, "Assertion %s failed, %s, line %d.\n", s, fn, ln);
46
    abort () ;
46
    abort();
47
}
47
}
48
#endif
48
#endif
49
 
49
 
-
 
50
errors *
50
errors *check_null_errors
51
check_null_errors
51
    PROTO_N ( ( p, fn, ln ) )
-
 
52
    PROTO_T ( errors *p X CONST_S char *fn X int ln )
52
(errors *p, char *fn, int ln)
53
{
53
{
54
    if ( p == NULL ) assert_errors ( "Null pointer", fn, ln ) ;
54
    if (p == NULL) assert_errors("Null pointer", fn, ln);
55
    return ( p ) ;
55
    return(p);
56
}
56
}
57
 
57
 
-
 
58
errors *
58
errors *check_tag_errors
59
check_tag_errors
59
    PROTO_N ( ( p, t, fn, ln ) )
-
 
60
    PROTO_T ( errors *p X unsigned t X CONST_S char *fn X int ln )
60
(errors *p, unsigned t, char *fn, int ln)
61
{
61
{
62
    p = check_null_errors ( p, fn, ln ) ;
62
    p = check_null_errors(p, fn, ln);
63
    if ( p->ag_tag != t ) assert_errors ( "Union tag", fn, ln ) ;
63
    if (p->ag_tag != t) assert_errors("Union tag", fn, ln);
64
    return ( p ) ;
64
    return(p);
65
}
65
}
66
 
66
 
-
 
67
errors *
67
errors *check_tag_etc_errors
68
check_tag_etc_errors
68
    PROTO_N ( ( p, tl, tb, fn, ln ) )
-
 
69
    PROTO_T ( errors *p X unsigned tl X unsigned tb X CONST_S char *fn X int ln )
69
(errors *p, unsigned tl, unsigned tb X char *fn X int ln)
70
{
70
{
71
    p = check_null_errors ( p, fn, ln ) ;
71
    p = check_null_errors(p, fn, ln);
72
    if ( p->ag_tag < tl || p->ag_tag >= tb ) {
72
    if (p->ag_tag < tl || p->ag_tag >= tb) {
73
	assert_errors ( "Union tag", fn, ln ) ;
73
	assert_errors("Union tag", fn, ln);
74
    }
74
    }
75
    return ( p ) ;
75
    return(p);
76
}
76
}
77
 
77
 
78
#endif
78
#endif