[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT/DUKTAPE PATCH] Provide main(), jump into interactive mode.
Looks fine to me. Thanks! Reviewed-by: Simon Kuenzer <simon.keunzer@xxxxxxxxx> On 12.02.20 14:54, Felipe Huici wrote: Add the ability for the duktape library to provide a main() so that the application doesn't have to (selectable from the menu). In addition, duktape now goes straight into interactive mode; previosuly it was assuming that the --append parameter was a file name to be read and executed, which was broken. At some point we should add initrd support to this port. Signed-off-by: Felipe Huici <felipe.huici@xxxxxxxxx> --- Config.uk | 8 +++++- Makefile.uk | 8 ++++++ glue.c | 11 ++++++++ patches/0001-jump-into-interactive-mode.patch | 28 +++++++++++++++++++ patches/0001-rename-main-function.patch | 11 -------- 5 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 glue.c create mode 100644 patches/0001-jump-into-interactive-mode.patch delete mode 100644 patches/0001-rename-main-function.patch diff --git a/Config.uk b/Config.uk index 6a3c59c..b9e2274 100644 --- a/Config.uk +++ b/Config.uk @@ -1,4 +1,10 @@ -config DUKTAPE +menuconfig DUKTAPE bool "Duktape - an embeddable Javascript engine" default n select LIBNEWLIBC + +if DUKTAPE +config DUKTAPE_MAIN_FUNCTION + bool "Provide main function" + default y +endif diff --git a/Makefile.uk b/Makefile.uk index 45dffcc..bcb3def 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -60,9 +60,17 @@ DUKTAPE_GENERATED=$(DUKTAPE_EXTRACTED)/duktape-src CINCLUDES-$(CONFIG_DUKTAPE) += -I$(DUKTAPE_EXTRACTED)/duktape-src CXXINCLUDES-$(CONFIG_DUKTAPE) += -I$(DUKTAPE_EXTRACTED)/duktape-src+################################################################################+# Library flags +################################################################################ +DUKTAPE_CFLAGS-y += -Wno-unused-function +DUKTAPE_CXXFLAGS-y += -Wno-unused-function + ################################################################################ # Sources ################################################################################ +DUKTAPE_DUK_CMDLINE_FLAGS-y += -Dmain=duktape_main +DUKTAPE_SRCS-$(CONFIG_DUKTAPE_MAIN_FUNCTION) += $(DUKTAPE_BASE)/glue.c DUKTAPE_SRCS-y += $(DUKTAPE_GENERATED)/duktape.c DUKTAPE_SRCS-y += $(DUKTAPE_EXTRACTED)/examples/cmdline/duk_cmdline.cdiff --git a/glue.c b/glue.cnew file mode 100644 index 0000000..7cee52d --- /dev/null +++ b/glue.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +/* Import user configuration: */ +#include <uk/config.h> + +extern int duktape_main(int argc, char *argv[]); + +int main(int argc, char *argv[]) +{ + return duktape_main(argc, argv); +} diff --git a/patches/0001-jump-into-interactive-mode.patch b/patches/0001-jump-into-interactive-mode.patch new file mode 100644 index 0000000..7ba2f01 --- /dev/null +++ b/patches/0001-jump-into-interactive-mode.patch @@ -0,0 +1,28 @@ +--- a/examples/cmdline/duk_cmdline.c 2020-02-12 14:43:19.599772761 +0100 ++++ b/examples/cmdline/duk_cmdline.c 2020-02-12 14:41:23.393106690 +0100 +@@ -1265,7 +1265,7 @@ + int retval = 0; + int have_files = 0; + int have_eval = 0; +- int interactive = 0; ++ int interactive = 1; + int memlimit_high = 1; + int alloc_provider = ALLOC_DEFAULT; + int lowmem_log = 0; +@@ -1456,6 +1456,7 @@ + continue; + } + ++ /* + if (verbose) { + fprintf(stderr, "*** Executing file: %s\n", arg); + fflush(stderr); +@@ -1465,7 +1466,7 @@ + retval = 1; + goto cleanup; + } +- ++ */ + if (recreate_heap) { + if (verbose) { + fprintf(stderr, "*** Recreating heap...\n"); diff --git a/patches/0001-rename-main-function.patch b/patches/0001-rename-main-function.patch deleted file mode 100644 index 8c4a8cc..0000000 --- a/patches/0001-rename-main-function.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/examples/cmdline/duk_cmdline.c 2019-09-09 08:23:15.891284704 +0200 -+++ b/examples/cmdline/duk_cmdline.c 2019-09-09 08:22:57.783472251 +0200 -@@ -1260,7 +1260,7 @@ - * Main - */ - --int main(int argc, char *argv[]) { -+int duktape_main(int argc, char *argv[]) { - duk_context *ctx = NULL; - int retval = 0; - int have_files = 0; _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |