diff options
| author | jmoenig <jens@moenig.org> | 2013-06-18 18:43:15 +0200 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2013-06-18 18:43:15 +0200 |
| commit | acc40a6d2a06ab1fcfbd488030e091bd9215a1b2 (patch) | |
| tree | 57374704c2b908df2c1d8721f8a055a0f1378d1e /objects.js | |
| parent | a7ebff7c5bb4a79b3a64441b50957e523fe686e0 (diff) | |
| download | snap-acc40a6d2a06ab1fcfbd488030e091bd9215a1b2.tar.gz snap-acc40a6d2a06ab1fcfbd488030e091bd9215a1b2.zip | |
Code mapping
generating text code from blocks, first experimental iteration
Diffstat (limited to 'objects.js')
| -rw-r--r-- | objects.js | 45 |
1 files changed, 44 insertions, 1 deletions
@@ -123,7 +123,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2013-June-05'; +modules.objects = '2013-June-18'; var SpriteMorph; var StageMorph; @@ -1016,6 +1016,29 @@ SpriteMorph.prototype.initBlocks = function () { category: 'lists', spec: 'replace item %idx of %l with %s', defaults: [1, null, localize('thing')] + }, + + // Code mapping - experimental + doMapCode: { // experimental + type: 'command', + category: 'other', + spec: 'map %cmdRing to code %s' + }, + doMapStringCode: { // experimental + type: 'command', + category: 'other', + spec: 'map String to code %s', + defaults: ['<#1>'] + }, + doMapListCode: { // experimental + type: 'command', + category: 'other', + spec: 'map %codeListPart of %codeListKind to code %s' + }, + reportMappedCode: { // experimental + type: 'reporter', + category: 'other', + spec: 'code of %cmdRing' } }; }; @@ -1771,6 +1794,15 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push('='); + if (StageMorph.prototype.enableCodeMapping) { + blocks.push(block('doMapCode')); + blocks.push(block('doMapStringCode')); + blocks.push(block('doMapListCode')); + blocks.push('-'); + blocks.push(block('reportMappedCode')); + blocks.push('='); + } + button = new PushButtonMorph( null, function () { @@ -3189,6 +3221,8 @@ StageMorph.prototype.paletteTextColor = SpriteMorph.prototype.paletteTextColor; StageMorph.prototype.hiddenPrimitives = {}; +StageMorph.prototype.codeMappings = {}; +StageMorph.prototype.enableCodeMapping = false; // StageMorph instance creation @@ -4011,6 +4045,15 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push('='); + if (StageMorph.prototype.enableCodeMapping) { + blocks.push(block('doMapCode')); + blocks.push(block('doMapStringCode')); + blocks.push(block('doMapListCode')); + blocks.push('-'); + blocks.push(block('reportMappedCode')); + blocks.push('='); + } + button = new PushButtonMorph( null, function () { |
