summaryrefslogtreecommitdiff
path: root/scripts/kconfig/example/query.rb
Unidiff
Diffstat (limited to 'scripts/kconfig/example/query.rb') (more/less context) (ignore whitespace changes)
-rw-r--r--scripts/kconfig/example/query.rb34
1 files changed, 34 insertions, 0 deletions
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 @@
1require "kconfig"
2
3include Kconfig
4
5conf_parse("arch/i386/Kconfig")
6conf_read(nil)
7
8sym = Kconfig::Symbol.find(ARGV[0])
9if !sym
10 print "Symbol #{ARGV[0]} not found!\n"
11 exit
12end
13
14sym.calc_value
15print "symbol: #{sym.name}\n"
16print " type: #{Kconfig::Symbol.type_name(sym.type)}\n"
17print " value: #{sym.get_string}\n"
18print " choice\n" if sym.isChoice?
19print " choice value\n" if sym.isChoiceValue?
20print " properties:\n" if sym.prop
21sym.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
34end