My Project
|
#include "board.h"
#include "move.h"
#include "options.h"
#include "util.h"
#include "ui.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/tcp.h>
Classes | |
struct | Text |
struct | GGSClock |
struct | GGSPlayer |
struct | GGSMatchType |
struct | GGSMatchOff |
struct | GGSMatchOn |
struct | GGSRequest |
struct | GGSBoard |
struct | GGSAdmin |
struct | GGSEvent |
struct | GGSClient |
Macros | |
#define | WORD_SIZE 256 |
#define | GGS_BOARD_SIZE 256 |
#define | MOVELIST_SIZE 256 |
Typedefs | |
typedef struct Text | Text |
typedef struct GGSClock | GGSClock |
typedef struct GGSPlayer | GGSPlayer |
typedef struct GGSMatchType | GGSMatchType |
typedef struct GGSMatchOff | GGSMatchOff |
typedef struct GGSMatchOn | GGSMatchOn |
typedef struct GGSRequest | GGSRequest |
typedef struct GGSBoard | GGSBoard |
typedef struct GGSAdmin | GGSAdmin |
typedef struct GGSEvent | GGSEvent |
typedef struct GGSClient | GGSClient |
Functions | |
static void | text_init (Text *text) |
text_init More... | |
static void | text_add_line (Text *text, const char *line) |
text_add_line More... | |
static void | text_print (Text *text, FILE *f) |
text_print More... | |
static void | text_free (Text *text) |
text_free More... | |
static char * | ggs_parse_line (const char *buffer, char **line) |
ggs_parse_line More... | |
static char * | ggs_parse_text (const char *buffer, Text *text) |
ggs_parse_text More... | |
static bool | ggs_parse_int (int *value, const char *word) |
ggs_parse_int More... | |
static bool | ggs_parse_double (double *value, const char *word) |
ggs_parse_double More... | |
static bool | ggs_parse_move (int *move, const char *word) |
ggs_parse_move More... | |
static bool | ggs_parse_time (int *time, const char *word) |
ggs_parse_move More... | |
static bool | ggs_parse_clock (GGSClock *ggsclock, const char *line) |
ggs_parse_clock More... | |
static bool | ggs_player_set (GGSPlayer *player, const char *name, const char *rating) |
ggs_player_set More... | |
static void | ggs_match_type_set (GGSMatchType *type, const char *word) |
ggs_match_type_set More... | |
static void | ggs_player_free (GGSPlayer *player) |
ggs_player_free More... | |
static void | ggs_MBR_free (void *v) |
ggs_MBR_free More... | |
static bool | ggs_has_player (GGSPlayer *player, const char *me) |
ggs_match_check_destination More... | |
static bool | ggs_request (GGSRequest *request, Text *text) |
ggs_request More... | |
static bool | ggs_match_on (GGSMatchOn *match, Text *text) |
ggs_match_on More... | |
static bool | ggs_match_off (GGSMatchOff *match, Text *text) |
ggs_match_off More... | |
static bool | ggs_board (GGSBoard *board, Text *text) |
ggs_board More... | |
static bool | ggs_os_on (Text *text) |
ggs_os_on More... | |
static bool | ggs_os_off (Text *text) |
ggs_os_off More... | |
static bool | ggs_saio_delay (Text *text, long long *delay) |
ggs_saio_delay More... | |
static int | ggs_admin (GGSAdmin *admin, Text *text) |
ggs_admin More... | |
static bool | ggs_ready (Text *text) |
ggs_ready More... | |
static bool | ggs_alert (Text *text) |
ggs_alert More... | |
static bool | ggs_login (Text *text) |
ggs_login More... | |
static bool | ggs_password (Text *text) |
ggs_password More... | |
static void * | ggs_event_loop (void *v) |
ggs_event_loop More... | |
static void | ggs_event_init (GGSEvent *event) |
ggs_event_init More... | |
static void | ggs_event_free (GGSEvent *event) |
ggs_event_free More... | |
static bool | ggs_event_peek (GGSEvent *event, Text *text) |
ggs_event_peek More... | |
static void | ggs_client_free (GGSClient *client) |
ggs_client_free More... | |
static void | ggs_client_send (GGSClient *client, const char *fmt,...) |
ggs_client_send More... | |
static void | ggs_client_refresh (GGSClient *client) |
ggs_client_refresh More... | |
static void | ui_login (UI *ui) |
ui_login More... | |
static void | ui_ggs_ponder (UI *ui, int turn) |
ui_ggs_ponder More... | |
static void | ui_ggs_play (UI *ui, int turn) |
ui_ggs_play More... | |
static void | ui_ggs_join (UI *ui) |
ui_ggs_join More... | |
static void | ui_ggs_update (UI *ui) |
ui_ggs_update More... | |
void | ui_init_ggs (UI *ui) |
ui_init_ggs More... | |
void | ui_loop_ggs (UI *ui) |
ui_loop_ggs More... | |
void | ui_free_ggs (UI *ui) |
ui_free_ggs More... | |
Variables | |
static Log | ggs_log [1] |
static char | admin_list [][16] = {"delorme", "dan", "mic", "romano", "HCyrano", "romelica", ""} |
static const GGSClock | GGS_CLOCK_INI = {0, 0, 0, 0, 0, 0, 0, 0, 0} |
static const GGSMatchType | GGS_MATCH_TYPE_INI = {0, 0, 0, 0, 0, 0, 0, 0} |
A ggs client in C language.
#define GGS_BOARD_SIZE 256 |
Board Size
#define MOVELIST_SIZE 256 |
Move list size
#define WORD_SIZE 256 |
Word size
typedef struct GGSMatchOff GGSMatchOff |
typedef struct GGSMatchOn GGSMatchOn |
typedef struct GGSMatchType GGSMatchType |
Match type description
typedef struct GGSRequest GGSRequest |
ggs_admin
Parse an admin command from a GGS input text. Admin are authorised people (see list above) that can interact with Edax. Usually, edax will repeat the command to GGS.
admin | An authorised person. |
text | GGS input text. |
|
static |
ggs_alert
Parse a "ALERT" from a GGS input text.
text | GGS input text. |
ggs_board
Parse a "GGS board" from a GGS input text.
board | GGS board. |
text | GGS input text. |
|
static |
ggs_client_free
Free the GGS client structure.
client | GGS client. |
|
static |
ggs_client_refresh
Periodically send a message to the GGS server. This is a workaround to avoid spurious deconnection from GGS.
client | GGS client. |
|
static |
ggs_client_send
Send a message to the GGS server. This function uses vnsprintf with some workaround for MS-Windows incorrect behaviour.
client | GGS client. |
fmt | Text format. |
... | other args. |
|
static |
|
static |
|
static |
ggs_event_loop
GGS event loop. Read all inputs from GGS within a thread.
v | Event. |
|
static |
ggs_match_check_destination
Check if Edax is concerned by the match.
player | GGS player. |
me | Edax's login name. |
|
static |
ggs_login
Parse a login request from a GGS input text.
text | GGS input text. |
|
static |
ggs_match_off
Parse a "match off" from a GGS input text.
match | GGS match off. |
text | GGS input text. |
|
static |
ggs_match_on
Parse a "match on" from a GGS input text.
match | GGS match on. |
text | GGS input text. |
|
static |
ggs_match_type_set
Translate input word into a type of match.
type | GGS match type. |
word | Word. |
|
static |
ggs_MBR_free
Free a GGS MatchOn/Off / Board / Request structure.
v | GGS match/Board or Request structure. |
|
static |
ggs_os_off
Parse a "os off" from a GGS input text. PS: os = (o)thello (s)ervice
text | GGS input text. |
|
static |
ggs_os_on
Parse a "os on" from a GGS input text. PS: os = (o)thello (s)ervice
text | GGS input text. |
|
static |
ggs_parse_clock
Translate input word into a GGS clock time.
ggsclock | GGS clock. |
line | Text. |
|
static |
ggs_parse_double
Translate input word into a double.
value | double. |
word | Word. |
|
static |
ggs_parse_int
Translate input word into an integer.
value | integer. |
word | Word. |
|
static |
ggs_parse_line
Parse a ('
' terminated) line from a buffer.
buffer | buffer. |
line | Newly allocated line of text. |
|
static |
ggs_parse_move
Translate input word into a move.
move | Move. |
word | Word. |
|
static |
ggs_parse_text
Parse a text (ie a set of lines) from a buffer.
buffer | Buffer. |
text | Text. |
|
static |
ggs_parse_move
Translate input word into time (as ms).
time | Time. |
word | Word. |
|
static |
ggs_password
Parse a login password from a GGS input text.
text | GGS input text. |
|
static |
ggs_player_free
Free a GGS player structure.
player | GGS player. |
|
static |
ggs_player_set
Set player's name and rating.
player | GGS player. |
name | Name. |
rating | Rating. |
|
static |
ggs_ready
Parse a "READY" from a GGS input text.
text | GGS input text. |
|
static |
ggs_request
Parse a request from a GGS input text.
request | GGS request. |
text | GGS input text. |
|
static |
ggs_saio_delay
Parse a "saio" from a GGS input text. When Saio is building is book, it tells when it will be available again. Edax will automatically re-start asking him to play again at the right moment.
text | GGS input text. |
delay | Time delay (in ms). |
|
static |
|
static |
|
static |
void ui_free_ggs | ( | UI * | ui | ) |
ui_free_ggs
Free GGS.
ui | User Interface. |
|
static |
ui_ggs_join
Join a new game. This is a new game from Edax point of view. This may be a saved game from GGS side.
ui | User Interface. |
|
static |
|
static |
ui_ggs_ponder
Ponder, ie search during opponent time.
ui | User Interface. |
turn | Edax's color. |
|
static |
ui_ggs_update
Update a game.
ui | User Interface. |
void ui_init_ggs | ( | UI * | ui | ) |
ui_init_ggs
Init GGS interface.
ui | User Interface. |
|
static |
ui_login
Connect to GGS.
ui | User Interface. |
void ui_loop_ggs | ( | UI * | ui | ) |
ui_loop_ggs
GGS main loop. Here the input from both the user and GGS server is interpreted.
ui | User Interface. |
|
static |
|
static |
|
static |
|
static |