Merge branch 'android_branch' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into android_branch

This commit is contained in:
Eric House 2010-12-13 22:08:11 -08:00
commit a663b2deae
11 changed files with 28 additions and 298 deletions

View file

@ -100,6 +100,7 @@ public class CommsTransport implements TransportProcs {
@Override
public void run()
{
boolean failed = true;
try {
if ( Build.PRODUCT.contains("sdk") ) {
System.setProperty("java.net.preferIPv6Addresses", "false");
@ -107,7 +108,7 @@ public class CommsTransport implements TransportProcs {
m_selector = Selector.open();
loop();
failed = loop();
closeSocket();
} catch ( java.io.IOException ioe ) {
@ -117,11 +118,16 @@ public class CommsTransport implements TransportProcs {
m_addr.ip_relay_hostName, m_addr.ip_relay_port,
uae.toString() );
}
m_thread = null;
if ( failed ) {
m_jniThread.handle( JNICmd.CMD_TRANSFAIL );
}
}
private void loop()
private boolean loop()
{
boolean failed = false;
outer_loop:
while ( !m_done ) {
try {
@ -136,12 +142,14 @@ public class CommsTransport implements TransportProcs {
Utils.logf( "connecting to %s:%d",
m_addr.ip_relay_hostName,
m_addr.ip_relay_port );
InetSocketAddress isa
= new InetSocketAddress( m_addr.ip_relay_hostName,
m_addr.ip_relay_port );
InetSocketAddress isa = new
InetSocketAddress(m_addr.ip_relay_hostName,
m_addr.ip_relay_port );
m_socketChannel.connect( isa );
} catch ( java.io.IOException ioe ) {
Utils.logf( ioe.toString() );
failed = true;
break outer_loop;
}
}
@ -154,7 +162,7 @@ public class CommsTransport implements TransportProcs {
m_selector.select();
} catch ( ClosedChannelException cce ) {
// we get this when relay goes down. Need to notify!
m_jniThread.handle( JNICmd.CMD_TRANSFAIL );
failed = true;
closeSocket();
Utils.logf( "exiting: " + cce.toString() );
break; // don't try again
@ -162,6 +170,10 @@ public class CommsTransport implements TransportProcs {
closeSocket();
Utils.logf( "exiting: " + ioe.toString() );
Utils.logf( ioe.toString() );
} catch ( java.nio.channels.NoConnectionPendingException ncp ) {
Utils.logf( "%s", ncp.toString() );
closeSocket();
break;
}
Iterator<SelectionKey> iter = m_selector.selectedKeys().iterator();
@ -196,12 +208,17 @@ public class CommsTransport implements TransportProcs {
} catch ( java.io.IOException ioe ) {
Utils.logf( "%s: cancelling key", ioe.toString() );
key.cancel();
failed = true;
break outer_loop;
} catch ( java.nio.channels.
NoConnectionPendingException ncp ) {
Utils.logf( "%s", ncp.toString() );
break outer_loop;
}
}
}
return failed;
} // loop
}
public void setReceiver( JNIThread jnit )

View file

@ -857,8 +857,6 @@ public class GameConfig extends XWActivity
}
}
m_gi.fixup();
// position = m_connectSpinner.getSelectedItemPosition();
// m_car.conType = m_types[ position ];

View file

