// Do not edit this file; automatically generated by build.py. "use strict"; // Copyright 2012 Google Inc. Apache License 2.0 Blockly.Blocks.colour={};Blockly.Blocks.colour_picker={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_PICKER_HELPURL);this.setColour(20);this.appendDummyInput().appendField(new Blockly.FieldColour("#ff0000"),"COLOUR");this.setOutput(!0,"Colour");this.setTooltip(Blockly.Msg.COLOUR_PICKER_TOOLTIP)}}; Blockly.Blocks.colour_random={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_RANDOM_HELPURL);this.setColour(20);this.appendDummyInput().appendField(Blockly.Msg.COLOUR_RANDOM_TITLE);this.setOutput(!0,"Colour");this.setTooltip(Blockly.Msg.COLOUR_RANDOM_TOOLTIP)}}; Blockly.Blocks.colour_rgb={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_RGB_HELPURL);this.setColour(20);this.appendValueInput("RED").setCheck("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_TITLE).appendField(Blockly.Msg.COLOUR_RGB_RED);this.appendValueInput("GREEN").setCheck("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_GREEN);this.appendValueInput("BLUE").setCheck("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_BLUE); this.setOutput(!0,"Colour");this.setTooltip(Blockly.Msg.COLOUR_RGB_TOOLTIP)}}; Blockly.Blocks.colour_blend={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_BLEND_HELPURL);this.setColour(20);this.appendValueInput("COLOUR1").setCheck("Colour").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_BLEND_TITLE).appendField(Blockly.Msg.COLOUR_BLEND_COLOUR1);this.appendValueInput("COLOUR2").setCheck("Colour").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_BLEND_COLOUR2);this.appendValueInput("RATIO").setCheck("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_BLEND_RATIO);this.setOutput(!0, "Colour");this.setTooltip(Blockly.Msg.COLOUR_BLEND_TOOLTIP)}}; // Copyright 2012 Google Inc. Apache License 2.0 Blockly.Blocks.lists={};Blockly.Blocks.lists_create_empty={init:function(){this.setHelpUrl(Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL);this.setColour(260);this.setOutput(!0,"Array");this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);this.setTooltip(Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP)}}; Blockly.Blocks.lists_create_with={init:function(){this.setColour(260);this.appendValueInput("ADD0").appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH);this.appendValueInput("ADD1");this.appendValueInput("ADD2");this.setOutput(!0,"Array");this.setMutator(new Blockly.Mutator(["lists_create_with_item"]));this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP);this.itemCount_=3},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){for(var b= 0;b","LT"],["\u2265","LTE"],["<","GT"],["\u2264","GTE"]]:[["=","EQ"],["\u2260","NEQ"],["<","LT"],["\u2264","LTE"],[">","GT"],["\u2265","GTE"]];this.setColour(200);this.setOutput(!0,"Boolean");this.appendValueInput("A");this.appendValueInput("B").appendField(new Blockly.FieldDropdown(a),"OP");this.setInputsInline(!0);var b=this;this.setTooltip(function(){var a=b.getFieldValue("OP");return{EQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ, NEQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,LT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT,LTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE,GT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT,GTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE}[a]});this.tag=Blockly.Msg.TAG_LOGIC_COMPARE},onchange:Blockly.Blocks.requireInFunction}; Blockly.Blocks.logic_operation={init:function(){var a=[[Blockly.Msg.LOGIC_OPERATION_AND,"AND"],[Blockly.Msg.LOGIC_OPERATION_OR,"OR"]];this.setColour(200);this.setOutput(!0,"Boolean");this.appendValueInput("A");this.appendValueInput("B").appendField(new Blockly.FieldDropdown(a),"OP");this.setInputsInline(!0);var b=this;this.setTooltip(function(){var a=b.getFieldValue("OP");return{AND:Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND,OR:Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR}[a]});this.tag=Blockly.Msg.TAG_LOGIC_OPERATION}, onchange:Blockly.Blocks.requireInFunction}; Blockly.Blocks.logic_negate={init:function(){this.setColour(200);this.setOutput(!0,"Boolean");this.interpolateMsg(Blockly.Msg.LOGIC_NEGATE_TITLE,["BOOL",["Boolean","Variable","VAR_INT","VAR_UNINT","Number","NEGATIVE","INT"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setTooltip(Blockly.Msg.LOGIC_NEGATE_TOOLTIP);this.tag=Blockly.Msg.TAG_LOGIC_NEGATE},onchange:Blockly.Blocks.requireInFunction}; Blockly.Blocks.logic_boolean={init:function(){var a=[[Blockly.Msg.LOGIC_BOOLEAN_TRUE,"TRUE"],[Blockly.Msg.LOGIC_BOOLEAN_FALSE,"FALSE"]];this.setColour(200);this.setOutput(!0,"Boolean");this.appendDummyInput().appendField(new Blockly.FieldDropdown(a),"BOOL");this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP);this.tag=Blockly.Msg.TAG_LOGIC_BOOLEAN},onchange:Blockly.Blocks.requireInFunction}; Blockly.Blocks.logic_null={init:function(){this.setColour(200);this.setOutput(!0);this.appendDummyInput().appendField(Blockly.Msg.LOGIC_NULL);this.setTooltip(Blockly.Msg.LOGIC_NULL_TOOLTIP);this.tag=Blockly.Msg.TAG_LOGIC_NULL},onchange:Blockly.Blocks.requireInFunction}; Blockly.Blocks.logic_ternary={init:function(){this.setColour(200);this.appendValueInput("IF").appendField(Blockly.Msg.LOGIC_TERNARY_CONDITION);this.appendValueInput("THEN").appendField(Blockly.Msg.LOGIC_TERNARY_IF_TRUE);this.appendValueInput("ELSE").appendField(Blockly.Msg.LOGIC_TERNARY_IF_FALSE);this.setOutput(!0);this.setTooltip(Blockly.Msg.LOGIC_TERNARY_TOOLTIP);this.tag=Blockly.Msg.TAG_LOGIC_TERNARY},onchange:Blockly.Blocks.requireInFunction}; Blockly.Blocks.controls_switch={init:function(){this.setColour(200);this.appendValueInput("SWITCH").appendField(Blockly.Msg.CONTROLS_SWITCH);this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_SWITCH_DEFAULT);this.appendStatementInput("DEFAULT").appendField(Blockly.Msg.CONTROLS_SWITCH_DO);this.appendValueInput("CASE0").setCheck(["Number","INT","UNINT","NEGATIVE","CHAR"]).appendField(Blockly.Msg.CONTROLS_SWITCH_CASE);this.appendStatementInput("DO0").appendField(Blockly.Msg.CONTROLS_SWITCH_DO); this.setPreviousStatement(!0);this.setNextStatement(!0);this.setMutator(new Blockly.Mutator(["controls_switch_case"]));var a=this;this.tag=Blockly.Msg.TAG_LOGIC_SWITCH;this.setTooltip(function(){if(a.caseCount_)if(a.caseCount_){if(a.caseCount_)return Blockly.Msg.CONTROLS_SWITCH_TOOLTIP3;if(a.caseCount_)return Blockly.Msg.CONTROLS_SWITCH_TOOLTIP4}else return Blockly.Msg.CONTROLS_SWITCH_TOOLTIP2;else return Blockly.Msg.CONTROLS_SWITCH_TOOLTIP1;return""});this.caseCount_=0},mutationToDom:function(){if(!this.caseCount_)return null; var a=document.createElement("mutation");this.caseCount_&&a.setAttribute("case",this.caseCount_);return a},domToMutation:function(a){this.caseCount_=parseInt(a.getAttribute("case"),10);for(a=1;a<=this.caseCount_;a++)this.appendValueInput("CASE"+a).appendField(Blockly.Msg.CONTROLS_SWITCH_CASE),this.appendStatementInput("DO"+a).appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN)},decompose:function(a){var b=Blockly.Block.obtain(a,"controls_switch_switch");b.initSvg();for(var c=b.getInput("STACK").connection, d=1;d<=this.caseCount_;d++){var e=Blockly.Block.obtain(a,"controls_switch_case");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}return b},compose:function(a){for(var b=this.caseCount_;0c?this.setOutputType("PTR",a):this.changeOutput("Array")},setOutputType:Blockly.Blocks.variables_get.setOutputType}; Blockly.Blocks.variables_array_set={init:function(){this.setColour(48);this.appendDummyInput().appendField(Blockly.Msg.VARIABLES_SET_TITLE).appendField(new Blockly.FieldVariableArray(Blockly.Msg.SELECT_MENU,null,this),"VAR");this.appendValueInput("LENGTH_1").setCheck("Number INT NEGATIVE Variable VAR_INT VAR_UNINT DOUBLE VAR_FLOAT VAR_DOUBLE Aster".split(" "));this.appendValueInput("LENGTH_2").setCheck("Number INT NEGATIVE Variable VAR_INT VAR_UNINT DOUBLE VAR_FLOAT VAR_DOUBLE Aster".split(" ")); this.appendValueInput("VALUE").setCheck(null).appendField(Blockly.Msg.VARIABLES_SET_TAIL);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.VARIABLES_SET_TOOLTIP);this.contextMenuMsg_=Blockly.Msg.VARIABLES_SET_CREATE_GET;this.contextMenuType_="variables_array_set";this.tag=Blockly.Msg.TAG_VARIABLE_ARRAY_SET},getVars:function(){return[this.getFieldValue("VAR")]},getPos:function(){return this.getRelativeToSurfaceXY().y},renameVar:function(a, b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"VAR")},getIndices:Blockly.Blocks.variables_array_get.getIndices,initIdx:Blockly.Blocks.variables_array_get.initIdx,customContextMenu:Blockly.Blocks.variables_array_get.customContextMenu,getInputIdxLength:Blockly.Blocks.variables_array_get.getInputIdxLength,onchange:function(){Blockly.Blocks.requireInFunction(this);if(this.getFieldValue("VAR")){var a=this.getFieldValue("VAR"),b=Blockly.FieldDropdown.prototype.getTypefromVars(a, 0);a=Blockly.FieldVariableArray.getBlockIdxLength(a);var c=this.getInputIdxLength();this.getInput("VALUE")&&this.getInput("VALUE").connection.targetBlock()&&c--;a==c?Blockly.Blocks.setCheckVariable(this,b,"VALUE"):Blockly.Blocks.setCheckPointer(this,b,"VALUE")}}}; Blockly.Blocks.variables_array_declare={init:function(){var a=[[Blockly.Msg.VARIABLES_SET_TYPE_INT,"int"],[Blockly.Msg.VARIABLES_SET_TYPE_UNSIGNED_INT,"unsigned int"],[Blockly.Msg.VARIABLES_SET_TYPE_FLOAT,"float"],[Blockly.Msg.VARIABLES_SET_TYPE_DOUBLE,"double"],[Blockly.Msg.VARIABLES_SET_TYPE_CHAR,"char"],["uint8_t","uint8_t"],["uint32_t","uint32_t"]];this.setColour(48);var b=Blockly.Procedures.findLegalName(Blockly.Msg.VARIABLES_ARRAY_DECLARE_DEFAULT_NAME,this);this.varInputField=new Blockly.FieldTextInput(b,Blockly.Procedures.rename);this.interpolateMsg(Blockly.Msg.VARIABLES_ARRAY_DECLARE_TITLE+ " %1 "+Blockly.Msg.VARIABLES_DECLARE_NAME+" %2 "+Blockly.Msg.VARIABLES_ARRAY_DECLARE_LENGTH+" %3 %4 "+Blockly.Msg.VARIABLES_ARRAY_DECLARE_VALUE+" %5 ",["TYPES",new Blockly.FieldDropdown(a)],["VAR",this.varInputField],["LENGTH_1","Number INT Variable VAR_INT VAR_UNINT Aster Macro".split(" "),Blockly.ALIGN_RIGHT],["LENGTH_2","Number INT Variable VAR_INT VAR_UNINT Aster Macro".split(" "),Blockly.ALIGN_RIGHT],["VALUE",["Array_Initial"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setInputsInline(!0); this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.VARIABLES_DECLARE_TOOLTIP);this.contextMenuMsg_=Blockly.Msg.VARIABLES_SET_CREATE_GET;this.contextMenuType_="variables_array_get";this.tag=Blockly.Msg.TAG_VARIABLE_ARRAY_DECLARE;this.oldName=b},initVar:Blockly.Blocks.define_declare.initVar,getDist:function(){return"a"},getScope:Blockly.Blocks.variables_declare.getScope,getPos:function(){return this.getRelativeToSurfaceXY().y},getSpec:function(){var a=this.getIndices()[0], b=this.getIndices()[1],c=this.getIndices()[2];a*=1;b*=1;c*=1;if(0!=a&&0==b&&0==c)return[1,a];if(0!=a&&0!=b&&0==c)return[2,a,b];if(0!=a&&0!=b&&0!=c)return[3,a,b,c]},onchange:function(){var a=this.getFieldValue("VAR");if(this.oldName!=a){var b=this.getScope();b&&Blockly.Variables.renameVariablebyScope(this.oldName,a,b[0]);this.oldName=a}},getTypes:function(){return[this.getFieldValue("TYPES")]},getLength:function(){return[this.childBlocks_[0].getFieldValue("NUM")]}, getVars:function(){return[this.getFieldValue("VAR")]},getDeclare:function(){return[this.getFieldValue("VAR")]},renameVar:function(a,b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"VAR")},getIndices:Blockly.Blocks.variables_array_get.getIndices,customContextMenu:Blockly.Blocks.variables_array_get.customContextMenu}; Blockly.Blocks["variables_pointer_&"]={init:function(){this.setColour(25);this.interpolateMsg("& %1 ",["VALUE","Variable VAR_INT VAR_UNINT VAR_FLOAT VAR_DOUBLE VAR_CHAR Array Pointer PTR_INT PTR_UNINT PTR_FLOAT PTR_DOUBLE PTR_CHAR".split(" "),Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setOutput(!0,"Address");this.tag=Blockly.Msg.TAG_VARIABLE_POINTER_ADDR},onchange:function(){if(this.getInputTargetBlock("VALUE")){var a=this.getInputTargetBlock("VALUE"),b=a.getVars(),c=Blockly.FieldDropdown.prototype.getTypefromVars(b, 0);0==a.type.search("variables")&&(0a&&this.setOutputType("VAR",c)))}},setOutputType:Blockly.Blocks.variables_get.setOutputType}; Blockly.Blocks.variables_array_pointer={init:function(){this.setColour(48);this.appendDummyInput().appendField(Blockly.Msg.ARRAY_GET_TITLE).appendField(new Blockly.FieldVariableArray(Blockly.Msg.SELECT_MENU,null,this),"VAR");this.setOutput(!0,["Address","Pointer"]);this.setInputsInline(!0);this.setTooltip(Blockly.Msg.VARIABLES_ARRAY_POINTER_TOOLTIP)},renameVar:function(a,b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"VAR")},getVars:function(){return[this.getFieldValue("VAR")]}, setOutputType:Blockly.Blocks.variables_get.setOutputType}; Blockly.Blocks.variables_string_null={init:function(){this.setColour(48);this.setOutput(!0);this.appendDummyInput().appendField(Blockly.Msg.VARIABLES_STRING_NULL);this.setTooltip(Blockly.Msg.VARIABLES_STRING_NULL_TOOLTIP);this.tag=Blockly.Msg.TAG_VARIABLES_STRING_NULL},onchange:Blockly.Blocks.requireInFunction}; Blockly.Blocks.variables_string_declare={init:function(){var a=[[Blockly.Msg.VARIABLES_SET_TYPE_CHAR,"char"]];this.setColour(48);var b=Blockly.Procedures.findLegalName(Blockly.Msg.VARIABLES_STRING_DECLARE_DEFAULT_NAME,this);this.interpolateMsg(Blockly.Msg.VARIABLES_STRING_DECLARE_TITLE+" %1 "+Blockly.Msg.VARIABLES_DECLARE_NAME+" %2 "+Blockly.Msg.VARIABLES_STRING_DECLARE_LENGTH+" %3 "+Blockly.Msg.VARIABLES_STRING_DECLARE_VALUE+" %4",["TYPES",new Blockly.FieldDropdown(a)],["VAR",new Blockly.FieldTextInput(b, Blockly.Procedures.rename)],["LENGTH_1","Number INT Variable VAR_INT VAR_UNINT Aster Macro".split(" "),Blockly.ALIGN_RIGHT],["VALUE",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.VARIABLES_DECLARE_TOOLTIP);this.contextMenuMsg_=Blockly.Msg.VARIABLES_SET_CREATE_GET;this.contextMenuType_="variables_array_get";this.tag=Blockly.Msg.TAG_VARIABLE_ARRAY_DECLARE;this.oldName=b},initVar:Blockly.Blocks.define_declare.initVar, getDist:function(){return"a"},getScope:Blockly.Blocks.variables_declare.getScope,getPos:function(){return this.getRelativeToSurfaceXY().y},getSpec:function(){var a=this.getIndices()[0],b=this.getIndices()[1],c=this.getIndices()[2];a*=1;b*=1;c*=1;if(0!=a&&0==b&&0==c)return[1,a];if(0!=a&&0!=b&&0==c)return[2,a,b];if(0!=a&&0!=b&&0!=c)return[3,a,b,c]},onchange:function(){Blockly.Blocks.variablePlaceCheck(this);var a=this.getFieldValue("VAR");this.oldName!=a&&(Blockly.Variables.renameVariable(this.oldName, a),this.oldName=a)},getTypes:function(){return[this.getFieldValue("TYPES")]},getLength:function(){return[this.childBlocks_[0].getFieldValue("NUM")]},getVars:function(){return[this.getFieldValue("VAR")]},getDeclare:function(){return[this.getFieldValue("VAR")]},renameVar:function(a,b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"VAR")},getIndices:Blockly.Blocks.variables_array_get.getIndices,customContextMenu:Blockly.Blocks.variables_array_get.customContextMenu}; Blockly.Blocks.library_stdio_tab={init:function(){this.setColour(90);this.interpolateMsg(Blockly.Msg.STDIO_TAB_TITLE,Blockly.ALIGN_RIGHT);this.setOutput(!0,"String");this.setTooltip(Blockly.Msg.STDIO_TAB_TOOLTIP);this.tag=Blockly.Msg.TAG_STDIO_TAB},onchange:Blockly.Blocks.requireInFunction}; Blockly.Blocks.variables_array_initial={init:function(){this.setColour(48);this.appendValueInput("ADD0").appendField(Blockly.Msg.VARIABLES_ARRAY_INITIAL);this.appendValueInput("ADD1");this.appendValueInput("ADD2");this.setOutput(!0,"Array_Initial");this.setMutator(new Blockly.Mutator(["array_create_with_item"]));this.setTooltip(Blockly.Msg.VARIABLES_ARRAY_INITIAL_TOOLTIP);this.itemCount_=3},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("items",this.itemCount_);return a}, domToMutation:function(a){for(var b=0;bblock.getIndices()[0]? this.setWarningText(Blockly.Msg.VARIABLES_ARRAY_INITIAL_WARNING):this.setWarningText(null))}}; Blockly.Blocks.array_create_with_container={init:function(){this.setColour(48);this.appendDummyInput().appendField(Blockly.Msg.ARRAY_CREATE_WITH_CONTAINER_TITLE_ADD);this.appendStatementInput("STACK");this.setTooltip(Blockly.Msg.ARRAY_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}}; Blockly.Blocks.array_create_with_item={init:function(){this.setColour(48);this.appendDummyInput().appendField(Blockly.Msg.ARRAY_CREATE_WITH_ITEM_TITLE);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.ARRAY_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}}; //2023/04/12 ----c test Blockly.Blocks.arr_data={init:function(){this.setColour(90);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"TEXT");this.setOutput(!0,"String");this.setTooltip(Blockly.Msg.TEXT_TEXT_TOOLTIP);this.tag=Blockly.Msg.TAG_STDIO_TEXT},onchange:function(){Blockly.Blocks.requireInFunction();this.getFieldValue("TEXT")&&(1==this.getFieldValue("TEXT").length?this.changeOutput("CHAR"):this.changeOutput("STR"))}}; Blockly.Blocks.include = { init: function () { var a = [["stm32f4xx_hal.h","stm32f4xx_hal"], ["main.h","main"],["adc.h","adc"], ["i2c.h","i2c"], ["lwip.h","lwip"], ["tim.h","tim"], ["usart.h","usart"], ["gpio.h","gpio"], ["lwip/debug.h","lwip/debug"], ["lwip/stats.h","lwip/stats"], ["lwip/tcp.h","lwip/tcp"], ["lwip/memp.h","lwip/memp"], ["stdio.h","stdio"], ["string.h","string"]];this.interpolateMsg("#include "+" %1 ",["VAR",new Blockly.FieldDropdown(a,null,this)],Blockly.ALIGN_RIGHT);}}; Blockly.Blocks.def={init:function(){var a=Blockly.Procedures.findLegalName(Blockly.Msg.DEFINE_DECLARE_DEFAULT_NAME,this);this.interpolateMsg(Blockly.Msg.DEFINE_DECLARE_TITLE+" "+Blockly.Msg.VARIABLES_DECLARE_NAME+" %1 "+Blockly.Msg.DEFINE_DECLARE_INIT+" %2",["VAR",new Blockly.FieldTextInput(a,Blockly.Procedures.rename)],["VALUE",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setTooltip(Blockly.Msg.VARIABLES_DECLARE_TOOLTIP);this.contextMenuMsg_=Blockly.Msg.VARIABLES_SET_CREATE_GET;this.contextMenuType_="define_get";this.tag=Blockly.Msg.TAG_DEFINE_DECLARE;this.macroType_="Macro"},initVar:function(){this.setFieldValue("","VAR")},getTypes:function(){return[this.macroType_]},getDist:function(){return"d"},getScope:function(){return["Global"]},getSpec:function(){return null},getPos:function(){return this.getRelativeToSurfaceXY().y},getDeclare:function(){return[this.getFieldValue("VAR")]}, getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(a,b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"VAR")},customContextMenu:Blockly.Blocks.define_get.customContextMenu,onchange:function(){Blockly.Blocks.requireOutFunction();if(this.getInputTargetBlock("VALUE")){var a=this.getInputTargetBlock("VALUE");a.type.match("math")?this.macroType_="int":a.type.match("text")&&(1==a.getFieldValue("TEXT").length?this.macroType_="char":this.macroType_="dbchar")}}}; Blockly.Blocks.vari={init:function(){var a=[[Blockly.Msg.VARIABLES_SET_TYPE_INT,"int"],[Blockly.Msg.VARIABLES_SET_TYPE_UNSIGNED_INT,"unsigned int"],[Blockly.Msg.VARIABLES_SET_TYPE_FLOAT,"float"],[Blockly.Msg.VARIABLES_SET_TYPE_DOUBLE,"double"],[Blockly.Msg.VARIABLES_SET_TYPE_CHAR,"char"],["u8_t","u8_t"], ["__IO","__IO"], ["uint16_t","uint16_t"]];var b=Blockly.Procedures.findLegalName(Blockly.Msg.VARIABLES_DECLARE_DEFAULT_NAME,this);this.interpolateMsg("%1 "+Blockly.Msg.VARIABLES_DECLARE_TITLE+Blockly.Msg.VARIABLES_DECLARE_NAME+ " %2 "+Blockly.Msg.VARIABLES_DECLARE_INIT+" %3 ",["TYPES",new Blockly.FieldDropdown(a,null,this)],["VAR",new Blockly.FieldTextInput(b,Blockly.Procedures.rename)],["VALUE",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setTooltip(Blockly.Msg.VARIABLES_DECLARE_TOOLTIP);this.contextMenuMsg_=Blockly.Msg.VARIABLES_SET_CREATE_GET;this.contextMenuType_="variables_get";this.tag=Blockly.Msg.TAG_VARIABLE_DECLARE;this.oldName=b},initVar:Blockly.Blocks.define_declare.initVar, getDist:function(){return"v"},getScope:function(){if(this.getSurroundParent())return this.getSurroundParent().getName()},getSpec:function(){return null},getPos:function(){return this.getRelativeToSurfaceXY().y},getTypes:function(){return[this.getFieldValue("TYPES")]},getVars:function(){return[this.getFieldValue("VAR")]},getDeclare:function(){return[this.getFieldValue("VAR")]},renameVar:function(a,b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"VAR")},customContextMenu:Blockly.Blocks.variables_get.customContextMenu, onchange:function(){var a=this.getFieldValue("TYPES");0==a&&(a="int");Blockly.Blocks.setCheckVariable(this,a,"VALUE");a=this.getFieldValue("VAR");if(this.oldName!=a){var b=this.getScope();b&&Blockly.Variables.renameVariablebyScope(this.oldName,a,b[0]);this.oldName=a}}}; Blockly.Blocks.array_declare={init:function(){var a=[[Blockly.Msg.VARIABLES_SET_TYPE_INT,"int"],[Blockly.Msg.VARIABLES_SET_TYPE_UNSIGNED_INT,"unsigned int"],[Blockly.Msg.VARIABLES_SET_TYPE_FLOAT,"float"],[Blockly.Msg.VARIABLES_SET_TYPE_DOUBLE,"double"],[Blockly.Msg.VARIABLES_SET_TYPE_CHAR,"char"],["uint8_t","uint8_t"],["uint32_t","uint32_t"]];this.setColour(48);var b=Blockly.Procedures.findLegalName(Blockly.Msg.VARIABLES_ARRAY_DECLARE_DEFAULT_NAME,this);this.varInputField=new Blockly.FieldTextInput(b,Blockly.Procedures.rename);this.interpolateMsg(Blockly.Msg.VARIABLES_ARRAY_DECLARE_TITLE+ " %1 "+Blockly.Msg.VARIABLES_DECLARE_NAME+" %2 "+Blockly.Msg.VARIABLES_ARRAY_DECLARE_LENGTH+" %3 %4 "+Blockly.Msg.VARIABLES_ARRAY_DECLARE_VALUE+" %5 ",["TYPES",new Blockly.FieldDropdown(a)],["VAR",this.varInputField],["LENGTH_1","Number INT Variable VAR_INT VAR_UNINT Aster Macro".split(" "),Blockly.ALIGN_RIGHT],["LENGTH_2","Number INT Variable VAR_INT VAR_UNINT Aster Macro".split(" "),Blockly.ALIGN_RIGHT],["VALUE",["Array_Initial"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setInputsInline(!0); this.setTooltip(Blockly.Msg.VARIABLES_DECLARE_TOOLTIP);this.contextMenuMsg_=Blockly.Msg.VARIABLES_SET_CREATE_GET;this.contextMenuType_="variables_array_get";this.tag=Blockly.Msg.TAG_VARIABLE_ARRAY_DECLARE;this.oldName=b},initVar:Blockly.Blocks.define_declare.initVar,getDist:function(){return"a"},getScope:Blockly.Blocks.variables_declare.getScope,getPos:function(){return this.getRelativeToSurfaceXY().y},getSpec:function(){var a=this.getIndices()[0], b=this.getIndices()[1],c=this.getIndices()[2];a*=1;b*=1;c*=1;if(0!=a&&0==b&&0==c)return[1,a];if(0!=a&&0!=b&&0==c)return[2,a,b];if(0!=a&&0!=b&&0!=c)return[3,a,b,c]},onchange:function(){var a=this.getFieldValue("VAR");if(this.oldName!=a){var b=this.getScope();b&&Blockly.Variables.renameVariablebyScope(this.oldName,a,b[0]);this.oldName=a}},getTypes:function(){return[this.getFieldValue("TYPES")]},getLength:function(){return[this.childBlocks_[0].getFieldValue("NUM")]}, getVars:function(){return[this.getFieldValue("VAR")]},getDeclare:function(){return[this.getFieldValue("VAR")]},renameVar:function(a,b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"VAR")},getIndices:Blockly.Blocks.variables_array_get.getIndices,customContextMenu:Blockly.Blocks.variables_array_get.customContextMenu}; Blockly.Blocks.controls_fors={init:function(){this.setColour(220);this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_FOR_INPUT_WITH).appendField(new Blockly.FieldVariable(Blockly.Msg.SELECT_MENU,null,this),"VAR"); this.interpolateMsg(" %1 ",["FROM","Number Variable INT NEGATIVE VAR_INT VAR_UNINT".split(" "),Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT); this.appendDummyInput().appendField(new Blockly.FieldDropdown([["=","=="],["\u2260","!="],["<","<"],["\u2264","<="],[">",">"],["\u2265",">="]]), "NAME"); this.interpolateMsg("%1 增量 %2",["TO","Number Variable INT NEGATIVE VAR_INT VAR_UNINT".split(" "),Blockly.ALIGN_RIGHT],["BY","Number Variable INT NEGATIVE VAR_INT VAR_UNINT".split(" "), Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT); this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_FOR_INPUT_DO);this.appendDummyInput().appendField(new Blockly.FieldCheckbox("TRUE"),"ORDER").appendField(Blockly.Msg.CONTROLS_FOR_INPUT_ORDER).setAlign(Blockly.ALIGN_RIGHT);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0);var b=this;this.tag=Blockly.Msg.TAG_LOOP_FOR;this.setTooltip(function(){return Blockly.Msg.CONTROLS_FOR_TOOLTIP.replace("%1",b.getFieldValue("VAR"))})}, getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(b,c){Blockly.Names.equals(b,this.getFieldValue("VAR"))&&this.setFieldValue(c,"VAR")},customContextMenu:function(b){if(!this.isCollapsed()){var c={enabled:!0},a=this.getFieldValue("VAR");c.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",a);a=goog.dom.createDom("field",null,a);a.setAttribute("name","VAR");a=goog.dom.createDom("block",null,a);a.setAttribute("type","variables_get");c.callback=Blockly.ContextMenu.callbackFactory(this, a);b.push(c)}},onchange:Blockly.Blocks.requireInFunction};