targets/zephyr/Makefile.zephyr: Use zephyr_getline module for line input.

The original implementation used shell facility, but it was designed for
a unix shell like input, and automatically tokenized it into
space-separated "words", with limit of 10 (i.e. 9 spaces per line). For
JavaScript input, it is quite easy to have more than 9 spaces per line,
and get error:

Too many parameters (max 10)

After consultation with upstream
(https://jira.zephyrproject.org/browse/ZEP-532) it was decided that the
best approach is to skip using shell facility and use Zephyr console
facility. That however requires some Zephyr-specific boilerplate code.
This code was implemented as reusable modules in
https://github.com/pfalcon/zephyr_console_helpers repository, to be
usable for other console-based projects too. zephyr_getline.h/c in this
commits are direct imports from this repository.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
This commit is contained in:
Paul Sokolovsky
2016-08-11 17:22:12 +03:00
parent 27253112c2
commit 314e74f8ce
5 changed files with 106 additions and 136 deletions
+6 -13
View File
@@ -132,28 +132,21 @@ Test command line in a serial terminal.
You should see something similar to this:
```
Jerry Compilation May 26 2016 13:37:50
JerryScript build: Aug 12 2016 17:12:55
JerryScript API 1.0
Zephyr version 1.4.0
js>
```
Run the example javascript command test function
```
js> test
Script [var test=0; for (t=100; t<1000; t++) test+=t; print ('Hi JS World! '+test);]
js> var test=0; for (t=100; t<1000; t++) test+=t; print ('Hi JS World! '+test);
Hi JS World! 494550
```
Try more complex functions:
Try a more complex function:
```
js>function hello(t){t=t*10;return t}; print("result"+hello(10.5));
js> function hello(t) {t=t*10;return t}; print("result"+hello(10.5));
```
Help will provide a list of commands
```
> help
```
This program, is built in top of the Zephyr command line, so there is a limit of 10 spaces.