Annotation of mstools/h/varargs.h, revision 1.1.1.4

1.1       root        1: /***
                      2: *varargs.h - XENIX style macros for variable argument functions
                      3: *
                      4: *      Copyright (c) 1985-1990, Microsoft Corporation. All rights reserved.
                      5: *
                      6: *Purpose:
                      7: *      This file defines XENIX style macros for accessing arguments of a
                      8: *      function which takes a variable number of arguments.
                      9: *      [System V]
                     10: *
                     11: ****/
                     12: 
                     13: #ifndef _INC_VARARGS
                     14: 
                     15: #ifdef __cplusplus
                     16: extern "C" {
                     17: #endif
                     18: 
                     19: #ifdef __STDC__
                     20: #error varargs.h incompatible with ANSI (use stdarg.h)
                     21: #endif
                     22: 
                     23: #ifndef _VA_LIST_DEFINED
1.1.1.4 ! root       24: 
        !            25: #ifdef _ALPHA_
        !            26: typedef struct {
        !            27:     char *a0;           /* pointer to first homed integer argument */
        !            28:     int offset;         /* byte offset of next parameter */
        !            29: } va_list;
        !            30: 
        !            31: #else
1.1       root       32: typedef char *va_list;
1.1.1.4 ! root       33: #endif
        !            34: 
1.1       root       35: #define _VA_LIST_DEFINED
                     36: #endif
                     37: 
1.1.1.2   root       38: 
                     39: 
1.1.1.3   root       40: #ifdef _X86_
1.1       root       41: /*
                     42:  * define a macro to compute the size of a type, variable or expression,
                     43:  * rounded up to the nearest multiple of sizeof(int). This number is its
                     44:  * size as function argument (Intel architecture). Note that the macro
                     45:  * depends on sizeof(int) being a power of 2!
                     46:  */
                     47: 
                     48: #define _INTSIZEOF(n)   ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
                     49: 
                     50: #define va_dcl va_list va_alist;
                     51: #define va_start(ap) ap = (va_list)&va_alist
1.1.1.2   root       52: #define va_arg(ap,t)    ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
1.1       root       53: #define va_end(ap) ap = (va_list)0
1.1.1.2   root       54: #endif
                     55: 
                     56: 
1.1.1.3   root       57: #if defined(_M_MRX000)
1.1.1.2   root       58: #define va_dcl int va_alist;
                     59: #define va_start(list) list = (char *) &va_alist
                     60: #define va_end(list)
                     61: #define va_arg(list, mode) ((mode *)(list =\
                     62:  (char *) ((((int)list + (__builtin_alignof(mode)<=4?3:7)) &\
                     63:  (__builtin_alignof(mode)<=4?-4:-8))+sizeof(mode))))[-1]
                     64: /*  +++++++++++++++++++++++++++++++++++++++++++
                     65:     Because of parameter passing conventions in C:
                     66:     use mode=int for char, and short types
                     67:     use mode=double for float types
                     68:     use a pointer for array types
                     69:     +++++++++++++++++++++++++++++++++++++++++++ */
                     70: #endif
                     71: 
1.1       root       72: 
1.1.1.4 ! root       73: #ifdef _ALPHA_
        !            74: 
        !            75: /*
        !            76:  * The Alpha compiler supports two builtin functions that are used to
        !            77:  * implement stdarg/varargs.  The __builtin_va_start function is used
        !            78:  * by va_start to initialize the data structure that locates the next
        !            79:  * argument.  The __builtin_isfloat function is used by va_arg to pick
        !            80:  * which part of the home area a given register argument is stored in.
        !            81:  * The home area is where up to six integer and/or six floating point
        !            82:  * register arguments are stored down (so they can also be referenced
        !            83:  * by a pointer like any arguments passed on the stack).
        !            84:  */
        !            85: 
        !            86: #ifdef __cplusplus
        !            87: extern __builtin_va_start(va_list, ...);
        !            88: #endif
        !            89: #define va_dcl long va_alist;
        !            90: #define va_start(list) __builtin_va_start(list, va_alist, 0)
        !            91: #define va_end(list)
        !            92: #define va_arg(list, mode) \
        !            93:     ( *(        ((list).offset += ((int)sizeof(mode) + 7) & -8) , \
        !            94:         (mode *)((list).a0 + (list).offset - \
        !            95:                     ((__builtin_isfloat(mode) && (list).offset <= (6 * 8)) ? \
        !            96:                         (6 * 8) + 8 : ((int)sizeof(mode) + 7) & -8) \
        !            97:                 ) \
        !            98:        ) \
        !            99:     )
        !           100: 
        !           101: #endif /* _ALPHA_ */
        !           102: 
        !           103: 
1.1       root      104: #ifdef __cplusplus
                    105: }
                    106: #endif
                    107: 
                    108: #define _INC_VARARGS
                    109: #endif /* _INC_VARARGS */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.