finsh_error.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * File : finsh_error.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_error.h"
  15. u_char global_errno;
  16. static const char* finsh_error_string_table[] =
  17. {
  18. "No error",
  19. "Invalid token",
  20. "Expect a type",
  21. "Unknown type",
  22. "Variable exist",
  23. "Expect a operater",
  24. "Memory full",
  25. "Unknown operator",
  26. "Unknown node",
  27. "Expect a character",
  28. "Unexpect end",
  29. "Unknown token",
  30. "Float not supported",
  31. "Unknown symbol",
  32. "Null node"
  33. };
  34. int finsh_error_init()
  35. {
  36. global_errno = FINSH_ERROR_OK;
  37. return 0;
  38. }
  39. int finsh_error_set(u_char type)
  40. {
  41. global_errno = type;
  42. return 0;
  43. }
  44. u_char finsh_errno()
  45. {
  46. return global_errno;
  47. }
  48. const char* finsh_error_string(u_char type)
  49. {
  50. return finsh_error_string_table[type];
  51. }