/xbmc/visualizations/Vortex/angelscript/angelscript/source/as_variablescope.h

http://github.com/xbmc/xbmc · C++ Header · 80 lines · 31 code · 15 blank · 34 comment · 0 complexity · 0a4e56b25d377aee39dc9dbdd6253989 MD5 · raw file

  1. /*
  2. AngelCode Scripting Library
  3. Copyright (c) 2003-2007 Andreas Jonsson
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any
  6. damages arising from the use of this software.
  7. Permission is granted to anyone to use this software for any
  8. purpose, including commercial applications, and to alter it and
  9. redistribute it freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you
  11. must not claim that you wrote the original software. If you use
  12. this software in a product, an acknowledgment in the product
  13. documentation would be appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and
  15. must not be misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source
  17. distribution.
  18. The original version of this library can be located at:
  19. http://www.angelcode.com/angelscript/
  20. Andreas Jonsson
  21. andreas@angelcode.com
  22. */
  23. //
  24. // as_variablescope.h
  25. //
  26. // A manager class for variable declarations
  27. //
  28. #ifndef AS_VARIABLESCOPE_H
  29. #define AS_VARIABLESCOPE_H
  30. #include "as_array.h"
  31. #include "as_string.h"
  32. #include "as_datatype.h"
  33. BEGIN_AS_NAMESPACE
  34. struct sVariable
  35. {
  36. asCString name;
  37. asCDataType type;
  38. int stackOffset;
  39. bool isInitialized;
  40. bool isPureConstant;
  41. asQWORD constantValue;
  42. };
  43. class asCVariableScope
  44. {
  45. public:
  46. asCVariableScope(asCVariableScope *parent);
  47. ~asCVariableScope();
  48. void Reset();
  49. int DeclareVariable(const char *name, const asCDataType &type, int stackOffset);
  50. sVariable *GetVariable(const char *name);
  51. sVariable *GetVariableByOffset(int offset);
  52. asCVariableScope *parent;
  53. bool isBreakScope;
  54. bool isContinueScope;
  55. asCArray<sVariable *> variables;
  56. };
  57. END_AS_NAMESPACE
  58. #endif