Correct the documentation

- Fix some style issue, typos, and examples
- Follow the variable naming conventions
- Fix tables both in the project and on the webpage

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
This commit is contained in:
Zsolt Borbély
2016-08-24 12:52:02 +02:00
parent 48d5eee920
commit e93e32635f
7 changed files with 180 additions and 153 deletions
+18 -11
View File
@@ -9,14 +9,14 @@ This guide is intended to introduce you to JerryScript embedding API through cre
#include "jerry-api.h"
int
main (int argc, char * argv[])
main (int argc, char *argv[])
{
const jerry_char_t script[] = "print ('Hello, World!');";
size_t script_size = strlen ((const char *) script);
bool ret_value = jerry_run_simple (script, script_size, JERRY_INIT_EMPTY);
return (ret_value ? 1 : 0);
return (ret_value ? 0 : 1);
}
```
@@ -41,7 +41,7 @@ Here we perform the same actions, as `jerry_run_simple`, while splitting into se
#include "jerry-api.h"
int
main (int argc, char * argv[])
main (int argc, char *argv[])
{
const jerry_char_t script[] = "print ('Hello, World!');";
size_t script_size = strlen ((const char *) script);
@@ -80,7 +80,7 @@ Our code is more complex now, but it introduces possibilities to interact with J
#include "jerry-api.h"
int
main (int argc, char * argv[])
main (int argc, char *argv[])
{
const jerry_char_t script_1[] = "var s = 'Hello, World!';";
const jerry_char_t script_2[] = "print (s);";
@@ -122,7 +122,7 @@ This way, we execute two independent script parts in one execution environment.
#include "jerry-api.h"
int
main (int argc, char * argv[]) {
main (int argc, char *argv[]) {
const jerry_char_t str[] = "Hello, World!";
const jerry_char_t script[] = "print (s);";
@@ -214,6 +214,7 @@ print_value (const jerry_value_t value)
jerry_char_t str_buf_p[req_sz];
jerry_string_to_char_buffer (value, str_buf_p, req_sz);
str_buf_p[req_sz] = '\0';
jerry_port_console ("%s", (const char *) str_buf_p);
}
@@ -248,10 +249,10 @@ Shell operation can be described with the following loop:
#include "jerry-api.h"
#include "jerry-port.h"
static void print_value (const jerry_api_value_t);
static void print_value (const jerry_value_t);
int
main (int argc, char * argv[])
main (int argc, char *argv[])
{
bool is_done = false;
@@ -260,7 +261,7 @@ main (int argc, char * argv[])
while (!is_done)
{
char cmd [256];
char cmd[256] = {};
char *cmd_tail = cmd;
size_t len = 0;
@@ -283,6 +284,12 @@ main (int argc, char * argv[])
len++;
}
/* If the command is "quit", break the loop */
if (!strncmp (cmd, "quit\n", strlen ("quit\n")))
{
break;
}
jerry_value_t ret_val;
/* Evaluate entered command */
@@ -337,7 +344,7 @@ get_msg_handler (const jerry_value_t func_value, /**< function object */
} /* get_msg_handler */
int
main (int argc, char * argv[])
main (int argc, char *argv[])
{
/* Initialize engine */
jerry_init (JERRY_INIT_EMPTY);
@@ -439,7 +446,7 @@ add_handler (const jerry_value_t func_value, /**< function object */
} /* add_handler */
int
main (int argc, char * argv[])
main (int argc, char *argv[])
{
/* Initialize engine */
jerry_init (JERRY_INIT_EMPTY);
@@ -505,4 +512,4 @@ Value of x is 17
## Further steps
For further API description, please visit [API Reference page](https://samsung.github.io/jerryscript/API/) on [JerryScript home page](https://samsung.github.io/jerryscript/).
For further API description, please visit [API Reference page](https://samsung.github.io/jerryscript/api-reference/) on [JerryScript home page](https://samsung.github.io/jerryscript/).