home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
INCLUDE
/
OAKARG.H
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-18
|
2KB
|
78 lines
/*
oakarg.h
% portable macros for creating variable argument functions
OWL 1.2
Copyright (c) 1989, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
12/10/89 jmd created
4/30/90 jmd added ova_list macro for stdargs
8/08/90 jmd added stuff for STACK_MINUS
10/18/90 jmd moved O_STACKMINUS define to oakland.h
This header defines the ova_ set of macros. These are defined
to work in the same manner as the ANSI-proposed stdarg macros.
There are three versions:
1) using UNIX-style varargs (define O_VARARG in oakpriv.h)
2) using ANSI-style stdargs (define O_STDARG in oakpriv.h)
3) emulating stdargs with our own macros. (O_VARARG and O_STDARG are undefined)
*/
#ifdef O_VARARG
/* use UNIX-style varargs for variable argument processing */
# include <varargs.h>
# define ova_alist , va_alist
# define ova_dcl va_dcl
# define ova_list va_list
# define ova_start(pvar, prev) va_start(pvar)
# define ova_arg(pvar, type) va_arg(pvar, type)
# define ova_end(pvar) va_end(pvar)
# define OARGS
#endif
#ifdef O_STDARG
/* use ANSI stdargs for variable argument processing */
# include <stdarg.h>
# define ova_alist , ...
# define ova_dcl
# define ova_list va_list
# define ova_start(pvar, prev) va_start(pvar, prev)
# define ova_arg(pvar, type) va_arg(pvar, type)
# define ova_end(pvar) va_end(pvar)
# define OARGS
#endif
#ifndef OARGS
/* use our own macros for variable argument processing */
# define ova_alist , ...
# define ova_dcl
# define ova_list char *
#ifndef O_STACKMINUS
# define ova_start(pvar, prev) (pvar = (ova_list)&prev + sizeof(prev))
# define ova_arg(pvar, type) ((type *)(pvar += sizeof(type)))[-1]
# define ova_end(pvar) (pvar = NULL)
#else /* for DG */
# define ova_start(pvar, prev) (pvar = (ova_list)&prev - sizeof(prev))
# define ova_arg(pvar, type) ((type *)(pvar -= sizeof(type)))[1]
# define ova_end(pvar) (pvar = NULL)
#endif
#endif