Commit graph

61 commits

Author SHA1 Message Date
Eric House
ba132bb23d Replace LangCode with ISOCode, linux and common side
This will break the Android build, but it's the order in which I
work...
2022-06-05 09:07:01 -07:00
Eric House
4190926c0a add isoCode to DictInfo, and load it 2022-06-04 14:18:00 -07:00
Eric House
0e665a990e add langName and isoCode to dict struct 2022-05-28 09:00:20 -07:00
Eric House
9568e4ab03 move extra counts into header so new dicts backward compatible 2022-04-01 07:51:13 +02:00
Eric House
cdc77eaf68 add board sizes to wordlist format (English only)
Modify language metadata to have possibly different counts of tiles
for different board sizes. Make the necessary changes for loading such
files. Works on linux version at least. Only English will build for
now thanks to changes in info.txt format.
2022-04-01 07:51:13 +02:00
Eric House
372d722b58 make number of tiles proportional to board size
Until there's a way to specify specifically for each size, adjusting
from the built-in 15x15 tileset works reasonably well.
2022-04-01 07:51:13 +02:00
Eric House
633896292a snapshot: drawing empty board 2021-03-19 14:26:18 -07:00
Eric House
35bdd2282e limit pattern parse by max length of tiles 2020-12-27 11:53:36 -08:00
Eric House
b8f359c3e5 add filtering to wordlist browser
Add a basic regular expression engine to the dictiter, and to the UI add
the ability to filter for "starts with", "contains" and "ends with",
which translate into ANDed RE_*, _*RE_* and _*RE, respectively (with
_ standing for blank/wildcard). The engine's tightly integrated with the
next/prevWord() functions for greatest possible speed, but unless
there's no pattern does slow things down a bit (especially when "ENDS
WITH" is used.) The full engine is not exposed (users can't provide raw
REs), and while the parser will accept nesting (e.g. ([AB]_*[CD]){2,5}
to mean words from 2-5 tiles long starting with A or B and ending with C
or D) the engine can't handle it. Which is why filtering for word length
is handled separately from REs (but also tightly integrated.)

