Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.4 KiB

  1. #! perl -w write_unames.pl
  2. #
  3. # Description:
  4. # Write the names of the Unicode characters extracted from "UnicodeData-Latest.txt".
  5. # The names are written to the file "unames.str" which is included into the
  6. # resource file "getuname.rc" used to build getunames.dll.
  7. #
  8. # Author: John I. McConnell
  9. # 23-Sep-2000 JohnMcCo Created
  10. # 27-Nov-2000 JohnMcCo Converted most names to lowercase to make life easier
  11. # for the localizers. Changed base string id to IDS_UNAME
  12. # since uce uses IDS_UNICODE for a string resource (and
  13. # includes getuname.h for some strange reason).
  14. #
  15. # Enforce the rules.
  16. use strict;
  17. # Read the UnicodeData-Latest.txt properties.
  18. open(DATA, "UnicodeData-Latest.txt") or die "Could not open UnicodeData-Latest.txt $!";
  19. # Open the new string file.
  20. open(NAME, ">unames.str") or die "Could not open unames.str $!";
  21. print NAME<<HEADER;
  22. /*++
  23. Copyright (c) 1997-2001, Microsoft Corporation All rights reserved.
  24. Module Name:
  25. unames.str
  26. Abstract:
  27. This file is generated by write_unames.pl. DO NOT EDIT.
  28. It contains the Unicode code value names used by getunames.dll.
  29. Revision History:
  30. 23-Sep-2000 JohnMcCo Added support for Unicode 3.0
  31. 27-Nov-2000 JohnMcCo Changed names to title case and string ID to IDS_UNAME
  32. 25-Jan-2001 JohnMcCo Make each part of a hyphenated name uppercase.
  33. --*/
  34. STRINGTABLE DISCARDABLE
  35. BEGIN
  36. HEADER
  37. # Copy names from UnicodeData-Latest to the string file.
  38. while (<DATA>) {
  39. # Get the tab-separated fields.
  40. my ($cp, $name, @fields) = split /;/ or die "bad line in UnicodeData-Latest.txt";
  41. # If it is a control character, use the ISO name if it exists.
  42. if ($name =~ /<control>/ && length($fields[8]) > 0) {
  43. $name = $fields[8];
  44. }
  45. # If it's off the BMP or a range, ignore it.
  46. next if hex $cp > 0xffff || ($name =~ /^<.*,/);
  47. # Titlecase each word in the name except 'CJK'.
  48. my @words = map { /CJK/ ? $_ : ucfirst lc } split(' ', $name);
  49. # Titlecase each hyphen-separated word in the name.
  50. @words = split('-', $name);
  51. @words = map ucfirst, @words;
  52. $name = join('-', @words);
  53. # Print the string resource id value and name.
  54. print NAME 'IDS_UNAME + 0x', $cp, ' "', join(' ', @words), '"', "\n";
  55. }
  56. close(DATA);
  57. print NAME "END\n";
  58. close(NAME);