Too many elements in initializer
jjames
Posts: 2,908
Okay, perhaps I need a refresher with multi-array constants. I just put this in and I tried compiling.
Thanks!
P.S. - In case anyone is wondering, the strings are for the horrible Niles VS-6. A lovely piece that doesn't even echo or give any type of response. The 232 gives as much information back just as using IR.
CHAR c_NILES_ROUTING[][][]= { // Zone 1 { "$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$30,$30,$0D" // Source 1 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$30,$31,$0D" // Source 2 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$30,$32,$0D" // Source 3 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$30,$33,$0D" // Source 4 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$30,$34,$0D" // Source 5 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$30,$35,$0D" // Source 6 }, // Zone 2 { "$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$30,$38,$0D" // Source 1 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$30,$39,$0D" // Source 2 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$31,$30,$0D" // Source 3 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$31,$31,$0D" // Source 4 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$31,$32,$0D" // Source 5 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$31,$33,$0D" // Source 6 }, // Zone 3 { "$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$31,$36,$0D" // Source 1 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$31,$37,$0D" // Source 2 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$31,$38,$0D" // Source 3 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$31,$39,$0D" // Source 4 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$32,$30,$0D" // Source 5 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$32,$31,$0D" // Source 6 }, // Zone 4 { "$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$32,$34,$0D" // Source 1 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$32,$35,$0D" // Source 2 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$32,$36,$0D" // Source 3 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$32,$37,$0D" // Source 4 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$32,$38,$0D" // Source 5 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$32,$39,$0D" // Source 6 }, // Zone 5 { "$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$33,$32,$0D" // Source 1 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$33,$33,$0D" // Source 2 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$33,$34,$0D" // Source 3 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$33,$35,$0D" // Source 4 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$33,$36,$0D" // Source 5 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$33,$37,$0D" // Source 6 }, // Zone 6 { "$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$34,$30,$0D" // Source 1 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$34,$31,$0D" // Source 2 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$34,$32,$0D" // Source 3 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$34,$33,$0D" // Source 4 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$34,$34,$0D" // Source 5 ,"$26,$56,$38,$38,$33,$2C,$4B,$45,$59,$2C,$30,$34,$35,$0D" // Source 6 } }And of course get the "Too many elements in initializer" error. So, I put 14 in the last brackets, being that there's 14 "characters" in each string. Of course, that didn't work and still got the same error. So since there are 6 zones, and 6 sources each, I put [6][6][14] - same error. So I kept increasing the last number, and it eventually compiled okay with [][][55]. So, it's obvious I need a refresher. Why is the "correct" number 55 when I have 44 characters? Last I checked, 14 does not go into 55 evenly, so could someone explain to me again on how to put in the correct dimensions when setting up an array. I'm sure this was covered in P2 at one time or another . . . I just don't remember.
Thanks!
P.S. - In case anyone is wondering, the strings are for the horrible Niles VS-6. A lovely piece that doesn't even echo or give any type of response. The 232 gives as much information back just as using IR.
0
Comments
Is that a compile error, I get no errors???
DEFINE_FUNCTION CHAR[14] NILES_ROUTING(INTEGER zone, INTEGER source)
Just curious, if I define everything correctly then without quotes and all that, I then don't have to put in dimension definitions, correct? I thought I had seen something on how to define the dimensions, but I couldn't find it, which is what prompted me to create the thread and ask: How do you come up with the correct definitions. But if I don't have to and can do it this way, there's really no point is there?
Right, the last few bytes are different with each string. I could have only had the last couple of bytes in the string array, but for documentation purposes I put the entire string. I do have a function exactly how you have it. Within it is a SEND_STRING dvNILES,"c_NILES_ROUTING[nOUTPUT][nINPUT]".