Skip to content

Commit a721bda

Browse files
committed
Drop CONFIG_ALL_UNICODE and enable it by default
1 parent bef2a12 commit a721bda

File tree

8 files changed

+1
-47
lines changed

8 files changed

+1
-47
lines changed

libregexp.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,6 @@ int lre_parse_escape(const uint8_t **pp, int allow_utf16)
600600
return c;
601601
}
602602

603-
#ifdef CONFIG_ALL_UNICODE
604603
/* XXX: we use the same chars for name and value */
605604
static BOOL is_unicode_char(int c)
606605
{
@@ -703,7 +702,6 @@ static int parse_unicode_property(REParseState *s, CharRange *cr,
703702
out_of_memory:
704703
return re_parse_out_of_memory(s);
705704
}
706-
#endif /* CONFIG_ALL_UNICODE */
707705

708706
/* return -1 if error otherwise the character or a class range
709707
(CLASS_RANGE_BASE). In case of class range, 'cr' is
@@ -763,7 +761,6 @@ static int get_class_atom(REParseState *s, CharRange *cr,
763761
c = '\\';
764762
}
765763
break;
766-
#ifdef CONFIG_ALL_UNICODE
767764
case 'p':
768765
case 'P':
769766
if (s->is_utf16) {
@@ -773,7 +770,6 @@ static int get_class_atom(REParseState *s, CharRange *cr,
773770
break;
774771
}
775772
/* fall thru */
776-
#endif
777773
default:
778774
p--;
779775
ret = lre_parse_escape(&p, s->is_utf16 * 2);

libregexp.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ static inline int lre_js_is_ident_first(int c)
6666
if ((uint32_t)c < 128) {
6767
return (lre_id_start_table_ascii[c >> 5] >> (c & 31)) & 1;
6868
} else {
69-
#ifdef CONFIG_ALL_UNICODE
7069
return lre_is_id_start(c);
71-
#else
72-
return !lre_is_space(c);
73-
#endif
7470
}
7571
}
7672

@@ -80,11 +76,7 @@ static inline int lre_js_is_ident_next(int c)
8076
return (lre_id_continue_table_ascii[c >> 5] >> (c & 31)) & 1;
8177
} else {
8278
/* ZWNJ and ZWJ are accepted in identifiers */
83-
#ifdef CONFIG_ALL_UNICODE
8479
return lre_is_id_continue(c) || c == 0x200C || c == 0x200D;
85-
#else
86-
return !lre_is_space(c) || c == 0x200C || c == 0x200D;
87-
#endif
8880
}
8981
}
9082

libunicode-table.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,6 @@ static const uint8_t unicode_prop_ID_Continue1_index[63] = {
557557
0x41, 0xaf, 0xe2, 0x21, 0xf0, 0x01, 0x0e,
558558
};
559559

560-
#ifdef CONFIG_ALL_UNICODE
561-
562560
static const uint8_t unicode_cc_table[899] = {
563561
0xb2, 0xcf, 0xd4, 0x00, 0xe8, 0x03, 0xdc, 0x00,
564562
0xe8, 0x00, 0xd8, 0x04, 0xdc, 0x01, 0xca, 0x03,
@@ -4484,5 +4482,3 @@ static const uint16_t unicode_prop_len_table[] = {
44844482
countof(unicode_prop_ID_Start_table),
44854483
countof(unicode_prop_Case_Ignorable_table),
44864484
};
4487-
4488-
#endif /* CONFIG_ALL_UNICODE */

libunicode.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,6 @@ int cr_invert(CharRange *cr)
426426
return 0;
427427
}
428428

429-
#ifdef CONFIG_ALL_UNICODE
430-
431429
BOOL lre_is_id_start(uint32_t c)
432430
{
433431
return lre_is_in_table(c, unicode_prop_ID_Start_table,
@@ -1504,5 +1502,3 @@ int unicode_prop(CharRange *cr, const char *prop_name)
15041502
}
15051503
return ret;
15061504
}
1507-
1508-
#endif /* CONFIG_ALL_UNICODE */

libunicode.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828

2929
#define LRE_BOOL int /* for documentation purposes */
3030

31-
/* define it to include all the unicode tables (40KB larger) */
32-
#define CONFIG_ALL_UNICODE
33-
3431
#define LRE_CC_RES_LEN_MAX 3
3532

