* Re: [ANNOUNCE] kernelconf-0.1.2
2002-01-24 6:45 Anuradha Ratnaweera
2002-01-24 22:47 ` Sam Ravnborg
@ 2002-02-05 20:01 ` Christian Koenig
2002-02-06 6:22 ` Anuradha Ratnaweera
1 sibling, 1 reply; 10+ messages in thread
From: Christian Koenig @ 2002-02-05 20:01 UTC (permalink / raw)
To: Anuradha Ratnaweera; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 406 bytes --]
Hi,
The atachmend is a little beta/patch to your kernelconf.
It adds xconfig capability to kernelconf, by using Tcl/Tk scripts.
It's still a little bit beta, but the main parts like config file
loading/storing, menu-deps ... are implemented.
The main disatvantage for the moment: it doesn't looks like the original
xconfig, but i'm working on it.
MfG,Christian Koenig (and sorry for my poor english)
[-- Attachment #2: kernelconf-xconfig.diff --]
[-- Type: text/x-diff, Size: 34324 bytes --]
diff -uNrb kernelconf-0.1.2/conf/deps.d kernelconf-0.1.2.new/conf/deps.d
--- kernelconf-0.1.2/conf/deps.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/deps.d Tue Feb 5 20:49:04 2002
@@ -0,0 +1,16 @@
+deps.o: deps.c /usr/include/ctype.h /usr/include/features.h \
+ /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
+ /usr/include/bits/types.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h \
+ /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+ /usr/include/endian.h /usr/include/bits/endian.h \
+ /usr/include/malloc.h /usr/include/stdio.h /usr/include/libio.h \
+ /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/include/bits/wchar.h /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h \
+ /usr/include/bits/stdio_lim.h /usr/include/string.h \
+ /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
+ /usr/include/sys/select.h /usr/include/bits/select.h \
+ /usr/include/bits/sigset.h /usr/include/bits/time.h \
+ /usr/include/sys/sysmacros.h /usr/include/alloca.h kernelconf.h \
+ expressions.h utils.h tree.h
Binary files kernelconf-0.1.2/conf/deps.o and kernelconf-0.1.2.new/conf/deps.o differ
diff -uNrb kernelconf-0.1.2/conf/expressions.c kernelconf-0.1.2.new/conf/expressions.c
--- kernelconf-0.1.2/conf/expressions.c Thu Jan 24 05:27:08 2002
+++ kernelconf-0.1.2.new/conf/expressions.c Sun Feb 3 19:01:45 2002
@@ -836,6 +836,122 @@
return tmp;
}
+void fprintf_value2tk(FILE *tclf, Type type, Value value)
+{
+ switch (type) {
+ case TYPE_TRI:
+// case TYPE_MODULE:
+ case TYPE_BOOL:
+ case TYPE_OPTION:
+ fprintf(tclf,"%c",value.char_val); break;
+ case TYPE_INT:
+ case TYPE_HEX:
+ case TYPE_CHAR:
+ fprintf(tclf,"%d",value.int_val); break;
+ case TYPE_SYMBOL:
+ fprintf(tclf,"CONFIG_%s",value.id_val->name); break;
+ case TYPE_STR:
+ case TYPE_VALUE:
+ fprintf(tclf,"%s",value.str_val); break;
+ default:
+ fprintf(tclf,"%d %d test1",TYPE_CHAR,type);
+ break;
+ }
+}
+
+void tcl_pop(FILE *tclf, TokenPtr *stack)
+{
+ TokenPtr token;
+
+ token = pop(stack);
+ if(token->type != TYPE_VALUE )
+ fprintf(tclf," [ ");
+
+
+ switch (token->type) {
+ case TYPE_OR:
+ fprintf(tclf,"sym_or");
+ tcl_pop(tclf,stack);
+ tcl_pop(tclf,stack);
+ break;
+ case TYPE_AND:
+ fprintf(tclf,"sym_and");
+ tcl_pop(tclf,stack);
+ tcl_pop(tclf,stack);
+ break;
+ case TYPE_EQUAL:
+ fprintf(tclf,"sym_equal");
+ tcl_pop(tclf,stack);
+ tcl_pop(tclf,stack);
+ break;
+ case TYPE_NOT_EQUAL:
+ fprintf(tclf,"sym_not_equal");
+ tcl_pop(tclf,stack);
+ tcl_pop(tclf,stack);
+ break;
+ case TYPE_LT:
+ fprintf(tclf,"sym_lt");
+ tcl_pop(tclf,stack);
+ tcl_pop(tclf,stack);
+ break;
+ case TYPE_GT:
+ fprintf(tclf,"sym_gt");
+ tcl_pop(tclf,stack);
+ tcl_pop(tclf,stack);
+ break;
+ case TYPE_LTE:
+ fprintf(tclf,"sym_lte");
+ tcl_pop(tclf,stack);
+ tcl_pop(tclf,stack);
+ break;
+ case TYPE_GTE:
+ fprintf(tclf,"sym_gte");
+ tcl_pop(tclf,stack);
+ tcl_pop(tclf,stack);
+ break;
+ case TYPE_NOT:
+ fprintf(tclf,"sym_not");
+ tcl_pop(tclf,stack);
+ break;
+ case TYPE_DEPENDS:
+ fprintf(tclf,"sym_depends");
+ tcl_pop(tclf,stack);
+ tcl_pop(tclf,stack);
+ break;
+ case TYPE_DERIVED:
+ fprintf(tclf,"sym_derived");
+ tcl_pop(tclf,stack);
+ break;
+ case TYPE_SYMBOL:
+ fprintf(tclf,"get_sym");
+ case TYPE_VALUE:
+ fprintf(tclf," ");
+ fprintf_value2tk(tclf,token->type,token->value);
+ break;
+ default:
+ fprintf(tclf,"test2");
+ ;
+ }
+
+ if(token->type != TYPE_VALUE )
+ fprintf(tclf," ] ");
+
+ free_token(token);
+}
+
+void evaluate_expressions2tk(FILE *tclf, ExpressionPtr exp) {
+
+ TokenPtr token, stack, t;
+
+ stack = NULL;
+ for (t = exp->first_token; t; t = t->next) {
+ token = duplicate_token(t);
+ push(&stack, token);
+ }
+ tcl_pop(tclf,&stack);
+}
+
+
/*
* Expressions are represented as a sequence of tokens. These tokens are
* operators, of TYPE_VALUE or of type TYPE_SYMBOL. While evaluating, we don't
diff -uNrb kernelconf-0.1.2/conf/expressions.d kernelconf-0.1.2.new/conf/expressions.d
--- kernelconf-0.1.2/conf/expressions.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/expressions.d Tue Feb 5 20:49:04 2002
@@ -0,0 +1,16 @@
+expressions.o: expressions.c /usr/include/ctype.h \
+ /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/gnu/stubs.h /usr/include/bits/types.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h \
+ /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+ /usr/include/endian.h /usr/include/bits/endian.h \
+ /usr/include/malloc.h /usr/include/stdio.h /usr/include/libio.h \
+ /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/include/bits/wchar.h /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h \
+ /usr/include/bits/stdio_lim.h /usr/include/string.h \
+ /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
+ /usr/include/sys/select.h /usr/include/bits/select.h \
+ /usr/include/bits/sigset.h /usr/include/bits/time.h \
+ /usr/include/sys/sysmacros.h /usr/include/alloca.h kernelconf.h \
+ expressions.h utils.h tree.h
diff -uNrb kernelconf-0.1.2/conf/expressions.h kernelconf-0.1.2.new/conf/expressions.h
--- kernelconf-0.1.2/conf/expressions.h Thu Jan 24 05:27:09 2002
+++ kernelconf-0.1.2.new/conf/expressions.h Sat Feb 2 13:24:30 2002
@@ -16,5 +16,7 @@
Type get_generic_type(Type);
void free_token(TokenPtr);
char get_boolean_value(TokenPtr);
+void fprintf_value2tk(FILE *tclf, Type type, Value value);
+void evaluate_expressions2tk(FILE *tclf, ExpressionPtr exp);
#endif /* _KCONF_EXPRESSIONS_H */
Binary files kernelconf-0.1.2/conf/expressions.o and kernelconf-0.1.2.new/conf/expressions.o differ
diff -uNrb kernelconf-0.1.2/conf/header.tk kernelconf-0.1.2.new/conf/header.tk
--- kernelconf-0.1.2/conf/header.tk Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/header.tk Tue Feb 5 20:49:47 2002
@@ -0,0 +1,384 @@
+proc config_option {w line text sym symname havesym help havehelp child havechild} {
+ frame $w.f$line
+
+ if { $havesym & 4 } {
+ radiobutton $w.f$line.sy -text "y" -variable $symname -value y \
+ -relief groove -width 2 -command "change_sym_$symname true"
+ if { $sym != "SYM_BOOL" && $sym != "SYM_TRI" && $sym != "SYM_OPTION"} {
+ $w.f$line.sy configure -text "-" -state disabled
+ } elseif { $sym == "SYM_OPTION" } {
+ $w.f$line.sy configure -text ""
+ }
+ pack $w.f$line.sy -side left -fill y
+ }
+
+ if { $havesym & 2 } {
+ radiobutton $w.f$line.sm -text "m" -variable $symname -value m \
+ -relief groove -width 2 -command "change_sym_$symname true"
+
+ if { $sym != "SYM_MODULE" && $sym != "SYM_TRI" } {
+ $w.f$line.sm configure -text "-" -state disabled
+ }
+ pack $w.f$line.sm -side left -fill y
+ }
+
+ if { $havesym & 1 } {
+ radiobutton $w.f$line.sn -text "n" -variable $symname -value n \
+ -relief groove -width 2 -command "change_sym_$symname true"
+ if { $sym != "SYM_BOOL" && $sym != "SYM_MODULE" && $sym != "SYM_TRI" } {
+ $w.f$line.sn configure -text "-" -state disabled
+ }
+ pack $w.f$line.sn -side left -fill y
+ }
+
+ message $w.f$line.m -text "$text" -anchor w -width 10000
+ pack $w.f$line.m -side left -fill both -expand on
+
+ if { $havehelp } {
+ if { $help != "" } {
+ button $w.f$line.h -text "?" -command $help
+ } else {
+ button $w.f$line.h -text "?" -state disabled -relief flat
+ }
+ pack $w.f$line.h -side left -fill y
+ }
+
+ if { $havechild } {
+ if { $child != "" } {
+ button $w.f$line.c
+ child_button_on $w $line "$text" "$child"
+ } else {
+ button $w.f$line.c -text "->" -state disabled -relief flat
+ }
+ pack $w.f$line.c -side left -fill y
+ }
+
+ pack $w.f$line -anchor w -fill both -expand y -in $w.canvas.sbf
+}
+
+proc child_button_on { w line text child } {
+ $w.f$line.c configure -text "->"
+ $w.f$line.c configure -command "create_window $w $line \"$text\" \"$child\";$child;create_scrollbar $w.c$line"
+ $w.f$line.c configure -relief raised
+}
+
+proc child_button_off { w line } {
+ $w.f$line.c configure -text "<-"
+ $w.f$line.c configure -command "destroy $w.c$line"
+ $w.f$line.c configure -relief flat
+}
+
+proc init_window { w text } {
+
+ scrollbar $w.vscroll -command "$w.canvas yview"
+ pack $w.vscroll -side right -fill y
+
+ canvas $w.canvas -relief flat -borderwidth 0 -yscrollcommand "$w.vscroll set"
+ frame $w.canvas.sbf
+ pack $w.canvas -side right -fill y -expand on
+}
+
+proc calwi { cmd w } {
+ if { [ winfo parent $w ] != "" } {
+ return [ expr [ calwi $cmd [ winfo parent $w ] ] + [ winfo $cmd $w ] ]
+ } else {
+ return [ winfo $cmd $w ]
+ }
+}
+
+proc maxwi { cmd w } {
+ if { [ winfo parent $w ] != "" } {
+ return [ max [ maxwi $cmd [ winfo parent $w ] ] [ winfo $cmd $w ] ]
+ } else {
+ return [ winfo $cmd $w ]
+ }
+}
+
+proc create_window { w line text child } {
+
+ toplevel $w.c$line -class Dialog
+ wm title $w.c$line $text
+
+ init_window $w.c$line $text
+
+ eval "bind $w.c$line <Destroy> { child_button_on $w $line \"$text\" \"$child\" }"
+ child_button_off $w $line
+
+# button $w.c$line.close -text "<-" -command "destroy $w.c$line"
+# pack $w.c$line.close -side left -anchor n
+
+# set posx [ maxwi reqw $w ]
+# set posy [ expr [ calwi y $w.f$line.c ] - [ calwi y $w.c$line.close ] ]
+# set posy [ calwi y $w.f$line.c ]
+
+# wm geometry $w.c$line +$posx+$posy
+}
+
+proc create_scrollbar { w } {
+
+ set sizok 0
+ #[expr [winfo reqheight $w.f2.ok] + 12]
+ #pack $w.canvas.sbf
+ update idletasks
+ set maxy [expr [winfo screenheight .] * 3 / 4]
+ set canvtotal [winfo reqheight $w.canvas.sbf]
+ if [expr $sizok + $canvtotal < $maxy] {
+ set sizy $canvtotal
+ } else {
+ set sizy [expr $maxy - $sizok]
+ }
+
+ $w.canvas configure -width [winfo reqw $w.canvas.sbf] -height $sizy \
+ -scrollregion "0 0 [winfo reqw $w.canvas.sbf] [winfo reqh $w.canvas.sbf]"
+ $w.canvas configure -yscrollincrement 10
+ $w.canvas create window 0 0 -anchor nw -window $w.canvas.sbf
+ pack $w.canvas -side right -fill y -expand on
+ # update idletasks
+
+}
+
+proc dohelp { w parent filename start length } {
+ catch {destroy $w }
+ toplevel $w -class Dialog
+ set filefound 0
+ if { [file readable $filename] == 1} then {
+ set filefound 1
+ set id [open $filename]
+ seek $id $start
+ set message [read $id $length]
+ close $id
+ }
+ frame $w.f1
+ pack $w.f1 -fill both -expand on
+ set oldFocus [focus]
+ frame $w.f2
+ button $w.f2.ok -text "OK" -width 10 -command "destroy $w; catch {focus $oldFocus}"
+ pack $w.f2.ok -side bottom -pady 6 -anchor n
+ pack $w.f2 -side bottom -padx 10 -anchor s
+ scrollbar $w.f1.vscroll -command "$w.f1.canvas yview"
+ pack $w.f1.vscroll -side right -fill y
+
+ canvas $w.f1.canvas -relief flat -borderwidth 0 -yscrollcommand "$w.f1.vscroll set"
+ frame $w.f1.f
+ pack $w.f1.canvas -side right -fill y -expand on
+ if { $filefound == 0 } then {
+ message $w.f1.f.m -width 750 -aspect 300 -relief flat -text \
+ "No help available - unable to open file $filename. This file should have come with your kernel."
+ label $w.f1.bm -bitmap error
+ wm title $w "RTFM"
+ } else {
+ text $w.f1.f.m -width 73 -relief flat -wrap word
+ $w.f1.f.m insert 0.0 $message
+ $w.f1.f.m conf -state disabled -height [$w.f1.f.m index end]
+ label $w.f1.bm -bitmap info
+ wm title $w "Configuration help"
+ }
+ pack $w.f1.f.m -side left
+ pack $w.f1.bm $w.f1.f -side left -padx 10
+ focus $w
+ set winx [expr [winfo x $parent]+20]
+ set winy [expr [winfo y $parent]+20]
+ wm geometry $w +$winx+$winy
+ set sizok [expr [winfo reqheight $w.f2.ok] + 12]
+ set maxy [expr [winfo screenheight .] * 3 / 4]
+ set canvtotal [winfo reqheight $w.f1.f.m]
+ if [expr $sizok + $canvtotal < $maxy] {
+ set sizy $canvtotal
+ } else {
+ set sizy [expr $maxy - $sizok]
+ }
+ $w.f1.canvas configure -height $sizy -width [winfo reqwidth $w.f1.f.m] \
+ -scrollregion "0 0 [winfo reqwidth $w.f1.f.m] [winfo reqheight $w.f1.f.m]"
+ $w.f1.canvas create window 0 0 -anchor nw -window $w.f1.f
+ update idletasks
+ set maxy [winfo screenheight .]
+ if [expr $sizok + $canvtotal < $maxy] {
+ set sizy [expr $sizok + $canvtotal]
+ } else {
+ set sizy $maxy
+ }
+ wm maxsize $w [winfo width $w] $sizy
+}
+
+proc write_symbol { conf conf_h type symname symval } {
+ switch $type {
+ "SYM_TRI" - "SYM_BOOL" - "SYM_OPTION" {
+ if { $symval == "y" } {
+ puts $conf_h "#define CONFIG_$symname 1"
+ puts $conf "CONFIG_$symname=y"
+ } elseif { $symval == "m" } {
+ puts $conf_h "#undef CONFIG_$symname"
+ puts $conf_h "#define CONFIG_$symname_MODULE 1"
+ puts $conf "CONFIG_$symname=m"
+ } else {
+ puts $conf_h "#undef CONFIG_$symname"
+ puts $conf "# CONFIG_$symname is not set"
+ }
+ }
+ "SYM_NULL" {
+ puts conf_h "#undef CONFIG_$symname"
+ puts conf "# CONFIG_$symname is not set"
+ }
+ }
+}
+
+proc read_config { conf_name } {
+ if { [string length $conf_name] == 0 || [file readable $conf_name] != 1 } then { return }
+ set conf [ open $conf_name r ]
+ while { [ gets $conf line ] >= 0 } {
+ if [regexp {([0-9A-Za-z_]+)=([ynm])} $line foo var value] {
+ if { $value == "y" } then { set cmd "global $var; set $var y" }
+ if { $value == "n" } then { set cmd "global $var; set $var n" }
+ if { $value == "m" } then { set cmd "global $var; set $var m" }
+ eval $cmd
+ }
+ if [regexp {# ([0-9A-Za-z_]+) is not set} $line foo var] {
+ set cmd "global $var; set $var n"
+ eval $cmd
+ }
+ if [regexp {([0-9A-Za-z_]+)=([0-9A-Fa-f]+)} $line foo var value] {
+ set cmd "global $var; set $var $value"
+ eval $cmd
+ }
+ if [regexp {([0-9A-Za-z_]+)="([^"]*)"} $line foo var value] {
+ set cmd "global $var; set $var \"$value\""
+ eval $cmd
+ }
+ }
+ close $conf
+}
+
+proc update_menu_sym { w type symsize symval } {
+ catch {
+ if { $symsize & 4 } {
+ if { $symval == "n" } {
+ eval "$w.sy configure -text \"y\" -state disabled"
+ } else {
+ eval "$w.sy configure -text \"y\" -state normal"
+ }
+ }
+ if { $symsize & 2 } {
+ if { $symval == "n" } {
+ eval "$w.sm configure -text \"m\" -state disabled"
+ } else {
+ eval "$w.sm configure -text \"m\" -state normal"
+ }
+ }
+ if { $symsize & 1 } {
+ if { $symval == "n" } {
+ eval "$w.sn configure -text \"n\" -state disabled"
+ } else {
+ eval "$w.sn configure -text \"n\" -state normal"
+ }
+ }
+ }
+}
+
+proc conv_boolean { value } {
+ if { $value == "" } { return "n" }
+ if { $value == 0 } { return "n" }
+ if { $value == "n" } { return "n" }
+ if { $value == "m" } { return "m" }
+ return "y"
+}
+
+proc sym_not { value } {
+ set value [ conv_boolean $value ]
+ if { $value == "n" } { return "y" }
+ return "n"
+}
+
+proc bool2int { value } {
+ if { $value == "n" } {
+ return 0
+ } elseif { $value == "m" } {
+ return 1
+ } else {
+ return 2
+ }
+}
+
+proc int2bool { value } {
+ if { $value == 0 } {
+ return "n"
+ } elseif { $value == 1 } {
+ return "m"
+ } else {
+ return "y"
+ }
+}
+
+proc min { value1 value2 } {
+ if { $value1 < $value2 } {
+ return $value1
+ } else {
+ return $value2
+ }
+}
+
+proc max { value1 value2 } {
+ if { $value1 < $value2 } {
+ return $value1
+ } else {
+ return $value2
+ }
+}
+
+proc get_sym { symname } {
+ set cmd "global $symname; return \$$symname"
+ return [ eval $cmd ]
+}
+
+proc sym_and { value1 value2 } {
+ set value1 [ bool2int [ conv_boolean $value1 ] ]
+ set value2 [ bool2int [ conv_boolean $value2 ] ]
+ set value [ min $value1 $value2 ]
+ return [ int2bool $value ]
+}
+
+proc sym_or { value1 value2 } {
+ set value1 [ bool2int [ conv_boolean $value1 ] ]
+ set value2 [ bool2int [ conv_boolean $value2 ] ]
+ set value [ max $value1 $value2 ]
+ return [ int2bool $value ]
+}
+
+proc sym_equal { value1 value2 } {
+ if { $value1 == $value2 } { return "y" }
+ set value1 [ conv_boolean $value1 ]
+ set value2 [ conv_boolean $value2 ]
+ if { $value1 == $value2 } { return "y" }
+ return "n"
+}
+
+proc sym_not_equal { value1 value2 } {
+ if { $value1 == $value2 } { return "n" }
+ set value1 [ conv_boolean $value1 ]
+ set value2 [ conv_boolean $value2 ]
+ if { $value1 == $value2 } { return "n" }
+ return "y"
+}
+
+proc sym_depends { value1 value2 } {
+ if { $value1 == "y" } {
+ if { $value2 == "n" } {
+ return "n"
+ } else {
+ return "y"
+ }
+ } else {
+ return "y"
+ }
+}
+
+proc sym_derived { value } {
+ if { $value == "y" } { return "" }
+ return "n"
+}
+
+proc update_derived { symname derived } {
+}
+
+proc update_depends { symname depends } {
+}
+
diff -uNrb kernelconf-0.1.2/conf/help.d kernelconf-0.1.2.new/conf/help.d
--- kernelconf-0.1.2/conf/help.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/help.d Tue Feb 5 20:49:05 2002
@@ -0,0 +1,10 @@
+help.o: help.c /usr/include/stdio.h /usr/include/features.h \
+ /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h \
+ /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h \
+ /usr/include/bits/sched.h /usr/include/libio.h \
+ /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/include/bits/wchar.h /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h \
+ /usr/include/bits/stdio_lim.h /usr/include/malloc.h \
+ /usr/include/string.h help.h kernelconf.h
Binary files kernelconf-0.1.2/conf/help.o and kernelconf-0.1.2.new/conf/help.o differ
Binary files kernelconf-0.1.2/conf/kernelconf and kernelconf-0.1.2.new/conf/kernelconf differ
diff -uNrb kernelconf-0.1.2/conf/kernelconf.d kernelconf-0.1.2.new/conf/kernelconf.d
--- kernelconf-0.1.2/conf/kernelconf.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/kernelconf.d Tue Feb 5 20:49:05 2002
@@ -0,0 +1,5 @@
+kernelconf.o: kernelconf.c /usr/include/string.h \
+ /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/gnu/stubs.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h menuconfig.h \
+ oldconfig.h readconfig.h readsymbols.h xconfig.h
Binary files kernelconf-0.1.2/conf/kernelconf.o and kernelconf-0.1.2.new/conf/kernelconf.o differ
diff -uNrb kernelconf-0.1.2/conf/menuconfig.d kernelconf-0.1.2.new/conf/menuconfig.d
--- kernelconf-0.1.2/conf/menuconfig.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/menuconfig.d Tue Feb 5 20:49:05 2002
@@ -0,0 +1,18 @@
+menuconfig.o: menuconfig.c /usr/include/ctype.h \
+ /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/gnu/stubs.h /usr/include/bits/types.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h \
+ /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+ /usr/include/endian.h /usr/include/bits/endian.h /usr/include/stdio.h \
+ /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/include/bits/wchar.h /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h \
+ /usr/include/bits/stdio_lim.h /usr/include/string.h \
+ /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
+ /usr/include/sys/select.h /usr/include/bits/select.h \
+ /usr/include/bits/sigset.h /usr/include/bits/time.h \
+ /usr/include/sys/sysmacros.h /usr/include/alloca.h \
+ /usr/include/unistd.h /usr/include/bits/posix_opt.h \
+ /usr/include/bits/confname.h /usr/include/getopt.h \
+ ../include/linux/version.h tree.h kernelconf.h deps.h expressions.h \
+ help.h writeconfig.h
Binary files kernelconf-0.1.2/conf/menuconfig.o and kernelconf-0.1.2.new/conf/menuconfig.o differ
diff -uNrb kernelconf-0.1.2/conf/oldconfig.d kernelconf-0.1.2.new/conf/oldconfig.d
--- kernelconf-0.1.2/conf/oldconfig.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/oldconfig.d Tue Feb 5 20:49:06 2002
@@ -0,0 +1 @@
+oldconfig.o: oldconfig.c
Binary files kernelconf-0.1.2/conf/oldconfig.o and kernelconf-0.1.2.new/conf/oldconfig.o differ
diff -uNrb kernelconf-0.1.2/conf/readconfig.d kernelconf-0.1.2.new/conf/readconfig.d
--- kernelconf-0.1.2/conf/readconfig.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/readconfig.d Tue Feb 5 20:49:06 2002
@@ -0,0 +1,17 @@
+readconfig.o: readconfig.c /usr/include/ctype.h \
+ /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/gnu/stubs.h /usr/include/bits/types.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h \
+ /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+ /usr/include/endian.h /usr/include/bits/endian.h \
+ /usr/include/malloc.h /usr/include/stdio.h /usr/include/libio.h \
+ /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/include/bits/wchar.h /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h \
+ /usr/include/bits/stdio_lim.h /usr/include/stdlib.h \
+ /usr/include/sys/types.h /usr/include/time.h \
+ /usr/include/sys/select.h /usr/include/bits/select.h \
+ /usr/include/bits/sigset.h /usr/include/bits/time.h \
+ /usr/include/sys/sysmacros.h /usr/include/alloca.h \
+ /usr/include/string.h ../include/linux/version.h kernelconf.h \
+ readsymbols.h help.h tree.h utils.h
Binary files kernelconf-0.1.2/conf/readconfig.o and kernelconf-0.1.2.new/conf/readconfig.o differ
diff -uNrb kernelconf-0.1.2/conf/readsymbols.d kernelconf-0.1.2.new/conf/readsymbols.d
--- kernelconf-0.1.2/conf/readsymbols.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/readsymbols.d Tue Feb 5 20:49:06 2002
@@ -0,0 +1,17 @@
+readsymbols.o: readsymbols.c /usr/include/ctype.h \
+ /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/gnu/stubs.h /usr/include/bits/types.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h \
+ /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+ /usr/include/endian.h /usr/include/bits/endian.h \
+ /usr/include/malloc.h /usr/include/stdio.h /usr/include/libio.h \
+ /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/include/bits/wchar.h /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h \
+ /usr/include/bits/stdio_lim.h /usr/include/stdlib.h \
+ /usr/include/sys/types.h /usr/include/time.h \
+ /usr/include/sys/select.h /usr/include/bits/select.h \
+ /usr/include/bits/sigset.h /usr/include/bits/time.h \
+ /usr/include/sys/sysmacros.h /usr/include/alloca.h \
+ /usr/include/string.h ../include/linux/version.h kernelconf.h deps.h \
+ expressions.h readsymbols.h help.h utils.h tree.h
Binary files kernelconf-0.1.2/conf/readsymbols.o and kernelconf-0.1.2.new/conf/readsymbols.o differ
diff -uNrb kernelconf-0.1.2/conf/tree.d kernelconf-0.1.2.new/conf/tree.d
--- kernelconf-0.1.2/conf/tree.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/tree.d Tue Feb 5 20:49:06 2002
@@ -0,0 +1,4 @@
+tree.o: tree.c /usr/include/malloc.h /usr/include/features.h \
+ /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h tree.h \
+ kernelconf.h utils.h
Binary files kernelconf-0.1.2/conf/tree.o and kernelconf-0.1.2.new/conf/tree.o differ
diff -uNrb kernelconf-0.1.2/conf/utils.d kernelconf-0.1.2.new/conf/utils.d
--- kernelconf-0.1.2/conf/utils.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/utils.d Tue Feb 5 20:49:06 2002
@@ -0,0 +1,7 @@
+utils.o: utils.c /usr/include/ctype.h /usr/include/features.h \
+ /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
+ /usr/include/bits/types.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h \
+ /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+ /usr/include/endian.h /usr/include/bits/endian.h \
+ /usr/include/malloc.h
Binary files kernelconf-0.1.2/conf/utils.o and kernelconf-0.1.2.new/conf/utils.o differ
diff -uNrb kernelconf-0.1.2/conf/writeconfig.d kernelconf-0.1.2.new/conf/writeconfig.d
--- kernelconf-0.1.2/conf/writeconfig.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/writeconfig.d Tue Feb 5 20:49:07 2002
@@ -0,0 +1,10 @@
+writeconfig.o: writeconfig.c /usr/include/stdio.h \
+ /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/gnu/stubs.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h \
+ /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h \
+ /usr/include/bits/sched.h /usr/include/libio.h \
+ /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/include/bits/wchar.h /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h \
+ /usr/include/bits/stdio_lim.h kernelconf.h writeconfig.h
Binary files kernelconf-0.1.2/conf/writeconfig.o and kernelconf-0.1.2.new/conf/writeconfig.o differ
diff -uNrb kernelconf-0.1.2/conf/xconfig.c kernelconf-0.1.2.new/conf/xconfig.c
--- kernelconf-0.1.2/conf/xconfig.c Thu Jan 24 05:27:08 2002
+++ kernelconf-0.1.2.new/conf/xconfig.c Tue Feb 5 20:12:52 2002
@@ -6,9 +6,322 @@
* Copyright (C) 2002 by Anuradha Ratnaweera
*/
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "kernelconf.h"
+#include "expressions.h"
+
+#define MAX_MENU_NAME 256
+#define MAX_VALUE_SIZE 256
+
+extern IdPtr root_menu;
+extern IdPtr first_symbol;
+
+FILE *tclf;
+
+int type2xsize(Type type)
+{
+ switch (type) {
+ case TYPE_OPTION:
+ return 4; break;
+ case TYPE_BOOL:
+ return 5; break;
+ case TYPE_TRI:
+ case TYPE_INT:
+ case TYPE_HEX:
+ case TYPE_CHAR:
+ case TYPE_STR:
+ return 7; break;
+ default:
+ return 0;
+ }
+}
+
+void fprintf_type2name(Type type)
+{
+ switch (type) {
+ case TYPE_NULL:
+ fprintf(tclf,"SYM_NULL"); break;
+ case TYPE_BOOL:
+ fprintf(tclf,"SYM_BOOL"); break;
+ case TYPE_TRI:
+ fprintf(tclf,"SYM_TRI"); break;
+ case TYPE_INT:
+ fprintf(tclf,"SYM_INT"); break;
+ case TYPE_HEX:
+ fprintf(tclf,"SYM_HEX"); break;
+ case TYPE_CHAR:
+ fprintf(tclf,"SYM_CHAR"); break;
+ case TYPE_STR:
+ fprintf(tclf,"SYM_STR"); break;
+ case TYPE_OPTION:
+ fprintf(tclf,"SYM_OPTION"); break;
+ case TYPE_UNKNOWN:
+ fprintf(tclf,"SYM_UNKNOWN"); break;
+ case TYPE_DEPENDS:
+ fprintf(tclf,"SYM_DEPENDS"); break;
+ case TYPE_DERIVED:
+ fprintf(tclf,"SYM_DERIVED"); break;
+ case TYPE_OR:
+ fprintf(tclf,"SYM_OR"); break;
+ case TYPE_AND:
+ fprintf(tclf,"SYM_AND"); break;
+ case TYPE_EQUAL:
+ fprintf(tclf,"SYM_EQUAL"); break;
+ case TYPE_NOT_EQUAL:
+ fprintf(tclf,"SYM_NOT_EQUAL"); break;
+ case TYPE_LT:
+ fprintf(tclf,"SYM_LT"); break;
+ case TYPE_GT:
+ fprintf(tclf,"SYM_GT"); break;
+ case TYPE_LTE:
+ fprintf(tclf,"SYM_LTE"); break;
+ case TYPE_GTE:
+ fprintf(tclf,"SYM_GTE"); break;
+ case TYPE_NOT:
+ fprintf(tclf,"SYM_NOT"); break;
+ case TYPE_LEFT_PARA:
+ fprintf(tclf,"SYM_LEFT_PARA"); break;
+ case TYPE_RIGHT_PARA:
+ fprintf(tclf,"SYM_RIGHT_PARA"); break;
+ case TYPE_SYMBOL:
+ fprintf(tclf,"SYM_SYMBOLE"); break;
+ case TYPE_VALUE:
+ fprintf(tclf,"SYM_VALUE"); break;
+ }
+}
+
+#define CSYMNAME cur_menu->symbol->node.name
+#define CSYMTYPE if (cur_menu->symbol) { \
+ fprintf_type2name(cur_menu->symbol->type); \
+ } else { \
+ fprintf(tclf,"SYM_NONE"); \
+ }
+
+void fprintf_prec2tk(Precedence prec)
+{
+ switch (prec) {
+ case PRE_NULL:
+ fprintf(tclf,"PRE_NULL"); break;
+ case PRE_ASSIGN:
+ fprintf(tclf,"PRE_ASSIGN"); break;
+ case PRE_OR:
+ fprintf(tclf,"PRE_OR"); break;
+ case PRE_AND:
+ fprintf(tclf,"PRE_AND"); break;
+ case PRE_EQUAL:
+ fprintf(tclf,"PRE_EQUAL"); break;
+ case PRE_REL:
+ fprintf(tclf,"PRE_REL"); break;
+ case PRE_NOT:
+ fprintf(tclf,"PRE_NOT"); break;
+ }
+}
+
+void fprintf_menu_name(IdPtr menu, int root)
+{
+ int tclidx = 0;
+ int childidx = 0;
+ IdPtr cur_menu;
+
+ if(menu->menu->parent) {
+ fprintf_menu_name(menu->menu->parent, 0);
+ cur_menu = menu->menu->parent->menu->first_child;
+ for(;cur_menu && (strcmp(cur_menu->name,menu->name) != 0);cur_menu = cur_menu->menu->next)
+ if(cur_menu->menu) {
+ tclidx++;
+ if(cur_menu->menu->first_child)
+ childidx++;
+ }
+ if(root)
+ fprintf(tclf,".f%d",tclidx);
+ else
+ fprintf(tclf,".c%d",childidx);
+ } else
+ fprintf(tclf,".f0");
+}
+
+void fprintf_update_menu(IdPtr menu)
+{
+ fprintf(tclf,"\t\tupdate_menu_sym ");
+ fprintf_menu_name(menu,1);
+ if (menu->symbol) {
+ fprintf(tclf," ");
+ fprintf_type2name(menu->symbol->type);
+ fprintf(tclf, " %d ",type2xsize(menu->symbol->type));
+ } else
+ fprintf(tclf," SYM_NONE 0 ");
+ if(menu->menu->depends)
+ evaluate_expressions2tk(tclf, menu->menu->depends);
+ else
+ fprintf(tclf,"\"\"");
+ fprintf(tclf,"\n");
+}
+
+void do_xsyms(IdPtr sym)
+{
+ IdPtr cur_sym;
+
+ for(cur_sym = sym;cur_sym;cur_sym = cur_sym->symbol->next) {
+ fprintf(tclf,"set CONFIG_%s ",cur_sym->name);
+ fprintf_value2tk(tclf,cur_sym->symbol->type,cur_sym->symbol->value);
+ fprintf(tclf,"\n");
+ }
+
+ for(cur_sym = sym;cur_sym;cur_sym = cur_sym->symbol->next) {
+ fprintf(tclf,"proc change_sym_CONFIG_%s { root } {\n",cur_sym->name);
+ fprintf(tclf,"\tglobal ARCH\n");
+ fprintf(tclf,"\tset old_CONFIG_%s [ get_sym CONFIG_%s ]\n",cur_sym->name,cur_sym->name);
+ if(cur_sym->symbol->depends || cur_sym->symbol->derived) {
+ fprintf(tclf,"\tif { ! $root } {\n");
+ if(cur_sym->symbol->depends) {
+ fprintf(tclf,"\t\tupdate_depends CONFIG_%s ",cur_sym->name);
+ evaluate_expressions2tk(tclf, cur_sym->symbol->depends);
+ fprintf(tclf,"\n");
+ }
+ if(cur_sym->symbol->derived) {
+ fprintf(tclf,"\t\tupdate_derived CONFIG_%s ",cur_sym->name);
+ evaluate_expressions2tk(tclf, cur_sym->symbol->derived);
+ fprintf(tclf,"\n");
+ }
+ fprintf(tclf,"\t}\n");
+ }
+ fprintf(tclf,"\tif { $old_CONFIG_%s != [ get_sym CONFIG_%s ] || $root } {\n",cur_sym->name,cur_sym->name);
+ if(cur_sym->symbol->affects) {
+ IdListPtr list;
+ for(list=cur_sym->symbol->affects;list;list = list->next) {
+ if (list->id->symbol)
+ fprintf(tclf,"\t\tchange_sym_CONFIG_%s false\n",list->id->name);
+ if (list->id->menu) {
+ fprintf_update_menu(list->id);
+ }
+ }
+
+ }
+ fprintf(tclf,"\t}\n");
+
+ fprintf(tclf,"}\n\n");
+ }
+
+ fprintf(tclf,"proc write_config { conf_name conf_h_name } {\n");
+ fprintf(tclf,"\tif { [string length $conf_name] != 0\n");
+ fprintf(tclf,"\t\t&& ([file writable $conf_name] == 1 || \n");
+ fprintf(tclf,"\t\t([file exists $conf_name] == 0 && [file writable [file dirname $conf_name]] == 1)) } then {\n");
+ fprintf(tclf,"\t\tset conf [ open $conf_name w ]\n");
+ fprintf(tclf,"\t\tset conf_h [ open $conf_h_name w ]\n");
+ fprintf(tclf,"\t\tputs $conf_h \"#define AUTOCONF_INCLUDED\"\n");
+ for(cur_sym = sym;cur_sym;cur_sym = cur_sym->symbol->next) {
+ fprintf(tclf,"\t\tglobal CONFIG_%s\n",cur_sym->name);
+ fprintf(tclf,"\t\twrite_symbol $conf $conf_h ");
+ fprintf_type2name(cur_sym->symbol->type);
+ fprintf(tclf," CONFIG_%s $CONFIG_%s\n",cur_sym->name,cur_sym->name);
+ }
+ fprintf(tclf,"\t\tclose $conf\n");
+ fprintf(tclf,"\t\tclose $conf_h\n");
+ fprintf(tclf,"\t}\n\n");
+ fprintf(tclf,"}\n\n");
+}
+
+void do_xmenu(IdPtr menu, char *name)
+{
+ char sub_name[MAX_MENU_NAME];
+ int sub_index,tclidx;
+ int have_sym = 0;
+ int have_desc = 0;
+ int have_child = 0;
+ IdPtr cur_menu;
+
+ sub_index = 0;
+ for(cur_menu = menu;cur_menu;cur_menu = cur_menu->menu->next) {
+ if(cur_menu->symbol)
+ have_sym = type2xsize(cur_menu->symbol->type);
+
+ if(cur_menu->menu->first_child) {
+ sprintf(sub_name,"%s_%d",name,sub_index++);
+ do_xmenu(cur_menu->menu->first_child,&sub_name[0]);
+ have_child = 1;
+ }
+
+ if(cur_menu->desc_length)
+ have_desc = 1;
+ }
+
+ fprintf(tclf,"\n");
+ fprintf(tclf, "proc %s { w } {\n",name);
+ sub_index = 0;
+ tclidx = 0;
+ for(cur_menu = menu;cur_menu;cur_menu = cur_menu->menu->next) {
+
+ fprintf(tclf, "\tconfig_option $w %d \"%s\" ",tclidx,cur_menu->menu->caption);
+
+ if(cur_menu->symbol) {
+ CSYMTYPE;
+ fprintf(tclf, " CONFIG_%s %d ",cur_menu->name,have_sym);
+ } else {
+ fprintf(tclf, "SYM_NONE \"\" %d ",have_sym);
+ }
+
+ if(cur_menu->desc_length) {
+ fprintf(tclf, "\"dohelp .dohelp . \\\"%s\\\" %ld %ld\" true ",
+ cur_menu->config_file,
+ cur_menu->desc_start,cur_menu->desc_length);
+ } else {
+ fprintf(tclf, "\"\" %s ", have_desc ? "true" : "false");
+ }
+
+ if(cur_menu->menu->first_child) {
+ sprintf(sub_name,"%s_%d",name,sub_index);
+ fprintf(tclf, "\"%s $w.c%d\" true\n",&sub_name[0],tclidx);
+ sub_index++;
+ } else {
+ fprintf(tclf, "\"\" %s\n", have_child ? "true" : "false");
+ }
+
+ fprintf_update_menu(cur_menu);
+ tclidx++;
+ }
+ fprintf(tclf, "}\n\n");
+
+}
int do_xconfig()
{
- return 1;
+ FILE *header;
+ int ch;
+
+ tclf = fopen("XCmenu", "wt");
+
+ header = fopen("conf/header.tk","r");
+ while (!feof(header)) {
+ ch = fgetc(header);
+ if (ch >= 0) fputc(ch, tclf);
+ }
+ fclose(header);
+
+ fprintf(tclf,"set ARCH i386\n");
+ do_xsyms(first_symbol);
+
+ do_xmenu(root_menu->menu->first_child,"domenu");
+
+ fprintf(tclf,"read_config .config\n");
+ fprintf(tclf,"frame .f0\n");
+ fprintf(tclf,"init_window .f0 \"%s\"\n",root_menu->menu->caption);
+ fprintf(tclf,"domenu .f0\n");
+ fprintf(tclf,"create_scrollbar .f0\n");
+ fprintf(tclf,"pack .f0\n");
+ fprintf(tclf,"button .save -text \"Save\" -command \"write_config .config include/linux/autoconf.h\"\n");
+ fprintf(tclf,"pack .save\n");
+ fprintf(tclf,"button .load -text \"Load\" -command \"read_config .config\"\n");
+ fprintf(tclf,"pack .load\n");
+ fclose(tclf);
+
+ system("wish -f XCmenu");
+
+ unlink("XCmenu");
+ return 0;
}
diff -uNrb kernelconf-0.1.2/conf/xconfig.d kernelconf-0.1.2.new/conf/xconfig.d
--- kernelconf-0.1.2/conf/xconfig.d Thu Jan 1 01:00:00 1970
+++ kernelconf-0.1.2.new/conf/xconfig.d Tue Feb 5 20:49:07 2002
@@ -0,0 +1,17 @@
+xconfig.o: xconfig.c /usr/include/ctype.h /usr/include/features.h \
+ /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
+ /usr/include/bits/types.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h \
+ /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+ /usr/include/endian.h /usr/include/bits/endian.h /usr/include/stdio.h \
+ /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
+ /usr/include/bits/wchar.h /usr/include/gconv.h \
+ /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h \
+ /usr/include/bits/stdio_lim.h /usr/include/string.h \
+ /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
+ /usr/include/sys/select.h /usr/include/bits/select.h \
+ /usr/include/bits/sigset.h /usr/include/bits/time.h \
+ /usr/include/sys/sysmacros.h /usr/include/alloca.h \
+ /usr/include/unistd.h /usr/include/bits/posix_opt.h \
+ /usr/include/bits/confname.h /usr/include/getopt.h kernelconf.h \
+ expressions.h
Binary files kernelconf-0.1.2/conf/xconfig.o and kernelconf-0.1.2.new/conf/xconfig.o differ
^ permalink raw reply [flat|nested] 10+ messages in thread