cra16/cake-core

View on GitHub
blockly/apps/code/template.soy

Summary

Maintainability
Test Coverage
{namespace codepage}

/**
 * This is a Closure Template.
 *
 * To regenerate just en.js, run this command:
 * java -jar ../_soy/SoyToJsSrcCompiler.jar --outputPathFormat generated/en.js --srcs ../common.soy,template.soy
 *
 * To regenerate all files, see: trunk/apps/common.soy
 */

/**
 * Translated messages for use in JavaScript.
 */
{template .messages}
  {call apps.messages /}
  <div style="display: none">
    <span id="Code_badXml">{msg meaning="Code.badXml" desc="alert - Message shown when the user tries switching from the XML tab after entering XML text that could not be parsed.  This asks whether they wish to abandon the XML they added.  If they select 'OK' (or the translated equivalent), the XML is cleared, and the other tab is shown.  If they select 'Cancel', they remain on the XML tab with the bad XML.\n\nUsed in JavaScript <code>window.confirm()</code>."}Error parsing XML:\n%1\n\nSelect 'OK' to abandon your changes or 'Cancel' to further edit the XML.{/msg}</span>
    <span id="Code_badCode">{msg meaning="Code.badCode" desc="alert - Message shown if an error occurs while interpreting the user program.  The error description follows."}Program error:\n%1{/msg}</span>
    <span id="Code_timeout">{msg meaning="Code.timeout" desc="alert - Message shown if the program has run for more than the permitted number of steps.  This exists so that programs with infinite loops do not run forever."}Maximum execution iterations exceeded.{/msg}</span>
    <span id="Code_discard">{msg meaning="Code.discard" desc="alert - Message shown after the user clicks on the 'discard all' icon.  Selecting 'OK' (or the translated equivalent) causes all of the blocks to be discarded.  Selecting 'Cancel' prevents blocks from being deleted.\n\nParameters:\n* %1 - number of blocks to be deleted. It is always an integer greater than or equal to 2."}Delete all %1 blocks?{/msg}</span>
  </div>
{/template}

/**
 * @authur Joshua Jung
 * include _uncompressed.js under blocks/ and generators/cake/ for debug usage.
 */
{template .debug}
  <!-- debug template -->
  <script type="text/javascript" src="../../generators/cake.js"></script>
  <script type="text/javascript" src="../../generators/cake/colour.js"></script>
  <script type="text/javascript" src="../../generators/cake/stdio.js"></script>
  <script type="text/javascript" src="../../generators/cake/stdlib.js"></script>
  <script type="text/javascript" src="../../generators/cake/math.js"></script>
  <script type="text/javascript" src="../../generators/cake/string.js"></script>
  <script type="text/javascript" src="../../generators/cake/lists.js"></script>
  <script type="text/javascript" src="../../generators/cake/logic.js"></script>
  <script type="text/javascript" src="../../generators/cake/loops.js"></script>
  <script type="text/javascript" src="../../generators/cake/procedures.js"></script>
  <script type="text/javascript" src="../../generators/cake/text.js"></script>
  <script type="text/javascript" src="../../generators/cake/variables.js"></script>
  <script type="text/javascript" src="../../blocks/colour.js"></script>
  <script type="text/javascript" src="../../blocks/stdio.js"></script>
  <script type="text/javascript" src="../../blocks/stdlib.js"></script>
  <script type="text/javascript" src="../../blocks/math.js"></script>
  <script type="text/javascript" src="../../blocks/string.js"></script>
  <script type="text/javascript" src="../../blocks/lists.js"></script>
  <script type="text/javascript" src="../../blocks/logic.js"></script>
  <script type="text/javascript" src="../../blocks/loops.js"></script>
  <script type="text/javascript" src="../../blocks/procedures.js"></script>
  <script type="text/javascript" src="../../blocks/text.js"></script>
  <script type="text/javascript" src="../../blocks/variables.js"></script>
  <!-- Load the Google Drive SDK Realtime libraries. -->
  <script type="text/javascript" src="https://apis.google.com/js/api.js"></script>
  <!-- /debug template -->
{/template}