3633
typedef enum {
@@ -101,8 +98,6 @@ int cr_op(CharRange *cr, const uint32_t *a_pt, int a_len,
10198

10299
int cr_invert(CharRange *cr);
103100

104-
#ifdef CONFIG_ALL_UNICODE
105-
106101
LRE_BOOL lre_is_id_start(uint32_t c);
107102
LRE_BOOL lre_is_id_continue(uint32_t c);
108103

@@ -117,8 +112,6 @@ int unicode_script(CharRange *cr,
117112
int unicode_general_category(CharRange *cr, const char *gc_name);
118113
int unicode_prop(CharRange *cr, const char *prop_name);
119114

120-
#endif /* CONFIG_ALL_UNICODE */
121-
122115
#undef LRE_BOOL
123116

124117
#endif /* LIBUNICODE_H */

quickjs.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,6 @@ JSContext *JS_NewContext(JSRuntime *rt)
19781978
JS_AddIntrinsicBaseObjects(ctx);
19791979
JS_AddIntrinsicDate(ctx);
19801980
JS_AddIntrinsicEval(ctx);
1981-
JS_AddIntrinsicStringNormalize(ctx);
19821981
JS_AddIntrinsicRegExp(ctx);
19831982
JS_AddIntrinsicJSON(ctx);
19841983
JS_AddIntrinsicProxy(ctx);
@@ -39197,8 +39196,6 @@ static JSValue js_string_toLowerCase(JSContext *ctx, JSValueConst this_val,
3919739196
return JS_EXCEPTION;
3919839197
}
3919939198

39200-
#ifdef CONFIG_ALL_UNICODE
39201-
3920239199
/* return (-1, NULL) if exception, otherwise (len, buf) */
3920339200
static int JS_ToUTF32String(JSContext *ctx, uint32_t **pbuf, JSValueConst val1)
3920439201
{
@@ -39301,7 +39298,6 @@ static JSValue js_string_normalize(JSContext *ctx, JSValueConst this_val,
3930139298
js_free(ctx, out_buf);
3930239299
return val;
3930339300
}
39304-
#endif /* CONFIG_ALL_UNICODE */
3930539301

3930639302
/* also used for String.prototype.valueOf */
3930739303
static JSValue js_string_toString(JSContext *ctx, JSValueConst this_val,
@@ -39460,6 +39456,7 @@ static const JSCFunctionListEntry js_string_proto_funcs[] = {
3946039456
JS_CFUNC_DEF("valueOf", 0, js_string_toString ),
3946139457
JS_CFUNC_DEF("__quote", 1, js_string___quote ),
3946239458
JS_CFUNC_DEF("localeCompare", 1, js_string_localeCompare ),
39459+
JS_CFUNC_DEF("normalize", 0, js_string_normalize ),
3946339460
JS_CFUNC_MAGIC_DEF("toLowerCase", 0, js_string_toLowerCase, 1 ),
3946439461
JS_CFUNC_MAGIC_DEF("toUpperCase", 0, js_string_toLowerCase, 0 ),
3946539462
JS_CFUNC_MAGIC_DEF("toLocaleLowerCase", 0, js_string_toLowerCase, 1 ),
@@ -39486,19 +39483,6 @@ static const JSCFunctionListEntry js_string_iterator_proto_funcs[] = {
3948639483
JS_PROP_STRING_DEF("[Symbol.toStringTag]", "String Iterator", JS_PROP_CONFIGURABLE ),
3948739484
};
3948839485

39489-
#ifdef CONFIG_ALL_UNICODE
39490-
static const JSCFunctionListEntry js_string_proto_normalize[] = {
39491-
JS_CFUNC_DEF("normalize", 0, js_string_normalize ),
39492-
};
39493-
#endif
39494-
39495-
void JS_AddIntrinsicStringNormalize(JSContext *ctx)
39496-
{
39497-
#ifdef CONFIG_ALL_UNICODE
39498-
JS_SetPropertyFunctionList(ctx, ctx->class_proto[JS_CLASS_STRING], js_string_proto_normalize,
39499-
countof(js_string_proto_normalize));
39500-
#endif
39501-
}
3950239486

3950339487
/* Math */
3950439488

quickjs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ JSContext *JS_NewContextRaw(JSRuntime *rt);
356356
void JS_AddIntrinsicBaseObjects(JSContext *ctx);
357357
void JS_AddIntrinsicDate(JSContext *ctx);
358358
void JS_AddIntrinsicEval(JSContext *ctx);
359-
void JS_AddIntrinsicStringNormalize(JSContext *ctx);
360359
void JS_AddIntrinsicRegExpCompiler(JSContext *ctx);
361360
void JS_AddIntrinsicRegExp(JSContext *ctx);
362361
void JS_AddIntrinsicJSON(JSContext *ctx);

unicode_gen.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2987,14 +2987,12 @@ int main(int argc, char **argv)
29872987
dump_case_conv_table(fo);
29882988
compute_internal_props();
29892989
build_flags_tables(fo);
2990-
fprintf(fo, "#ifdef CONFIG_ALL_UNICODE\n\n");
29912990
build_cc_table(fo);
29922991
build_decompose_table(fo);
29932992
build_general_category_table(fo);
29942993
build_script_table(fo);
29952994
build_script_ext_table(fo);
29962995
build_prop_list_table(fo);
2997-
fprintf(fo, "#endif /* CONFIG_ALL_UNICODE */\n");
29982996
fclose(fo);
29992997
}
30002998
return 0;

0 commit comments

Comments
 (0)