evolve

Statement Summary

Appendix 1 Statements

Flow Control

if The if statement evaluates the logical expression if it evaluates to true then it runs the code following if it evaluates to false then the code is skipped. Can be used with the else statement or on its own.

Prototype:

if <logical expression>

...code

else

...code

_if

while If the logical expression evaluates to true the code between while and _while is run, otherwise it is skipped.

Prototype:

while <logical expression>

...code

_while

loop If the loops the code a specific number of times incrementing the variable each time.

Prototype:

loop <variable> <variable | constant>

...code

_loop

Arguments

variable

variable | constant

The variable to set to zero on first pass and then increment.

Variable or constant defining the number loops

iter The iter statement allows iteration through a variable list.

Prototype:

iter <variable> <variable list>

...code

_iter

switch The switch statement compares the variable with the constants if they match then the associated block is called. If there is no match but there is a default then this block will be run.

Prototype:

switch <variable>

...<constant> <block>

...<constant> <block>

...default <block>

_switch

? Conditional Operator allows values to be assigned depending on a simple operand

Prototype:

l<header>? <variable1 | constant1> <operand> <variable2 | constant2> <variable3> = <variable4 | constant4> : <variable5 | constant5>

Arguments:

Look Up Table

lookup_get Allows access to data in a look up table

Prototype:

Arguments:

lookup_get <data> <table> <field> <row>

lookup_size Gets the size of a lookup table

Prototype:

Arguments:

lookup_size <fields> <rows> <table>

table

fields

rows

The table to get the value from.

The number of fields in a row

The number of rows in the table

Screen Output

out Sends data to the screen, another version of the command is outl this is the same command but adds a line feed when the data is displayed.

Prototype:

Argument:

out <variable | constant> ...

variable | constant a variable or constant to be displayed on the screen, multiple values can be sent at once.

outlst Sends a list variable to the screen, each element is separated by a delimiter.

Prototype:

Argument:

outlist <variable> <delimiter | constant>

variable a list variableto be displayed on the screen.

delimiter | constant a string delimiter or the constant #LF for a line feed.

out_format Specifies the print width, alignment and fill character.

Prototype:

Arguments:

out_format <width> <fill character> <alignment>

width

fill character

alignment

The width of the print field

The fill character.

The alignment which can be #RIGHT, #LEFT or #CENTER

out_fprec Specifies the precision to use for displaying floating point numbers.

Prototype:

Argument

out_fprec <decimal places>

decimal places The number of decimal places.

out_fbase Specifies the base to display floating point numbers in.

Prototype:

Argument:

out_fbase <base>

base The base it can be #DEFAULTFLOAT, #FIXED, #SCIENTIFIC, #HEXFLOAT

out_ibase The base to display integer values in.

Prototype:

Argument

out_ibase <base>

base The base it can be #DEC, #OCT, #HEX

new_line Prints a line feed

Console

con_cls Clears the console.

Prototype:

new_line

Prototype:

con_cls

con_colour Sets the text colour

Prototype:

Abbreviation:

Arguments:

con_colour <foreground colour> <background colour>

cc

foreground colour

background colour

The foreground colour.

The background colour.

The values can be one of the following #BLACK, #BLUE, #GREEN, #CYAN, #RED, #MAGENTA, #YELLOW, #WHITE, #BLACK_INT, #BLUE_INT, #GREEN_INT, #CYAN_INT, #RED_INT, #MAGENTA_INT, #YELLOW_INT, #WHITE_INT or byte values generated from the following bits Blue = 1, Green = 2, Red = 4, High Intensity = 8.

con_xy Sets the position to write to on the console screen.

Prototype:

Argument

con_xy <x coordinate> <y coordinate>

x coordinate

y coordinate

X position to display data.

Y position to display data.

con_title Sets the title of the console.

Prototype:

Argument:

con_title <title>

title The string to set as the title.

con_cursor Allows the cursor to be enabled or disabled.

Prototype:

Argument:

con_cursor <enable>

enable Set to true to enable the cursor.

Keyboard Input

in Allows data entry from the keyboard if the passed variable is numeric then in will only allow numeric input.

Prototype:

Argument:

in <input data>

