Browse Source

Expose DUK_INTERNAL_SYMBOL() macro

While an application should never use the DUK_INTERNAL_SYMBOL() macro
to write internal symbols, reading Duktape internal symbols (even with
no versioning guarantees) is sometimes useful.
pull/2118/head
Sami Vaarala 5 years ago
parent
commit
65c15085f5
  1. 2
      src-input/duk_api_internal.h
  2. 6
      src-input/duktape.h.in

2
src-input/duk_api_internal.h

@ -6,8 +6,6 @@
#if !defined(DUK_API_INTERNAL_H_INCLUDED)
#define DUK_API_INTERNAL_H_INCLUDED
#define DUK_INTERNAL_SYMBOL(x) ("\x82" x)
/* duk_push_sprintf constants */
#define DUK_PUSH_SPRINTF_INITIAL_SIZE 256L
#define DUK_PUSH_SPRINTF_SANITY_LIMIT (1L * 1024L * 1024L * 1024L)

6
src-input/duktape.h.in

@ -321,18 +321,24 @@ struct duk_time_components {
* Macros to create Symbols as C statically constructed strings.
*
* Call e.g. as DUK_HIDDEN_SYMBOL("myProperty") <=> ("\xFF" "myProperty").
*
* Local symbols have a unique suffix, caller should take care to avoid
* conflicting with the Duktape internal representation by e.g. prepending
* a '!' character: DUK_LOCAL_SYMBOL("myLocal", "!123").
*
* Note that these can only be used for string constants, not dynamically
* created strings.
*
* You shouldn't normally use DUK_INTERNAL_SYMBOL() at all. It is reserved
* for Duktape internal symbols only. There are no versioning guarantees
* for internal symbols.
*/
#define DUK_HIDDEN_SYMBOL(x) ("\xFF" x)
#define DUK_GLOBAL_SYMBOL(x) ("\x80" x)
#define DUK_LOCAL_SYMBOL(x,uniq) ("\x81" x "\xff" uniq)
#define DUK_WELLKNOWN_SYMBOL(x) ("\x81" x "\xff")
#define DUK_INTERNAL_SYMBOL(x) ("\x82" x)
/*
* If no variadic macros, __FILE__ and __LINE__ are passed through globals

Loading…
Cancel
Save