reduce finsh shell memory usage.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@765 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2010-06-09 10:00:08 +00:00
parent f419a1711b
commit 6254665cfe
4 changed files with 7 additions and 5 deletions

View File

@ -24,7 +24,7 @@
#define FINSH_STRING_MAX 128 /* max length of string */ #define FINSH_STRING_MAX 128 /* max length of string */
#define FINSH_VARIABLE_MAX 8 /* max number of variable */ #define FINSH_VARIABLE_MAX 8 /* max number of variable */
#define FINSH_STACK_MAX 128 /* max stack size */ #define FINSH_STACK_MAX 64 /* max stack size */
#define FINSH_TEXT_MAX 128 /* max text segment size */ #define FINSH_TEXT_MAX 128 /* max text segment size */
#define HEAP_ALIGNMENT 4 /* heap alignment */ #define HEAP_ALIGNMENT 4 /* heap alignment */

View File

@ -15,7 +15,7 @@
u_char global_errno; u_char global_errno;
const char* finsh_error_string_table[] = static const char* finsh_error_string_table[] =
{ {
"No error", "No error",
"Invalid token", "Invalid token",

View File

@ -28,7 +28,7 @@ struct name_table
}; };
/* keyword */ /* keyword */
static struct name_table finsh_name_table[] = static const struct name_table finsh_name_table[] =
{ {
{"void", finsh_token_type_void}, {"void", finsh_token_type_void},
{"char", finsh_token_type_char}, {"char", finsh_token_type_char},

View File

@ -144,9 +144,10 @@ void finsh_auto_complete(char* prefix)
rt_kprintf("finsh>>%s", prefix); rt_kprintf("finsh>>%s", prefix);
} }
extern const char* finsh_error_string_table[];
void finsh_run_line(struct finsh_parser* parser, const char *line) void finsh_run_line(struct finsh_parser* parser, const char *line)
{ {
const char* err_str;
rt_kprintf("\n"); rt_kprintf("\n");
finsh_parser_run(parser, (unsigned char*)line); finsh_parser_run(parser, (unsigned char*)line);
@ -157,7 +158,8 @@ void finsh_run_line(struct finsh_parser* parser, const char *line)
} }
else else
{ {
rt_kprintf("%s\n", finsh_error_string(finsh_errno())); err_str = finsh_error_string(finsh_errno());
rt_kprintf("%s\n", err_str);
} }
/* run virtual machine */ /* run virtual machine */