Browse Source

fix the line too long issue

bernard 11 years ago
parent
commit
6c5e34fa70
3 changed files with 11 additions and 13 deletions
  1. 5 0
      components/finsh/finsh_parser.c
  2. 1 8
      components/finsh/finsh_token.c
  3. 5 5
      components/finsh/finsh_vm.c

+ 5 - 0
components/finsh/finsh_parser.c

@@ -25,6 +25,7 @@
  * Change Logs:
  * Date           Author       Notes
  * 2010-03-22     Bernard      first version
+ * 2013-10-09     Bernard      fix the command line too long issue.
  */
 #include <finsh.h>
 
@@ -987,6 +988,10 @@ void finsh_parser_run(struct finsh_parser* self, const u_char* string)
 
 			break;
 		}
+
+		/* no root found, break out */
+		if (self->root == NULL) break;
+
         /* get next token */
 		next_token(token, &(self->token));
 	}

+ 1 - 8
components/finsh/finsh_token.c

@@ -164,7 +164,6 @@ static void token_run(struct finsh_token* self)
 		{
 			self->current_token = finsh_token_type_identifier;
 		}
-		return;
 	}
 	else/*It is a operator character.*/
 	{
@@ -331,15 +330,9 @@ static int token_match_name(struct finsh_token* self, const char* str)
 static void token_trim_space(struct finsh_token* self)
 {
 	char ch;
-#if 0	
 	while ( (ch = token_next_char(self)) ==' ' || 
         ch == '\t' || 
-        ch == '\r' ||
-        ch == '\n');
-#else
-	while ( (ch = token_next_char(self)) ==' ' || 
-        ch == '\t');
-#endif
+        ch == '\r');
 
 	token_prev_char(self);
 }

+ 5 - 5
components/finsh/finsh_vm.c

@@ -1,5 +1,5 @@
 /*
- *  Virtual machine finsh shell.
+ *  Virtual machine of finsh shell.
  *
  * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
  *
@@ -43,13 +43,13 @@ u_char*				finsh_pc;		/* PC */
 /* syscall list, for dynamic system call register */
 struct finsh_syscall_item* global_syscall_list = NULL;
 
-// #define VM_DISASSEMBLE
+// #define FINSH_VM_DISASSEMBLE
 void finsh_vm_run()
 {
 	u_char op;
 
-	/* if want to disassemble the bytecode, please define VM_DISASSEMBLE */
-#ifdef VM_DISASSEMBLE
+	/* if you want to disassemble the byte code, please define FINSH_VM_DISASSEMBLE */
+#ifdef FINSH_VM_DISASSEMBLE
 	void finsh_disassemble();
 	finsh_disassemble();
 #endif
@@ -146,7 +146,7 @@ struct finsh_syscall* finsh_syscall_lookup(const char* name)
 	return NULL;
 }
 
-#ifdef VM_DISASSEMBLE
+#ifdef FINSH_VM_DISASSEMBLE
 void finsh_disassemble()
 {
 	u_char *pc, op;