Update: 更新板卡

This commit is contained in:
王立帮
2024-07-21 09:30:11 +08:00
parent ab9db2b32a
commit 189de53fb0
1258 changed files with 1461 additions and 1260 deletions

View File

@@ -989,5 +989,34 @@ export const do_while = {
}
};
export const garbage_collection = {
init: function () {
this.setColour(LOOPS_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_OP_GARBAGE_COLLECT);
this.setPreviousStatement(true);
this.setNextStatement(true);
}
};
export const get_mem_alloc = {
init: function () {
this.setColour(LOOPS_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_GET_MEM_ALLOC);
this.setOutput(true)
}
};
export const get_mem_free = {
init: function () {
this.setColour(LOOPS_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_GET_MEM_FREE);
this.setOutput(true)
}
};
// export const base_type = controls_type;
// export const controls_TypeLists = controls_typeLists;

View File

@@ -252,5 +252,24 @@ export const controls_repeat_ext = function (a, generator) {
return 'for _my_variable in range(' + times + '):\n' + d;
}
export const garbage_collection = function (_, generator) {
generator.definitions_['import_gc'] = 'import gc';
var code = 'gc.collect()\n'
return code;
}
export const get_mem_alloc = function (_, generator) {
generator.definitions_['import_gc'] = 'import gc';
var code = 'gc.mem_alloc()\n';
return [code, generator.ORDER_ATOMIC];
}
export const get_mem_free = function (_, generator) {
generator.definitions_['import_gc'] = 'import gc';
var code = 'gc.mem_free()\n';
return [code, generator.ORDER_ATOMIC]
}
// ok
export const controls_repeat = controls_repeat_ext;