Crestron simpl plus language ref 사용자 설명서

다운로드
페이지 374
Crestron SIMPL+
®
Software 
Language Reference Guide - DOC. 5797G
 SIMPL+
®
 
z 305
}
FUNCTION myFunc2( STRING sArg[10],     // error – size is not 
allowed
                  STRING sArgArr[][] ) // error – 2-D strings not
                                       //         supported
{
}
Compiler Error 1301
declaration error:  Invalid array index 
An index is required when accessing any element of an array.  Two dimensional 
arrays require both indices of the array to be specified.  This index must be a valid 
numeric expression.
All arrays are passed to functions by reference, so specifying an index in this case is 
not allowed.
The following are examples of this error:
INTEGER xArr[10], x2dArr[10][20]; // ok
STRING str[100], strArr[50][100]; // ok
STRING_INPUT strIn[100];          // ok
STRING_OUTPUT strOut;             // ok
STRING str;                       // error – no length specified
STRING_INPUT strIn;               // error – no length specified
BUFFER_INPUT bufIn;               // error – no length specified
STRING_OUTPUT strOutArr[10][20];  // error – 2-D arrays not 
supported
STRING str[x];                    // error – variables are not 
allowed
STRING str[myFunc()];             // error – function calls are
                                  //         not allowed
INTEGER_FUNCTION MyIntFunc( INTEGER x[], INTEGER xArr[][] )
{
   xArr[1] = 5;                                         // ok
   xArr[1+2] = xArr[3+4];                               // ok
   xArr[1+xArr[2]] = xArr[xArr[3]];                     // ok
   xArr[MyIntFunc(xArr,x2dArr)] = 6;                    // ok
   x2dArr[1][2] = 6;                                    // ok
   x2dArr[xArr[1]][xArr[2]] = x2dArr[xArr[5]][xArr[6]]; // ok
   Call MyFunc( xArr, x2dArr );                         // ok
   xArr = 5;         // error – no index specified
   xArr[] = 0;       // error – no index specified
   xArr[str] = 6;    // error - s is a STRING
   xArr[5][6] = 7;   // error – xArr is not a 2D array