module.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef _SCRIPT_MODULE_H_
  2. #define _SCRIPT_MODULE_H_
  3. #include "runtime.h"
  4. #include "console/console.h"
  5. #include "platform/types.h"
  6. namespace Con
  7. {
  8. class Module
  9. {
  10. private:
  11. S32 mRefCount = 0;
  12. public:
  13. Module() = default;
  14. virtual ~Module() = default;
  15. void incRefCount() { mRefCount++; }
  16. void decRefCount() { mRefCount--; if (!mRefCount) delete this; }
  17. virtual const char* getFunctionArgs(StringTableEntry functionName, U32 functionOffset) = 0;
  18. virtual const char* getPath() = 0;
  19. virtual const char* getName() = 0;
  20. virtual EvalResult exec(U32 offset, const char* fnName, Namespace* ns, U32 argc,
  21. ConsoleValue* argv, bool noCalls, StringTableEntry packageName,
  22. S32 setFrame = -1) = 0;
  23. virtual void findBreakLine(U32 ip, U32& line, U32& instruction) {}
  24. /// Returns the first breakable line or 0 if none was found.
  25. /// @param lineNumber The one based line number.
  26. virtual U32 findFirstBreakLine(U32 lineNumber) { return 0; }
  27. /// Set a OP_BREAK instruction on a line. If a break
  28. /// is not possible on that line it returns false.
  29. /// @param lineNumber The one based line number.
  30. virtual bool setBreakpoint(U32 lineNumber) { return false;}
  31. virtual void setAllBreaks() {}
  32. virtual void clearAllBreaks() {}
  33. virtual void clearBreakpoint(U32 lineNumber) {}
  34. virtual Vector<U32> getBreakableLines() { return {}; }
  35. };
  36. }
  37. #endif