Update the webpage (#1820)

* Add docs of extensions
  * Use `category` to distinct dropdown pages
  * Sort the documents alphabetical

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
This commit is contained in:
Zsolt Borbély
2017-05-15 08:42:18 +02:00
committed by yichoi
parent 13a04be79c
commit 5d2b25659d
11 changed files with 874 additions and 47 deletions
+13 -12
View File
@@ -1,6 +1,7 @@
---
layout: page
title: API Examples
category: navbar
permalink: /api-example/
---
@@ -182,38 +183,38 @@ created by API functions has the error flag set.
The following example function will output a JavaScript value:
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "jerryscript.h"
#include "jerryscript-port.h"
static void
print_value (const jerry_value_t value)
{
if (jerry_value_is_undefined (value))
{
jerry_port_console ("undefined");
printf ("undefined");
}
else if (jerry_value_is_null (value))
{
jerry_port_console ("null");
printf ("null");
}
else if (jerry_value_is_boolean (value))
{
if (jerry_get_boolean_value (value))
{
jerry_port_console ("true");
printf ("true");
}
else
{
jerry_port_console ("false");
printf ("false");
}
}
/* Float value */
else if (jerry_value_is_number (value))
{
jerry_port_console ("number");
printf ("number");
}
/* String value */
else if (jerry_value_is_string (value))
@@ -225,15 +226,15 @@ print_value (const jerry_value_t value)
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);
printf ("%s", (const char *) str_buf_p);
}
/* Object reference */
else if (jerry_value_is_object (value))
{
jerry_port_console ("[JS object]");
printf ("[JS object]");
}
jerry_port_console ("\n");
printf ("\n");
}
```
@@ -252,11 +253,11 @@ Shell operation can be described with the following loop:
- loop.
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "jerryscript.h"
#include "jerryscript-port.h"
static void print_value (const jerry_value_t);
@@ -274,7 +275,7 @@ main (int argc, char *argv[])
char *cmd_tail = cmd;
size_t len = 0;
jerry_port_console ("> ");
printf ("> ");
/* Read next command */
while (true)
@@ -311,7 +312,7 @@ main (int argc, char *argv[])
{
/* Evaluated JS code thrown an exception
* and didn't handle it with try-catch-finally */
jerry_port_console ("Unhandled JS exception occured: ");
printf ("Unhandled JS exception occured: ");
}
print_value (ret_val);