Shell_internal.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Copyright (c) 2002-2012 Croteam Ltd.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of version 2 of the GNU General Public License as published by
  4. the Free Software Foundation
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along
  10. with this program; if not, write to the Free Software Foundation, Inc.,
  11. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
  12. #ifndef SE_INCL_SHELL_INTERNAL_H
  13. #define SE_INCL_SHELL_INTERNAL_H
  14. #ifdef PRAGMA_ONCE
  15. #pragma once
  16. #endif
  17. #include <Engine/Base/CTString.h>
  18. // basic data type types
  19. enum ShellTypeType {
  20. STT_ILLEGAL ,
  21. STT_POINTER ,
  22. STT_FUNCTION ,
  23. STT_ARRAY ,
  24. STT_VOID ,
  25. STT_INDEX ,
  26. STT_FLOAT ,
  27. STT_STRING ,
  28. };
  29. // data type structure
  30. struct ShellType {
  31. enum ShellTypeType st_sttType;
  32. INDEX st_ctArraySize; // number of members if an array
  33. INDEX st_istBaseType; // type pointed to by a pointer, or member of array
  34. // or result of a function
  35. INDEX st_istFirstArgument; // first argument in function
  36. INDEX st_istLastArgument; // last argument in function
  37. INDEX st_istNextInArguments; // next argument in function
  38. INDEX st_istPrevInArguments; // previous argument in function
  39. };
  40. // symbol flags
  41. #define SSF_CONSTANT (1L<<0) // the symbol cannot be changed
  42. #define SSF_USER (1L<<1) // the symbol is visible to user (with ListSymbols() )
  43. #define SSF_PERSISTENT (1L<<2) // the symbol is saved when exiting
  44. #define SSF_EXTERNAL (1L<<3) // the symbol was declared externally (in a script)
  45. // A symbol defined for using in shell.
  46. class CShellSymbol {
  47. public:
  48. // implementation:
  49. INDEX ss_istType; // type of the symbol
  50. CTString ss_strName; // symbol name
  51. void *ss_pvValue; // symbol value
  52. BOOL (*ss_pPreFunc)(void *);
  53. void (*ss_pPostFunc)(void *);
  54. ULONG ss_ulFlags; // various flags
  55. // Clear function.
  56. void Clear(void);
  57. // check if declared
  58. BOOL IsDeclared(void);
  59. // interface:
  60. // get string for 'tab' completion in console
  61. ENGINE_API CTString GetCompletionString(void) const;
  62. };
  63. #endif /* include-once check. */