Annotation of XNU/osfmk/sys/varargs.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * The contents of this file constitute Original Code as defined in and
        !             7:  * are subject to the Apple Public Source License Version 1.1 (the
        !             8:  * "License").  You may not use this file except in compliance with the
        !             9:  * License.  Please obtain a copy of the License at
        !            10:  * http://www.apple.com/publicsource and read it before using this file.
        !            11:  * 
        !            12:  * This Original Code and all software distributed under the License are
        !            13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            17:  * License for the specific language governing rights and limitations
        !            18:  * under the License.
        !            19:  * 
        !            20:  * @APPLE_LICENSE_HEADER_END@
        !            21:  */
        !            22: /*
        !            23:  * @OSF_COPYRIGHT@
        !            24:  */
        !            25: /*
        !            26:  * HISTORY
        !            27:  * 
        !            28:  * Revision 1.1.1.1  1998/09/22 21:05:49  wsanchez
        !            29:  * Import of Mac OS X kernel (~semeria)
        !            30:  *
        !            31:  * Revision 1.1.1.1  1998/03/07 02:25:59  wsanchez
        !            32:  * Import of OSF Mach kernel (~mburg)
        !            33:  *
        !            34:  * Revision 1.2.28.1  1996/11/29  16:59:53  stephen
        !            35:  *     nmklinux_1.0b3_shared into pmk1.1
        !            36:  *     Added powerpc special case
        !            37:  *     [1996/11/29  16:34:18  stephen]
        !            38:  *
        !            39:  * Revision 1.2.15.2  1996/01/09  19:23:16  devrcs
        !            40:  *     Added alpha varargs.h
        !            41:  *     [1995/12/01  20:39:10  jfraser]
        !            42:  * 
        !            43:  *     Merged '64-bit safe' changes from DEC alpha port.
        !            44:  *     [1995/11/21  18:10:39  jfraser]
        !            45:  * 
        !            46:  * Revision 1.2.15.1  1994/09/23  03:13:46  ezf
        !            47:  *     change marker to not FREE
        !            48:  *     [1994/09/22  21:59:07  ezf]
        !            49:  * 
        !            50:  * Revision 1.2.4.3  1993/08/03  18:30:40  gm
        !            51:  *     CR9596: Change KERNEL to MACH_KERNEL.
        !            52:  *     [1993/08/02  19:03:10  gm]
        !            53:  * 
        !            54:  * Revision 1.2.4.2  1993/06/09  02:55:42  gm
        !            55:  *     Added to OSF/1 R1.3 from NMK15.0.
        !            56:  *     [1993/06/02  21:31:11  jeffc]
        !            57:  * 
        !            58:  * Revision 1.2  1993/04/19  17:17:26  devrcs
        !            59:  *     correct endif tags for ansi
        !            60:  *     [1993/02/25  17:56:02  david]
        !            61:  * 
        !            62:  * Revision 1.1  1992/09/30  02:37:05  robert
        !            63:  *     Initial revision
        !            64:  * 
        !            65:  * $EndLog$
        !            66:  */
        !            67: /* CMU_HIST */
        !            68: /*
        !            69:  * Revision 2.10  91/12/10  16:32:53  jsb
        !            70:  *     Fixes from Intel
        !            71:  *     [91/12/10  15:52:01  jsb]
        !            72:  * 
        !            73:  * Revision 2.9  91/09/12  16:54:22  bohman
        !            74:  *     Added mac2.
        !            75:  *     [91/09/11  17:22:52  bohman]
        !            76:  * 
        !            77:  * Revision 2.8  91/07/09  23:23:50  danner
        !            78:  *     Added luna88k support.
        !            79:  *     [91/06/24            danner]
        !            80:  * 
        !            81:  * Revision 2.7  91/06/18  20:53:02  jsb
        !            82:  *     Moved i860 varargs code here from i860/i860_varargs.h, thanks to
        !            83:  *     new copyright from Intel.
        !            84:  *     [91/06/18  19:15:02  jsb]
        !            85:  * 
        !            86:  * Revision 2.6  91/05/14  17:40:46  mrt
        !            87:  *     Correcting copyright
        !            88:  * 
        !            89:  * Revision 2.5  91/02/05  17:57:12  mrt
        !            90:  *     Changed to new Mach copyright
        !            91:  *     [91/02/01  17:49:51  mrt]
        !            92:  * 
        !            93:  * Revision 2.4  90/11/25  17:48:50  jsb
        !            94:  *     Added i860 support.
        !            95:  *     [90/11/25  16:54:09  jsb]
        !            96:  * 
        !            97:  * Revision 2.3  90/05/03  15:51:29  dbg
        !            98:  *     Added i386.
        !            99:  *     [90/02/08            dbg]
        !           100:  * 
        !           101:  * Revision 2.2  89/11/29  14:16:44  af
        !           102:  *     RCS-ed, added mips case.  Mips also needs it in Mach standalone
        !           103:  *     programs.
        !           104:  *     [89/10/28  10:39:14  af]
        !           105:  * 
        !           106:  */
        !           107: /* CMU_ENDHIST */
        !           108: /* 
        !           109:  * Mach Operating System
        !           110:  * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
        !           111:  * All Rights Reserved.
        !           112:  * 
        !           113:  * Permission to use, copy, modify and distribute this software and its
        !           114:  * documentation is hereby granted, provided that both the copyright
        !           115:  * notice and this permission notice appear in all copies of the
        !           116:  * software, derivative works or modified versions, and any portions
        !           117:  * thereof, and that both notices appear in supporting documentation.
        !           118:  * 
        !           119:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
        !           120:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
        !           121:  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
        !           122:  * 
        !           123:  * Carnegie Mellon requests users of this software to return to
        !           124:  *
        !           125:  *  Software Distribution Coordinator  or  [email protected]
        !           126:  *  School of Computer Science
        !           127:  *  Carnegie Mellon University
        !           128:  *  Pittsburgh PA 15213-3890
        !           129:  *
        !           130:  * any improvements or extensions that they make and grant Carnegie Mellon rights
        !           131:  * to redistribute these changes.
        !           132:  */
        !           133: /*
        !           134:  */
        !           135: 
        !           136: #ifndef _SYS_VARARGS_H_
        !           137: #define _SYS_VARARGS_H_
        !           138: 
        !           139: #if    defined(vax) || defined(sun3) || defined(mips) || defined(i386) || defined(mac2)
        !           140: #define        va_dcl  int     va_alist;
        !           141: typedef        char *  va_list;
        !           142: 
        !           143: #define        va_start(pvar)  (pvar) = (va_list)&va_alist
        !           144: #define        va_end(pvar)
        !           145: #ifdef mips
        !           146: # define va_arg(pvar, type) ((type *)(pvar = \
        !           147:                (va_list) (sizeof(type) > 4 ? ((int)pvar + 2*8 - 1) & -8 \
        !           148:                                   : ((int)pvar + 2*4 - 1) & -4)))[-1]
        !           149: #else  /* mips */
        !           150: #define        va_arg(pvar,type)       (               \
        !           151:                (pvar) += ((sizeof(type)+3) & ~0x3),    \
        !           152:                *((type *)((pvar) - ((sizeof(type)+3) & ~0x3))) )
        !           153: #endif /* mips */
        !           154: #endif /* vax */
        !           155: 
        !           156: /*
        !           157:  * Try to make varargs work for the Multimax so that _doprnt can be
        !           158:  * declared as
        !           159:  *     _doprnt(file, fmt, list)
        !           160:  *     FILE    *file;
        !           161:  *     char    *fmt;
        !           162:  *     va_list *list;
        !           163:  * and use
        !           164:  *
        !           165:  *     n = va_arg(*list, type)
        !           166:  *
        !           167:  * without needing to drag in extra declarations
        !           168:  *
        !           169:  * and printf becomes
        !           170:  *
        !           171:  * printf(fmt, va_alist)
        !           172:  *     char    *fmt;
        !           173:  *     va_dcl
        !           174:  * {
        !           175:  *     va_list listp;
        !           176:  *     va_start(listp);
        !           177:  *     _doprnt((FILE *)0, fmt, &listp);
        !           178:  *     va_end(listp);
        !           179:  * }
        !           180:  */
        !           181: 
        !           182: #if    defined(multimax) && defined(MACH_KERNEL)
        !           183: 
        !           184: /*
        !           185:  * the vararglist pointer is an elaborate structure (ecch)
        !           186:  */
        !           187: typedef struct va_list {
        !           188:        char    *va_item;       /* current item */
        !           189:        int     *va_ptr1,       /* arglist pointers for 1, 2, n */
        !           190:                *va_ptr2,
        !           191:                *va_ptrn;
        !           192:        int     va_ct;          /* current argument number */
        !           193: } va_list;
        !           194: 
        !           195: #define        va_alist        va_arg1, va_arg2, va_argn
        !           196: #define        va_dcl          int     va_arg1, va_arg2, va_argn;
        !           197: 
        !           198: #define        va_start(pvar)  (               \
        !           199:        (pvar).va_ptr1 = &va_arg1,      \
        !           200:        (pvar).va_ptr2 = &va_arg2,      \
        !           201:        (pvar).va_ptrn = &va_argn,      \
        !           202:        (pvar).va_ct = 0 )
        !           203: 
        !           204: #define        va_end(pvar)
        !           205: 
        !           206: #define        va_arg(pvar, type)      (       \
        !           207:        (pvar).va_ct++,                 \
        !           208:        (pvar).va_item = (char *)       \
        !           209:          ( ((pvar).va_ct == 1)         \
        !           210:            ? (pvar).va_ptr1            \
        !           211:            : ((pvar).va_ct == 2)       \
        !           212:              ? (pvar).va_ptr2          \
        !           213:              : (pvar).va_ptrn++ ) ,    \
        !           214:        *((type *)((pvar).va_item)) )
        !           215: 
        !           216: /* what a mess! */
        !           217: #endif /* defined(multimax) && defined(MACH_KERNEL) */
        !           218: 
        !           219: #if i860
        !           220: #include <i860/varargs.h>      /* PGI vs. Greenhills */
        !           221: #endif
        !           222: 
        !           223: #ifdef luna88k
        !           224: #include <luna88k/varargs.h> /* How nice */
        !           225: #endif
        !           226: 
        !           227: #if defined (__PPC__) && defined (_CALL_SYSV)
        !           228: #include <ppc/va-ppc.h>        /* care of gcc compiler - TEMPORARY 2.7.1 TODO NMGS*/
        !           229: #endif
        !           230: 
        !           231: #if defined(__alpha)
        !           232: #  include <varargs.h>
        !           233: #endif /* defined(__alpha) */
        !           234: 
        !           235: #endif /* _SYS_VARARGS_H_ */

unix.superglobalmegacorp.com

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