@@ -92,6 +92,49 @@ typedef uint32_t jerry_length_t;
92
92
*/
93
93
typedef uint32_t jerry_value_t ;
94
94
95
+
96
+ /**
97
+ * Description of ECMA property descriptor
98
+ */
99
+ typedef struct
100
+ {
101
+ /** Is [[Value]] defined? */
102
+ bool is_value_defined ;
103
+
104
+ /** Is [[Get]] defined? */
105
+ bool is_get_defined ;
106
+
107
+ /** Is [[Set]] defined? */
108
+ bool is_set_defined ;
109
+
110
+ /** Is [[Writable]] defined? */
111
+ bool is_writable_defined ;
112
+
113
+ /** [[Writable]] */
114
+ bool is_writable ;
115
+
116
+ /** Is [[Enumerable]] defined? */
117
+ bool is_enumerable_defined ;
118
+
119
+ /** [[Enumerable]] */
120
+ bool is_enumerable ;
121
+
122
+ /** Is [[Configurable]] defined? */
123
+ bool is_configurable_defined ;
124
+
125
+ /** [[Configurable]] */
126
+ bool is_configurable ;
127
+
128
+ /** [[Value]] */
129
+ jerry_value_t value ;
130
+
131
+ /** [[Get]] */
132
+ jerry_value_t getter ;
133
+
134
+ /** [[Set]] */
135
+ jerry_value_t setter ;
136
+ } jerry_property_descriptor_t ;
137
+
95
138
/**
96
139
* Type of an external function handler
97
140
*/
@@ -108,9 +151,9 @@ typedef void (*jerry_object_free_callback_t) (const uintptr_t native_p);
108
151
/**
109
152
* Function type applied for each data property of an object
110
153
*/
111
- typedef bool (* jerry_object_field_foreach_t ) (const jerry_value_t property_name_p ,
112
- const jerry_value_t property_value ,
113
- void * user_data_p );
154
+ typedef bool (* jerry_object_property_foreach_t ) (const jerry_value_t property_name_p ,
155
+ const jerry_value_t property_value ,
156
+ void * user_data_p );
114
157
115
158
116
159
/**
@@ -134,7 +177,7 @@ void jerry_gc (void);
134
177
* Parser and executor functions
135
178
*/
136
179
bool jerry_run_simple (const jerry_char_t * , size_t , jerry_init_flag_t );
137
- jerry_value_t jerry_parse (const jerry_char_t * , size_t ); // true value if success
180
+ jerry_value_t jerry_parse (const jerry_char_t * , size_t );
138
181
jerry_value_t jerry_run (void );
139
182
jerry_value_t jerry_eval (const jerry_char_t * , size_t , bool );
140
183
@@ -149,28 +192,45 @@ jerry_value_t jerry_get_global (void);
149
192
bool jerry_value_is_array (const jerry_value_t );
150
193
bool jerry_value_is_boolean (const jerry_value_t );
151
194
bool jerry_value_is_constructor (const jerry_value_t );
152
- bool jerry_value_is_error (const jerry_value_t );
153
195
bool jerry_value_is_function (const jerry_value_t );
154
196
bool jerry_value_is_number (const jerry_value_t );
155
197
bool jerry_value_is_null (const jerry_value_t );
156
198
bool jerry_value_is_object (const jerry_value_t );
157
199
bool jerry_value_is_string (const jerry_value_t );
158
200
bool jerry_value_is_undefined (const jerry_value_t );
159
201
202
+ /**
203
+ * Error flag manipulation functions
204
+ */
205
+ bool jerry_value_has_error_flag (const jerry_value_t );
206
+ void jerry_value_clear_error_flag (jerry_value_t * );
207
+ void jerry_value_set_error_flag (jerry_value_t * );
208
+
160
209
/**
161
210
* Getter functions of 'jerry_value_t'
162
211
*/
163
212
bool jerry_get_boolean_value (const jerry_value_t );
164
213
double jerry_get_number_value (const jerry_value_t );
165
214
215
+ /**
216
+ * Functions of string values
217
+ */
218
+ jerry_size_t jerry_get_string_size (const jerry_value_t );
219
+ jerry_length_t jerry_get_string_length (const jerry_value_t );
220
+ jerry_size_t jerry_string_to_char_buffer (const jerry_value_t , jerry_char_t * , jerry_size_t );
221
+
222
+ /**
223
+ * Functions of array object values
224
+ */
225
+ uint32_t jerry_get_array_length (const jerry_value_t );
226
+
166
227
/**
167
228
* Converters of 'jerry_value_t'
168
229
*/
169
230
bool jerry_value_to_boolean (const jerry_value_t );
170
231
jerry_value_t jerry_value_to_number (const jerry_value_t );
171
232
jerry_value_t jerry_value_to_object (const jerry_value_t );
172
233
jerry_value_t jerry_value_to_string (const jerry_value_t );
173
- jerry_value_t jerry_value_remove_error_flag (const jerry_value_t );
174
234
175
235
/**
176
236
* Acquire types with reference counter (increase the references)
@@ -197,53 +257,38 @@ jerry_value_t jerry_create_string (const jerry_char_t *);
197
257
jerry_value_t jerry_create_string_sz (const jerry_char_t * , jerry_size_t );
198
258
jerry_value_t jerry_create_undefined (void );
199
259
200
- /**
201
- * Functions of array objects
202
- */
203
- jerry_value_t jerry_set_array_index_value (const jerry_value_t , uint32_t , const jerry_value_t );
204
- jerry_value_t jerry_get_array_index_value (const jerry_value_t , uint32_t );
205
- uint32_t jerry_get_array_length (const jerry_value_t );
206
-
207
- /**
208
- * Functions of 'jerry_string_t'
209
- */
210
- jerry_size_t jerry_get_string_size (const jerry_value_t );
211
- jerry_length_t jerry_get_string_length (const jerry_value_t );
212
- jerry_size_t jerry_string_to_char_buffer (const jerry_value_t , jerry_char_t * , jerry_size_t );
213
-
214
260
/**
215
261
* General API functions of JS objects
216
262
*/
217
263
bool jerry_has_property (const jerry_value_t , const jerry_value_t );
218
264
bool jerry_has_own_property (const jerry_value_t , const jerry_value_t );
219
265
bool jerry_delete_property (const jerry_value_t , const jerry_value_t );
220
266
221
- jerry_value_t jerry_set_data_property (const jerry_value_t , const jerry_value_t , const jerry_value_t );
222
- jerry_value_t jerry_set_own_data_property (const jerry_value_t , const jerry_value_t , const jerry_value_t );
223
- jerry_value_t jerry_get_data_property (const jerry_value_t , const jerry_value_t );
224
- jerry_value_t jerry_get_own_data_property (const jerry_value_t , const jerry_value_t );
225
-
226
- jerry_value_t jerry_define_own_data_property (const jerry_value_t ,
227
- const jerry_value_t ,
228
- bool ,
229
- bool ,
230
- bool ,
231
- const jerry_value_t );
232
- jerry_value_t jerry_define_own_accessor_property (const jerry_value_t ,
233
- const jerry_value_t ,
234
- bool ,
235
- bool ,
236
- const jerry_value_t ,
237
- const jerry_value_t );
238
-
239
- jerry_value_t jerry_function_call (const jerry_value_t , const jerry_value_t , const jerry_value_t [], jerry_size_t );
240
- jerry_value_t jerry_object_construct (const jerry_value_t , const jerry_value_t [], jerry_size_t );
267
+ jerry_value_t jerry_set_property (const jerry_value_t , const jerry_value_t , const jerry_value_t );
268
+ jerry_value_t jerry_set_own_property (const jerry_value_t , const jerry_value_t , const jerry_value_t );
269
+ jerry_value_t jerry_set_property_by_index (const jerry_value_t , uint32_t , const jerry_value_t );
270
+ jerry_value_t jerry_get_property (const jerry_value_t , const jerry_value_t );
271
+ jerry_value_t jerry_get_own_property (const jerry_value_t , const jerry_value_t );
272
+ jerry_value_t jerry_get_property_by_index (const jerry_value_t , uint32_t );
273
+
274
+ void jerry_init_property_descriptor (jerry_property_descriptor_t * );
275
+ jerry_value_t jerry_define_own_property (const jerry_value_t ,
276
+ const jerry_value_t ,
277
+ const jerry_property_descriptor_t * );
278
+
279
+ bool jerry_get_own_property_descriptor (const jerry_value_t ,
280
+ const jerry_value_t ,
281
+ jerry_property_descriptor_t * );
282
+ void jerry_free_property_descriptor_fields (const jerry_property_descriptor_t * );
283
+
284
+ jerry_value_t jerry_call_function (const jerry_value_t , const jerry_value_t , const jerry_value_t [], jerry_size_t );
285
+ jerry_value_t jerry_construct_object (const jerry_value_t , const jerry_value_t [], jerry_size_t );
241
286
242
287
jerry_value_t jerry_get_object_keys (const jerry_value_t );
243
288
244
289
bool jerry_get_object_native_handle (const jerry_value_t , uintptr_t * );
245
290
void jerry_set_object_native_handle (const jerry_value_t , uintptr_t , jerry_object_free_callback_t );
246
- bool jerry_foreach_object_field (const jerry_value_t , jerry_object_field_foreach_t , void * );
291
+ bool jerry_foreach_object_property (const jerry_value_t , jerry_object_property_foreach_t , void * );
247
292
248
293
/**
249
294
* Snapshot functions
0 commit comments