diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2003-03-04 22:07:12 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2003-03-04 22:07:12 +0000 |
commit | 480eeeec01168f9f1bcbe933cf1ac1e6b881a77c (patch) | |
tree | c14f4be9ad82e9c10ac0ffda22fa435d058832ad | |
parent | 1175f1628843f1eeac015754ea0d2f96a928e095 (diff) | |
download | ATCD-480eeeec01168f9f1bcbe933cf1ac1e6b881a77c.tar.gz |
ChangeLog tag: Tue Mar 4 13:54:52 2003 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r-- | ChangeLog | 53 | ||||
-rw-r--r-- | ace/CDR_Stream.h | 8 | ||||
-rw-r--r-- | ace/Makefile.ace | 2 | ||||
-rw-r--r-- | ace/ace.mpc | 2 | ||||
-rw-r--r-- | apps/mkcsregdb/Makefile | 37 | ||||
-rw-r--r-- | apps/mkcsregdb/code_set_registry1.2g.txt | 1528 | ||||
-rw-r--r-- | apps/mkcsregdb/cs_test.txt | 15 | ||||
-rw-r--r-- | apps/mkcsregdb/iso_only.txt | 7 | ||||
-rwxr-xr-x | apps/mkcsregdb/mkcsregdb | bin | 0 -> 245031 bytes | |||
-rw-r--r-- | apps/mkcsregdb/mkcsregdb.cpp | 319 | ||||
-rw-r--r-- | apps/mkcsregdb/mkcsregdb.cpp~ | 308 | ||||
-rw-r--r-- | apps/mkcsregdb/mkcsregdb.dsp | 102 |
12 files changed, 2367 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog index 63b939a5b6c..805a543edd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,48 @@ +Tue Mar 4 13:54:52 2003 Phil Mesnier <mesnier_p@ociweb.com> + + * ace/Codeset_Registry.cpp: + * ace/Codeset_Registry.h: + * ace/Codeset_Registry.inl: + + New files added to support the codeset framework. The Codeset Registry + is either a wrapper for dce code and character set registry functions, + if the system supports them, or these fucntions are emulated. Only the + functions necessary to support TAO's Codeset translation framework are + emulated. + + * ace/Codeset_Registry_db.cpp: + + The codeset "database." A minimal list (2 entries) is shipped, see + apps/mkcsregdb to build a new list of supported codesets as needed. + + * ace/CDR_Stream.h: + + Changed the interface on the ACE_[W]Char_Codeset_Translator class for + the read_[w]char_array to take a non-const array as the out parameter. + + * ace/Makefile.ace: + * ace/ace.mpc: + + Added the new codeset files to the makefile. + + * apps/mkcsregdb: + + A new application used to generate custom list of codeset identites. + The description of how to run is in a comment at the top of + ace/Codeset_Registry_db.cpp. + Tue Jan 24 17:50:32 2003 Gonzalo Diethelm <gonzalo.diethelm@aditiva.com> - * ace/INET_Addr.cpp: - Method string_to_addr() now uses ACE_OS_String::strtol() instead - of the ugly hack using ACE_OS::strspn() and ACE_OS::atoi(). The - two set() methods that receive a const char port_name[] now try - first to parse that port_name as a simple number (like "901"), - and if that fails they try to resolve the port name as a - service. In order to implement this, I added a static helper - function called get_port_number_from_name() (sorry for the awful - name). - + * ace/INET_Addr.cpp: + Method string_to_addr() now uses ACE_OS_String::strtol() instead + of the ugly hack using ACE_OS::strspn() and ACE_OS::atoi(). The + two set() methods that receive a const char port_name[] now try + first to parse that port_name as a simple number (like "901"), + and if that fails they try to resolve the port name as a + service. In order to implement this, I added a static helper + function called get_port_number_from_name() (sorry for the awful + name). + Tue Mar 4 12:53:06 2003 Chad Elliott <elliott_c@ociweb.com> * bin/MakeProjectCreator/modules/ProjectCreator.pm: diff --git a/ace/CDR_Stream.h b/ace/CDR_Stream.h index 0cb741a6d5c..954b8f81b22 100644 --- a/ace/CDR_Stream.h +++ b/ace/CDR_Stream.h @@ -950,7 +950,7 @@ public: /// Read an array of characters from the stream, converting the /// characters from the stream codeset to the native codeset. virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR&, - const ACE_CDR::Char*, + ACE_CDR::Char*, ACE_CDR::ULong) = 0; /// Write a single character to the stream, converting from the @@ -1044,7 +1044,7 @@ public: virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR&, ACE_CDR::WChar *&) = 0; virtual ACE_CDR::Boolean read_wchar_array (ACE_InputCDR&, - const ACE_CDR::WChar*, + ACE_CDR::WChar*, ACE_CDR::ULong) = 0; virtual ACE_CDR::Boolean write_wchar (ACE_OutputCDR&, ACE_CDR::WChar) = 0; @@ -1055,6 +1055,8 @@ public: const ACE_CDR::WChar*, ACE_CDR::ULong) = 0; + virtual ACE_CDR::ULong ncs () = 0; + virtual ACE_CDR::ULong tcs () = 0; protected: /// Children have access to low-level routines because they cannot /// use read_char or something similar (it would recurse). @@ -1112,8 +1114,6 @@ protected: ACE_CDR::Octet major_version (ACE_OutputCDR& output); ACE_CDR::Octet minor_version (ACE_OutputCDR& output); - virtual ACE_CDR::ULong ncs () = 0; - virtual ACE_CDR::ULong tcs () = 0; }; // @@ These operators should not be inlined since they force SString.h diff --git a/ace/Makefile.ace b/ace/Makefile.ace index eece823158b..339d3a86fdc 100644 --- a/ace/Makefile.ace +++ b/ace/Makefile.ace @@ -204,6 +204,8 @@ STREAMS_FILES = \ CDR_Base \ CDR_Stream \ Codeset_IBM1047 \ + Codeset_Registry \ + Codeset_Registry_db \ Message_Queue \ Reactor_Notification_Strategy \ Task diff --git a/ace/ace.mpc b/ace/ace.mpc index b9eb5d41241..ba54593075d 100644 --- a/ace/ace.mpc +++ b/ace/ace.mpc @@ -224,6 +224,8 @@ project : acelib, core { CDR_Base.cpp CDR_Stream.cpp Codeset_IBM1047.cpp + Codeset_Registry.cpp + Codeset_Registry_db.cpp Message_Queue.cpp Reactor_Notification_Strategy.cpp Task.cpp diff --git a/apps/mkcsregdb/Makefile b/apps/mkcsregdb/Makefile new file mode 100644 index 00000000000..9e9c05ed23c --- /dev/null +++ b/apps/mkcsregdb/Makefile @@ -0,0 +1,37 @@ +#---------------------------------------------------------------------------- +# $Id$ +# +# Makefile for soreduce utility +#---------------------------------------------------------------------------- + +BIN = mkcsregdb +INSBIN = $(ACE_ROOT)/bin/mkcsregdb + +FILES = mkcsregdb + +SRC = $(addsuffix .cpp,$(FILES)) +OBJ = $(addsuffix .o,$(FILES)) + +BUILD = $(VBIN) + +INSTALL = $(VBIN:%=$(INSBIN)/%$(EXEEXT)) + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/apps/mkcsregdb/code_set_registry1.2g.txt b/apps/mkcsregdb/code_set_registry1.2g.txt new file mode 100644 index 00000000000..3e87317d5f0 --- /dev/null +++ b/apps/mkcsregdb/code_set_registry1.2g.txt @@ -0,0 +1,1528 @@ +start +description ISO 8859-1:1987; Latin Alphabet No. 1 +loc_name NONE +rgy_value 0x00010001 +char_values 0x0011 +max_bytes 1 +end + +start +description ISO 8859-2:1987; Latin Alphabet No. 2 +loc_name NONE +rgy_value 0x00010002 +char_values 0x0012 +max_bytes 1 +end + +start +description ISO 8859-3:1988; Latin Alphabet No. 3 +loc_name NONE +rgy_value 0x00010003 +char_values 0x0013 +max_bytes 1 +end + +start +description ISO 8859-4:1988; Latin Alphabet No. 4 +loc_name NONE +rgy_value 0x00010004 +char_values 0x0014 +max_bytes 1 +end + +start +description ISO/IEC 8859-5:1988; Latin-Cyrillic Alphabet +loc_name NONE +rgy_value 0x00010005 +char_values 0x0015 +max_bytes 1 +end + +start +description ISO 8859-6:1987; Latin-Arabic Alphabet +loc_name NONE +rgy_value 0x00010006 +char_values 0x0016 +max_bytes 1 +end + +start +description ISO 8859-7:1987; Latin-Greek Alphabet +loc_name NONE +rgy_value 0x00010007 +char_values 0x0017 +max_bytes 1 +end + +start +description ISO 8859-8:1988; Latin-Hebrew Alphabet +loc_name NONE +rgy_value 0x00010008 +char_values 0x0018 +max_bytes 1 +end + +start +description ISO/IEC 8859-9:1989; Latin Alphabet No. 5 +loc_name NONE +rgy_value 0x00010009 +char_values 0x0019 +max_bytes 1 +end + +start +description ISO/IEC 8859-10:1992; Latin Alphabet No. 6 +loc_name NONE +rgy_value 0x0001000a +char_values 0x001a +max_bytes 1 +end + +start +description ISO 646:1991 IRV (International Reference Version) +loc_name NONE +rgy_value 0x00010020 +char_values 0x0001 +max_bytes 1 +end + +start +description ISO/IEC 10646-1:1993; UCS-2, Level 1 +loc_name NONE +rgy_value 0x00010100 +char_values 0x1000 +max_bytes 2 +end + +start +description ISO/IEC 10646-1:1993; UCS-2, Level 2 +loc_name NONE +rgy_value 0x00010101 +char_values 0x1000 +max_bytes 2 +end + +start +description ISO/IEC 10646-1:1993; UCS-2, Level 3 +loc_name NONE +rgy_value 0x00010102 +char_values 0x1000 +max_bytes 2 +end + +start +description ISO/IEC 10646-1:1993; UCS-4, Level 1 +loc_name NONE +rgy_value 0x00010104 +char_values 0x1000 +max_bytes 4 +end + +start +description ISO/IEC 10646-1:1993; UCS-4, Level 2 +loc_name NONE +rgy_value 0x00010105 +char_values 0x1000 +max_bytes 4 +end + +start +description ISO/IEC 10646-1:1993; UCS-4, Level 3 +loc_name NONE +rgy_value 0x00010106 +char_values 0x1000 +max_bytes 4 +end + +start +description ISO/IEC 10646-1:1993; UTF-1, UCS Transformation Format 1 +loc_name NONE +rgy_value 0x00010108 +char_values 0x1000 +max_bytes 5 +end + +start +description ISO/IEC 10646-1:1993; UTF-16, UCS Transformation Format 16-bit form +loc_name NONE +rgy_value 0x00010109 +char_values 0x1000 +max_bytes 2 +end + +start +description JIS X0201:1976; Japanese phonetic characters +loc_name NONE +rgy_value 0x00030001 +char_values 0x0080 +max_bytes 1 +end + +start +description JIS X0208:1978 Japanese Kanji Graphic Characters +loc_name NONE +rgy_value 0x00030004 +char_values 0x0081 +max_bytes 2 +end + +start +description JIS X0208:1983 Japanese Kanji Graphic Characters +loc_name NONE +rgy_value 0x00030005 +char_values 0x0081 +max_bytes 2 +end + +start +description JIS X0208:1990 Japanese Kanji Graphic Characters +loc_name NONE +rgy_value 0x00030006 +char_values 0x0081 +max_bytes 2 +end + +start +description JIS X0212:1990; Supplementary Japanese Kanji Graphic Chars +loc_name NONE +rgy_value 0x0003000a +char_values 0x0082 +max_bytes 2 +end + +start +description JIS eucJP:1993; Japanese EUC +loc_name NONE +rgy_value 0x00030010 +char_values 0x0011:0x0080:0x0081:0x0082 +max_bytes 3 +end + +start +description KS C5601:1987; Korean Hangul and Hanja Graphic Characters +loc_name NONE +rgy_value 0x00040001 +char_values 0x0100 +max_bytes 2 +end + +start +description KS C5657:1991; Supplementary Korean Graphic Characters +loc_name NONE +rgy_value 0x00040002 +char_values 0x0101 +max_bytes 2 +end + +start +description KS eucKR:1991; Korean EUC +loc_name NONE +rgy_value 0x0004000a +char_values 0x0011:0x0100:0x0101 +max_bytes 2 +end + +start +description CNS 11643:1986; Taiwanese Hanzi Graphic Characters +loc_name NONE +rgy_value 0x00050001 +char_values 0x0180 +max_bytes 2 +end + +start +description CNS 11643:1992; Taiwanese Extended Hanzi Graphic Chars +loc_name NONE +rgy_value 0x00050002 +char_values 0x0181 +max_bytes 4 +end + +start +description CNS eucTW:1991; Taiwanese EUC +loc_name NONE +rgy_value 0x0005000a +char_values 0x0001:0x0180 +max_bytes 4 +end + +start +description CNS eucTW:1993; Taiwanese EUC +loc_name NONE +rgy_value 0x00050010 +char_values 0x0001:0x0181 +max_bytes 4 +end + +start +description TIS 620-2529, Thai characters +loc_name NONE +rgy_value 0x000b0001 +char_values 0x0200 +max_bytes 1 +end + +start +description TTB CCDC:1984; Chinese Code for Data Communications +loc_name NONE +rgy_value 0x000d0001 +char_values 0x0180 +max_bytes 2 +end + +start +description OSF Japanese UJIS +loc_name NONE +rgy_value 0x05000010 +char_values 0x0001:0x0080:0x0081 +max_bytes 2 +end + +start +description OSF Japanese SJIS-1 +loc_name NONE +rgy_value 0x05000011 +char_values 0x0001:0x0080:0x0081 +max_bytes 2 +end + +start +description OSF Japanese SJIS-2 +loc_name NONE +rgy_value 0x05000012 +char_values 0x0001:0x0080:0x0081 +max_bytes 2 +end + +start +description X/Open UTF-8; UCS Transformation Format 8 (UTF-8) +loc_name NONE +rgy_value 0x05010001 +char_values 0x1000 +max_bytes 6 +end + +start +description JVC_eucJP +loc_name NONE +rgy_value 0x05020001 +char_values 0x0001:0x0080:0x0081:0x0082 +max_bytes 3 +end + +start +description JVC_SJIS +loc_name NONE +rgy_value 0x05020002 +char_values 0x0001:0x0080:0x0081 +max_bytes 2 +end + +start +description DEC Kanji +loc_name NONE +rgy_value 0x10000001 +char_values 0x0011:0x0080:0x0081 +max_bytes 2 +end + +start +description Super DEC Kanji +loc_name NONE +rgy_value 0x10000002 +char_values 0x0011:0x0080:0x0081:0x0082 +max_bytes 3 +end + +start +description DEC Shift JIS +loc_name NONE +rgy_value 0x10000003 +char_values 0x0011:0x0080:0x0081 +max_bytes 2 +end + +start +description HP roman8; English and Western European languages +loc_name NONE +rgy_value 0x10010001 +char_values 0x0011 +max_bytes 1 +end + +start +description HP kana8; Japanese katakana (incl JIS X0201:1976) +loc_name NONE +rgy_value 0x10010002 +char_values 0x0080 +max_bytes 1 +end + +start +description HP arabic8; Arabic +loc_name NONE +rgy_value 0x10010003 +char_values 0x0016 +max_bytes 1 +end + +start +description HP greek8; Greek +loc_name NONE +rgy_value 0x10010004 +char_values 0x0017 +max_bytes 1 +end + +start +description HP hebrew8; Hebrew +loc_name NONE +rgy_value 0x10010005 +char_values 0x0018 +max_bytes 1 +end + +start +description HP turkish8; Turkish +loc_name NONE +rgy_value 0x10010006 +char_values 0x0013:0x0019 +max_bytes 1 +end + +start +description HP15CN; encoding method for Simplified Chinese +loc_name NONE +rgy_value 0x10010007 +char_values 0x0001:0x0300 +max_bytes 2 +end + +start +description HP big5; encoding method for Traditional Chinese +loc_name NONE +rgy_value 0x10010008 +char_values 0x0001:0x0180 +max_bytes 2 +end + +start +description HP japanese15 (sjis); Shift-JIS for mainframe (incl JIS X0208:1990) +loc_name NONE +rgy_value 0x10010009 +char_values 0x0001:0x0080:0x0081 +max_bytes 2 +end + +start +description HP sjishi; Shift-JIS for HP user (incl JIS X0208:1990) +loc_name NONE +rgy_value 0x1001000a +char_values 0x0001:0x0080:0x0081 +max_bytes 2 +end + +start +description HP sjispc; Shift-JIS for PC (incl JIS X0208:1990) +loc_name NONE +rgy_value 0x1001000b +char_values 0x0001:0x0080:0x0081 +max_bytes 2 +end + +start +description HP ujis; EUC (incl JIS X0208:1990) +loc_name NONE +rgy_value 0x1001000c +char_values 0x0001:0x0080:0x0081 +max_bytes 2 +end + +start +description IBM-037 (CCSID 00037); CECP for USA, Canada, NL, Ptgl, Brazil, Australia, NZ +loc_name NONE +rgy_value 0x10020025 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-273 (CCSID 00273); CECP for Austria, Germany +loc_name NONE +rgy_value 0x10020111 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-277 (CCSID 00277); CECP for Denmark, Norway +loc_name NONE +rgy_value 0x10020115 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-278 (CCSID 00278); CECP for Finland, Sweden +loc_name NONE +rgy_value 0x10020116 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-280 (CCSID 00280); CECP for Italy +loc_name NONE +rgy_value 0x10020118 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-282 (CCSID 00282); CECP for Portugal +loc_name NONE +rgy_value 0x1002011a +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-284 (CCSID 00284); CECP for Spain, Latin America (Spanish) +loc_name NONE +rgy_value 0x1002011c +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-285 (CCSID 00285); CECP for United Kingdom +loc_name NONE +rgy_value 0x1002011d +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-290 (CCSID 00290); Japanese Katakana Host Ext SBCS +loc_name NONE +rgy_value 0x10020122 +char_values 0x0080 +max_bytes 1 +end + +start +description IBM-297 (CCSID 00297); CECP for France +loc_name NONE +rgy_value 0x10020129 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-300 (CCSID 00300); Japanese Host DBCS incl 4370 UDC +loc_name NONE +rgy_value 0x1002012c +char_values 0x0081 +max_bytes 2 +end + +start +description IBM-301 (CCSID 00301); Japanese PC Data DBCS incl 1880 UDC +loc_name NONE +rgy_value 0x1002012d +char_values 0x0081 +max_bytes 2 +end + +start +description IBM-420 (CCSID 00420); Arabic (presentation shapes) +loc_name NONE +rgy_value 0x100201a4 +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-424 (CCSID 00424); Hebrew +loc_name NONE +rgy_value 0x100201a8 +char_values 0x0018 +max_bytes 1 +end + +start +description IBM-437 (CCSID 00437); PC USA +loc_name NONE +rgy_value 0x100201b5 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-500 (CCSID 00500); CECP for Belgium, Switzerland +loc_name NONE +rgy_value 0x100201f4 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-833 (CCSID 00833); Korean Host Extended SBCS +loc_name NONE +rgy_value 0x10020341 +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-834 (CCSID 00834); Korean Host DBCS incl 1227 UDC +loc_name NONE +rgy_value 0x10020342 +char_values 0x0100 +max_bytes 2 +end + +start +description IBM-835 (CCSID 00835); T-Ch Host DBCS incl 6204 UDC +loc_name NONE +rgy_value 0x10020343 +char_values 0x0180 +max_bytes 2 +end + +start +description IBM-836 (CCSID 00836); S-Ch Host Extended SBCS +loc_name NONE +rgy_value 0x10020344 +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-837 (CCSID 00837); S-Ch Host DBCS incl 1880 UDC +loc_name NONE +rgy_value 0x10020345 +char_values 0x0300 +max_bytes 2 +end + +start +description IBM-838 (CCSID 00838); Thai Host Extended SBCS +loc_name NONE +rgy_value 0x10020346 +char_values 0x0200 +max_bytes 1 +end + +start +description IBM-839 (CCSID 00839); Thai Host DBCS incl 374 UDC +loc_name NONE +rgy_value 0x10020347 +char_values 0x0200 +max_bytes 2 +end + +start +description IBM-850 (CCSID 00850); Multilingual IBM PC Data-MLP 222 +loc_name NONE +rgy_value 0x10020352 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-852 (CCSID 00852); Multilingual Latin-2 +loc_name NONE +rgy_value 0x10020354 +char_values 0x0012 +max_bytes 1 +end + +start +description IBM-855 (CCSID 00855); Cyrillic PC Data +loc_name NONE +rgy_value 0x10020357 +char_values 0x0015 +max_bytes 1 +end + +start +description IBM-856 (CCSID 00856); Hebrew PC Data (extensions) +loc_name NONE +rgy_value 0x10020358 +char_values 0x0018 +max_bytes 1 +end + +start +description IBM-857 (CCSID 00857); Turkish Latin-5 PC Data +loc_name NONE +rgy_value 0x10020359 +char_values 0x0019 +max_bytes 1 +end + +start +description IBM-861 (CCSID 00861); PC Data Iceland +loc_name NONE +rgy_value 0x1002035d +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-862 (CCSID 00862); PC Data Hebrew +loc_name NONE +rgy_value 0x1002035e +char_values 0x0018 +max_bytes 1 +end + +start +description IBM-863 (CCSID 00863); PC Data Canadian French +loc_name NONE +rgy_value 0x1002035f +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-864 (CCSID 00864); Arabic PC Data +loc_name NONE +rgy_value 0x10020360 +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-866 (CCSID 00866); PC Data Cyrillic 2 +loc_name NONE +rgy_value 0x10020362 +char_values 0x0015 +max_bytes 1 +end + +start +description IBM-868 (CCSID 00868); Urdu PC Data +loc_name NONE +rgy_value 0x10020364 +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-869 (CCSID 00869); Greek PC Data +loc_name NONE +rgy_value 0x10020365 +char_values 0x0017 +max_bytes 1 +end + +start +description IBM-870 (CCSID 00870); Multilingual Latin-2 EBCDIC +loc_name NONE +rgy_value 0x10020366 +char_values 0x0012 +max_bytes 1 +end + +start +description IBM-871 (CCSID 00871); CECP for Iceland +loc_name NONE +rgy_value 0x10020367 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-874 (CCSID 00874); Thai PC Display Extended SBCS +loc_name NONE +rgy_value 0x1002036a +char_values 0x0200 +max_bytes 1 +end + +start +description IBM-875 (CCSID 00875); Greek +loc_name NONE +rgy_value 0x1002036b +char_values 0x0017 +max_bytes 1 +end + +start +description IBM-880 (CCSID 00880); Multilingual Cyrillic +loc_name NONE +rgy_value 0x10020370 +char_values 0x0015 +max_bytes 1 +end + +start +description IBM-891 (CCSID 00891); Korean PC Data SBCS +loc_name NONE +rgy_value 0x1002037b +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-896 (CCSID 00896); Japanese Katakana characters; superset of JIS X0201:1976 +loc_name NONE +rgy_value 0x10020380 +char_values 0x0080 +max_bytes 1 +end + +start +description IBM-897 (CCSID 00897); PC Data Japanese SBCS (use with CP 00301) +loc_name NONE +rgy_value 0x10020381 +char_values 0x0080 +max_bytes 1 +end + +start +description IBM-903 (CCSID 00903); PC Data Simplified Chinese SBCS (use with DBCS) +loc_name NONE +rgy_value 0x10020387 +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-904 (CCSID 00904); PC Data Traditional Chinese SBCS (use with DBCS) +loc_name NONE +rgy_value 0x10020388 +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-918 (CCSID 00918); Urdu +loc_name NONE +rgy_value 0x10020396 +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-921 (CCSID 00921); Baltic 8-Bit +loc_name NONE +rgy_value 0x10020399 +char_values 0x001a +max_bytes 1 +end + +start +description IBM-922 (CCSID 00922); Estonia 8-Bit +loc_name NONE +rgy_value 0x1002039a +char_values 0x001a +max_bytes 1 +end + +start +description IBM-926 (CCSID 00926); Korean PC Data DBCS incl 1880 UDC +loc_name NONE +rgy_value 0x1002039e +char_values 0x0100 +max_bytes 2 +end + +start +description IBM-927 (CCSID 00927); T-Ch PC Data DBCS incl 6204 UDC +loc_name NONE +rgy_value 0x1002039f +char_values 0x0180 +max_bytes 2 +end + +start +description IBM-928 (CCSID 00928); S-Ch PC Data DBCS incl 1880 UDC +loc_name NONE +rgy_value 0x100203a0 +char_values 0x0300 +max_bytes 2 +end + +start +description IBM-929 (CCSID 00929); Thai PC Data DBCS incl 374 UDC +loc_name NONE +rgy_value 0x100203a1 +char_values 0x0200 +max_bytes 2 +end + +start +description IBM-930 (CCSID 00930); Kat-Kanji Host MBCS Ext-SBCS +loc_name NONE +rgy_value 0x100203a2 +char_values 0x0080:0x0081 +max_bytes 2 +end + +start +description IBM-932 (CCSID 00932); Japanese PC Data Mixed +loc_name NONE +rgy_value 0x100203a4 +char_values 0x0080:0x0081 +max_bytes 2 +end + +start +description IBM-933 (CCSID 00933); Korean Host Extended SBCS +loc_name NONE +rgy_value 0x100203a5 +char_values 0x0001:0x0100 +max_bytes 2 +end + +start +description IBM-934 (CCSID 00934); Korean PC Data Mixed +loc_name NONE +rgy_value 0x100203a6 +char_values 0x0001:0x0100 +max_bytes 2 +end + +start +description IBM-935 (CCSID 00935); S-Ch Host Mixed +loc_name NONE +rgy_value 0x100203a7 +char_values 0x0001:0x0300 +max_bytes 2 +end + +start +description IBM-936 (CCSID 00936); PC Data S-Ch MBCS +loc_name NONE +rgy_value 0x100203a8 +char_values 0x0001:0x0300 +max_bytes 2 +end + +start +description IBM-937 (CCSID 00937); T-Ch Host Mixed +loc_name NONE +rgy_value 0x100203a9 +char_values 0x0001:0x0180 +max_bytes 2 +end + +start +description IBM-938 (CCSID 00938); PC Data T-Ch MBCS +loc_name NONE +rgy_value 0x100203aa +char_values 0x0001:0x0180 +max_bytes 2 +end + +start +description IBM-939 (CCSID 00939); Latin-Kanji Host MBCS +loc_name NONE +rgy_value 0x100203ab +char_values 0x0080:0x0081 +max_bytes 2 +end + +start +description IBM-941 (CCSID 00941); Japanese PC DBCS for Open +loc_name NONE +rgy_value 0x100203ad +char_values 0x0081 +max_bytes 2 +end + +start +description IBM-942 (CCSID 00942); Japanese PC Data Mixed +loc_name NONE +rgy_value 0x100203ae +char_values 0x0080:0x0081 +max_bytes 2 +end + +start +description IBM-943 (CCSID 00943); Japanese PC MBCS for Open +loc_name NONE +rgy_value 0x100203af +char_values 0x0080:0x0081 +max_bytes 2 +end + +start +description IBM-946 (CCSID 00946); S-Ch PC Data Mixed +loc_name NONE +rgy_value 0x100203b2 +char_values 0x0001:0x0300 +max_bytes 2 +end + +start +description IBM-947 (CCSID 00947); T-Ch PC Data DBCS incl 6204 UDC +loc_name NONE +rgy_value 0x100203b3 +char_values 0x0180 +max_bytes 2 +end + +start +description IBM-948 (CCSID 00948); T-Ch PC Data Mixed +loc_name NONE +rgy_value 0x100203b4 +char_values 0x0001:0x0180 +max_bytes 2 +end + +start +description IBM-949 (CCSID 00949); IBM KS PC Data Mixed +loc_name NONE +rgy_value 0x100203b5 +char_values 0x0001:0x0100 +max_bytes 2 +end + +start +description IBM-950 (CCSID 00950); T-Ch PC Data Mixed +loc_name NONE +rgy_value 0x100203b6 +char_values 0x0001:0x0180 +max_bytes 2 +end + +start +description IBM-951 (CCSID 00951); IBM KS PC Data DBCS incl 1880 UDC +loc_name NONE +rgy_value 0x100203b7 +char_values 0x0100 +max_bytes 2 +end + +start +description IBM-955 (CCSID 00955); Japan Kanji characters; superset of JIS X0208:1978 +loc_name NONE +rgy_value 0x100203bb +char_values 0x0081 +max_bytes 2 +end + +start +description IBM-964 (CCSID 00964); T-Chinese EUC CNS1163 plane 1,2 +loc_name NONE +rgy_value 0x100203c4 +char_values 0x0001:0x0180 +max_bytes 4 +end + +start +description IBM-970 (CCSID 00970); Korean EUC +loc_name NONE +rgy_value 0x100203ca +char_values 0x0011:0x0100:0x0101 +max_bytes 2 +end + +start +description IBM-1006 (CCSID 01006); Urdu 8-bit +loc_name NONE +rgy_value 0x100203ee +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-1025 (CCSID 01025); Cyrillic Multilingual +loc_name NONE +rgy_value 0x10020401 +char_values 0x0015 +max_bytes 1 +end + +start +description IBM-1026 (CCSID 01026); Turkish Latin-5 +loc_name NONE +rgy_value 0x10020402 +char_values 0x0019 +max_bytes 1 +end + +start +description IBM-1027 (CCSID 01027); Japanese Latin Host Ext SBCS +loc_name NONE +rgy_value 0x10020403 +char_values 0x0080 +max_bytes 1 +end + +start +description IBM-1040 (CCSID 01040); Korean PC Data Extended SBCS +loc_name NONE +rgy_value 0x10020410 +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-1041 (CCSID 01041); Japanese PC Data Extended SBCS +loc_name NONE +rgy_value 0x10020411 +char_values 0x0080 +max_bytes 1 +end + +start +description IBM-1043 (CCSID 01043); T-Ch PC Data Extended SBCS +loc_name NONE +rgy_value 0x10020413 +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-1046 (CCSID 01046); Arabic PC Data +loc_name NONE +rgy_value 0x10020416 +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-1047 (CCSID 01047); Latin-1 Open System +loc_name NONE +rgy_value 0x10020417 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-1088 (CCSID 01088); IBM KS Code PC Data SBCS +loc_name NONE +rgy_value 0x10020440 +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-1097 (CCSID 01097); Farsi +loc_name NONE +rgy_value 0x10020449 +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-1098 (CCSID 01098); Farsi PC Data +loc_name NONE +rgy_value 0x1002044a +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-1112 (CCSID 01112); Baltic Multilingual +loc_name NONE +rgy_value 0x10020458 +char_values 0x001a +max_bytes 1 +end + +start +description IBM-1114 (CCSID 01114); T-Ch PC Data SBCS (IBM BIG-5) +loc_name NONE +rgy_value 0x1002045a +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-1115 (CCSID 01115); S-Ch PC Data SBCS (IBM GB) +loc_name NONE +rgy_value 0x1002045b +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-1122 (CCSID 01122); Estonia +loc_name NONE +rgy_value 0x10020462 +char_values 0x001a +max_bytes 1 +end + +start +description IBM-1250 (CCSID 01250); MS Windows Latin-2 +loc_name NONE +rgy_value 0x100204e2 +char_values 0x0012 +max_bytes 1 +end + +start +description IBM-1251 (CCSID 01251); MS Windows Cyrillic +loc_name NONE +rgy_value 0x100204e3 +char_values 0x0015 +max_bytes 1 +end + +start +description IBM-1252 (CCSID 01252); MS Windows Latin-1 +loc_name NONE +rgy_value 0x100204e4 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-1253 (CCSID 01253); MS Windows Greek +loc_name NONE +rgy_value 0x100204e5 +char_values 0x0017 +max_bytes 1 +end + +start +description IBM-1254 (CCSID 01254); MS Windows Turkey +loc_name NONE +rgy_value 0x100204e6 +char_values 0x0019 +max_bytes 1 +end + +start +description IBM-1255 (CCSID 01255); MS Windows Hebrew +loc_name NONE +rgy_value 0x100204e7 +char_values 0x0018 +max_bytes 1 +end + +start +description IBM-1256 (CCSID 01256); MS Windows Arabic +loc_name NONE +rgy_value 0x100204e8 +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-1257 (CCSID 01257); MS Windows Baltic +loc_name NONE +rgy_value 0x100204e9 +char_values 0x001a +max_bytes 1 +end + +start +description IBM-1380 (CCSID 01380); S-Ch PC Data DBCS incl 1880 UDC +loc_name NONE +rgy_value 0x10020564 +char_values 0x0300 +max_bytes 2 +end + +start +description IBM-1381 (CCSID 01381); S-Ch PC Data Mixed incl 1880 UDC +loc_name NONE +rgy_value 0x10020565 +char_values 0x0001:0x0300 +max_bytes 2 +end + +start +description IBM-1383 (CCSID 01383); S-Ch EUC GB 2312-80 set (1382) +loc_name NONE +rgy_value 0x10020567 +char_values 0x0001:0x0300 +max_bytes 3 +end + +start +description IBM-300 (CCSID 04396); Japanese Host DBCS incl 1880 UDC +loc_name NONE +rgy_value 0x1002112c +char_values 0x0081 +max_bytes 2 +end + +start +description IBM-850 (CCSID 04946); Multilingual IBM PC Data-190 +loc_name NONE +rgy_value 0x10021352 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-852 (CCSID 04948); Latin-2 Personal Computer +loc_name NONE +rgy_value 0x10021354 +char_values 0x0012 +max_bytes 1 +end + +start +description IBM-855 (CCSID 04951); Cyrillic Personal Computer +loc_name NONE +rgy_value 0x10021357 +char_values 0x0015 +max_bytes 1 +end + +start +description IBM-856 (CCSID 04952); Hebrew PC Data +loc_name NONE +rgy_value 0x10021358 +char_values 0x0018 +max_bytes 1 +end + +start +description IBM-857 (CCSID 04953); Turkish Latin-5 PC Data +loc_name NONE +rgy_value 0x10021359 +char_values 0x0019 +max_bytes 1 +end + +start +description IBM-864 (CCSID 04960); Arabic PC Data (all shapes) +loc_name NONE +rgy_value 0x10021360 +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-868 (CCSID 04964); PC Data for Urdu +loc_name NONE +rgy_value 0x10021364 +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-869 (CCSID 04965); Greek PC Data +loc_name NONE +rgy_value 0x10021365 +char_values 0x0017 +max_bytes 1 +end + +start +description IBM-5026 (CCSID 05026); Japanese Katakana-Kanji Host Mixed +loc_name NONE +rgy_value 0x100213a2 +char_values 0x0080:0x0081 +max_bytes 2 +end + +start +description IBM-5031 (CCSID 05031); S-Ch Host MBCS +loc_name NONE +rgy_value 0x100213a7 +char_values 0x0001:0x0300 +max_bytes 2 +end + +start +description IBM-1027 and -300 (CCSID 05035); Japanese Latin-Kanji Host Mixed +loc_name NONE +rgy_value 0x100213ab +char_values 0x0080:0x0081 +max_bytes 2 +end + +start +description IBM-5048 (CCSID 05048); Japanese Kanji characters; superset of JIS X0208:1990 (and 1983) +loc_name NONE +rgy_value 0x100213b8 +char_values 0x0081 +max_bytes 2 +end + +start +description IBM-5049 (CCSID 05049); Japanese Kanji characters; superset of JIS X0212:1990 +loc_name NONE +rgy_value 0x100213b9 +char_values 0x0082 +max_bytes 2 +end + +start +description IBM-5067 (CCSID 05067); Korean Hangul and Hanja; superset of KS C5601:1987 +loc_name NONE +rgy_value 0x100213cb +char_values 0x0100 +max_bytes 2 +end + +start +description IBM-420 (CCSID 08612); Arabic (base shapes only) +loc_name NONE +rgy_value 0x100221a4 +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-833 (CCSID 09025); Korean Host SBCS +loc_name NONE +rgy_value 0x10022341 +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-834 (CCSID 09026); Korean Host DBCS incl 1880 UDC +loc_name NONE +rgy_value 0x10022342 +char_values 0x0100 +max_bytes 2 +end + +start +description IBM-838 (CCSID 09030); Thai Host Extended SBCS +loc_name NONE +rgy_value 0x10022346 +char_values 0x0200 +max_bytes 1 +end + +start +description IBM-864 (CCSID 09056); Arabic PC Data (unshaped) +loc_name NONE +rgy_value 0x10022360 +char_values 0x0016 +max_bytes 1 +end + +start +description IBM-874 (CCSID 09066); Thai PC Display Extended SBCS +loc_name NONE +rgy_value 0x1002236a +char_values 0x0200 +max_bytes 1 +end + +start +description IBM-9125 (CCSID 09125); Korean Host Mixed incl 1880 UDC +loc_name NONE +rgy_value 0x100223a5 +char_values 0x0001:0x0100 +max_bytes 2 +end + +start +description IBM-850 (CCSID 25426); Multilingual IBM PC Display-MLP +loc_name NONE +rgy_value 0x10026352 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-856 (CCSID 25432); Hebrew PC Display (extensions) +loc_name NONE +rgy_value 0x10026358 +char_values 0x0018 +max_bytes 1 +end + +start +description IBM-1042 (CCSID 25618); S-Ch PC Display Ext SBCS +loc_name NONE +rgy_value 0x10026412 +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-037 (CCSID 28709); T-Ch Host Extended SBCS +loc_name NONE +rgy_value 0x10027025 +char_values 0x0001 +max_bytes 1 +end + +start +description IBM-856 (CCSID 33624); Hebrew PC Display +loc_name NONE +rgy_value 0x10028358 +char_values 0x0018 +max_bytes 1 +end + +start +description IBM33722 (CCSID 33722); Japanese EUC JISx201,208,212 +loc_name NONE +rgy_value 0x100283ba +char_values 0x0080:0x0081:0x0082 +max_bytes 3 +end + +start +description HTCsjis; Hitachi SJIS 90-1 +loc_name NONE +rgy_value 0x10030001 +char_values 0x0001:0x0080:0x0081 +max_bytes 2 +end + +start +description HTCujis; Hitachi eucJP 90-1 +loc_name NONE +rgy_value 0x10030002 +char_values 0x0001:0x0080:0x0081 +max_bytes 2 +end + +start +description Fujitsu U90; Japanese EUC +loc_name NONE +rgy_value 0x10040001 +char_values 0x0001:0x0080:0x0081 +max_bytes 3 +end + +start +description Fujitsu S90; Japanese EUC +loc_name NONE +rgy_value 0x10040002 +char_values 0x0001:0x0080:0x0081 +max_bytes 3 +end + +start +description Fujitsu R90; Fujitsu Shift JIS +loc_name NONE +rgy_value 0x10040003 +char_values 0x0001:0x0080:0x0081 +max_bytes 2 +end + +start +description EBCDIC(ASCII) and JEF; Japanese encoding method for mainframe +loc_name NONE +rgy_value 0x10040004 +char_values 0x0001:0x0081 +max_bytes 3 +end + +start +description EBCDIC(Katakana) and JEF; Japanese encoding method for mainframe +loc_name NONE +rgy_value 0x10040005 +max_bytes 3 +char_values 0x0001:0x0080:0x0081 +end + +start +description EBCDIC(Japanese English) and JEF; Japanese encoding method for mainframe +loc_name NONE +rgy_value 0x10040006 +max_bytes 3 +char_values 0x0001:0x0081 +end + diff --git a/apps/mkcsregdb/cs_test.txt b/apps/mkcsregdb/cs_test.txt new file mode 100644 index 00000000000..93ba4033c49 --- /dev/null +++ b/apps/mkcsregdb/cs_test.txt @@ -0,0 +1,15 @@ +start +description ISO 8859-1:1987; Latin Alphabet No. 1 +loc_name ASCII +rgy_value 0x00010001 +char_values 0x0011 +max_bytes 1 +end + +start +description IBM-1047 (CCSID 01047); Latin-1 Open System +loc_name ECBDIC +rgy_value 0x10020417 +char_values 0x0011 +max_bytes 1 +end diff --git a/apps/mkcsregdb/iso_only.txt b/apps/mkcsregdb/iso_only.txt new file mode 100644 index 00000000000..1b8cacb4d0e --- /dev/null +++ b/apps/mkcsregdb/iso_only.txt @@ -0,0 +1,7 @@ +start +description ISO 8859-1:1987; Latin Alphabet No. 1 +loc_name ASCII +rgy_value 0x00010001 +char_values 0x0011 +max_bytes 1 +end diff --git a/apps/mkcsregdb/mkcsregdb b/apps/mkcsregdb/mkcsregdb Binary files differnew file mode 100755 index 00000000000..88555696c04 --- /dev/null +++ b/apps/mkcsregdb/mkcsregdb diff --git a/apps/mkcsregdb/mkcsregdb.cpp b/apps/mkcsregdb/mkcsregdb.cpp new file mode 100644 index 00000000000..ef02574979c --- /dev/null +++ b/apps/mkcsregdb/mkcsregdb.cpp @@ -0,0 +1,319 @@ +/* $Id$ + * + * To populate the registry_db, construct a codeset registry text file based + * on the OSF's Character and Code Set Registry. See DCE RFC 40.1 for details + * on obtaining the full text for the current registry. Once you have composed + * a text file containing all the desired codeset information, build and run + * mkcsregdb. The source is in $ACE_ROOT/apps/mkcsregdb. It will generate a new + * copy of this file, with the registry_db_ array properly initialized. + */ + +#include <ace/streams.h> +#include <ace/Codeset_Registry.h> + +class csdb_generator : public ACE_Codeset_Registry +{ +public: + csdb_generator (); + int read_from (const char *source); + int init_output (const char *srcfile); + int write_entry (); + int fini_output (const char *target); + int read_line (); + void write_dummy_entry(); + void fail(const char *msg); +private: + static const char * tags_[]; + static int max_line_; + int count_; + int in_entry_; + registry_entry entry_; + int linecounter_; + char *source_line_; + char *line_data_; + ifstream *inf_; + FILE *outf_; + char *tempfilename_; + char *ace_src_; +}; + +int csdb_generator::max_line_ = 1024; +const char * csdb_generator::tags_[] = { + "start", + "end", + "description ", + "loc_name ", + "rgy_value ", + "char_values ", + "max_bytes ", + 0 +}; + +csdb_generator::csdb_generator () + :count_(0), + in_entry_(0), + linecounter_(0), + source_line_ (new char[max_line_]), + line_data_ (0), + inf_ (0), + outf_ (0) +{ + ace_src_ = ACE_OS::getenv("ACE_ROOT"); +} + +void +csdb_generator::fail (const char *msg) +{ + ACE_ERROR ((LM_ERROR,"Error, line %d: %s\n",linecounter_,msg)); + ACE_OS::fclose (outf_); + ACE_OS::unlink (tempfilename_); + exit (-1); +} + +int +csdb_generator::read_line() +{ + inf_->getline (source_line_,max_line_); + line_data_ = 0; + char *cpos = ACE_OS::strchr (source_line_,'#'); + if (cpos == 0) + cpos = source_line_ + ACE_OS::strlen(source_line_); + while (cpos > source_line_ && ACE_OS::strchr(" \t",*(cpos - 1))) cpos--; + *cpos = 0; + if (cpos == source_line_) + return 0; + for (int i = 0; tags_[i]; i++) + { + cpos = ACE_OS::strstr (source_line_,tags_[i]); + if (cpos == 0) // not found + continue; + if (cpos > source_line_) // make sure it's first token + { + char *tpos = cpos-1; + while (tpos > source_line_ && ACE_OS::strchr(" \t",*tpos)) tpos--; + if (tpos > source_line_) + continue; + } + if (i == 0 && in_entry_) + fail ("\"start\" encountered twice before \"end\""); + if (i > 0 && !in_entry_) + { + char *emsg = new char[100]; + sprintf (emsg,"\"%s\" encountered before \"start\"",tags_[i]); + fail (emsg); + } + if (i > 1) + { + line_data_ = cpos + ACE_OS::strlen(tags_[i]); + while (*line_data_ && ACE_OS::strchr(" \t",(*line_data_))) + line_data_++; + } + return i+1; + } + return -1; +} + +int +csdb_generator::read_from (const char *srcfile) +{ + inf_ = new ifstream(srcfile); + char *ptr; + while (inf_->good() && !inf_->eof()) { + linecounter_++; + switch (read_line ()) { + case -1: // bogus line + fail ("unknown field tag"); + break; + case 0: // comment or blank line + break; + case 1: // start + entry_.desc_ = 0; + entry_.loc_name_ = 0; + entry_.codeset_id_ = 0; + entry_.num_sets_ = 0; + entry_.max_bytes_ = 0; + in_entry_ = 1; + break; + case 2: // end + if (entry_.codeset_id_ == 0) + fail ("entry missing rgy_value"); + if (entry_.num_sets_ == 0) + fail ("entry does not include at least one char_value"); + if (entry_.max_bytes_ == 0) + fail ("entry does not define max_bytes"); + write_entry (); + delete [] entry_.desc_; + delete [] entry_.loc_name_; + count_++; + in_entry_ = 0; + break; + case 3: // description + if (entry_.desc_ != 0) + fail ("duplicate description"); + entry_.desc_ = ACE_OS::strdup(line_data_); + break; + case 4: // loc_name + if (entry_.loc_name_ != 0) + fail ("duplicate loc_name"); + entry_.loc_name_ = ACE_OS::strdup(line_data_); + break; + case 5: // rgy_value + if (entry_.codeset_id_ != 0) + fail ("duplicate rgy_value"); + entry_.codeset_id_ = strtoul(line_data_,&ptr,16); + if (*ptr != 0 || entry_.codeset_id_ == 0) + { + char emsg [100]; + sprintf (emsg,"invalid rgy_value, '%s'",line_data_); + fail (emsg); + } + break; + case 6: // char_values + if (entry_.num_sets_ != 0) + fail ("duplicate char_values"); + ptr = line_data_; + do { + if (*ptr == ':') + ptr++; + ACE_CDR::UShort tmp = + ACE_static_cast(ACE_CDR::UShort,strtoul(ptr,&ptr,16)); + if (*ptr != 0 && *ptr != ':') + { + char *emsg = new char [100]; + sprintf (emsg,"invalid symbol \'%c\' in char_values",*ptr); + fail (emsg); + } + if (entry_.num_sets_ < max_charsets_) + entry_.char_sets_[entry_.num_sets_++] = tmp; + else entry_.num_sets_++; + } while (*ptr == ':'); + if (entry_.num_sets_ > max_charsets_) + { + char *emsg = new char [200]; + sprintf (emsg,"max of %d char_values exceeded.\nIncrease ACE_Codeset_Registry::max_charsets_ to at least %d and rebuild mkcsregdb",max_charsets_,entry_.num_sets_); + fail (emsg); + } + break; + case 7: // max_bytes + if (entry_.max_bytes_ != 0) + fail ("duplicate max_bytes"); + entry_.max_bytes_ = strtol(line_data_,&ptr,10); + if (*ptr != 0) + fail ("invalid max_bytes"); + break; + } + } + return 0; +} + +int +csdb_generator::init_output (const char *srcfile) +{ + ACE_stat buf; + if (ACE_OS::stat (srcfile,&buf) != 0) + ACE_ERROR_RETURN ((LM_ERROR,"Unable to open %s\n",srcfile),-1); + + if (ace_src_ == 0) + ACE_ERROR_RETURN ((LM_ERROR,"You must first set $ACE_ROOT\n"),-1); + + time_t now = ACE_OS::time(); + tempfilename_ = ACE_OS::tempnam (ace_src_,"csdb"); + outf_ = fopen (tempfilename_,"w"); + if (outf_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to open output file, %s\n",tempfilename_),-1); + + fprintf (outf_,"// $ID: $\n"); + fprintf (outf_,"/*\n * Codeset registry DB, generated %s * source: %s\n", + ACE_OS::asctime (ACE_OS::localtime(&now)), + srcfile); + fprintf (outf_," *\n * To populate the registry_db, construct a codeset registry text file based \n"); + fprintf (outf_," * on the OSF's Character and Code Set Registry. See DCE RFC 40.1 for details\n"); + fprintf (outf_," * on obtaining the full text for the current registry. Once you have composed\n"); + fprintf (outf_," * a text file containing all the desired codeset information, build and run\n"); + fprintf (outf_," * mkcsregdb. The source is in $ACE_ROOT/apps/mkcsregdb. It will generate a new\n"); + fprintf (outf_," * copy of this file, with the registry_db_ array properly initialized.\n */\n"); + fprintf (outf_,"\n#include \"ace/Codeset_Registry.h\"\n\n%s\n%s\n{\n", + "ACE_Codeset_Registry::registry_entry", + "ACE_Codeset_Registry::registry_db_[] ="); + return 0; +} + +int +csdb_generator::write_entry () +{ + if (count_) + fprintf (outf_,",\n"); + fprintf (outf_," {\"%s\",\"%s\",0x%08x,%d,{", + entry_.desc_, + entry_.loc_name_, + entry_.codeset_id_, + entry_.num_sets_); + for (unsigned j = 0; j < entry_.num_sets_; j++) + if (j+1 < entry_.num_sets_) + fprintf (outf_,"0x%04x,",entry_.char_sets_[j]); + else + fprintf (outf_,"0x%04x",entry_.char_sets_[j]); + fprintf (outf_,"},%d}",entry_.max_bytes_); + return 0; +} + +void +csdb_generator::write_dummy_entry() +{ + entry_.desc_ = "No codesets defined"; + entry_.loc_name_ = "NONE"; + entry_.codeset_id_ = 0; + entry_.num_sets_ = 1; + entry_.char_sets_[0] = 0; + entry_.max_bytes_ = 0; + write_entry(); +} + +int +csdb_generator::fini_output (const char *tgt) +{ + char *target = new char [ACE_OS::strlen(ace_src_) + ACE_OS::strlen(tgt) + 6]; + sprintf (target,"%s/ace/%s",ace_src_,tgt); + if (count_ == 0) + write_dummy_entry(); + fprintf (outf_,"\n};\n\nsize_t ACE_Codeset_Registry::num_registry_entries_ = %d;\n\n",count_); + fclose (outf_); + ACE_stat buf; + if (ACE_OS::stat (target,&buf) == 0) + { + char fname[200]; + int result = 0; + for (int i = 0; result == 0; i++) + { + sprintf (fname,"%s.%03d",target,i); + result = ACE_OS::stat(fname,&buf); + } + ACE_DEBUG ((LM_DEBUG,"Moving $ACE_ROOT/ace/%s to $ACE_ROOT/ace%s\n", + tgt,ACE_OS::strrchr(fname,'/'))); + if (ACE_OS::rename (target,fname) == -1) + ACE_ERROR_RETURN ((LM_ERROR,"Could not create %s\n, output stored in %s", + fname,tempfilename_),-1); + } + ACE_DEBUG ((LM_DEBUG,"writing $ACE_ROOT/ace/%s\n",tgt)); + if (ACE_OS::rename (tempfilename_,target) == -1) + ACE_ERROR_RETURN ((LM_ERROR,"Could not create %s\n, output stored in %s", + target,tempfilename_),-1); + return 0; +} + +int +main (int argc, char ** argv) +{ + ACE_CString srcname; + if (argc > 1) + srcname.set(argv[1]); + else + ACE_ERROR_RETURN ((LM_ERROR,"Usage: %s <source_file>\nwhere source file is the full path to a code set registry text file.\n",argv[0]),-1); + csdb_generator csdb; + if (csdb.init_output(srcname.c_str()) == -1) + return 0; + if (csdb.read_from (srcname.c_str()) == 0) + csdb.fini_output ("Codeset_Registry_db.cpp"); + return 0; +} + diff --git a/apps/mkcsregdb/mkcsregdb.cpp~ b/apps/mkcsregdb/mkcsregdb.cpp~ new file mode 100644 index 00000000000..b12fd847b60 --- /dev/null +++ b/apps/mkcsregdb/mkcsregdb.cpp~ @@ -0,0 +1,308 @@ +#include <ace/streams.h> +#include <ace/Codeset_Registry.h> + +class csdb_generator : public ACE_Codeset_Registry +{ +public: + csdb_generator (); + int read_from (const char *source); + int init_output (const char *srcfile); + int write_entry (); + int fini_output (const char *target); + int read_line (); + void write_dummy_entry(); + void fail(const char *msg); +private: + static const char * tags_[]; + static int max_line_; + int count_; + int in_entry_; + registry_entry entry_; + int linecounter_; + char *source_line_; + char *line_data_; + ifstream *inf_; + FILE *outf_; + char *tempfilename_; + char *ace_src_; +}; + +int csdb_generator::max_line_ = 1024; +const char * csdb_generator::tags_[] = { + "start", + "end", + "description ", + "loc_name ", + "rgy_value ", + "char_values ", + "max_bytes ", + 0 +}; + +csdb_generator::csdb_generator () + :count_(0), + in_entry_(0), + linecounter_(0), + source_line_ (new char[max_line_]), + line_data_ (0), + inf_ (0), + outf_ (0) +{ + ace_src_ = ACE_OS::getenv("ACE_ROOT"); +} + +void +csdb_generator::fail (const char *msg) +{ + ACE_ERROR ((LM_ERROR,"Error, line %d: %s\n",linecounter_,msg)); + ACE_OS::fclose (outf_); + ACE_OS::unlink (tempfilename_); + exit (-1); +} + +int +csdb_generator::read_line() +{ + inf_->getline (source_line_,max_line_); + line_data_ = 0; + char *cpos = ACE_OS::strchr (source_line_,'#'); + if (cpos == 0) + cpos = source_line_ + ACE_OS::strlen(source_line_); + while (cpos > source_line_ && ACE_OS::strchr(" \t",*(cpos - 1))) cpos--; + *cpos = 0; + if (cpos == source_line_) + return 0; + for (int i = 0; tags_[i]; i++) + { + cpos = ACE_OS::strstr (source_line_,tags_[i]); + if (cpos == 0) // not found + continue; + if (cpos > source_line_) // make sure it's first token + { + char *tpos = cpos-1; + while (tpos > source_line_ && ACE_OS::strchr(" \t",*tpos)) tpos--; + if (tpos > source_line_) + continue; + } + if (i == 0 && in_entry_) + fail ("\"start\" encountered twice before \"end\""); + if (i > 0 && !in_entry_) + { + char *emsg = new char[100]; + sprintf (emsg,"\"%s\" encountered before \"start\"",tags_[i]); + fail (emsg); + } + if (i > 1) + { + line_data_ = cpos + ACE_OS::strlen(tags_[i]); + while (*line_data_ && ACE_OS::strchr(" \t",(*line_data_))) + line_data_++; + } + return i+1; + } + return -1; +} + +int +csdb_generator::read_from (const char *srcfile) +{ + inf_ = new ifstream(srcfile); + char *ptr; + while (inf_->good() && !inf_->eof()) { + linecounter_++; + switch (read_line ()) { + case -1: // bogus line + fail ("unknown field tag"); + break; + case 0: // comment or blank line + break; + case 1: // start + entry_.desc_ = 0; + entry_.loc_name_ = 0; + entry_.codeset_id_ = 0; + entry_.num_sets_ = 0; + entry_.max_bytes_ = 0; + in_entry_ = 1; + break; + case 2: // end + if (entry_.codeset_id_ == 0) + fail ("entry missing rgy_value"); + if (entry_.num_sets_ == 0) + fail ("entry does not include at least one char_value"); + if (entry_.max_bytes_ == 0) + fail ("entry does not define max_bytes"); + write_entry (); + delete [] entry_.desc_; + delete [] entry_.loc_name_; + count_++; + in_entry_ = 0; + break; + case 3: // description + if (entry_.desc_ != 0) + fail ("duplicate description"); + entry_.desc_ = ACE_OS::strdup(line_data_); + break; + case 4: // loc_name + if (entry_.loc_name_ != 0) + fail ("duplicate loc_name"); + entry_.loc_name_ = ACE_OS::strdup(line_data_); + break; + case 5: // rgy_value + if (entry_.codeset_id_ != 0) + fail ("duplicate rgy_value"); + entry_.codeset_id_ = strtoul(line_data_,&ptr,16); + if (*ptr != 0 || entry_.codeset_id_ == 0) + { + char emsg [100]; + sprintf (emsg,"invalid rgy_value, '%s'",line_data_); + fail (emsg); + } + break; + case 6: // char_values + if (entry_.num_sets_ != 0) + fail ("duplicate char_values"); + ptr = line_data_; + do { + if (*ptr == ':') + ptr++; + ACE_CDR::UShort tmp = + ACE_static_cast(ACE_CDR::UShort,strtoul(ptr,&ptr,16)); + if (*ptr != 0 && *ptr != ':') + { + char *emsg = new char [100]; + sprintf (emsg,"invalid symbol \'%c\' in char_values",*ptr); + fail (emsg); + } + if (entry_.num_sets_ < max_charsets_) + entry_.char_sets_[entry_.num_sets_++] = tmp; + else entry_.num_sets_++; + } while (*ptr == ':'); + if (entry_.num_sets_ > max_charsets_) + { + char *emsg = new char [200]; + sprintf (emsg,"max of %d char_values exceeded.\nIncrease ACE_Codeset_Registry::max_charsets_ to at least %d and rebuild mkcsregdb",max_charsets_,entry_.num_sets_); + fail (emsg); + } + break; + case 7: // max_bytes + if (entry_.max_bytes_ != 0) + fail ("duplicate max_bytes"); + entry_.max_bytes_ = strtol(line_data_,&ptr,10); + if (*ptr != 0) + fail ("invalid max_bytes"); + break; + } + } + return 0; +} + +int +csdb_generator::init_output (const char *srcfile) +{ + ACE_stat buf; + if (ACE_OS::stat (srcfile,&buf) != 0) + ACE_ERROR_RETURN ((LM_ERROR,"Unable to open %s\n",srcfile),-1); + + if (ace_src_ == 0) + ACE_ERROR_RETURN ((LM_ERROR,"You must first set $ACE_ROOT\n"),-1); + + time_t now = ACE_OS::time(); + tempfilename_ = ACE_OS::tempnam (ace_src_,"csdb"); + outf_ = fopen (tempfilename_,"w"); + if (outf_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to open output file, %s\n",tempfilename_),-1); + + fprintf (outf_,"/*\n * Codeset registry DB, generated %s * source: %s\n", + ACE_OS::asctime (ACE_OS::localtime(&now)), + srcfile); + fprintf (outf_," *\n * To populate the registry_db, construct a codeset registry text file based \n"); + fprintf (outf_," * on the OSF's Character and Code Set Registry. See DCE RFC 40.1 for details\n"); + fprintf (outf_," * on obtaining the full text for the current registry. Once you have composed\n"); + fprintf (outf_," * a text file containing all the desired codeset information, build and run\n"); + fprintf (outf_," * mkcsregdb. The source is in $ACE_ROOT/apps/mkcsregdb. It will generate a new\n"); + fprintf (outf_," * copy of this file, with the registry_db_ array properly initialized.\n */\n"); + fprintf (outf_,"\n#include \"ace/Codeset_Registry.h\"\n\n%s\n%s\n{\n", + "ACE_Codeset_Registry::registry_entry", + "ACE_Codeset_Registry::registry_db_[] ="); + return 0; +} + +int +csdb_generator::write_entry () +{ + if (count_) + fprintf (outf_,",\n"); + fprintf (outf_," {\"%s\",\"%s\",0x%08x,%d,{", + entry_.desc_, + entry_.loc_name_, + entry_.codeset_id_, + entry_.num_sets_); + for (unsigned j = 0; j < entry_.num_sets_; j++) + if (j+1 < entry_.num_sets_) + fprintf (outf_,"0x%04x,",entry_.char_sets_[j]); + else + fprintf (outf_,"0x%04x",entry_.char_sets_[j]); + fprintf (outf_,"},%d}",entry_.max_bytes_); + return 0; +} + +void +csdb_generator::write_dummy_entry() +{ + entry_.desc_ = "No codesets defined"; + entry_.loc_name_ = "NONE"; + entry_.codeset_id_ = 0; + entry_.num_sets_ = 1; + entry_.char_sets_[0] = 0; + entry_.max_bytes_ = 0; + write_entry(); +} + +int +csdb_generator::fini_output (const char *tgt) +{ + char *target = new char [ACE_OS::strlen(ace_src_) + ACE_OS::strlen(tgt) + 6]; + sprintf (target,"%s/ace/%s",ace_src_,tgt); + if (count_ == 0) + write_dummy_entry(); + fprintf (outf_,"\n};\n\nsize_t ACE_Codeset_Registry::num_registry_entries_ = %d;\n\n",count_); + fclose (outf_); + ACE_stat buf; + if (ACE_OS::stat (target,&buf) == 0) + { + char fname[200]; + int result = 0; + for (int i = 0; result == 0; i++) + { + sprintf (fname,"%s.%03d",target,i); + result = ACE_OS::stat(fname,&buf); + } + ACE_DEBUG ((LM_DEBUG,"Moving $ACE_ROOT/ace/%s to $ACE_ROOT/ace%s\n", + tgt,ACE_OS::strrchr(fname,'/'))); + if (ACE_OS::rename (target,fname) == -1) + ACE_ERROR_RETURN ((LM_ERROR,"Could not create %s\n, output stored in %s", + fname,tempfilename_),-1); + } + ACE_DEBUG ((LM_DEBUG,"writing $ACE_ROOT/ace/%s\n",tgt)); + if (ACE_OS::rename (tempfilename_,target) == -1) + ACE_ERROR_RETURN ((LM_ERROR,"Could not create %s\n, output stored in %s", + target,tempfilename_),-1); + return 0; +} + +int +main (int argc, char ** argv) +{ + ACE_CString srcname; + if (argc > 1) + srcname.set(argv[1]); + else + ACE_ERROR_RETURN ((LM_ERROR,"Usage: %s <source_file>\nwhere source file is the full path to a code set registry text file.\n",argv[0]),-1); + csdb_generator csdb; + if (csdb.init_output(srcname.c_str()) == -1) + return 0; + if (csdb.read_from (srcname.c_str()) == 0) + csdb.fini_output ("Codeset_Registry_db.cpp"); + return 0; +} + diff --git a/apps/mkcsregdb/mkcsregdb.dsp b/apps/mkcsregdb/mkcsregdb.dsp new file mode 100644 index 00000000000..9d93180a7c0 --- /dev/null +++ b/apps/mkcsregdb/mkcsregdb.dsp @@ -0,0 +1,102 @@ +# Microsoft Developer Studio Project File - Name="mkcsregdb" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=mkcsregdb - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "mkcsregdb.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "mkcsregdb.mak" CFG="mkcsregdb - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mkcsregdb - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "mkcsregdb - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "mkcsregdb - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "mkcsregdb - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\mkcsregdb.exe" /pdbtype:sept /libpath:"..\..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "mkcsregdb - Win32 Release"
+# Name "mkcsregdb - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\mkcsregdb.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
|