summaryrefslogtreecommitdiff
path: root/scripts/kconfig/example/query.rb
blob: 2f47880b1de87ca2cdd745f4b0339fb7ebf7c3ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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