Applies To:
  • CitectSCADA

Summary:

Compiler error reads "Total code size too large; refactor code".


Solution:
The statements that control decisions and loops in your functions are called conditional executors. Cicode uses four conditional executors: IF, FOR, WHILE, and SELECT CASE.

This compiler error indicates that a conditional executor is followed by too many executable statements. For example:

IF condition THEN

... too many executable statements ...

END

IF condition THEN

...

ELSE

... too many executable statements ...

END

FOR i = 1 TO x DO

... too many executable statements ...

END

WHILE condition DO

... too many executable statements ...

END

SELECT CASE x

...

CASE 42

... too many executable statements ...

...

END SELECT

The context of the compiler error points to the end of the problematic conditional executor. The executable statements will normally be found immediately before this line.

The Cicode needs to be reorganized to reduce the number executable statements within the conditional branch. One approach is to move the statements that follow the conditional executor into a separate function.

For example, rather than:

IF condition THEN

... take action on condition ...

END

you might instead add a new function:

FUNCTION TakeActionOnCondition()

... take action on condition ...

END

that is called as follows:

IF condition THEN

TakeActionOnCondition();

END


Keywords:
 Cicode, Compiler error,

Attachments