--- a/src/Tools/jEdit/plugin/services.xml Tue Sep 15 20:46:46 2009 +0200
+++ b/src/Tools/jEdit/plugin/services.xml Tue Sep 15 21:14:09 2009 +0200
@@ -2,7 +2,7 @@
<!DOCTYPE SERVICES SYSTEM "services.dtd">
<SERVICES>
<SERVICE NAME="UTF-8-Isabelle" CLASS="org.gjt.sp.jedit.io.Encoding">
- new isabelle.jedit.IsabelleEncoding();
+ new isabelle.jedit.Isabelle_Encoding();
</SERVICE>
<SERVICE NAME="isabelle" CLASS="sidekick.SideKickParser">
new isabelle.jedit.IsabelleSideKickParser();
--- a/src/Tools/jEdit/src/jedit/IsabelleEncoding.scala Tue Sep 15 20:46:46 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Isabelle encoding -- based on utf-8
- *
- * @author Makarius
- */
-
-package isabelle.jedit
-
-import org.gjt.sp.jedit.io.Encoding
-import org.gjt.sp.jedit.buffer.JEditBuffer
-
-import java.nio.charset.{Charset, CharsetDecoder, CodingErrorAction}
-import java.io.{InputStream, OutputStream, Reader, Writer, InputStreamReader, OutputStreamWriter,
- CharArrayReader, ByteArrayOutputStream}
-
-import scala.io.{Source, BufferedSource}
-
-
-object IsabelleEncoding
-{
- val NAME = "UTF-8-Isabelle"
-
- def is_active(buffer: JEditBuffer): Boolean =
- buffer.getProperty(JEditBuffer.ENCODING).asInstanceOf[String] == NAME
-}
-
-class IsabelleEncoding extends Encoding
-{
- private val charset = Charset.forName(Isabelle_System.charset)
- private val BUFSIZE = 32768
-
- private def text_reader(in: InputStream, decoder: CharsetDecoder): Reader =
- {
- def source(): Source =
- BufferedSource.fromInputStream(in, decoder, BUFSIZE, { () => source() })
- new CharArrayReader(Isabelle.symbols.decode(source.mkString).toArray)
- }
-
- override def getTextReader(in: InputStream): Reader =
- text_reader(in, charset.newDecoder())
-
- override def getPermissiveTextReader(in: InputStream): Reader =
- {
- val decoder = charset.newDecoder()
- decoder.onMalformedInput(CodingErrorAction.REPLACE)
- decoder.onUnmappableCharacter(CodingErrorAction.REPLACE)
- text_reader(in, decoder)
- }
-
- override def getTextWriter(out: OutputStream): Writer =
- {
- val buffer = new ByteArrayOutputStream(BUFSIZE) {
- override def flush()
- {
- val text = Isabelle.symbols.encode(toString(Isabelle_System.charset))
- out.write(text.getBytes(Isabelle_System.charset))
- out.flush()
- }
- override def close() { out.close() }
- }
- new OutputStreamWriter(buffer, charset.newEncoder())
- }
-}
--- a/src/Tools/jEdit/src/jedit/IsabelleSideKickParser.scala Tue Sep 15 20:46:46 2009 +0200
+++ b/src/Tools/jEdit/src/jedit/IsabelleSideKickParser.scala Tue Sep 15 21:14:09 2009 +0200
@@ -92,7 +92,7 @@
case None => null
case Some((word, cs)) =>
val ds =
- if (IsabelleEncoding.is_active(buffer))
+ if (Isabelle_Encoding.is_active(buffer))
cs.map(Isabelle.system.symbols.decode(_)).sort(Completion.length_ord _)
else cs
new SideKickCompletion(pane.getView, word, ds.toArray.asInstanceOf[Array[Object]]) { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/jEdit/src/jedit/Isabelle_Encoding.scala Tue Sep 15 21:14:09 2009 +0200
@@ -0,0 +1,63 @@
+/*
+ * Isabelle encoding -- based on utf-8
+ *
+ * @author Makarius
+ */
+
+package isabelle.jedit
+
+import org.gjt.sp.jedit.io.Encoding
+import org.gjt.sp.jedit.buffer.JEditBuffer
+
+import java.nio.charset.{Charset, CharsetDecoder, CodingErrorAction}
+import java.io.{InputStream, OutputStream, Reader, Writer, InputStreamReader, OutputStreamWriter,
+ CharArrayReader, ByteArrayOutputStream}
+
+import scala.io.{Source, BufferedSource}
+
+
+object Isabelle_Encoding
+{
+ val NAME = "UTF-8-Isabelle"
+
+ def is_active(buffer: JEditBuffer): Boolean =
+ buffer.getProperty(JEditBuffer.ENCODING).asInstanceOf[String] == NAME
+}
+
+class Isabelle_Encoding extends Encoding
+{
+ private val charset = Charset.forName(Isabelle_System.charset)
+ private val BUFSIZE = 32768
+
+ private def text_reader(in: InputStream, decoder: CharsetDecoder): Reader =
+ {
+ def source(): Source =
+ BufferedSource.fromInputStream(in, decoder, BUFSIZE, { () => source() })
+ new CharArrayReader(Isabelle.symbols.decode(source.mkString).toArray)
+ }
+
+ override def getTextReader(in: InputStream): Reader =
+ text_reader(in, charset.newDecoder())
+
+ override def getPermissiveTextReader(in: InputStream): Reader =
+ {
+ val decoder = charset.newDecoder()
+ decoder.onMalformedInput(CodingErrorAction.REPLACE)
+ decoder.onUnmappableCharacter(CodingErrorAction.REPLACE)
+ text_reader(in, decoder)
+ }
+
+ override def getTextWriter(out: OutputStream): Writer =
+ {
+ val buffer = new ByteArrayOutputStream(BUFSIZE) {
+ override def flush()
+ {
+ val text = Isabelle.symbols.encode(toString(Isabelle_System.charset))
+ out.write(text.getBytes(Isabelle_System.charset))
+ out.flush()
+ }
+ override def close() { out.close() }
+ }
+ new OutputStreamWriter(buffer, charset.newEncoder())
+ }
+}