activation.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef AFUN_ACTIVATION_HPP
  2. #define AFUN_ACTIVATION_HPP
  3. #include "tool.hpp"
  4. #include "aFunCoreExport.h"
  5. namespace aFuncore {
  6. class Activation;
  7. class TopActivation;
  8. typedef enum ActivationStatus {
  9. as_run = 0,
  10. as_end = 1,
  11. } ActivationStatus;
  12. }
  13. #include "msg.hpp"
  14. #include "code.hpp"
  15. #include "inter.hpp"
  16. #include "var.hpp"
  17. namespace aFuncore {
  18. class Activation {
  19. protected:
  20. Activation *prev;
  21. VarList *varlist;
  22. VarList *old_varlist;
  23. UpMessage *up;
  24. DownMessage *down;
  25. public:
  26. Inter *const inter;
  27. StringFilePath path;
  28. FileLine line;
  29. explicit Activation(Inter *inter_);
  30. virtual ~Activation();
  31. virtual ActivationStatus getCode(Code *&code)=0;
  32. virtual bool onTail()=0;
  33. [[nodiscard]] VarList *getVarlist() const {return varlist;}
  34. [[nodiscard]] Activation *toPrev() const {return prev;}
  35. [[nodiscard]] UpMessage *getUpStream() const {return up;}
  36. [[nodiscard]] DownMessage *getDownStream() const {return down;}
  37. };
  38. class TopActivation : public Activation {
  39. Code *start;
  40. Code *next;
  41. public:
  42. explicit TopActivation(Code *code, Inter *inter_);
  43. ~TopActivation() override;
  44. ActivationStatus getCode(Code *&code) override;
  45. bool onTail() override {return false;}
  46. };
  47. }
  48. #endif //AFUN_ACTIVATION_HPP