From 1c425607c3940e77e4d4893348bbc8d375004d37 Mon Sep 17 00:00:00 2001 From: "bernard.xiong@gmail.com" Date: Mon, 22 Oct 2012 03:12:21 +0000 Subject: fixed mutex issue in memheap; fixed compiling issue in kservice.c when COMPILER is not defined; add finsh for win32 porting. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2365 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/finsh/shell.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'components/finsh/shell.c') diff --git a/components/finsh/shell.c b/components/finsh/shell.c index 601bf647f6..c10c193c9c 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -304,7 +304,17 @@ rt_bool_t finsh_handle_history(struct finsh_shell* shell, char ch) if (shell->use_history) { +#if defined(_WIN32) + int i; + rt_kprintf("\r"); + + for(i=0; i<= 60; i++) + putchar(' '); + rt_kprintf("\r"); + +#else rt_kprintf("\033[2K\r"); +#endif rt_kprintf("%s%s", FINSH_PROMPT, shell->line); return RT_TRUE;; } @@ -459,6 +469,26 @@ void finsh_system_var_init(const void* begin, const void* end) extern "asm" int __vsymtab_start; extern "asm" int __vsymtab_end; #endif +#elif defined(_MSC_VER) +#pragma section("FSymTab$a", read) +const char __fsym_begin_name[] = "__start"; +const char __fsym_begin_desc[] = "begin of finsh"; +__declspec(allocate("FSymTab$a")) const struct finsh_syscall __fsym_begin = +{ + __fsym_begin_name, + __fsym_begin_desc, + NULL +}; + +#pragma section("FSymTab$z", read) +const char __fsym_end_name[] = "__end"; +const char __fsym_end_desc[] = "end of finsh"; +__declspec(allocate("FSymTab$z")) const struct finsh_syscall __fsym_end = +{ + __fsym_end_name, + __fsym_end_desc, + NULL +}; #endif /* @@ -493,6 +523,16 @@ void finsh_system_init(void) #elif defined(__ADSPBLACKFIN__) /* for VisualDSP++ Compiler */ finsh_system_function_init(&__fsymtab_start, &__fsymtab_end); finsh_system_var_init(&__vsymtab_start, &__vsymtab_end); +#elif defined(_MSC_VER) + unsigned int *ptr_begin, *ptr_end; + + ptr_begin = (unsigned int*)&__fsym_begin; ptr_begin += (sizeof(struct finsh_syscall)/sizeof(unsigned int)); + while (*ptr_begin == 0) ptr_begin ++; + + ptr_end = (unsigned int*) &__fsym_end; ptr_end --; + while (*ptr_end == 0) ptr_end --; + + finsh_system_function_init(ptr_begin, ptr_end); #endif #endif -- cgit v1.3.1