finsh_node.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * node routines for finsh shell.
  3. *
  4. * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
  5. *
  6. * This file is part of RT-Thread (http://www.rt-thread.org)
  7. * Maintainer: bernard.xiong <bernard.xiong at gmail.com>
  8. *
  9. * All rights reserved.
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License along
  22. * with this program; if not, write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  24. *
  25. * Change Logs:
  26. * Date Author Notes
  27. * 2010-03-22 Bernard first version
  28. */
  29. #ifndef __FINSH_NODE_H__
  30. #define __FINSH_NODE_H__
  31. #include <finsh.h>
  32. #define FINSH_NODE_UNKNOWN 0
  33. #define FINSH_NODE_ID 1
  34. #define FINSH_NODE_VALUE_CHAR 2
  35. #define FINSH_NODE_VALUE_INT 3
  36. #define FINSH_NODE_VALUE_LONG 4
  37. #define FINSH_NODE_VALUE_STRING 5
  38. #define FINSH_NODE_VALUE_NULL 6
  39. #define FINSH_NODE_SYS_ADD 7
  40. #define FINSH_NODE_SYS_SUB 8
  41. #define FINSH_NODE_SYS_MUL 9
  42. #define FINSH_NODE_SYS_DIV 10
  43. #define FINSH_NODE_SYS_MOD 11
  44. #define FINSH_NODE_SYS_AND 12
  45. #define FINSH_NODE_SYS_OR 13
  46. #define FINSH_NODE_SYS_XOR 14
  47. #define FINSH_NODE_SYS_BITWISE 15
  48. #define FINSH_NODE_SYS_SHL 16
  49. #define FINSH_NODE_SYS_SHR 17
  50. #define FINSH_NODE_SYS_FUNC 18
  51. #define FINSH_NODE_SYS_ASSIGN 19
  52. #define FINSH_NODE_SYS_CAST 20
  53. #define FINSH_NODE_SYS_PREINC 21
  54. #define FINSH_NODE_SYS_PREDEC 22
  55. #define FINSH_NODE_SYS_INC 23
  56. #define FINSH_NODE_SYS_DEC 24
  57. #define FINSH_NODE_SYS_GETVALUE 25
  58. #define FINSH_NODE_SYS_GETADDR 26
  59. #define FINSH_NODE_SYS_NULL 27
  60. #define FINSH_DATA_TYPE_VOID 0x00
  61. #define FINSH_DATA_TYPE_BYTE 0x01
  62. #define FINSH_DATA_TYPE_WORD 0x02
  63. #define FINSH_DATA_TYPE_DWORD 0x03
  64. #define FINSH_DATA_TYPE_PTR 0x10
  65. #define FINSH_NODE_VALUE 0
  66. #define FINSH_NODE_ADDRESS 1
  67. #define FINSH_NODE_FUNCTION 2
  68. int finsh_node_init(void);
  69. struct finsh_node* finsh_node_allocate(u_char type);
  70. struct finsh_node* finsh_node_new_id(char* id);
  71. struct finsh_node* finsh_node_new_char(char c);
  72. struct finsh_node* finsh_node_new_int(int i);
  73. struct finsh_node* finsh_node_new_long(long l);
  74. struct finsh_node* finsh_node_new_string(char* s);
  75. struct finsh_node* finsh_node_new_ptr(void* ptr);
  76. #define finsh_node_sibling(node) ((node)->sibling)
  77. #define finsh_node_child(node) ((node)->child)
  78. #endif