summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-05-30 02:42:26 +0000
committer[email protected] <[email protected]>2012-05-30 02:42:26 +0000
commite86bd6827804ff09fbb9f2c39ad7ff4cd574ff8c (patch)
tree6d05c62d42f59791c528140560b8da73326d2072 /components
parent2c82d4945b94d4f917ec78b3b1c8085d30c9b13e (diff)
fixed the mismatch of device definitions in rtdef.h and finsh shell; add line comment in finsh shell.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2136 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components')
-rw-r--r--components/finsh/cmd.c7
-rw-r--r--components/finsh/finsh_token.c12
-rw-r--r--components/finsh/finsh_token.h1
3 files changed, 15 insertions, 5 deletions
diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c
index d125864aa0..451d80506b 100644
--- a/components/finsh/cmd.c
+++ b/components/finsh/cmd.c
@@ -356,7 +356,8 @@ static long _list_device(struct rt_list_node *list)
"CAN Device",
"RTC",
"Sound Device",
- "Graphic Device",
+ "Graphic Device",
+ "I2C Bus",
"I2C Device",
"USB Slave Device",
"USB Host Bus",
@@ -401,12 +402,10 @@ int list_module(void)
for (node = list->next; node != list; node = node->next)
{
module = (struct rt_module*)(rt_list_entry(node, struct rt_object, list));
- rt_kprintf("%-16s ", module->parent.name);
- rt_kprintf("%-04d \n", module->nref);
+ rt_kprintf("%-16.*s %-04d\n", RT_NAME_MAX, module->parent.name, module->nref);
}
return 0;
-
}
FINSH_FUNCTION_EXPORT(list_module, list module in system)
diff --git a/components/finsh/finsh_token.c b/components/finsh/finsh_token.c
index 49d4f8d44a..1965bc5400 100644
--- a/components/finsh/finsh_token.c
+++ b/components/finsh/finsh_token.c
@@ -207,7 +207,17 @@ static void token_run(struct finsh_token* self)
break;
case '/':
- self->current_token = finsh_token_type_div;
+ ch = token_next_char(self);
+ if (ch == '/')
+ {
+ /* line comments, set to end of file */
+ self->current_token = finsh_token_type_eof;
+ }
+ else
+ {
+ token_prev_char(self);
+ self->current_token = finsh_token_type_div;
+ }
break;
case '<':
diff --git a/components/finsh/finsh_token.h b/components/finsh/finsh_token.h
index a5eb775dde..cde596b1bf 100644
--- a/components/finsh/finsh_token.h
+++ b/components/finsh/finsh_token.h
@@ -36,6 +36,7 @@ enum finsh_token_type
finsh_token_type_bitwise, /* ~ */
finsh_token_type_shl, /* << */
finsh_token_type_shr, /* >> */
+ finsh_token_type_comments, /* // */
/*-- data type --*/
finsh_token_type_void, /* void */
finsh_token_type_char, /* char */