@@ -429,9 +429,16 @@ ALIASES FOR OBJECT DICTIONARY VARIABLES
429429
430430 ODAs . Add ( ODA ) ;
431431
432-
433- ODAout += ( string . Format ( " #define {0,-51}{1}\r \n " , string . Format ( "ODA_{0}_{1}" , make_cname ( od . parameter_name ) , make_cname ( sub . parameter_name ) ) , sub . subindex ) ) ;
434-
432+ //Arrays do not have a size in the raw CO objects, Records do
433+ //so offset by one
434+ if ( od . objecttype == ObjectType . ARRAY )
435+ {
436+ ODAout += ( string . Format ( " #define {0,-51}{1}\r \n " , string . Format ( "ODA_{0}_{1}" , make_cname ( od . parameter_name ) , make_cname ( sub . parameter_name ) ) , sub . subindex - 1 ) ) ;
437+ }
438+ else
439+ {
440+ ODAout += ( string . Format ( " #define {0,-51}{1}\r \n " , string . Format ( "ODA_{0}_{1}" , make_cname ( od . parameter_name ) , make_cname ( sub . parameter_name ) ) , sub . subindex ) ) ;
441+ }
435442 }
436443
437444 file . Write ( ODAout ) ;
@@ -520,6 +527,9 @@ OBJECT DICTIONARY
520527 file . WriteLine ( @"] = {
521528" ) ;
522529
530+ bool arrayspecialcase = false ;
531+ int count = 0 ;
532+
523533 foreach ( KeyValuePair < UInt16 , ODentry > kvp in eds . ods )
524534 {
525535
@@ -552,8 +562,25 @@ OBJECT DICTIONARY
552562 if ( od . objecttype == ObjectType . ARRAY && od . nosubindexes > 0 )
553563 array = string . Format ( "[0]" ) ;
554564
565+
566+ if ( arrayspecial ( od . index , true ) )
567+ {
568+ arrayspecialcase = true ;
569+ count = 0 ;
570+ }
571+
572+ if ( arrayspecialcase )
573+ {
574+ array = string . Format ( "[{0}]" , count ) ;
575+ count ++ ;
576+ }
577+
555578 file . WriteLine ( string . Format ( "{{0x{0:x4}, 0x{1:x2}, 0x{2:x2}, {3}, (void*)&{4}.{5}{6}}}," , od . index , od . nosubindexes , flags , datasize , loc , make_cname ( od . parameter_name ) , array ) ) ;
556579
580+ if ( arrayspecial ( od . index , false ) )
581+ {
582+ arrayspecialcase = false ;
583+ }
557584 }
558585
559586
0 commit comments