This commit is contained in:
Peli de Halleux 2015-04-26 21:26:25 -07:00
Родитель e588dbe0b6 ecabdf99c7
Коммит 0083768131
16 изменённых файлов: 191 добавлений и 166 удалений

Просмотреть файл

@ -167,6 +167,10 @@ mkSimpleTask('build/storage.js', [
'build/browser.d.ts',
'storage'
], "storage/refs.ts");
mkSimpleTask('build/embedded.js', [
'build/ast.d.ts',
'embedded'
], "embedded/refs.ts");
mkSimpleTask('build/ast.js', [
'build/rt.d.ts',
'ast'
@ -196,6 +200,7 @@ mkSimpleTask('build/editor.js', [
'build/storage.d.ts',
'build/libwab.d.ts',
'build/libcordova.d.ts',
'build/embedded.d.ts',
'intellitrain',
'editor'
], "editor/refs.ts");
@ -393,9 +398,9 @@ task('clean', [], function () {
desc('display info about installed tools')
task('info', [], { async: true }, function () {
var task = this;
if (process.env.TRAVIS) {
assert(process.env.TD_UPLOAD_KEY, "missing touchdevelop upload key TD_UPLOAD_KEY");
assert(process.env.TD_UPLOAD_KEY, "missing touchdevelop upload key TD_UPLOAD_KEY");
}
jake.exec([ 'tsc --version' ],
@ -418,16 +423,16 @@ task('upload', [ "build/client.js" ], { async : true }, function() {
var task = this;
var upload = function (buildVersion) {
console.log("[I] uploading v" + buildVersion)
var procs = [];
if (process.env.TD_UPLOAD_LITE_KEY) {
console.log("[I] uploading to lite")
procs.push('node build/client.js tdupload ' + process.env.TD_UPLOAD_LITE_KEY + ' ' + buildVersion + ' latest');
}
var uploadKey = process.env.TD_UPLOAD_KEY || "direct";
procs.push('node build/client.js tdupload ' + uploadKey + ' ' + buildVersion);
jake.exec(procs,
{ printStdout: true, printStderr: true },
function() { task.complete(); });
var procs = [];
if (process.env.TD_UPLOAD_LITE_KEY) {
console.log("[I] uploading to lite")
procs.push('node build/client.js tdupload ' + process.env.TD_UPLOAD_LITE_KEY + ' ' + buildVersion + ' latest');
}
var uploadKey = process.env.TD_UPLOAD_KEY || "direct";
procs.push('node build/client.js tdupload ' + uploadKey + ' ' + buildVersion);
jake.exec(procs,
{ printStdout: true, printStderr: true },
function() { task.complete(); });
};
if (!process.env.TRAVIS) {
upload(process.env.TD_UPLOAD_USER || process.env.USERNAME);

Просмотреть файл

@ -2079,7 +2079,7 @@ module TDev
*/
private compile() {
Microbit.compile(AST.Json.dump(Script)).then((cpp: string) => {
Embedded.compile(AST.Json.dump(Script)).then((cpp: string) => {
cpp = External.wrapCpp(cpp);
console.log(cpp);
Cloud.postUserInstalledCompileAsync(ScriptEditorWorldInfo.guid, cpp).then(json => {

Просмотреть файл

@ -1,10 +1,14 @@
///<reference path='../refs.ts'/>
///<reference path='refs.ts'/>
// The main driver for C++ compilation: for each program, loads the libraries it
// depends on, compiles said libraries, compiles the main program, and stitches
// the various part together.
module TDev {
import J = AST.Json
export module Microbit {
export module Embedded {
interface ResolvedLibrary {
isShim: boolean;

Просмотреть файл

@ -68,10 +68,10 @@ module TDev {
}
// This function modifies its argument by adding an extra [J.JLibrary]
// to its [decls] field that references the Microbit library.
function addMicrobitLibrary(app: J.JApp) {
// to its [decls] field that references the device's library.
function addDeviceLibrary(app: J.JApp) {
var lib = <AST.LibraryRef> AST.Parser.parseDecl(
'meta import microbit {'+
'meta import device {'+
' pub "hrgbjn"'+
'}'
);
@ -82,7 +82,7 @@ module TDev {
// Takes a [JApp] and runs its through various hoops to make sure
// everything is type-checked and resolved properly.
function roundtrip(a: J.JApp): Promise { // of J.JApp
addMicrobitLibrary(a);
addDeviceLibrary(a);
var text = J.serialize(a);
return AST.loadScriptAsync((id: string) => {
if (id == "")
@ -227,7 +227,7 @@ module TDev {
case Language.TouchDevelop:
// the guid is here only for testing; the real generation should be deterministic for best results
cpp = roundtrip(message1.text).then((a: J.JApp) => {
return Microbit.compile(a);
return Embedded.compile(a);
});
break;
}
@ -267,7 +267,7 @@ module TDev {
case MessageType.Upgrade:
var message2 = <Message_Upgrade> event.data;
var ast = message2.ast;
addMicrobitLibrary(ast);
addDeviceLibrary(ast);
console.log("Attempting to serialize", ast);
var text = J.serialize(ast);
console.log("Attempting to edit script text", text);

Просмотреть файл

@ -5,6 +5,7 @@
///<reference path='../build/storage.d.ts'/>
///<reference path='../build/libwab.d.ts'/>
///<reference path='../build/libcordova.d.ts'/>
///<reference path='../build/embedded.d.ts'/>
///<reference path='../typings/ace/ace.d.ts'/>
///<reference path='videoUtil.ts'/>
///<reference path='tipManager.ts'/>
@ -48,13 +49,9 @@
///<reference path='plugins.ts'/>
///<reference path='external.ts'/>
///<reference path='messages.ts'/>
///<reference path='embedded.ts'/>
///<reference path='../intellitrain/train.ts'/>
///<reference path='../intellitrain/astutil.ts'/>
///<reference path='../intellitrain/features.ts'/>
///<reference path='../intellitrain/output.ts'/>
///<reference path='../intellitrain/tokenize.ts'/>
///<reference path='microbit/helpers.ts'/>
///<reference path='microbit/main.ts'/>
///<reference path='microbit/visitor.ts'/>
///<reference path='microbit/emitter.ts'/>
///<reference path='microbit/lambda_lifter.ts'/>

7
embedded/README Normal file
Просмотреть файл

@ -0,0 +1,7 @@
The embedded target.
A series of transformation passes that convert a TouchDevelop script into a C++
program suitable for targeting embedded platforms. These are self-contained and
do not depend on the rest of the TouchDevelop codebase. There is a driver that
performs TouchDevelop-specific operations (e.g. load required libraries prior to
translating into C++); this driver is contained in [editor/embedded.ts].

Просмотреть файл

@ -1,8 +1,8 @@
///<reference path='../refs.ts'/>
///<reference path='refs.ts'/>
module TDev {
export module Microbit {
export module Embedded {
import J = AST.Json
import H = Helpers
@ -91,7 +91,7 @@ module TDev {
// the right number constant.
function translateArgsIfNeeded(call: string, args: J.JExpr[]) {
switch (call) {
case "microbit_button_pressed":
case "device_button_pressed":
if (isStringLiteral(args[0]) == "left")
return [mkNumberLiteral(1)];
else if (isStringLiteral(args[0]) == "right")
@ -294,7 +294,7 @@ module TDev {
var userFunctions = decls.map((d: J.JDecl) => {
if (d.nodeType == "action") {
return this.visit(e, d);
} else if (!(d.nodeType == "library" && d.name == "microbit")) {
} else if (!(d.nodeType == "library")) {
throw new Error("Untranslated declaration" + d);
}
return null;

Просмотреть файл

@ -1,8 +1,8 @@
///<reference path='../refs.ts'/>
///<reference path='refs.ts'/>
module TDev {
export module Microbit {
export module Embedded {
import J = AST.Json

Просмотреть файл

@ -1,8 +1,8 @@
///<reference path='../refs.ts'/>
///<reference path='refs.ts'/>
module TDev {
export module Microbit {
export module Embedded {
import J = AST.Json
import H = Helpers

5
embedded/refs.ts Normal file
Просмотреть файл

@ -0,0 +1,5 @@
///<reference path='../build/ast.d.ts'/>
///<reference path='helpers.ts'/>
///<reference path='visitor.ts'/>
///<reference path='emitter.ts'/>
///<reference path='lambda_lifter.ts'/>

Просмотреть файл

@ -1,8 +1,8 @@
///<reference path='../refs.ts'/>
///<reference path='refs.ts'/>
module TDev {
export module Microbit {
export module Embedded {
import J = AST.Json

Просмотреть файл

@ -586,7 +586,7 @@ module TDev.Cloud {
HTML.showProgressNotification(lf("starting compilation"));
Util.httpPostJsonAsync(getPrivateApiUrl("me/installed/" + guid + "/compile"), {
config: "microbit",
config: "embedded",
source: cppSource
})
.then(resp => {

Просмотреть файл

@ -1,10 +1,10 @@
'use strict';
goog.provide('Blockly.Blocks.microbit');
goog.provide('Blockly.Blocks.device');
goog.require('Blockly.Blocks');
Blockly.Blocks['microbit_wait'] = {
Blockly.Blocks['device_wait'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(120);
@ -20,7 +20,7 @@ Blockly.Blocks['microbit_wait'] = {
};
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#xxv26z
Blockly.Blocks['microbit_event'] = {
Blockly.Blocks['device_event'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(120);
@ -38,7 +38,7 @@ Blockly.Blocks['microbit_event'] = {
}
};
Blockly.Blocks['microbit_set_led'] = {
Blockly.Blocks['device_set_led'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(120);
@ -57,7 +57,7 @@ Blockly.Blocks['microbit_set_led'] = {
}
};
Blockly.Blocks['microbit_button_pressed'] = {
Blockly.Blocks['device_button_pressed'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(210);
@ -75,7 +75,7 @@ Blockly.Blocks['microbit_button_pressed'] = {
// -----------------------------------------------------------------------------
// Blockly.Blocks['microbit_scroll_string'] = {
// Blockly.Blocks['device_scroll_string'] = {
// init: function() {
// this.setHelpUrl('http://www.example.com/');
// this.setColour(0);
@ -94,7 +94,7 @@ Blockly.Blocks['microbit_button_pressed'] = {
// };
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#83qc3o
Blockly.Blocks['microbit_set_eye'] = {
Blockly.Blocks['device_set_eye'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -115,7 +115,7 @@ Blockly.Blocks['microbit_set_eye'] = {
};
//https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#jgkr8y
Blockly.Blocks['microbit_eye_on'] = {
Blockly.Blocks['device_eye_on'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -130,7 +130,7 @@ Blockly.Blocks['microbit_eye_on'] = {
this.setTooltip('');
}
};
Blockly.Blocks['microbit_eye_off'] = {
Blockly.Blocks['device_eye_off'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -146,7 +146,7 @@ Blockly.Blocks['microbit_eye_off'] = {
}
};
Blockly.Blocks['microbit_toggle_eye'] = {
Blockly.Blocks['device_toggle_eye'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -163,7 +163,7 @@ Blockly.Blocks['microbit_toggle_eye'] = {
};
//https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#tmkc86
Blockly.Blocks['microbit_print_message'] = {
Blockly.Blocks['device_print_message'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -185,7 +185,7 @@ Blockly.Blocks['microbit_print_message'] = {
};
//https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#xiu9u7
Blockly.Blocks['microbit_scroll'] = {
Blockly.Blocks['device_scroll'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -202,7 +202,7 @@ Blockly.Blocks['microbit_scroll'] = {
};
//https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#nwf7c5
Blockly.Blocks['microbit_clear_display'] = {
Blockly.Blocks['device_clear_display'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -216,7 +216,7 @@ Blockly.Blocks['microbit_clear_display'] = {
};
//https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#rhpgfx
Blockly.Blocks['microbit_plot'] = {
Blockly.Blocks['device_plot'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -234,7 +234,7 @@ Blockly.Blocks['microbit_plot'] = {
this.setTooltip('');
}
};
Blockly.Blocks['microbit_unplot'] = {
Blockly.Blocks['device_unplot'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -254,7 +254,7 @@ Blockly.Blocks['microbit_unplot'] = {
};
//https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#jw5b4i
Blockly.Blocks['microbit_point'] = {
Blockly.Blocks['device_point'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -272,7 +272,7 @@ Blockly.Blocks['microbit_point'] = {
}
};
Blockly.Blocks['microbit_build_image'] = {
Blockly.Blocks['device_build_image'] = {
init: function()
{
this.setColour(160);
@ -287,7 +287,7 @@ Blockly.Blocks['microbit_build_image'] = {
}
};
Blockly.Blocks['microbit_build_big_image'] = {
Blockly.Blocks['device_build_big_image'] = {
init: function()
{
this.setColour(160);
@ -314,7 +314,7 @@ Blockly.Blocks['microbit_build_big_image'] = {
}
};
// Blockly.Blocks['microbit_show_image'] = {
// Blockly.Blocks['device_show_image'] = {
// init: function()
// {
// this.setColour(160);
@ -326,7 +326,7 @@ Blockly.Blocks['microbit_build_big_image'] = {
// }
// };
Blockly.Blocks['microbit_show_image_offset'] = {
Blockly.Blocks['device_show_image_offset'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -347,7 +347,7 @@ Blockly.Blocks['microbit_show_image_offset'] = {
}
};
Blockly.Blocks['microbit_scroll_image'] = {
Blockly.Blocks['device_scroll_image'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -368,7 +368,7 @@ Blockly.Blocks['microbit_scroll_image'] = {
}
};
Blockly.Blocks['microbit_get_image_point'] = {
Blockly.Blocks['device_get_image_point'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -391,7 +391,7 @@ Blockly.Blocks['microbit_get_image_point'] = {
}
};
Blockly.Blocks['microbit_set_image_point'] = {
Blockly.Blocks['device_set_image_point'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -420,7 +420,7 @@ Blockly.Blocks['microbit_set_image_point'] = {
};
Blockly.Blocks['microbit_make_StringImage'] = {
Blockly.Blocks['device_make_StringImage'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -435,7 +435,7 @@ Blockly.Blocks['microbit_make_StringImage'] = {
}
};
Blockly.Blocks['microbit_scroll_string_image'] = {
Blockly.Blocks['device_scroll_string_image'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -455,7 +455,7 @@ Blockly.Blocks['microbit_scroll_string_image'] = {
}
};
Blockly.Blocks['microbit_pause'] = {
Blockly.Blocks['device_pause'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -469,7 +469,7 @@ Blockly.Blocks['microbit_pause'] = {
}
};
Blockly.Blocks['microbit_forever'] = {
Blockly.Blocks['device_forever'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(120);
@ -483,7 +483,7 @@ Blockly.Blocks['microbit_forever'] = {
}
};
Blockly.Blocks['microbit_get_eye'] = {
Blockly.Blocks['device_get_eye'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(160);
@ -497,7 +497,7 @@ Blockly.Blocks['microbit_get_eye'] = {
}
};
Blockly.Blocks['microbit_logic_onoff_states'] = {
Blockly.Blocks['device_logic_onoff_states'] = {
init: function() {
var BOOLEANS =
[['on', 'ON'],
@ -509,7 +509,7 @@ Blockly.Blocks['microbit_logic_onoff_states'] = {
}
};
Blockly.Blocks['microbit_logic_button_states'] = {
Blockly.Blocks['device_logic_button_states'] = {
init: function() {
var BOOLEANS =
[['pressed', 'PRESSED'],
@ -521,7 +521,7 @@ Blockly.Blocks['microbit_logic_button_states'] = {
}
};
Blockly.Blocks['microbit_comment'] = {
Blockly.Blocks['device_comment'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(120);

Просмотреть файл

@ -5,11 +5,6 @@
// A compiler from Blocky to TouchDevelop //
///////////////////////////////////////////////////////////////////////////////
// TODO:
// - loops: repeat n times, repeat, forever, simplified for loop
// - logic: on/off
// - basic, led, images, input: adapt API
import J = TDev.AST.Json;
import B = Blockly;
@ -98,10 +93,10 @@ module Helpers {
return mkCall(name, mkTypeRef(librarySymbol), [librarySingleton]);
}
// Call function [name] from the standard microbit library with arguments
// Call function [name] from the standard device library with arguments
// [args].
export function stdCall(name: string, args: J.JExpr[]): J.JCall {
return mkCall(name, mkTypeRef("microbit"), [<J.JExpr> mkLibrary("microbit")].concat(args));
return mkCall(name, mkTypeRef("device"), [<J.JExpr> mkLibrary("device")].concat(args));
}
// Assumes its parameter [p] is in the [knownPropertyRefs] table.
@ -419,9 +414,9 @@ function compileExpression(e: Environment, b: B.Block): J.JExpr {
return compileVariableGet(e, b);
case "text":
return compileText(e, b);
case "microbit_button_pressed":
case "device_button_pressed":
return compileButtonPressed(e, b);
case "microbit_logic_onoff_states":
case "device_logic_onoff_states":
return compileOnOff(e, b);
case "procedures_callreturn":
return compileCall(e, <B.DefOrCallBlock> b);
@ -575,18 +570,21 @@ function compileComment(e: Environment, b: B.Block): J.JStmt {
return H.mkComment((<J.JStringLiteral> arg).value);
}
function compileEvent(e: Environment, b: B.Block): J.JStmt {
var bId = b.getInputTargetBlock("ID");
var bBody = b.getInputTargetBlock("HANDLER");
var id = compileExpression(e, bId);
var body = compileStatements(e, bBody);
function generateEvent(e: Environment, id: J.JExpr, body: J.JStmt[]): J.JStmt {
var def = H.mkDef("_body_", H.mkGTypeRef("Action"));
return H.mkInlineActions(
[ H.mkInlineAction(body, true, def) ],
H.mkExprHolder(
[ def ],
H.stdCall("on", [id])));
}
function compileEvent(e: Environment, b: B.Block): J.JStmt {
var bId = b.getInputTargetBlock("ID");
var bBody = b.getInputTargetBlock("HANDLER");
var id = compileExpression(e, bId);
var body = compileStatements(e, bBody);
return generateEvent(e, id, body);
}
function compileStatements(e: Environment, b: B.Block): J.JStmt[] {
@ -609,15 +607,15 @@ function compileStatements(e: Environment, b: B.Block): J.JStmt[] {
case 'variables_set':
var r = compileSetOrDef(e, b);
stmts.push(r.stmt);
// This function also return a possibly-extended environment.
// This function also returns a possibly-extended environment.
e = r.env;
break;
case 'microbit_comment':
case 'device_comment':
stmts.push(compileComment(e, b));
break;
case 'microbit_forever':
case 'device_forever':
stmts.push(compileForever(e, b));
break;
@ -629,23 +627,22 @@ function compileStatements(e: Environment, b: B.Block): J.JStmt[] {
stmts.push(compileControlsWhileUntil(e, b));
break;
case 'microbit_set_led':
case 'device_set_led':
stmts.push(compileStdBlock(e, b, "set led", ["id", "brightness"]));
break;
case 'microbit_wait':
case 'device_wait':
stmts.push(compileStdBlock(e, b, "busy wait ms", ["VAL"]));
break;
case 'microbit_scroll':
case 'device_scroll':
stmts.push(compileStdBlock(e, b, "scroll", ["ARG"]));
break;
case 'microbit_event':
case 'device_event':
stmts.push(compileEvent(e, b));
break;
default:
throw new Error(b.type + " is not a statement block or is not supported");
}
@ -678,13 +675,18 @@ interface CompileOptions {
description: string;
}
function compileWithEventIfNeeded(e: Environment, b: B.Block): J.JStmt {
if (b.type != "device_event") {
var id = H.mkStringLiteral("start");
var body = compileStatements(e, b);
return generateEvent(e, id, body);
}
}
function compileWorkspace(b: B.Workspace, options: CompileOptions): J.JApp {
var stmts: J.JStmt[] = [];
b.getTopBlocks(true).forEach((b: B.Block) => {
// TODO: wrap in "on event start" if outer block is not of type event.
// Each "on ..." event handler is compiled in its own empty environment.
// This is akin to a function definition.
stmts = stmts.concat(compileStatements(empty, b));
stmts.push(compileWithEventIfNeeded(empty, b));
});
var def: J.JLocalDef = H.mkDef("errno", H.mkTypeRef("Number"));

Просмотреть файл

@ -9,8 +9,8 @@
<!-- <script type="application/javascript" src="blockly/blockly_uncompressed.js"></script> -->
<!-- <script type="application/javascript" src="blockly/blocks_compressed.js"></script> -->
<!-- <script type="application/javascript" src="blockly/msg/js/en.js"></script> -->
<!-- Microbit-specific blocks -->
<script type="application/javascript" src="blocks-microbit.js"></script>
<!-- device-specific blocks -->
<script type="application/javascript" src="blocks-custom.js"></script>
<!-- Compiled version of blockly-main.ts -->
<script type="application/javascript" src="../blockly-main.js"></script>
<link rel="stylesheet" type="text/css" href="style.css" />
@ -53,38 +53,38 @@
<block type="text"></block>
<block type="math_number"></block>
<block type="math_number1"></block>
<block type="microbit_scroll">
<block type="device_scroll">
<value name="ARG">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
</block>
<block type="microbit_event">
<block type="device_event">
<value name="ID">
<block type="text">
<field name="TEXT">start</field>
</block>
</value>
</block>
<block type="microbit_wait">
<block type="device_wait">
<value name="VAL">
<block type="math_number">
<field name="NUM">100</field>
</block>
</value>
</block>
<!-- <block type="microbit_pause"> -->
<!-- <block type="device_pause"> -->
<!-- <value name="pause"> -->
<!-- <block type="math_number"> -->
<!-- <field name="NUM">100</field> -->
<!-- </block> -->
<!-- </value> -->
<!-- </block> -->
<!-- <block type="microbit_print_message"> -->
<!-- <block type="device_print_message"> -->
<!-- <value name="message"> -->
<!-- <block type="text"> -->
<!-- <field name="TEXT">BBC Bug</field> -->
<!-- <field name="TEXT">Hello world</field> -->
<!-- </block> -->
<!-- </value> -->
<!-- <value name="pausetime"> -->
@ -95,19 +95,19 @@
<!-- </block> -->
</category>
<category name="LED">
<block type="microbit_clear_display"></block>
<block type="microbit_set_led">
<block type="device_clear_display"></block>
<block type="device_set_led">
<value name="id">
<block type="math_number">
<field name="NUM">0</field>
</block>
</value>
<value name="brightness">
<block type="microbit_logic_onoff_states"></block>
<block type="device_logic_onoff_states"></block>
</value>
</block>
<!-- <block type="microbit_plot"> -->
<!-- <block type="device_plot"> -->
<!-- <value name="x"> -->
<!-- <block type="math_number"> -->
<!-- <field name="NUM">0</field> -->
@ -119,7 +119,7 @@
<!-- </block> -->
<!-- </value> -->
<!-- </block> -->
<!-- <block type="microbit_unplot"> -->
<!-- <block type="device_unplot"> -->
<!-- <value name="x"> -->
<!-- <block type="math_number"> -->
<!-- <field name="NUM">0</field> -->
@ -131,7 +131,7 @@
<!-- </block> -->
<!-- </value> -->
<!-- </block> -->
<!-- <block type="microbit_point"> -->
<!-- <block type="device_point"> -->
<!-- <value name="x"> -->
<!-- <block type="math_number"> -->
<!-- <field name="NUM">0</field> -->
@ -143,29 +143,29 @@
<!-- </block> -->
<!-- </value> -->
<!-- </block> -->
<!-- <block type="microbit_eye_on"></block> -->
<!-- <block type="microbit_eye_off"></block> -->
<!-- <block type="microbit_set_eye"></block> -->
<!-- <block type="microbit_toggle_eye"></block> -->
<!-- <block type="microbit_get_eye"></block> -->
<!-- <block type="device_eye_on"></block> -->
<!-- <block type="device_eye_off"></block> -->
<!-- <block type="device_set_eye"></block> -->
<!-- <block type="device_toggle_eye"></block> -->
<!-- <block type="device_get_eye"></block> -->
</category>
<category name="Images">
<block type="microbit_make_StringImage">
<block type="device_make_StringImage">
<value name="NAME">
<block type="text">
<field name="TEXT">BBC Bug</field>
<field name="TEXT">Hello world</field>
</block>
</value>
</block>
<block type="microbit_scroll_string_image">
<block type="device_scroll_string_image">
<value name="speed">
<block type="math_number">
<field name="NUM">100</field>
</block>
</value>
</block>
<!-- <block type="microbit_show_image"></block> -->
<block type="microbit_show_image_offset">
<!-- <block type="device_show_image"></block> -->
<block type="device_show_image_offset">
<value name="x">
<block type="math_number">
<field name="NUM">0</field>
@ -177,14 +177,14 @@
</block>
</value>
</block>
<!-- <block type="microbit_scroll_image"></block> -->
<block type="microbit_build_image"></block>
<block type="microbit_build_big_image"></block>
<!-- <block type="microbit_set_image_point"></block>
<block type="microbit_get_image_point"></block> -->
<!-- <block type="device_scroll_image"></block> -->
<block type="device_build_image"></block>
<block type="device_build_big_image"></block>
<!-- <block type="device_set_image_point"></block>
<block type="device_get_image_point"></block> -->
</category>
<category name="Input">
<block type="microbit_button_pressed"></block>
<block type="device_button_pressed"></block>
</category>
<category name="If">
<block type="controls_if"></block>
@ -221,14 +221,14 @@
</block>
</value>
</block>
<block type="microbit_forever"></block>
<block type="device_forever"></block>
</category>
<category name="Logic">
<block type="logic_compare"></block>
<block type="logic_operation"></block>
<block type="logic_negate"></block>
<block type="logic_boolean"></block>
<block type="microbit_logic_onoff_states"></block>
<block type="device_logic_onoff_states"></block>
</category>
<category name="Maths">
<block type="math_arithmetic"></block>
@ -238,7 +238,7 @@
<block type="variables_get"></block>
</category>
<category name="Comment">
<block type="microbit_comment">
<block type="device_comment">
<value name="comment">
<block type="text">
<field name="TEXT"></field>

Просмотреть файл

@ -19,7 +19,7 @@ div.calcButtonHelp {
.hubSectionHeader
{
font-family: "Segoe UI Light", "Segoe UI", "Segoe WP Light", "Segoe WP",
"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Sans-Serif;
"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Sans-Serif;
font-weight: 200;
}
@ -178,13 +178,13 @@ button.navItem[data-current^="yes"]
.navImg
{
width: 3.15em;
height: 3.15em;
/* border: 1px solid transparent; why? */
position: absolute;
width: 3.15em;
height: 3.15em;
/* border: 1px solid transparent; why? */
position: absolute;
padding: 0;
top: 0;
left: 0;
top: 0;
left: 0;
}
.navDiamond .svg,
@ -200,13 +200,13 @@ button.navItem[data-current^="yes"]
.navContent
{
position: absolute;
left: 4em;
top: 0;
/*margin-top: -5px;
margin-left: 62px;*/
white-space: nowrap;
overflow: hidden;
position: absolute;
left: 4em;
top: 0;
/*margin-top: -5px;
margin-left: 62px;*/
white-space: nowrap;
overflow: hidden;
}
.recordTypeDescription .navContent
{
@ -215,8 +215,8 @@ button.navItem[data-current^="yes"]
.smallDecl
{
font-size: 0.8em;
color: #666;
font-size: 0.8em;
color: #666;
display: inline;
}
@ -228,8 +228,8 @@ button.navItem[data-current^="yes"]
.navDescription
{
font-size: 0.8em;
color: #666;
font-size: 0.8em;
color: #666;
}
.recordTypeDescription .navDescription
@ -241,7 +241,7 @@ button.navItem[data-current^="yes"]
.navItem[data-current^="yes"] .navDescription
{
color: #ccc;
color: #ccc;
}
.navItem[data-current^="yes"] .navImg
@ -995,16 +995,16 @@ textarea.commentEdit {
.stmtEditorSide
{
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 38%;
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 38%;
}
.landscape .stmtEditorSide
{
background: white;
background: white;
}
@ -3467,7 +3467,7 @@ div.sdTabTileLabel {
.sdCmt .sdCmtNested
{
padding-left: 4em;
padding-left: 4em;
}
.phone .sdCmt {
@ -3849,15 +3849,15 @@ right:4.5em;
.hubTileSize2 img,
.hubTileSize1 img
{
width: 4em;
height: 4em;
width: 4em;
height: 4em;
}
.hubTileSize3 .svg,
.hubTileSize3 img
{
width: 11em;
height: 11em;
width: 11em;
height: 11em;
}
.hubDocTile {
@ -4507,6 +4507,11 @@ span.videoCaption
#btn-editorTutorialNext { right: 0.1em; top:0em; }
#btn-editorTutorialPrevious { left: 0.1em; top:0em; }
/* Try to roughly center the bolt icon in the compile button */
#btn-codeCompile svg {
margin-left: .3em;
}
.tutorialStars {
text-align:center;
}
@ -4758,17 +4763,17 @@ height: 2.2em;
}
.md-video-wrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.md-video-wrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.md-box {