~vcs-imports-ii/gnubg/trunk

237 by gtw
Started work on SGF file handling.
1
/*
2
 * sgf.h
3
 *
4
 * by Gary Wong <gtw@gnu.org>, 2000
5
 *
6
 * This program is free software; you can redistribute it and/or modify
3944 by ace
*** empty log message ***
7
 * it under the terms of version 3 or later of the GNU General Public License as
237 by gtw
Started work on SGF file handling.
8
 * published by the Free Software Foundation.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 *
5379 by mdpetch
Standardized the code formatting with indent -kr -l120 -fc1 -sc -nut -psl
19
 * $Id: sgf.h,v 1.10 2013/06/16 02:16:20 mdpetch Exp $
237 by gtw
Started work on SGF file handling.
20
 */
21
5158 by plm
Fix bug #36201
22
#ifndef SGF_H
23
#define SGF_H
237 by gtw
Started work on SGF file handling.
24
3829 by Superfly_Jon
Made minor changes to code after run through lint code checker
25
#include "list.h"
237 by gtw
Started work on SGF file handling.
26
#include <stdio.h>
27
28
typedef struct _property {
5379 by mdpetch
Standardized the code formatting with indent -kr -l120 -fc1 -sc -nut -psl
29
    char ach[2];                /* 2 character tag; ach[ 1 ] = 0 for 1 character tags */
30
    listOLD *pl;                /* Values */
237 by gtw
Started work on SGF file handling.
31
} property;
32
5263 by plm
Silence compiler warning
33
extern void (*SGFErrorHandler) (const char *szMessage, int fParseError);
237 by gtw
Started work on SGF file handling.
34
35
/* Parse an SGF file, and return a syntax tree.  The tree is saved as a list
5379 by mdpetch
Standardized the code formatting with indent -kr -l120 -fc1 -sc -nut -psl
36
 * of game trees; each game tree is a list where the first element is the
37
 * initial sequence of SGF nodes and any other elements are alternate
38
 * variations (each variation is itself a game tree).  Sequences of SGF
39
 * nodes are also stored as lists; each element is a single SGF node.
40
 * Nodes consist of yet MORE lists; each element is a "property" struct
41
 * as defined above.
42
 * 
43
 * If there are any errors in the file, SGFParse calls SGFErrorHandler
44
 * (if set), or complains to stderr (otherwise). */
4038 by Superfly_Jon
Misc changes
45
extern listOLD *SGFParse(FILE * pf);
547 by gtw
Started loading/saving statistics.
46
47
/* The following properties are defined for GNU Backgammon SGF files:
5379 by mdpetch
Standardized the code formatting with indent -kr -l120 -fc1 -sc -nut -psl
48
 * 
49
 * A  (M)  - analysis (gnubg private)
50
 * AB (S)  - add black (general SGF)
51
 * AE (S)  - add empty (general SGF)
52
 * AN (GI) - annotation (general SGF) (not currently used)
53
 * AP (R)  - application (general SGF)
54
 * AR      - arrow (general SGF) (not currently used)
55
 * AW (S)  - add white (general SGF)
56
 * B (M)   - black move (general SGF)
57
 * BL (M)  - black time left (general SGF) (not currently used)
58
 * BM (M)  - bad move (general SGF)
59
 * BR (GI) - black rank (general SGF) (not currently used)
60
 * BT (GI) - black team (general SGF) (not currently used)
61
 * C       - comment (general SGF)
62
 * CA (R)  - character set (general SGF) (not currently used)
63
 * CP      - Whoops!!  We use this for "cube position", but it's actually
64
 * reserved for "copyright"...
65
 * CR      - circle (general SGF) (not currently used)
66
 * CV (S)  - cube value (backgammon)
67
 * DA (M)  - double analysis (gnubg private)
68
 * DD      - dim points (general SGF) (not currently used)
69
 * DI (S)  - dice (should be a standard backgammon property)
70
 * DM      - even position (general SGF) (not currently used)
71
 * DO (M)  - doubtful (general SGF)
72
 * DT (GI) - date (general SGF) (not currently used)
73
 * EV (GI) - event (general SGF) (not currently used)
74
 * FF (R)  - file format (general SGF)
75
 * FG      - figure (general SGF) (not currently used)
76
 * GB      - good for black (general SGF)
77
 * GC (GI) - game comment (general SGF) (not currently used)
78
 * GM (R)  - game (general SGF)
79
 * GN (GI) - game name (general SGF) (not currently used)
80
 * GS (GI) - game statistics (gnubg private)
81
 * GW      - good for white (general SGF)
82
 * HO      - hotspot (general SGF) (not currently used)
83
 * IT (M)  - interesting (general SGF)
84
 * KO (M)  - illegal move (general SGF) (not currently used)
85
 * LB      - label (general SGF) (not currently used)
86
 * LN      - line (general SGF) (not currently used)
87
 * LU (M)  - luck (gnubg private)
88
 * MA      - mark (general SGF) (not currently used)
89
 * MI (GI) - match information (backgammon)
90
 * MN (M)  - move number (general SGF) (not currently used)
91
 * N       - node name (general SGF) (not currently used)
92
 * ON (GI) - opening (general SGF) (not currently used)
93
 * OT (GI) - overtime (general SGF) (not currently used)
94
 * PB (GI) - player black (general SGF)
95
 * PC (GI) - place (general SGF) (not currently used)
96
 * PL (S)  - player (general SGF)
97
 * PM      - print move (general SGF) (not currently used)
98
 * PW (GI) - player white (general SGF)
99
 * RE (GI) - result (general SGF)
100
 * RO (GI) - round (general SGF) (not currently used)
101
 * RU (GI) - rules (general SGF)
102
 * SL      - selected (general SGF) (not currently used)
103
 * SO (GI) - source (general SGF) (not currently used)
104
 * SQ      - square (general SGF) (not currently used)
105
 * ST (R)  - style (general SGF) (not currently used)
106
 * TE (M)  - good move (general SGF)
107
 * TM (GI) - time limit (general SGF) (not currently used)
108
 * TR      - triangle (general SGF) (not currently used)
109
 * UC      - unclear (general SGF) (not currently used)
110
 * US (GI) - user (general SGF) (not currently used)
111
 * V       - value (general SGF) (not currently used)
112
 * VW      - view (general SGF) (not currently used)
113
 * W (M)   - white move (general SGF)
114
 * WL (M)  - white time left (general SGF) (not currently used)
115
 * WR (GI) - white rank (general SGF) (not currently used)
116
 * WT (GI) - white team (general SGF) (not currently used)
117
 * 
118
 */
237 by gtw
Started work on SGF file handling.
119
#endif