HARSFEN0602ElmoHARmonicaSoftwareManual

PRELIMINARYDRAFT

 

 

 

 

 

 

 

 

 

 

54

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

them in the database

 

 

24

Name is keyword

 

Variable or function name is the same as some keyword. This error may

 

 

 

 

 

 

appear if variable name is identical to some auto routine name.

 

 

 

 

 

 

For example,

 

 

 

 

 

 

int switch;

 

 

 

 

 

 

‘switch’ is keyword, so its use as variable name is illegal.

 

 

25

Name is not distinct

 

This error occurs if some variable or function name is not distinct.

 

 

 

 

 

 

For example,

 

 

 

 

 

 

int foo ;

 

 

 

 

 

 

function foo (int a)

 

 

 

 

 

 

Function and variable have the same name ‘foo’,

 

 

 

 

 

 

One more example,

 

 

 

 

 

 

function foo (int a ) ** Function definition

 

 

 

 

 

 

int a ; ** Local variable definition

 

 

 

 

 

 

Definition of the local variable ‘a’ is illegal, because this function is already

 

 

 

 

 

 

contains local variable ‘a’ as input argument.

 

 

26

Variable name is

 

This error occur in the following cases:

 

 

 

 

invalid

 

1. Variable or function name starts from digit or underscore, but not

 

 

 

 

 

 

from letter

 

 

 

 

 

 

2. Variable or function name is empty

 

 

 

 

 

 

3. At the variable definition line there is a comma as a separator

 

 

 

 

 

 

between variables, but variable name after a comma is absent.

 

 

 

 

 

 

For example,

 

 

 

 

 

 

int _abc ;

 

 

 

 

 

 

function (int a)

 

 

 

 

 

 

int a, b,

 

 

 

 

 

 

In the first example variable name has leading underscore.

 

 

 

 

 

 

In the second example variable name is absent after a comma.

 

 

 

 

 

 

In the third example function name is absent after the keyword ‘function’.

 

 

27

Bad separator between

 

The only legal separator between variables at the variable definition line is

 

 

 

 

variables

 

comma. After variable name either variable separator (comma) or expression

 

 

 

 

 

 

terminator is expected. Any other symbol causes to this error.

 

 

 

 

 

 

For example,

 

 

 

 

 

 

int a b;

 

 

 

 

 

 

A command as variable separator is absent between ‘a’ and ‘b’.

 

 

28

Illegal global variable

 

Global variable must be declared inside function with the keyword ‘global’

 

 

 

 

definition

 

and must be defined before this function. This error appears only if the

 

 

 

 

 

 

keyword ‘global’ was used in the bad context:

 

 

 

 

 

 

1. The keyword ’global’ was used outside function.

 

 

 

 

 

 

2. Variable that is declared as global inside function is not defined

 

 

 

 

 

 

before.

 

 

 

 

 

 

3. Type of the variable at the definition outside the function differ from

 

 

 

 

 

 

the type of the declaration inside function

 

 

 

 

 

 

For example,

 

 

 

 

 

 

int a1 ; ** Global variable definition

 

 

 

 

 

 

function foo (int a) ** Function definition

 

 

 

 

 

 

global float a1; ** Declaration of the global variable inside function

 

 

 

 

 

 

Type of variable a1 at its definition is ‘int’, while inside function is declared

 

 

 

 

 

 

as ‘float’.

 

 

29

Bad variable definition

 

All local variables must be defined at the beginning of the function. Any

 

 

 

 

 

 

variable definition after some executable code in the function is illegal.

 

 

 

 

 

 

For example,

 

 

 

 

 

 

function foo (int a) ** Function definition

 

 

 

 

 

 

int b ;

 

 

 

 

 

 

global int a1;

 

 

 

 

 

 

b = a ; ** Executable code

 

 

Page 56
Image 56
Elmo HARmonica, HARSFEN0602 software manual Preliminarydraft