Renamed ACIPConverter to TConverter. Added a needed parameter (the
only needed parameter in that class's interface AFAIK.
This commit is contained in:
parent
37bf9a736d
commit
3e0168b384
6 changed files with 42 additions and 37 deletions
|
@ -348,8 +348,8 @@ Contributor(s): ______________________________________.
|
||||||
<param name="my.included.source.file"
|
<param name="my.included.source.file"
|
||||||
value="org/thdl/util/VerboseUnicodeDump.java"/>
|
value="org/thdl/util/VerboseUnicodeDump.java"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
<!-- Put TibetanConverter and ACIPConverter in Jskad's jar for
|
<!-- Put TibetanConverter in Jskad's jar for those who want to use
|
||||||
those who want to use them. -->
|
it. -->
|
||||||
<antcall target="our-internal-javac-task">
|
<antcall target="our-internal-javac-task">
|
||||||
<param name="mybin" value="${jskadbin}"/>
|
<param name="mybin" value="${jskadbin}"/>
|
||||||
<param name="my.included.source.file"
|
<param name="my.included.source.file"
|
||||||
|
@ -358,7 +358,7 @@ Contributor(s): ______________________________________.
|
||||||
<antcall target="our-internal-javac-task">
|
<antcall target="our-internal-javac-task">
|
||||||
<param name="mybin" value="${jskadbin}"/>
|
<param name="mybin" value="${jskadbin}"/>
|
||||||
<param name="my.included.source.file"
|
<param name="my.included.source.file"
|
||||||
value="org/thdl/tib/text/ttt/ACIPConverter.java"/>
|
value="org/thdl/tib/text/ttt/TConverter.java"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
<antcall target="our-internal-javac-task">
|
<antcall target="our-internal-javac-task">
|
||||||
<param name="mybin" value="${jskadbin}"/>
|
<param name="mybin" value="${jskadbin}"/>
|
||||||
|
|
|
@ -26,7 +26,7 @@ import javax.swing.text.StyleConstants;
|
||||||
import org.thdl.util.*;
|
import org.thdl.util.*;
|
||||||
import org.thdl.tib.text.*;
|
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 org.thdl.tib.text.ttt.ACIPTshegBarScanner;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@ -307,19 +307,19 @@ public class TibetanConverter implements FontConverterConstants {
|
||||||
boolean embeddedWarnings = (warningLevel != "None");
|
boolean embeddedWarnings = (warningLevel != "None");
|
||||||
boolean hasWarnings[] = new boolean[] { false };
|
boolean hasWarnings[] = new boolean[] { false };
|
||||||
if (ACIP_TO_UNI_TEXT == ct) {
|
if (ACIP_TO_UNI_TEXT == ct) {
|
||||||
if (!ACIPConverter.convertToUnicodeText(al, out, null,
|
if (!TConverter.convertToUnicodeText(al, out, null,
|
||||||
null, hasWarnings,
|
null, hasWarnings,
|
||||||
embeddedWarnings,
|
embeddedWarnings,
|
||||||
warningLevel,
|
warningLevel,
|
||||||
shortMessages))
|
shortMessages))
|
||||||
return 46;
|
return 46;
|
||||||
} else {
|
} else {
|
||||||
if (ct != ACIP_TO_TMW) throw new Error("badness");
|
if (ct != ACIP_TO_TMW) throw new Error("badness");
|
||||||
if (!ACIPConverter.convertToTMW(al, out, null, null,
|
if (!TConverter.convertToTMW(al, out, null, null,
|
||||||
hasWarnings,
|
hasWarnings,
|
||||||
embeddedWarnings,
|
embeddedWarnings,
|
||||||
warningLevel, shortMessages,
|
warningLevel, shortMessages,
|
||||||
colors))
|
colors))
|
||||||
return 46;
|
return 46;
|
||||||
}
|
}
|
||||||
if (embeddedWarnings && hasWarnings[0])
|
if (embeddedWarnings && hasWarnings[0])
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.io.*;
|
||||||
|
|
||||||
import org.thdl.util.ThdlDebug;
|
import org.thdl.util.ThdlDebug;
|
||||||
import org.thdl.tib.text.ttt.ACIPTshegBarScanner;
|
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.LegalTshegBar;
|
||||||
import org.thdl.tib.text.tshegbar.UnicodeConstants;
|
import org.thdl.tib.text.tshegbar.UnicodeConstants;
|
||||||
import org.thdl.tib.text.tshegbar.UnicodeUtils;
|
import org.thdl.tib.text.tshegbar.UnicodeUtils;
|
||||||
|
@ -348,9 +348,9 @@ public class TibTextUtils implements THDLWylieConstants {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
int tloc[] = new int[] { loc };
|
int tloc[] = new int[] { loc };
|
||||||
ACIPConverter.convertToTMW(al, tdoc, null, null, null,
|
TConverter.convertToTMW(al, tdoc, null, null, null,
|
||||||
putWarningsInOutput, warningLevel,
|
putWarningsInOutput, warningLevel,
|
||||||
false, colors, tloc);
|
false, colors, tloc);
|
||||||
return tloc[0] - loc;
|
return tloc[0] - loc;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new Error("Can't happen: " + e);
|
throw new Error("Can't happen: " + e);
|
||||||
|
|
|
@ -64,9 +64,9 @@ $~38,5~~9,41~~~~~~~0F06
|
||||||
#~200,1~~9,39~~~~~~~0F05
|
#~200,1~~9,39~~~~~~~0F05
|
||||||
// Yig.mgo.tsheg.shad:
|
// Yig.mgo.tsheg.shad:
|
||||||
%~39,5~~9,42~~~~~~~0F07
|
%~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
|
(~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
|
)~209,1~~9,94~~~~~~~0F3D
|
||||||
H~239,1~~8,92~~~~~~~0F7F
|
H~239,1~~8,92~~~~~~~0F7F
|
||||||
// mtshan.rtags:
|
// mtshan.rtags:
|
||||||
|
|
|
@ -209,16 +209,16 @@ public class PackageTest extends TestCase {
|
||||||
= new org.thdl.tib.text.TibetanDocument();
|
= new org.thdl.tib.text.TibetanDocument();
|
||||||
int loc[] = new int[] { 0 };
|
int loc[] = new int[] { 0 };
|
||||||
try {
|
try {
|
||||||
if (!ACIPConverter.convertToTMW(al,
|
if (!TConverter.convertToTMW(al,
|
||||||
tdoc,
|
tdoc,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
false,
|
false,
|
||||||
"None",
|
"None",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
loc))
|
loc))
|
||||||
return null;
|
return null;
|
||||||
} catch (java.io.IOException e) {
|
} catch (java.io.IOException e) {
|
||||||
assertTrue("I/O exception?", false);
|
assertTrue("I/O exception?", false);
|
||||||
|
@ -7680,9 +7680,10 @@ tstHelper("ZUR");
|
||||||
private static void uhelp(String acip, String expectedUnicode,
|
private static void uhelp(String acip, String expectedUnicode,
|
||||||
String warningLevel, boolean shortMessages) {
|
String warningLevel, boolean shortMessages) {
|
||||||
StringBuffer errors = new StringBuffer();
|
StringBuffer errors = new StringBuffer();
|
||||||
String unicode = ACIPConverter.convertToUnicodeText(acip, errors, null,
|
String unicode = TConverter.convertToUnicodeText("ACIP", acip, errors,
|
||||||
true, warningLevel,
|
null, true,
|
||||||
shortMessages);
|
warningLevel,
|
||||||
|
shortMessages);
|
||||||
if (null == unicode) {
|
if (null == unicode) {
|
||||||
if (null != expectedUnicode && "none" != expectedUnicode) {
|
if (null != expectedUnicode && "none" != expectedUnicode) {
|
||||||
System.out.println("No unicode exists for " + acip + " but you expected " + org.thdl.tib.text.tshegbar.UnicodeUtils.unicodeStringToPrettyString(expectedUnicode));
|
System.out.println("No unicode exists for " + acip + " but you expected " + org.thdl.tib.text.tshegbar.UnicodeUtils.unicodeStringToPrettyString(expectedUnicode));
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.thdl.tib.text.DuffCode;
|
||||||
* results as ACIP->TMW followed by TMW->Unicode (FIXME: test it!)
|
* results as ACIP->TMW followed by TMW->Unicode (FIXME: test it!)
|
||||||
* @author David Chandler
|
* @author David Chandler
|
||||||
*/
|
*/
|
||||||
public class ACIPConverter {
|
public class TConverter {
|
||||||
|
|
||||||
/** Command-line converter for testing only -- use
|
/** Command-line converter for testing only -- use
|
||||||
* org.thdl.tib.input.TibetanConverter for production work.
|
* org.thdl.tib.input.TibetanConverter for production work.
|
||||||
|
@ -55,7 +55,7 @@ public class ACIPConverter {
|
||||||
|
|
||||||
// Only developers should use this.
|
// Only developers should use this.
|
||||||
if (!ThdlOptions.getBooleanOption("thdl.debug")) {
|
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);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,6 @@ public class ACIPConverter {
|
||||||
* prefix rules in another
|
* prefix rules in another
|
||||||
* @throws IOException if we cannot write to out
|
* @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,
|
public static boolean convertToTMW(ArrayList scan,
|
||||||
OutputStream out,
|
OutputStream out,
|
||||||
StringBuffer errors,
|
StringBuffer errors,
|
||||||
|
@ -197,12 +196,17 @@ public class ACIPConverter {
|
||||||
* messages are long and self-contained unless shortMessages is
|
* messages are long and self-contained unless shortMessages is
|
||||||
* true. Returns the conversion upon perfect success or if there
|
* true. Returns the conversion upon perfect success or if there
|
||||||
* were merely warnings, null if errors occurred. */
|
* were merely warnings, null if errors occurred. */
|
||||||
public static String convertToUnicodeText(String acip,
|
public static String convertToUnicodeText(String transliteration,
|
||||||
|
String acip,
|
||||||
StringBuffer errors,
|
StringBuffer errors,
|
||||||
StringBuffer warnings,
|
StringBuffer warnings,
|
||||||
boolean writeWarningsToResult,
|
boolean writeWarningsToResult,
|
||||||
String warningLevel,
|
String warningLevel,
|
||||||
boolean shortMessages) {
|
boolean shortMessages) {
|
||||||
|
if (transliteration != "ACIP") {
|
||||||
|
ThdlDebug.noteIffyCode();
|
||||||
|
throw new IllegalArgumentException("Unsupported transliteration");
|
||||||
|
}
|
||||||
ByteArrayOutputStream sw = new ByteArrayOutputStream();
|
ByteArrayOutputStream sw = new ByteArrayOutputStream();
|
||||||
ArrayList al = ACIPTshegBarScanner.scan(acip, errors, -1, shortMessages,
|
ArrayList al = ACIPTshegBarScanner.scan(acip, errors, -1, shortMessages,
|
||||||
warningLevel);
|
warningLevel);
|
Loading…
Add table
Add a link
Reference in a new issue