/**
 * Web page structure.
 */
{template .start}
  {call .messages /}
  <script type="text/javascript" src="../../blockly_uncompressed.js"></script>
  <script type="text/javascript" src="../../javascript_compressed.js"></script>
  <script type="text/javascript" src="../../python_compressed.js"></script>
  <script type="text/javascript" src="../../dart_compressed.js"></script>
  <script type="text/javascript" src="../../{$ij.langSrc}"></script>
  {call .debug /}
  <table width="100%" height="100%">
    <tr>
      <td>
        <h1>
          <span id="title">
            <a href="../index.html?lang={$ij.lang}">{msg meaning="Apps.blocklyMessage" desc="IBID"}Cake{/msg}</a>
            {sp}:{sp}
            {{msg meaning="Code.title" desc="title - Title of this application, indicating that it is for writing arbitrary programs.\n{lb}{lb}Identical|Code{rb}{rb}"}}
              C language
            {{/msg}}
          </span>
        </h1>
      </td>
      <td class="farSide">
        <select id="languageMenu"></select>
      </td>
    </tr>
    <tr>
      <td colspan=2>
        <table width="100%">
          <tr id="tabRow" height="1em">
            <td id="tab_blocks" class="tabon">{{msg meaning="Code.blocks" desc="tab text - Displays and allows editing of the user's program as blocks.\n{lb}{lb}Identical|Blocks{rb}{rb}"}}Blocks{{/msg}}</td>
            <td class="tabmin">&nbsp;</td>
            <td id="tab_javascript" class="taboff">JavaScript</td>
            <td class="tabmin">&nbsp;</td>
            <td id="tab_python" class="taboff">Python</td>
            <td class="tabmin">&nbsp;</td>
            <td id="tab_dart" class="taboff">Dart</td>
            <td class="tabmin">&nbsp;</td>
            <td id="tab_xml" class="taboff">XML</td>
            <td class="tabmin">&nbsp;</td>
            <td id="tab_cake" class="taboff">C</td>
            <td class="tabmax">
              <button id="trashButton" class="notext" title="{msg meaning="Code.trashTooltip" desc="tooltip - Clicking on this causes the user program to be discarded."}Discard all blocks.{/msg}">
                <img src='../../media/1x1.gif' class="trash icon21">
              </button>{sp}
              <button id="linkButton" class="notext" title="{msg meaning="Apps.linkTooltip" desc="IBID."}Save and link to blocks.{/msg}">
                <img src='../../media/1x1.gif' class="link icon21">
              </button>{sp}
              <button id="runButton" class="notext primary" title="{msg meaning="Apps.runTooltip" desc="IBID"}Run the program defined by the blocks in the workspace.{/msg}">
                <img src='../../media/1x1.gif' class="run icon21">
              </button>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td height="99%" colspan=2 id="content_area">
        {call .toolbox /}
      </td>
    </tr>
  </table>
  <div id="content_blocks" class="content"></div>
  <pre id="content_javascript" class="content"></pre>
  <pre id="content_python" class="content"></pre>
  <pre id="content_dart" class="content"></pre>
  <textarea id="content_xml" class="content" wrap="off"></textarea>
  <pre id="content_cake" class="content"></pre>
  {call apps.dialog /}
  {call apps.storageDialog /}
{/template}

/**
 * New toolbox.
 */
{template .toolbox}
  <xml id="toolbox" style="display: none">
    <category name="{msg meaning="Apps.catVariables" desc="IBID"}Variables{/msg}">
      <block type="variables_declare"></block>
      <block type="variables_get"></block>
      <block type="variables_set"></block>      
    </category>
    <category name="{msg meaning="Apps.catLoops" desc="IBID"}Loops{/msg}">
      <block type="controls_whileUntil"></block>
      
      <block type="controls_for"></block>
    </category>
    <category name="{msg meaning="Apps.catLogic" desc="IBID"}Logic{/msg}">
      <block type="controls_if"></block>
      <block type="logic_compare"></block>
      <block type="logic_operation"></block>
      <block type="logic_negate"></block>
      <block type="logic_boolean"></block>
      <block type="logic_null"></block>
      <block type="logic_ternary"></block>
    </category>
    <category name="{msg meaning="Apps.catProcedures" desc="IBID"}Functions{/msg}" custom="PROCEDURE">
    </category>
    <category name="{msg meaning="Apps.catLibrary" desc="IBID"}Library{/msg}">
      <category name="Stdio">
        <category name="FILE I/O">
          <block type="library_stdio_fopen">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
          <block type="library_stdio_fclose">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
          <block type="library_stdio_fprintf">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
          <block type="library_stdio_fscanf">
            <value name="TEXT">
            <block type="library_func_paren"></block>
            </value>
          </block>
          <block type="library_stdio_fread">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
          <block type="library_stdio_fwrite">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
          <block type="library_stdio_fflush">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
          </category>
          <category name="I/O">
          <block type="library_stdio_printf">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
          <block type="library_stdio_scanf">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
          <block type="library_stdio_getchar">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
          <block type="library_stdio_putchar">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
          <block type="library_stdio_gets">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
          <block type="library_stdio_puts">
            <value name="TEXT">
              <block type="library_func_paren"></block>
            </value>
          </block>
        </category>
      </category>
      <category name="Stdlib">
        <block type="library_stdlib_rand">
          <value name="TEXT">
            <block type="library_func_paren"></block>
          </value>
        </block>
        <block type="library_stdlib_srand">
          <value name="TEXT">
            <block type="library_func_paren"></block>
          </value>
        </block>
        <block type="library_stdlib_malloc">
          <value name="TEXT">
            <block type="library_func_paren"></block>
          </value>
        </block>
        <block type="library_stdlib_free">
          <value name="TEXT">
            <block type="library_func_paren"></block>
          </value>
        </block>
        <block type="library_stdlib_exit">
          <value name="TEXT">
            <block type="library_func_paren"></block>
          </value>
        </block>
      </category>
      <category name="{msg meaning="Apps.catMath" desc="IBID"}Math{/msg}">
        <block type="library_func_paren"></block>
        <block type="library_math_sin"></block>
        <block type="library_math_cos"></block>
        <block type="library_math_tan"></block>
      </category>
    </category>
  </xml>
{/template}

