Forth Language

332 views
Skip to first unread message

jimmyscratchlab jimmyscratchlab

unread,
Jun 19, 2012, 5:25:49 PM6/19/12
to blo...@googlegroups.com
I try to add Forth language to Blockly but having some problems.
How to change the connection of the block using ContextMenu?
How to disable the connection of the Procedure/Control block of the tail?
To provide Blockly.Block.prototype.appendTail() function might be able to solve my problem.
Sincerely


Neil Fraser

unread,
Jun 19, 2012, 6:13:59 PM6/19/12
to blo...@googlegroups.com
On 19 June 2012 14:25, jimmyscratchlab jimmyscratchlab <jimmysc...@gmail.com> wrote:
I try to add Forth language to Blockly but having some problems.
How to change the connection of the block using ContextMenu?

More details please?

How to disable the connection of the Procedure/Control block of the tail?

Your purple blocks appear to have the following two lines in them:
    this.appendInput('', Blockly.NEXT_STATEMENT, '...');
    this.appendInput(';', Blockly.INPUT_VALUE, '...', null);
Just delete the second appendInput line (the one with the INPUT_VALUE) and that connection will disappear.

You might find this page of help:
http://code.google.com/p/blockly/wiki/CreatingBlocks

--
Neil Fraser
http://neil.fraser.name

jimmyscratchlab jimmyscratchlab

unread,
Jun 19, 2012, 6:39:12 PM6/19/12
to blo...@googlegroups.com



How to disable the connection of the Procedure/Control block of the tail?

Your purple blocks appear to have the following two lines in them:
    this.appendInput('', Blockly.NEXT_STATEMENT, '...');
    this.appendInput(';', Blockly.INPUT_VALUE, '...', null);
Just delete the second appendInput line (the one with the INPUT_VALUE) and that connection will disappear.

Sorry,My graph is not correct.
I need label ';' but disable the connection of the Procedure/Control block of the tail.

Neil Fraser

unread,
Jun 19, 2012, 6:49:10 PM6/19/12
to blo...@googlegroups.com
On 19 June 2012 15:39, jimmyscratchlab jimmyscratchlab <jimmysc...@gmail.com> wrote:
Sorry,My graph is not correct.
I need label ';' but disable the connection of the Procedure/Control block of the tail.

Interesting.  Currently that's not possible.  However I'm currently rewriting the renderer to handle some other cases, so I'll also upgrade it so that you can specify 'null' in place of 'Blockly.VALUE_INPUT' and it will not add the notch.

I'm currently preparing for a conference presentation, so this might not land until later in the week.  But you can count on it getting done.

jimmyscratchlab jimmyscratchlab

unread,
Jun 22, 2012, 1:45:42 PM6/22/12
to blo...@googlegroups.com
I solve my problem.
My solution--> http://jimmyscratchlab.blogspot.tw/2012/06/try-google-blockly-forth.html
Can I call it free style Forth-Lang block?



Neil Fraser於 2012年6月20日星期三UTC+8上午6時13分59秒寫道:


On 19 June 2012 14:25, jimmyscratchlab
I try to add Forth language to Blockly but having some problems.

How to change the connection of the block using ContextMenu?

More details please?


Neil Fraser

unread,
Jun 26, 2012, 8:29:01 PM6/26/12
to blo...@googlegroups.com
On 19 June 2012 15:49, Neil Fraser <ro...@neil.fraser.name> wrote:
> On 19 June 2012 15:39, jimmyscratchlab jimmyscratchlab
> <jimmysc...@gmail.com> wrote:
>>
>> Sorry,My graph is not correct.
>> I need label ';' but disable the connection of the Procedure/Control block
>> of the tail.
>
> Interesting.  Currently that's not possible.  However I'm currently
> rewriting the renderer to handle some other cases, so I'll also upgrade it
> so that you can specify 'null' in place of 'Blockly.VALUE_INPUT' and it will
> not add the notch.

Done (r287). You can now add the following:
this.appendInput(';', Blockly.DUMMY_INPUT, '', null);

jimmyscratchlab jimmyscratchlab

unread,
Jun 26, 2012, 9:30:48 PM6/26/12
to blo...@googlegroups.com

Done (r287).  You can now add the following:
    this.appendInput(';', Blockly.DUMMY_INPUT, '', null);

--


Thanks.
I check out the latest project source code but I can not define a new procedure.

