--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Pure/System/isabelle_charset.scala Thu Jun 23 10:58:29 2011 +0200
@@ -0,0 +1,50 @@
+/* Title: Pure/System/isabelle_charset.scala
+ Author: Makarius
+
+Charset for Isabelle symbols.
+*/
+
+package isabelle
+
+import java.nio.Buffer
+import java.nio.{ByteBuffer, CharBuffer}
+import java.nio.charset.{Charset, CharsetDecoder, CharsetEncoder, CoderResult}
+import java.nio.charset.spi.CharsetProvider
+
+
+object Isabelle_Charset
+{
+ val name: String = "UTF-8-Isabelle-test" // FIXME
+ lazy val charset: Charset = new Isabelle_Charset
+}
+
+
+class Isabelle_Charset extends Charset(Isabelle_Charset.name, null)
+{
+ override def contains(cs: Charset): Boolean =
+ cs.name.equalsIgnoreCase(Standard_System.charset_name) ||
+ Standard_System.charset.contains(cs)
+
+ override def newDecoder(): CharsetDecoder =
+ Standard_System.charset.newDecoder
+
+ override def newEncoder(): CharsetEncoder =
+ Standard_System.charset.newEncoder
+}
+
+
+class Isabelle_Charset_Provider extends CharsetProvider
+{
+ override def charsetForName(name: String): Charset =
+ {
+ if (name.equalsIgnoreCase(Isabelle_Charset.name)) Isabelle_Charset.charset
+ else null
+ }
+
+ override def charsets(): java.util.Iterator[Charset] =
+ {
+ import scala.collection.JavaConversions._
+ Iterator(Isabelle_Charset.charset)
+ }
+}
+
--- a/src/Pure/build-jars Wed Jun 22 23:56:44 2011 +0200
+++ b/src/Pure/build-jars Thu Jun 23 10:58:29 2011 +0200
@@ -37,6 +37,7 @@
System/download.scala
System/event_bus.scala
System/gui_setup.scala
+ System/isabelle_charset.scala
System/isabelle_process.scala
System/isabelle_syntax.scala
System/isabelle_system.scala
@@ -165,7 +166,11 @@
pushd classes >/dev/null
- jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup isabelle || \
+ CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider"
+ mkdir -p "$(dirname "$CHARSET_SERVICE")"
+ echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE"
+
+ jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup META-INF isabelle || \
fail "Failed to produce $PURE_JAR"
cp "$SCALA_HOME/lib/scala-swing.jar" .