1 | /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.12 2001/05/04 19:05:30 dawes Exp $ */
|
---|
2 |
|
---|
3 | /* Option handling things that ModuleSetup procs can use */
|
---|
4 |
|
---|
5 | #ifndef _XF86_OPT_H_
|
---|
6 | #define _XF86_OPT_H_
|
---|
7 |
|
---|
8 | typedef struct {
|
---|
9 | double freq;
|
---|
10 | int units;
|
---|
11 | } OptFrequency;
|
---|
12 |
|
---|
13 | typedef union {
|
---|
14 | unsigned long num;
|
---|
15 | char * str;
|
---|
16 | double realnum;
|
---|
17 | Bool bool;
|
---|
18 | OptFrequency freq;
|
---|
19 | } ValueUnion;
|
---|
20 |
|
---|
21 | typedef enum {
|
---|
22 | OPTV_NONE = 0,
|
---|
23 | OPTV_INTEGER,
|
---|
24 | OPTV_STRING, /* a non-empty string */
|
---|
25 | OPTV_ANYSTR, /* Any string, including an empty one */
|
---|
26 | OPTV_REAL,
|
---|
27 | OPTV_BOOLEAN,
|
---|
28 | OPTV_FREQ
|
---|
29 | } OptionValueType;
|
---|
30 |
|
---|
31 | typedef enum {
|
---|
32 | OPTUNITS_HZ = 1,
|
---|
33 | OPTUNITS_KHZ,
|
---|
34 | OPTUNITS_MHZ
|
---|
35 | } OptFreqUnits;
|
---|
36 |
|
---|
37 | typedef struct {
|
---|
38 | int token;
|
---|
39 | const char* name;
|
---|
40 | OptionValueType type;
|
---|
41 | ValueUnion value;
|
---|
42 | Bool found;
|
---|
43 | } OptionInfoRec, *OptionInfoPtr;
|
---|
44 |
|
---|
45 | int xf86SetIntOption(pointer optlist, const char *name, int deflt);
|
---|
46 | double xf86SetRealOption(pointer optlist, const char *name, double deflt);
|
---|
47 | char *xf86SetStrOption(pointer optlist, const char *name, char *deflt);
|
---|
48 | int xf86SetBoolOption(pointer list, const char *name, int deflt );
|
---|
49 | pointer xf86AddNewOption(pointer head, char *name, char *val );
|
---|
50 | pointer xf86NewOption(char *name, char *value );
|
---|
51 | pointer xf86NextOption(pointer list );
|
---|
52 | pointer xf86OptionListCreate(const char **options, int count, int used);
|
---|
53 | pointer xf86OptionListMerge(pointer head, pointer tail);
|
---|
54 | void xf86OptionListFree(pointer opt);
|
---|
55 | char *xf86OptionName(pointer opt);
|
---|
56 | char *xf86OptionValue(pointer opt);
|
---|
57 | void xf86OptionListReport(pointer parm);
|
---|
58 | pointer xf86FindOption(pointer options, const char *name);
|
---|
59 | char *xf86FindOptionValue(pointer options, const char *name);
|
---|
60 | void xf86MarkOptionUsed(pointer option);
|
---|
61 | void xf86MarkOptionUsedByName(pointer options, const char *name);
|
---|
62 | Bool xf86CheckIfOptionUsed(pointer option);
|
---|
63 | Bool xf86CheckIfOptionUsedByName(pointer options, const char *name);
|
---|
64 | void xf86ShowUnusedOptions(int scrnIndex, pointer options);
|
---|
65 | void xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo);
|
---|
66 | OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token);
|
---|
67 | const char *xf86TokenToOptName(const OptionInfoRec *table, int token);
|
---|
68 | Bool xf86IsOptionSet(const OptionInfoRec *table, int token);
|
---|
69 | char *xf86GetOptValString(const OptionInfoRec *table, int token);
|
---|
70 | Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value);
|
---|
71 | Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value);
|
---|
72 | Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value);
|
---|
73 | Bool xf86GetOptValFreq(const OptionInfoRec *table, int token,
|
---|
74 | OptFreqUnits expectedUnits, double *value);
|
---|
75 | Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value);
|
---|
76 | Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def);
|
---|
77 | int xf86NameCmp(const char *s1, const char *s2);
|
---|
78 | char *xf86NormalizeName(const char *s);
|
---|
79 | pointer xf86ReplaceIntOption(pointer optlist, char *name, int val);
|
---|
80 | pointer xf86ReplaceBoolOption(pointer optlist, char *name, Bool val);
|
---|
81 | pointer xf86ReplaceStrOption(pointer optlist, char *name, char* val);
|
---|
82 | #endif
|
---|