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
#ifndef __BUILDING_TDF_ANSI_STDARG_H_VA_ARGS
34
 
35
#include <standards.h>
36
#include <va_list.h>
37
 
38
 
39
/*
40
    TOKEN DECLARATIONS
41
 
42
    The tokens __va_t, __va_start, va_arg and va_end are as in the
43
    ansi:stdarg header.  The only difference is that va_list is defined
44
    as its implementation type, rather than being a tokenised type.
45
*/
46
 
47
#pragma token TYPE __va_t # ~__va_t
48
#pragma token PROC ( EXP rvalue : __va_t : ) EXP rvalue : va_list : __va_start # ansi.stdarg.__va_start
49
#pragma token PROC ( EXP lvalue : va_list : e , TYPE t ) EXP rvalue : t : va_arg # ansi.stdarg.va_arg
50
#pragma token PROC ( EXP lvalue : va_list : ) EXP rvalue : void : va_end # ansi.stdarg.va_end
51
#pragma interface __va_t __va_start va_arg va_end
52
 
53
 
54
/*
55
    DEFINITION OF VA_START
56
 
57
    How va_start is defined in terms of __va_start depends on whether
58
    this is stdarg.h or varargs.h.
59
*/
60
 
61
#pragma TenDRA ident ... allow
62
 
63
#ifdef __HACKED_VARARGS
64
#define va_alist		...
65
#define va_dcl
66
#define va_start( l )		( ( void ) ( l = __va_start ( ... ) ) )
67
#else
68
#define va_start( l, i )	( ( void ) ( l = __va_start ( ... ) ) )
69
#endif
70
 
71
 
72
#else /* __BUILDING_TDF_ANSI_STDARG_H_VA_ARGS */
73
 
74
 
75
/*
76
    IMPLEMENTATION OF STDARG
77
 
78
    This implementation basically works, and avoids the built-in
79
    operators defined in the system header.
80
*/
81
 
82
#pragma token PROC ( TYPE t ) EXP rvalue : int : __builtin_isfloat #
83
#pragma no_def __builtin_isfloat
84
 
85
#define _VA_LIST
86
#define __COMPLEX_VA_LIST
87
typedef struct {
88
    char *_a0;		/* pointer to first homed integer arg */
89
    int _offset;	/* byte offset of next param */
90
} va_list;
91
 
92
static va_list _v ;
93
typedef char *__va_t ;
94
 
95
#define __va_start(X)   (_v._a0 = ( X ), _v._offset = 0, _v)
96
#define va_end(X)	( ( void ) 0 )
97
 
98
#define va_arg(list, mode) \
99
	(*(((list)._offset += ((int)sizeof(mode) + 7) & -8), \
100
	    (mode *)((list)._a0 + (list)._offset - \
101
		((__builtin_isfloat(mode) && (list)._offset <= (6 * 8)) ? \
102
		(6 * 8) + 8 : ((int)sizeof(mode) + 7) & -8))))
103
 
104
#endif /* __BUILDING_TDF_ANSI_STDARG_H_VA_ARGS */
105
 
106
 
107
#endif /* _STDARG_H */