diff --git a/build.xml b/build.xml index c009ebc..4b5cde0 100644 --- a/build.xml +++ b/build.xml @@ -348,8 +348,8 @@ Contributor(s): ______________________________________. - + + value="org/thdl/tib/text/ttt/TConverter.java"/> diff --git a/source/org/thdl/tib/input/TibetanConverter.java b/source/org/thdl/tib/input/TibetanConverter.java index 134c0de..6c50aeb 100644 --- a/source/org/thdl/tib/input/TibetanConverter.java +++ b/source/org/thdl/tib/input/TibetanConverter.java @@ -26,7 +26,7 @@ import javax.swing.text.StyleConstants; import org.thdl.util.*; import org.thdl.tib.text.*; -import org.thdl.tib.text.ttt.ACIPConverter; +import org.thdl.tib.text.ttt.TConverter; import org.thdl.tib.text.ttt.ACIPTshegBarScanner; import java.util.ArrayList; @@ -307,19 +307,19 @@ public class TibetanConverter implements FontConverterConstants { boolean embeddedWarnings = (warningLevel != "None"); boolean hasWarnings[] = new boolean[] { false }; if (ACIP_TO_UNI_TEXT == ct) { - if (!ACIPConverter.convertToUnicodeText(al, out, null, - null, hasWarnings, - embeddedWarnings, - warningLevel, - shortMessages)) + if (!TConverter.convertToUnicodeText(al, out, null, + null, hasWarnings, + embeddedWarnings, + warningLevel, + shortMessages)) return 46; } else { if (ct != ACIP_TO_TMW) throw new Error("badness"); - if (!ACIPConverter.convertToTMW(al, out, null, null, - hasWarnings, - embeddedWarnings, - warningLevel, shortMessages, - colors)) + if (!TConverter.convertToTMW(al, out, null, null, + hasWarnings, + embeddedWarnings, + warningLevel, shortMessages, + colors)) return 46; } if (embeddedWarnings && hasWarnings[0]) diff --git a/source/org/thdl/tib/text/TibTextUtils.java b/source/org/thdl/tib/text/TibTextUtils.java index d54cace..3526f34 100644 --- a/source/org/thdl/tib/text/TibTextUtils.java +++ b/source/org/thdl/tib/text/TibTextUtils.java @@ -26,7 +26,7 @@ import java.io.*; import org.thdl.util.ThdlDebug; import org.thdl.tib.text.ttt.ACIPTshegBarScanner; -import org.thdl.tib.text.ttt.ACIPConverter; +import org.thdl.tib.text.ttt.TConverter; import org.thdl.tib.text.tshegbar.LegalTshegBar; import org.thdl.tib.text.tshegbar.UnicodeConstants; import org.thdl.tib.text.tshegbar.UnicodeUtils; @@ -348,9 +348,9 @@ public class TibTextUtils implements THDLWylieConstants { } try { int tloc[] = new int[] { loc }; - ACIPConverter.convertToTMW(al, tdoc, null, null, null, - putWarningsInOutput, warningLevel, - false, colors, tloc); + TConverter.convertToTMW(al, tdoc, null, null, null, + putWarningsInOutput, warningLevel, + false, colors, tloc); return tloc[0] - loc; } catch (IOException e) { throw new Error("Can't happen: " + e); diff --git a/source/org/thdl/tib/text/tibwn.ini b/source/org/thdl/tib/text/tibwn.ini index fc0d9d9..05a0eaa 100644 --- a/source/org/thdl/tib/text/tibwn.ini +++ b/source/org/thdl/tib/text/tibwn.ini @@ -64,9 +64,9 @@ $~38,5~~9,41~~~~~~~0F06 #~200,1~~9,39~~~~~~~0F05 // Yig.mgo.tsheg.shad: %~39,5~~9,42~~~~~~~0F07 -// dbu.khang.g-yon: (If this changes, edit ACIPConverter) +// dbu.khang.g-yon: (If this changes, edit TConverter) (~208,1~~9,93~~~~~~~0F3C -// dbu.khang.g-yas: (If this changes, edit ACIPConverter) +// dbu.khang.g-yas: (If this changes, edit TConverter) )~209,1~~9,94~~~~~~~0F3D H~239,1~~8,92~~~~~~~0F7F // mtshan.rtags: diff --git a/source/org/thdl/tib/text/ttt/PackageTest.java b/source/org/thdl/tib/text/ttt/PackageTest.java index fbbb879..6246868 100644 --- a/source/org/thdl/tib/text/ttt/PackageTest.java +++ b/source/org/thdl/tib/text/ttt/PackageTest.java @@ -209,16 +209,16 @@ public class PackageTest extends TestCase { = new org.thdl.tib.text.TibetanDocument(); int loc[] = new int[] { 0 }; try { - if (!ACIPConverter.convertToTMW(al, - tdoc, - null, - null, - null, - false, - "None", - false, - false, - loc)) + if (!TConverter.convertToTMW(al, + tdoc, + null, + null, + null, + false, + "None", + false, + false, + loc)) return null; } catch (java.io.IOException e) { assertTrue("I/O exception?", false); @@ -7680,9 +7680,10 @@ tstHelper("ZUR"); private static void uhelp(String acip, String expectedUnicode, String warningLevel, boolean shortMessages) { StringBuffer errors = new StringBuffer(); - String unicode = ACIPConverter.convertToUnicodeText(acip, errors, null, - true, warningLevel, - shortMessages); + String unicode = TConverter.convertToUnicodeText("ACIP", acip, errors, + null, true, + warningLevel, + shortMessages); if (null == unicode) { if (null != expectedUnicode && "none" != expectedUnicode) { System.out.println("No unicode exists for " + acip + " but you expected " + org.thdl.tib.text.tshegbar.UnicodeUtils.unicodeStringToPrettyString(expectedUnicode)); diff --git a/source/org/thdl/tib/text/ttt/ACIPConverter.java b/source/org/thdl/tib/text/ttt/TConverter.java similarity index 99% rename from source/org/thdl/tib/text/ttt/ACIPConverter.java rename to source/org/thdl/tib/text/ttt/TConverter.java index 0df715d..d0fd55e 100644 --- a/source/org/thdl/tib/text/ttt/ACIPConverter.java +++ b/source/org/thdl/tib/text/ttt/TConverter.java @@ -35,7 +35,7 @@ import org.thdl.tib.text.DuffCode; * results as ACIP->TMW followed by TMW->Unicode (FIXME: test it!) * @author David Chandler */ -public class ACIPConverter { +public class TConverter { /** Command-line converter for testing only -- use * org.thdl.tib.input.TibetanConverter for production work. @@ -55,7 +55,7 @@ public class ACIPConverter { // Only developers should use this. if (!ThdlOptions.getBooleanOption("thdl.debug")) { - System.err.println("Use org.thdl.tib.input.TibetanConverter for production work, not ACIPConverter."); + System.err.println("Use org.thdl.tib.input.TibetanConverter for production work, not TConverter."); System.exit(1); } @@ -137,7 +137,6 @@ public class ACIPConverter { * prefix rules in another * @throws IOException if we cannot write to out */ - // TODO(DLC)[EWTS->Tibetan]: misnamed source file, this is TConverter.java nowadays public static boolean convertToTMW(ArrayList scan, OutputStream out, StringBuffer errors, @@ -197,12 +196,17 @@ public class ACIPConverter { * messages are long and self-contained unless shortMessages is * true. Returns the conversion upon perfect success or if there * were merely warnings, null if errors occurred. */ - public static String convertToUnicodeText(String acip, + public static String convertToUnicodeText(String transliteration, + String acip, StringBuffer errors, StringBuffer warnings, boolean writeWarningsToResult, String warningLevel, boolean shortMessages) { + if (transliteration != "ACIP") { + ThdlDebug.noteIffyCode(); + throw new IllegalArgumentException("Unsupported transliteration"); + } ByteArrayOutputStream sw = new ByteArrayOutputStream(); ArrayList al = ACIPTshegBarScanner.scan(acip, errors, -1, shortMessages, warningLevel);