Updated installers to include unicode to wylie and acip to wylie.

This commit is contained in:
amontano 2007-05-01 02:38:45 +00:00
parent c5c448f0c6
commit d6d2eeb004
4 changed files with 103 additions and 72 deletions

View file

@ -238,12 +238,15 @@ class ConvertDialog extends JDialog
|| cmd.equals(BROWSENEW))
{
JButton src = (JButton)ae.getSource();
String choice = (String)choices.getSelectedItem();
if (src == browseOld) {
jfc.setFileFilter((ACIP_TO_UNI_TEXT.equals((String)choices.getSelectedItem())
|| WYLIE_TO_UNI_TEXT.equals((String)choices.getSelectedItem())
|| UNI_TO_WYLIE_TEXT.equals((String)choices.getSelectedItem())
|| ACIP_TO_TMW.equals((String)choices.getSelectedItem())
|| WYLIE_TO_TMW.equals((String)choices.getSelectedItem()))
jfc.setFileFilter((ACIP_TO_UNI_TEXT.equals(choice)
|| WYLIE_TO_UNI_TEXT.equals(choice)
|| UNI_TO_WYLIE_TEXT.equals(choice)
|| ACIP_TO_TMW.equals(choice)
|| WYLIE_TO_TMW.equals(choice)
|| ACIP_TO_WYLIE_TEXT.equals(choice)
|| WYLIE_TO_ACIP_TEXT.equals(choice))
? textFileFilter : rtfFileFilter);
} else {
jfc.setFileFilter((ACIP_TO_UNI_TEXT.equals((String)choices.getSelectedItem())
@ -500,12 +503,12 @@ class ConvertDialog extends JDialog
newFileNamePrefix = suggested_WYLIE_prefix;
if (UNI_TO_WYLIE_TEXT == ct)
newFileNameExtension = ".TXT";
} else if (TMW_TO_WYLIE_TEXT == ct) {
} else if (TMW_TO_WYLIE_TEXT == ct || ACIP_TO_WYLIE_TEXT == ct) {
newFileNamePrefix = suggested_WYLIE_prefix;
newFileNameExtension = ".TXT";
} else if (TMW_TO_ACIP == ct) {
newFileNamePrefix = suggested_ACIP_prefix;
} else if (TMW_TO_ACIP_TEXT == ct) {
} else if (TMW_TO_ACIP_TEXT == ct || WYLIE_TO_ACIP_TEXT == ct) {
newFileNamePrefix = suggested_ACIP_prefix;
newFileNameExtension = ".TXT";
} else if (TMW_TO_UNI == ct || ACIP_TO_UNI_TEXT == ct

View file

@ -22,13 +22,15 @@ package org.thdl.tib.input;
/** Constants used by ConvertDialog.
@author Nathaniel Garson, Tibetan and Himalayan Digital Library */
interface FontConverterConstants
public interface FontConverterConstants
{
final String UNI_TO_WYLIE_TEXT = "Unicode to Wylie (UTF-8 Text->Text)";
final String UNI_TO_WYLIE_TEXT = "Unicode to Wylie (UTF-16 Text->Text)";
final String WYLIE_TO_UNI_TEXT = "Wylie to Unicode (Text->Text)";
final String WYLIE_TO_TMW = "Wylie to TMW (Text->RTF)";
final String WYLIE_TO_ACIP_TEXT = "Wylie to ACIP (Text->Text)";
final String TMW_TO_SAME_TMW = "TMW to the same TMW (for testing only) (RTF->RTF)";
final String ACIP_TO_UNI_TEXT = "ACIP to Unicode (Text->Text)";
final String ACIP_TO_WYLIE_TEXT = "ACIP to Wylie (Text->Text)";
final String ACIP_TO_TMW = "ACIP to TMW (Text->RTF)";
final String TMW_TO_ACIP = "TMW to ACIP (RTF->RTF)";
final String TMW_TO_ACIP_TEXT = "TMW to ACIP (RTF->Text)";
@ -45,7 +47,9 @@ interface FontConverterConstants
final String[] CHOICES = new String[] {
WYLIE_TO_UNI_TEXT,
WYLIE_TO_TMW,
//WYLIE_TO_ACIP_TEXT,
ACIP_TO_UNI_TEXT,
ACIP_TO_WYLIE_TEXT,
ACIP_TO_TMW,
TMW_TO_ACIP,
TMW_TO_ACIP_TEXT,
@ -54,6 +58,7 @@ interface FontConverterConstants
TMW_TO_UNI,
TMW_TO_WYLIE,
TMW_TO_WYLIE_TEXT,
UNI_TO_WYLIE_TEXT,
FIND_SOME_NON_TMW, // TODO(dchandler): should this be in DEBUG_CHOICES only?
FIND_SOME_NON_TM, // TODO(dchandler): should this be in DEBUG_CHOICES only?
FIND_ALL_NON_TMW, // TODO(dchandler): should this be in DEBUG_CHOICES only?
@ -61,11 +66,11 @@ interface FontConverterConstants
};
final String[] DEBUG_CHOICES = new String[] {
UNI_TO_WYLIE_TEXT,
TMW_TO_SAME_TMW,
WYLIE_TO_UNI_TEXT,
WYLIE_TO_TMW,
ACIP_TO_UNI_TEXT,
ACIP_TO_WYLIE_TEXT,
ACIP_TO_TMW,
TMW_TO_ACIP,
TMW_TO_ACIP_TEXT,
@ -74,6 +79,7 @@ interface FontConverterConstants
TMW_TO_UNI,
TMW_TO_WYLIE,
TMW_TO_WYLIE_TEXT,
UNI_TO_WYLIE_TEXT,
FIND_SOME_NON_TMW,
FIND_SOME_NON_TM,
FIND_ALL_NON_TMW,
@ -88,5 +94,4 @@ interface FontConverterConstants
// String Constants
public final String PROGRAM_TITLE = "THDL Tibetan Converters -- featuring Jskad Technology";
}
}

View file

@ -26,6 +26,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.swing.text.SimpleAttributeSet;
@ -43,6 +44,7 @@ import org.thdl.util.ThdlDebug;
import org.thdl.util.ThdlLazyException;
import org.thdl.util.ThdlOptions;
import org.thdl.util.ThdlVersion;
import org.thdl.tib.scanner.*;
/** TibetanConverter is a command-line utility for converting to and
* from Tibetan Machine Web (TMW). It converts TMW to Wylie, ACIP,
@ -329,9 +331,9 @@ public class TibetanConverter implements FontConverterConstants {
static int reallyConvert(InputStream in, PrintStream out, String ct,
String warningLevel, boolean shortMessages,
boolean colors) {
if (UNI_TO_WYLIE_TEXT == ct) {
if (UNI_TO_WYLIE_TEXT == ct || WYLIE_TO_ACIP_TEXT == ct || ACIP_TO_WYLIE_TEXT == ct) {
try {
String uniText;
/*String uniText;
{
// TODO(dchandler): use, here and elsewhere in the
// codebase,
@ -355,7 +357,12 @@ public class TibetanConverter implements FontConverterConstants {
String ewtsText = Converter.convertToEwtsForComputers(uniText,
errors);
// TODO(dchandler): is 51 the right choice?
return (errors.length() > 0) ? 51 : 0;
return (errors.length() > 0) ? 51 : 0;*/
BasicTibetanTranscriptionConverter bc = null;
if (UNI_TO_WYLIE_TEXT == ct) bc = new BasicTibetanTranscriptionConverter(new BufferedReader(new InputStreamReader(in, "UTF16")), new PrintWriter(out));
else bc = new BasicTibetanTranscriptionConverter(new BufferedReader(new InputStreamReader(in)), new PrintWriter(out));
bc.run(ct);
return 0;
} catch (IOException e) {
// TODO(dchandler): print it? where to?
return 48;