9
//should be no longer than 100
11
arrayType : enumeration("TypeEnum", uint8(), typeEnumValues),
12
// length of this array is always equal to min(len.value, 100)
13
dynArray : array(uint8(), 10, null, updateLength),
15
//this array changes type depending on the value of arrayType
16
typeChangingArray : array(char(), 10, null, updateType),
21
function updateLength(mainStruct) {
22
//set the array length to the correct length (no more than 100)
23
var newLen = mainStruct.len.value;
29
function updateType(mainStruct) {
30
var type = mainStruct.arrayType.value;
31
if (type == typeEnumValues.char && this.childType != char())
32
this.setArrayType(char());
33
else if (type == typeEnumValues.int16 && this.childType != int16())
34
this.setArrayType(int16());
35
else if (type == typeEnumValues.int32 && this.childType != int32())
36
this.setArrayType(int32());
39
function validateLength() {
40
if (this.len.value > 100)
41
this.len.validationError = "len must be no bigger than 100";
43
this.len.valid = true;
45
var type = this.arrayType.value;
46
if (type == 0 || type == 1 || type == 2)
47
this.arrayType.valid = true;
49
this.arrayType.validationError = "value is not in enum";