HTML Tidy  5.4.0
The HTACG Tidy HTML Project
language.h File Reference

Go to the source code of this file.

Data Structures

struct  languageDefinition
 Finally, a complete language definition. More...
 
struct  languageDictionaryEntry
 Describes a record for a localization string. More...
 
struct  tidyErrorFilterKeyItem
 The function getNextErrorCode() returns pointers to this type; it gives LibTidy implementors the ability to know what errors can be returned via TidyReportFilter3. More...
 
struct  tidyLocaleMapItem
 The function getNextWindowsLanguage() returns pointers to this type; it gives LibTidy implementors the ability to determine how Windows locale names are mapped to POSIX language codes. More...
 

Functions

Localization Related Functions
tmbstr tidySystemLocale (tmbstr result)
 Determines the current locale without affecting the C locale. More...
 
Bool tidySetLanguage (ctmbstr languageCode)
 Tells Tidy to use a different language for output. More...
 
ctmbstr tidyGetLanguage ()
 Gets the current language used by Tidy. More...
 
ctmbstr tidyLocalizedStringN (uint messageType, uint quantity)
 Provides a string given messageType in the current localization for quantity. More...
 
ctmbstr tidyLocalizedString (uint messageType)
 Provides a string given messageType in the current localization for the single case. More...
 
Documentation Generation
ctmbstr tidyDefaultString (uint messageType)
 Provides a string given messageType in the default localization (which is en). More...
 
TidyIterator getStringKeyList ()
 
uint getNextStringKey (TidyIterator *iter)
 
TidyIterator getWindowsLanguageList ()
 Initializes the TidyIterator to point to the first item in Tidy's structure of Windows<->POSIX local mapping. More...
 
const tidyLocaleMapItemgetNextWindowsLanguage (TidyIterator *iter)
 Returns the next record of type localeMapItem in Tidy's structure of Windows<->POSIX local mapping. More...
 
TidyIterator getInstalledLanguageList ()
 Initializes the TidyIterator to point to the first item in Tidy's list of installed language codes. More...
 
ctmbstr getNextInstalledLanguage (TidyIterator *iter)
 Returns the next installed language. More...
 
TidyIterator getErrorCodeList ()
 Initializes the TidyIterator to point to the first item in Tidy's list of error codes that can be return with TidyReportFilter3. More...
 
const tidyErrorFilterKeyItemgetNextErrorCode (TidyIterator *iter)
 Returns the next error code. More...
 

Exposed Data Structures

