finsh_var.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * File : finsh_var.h
  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. #ifndef __FINSH_VAR_H__
  15. #define __FINSH_VAR_H__
  16. #include <finsh.h>
  17. /*
  18. * The variable in finsh is put in data segment as a global variable.
  19. * The 'finsh_var' structure presents the structure of variable in data segment.
  20. */
  21. struct finsh_var
  22. {
  23. char name[FINSH_NAME_MAX + 1]; /* the name of variable */
  24. u_char type; /* the type of variable */
  25. /* variable value */
  26. union {
  27. char char_value;
  28. short short_value;
  29. int int_value;
  30. long long_value;
  31. void* ptr;
  32. }value;
  33. };
  34. extern struct finsh_var global_variable[];
  35. int finsh_var_init(void);
  36. int finsh_var_insert(const char* name, int type);
  37. int finsh_var_delete(const char* name);
  38. struct finsh_var* finsh_var_lookup(const char* name);
  39. #endif