home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!gatech!europa.asd.contel.com!howland.reston.ans.net!spool.mu.edu!sgiblab!newsun!news
- From: Duane Murphy <damurphy@wc.novell.com>
- Subject: MPW VarArgs.h?
- Message-ID: <1993Jan22.164614.11185@novell.com>
- X-Xxdate: Fri, 22 Jan 93 16:53:41 GMT
- Sender: news@novell.com (The Netnews Manager)
- Nntp-Posting-Host: 130.57.72.123
- Organization: Novell, Inc.
- X-Useragent: Nuntius v1.1.1d12
- Date: Fri, 22 Jan 1993 16:46:14 GMT
- Lines: 42
-
-
- I am porting a program from the Unix world to the Macintosh. At one
- point we had everything working pretty well in Think C. We also would
- like to compile the program in MPW. However, I have discovered that MPW
- does not support the (outdated) varargs.h file. I am using the MPW from
- ETO 9 (C compiler 3.2.4).
-
- Varags.h is (kind of) an older version of stdarg.h. The varagrs
- mechanism is used in many places in the code and I would rather not
- change that (I would like to keep those code changes to a minimum). I
- looked at Think C's stdarg.h and varargs.h, compared them to MPW's
- stdarg.h (which is slightly different) and I came up with this for
- VarArgs.h for MPW.
-
- #ifndef __VARARGS__
- #define __VARARGS__
-
- #ifndef __va_list__
- #define __va_list__
- typedef char *va_list;
- #endif
-
- #define va_dcl int va_alist;
-
- #define va_start(ap) ap = (va_list) ((char *)&va_alist)
- #define va_arg(ap, type) ((type *)(ap += sizeof (type)))[-1]
- #define va_end(ap) /* do nothing */
-
- #endif
-
- Has any one else needed to do this? Is this correct? I am in the
- processes of trying it right now. This is one of those things that is
- not easy to tell if this is going to work every time.
-
- Thanks for any help,
- ...Duane
-
- +------------------------+--------------------------------------------+
- | Duane Murphy | My opinions are mine, mine, and only mine; |
- | damurphy@wc.novell.com | Except when they are also yours. |
- | Macintosh Software QA | |
- +------------------------+--------------------------------------------+
-