input data The data read from the keyboard.

key_in Gets data from the keyboard if a byte is passed returns the ASCII code, if a string is passed returns the character. If no key has been pressed returns 0 or “”.

Prototype:

Abbreviation:

Argument:

key_in <input data>

<<-

input data The data read from the keyboard

key_inwait The same as key_in but waits for a character to be pressed.

Prototype:

Argument:

key_inwait <input data>

input data The data read from the keyboard.

Misc

= Allows a value to be assigned to a variable.

Prototype:

Arguments:

<variable> assign <value>

variable

value

Variable to be assigned value to.

Value to be assigned.

++ Increments a variable

Prototype:

Argument

++ <variable>

variable Variable to increment.

-- Decrements a variable

Prototype:

Argument

-- <variable>

variable Variable to decrement.

Blocks

block Defines the start of a code block definition.

Prototype:

block <block name> <var1>...

...code

_block

Arguments:

Block name

var1

The name of the block.

One or more arguments for the block.

exit_block Exits the current block and returns to the calling block.

Prototype:

exit_block

exit_program Exits the program.

Prototype:

exit_program

def Defines the start of a definition block

Prototype:

def

..variable definition

_def

Files

fo_open Opens a file to write to.

Prototype:

Arguments:

fo_open <file id> <filename>

file id

filename

Gets set to the file id or 0 if the file cannot be opened

Filename of the file to open

fo_openapp Opens a file to append extra data to.

Prototype:

Arguments:

fo_openapp <file id> <filename>

file id

filename

Gets set to the file id or 0 if the file cannot be opened

Filename of the file to open

fi_open Opens a file to read data from.

Prototype:

Arguments:

fi_open <is open> <filename>

file id

filename

Gets set to the file id or 0 if the file cannot be opened

Filename of the file to open.

fi_read Reads binary data from an input file

Prototype:

Argument

fi_read <file id> <data>

file id

data

The id of the file to read

Variable to return the read data in.

fi_readtxt Reads text data from the input file until the stop character or end of file is reached.

Prototype:

Argument

fi_readtxt <file id> <data> <stop character>

file id

data

stop character

The id of the file to read

String variable to read the data into.

String will be read until this character is read or EOF is reached

fi_readbytes Reads a specified number of bytes into a byte list which it resizes to the specified number of bytes.

Prototype:

Argument

fi_readbytes <file id> <byt> <bytes>

file id

data

bytes

The id of the file to read

Byte list to read the data into

The number of bytes

fi_readbyte Reads a byte from the input file.

Prototype:

Argument

fi_readbyte <file id> <data>

file id

data

The id of the file to read

Byte were the read data is returned.

fo_write Writes binary data to the open file.

Prototype:

Argument

fo_write<file id> <data><data><...>

data The variable to write to the file.

file id

data

The id of the file to write

The variable to write to the file.

fo_writetxt Writes the passed variable as text to the open file, a similar command is fo_writetxtl which adds a carriage return after the write.

Prototype:

Argument

fo_writetxt <file id> <data><data><...>

file id

data

The id of the file to write

The variable to write to the file.

fo_close Closes the open output file

Prototype:

Argument

fo_close <file id>

file id The id of the file to close

fi_close Closes the open input file.

Prototype:

fi_close <file id>

fo_isopen Used to check if the output file is open.

Prototype:

Argument:

fo_isopen <file id> <is open>

is open

file id

Gets set to true if the output file is true

The id of the file to check

fi_isopen Used to check if the input file is open.

Prototype:

Argument:

fi_isopen <file id> <is open>

is open

file id

Gets set to true if the input file is true

The id of the file to check

fi_eof Checks if all the data has been read from the input file.

Prototype:

Argument:

fi_eof <file id> <is eof>

is eof

file id

Gets set to true if reached the end of file.

The id of the file to check

f_delete Deletes a file.

Prototype:

Arguments:

f_delete <file deleted> <filename>

file deleted

filename

Gets set to true if the file is deleted successfully.

The filename to delete.

f_rename Renames a file.

Prototype:

Arguments:

f_rename <file renamed> <new filename> <old filename>

file renamed

new filename

old filename

