1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #ifndef AFUN_ACTIVATION_H
- #define AFUN_ACTIVATION_H
- #include "aFuntool.h"
- #include "aFunCoreExport.h"
- #include "core.h"
- #include "value.h"
- namespace aFuncore {
- class AFUN_CORE_EXPORT Activation {
- protected:
- Activation *prev;
- VarList *varlist;
- UpMessage *up;
- DownMessage *down;
- StringFilePath path;
- FileLine line;
- public:
- Inter *const inter;
- explicit Activation(Inter *inter_);
- virtual ~Activation();
- Activation &operator=(const Activation &)=delete;
- virtual ActivationStatus getCode(Code *&code) = 0;
- virtual void runCode(Code *code);
- virtual void endRun() {}
- [[nodiscard]] VarList *getVarlist() const {return varlist;}
- [[nodiscard]] Activation *toPrev() const {return prev;}
- [[nodiscard]] UpMessage *getUpStream() const {return up;}
- [[nodiscard]] DownMessage *getDownStream() const {return down;}
- [[nodiscard]] FileLine getFileLine() const {return line;}
- [[nodiscard]] const StringFilePath &getFilePath() const {return path;}
- };
- class AFUN_CORE_EXPORT ExeActivation : public Activation {
- Code *start;
- Code *next;
- bool first=true;
- public:
- explicit ExeActivation(Code *code, Inter *inter_) : Activation(inter_), start{code}, next{code} {}
- ActivationStatus getCode(Code *&code) override;
- [[nodiscard]] Code *getStart() const {return start;}
- };
- class AFUN_CORE_EXPORT TopActivation : public ExeActivation {
- public:
- explicit TopActivation(Code *code, Inter *inter_);
- ~TopActivation() override;
- };
- class AFUN_CORE_EXPORT FuncActivation : public Activation {
- enum {
- func_first = 0,
- func_get_func = 1,
- func_get_arg = 2,
- } status = func_first;
- bool on_tail = false;
- Code *call;
- Function *func = nullptr;
- Function::CallFunction *call_func = nullptr;
- std::list<Function::CallFunction::ArgCodeList> *acl = nullptr;
- std::list<Function::CallFunction::ArgCodeList>::iterator acl_begin;
- std::list<Function::CallFunction::ArgCodeList>::iterator acl_end;
- public:
- explicit FuncActivation(Code *code, Inter *inter_) : Activation(inter_), call{code,} {}
- ~FuncActivation() override;
- ActivationStatus getCode(Code *&code) override;
- void endRun() override;
- };
- }
- #endif //AFUN_ACTIVATION_H
|