Update the webpage (#2549)

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
This commit is contained in:
Zsolt Borbély
2018-10-04 11:04:17 +02:00
committed by Akos Kiss
parent cf87970ef6
commit c846c4ab73
6 changed files with 231 additions and 199 deletions
+22 -19
View File
@@ -122,23 +122,25 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p);
double jerry_port_get_current_time (void);
```
## External instance
## External context
Allow user to provide external buffer for jerry instance (which includes an isolated context and heap with other instances), so that user can config the heap size in runtime and run multiple JS apps simultaneously.
Allow user to provide external buffer for isolated engine contexts, so that user
can configure the heap size at runtime and run multiple JS applications
simultaneously.
```c
/**
* 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);
```
## Sleep
@@ -243,37 +245,38 @@ double jerry_port_get_current_time (void)
return ((double) tv.tv_sec) * 1000.0 + ((double) tv.tv_usec) / 1000.0;
} /* jerry_port_get_current_time */
```
## External instance
## External context
```c
#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
/**
* Pointer to the current instance.
* Pointer to the current context.
* Note that it is a global variable, and is not a thread safe implementation.
*/
static jerry_instance_t *current_instance_p = NULL;
static jerry_context_t *current_context_p = NULL;
/**
* Set the current_instance_p as the passed pointer.
* Set the current_context_p as the passed pointer.
*/
void
jerry_port_default_set_instance (jerry_instance_t *instance_p) /**< points to the created instance */
jerry_port_default_set_context (jerry_context_t *context_p) /**< points to the created context */
{
current_instance_p = instance_p;
} /* jerry_port_default_set_instance */
current_context_p = context_p;
} /* jerry_port_default_set_context */
/**
* Get the current instance.
* Get the current context.
*
* @return the pointer to the current instance
* @return the pointer to the current context
*/
jerry_instance_t *
jerry_port_get_current_instance (void)
jerry_context_t *
jerry_port_get_current_context (void)
{
return current_instance_p;
} /* jerry_port_get_current_instance */
return current_context_p;
} /* jerry_port_get_current_context */
```
## Sleep