038e7e9355040c883ec2f61379d3a1fb47dc5caa
3 # Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
6 # Based on Perl script by Dirk Hohndel.
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in
16 # the documentation and/or other materials provided with the
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 # INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 # Usage: modeline2c.awk < modefile > xf86DefModeSet.c
38 flagsdict
["+hsync +vsync"] =
"V_PHSYNC | V_PVSYNC"
39 flagsdict
["+hsync -vsync"] =
"V_PHSYNC | V_NVSYNC"
40 flagsdict
["-hsync +vsync"] =
"V_NHSYNC | V_PVSYNC"
41 flagsdict
["-hsync -vsync"] =
"V_NHSYNC | V_NVSYNC"
42 flagsdict
["+hsync +vsync interlace"] =
"V_PHSYNC | V_PVSYNC | V_INTERLACE"
43 flagsdict
["+hsync -vsync interlace"] =
"V_PHSYNC | V_NVSYNC | V_INTERLACE"
44 flagsdict
["-hsync +vsync interlace"] =
"V_NHSYNC | V_PVSYNC | V_INTERLACE"
45 flagsdict
["-hsync -vsync interlace"] =
"V_NHSYNC | V_NVSYNC | V_INTERLACE"
47 print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at"
48 print " * modeline2c.awk */"
51 print " * Author: Joerg Sonnenberger <joerg@NetBSD.org>"
52 print " * Based on Perl script from Dirk Hohndel <hohndel@XFree86.Org>"
55 print "#ifdef HAVE_XORG_CONFIG_H"
56 print "#include <xorg-config.h>"
59 print "#include \"xf86.h\""
60 print "#include \"xf86Config.h\""
61 print "#include \"xf86Priv.h\""
62 print "#include \"xf86_OSlib.h\""
64 print "#include \"globals.h\""
66 print "#define MODEPREFIX NULL, NULL, NULL, MODE_OK, M_T_DEFAULT"
67 print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0"
69 print "const DisplayModeRec xf86DefaultModes [] = {"
71 modeline =
"\t{MODEPREFIX,%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n"
72 modeline_data =
"^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+"
75 /^
[mM
][oO
][dD
][eE
][lL
][iI
][nN
][eE
]/ {
77 gsub(modeline_data
, "", flags
)
78 flags =
tolower(flags
)
79 printf(modeline
, $
3 * 1000, $
4, $
5, $
6, $
7,
80 $
8, $
9, $
10, $
11, flagsdict
[flags
])
81 # Half-width double scanned modes
82 printf(modeline
, $
3 * 500, $
4/2, $
5/2, $
6/2, $
7/2,
83 $
8/2, $
9/2, $
10/2, $
11/2, flagsdict
[flags
] " | V_DBLSCAN")
87 print "/*" substr($
0, 2) " */"
92 printf "const int xf86NumDefaultModes = sizeof(xf86DefaultModes) / sizeof(DisplayModeRec);"