@ -71,7 +71,6 @@ public class GameUtils {
XwJNI.game_dispose( gamePtr );
gi.setInProgress( false );
gi.fixup();
gamePtr = XwJNI.initJNI();
XwJNI.game_makeNewGame( gamePtr, gi, JNIUtilsImpl.get(),
@ -408,7 +407,6 @@ public class GameUtils {
if ( forceNew || !madeGame ) {
gi.setInProgress( false );
gi.fixup();
XwJNI.game_makeNewGame( gamePtr, gi, JNIUtilsImpl.get(),
cp, dictBytes, gi.dictName );
}

View file

@ -191,36 +191,6 @@ public class CurGameInfo {
return !consistent;
}
/**
* fixup: if we're pretending some players don't exist, move them
* up and make externally (i.e. in the jni world) visible fields
* consistent.
*/
public void fixup()
{
// if ( m_nVisiblePlayers < nPlayers ) {
// Assert.assertTrue( serverRole == DeviceRole.SERVER_ISCLIENT );
// for ( int ii = 0; ii < nPlayers; ++ii ) {
// // Assert.assertTrue( m_visiblePlayers[ii] >= ii );
// if ( m_visiblePlayers[ii] != ii ) {
// LocalPlayer tmp = players[ii];
// players[ii] = players[m_visiblePlayers[ii]];
// players[m_visiblePlayers[ii]] = tmp;
// m_visiblePlayers[ii] = ii;
// }
// }
// nPlayers = m_nVisiblePlayers;
// }
// if ( !m_inProgress && serverRole != DeviceRole.SERVER_ISSERVER ) {
// for ( int ii = 0; ii < nPlayers; ++ii ) {
// players[ii].isLocal = true;
// }
// }
}
public String[] visibleNames( Context context )
{
String[] names = new String[nPlayers];

View file

@ -1,43 +0,0 @@
# -*-mode: Makefile; coding: windows-1250; -*-
# Copyright 2002-2008 by Eric House (xwords@eehouse.org). All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
XWLANG=Czech-CP1250
LANGCODE=cs_CS
TARGET_TYPE ?= PALM
include ../Makefile.2to8
include ../Makefile.langcommon
SOURCEDICT ?= $(XWDICTPATH)/$(XWLANG)/czech2_5.dict.gz
$(XWLANG)Main.dict.gz: $(SOURCEDICT) Makefile
export LC_ALL=$(LANGCODE); \
zcat $< | \
tr [aábcèdïeéìfghiíjklmnòoóprøsšt<EFBFBD>uúùvxyýzž] [AÁBCÈDÏEÉÌFGHIÍJKLMNÒOÓPRØSŠT<EFBFBD>UÚÙVXYÝZŽ] | \
grep '^[AÁBCÈDÏEÉÌFGHIÍJKLMNÒOÓPRØSŠT<C5A0>UÚÙVXYÝZŽ]\+$$' | \
gzip -c > $@
# Everything but creating of the Main.dict file is inherited from the
# "parent" Makefile.langcommon in the parent directory.
clean: clean_common
rm -f $(XWLANG)Main.dict.gz *.bin $(XWLANG)*.pdb $(XWLANG)*.seb
help:
@echo 'make [SOURCEDICT=$(XWDICTPATH)/$(XWLANG)/czech2_5.dict.gz]'

View file

@ -1,84 +0,0 @@
# -*- coding: windows-1250; mode: conf; -*-
# Copyright 2002-2008 by Eric House (xwords@eehouse.org). All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
LANGCODE:cs_CZ
CHARSET:windows-1250
# deal with DOS files
LANGFILTER: tr -d '\r'
# tr seems to work on systems that don't know the Czech locale, but
# grep does not. So don't use grep, e.g. to eliminate words
# containing letters not in our alphabet. Instead, pass the -r flag
# via D2DARGS so they're dropped.
LANGFILTER: | tr [aábcèdïeéìfghiíjklmnòoóprøsšt<C5A1>uúùvxyýzž] [AÁBCÈDÏEÉÌFGHIÍJKLMNÒOÓPRØSŠT<C5A0>UÚÙVXYÝZŽ]
LANGFILTER: | sort -u
# presence of high-ascii means we must not pass -nosort
D2DARGS: -term 10 -r
LANGINFO: <p>This BYOD language works on Czech wordlists encoded in
LANGINFO: windows-1250 and produces dictionaries that should work on
LANGINFO: windows-1250-localized systems. If your Czech wordlist is
LANGINFO: iso-8859-2-encoded, go back and choose Czech-ISO8859-2. </p>
# High bit means "official". Next 7 bits are an enum where
# Czech-CP1250==0x10. Low byte is padding.
XLOC_HEADER:0x9000
#COUNT VAL FACE
<BEGIN_TILES>
2 0 {"_"}
5 1 'A'
2 2 'Á'
2 3 'B'
3 2 'C'
1 4 'È'
3 1 'D'
1 8 'Ï'
5 1 'E'
2 3 'É'
2 3 'Ì'
1 5 'F'
1 5 'G'
3 2 'H'
4 1 'I'
3 2 'Í'
2 2 'J'
3 1 'K'
3 1 'L'
3 2 'M'
5 1 'N'
1 6 'Ò'
6 1 'O'
1 7 'Ó'
3 1 'P'
3 1 'R'
2 4 'Ø'
4 1 'S'
2 4 'Š'
4 1 'T'
1 7 '<27>'
3 2 'U'
1 5 'Ú'
1 4 'Ù'
4 1 'V'
1 10 'X'
2 2 'Y'
2 4 'Ý'
2 2 'Z'
1 4 'Ž'
<END_TILES>

View file

@ -1,43 +0,0 @@
# -*-mode: Makefile; coding: iso-8859-2; -*-
# Copyright 2002-2008 by Eric House (xwords@eehouse.org). All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
XWLANG=Czech-ISO8859-2
LANGCODE=cs_CS
TARGET_TYPE ?= PALM
include ../Makefile.2to8
include ../Makefile.langcommon
SOURCEDICT ?= $(XWDICTPATH)/$(XWLANG)/czech2_10_iso.dict.gz
$(XWLANG)Main.dict.gz: $(SOURCEDICT) Makefile
export LC_ALL=$(LANGCODE); \
zcat $< | \
tr [aábcèdïeéìfghiíjklmnòoóprøs¹t»uúùvxyýz¾] [AÁBCÈDÏEÉÌFGHIÍJKLMNÒOÓPRØS©T«UÚÙVXYÝZ®] | \
grep '^[AÁBCÈDÏEÉÌFGHIÍJKLMNÒOÓPRØS©T«UÚÙVXYÝZ®]\+$$' | \
gzip -c > $@
# Everything but creating of the Main.dict file is inherited from the
# "parent" Makefile.langcommon in the parent directory.
clean: clean_common
rm -f $(XWLANG)Main.dict.gz *.bin $(XWLANG)*.pdb $(XWLANG)*.seb
help:
@echo 'make [SOURCEDICT=$(XWDICTPATH)/$(XWLANG)/czech2_5.dict.gz]'

View file

@ -1,84 +0,0 @@
# -*- coding: iso-8859-2; mode: conf; -*-
# Copyright 2002-2008 by Eric House (xwords@eehouse.org). All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
LANGCODE:cs_CZ
CHARSET:iso-8859-2
# deal with DOS files
LANGFILTER: tr -d '\r'
# tr seems to work on systems that don't know the Czech locale, but
# grep does not. So don't use grep, e.g. to eliminate words
# containing letters not in our alphabet. Instead, pass the -r flag
# via D2DARGS so they're dropped.
LANGFILTER: | tr [aábcèdïeéìfghiíjklmnòoóprøs¹t»uúùvxyýz¾] [AÁBCÈDÏEÉÌFGHIÍJKLMNÒOÓPRØS©T«UÚÙVXYÝZ®]
LANGFILTER: | sort -u
# presence of high-ascii means we must not pass -nosort
D2DARGS: -term 10 -r
LANGINFO: <p>This BYOD language works on Czech wordlists encoded in
LANGINFO: iso-8859-2 and produces dictionaries that should work on
LANGINFO: iso-8859-2-localized systems. If your Czech wordlist is
LANGINFO: windows-1250-encoded, go back and choose Czech-CP1250. </p>
# High bit means "official". Next 7 bits are an enum where
# Czech-ISO8859-2==0x11. Low byte is padding.
XLOC_HEADER:0x9100
#COUNT VAL FACE
<BEGIN_TILES>
2 0 {"_"}
5 1 'A'
2 2 'Á'
2 3 'B'
3 2 'C'
1 4 'È'
3 1 'D'
1 8 'Ï'
5 1 'E'
2 3 'É'
2 3 'Ì'
1 5 'F'
1 5 'G'
3 2 'H'
4 1 'I'
3 2 'Í'
2 2 'J'
3 1 'K'
3 1 'L'
3 2 'M'
5 1 'N'
1 6 'Ò'
6 1 'O'
1 7 'Ó'
3 1 'P'
3 1 'R'
2 4 'Ø'
4 1 'S'
2 4 '©'
4 1 'T'
1 7 '«'
3 2 'U'
1 5 'Ú'
1 4 'Ù'
4 1 'V'
1 10 'X'
2 2 'Y'
2 4 'Ý'
2 2 'Z'
1 4 '®'
<END_TILES>

View file

@ -29,7 +29,7 @@ SOURCEDICT ?= $(XWDICTPATH)/Czech/Czech.2-1-6.dict.gz
$(XWLANG)Main.dict.gz: $(SOURCEDICT) Makefile
zcat $< | tr -d '\r' | \
tr [aábcčdďeéěfghiíjklmnňoóprřsštťuúůvxyýzž] [AÁBCČDĎEÉĚFGHIÍJKLMNŇOÓPRŘSŠTŤUÚŮVXYÝZŽ] | \
sed 's,.,\U\0,g' | \
grep '^[AÁBCČDĎEÉĚFGHIÍJKLMNŇOÓPRŘSŠTŤUÚŮVXYÝZŽ]*$$' | \
gzip -c > $@

View file

@ -30,7 +30,8 @@ SOURCEDICT ?= $(XWDICTPATH)/German/HansGerman.dict.gz
$(XWLANG)Main.dict.gz: $(SOURCEDICT) Makefile
zcat $< \
| tr [a-zäöü] [A-ZÄÖÜ] \
| iconv -f iso88591 -t utf8 \
| sed 's,.,\U\0,g' \
| sed -e 's/ß/SS/g' \
| grep '^[A-ZÄÖÜ]*$$' \
| gzip -c > $@

View file

@ -29,7 +29,7 @@ SOURCEDICT ?= $(XWDICTPATH)/Slovak/slovnik_scrabble.dict.gz
$(XWLANG)Main.dict.gz: $(SOURCEDICT) Makefile
zcat $< | tr -d '\r' | \
tr [aáäbcčdďeéfghiíjklĺľmnňoôóprŕsštťuúvxyýzž] [AÁÄBCČDĎEÉFGHIÍJKLĹĽMNŇOÔÓPRŔSŠTŤUÚVXYÝZŽ] | \
sed 's,.,\U\0,g' | \
grep '^[AÁÄBCČDĎEÉFGHIÍJKLĹĽMNŇOÔÓPRŔSŠTŤUÚVXYÝZŽ]*$$' | \
gzip -c > $@