enum  tidyMessageTypes {
  TIDY_MESSAGE_TYPE_FIRST = 4096,
  TIDY_LANGUAGE,
  TEST_PRESENT_IN_BASE,
  TEST_PRESENT_IN_REGION,
  TC_CAT_DIAGNOSTICS,
  TC_CAT_ENCODING,
  TC_CAT_MARKUP,
  TC_CAT_MISC,
  TC_CAT_PRETTYPRINT,
  TC_LABEL_COL,
  TC_LABEL_FILE,
  TC_LABEL_LANG,
  TC_LABEL_LEVL,
  TC_LABEL_OPT,
  TC_MAIN_ERROR_LOAD_CONFIG,
  TC_OPT_ACCESS,
  TC_OPT_ASCII,
  TC_OPT_ASHTML,
  TC_OPT_ASXML,
  TC_OPT_BARE,
  TC_OPT_BIG5,
  TC_OPT_CLEAN,
  TC_OPT_CONFIG,
  TC_OPT_ERRORS,
  TC_OPT_FILE,
  TC_OPT_GDOC,
  TC_OPT_HELP,
  TC_OPT_HELPCFG,
  TC_OPT_HELPOPT,
  TC_OPT_IBM858,
  TC_OPT_INDENT,
  TC_OPT_ISO2022,
  TC_OPT_LANGUAGE,
  TC_OPT_LATIN0,
  TC_OPT_LATIN1,
  TC_OPT_MAC,
  TC_OPT_MODIFY,
  TC_OPT_NUMERIC,
  TC_OPT_OMIT,
  TC_OPT_OUTPUT,
  TC_OPT_QUIET,
  TC_OPT_RAW,
  TC_OPT_SHIFTJIS,
  TC_OPT_SHOWCFG,
  TC_OPT_UPPER,
  TC_OPT_UTF16,
  TC_OPT_UTF16BE,
  TC_OPT_UTF16LE,
  TC_OPT_UTF8,
  TC_OPT_VERSION,
  TC_OPT_WIN1252,
  TC_OPT_WRAP,
  TC_OPT_XML,
  TC_OPT_XMLCFG,
  TC_OPT_XMLSTRG,
  TC_OPT_XMLERRS,
  TC_OPT_XMLOPTS,
  TC_OPT_XMLHELP,
  TC_STRING_CONF_HEADER,
  TC_STRING_CONF_NAME,
  TC_STRING_CONF_TYPE,
  TC_STRING_CONF_VALUE,
  TC_STRING_CONF_NOTE,
  TC_STRING_OPT_NOT_DOCUMENTED,
  TC_STRING_OUT_OF_MEMORY,
  TC_STRING_FATAL_ERROR,
  TC_STRING_FILE_MANIP,
  TC_STRING_LANG_MUST_SPECIFY,
  TC_STRING_LANG_NOT_FOUND,
  TC_STRING_MUST_SPECIFY,
  TC_STRING_PROCESS_DIRECTIVES,
  TC_STRING_CHAR_ENCODING,
  TC_STRING_MISC,
  TC_STRING_XML,
  TC_STRING_UNKNOWN_OPTION,
  TC_STRING_UNKNOWN_OPTION_B,
  TC_STRING_VERS_A,
  TC_STRING_VERS_B,
  TC_TXT_HELP_1,
  TC_TXT_HELP_2A,
  TC_TXT_HELP_2B,
  TC_TXT_HELP_3,
  TC_TXT_HELP_CONFIG,
  TC_TXT_HELP_CONFIG_NAME,
  TC_TXT_HELP_CONFIG_TYPE,
  TC_TXT_HELP_CONFIG_ALLW,
  TC_TXT_HELP_LANG_1,
  TC_TXT_HELP_LANG_2,
  TC_TXT_HELP_LANG_3,
  TIDY_MESSAGE_TYPE_LAST
}
 Defines all of the possible dictionary keys. More...
 
typedef languageDictionaryEntry const languageDictionary[600]
 For now we'll just use an array to hold all of the dictionary entries. More...
 
ctmbstr tidyErrorCodeAsString (uint code)
 LibTidy users may want to use TidyReportFilter3 to enable their own localization lookup features. More...
 

Data Structure Documentation

◆ languageDictionaryEntry

struct languageDictionaryEntry

Describes a record for a localization string.

Data Fields
uint key
uint pluralForm
ctmbstr value

◆ tidyErrorFilterKeyItem

struct tidyErrorFilterKeyItem

The function getNextErrorCode() returns pointers to this type; it gives LibTidy implementors the ability to know what errors can be returned via TidyReportFilter3.

Provides the mapping for LibTidy users to map between an opaque key and an error message value. See tidyErrorFilterKeys[] in language.c. The key string is guaranteed by the API (unless deleted entirely). The value is suitable for use in looking up Tidy's strings, but its value is not guaranteed between releases.

Data Fields
ctmbstr key
int value

◆ tidyLocaleMapItem

struct tidyLocaleMapItem

The function getNextWindowsLanguage() returns pointers to this type; it gives LibTidy implementors the ability to determine how Windows locale names are mapped to POSIX language codes.

Data Fields
ctmbstr POSIXName
ctmbstr winName

Typedef Documentation

◆ languageDictionary

typedef languageDictionaryEntry const languageDictionary[600]

For now we'll just use an array to hold all of the dictionary entries.

In the future we can convert this to a hash structure which will make looking up strings faster.

Enumeration Type Documentation

◆ tidyMessageTypes

Defines all of the possible dictionary keys.

The starting value is arbitrary but must prevent overlaps with other enums that are used for retrieving strings. The comprehensive list of enums for which we provides strings is as follows:

  • tidyMessageTypes in this file, start == 4096.
  • tidyErrorCodes from message.h, start == 200.
  • accessErrorCodes from access.h, start == CODES_TIDY_ERROR_LAST+1.
  • tidyMessagesMisc from message.h, start == 2048.
  • TidyOptionId from tidyEnum.h, start == 0 (important!).
  • TidyReportLevelKeys from tidyEnum.h, start == 600.
  • ... You should never count on the value of a label being constant. Accordingly feel free to arrange new enum values in the most appropriate grouping below.
Enumerator
TIDY_MESSAGE_TYPE_FIRST 
TIDY_LANGUAGE 
TEST_PRESENT_IN_BASE 
TEST_PRESENT_IN_REGION 
TC_CAT_DIAGNOSTICS 
TC_CAT_ENCODING 
TC_CAT_MARKUP 
TC_CAT_MISC 
TC_CAT_PRETTYPRINT 
TC_LABEL_COL 
TC_LABEL_FILE 
TC_LABEL_LANG 
TC_LABEL_LEVL 
TC_LABEL_OPT 
TC_MAIN_ERROR_LOAD_CONFIG 
TC_OPT_ACCESS 
TC_OPT_ASCII 
TC_OPT_ASHTML 
TC_OPT_ASXML 
TC_OPT_BARE 
TC_OPT_BIG5 
TC_OPT_CLEAN 
TC_OPT_CONFIG 
TC_OPT_ERRORS 
TC_OPT_FILE 
TC_OPT_GDOC 
TC_OPT_HELP 
TC_OPT_HELPCFG 
TC_OPT_HELPOPT 
TC_OPT_IBM858 
TC_OPT_INDENT 
TC_OPT_ISO2022 
TC_OPT_LANGUAGE 
TC_OPT_LATIN0 
TC_OPT_LATIN1 
TC_OPT_MAC 
TC_OPT_MODIFY 
TC_OPT_NUMERIC 
TC_OPT_OMIT 
TC_OPT_OUTPUT 
TC_OPT_QUIET 
TC_OPT_RAW 
TC_OPT_SHIFTJIS 
TC_OPT_SHOWCFG 
TC_OPT_UPPER 
TC_OPT_UTF16 
TC_OPT_UTF16BE 
TC_OPT_UTF16LE 
TC_OPT_UTF8 
TC_OPT_VERSION 
TC_OPT_WIN1252 
TC_OPT_WRAP 
TC_OPT_XML 
TC_OPT_XMLCFG 
TC_OPT_XMLSTRG 
TC_OPT_XMLERRS 
TC_OPT_XMLOPTS 
TC_OPT_XMLHELP 
TC_STRING_CONF_HEADER 
TC_STRING_CONF_NAME 
TC_STRING_CONF_TYPE 
TC_STRING_CONF_VALUE 
TC_STRING_CONF_NOTE 
TC_STRING_OPT_NOT_DOCUMENTED 
TC_STRING_OUT_OF_MEMORY 
TC_STRING_FATAL_ERROR 
TC_STRING_FILE_MANIP 
TC_STRING_LANG_MUST_SPECIFY 
TC_STRING_LANG_NOT_FOUND 
TC_STRING_MUST_SPECIFY 
TC_STRING_PROCESS_DIRECTIVES 
TC_STRING_CHAR_ENCODING 
TC_STRING_MISC 
TC_STRING_XML 
TC_STRING_UNKNOWN_OPTION 
TC_STRING_UNKNOWN_OPTION_B 
TC_STRING_VERS_A 
TC_STRING_VERS_B 
TC_TXT_HELP_1 
TC_TXT_HELP_2A 
TC_TXT_HELP_2B 
TC_TXT_HELP_3 
TC_TXT_HELP_CONFIG 
TC_TXT_HELP_CONFIG_NAME 
TC_TXT_HELP_CONFIG_TYPE 
TC_TXT_HELP_CONFIG_ALLW 
TC_TXT_HELP_LANG_1 
TC_TXT_HELP_LANG_2 
TC_TXT_HELP_LANG_3 
TIDY_MESSAGE_TYPE_LAST 

