root/05/bugfix/sgfpars.h

Revision 41, 2.6 kB (checked in by ug, 5 years ago)

Updated copyright notice

Line 
1 // File: sgfpars.h
2
3 //   Copyright (C) 2001-4 Ulrich Goertz (u@g0ertz.de)
4
5 //   This is part of Kombilo, a go database program.
6
7 //   This program is free software; you can redistribute it and/or modify
8 //   it under the terms of the GNU General Public License as published by
9 //   the Free Software Foundation; either version 2 of the License, or
10 //   (at your option) any later version.
11
12 //   This program is distributed in the hope that it will be useful,
13 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //   GNU General Public License for more details.
16
17 //   You should have received a copy of the GNU General Public License
18 //   along with this program (see doc/license.txt); if not, write to the Free Software
19 //   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 //   The GNU GPL is also currently available at
21 //   http://www.gnu.org/copyleft/gpl.html
22
23 #include "Python.h"
24
25 class SGFError {
26 public:
27   SGFError();
28 };
29
30 char* SGFescape(char* s);
31
32 class Node {
33  public:
34   Node* previous;
35   Node* next;
36   Node* up;
37   Node* down;
38   int numChildren;
39   int level;
40   char* SGFstring;
41   int parsed;
42   PyObject* data;
43
44   int posyD;
45
46   Node(Node* prev, char* SGFst, int lvl) throw(SGFError);
47   ~Node();
48   PyObject* pathToNode();
49   void parseNode() throw(SGFError);
50   PyObject* getData();
51
52   static int sloppy;
53 };
54
55 class Cursor {
56  public:
57   Cursor(char* sgf, int sloppy) throw(SGFError);
58   ~Cursor();
59  
60   int atStart;
61   int atEnd;
62   int height;
63   int width;
64   Node* root;
65   Node* currentN;
66   int posx;
67   int posy;
68
69   int noChildren();
70   PyObject* currentNode();
71   void parse(char* s) throw(SGFError);
72   void game(int n) throw(SGFError);
73   PyObject* next(int n=0) throw(SGFError);
74   PyObject* previous() throw(SGFError);
75   PyObject* getRootNode(int n) throw(SGFError);
76   void updateCurrentNode() throw(SGFError);
77   void updateRootNode(PyObject* data, int n) throw(SGFError);
78   char* rootNodeToString(PyObject* data);
79   char* nodeToString(PyObject* data) throw(SGFError);
80   char* outputVar(Node* node);
81   char* output();
82   void add(char* st);
83   void delVariation(Node* node);
84   void setFlags(); 
85
86  protected:
87   void delVar(Node* node);
88   void deltree(Node* node);
89
90 };
91
92 class intN {
93  public:
94   int data;
95   intN* prev;
96   intN(int i, intN* p);
97 };
98
99 class IntStack {
100  public:
101   intN* root;
102   IntStack();
103   void push(int i);
104   void pop();
105   int top();
106   bool nonempty();
107 };
108
109 class nodeN {
110  public:
111   Node* data;
112   nodeN* prev;
113   nodeN(Node* i, nodeN* p);
114 };
115
116 class NodeStack {
117  public:
118   nodeN* root;
119   NodeStack();
120   void push(Node* i);
121   void pop();
122   Node* top();
123   bool nonempty();
124 };
125
Note: See TracBrowser for help on using the browser.