packages feed

hs-duktape 0.1.2 → 0.1.3

raw patch · 5 files changed

+100/−87 lines, 5 files

Files

duktape/src/duktape.c view

file too large to diff

duktape/src/duktape.h view
@@ -1,12 +1,13 @@ /*- *  Duktape public API for Duktape 1.4.0.+ *  Duktape public API for Duktape 1.5.1.+ *  *  See the API reference for documentation on call semantics.  *  The exposed API is inside the DUK_API_PUBLIC_H_INCLUDED  *  include guard.  Other parts of the header are Duktape  *  internal and related to platform/compiler/feature detection.  *- *  Git commit cad6f595382a0cc1a7e4207794ade5be11b3e397 (v1.4.0).- *  Git branch master.+ *  Git commit 2cc76e9ff1f64869e1146ad7317d8cbe33bbd27e (v1.5.1).+ *  Git branch HEAD.  *  *  See Duktape AUTHORS.rst and LICENSE.txt for copyright and  *  licensing information.@@ -72,6 +73,8 @@  *  * Karl Skomski <karl@skomski.com>  *  * Bruce Pascoe <fatcerberus1@gmail.com>  *  * Ren\u00e9 Hollander <rene@rene8888.at>+ *  * Julien Hamaide (https://github.com/crazyjul)+ *  * Sebastian G\u00f6tte (https://github.com/jaseg)  *    *  Other contributions  *  ===================@@ -109,6 +112,7 @@  *  * Michael Drake (https://github.com/tlsa)  *  * https://github.com/chris-y  *  * Laurent Zubiaur (https://github.com/lzubiaur)+ *  * Ole Andr\u00e9 Vadla Ravn\u00e5s (https://github.com/oleavr)  *    *  If you are accidentally missing from this list, send me an e-mail  *  (``sami.vaarala@iki.fi``) and I'll fix the omission.@@ -183,6 +187,7 @@ typedef duk_size_t (*duk_debug_peek_function) (void *udata); typedef void (*duk_debug_read_flush_function) (void *udata); typedef void (*duk_debug_write_flush_function) (void *udata);+typedef duk_idx_t (*duk_debug_request_function) (duk_context *ctx, void *udata, duk_idx_t nvalues); typedef void (*duk_debug_detached_function) (void *udata);  struct duk_memory_functions {@@ -213,16 +218,16 @@  * have 99 for patch level (e.g. 0.10.99 would be a development version  * after 0.10.0 but before the next official release).  */-#define DUK_VERSION                       10400L+#define DUK_VERSION                       10501L  /* Git commit, describe, and branch for Duktape build.  Useful for  * non-official snapshot builds so that application code can easily log  * which Duktape snapshot was used.  Not available in the Ecmascript  * environment.  */-#define DUK_GIT_COMMIT                    "cad6f595382a0cc1a7e4207794ade5be11b3e397"-#define DUK_GIT_DESCRIBE                  "v1.4.0"-#define DUK_GIT_BRANCH                    "master"+#define DUK_GIT_COMMIT                    "2cc76e9ff1f64869e1146ad7317d8cbe33bbd27e"+#define DUK_GIT_DESCRIBE                  "v1.5.1"+#define DUK_GIT_BRANCH                    "HEAD"  /* Duktape debug protocol version used by this build. */ #define DUK_DEBUG_PROTOCOL_VERSION        1@@ -286,13 +291,18 @@ #define DUK_ENUM_NO_PROXY_BEHAVIOR        (1 << 5)    /* enumerate a proxy object itself without invoking proxy behavior */  /* Compilation flags for duk_compile() and duk_eval() */-#define DUK_COMPILE_EVAL                  (1 << 0)    /* compile eval code (instead of global code) */-#define DUK_COMPILE_FUNCTION              (1 << 1)    /* compile function code (instead of global code) */-#define DUK_COMPILE_STRICT                (1 << 2)    /* use strict (outer) context for global, eval, or function code */-#define DUK_COMPILE_SAFE                  (1 << 3)    /* (internal) catch compilation errors */-#define DUK_COMPILE_NORESULT              (1 << 4)    /* (internal) omit eval result */-#define DUK_COMPILE_NOSOURCE              (1 << 5)    /* (internal) no source string on stack */-#define DUK_COMPILE_STRLEN                (1 << 6)    /* (internal) take strlen() of src_buffer (avoids double evaluation in macro) */+/* DUK_COMPILE_xxx bits 0-2 are reserved for an internal 'nargs' argument+ * (the nargs value passed is direct stack arguments + 1 to account for an+ * internal extra argument).+ */+#define DUK_COMPILE_EVAL                  (1 << 3)    /* compile eval code (instead of global code) */+#define DUK_COMPILE_FUNCTION              (1 << 4)    /* compile function code (instead of global code) */+#define DUK_COMPILE_STRICT                (1 << 5)    /* use strict (outer) context for global, eval, or function code */+#define DUK_COMPILE_SAFE                  (1 << 6)    /* (internal) catch compilation errors */+#define DUK_COMPILE_NORESULT              (1 << 7)    /* (internal) omit eval result */+#define DUK_COMPILE_NOSOURCE              (1 << 8)    /* (internal) no source string on stack */+#define DUK_COMPILE_STRLEN                (1 << 9)    /* (internal) take strlen() of src_buffer (avoids double evaluation in macro) */+#define DUK_COMPILE_NOFILENAME            (1 << 10)    /* (internal) no filename on stack */  /* Flags for duk_def_prop() and its variants */ #define DUK_DEFPROP_WRITABLE              (1 << 0)    /* set writable (effective if DUK_DEFPROP_HAVE_WRITABLE set) */@@ -318,15 +328,15 @@ /* Flags for duk_push_string_file_raw() */ #define DUK_STRING_PUSH_SAFE              (1 << 0)    /* no error if file does not exist */ -/* Duktape specific error codes */+/* Duktape specific error codes (must be 8 bits at most, see duk_error.h) */ #define DUK_ERR_NONE                      0    /* no error (e.g. from duk_get_error_code()) */-#define DUK_ERR_UNIMPLEMENTED_ERROR       50   /* UnimplementedError */-#define DUK_ERR_UNSUPPORTED_ERROR         51   /* UnsupportedError */-#define DUK_ERR_INTERNAL_ERROR            52   /* InternalError */-#define DUK_ERR_ALLOC_ERROR               53   /* AllocError */-#define DUK_ERR_ASSERTION_ERROR           54   /* AssertionError */-#define DUK_ERR_API_ERROR                 55   /* APIError */-#define DUK_ERR_UNCAUGHT_ERROR            56   /* UncaughtError */+#define DUK_ERR_UNIMPLEMENTED_ERROR       50   /* UnimplementedError */  /* XXX: replace with TypeError? */+#define DUK_ERR_UNSUPPORTED_ERROR         51   /* UnsupportedError */    /* XXX: replace with TypeError? */+#define DUK_ERR_INTERNAL_ERROR            52   /* InternalError */       /* XXX: replace with plain Error? */+#define DUK_ERR_ALLOC_ERROR               53   /* AllocError */          /* XXX: replace with RangeError? */+#define DUK_ERR_ASSERTION_ERROR           54   /* AssertionError */      /* XXX: to be removed? */+#define DUK_ERR_API_ERROR                 55   /* APIError */            /* XXX: replace with TypeError? */+#define DUK_ERR_UNCAUGHT_ERROR            56   /* UncaughtError */       /* XXX: to be removed? */  /* Ecmascript E5 specification error codes */ #define DUK_ERR_ERROR                     100  /* Error */@@ -353,7 +363,7 @@ #define DUK_RET_TYPE_ERROR                (-DUK_ERR_TYPE_ERROR) #define DUK_RET_URI_ERROR                 (-DUK_ERR_URI_ERROR) -/* Return codes for protected calls (duk_safe_call(), duk_pcall()). */+/* Return codes for protected calls (duk_safe_call(), duk_pcall()) */ #define DUK_EXEC_SUCCESS                  0 #define DUK_EXEC_ERROR                    1 @@ -416,7 +426,7 @@  #ifdef DUK_API_VARIADIC_MACROS #define duk_error(ctx,err_code,...)  \-	duk_error_raw((ctx), (duk_errcode_t) (err_code), (const char *) (__FILE__), (duk_int_t) (__LINE__), __VA_ARGS__)+	duk_error_raw((ctx), (duk_errcode_t) (err_code), (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__) #else DUK_API_NORETURN(DUK_EXTERNAL_DECL void duk_error_stash(duk_context *ctx, duk_errcode_t err_code, const char *fmt, ...)); /* One problem with this macro is that expressions like the following fail@@ -424,14 +434,14 @@  * they make little sense anyway.  */ #define duk_error  \-	(duk_api_global_filename = (const char *) (__FILE__), \-	 duk_api_global_line = (duk_int_t) (__LINE__), \+	(duk_api_global_filename = (const char *) (DUK_FILE_MACRO), \+	 duk_api_global_line = (duk_int_t) (DUK_LINE_MACRO), \ 	 duk_error_stash)  /* last value is func pointer, arguments follow in parens */ #endif  DUK_API_NORETURN(DUK_EXTERNAL_DECL void duk_error_va_raw(duk_context *ctx, duk_errcode_t err_code, const char *filename, duk_int_t line, const char *fmt, va_list ap)); #define duk_error_va(ctx,err_code,fmt,ap)  \-	duk_error_va_raw((ctx), (duk_errcode_t) (err_code), (const char *) (__FILE__), (duk_int_t) (__LINE__), (fmt), (ap))+	duk_error_va_raw((ctx), (duk_errcode_t) (err_code), (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), (fmt), (ap))  /*  *  Other state related functions@@ -537,19 +547,19 @@  #ifdef DUK_API_VARIADIC_MACROS #define duk_push_error_object(ctx,err_code,...)  \-	duk_push_error_object_raw((ctx), (err_code), (const char *) (__FILE__), (duk_int_t) (__LINE__), __VA_ARGS__)+	duk_push_error_object_raw((ctx), (err_code), (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__) #else DUK_EXTERNAL_DECL duk_idx_t duk_push_error_object_stash(duk_context *ctx, duk_errcode_t err_code, const char *fmt, ...); /* Note: parentheses are required so that the comma expression works in assignments. */ #define duk_push_error_object  \-	(duk_api_global_filename = (const char *) (__FILE__), \-	 duk_api_global_line = (duk_int_t) (__LINE__), \+	(duk_api_global_filename = (const char *) (DUK_FILE_MACRO), \+	 duk_api_global_line = (duk_int_t) (DUK_LINE_MACRO), \ 	 duk_push_error_object_stash)  /* last value is func pointer, arguments follow in parens */ #endif  DUK_EXTERNAL_DECL duk_idx_t duk_push_error_object_va_raw(duk_context *ctx, duk_errcode_t err_code, const char *filename, duk_int_t line, const char *fmt, va_list ap); #define duk_push_error_object_va(ctx,err_code,fmt,ap)  \-	duk_push_error_object_va_raw((ctx), (err_code), (const char *) (__FILE__), (duk_int_t) (__LINE__), (fmt), (ap))+	duk_push_error_object_va_raw((ctx), (err_code), (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), (fmt), (ap))  #define DUK_BUF_FLAG_DYNAMIC   (1 << 0)    /* internal flag: dynamic buffer */ #define DUK_BUF_FLAG_EXTERNAL  (1 << 1)    /* internal flag: external buffer */@@ -914,119 +924,103 @@  /* plain */ #define duk_eval(ctx)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 (void) duk_eval_raw((ctx), NULL, 0, DUK_COMPILE_EVAL))+	((void) duk_eval_raw((ctx), NULL, 0, 2 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOFILENAME))  #define duk_eval_noresult(ctx)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 (void) duk_eval_raw((ctx), NULL, 0, DUK_COMPILE_EVAL | DUK_COMPILE_NORESULT))+	((void) duk_eval_raw((ctx), NULL, 0, 2 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))  #define duk_peval(ctx)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 duk_eval_raw((ctx), NULL, 0, DUK_COMPILE_EVAL | DUK_COMPILE_SAFE))+	(duk_eval_raw((ctx), NULL, 0, 2 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOFILENAME))  #define duk_peval_noresult(ctx)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 duk_eval_raw((ctx), NULL, 0, DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NORESULT))+	(duk_eval_raw((ctx), NULL, 0, 2 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))  #define duk_compile(ctx,flags)  \-	((void) duk_compile_raw((ctx), NULL, 0, (flags)))+	((void) duk_compile_raw((ctx), NULL, 0, 3 /*args*/ | (flags)))  #define duk_pcompile(ctx,flags)  \-	(duk_compile_raw((ctx), NULL, 0, (flags) | DUK_COMPILE_SAFE))+	(duk_compile_raw((ctx), NULL, 0, 3 /*args*/ | (flags) | DUK_COMPILE_SAFE))  /* string */ #define duk_eval_string(ctx,src)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 (void) duk_eval_raw((ctx), (src), 0, DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN))+	((void) duk_eval_raw((ctx), (src), 0, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NOFILENAME))  #define duk_eval_string_noresult(ctx,src)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 (void) duk_eval_raw((ctx), (src), 0, DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NORESULT))+	((void) duk_eval_raw((ctx), (src), 0, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))  #define duk_peval_string(ctx,src)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 duk_eval_raw((ctx), (src), 0, DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN))+	(duk_eval_raw((ctx), (src), 0, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NOFILENAME))  #define duk_peval_string_noresult(ctx,src)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 duk_eval_raw((ctx), (src), 0, DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NORESULT))+	(duk_eval_raw((ctx), (src), 0, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))  #define duk_compile_string(ctx,flags,src)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 (void) duk_compile_raw((ctx), (src), 0, (flags) | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN))+	((void) duk_compile_raw((ctx), (src), 0, 1 /*args*/ | (flags) | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NOFILENAME))  #define duk_compile_string_filename(ctx,flags,src)  \-	((void) duk_compile_raw((ctx), (src), 0, (flags) | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN))+	((void) duk_compile_raw((ctx), (src), 0, 2 /*args*/ | (flags) | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN))  #define duk_pcompile_string(ctx,flags,src)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 duk_compile_raw((ctx), (src), 0, (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN))+	(duk_compile_raw((ctx), (src), 0, 1 /*args*/ | (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NOFILENAME))  #define duk_pcompile_string_filename(ctx,flags,src)  \-	(duk_compile_raw((ctx), (src), 0, (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN))+	(duk_compile_raw((ctx), (src), 0, 2 /*args*/ | (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN))  /* lstring */ #define duk_eval_lstring(ctx,buf,len)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 (void) duk_eval_raw((ctx), buf, len, DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE))+	((void) duk_eval_raw((ctx), buf, len, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NOFILENAME))  #define duk_eval_lstring_noresult(ctx,buf,len)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 (void) duk_eval_raw((ctx), buf, len, DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NORESULT))+	((void) duk_eval_raw((ctx), buf, len, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))  #define duk_peval_lstring(ctx,buf,len)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 duk_eval_raw((ctx), buf, len, DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_SAFE))+	(duk_eval_raw((ctx), buf, len, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_SAFE | DUK_COMPILE_NOFILENAME))  #define duk_peval_lstring_noresult(ctx,buf,len)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 duk_eval_raw((ctx), buf, len, DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NORESULT))+	(duk_eval_raw((ctx), buf, len, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))  #define duk_compile_lstring(ctx,flags,buf,len)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 (void) duk_compile_raw((ctx), buf, len, (flags) | DUK_COMPILE_NOSOURCE))+	((void) duk_compile_raw((ctx), buf, len, 1 /*args*/ | (flags) | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NOFILENAME))  #define duk_compile_lstring_filename(ctx,flags,buf,len)  \-	((void) duk_compile_raw((ctx), buf, len, (flags) | DUK_COMPILE_NOSOURCE))+	((void) duk_compile_raw((ctx), buf, len, 2 /*args*/ | (flags) | DUK_COMPILE_NOSOURCE))  #define duk_pcompile_lstring(ctx,flags,buf,len)  \-	((void) duk_push_string((ctx), (const char *) (__FILE__)), \-	 duk_compile_raw((ctx), buf, len, (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE))+	(duk_compile_raw((ctx), buf, len, 1 /*args*/ | (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NOFILENAME))  #define duk_pcompile_lstring_filename(ctx,flags,buf,len)  \-	(duk_compile_raw((ctx), buf, len, (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE))+	(duk_compile_raw((ctx), buf, len, 2 /*args*/ | (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE))  /* file */ #define duk_eval_file(ctx,path)  \ 	((void) duk_push_string_file_raw((ctx), (path), 0), \ 	 (void) duk_push_string((ctx), (path)), \-	 (void) duk_eval_raw((ctx), NULL, 0, DUK_COMPILE_EVAL))+	 (void) duk_eval_raw((ctx), NULL, 0, 3 /*args*/ | DUK_COMPILE_EVAL))  #define duk_eval_file_noresult(ctx,path)  \ 	((void) duk_push_string_file_raw((ctx), (path), 0), \ 	 (void) duk_push_string((ctx), (path)), \-	 (void) duk_eval_raw((ctx), NULL, 0, DUK_COMPILE_EVAL | DUK_COMPILE_NORESULT))+	 (void) duk_eval_raw((ctx), NULL, 0, 3 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NORESULT))  #define duk_peval_file(ctx,path)  \ 	((void) duk_push_string_file_raw((ctx), (path), DUK_STRING_PUSH_SAFE), \ 	 (void) duk_push_string((ctx), (path)), \-	 duk_eval_raw((ctx), NULL, 0, DUK_COMPILE_EVAL | DUK_COMPILE_SAFE))+	 duk_eval_raw((ctx), NULL, 0, 3 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE))  #define duk_peval_file_noresult(ctx,path)  \ 	((void) duk_push_string_file_raw((ctx), (path), DUK_STRING_PUSH_SAFE), \ 	 (void) duk_push_string((ctx), (path)), \-	 duk_eval_raw((ctx), NULL, 0, DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NORESULT))+	 duk_eval_raw((ctx), NULL, 0, 3 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NORESULT))  #define duk_compile_file(ctx,flags,path)  \ 	((void) duk_push_string_file_raw((ctx), (path), 0), \ 	 (void) duk_push_string((ctx), (path)), \-	 (void) duk_compile_raw((ctx), NULL, 0, (flags)))+	 (void) duk_compile_raw((ctx), NULL, 0, 3 /*args*/ | (flags)))  #define duk_pcompile_file(ctx,flags,path)  \ 	((void) duk_push_string_file_raw((ctx), (path), DUK_STRING_PUSH_SAFE), \ 	 (void) duk_push_string((ctx), (path)), \-	 duk_compile_raw((ctx), NULL, 0, (flags) | DUK_COMPILE_SAFE))+	 duk_compile_raw((ctx), NULL, 0, 3 /*args*/ | (flags) | DUK_COMPILE_SAFE))  /*  *  Bytecode load/dump@@ -1069,16 +1063,23 @@  *  Debugger (debug protocol)  */ -DUK_EXTERNAL_DECL void duk_debugger_attach(duk_context *ctx,-                                           duk_debug_read_function read_cb,-                                           duk_debug_write_function write_cb,-                                           duk_debug_peek_function peek_cb,-                                           duk_debug_read_flush_function read_flush_cb,-                                           duk_debug_write_flush_function write_flush_cb,-                                           duk_debug_detached_function detached_cb,-                                           void *udata);+#define duk_debugger_attach(ctx,read_cb,write_cb,peek_cb,read_flush_cb,write_flush_cb,detached_cb,udata) \+	duk_debugger_attach_custom((ctx), (read_cb), (write_cb), (peek_cb), (read_flush_cb), (write_flush_cb), \+	                           NULL, (detached_cb), (udata))++DUK_EXTERNAL_DECL void duk_debugger_attach_custom(duk_context *ctx,+                                                  duk_debug_read_function read_cb,+                                                  duk_debug_write_function write_cb,+                                                  duk_debug_peek_function peek_cb,+                                                  duk_debug_read_flush_function read_flush_cb,+                                                  duk_debug_write_flush_function write_flush_cb,+                                                  duk_debug_request_function request_cb,+                                                  duk_debug_detached_function detached_cb,+                                                  void *udata); DUK_EXTERNAL_DECL void duk_debugger_detach(duk_context *ctx); DUK_EXTERNAL_DECL void duk_debugger_cooperate(duk_context *ctx);+DUK_EXTERNAL_DECL duk_bool_t duk_debugger_notify(duk_context *ctx, duk_idx_t nvalues);+DUK_EXTERNAL_DECL void duk_debugger_pause(duk_context *ctx);  /*  *  Date provider related constants@@ -1157,6 +1158,17 @@ #define DUK_DATE_FLAG_YEAR_FIXUP           (1 << 10) /* setter: perform 2-digit year fixup (00...99 -> 1900...1999) */ #define DUK_DATE_FLAG_SEP_T                (1 << 11) /* string conversion: use 'T' instead of ' ' as a separator */ #define DUK_DATE_FLAG_VALUE_SHIFT          12        /* additional values begin at bit 12 */++/*+ *  ROM pointer compression+ */++/* Support array for ROM pointer compression.  Only declared when ROM+ * pointer compression is active.+ */+#if defined(DUK_USE_ROM_OBJECTS) && defined(DUK_USE_HEAPPTR16)+DUK_EXTERNAL_DECL const void * const duk_rom_compressed_pointers[];+#endif  /*  *  C++ name mangling
hs-duktape.cabal view
@@ -1,5 +1,5 @@ name:            hs-duktape-version:         0.1.2+version:         0.1.3 synopsis:        Haskell bindings for a very compact embedded ECMAScript (JavaScript) engine. category:        Web homepage:        https://github.com/myfreeweb/hs-duktape@@ -15,7 +15,7 @@     duktape/src/duktape.c     duktape/src/duktape.h tested-with:-    GHC == 7.10.2+    GHC == 8.0.1  source-repository head     type: git
library/Scripting/Duktape.hs view
@@ -24,6 +24,7 @@ import           Control.Concurrent.MVar (withMVar) import           Control.Monad (void, forM_, liftM) import           Data.Text.Encoding (decodeUtf8, encodeUtf8)+import qualified Data.Text.Foreign as TF import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BL import qualified Data.Vector as V@@ -89,7 +90,7 @@ pushValue ctxPtr (Bool True) = c_duk_push_boolean ctxPtr 1 pushValue ctxPtr (Bool False) = c_duk_push_boolean ctxPtr 0 pushValue ctxPtr (Number n) = c_duk_push_number ctxPtr $ realToFrac n-pushValue ctxPtr (String s) = void $ BS.useAsCStringLen (encodeUtf8 s) $ \(sCstr, sLen) →+pushValue ctxPtr (String s) = void $ TF.withCStringLen s $ \(sCstr, sLen) →                                 c_duk_push_lstring ctxPtr sCstr $ fromIntegral sLen pushValue ctxPtr (Array v) = do   idx ← c_duk_push_array ctxPtr
test-suite/Scripting/DuktapeSpec.hs view
@@ -17,7 +17,7 @@       r0 ← evalDuktape (fromJust ctx) ""       r0 `shouldBe` Right Nothing       rE ← evalDuktape (fromJust ctx) "print('hello"-      rE `shouldBe` Left "SyntaxError: eof or line terminator while parsing string literal (line 1)"+      rE `shouldBe` Left "SyntaxError: eof or line terminator in string literal (line 1)"       rT ← evalDuktape (fromJust ctx) "1 == 1"       rT `shouldBe` (Right $ Just $ Bool True)       rF ← evalDuktape (fromJust ctx) "1 == 2"