3 # automatically generate the xf86DefModeSet.c file from a normal
4 # XF86Config style file of Modelines
8 # perl /modeline2c.pl < [modesfile] > xf86DefModes.c
10 # hackish perl - author Dirk Hohndel
12 # Copyright 1999-2003 by The XFree86 Project, Inc.
14 # Permission is hereby granted, free of charge, to any person obtaining a
15 # copy of this software and associated documentation files (the "Software"),
16 # to deal in the Software without restriction, including without limitation
17 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 # and/or sell copies of the Software, and to permit persons to whom the
19 # Software is furnished to do so, subject to the following conditions:
21 # The above copyright notice and this permission notice shall be included in
22 # all copies or substantial portions of the Software.
24 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 # THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
28 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30 # OTHER DEALINGS IN THE SOFTWARE.
32 # Except as contained in this notice, the name of the copyright holder(s)
33 # and author(s) shall not be used in advertising or otherwise to promote
34 # the sale, use or other dealings in this Software without prior written
35 # authorization from the copyright holder(s) and author(s).
37 # $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.10tsi Exp $
41 # $flagshash{"Interlace"} = "V_INTERLACE";
42 # $flagshash{"+hsync"} = "V_PHSYNC";
43 # $flagshash{"-hsync"} = "V_NHSYNC";
44 # $flagshash{"+vsync"} = "V_PVSYNC";
45 # $flagshash{"-vsync"} = "V_NVSYNC";
46 # XXX I'm definitely not a perl guru... -- tsi
47 $flagshash{"+hsync +vsync"} = "V_PHSYNC | V_PVSYNC";
48 $flagshash{"+hsync -vsync"} = "V_PHSYNC | V_NVSYNC";
49 $flagshash{"-hsync +vsync"} = "V_NHSYNC | V_PVSYNC";
50 $flagshash{"-hsync -vsync"} = "V_NHSYNC | V_NVSYNC";
51 $flagshash{"+hsync +vsync interlace"} = "V_PHSYNC | V_PVSYNC | V_INTERLACE";
52 $flagshash{"+hsync -vsync interlace"} = "V_PHSYNC | V_NVSYNC | V_INTERLACE";
53 $flagshash{"-hsync +vsync interlace"} = "V_NHSYNC | V_PVSYNC | V_INTERLACE";
54 $flagshash{"-hsync -vsync interlace"} = "V_NHSYNC | V_NVSYNC | V_INTERLACE";
56 # stop CVS from expanding the XFree86 Id here...
59 printf("/* \$$proj\$ */
61 /* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at
65 * Copyright 1999-2003 by The XFree86 Project, Inc.
67 * Author: Dirk Hohndel <hohndel\@XFree86.Org>
70 #ifdef HAVE_XORG_CONFIG_H
71 #include <xorg-config.h>
75 #include \"xf86Config.h\"
76 #include \"xf86Priv.h\"
77 #include \"xf86_OSlib.h\"
79 #include \"globals.h\"
81 #define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT
82 #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
84 DisplayModeRec xf86DefaultModes [] = {
90 print "/*" . $_ . " */\n";
92 if (/^ModeLine\s+(\S+)\s+([\d.\s]+)(.*)/i) {
97 $values =~ /([\d.]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/;
98 printf("\t{MODEPREFIX(%s),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n",
99 $name,$1*1000,$2,$3,$4,$5,$6,$7,$8,$9,$flagshash{$flags});
100 # Also generate half-width doublescanned modes
101 printf("\t{MODEPREFIX(\"%dx%d\"),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s | V_DBLSCAN, MODESUFFIX},\n",
102 $2/2,$6/2,$1*500,$2/2,$3/2,$4/2,$5/2,$6/2,$7/2,$8/2,$9/2,$flagshash{$flags});
107 printf("\t{MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n");