![]() |
![]() |
Welcome to the November 2004 edition of Riverace's ACE News and Tips newsletter. This issue contains an explanation of ACE's character-width facilities, news about what's coming up in the next ACE release, and a note about the latest ACE Fix Kit releases. Please forward this newsletter to anyone you think may be interested! Anyone who wishes to receive their own copy of this newsletter can subscribe at http://www.riverace.com/subscribe2/index.mv. If you no longer wish to subscribe, removal directions are at the bottom of this page. Please reply with any feedback you have on this newsletter, as well as ideas for information you'd like to see in upcoming newsletters. We want to be as helpful as possible, so please let us know how we can do that. ACE Tip: Proper Use of ACE's Text-Width Macros and TypesWindows programmers tend to be more familiar with wide-character usage than do UNIX/POSIX programmers because of Windows' prominent use of UNICODE. However, UNIX/POSIX platforms offer support for wide-character usage as well, and it is becoming more and more necessary to understand how to make use of both narrow and wide characters as international markets for software expand. As usual, ACE offers a lot of support for your efforts in this area. BackgroundAPG chapter 1 contains background information on wide characters, but I'll summarize here. C (and C++) programmers are usually trained in the use of the char type for text character data. A char is a single byte but many languages in the world use character sets that require more than one byte to represent a character, hence the need for "wide characters". Some common character sets are ISO 10646 and UNICODE. To make text programming with wide characters possible, there is a native wchar_t type which represents a wide character. A wchar_t is usually either 2 or 4 bytes but it could be other sizes as well; it's a platform-specific detail. There is a set of system library functions to manipulate wide-character strings, analogous to those for narrow characters (strcpy(), printf(), etc.). However, unlike the narrow-character functions, the wide-character functions evolved more recently and are not uniform across all platforms. ACE's string manipulation methods in the ACE_OS namespace allow you to pass either narrow or wide characters, though, so you can manipulate strings of either width across all platforms that support both. Configuration and Wide Character CapabilityThere are two dimensions to configuration for wide-character capability and use. The following two configuration macros can be placed in your config.h file before building ACE and your applications:
Switching Between Narrow and Wide CharactersIf your code needs to be buildable for both narrow and wide character environments, it can be very hard to decide how to program this in a way that doesn't make maintenance a burden. You wouldn't want to find every variable and class member declaration using character data and change between char and wchar_t for different builds. ACE offers the following facilities to make program coding and maintenance easier:
Converting Strings Between Different Character WidthsThere are many string-using ACE methods defined with both char and wchar_t types. Others are defined in terms of ACE_TCHAR to switch depending on the setting of ACE_USES_WCHAR. When you have a need to convert strings between character widths, or make sure that a string is always in a certain width, ACE offers the following macros:
In all of the above macros, remember that:
For string objects, ACE also offers an easy way to portably change between narrow and wide characters. The ACE_CString and ACE_WString are string classes for narrow and wide characters, respectively. Analogous to the ACE_TCHAR width-switching type, ACE offers the ACE_TString type, which is defined as ACE_CString when ACE_USES_WCHAR is not set, and ACE_WString when it is. For examples of these facilities, please see the ACE test suite source code in ACE_wrappers/tests or the APG example source code in ACE_wrappers/examples/APG. If you have more questions about wide-character usage and ACE, please feel free to file a support request to get further clarification and information. If you're not a Riverace support customer, you can learn more about our support services at http://www.riverace.com/support.htm. ACE.next: What's New?The ACE development community is hard at work on the next version of ACE. Here are some of the things you can look forward to (items in bold are new or changed since last month):
New ACE Fix Kits Released!Riverace released ACE versions 5.3e and 5.4b, containing lots of new fixes and improvements to the ACE 5.3 and 5.4 release series, respectively. These kits provide fixes to previously released ACE versions, and are not beta test kits in the ACE develoment stream. The small price for these kits provides you with tremendous value in the ability to maintain stability in your projects while picking up important fixes to ACE. New Project Coming Up?If you're planning a new project to start soon, or find yourself grappling with how to apply ACE to your current project, remember that Riverace provides world-class development and consulting services with special expertise in ACE. We can help you be sure that your new system is designed to take full advantage of ACE's power and flexibility, getting your system delivered in the shortest possible time and with the highest level of quality. Please contact Steve Huston at 888-384-8154 (toll-free in the US) or +1 508-541-9180 to discuss how Riverace can help you. |
Useful ACE Information
Quotables"I also wanted to take this opportunity to express my appreciation for the quality and responsiveness of your organization. It is a very rare pleasure to work with an organization that provides in-depth technical support while remaining strongly customer focused - a fact you clearly demonstrate on every interaction. With your help, we have been able to dramatically improve our development schedule while reducing the overall cost and resources required. Riverace has exceeded our expectations without exception." Christopher W. Midgley This Newsletter...... is produced by Riverace Corporation to educate the ACE user community about ACE and available ACE resources, give tips on how to use ACE more effectively, and explain how Riverace can help you make the most of this powerful toolkit. About UsRiverace Corporation is the premier support service provider for the ACE toolkit worldwide. Steve Huston, Riverace's President/CEO and founder, has over 20 years' experience developing network protocols and applications. He has coauthored three books on ACE's design and usage and is considered an expert by ACE users around the world. Riverace has been focused on providing world-class technical support and consulting services for ACE since 1997. |