Makeblock-official / mBlock

base on scratch offline v2.0 by MIT, Learn more from Makeblock official website
http://www.makeblock.com
GNU General Public License v2.0
319 stars 228 forks source link

Create extension with “header blocks” #68

Closed Ahmedfcis closed 7 years ago

Ahmedfcis commented 7 years ago

I creating an extension contains the following “header blocks”

[ "h", "When Remote %d.IRKeys Key Pressed", "procDef", "Power", { "setup":"addPressHandlerIRremote({0},onPress{0});\n", "inc":"", "def":"", "work":"", "loop":"" } ]

I was expecting to have my generated code be as following:

onPressPower() { //... }

void setup(){ addPressHandlerIRremote(POWER,onPressPower); }

but no code was generated, I not sure how 'ArduinoManager.as' handles “header blocks”

bigeyex commented 7 years ago

Header blocks are not supported in the current version of mBlock. It will be ignored by the code generator. only "runArduino" header blocks are considered as the start blocks. Implementing this requires an overhaul of the extension system, which is not included in the current batch of iterations.

Ahmedfcis commented 7 years ago

Thank you @bigeyex