Gets set to true if the file is renamed successfully.

The new name of the file to set.

The old filename.

f_copy Copies a file.

Prototype:

Arguments:

f_copy <file copied> <destination> <source file name>

file copied

destination

source file name

Gets set to true if file copied successfully.

The desination to copy the file to

The file to copy

f_copy Copies a file.

Prototype:

Arguments:

f_copy <file copied> <destination> <source file name>

file copied

destination

source file name

Gets set to true if file copied successfully.

The desination to copy the file to

The file to copy

f_chgext Changes a filename extesnion

Prototype:

Arguments:

f_chgext <new name> <old name> <new extension>

new name

old name

New extension

The updated filename

The filename to change the extension of

The new extension

f_splitname Splits a string containing the path and file name into its parts

Prototype:

Arguments:

f_splitname <name container> <filename>

name container

filename

Returns a container with the following information

Var.Path – The path of the file

Var.Name – The filename

Var.Ext – the extension

The filename to split

f_details Loads a CSV file into a container.

Prototype:

Arguments:

f_details <detail container> <filename>

detail container

filename

Returns a container with the following information

Details.Hour

Details.Min

Details.Sec

Details.Day

Details.Mon

Details.Yr

The filename to check

filecsv_out Saves a container as a CSV file.

Prototype:

Arguments:

fcsv_out <file loaded> <container> <filename>

file saved

container

filename

Gets set to true if the file is saved successfully.

The container to save to the file.

The filename to save.

Directory

dir_get Gets the files and sub directories at the path.

Prototype:

Arguments:

dir_get <files> <path>

files

path

String list of the found files.

Path to the directory to get.

dir_make Creates a new directory.

Prototype:

Arguments:

dir_make <directory created> <directory name>

directory created

directory name

Gets set to true if the directory is created.

The name of the directory to create.

dir_remove Removes a directory.

Prototype:

Arguments:

dir_remove<directory removed> <directory name>

directory removed

directory name

Gets set to true if the directory is removed.

The name of the directory to remove.

Strings

str_add Appends one or more string to the end of another string.

Prototype:

Arguments:

str_add <string1> <string2> <...>

string1

string2

The string to add string2 to.

The string to add to string1.

str_find Finds the position of one string within another string.

Prototype:

Arguments:

str_find <sub string position> <string> <string to find> <search start position>

str_ regex Finds the position of strings within another string that match a regular expression.

Prototype:

Arguments:

str_regex <container list> <string> <regular expression>

container list

string

regular expression

Container list of the found matches

Var.Str - The found string matches

Var.Pos - The found string positions

The string to search.

The regular expression to find.

str_wild Finds the position of strings within another string that match a wild card expression.

Prototype:

Arguments:

str_wild <result container> <string> <wild card expression> <start pos>

str_sub Gets a portion of an existing string

Prototype:

Arguments:

str_sub <new string> <old string> <start> <number chars>

str_replace Replaces a sub string within a string with another one.

Prototype:

Arguments:

str_replace <string> <find string> <replace string>

string

find string

replace string

String to do the replace in.

The sub string to find.

The string to replace the sub string with.

str_split Gets a sub string of an existing string from an index to the end or beginning of the string.

Prototype:

Arguments:

str_split <new string> <old string> <split> <split direction>

str_len Gets the length of a string.

Prototype:

Arguments:

str_len <length> <string>

length

string

Gets set to the length of the string.

The string to get the length of.

str_strtobyte Gets the ASCII value of a character from a string.

Prototype:

Abbreviation:

Argument

str_strtobyte <ASCII value> <string> <byte position>

ssb

ASCII value

string

byte position

Byte which gets set to the ASCII value of the selected characters.

The string to get the byte from.

The position of the byte within the string.

str_bytetostr Converts an ASCII value to a string.

Prototype:

Argument

str_bytetostr <string> <ASCII value>

string

ASCII Value

The string to set to the character.

The ASCII value of the character.

Conversion

cvt_hexint Converts a hex string to an integer

Prototype:

Arguments:

cvt_hexint <integer> <hex string>

integer

hex string

The value of the converted hex string.

The string to convert.

cvt_inthex Converts an integer to a hex string

