case.h File Reference

Locale-independent implementation of case swapping operation. More...

`#include <string.h>`
`#include <sphinxbase/prim_type.h>`
`#include <sphinxbase/sphinxbase_export.h>`

Go to the source code of this file.

## Macros

#define | UPPER_CASE(c)
| Return upper case form for c.
#define | LOWER_CASE(c)
| Return lower case form for c.

## Functions

SPHINXBASE_EXPORT void | ucase (char *str)
| Convert str to all upper case.
SPHINXBASE_EXPORT void | lcase (char *str)
| Convert str to all lower case.
SPHINXBASE_EXPORT int32 | strcmp_nocase (const char *str1, const char *str2)
| (FIXME!
SPHINXBASE_EXPORT int32 | strncmp_nocase (const char *str1, const char *str2, size_t len)
| Like strcmp_nocase() but with a maximum length.

## Detailed Description

Locale-independent implementation of case swapping operation.

This function implements ASCII-only case switching and comparison related operations, which do not depend on the locale and are guaranteed to exist on all versions of Windows.

Definition in file case.h.

## Macro Definition Documentation

## LOWER_CASE

#define LOWER_CASE | ( |  | c | ) |

Value:
((((c) >= 'A') && ((c) <= 'Z')) ? (c+32) : c)

Return lower case form for c.

Definition at line 97 of file case.h.

## UPPER_CASE

#define UPPER_CASE | ( |  | c | ) |

Value:
((((c) >= 'a') && ((c) <= 'z')) ? (c-32) : c)

Return upper case form for c.

Definition at line 92 of file case.h.

Referenced by strcmp_nocase(), and strncmp_nocase().

## Function Documentation

## lcase()

SPHINXBASE_EXPORT void lcase | ( | char * | str | ) |

Convert str to all lower case.

Parameters

  str | is a string.

Referenced by ngram_model_casefold().

## strcmp_nocase()

SPHINXBASE_EXPORT int32 strcmp_nocase | ( | const char * | str1,
|  | const char * | str2 )

(FIXME!

The implementation is incorrect!) Case insensitive string compare. Return the usual -1, 0, +1, depending on str1 <, =, > str2 (case insensitive, of course).

Parameters

  str1 | is the first string.
  str2 | is the second string.

Definition at line 94 of file case.c.

References strcmp_nocase(), and UPPER_CASE.

Referenced by ngram_file_name_to_type(), ngram_str_to_type(), and strcmp_nocase().

## strncmp_nocase()

SPHINXBASE_EXPORT int32 strncmp_nocase | ( | const char * | str1,
|  | const char * | str2,
|  | size_t | len )

Like strcmp_nocase() but with a maximum length.

Definition at line 119 of file case.c.

References strncmp_nocase(), and UPPER_CASE.

Referenced by ngram_file_name_to_type(), and strncmp_nocase().

## ucase()

SPHINXBASE_EXPORT void ucase | ( | char * | str | ) |

Convert str to all upper case.

Parameters

  str | is a string.

Referenced by ngram_model_casefold().