Michael "Z" Goddard
f73dae828e
Add enableProfiling and disableProfiling to Runtime
2017-11-14 14:57:32 -05:00
Michael "Z" Goddard
516d4f6f30
Add Profiler events to Runtime, Sequencer and execute
2017-11-14 14:57:32 -05:00
Michael "Z" Goddard
a5b55a5128
Add runtime Profiler
...
Profile internal virtual machine performance down to which blocks take
how long.
2017-11-14 14:57:31 -05:00
DD
9048a9b9e7
Pipe through whether a monitor is sprite-specific
2017-11-14 12:20:24 -05:00
Karishma Chadha
386045f033
Some code cleanup.
2017-11-13 16:55:57 -05:00
Karishma Chadha
26d4a3a069
Refactoring representation of variable type.
2017-11-13 16:29:38 -05:00
Karishma Chadha
038a65b460
Finishing up lists.
2017-11-13 14:24:30 -05:00
Karishma Chadha
b18938963f
Fixing linting errors
2017-11-13 14:22:36 -05:00
Karishma Chadha
70959cc7f5
First cut at turning lists into typed variables
2017-11-09 17:19:34 -05:00
Andrew Sliwinski
3fa1599b90
Merge pull request #701 from Scimonster/variable-xml-names
...
Correctly deserialize HTML entities in block DOM
2017-11-08 08:03:56 -05:00
Ray Schamp
b07bbd4745
Merge pull request #765 from mzgoddard/execute-is-promise-deopt
...
Write src/engine/execute so it can be optimized
2017-11-07 12:19:58 -05:00
Ray Schamp
180e545b4e
Merge pull request #766 from mzgoddard/execute-handle-report-block-utility
...
Extract handleReport and BlockUtility from inside the execute function
2017-11-07 12:19:23 -05:00
Ray Schamp
5290570fc5
Merge pull request #758 from mzgoddard/done-threads-indexof
...
Constant time check if a thread is in doneThreads
2017-11-07 10:30:15 -05:00
Michael "Z" Goddard
bbe7981703
Extract blockUtility from execute to reduce allocations
...
blockUtility as an object literal inside execute creates 11 objects,
one for the object, and 10 for the function closures. As a separate
object and allocated once, setting its sequencer and thread members,
block functions can share the same util object. Extract blockUtility to
cut down on allocations.
2017-11-07 10:21:51 -05:00
Michael "Z" Goddard
78847de660
Extract handleReport and add arguments to prevent closure alloc
...
`handleReport` inside `src/engine/execute.js`'s `execute` method needs
to allocate a closure to be able to refer to the higher scoped
variables. `execute` is called frequently that this has a noticable
impact on memory allocation and later collection. Extract handleReport
and add arguments to prevent the allocation.
2017-11-07 10:21:51 -05:00
Andrew Sliwinski
1efc312c36
Merge pull request #767 from mzgoddard/docs-blocks-param-names
...
Replace duplicate documentation on getProcedureParamNames
2017-11-06 19:34:51 -05:00
Michael "Z" Goddard
888da915a5
Replace duplicate documentation on getProcedureParamNames
...
Replace the duplicate getProcedureDefintion documentation block above
getProcedureParamNames.
2017-11-06 17:28:34 -05:00
Michael "Z" Goddard
cd9004ce5b
Write src/engine/execute so it can be optimized
...
Testing with implicitly casted `value` and `value.then` is deoptimizing
isPromise, which deoptimizes execute. In this case deoptimizing means
that the JavaScript VM cannot compile the functions into a form that
can be run faster.
2017-11-06 15:54:22 -05:00
Eric Rosenbaum
0540640684
Merge pull request #754 from ericrosenbaum/feature/pen-block-icon
...
Extension block icons (including pen icon)
2017-11-06 10:02:23 -05:00
Michael "Z" Goddard
6d82c0f115
In place filter threads at end of stepThreads
...
Skip a large array allocation by filtering done threads in place with a
for loop.
2017-11-03 17:48:52 -04:00
Michael "Z" Goddard
4e24a3f380
Constant time check if thread is in doneThreads
...
Remove indexOf tests for thread existence in doneThreads. Maintain a
list of null and thread objects mirroring the index position of threads
that are done in runtime.threads. Filter out null values after
filtering out done threads from runtime.threads.
This has a small side effect that threads that normally became DONE and
were added to doneThreads before being removed or restarted will not be
in doneThreads in this version. Restarted threads (_restartThread) do
not appear in this version but new copies will be in Runtime
this.threads supporting glow and monitor updates. Removed threads
(_removeThread) do not appear in this version if they are removed after
they were seen as DONE by the prior version. Threads removed before
they are seen as DONE do not appear in doneThreads in the prior or this
version.
Threads that are removed before normally becoming DONE do not appear in
doneThreads in either case. Threads that are restarted before the loop
checks if the thread is done do not appear in doneThreads in either
case.
2017-11-03 17:46:50 -04:00
Paul Kaplan
c1ba902ebb
Use category info that has colors when building menu blocks
2017-11-03 13:50:50 -04:00
Eric Rosenbaum
2ac464c53e
Prepend icon to each extension block
2017-11-03 11:35:42 -04:00
Paul Kaplan
18398d010b
Add hideFromPalette flag for hiding legacy blocks
2017-11-01 11:30:15 -04:00
Paul Kaplan
d126f799d8
Prevent imported local variables from being duplicated on the stage.
2017-10-25 11:17:29 -04:00
Chris Willis-Ford
c4e79c9732
Merge pull request #713 from cwillisf/fix-extension-hats
...
Fix extension hats
2017-10-13 16:03:51 -07:00
Chris Willis-Ford
a8ae7bc5b4
Merge pull request #700 from cwillisf/extension-menus
...
Extensions: implement drop-down menus
2017-10-13 09:49:42 -07:00
Chris Willis-Ford
7051ccfd69
Merge pull request #687 from cwillisf/builtin-extensions
...
Builtin extensions
2017-10-13 09:48:56 -07:00
Christopher Willis-Ford
96fa7315d5
Don't overwrite hat block's fields
...
Due to a typo (I believe) we were overwriting a horizontal hat block's
fields list when collecting hat block inputs. Now we collect inputs into
a temporary object in this case.
2017-10-13 01:46:35 -07:00
Christopher Willis-Ford
309f02542f
Throw if extension tries to build a dynamic menu
...
Dynamic menus are not yet supported for extension menus, though they are
part of the extension spec. This change provides more thorough feedback
if an extension tries to register an unsupported dynamic menu.
2017-10-11 11:41:03 -07:00
Paul Kaplan
f09c4d0bb9
Merge pull request #691 from paulkaplan/say-think
...
Add say/think functionality to looks blocks
2017-10-11 14:24:10 -04:00
Paul Kaplan
fa2db053a7
Fix copy paste error on targetWasRemoved
2017-10-11 14:19:15 -04:00
Paul Kaplan
e8c5bbbf80
Fix tests and make chain more resilient
2017-10-10 12:19:27 -04:00
Scimonster
7afb17df7f
Correctly deserialize HTML entities in block DOM
...
E.g. in variable names
2017-10-09 01:19:55 +03:00
Christopher Willis-Ford
2f9796c163
Fix escapeHtml
error caused by rebase
2017-10-06 23:44:27 -07:00
Christopher Willis-Ford
67c788ec8d
Extensions: fix Boolean inputs
2017-10-06 23:33:33 -07:00
Christopher Willis-Ford
c1681e54d5
Implement drop-down menus for extension blocks
...
Also, add `ANGLE` argument type (like `NUMBER` but adds an angle picker)
2017-10-06 23:33:33 -07:00
Paul Kaplan
b0870518a4
Changing parsing of custom procedures for new style
2017-10-06 16:26:19 -04:00
Paul Kaplan
14600d7893
Update looks implementation
2017-10-06 13:43:07 -04:00
Christopher Willis-Ford
7297341c51
Fixups from code review
...
- Remove WeDo 2 extension from the runtime's default block packages list
- The WeDo 2.0 extension now calls its own `connect` method on startup
I also renamed `EXTENSION_NAME` to `EXTENSION_ID` for consistency with
the rest of the extension system.
2017-10-06 09:55:19 -07:00
Christopher Willis-Ford
dd20e09774
Extensions: escape HTML entities in default values
...
This prevents generation of invalid XML due to characters like '<' or
'>' in fields' default values. Unfortunately the value comes back in its
escaped form, so there's still more work to be done.
2017-10-04 13:00:45 -07:00
Christopher Willis-Ford
6757fb6de9
Convert pen blocks into an "internal" extension
2017-10-04 12:54:30 -07:00
Paul Kaplan
e4830dfe51
Merge pull request #686 from paulkaplan/fix-extension-labels
...
Remove label generation for extensions
2017-10-04 15:37:06 -04:00
Paul Kaplan
0358d6c0c3
Remove label generation for extensions
2017-10-04 15:02:09 -04:00
Christopher Willis-Ford
99b868c0f0
Explain when it's OK to omit <field> element
...
Also, alphabetize the `ArgumentType` and `BlockType` enums.
2017-10-02 15:29:32 -07:00
Christopher Willis-Ford
06252e020b
Extensions: add support for color-picker arguments
2017-09-27 00:02:53 -04:00
Chris Willis-Ford
6087b5346c
Merge pull request #675 from cwillisf/feature/extensions
...
Feature/extensions
2017-09-14 13:34:18 -07:00
Paul Kaplan
0f04c99e67
Merge pull request #676 from paulkaplan/duplicate
...
Add sprite duplication method
2017-09-13 11:57:13 -04:00
Paul Kaplan
b68b874067
Add sprite duplication method
2017-09-07 11:51:21 -04:00
Christopher Willis-Ford
635c7966eb
Fix tests: don't require('scratch-blocks')
2017-09-06 01:24:24 -06:00
Christopher Willis-Ford
799d61ac98
Cleanup
2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
d99c11ef91
Fix extension conditional blocks' appearance
...
The JSON generated for conditional blocks had slightly incorrect
structure for its `argsN` items and was missing some necessary
`messageN` items.
2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
e7c727977a
Adjust for LLK/scratch-gui#655 & code review
...
- Move extension from this repository into LLK/scratch-gui
- Rename `EXTENSION_WAS_ADDED` event to `EXTENSION_ADDED`
2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
d43749d675
WIP for demo
2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
aaa7784d39
Add methods to fetch scratch-blocks XML and JSON
2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
403adb743c
Track extension blocks in the Runtime
2017-09-06 00:57:03 -06:00
Ray Schamp
32bc087bba
Fix remaining lint issues
2017-08-26 13:24:10 -04:00
Ray Schamp
5113876588
Pass with --fix
2017-08-26 13:24:10 -04:00
Andrew Sliwinski
d1af3ef808
Merge pull request #562 from bigeyex/feature/fix-deleted-clone-sequence-order
...
Fix the next thread is skipped after clone deleted
2017-08-23 09:51:38 -04:00
DD Liu
a48efe681e
tests
2017-07-31 17:57:51 -04:00
DD Liu
cc1678fa9e
Also run monitor blocks every frame
2017-07-28 14:38:26 -04:00
DD Liu
2aef75bc11
Merge branch 'develop' into timerBlock
2017-07-28 11:35:47 -04:00
DD Liu
3722aefb17
fix greater than hat block click activation, and also event activation which was only on half the time
2017-07-12 15:46:23 -04:00
DD Liu
01db5da8ce
fix value
2017-07-11 13:08:18 -04:00
DD Liu
4b1307bb11
fix test
2017-07-11 11:51:47 -04:00
DD Liu
7f1f9079e3
support rename variable
2017-07-10 18:29:25 -04:00
Paul Kaplan
6fa49b1e7a
Merge pull request #629 from marisaleung/develop
...
ChangeBlock uses id's of variable instead of name.
2017-06-30 08:10:55 -04:00
Chris Willis-Ford
47fc38fd9a
Merge pull request #619 from cwillisf/clone-custom-state
...
Clone custom state
2017-06-27 22:37:30 -07:00
marisaleung
22f87e32f8
ChangeBlock uses id's of variable instead of name.
2017-06-27 16:28:37 -07:00
marisaleung
875ccf5b88
Updated variables and var_fire event listener.
2017-06-23 09:57:01 -07:00
Christopher Willis-Ford
06d5994a32
Use targetWasCreated
event to clone pen state
...
Remove explicit cloning of `_customState` in favor of smarter,
state-specific cloning.
2017-06-16 14:22:51 -07:00
Christopher Willis-Ford
04871e24d6
Move RenderedTarget.runtime into Target
...
Some code in `Target` was already assuming a `runtime` property was
available, so this change just makes it official.
2017-06-16 13:16:13 -07:00
Chris Willis-Ford
d41997b58b
Merge pull request #556 from cwillisf/wedo2-blocks
...
Add WeDo 2.0 blocks
2017-06-07 09:57:36 -07:00
Ray Schamp
adcd225598
Merge pull request #584 from rschamp/nit/no-useless-call
...
Fix no-useless-call todo
2017-06-01 09:48:58 -04:00
DD Liu
d3d82bae69
Merge pull request #574 from fsih/immutableState
...
Only send update monitor events when changes happen
2017-05-30 12:38:09 -04:00
DD Liu
55f677702a
add missing file
2017-05-30 10:05:13 -04:00
Paul Kaplan
51928bac65
Merge pull request #581 from paulkaplan/feature/variable-persistence
...
Add variable creation and variable serialization
2017-05-30 09:26:37 -04:00
DD Liu
809760b954
Merge branch 'develop' into immutableState
2017-05-26 13:50:50 -04:00
Paul Kaplan
3e9dfde43f
Merge pull request #576 from paulkaplan/feature/monitor-labels
...
Send monitor opcode and block params instead of fixed label/categories
2017-05-26 11:07:58 -04:00
Paul Kaplan
77cc01a38a
Add variable creation and variable serialization
2017-05-25 11:44:49 -04:00
Christopher Willis-Ford
2625529ebe
Create WeDo 2.0 device communication classes
2017-05-24 16:40:55 -07:00
Chris Willis-Ford
3970883e45
Merge pull request #549 from cwillisf/device-manager-client
...
Device manager client
2017-05-24 14:43:28 -07:00
DD Liu
18282fc1d0
remove get for records
2017-05-24 16:33:22 -04:00
DD Liu
2867b5c331
add record file
2017-05-24 15:43:12 -04:00
DD Liu
1902848ea4
Switch to ordered maps of monitor records for monitor state
2017-05-24 15:42:29 -04:00
Paul Kaplan
df9230a0ff
Make helper private
2017-05-23 09:55:42 -04:00
DD Liu
acdc783f27
emit immutable
2017-05-22 17:31:53 -04:00
Paul Kaplan
5973e2d305
Add reporting for block params
2017-05-22 15:18:48 -04:00
Paul Kaplan
817ea47e32
Remove XY from monitor reporting
2017-05-22 14:40:07 -04:00
Paul Kaplan
144a0b349d
Change monitor reporting from category and label to opcode
2017-05-22 13:38:29 -04:00
DD Liu
48c51ab2ec
switch to nested immutables state
2017-05-19 17:28:00 -04:00
DD Liu
9645a513b1
Only send monitor update on change
2017-05-19 12:28:05 -04:00
DD Liu
adc60001ee
Merge branch 'develop' into updateMonitorsAction
2017-05-18 16:50:34 -04:00
Paul Kaplan
2c4361b830
Fix refreshTargets race condition
2017-05-16 09:20:52 -04:00
Ray Schamp
548aa6dd70
Fix no-useless-call todo
...
The linter is correct that `devObject[func].call(devObject, args)` is unnecessary because it's equivalent to `devObject[func](args)`.
@tmickel probably either meant to allow passing an array of arguments to be applied, or to call the function with the provided argument. Since we probably want to be able to use multi-argument functions, use `apply` and fix the one place that uses `ioQuery` with an argument.
2017-05-15 21:11:38 -07:00
DD Liu
f1208720f6
restore things lost in bad merge
2017-05-15 16:25:34 -04:00
DD Liu
65d998f473
attach issue to todo
2017-05-15 10:47:36 -04:00
DD Liu
dcdb806b57
fix merge more
2017-05-15 10:45:20 -04:00
DD Liu
4cfedc8d9d
fix merge conflicts
2017-05-15 10:18:48 -04:00
DD Liu
9060a35350
Merge branch 'develop' into updateMonitorsAction
2017-05-15 10:16:12 -04:00
DD Liu
6ee1e6614c
Remove leftover instances of MONITORS_ADDED and MONITORS_REMOVED, change updateMonitor to requestUpdateMonitor, update some todos with tracking numbers.
2017-05-15 10:12:25 -04:00
Ray Schamp
20337b53f2
Stop emitting SPRITE_INFO_REPORT
...
Instead, set the `_refreshTargets` flag, and emit a full target list at the end of the step.
2017-05-12 11:42:22 -04:00
Wang Yu
6ec231db9d
Fix the next thread is skipped after clone deleted
...
Problem:
When a clone is deleted, its thread is removed from the thread
list; but the index "i" in the execution for-loop will still +1,
making the next thread skipped.
Changes:
Added a flag "isKilled" on a thread;
Set the flag when a thread is removed from the thread list;
reduce the "i" counter if the thread of the current loop is removed.
2017-05-12 14:01:37 +08:00
DD Liu
7a1b3eccd0
fix Object.values is not a function test
2017-05-11 17:28:48 -04:00
DD Liu
2a7f3edda6
Fix some issues: 1. Monitors not running anymore if you change categories 2. Visual reports not showing 3. threads acquiring properties of old thread when restarting thread
2017-05-11 17:12:19 -04:00
DD Liu
6b774c58f5
Update some comments
2017-05-11 15:23:11 -04:00
DD Liu
7841d44ccf
Move the block.isMonitored below the block is undefined check
2017-05-11 10:33:46 -04:00
DD Liu
1ea69dd504
Rename functions to be less wordy
2017-05-11 10:20:33 -04:00
DD Liu
b2e0a632e3
add add monitor action
2017-05-10 17:00:08 -04:00
DD Liu
b1355c6b0b
Fire remove monitors VM event
2017-05-10 15:47:06 -04:00
DD Liu
4687fe41fe
don't show green flag when monitor running
2017-05-10 14:06:02 -04:00
DD Liu
4ae1321252
indicate show visual report or update monitor on the thread
2017-05-09 17:34:13 -04:00
DD Liu
35a208d1d3
make it possible for VM to emit update monitors action
2017-05-09 12:10:11 -04:00
DD Liu
26a5098347
don't show visual report when monitor is running
2017-05-08 16:51:45 -04:00
DD Liu
706e112082
Add a block container for monitors that will run in the sequencer
2017-05-08 15:45:55 -04:00
Christopher Willis-Ford
f3c6be2881
Add an I/O device to represent the Device Manager
2017-04-28 13:40:13 -07:00
john
e91865fc21
the right quots is mission in blockToXML
...
the right quote is mission in blockToXML, and it will result in the following code execution errors
vm.on('workspaceUpdate', function (data) {
workspace.clear();
var dom = Blockly.Xml.textToDom(data.xml);
Blockly.Xml.domToWorkspace(dom, workspace);
});
2017-04-21 16:36:33 +08:00
Ray Schamp
d2343e3601
Fix up some auto-converted weirdness
2017-04-19 17:36:33 -04:00
Ray Schamp
a4f095db5e
Use ES6 style classes
2017-04-17 19:42:48 -04:00
Ray Schamp
4455b0694f
Fix remaining no-var and no-use-before-define's
2017-04-17 17:15:19 -04:00
Ray Schamp
e01c4ae108
Pass with --fix
2017-04-17 15:10:04 -04:00
Chris Willis-Ford
a4aa3810ae
Merge pull request #462 from griffpatch/optimise/reduceGetBlockCalls
...
Optimise reducegetblockcalls
2017-04-03 13:00:05 -04:00
griffpatch
c754cc7cf8
Remove line break
2017-03-22 09:11:53 +00:00
griffpatch
220d854f28
Merge remote-tracking branch 'refs/remotes/LLK/develop' into optimise/reduceGetBlockCalls
...
# Conflicts:
# src/engine/execute.js
2017-03-22 08:58:01 +00:00
griffpatch
25429b1192
Tidy up commit and revert direct member access
2017-03-22 08:48:30 +00:00
griffpatch
a5ce0f60cf
Merge remote-tracking branch 'refs/remotes/LLK/develop' into optimise/reduceGetBlockCalls
2017-03-22 07:56:04 +00:00
Christopher Willis-Ford
c23e9c6bf8
Load projects & costumes through scratch-storage
...
This also sets up the framework to load sounds through scratch-storage,
to be finished in a later change.
2017-03-09 11:25:55 -08:00
Ray Schamp
d0cd9cd897
Add methods for dragging and dropping sprites
...
* Add `getTargetIdForDrawableId` to translate between renderer picks and VM targets
* Add `startDrag` to stop sprite motion while dragging
* Add `stopDrag` to return sprite motion after dragging
2017-03-03 09:43:31 -05:00
Andrew Sliwinski
7042bdb45c
Merge pull request #472 from griffpatch/bug/escapeFromConditionalBranches
...
Bug - escapeFromConditionalBranches
2017-03-01 16:42:30 -05:00
Chris Willis-Ford
a56db95aba
Merge pull request #446 from magmaboat/hasownproperty
...
Perform hasOwnProperty validation
2017-02-22 13:55:54 -08:00
griffpatch
c5eb8ece16
Handle actual looping cases
...
And it starts to get a little less elegant :/
Wondering if this should not be handled better in another part of the
codebase?
We don't want to be duplicating existing code stepping functionality
locally at the end of the promise script really... What do you think?
2017-02-20 09:40:32 +00:00
griffpatch
362a231279
bug - escape from conditional branches
...
Execution bug: can't escape from conditional branches that end with a
Promise-resolution-terminating command block (see #464 )
2017-02-20 08:20:21 +00:00
griffpatch
a141bfb1b9
Fix lint issues
2017-02-16 10:54:17 +00:00
Christopher Willis-Ford
18107cde7b
Reverse target iteration in allScriptsDo
...
The `allStacksAndOwnersDo` function in Scratch 2.0 runtime iterates
targets in reverse and projects sometimes rely on that for correct
initialization. If, for example, each sprite runs a "go back 999 layers"
or "go to front" block as its first action, the order of execution will
determine the ordering of the layers.
This change makes Scratch 3.0 match the Scratch 2.0 execution order.
2017-02-13 14:45:29 -08:00
griffpatch
ea59f8cd66
Reduce calls to getBlock
2017-02-11 14:26:23 +00:00
Magmaboat
85eee4f18e
Perform hasOwnProperty validation
2017-02-09 21:12:47 -05:00
Andrew Sliwinski
d650e5393e
Merge pull request #439 from griffpatch/bug/StopThisScript
...
Implement "Stop this script" function
2017-02-09 08:10:00 -05:00
griffpatch
276ae82769
Fixes Case Insensitive Broadcast Bug
...
Broadcasts are case sensitive #433
2017-02-08 10:05:48 +00:00
griffpatch
9cb595312e
Implement "Stop this script" function
...
Existing implementation incorrectly terminates the entire thread.
See: http://llk.github.io/scratch-vm/#144142535
2017-02-08 09:44:10 +00:00
Ray Schamp
727fcc7875
Lint for eslint-config-scratch@3
2017-02-01 16:27:55 -05:00
Andrew Sliwinski
c2a488a197
Merge pull request #408 from griffpatch/optimisation/avoid-negative-index-lookups
...
Optimisation - Avoid negative index lookups #407
2017-01-30 15:06:02 -05:00
Andrew Sliwinski
249c0d6dca
Merge pull request #409 from griffpatch/optimisation/remove-redundant-lookups
...
Optimisation - Remove redunant lookups
2017-01-30 15:04:42 -05:00
griffpatch
fbf2c0c345
Optimisation - Recycle Stack Frame for cosecutive blocks
...
This saves popping, destroying, recreating, and pushing the stack frame,
and then reassigning the warp mode attribute for every block to block
step in the execution.
2017-01-28 17:06:07 +00:00
griffpatch
76c9c993f2
Optimisation - Remove redunant lookups
...
It's surprising how much time it takes to do an object member lookup, so
reducing these is a great idea.
2017-01-28 16:33:20 +00:00
griffpatch
bd9159b9fb
More negative index checks
2017-01-28 14:39:22 +00:00
griffpatch
a25e117412
optimisation/avoid negative index lookups #407
...
Run-time Optimisation
The thread.stackFrames array is accessed all the time to retrieve the
'parent' stack frame. This is done using as index of [this.stack.length
- 1]. However, a lot of the time this evaluated to [-1]. Although this
results in null, which is fine, to get to this javascript actually
defers from a numeric array lookup to an object lookup using the string
"-1". This is roughly 100 times slower to compute and so a simple catch
for negative indexes is well worth the extra check.
2017-01-28 14:38:13 +00:00
griffpatch
c6a872ef4a
Fix whitespace issues
2017-01-28 14:11:48 +00:00
griffpatch
5f100129b6
Fix for ending warp bug
...
When popping down the stack frame it is assumed that you keep using the
previous warp state rather than looking at the warp state of the level
you just popped out to. This causes the loss of screen updates if the
warping block was the last statement in a loop as the loop does not obey
it's 'non warp' status.
2017-01-28 14:03:29 +00:00
Christopher Willis-Ford
88cc50aa18
Code review: more docs, move constants, clone util
...
Changes include:
- Added missing JSDoc for items in `scratch3_pen.js` and `target.js`.
- Moved constants used by `Scratch3PenBlocks` into the class.
- Created a constant for minimum and maximum pen size.
- Added `util/clone.js` to host cloning functionality.
- Pen blocks now check for the renderer before trying to use it.
- The pen integration test covers all blocks, though `clear`, `stamp`,
and `pen down` will skip some of their functionality when there is no
renderer.
2017-01-20 11:26:18 -08:00
Christopher Willis-Ford
369c02b5d5
Implement pen blocks
...
These blocks implement pen features as found in Scratch 2.0
Supporting changes include:
- `Target` is now an event emitter
- `RenderedTarget` now emits an event when it moves
- `Target` can now store arbitrary "extra" data, called "custom state"
in the code, using a `Target`'s `setCustomState` and `getCustomState`
methods. This is used to store per-target pen state without requiring
`Target` or `RenderedTarget` to know anything about the pen.
- `Cast` can now cast to an RGB color object.
- `Color` now has functions to convert between RGB and HSV, constants
for for black & white, and a `mixRgb` function to lerp between two
colors.
2017-01-19 11:51:22 -08:00
Eric Rosenbaum
dc9126e067
Merge pull request #373 from ericrosenbaum/sound
...
Integrate audio engine
2017-01-06 16:28:09 -05:00
Eric Rosenbaum
9980f4da3f
lint
2017-01-06 16:13:43 -05:00
Eric Rosenbaum
c0d57b4b6b
separate out main audioengine from audioplayer for each clone
2017-01-04 18:37:55 -05:00
Andrew Sliwinski
5daaaa4438
Merge pull request #362 from thisandagain/bugfix/coverage
...
Add integration test coverage
2017-01-03 09:38:14 -05:00
Andrew Sliwinski
4709cae4b7
Basic integration (end-to-end) testing for default project
2016-12-23 10:39:19 -05:00
Andrew Sliwinski
48721dd336
If not hat fields are not found, check inputs before continuing. Resolves GH-360
2016-12-23 09:38:18 -05:00
Eric Rosenbaum
f2793a1d59
Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound
...
# Conflicts:
# package.json
# src/engine/runtime.js
# src/sprites/clone.js
2016-12-21 15:29:57 -05:00
Ray Schamp
e9da046969
Report full sprite info in targetsUpdate
...
We need more than just the name for the initial render, so send everything consistent with sprite info reports.
2016-12-07 17:11:08 -05:00
Ray Schamp
adaf2df743
Emit sprite info report for all sprites
...
This allows costume data to reach listeners even when the sprite isn't the editing target.
Filter out non-editing target reports in the playground to match previous behavior.
2016-11-30 13:21:00 -05:00
Ray Schamp
ce17fdbd30
Include costume data in sprite info reports
...
Also emit the report on all costume changes
2016-11-30 13:19:49 -05:00
Ray Schamp
d00cdd6b2c
Account for done threads on threadCount update
...
Also rename inactiveThreads -> doneThreads, since this describes them better. They are the threads that have completed in the step.
2016-11-28 10:49:05 -05:00
Ray Schamp
0003b294cb
Lint
2016-11-24 10:36:30 -05:00
Ray Schamp
55ac7e269c
Add PROJECT_RUN_START/STOP events
...
These events signal when any threads are running or when all threads have stopped running. This maps to whether the green flag or the stop button should be illuminated in the GUI.
2016-11-23 15:47:49 -05:00
Ray Schamp
2ff719f2ba
Fix consistency of existing emits
2016-11-23 15:43:05 -05:00
Tim Mickel
4deee071b2
Don't copy threads in step; stable restartThread ( #331 )
2016-11-10 15:05:49 -05:00
Eric Rosenbaum
6dadaba117
onStopAll function for stop button
2016-10-27 16:28:39 -04:00
Tim Mickel
56ef01745f
Implement sprite info emitting and posting ( #320 )
2016-10-26 13:27:12 -04:00
Tim Mickel
1dc4aaa2d7
Remove rAF usage and inline into _step ( #318 )
2016-10-26 11:32:15 -04:00
Ray Schamp
659014b45f
Fix typo
2016-10-24 14:07:38 -04:00
Ray Schamp
d2a0e6fa2d
Disable no-useless-call in case of behavior change
2016-10-24 13:01:57 -04:00
Ray Schamp
22bf947ddb
Revert no-lonely-if
2016-10-24 13:01:41 -04:00
Ray Schamp
04d7f4f019
Use consistent function declaration style
2016-10-24 11:49:34 -04:00
Ray Schamp
63cfa4229a
Fix space-infix-ops
...
http://eslint.org/docs/rules/space-infix-ops
2016-10-24 11:19:07 -04:00
Ray Schamp
7712b2902f
Fix quote-props
2016-10-24 11:02:19 -04:00
Ray Schamp
14a2dbc50f
Revert no-lonely-if
2016-10-24 10:28:31 -04:00
Ray Schamp
73edb65c4d
Replace console with minilog
2016-10-23 22:20:30 -04:00
Ray Schamp
f6c0064235
All linting other than console statements
2016-10-23 22:20:29 -04:00
Ray Schamp
68ed110b49
Pass with eslint --fix
...
Resolved whitespace issues, e.g., space-before-function-paren and key-spacing
2016-10-23 12:41:45 -04:00
Tim Mickel
3d57c2e74c
Drop single-stepping and pause modes ( #294 )
2016-10-20 11:42:16 -04:00
Tim Mickel
e49f076fa1
Interpreter fixes, enhancements, features ( #280 )
...
* Thread stepping rework; interp.redraw equivalent
* Add turbo mode and pause mode
* Yielding behavior to match Scratch 2.0
* Implement warp-mode procedure threads
* Add check for recursive call
* Inline wait block timer
* Revert to setInterval and always drawing
* Restore yielding in glide
* 30TPS compatibility mode
* 5-call count recursion limit
* Removing dead primitive code
* To simplify, access runtime.threads inline in `stepThreads`.
* Warp mode/timer fixes; recursive check fixes; clean-up
* Add basic single-stepping
* Add single-stepping speed slider
* Allow yielding threads to run in single-stepping
* Restore inactive threads tracking for block glows
* Add clock pausing during pause mode
* Documentation and clean-up throughout
* Don't look for block glows in `thread.topBlock`.
* Add null check for block glows; rename `_updateScriptGlows` to reflect block glowing
* Use the current executed block for glow, instead of stack
* Add more comments to `stepToProcedure`, and re-arrange to match 2.0
* Tweak to Blocks.prototype.getTopLevelScript
* Revert previous
* Fix threads array to be resilient to changes during `stepThreads`
* Restore inactive threads filtering
* Fix typo in "procedure"
* !! instead of == true
2016-10-17 23:23:16 -04:00
Eric Rosenbaum
7bd0142deb
Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound
...
# Conflicts:
# playground/index.html
2016-10-17 17:13:43 -04:00
Ray Schamp
5615583fb2
Lint
2016-10-17 13:54:27 -04:00
Ray Schamp
bd95c1461d
Add VM.clear method
...
Use it before loading projects so targets don't accumulate when multiple projects are loaded on the same instance.
Move check to see if the clone is the original clone onto the block implementation so all clones can be removed.
Fixes #274
2016-10-17 13:43:38 -04:00
Tim Mickel
3bfd755e60
Complete implementation of stop block ( #271 )
...
* "Other scripts in stage" sb2
* Complete implementation of "stop" block
2016-10-13 23:00:46 -04:00
Tim Mickel
c45b420115
Fix check for existing hat threads ( #269 )
2016-10-13 22:14:19 -04:00
Tim Mickel
1e86d48a31
Clicking blocks in the toolbox ( #267 )
2016-10-13 17:15:49 -04:00
Tim Mickel
8c654bbe60
Procedure blocks ( #264 )
2016-10-13 13:11:26 -04:00
Eric Rosenbaum
0024b209bd
Merge remote-tracking branch 'LLK/develop' into develop
2016-10-11 13:47:24 -04:00
Eric Rosenbaum
ed650ba487
Merge remote-tracking branch 'LLK/develop' into develop
2016-10-05 17:16:13 -04:00
Liam
5871672551
Implement "go to" block ( #238 )
...
* Implement "go to" block
* Add a missing semicolon
My text editor doesn't automatically insert them and I'm not used to using
semicolons so much. :(
* Implement go-to-random
* Clean up the go-to-random code a bit
* Add rounding to _random_ picks
2016-10-04 18:19:52 -04:00
Tim Mickel
0a66c62f6a
Mutations in block representation; an unfeatured procedure call ( #212 )
...
* Add scratch3_procedures and no-op for defnoreturn
* Add mutation adapter to parse mutations in CREATE/CHANGE events
* Add mutation-to-XML
* Update spec map for Blockly procedure names
* Placeholder for procedure special cases
* Basic stepping to procedures
* Remove extra case
* Validation for changeBlock
2016-10-03 17:43:24 -04:00
Eric Rosenbaum
7c91565408
Merge branch 'develop' of https://github.com/LLK/scratch-vm into develop
2016-09-27 18:12:20 -04:00
Tim Mickel
a118d50056
Variables and lists ( #187 )
...
* Import lists and variables from SB2
* Switch to Variable and List objects
* Add Clone.lookupOrCreateVariable, Clone.getVariable, Clone.setVariable
* Add (get, set, change) variable blocks.
* Copy variables and lists on clone instantiation
* Move variable options closer to blocks
* Add list primitives
* Move variable and lists storage to `Target` instead of `Clone`
* Move _computeIndex to a Cast function
* Rename `getList` -> `getListAsString`
* Renames renames
* Remove extra check in Cast.isNaN
2016-09-21 16:38:33 -04:00
Tim Mickel
aa5e8d2648
Clear graphic effects on green flag ( #199 )
2016-09-21 16:31:07 -04:00
Ray Schamp
4e547556a8
Use attachRenderer rather than the constructor
...
This makes the renderer optional as well as making the order of instantiation flexible.
2016-09-20 15:09:21 -04:00
Ray Schamp
499ba5235c
Scope renderer to instance
...
This allows usage without global scope to attach a renderer to the VM. It also provides the ability to have multiple VMs/renderers to be used at once.
2016-09-20 02:52:33 -04:00
Tim Mickel
9744bcbb70
Clones ( #150 )
...
* Provide property to Clone to distinguish "original" clones
* Provide method to clone a clone's properties
* Don't report clones in the UI target list
* Add target info to Thread
* Allow hats to skip clones (for green flag)
* Green flag skips clones
* Implement "create clone" and hat
* Pass the runtime to sprites and clones (for start hats)
* Clone disposal; trigger hats after drawable initializes.
* Separate stop threads for target; fix handling of stop button
* Remove extraneous `skipClones` property
* Add global clone limit
* Don't allow a non-clone to delete itself.
* Rename `cloneClone` -> `makeClone`
* Variable updates in runtime.js
* Synchronous drawable initialization (until we put it back to promises)
2016-09-15 19:37:12 -04:00
Eric Rosenbaum
8872f663a4
Merge remote-tracking branch 'LLK/develop' into develop
...
# Conflicts:
# playground/index.html
# playground/playground.js
# src/engine/execute.js
# src/engine/runtime.js
# src/index.js
# src/sprites/clone.js
2016-09-15 16:58:41 -04:00
Tim Mickel
8987330853
Cleanly handle deleting running scripts ( #162 )
...
* Cleanly handle deleting running scripts
* Turn off glow request on retire thread; add null check
2016-09-15 13:51:40 -04:00
Eric Rosenbaum
e19c1942c3
Merge remote-tracking branch 'LLK/develop' into develop
...
# Conflicts:
# src/index.js
# src/sprites/clone.js
# src/worker.js
2016-09-13 18:09:43 -04:00
Tim Mickel
6b08b95b97
Escape field values for XML-unsafe characters ( #177 )
...
* Escape field values for XML-unsafe characters
* String equality check ===
2016-09-13 17:51:17 -04:00
Tim Mickel
833c5ed313
When clicked hats ( #156 )
2016-09-12 17:16:10 -04:00
Tim Mickel
bbea1af5a3
Better shadow evaluation ( #160 )
...
* Better shadow evaluation
* Audit and improve casting for all primitives
* Force repeat times to int
* Remove colorPicker shadow menu
2016-09-12 13:14:16 -04:00
Tim Mickel
5df0acc895
Better glows ( #152 )
...
* Strip out old script glowing in thread management
* Add new tracking mechanism for glowing scripts
* Track parents and use them to determine script glows
* Use top-block for a thread if there's nothing on the stack
* Remove `console.log`
2016-09-08 09:40:53 -04:00
Tim Mickel
797f844de3
Stage, costumes, backdrops ( #149 )
...
* Add `Clone.prototype.getCostumeIndexByName`, keep in range
* Add basic costume primitives from Scratch 2.0
* Add costume getter block
* Add properties and methods for distinguishing stage and sprites-vs-clones
* Add backdrop-related looks blocks
* Fix up "switch to backdrop" to be working
* Costume/backdrop reporters are 1-indexed
* Fire "when backdrop switched" hats
* Cut cloning helpers for a separate PR
* Disable many blocks on the stage
* Refactor into _setCostumeOrBackdrop; implement switch backdrop and wait
* Fire hats even when backdrop unchanged
2016-09-08 09:40:27 -04:00
Tim Mickel
14feb64005
Create a new input if one doesn't exist ( #148 )
...
* Create a new input if one doesn't exist
* Add regression tests for move-into-empty and obscuring shadows via move
2016-09-08 09:40:01 -04:00
Eric Rosenbaum
6d21890338
Merge remote-tracking branch 'LLK/develop' into develop
2016-09-06 12:55:19 -04:00
Tim Mickel
9a8b68643a
Shadow improvements ( #135 )
...
* Always add `next` to block representation
* Add `shadow` property to inputs, to maintain obscured shadows
* Create obscured shadows in SB2 import
* Add XML import of obscured shadows
* Alias SB2 shadow inputs to block inputs
* Add shadow to inputs on "delete inputs" test
* Add a small test to ensure obscured shadows are preserved
* Add more obscured shadow tests
2016-09-06 10:55:52 -04:00
dekrain
7caf8e588a
More hats ( #143 )
...
* Key pressed hat
* Tabs -> Spaces
* Oops
* Edge activate
* Fix hat
Phew...
* I forgot to change it also here
:/ :/ :\
* Minor fixes for TravisCi
* Minor docs
* Line length
2016-09-03 16:33:45 -04:00
Tim Mickel
e831866789
Keyboard events, "key is down" reporter ( #117 )
...
* Keyboard events, "key is down" reporter
* Update comment about inputs
* Simplify/generalize keyMap into a keys-pressed list
* Cast values passed to scratchKeyToKeyCode appropriately.
* Cut unspaced key values
* Fix lint from merge commit
2016-09-02 11:23:09 -04:00
Tim Mickel
86f136dd10
Merge pull request #115 from tmickel/feature/2.0-loader
...
Start of a 2.0 project loader
2016-09-02 11:16:35 -04:00
Tim Mickel
23d9999a9f
Add runtime.getTargetById
helper
2016-08-31 12:18:24 -04:00
Tim Mickel
08f48c5b30
Always start runtime with an empty target list.
2016-08-31 12:03:41 -04:00
Tim Mickel
ad82a5cb74
Add naming mechanism for targets/clones
2016-08-31 11:50:10 -04:00
Tim Mickel
2c6722b958
Add unique ID for Targets
2016-08-31 11:39:57 -04:00
Tim Mickel
b1a3026ea1
Blockly XML encoding for Blocks
object
...
Provide two functions, `toXML` and `blockToXML`, which can be used to generate workspaces based on the VM representation of the blocks.
2016-08-31 11:38:45 -04:00
Tim Mickel
c58bda1839
Record coordinate changes in block representation
2016-08-31 11:34:29 -04:00
Tim Mickel
05a5369d7b
Switch Blockly listener to normal function (not closure/generated)
2016-08-31 11:34:17 -04:00
Tim Mickel
aa70c1bc3b
Add shadow, x, y properties to block adapter
2016-08-31 11:32:59 -04:00
Tim Mickel
bdc95cffc0
Rename trigger->activate/start
2016-08-29 10:26:26 -04:00
Tim Mickel
1098a06985
Various renames for hat opcodes/top blocks, allScriptsDo
2016-08-29 10:18:49 -04:00
Tim Mickel
3ccfdf3df0
Use hasOwnProperty
in getIsHat
/getIsEdgeTriggeredHat
2016-08-29 10:03:21 -04:00
Tim Mickel
40c90bbcc7
Add isActiveThread
and simplify broadcast-and-wait accordingly
2016-08-29 10:01:31 -04:00
Tim Mickel
64b82f4dc2
Switch back j->i
2016-08-29 09:52:34 -04:00
Tim Mickel
29887e24c9
Simplify execute
hat check.
...
In case a reporter has side-effects, we'd probably like to run hat predicates even if there is no next block.
2016-08-24 11:04:23 -04:00
Tim Mickel
4f2cccf279
Fix issue when broadcasting in a when-broadcast
2016-08-23 18:37:03 -04:00
Tim Mickel
b4cf64009f
General-purpose hat implementation
2016-08-23 18:12:32 -04:00
Tim Mickel
39fdbaf983
Add atStackTop helper to Thread
2016-08-23 18:12:19 -04:00
Tim Mickel
43f3b59f7c
Add retireThread
to seqeuencer
2016-08-23 15:53:34 -04:00
Tim Mickel
94e389c8fb
Refactor script glowing into its own runtime function
2016-08-23 15:47:21 -04:00
Eric Rosenbaum
d121a4c6fa
Merge remote-tracking branch 'LLK/develop' into develop
...
# Conflicts:
# src/engine/runtime.js
2016-08-16 16:41:36 -04:00
Tim Mickel
aebcfde492
Add VM "I/O devices", clock, mouse as demo
2016-08-15 21:37:36 -04:00
Tim Mickel
4faaf1b685
Rename stacks
to scripts
...
Further pushing toward removing ambiguity of what "stack" means in the codebase.
2016-08-11 11:11:27 -04:00
Tim Mickel
7780b25c46
Project wide rename substack -> branch
2016-08-10 11:43:49 -04:00
Eric Rosenbaum
951d7771f3
tonejs synth for play note blocks
2016-08-09 15:40:50 -04:00
Andrew Sliwinski
32b1d4ec61
Remove memoizee dependency and usage in adapter. Resolves GH-2
2016-08-08 17:07:50 -04:00
Tim Mickel
1f19d7a209
Only visually report when an actual value was returned
2016-07-07 19:44:26 -04:00
Tim Mickel
9c6dca8131
Add visual reporting of top-level reporter execution
2016-07-07 19:42:38 -04:00
Tim Mickel
d4353458ff
Don't quit loop when a thread is yielding
2016-07-06 14:16:44 -04:00
Tim Mickel
0ae0ea5f22
Run threads for 60fps
2016-07-01 16:30:33 -04:00
Tim Mickel
660029010d
Feed in requestAnimationFrame events to VM
...
Not sure exactly how to use these yet, but it seems helpful to have them in there.
2016-07-01 11:52:43 -04:00
Tim Mickel
ad30fa8059
Temporarily remove per-block glow
2016-07-01 11:27:01 -04:00
Tim Mickel
dda4fc8332
Yield frame on an empty substack
2016-07-01 11:24:06 -04:00
Tim Mickel
de6ba08866
Add single-frame yield mode
2016-07-01 10:44:43 -04:00
Tim Mickel
bb5acd1ef4
Fix merge issue in execute.js
2016-06-30 19:01:19 -04:00
Tim Mickel
1eaed6fff3
Implement graphic effects and size blocks
2016-06-30 18:59:47 -04:00
Tim Mickel
19da0b0032
Add renderer demo using scratch-render-webgl
2016-06-30 18:59:47 -04:00
Tim Mickel
809528abdc
Straw-man implementation of targets/sprites/clones
2016-06-30 18:59:17 -04:00
Tim Mickel
1c24770f8c
Remove debug calls from execute
2016-06-30 18:56:31 -04:00
Tim Mickel
ec4567aa8a
Simplify logic for Thread status
2016-06-30 18:56:31 -04:00
Tim Mickel
ab6e0d3839
Remove YieldTimers, unused WeDo blocks
2016-06-30 18:56:31 -04:00
Tim Mickel
6daee9a70e
Remove VM-locking yield mode per discussion
2016-06-30 18:56:23 -04:00
Tim Mickel
9a7ab57f6f
Always yield thread when a promise is returned.
2016-06-30 18:56:23 -04:00
Tim Mickel
9881ee76b9
Deal with promise rejection also.
2016-06-30 18:56:23 -04:00
Tim Mickel
57057bfffc
Remove unused require to fix build
2016-06-30 18:56:23 -04:00
Tim Mickel
d72cc55c11
Example that uses promises instead of util.report
2016-06-30 18:56:23 -04:00
Tim Mickel
09b9c506a9
Check for blocking case in stepToReporter
2016-06-30 18:56:23 -04:00
Tim Mickel
405ad1044e
getBlockingThread_ returns null when none available.
2016-06-30 18:56:23 -04:00
Tim Mickel
d44b806b4f
Add blocking yield mode
2016-06-30 18:56:23 -04:00
Tim Mickel
c63747e61b
Move stepping logic for reporters to sequencer
2016-06-30 18:56:23 -04:00
Tim Mickel
e56c6e6980
Rename primitiveReturnValue
-> primitiveReportedValue
2016-06-30 18:56:23 -04:00
Tim Mickel
e83cfa6049
Add comment and clear currentStackFrame.reported
2016-06-30 18:56:23 -04:00
Tim Mickel
9d9749681b
Comment and else
for reporter finishes right away
2016-06-30 18:56:23 -04:00
Tim Mickel
b21c9edf04
Commenting improvements
2016-06-30 18:56:23 -04:00
Tim Mickel
173f0615d3
Refactor: always push reports to the stack frame
2016-06-30 18:56:23 -04:00
Tim Mickel
6181bcd5cb
Refactor Thread.peekParentStackFrame
2016-06-30 18:56:23 -04:00
Tim Mickel
bed3e28c02
Simplifications of execute
ordering
...
and always cache returned reporter values in currentStackFrame.reported.
2016-06-30 18:56:23 -04:00
Tim Mickel
d15c93af05
Keep "waiting reporter name" on the stack frame.
...
Also add highlighting for inputs.
2016-06-30 18:56:23 -04:00
Tim Mickel
97f7571c6f
Prototype implementation of yielding reporters
2016-06-30 18:56:23 -04:00
Tim Mickel
190208b620
Clean up yield-timers: support multiple, move logic to Threads.
2016-06-30 18:56:23 -04:00
Tim Mickel
652cc8a31c
Fix references to window
2016-06-21 14:29:40 -04:00
Tim Mickel
695d0bd7fd
Merge pull request #80 from tmickel/bugfix/empty-fields
...
Handling empty fields
2016-06-17 11:46:36 -04:00
Tim Mickel
7427fe4ff3
Add fix for adapter
to deal with empty fields
2016-06-14 18:14:04 -04:00
Tim Mickel
056fb76492
Remove try/catch in execution - fix #75
2016-06-13 11:23:39 -04:00
Tim Mickel
a58fa43572
Add reset to numYieldingThreads
and comment about YieldTimers
2016-06-10 13:38:35 -04:00
Tim Mickel
e9eb7c6e57
Remove leftover console.groupEnd
s in execute
2016-06-10 13:34:07 -04:00
Tim Mickel
0bf9ab59a1
Add implementation for ifElse
2016-06-10 10:40:15 -04:00
Tim Mickel
506e9c32be
Don't attempt to glow a block that isn't known in the VM
2016-06-10 08:48:39 -04:00
Tim Mickel
7cc0c00da6
Correctly deal with empty substacks.
...
The stack needs to be popped in this situation.
2016-06-10 08:47:54 -04:00
Tim Mickel
559a2a0fab
Remove redundant piece of code
...
The stack is pushed in after the thread finishes (`proceedThread`).
2016-06-10 08:41:44 -04:00
Tim Mickel
526a260101
Simplify execution by removing nextBlock
...
Everything is managed by the stack, including what the execute() function does.
2016-06-09 17:08:30 -04:00
Tim Mickel
d52938c255
Bind thread.yield passed to primitive to actual thread
2016-06-09 15:06:24 -04:00
Tim Mickel
88402ee68c
Move popStack to inside execute
2016-06-09 14:45:54 -04:00
Tim Mickel
b0441e2ef5
Implement stub for number and add blocks
2016-06-09 14:29:07 -04:00
Tim Mickel
a987d9d9cc
Only include field value in execute.argValues
2016-06-09 14:27:11 -04:00
Tim Mickel
c21700380f
Pull sequencer-related callbacks out of execute
2016-06-09 14:23:34 -04:00
Tim Mickel
9df470255e
Add helpers to thread object
2016-06-09 14:22:58 -04:00
Tim Mickel
1d16a97115
Recursive evaluation for block arguments
2016-06-09 13:28:50 -04:00
Tim Mickel
c4517a451b
Add isInput
execution property to avoid proceeding the thread
2016-06-09 13:28:06 -04:00
Tim Mickel
6e5ebcf6df
Split execution into separate function and file
2016-06-09 13:27:30 -04:00
Tim Mickel
3898fe1c45
Instrument blocks.js with getters for fields and inputs
2016-06-09 13:26:07 -04:00
Tim Mickel
bd7f3245a2
Move scratch3 blocks into separate packages.
2016-06-09 11:45:58 -04:00
Tim Mickel
b9bd037963
Fixing eslint JSDoc from merge
2016-06-08 17:25:26 -04:00
Tim Mickel
42d03db28b
Merge branch 'develop' into feature/eslint-jsdoc
...
# Conflicts:
# .eslintrc
# src/index.js
2016-06-08 17:23:41 -04:00
Tim Mickel
d17ffbb99b
Merge pull request #60 from tmickel/feature/vm-playground-execution
...
Instrument VM and playground for better execution debugging
2016-06-08 17:15:36 -04:00
Tim Mickel
1f1a4941f3
Add .eslintrc rule to check JSDoc syntax
...
And fix the broken syntax rules
2016-06-08 16:57:08 -04:00
Tim Mickel
7a42e9ae68
Move blockListener to blocks.js; combine flyout listener
2016-06-08 13:44:09 -04:00
Tim Mickel
8fa29bc6de
Spacing fix in blocks.js
2016-06-08 13:27:01 -04:00
Tim Mickel
c1e30cf2ee
Add sequencer-level debug console logs
2016-06-07 21:05:32 -04:00
Tim Mickel
5767e05d56
Add block-by-block feedback to the VM playground
2016-06-07 20:59:34 -04:00
Tim Mickel
2339c5e710
Additional tests for invalid adapter
inputs
2016-06-07 12:01:47 -04:00
Tim Mickel
3b4a00ce46
Add check for null substackNum
, fix numbering
2016-06-07 11:32:29 -04:00
Tim Mickel
fd95d3045d
Fix property check of topLevel
in createBlock
2016-06-06 15:58:54 -04:00
Tim Mickel
f63e261892
Remove breaking check for blockId
2016-06-06 15:58:40 -04:00
Tim Mickel
dbb31462ad
Extend getSubstack to support multiple substacks
2016-06-06 15:31:14 -04:00
Tim Mickel
9be33089a8
Refactor block management into a separate module.
2016-06-06 15:29:34 -04:00
Tim Mickel
25c3a38c16
Allow top-level creation of shadow blocks in adapter
2016-06-06 14:57:58 -04:00
Tim Mickel
aa152fd604
Rewrite of moveBlock to better reflect Blockly
2016-06-06 14:55:01 -04:00
Tim Mickel
214daa8087
Always unset topLevel
in deleteStack_
...
Blocks may have topLevel set even if they are not present in this.stacks
2016-06-06 14:54:32 -04:00
Tim Mickel
18e4228399
Update runtime's handling of delete for new blocks structure
2016-06-06 14:53:59 -04:00
Tim Mickel
285c2792ef
Only add to stacks if topLevel is true in CREATE
2016-06-06 14:53:42 -04:00
Tim Mickel
9fef9d7edd
Fix up adapter's domToBlock
2016-06-06 14:44:51 -04:00
Tim Mickel
0dfc72893c
Update Runtime createBlock for new structure; _addStack helper.
2016-06-06 14:12:43 -04:00
Tim Mickel
b28c50e6a5
Rewrite of adapter to support trees of blocks, inputs
2016-06-06 14:09:27 -04:00
Tim Mickel
dd53b86b8c
Reduce amount of time for executing blocks
2016-05-05 13:09:37 -04:00
Tim Mickel
5c03167ec3
Hack helper for distance sensors
2016-05-03 17:39:02 -04:00
Tim Mickel
659c9b274a
Add motorStop patch to stopAll
2016-05-03 17:18:28 -04:00
Tim Mickel
79b50e5172
Remove block glows from sequencer
2016-05-03 17:18:21 -04:00
Tim Mickel
833f40cfe5
Allow pushing threads that are not on this.stacks
...
For flyout running
2016-05-03 15:58:20 -04:00
Tim Mickel
9363432456
Hacked implementation of broadcasts
2016-05-03 14:57:10 -04:00
Tim Mickel
5f5fe6fafd
Fix to check if block still exists
2016-05-03 14:35:02 -04:00
Tim Mickel
8facd64376
Hack for getting argument values
2016-05-03 14:25:12 -04:00
Tim Mickel
90a5982ff9
Fix Runtime.stopAll
...
Removing threads as we were looping was causing not all of them to be hit.
2016-05-03 14:11:37 -04:00
Tim Mickel
5b834667eb
Merge pull request #19 from tmickel/feature/repeats
...
Stacks management, stack frames, repeat, forever
2016-05-03 14:04:50 -04:00
Tim Mickel
548d95b765
Fix attempt to pop from the stack
...
-Keeps it in newThreads
-Update thread status to STATUS_RUNNING to keep it going
2016-05-03 13:53:52 -04:00
Tim Mickel
852b11519a
Fix for empty substacks
2016-05-03 13:45:22 -04:00
Tim Mickel
add3e9dec9
Strip blockExecutionData
2016-05-03 13:31:03 -04:00
Tim Mickel
379b2dec79
Stack management, stack frames, forever and repeat
2016-05-03 13:28:24 -04:00
Christopher Willis-Ford
e1109e8ca6
Improve error exception report for Android Monitor
...
Android Monitor doesn't support passing multiple arguments to
`console.error`, so this change instead builds a single string for the
report.
2016-05-03 09:48:12 -07:00
Tim Mickel
4c6f08f665
Add mechanism for per-block metadata
2016-05-03 11:45:25 -04:00
Tim Mickel
4de24cfc30
Implement thread status, YieldTimer, block glow, wait
2016-05-03 11:26:28 -04:00
Tim Mickel
3eeccf1970
Update nextBlock to be set before primitive call
2016-05-03 11:26:15 -04:00
Tim Mickel
6bbeb2d0fe
Shuffle moveBlock to allow case where e.oldParent !== undefined
2016-05-02 22:31:00 -04:00
Christopher Willis-Ford
751ca97733
Fix eslint errors
...
This includes adding a line to `.eslintrc` to allow `console.log`,
`console.warn`, and `console.error`.
2016-05-02 11:56:52 -07:00
Christopher Willis-Ford
4a3276d026
Improve block primitive lookup and execution
...
Slightly simplify export of block primitives from a block package.
Catch and report exceptions from block functions.
2016-05-02 11:31:37 -07:00
Christopher Willis-Ford
27c06ce476
Add framework for block execution
...
The runtime now stores a mapping of opcode to function.
The `wedo2` and `scratch3` packages are currently stubs.
2016-05-02 11:31:25 -07:00
Tim Mickel
79f6725ff3
Add stack glow and infrastructure for block glow
2016-05-02 13:09:38 -04:00
Tim Mickel
773f2e1bbc
Improve JSDoc on Thread
2016-05-02 13:05:48 -04:00
Tim Mickel
b92a73da0f
Add green flag and stop button functions
2016-04-29 17:58:31 -04:00
Tim Mickel
b46ee0113f
Return if a thread is toggled off
2016-04-29 17:39:18 -04:00
Tim Mickel
7d9f75b14d
updating _removeThread to actually match docs
2016-04-29 17:36:09 -04:00
Tim Mickel
96123f870f
Fix _removeThread documentation and add toggleStack
2016-04-29 17:31:04 -04:00
Tim Mickel
2b2187014f
fix createBlock
2016-04-29 16:55:13 -04:00
Tim Mickel
11c6537f42
Add listener for new blocks that doesn't add to stacks
2016-04-29 16:49:08 -04:00
Tim Mickel
b3e981ba74
Updating timer require
2016-04-26 17:06:24 -04:00
Tim Mickel
92dab97b84
Add thread management and stepping to runtime
2016-04-26 16:50:49 -04:00
Tim Mickel
dbfb3356c6
Move threads list to the Runtime
2016-04-26 15:51:14 -04:00
Tim Mickel
b6186a44f3
Add basics for the sequencer and threads
2016-04-26 15:00:45 -04:00
Tim Mickel
33340125e4
Adding JSDocs, threads, sequencer to runtime
2016-04-26 14:23:22 -04:00
Andrew Sliwinski
f1375ef44f
Delete unused primitives stub
2016-04-26 12:05:38 -04:00
Andrew Sliwinski
389d112729
All tests passing
2016-04-26 09:54:14 -04:00
Andrew Sliwinski
981b85e78f
AST create / change / move / delete from blockly
2016-04-26 09:49:52 -04:00
Andrew Sliwinski
53779220b7
WIP
2016-04-18 18:03:18 -04:00
Andrew Sliwinski
f9f47ed103
WIP
2016-04-18 17:20:30 -04:00