1 2 // automatically generated by m4 from headers in proto subdir 3 4 5 #ifndef __STDARG_H__ 6 #define __STDARG_H__ 7 8 #if defined(__CLANG) 9 10 typedef unsigned char * va_list; 11 12 #define va_start(marker, last) { marker = (va_list)&last + sizeof(last); } 13 #define va_arg(marker, type) *((type *)((marker += sizeof(type)) - sizeof(type))) 14 #define va_copy(dest, src) { dest = src; } 15 #define va_end(marker) { marker = (va_list) 0; }; 16 17 #elif defined(__SDCC) || defined(__Z88DK_R2L_CALLING_CONVENTION) 18 19 // SDCC (or sccz80 with r2l mode) 20 // r->l parameter passing means there are no issues 21 22 /*------------------------------------------------------------------------- 23 stdarg.h - ANSI macros for variable parameter list 24 25 Copyright (C) 2000, Michael Hope 26 Copyright (C) 2011, Philipp Klaus Krause pkk@spth.de 27 28 This library is free software; you can redistribute it and/or modify it 29 under the terms of the GNU General Public License as published by the 30 Free Software Foundation; either version 2, or (at your option) any 31 later version. 32 33 This library is distributed in the hope that it will be useful, 34 but WITHOUT ANY WARRANTY; without even the implied warranty of 35 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 36 GNU General Public License for more details. 37 38 You should have received a copy of the GNU General Public License 39 along with this library; see the file COPYING. If not, write to the 40 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 41 MA 02110-1301, USA. 42 43 As a special exception, if you link this library with other files, 44 some of which are compiled with SDCC, to produce an executable, 45 this library does not by itself cause the resulting executable to 46 be covered by the GNU General Public License. This exception does 47 not however invalidate any other reasons why the executable file 48 might be covered by the GNU General Public License. 49 -------------------------------------------------------------------------*/ 50 51 typedef unsigned char * va_list; 52 53 #define va_start(marker, last) { marker = (va_list)&last + sizeof(last); } 54 #define va_arg(marker, type) *((type *)((marker += sizeof(type)) - sizeof(type))) 55 #define va_copy(dest, src) { dest = src; } 56 #define va_end(marker) { marker = (va_list) 0; }; 57 58 #define va_ptr(marker, type) *((type *)(marker - sizeof(type))) 59 60 #elif defined(__SCCZ80) 61 #warning stdarg.h has many caveats when used in left-to-right mode. 62 63 // SCCZ80 64 // l->r parameter passing means compiler must tell us how many params are on the stack 65 66 // djm 28/2/2000 67 68 extern int __LIB__ getarg(void); 69 70 #define va_list unsigned char * 71 #define va_start(ap,last) ap=(getarg()*2)+&last-7 72 #define va_arg(ap,type) (*(type*)(ap-=sizeof(type),ap+1)) 73 #define va_copy(dst, src) dst = src 74 #define va_end(ap) 75 76 #define va_ptr(ap,type) (*(type*)(ap+1)) 77 78 #endif 79 80 #endif 81