author | wenzelm |
Mon, 24 Jan 2022 21:29:37 +0100 | |
changeset 74995 | 68ffcf5cc94b |
parent 73909 | 1d0d9772fff0 |
child 75393 | 87ebf5a50283 |
permissions | -rw-r--r-- |
43517 | 1 |
/* Title: Pure/System/isabelle_charset.scala |
2 |
Author: Makarius |
|
3 |
||
4 |
Charset for Isabelle symbols. |
|
5 |
*/ |
|
6 |
||
7 |
package isabelle |
|
8 |
||
55618 | 9 |
|
73909 | 10 |
import java.util.{List => JList} |
43517 | 11 |
import java.nio.Buffer |
12 |
import java.nio.{ByteBuffer, CharBuffer} |
|
13 |
import java.nio.charset.{Charset, CharsetDecoder, CharsetEncoder, CoderResult} |
|
14 |
import java.nio.charset.spi.CharsetProvider |
|
15 |
||
16 |
||
17 |
object Isabelle_Charset |
|
18 |
{ |
|
19 |
val name: String = "UTF-8-Isabelle-test" // FIXME |
|
20 |
lazy val charset: Charset = new Isabelle_Charset |
|
21 |
} |
|
22 |
||
23 |
||
24 |
class Isabelle_Charset extends Charset(Isabelle_Charset.name, null) |
|
25 |
{ |
|
26 |
override def contains(cs: Charset): Boolean = |
|
50203 | 27 |
cs.name.equalsIgnoreCase(UTF8.charset_name) || UTF8.charset.contains(cs) |
43517 | 28 |
|
50203 | 29 |
override def newDecoder(): CharsetDecoder = UTF8.charset.newDecoder |
43517 | 30 |
|
50203 | 31 |
override def newEncoder(): CharsetEncoder = UTF8.charset.newEncoder |
43517 | 32 |
} |
33 |
||
34 |
||
35 |
class Isabelle_Charset_Provider extends CharsetProvider |
|
36 |
{ |
|
37 |
override def charsetForName(name: String): Charset = |
|
38 |
{ |
|
44778
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
39 |
// FIXME inactive |
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
40 |
// if (name.equalsIgnoreCase(Isabelle_Charset.name)) Isabelle_Charset.charset |
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
41 |
// else null |
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
42 |
null |
43517 | 43 |
} |
44 |
||
45 |
override def charsets(): java.util.Iterator[Charset] = |
|
46 |
{ |
|
44778
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
47 |
// FIXME inactive |
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
48 |
// Iterator(Isabelle_Charset.charset) |
73909 | 49 |
JList.of[Charset]().listIterator() |
43517 | 50 |
} |
51 |
} |