Skip to content

Commit fc2f913

Browse files
committed
fields definition macros now extrat template typename from target variable type
1 parent 4a7f83c commit fc2f913

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

menu.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,6 @@ for encoders, joysticks, keyboards or touch a stream must be made out of them
9999
};\
100100
menu id (text,sizeof(id##_data)/sizeof(prompt*),id##_data);
101101

102-
/*#define CHOOSE(type,id,text,...)\
103-
FOR_EACH(menuValue<type> DECL_VALUE,__VA_ARGS__)\
104-
menuValue<type>* const id##_data[]={\
105-
FOR_EACH(DEF,__VA_ARGS__)\
106-
};\
107-
menuChoice<type> id (text,sizeof(id##_data)/sizeof(prompt*),id##_data);*/
108-
109102
#define CHOOSE(target,id,text,...)\
110103
FOR_EACH(menuValue<typeof(target)> DECL_VALUE,__VA_ARGS__)\
111104
menuValue<typeof(target)>* const id##_data[]={\
@@ -125,13 +118,13 @@ for encoders, joysticks, keyboards or touch a stream must be made out of them
125118
#define VALUE(...) VALUE_(__COUNTER__,__VA_ARGS__)
126119

127120
#define DECL_OP_(cnt,...) prompt op##cnt(__VA_ARGS__);
128-
#define DECL_FIELD_(cnt,type,...) menuField<type> _menuField##cnt(__VA_ARGS__);
121+
#define DECL_FIELD_(cnt,target,...) menuField<typeof(target)> _menuField##cnt(target,__VA_ARGS__);
129122
#define DECL_SUBMENU(id)
130123
#define DECL_VALUE(...) _##__VA_ARGS__
131124
#define _VALUE_(cnt,...) choice##cnt(__VA_ARGS__);
132125

133126
#define DEF_OP_(cnt,...) &op##cnt
134-
#define DEF_FIELD_(cnt,type,...) &_menuField##cnt
127+
#define DEF_FIELD_(cnt,...) &_menuField##cnt
135128
#define DEF_SUBMENU(id) &id
136129
#define DEF_VALUE(id) &id
137130
#define DEF_VALUE_(cnt,...) &choice##cnt

0 commit comments

Comments
 (0)