diff options
Diffstat (limited to 'src/stdarg')
-rw-r--r-- | src/stdarg/va_arg.c | 22 | ||||
-rw-r--r-- | src/stdarg/va_copy.c | 6 | ||||
-rw-r--r-- | src/stdarg/va_end.c | 19 | ||||
-rw-r--r-- | src/stdarg/va_list.c | 12 | ||||
-rw-r--r-- | src/stdarg/va_start.c | 24 |
5 files changed, 83 insertions, 0 deletions
diff --git a/src/stdarg/va_arg.c b/src/stdarg/va_arg.c new file mode 100644 index 00000000..37353882 --- /dev/null +++ b/src/stdarg/va_arg.c @@ -0,0 +1,22 @@ +#include <stdarg.h> +#define va_arg(ap, type) __builtin_va_arg(ap, type) + +/** get an unnamed parameter **/ + +/*** +retrieves the next unnamed parameter for use. The +ARGUMENT(ap) parameter must be first initialized with a call to FUNCTION(va_start). +Each successive call to FUNCTION(va_arg) evaluates the next argument as an +object of type ARGUMENT(type) and returns that value, modifying ARGUMENT(ap) for use in +the next call to FUNCTION(va_arg). +***/ + +/* +PROTOTYPE(TYPE(VAR(type)) va_arg(va_list ap, TYPE(VAR(type)));) +UNDEFINED(There is no next argument) +UNDEFINED(The next argument is not compatible with TYPE(ARGUMENT(type))) +RETURN_SUCCESS(an object of TYPE(ARGUMENT(type)) which is the next unnamed function parameter) +*/ +/* +STDC(1) +*/ diff --git a/src/stdarg/va_copy.c b/src/stdarg/va_copy.c new file mode 100644 index 00000000..27c13dc8 --- /dev/null +++ b/src/stdarg/va_copy.c @@ -0,0 +1,6 @@ +#include <stdarg.h> +#define va_copy(dest, src) __builtin_va_copy(dest, src) + +/* +STDC(199901) +*/ diff --git a/src/stdarg/va_end.c b/src/stdarg/va_end.c new file mode 100644 index 00000000..00588526 --- /dev/null +++ b/src/stdarg/va_end.c @@ -0,0 +1,19 @@ +#include <stdarg.h> +#define va_end(ap) __builtin_va_end(ap) + +/** end processing unnamed arguments **/ + +/*** +stops processing unnamed arguments that were +previously begun with a call to FUNCTION(va_start) so that the enclosing function +may return normally. +***/ + +/* +PROTOTYPE(void va_end(va_list ap);) +UNDEFINED(ARGUMENT(ap) was not initialized by FUNCTION(va_start)) +UNDEFINED(THIS() is not called in the same function as FUNCTION(va_start)) +*/ +/* +STDC(1) +*/ diff --git a/src/stdarg/va_list.c b/src/stdarg/va_list.c new file mode 100644 index 00000000..21b1329b --- /dev/null +++ b/src/stdarg/va_list.c @@ -0,0 +1,12 @@ +#include <stdarg.h> +typedef __builtin_va_list va_list; + +/** variable length argument list **/ + +/*** +holds the information necessary for making calls to FUNCTION(va_start), +FUNCTION(va_copy), FUNCTION(va_arg), and FUNCTION(va_end). +***/ +/* +STDC(1) +*/ diff --git a/src/stdarg/va_start.c b/src/stdarg/va_start.c new file mode 100644 index 00000000..6151fb15 --- /dev/null +++ b/src/stdarg/va_start.c @@ -0,0 +1,24 @@ +#include <stdarg.h> +#define va_start(ap, parmN) __builtin_va_start(ap, parmN) + +/** begin processing unnamed arguments **/ + +/*** +prepares unnamed arguments for use. It initializes +ARGUMENT(ap) with the the first argument after the argument named by ARGUMENT(parmN). The +argument named by ARGUMENT(parmN) must be the final named argument to function (i.e. +the argument just prior to LITERAL(`, ...')). +***/ + +/* +PROTOTYPE(void va_start(va_list ap, VAR(parmN));) + +/* +UNDEFINED(ARGUMENT(parmN) is declared TYPE(register)) +UNDEFINED(ARGUMENT(parmN) is a function pointer) +UNDEFINED(ARGUMENT(parmN) is an array type) +UNDEFINED(ARGUMENT(parmN) is a type not compatible with default argument promotions) +*/ +/* +STDC(1) +*/ |