finsh_var.h 709 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef __FINSH_VAR_H__
  2. #define __FINSH_VAR_H__
  3. #include <finsh.h>
  4. /*
  5. * The variable in finsh is put in data segment as a global variable.
  6. * The 'finsh_var' structure presents the structure of variable in data segment.
  7. */
  8. struct finsh_var
  9. {
  10. char name[FINSH_NAME_MAX + 1]; /* the name of variable */
  11. u_char type; /* the type of variable */
  12. /* variable value */
  13. union {
  14. char char_value;
  15. short short_value;
  16. int int_value;
  17. long long_value;
  18. void* ptr;
  19. }value;
  20. };
  21. extern struct finsh_var global_variable[];
  22. int finsh_var_init(void);
  23. int finsh_var_insert(const char* name, int type);
  24. int finsh_var_delete(const char* name);
  25. struct finsh_var* finsh_var_lookup(const char* name);
  26. #endif