1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2  * vim: set ts=8 sts=2 et sw=2 tw=80:
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #include "vm/WellKnownAtom.h"
8 
9 #define DECLARE_CONST_CHAR_STR(IDPART, _, TEXT) char js_##IDPART##_str[] = TEXT;
10 FOR_EACH_COMMON_PROPERTYNAME(DECLARE_CONST_CHAR_STR)
11 #undef DECLARE_CONST_CHAR_STR
12 
13 #define DECLARE_CONST_CHAR_STR(NAME, _) char js_##NAME##_str[] = #NAME;
14 JS_FOR_EACH_PROTOTYPE(DECLARE_CONST_CHAR_STR)
15 #undef DECLARE_CONST_CHAR_STR
16 
17 #define DECLARE_CONST_CHAR_STR(NAME) char js_##NAME##_str[] = #NAME;
18 JS_FOR_EACH_WELL_KNOWN_SYMBOL(DECLARE_CONST_CHAR_STR)
19 #undef DECLARE_CONST_CHAR_STR
20 
21 js::WellKnownAtomInfo js::wellKnownAtomInfos[] = {
22 #define ENUM_ENTRY_(IDPART, _, _2)                                \
23   {uint32_t(sizeof(js_##IDPART##_str) - 1),                       \
24    mozilla::HashStringKnownLength(js_##IDPART##_str,              \
25                                   sizeof(js_##IDPART##_str) - 1), \
26    js_##IDPART##_str},
27     FOR_EACH_COMMON_PROPERTYNAME(ENUM_ENTRY_)
28 #undef ENUM_ENTRY_
29 
30 #define ENUM_ENTRY_(NAME, _)                                    \
31   {uint32_t(sizeof(js_##NAME##_str) - 1),                       \
32    mozilla::HashStringKnownLength(js_##NAME##_str,              \
33                                   sizeof(js_##NAME##_str) - 1), \
34    js_##NAME##_str},
35         JS_FOR_EACH_PROTOTYPE(ENUM_ENTRY_)
36 #undef ENUM_ENTRY_
37 
38 #define ENUM_ENTRY_(NAME)                                       \
39   {uint32_t(sizeof(js_##NAME##_str) - 1),                       \
40    mozilla::HashStringKnownLength(js_##NAME##_str,              \
41                                   sizeof(js_##NAME##_str) - 1), \
42    js_##NAME##_str},
43             JS_FOR_EACH_WELL_KNOWN_SYMBOL(ENUM_ENTRY_)
44 #undef ENUM_ENTRY_
45 };
46