author | kergoth <kergoth> | 2002-10-31 17:11:35 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-10-31 17:11:35 (UTC) |
commit | d955226c2197578f69c510282a4e9ad1ea8fe771 (patch) (side-by-side diff) | |
tree | 0d8f210dd012559df4e3432ccc8ce96e9bd15853 /scripts/kconfig/example | |
parent | 16fcb285f9ba7c514fc3f2695768a82feeb7182b (diff) | |
download | opie-d955226c2197578f69c510282a4e9ad1ea8fe771.zip opie-d955226c2197578f69c510282a4e9ad1ea8fe771.tar.gz opie-d955226c2197578f69c510282a4e9ad1ea8fe771.tar.bz2 |
Initial bits to start work on revamping the buildsystem
-rw-r--r-- | scripts/kconfig/example/miniconf.rb | 32 | ||||
-rw-r--r-- | scripts/kconfig/example/query.rb | 34 |
2 files changed, 66 insertions, 0 deletions
diff --git a/scripts/kconfig/example/miniconf.rb b/scripts/kconfig/example/miniconf.rb new file mode 100644 index 0000000..e687fbb --- a/dev/null +++ b/scripts/kconfig/example/miniconf.rb @@ -0,0 +1,32 @@ +require "kconfig" + +include Kconfig + +conf_parse("arch/i386/Kconfig") +conf_read(nil) + +def conf(menu) + return unless menu.isVisible? + prompt = menu.prompt + if prompt.type == P_COMMENT || prompt.type == P_MENU + print "* #{prompt.text}\n" + end + sym = menu.sym + if sym + begin + print "#{prompt.text} (#{sym.get_string})? " + unless sym.isChangable? + print "\n" + break + end + val = gets.strip + end until val.empty? || sym.set_string(val) + end + menu.each do |child| + conf(child) + end +end + +conf(Kconfig.rootmenu) + +conf_write(nil) diff --git a/scripts/kconfig/example/query.rb b/scripts/kconfig/example/query.rb new file mode 100644 index 0000000..2f47880 --- a/dev/null +++ b/scripts/kconfig/example/query.rb @@ -0,0 +1,34 @@ +require "kconfig" + +include Kconfig + +conf_parse("arch/i386/Kconfig") +conf_read(nil) + +sym = Kconfig::Symbol.find(ARGV[0]) +if !sym + print "Symbol #{ARGV[0]} not found!\n" + exit +end + +sym.calc_value +print "symbol: #{sym.name}\n" +print " type: #{Kconfig::Symbol.type_name(sym.type)}\n" +print " value: #{sym.get_string}\n" +print " choice\n" if sym.isChoice? +print " choice value\n" if sym.isChoiceValue? +print " properties:\n" if sym.prop +sym.each do |prop| + case prop.type + when P_PROMPT + print " prompt: #{prop.text}\n" + when P_DEFAULT + prop.def.calc_value + print " default: #{prop.def.get_string}\n" + when P_CHOICE + print " choice reference\n" + else + print " unknown property: #{Property.type_name(prop.type)}\n" + end + print " dep: #{prop.visible.expr}\n" if prop.visible.expr +end |