Crestron simpl plus language ref 사용자 설명서
Crestron SIMPL+
®
Software
Language Reference Guide - DOC. 5797G
SIMPL+
®
z 313
// all global variables
INTEGER x;
STRING str[100];
DIGITAL_INPUT di;
#DEFAULT_NONVOLATILE // error – #DEFAULT_VOLATILE has already
// been set
INTEGER y;
#DEFAULT_NONVOLATILE // error – #DEFAULT_VOLATILE has already
// been set
INTEGER z;
FUNCTION MyFunc()
{
}
Compiler Error 1310
declaration error: Compiler directive cannot be in function
scope
Compiler directives cannot be used locally within functions. They can only be used
at a global level and the directive applies to the entire SIMPL+ module.
at a global level and the directive applies to the entire SIMPL+ module.
Scope refers to the level at which an Event, user-defined function or statement
resides. Having a global scope means that the function or variable can be called or
accessed from anywhere within the program. A local scope means that the variable
can only be accessed from within the event or function that it resides in.
The following are examples of this error:
resides. Having a global scope means that the function or variable can be called or
accessed from anywhere within the program. A local scope means that the variable
can only be accessed from within the event or function that it resides in.
The following are examples of this error:
#DEFINE_CONSTANT MyConst 100 // ok – used globally
#USER_LIBRARY “MyUserLib” // ok – used globally
FUNCTION MyFunc()
{
#DEFINE_CONSTANT AnotherConst 100 // error – constants
cannot
// be used locally
#USER_LIBRARY “AnotherUserLib” // error – libraries
cannot
// be included locally
}