1 /*
2  * Copyright (C) 2015-2019 Alibaba Group Holding Limited
3  */
4 
5 #ifndef __AMP_REPL_H
6 #define __AMP_REPL_H
7 
8 #include <stdint.h>
9 #include "duktape/duktape.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #define REPL_OK 0
16 #define REPL_ERR_NOMEM -10000
17 #define REPL_ERR_DENIED -10001
18 #define REPL_ERR_INVALID -10002
19 #define REPL_ERR_BADCMD -10003
20 #define REPL_ERR_SYNTAX -10004
21 
22 /* repl prompt tag */
23 #ifndef AMP_REPL_PROMPT
24 #define REPL_PROMPT "amp > "
25 #else
26 #define REPL_PROMPT AMP_REPL_PROMPT
27 #endif
28 
29 /* repl port */
30 #ifndef AMP_REPL_STDIO
31 #define STDIO_UART 0
32 #else
33 #define STDIO_UART AMP_REPL_STDIO
34 #endif
35 
36 /* repl port bandrate */
37 #ifndef AMP_REPL_STDIO_BANDRATE
38 #define STDIO_UART_BANDRATE 115200
39 #else
40 #define STDIO_UART_BANDRATE AMP_REPL_STDIO_BANDRATE
41 #endif
42 
43 /* repl task stack size */
44 #ifndef AMP_REPL_STACK_SIZE
45 #define REPL_STACK_SIZE 1024*4
46 #else
47 #define REPL_STACK_SIZE AMP_REPL_STACK_SIZE
48 #endif
49 
50 #define REPL_INBUF_SIZE 256
51 #define REPL_OUTBUF_SIZE 1024
52 
53 int32_t repl_printf(const char *buffer, ...);
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 
59 #endif /* __AMP_REPL_H */