src/Pure/System/isabelle_charset.scala
author wenzelm
Mon Jul 15 10:25:35 2013 +0200 (2013-07-15 ago)
changeset 52655 3b2b1ef13979
parent 50203 00d8ad713e32
child 55618 995162143ef4
permissions -rw-r--r--
more careful termination of removed execs, leaving running execs undisturbed;
     1 /*  Title:      Pure/System/isabelle_charset.scala
     2     Author:     Makarius
     3 
     4 Charset for Isabelle symbols.
     5 */
     6 
     7 package isabelle
     8 
     9 import java.nio.Buffer
    10 import java.nio.{ByteBuffer, CharBuffer}
    11 import java.nio.charset.{Charset, CharsetDecoder, CharsetEncoder, CoderResult}
    12 import java.nio.charset.spi.CharsetProvider
    13 
    14 
    15 object Isabelle_Charset
    16 {
    17   val name: String = "UTF-8-Isabelle-test"  // FIXME
    18   lazy val charset: Charset = new Isabelle_Charset
    19 }
    20 
    21 
    22 class Isabelle_Charset extends Charset(Isabelle_Charset.name, null)
    23 {
    24   override def contains(cs: Charset): Boolean =
    25     cs.name.equalsIgnoreCase(UTF8.charset_name) || UTF8.charset.contains(cs)
    26 
    27   override def newDecoder(): CharsetDecoder = UTF8.charset.newDecoder
    28 
    29   override def newEncoder(): CharsetEncoder = UTF8.charset.newEncoder
    30 }
    31 
    32 
    33 class Isabelle_Charset_Provider extends CharsetProvider
    34 {
    35   override def charsetForName(name: String): Charset =
    36   {
    37     // FIXME inactive
    38     // if (name.equalsIgnoreCase(Isabelle_Charset.name)) Isabelle_Charset.charset
    39     // else null
    40     null
    41   }
    42 
    43   override def charsets(): java.util.Iterator[Charset] =
    44   {
    45     import scala.collection.JavaConversions._
    46     // FIXME inactive
    47     // Iterator(Isabelle_Charset.charset)
    48     Iterator()
    49   }
    50 }
    51