1 /* Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
17 #include "iotjs_def.h"
20 // strings in iotjs built-in scripts
22 #include "iotjs_string_ext.inl.h"
25 // declare string items
27 #define MAGICSTR_EX_DEF(NAME, STRING) \
28 static const char jerry_magic_string_ex_##NAME[] = STRING;
30 JERRY_MAGIC_STRING_ITEMS
32 #undef MAGICSTR_EX_DEF
36 // declare strings length array
38 static const jerry_length_t magic_string_lengths[] = {
39 #define MAGICSTR_EX_DEF(NAME, STRING) \
40 (jerry_length_t)(sizeof(jerry_magic_string_ex_##NAME) - 1u),
42 JERRY_MAGIC_STRING_ITEMS
44 #undef MAGICSTR_EX_DEF
49 // declare strings table
51 static const jerry_char_ptr_t magic_string_items[] = {
52 #define MAGICSTR_EX_DEF(NAME, STRING) \
53 (const jerry_char_ptr_t) jerry_magic_string_ex_##NAME,
55 JERRY_MAGIC_STRING_ITEMS
57 #undef MAGICSTR_EX_DEF
61 void iotjs_register_jerry_magic_string(void) {
62 uint32_t num_magic_string_items =
63 (uint32_t)(sizeof(magic_string_items) / sizeof(jerry_char_ptr_t));
64 jerry_register_magic_strings(magic_string_items, num_magic_string_items,
65 magic_string_lengths);