Rev 1217 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1217 | Rev 1331 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /* |
1 | /* |
| 2 | * Copyright (C) 2006 Martin Decky |
2 | * Copyright (C) 2006 Josef Cejka |
| 3 | * All rights reserved. |
3 | * All rights reserved. |
| 4 | * |
4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
7 | * are met: |
| Line 24... | Line 24... | ||
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
27 | */ |
| 28 | 28 | ||
| 29 | - | ||
| 30 | /* |
- | |
| 31 | * Variable argument list manipulation macros |
- | |
| 32 | * for architectures using stack to pass arguments. |
- | |
| 33 | */ |
- | |
| 34 | - | ||
| 35 | #ifndef __LIBC_STACKARG_H__ |
29 | #ifndef __LIBC__STACKARG_H__ |
| 36 | #define __LIBC_STACKARG_H__ |
30 | #define __LIBC__STACKARG_H__ |
| 37 | - | ||
| 38 | #include <types.h> |
- | |
| 39 | - | ||
| 40 | /* dont allow to define it second time in stdarg.h */ |
- | |
| 41 | #define __VARARGS_DEFINED |
- | |
| 42 | - | ||
| 43 | typedef struct va_list { |
- | |
| 44 | int pos; |
- | |
| 45 | uint8_t *last; |
- | |
| 46 | } va_list; |
- | |
| 47 | - | ||
| 48 | #define va_start(ap, lst) \ |
- | |
| 49 | (ap).pos = sizeof(lst); \ |
- | |
| 50 | (ap).last = (uint8_t *) &(lst) |
- | |
| 51 | - | ||
| 52 | #define va_arg(ap, type) \ |
- | |
| 53 | (*((type *)((ap).last + ((ap).pos += sizeof(type)) - sizeof(type)))) |
- | |
| 54 | - | ||
| 55 | #define va_end(ap) |
- | |
| 56 | - | ||
| 57 | 31 | ||
| 58 | #endif |
32 | #endif |
| - | 33 | ||