R
Robbie Hatley
Greetings, group. I've got a big MESS of code in one of the source
files of my employer's primary software product. It's basically
assignments of automatically-generated control-id macros to arrays,
so they can be easily accessed by nested for loops. This mess
looks like:
AuxChanId [0] [0] = IG1_CH1;
AuxTypeId [0] [0] = IG1_TYPE1;
AuxOperId [0] [0] = IG1_OP1;
AuxThreId [0] [0] = IG1_THRESH1;
AuxMinuId [0] [0] = IG1_MM1;
AuxSecoId [0] [0] = IG1_SS1;
AuxHoldId [0] [0] = IG1_HOLD1;
AuxChanId [0] [1] = IG1_CH2;
AuxTypeId [0] [1] = IG1_TYPE2;
AuxOperId [0] [1] = IG1_OP2;
AuxThreId [0] [1] = IG1_THRESH2;
AuxMinuId [0] [1] = IG1_MM2;
AuxSecoId [0] [1] = IG1_SS2;
AuxHoldId [0] [1] = IG1_HOLD2;
AuxChanId [0] [2] = IG1_CH3;
AuxTypeId [0] [2] = IG1_TYPE3;
AuxOperId [0] [2] = IG1_OP3;
AuxThreId [0] [2] = IG1_THRESH3;
AuxMinuId [0] [2] = IG1_MM3;
AuxSecoId [0] [2] = IG1_SS3;
AuxHoldId [0] [2] = IG1_HOLD3;
.
.
.
AuxChanId [1] [0] = IG2_CH1;
AuxTypeId [1] [0] = IG2_TYPE1;
AuxOperId [1] [0] = IG2_OP1;
AuxThreId [1] [0] = IG2_THRESH1;
AuxMinuId [1] [0] = IG2_MM1;
AuxSecoId [1] [0] = IG2_SS1;
AuxHoldId [1] [0] = IG2_HOLD1;
.
.
.
(continuing likewise for hundreds more lines)
.
.
.
Ugly as hell and takes up a lot of space. Is this any way to wind this
into nested for loops, perhaps by using preprocessor commands to
generate the macro name strings and insert them on the right?
Perhaps something using the stringizing and concatenation commands?
I don't see how to go about it, though... or even if it CAN be done.
files of my employer's primary software product. It's basically
assignments of automatically-generated control-id macros to arrays,
so they can be easily accessed by nested for loops. This mess
looks like:
AuxChanId [0] [0] = IG1_CH1;
AuxTypeId [0] [0] = IG1_TYPE1;
AuxOperId [0] [0] = IG1_OP1;
AuxThreId [0] [0] = IG1_THRESH1;
AuxMinuId [0] [0] = IG1_MM1;
AuxSecoId [0] [0] = IG1_SS1;
AuxHoldId [0] [0] = IG1_HOLD1;
AuxChanId [0] [1] = IG1_CH2;
AuxTypeId [0] [1] = IG1_TYPE2;
AuxOperId [0] [1] = IG1_OP2;
AuxThreId [0] [1] = IG1_THRESH2;
AuxMinuId [0] [1] = IG1_MM2;
AuxSecoId [0] [1] = IG1_SS2;
AuxHoldId [0] [1] = IG1_HOLD2;
AuxChanId [0] [2] = IG1_CH3;
AuxTypeId [0] [2] = IG1_TYPE3;
AuxOperId [0] [2] = IG1_OP3;
AuxThreId [0] [2] = IG1_THRESH3;
AuxMinuId [0] [2] = IG1_MM3;
AuxSecoId [0] [2] = IG1_SS3;
AuxHoldId [0] [2] = IG1_HOLD3;
.
.
.
AuxChanId [1] [0] = IG2_CH1;
AuxTypeId [1] [0] = IG2_TYPE1;
AuxOperId [1] [0] = IG2_OP1;
AuxThreId [1] [0] = IG2_THRESH1;
AuxMinuId [1] [0] = IG2_MM1;
AuxSecoId [1] [0] = IG2_SS1;
AuxHoldId [1] [0] = IG2_HOLD1;
.
.
.
(continuing likewise for hundreds more lines)
.
.
.
Ugly as hell and takes up a lot of space. Is this any way to wind this
into nested for loops, perhaps by using preprocessor commands to
generate the macro name strings and insert them on the right?
Perhaps something using the stringizing and concatenation commands?
I don't see how to go about it, though... or even if it CAN be done.