deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/*
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * Copyright (c) 1998-2003 by The XFree86 Project, Inc.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync *
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * Permission is hereby granted, free of charge, to any person obtaining a
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * copy of this software and associated documentation files (the "Software"),
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * to deal in the Software without restriction, including without limitation
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * and/or sell copies of the Software, and to permit persons to whom the
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * Software is furnished to do so, subject to the following conditions:
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync *
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * The above copyright notice and this permission notice shall be included in
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * all copies or substantial portions of the Software.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync *
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * OTHER DEALINGS IN THE SOFTWARE.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync *
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * Except as contained in this notice, the name of the copyright holder(s)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * and author(s) shall not be used in advertising or otherwise to promote
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * the sale, use or other dealings in this Software without prior written
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * authorization from the copyright holder(s) and author(s).
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* Option handling things that ModuleSetup procs can use */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#ifndef _XF86_OPT_H_
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define _XF86_OPT_H_
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef struct {
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync double freq;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync int units;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync} OptFrequency;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef union {
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync unsigned long num;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync char * str;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync double realnum;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync Bool bool;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OptFrequency freq;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync} ValueUnion;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef enum {
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OPTV_NONE = 0,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OPTV_INTEGER,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OPTV_STRING, /* a non-empty string */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OPTV_ANYSTR, /* Any string, including an empty one */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OPTV_REAL,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OPTV_BOOLEAN,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OPTV_FREQ
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync} OptionValueType;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef enum {
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OPTUNITS_HZ = 1,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OPTUNITS_KHZ,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OPTUNITS_MHZ
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync} OptFreqUnits;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef struct {
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync int token;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync const char* name;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OptionValueType type;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync ValueUnion value;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync Bool found;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync} OptionInfoRec, *OptionInfoPtr;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncint xf86SetIntOption(pointer optlist, const char *name, int deflt);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncdouble xf86SetRealOption(pointer optlist, const char *name, double deflt);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncchar *xf86SetStrOption(pointer optlist, const char *name, char *deflt);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncint xf86SetBoolOption(pointer list, const char *name, int deflt );
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncint xf86CheckIntOption(pointer optlist, const char *name, int deflt);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncdouble xf86CheckRealOption(pointer optlist, const char *name, double deflt);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncchar *xf86CheckStrOption(pointer optlist, const char *name, char *deflt);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncint xf86CheckBoolOption(pointer list, const char *name, int deflt );
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncpointer xf86AddNewOption(pointer head, const char *name, const char *val );
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncpointer xf86NewOption(char *name, char *value );
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncpointer xf86NextOption(pointer list );
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncpointer xf86OptionListCreate(const char **options, int count, int used);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncpointer xf86OptionListMerge(pointer head, pointer tail);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncvoid xf86OptionListFree(pointer opt);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncchar *xf86OptionName(pointer opt);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncchar *xf86OptionValue(pointer opt);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncvoid xf86OptionListReport(pointer parm);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncpointer xf86FindOption(pointer options, const char *name);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncchar *xf86FindOptionValue(pointer options, const char *name);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncvoid xf86MarkOptionUsed(pointer option);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncvoid xf86MarkOptionUsedByName(pointer options, const char *name);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncBool xf86CheckIfOptionUsed(pointer option);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncBool xf86CheckIfOptionUsedByName(pointer options, const char *name);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncvoid xf86ShowUnusedOptions(int scrnIndex, pointer options);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncvoid xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncOptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncconst char *xf86TokenToOptName(const OptionInfoRec *table, int token);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncBool xf86IsOptionSet(const OptionInfoRec *table, int token);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncchar *xf86GetOptValString(const OptionInfoRec *table, int token);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncBool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncBool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncBool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncBool xf86GetOptValFreq(const OptionInfoRec *table, int token,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OptFreqUnits expectedUnits, double *value);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncBool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncBool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncint xf86NameCmp(const char *s1, const char *s2);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncchar *xf86NormalizeName(const char *s);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncpointer xf86ReplaceIntOption(pointer optlist, const char *name, const int val);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncpointer xf86ReplaceRealOption(pointer optlist, const char *name, const double val);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncpointer xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncpointer xf86ReplaceStrOption(pointer optlist, const char *name, const char* val);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#endif