author | kergoth <kergoth> | 2002-10-31 17:11:35 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-10-31 17:11:35 (UTC) |
commit | d955226c2197578f69c510282a4e9ad1ea8fe771 (patch) (unidiff) | |
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 @@ | |||
1 | require "kconfig" | ||
2 | |||
3 | include Kconfig | ||
4 | |||
5 | conf_parse("arch/i386/Kconfig") | ||
6 | conf_read(nil) | ||
7 | |||
8 | def conf(menu) | ||
9 | return unless menu.isVisible? | ||
10 | prompt = menu.prompt | ||
11 | if prompt.type == P_COMMENT || prompt.type == P_MENU | ||
12 | print "* #{prompt.text}\n" | ||
13 | end | ||
14 | sym = menu.sym | ||
15 | if sym | ||
16 | begin | ||
17 | print "#{prompt.text} (#{sym.get_string})? " | ||
18 | unless sym.isChangable? | ||
19 | print "\n" | ||
20 | break | ||
21 | end | ||
22 | val = gets.strip | ||
23 | end until val.empty? || sym.set_string(val) | ||
24 | end | ||
25 | menu.each do |child| | ||
26 | conf(child) | ||
27 | end | ||
28 | end | ||
29 | |||
30 | conf(Kconfig.rootmenu) | ||
31 | |||
32 | 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 @@ | |||
1 | require "kconfig" | ||
2 | |||
3 | include Kconfig | ||
4 | |||
5 | conf_parse("arch/i386/Kconfig") | ||
6 | conf_read(nil) | ||
7 | |||
8 | sym = Kconfig::Symbol.find(ARGV[0]) | ||
9 | if !sym | ||
10 | print "Symbol #{ARGV[0]} not found!\n" | ||
11 | exit | ||
12 | end | ||
13 | |||
14 | sym.calc_value | ||
15 | print "symbol: #{sym.name}\n" | ||
16 | print " type: #{Kconfig::Symbol.type_name(sym.type)}\n" | ||
17 | print " value: #{sym.get_string}\n" | ||
18 | print " choice\n" if sym.isChoice? | ||
19 | print " choice value\n" if sym.isChoiceValue? | ||
20 | print " properties:\n" if sym.prop | ||
21 | sym.each do |prop| | ||
22 | case prop.type | ||
23 | when P_PROMPT | ||
24 | print " prompt: #{prop.text}\n" | ||
25 | when P_DEFAULT | ||
26 | prop.def.calc_value | ||
27 | print " default: #{prop.def.get_string}\n" | ||
28 | when P_CHOICE | ||
29 | print " choice reference\n" | ||
30 | else | ||
31 | print " unknown property: #{Property.type_name(prop.type)}\n" | ||
32 | end | ||
33 | print " dep: #{prop.visible.expr}\n" if prop.visible.expr | ||
34 | end | ||