xref: /nrf52832-nimble/rt-thread/components/finsh/finsh_error.c (revision 104654410c56c573564690304ae786df310c91fc)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2010-03-22     Bernard      first version
9  */
10 #include "finsh_error.h"
11 
12 uint8_t global_errno;
13 
14 static const char * finsh_error_string_table[] =
15 {
16     "No error",
17     "Invalid token",
18     "Expect a type",
19     "Unknown type",
20     "Variable exist",
21     "Expect a operater",
22     "Memory full",
23     "Unknown operator",
24     "Unknown node",
25     "Expect a character",
26     "Unexpect end",
27     "Unknown token",
28     "Float not supported",
29     "Unknown symbol",
30     "Null node"
31 };
32 
finsh_error_init()33 int finsh_error_init()
34 {
35     global_errno = FINSH_ERROR_OK;
36 
37     return 0;
38 }
39 
finsh_error_set(uint8_t type)40 int finsh_error_set(uint8_t type)
41 {
42     global_errno = type;
43 
44     return 0;
45 }
46 
finsh_errno()47 uint8_t finsh_errno()
48 {
49     return global_errno;
50 }
51 
finsh_error_string(uint8_t type)52 const char* finsh_error_string(uint8_t type)
53 {
54     return finsh_error_string_table[type];
55 }
56