int OKToStartUserMove P((int x, int y));
void Reset P((int redraw, int init));
void ResetGameEvent P((void));
+Boolean HasPattern P(( const char * text, const char * pattern ));\r
+Boolean SearchPattern P(( const char * text, const char * pattern ));\r
int LoadGame P((FILE *f, int n, char *title, int useList));
int LoadGameFromFile P((char *filename, int n, char *title, int useList));
int CmailLoadGame P((FILE *f, int n, char *title, int useList));
static void GameListFree P((List *));
static int GameListNewGame P((ListGame **));
+/* [AS] Wildcard pattern matching */
+Boolean
+HasPattern( const char * text, const char * pattern )
+{
+ while( *pattern != '\0' ) {
+ if( *pattern == '*' ) {
+ while( *pattern == '*' ) {
+ pattern++;
+ }
+
+ if( *pattern == '\0' ) {
+ return TRUE;
+ }
+
+ while( *text != '\0' ) {
+ if( HasPattern( text, pattern ) ) {
+ return TRUE;
+ }
+ text++;
+ }
+ }
+ else if( (*pattern == *text) || ((*pattern == '?') && (*text != '\0')) ) {
+ pattern++;
+ text++;
+ continue;
+ }
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+Boolean
+SearchPattern( const char * text, const char * pattern )
+{
+ Boolean result = TRUE;
+
+ if( pattern != NULL && *pattern != '\0' ) {
+ if( *pattern == '*' ) {
+ result = HasPattern( text, pattern );
+ }
+ else {
+ result = FALSE;
+
+ while( *text != '\0' ) {
+ if( HasPattern( text, pattern ) ) {
+ result = TRUE;
+ break;
+ }
+ text++;
+ }
+ }
+ }
+
+ return result;
+}
+
/* Delete a ListGame; implies removint it from a list.
*/
static void GameListDeleteGame(listGame)
int unfinished;\r
};\r
\r
-/* [AS] Wildcard pattern matching */\r
-static BOOL HasPattern( const char * text, const char * pattern )\r
-{\r
- while( *pattern != '\0' ) {\r
- if( *pattern == '*' ) {\r
- while( *pattern == '*' ) {\r
- pattern++;\r
- }\r
-\r
- if( *pattern == '\0' ) {\r
- return TRUE;\r
- }\r
-\r
- while( *text != '\0' ) {\r
- if( HasPattern( text, pattern ) ) {\r
- return TRUE;\r
- }\r
- text++;\r
- }\r
- }\r
- else if( (*pattern == *text) || ((*pattern == '?') && (*text != '\0')) ) {\r
- pattern++;\r
- text++;\r
- continue;\r
- }\r
-\r
- return FALSE;\r
- }\r
-\r
- return TRUE;\r
-}\r
-\r
-static BOOL SearchPattern( const char * text, const char * pattern )\r
-{\r
- BOOL result = TRUE;\r
-\r
- if( pattern != NULL && *pattern != '\0' ) {\r
- if( *pattern == '*' ) {\r
- result = HasPattern( text, pattern );\r
- }\r
- else {\r
- result = FALSE;\r
-\r
- while( *text != '\0' ) {\r
- if( HasPattern( text, pattern ) ) {\r
- result = TRUE;\r
- break;\r
- }\r
- text++;\r
- }\r
- }\r
- }\r
-\r
- return result;\r
-}\r
-\r
/* [AS] Setup the game list according to the specified filter */\r
static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct GameListStats * stats )\r
{\r
{ XtNdefaultDistance, 0 }
};
-/* [AS] Wildcard pattern matching */\r
-static Boolean HasPattern( const char * text, const char * pattern )\r
-{\r
- while( *pattern != '\0' ) {\r
- if( *pattern == '*' ) {\r
- while( *pattern == '*' ) {\r
- pattern++;\r
- }\r
-\r
- if( *pattern == '\0' ) {\r
- return TRUE;\r
- }\r
-\r
- while( *text != '\0' ) {\r
- if( HasPattern( text, pattern ) ) {\r
- return TRUE;\r
- }\r
- text++;\r
- }\r
- }\r
- else if( (*pattern == *text) || ((*pattern == '?') && (*text != '\0')) ) {\r
- pattern++;\r
- text++;\r
- continue;\r
- }\r
-\r
- return FALSE;\r
- }\r
-\r
- return TRUE;\r
-}\r
-\r
-static Boolean SearchPattern( const char * text, const char * pattern )\r
-{\r
- Boolean result = TRUE;\r
-\r
- if( pattern != NULL && *pattern != '\0' ) {\r
- if( *pattern == '*' ) {\r
- result = HasPattern( text, pattern );\r
- }\r
- else {\r
- result = FALSE;\r
-\r
- while( *text != '\0' ) {\r
- if( HasPattern( text, pattern ) ) {\r
- result = TRUE;\r
- break;\r
- }\r
- text++;\r
- }\r
- }\r
- }\r
-\r
- return result;\r
-}\r
-\r
Widget
GameListCreate(name, callback, client_data)
char *name;