1 /* 2 * XML DRI client-side driver configuration 3 * Copyright (C) 2003 Felix Kuehling 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be included 13 * in all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, 19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 21 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 * 23 */ 24 /** 25 * \file xmlpool.h 26 * \brief Pool of common options 27 * \author Felix Kuehling 28 * 29 * This file defines macros that can be used to construct 30 * driConfigOptions in the drivers. Common options are defined in 31 * xmlpool/t_options.h from which xmlpool/options.h is generated with 32 * translations. This file defines generic helper macros and includes 33 * xmlpool/options.h. 34 */ 35 36 #ifndef __XMLPOOL_H 37 #define __XMLPOOL_H 38 39 /* 40 * generic macros 41 */ 42 43 /** \brief Begin __driConfigOptions */ 44 #define DRI_CONF_BEGIN \ 45 "<?xml version=\"1.0\" standalone=\"yes\"?>" \ 46 "<!DOCTYPE driinfo [" \ 47 " <!ELEMENT driinfo (section*)>" \ 48 " <!ELEMENT section (description+, option+)>" \ 49 " <!ELEMENT description (enum*)>" \ 50 " <!ATTLIST description lang CDATA #REQUIRED" \ 51 " text CDATA #REQUIRED>" \ 52 " <!ELEMENT option (description+)>" \ 53 " <!ATTLIST option name CDATA #REQUIRED" \ 54 " type (bool|enum|int|float) #REQUIRED" \ 55 " default CDATA #REQUIRED" \ 56 " valid CDATA #IMPLIED>" \ 57 " <!ELEMENT enum EMPTY>" \ 58 " <!ATTLIST enum value CDATA #REQUIRED" \ 59 " text CDATA #REQUIRED>" \ 60 "]>" \ 61 "<driinfo>\n" 62 63 /** \brief End __driConfigOptions */ 64 #define DRI_CONF_END \ 65 "</driinfo>\n" 66 67 /** \brief Begin a section of related options */ 68 #define DRI_CONF_SECTION_BEGIN \ 69 "<section>\n" 70 71 /** \brief End a section of related options */ 72 #define DRI_CONF_SECTION_END \ 73 "</section>\n" 74 75 /** \brief Begin an option definition */ 76 #define DRI_CONF_OPT_BEGIN(name,type,def) \ 77 "<option name=\""#name"\" type=\""#type"\" default=\""#def"\">\n" 78 79 /** 80 * \brief Begin a boolean option definition, with the default value passed in 81 * as a string 82 */ 83 #define DRI_CONF_OPT_BEGIN_B(name,def) \ 84 "<option name=\""#name"\" type=\"bool\" default="#def">\n" 85 86 /** \brief Begin an option definition with restrictions on valid values */ 87 #define DRI_CONF_OPT_BEGIN_V(name,type,def,valid) \ 88 "<option name=\""#name"\" type=\""#type"\" default=\""#def"\" valid=\""valid"\">\n" 89 90 /** \brief End an option description */ 91 #define DRI_CONF_OPT_END \ 92 "</option>\n" 93 94 /** \brief A verbal description in a specified language (empty version) */ 95 #define DRI_CONF_DESC(lang,text) \ 96 "<description lang=\""#lang"\" text=\""text"\"/>\n" 97 98 /** \brief A verbal description in a specified language */ 99 #define DRI_CONF_DESC_BEGIN(lang,text) \ 100 "<description lang=\""#lang"\" text=\""text"\">\n" 101 102 /** \brief End a description */ 103 #define DRI_CONF_DESC_END \ 104 "</description>\n" 105 106 /** \brief A verbal description of an enum value */ 107 #define DRI_CONF_ENUM(value,text) \ 108 "<enum value=\""#value"\" text=\""text"\"/>\n" 109 110 111 /* 112 * Predefined option sections and options with multi-lingual descriptions 113 * are now automatically generated. 114 */ 115 #include "xmlpool/options.h" 116 117 #endif 118