root/05/release-0.5j/sgfpars.h

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

Create encoding property for class Cursor

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   char* encoding;
70
71   int noChildren();
72   PyObject* currentNode();
73   void parse(char* s) throw(SGFError);
74   void game(int n) throw(SGFError);
75   PyObject* next(int n=0) throw(SGFError);
76   PyObject* previous() throw(SGFError);
77   PyObject* getRootNode(int n) throw(SGFError);
78   void updateCurrentNode() throw(SGFError);
79   void updateRootNode(PyObject* data, int n) throw(SGFError);
80   char* rootNodeToString(PyObject* data);
81   char* nodeToString(PyObject* data) throw(SGFError);
82   char* outputVar(Node* node);
83   char* output();
84   void add(char* st);
85   void delVariation(Node* node);
86   void setFlags(); 
87
88  protected:
89   void delVar(Node* node);
90   void deltree(Node* node);
91
92 };
93
94 class intN {
95  public:
96   int data;
97   intN* prev;
98   intN(int i, intN* p);
99 };
100
101 class IntStack {
102  public:
103   intN* root;
104   IntStack();
105   void push(int i);
106   void pop();
107   int top();
108   bool nonempty();
109 };
110
111 class nodeN {
112  public:
113   Node* data;
114   nodeN* prev;
115   nodeN(Node* i, nodeN* p);
116 };
117
118 class NodeStack {
119  public:
120   nodeN* root;
121   NodeStack();
122   void push(Node* i);
123   void pop();
124   Node* top();
125   bool nonempty();
126 };
127
Note: See TracBrowser for help on using the browser.