From c54a04ac1040b944d8dd084063e1d71524d69f1e Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Mon, 29 Dec 2014 15:07:47 +0200 Subject: [PATCH] API docs for new vararg API call variants --- website/api/duk_error.txt | 1 + website/api/duk_error_va.txt | 30 +++++++++++++++++++++ website/api/duk_log.txt | 3 +++ website/api/duk_log_va.txt | 25 ++++++++++++++++++ website/api/duk_push_error_object.txt | 3 +++ website/api/duk_push_error_object_va.txt | 33 ++++++++++++++++++++++++ website/api/duk_push_vsprintf.txt | 1 + 7 files changed, 96 insertions(+) create mode 100644 website/api/duk_error_va.txt create mode 100644 website/api/duk_log_va.txt create mode 100644 website/api/duk_push_error_object_va.txt diff --git a/website/api/duk_error.txt b/website/api/duk_error.txt index 31e72ebc..27e8c0a1 100644 --- a/website/api/duk_error.txt +++ b/website/api/duk_error.txt @@ -25,6 +25,7 @@ duk_error(ctx, DUK_ERR_RANGE_ERROR, "argument out of range: %d", (int) argval); error =seealso +duk_error_va duk_throw duk_push_error_object diff --git a/website/api/duk_error_va.txt b/website/api/duk_error_va.txt new file mode 100644 index 00000000..b5a3aad9 --- /dev/null +++ b/website/api/duk_error_va.txt @@ -0,0 +1,30 @@ +=proto +void duk_error_va(duk_context *ctx, duk_errcode_t err_code, const char *fmt, va_list ap); + +=stack +[ ... ] -> [ ... err! ] + +=summary +

Vararg variant of +duk_error().

+ +=example +void my_range_error(duk_context *ctx, const char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + duk_error_va(ctx, DUK_ERR_RANGE_ERROR, fmt, ap); + va_end(ap); +} + +=tags +error +vararg + +=seealso +duk_error +duk_throw +duk_push_error_object + +=introduced +1.1.0 diff --git a/website/api/duk_log.txt b/website/api/duk_log.txt index 154470f7..5272ef22 100644 --- a/website/api/duk_log.txt +++ b/website/api/duk_log.txt @@ -10,6 +10,9 @@ built-in logging facility, see =example duk_log(ctx, DUK_LOG_INFO, "received message, type: %d", (int) msg_type); +=seealso +duk_log_va + =tags log diff --git a/website/api/duk_log_va.txt b/website/api/duk_log_va.txt new file mode 100644 index 00000000..9cc0e60b --- /dev/null +++ b/website/api/duk_log_va.txt @@ -0,0 +1,25 @@ +=proto +void duk_log_va(duk_context *ctx, duk_int_t level, const char *fmt, va_list ap); + +=summary +

Vararg variant of +duk_log().

+ +=example +void my_log_info(duk_context *ctx, const char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + duk_log_va(ctx, DUK_LOG_INFO, fmt, ap); + va_end(ap); +} + +=tags +log +vararg + +=seealso +duk_log + +=introduced +1.1.0 diff --git a/website/api/duk_push_error_object.txt b/website/api/duk_push_error_object.txt index 00b6c889..fab406c9 100644 --- a/website/api/duk_push_error_object.txt +++ b/website/api/duk_push_error_object.txt @@ -24,5 +24,8 @@ stack object error +=seealso +duk_push_error_object_va + =introduced 1.0.0 diff --git a/website/api/duk_push_error_object_va.txt b/website/api/duk_push_error_object_va.txt new file mode 100644 index 00000000..901c5897 --- /dev/null +++ b/website/api/duk_push_error_object_va.txt @@ -0,0 +1,33 @@ +=proto +duk_idx_t duk_push_error_object_va(duk_context *ctx, duk_errcode_t err_code, const char *fmt, va_list ap); + +=stack +[ ... ] -> [ ... err! ] + +=summary +

Vararg variant of +duk_push_error_object().

+ +=example +duk_idx_t my_type_error(duk_context *ctx, const char *fmt, ...) { + va_list ap; + duk_idx_t err_idx; + + va_start(ap, fmt); + err_idx = duk_push_error_object_va(ctx, fmt, ap); + va_end(ap); + + return err_idx; +} + +=tags +stack +object +error +vararg + +=seealso +duk_push_error_object + +=introduced +1.1.0 diff --git a/website/api/duk_push_vsprintf.txt b/website/api/duk_push_vsprintf.txt index 6cc91cb7..e872b1aa 100644 --- a/website/api/duk_push_vsprintf.txt +++ b/website/api/duk_push_vsprintf.txt @@ -40,6 +40,7 @@ void test(duk_context *ctx) { =tags stack string +vararg =introduced 1.0.0