mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
b8f359c3e5
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.
51 lines
1.9 KiB
C
51 lines
1.9 KiB
C
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
|
|
/*
|
|
* Copyright 2000-2001 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.
|
|
*/
|
|
|
|
#ifndef _POOL_H_
|
|
#define _POOL_H_
|
|
|
|
#include "comtypes.h"
|
|
#include "mempool.h"
|
|
#include "model.h"
|
|
|
|
void pool_requestTiles( PoolContext* pool, Tile* tiles,
|
|
/*in out*/ XP_U16* maxNum );
|
|
void pool_replaceTiles( PoolContext* pool, const TrayTileSet* tiles );
|
|
void pool_replaceTiles2( PoolContext* pool, XP_U16 nTiles, const Tile* tilesP );
|
|
|
|
void pool_removeTiles( PoolContext* pool, const TrayTileSet* tiles );
|
|
XP_Bool pool_containsTiles( const PoolContext* pool,
|
|
const TrayTileSet* tiles );
|
|
|
|
XP_U16 pool_getNTilesLeft( const PoolContext* pool );
|
|
XP_U16 pool_getNTilesLeftFor( const PoolContext* pool, Tile tile );
|
|
|
|
PoolContext* pool_make( MPFORMAL_NOCOMMA );
|
|
|
|
void pool_destroy( PoolContext* pool );
|
|
void pool_initFromDict( PoolContext* pool, const DictionaryCtxt* dict );
|
|
|
|
void pool_writeToStream( PoolContext* pool, XWStreamCtxt* stream );
|
|
PoolContext* pool_makeFromStream( MPFORMAL XWStreamCtxt* stream );
|
|
|
|
#ifdef DEBUG
|
|
void pool_dumpSelf( const PoolContext* pool );
|
|
#endif
|
|
|
|
#endif
|