diff options
Diffstat (limited to 'scripts/kconfig')
-rw-r--r-- | scripts/kconfig/expr.c | 50 | ||||
-rw-r--r-- | scripts/kconfig/lkc_proto.h | 2 | ||||
-rw-r--r-- | scripts/kconfig/qconf.cc | 57 | ||||
-rw-r--r-- | scripts/kconfig/qconf.h | 4 |
4 files changed, 81 insertions, 32 deletions
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 87238afb21b7..6f98dbfe70cf 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -1013,73 +1013,73 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2) | |||
1013 | #endif | 1013 | #endif |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | void expr_print(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken) | 1016 | void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken) |
1017 | { | 1017 | { |
1018 | if (!e) { | 1018 | if (!e) { |
1019 | fn(data, "y"); | 1019 | fn(data, NULL, "y"); |
1020 | return; | 1020 | return; |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | if (expr_compare_type(prevtoken, e->type) > 0) | 1023 | if (expr_compare_type(prevtoken, e->type) > 0) |
1024 | fn(data, "("); | 1024 | fn(data, NULL, "("); |
1025 | switch (e->type) { | 1025 | switch (e->type) { |
1026 | case E_SYMBOL: | 1026 | case E_SYMBOL: |
1027 | if (e->left.sym->name) | 1027 | if (e->left.sym->name) |
1028 | fn(data, e->left.sym->name); | 1028 | fn(data, e->left.sym, e->left.sym->name); |
1029 | else | 1029 | else |
1030 | fn(data, "<choice>"); | 1030 | fn(data, NULL, "<choice>"); |
1031 | break; | 1031 | break; |
1032 | case E_NOT: | 1032 | case E_NOT: |
1033 | fn(data, "!"); | 1033 | fn(data, NULL, "!"); |
1034 | expr_print(e->left.expr, fn, data, E_NOT); | 1034 | expr_print(e->left.expr, fn, data, E_NOT); |
1035 | break; | 1035 | break; |
1036 | case E_EQUAL: | 1036 | case E_EQUAL: |
1037 | fn(data, e->left.sym->name); | 1037 | fn(data, e->left.sym, e->left.sym->name); |
1038 | fn(data, "="); | 1038 | fn(data, NULL, "="); |
1039 | fn(data, e->right.sym->name); | 1039 | fn(data, e->right.sym, e->right.sym->name); |
1040 | break; | 1040 | break; |
1041 | case E_UNEQUAL: | 1041 | case E_UNEQUAL: |
1042 | fn(data, e->left.sym->name); | 1042 | fn(data, e->left.sym, e->left.sym->name); |
1043 | fn(data, "!="); | 1043 | fn(data, NULL, "!="); |
1044 | fn(data, e->right.sym->name); | 1044 | fn(data, e->right.sym, e->right.sym->name); |
1045 | break; | 1045 | break; |
1046 | case E_OR: | 1046 | case E_OR: |
1047 | expr_print(e->left.expr, fn, data, E_OR); | 1047 | expr_print(e->left.expr, fn, data, E_OR); |
1048 | fn(data, " || "); | 1048 | fn(data, NULL, " || "); |
1049 | expr_print(e->right.expr, fn, data, E_OR); | 1049 | expr_print(e->right.expr, fn, data, E_OR); |
1050 | break; | 1050 | break; |
1051 | case E_AND: | 1051 | case E_AND: |
1052 | expr_print(e->left.expr, fn, data, E_AND); | 1052 | expr_print(e->left.expr, fn, data, E_AND); |
1053 | fn(data, " && "); | 1053 | fn(data, NULL, " && "); |
1054 | expr_print(e->right.expr, fn, data, E_AND); | 1054 | expr_print(e->right.expr, fn, data, E_AND); |
1055 | break; | 1055 | break; |
1056 | case E_CHOICE: | 1056 | case E_CHOICE: |
1057 | fn(data, e->right.sym->name); | 1057 | fn(data, e->right.sym, e->right.sym->name); |
1058 | if (e->left.expr) { | 1058 | if (e->left.expr) { |
1059 | fn(data, " ^ "); | 1059 | fn(data, NULL, " ^ "); |
1060 | expr_print(e->left.expr, fn, data, E_CHOICE); | 1060 | expr_print(e->left.expr, fn, data, E_CHOICE); |
1061 | } | 1061 | } |
1062 | break; | 1062 | break; |
1063 | case E_RANGE: | 1063 | case E_RANGE: |
1064 | fn(data, "["); | 1064 | fn(data, NULL, "["); |
1065 | fn(data, e->left.sym->name); | 1065 | fn(data, e->left.sym, e->left.sym->name); |
1066 | fn(data, " "); | 1066 | fn(data, NULL, " "); |
1067 | fn(data, e->right.sym->name); | 1067 | fn(data, e->right.sym, e->right.sym->name); |
1068 | fn(data, "]"); | 1068 | fn(data, NULL, "]"); |
1069 | break; | 1069 | break; |
1070 | default: | 1070 | default: |
1071 | { | 1071 | { |
1072 | char buf[32]; | 1072 | char buf[32]; |
1073 | sprintf(buf, "<unknown type %d>", e->type); | 1073 | sprintf(buf, "<unknown type %d>", e->type); |
1074 | fn(data, buf); | 1074 | fn(data, NULL, buf); |
1075 | break; | 1075 | break; |
1076 | } | 1076 | } |
1077 | } | 1077 | } |
1078 | if (expr_compare_type(prevtoken, e->type) > 0) | 1078 | if (expr_compare_type(prevtoken, e->type) > 0) |
1079 | fn(data, ")"); | 1079 | fn(data, NULL, ")"); |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | static void expr_print_file_helper(void *data, const char *str) | 1082 | static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) |
1083 | { | 1083 | { |
1084 | fwrite(str, strlen(str), 1, data); | 1084 | fwrite(str, strlen(str), 1, data); |
1085 | } | 1085 | } |
@@ -1089,7 +1089,7 @@ void expr_fprint(struct expr *e, FILE *out) | |||
1089 | expr_print(e, expr_print_file_helper, out, E_NONE); | 1089 | expr_print(e, expr_print_file_helper, out, E_NONE); |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | static void expr_print_gstr_helper(void *data, const char *str) | 1092 | static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) |
1093 | { | 1093 | { |
1094 | str_append((struct gstr*)data, str); | 1094 | str_append((struct gstr*)data, str); |
1095 | } | 1095 | } |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index e195c455bfef..a263746cfa7d 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -39,4 +39,4 @@ P(prop_get_type_name,const char *,(enum prop_type type)); | |||
39 | 39 | ||
40 | /* expr.c */ | 40 | /* expr.c */ |
41 | P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); | 41 | P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); |
42 | P(expr_print,void,(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken)); | 42 | P(expr_print,void,(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)); |
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index f3f86e735a87..425ce5ce2d12 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -925,6 +925,8 @@ void ConfigInfoView::setShowDebug(bool b) | |||
925 | _showDebug = b; | 925 | _showDebug = b; |
926 | if (menu) | 926 | if (menu) |
927 | menuInfo(); | 927 | menuInfo(); |
928 | else if (sym) | ||
929 | symbolInfo(); | ||
928 | emit showDebugChanged(b); | 930 | emit showDebugChanged(b); |
929 | } | 931 | } |
930 | } | 932 | } |
@@ -943,15 +945,44 @@ void ConfigInfoView::setSource(const QString& name) | |||
943 | const char *p = name.latin1(); | 945 | const char *p = name.latin1(); |
944 | 946 | ||
945 | menu = NULL; | 947 | menu = NULL; |
948 | sym = NULL; | ||
946 | 949 | ||
947 | switch (p[0]) { | 950 | switch (p[0]) { |
948 | case 'm': | 951 | case 'm': |
949 | if (sscanf(p, "m%p", &menu) == 1) | 952 | struct menu *m; |
953 | |||
954 | if (sscanf(p, "m%p", &m) == 1 && menu != m) { | ||
955 | menu = m; | ||
950 | menuInfo(); | 956 | menuInfo(); |
957 | } | ||
958 | break; | ||
959 | case 's': | ||
960 | struct symbol *s; | ||
961 | |||
962 | if (sscanf(p, "s%p", &s) == 1 && sym != s) { | ||
963 | sym = s; | ||
964 | symbolInfo(); | ||
965 | } | ||
951 | break; | 966 | break; |
952 | } | 967 | } |
953 | } | 968 | } |
954 | 969 | ||
970 | void ConfigInfoView::symbolInfo(void) | ||
971 | { | ||
972 | QString str; | ||
973 | |||
974 | str += "<big>Symbol: <b>"; | ||
975 | str += print_filter(sym->name); | ||
976 | str += "</b></big><br><br>value: "; | ||
977 | str += print_filter(sym_get_string_value(sym)); | ||
978 | str += "<br>visibility: "; | ||
979 | str += sym->visible == yes ? "y" : sym->visible == mod ? "m" : "n"; | ||
980 | str += "<br>"; | ||
981 | str += debug_info(sym); | ||
982 | |||
983 | setText(str); | ||
984 | } | ||
985 | |||
955 | void ConfigInfoView::menuInfo(void) | 986 | void ConfigInfoView::menuInfo(void) |
956 | { | 987 | { |
957 | struct symbol* sym; | 988 | struct symbol* sym; |
@@ -965,12 +996,20 @@ void ConfigInfoView::menuInfo(void) | |||
965 | head += "</b></big>"; | 996 | head += "</b></big>"; |
966 | if (sym->name) { | 997 | if (sym->name) { |
967 | head += " ("; | 998 | head += " ("; |
999 | if (showDebug()) | ||
1000 | head += QString().sprintf("<a href=\"s%p\">", sym); | ||
968 | head += print_filter(sym->name); | 1001 | head += print_filter(sym->name); |
1002 | if (showDebug()) | ||
1003 | head += "</a>"; | ||
969 | head += ")"; | 1004 | head += ")"; |
970 | } | 1005 | } |
971 | } else if (sym->name) { | 1006 | } else if (sym->name) { |
972 | head += "<big><b>"; | 1007 | head += "<big><b>"; |
1008 | if (showDebug()) | ||
1009 | head += QString().sprintf("<a href=\"s%p\">", sym); | ||
973 | head += print_filter(sym->name); | 1010 | head += print_filter(sym->name); |
1011 | if (showDebug()) | ||
1012 | head += "</a>"; | ||
974 | head += "</b></big>"; | 1013 | head += "</b></big>"; |
975 | } | 1014 | } |
976 | head += "<br><br>"; | 1015 | head += "<br><br>"; |
@@ -1015,9 +1054,9 @@ QString ConfigInfoView::debug_info(struct symbol *sym) | |||
1015 | switch (prop->type) { | 1054 | switch (prop->type) { |
1016 | case P_PROMPT: | 1055 | case P_PROMPT: |
1017 | case P_MENU: | 1056 | case P_MENU: |
1018 | debug += "prompt: "; | 1057 | debug += QString().sprintf("prompt: <a href=\"m%p\">", prop->menu); |
1019 | debug += print_filter(_(prop->text)); | 1058 | debug += print_filter(_(prop->text)); |
1020 | debug += "<br>"; | 1059 | debug += "</a><br>"; |
1021 | break; | 1060 | break; |
1022 | case P_DEFAULT: | 1061 | case P_DEFAULT: |
1023 | debug += "default: "; | 1062 | debug += "default: "; |
@@ -1088,9 +1127,17 @@ QString ConfigInfoView::print_filter(const QString &str) | |||
1088 | return res; | 1127 | return res; |
1089 | } | 1128 | } |
1090 | 1129 | ||
1091 | void ConfigInfoView::expr_print_help(void *data, const char *str) | 1130 | void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char *str) |
1092 | { | 1131 | { |
1093 | reinterpret_cast<QString*>(data)->append(print_filter(str)); | 1132 | QString* text = reinterpret_cast<QString*>(data); |
1133 | QString str2 = print_filter(str); | ||
1134 | |||
1135 | if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) { | ||
1136 | *text += QString().sprintf("<a href=\"s%p\">", sym); | ||
1137 | *text += str2; | ||
1138 | *text += "</a>"; | ||
1139 | } else | ||
1140 | *text += str2; | ||
1094 | } | 1141 | } |
1095 | 1142 | ||
1096 | QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) | 1143 | QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) |
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index fb50e1c6029f..b824f78cc06d 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h | |||
@@ -260,13 +260,15 @@ signals: | |||
260 | void showDebugChanged(bool); | 260 | void showDebugChanged(bool); |
261 | 261 | ||
262 | protected: | 262 | protected: |
263 | void symbolInfo(void); | ||
263 | void menuInfo(void); | 264 | void menuInfo(void); |
264 | QString debug_info(struct symbol *sym); | 265 | QString debug_info(struct symbol *sym); |
265 | static QString print_filter(const QString &str); | 266 | static QString print_filter(const QString &str); |
266 | static void expr_print_help(void *data, const char *str); | 267 | static void expr_print_help(void *data, struct symbol *sym, const char *str); |
267 | QPopupMenu* createPopupMenu(const QPoint& pos); | 268 | QPopupMenu* createPopupMenu(const QPoint& pos); |
268 | void contentsContextMenuEvent(QContextMenuEvent *e); | 269 | void contentsContextMenuEvent(QContextMenuEvent *e); |
269 | 270 | ||
271 | struct symbol *sym; | ||
270 | struct menu *menu; | 272 | struct menu *menu; |
271 | bool _showDebug; | 273 | bool _showDebug; |
272 | }; | 274 | }; |