Too many elements in initializer
jjames
AMX Sustaining Engineer
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.
Comments
-
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 }, -
Thanks, but even when putting it in brackets I get the "too many elements" deal without putting [55].
-
Thanks, but even when putting it in brackets I get the "too many elements" deal without putting [55].
Is that a compile error, I get no errors??? -
Those strings are all the same except for the 2nd to last and 3rd to last bytes... why not write a function to construct the appropriate string based on 'zone' and 'source' parameters, as opposed to store all the correct strings in an array?
DEFINE_FUNCTION CHAR[14] NILES_ROUTING(INTEGER zone, INTEGER source) -
Yeah, was an error. My bad though - I didn't remove the quote from the string definitions. Once I removed them, all was good.AMXJeff wrote:Is that a compile error, I get no errors???
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]".mpullin wrote:Those strings are all the same except for the 2nd to last and 3rd to last bytes... why not write a function to construct the appropriate string based on 'zone' and 'source' parameters, as opposed to store all the correct strings in an array?
DEFINE_FUNCTION CHAR[14] NILES_ROUTING(INTEGER zone, INTEGER source)
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums