From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libjava/gnu/gcj/convert/IOConverter.java | 89 ++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 libjava/gnu/gcj/convert/IOConverter.java (limited to 'libjava/gnu/gcj/convert/IOConverter.java') diff --git a/libjava/gnu/gcj/convert/IOConverter.java b/libjava/gnu/gcj/convert/IOConverter.java new file mode 100644 index 000000000..a0d466776 --- /dev/null +++ b/libjava/gnu/gcj/convert/IOConverter.java @@ -0,0 +1,89 @@ +/* Copyright (C) 2000, 2001, 2005 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +/* This is a base class that handles aliasing issues for + UnicodeToBytes to BytesToUnicode. */ + +package gnu.gcj.convert; + +import java.util.Hashtable; + +public abstract class IOConverter +{ + // Map encoding aliases to our canonical form. + static private Hashtable hash = new Hashtable (); + + // True if we have to do byte-order conversions on iconv() + // arguments. + static protected boolean iconv_byte_swap; + + static + { + // Manually maintained aliases. Note that the value must be our + // canonical name. + hash.put ("iso-latin-1", "8859_1"); + hash.put ("iso8859_1", "8859_1"); + hash.put ("utf-16le", "UnicodeLittle"); + hash.put ("utf-16be", "UnicodeBig"); + // At least one build script out there uses 'utf8'. + hash.put ("utf8", "UTF8"); + // On Solaris the default encoding, as returned by nl_langinfo(), + // is `646' (aka ASCII), but the Solaris iconv_open() doesn't + // understand that. We work around the problem by adding an + // explicit alias for Solaris users. + hash.put ("646", "ASCII"); + + // See PR 24552, PR 14358. + hash.put ("euc_jp", "EUCJIS"); + hash.put ("eucjp", "EUCJIS"); + + // All aliases after this point are automatically generated by the + // `encodings.pl' script. Run it to make any corrections. + hash.put ("ansi_x3.4-1968", "ASCII"); + hash.put ("ansi_x3.4-1986", "ASCII"); + hash.put ("ascii", "ASCII"); + hash.put ("cp367", "ASCII"); + hash.put ("cp819", "8859_1"); + hash.put ("csascii", "ASCII"); + hash.put ("cseucpkdfmtjapanese", "EUCJIS"); + hash.put ("csisolatin1", "8859_1"); + hash.put ("csshiftjis", "SJIS"); + hash.put ("euc-jp", "EUCJIS"); + hash.put ("extended_unix_code_packed_format_for_japanese", "EUCJIS"); + hash.put ("ibm367", "ASCII"); + hash.put ("ibm819", "8859_1"); + hash.put ("iso-8859-1", "8859_1"); + hash.put ("iso-ir-100", "8859_1"); + hash.put ("iso-ir-6", "ASCII"); + hash.put ("iso646-us", "ASCII"); + hash.put ("iso_646.irv:1991", "ASCII"); + hash.put ("iso_8859-1", "8859_1"); + hash.put ("iso_8859-1:1987", "8859_1"); + hash.put ("l1", "8859_1"); + hash.put ("latin1", "8859_1"); + hash.put ("ms_kanji", "SJIS"); + hash.put ("shift_jis", "SJIS"); + hash.put ("us", "ASCII"); + hash.put ("us-ascii", "ASCII"); + hash.put ("utf-8", "UTF8"); + hash.put ("utf16-be", "UnicodeBig"); + hash.put ("utf16-le", "UnicodeLittle"); + // End script-generated section. + + iconv_byte_swap = iconv_init (); + } + + private static native boolean iconv_init (); + + // Turn an alias into the canonical form. + protected static final String canonicalize (String name) + { + String c = (String) hash.get (name.toLowerCase ()); + return c == null ? name : c; + } +} -- cgit v1.2.3