Notes on Internationalization for the Alarm Management API

Work with strings.

Recommended reading.

Work with strings

This API is written for the international environment. In an international environment, strings in CIMPLICITY software can be multi-byte strings. If you want your code to conform to international standards, GE Fanuc recommends that you do the following when working with strings:

Use the TCHAR macros found in TCHAR.H.

Declare string buffers as TCHAR[]. Declare string pointers as TCHAR* or LPTSTR.

Wrap string and character constants with the _T() macro.

Use the _tcs...() functions in place of the str...() functions. For example, use _tcslen() in place of strlen().

Be careful when incrementing a pointer through a string. Remember that a logical character may occupy one or two TCHAR units. So replace code that looks like this:

char *cp;

for (cp = string; *cp != '\0'; ++cp)

{

}

with code that looks like this:

TCHAR const *cp;

for (cp = string; *cp != _T('\0'); cp = _tcsinc(cp))

{

}

Avoid using a variable to hold the value of a logical character. Instead, use a pointer to a character in the string. In particular, avoid the _tcsnextc() macro, because the value it returns appears to be incompatible with some of the C runtime library functions.

Use the functions _tccpy() and _tccmp() and string pointers instead of the = and == operators on characters.

Use GetStringTypeEx() instead of the character classification macros such as _istalpha().

Use CharUpper() and CharLower() instead of _toupper() and _tolower().

Recommended Reading

Microsoft has several good papers on writing international code on its Developer Network CD and its web site To find documentation on the web site, go to http://msdn.microsoft.com/default.asp and search for MBCS

For documentation on globalization, go to http://www.microsoft.com/globaldev/

The following book is also available:

Schmitt, David A. International Programming for Microsoft® Windows®, ISBN 1-57231-956-9.

For more information about this book, go to http://mspress.microsoft.com/books/2323.htm.

More information

Alarm Management and CIMPLICITY functionality.