Subversion Repositories tendra.SVN

Rev

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

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
6 7u83 3
 
2 7u83 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:-
6 7u83 12
 
2 7u83 13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
6 7u83 15
 
2 7u83 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;
6 7u83 19
 
2 7u83 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;
6 7u83 23
 
2 7u83 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
    AUTOMATICALLY GENERATED FROM ALGEBRA errors (VERSION 1.0)
32
    BY calculus (VERSION 1.2)
33
*/
34
 
35
#ifndef ASSERT_DEF_H_INCLUDED
36
#define ASSERT_DEF_H_INCLUDED
37
 
38
/* Assertion function definitions */
39
 
40
#ifndef assert_errors
6 7u83 41
static void
42
assert_errors
43
(char *s, char *fn, int ln)
2 7u83 44
{
6 7u83 45
    (void)fprintf(stderr, "Assertion %s failed, %s, line %d.\n", s, fn, ln);
46
    abort();
2 7u83 47
}
48
#endif
49
 
6 7u83 50
errors *
51
check_null_errors
52
(errors *p, char *fn, int ln)
2 7u83 53
{
6 7u83 54
    if (p == NULL) assert_errors("Null pointer", fn, ln);
55
    return(p);
2 7u83 56
}
57
 
6 7u83 58
errors *
59
check_tag_errors
60
(errors *p, unsigned t, char *fn, int ln)
2 7u83 61
{
6 7u83 62
    p = check_null_errors(p, fn, ln);
63
    if (p->ag_tag != t) assert_errors("Union tag", fn, ln);
64
    return(p);
2 7u83 65
}
66
 
6 7u83 67
errors *
68
check_tag_etc_errors
69
(errors *p, unsigned tl, unsigned tb X char *fn X int ln)
2 7u83 70
{
6 7u83 71
    p = check_null_errors(p, fn, ln);
72
    if (p->ag_tag < tl || p->ag_tag >= tb) {
73
	assert_errors("Union tag", fn, ln);
2 7u83 74
    }
6 7u83 75
    return(p);
2 7u83 76
}
77
 
78
#endif