Blockly.Language.procedures_defreturn_1 = {
  // Define a procedure with a return value.
  category: null,  // Procedures are handled specially.
  helpUrl: Blockly.LANG_PROCEDURES_DEFRETURN_HELPURL,
  init: function() {
    this.setColour(290);
    this.appendTitle(':');
    var name = Blockly.Procedures.findLegalName(Blockly.LANG_PROCEDURES_DEFRETURN_PROCEDURE, this);
    this.appendTitle(new Blockly.FieldTextInput(name, Blockly.Procedures.rename), 'NAME');
    this.appendInput('', Blockly.NEXT_STATEMENT, 'STACK');
    //this.appendInput(Blockly.LANG_PROCEDURES_DEFRETURN_RETURN, Blockly.INPUT_VALUE, 'RETURN', null);

    this.appendInput(';', Blockly.DUMMY_INPUT, '', null);
    //this.setMutator(new Blockly.Mutator(this, ['procedures_mutatorparam']));
    this.setTooltip(Blockly.LANG_PROCEDURES_DEFRETURN_TOOLTIP_1);
  },
  destroy: Blockly.Language.procedures_defnoreturn_1.destroy,
  getProcedureDef: function() {
    // Return the name of the defined procedure
    // and that it does not have a return value.
    return [this.getTitleText('NAME'), true];
  }
};

Neil Fraser

unread,
Jun 27, 2012, 1:00:39 AM6/27/12
to blo...@googlegroups.com
On 26 June 2012 18:30, jimmyscratchlab jimmyscratchlab
<jimmysc...@gmail.com> wrote:
> I check out the latest project source code but I can not define a new
> procedure.

Your code is correct. Attached is a screenshot of the resulting block.

>   category: null,  // Procedures are handled specially.

This is the issue. Procedures are indeed handled specially. If you
really need to create another type of procedure, you'll need to also
edit Blockly.Procedures.flyoutCategory (in procedures.js).
proc_forth.png

jimmyscratchlab jimmyscratchlab

unread,
Jun 27, 2012, 4:25:27 AM6/27/12
to blo...@googlegroups.com
I try it again in different browsers.

It is OK in Chrome.

It disappear in Firefox.


Neil Fraser於 2012年6月27日星期三UTC+8下午1時00分39秒寫道:

jimmyscratchlab jimmyscratchlab

unread,
Jul 4, 2012, 3:57:50 PM7/4/12
to blo...@googlegroups.com

jimmyscratchlab jimmyscratchlab

unread,
Jul 9, 2012, 1:02:58 PM7/9/12
to blo...@googlegroups.com
a ProcessingJS tutorial

jimmyscratchlab.blogspot.tw/2012/07/jforthblocks-processingjs-tutorial.html

jimmyscratchlab jimmyscratchlab於 2012年7月5日星期四UTC+8上午3時57分50秒寫道:
21.png

jimmyscratchlab jimmyscratchlab

unread,
Jul 10, 2012, 12:16:08 AM7/10/12
to blo...@googlegroups.com
 
  http://jimmyscratchlab.blogspot.tw/2012/07/jforthblocks-processingjs-tutorial.html

jimmyscratchlab jimmyscratchlab於 2012年7月10日星期二UTC+8上午1時02分58秒寫道:
a ProcessingJS tutorial

jimmyscratchlab.blogspot.tw/2012/07/jforthblocks-processingjs-tutorial.html


jimmyscratchlab jimmyscratchlab

unread,
Aug 1, 2012, 3:49:35 PM8/1/12
to blo...@googlegroups.com



jimmyscratchlab jimmyscratchlab於 2012年7月10日星期二UTC+8下午12時16分08秒寫道:
 
  http://jimmyscratchlab.blogspot.tw/2012/07/jforthblocks-processingjs-tutorial.html


Luís Carlos Gomes Domingos

unread,
Aug 3, 2012, 5:06:39 AM8/3/12
to blo...@googlegroups.com


Em terça-feira, 19 de junho de 2012 22h25min49s UTC +1, jimmyscratchlab jimmyscratchlab escreveu:
Eu tento adicionar Forth linguagem para Blockly mas tendo alguns problemas.
Como alterar a conexão do bloco usando ContextMenu?
Como desativar a conexão do bloco de Processo / Controle da cauda?
Para fornecer Blockly.Block.prototype. appendTail () função pode ser capaz de resolver o meu problema.
Atenciosamente


jimmyscratchlab jimmyscratchlab

unread,
Sep 1, 2012, 5:50:44 PM9/1/12
to blo...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages