Modify Source Code

Parent Previous Next

Modify Source Code.

In this tutorial we use the example here:

Class Main


 Public Function Main(Integer x, y, z) : Integer


   //Create our text variable.

   String text := "X=" + x.ToString() + " and Y=" + y.ToString();

   //Convert text to UTF8 bytes, rotated z bits left.

   Blob crypto := Encrypt(text, z);

   //Write to the public VM cells, which are readable to the host.

   //Each cell is assigned as @CellSetType(rowIdx, columnIdx, value).

   @CellSetString(1, 1, text);

   @CellSetBytes(1, 2, crypto);

   Return crypto.Length();


 Private Function Encrypt(String text; Integer rotateBitsLeft) : Blob


   //This is a very simple encryption which turns the text

   //into UTF8 bytes, and then rotates the bits to the left

   //(or alternatively to the right if rotateBitsLeft < 0).

   Integer cpUTF8 := 65001; //the utf8 codepage;

   Blob tmp := @EncodeStringToBytes(text, cpUTF8);

   Return tmp.Rotate(0, rotateBitsLeft);



Please enter the source code into the IDE:

» Either write the missing source manually or use copy and paste.

» Save the file.

View Symbols and Help.

The editor can present symbols and help in a context sensitive manner. Symbols refer to variables, functions, arguments etc. By help we mean the SCRAMBLECODE documentation that accompany the software.

To view the symbols:

» Position the cursor on a symbol.

» Press Ctrl+Space or click the menu item Edit > Select Symbol.

The information presented is decided by the compiler and depends on the position of the cursor. Please notice you can get different results by positioning the cursor before a symbol, inside a symbol or after a symbol-dot (e.g. tmp.|Rotate).

Help is available in a similar manner. To get help:

» Position the cursor on a symbol.

» Press the function key F1 to access the local help.

The compiler then evaluates the source code to identify the symbol under the cursor and presents the relevant help item.

You get the best results, if your source code does not contain critical errors. The source code in this example has no errors, so feel free to position the cursor in different places and invoke the list of symbols or the F1 help to get acquainted with the functionality.

Next: Compile to ByteCode