Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1.  
  2. /** \file lispglobals.h
  3.  *  Storage of globals in a associated hash
  4.  *
  5.  */
  6.  
  7. #ifndef __lispglobals_h__
  8. #define __lispglobals_h__
  9.  
  10. #include "yacasbase.h"
  11. #include "lispobject.h"
  12. #include "lisphash.h"
  13.  
  14.  
  15. /// Value of a Lisp global variable.
  16. /// The only special feature of this class is the attribute
  17. /// #iEvalBeforeReturn, which defaults to #LispFalse. If this
  18. /// attribute is set to #LispTrue, the value in #iValue needs to be
  19. /// evaluated to get the value of the Lisp variable.
  20. /// \sa LispEnvironment::GetVariable()
  21.  
  22. class LispGlobalVariable : public YacasBase
  23. {
  24. public:
  25.     inline LispGlobalVariable(const LispGlobalVariable& aOther);
  26.     LispGlobalVariable(LispPtr& aValue): iValue(aValue), iEvalBeforeReturn(LispFalse) {}
  27.     inline LispGlobalVariable& operator=(const LispGlobalVariable& aOther);
  28.  
  29.     inline void SetEvalBeforeReturn(LispBoolean aEval);
  30.     LispPtr iValue;
  31.     LispBoolean iEvalBeforeReturn;
  32. };
  33.  
  34. /// Associated hash of LispGlobalVariable objects
  35.  
  36. class LispGlobal : public LispAssociatedHash<LispGlobalVariable>
  37. {
  38. };
  39.  
  40.  
  41.  
  42.  
  43. inline LispGlobalVariable::LispGlobalVariable(const LispGlobalVariable& aOther) : iValue(aOther.iValue), iEvalBeforeReturn(LispFalse)
  44. {
  45. }
  46.  
  47. inline void LispGlobalVariable::SetEvalBeforeReturn(LispBoolean aEval)
  48. {
  49.   iEvalBeforeReturn = aEval;
  50. }
  51.  
  52.  
  53. inline LispGlobalVariable& LispGlobalVariable::operator=(const LispGlobalVariable& aOther)
  54. {
  55.   iValue = (aOther.iValue);
  56.   return *this;
  57. }
  58.  
  59.  
  60. #endif
  61.  
  62.