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