Prototype:

Argument

cvt_inthex <hex string> <integer>

hex string

integer

Hex string representation of the integer.

Value to convert to the hex string.

cvt_toupper Converts a string to upper case

Prototype:

Argument:

cvt_toupper <string>

string the string to convert to upper case.

cvt_tolower Converts a string to lower case.

Prototype:

Argument

cvt_tolower <string>

string the string to convert to lower case.

Random

seed_rnd Seeds the random number generation.

Prototype:

Argument:

seed_rnd <seed>

Seed the value to seed the random number generator with.

Time

tm_get Gets the current time which is returned as a container.

Prototype:

Argument

tm_get <@Time>

Time.Hour

Time.Min

Time.Sec

The current hour.

The current minute.

The current second.

tm_dif Calculates the difference between 2 times in seconds

Prototype:

Arguments:

tm_dif <difference> <@Time1><@Time2>

tm_sectotime Converts seconds to hours, minutes, seconds.

Prototype:

Arguments:

tm_sectotime <@Time><seconds to convert>

date_get Gets the current date

Prototype:

Argument

date_get <@Date>

Date.day

Date.Mon

Date.Yr

The current day.

The current month.

The current year.

sleep Puts the program into sleep mode for the set time

Prototype:

Argument:

sleep <milliseconds>

milliseconds The milliseconds the program should sleep for.

Timer

tr_reset Resets the timer

Prototype:

Argument:

tr_reset <timer>

timer The timer to reset

tr_elapsed Gets the elapsed time in milliseconds

Prototype:

Argument:

tr_elapsed <elapsed time><timer>

elapsed time

timer

The elapsed time

The timer variable.

tr_expired Checks if the timer has expired

Prototype:

Argument:

tr_expired <is expired><timer><time out>

is expired

timer

time out

Gets set to true if the timer has expired.

The timer variable.

The time out in milliseconds.

tr_regular Checks if the timer has expired if it has then resets the timer

Prototype:

Argument:

tr_regular <is expired><timer><time out>

is expired

timer

time out

Gets set to true if the timer has expired.

The timer variable.

The time out in milliseconds.

Variables

var_del Deletes the passed variable from the stack.

Prototype:

Argument:

var_del <variable>

variable The variable to delete from the stack.

var_exits Checks if a variable exists

Prototype:

Arguments:

var_exists <exists> <variable>

exists

variable

Gets set to true if the variable exists.

The variable to check.

var_type Gets the variable type

Prototype:

Arguments:

var_type<type> <variable>

type

variable

Returns a value indicating the variable type

bool = 0

float = 1

int = 2

byte = 3

string = 4

container = 5

unknown = 0xFF

The variable to check.

lst_size Gets the number of elements in the list.

Prototype:

Arguments:

lst_size <number of elements> <list>

number of elements

list

The number of elements in the list or 0 if the variable doesn't exist

The list to get the number of elements from.

lst_resize Adjusts the number of elements in a list.

Prototype:

Arguments:

lst_resize <variable> <new size>

variable

new size

The list variable.

The size to set the list to.

lst_delelement Deletes an element within a list.

Prototype:

Arguments:

Prototype:

Arguments:

lst_extract Extracts variables from a byte list

lst_delelement <element>

Element The element to delete in the list.

lst_extract <var1> <type1> <bytes> <var..> <type..> <byte_list>

var1

type1

byte_list

Variable to assign extracted data to.

Variable constant type defining how to extract the data #BOOL, #BYTE, #INT16, #INT32, #INT64, #LINT16, #LINT32, #LINT64, #STR, #STRNULL.

The byte_list to extract the data from.

lst_set Sets variables in a byte list

Prototype:

Arguments:

lst_set <byte_list> <var1> <type1> <bytes> <var..> <type..>

byte_list

var1

type1

The byte_list to set to the data

Variable to add to the byte buffer

Variable constant type defining how to set the data #BOOL, #BYTE, #INT16, #INT32, #INT64, #LINT16, #LINT32, #LINT64, #STR, #STRNULL.

lst_bitlist Allows a string list to be created from another list using a bit map to decide the new fields

Prototype:

Arguments:

