Skip to content

Commit cfa31e5

Browse files
committed
Remove old compiler and VM code
1 parent fe3ff4b commit cfa31e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+51
-23168
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ target_sources(scratchcpp
3737
include/scratchcpp/field.h
3838
include/scratchcpp/script.h
3939
include/scratchcpp/broadcast.h
40-
include/scratchcpp/virtualmachine.h
4140
include/scratchcpp/blockprototype.h
4241
include/scratchcpp/block.h
4342
include/scratchcpp/istagehandler.h

include/scratchcpp/block.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ namespace libscratchcpp
1010

1111
class IEngine;
1212
class Target;
13-
#ifdef USE_LLVM
1413
class CompilerValue;
15-
#endif
1614
class Input;
1715
class Field;
1816
class Comment;
@@ -28,11 +26,7 @@ class LIBSCRATCHCPP_EXPORT Block : public Entity
2826
Block(const std::string &id, const std::string &opcode);
2927
Block(const Block &) = delete;
3028

31-
#ifdef USE_LLVM
3229
CompilerValue *compile(Compiler *compiler);
33-
#else
34-
void compile(Compiler *compiler);
35-
#endif
3630

3731
const std::string &opcode() const;
3832

include/scratchcpp/compiler.h

Lines changed: 0 additions & 92 deletions
This file was deleted.

include/scratchcpp/global.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,17 @@
2323
namespace libscratchcpp
2424
{
2525

26-
class VirtualMachine;
2726
class Compiler;
28-
#ifdef USE_LLVM
2927
class CompilerValue;
30-
#endif
3128
class Block;
3229
class Value;
3330

34-
/*!
35-
* \typedef BlockFunc
36-
*
37-
* BlockFunc is a function pointer for block implementation functions.
38-
*/
39-
using BlockFunc = unsigned int (*)(VirtualMachine *vm);
40-
41-
#ifdef USE_LLVM
4231
/*!
4332
* \typedef BlockComp
4433
*
4534
* BlockComp is a function pointer for functions which are used to compile blocks.
4635
*/
4736
using BlockComp = CompilerValue *(*)(Compiler *);
48-
#else
49-
/*!
50-
* \typedef BlockComp
51-
*
52-
* BlockComp is a function pointer for functions which are used to compile blocks to bytecode.
53-
*/
54-
using BlockComp = void (*)(Compiler *);
55-
#endif // USE_LLVM
5637

5738
/*!
5839
* \typedef MonitorNameFunc
@@ -68,21 +49,12 @@ using MonitorNameFunc = const std::string &(*)(Block *);
6849
*/
6950
using MonitorChangeFunc = void (*)(Block *, const Value &newValue);
7051

71-
#ifdef USE_LLVM
7252
/*!
7353
* \typedef HatPredicateCompileFunc
7454
*
7555
* HatPredicateCompileFunc is a function pointer for functions which are used to compile edge-activated hat predicates.
7656
*/
7757
using HatPredicateCompileFunc = CompilerValue *(*)(Compiler *vm);
78-
#else
79-
/*!
80-
* \typedef HatPredicateCompileFunc
81-
*
82-
* HatPredicateCompileFunc is a function pointer for functions which are used to compile edge-activated hat predicates to bytecode.
83-
*/
84-
using HatPredicateCompileFunc = void (*)(Compiler *vm);
85-
#endif // USE_LLVM
8658

8759
} // namespace libscratchcpp
8860

include/scratchcpp/iengine.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <vector>
77
#include <unordered_map>
88
#include <unordered_set>
9-
#include <functional>
109

1110
#include "global.h"
1211
#include "signal.h"
@@ -219,12 +218,6 @@ class LIBSCRATCHCPP_EXPORT IEngine
219218
/*! Returns the timer of the project. */
220219
virtual ITimer *timer() const = 0;
221220

222-
/*! Returns the index of the given block function. */
223-
virtual unsigned int functionIndex(BlockFunc f) = 0;
224-
225-
/*! Returns the list of block functions. */
226-
virtual const std::vector<BlockFunc> &blockFunctions() const = 0;
227-
228221
/*!
229222
* Call this from IExtension#registerBlocks() to add a compile function to a block section.
230223
* \see <a href="extensions.html">Extensions</a>

include/scratchcpp/imonitorhandler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ class LIBSCRATCHCPP_EXPORT IMonitorHandler
1717

1818
virtual void init(Monitor *monitor) = 0;
1919

20-
virtual void onValueChanged(const VirtualMachine *vm) = 0;
20+
// TODO: Add onValueChanged()
21+
// virtual void onValueChanged(const VirtualMachine *vm) = 0;
2122
virtual void onXChanged(int x) = 0;
2223
virtual void onYChanged(int y) = 0;
2324
virtual void onVisibleChanged(bool visible) = 0;

include/scratchcpp/inputvalue.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
namespace libscratchcpp
1111
{
1212

13-
#ifdef USE_LLVM
1413
class CompilerValue;
15-
#endif
1614
class Block;
1715
class Entity;
1816
class InputValuePrivate;
@@ -37,11 +35,7 @@ class LIBSCRATCHCPP_EXPORT InputValue
3735

3836
InputValue(Type type = Type::Number);
3937

40-
#ifdef USE_LLVM
4138
CompilerValue *compile(Compiler *compiler);
42-
#else
43-
void compile(Compiler *compiler);
44-
#endif
4539

4640
Type type() const;
4741
void setType(Type newType);

include/scratchcpp/monitor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ class LIBSCRATCHCPP_EXPORT Monitor : public Entity
5656

5757
const std::string &opcode() const;
5858

59-
void updateValue(const VirtualMachine *vm);
59+
// TODO: Add updateValue()
60+
// void updateValue(const VirtualMachine *vm);
6061

6162
void setValueChangeFunction(MonitorChangeFunc f);
6263
void changeValue(const Value &newValue);

include/scratchcpp/script.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@ namespace libscratchcpp
1414
class Target;
1515
class Block;
1616
class IEngine;
17-
#ifdef USE_LLVM
1817
class ExecutableCode;
19-
#endif
20-
class Value;
2118
class Thread;
22-
class Variable;
23-
class List;
2419
class ScriptPrivate;
2520

2621
/*! \brief The Script class represents a compiled Scratch script. */
@@ -33,29 +28,15 @@ class LIBSCRATCHCPP_EXPORT Script
3328
Target *target() const;
3429
std::shared_ptr<Block> topBlock() const;
3530

36-
unsigned int *bytecode() const;
37-
const std::vector<unsigned int> &bytecodeVector() const;
38-
void setBytecode(const std::vector<unsigned int> &code);
39-
40-
#ifdef USE_LLVM
4131
ExecutableCode *code() const;
4232
void setCode(std::shared_ptr<ExecutableCode> code);
43-
#endif
4433

45-
void setHatPredicateBytecode(const std::vector<unsigned int> &code);
4634
bool runHatPredicate(Target *target);
4735

48-
void setProcedures(const std::vector<unsigned int *> &procedures);
49-
void setConstValues(const std::vector<Value> &values);
50-
void setVariables(const std::vector<Variable *> &variables);
51-
void setLists(const std::vector<List *> &lists);
52-
5336
std::shared_ptr<Thread> start();
5437
std::shared_ptr<Thread> start(Target *target);
5538

5639
private:
57-
BlockFunc *getFunctions() const;
58-
5940
spimpl::unique_impl_ptr<ScriptPrivate> impl;
6041
};
6142

include/scratchcpp/thread.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
namespace libscratchcpp
99
{
1010

11-
class VirtualMachine;
1211
class Target;
13-
#ifdef USE_LLVM
1412
class Promise;
15-
#endif
1613
class IEngine;
1714
class Script;
1815
class ThreadPrivate;
@@ -24,7 +21,6 @@ class LIBSCRATCHCPP_EXPORT Thread
2421
Thread(Target *target, IEngine *engine, Script *script);
2522
Thread(const Thread &) = delete;
2623

27-
VirtualMachine *vm() const;
2824
Target *target() const;
2925
IEngine *engine() const;
3026
Script *script() const;
@@ -35,13 +31,8 @@ class LIBSCRATCHCPP_EXPORT Thread
3531

3632
bool isFinished() const;
3733

38-
#ifdef USE_LLVM
3934
std::shared_ptr<Promise> promise() const;
4035
void setPromise(std::shared_ptr<Promise> promise);
41-
#else
42-
void promise();
43-
void resolvePromise();
44-
#endif
4536

4637
private:
4738
spimpl::unique_impl_ptr<ThreadPrivate> impl;

0 commit comments

Comments
 (0)