Function Documentation

◆ getErrorCodeList()

TidyIterator getErrorCodeList ( )

Initializes the TidyIterator to point to the first item in Tidy's list of error codes that can be return with TidyReportFilter3.

Items can be retrieved with getNextErrorCode();

◆ getInstalledLanguageList()

TidyIterator getInstalledLanguageList ( )

Initializes the TidyIterator to point to the first item in Tidy's list of installed language codes.

Items can be retrieved with getNextInstalledLanguage();

◆ getNextErrorCode()

const tidyErrorFilterKeyItem* getNextErrorCode ( TidyIterator *  iter)

Returns the next error code.

◆ getNextInstalledLanguage()

ctmbstr getNextInstalledLanguage ( TidyIterator *  iter)

Returns the next installed language.

◆ getNextStringKey()

uint getNextStringKey ( TidyIterator *  iter)

◆ getNextWindowsLanguage()

const tidyLocaleMapItem* getNextWindowsLanguage ( TidyIterator *  iter)

Returns the next record of type localeMapItem in Tidy's structure of Windows<->POSIX local mapping.

◆ getStringKeyList()

TidyIterator getStringKeyList ( )

◆ getWindowsLanguageList()

TidyIterator getWindowsLanguageList ( )

Initializes the TidyIterator to point to the first item in Tidy's structure of Windows<->POSIX local mapping.

Items can be retrieved with getNextWindowsLanguage();

◆ tidyDefaultString()

ctmbstr tidyDefaultString ( uint  messageType)

Provides a string given messageType in the default localization (which is en).

◆ tidyErrorCodeAsString()

ctmbstr tidyErrorCodeAsString ( uint  code)

LibTidy users may want to use TidyReportFilter3 to enable their own localization lookup features.

Because Tidy's errors codes are enums the specific values can change over time. This function returns a string representing the enum value name that can be used as a lookup key independent of changing string values (TidyReportFiler2 is vulnerable to changing strings). TidyReportFilter3 will return this general string as the error message indicator.

◆ tidyGetLanguage()

ctmbstr tidyGetLanguage ( )

Gets the current language used by Tidy.

◆ tidyLocalizedString()

ctmbstr tidyLocalizedString ( uint  messageType)

Provides a string given messageType in the current localization for the single case.

◆ tidyLocalizedStringN()

ctmbstr tidyLocalizedStringN ( uint  messageType,
uint  quantity 
)

Provides a string given messageType in the current localization for quantity.

◆ tidySetLanguage()

Bool tidySetLanguage ( ctmbstr  languageCode)

Tells Tidy to use a different language for output.

Parameters
languageCodeA Windows or POSIX language code, and must match a TIDY_LANGUAGE for an installed language.
Returns
Indicates that a setting was applied, but not necessarily the specific request, i.e., true indicates a language and/or region was applied. If es_mx is requested but not installed, and es is installed, then es will be selected and this function will return true. However the opposite is not true; if es is requested but not present, Tidy will not try to select from the es_XX variants.

◆ tidySystemLocale()

tmbstr tidySystemLocale ( tmbstr  result)

Determines the current locale without affecting the C locale.

Tidy has always used the default C locale, and at this point in its development we're not going to tamper with that.

Parameters
resultThe buffer to use to return the string. Returns NULL on failure.
Returns
The same buffer for convenience.