diff options
Diffstat (limited to 'apps/plugins/chessbox/chessbox_pgn.h')
-rw-r--r-- | apps/plugins/chessbox/chessbox_pgn.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/apps/plugins/chessbox/chessbox_pgn.h b/apps/plugins/chessbox/chessbox_pgn.h new file mode 100644 index 0000000000..541bbc8b81 --- /dev/null +++ b/apps/plugins/chessbox/chessbox_pgn.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 Mauricio Peccorini | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "plugin.h" | ||
21 | #include "gnuchess.h" | ||
22 | |||
23 | /* structure to represent the plies */ | ||
24 | struct pgn_ply_node { | ||
25 | unsigned short player; | ||
26 | char pgn_text[9]; | ||
27 | unsigned short row_from; | ||
28 | unsigned short column_from; | ||
29 | unsigned short row_to; | ||
30 | unsigned short column_to; | ||
31 | unsigned short taken_piece; | ||
32 | unsigned short promotion_piece; | ||
33 | bool enpassant; | ||
34 | bool castle; | ||
35 | bool promotion; | ||
36 | struct pgn_ply_node* prev_node; | ||
37 | struct pgn_ply_node* next_node; | ||
38 | }; | ||
39 | |||
40 | /* structure to list the games */ | ||
41 | struct pgn_game_node { | ||
42 | unsigned short game_number; | ||
43 | char white_player[20]; | ||
44 | char black_player[20]; | ||
45 | char game_date[11]; | ||
46 | char result[8]; | ||
47 | int pgn_line; | ||
48 | struct pgn_ply_node* first_ply; | ||
49 | struct pgn_game_node* next_node; | ||
50 | }; | ||
51 | |||
52 | /* Return the list of games in a PGN file. | ||
53 | * Parsing of the games themselves is postponed until | ||
54 | * the user selects a game, that obviously saves processing | ||
55 | * and speeds up response when the user selects the file | ||
56 | */ | ||
57 | struct pgn_game_node* pgn_list_games(struct plugin_api* api, const char* filename); | ||
58 | |||
59 | /* Show the list of games found in a file and allow the user | ||
60 | * to select a game to be parsed and showed | ||
61 | */ | ||
62 | struct pgn_game_node* pgn_show_game_list(struct plugin_api* api, struct pgn_game_node* first_game); | ||
63 | |||
64 | /* Parse the pgn string of a game and assign it to the move | ||
65 | * list in the structure | ||
66 | */ | ||
67 | void pgn_parse_game(struct plugin_api* api, const char* filename, struct pgn_game_node* selected_game); | ||