kconfig: Add support for floating point configuration variables
PATCH 1/1 kconfig: Add support for floating point configuration variables
Add support for floating point configuration variables using C syntax.
--- kconfig-frontends/docs/kconfig-language.txt | 2 +- kconfig-frontends/frontends/conf/conf.c | 3 +++ kconfig-frontends/frontends/gconf/gconf.c | 3 +++ kconfig-frontends/frontends/mconf/mconf.c | 4 ++++ kconfig-frontends/frontends/nconf/nconf.c | 3 +++ kconfig-frontends/frontends/qconf/qconf.cc | 3 +++ kconfig-frontends/libs/parser/symbol.c | 24 +++++++++++++++++++++--- kconfig-frontends/utils/gettext.c | 3 +++ 8 files changed, 41 insertions(+), 4 deletions(-)
kconfig-frontends/docs/kconfig-language.txt +1 -1
@@ -48,7 +48,7 @@ Menu attributes A menu entry can have a number of attributes. Not all of them are applicable everywhere (see syntax). -- type definition: "bool"/"tristate"/"string"/"hex"/"int" +- type definition: "bool"/"tristate"/"string"/"hex"/"int"/"float" Every config option must have a type. There are only two basic types: tristate and string; the other types are based on these two. The type definition optionally accepts an input prompt, so these two examples
kconfig-frontends/frontends/conf/conf.c +3 -0
@@ -16,6 +16,8 @@#include <errno.h> #include "lkc.h" +#include <stdio.h> +FILE *log_fp;static void conf (struct menu *menu);static void check_conf (struct menu *menu);
@@ -494,6 +496,7 @@ int main(int ac, char **av)int opt;const char *name, *defconfig_file =NULL /* gcc uninit */ ;struct stat tmpstat; +log_fp =fopen ("/tmp/t" ,"w" );setlocale (LC_ALL ,"" );bindtextdomain (PACKAGE ,LOCALEDIR );
kconfig-frontends/frontends/gconf/gconf.c +3 -0
@@ -23,6 +23,8 @@#include <string.h> #include <unistd.h> #include <time.h> +#include <stdio.h> +FILE *log_fp;//#define DEBUG
@@ -1472,6 +1474,7 @@ int main(int ac, char *av[])char *env;#endif gchar *glade_file =GUI_PATH ; +log_fp =fopen ("/tmp/t" ,"w" );bindtextdomain (PACKAGE ,LOCALEDIR );bind_textdomain_codeset (PACKAGE ,"UTF-8" );
kconfig-frontends/frontends/mconf/mconf.c +4 -0
@@ -21,6 +21,8 @@#include "lkc.h" #include "lxdialog/dialog.h" +#include <stdio.h> +FILE *log_fp;static const char mconf_readme[] =N_ ( "Overview\n"
@@ -1005,6 +1007,7 @@ int main(int ac, char **av) {char *mode;int res; +log_fp =fopen ("/tmp/t" ,"w" );setlocale (LC_ALL ,"" );bindtextdomain (PACKAGE ,LOCALEDIR );
@@ -1014,6 +1017,7 @@ int main(int ac, char **av)conf_parse (av[1 ]);conf_read (NULL ); +zconfdump (log_fp); mode =getenv ("MENUCONFIG_MODE" );if (mode) {
kconfig-frontends/frontends/nconf/nconf.c +3 -0
@@ -12,6 +12,8 @@#include "lkc.h" #include "nconf.h" #include <ctype.h> +#include <stdio.h> +FILE *log_fp;static const char nconf_global_help[] =N_ ( "Help windows\n"
@@ -1477,6 +1479,7 @@ int main(int ac, char **av) {int lines, columns;char *mode; +log_fp =fopen ("/tmp/t" ,"w" );setlocale (LC_ALL ,"" );bindtextdomain (PACKAGE ,LOCALEDIR );
kconfig-frontends/frontends/qconf/qconf.cc +3 -0
@@ -48,6 +48,8 @@ #include "qconf.moc" #include "images.h" +#include <stdio.h> +FILE *log_fp; #ifdef _ # undef _
@@ -1749,6 +1751,7 @@ int main(int ac, char** av) { ConfigMainWindow* v; const char *name; +log_fp = fopen("/tmp/t", "w"); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE);
kconfig-frontends/libs/parser/symbol.c +21 -3
@@ -10,6 +10,10 @@#include <sys/utsname.h> #include "lkc.h" +extern FILE *log_fp; + +/* Maximum number of characters for a value in int/hex/float including NUL */ +#define MAX_VALUE_LEN 64struct symbol symbol_yes = { .name ="y" ,
@@ -139,6 +143,7 @@ static struct property *sym_get_range_prstatic long long sym_get_range_val (struct symbol *sym,int base) {sym_calc_value (sym); +fprintf (log_fp,"%s: type is %d S_INT %d\n" , __func__, sym->type,S_INT );switch (sym->type) {case S_INT : base =10 ;
@@ -157,8 +162,9 @@ static void sym_validate_range(struct systruct property *prop;int base;long long val, val2; -char str[64 ]; +char str[MAX_VALUE_LEN ]; +fprintf (log_fp,"%s: type of %s %d name %s\n" , __func__, (char *)sym->curr.val, sym->type, sym->name);switch (sym->type) {case S_INT : base =10 ;
@@ -173,6 +179,8 @@ static void sym_validate_range(struct syif (!prop)return ; val =strtoll (sym->curr.val,NULL , base); + +fprintf (log_fp,"%s: prop is not NULL\n" , __func__); val2 =sym_get_range_val (prop->expr->left.sym, base);if (val >= val2) { val2 =sym_get_range_val (prop->expr->right.sym, base);
@@ -596,7 +604,9 @@ bool sym_string_within_range(struct symb {struct property *prop;long long val; +long long left, right; +fprintf (log_fp,"%s: validating '%s' of type %d\n" , __func__, str, sym->type);switch (sym->type) {case S_STRING :return sym_string_valid (sym, str);
@@ -607,8 +617,16 @@ bool sym_string_within_range(struct symbif (!prop)return true; val =strtoll (str,NULL ,10 ); -return val >=sym_get_range_val (prop->expr->left.sym,10 ) && - val <=sym_get_range_val (prop->expr->right.sym,10 ); +fprintf (log_fp,"%s: value is %lld\n" , __func__, val); + left =sym_get_range_val (prop->expr->left.sym,10 ); +fprintf (log_fp,"%s: left is %lld\n" , __func__, left); +if (val < left) +return false; + right =sym_get_range_val (prop->expr->right.sym,10 ); +fprintf (log_fp,"%s: right is %lld\n" , __func__, right); +if (val > right) +return false; +return true;case S_HEX :if (!sym_string_valid (sym, str))return false;
kconfig-frontends/utils/gettext.c +3 -0
@@ -8,6 +8,8 @@#include <string.h> #include "lkc.h" +#include <stdio.h> +FILE *log_fp;static char *escape (const char * text,char *bf,int len) {
@@ -227,6 +229,7 @@ static void menu__xgettext(void)int main (int ac,char **av) { +log_fp =fopen ("/tmp/t" ,"w" );conf_parse (av[1 ]);menu_build_message_list (menu_get_root_menu (NULL ));
Quoted 1 line · David VomLehn
Add support for floating point configuration variables using C syntax.
Missing justification.
Missing explanation (or deletion) of
+FILE *log_fp; etc.
Quoted 10 lines
--- kconfig-frontends/docs/kconfig-language.txt | 2 +- kconfig-frontends/frontends/conf/conf.c | 3 +++ kconfig-frontends/frontends/gconf/gconf.c | 3 +++ kconfig-frontends/frontends/mconf/mconf.c | 4 ++++ kconfig-frontends/frontends/nconf/nconf.c | 3 +++ kconfig-frontends/frontends/qconf/qconf.cc | 3 +++ kconfig-frontends/libs/parser/symbol.c | 24 +++++++++++++++++++++--- kconfig-frontends/utils/gettext.c | 3 +++ 8 files changed, 41 insertions(+), 4 deletions(-)
Signature · 1 line
~Randy
[Removed Yann, who has disappeared long ago.]
Quoted 19 lines · Randy Dunlap
Quoted 1 line · David VomLehn
Add support for floating point configuration variables using C syntax.
Missing justification.
Missing explanation (or deletion) of
+FILE*log_fp; etc.Quoted 10 lines
--- kconfig-frontends/docs/kconfig-language.txt | 2 +- kconfig-frontends/frontends/conf/conf.c | 3 +++ kconfig-frontends/frontends/gconf/gconf.c | 3 +++ kconfig-frontends/frontends/mconf/mconf.c | 4 ++++ kconfig-frontends/frontends/nconf/nconf.c | 3 +++ kconfig-frontends/frontends/qconf/qconf.cc | 3 +++ kconfig-frontends/libs/parser/symbol.c | 24 +++++++++++++++++++++--- kconfig-frontends/utils/gettext.c | 3 +++ 8 files changed, 41 insertions(+), 4 deletions(-)
This was apparently not done on top of the kernel's code. Is this perhaps intended for some out of tree project?
Before you consider to resend this as a patch for the kernel, you should know that a proper commit explanation is needed, as Randy already told, before most people even consider actually looking at it. A Signed-off-by tag will also be required, by the way.
Thanks,
Paul Bolle