~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/xfree86/common/xf86Opt.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.15 2003/10/08 14:30:38 dawes Exp $ */
 
2
 
 
3
/*
 
4
 * Copyright (c) 1998-2003 by The XFree86 Project, Inc.
 
5
 *
 
6
 * Permission is hereby granted, free of charge, to any person obtaining a
 
7
 * copy of this software and associated documentation files (the "Software"),
 
8
 * to deal in the Software without restriction, including without limitation
 
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
10
 * and/or sell copies of the Software, and to permit persons to whom the
 
11
 * Software is furnished to do so, subject to the following conditions:
 
12
 *
 
13
 * The above copyright notice and this permission notice shall be included in
 
14
 * all copies or substantial portions of the Software.
 
15
 *
 
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
19
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 
20
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 
21
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 
22
 * OTHER DEALINGS IN THE SOFTWARE.
 
23
 *
 
24
 * Except as contained in this notice, the name of the copyright holder(s)
 
25
 * and author(s) shall not be used in advertising or otherwise to promote
 
26
 * the sale, use or other dealings in this Software without prior written
 
27
 * authorization from the copyright holder(s) and author(s).
 
28
 */
 
29
 
 
30
/* Option handling things that ModuleSetup procs can use */
 
31
 
 
32
#ifndef _XF86_OPT_H_
 
33
#define _XF86_OPT_H_
 
34
 
 
35
typedef struct {
 
36
    double freq;
 
37
    int units;
 
38
} OptFrequency;
 
39
 
 
40
typedef union {
 
41
    unsigned long       num;
 
42
    char *              str;
 
43
    double              realnum;
 
44
    Bool                bool;
 
45
    OptFrequency        freq;
 
46
} ValueUnion;
 
47
    
 
48
typedef enum {
 
49
    OPTV_NONE = 0,
 
50
    OPTV_INTEGER,
 
51
    OPTV_STRING,                /* a non-empty string */
 
52
    OPTV_ANYSTR,                /* Any string, including an empty one */
 
53
    OPTV_REAL,
 
54
    OPTV_BOOLEAN,
 
55
    OPTV_FREQ
 
56
} OptionValueType;
 
57
 
 
58
typedef enum {
 
59
    OPTUNITS_HZ = 1,
 
60
    OPTUNITS_KHZ,
 
61
    OPTUNITS_MHZ
 
62
} OptFreqUnits;
 
63
 
 
64
typedef struct {
 
65
    int                 token;
 
66
    const char*         name;
 
67
    OptionValueType     type;
 
68
    ValueUnion          value;
 
69
    Bool                found;
 
70
} OptionInfoRec, *OptionInfoPtr;
 
71
 
 
72
int xf86SetIntOption(pointer optlist, const char *name, int deflt);
 
73
double xf86SetRealOption(pointer optlist, const char *name, double deflt);
 
74
char *xf86SetStrOption(pointer optlist, const char *name, char *deflt);
 
75
int xf86SetBoolOption(pointer list, const char *name, int deflt );
 
76
int xf86CheckIntOption(pointer optlist, const char *name, int deflt);
 
77
double xf86CheckRealOption(pointer optlist, const char *name, double deflt);
 
78
char *xf86CheckStrOption(pointer optlist, const char *name, char *deflt);
 
79
int xf86CheckBoolOption(pointer list, const char *name, int deflt );
 
80
pointer xf86AddNewOption(pointer head, const char *name, const char *val );
 
81
pointer xf86NewOption(char *name, char *value );
 
82
pointer xf86NextOption(pointer list );
 
83
pointer xf86OptionListCreate(const char **options, int count, int used);
 
84
pointer xf86OptionListMerge(pointer head, pointer tail);
 
85
void xf86OptionListFree(pointer opt);
 
86
char *xf86OptionName(pointer opt);
 
87
char *xf86OptionValue(pointer opt);
 
88
void xf86OptionListReport(pointer parm);
 
89
pointer xf86FindOption(pointer options, const char *name);
 
90
char *xf86FindOptionValue(pointer options, const char *name);
 
91
void xf86MarkOptionUsed(pointer option);
 
92
void xf86MarkOptionUsedByName(pointer options, const char *name);
 
93
Bool xf86CheckIfOptionUsed(pointer option);
 
94
Bool xf86CheckIfOptionUsedByName(pointer options, const char *name);
 
95
void xf86ShowUnusedOptions(int scrnIndex, pointer options);
 
96
void xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo);
 
97
OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token);
 
98
const char *xf86TokenToOptName(const OptionInfoRec *table, int token);
 
99
Bool xf86IsOptionSet(const OptionInfoRec *table, int token);
 
100
char *xf86GetOptValString(const OptionInfoRec *table, int token);
 
101
Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value);
 
102
Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value);
 
103
Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value);
 
104
Bool xf86GetOptValFreq(const OptionInfoRec *table, int token,
 
105
                        OptFreqUnits expectedUnits, double *value);
 
106
Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value);
 
107
Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def);
 
108
int xf86NameCmp(const char *s1, const char *s2);
 
109
char *xf86NormalizeName(const char *s);
 
110
pointer xf86ReplaceIntOption(pointer optlist,  const char *name, const int val);
 
111
pointer xf86ReplaceRealOption(pointer optlist,  const char *name, const double val);
 
112
pointer xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val);
 
113
pointer xf86ReplaceStrOption(pointer optlist,  const char *name, const char* val);        
 
114
#endif