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