-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathexecutablecode.h
More file actions
47 lines (33 loc) · 1.37 KB
/
executablecode.h
File metadata and controls
47 lines (33 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <memory>
#include "global.h"
namespace libscratchcpp
{
class ExecutionContext;
class Thread;
struct ValueData;
/*! \brief The ExecutableCode class represents the code of a compiled Scratch script. */
class LIBSCRATCHCPP_EXPORT ExecutableCode
{
public:
virtual ~ExecutableCode() { }
/*! Runs the script until it finishes or yields. */
virtual void run(ExecutionContext *context) = 0;
/*!
* Runs the reporter and returns its return value.
* \note Make sure to call value_free() to free the value.
*/
virtual ValueData runReporter(ExecutionContext *context) = 0;
/*! Runs the hat predicate and returns its return value. */
virtual bool runPredicate(ExecutionContext *context) = 0;
/*! Stops the code. isFinished() will return true. */
virtual void kill(ExecutionContext *context) = 0;
/*! Resets the code to run from the start. */
virtual void reset(ExecutionContext *context) = 0;
/*! Returns true if the code is stopped or finished. */
virtual bool isFinished(ExecutionContext *context) const = 0;
/*! Creates an execution context for the given Target. */
virtual std::shared_ptr<ExecutionContext> createExecutionContext(Thread *thread) const = 0;
};
} // namespace libscratchcpp