lst_bitlst <dest_str_list> <src_str_list> <evl_int>

dest_str_list

src_str_list

evl_int

The list which will contain the sub set of the src list.

The list containing the source strings.

The int bit map used to map src_str_list into dest_str_list list.

lst_sort Sorts the elements in a list

Prototype:

Arguments:

lst_sort <list> <direction>

list

direction

The list to be sorted

Constant defining the sort #ASCEND, #DESCEND

lst_find Finds an element in a list

Prototype:

Arguments:

lst_find <found_index> <list> <search_value> <start_pos>

Serial Port

ser_open Opens a serial port.

Prototype:

Arguments:

ser_open <is open> <port id> <serial port>

Is open

port id

Serial port

Gets set to true if the port is opened.

The port id to use.

String representing the port id (e.g. COM1)

ser_tx Sends data over the serial port.

Prototype:

Arguments:

ser_tx <bytes sent> <port id> <list> <bytes to send>

ser_rx Receives data from the serial port.

Prototype:

Argument:

ser_rx <bytes received> <list> <port id><bytes to receive>

ser_close Closes the serial port

Prototype:

Argument:

ser_close <port id>

Port id The port id to use.

ser_isopen Checks if the port is open.

Prototype:

Argument:

ser_isopen <is open> <port id>

is open Gets set to true if the port ism open.

ser_getports Gets the serial port ids.

Prototype:

Arguments:

ser_getports <number ports> <port ids>

number ports

port ids

The number of ports found.

String list which gets set to the port ids.

ser_baudrate Sets the baud rate of the serial port.

Prototype:

Argument:

ser_baudrate <port id> <baud rate>

port ids

baud rate

String list which gets set to the port ids.

The baud rate #BAUD110, #BAUD300, #BAUD600, #BAUD1200, #BAUD2400, #BAUD4800, #BAUD9600, #BAUD14400, #BAUD19200, #BAUD38400, #BAUD57600, #BAUD115200, #BAUD128000, #BAUD256000.

ser_dtrcontrol Sets the DTR control.

Prototype:

Argument

ser_dtrcontrol <port id> <dtr>

port ids

dtr

String list which gets set to the port ids.

The dtr value #DTRCONTROLDISABLE, #DTRCONTROLENABLE, #DTRCONTROLHANDSHAKE

ser_rtscontrol Sets the RTS control

Prototype:

Argument:

ser_rtscontrol <port id> <rts>

port id

rts

The port id to use

The rts value #RTSCONTROLDISABLE, #RTSCONTROLENABLE, #RTSCONTROLHANDSHAKE, #RTSCONTROLTOGGLE

ser_bytesize Sets the number of bits in the byte.

Prototype:

Argument:

ser_bytesize <port id> <size>

Size The number of bits in a byte.

ser_parity Sets the parity.

Prototype:

Argument:

ser_parity <port id> <parity>

port ids

parity

String list which gets set to the port ids.

The parity to set #PARITYNONE, #PARITYODD, #PARITYEVEN, #PARITYMARK, #PARITYSPACE

ser_stopbits Sets the number of stop bits.

Prototype:

Argument:

ser_stopbits <port id> <stop bits>

port ids

stop bits

String list which gets set to the port ids.

Sets the stop bits #STOPBITONE, #STOPBITSONE5, #STOPBITSTWO

ser_xonchar Sets the XON character.

Prototype:

Argument:

ser_xonchar <port id> <character>

character The XON character.

ser_xoffchar Sets the XOFF character.

Prototype:

Argument:

ser_xoffchar <port id> <character>

character The XOFF character.

External Programs

ext_run Runs an external file.

Prototype:

Argument

ext_run <is running> <file to run>

is running

file to run

Gets set to true if the external program runs.

The path of the file to run

ext_active Checks if the external programming is running

Prototype:

Argument

ext_active <is running>

is running Gets set to true if the external program is running

Assertions

ASSERT Causes an assertion if the logical expression evaluates to true and displays the message.

ASSERT

Prototype:

Argument

Causes an assertion if the logical expression evaluates to true and displays the message.

ASSERT <logical expression> <description>

logical expression

description

The expression to evaluate.

Text description of the assertion.