Subversion Repositories tendra.SVN

Rev

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

Rev Author Line No. Line
6 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
#ifndef _STDARG_H
31
#define _STDARG_H
32
 
33
 
34
#ifndef __BUILDING_TDF_ANSI_STDARG_H_VA_ARGS
35
 
36
 
37
/*
38
    DEFINITION OF VA_LIST
39
 
40
    The definition of va_list is copied from the system header.
41
*/
42
 
43
#ifndef _VA_LIST
44
#define _VA_LIST
45
typedef char *va_list ;
46
#endif
47
 
48
 
49
/*
50
    TOKEN DECLARATIONS
51
 
52
    The tokens __va_t, __va_start, va_arg and va_end are as in the
53
    ansi:stdarg header.  The only difference is that va_list is defined
54
    as its implementation type, rather than being a tokenised type.
55
*/
56
 
57
#pragma token TYPE __va_t # ~__va_t
58
#pragma token PROC ( EXP rvalue : __va_t : ) EXP rvalue : va_list : __va_start # ansi.stdarg.__va_start
59
#pragma token PROC ( EXP lvalue : va_list : e , TYPE t ) EXP rvalue : t : va_arg # ansi.stdarg.va_arg
60
#pragma token PROC ( EXP lvalue : va_list : ) EXP rvalue : void : va_end # ansi.stdarg.va_end
61
#pragma interface __va_t __va_start va_arg va_end
62
 
63
 
64
/*
65
    DEFINITION OF VA_START
66
 
67
    How va_start is defined in terms of __va_start depends on whether
68
    this is stdarg.h or varargs.h.
69
*/
70
 
71
#pragma TenDRA ident ... allow
72
 
73
#ifdef __HACKED_VARARGS
74
#define va_alist		...
75
#define va_dcl
76
#define va_start( l )		( ( void ) ( l = __va_start ( ... ) ) )
77
#else
78
#define va_start( l, i )	( ( void ) ( l = __va_start ( ... ) ) )
79
#endif
80
 
81
 
82
#else /* __BUILDING_TDF_ANSI_STDARG_H_VA_ARGS */
83
 
84
 
85
/*
86
    IMPLEMENTATION OF STDARG
87
 
88
    This implementation basically works, and avoids the built-in
89
    operators defined in the system header.
90
*/
91
 
92
typedef char *va_list ;
93
 
94
#define __va_round( T )\
95
    ( ( ( sizeof ( T ) + 3 ) / 4 ) * 4 )
96
 
97
#define va_start( AP, ARG )\
98
    ( AP = &( ARG ) + __va_round ( ARG ) )
99
 
100
#define va_end( AP )	( ( void ) 0 )
101
 
102
#define va_arg( AP, T )\
103
    ( AP += __va_round ( T ),\
104
      *( ( T * ) ( ( AP ) - __va_round ( T ) ) ) )
105
 
106
 
107
#endif /* __BUILDING_TDF_ANSI_STDARG_H_VA_ARGS */
108
 
109
 
110
#endif /* _STDARG_H */