Option opt(param), ...

Set interpreter options. This command is an "escape" mechanism to give an instruction to the script interpreter. It does not by itself do something, but affect how the interpreter reads and executes your script. If the interpreter understands this instruction, it will honor it, otherwise the instruction will be ignored.

General

The Option command should used be only at places it is intended for. It may not work correctly when used elsewhere.

Since it usually interpreted when the script is read, not when it is executed, parameters to commands cannot be expressions, nor does it make sense to execute Option conditionally within an If or Try.

Option Encoding

 Option Encoding("type")

Defines the script encoding. If you have strings written in a particular character set, name that character set using this command. For example,

 Option Encoding("koi8-r")

says that you wrote your strings in a cyrillic character set.

Place the command at the beginning of your script. It will affect all lines after it.

This option is supported by PCC2 1.99.12 (desktop version), ignored by PCC2 Web and PCC 1.x.

Option Optimize

 Option Optimize(level)

Set the optimisation level. The parameter is a numeric literal. When PCC2 reads the script and compiles it into an internal representation, it can perform some transformations that make the script quicker to execute. Possible optimisation levels are:

  • 0 (no optimisation, but some standard code selection intelligence is still used)
  • 1 (normal optimisation, default)
  • 2 (enable more expensive optimisations)
  • 3 (enable optimisations that may change behaviour in boundary case, e.g. generate different error messages than normal)
  • -1 (generate most naive code possible. This setting is not intended for normal use, but as a way out if I broke something and optimisation breaks your script.)

As of PCC2 1.99.22, no level 2 or 3 optimisations are implemented.

Place the command at the beginning of your script or subroutine. It will affect this script/subroutine and everything defined within, but not other subroutines following yours.

This option is supported by PCC2 1.99.22.

Option LocalSubs / LocalTypes

 Option LocalSubs(flag)
 Option LocalTypes(flag)

Set availability of the experimental features Local Subroutines and Local Types, see there. The parameter is either 0 (off, default) or 1 (on).

Place the command at the beginning of your script or subroutine. It will affect this script/subroutine and everything defined within, but not other subroutines following yours.

These options are supported by PCC2 1.99.22.

Since: PCC 1.0.19, PCC2 1.99.9

See also: Elementary Commands