1 /* Begin include file varargs.h */
 2 
 3 
 4 /* HISTORY COMMENTS:
 5   1) change(88-08-30,DGHowe), approve(88-08-30,MCR7971),
 6      audit(88-09-09,RWaters):
 7      Make compatible with System V version of varargs.h. Remove previously
 8      required indirection. Allow for compilation with -def
 9      Multics_Obsolete_Varargs. NOTE: This is an incompatible change.
10                                                    END HISTORY COMMENTS */
11 
12 /* Modification  */
13 /* Implemented March 9, 1987 DGHowe                                   */
14 
15 /* The include file varargs.h has been altered to support the System
16    V definitions of the macros usually included in this file.  This
17    will imply that programs using the older version of the macros
18    which required an extra level of indirection have to be
19    recompiled using -def Multics_Obsolete_Varargs. or be altered to
20    remove the usages of get_arg and the level of indirection.
21 */
22 
23 #ifndef Multics_Obsolete_Varargs
24 
25 /* new MR12.2 version of the varargs macros. */
26 
27 #ifndef NULL
28 #define NULL (void *) 0
29 #endif
30 
31 typedef int **va_list;
32 va_list c_arg_ptr_addr();
33 
34 #define va_dcl int va_alist;
35 
36 int new_last_arg();
37 
38 #define va_start(ap) (ap = c_arg_ptr_addr(&va_alist))
39 #define va_arg(ap, type) ((new_last_arg(ap) | ap == NULL) ? ((ap=NULL),((type) 0)) : **(type **) ((ap)++))
40 #define va_end(ap) (ap = NULL)
41 
42 #else
43 
44 /* MR12.1 version of varargs.h
45    two new functions are included here to obtain the last argument passed
46    to a routine (usually the return value except for void functions) and
47    a function get_arg(x) which will return a pointer to the specified
48    argument. Both functions return types va_list.
49 
50    Example.
51 
52    va_list get_arg(),last_arg();
53    va_list arg, last;
54 
55    arg = get_arg (2);  will get second arg
56    last = last_arg();  will return the last arg
57 
58 */
59 
60 typedef char **va_list;
61 #define va_dcl int va_alist;
62 
63 va_list get_arg(), last_arg();
64 
65 #define va_end(list) (list)
66 #define va_start(list) (list=get_arg(1))
67 #define va_arg(list, mode) ((mode *)((list==last_arg()) ? (void*)0:*((list = list + 1), (list - 1))))
68 
69 #endif
70 
71 /* End include file varargs.h */