/**
 * Old toolbox.
 */
{template .old_toolbox}
  <xml id="toolbox" style="display: none">
    <category name="{msg meaning="Apps.catLogic" desc="IBID"}Logic{/msg}">
      <block type="controls_if"></block>
      <block type="logic_compare"></block>
      <block type="logic_operation"></block>
      <block type="logic_negate"></block>
      <block type="logic_boolean"></block>
      <block type="logic_null"></block>
      <block type="logic_ternary"></block>
    </category>
    <category name="{msg meaning="Apps.catLoops" desc="IBID"}Loops{/msg}">
      <block type="controls_repeat_ext">
        <value name="TIMES">
          <block type="math_number">
            <field name="NUM">10</field>
          </block>
        </value>
      </block>
      <block type="controls_whileUntil"></block>
      <block type="controls_for">
        <value name="FROM">
          <block type="math_number">
            <field name="NUM">1</field>
          </block>
        </value>
        <value name="TO">
          <block type="math_number">
            <field name="NUM">10</field>
          </block>
        </value>
        <value name="BY">
          <block type="math_number">
            <field name="NUM">1</field>
          </block>
        </value>
      </block>
      <block type="controls_forEach"></block>
      <block type="controls_flow_statements"></block>
    </category>
    <category name="{msg meaning="Apps.catMath" desc="IBID"}Math{/msg}">
      <block type="math_number"></block>
      <block type="math_arithmetic"></block>
      <block type="math_single"></block>
      <block type="math_trig"></block>
      <block type="math_constant"></block>
      <block type="math_number_property"></block>
      <block type="math_change">
        <value name="DELTA">
          <block type="math_number">
            <field name="NUM">1</field>
          </block>
        </value>
      </block>
      <block type="math_round"></block>
      <block type="math_on_list"></block>
      <block type="math_modulo"></block>
      <block type="math_constrain">
        <value name="LOW">
          <block type="math_number">
            <field name="NUM">1</field>
          </block>
        </value>
        <value name="HIGH">
          <block type="math_number">
            <field name="NUM">100</field>
          </block>
        </value>
      </block>
      <block type="math_random_int">
        <value name="FROM">
          <block type="math_number">
            <field name="NUM">1</field>
          </block>
        </value>
        <value name="TO">
          <block type="math_number">
            <field name="NUM">100</field>
          </block>
        </value>
      </block>
      <block type="math_random_float"></block>
    </category>
    <category name="{msg meaning="Apps.catText" desc="IBID"}Text{/msg}">
      <block type="text"></block>
      <block type="text_join"></block>
      <block type="text_append">
        <value name="TEXT">
          <block type="text"></block>
        </value>
      </block>
      <block type="text_length"></block>
      <block type="text_isEmpty"></block>
      <block type="text_indexOf">
        <value name="VALUE">
          <block type="variables_get">
            <field name="VAR">{msg meaning="Apps.textVariable" desc="IBID"}text{/msg}</field>
          </block>
        </value>
      </block>
      <block type="text_charAt">
        <value name="VALUE">
          <block type="variables_get">
            <field name="VAR">{msg meaning="Apps.textVariable" desc="IBID"}text{/msg}</field>
          </block>
        </value>
      </block>
      <block type="text_getSubstring">
        <value name="STRING">
          <block type="variables_get">
            <field name="VAR">{msg meaning="Apps.textVariable" desc="IBID"}text{/msg}</field>
          </block>
        </value>
      </block>
      <block type="text_changeCase"></block>
      <block type="text_trim"></block>
      <block type="text_print"></block>
      <block type="text_prompt_ext">
        <value name="TEXT">
          <block type="text"></block>
        </value>
      </block>
    </category>
    <category name="{msg meaning="Apps.catLists" desc="IBID"}Lists{/msg}">
      <block type="lists_create_empty"></block>
      <block type="lists_create_with"></block>
      <block type="lists_repeat">
        <value name="NUM">
          <block type="math_number">
            <field name="NUM">5</field>
          </block>
        </value>
      </block>
      <block type="lists_length"></block>
      <block type="lists_isEmpty"></block>
      <block type="lists_indexOf">
        <value name="VALUE">
          <block type="variables_get">
            <field name="VAR">{msg meaning="Apps.listVariable" desc="IBID"}list{/msg}</field>
          </block>
        </value>
      </block>
      <block type="lists_getIndex">
        <value name="VALUE">
          <block type="variables_get">
            <field name="VAR">{msg meaning="Apps.listVariable" desc="IBID"}list{/msg}</field>
          </block>
        </value>
      </block>
      <block type="lists_setIndex">
        <value name="LIST">
          <block type="variables_get">
            <field name="VAR">{msg meaning="Apps.listVariable" desc="IBID"}list{/msg}</field>
          </block>
        </value>
      </block>
      <block type="lists_getSublist">
        <value name="LIST">
          <block type="variables_get">
            <field name="VAR">{msg meaning="Apps.listVariable" desc="IBID"}list{/msg}</field>
          </block>
        </value>
      </block>
    </category>
    <category name="{msg meaning="Apps.catColour" desc="IBID"}Colour{/msg}">
      <block type="colour_picker"></block>
      <block type="colour_random"></block>
      <block type="colour_rgb"></block>
      <block type="colour_blend"></block>
    </category>
    <category name="{msg meaning="Apps.catVariables" desc="IBID"}Variables{/msg}" custom="VARIABLE"></category>
    <category name="{msg meaning="Apps.catProcedures" desc="IBID"}Functions{/msg}" custom="PROCEDURE"></category>
  </xml>
{/template}

/**
 * Readonly Blockly in an iframe.
 */
{template .readonly}
  {call .messages /}

  <script type="text/javascript" src="../../blockly_compressed.js"></script>
  <script type="text/javascript" src="../../blocks_compressed.js"></script>
  <script type="text/javascript" src="../../{$ij.langSrc}"></script>
  <div id="blockly"></div>
{/template}