Users can enter strings that don't map to tiles. They now get an
error. It made sense for the error alert to have a "Show tiles"
button, so there's now a dialog listing all the tiles in a wordlist,
something the browser has needed all along.
2020-08-05 09:47:44 -07:00
Eric House
0e9661aa19 fix search of wordlists containing duplicates
Hungarian is unique (so far) in having two-letter tiles that can be
spelled with one-letter tiles AND in allowing words to be spelled both
ways. This crashed search based on strings because there were
duplicates. So now search is done by tile arrays. Strings are first
converted, and then IFF there is more than one tile array result AND the
wordlist has the new flag indicating that duplicates are possible, THEN
the user is asked to choose among the possible tile spellings of the
search string.
2020-05-04 08:33:15 -07:00
Eric House
07f4774a7c refactor so common dictnry does more work
Linux and Android duplicated all the code to parse a wordlist file --
and shared a bug that needed fixing. So now most of that is in a common/
function both call, and the bug -- failing to mask out flag bits I don't
care about -- is fixed.
2020-05-01 09:18:27 -07:00
Eric House
e34da24393 revert wordlist changes
There are bugs there still to resolve and I need to ship. Will return
once they're fixed.
2020-04-29 10:15:58 -07:00
Eric House
b2bc4e34cf do wordlist lookups using tiles not chars
Fixing a problem with languages (like Hungarian) where it's legal to use
a two-letter tile or two single-letter tiles to play the same word. When
words are seen, or searched for, as char-arrays, there are
duplicates. Current code crashes, but there's also risk the user gets
unexpected behavior. Crash is fixed, and foundation laid for better UX,
by doing all searches for tile arrays. If a search string translates to
more than one tile array the user must choose. For that choice to make
sense it's now possible to translate tile[] to char[] with a delimiter
between the tile strings.
2020-04-28 13:29:12 -07:00
Eric House
cfaa6849b2 pass env into dict-related methods
I was getting an occasional crash using a stale env to delete a dict's
resources because the dict was cacheing the env that created it. Dumb!
Using the thread->env mapping stuff worked, but that felt risky and so I
tried just passing it in. It's safe, and involves an amount of change I
can tolerate. So likely going that way.
2020-04-26 13:39:16 -07:00
Eric House
ed90c9c16d implement util->dutil split for Android
So now all jni code uses a single dutil context, but also a single
mempool and jniutil instance instead of new instances of the latter two
per game and dict-iteration.
2018-07-05 08:32:19 -07:00
Eric House
b77d529099 fix linux-side compile errors 2014-08-21 07:15:20 -07:00
Eric House
b869940997 fix another 64-bit bug, this one prevening opening new SOWPODS. 2014-03-12 19:24:00 -07:00
Eric House
2bb9a12b63 add missing (for android build) header 2014-03-11 22:04:30 -07:00
Eric House
d1a9b716bb protect refcount operations with mutex 2014-03-11 22:01:11 -07:00
Eric House
7d8f5844bd fix to compile without DEBUG defined 2014-03-11 19:38:08 -07:00
Eric House
3c32ca6402 add option to log callsites of dictmgr put and get for easier ref leak tracking 2014-03-10 18:59:10 -07:00
Eric House
a7c114e3f9 refcount dicts. Model "owns" its copy and so increments the refcount when gaining one and decrements the count on any being replaced (and on all on exit). This is setting up the real change, which is to let the java world wrap dicts in objects that hang onto them until they're destroyed, which should fix problems where dicts are referenced after they've been destroyed. 2014-03-08 20:57:27 -08:00
Eric House
541fc546ab remove that bit from flags -- since we already do the right thing for it. 2013-04-20 19:46:35 -07:00
Eric House
07cfdad699 fix to support synonyms within specials too -- for linux only so far.
Seems to work, though the dawg2dict.pl script is broken.
2013-04-09 07:43:04 -07:00
Eric House
3a628f4375 load new-format dict into linux client, display default faces
correctly, and search using alternate as well as default faces.  Next:
support for alternate specials.
2013-04-06 11:43:57 -07:00
Eric House
7d51ee99d9 add dict_getMd5Sum 2012-09-08 10:09:31 -07:00
Eric House
5fa9b60846 add md5Sum field to dict struct, and on linux load it if present,
otherwise calculate it.  In DEBUG builds always calculate and assert
they match.
2012-09-07 20:34:06 -07:00
Eric House
9d174601b9 add field, and getter, for new dict header description string, and
load it in linux client.
2012-08-26 20:58:28 -07:00
Eric House
464696566d get rid of NODE_CAN_4. Not change to post-compiled code 2012-08-01 20:29:15 -07:00
Andy2
210c59ef9b move bonus square values into model: add API to set an array, and API
to query model for values.  Now everybody else queries new model API
rather than client via util_getSquareBonus(), model uses its internal
values if present otherwise falls back to util_getSquareBonus(), and
internalizes the array as part of the game.  Now it should be easier
to have different bonus patterns and to have them exchanged as part of
network game init.
2011-11-16 19:01:11 -08:00
Eric House
268f018140 add dict sanity check that will, I hope, catch corrupt dicts. 2011-11-09 06:51:12 -08:00
Andy2
88f556356c dict_tileForString -> dict_tilesForString 2011-10-31 20:56:48 -07:00
Andy2
69b1b4da27 break dict iteration stuff out into new files. No code change
otherwise.
2011-10-31 18:30:55 -07:00
Andy2
dc58d123d5 combine params into single struct 2011-10-31 06:34:21 -07:00
Eric House
71450b02b3 use indexing (and add binary search) to double speed of getNthWord 2011-10-28 20:27:16 -07:00
Andy2
fc973079dc add first cut at dict_getNthWord. Works. Is slow. 2011-10-25 06:48:16 -07:00
Andy2
ac214236c4 add code to walk dict backwards as well, and test code that
succesfully walks huge dicts in both directions turning out the same
list of words either way.  Still compile-time disabled.
2011-10-24 18:27:16 -07:00
Andy2
7c7cd82e0a add code to iterate over words in a dict. Works on Linux (iterating
forward only) but disabled at compile time.  Idea's to have a dict
browser.  There was some simple refactoring in common code Android
uses, and that tests fine.
2011-10-21 18:51:33 -07:00
eehouse@eehouse.org
5a21aea2e5 Merge branch 'android_branch' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into android_branch 2011-04-13 06:58:58 -07:00
Eric House
3cc105da0b add ability to dump board (model) as text, protected by ifdef that
will likely only get set on Linux.  Uses lower-case to designate
blanks.  For that and maybe string size assumptions is very broken for
non-ascii languages, including Spanish.
2011-04-13 06:45:22 -07:00
Andy2
002bb40a09 report counts/values using language rather than dictionary name. To
support that, pass lang name from java into jni.
2011-04-11 18:55:42 -07:00
Andy2
e4999acc98 add dict_getWordCount() 2010-12-06 18:24:31 -08:00
Eric House
c4cdc24b78 initial changes to add a header to xwd format so that stuff like
number of words can be included.  Changed to build dicts and linux to
open them.  Android still needs to learn.  Also, some of the tools in
dawg/ need to be fixed to read old-format (pre-utf8) .xwd files.
2010-12-05 19:33:10 -08:00
Andy2
4208c33ecf make lang code support non-conditional 2010-08-25 06:31:38 -07:00
eehouse
bd611bb6f4 implement dictChanged. And so that utf8 dicts could be opened without
their games being drawn (no BoardActivity around) break the two
android-only callbacks out of UtilCtxt and into a new JNIUtils
interface that then requires new handing in C.
2010-02-11 13:27:09 +00:00
ehouse
535e97b855 replace array of indices with array of ptrs for faster & smaller code 2009-09-13 05:28:12 +00:00
ehouse
3a1c2572dd Merge in unicode changes to read in utf-8 dictionary format 2009-09-04 12:30:10 +00:00
ehouse
38a23ba74f Begin changes for utf8 support (mostly from unicode_branch). Dict now
provides tiles as null-terminated const strings ptrs to which can be
passed and stored.  They're utf8 strings.  Old dicts still work,
platform must convert to utf8 on load.
2009-04-05 19:02:21 +00:00
ehouse
6d7a81fce6 change draw api so all available bitmaps (only 2 in current format)
can be passed for tile and cell drawing
2009-01-13 12:57:56 +00:00
ehouse
36627fb051 Add listeners to model so board can be notified whenever dictionary
changes.  Pass dict into draw via new API, removing it from the
draw_begin calls.
2008-09-05 12:11:37 +00:00