Subversion Repositories tendra.SVN

Rev

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