From 7ececb46cbda81a493f9f4f7ce7677ba0c86f176 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Fri, 13 May 2016 03:50:39 +0300 Subject: [PATCH] print-alert/console extra consistency trivia --- extras/console/README.rst | 2 +- extras/console/test.c | 1 + extras/print-alert/README.rst | 2 +- extras/print-alert/test.c | 5 ++++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/extras/console/README.rst b/extras/console/README.rst index da312119..f6603821 100644 --- a/extras/console/README.rst +++ b/extras/console/README.rst @@ -11,7 +11,7 @@ contains an example binding: * Ensure ``duk_console.h`` is in the include path. -* Include the extra header in calling code:: +* Include the extra header in calling code and initialize the bindings:: #include "duktape.h" #include "duk_console.h" diff --git a/extras/console/test.c b/extras/console/test.c index f515a55a..00438413 100644 --- a/extras/console/test.c +++ b/extras/console/test.c @@ -12,6 +12,7 @@ int main(int argc, char *argv[]) { } duk_console_init(ctx, DUK_CONSOLE_PROXY_WRAPPER /*flags*/); + printf("top after init: %ld\n", (long) duk_get_top(ctx)); for (i = 1; i < argc; i++) { printf("Evaling: %s\n", argv[i]); diff --git a/extras/print-alert/README.rst b/extras/print-alert/README.rst index 6e14a2c5..41c36200 100644 --- a/extras/print-alert/README.rst +++ b/extras/print-alert/README.rst @@ -11,7 +11,7 @@ print() and alert() bindings: * Ensure ``duk_print_alert.h`` is in the include path. -* Include the extra header in calling code:: +* Include the extra header in calling code and initialize the bindings:: #include "duktape.h" #include "duk_print_alert.h" diff --git a/extras/print-alert/test.c b/extras/print-alert/test.c index 5ecebe3d..1237adb9 100644 --- a/extras/print-alert/test.c +++ b/extras/print-alert/test.c @@ -12,10 +12,13 @@ int main(int argc, char *argv[]) { } duk_print_alert_init(ctx, 0 /*flags*/); + printf("top after init: %ld\n", (long) duk_get_top(ctx)); for (i = 1; i < argc; i++) { printf("Evaling: %s\n", argv[i]); - duk_eval_string_noresult(ctx, argv[i]); + (void) duk_peval_string(ctx, argv[i]); + printf("--> %s\n", duk_safe_to_string(ctx, -1)); + duk_pop(ctx); } printf("Done\n");