/*
*
* Copyright (c) 1997 Metro Link Incorporated
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Metro Link shall not be
* used in advertising or otherwise to promote the sale, use or other dealings
* in this Software without prior written authorization from Metro Link.
*
*/
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86Parser.h"
#include "xf86tokens.h"
#include "Configint.h"
#include "fields.h" /* Config file output line fields */
#if defined(SMI_FBCONFIG)
#include "fbc_line_er.h" /* External Representation of config lines */
#endif
{
{ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"},
{VENDOR, "vendorname"},
{MODEL, "modelname"},
{USEMODES, "usemodes"},
{MODELINE, "modeline"},
{DISPLAYSIZE, "displaysize"},
{HORIZSYNC, "horizsync"},
{VERTREFRESH, "vertrefresh"},
{MODE, "mode"},
{GAMMA, "gamma"},
{OPTION, "option"},
{-1, ""},
};
{
{ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"},
{MODELINE, "modeline"},
{MODE, "mode"},
{-1, ""},
};
{
{TT_INTERLACE, "interlace"},
{TT_PHSYNC, "+hsync"},
{TT_NHSYNC, "-hsync"},
{TT_PVSYNC, "+vsync"},
{TT_NVSYNC, "-vsync"},
{TT_CSYNC, "composite"},
{TT_PCSYNC, "+csync"},
{TT_NCSYNC, "-csync"},
{TT_DBLSCAN, "doublescan"},
{TT_HSKEW, "hskew"},
{TT_BCAST, "bcast"},
{TT_VSCAN, "vscan"},
{TT_CUSTOM, "CUSTOM"},
{-1, ""},
};
{
{DOTCLOCK, "dotclock"},
{HTIMINGS, "htimings"},
{VTIMINGS, "vtimings"},
{FLAGS, "flags"},
{HSKEW, "hskew"},
{BCAST, "bcast"},
{VSCAN, "vscan"},
{ENDMODE, "endmode"},
{-1, ""},
};
xf86parseModeLine (void)
{
int token;
#if defined(SMI_FBCONFIG)
#endif
#if defined(SMI_FBCONFIG)
/*
* Link Internal & External Representations of the line
*/
#endif
/* Identifier */
/* DotClock */
/* HDisplay */
/* HSyncStart */
/* HSyncEnd */
/* HTotal */
/* VDisplay */
/* VSyncStart */
/* VSyncEnd */
/* VTotal */
{
switch (token)
{
case TT_INTERLACE:
break;
case TT_PHSYNC:
break;
case TT_NHSYNC:
break;
case TT_PVSYNC:
break;
case TT_NVSYNC:
break;
case TT_CSYNC:
break;
case TT_PCSYNC:
break;
case TT_NCSYNC:
break;
case TT_DBLSCAN:
break;
case TT_HSKEW:
break;
case TT_BCAST:
break;
case TT_VSCAN:
break;
case TT_CUSTOM:
break;
case EOF_TOKEN:
break;
default:
break;
}
}
#ifdef DEBUG
printf ("ModeLine parsed\n");
#endif
return (ptr);
}
/*
* xf86parseVerboseMode(void)
*
* Parse a "verbose" Mode-EndMode entry of a Monitor or Modes
* section.
*/
xf86parseVerboseMode (void)
{
#if defined(SMI_FBCONFIG)
#endif
for (;;)
{
#if defined(SMI_FBCONFIG)
/*
* Get a ptr to the External Representation of this config line
*/
#endif
{
break;
}
switch (token)
{
case COMMENT:
break;
case DOTCLOCK:
had_dotclock = 1;
#if defined(SMI_FBCONFIG)
/*
* Link Internal & External Representations of the line
*/
(void *)ptr,
#endif
break;
case HTIMINGS:
else
else
else
else
had_htimings = 1;
#if defined(SMI_FBCONFIG)
/*
* Link Internal & External Representations of the line
*/
(void *)ptr,
#endif
break;
case VTIMINGS:
else
else
else
else
had_vtimings = 1;
#if defined(SMI_FBCONFIG)
/*
* Link Internal & External Representations of the line
*/
(void *)ptr,
#endif
break;
case FLAGS:
{
switch (token2)
{
case TT_INTERLACE:
break;
case TT_PHSYNC:
break;
case TT_NHSYNC:
break;
case TT_PVSYNC:
break;
case TT_NVSYNC:
break;
case TT_CSYNC:
break;
case TT_PCSYNC:
break;
case TT_NCSYNC:
break;
case TT_DBLSCAN:
break;
case TT_CUSTOM:
break;
case EOF_TOKEN:
break;
default:
Error ("Unknown flag string, %s",
break;
}
}
#if defined(SMI_FBCONFIG)
/*
* Link Internal & External Representations of the line
*/
(void *)ptr,
#endif
break;
case HSKEW:
#if defined(SMI_FBCONFIG)
/*
* Link Internal & External Representations of the line
*/
(void *)ptr,
#endif
break;
case VSCAN:
#if defined(SMI_FBCONFIG)
/*
* Link Internal & External Representations of the line
*/
(void *)ptr,
#endif
break;
case EOF_TOKEN:
break;
default:
break;
}
}
#if defined(SMI_FBCONFIG)
/*
* Link Internal & External Representations of the EndMode line
*/
(void *)ptr,
NULL /* (xf86_print_fn_t *)&xf86printMxxxSectionEndMode */ ,
#endif
if (!had_dotclock)
if (!had_htimings)
if (!had_vtimings)
#ifdef DEBUG
printf ("Verbose Mode parsed\n");
#endif
return (ptr);
}
xf86parseMonitorSection (void)
{
int token;
#if defined(SMI_FBCONFIG)
#endif
for (;;)
{
#if defined(SMI_FBCONFIG)
/*
* Get a ptr to the External Representation of this config line
*/
#endif
if (token == ENDSECTION)
{
break;
}
switch (token)
{
case COMMENT:
break;
case IDENTIFIER:
break;
case VENDOR:
break;
case MODEL:
break;
case MODE:
break;
case MODELINE:
break;
case DISPLAYSIZE:
break;
case HORIZSYNC:
do {
{
case COMMA:
break;
case DASH:
break;
ptr->mon_n_hsync++;
goto HorizDone;
default:
/* We cannot currently know if a '\n' was found,
* or this is a real error
*/
ptr->mon_n_hsync++;
goto HorizDone;
}
ptr->mon_n_hsync++;
break;
case VERTREFRESH:
do {
{
case COMMA:
break;
case DASH:
break;
ptr->mon_n_vrefresh++;
goto VertDone;
default:
/* We cannot currently know if a '\n' was found,
* or this is a real error
*/
ptr->mon_n_vrefresh++;
goto VertDone;
}
ptr->mon_n_vrefresh++;
break;
case GAMMA:
{
break;
}
{
}
else
{
{
break;
}
}
#if defined(SMI_FBCONFIG)
/*
* Link Internal & External Representations of the line
*/
(void *)ptr,
#endif
break;
case OPTION:
break;
case USEMODES:
{
/* add to the end of the list of modes sections
referenced here */
#if defined(SMI_FBCONFIG)
/*
* Link Internal & External Representations of the line
*/
#endif
}
break;
case EOF_TOKEN:
break;
default:
return NULL;
}
}
#if defined(SMI_FBCONFIG)
/*
* Link Internal & External Representations of the EndSection line
*/
(void *)ptr,
#endif
if (!has_ident)
#ifdef DEBUG
printf ("Monitor section parsed\n");
#endif
return ptr;
}
xf86parseModesSection (void)
{
int token;
#if defined(SMI_FBCONFIG)
int isSunModesSection = FALSE;
/*
* Link Internal & External Representations of the line
*/
#endif /* SMI_FBCONFIG */
{
switch (token)
{
case COMMENT:
break;
case IDENTIFIER:
#if defined(SMI_FBCONFIG)
}
#endif /* SMI_FBCONFIG */
break;
case MODE:
break;
case MODELINE:
break;
default:
return NULL;
break;
}
}
#if defined(SMI_FBCONFIG)
if (isSunModesSection == TRUE) {
}
}
#endif /* SMI_FBCONFIG */
if (!has_ident)
#ifdef DEBUG
printf ("Modes section parsed\n");
#endif
return ptr;
}
/*
* xf86printMonitorSectionSection()
*
* Write the Monitor section Section line to the configuration file.
*/
void
{
}
}
/*
* xf86printMonitorSectionIdentifier()
*
* Write the Monitor section Identifier line to the configuration
* file.
*/
void
{
}
/*
* xf86printMonitorSectionUseModes()
*
* Write a Monitor section UseModes entry line to the configuration
* file.
*/
void
{
}
/*
* xf86printMonitorSectionGamma()
*
* Write the Gamma entry of a Monitor section to the configuration
* file.
*/
void
{
} else {
}
}
/*
* xf86printMonitorSectionEndSection()
*
* Write the Monitor section EndSection line to the configuration
* file.
*/
void
{
}
/*
* ModeLine/Mode-EndMode entry flags (in man page order)
*/
const static struct {
} modeFlagTab[] = {
{ XF86CONF_INTERLACE, "Interlace" },
{ XF86CONF_DBLSCAN , "DoubleScan" },
{ XF86CONF_PHSYNC , "+HSync" },
{ XF86CONF_NHSYNC , "-HSync" },
{ XF86CONF_PVSYNC , "+VSync" },
{ XF86CONF_NVSYNC , "-VSync" },
{ XF86CONF_CSYNC , "Composite" },
{ XF86CONF_PCSYNC , "+CSync" },
{ XF86CONF_NCSYNC , "-CSync" },
{ 0 , NULL } /* End-of-table marker */
};
/*
* xf86printMxxxSectionModeDotClock()
*
* Write the DotClock line of a Mode-EndMode entry of a Monitor or
* Modes section to the configuration file.
*/
#if !defined(SMI_FBCONFIG)
static
#endif
void
{
}
/*
* xf86printMxxxSectionModeHTimings()
*
* Write the HTimings line of a Mode-EndMode entry of a Monitor or
* Modes section to the configuration file.
*/
#if !defined(SMI_FBCONFIG)
static
#endif
void
{
}
/*
* xf86printMxxxSectionModeVTimings()
*
* Write the VTimings line of a Mode-EndMode entry of a Monitor or
* Modes section to the configuration file.
*/
#if !defined(SMI_FBCONFIG)
static
#endif
void
{
}
/*
* xf86printMxxxSectionModeFlags()
*
* Write the Flags line of a Mode-EndMode entry of a Monitor or Modes
* section to the configuration file.
*/
#if !defined(SMI_FBCONFIG)
static
#endif
void
{
int i; /* Loop counter / array index */
have_flags = FALSE;
if (!have_flags) {
have_flags = TRUE;
} else {
}
}
}
if (have_flags) {
}
}
/*
* xf86printMxxxSectionModeHSkew()
*
* Write the HSkew line of a Mode-EndMode entry of a Monitor or Modes
* section to the configuration file.
*/
#if !defined(SMI_FBCONFIG)
static
#endif
void
{
}
/*
* xf86printMxxxSectionModeVScan()
*
* Write the VScan line of a Mode-EndMode entry of a Monitor or Modes
* section to the configuration file.
*/
#if !defined(SMI_FBCONFIG)
static
#endif
void
{
}
/*
* xf86printMxxxSectionMode()
*
* Write the Mode-EndMode entry lines of a Monitor or Modes section
* to the configuration file.
*/
#if !defined(SMI_FBCONFIG)
static
#endif
void
const char *const whitespace_a[], const char *const whitespace_b[])
{
}
}
}
/*
* xf86printMxxxSectionModeLine()
*
* Write a ModeLine entry of a Monitor or Modes section to the
* configuration file.
*/
#if !defined(SMI_FBCONFIG)
static
#endif
void
{
int i; /* Loop counter / array index */
/* ModeLine entry name w/ whitespace fields */
/* Identifier, DotClock */
/* HTimings */
/* VTimings */
/* Flags */
}
}
/* HSkew */
}
/* VScan */
}
/* Comment (if any) and line terminator */
if (mlptr->ml_comment) {
} else {
}
}
/*
* xf86printMonitorSection()
*
* Write a Monitor section to the configuration file.
*/
void
{
int i;
while (ptr)
{
if (ptr->mon_identifier) {
}
if (ptr->mon_vendor)
if (ptr->mon_modelname)
while (mptr) {
}
ptr->mon_height);
for (i = 0; i < ptr->mon_n_hsync; i++)
{
}
for (i = 0; i < ptr->mon_n_vrefresh; i++)
{
}
if (ptr->mon_gamma_red) {
}
{
if (mlptr->ml_verbose) {
} else {
}
}
}
}
void
{
while (ptr)
{
if (ptr->modes_comment)
if (ptr->modes_identifier)
{
if (mlptr->ml_verbose) {
} else {
}
}
}
}
void
{
while (ptr)
{
xf86conffree (prev);
}
}
void
{
while (ptr)
{
xf86conffree (prev);
}
}
void
{
while (ptr)
{
xf86conffree (prev);
}
}
{
while (p)
{
if (xf86nameCompare (ident, p->mon_identifier) == 0)
return (p);
}
return (NULL);
}
/*
* xf86findModes()
*
* Given the name of a Modes section, search the list of Modes
* sections and return a pointer to the matching section. Return
* NULL if no Modes section has that name.
*/
{
while (p)
{
if (xf86nameCompare (ident, p->modes_identifier) == 0)
return (p);
}
return (NULL);
}
/*
* xf86findModeLine()
*
* Given the name of a ModeLine / Mode-EndMode entry and a list of
* entries from a Monitor or Modes section, search the list of
* entries and return a pointer to the matching entry. Return NULL
* if no ModeLine / Mode-EndMode entry in the section has that name.
*/
{
while (p)
{
if (xf86nameCompare (ident, p->ml_identifier) == 0)
return (p);
}
return (NULL);
}
/*
* xf86validateMonitor()
*
* Validate a Monitor section that is referenced by the specified
* Screen section. Validation of a Monitor section consists of
* making sure that every UseModes entry in the section specifies the
* name of an existing Modes section. A link is also created from
* each UseModes entry to the matching Modes section. Return TRUE
* iff successful.
*/
int
XF86ConfigPtr p, /* Ptr to configuration stuff */
const char *const screen_identifier, /* Name of Screen section */
{
if (!modes)
{
return (FALSE);
}
}
return (TRUE);
}