Merge instance into context (#2501)

There was quite some confusion about terminology around instances
and contexts. All the docs mentioned external contexts but
functions and types were referring to instances, and the relation
between these two concepts were not clear. This commit keeps
(external) context as the only surviving concept.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2018-09-04 13:56:49 +02:00
committed by GitHub
parent d3d42f7685
commit 30b7a72344
9 changed files with 145 additions and 140 deletions
+5 -5
View File
@@ -281,9 +281,9 @@ typedef struct
} jerry_context_data_manager_t;
/**
* Function type for allocating buffer for JerryScript instance.
* Function type for allocating buffer for JerryScript context.
*/
typedef void *(*jerry_instance_alloc_t) (size_t size, void *cb_data_p);
typedef void *(*jerry_context_alloc_t) (size_t size, void *cb_data_p);
/**
* Type information of a native pointer.
@@ -294,9 +294,9 @@ typedef struct
} jerry_object_native_info_t;
/**
* An opaque declaration of the JerryScript instance structure.
* An opaque declaration of the JerryScript context structure.
*/
typedef struct jerry_instance_t jerry_instance_t;
typedef struct jerry_context_t jerry_context_t;
/**
* General engine functions.
@@ -517,7 +517,7 @@ bool jerry_is_valid_cesu8_string (const jerry_char_t *cesu8_buf_p, jerry_size_t
/*
* External context functions.
*/
jerry_instance_t *jerry_create_instance (uint32_t heap_size, jerry_instance_alloc_t alloc, void *cb_data_p);
jerry_context_t *jerry_create_context (uint32_t heap_size, jerry_context_alloc_t alloc, void *cb_data_p);
/**
* Miscellaneous functions.
+4 -4
View File
@@ -147,17 +147,17 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p);
double jerry_port_get_current_time (void);
/**
* Get the current instance which contains the current context, heap and other
* structures. Each port should provide its own implementation of this interface.
* Get the current context of the engine. Each port should provide its own
* implementation of this interface.
*
* Note:
* This port function is called by jerry-core when
* JERRY_ENABLE_EXTERNAL_CONTEXT is defined. Otherwise this function is not
* used.
*
* @return the pointer to the jerry instance.
* @return the pointer to the engine context.
*/
struct jerry_instance_t *jerry_port_get_current_instance (void);
struct jerry_context_t *jerry_port_get_current_context (void);
/**
* Makes the process sleep for a given time.