finsh_init.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * File : finsh_init.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2010-03-22 Bernard first version
  13. */
  14. #include <finsh.h>
  15. #include "finsh_node.h"
  16. #include "finsh_vm.h"
  17. #include "finsh_parser.h"
  18. #include "finsh_var.h"
  19. #include "finsh_error.h"
  20. #include "finsh_heap.h"
  21. int finsh_init(struct finsh_parser* parser)
  22. {
  23. finsh_parser_init(parser);
  24. /* finsh init */
  25. finsh_node_init();
  26. finsh_var_init();
  27. finsh_error_init();
  28. finsh_heap_init();
  29. return 0;
  30. }
  31. long finsh_stack_bottom()
  32. {
  33. return finsh_vm_stack[0].long_value;
  34. }
  35. int finsh_flush(struct finsh_parser* parser)
  36. {
  37. finsh_parser_init(parser);
  38. /* finsh init */
  39. finsh_node_init();
  40. finsh_error_init();
  41. return 0;
  42. }
  43. int finsh_reset(struct finsh_parser* parser)
  44. {
  45. /* finsh init */
  46. finsh_node_init();
  47. finsh_var_init();
  48. finsh_error_init();
  49. finsh_heap_init();
  50. return 0;
  51. }