summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/findopts
blob: 64aaba7ee25e2c075c2f952e5ea92d827f73ff01 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#! /bin/sh
#
# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/findopts,v 3.2 1997/12/06 08:53:03 hohndel Exp $
#
# This script should be run by XF86Setup \
exec XF86Setup -notk `basename $0` -- ${1+"$@"}

# This is just for my own use in generating a list of valid options
# to each server as needed by carddata.tcl

set xf86dir $Xwinhome/xc/programs/Xserver/hw/xfree86

set dirlist [list accel/ibm8514 accel/agx accel/i128 accel/mach8\
		accel/mach32 accel/mach64 accel/p9000 accel/s3 \
		vga256 vga16 vga2]
set srvlist {8514 AGX I128 Mach8 Mach32 Mach64 P9000 S3 SVGA VGA16 Mono}

set fd [open $xf86dir/common/xf86_Option.h r]
set table none
while {[gets $fd line] >= 0} {
	if { $table == "none" } {
		if {[regexp {^OptFlagRec xf86_(.+)Tab.+ =} $line dummy tab]} {
			if { $tab == "Option" } {
				set table Options
			} elseif { $tab == "ClockOption" } {
				set table Clocks
			}
		}
		continue
	}
	if {[string match {*"",*} $line]} {
		set table none
		continue
	}
	if {![regexp {"([^"]+)",[ 	]*([A-Z_]+TION_[^ \}]+)} $line dummy nam val]} {
		continue
	}
	if ![info exists ${table}($val)] {
		set ${table}($val) ""
	}
	lappend ${table}($val) $nam
}
close $fd
set Clocks(CLOCK_OPTION_PROGRAMABLE) ""

for {set idx 0} {$idx < [llength $srvlist]} {incr idx} {
	set srv [lindex $srvlist $idx]
	cd $xf86dir/[lindex $dirlist $idx]
	set optlist ""
	set clklist ""
	set lines [exec find . -name {*.[hc]} -print | xargs grep OPTION_]
	foreach line [split $lines \n] {
		if [regexp {[^_](OPTION_[0-9A-Z_]+)} $line dummy opt] {
			lappend optlist $opt
		}
		if [regexp {(CLOCK_OPTION_[0-9A-Z_]+)} $line dummy opt] {
			lappend clklist $opt
		}
	}
	set optnamlist ""
	foreach opt [lrmdups $optlist] {
		if [info exists Options($opt)] {
			eval lappend optnamlist $Options($opt)
		} else {
			puts "Unknown option: $opt"
		}
	}
	puts "CardOptions($srv) = $optnamlist"
	set clknamlist ""
	foreach opt [lrmdups $clklist] {
		if [info exists Clocks($opt)] {
			eval lappend clknamlist $Clocks($opt)
		} else {
			puts "Unknown clock option: $opt"
		}
	}
	puts "CardClockChips($srv) = $clknamlist"
	puts ""
}