73
const TidyOptionImpl* lookupOption( ctmbstr optnam );
74
const TidyOptionImpl* getOption( TidyOptionId optId );
76
TidyIterator getOptionList( TidyDocImpl* doc );
77
const TidyOptionImpl* getNextOption( TidyDocImpl* doc, TidyIterator* iter );
79
TidyIterator getOptionPickList( const TidyOptionImpl* option );
80
ctmbstr getNextOptionPick( const TidyOptionImpl* option, TidyIterator* iter );
82
const TidyOptionDoc* tidyOptGetDocDesc( TidyOptionId optId );
84
void InitConfig( TidyDocImpl* doc );
85
void FreeConfig( TidyDocImpl* doc );
87
Bool SetOptionValue( TidyDocImpl* doc, TidyOptionId optId, ctmbstr val );
88
Bool SetOptionInt( TidyDocImpl* doc, TidyOptionId optId, ulong val );
89
Bool SetOptionBool( TidyDocImpl* doc, TidyOptionId optId, Bool val );
91
Bool ResetOptionToDefault( TidyDocImpl* doc, TidyOptionId optId );
92
void ResetConfigToDefault( TidyDocImpl* doc );
93
void TakeConfigSnapshot( TidyDocImpl* doc );
94
void ResetConfigToSnapshot( TidyDocImpl* doc );
96
void CopyConfig( TidyDocImpl* docTo, TidyDocImpl* docFrom );
99
Todd Lewis contributed this code for expanding
100
~/foo or ~your/foo according to $HOME and your
101
user name. This will only work on Unix systems.
103
ctmbstr ExpandTilde(ctmbstr filename);
105
int ParseConfigFile( TidyDocImpl* doc, ctmbstr cfgfil );
106
int ParseConfigFileEnc( TidyDocImpl* doc,
107
ctmbstr cfgfil, ctmbstr charenc );
109
int SaveConfigFile( TidyDocImpl* doc, ctmbstr cfgfil );
110
int SaveConfigSink( TidyDocImpl* doc, TidyOutputSink* sink );
79
const TidyOptionImpl* TY_(lookupOption)( ctmbstr optnam );
80
const TidyOptionImpl* TY_(getOption)( TidyOptionId optId );
82
TidyIterator TY_(getOptionList)( TidyDocImpl* doc );
83
const TidyOptionImpl* TY_(getNextOption)( TidyDocImpl* doc, TidyIterator* iter );
85
TidyIterator TY_(getOptionPickList)( const TidyOptionImpl* option );
86
ctmbstr TY_(getNextOptionPick)( const TidyOptionImpl* option, TidyIterator* iter );
88
const TidyOptionDoc* TY_(OptGetDocDesc)( TidyOptionId optId );
90
void TY_(InitConfig)( TidyDocImpl* doc );
91
void TY_(FreeConfig)( TidyDocImpl* doc );
93
/* Bool SetOptionValue( TidyDocImpl* doc, TidyOptionId optId, ctmbstr val ); */
94
Bool TY_(SetOptionInt)( TidyDocImpl* doc, TidyOptionId optId, ulong val );
95
Bool TY_(SetOptionBool)( TidyDocImpl* doc, TidyOptionId optId, Bool val );
97
Bool TY_(ResetOptionToDefault)( TidyDocImpl* doc, TidyOptionId optId );
98
void TY_(ResetConfigToDefault)( TidyDocImpl* doc );
99
void TY_(TakeConfigSnapshot)( TidyDocImpl* doc );
100
void TY_(ResetConfigToSnapshot)( TidyDocImpl* doc );
102
void TY_(CopyConfig)( TidyDocImpl* docTo, TidyDocImpl* docFrom );
104
int TY_(ParseConfigFile)( TidyDocImpl* doc, ctmbstr cfgfil );
105
int TY_(ParseConfigFileEnc)( TidyDocImpl* doc,
106
ctmbstr cfgfil, ctmbstr charenc );
108
int TY_(SaveConfigFile)( TidyDocImpl* doc, ctmbstr cfgfil );
109
int TY_(SaveConfigSink)( TidyDocImpl* doc, TidyOutputSink* sink );
112
111
/* returns false if unknown option, missing parameter, or
113
112
option doesn't use parameter
115
Bool ParseConfigOption( TidyDocImpl* doc, ctmbstr optnam, ctmbstr optVal );
116
Bool ParseConfigValue( TidyDocImpl* doc, TidyOptionId optId, ctmbstr optVal );
114
Bool TY_(ParseConfigOption)( TidyDocImpl* doc, ctmbstr optnam, ctmbstr optVal );
115
Bool TY_(ParseConfigValue)( TidyDocImpl* doc, TidyOptionId optId, ctmbstr optVal );
118
117
/* ensure that char encodings are self consistent */
119
Bool AdjustCharEncoding( TidyDocImpl* doc, int encoding );
121
/* ensure that config is self consistent */
122
void AdjustConfig( TidyDocImpl* doc );
124
Bool ConfigDiffThanDefault( TidyDocImpl* doc );
125
Bool ConfigDiffThanSnapshot( TidyDocImpl* doc );
127
int CharEncodingId( ctmbstr charenc );
128
ctmbstr CharEncodingName( int encoding );
129
ctmbstr CharEncodingOptName( int encoding );
131
void SetEmacsFilename( TidyDocImpl* doc, ctmbstr filename );
118
Bool TY_(AdjustCharEncoding)( TidyDocImpl* doc, int encoding );
120
Bool TY_(ConfigDiffThanDefault)( TidyDocImpl* doc );
121
Bool TY_(ConfigDiffThanSnapshot)( TidyDocImpl* doc );
123
int TY_(CharEncodingId)( TidyDocImpl* doc, ctmbstr charenc );
124
ctmbstr TY_(CharEncodingName)( int encoding );
125
ctmbstr TY_(CharEncodingOptName)( int encoding );
127
/* void SetEmacsFilename( TidyDocImpl* doc, ctmbstr filename ); */
136
132
/* Debug lookup functions will be type-safe and assert option type match */
137
ulong _cfgGet( TidyDocImpl* doc, TidyOptionId optId );
138
Bool _cfgGetBool( TidyDocImpl* doc, TidyOptionId optId );
139
TidyTriState _cfgGetAutoBool( TidyDocImpl* doc, TidyOptionId optId );
140
ctmbstr _cfgGetString( TidyDocImpl* doc, TidyOptionId optId );
133
ulong TY_(_cfgGet)( TidyDocImpl* doc, TidyOptionId optId );
134
Bool TY_(_cfgGetBool)( TidyDocImpl* doc, TidyOptionId optId );
135
TidyTriState TY_(_cfgGetAutoBool)( TidyDocImpl* doc, TidyOptionId optId );
136
ctmbstr TY_(_cfgGetString)( TidyDocImpl* doc, TidyOptionId optId );
142
#define cfg(doc, id) _cfgGet( (doc), (id) )
143
#define cfgBool(doc, id) _cfgGetBool( (doc), (id) )
144
#define cfgAutoBool(doc, id) _cfgGetAutoBool( (doc), (id) )
145
#define cfgStr(doc, id) _cfgGetString( (doc), (id) )
138
#define cfg(doc, id) TY_(_cfgGet)( (doc), (id) )
139
#define cfgBool(doc, id) TY_(_cfgGetBool)( (doc), (id) )
140
#define cfgAutoBool(doc, id) TY_(_cfgGetAutoBool)( (doc), (id) )
141
#define cfgStr(doc, id) TY_(_cfgGetString)( (doc), (id) )
149
145
/* Release build macros for speed */
150
#define cfg(doc, id) ((doc)->config.value[ (id) ])
146
#define cfg(doc, id) ((doc)->config.value[ (id) ].v)
151
147
#define cfgBool(doc, id) ((Bool) cfg(doc, id))
152
148
#define cfgAutoBool(doc, id) ((TidyTriState) cfg(doc, id))
153
#define cfgStr(doc, id) ((ctmbstr) cfg(doc, id))
149
#define cfgStr(doc, id) ((ctmbstr) (doc)->config.value[ (id) ].p)
155
151
#endif /* _DEBUG */
159
/* parser for integer values */
160
ParseProperty ParseInt;
162
/* parser for 't'/'f', 'true'/'false', 'y'/'n', 'yes'/'no' or '1'/'0' */
163
ParseProperty ParseBool;
165
/* parser for 't'/'f', 'true'/'false', 'y'/'n', 'yes'/'no', '1'/'0'
167
ParseProperty ParseAutoBool;
169
/* a string excluding whitespace */
170
ParseProperty ParseName;
172
/* a CSS1 selector - CSS class naming for -clean option */
173
ParseProperty ParseCSS1Selector;
175
/* a string including whitespace */
176
ParseProperty ParseString;
178
/* a space or comma separated list of tag names */
179
ParseProperty ParseTagNames;
181
/* RAW, ASCII, LATIN0, LATIN1, UTF8, ISO2022, MACROMAN,
182
WIN1252, IBM858, UTF16LE, UTF16BE, UTF16, BIG5, SHIFTJIS
184
ParseProperty ParseCharEnc;
185
ParseProperty ParseNewline;
187
/* omit | auto | strict | loose | <fpi> */
188
ParseProperty ParseDocType;
190
/* keep-first or keep-last? */
191
ParseProperty ParseRepeatAttr;
193
153
#endif /* __CONFIG_H__ */