| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2009 by The qGo Project * |
| 3 | * * |
| 4 | * This file is part of qGo. * |
| 5 | * * |
| 6 | * qGo is free software: you can redistribute it and/or modify * |
| 7 | * it under the terms of the GNU General Public License as published by * |
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
| 9 | * (at your option) any later version. * |
| 10 | * * |
| 11 | * This program is distributed in the hope that it will be useful, * |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 | * GNU General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU General Public License * |
| 17 | * along with this program; if not, see <http://www.gnu.org/licenses/> * |
| 18 | * or write to the Free Software Foundation, Inc., * |
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 20 | ***************************************************************************/ |
| 21 | |
| 22 | |
| 23 | /* |
| 24 | * sgfparser.cpp |
| 25 | * This class deals with SGF input. It puts data into a text stream (for cilpboard exchange) |
| 26 | * The parsing delivers orders solely into the game tree - namely the 'tree' class |
| 27 | */ |
| 28 | |
| 29 | |
| 30 | #include "sgfparser.h"cxx . . $ `<file>/src/sgf/sgfparser.h`/ |
| 31 | #include "../defines.h"cxx . . $ `<file>/src/defines.h`/ |
| 32 | #include "move.h"cxx . . $ `<file>/src/game_tree/move.h`/ |
| 33 | #include "tree.h"cxx . . $ `<file>/src/game_tree/tree.h`/ |
| 34 | #include "matrix.h"cxx . . $ `<file>/src/game_tree/matrix.h`/ |
| 35 | #include "gamedata.h"cxx . . $ `<file>/src/gamedata.h`/ |
| 36 | |
| 37 | #include <QMessageBox> |
| 38 | |
| 39 | #ifdef HAVE_CONFIG_H |
| 40 | #include <config.h> |
| 41 | #endif |
| 42 | |
| 43 | |
| 44 | #define STR_OFFSETcxx . . $ `src/sgf/sgfparser.cpp:44:9`! 2000 |
| 45 | /* #define DEBUG_CODEC */ |
| 46 | |
| 47 | struct Positioncxx . . $ Position# { int xcxx . . $ Position#x., ycxx . . $ Position#y.; }; |
| 48 | struct MoveNumcxx . . $ MoveNum# {int ncxx . . $ MoveNum#n.; }; |
| 49 | |
| 50 | /* FIXME consider a parser for other file types, what few there are. |
| 51 | * but for instance the tygem protocols use .gibo format and that code |
| 52 | * is super ugly. We could make a better parser for it and put it in here |
| 53 | * also allowing the reading of files. This will become more useful if |
| 54 | * we add in the stuff to retrieve game records from the server. |
| 55 | * oro also has its own format I think and there's a few others. There's |
| 56 | * no reason why we shouldn't be able to handle them. |
| 57 | * IGS also has its own format as probably does cyberoro */ |
| 58 | |
| 59 | class MyStringcxx . . $ MyString# |
| 60 | { |
| 61 | public: |
| 62 | MyStringcxx . . $ MyString#MyString(49f6e7a06ebc5aa8).() |
| 63 | { |
| 64 | } |
| 65 | |
| 66 | MyStringcxx . . $ MyString#MyString(3520e46b33348bf6).(const QStringcxx . . $ QString# &src) |
| 67 | { |
| 68 | Strcxx . . $ MyString#Str. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). src; |
| 69 | strLengthcxx . . $ MyString#strLength. = src.lengthcxx . . $ QString#length(455f465bc33b4cdf).(); |
| 70 | } |
| 71 | |
| 72 | virtual ~cxx . . $ MyString#`~MyString`(ced63f7c635d850d).MyStringcxx . . $ MyString#() |
| 73 | { |
| 74 | } |
| 75 | |
| 76 | virtual const QCharcxx . . $ QChar# atcxx . . $ MyString#at(22c1bbde645d9599).(uintcxx . . $ uint# i) const { return Strcxx . . $ MyString#Str..atcxx . . $ QString#at(13af7ae5a875439e).(i); } |
| 77 | |
| 78 | virtual uintcxx . . $ uint# next_nonspacecxx . . $ MyString#next_nonspace(560347b7e9428769). (uintcxx . . $ uint# i) const |
| 79 | { |
| 80 | // ignore lower characters, too |
| 81 | while (atcxx . . $ MyString#at(22c1bbde645d9599).(i).isSpacecxx . . $ QChar#isSpace(3482b152b9333168).() || // == ' ' || at(i) == '\n' || at(i) == '\t' || |
| 82 | (atcxx . . $ MyString#at(22c1bbde645d9599).(i) >=cxx . . $ `operator>=`(a468b2f18a3afe8). 'a'cxx . . $ QChar#QChar(f349c77f591a7878). && atcxx . . $ MyString#at(22c1bbde645d9599).(i) <=cxx . . $ `operator<=`(a468b2f18a3afe8). 'z'cxx . . $ QChar#QChar(f349c77f591a7878).)) |
| 83 | i++; |
| 84 | return i; |
| 85 | } |
| 86 | |
| 87 | virtual uintcxx . . $ uint# isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).(const char *c, unsigned int index) const |
| 88 | // Check if a property identified by the C string *c begins at index. |
| 89 | // Return poition of '[' (always >0 assuming *c is not empty) if yes, zero if no. |
| 90 | { |
| 91 | if (index+strlen(c) >= strLengthcxx . . $ MyString#strLength.) |
| 92 | return 0; |
| 93 | |
| 94 | while (*c != '\0') |
| 95 | { |
| 96 | if (*cxx . . $ QChar#QChar(f349c77f591a7878).(c++) !=cxx . . $ `operator!=`(a468b2f18a3afe8). Strcxx . . $ MyString#Str..atcxx . . $ QString#at(13af7ae5a875439e).(index++)) |
| 97 | return 0; |
| 98 | } |
| 99 | |
| 100 | uintcxx . . $ uint# tmppos = next_nonspacecxx . . $ MyString#next_nonspace(560347b7e9428769).(index); |
| 101 | if (atcxx . . $ MyString#at(22c1bbde645d9599).(tmppos) ==cxx . . $ `operator==`(a468b2f18a3afe8). '['cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 102 | return tmppos; |
| 103 | else return 0; |
| 104 | } |
| 105 | |
| 106 | virtual int findcxx . . $ MyString#find(42b144ad63e7644d).(const char *c, unsigned int index) const |
| 107 | { |
| 108 | if (index >= strLengthcxx . . $ MyString#strLength.) |
| 109 | return -1; |
| 110 | |
| 111 | // Offset. Hope that is enough. TODO Long comments check? |
| 112 | unsigned int l = index+STR_OFFSETcxx . . $ `src/sgf/sgfparser.cpp:44:9`!<strLengthcxx . . $ MyString#strLength. ? index+STR_OFFSETcxx . . $ `src/sgf/sgfparser.cpp:44:9`! : strLengthcxx . . $ MyString#strLength., |
| 113 | cl = strlen(c), |
| 114 | i, |
| 115 | found; |
| 116 | |
| 117 | do { |
| 118 | found = i = 0; |
| 119 | do { |
| 120 | if (Strcxx . . $ MyString#Str..datacxx . . $ QString#data(4b5a7d1cd542e2bb).()[index+i] !=cxx . . $ `operator!=`(a468b2f18a3afe8). ccxx . . $ QChar#QChar(f349c77f591a7878).[i]) //calls QChar::unicode() which is slow |
| 121 | break; |
| 122 | found ++; |
| 123 | if (found == cl) |
| 124 | return index; |
| 125 | } while (i++ < cl); |
| 126 | } while (index++ < l-1); |
| 127 | if (index == l) |
| 128 | return -1; |
| 129 | return index; |
| 130 | } |
| 131 | |
| 132 | virtual int findcxx . . $ MyString#find(a56cae53ed40db85).(char c, unsigned int index) const |
| 133 | { |
| 134 | if (index >= strLengthcxx . . $ MyString#strLength.) |
| 135 | return -1; |
| 136 | |
| 137 | // Offset. Hope that is enough. TODO Long comments check? |
| 138 | unsigned int l = index+STR_OFFSETcxx . . $ `src/sgf/sgfparser.cpp:44:9`!<strLengthcxx . . $ MyString#strLength. ? index+STR_OFFSETcxx . . $ `src/sgf/sgfparser.cpp:44:9`! : strLengthcxx . . $ MyString#strLength.; |
| 139 | |
| 140 | while (Strcxx . . $ MyString#Str..datacxx . . $ QString#data(4b5a7d1cd542e2bb).()[index] !=cxx . . $ `operator!=`(a468b2f18a3afe8). ccxx . . $ QChar#QChar(f349c77f591a7878). && index++ < l-1) {}; //calls QChar::unicode() which is slow |
| 141 | if (index == l) |
| 142 | return -1; |
| 143 | return index; |
| 144 | } |
| 145 | |
| 146 | virtual unsigned int lengthcxx . . $ MyString#length(ddd8539a2fcdd4ce).() const |
| 147 | { |
| 148 | return strLengthcxx . . $ MyString#strLength.; |
| 149 | } |
| 150 | |
| 151 | unsigned int strLengthcxx . . $ MyString#strLength.; |
| 152 | |
| 153 | char * getStrcxx . . $ MyString#getStr(e7e5aa338b9d5147).() const {return (char *)Strcxx . . $ MyString#Str..toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).();} |
| 154 | //private: |
| 155 | QStringcxx . . $ QString# Strcxx . . $ MyString#Str.; |
| 156 | }; |
| 157 | |
| 158 | |
| 159 | SGFParsercxx . . $ SGFParser#::SGFParsercxx . . $ SGFParser#SGFParser(ed4f44641ad95fbd).(Treecxx . . $ Tree# * _tree) |
| 160 | //: boardHandler(bh) |
| 161 | { |
| 162 | // CHECK_PTR(boardHandler); |
| 163 | streamcxx . . $ SGFParser#stream. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 164 | treecxx . . $ SGFParser#tree. = _tree; |
| 165 | readCodeccxx . . $ SGFParser#readCodec. = 0; |
| 166 | loadedfromfilecxx . . $ SGFParser#loadedfromfile. = false; |
| 167 | // xmlParser = NULL; |
| 168 | } |
| 169 | |
| 170 | SGFParsercxx . . $ SGFParser#::~cxx . . $ SGFParser#`~SGFParser`(ced63f7c635d850d).SGFParsercxx . . $ SGFParser#() |
| 171 | { |
| 172 | // delete xmlParser; |
| 173 | } |
| 174 | |
| 175 | bool SGFParsercxx . . $ SGFParser#::parsecxx . . $ SGFParser#parse(edf9e4f73813982f).(const QStringcxx . . $ QString# &fileName, const QStringcxx . . $ QString# &/*filter*/) |
| 176 | { |
| 177 | if (fileName.isNullcxx . . $ QString#isNull(50ce9a9e25b4a850).() || fileName.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 178 | { |
| 179 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("No filename given!"); |
| 180 | return false; |
| 181 | } |
| 182 | |
| 183 | // CHECK_PTR(boardHandler); |
| 184 | |
| 185 | QStringcxx . . $ QString# toParse = loadFilecxx . . $ SGFParser#loadFile(fd988a2ab94d906b).(fileName); |
| 186 | if (toParse.isNullcxx . . $ QString#isNull(50ce9a9e25b4a850).() || toParse.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 187 | return false; |
| 188 | |
| 189 | /* |
| 190 | // Check for filter, if given |
| 191 | if (!filter.isNull()) |
| 192 | { |
| 193 | // XML |
| 194 | if (filter == Board::tr("XML")) |
| 195 | { |
| 196 | // Init xmlparser if not yet done |
| 197 | if (xmlParser == NULL) |
| 198 | xmlParser = new XMLParser(boardHandler); |
| 199 | xmlParser->parse(fileName); |
| 200 | return true; |
| 201 | } |
| 202 | } |
| 203 | */ |
| 204 | if (!initGamecxx . . $ SGFParser#initGame(a4526618b9a7c13a).(toParse, fileName)) |
| 205 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(); |
| 206 | return doParsecxx . . $ SGFParser#doParse(e1defb592416720d).(toParse); |
| 207 | } |
| 208 | /* |
| 209 | // Called from clipboard SGF import |
| 210 | bool SGFParser::parseString(const QString &toParse) |
| 211 | { |
| 212 | if (toParse.isNull() || toParse.isEmpty() || !initGame(toParse, NULL)) |
| 213 | return corruptSgf(); |
| 214 | return doParse(toParse); |
| 215 | } |
| 216 | */ |
| 217 | |
| 218 | QStringcxx . . $ QString# SGFParsercxx . . $ SGFParser#::loadFilecxx . . $ SGFParser#loadFile(fd988a2ab94d906b).(const QStringcxx . . $ QString# &fileName) |
| 219 | { |
| 220 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Trying to load file <%s>", fileName.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 221 | |
| 222 | QFilecxx . . $ QFile# filecxx . . $ QFile#QFile(3520e46b33348bf6).(fileName); |
| 223 | |
| 224 | if (!file.existscxx . . $ QFile#exists(50ce9a9e25b4a850).()) |
| 225 | { |
| 226 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Could not find file: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). fileName; |
| 227 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 228 | } |
| 229 | |
| 230 | if (!file.opencxx . . $ QFile#open(dca164408be960c8).(QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::ReadOnlycxx . . $ QIODevice#ReadOnly.)) |
| 231 | { |
| 232 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Could not open file: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). fileName; |
| 233 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 234 | } |
| 235 | |
| 236 | QTextStreamcxx . . $ QTextStream# txtcxx . . $ QTextStream#QTextStream(bebe8f2dee7f9e86).(&file); |
| 237 | streamcxx . . $ SGFParser#stream. = &txt; |
| 238 | if (!setCodeccxx . . $ SGFParser#setCodec(7dc6c9a0b6a7270f).()) |
| 239 | { |
| 240 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Invalid text encoding given. Please check preferences!"; |
| 241 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 242 | } |
| 243 | |
| 244 | QStringcxx . . $ QString# toParsecxx . . $ QString#QString(ced63f7c635d850d).; |
| 245 | int i = 10; |
| 246 | while (!txt.atEndcxx . . $ QTextStream#atEnd(50ce9a9e25b4a850).() && i--) |
| 247 | toParse.appendcxx . . $ QString#append(6a89d0b7f4d2681c).(txt.readLinecxx . . $ QTextStream#readLine(20e0a2766677f583).() +cxx . . $ operator+(3d22f08efddf8107). "\n"); |
| 248 | QStringcxx . . $ QString# tmp=""cxx . . $ QString#QString(85c52e162fed56f9).; |
| 249 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "CA"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) //codec |
| 250 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 251 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 252 | { |
| 253 | if(!setCodeccxx . . $ SGFParser#setCodec(7dc6c9a0b6a7270f).(tmpcxx . . $ QString#QString(132dd6869045752b).)) |
| 254 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 255 | toParse.clearcxx . . $ QString#clear(49f6e7a06ebc5aa8).(); |
| 256 | txt.seekcxx . . $ QTextStream#seek(49597d8fcab147c1).(0); |
| 257 | } |
| 258 | while (!txt.atEndcxx . . $ QTextStream#atEnd(50ce9a9e25b4a850).()) |
| 259 | toParse.appendcxx . . $ QString#append(6a89d0b7f4d2681c).(txt.readLinecxx . . $ QTextStream#readLine(20e0a2766677f583).() +cxx . . $ operator+(3d22f08efddf8107). "\n"); |
| 260 | readCodeccxx . . $ SGFParser#readCodec. = streamcxx . . $ SGFParser#stream.->codeccxx . . $ QTextStream#codec(784de65596859dca).(); |
| 261 | file.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 262 | #ifdef DEBUG_CODEC |
| 263 | QMessageBox::information(0, "READING", toParse); |
| 264 | #endif |
| 265 | loadedfromfilecxx . . $ SGFParser#loadedfromfile. = true; //no need to check the codec later |
| 266 | return toParsecxx . . $ QString#QString(28715ad661ad3cec).; |
| 267 | } |
| 268 | |
| 269 | bool SGFParsercxx . . $ SGFParser#::setCodeccxx . . $ SGFParser#setCodec(7dc6c9a0b6a7270f).(QStringcxx . . $ QString# c) |
| 270 | { |
| 271 | QTextCodeccxx . . $ QTextCodec# *codec = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 272 | |
| 273 | if(c ==cxx . . $ `operator==`(5bc2975d2d751687). QStringcxx . . $ QString#QString(ced63f7c635d850d).()) |
| 274 | { |
| 275 | QSettingscxx . . $ QSettings# settingscxx . . $ QSettings#QSettings(749de1b6ae65bddd).; |
| 276 | |
| 277 | // TODO : make sure we are getting the proper codec value from settings |
| 278 | if (settings.containscxx . . $ QSettings#contains(f3b39adf77d9c36c).("CODEC"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 279 | codec = QTextCodeccxx . . $ QTextCodec#::codecForNamecxx . . $ QTextCodec#codecForName(9094647911411626).(settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("CODEC"cxx . . $ QString#QString(85c52e162fed56f9).).toByteArraycxx . . $ QVariant#toByteArray(a96750bfbcb1fbe9).()); |
| 280 | } |
| 281 | else |
| 282 | codec = QTextCodeccxx . . $ QTextCodec#::codecForNamecxx . . $ QTextCodec#codecForName(914382192c9ca379).(c.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 283 | #ifdef DEBUG_CODEC |
| 284 | QMessageBox::information(0, "LOCALE", codec); |
| 285 | #endif |
| 286 | /* |
| 287 | //switch (static_cast<Codec>(settings.value("CODEC")) |
| 288 | |
| 289 | switch (QTextCodec::codecForName(settings.value("CODEC"))) |
| 290 | { |
| 291 | case codecNone: |
| 292 | #ifdef DEBUG_CODEC |
| 293 | QMessageBox::information(0, "CODEC", "NONE"); |
| 294 | #endif |
| 295 | break; |
| 296 | |
| 297 | case codecBig5: |
| 298 | #ifdef DEBUG_CODEC |
| 299 | QMessageBox::information(0, "CODEC", "Big5"); |
| 300 | #endif |
| 301 | #ifndef Q_OS_WIN |
| 302 | codec = new QBig5Codec(); |
| 303 | #endif |
| 304 | break; |
| 305 | |
| 306 | case codecEucJP: |
| 307 | #ifdef DEBUG_CODEC |
| 308 | QMessageBox::information(0, "CODEC", "EUC JP"); |
| 309 | #endif |
| 310 | codec = new QEucJpCodec(); |
| 311 | break; |
| 312 | |
| 313 | case codecJIS: |
| 314 | #ifdef DEBUG_CODEC |
| 315 | QMessageBox::information(0, "CODEC", "JIS"); |
| 316 | #endif |
| 317 | codec = new QJisCodec(); |
| 318 | break; |
| 319 | |
| 320 | case codecSJIS: |
| 321 | #ifdef DEBUG_CODEC |
| 322 | QMessageBox::information(0, "CODEC", "Shift JIS"); |
| 323 | #endif |
| 324 | codec = new QSjisCodec(); |
| 325 | break; |
| 326 | |
| 327 | case codecEucKr: |
| 328 | #ifdef DEBUG_CODEC |
| 329 | QMessageBox::information(0, "CODEC", "EUC KR"); |
| 330 | #endif |
| 331 | codec = new QEucKrCodec(); |
| 332 | break; |
| 333 | |
| 334 | case codecGBK: |
| 335 | #ifdef DEBUG_CODEC |
| 336 | QMessageBox::information(0, "CODEC", "GBK"); |
| 337 | #endif |
| 338 | codec = new QGbkCodec(); |
| 339 | break; |
| 340 | |
| 341 | case codecTscii: |
| 342 | #ifdef DEBUG_CODEC |
| 343 | QMessageBox::information(0, "CODEC", "TSCII"); |
| 344 | #endif |
| 345 | codec = new QTsciiCodec(); |
| 346 | break; |
| 347 | |
| 348 | default: |
| 349 | return false; |
| 350 | } |
| 351 | */ |
| 352 | if ( streamcxx . . $ SGFParser#stream. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 353 | { |
| 354 | if (codec != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 355 | streamcxx . . $ SGFParser#stream.->setCodeccxx . . $ QTextStream#setCodec(1f30447839ed391).(codec); |
| 356 | else |
| 357 | streamcxx . . $ SGFParser#stream.->setCodeccxx . . $ QTextStream#setCodec(1f30447839ed391).(QTextCodeccxx . . $ QTextCodec#::codecForLocalecxx . . $ QTextCodec#codecForLocale(6599407a1b23811).()); |
| 358 | } |
| 359 | |
| 360 | return true; |
| 361 | } |
| 362 | |
| 363 | bool SGFParsercxx . . $ SGFParser#::doParsecxx . . $ SGFParser#doParse(e1defb592416720d).(const QStringcxx . . $ QString# &toParseStr) |
| 364 | { |
| 365 | if (toParseStr.isNullcxx . . $ QString#isNull(50ce9a9e25b4a850).() || toParseStr.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 366 | { |
| 367 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("Failed loading from file. Is it empty?"); |
| 368 | return false; |
| 369 | } |
| 370 | QStringcxx . . $ QString# tmpcxx . . $ QString#QString(ced63f7c635d850d).; |
| 371 | |
| 372 | if(!loadedfromfilecxx . . $ SGFParser#loadedfromfile.) |
| 373 | { |
| 374 | /* This bit of ugliness is because sgfs are used to duplicate boards as well |
| 375 | * as load from file FIXME */ |
| 376 | parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParseStr, "CA"cxx . . $ QString#QString(85c52e162fed56f9)., tmp); //codec |
| 377 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 378 | readCodeccxx . . $ SGFParser#readCodec. = QTextCodeccxx . . $ QTextCodec#::codecForNamecxx . . $ QTextCodec#codecForName(914382192c9ca379).(tmp.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 379 | } |
| 380 | |
| 381 | const MyStringcxx . . $ MyString# *toParse = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 382 | |
| 383 | //////TODO if (static_cast<Codec>(setting->readIntEntry("CODEC")) == codecNone) |
| 384 | ///////// toParse = new MySimpleString(toParseStr); |
| 385 | /////// else |
| 386 | toParse = new MyStringcxx . . $ MyString#(toParseStr); |
| 387 | |
| 388 | Q_CHECK_PTRcxx . . $ `<external>/15045578679651060896/qglobal.h:890:11`!(toParse); |
| 389 | |
| 390 | int pos = 0, |
| 391 | posVarBegin = 0, |
| 392 | posVarEnd = 0, |
| 393 | posNode = 0, |
| 394 | moves = 0, |
| 395 | i, x=-1, y=-1; |
| 396 | |
| 397 | int a_offset = QCharcxx . . $ QChar#::fromLatin1cxx . . $ QChar#fromLatin1(b9892872559b4892).('a').unicodecxx . . $ QChar#unicode(36716fbdc4fec2be).() - 1 ; |
| 398 | |
| 399 | unsigned int pointer = 0, |
| 400 | strLength = toParse->lengthcxx . . $ MyString#length(ddd8539a2fcdd4ce).(); |
| 401 | bool black = true, |
| 402 | setup = false, |
| 403 | old_label = false; |
| 404 | isRootcxx . . $ SGFParser#isRoot. = true; |
| 405 | bool remember_root; |
| 406 | QStringcxx . . $ QString# unknownPropertycxx . . $ QString#QString(ced63f7c635d850d).; |
| 407 | Statecxx . . $ State# state; |
| 408 | MarkTypecxx . . $ MarkType# markType; |
| 409 | QStringcxx . . $ QString# moveStrcxx . . $ QString#QString(ced63f7c635d850d)., commentStrcxx . . $ QString#QString(ced63f7c635d850d).; |
| 410 | Positioncxx . . $ Position# *position; |
| 411 | MoveNumcxx . . $ MoveNum# *moveNum; |
| 412 | QStackcxx . . $ QStack#<Movecxx . . $ Move#*> stack; |
| 413 | QStackcxx . . $ QStack#<MoveNumcxx . . $ MoveNum#*> movesStack; |
| 414 | /* FIXME toRemove, et., al., appears unused Remove it */ |
| 415 | QStackcxx . . $ QStack#<Positioncxx . . $ Position#*> toRemove; |
| 416 | /* |
| 417 | ////TODO stack.setAutoDelete(false); |
| 418 | movesStack.setAutoDelete(true); |
| 419 | toRemove.setAutoDelete(true); |
| 420 | */ |
| 421 | // Initialises the tree with board size |
| 422 | parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParseStr, "SZ"cxx . . $ QString#QString(85c52e162fed56f9)., tmp); |
| 423 | // Tree *tree = new Tree(tmp.isEmpty() ? 19 : tmp.toInt()) ;// boardHandler->getTree(); |
| 424 | |
| 425 | state = stateVarBegincxx . . $ stateVarBegin.; |
| 426 | |
| 427 | bool cancel = false; |
| 428 | //FIXME abort does nothing!! |
| 429 | |
| 430 | // qDebug("File length = %d", strLength); |
| 431 | |
| 432 | treecxx . . $ SGFParser#tree.->setLoadingSGFcxx . . $ Tree#setLoadingSGF(b45ddcbc8423892c).(true); |
| 433 | |
| 434 | QStringcxx . . $ QString# sss=""cxx . . $ QString#QString(85c52e162fed56f9).; |
| 435 | do { |
| 436 | posVarBegin = toParse->findcxx . . $ MyString#find(a56cae53ed40db85).('(', pointer); |
| 437 | posVarEnd = toParse->findcxx . . $ MyString#find(a56cae53ed40db85).(')', pointer); |
| 438 | posNode = toParse->findcxx . . $ MyString#find(a56cae53ed40db85).(';', pointer); |
| 439 | |
| 440 | pos = minPoscxx . . $ SGFParser#minPos(2326284602b0bb2d).(posVarBegin, posVarEnd, posNode); |
| 441 | |
| 442 | // Switch states |
| 443 | |
| 444 | // Node -> VarEnd |
| 445 | if (state == stateNodecxx . . $ stateNode. && pos == posVarEnd) |
| 446 | state = stateVarEndcxx . . $ stateVarEnd.; |
| 447 | |
| 448 | // Node -> VarBegin |
| 449 | if (state == stateNodecxx . . $ stateNode. && pos == posVarBegin) |
| 450 | state = stateVarBegincxx . . $ stateVarBegin.; |
| 451 | |
| 452 | // VarBegin -> Node |
| 453 | else if (state == stateVarBegincxx . . $ stateVarBegin. && pos == posNode) |
| 454 | state = stateNodecxx . . $ stateNode.; |
| 455 | |
| 456 | // VarEnd -> VarBegin |
| 457 | else if (state == stateVarEndcxx . . $ stateVarEnd. && pos == posVarBegin) |
| 458 | state = stateVarBegincxx . . $ stateVarBegin.; |
| 459 | |
| 460 | // qDebug("State after switch = %d", state); |
| 461 | |
| 462 | // Do the work |
| 463 | switch (state) |
| 464 | { |
| 465 | case stateVarBegincxx . . $ stateVarBegin.: |
| 466 | if (pos != posVarBegin) |
| 467 | { |
| 468 | delete toParse; |
| 469 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(pos); |
| 470 | } |
| 471 | |
| 472 | // qDebug("Var BEGIN at %d, moves = %d", pos, moves); |
| 473 | |
| 474 | stack.pushcxx . . $ QStack#push(77d9f17553126ecb).(treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()); |
| 475 | moveNum = new MoveNumcxx . . $ MoveNum#; |
| 476 | moveNum->ncxx . . $ MoveNum#n. = moves; |
| 477 | movesStack.pushcxx . . $ QStack#push(77d9f17553126ecb).(moveNum); |
| 478 | pointer = pos + 1; |
| 479 | break; |
| 480 | |
| 481 | case stateVarEndcxx . . $ stateVarEnd.: |
| 482 | if (pos != posVarEnd) |
| 483 | { |
| 484 | delete toParse; |
| 485 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(pos); |
| 486 | } |
| 487 | |
| 488 | // qDebug("VAR END"); |
| 489 | |
| 490 | if (!movesStack.isEmptycxx . . $ QVector#isEmpty(50ce9a9e25b4a850).() && !stack.isEmptycxx . . $ QVector#isEmpty(50ce9a9e25b4a850).()) |
| 491 | { |
| 492 | Movecxx . . $ Move# *m = stack.popcxx . . $ QStack#pop(5f357b03ed472e5e).(); |
| 493 | Q_CHECK_PTRcxx . . $ `<external>/15045578679651060896/qglobal.h:890:11`!(m); |
| 494 | x = movesStack.popcxx . . $ QStack#pop(5f357b03ed472e5e).()->ncxx . . $ MoveNum#n.; |
| 495 | |
| 496 | // qDebug("Var END at %d, moves = %d, moves from stack = %d", pos, moves, x); |
| 497 | |
| 498 | for (i=moves; i > x; i--) |
| 499 | { |
| 500 | position = toRemove.popcxx . . $ QStack#pop(5f357b03ed472e5e).(); |
| 501 | if (position == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 502 | continue; |
| 503 | /////////////////// boardHandler->getStoneHandler()->removeStone(position->x, position->y); |
| 504 | // tree->removeStone(position->x, position->y); |
| 505 | // qDebug("Removing %d %d from stoneHandler.", position->x, position->y); |
| 506 | } |
| 507 | |
| 508 | moves = x; |
| 509 | |
| 510 | |
| 511 | treecxx . . $ SGFParser#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(m); |
| 512 | } |
| 513 | pointer = pos + 1; |
| 514 | break; |
| 515 | |
| 516 | case stateNodecxx . . $ stateNode.: |
| 517 | if (pos != posNode) |
| 518 | { |
| 519 | delete toParse; |
| 520 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(pos); |
| 521 | } |
| 522 | |
| 523 | // qDebug("Node at %d", pos); |
| 524 | commentStr =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(ced63f7c635d850d).(); |
| 525 | setup = false; |
| 526 | markType = markNonecxx . . $ markNone.; |
| 527 | |
| 528 | // Create empty node |
| 529 | remember_root = isRootcxx . . $ SGFParser#isRoot.; |
| 530 | if (!isRootcxx . . $ SGFParser#isRoot.) |
| 531 | { |
| 532 | ///////////////////// boardHandler->createMoveSGF(); |
| 533 | // qDebug("############### Before creating move ####################"); |
| 534 | // qDebug(toParse->Str.toLatin1().constData()); |
| 535 | //tree->createMoveSGF(); |
| 536 | /* This does happen, why??? FIXME */ |
| 537 | // qDebug("############### ####################"); |
| 538 | // qDebug(toParse->Str.toLatin1().constData()); |
| 539 | // qDebug("############### After creating move ####################"); |
| 540 | unknownProperty =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(ced63f7c635d850d).(); |
| 541 | #ifdef FIXME //why is this a warning? this happens on loading a file with time info |
| 542 | if (tree->getCurrent()->getTimeinfo()) |
| 543 | qWarning("*** Timeinfo set !!!!"); |
| 544 | #endif //FIXME |
| 545 | //tree->getCurrent()->setTimeinfo(false); |
| 546 | } |
| 547 | else |
| 548 | isRootcxx . . $ SGFParser#isRoot. = false; |
| 549 | |
| 550 | Propertycxx . . $ Property# prop; |
| 551 | pos ++; |
| 552 | |
| 553 | do { |
| 554 | uintcxx . . $ uint# tmppos=0; |
| 555 | pos = toParse->next_nonspacecxx . . $ MyString#next_nonspace(560347b7e9428769). (pos); |
| 556 | |
| 557 | if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("B",pos))) |
| 558 | { |
| 559 | prop = moveBlackcxx . . $ moveBlack.; |
| 560 | pos = tmppos; |
| 561 | black = true; |
| 562 | } |
| 563 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("W",pos))) |
| 564 | { |
| 565 | prop = moveWhitecxx . . $ moveWhite.; |
| 566 | pos = tmppos; |
| 567 | black = false; |
| 568 | } |
| 569 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("N",pos))) |
| 570 | { |
| 571 | prop = nodeNamecxx . . $ nodeName.; |
| 572 | pos = tmppos; |
| 573 | } |
| 574 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("AB",pos))) |
| 575 | { |
| 576 | prop = editBlackcxx . . $ editBlack.; |
| 577 | pos = tmppos; |
| 578 | setup = true; |
| 579 | black = true; |
| 580 | } |
| 581 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("AW",pos))) |
| 582 | { |
| 583 | prop = editWhitecxx . . $ editWhite.; |
| 584 | pos = tmppos; |
| 585 | setup = true; |
| 586 | black = false; |
| 587 | } |
| 588 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("AE",pos))) |
| 589 | { |
| 590 | prop = editErasecxx . . $ editErase.; |
| 591 | pos = tmppos; |
| 592 | setup = true; |
| 593 | } |
| 594 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("TR",pos))) |
| 595 | { |
| 596 | prop = editMarkcxx . . $ editMark.; |
| 597 | markType = markTrianglecxx . . $ markTriangle.; |
| 598 | pos = tmppos; |
| 599 | } |
| 600 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("CR",pos))) |
| 601 | { |
| 602 | prop = editMarkcxx . . $ editMark.; |
| 603 | markType = markCirclecxx . . $ markCircle.; |
| 604 | pos = tmppos; |
| 605 | } |
| 606 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("SQ",pos))) |
| 607 | { |
| 608 | prop = editMarkcxx . . $ editMark.; |
| 609 | markType = markSquarecxx . . $ markSquare.; |
| 610 | pos = tmppos; |
| 611 | } |
| 612 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("MA",pos))) |
| 613 | { |
| 614 | prop = editMarkcxx . . $ editMark.; |
| 615 | markType = markCrosscxx . . $ markCross.; |
| 616 | pos = tmppos; |
| 617 | } |
| 618 | // old definition |
| 619 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("M",pos))) |
| 620 | { |
| 621 | prop = editMarkcxx . . $ editMark.; |
| 622 | markType = markCrosscxx . . $ markCross.; |
| 623 | pos = tmppos; |
| 624 | } |
| 625 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("LB",pos))) |
| 626 | { |
| 627 | prop = editMarkcxx . . $ editMark.; |
| 628 | markType = markTextcxx . . $ markText.; |
| 629 | pos = tmppos; |
| 630 | old_label = false; |
| 631 | } |
| 632 | // Added old L property. This is not SGF4, but many files contain this tag. |
| 633 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("L",pos))) |
| 634 | { |
| 635 | prop = editMarkcxx . . $ editMark.; |
| 636 | markType = markTextcxx . . $ markText.; |
| 637 | pos = tmppos; |
| 638 | old_label = true; |
| 639 | } |
| 640 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("C",pos))) |
| 641 | { |
| 642 | prop = commentcxx . . $ comment.; |
| 643 | pos = tmppos; |
| 644 | } |
| 645 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("TB",pos))) |
| 646 | { |
| 647 | prop = editMarkcxx . . $ editMark.; |
| 648 | markType = markTerrBlackcxx . . $ markTerrBlack.; |
| 649 | pos = tmppos; |
| 650 | black = true; |
| 651 | } |
| 652 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("TW",pos))) |
| 653 | { |
| 654 | prop = editMarkcxx . . $ editMark.; |
| 655 | markType = markTerrWhitecxx . . $ markTerrWhite.; |
| 656 | pos = tmppos; |
| 657 | black = false; |
| 658 | } |
| 659 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("BL",pos))) |
| 660 | { |
| 661 | prop = timeLeftcxx . . $ timeLeft.; |
| 662 | pos = tmppos; |
| 663 | black = true; |
| 664 | } |
| 665 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("WL",pos))) |
| 666 | { |
| 667 | prop = timeLeftcxx . . $ timeLeft.; |
| 668 | pos = tmppos; |
| 669 | black = false; |
| 670 | } |
| 671 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("OB",pos))) |
| 672 | { |
| 673 | prop = openMovescxx . . $ openMoves.; |
| 674 | pos = tmppos; |
| 675 | black = true; |
| 676 | } |
| 677 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("OW",pos))) |
| 678 | { |
| 679 | prop = openMovescxx . . $ openMoves.; |
| 680 | pos = tmppos; |
| 681 | black = false; |
| 682 | } |
| 683 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("PL",pos))) |
| 684 | { |
| 685 | prop = nextMovecxx . . $ nextMove.; |
| 686 | pos = tmppos; |
| 687 | } |
| 688 | else if ((tmppos = toParse->isPropertycxx . . $ MyString#isProperty(cee1001ac7b2fd64).("RG",pos))) |
| 689 | { |
| 690 | prop = unknownPropcxx . . $ unknownProp.; |
| 691 | pos = tmppos; |
| 692 | setup = true; |
| 693 | } |
| 694 | // Empty node |
| 695 | else if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). ';'cxx . . $ QChar#QChar(f349c77f591a7878). || toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). '('cxx . . $ QChar#QChar(f349c77f591a7878). || toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). ')'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 696 | { |
| 697 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Found empty node at %d", pos); |
| 698 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos).isSpacecxx . . $ QChar#isSpace(3482b152b9333168).()) |
| 699 | pos++; |
| 700 | continue; |
| 701 | } |
| 702 | else |
| 703 | { |
| 704 | // handle like comment |
| 705 | prop = unknownPropcxx . . $ unknownProp.; |
| 706 | pos = toParse->next_nonspacecxx . . $ MyString#next_nonspace(560347b7e9428769). (pos); |
| 707 | //qDebug("SGF: next nonspace (1st):" + QString(toParse->at(pos)) + QString(toParse->at(pos+1)) + QString(toParse->at(pos+2))); |
| 708 | } |
| 709 | |
| 710 | //qDebug("Start do loop : FOUND PROP %d, pos at %d now", prop, pos); |
| 711 | //qDebug(toParse->getStr()); //causes crash |
| 712 | // Next is one or more '[xx]'. |
| 713 | // Only one in a move property, several in a setup propery |
| 714 | do { |
| 715 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) !=cxx . . $ `operator!=`(a468b2f18a3afe8). '['cxx . . $ QChar#QChar(f349c77f591a7878). && prop != unknownPropcxx . . $ unknownProp.) |
| 716 | { |
| 717 | delete toParse; |
| 718 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(pos); |
| 719 | } |
| 720 | |
| 721 | // Empty type |
| 722 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1) ==cxx . . $ `operator==`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 723 | { |
| 724 | // CGoban stores pass as 'B[]' or 'W[]' |
| 725 | if (prop == moveBlackcxx . . $ moveBlack. || prop == moveWhitecxx . . $ moveWhite.) |
| 726 | { |
| 727 | treecxx . . $ SGFParser#tree.->doPasscxx . . $ Tree#doPass(b0b38cda41d4ede4).(true); |
| 728 | |
| 729 | // Remember this move for later, to remove from the matrix. |
| 730 | position = new Positioncxx . . $ Position#; |
| 731 | position->xcxx . . $ Position#x. = x; |
| 732 | position->ycxx . . $ Position#y. = y; |
| 733 | toRemove.pushcxx . . $ QStack#push(77d9f17553126ecb).(position); |
| 734 | moves ++; |
| 735 | } |
| 736 | |
| 737 | pos += 2; |
| 738 | continue; |
| 739 | } |
| 740 | |
| 741 | switch (prop) |
| 742 | { |
| 743 | case moveBlackcxx . . $ moveBlack.: |
| 744 | case moveWhitecxx . . $ moveWhite.: |
| 745 | // rare case: root contains move or placed stone: |
| 746 | if (remember_root) |
| 747 | { |
| 748 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("root contains stone -> node created"); |
| 749 | /* Something is screwy here, inconsistencies |
| 750 | * in the way SGF's are treated. Like the below: |
| 751 | * the whole point of "remember_root", FIXME*/ |
| 752 | treecxx . . $ SGFParser#tree.->addEmptyMovecxx . . $ Tree#addEmptyMove(49f6e7a06ebc5aa8).(); |
| 753 | isRootcxx . . $ SGFParser#isRoot. = false; |
| 754 | unknownProperty =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(ced63f7c635d850d).(); |
| 755 | #ifdef FIXME //why is this a warning? |
| 756 | if (tree->getCurrent()->getTimeinfo()) |
| 757 | qWarning("*** Timeinfo set (2)!!!!"); |
| 758 | #endif //FIXME |
| 759 | //tree->getCurrent()->setTimeinfo(false); |
| 760 | } |
| 761 | case editBlackcxx . . $ editBlack.: |
| 762 | case editWhitecxx . . $ editWhite.: |
| 763 | case editErasecxx . . $ editErase.: |
| 764 | { |
| 765 | x = toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1).unicodecxx . . $ QChar#unicode(fdddb4f32d8ba90f).() - a_offset ;// - 'a';// + 1; |
| 766 | y = toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+2).unicodecxx . . $ QChar#unicode(fdddb4f32d8ba90f).() - a_offset ; //- 'a' + 1; |
| 767 | |
| 768 | int x1, y1; |
| 769 | bool compressed_list; |
| 770 | |
| 771 | // check for compressed lists |
| 772 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+3) ==cxx . . $ `operator==`(a468b2f18a3afe8). ':'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 773 | { |
| 774 | x1 = toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+4).unicodecxx . . $ QChar#unicode(fdddb4f32d8ba90f).() -a_offset;// - 'a' + 1; |
| 775 | y1 = toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+5).unicodecxx . . $ QChar#unicode(fdddb4f32d8ba90f).() -a_offset;// - 'a' + 1; |
| 776 | compressed_list = true; |
| 777 | } |
| 778 | else |
| 779 | { |
| 780 | x1 = x; |
| 781 | y1 = y; |
| 782 | compressed_list = false; |
| 783 | } |
| 784 | /* |
| 785 | * TODO Do we nned this when the tree is created from file ? |
| 786 | * boardHandler->setModeSGF(setup || compressed_list ? modeEdit : modeNormal); |
| 787 | */ |
| 788 | |
| 789 | int i, j; |
| 790 | for (i = x; i <= x1; i++) |
| 791 | for (j = y; j <= y1; j++) |
| 792 | { |
| 793 | if (prop == editErasecxx . . $ editErase.) |
| 794 | { |
| 795 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->addStonecxx . . $ Move#addStone(e6b2860cd25699f2).(stoneErasecxx . . $ stoneErase., i, j); |
| 796 | } |
| 797 | else |
| 798 | { |
| 799 | if(setup) |
| 800 | { |
| 801 | if ((!remember_root) && (stack.topcxx . . $ QStack#top(19b2b6f17af048b).() == treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).())) |
| 802 | treecxx . . $ SGFParser#tree.->addEmptyMovecxx . . $ Tree#addEmptyMove(49f6e7a06ebc5aa8).(); //if this is first in branch we need to add an empty move |
| 803 | |
| 804 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->addStonecxx . . $ Move#addStone(e6b2860cd25699f2).(black ? stoneBlackcxx . . $ stoneBlack. : stoneWhitecxx . . $ stoneWhite., i, j); |
| 805 | } |
| 806 | else |
| 807 | { |
| 808 | Movecxx . . $ Move# *result = treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->makeMovecxx . . $ Move#makeMove(b73c42e1a544db20).(black ? stoneBlackcxx . . $ stoneBlack. : stoneWhitecxx . . $ stoneWhite., i, j); |
| 809 | if (result) |
| 810 | treecxx . . $ SGFParser#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(result); |
| 811 | } |
| 812 | } |
| 813 | // tree->getCurrent()->getMatrix()->debug(); |
| 814 | //qDebug("ADDING MOVE %s %d/%d", black?"B":"W", x, y); |
| 815 | |
| 816 | // Remember this move for later, to remove from the matrix. |
| 817 | position = new Positioncxx . . $ Position#; |
| 818 | position->xcxx . . $ Position#x. = i; |
| 819 | position->ycxx . . $ Position#y. = j; |
| 820 | toRemove.pushcxx . . $ QStack#push(77d9f17553126ecb).(position); |
| 821 | moves ++; |
| 822 | } |
| 823 | |
| 824 | if (compressed_list) |
| 825 | // Advance pos by 7 |
| 826 | pos += 7; |
| 827 | else |
| 828 | // Advance pos by 4 |
| 829 | pos += 4; |
| 830 | break; |
| 831 | } |
| 832 | |
| 833 | case nodeNamecxx . . $ nodeName.: |
| 834 | { |
| 835 | commentStr =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(ced63f7c635d850d).(); |
| 836 | bool skip = false; |
| 837 | |
| 838 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(++pos) !=cxx . . $ `operator!=`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 839 | { |
| 840 | if (static_cast<unsigned int>(pos) > strLength-1) |
| 841 | { |
| 842 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("SGF: Nodename string ended immediately"); |
| 843 | delete toParse; |
| 844 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(pos, "SGF: Nodename string ended immediately"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 845 | } |
| 846 | |
| 847 | // white spaces |
| 848 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). '\\'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 849 | { |
| 850 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1).isSpacecxx . . $ QChar#isSpace(3482b152b9333168).() && |
| 851 | static_cast<unsigned int>(pos) < strLength-2) |
| 852 | pos++; |
| 853 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos).isSpacecxx . . $ QChar#isSpace(3482b152b9333168).()) |
| 854 | pos++; |
| 855 | |
| 856 | // case: "../<cr><lf>]" |
| 857 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 858 | { |
| 859 | pos--; |
| 860 | skip = true; |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | // escaped chars: '\', ']', ':' |
| 865 | if (!(toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). '\\'cxx . . $ QChar#QChar(f349c77f591a7878). && |
| 866 | (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1) ==cxx . . $ `operator==`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878). || |
| 867 | toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1) ==cxx . . $ `operator==`(a468b2f18a3afe8). '\\'cxx . . $ QChar#QChar(f349c77f591a7878). || |
| 868 | toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1) ==cxx . . $ `operator==`(a468b2f18a3afe8). ':'cxx . . $ QChar#QChar(f349c77f591a7878).)) && |
| 869 | !skip && |
| 870 | // no formatting |
| 871 | !(toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). '\n'cxx . . $ QChar#QChar(f349c77f591a7878).) && |
| 872 | !(toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). '\r'cxx . . $ QChar#QChar(f349c77f591a7878).)) |
| 873 | commentStr.appendcxx . . $ QString#append(3a2ffbdf8ecc25e2).(toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos)); |
| 874 | } |
| 875 | |
| 876 | //qDebug("Node name read: %s", commentStr.toLatin1().constData()); |
| 877 | if (!commentStr.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 878 | // add comment; skip 'C[]' |
| 879 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setNodeNamecxx . . $ Move#setNodeName(3520e46b33348bf6).(commentStr); |
| 880 | pos++; |
| 881 | break; |
| 882 | } |
| 883 | |
| 884 | case commentcxx . . $ comment.: |
| 885 | { |
| 886 | commentStr =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(ced63f7c635d850d).(); |
| 887 | bool skip = false; |
| 888 | |
| 889 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(++pos) !=cxx . . $ `operator!=`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878). || |
| 890 | (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos-1) ==cxx . . $ `operator==`(a468b2f18a3afe8). '\\'cxx . . $ QChar#QChar(f349c77f591a7878). && toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878).)) |
| 891 | { |
| 892 | if (static_cast<unsigned int>(pos) > strLength-1) |
| 893 | { |
| 894 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("SGF: Comment string ended immediately"); |
| 895 | delete toParse; |
| 896 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(pos, "SGF: Comment string ended immediately"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 897 | } |
| 898 | |
| 899 | // white spaces |
| 900 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). '\\'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 901 | { |
| 902 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1).isSpacecxx . . $ QChar#isSpace(3482b152b9333168).() && |
| 903 | static_cast<unsigned int>(pos) < strLength-2) |
| 904 | pos++; |
| 905 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos).isSpacecxx . . $ QChar#isSpace(3482b152b9333168).()) |
| 906 | pos++; |
| 907 | |
| 908 | // case: "../<cr><lf>]" |
| 909 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 910 | { |
| 911 | pos--; |
| 912 | skip = true; |
| 913 | } |
| 914 | } |
| 915 | |
| 916 | // escaped chars: '\', ']', ':' |
| 917 | if (!(toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). '\\'cxx . . $ QChar#QChar(f349c77f591a7878). && |
| 918 | (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1) ==cxx . . $ `operator==`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878). || |
| 919 | toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1) ==cxx . . $ `operator==`(a468b2f18a3afe8). '\\'cxx . . $ QChar#QChar(f349c77f591a7878). || |
| 920 | toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1) ==cxx . . $ `operator==`(a468b2f18a3afe8). ':'cxx . . $ QChar#QChar(f349c77f591a7878).)) && |
| 921 | !skip) |
| 922 | commentStr.appendcxx . . $ QString#append(3a2ffbdf8ecc25e2).(toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos)); |
| 923 | } |
| 924 | |
| 925 | //qDebug("Comment read: %s", commentStr.toLatin1().constData()); |
| 926 | if (!commentStr.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 927 | { |
| 928 | // add comment; skip 'C[]' |
| 929 | if(readCodeccxx . . $ SGFParser#readCodec.) |
| 930 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setCommentcxx . . $ Move#setComment(3520e46b33348bf6).(readCodeccxx . . $ SGFParser#readCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(95b50e596355a4c5).(commentStr.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).())); |
| 931 | else |
| 932 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setCommentcxx . . $ Move#setComment(3520e46b33348bf6).(commentStrcxx . . $ QString#QString(85c52e162fed56f9)..toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 933 | } |
| 934 | pos ++; |
| 935 | break; |
| 936 | } |
| 937 | |
| 938 | case unknownPropcxx . . $ unknownProp.: |
| 939 | { |
| 940 | // skip if property is known anyway |
| 941 | bool skip = false; |
| 942 | |
| 943 | // save correct property name (or p.n. + '[') |
| 944 | commentStr =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(f2c90172ce699d92).(toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos)); |
| 945 | commentStr +=cxx . . $ QString#`operator+=`(3a2ffbdf8ecc25e2). toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(tmppos = toParse->next_nonspacecxx . . $ MyString#next_nonspace(560347b7e9428769). (pos + 1)); |
| 946 | pos = tmppos; |
| 947 | |
| 948 | // check if it's really necessary to hold properties |
| 949 | // maybe they are handled at another position |
| 950 | if (commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "WR" || |
| 951 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "BR" || |
| 952 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "PW" || |
| 953 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "PB" || |
| 954 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "SZ" || |
| 955 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "KM" || |
| 956 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "HA" || |
| 957 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "RE" || |
| 958 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "DT" || |
| 959 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "PC" || |
| 960 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "CP" || |
| 961 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "GN" || |
| 962 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "OT" || |
| 963 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "TM" || |
| 964 | // now: general options |
| 965 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "GM" || |
| 966 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "ST" || |
| 967 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "AP" || |
| 968 | commentStr ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "FF") |
| 969 | { |
| 970 | skip = true; |
| 971 | } |
| 972 | sss=cxx . . $ QString#`operator=`(3a2ffbdf8ecc25e2). toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos); |
| 973 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(++pos) !=cxx . . $ `operator!=`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878). || |
| 974 | (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos-1) ==cxx . . $ `operator==`(a468b2f18a3afe8). '\\'cxx . . $ QChar#QChar(f349c77f591a7878). && toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878).)) |
| 975 | { |
| 976 | if (static_cast<unsigned int>(pos) > strLength-1) |
| 977 | { |
| 978 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("SGF: Unknown property ended immediately"); |
| 979 | delete toParse; |
| 980 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(pos, "SGF: Unknown property ended immediately"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 981 | } |
| 982 | sss=cxx . . $ QString#`operator=`(3a2ffbdf8ecc25e2). toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos); |
| 983 | if (!skip) |
| 984 | commentStr.appendcxx . . $ QString#append(3a2ffbdf8ecc25e2).(toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos)); |
| 985 | } |
| 986 | |
| 987 | if (!skip) |
| 988 | commentStr.appendcxx . . $ QString#append(d02845eef0c33901).("]"); |
| 989 | |
| 990 | // qDebug("Comment read: %s", commentStr.latin1()); |
| 991 | if ((!commentStr.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) && (!skip)) |
| 992 | { |
| 993 | // cumulate unknown properties; skip empty property 'XZ[]' |
| 994 | unknownProperty +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). commentStr; |
| 995 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setUnknownPropertycxx . . $ Move#setUnknownProperty(3520e46b33348bf6).(unknownProperty); |
| 996 | } |
| 997 | pos ++; |
| 998 | sss=cxx . . $ QString#`operator=`(3a2ffbdf8ecc25e2). toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos); |
| 999 | break; |
| 1000 | } |
| 1001 | |
| 1002 | case editMarkcxx . . $ editMark.: |
| 1003 | // set moveStr for increment labels of old 'L[]' property |
| 1004 | moveStr =cxx . . $ QString#`operator=`(d02845eef0c33901). "A"; |
| 1005 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). '['cxx . . $ QChar#QChar(f349c77f591a7878). && |
| 1006 | static_cast<unsigned int>(pos) < strLength) |
| 1007 | { |
| 1008 | x = toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1).unicodecxx . . $ QChar#unicode(fdddb4f32d8ba90f).() -a_offset;// - 'a' + 1; |
| 1009 | y = toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+2).unicodecxx . . $ QChar#unicode(fdddb4f32d8ba90f).() -a_offset;// - 'a' + 1; |
| 1010 | // qDebug("MARK: %d at %d/%d", markType, x, y); |
| 1011 | pos += 3; |
| 1012 | |
| 1013 | // 'LB' property? Then we need to get the text |
| 1014 | if (markType == markTextcxx . . $ markText. && !old_label) |
| 1015 | { |
| 1016 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) !=cxx . . $ `operator!=`(a468b2f18a3afe8). ':'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 1017 | { |
| 1018 | delete toParse; |
| 1019 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(pos); |
| 1020 | } |
| 1021 | moveStr =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 1022 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(++pos) !=cxx . . $ `operator!=`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878). && |
| 1023 | static_cast<unsigned int>(pos) < strLength) |
| 1024 | moveStr.appendcxx . . $ QString#append(3a2ffbdf8ecc25e2).(toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos)); |
| 1025 | // qDebug("LB TEXT = %s", moveStr.latin1()); |
| 1026 | // It might me a number mark? |
| 1027 | bool check = false; |
| 1028 | moveStr.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(&check); // Try to convert to Integer |
| 1029 | // treat integers as characters... |
| 1030 | check = false; |
| 1031 | |
| 1032 | if (check) |
| 1033 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()-> |
| 1034 | insertMarkcxx . . $ Matrix#insertMark(2fb52c50f1893bf2).(x, y, markNumbercxx . . $ markNumber.); // Worked, its a number |
| 1035 | else |
| 1036 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()-> |
| 1037 | insertMarkcxx . . $ Matrix#insertMark(2fb52c50f1893bf2).(x, y, markType); // Nope, its a letter |
| 1038 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()-> |
| 1039 | setMarkTextcxx . . $ Matrix#setMarkText(c89d651b24440698).(x, y, moveStr); |
| 1040 | |
| 1041 | /*else //fastload |
| 1042 | { |
| 1043 | if (check) // Number |
| 1044 | tree->getCurrent()->insertFastLoadMark(x, y, markNumber); |
| 1045 | else // Text |
| 1046 | tree->getCurrent()->insertFastLoadMark(x, y, markType, moveStr); |
| 1047 | }*/ |
| 1048 | } |
| 1049 | else |
| 1050 | { |
| 1051 | int x1, y1; |
| 1052 | bool compressed_list; |
| 1053 | |
| 1054 | // check for compressed lists |
| 1055 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). ':'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 1056 | { |
| 1057 | x1 = toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+1).unicodecxx . . $ QChar#unicode(fdddb4f32d8ba90f).() -a_offset;// - 'a' + 1; |
| 1058 | y1 = toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos+2).unicodecxx . . $ QChar#unicode(fdddb4f32d8ba90f).() -a_offset;// - 'a' + 1; |
| 1059 | compressed_list = true; |
| 1060 | } |
| 1061 | else |
| 1062 | { |
| 1063 | x1 = x; |
| 1064 | y1 = y; |
| 1065 | compressed_list = false; |
| 1066 | } |
| 1067 | |
| 1068 | int i, j; |
| 1069 | for (i = x; i <= x1; i++) |
| 1070 | for (j = y; j <= y1; j++) |
| 1071 | { |
| 1072 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->insertMarkcxx . . $ Matrix#insertMark(2fb52c50f1893bf2).(i, j, markType); |
| 1073 | //else //fastload |
| 1074 | // tree->getCurrent()->insertFastLoadMark(i, j, markType); |
| 1075 | |
| 1076 | // auto increment for old property 'L' |
| 1077 | if (old_label) |
| 1078 | { |
| 1079 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()-> |
| 1080 | setMarkTextcxx . . $ Matrix#setMarkText(c89d651b24440698).(x, y, moveStr); |
| 1081 | QCharcxx . . $ QChar# c1 = moveStr[cxx . . $ QString#`operator[]`(57436120916eb52c).0]; |
| 1082 | if (c1 ==cxx . . $ `operator==`(a468b2f18a3afe8). 'Z'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 1083 | moveStr =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("a"); |
| 1084 | else |
| 1085 | moveStr =cxx . . $ QString#`operator=`(284c8d83f6f77cb5). c1.unicodecxx . . $ QChar#unicode(36716fbdc4fec2be).() + 1; |
| 1086 | } |
| 1087 | } |
| 1088 | |
| 1089 | // new_node = false; |
| 1090 | |
| 1091 | if (compressed_list) |
| 1092 | // Advance pos by 3 |
| 1093 | pos += 3; |
| 1094 | |
| 1095 | if((markType == markTerrWhitecxx . . $ markTerrWhite. || markType == markTerrBlackcxx . . $ markTerrBlack.) && !treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->isTerritoryMarkedcxx . . $ Move#isTerritoryMarked(50ce9a9e25b4a850).()) |
| 1096 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setTerritoryMarkedcxx . . $ Move#setTerritoryMarked(b45ddcbc8423892c).(); |
| 1097 | } |
| 1098 | |
| 1099 | //old_label = false; |
| 1100 | pos ++; |
| 1101 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos).isSpacecxx . . $ QChar#isSpace(3482b152b9333168).()) pos++; |
| 1102 | } |
| 1103 | break; |
| 1104 | |
| 1105 | case openMovescxx . . $ openMoves.: |
| 1106 | { |
| 1107 | QStringcxx . . $ QString# tmp_mvcxx . . $ QString#QString(ced63f7c635d850d).; |
| 1108 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(++pos) !=cxx . . $ `operator!=`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 1109 | tmp_mv +=cxx . . $ QString#`operator+=`(3a2ffbdf8ecc25e2). toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos); |
| 1110 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setOpenMovescxx . . $ Move#setOpenMoves(d4f767463ce0a6b3).(tmp_mv.toIntcxx . . $ QString#toInt(d7972accae11ee1f).()); |
| 1111 | pos++; |
| 1112 | |
| 1113 | if (!treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getTimeinfocxx . . $ Move#getTimeinfo(c9857a73d68e59ba).()) |
| 1114 | { |
| 1115 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setTimeinfocxx . . $ Move#setTimeinfo(b45ddcbc8423892c).(true); |
| 1116 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setTimeLeftcxx . . $ Move#setTimeLeft(9364e6e7bff7660).(0); |
| 1117 | } |
| 1118 | break; |
| 1119 | } |
| 1120 | |
| 1121 | case timeLeftcxx . . $ timeLeft.: |
| 1122 | { |
| 1123 | QStringcxx . . $ QString# tmp_mvcxx . . $ QString#QString(ced63f7c635d850d).; |
| 1124 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(++pos) !=cxx . . $ `operator!=`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 1125 | tmp_mv +=cxx . . $ QString#`operator+=`(3a2ffbdf8ecc25e2). toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos); |
| 1126 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setTimeLeftcxx . . $ Move#setTimeLeft(9364e6e7bff7660).(tmp_mv.toFloatcxx . . $ QString#toFloat(abac0204e50f9cf0).()); |
| 1127 | pos++; |
| 1128 | |
| 1129 | if (!treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getTimeinfocxx . . $ Move#getTimeinfo(c9857a73d68e59ba).()) |
| 1130 | { |
| 1131 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setTimeinfocxx . . $ Move#setTimeinfo(b45ddcbc8423892c).(true); |
| 1132 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setOpenMovescxx . . $ Move#setOpenMoves(d4f767463ce0a6b3).(0); |
| 1133 | } |
| 1134 | break; |
| 1135 | } |
| 1136 | |
| 1137 | case nextMovecxx . . $ nextMove.: |
| 1138 | if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(++pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). 'W'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 1139 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setPLinfocxx . . $ Move#setPLinfo(42096433316d3db3).(stoneWhitecxx . . $ stoneWhite.); |
| 1140 | else if (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). 'B'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 1141 | treecxx . . $ SGFParser#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setPLinfocxx . . $ Move#setPLinfo(42096433316d3db3).(stoneBlackcxx . . $ stoneBlack.); |
| 1142 | |
| 1143 | pos += 2; |
| 1144 | break; |
| 1145 | |
| 1146 | default: |
| 1147 | break; |
| 1148 | } |
| 1149 | |
| 1150 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos).isSpacecxx . . $ QChar#isSpace(3482b152b9333168).()) |
| 1151 | pos++; |
| 1152 | |
| 1153 | sss=cxx . . $ QString#`operator=`(3a2ffbdf8ecc25e2). toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos); |
| 1154 | |
| 1155 | } while (setup && toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) ==cxx . . $ `operator==`(a468b2f18a3afe8). '['cxx . . $ QChar#QChar(f349c77f591a7878).); |
| 1156 | |
| 1157 | // tree->getCurrent()->getMatrix()->debug(); |
| 1158 | // qDebug("end do loop"); |
| 1159 | // qDebug(toParse->getStr()); |
| 1160 | |
| 1161 | while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos).isSpacecxx . . $ QChar#isSpace(3482b152b9333168).()) |
| 1162 | pos++; |
| 1163 | |
| 1164 | } while (toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) !=cxx . . $ `operator!=`(a468b2f18a3afe8). ';'cxx . . $ QChar#QChar(f349c77f591a7878). && toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) !=cxx . . $ `operator!=`(a468b2f18a3afe8). '('cxx . . $ QChar#QChar(f349c77f591a7878). && toParse->atcxx . . $ MyString#at(22c1bbde645d9599).(pos) !=cxx . . $ `operator!=`(a468b2f18a3afe8). ')'cxx . . $ QChar#QChar(f349c77f591a7878). && static_cast<unsigned int>(pos) < strLength); |
| 1165 | |
| 1166 | // Advance pointer |
| 1167 | pointer = pos; |
| 1168 | |
| 1169 | break; |
| 1170 | |
| 1171 | default: |
| 1172 | delete toParse; |
| 1173 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(pointer); |
| 1174 | } |
| 1175 | |
| 1176 | } while (pointer < strLength && pos >= 0); |
| 1177 | |
| 1178 | treecxx . . $ SGFParser#tree.->setLoadingSGFcxx . . $ Tree#setLoadingSGF(b45ddcbc8423892c).(false); |
| 1179 | |
| 1180 | delete toParse; |
| 1181 | return !cancel; |
| 1182 | } |
| 1183 | |
| 1184 | bool SGFParsercxx . . $ SGFParser#::corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(int where, QStringcxx . . $ QString# reason) |
| 1185 | { |
| 1186 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(0, PACKAGEcxx . . $ `src/defines.h:32:9`!, QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Corrupt SGF file at position") +cxx . . $ operator+(3d22f08efddf8107). " " +cxx . . $ operator+(fab9b4f80031f353). |
| 1187 | QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(where) +cxx . . $ operator+(3d22f08efddf8107). "\n\n" +cxx . . $ operator+(fab9b4f80031f353). |
| 1188 | (reason.isNullcxx . . $ QString#isNull(50ce9a9e25b4a850).() || reason.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).() ? QStringcxx . . $ QString#QString(85c52e162fed56f9).("") : reasoncxx . . $ QString#QString(132dd6869045752b).)); |
| 1189 | treecxx . . $ SGFParser#tree.->setLoadingSGFcxx . . $ Tree#setLoadingSGF(b45ddcbc8423892c).(false); |
| 1190 | return false; |
| 1191 | } |
| 1192 | |
| 1193 | |
| 1194 | int SGFParsercxx . . $ SGFParser#::minPoscxx . . $ SGFParser#minPos(2326284602b0bb2d).(int n1, int n2, int n3) |
| 1195 | { |
| 1196 | int min; |
| 1197 | |
| 1198 | if (n1 != -1) |
| 1199 | min = n1; |
| 1200 | else if (n2 != -1) |
| 1201 | min = n2; |
| 1202 | else |
| 1203 | min = n3; |
| 1204 | |
| 1205 | if (n1 < min && n1 != -1) |
| 1206 | min = n1; |
| 1207 | |
| 1208 | if (n2 < min && n2 != -1) |
| 1209 | min = n2; |
| 1210 | |
| 1211 | if (n3 < min && n3 != -1) |
| 1212 | min = n3; |
| 1213 | |
| 1214 | return min; |
| 1215 | } |
| 1216 | |
| 1217 | // Return false: corrupt sgf, true: sgf okay. result = 0 when property not found |
| 1218 | bool SGFParsercxx . . $ SGFParser#::parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(const QStringcxx . . $ QString# &toParse, const QStringcxx . . $ QString# &prop, QStringcxx . . $ QString# &result) |
| 1219 | { |
| 1220 | int pos, strLength=toParse.lengthcxx . . $ QString#length(455f465bc33b4cdf).(); |
| 1221 | result =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 1222 | |
| 1223 | pos = toParse.indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).(prop+cxx . . $ operator+(3d22f08efddf8107)."["); |
| 1224 | if (pos == -1) |
| 1225 | return true; |
| 1226 | |
| 1227 | pos += 2; |
| 1228 | if (toParse[cxx . . $ QString#`operator[]`(13af7ae5a875439e).pos] !=cxx . . $ `operator!=`(a468b2f18a3afe8). '['cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 1229 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(pos); |
| 1230 | while (toParse[cxx . . $ QString#`operator[]`(13af7ae5a875439e).++pos] !=cxx . . $ `operator!=`(a468b2f18a3afe8). ']'cxx . . $ QChar#QChar(f349c77f591a7878). && pos < strLength) |
| 1231 | result.appendcxx . . $ QString#append(3a2ffbdf8ecc25e2).(toParse[cxx . . $ QString#`operator[]`(13af7ae5a875439e).pos]); |
| 1232 | if (pos > strLength) |
| 1233 | return corruptSgfcxx . . $ SGFParser#corruptSgf(397e7d3e7106fad8).(pos); |
| 1234 | |
| 1235 | return true; |
| 1236 | } |
| 1237 | |
| 1238 | GameDatacxx . . $ GameData# * SGFParsercxx . . $ SGFParser#::initGamecxx . . $ SGFParser#initGame(a4526618b9a7c13a).(const QStringcxx . . $ QString# &toParse, const QStringcxx . . $ QString# &fileName) |
| 1239 | { |
| 1240 | QStringcxx . . $ QString# tmp=""cxx . . $ QString#QString(85c52e162fed56f9).; |
| 1241 | GameDatacxx . . $ GameData# *gameData = new GameDatacxx . . $ GameData#GameData(49f6e7a06ebc5aa8).; |
| 1242 | |
| 1243 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "CA"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) //codec |
| 1244 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1245 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1246 | gameData->codeccxx . . $ GameData#codec. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). tmp; |
| 1247 | else |
| 1248 | gameData->codeccxx . . $ GameData#codec. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(ced63f7c635d850d).(); |
| 1249 | //probably should either be Latin1 or some default codec from somewhere FIXME |
| 1250 | |
| 1251 | // White player name |
| 1252 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "PW"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1253 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1254 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1255 | gameData->white_namecxx . . $ GameData#white_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). tmp; |
| 1256 | else |
| 1257 | gameData->white_namecxx . . $ GameData#white_name. =cxx . . $ QString#`operator=`(d02845eef0c33901). "White"; |
| 1258 | |
| 1259 | // White player rank |
| 1260 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "WR"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1261 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1262 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1263 | gameData->white_rankcxx . . $ GameData#white_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). tmp; |
| 1264 | else |
| 1265 | gameData->white_rankcxx . . $ GameData#white_rank. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 1266 | |
| 1267 | // Black player name |
| 1268 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "PB"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1269 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1270 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1271 | gameData->black_namecxx . . $ GameData#black_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). tmp; |
| 1272 | else |
| 1273 | gameData->black_namecxx . . $ GameData#black_name. =cxx . . $ QString#`operator=`(d02845eef0c33901). "Black"; |
| 1274 | |
| 1275 | // Black player rank |
| 1276 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "BR"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1277 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1278 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1279 | gameData->black_rankcxx . . $ GameData#black_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). tmp; |
| 1280 | else |
| 1281 | gameData->black_rankcxx . . $ GameData#black_rank. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 1282 | |
| 1283 | // Board size |
| 1284 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "SZ"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1285 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1286 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1287 | gameData->board_sizecxx . . $ GameData#board_size. = tmp.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 1288 | else |
| 1289 | gameData->board_sizecxx . . $ GameData#board_size. = 19; |
| 1290 | |
| 1291 | // Komi |
| 1292 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "KM"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1293 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1294 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1295 | gameData->komicxx . . $ GameData#komi. = tmp.toFloatcxx . . $ QString#toFloat(abac0204e50f9cf0).(); |
| 1296 | else |
| 1297 | gameData->komicxx . . $ GameData#komi. = 0.0; |
| 1298 | |
| 1299 | // Handicap |
| 1300 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "HA"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1301 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1302 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1303 | gameData->handicapcxx . . $ GameData#handicap. = tmp.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 1304 | else |
| 1305 | gameData->handicapcxx . . $ GameData#handicap. = 0; |
| 1306 | |
| 1307 | // Result |
| 1308 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "RE"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1309 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1310 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1311 | gameData->resultcxx . . $ GameData#result. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). tmp; |
| 1312 | else |
| 1313 | gameData->resultcxx . . $ GameData#result. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 1314 | |
| 1315 | // Date |
| 1316 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "DT"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1317 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1318 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1319 | gameData->datecxx . . $ GameData#date. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). tmp; |
| 1320 | else |
| 1321 | gameData->datecxx . . $ GameData#date. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 1322 | |
| 1323 | // Place |
| 1324 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "PC"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1325 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1326 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1327 | gameData->placecxx . . $ GameData#place. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). tmp; |
| 1328 | else |
| 1329 | gameData->placecxx . . $ GameData#place. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 1330 | |
| 1331 | // Copyright |
| 1332 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "CP"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1333 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1334 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1335 | gameData->copyrightcxx . . $ GameData#copyright. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). tmp; |
| 1336 | else |
| 1337 | gameData->copyrightcxx . . $ GameData#copyright. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 1338 | |
| 1339 | // Game Name |
| 1340 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "GN"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1341 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1342 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1343 | gameData->gameNamecxx . . $ GameData#gameName. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). tmp; |
| 1344 | else |
| 1345 | gameData->gameNamecxx . . $ GameData#gameName. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 1346 | |
| 1347 | // Comments style |
| 1348 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "ST"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1349 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1350 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1351 | gameData->stylecxx . . $ GameData#style. = tmp.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 1352 | else |
| 1353 | gameData->stylecxx . . $ GameData#style. = 1; |
| 1354 | |
| 1355 | // Timelimit |
| 1356 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "TM"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1357 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1358 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1359 | { |
| 1360 | gameData->timelimitcxx . . $ GameData#timelimit. = tmp.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 1361 | gameData->timeSystemcxx . . $ GameData#timeSystem. = absolutecxx . . $ absolute.; |
| 1362 | } |
| 1363 | else |
| 1364 | { |
| 1365 | gameData->timelimitcxx . . $ GameData#timelimit. = 0; |
| 1366 | gameData->timeSystemcxx . . $ GameData#timeSystem. = nonecxx . . $ none.; |
| 1367 | } |
| 1368 | |
| 1369 | // Overtime == time system |
| 1370 | if (!parsePropertycxx . . $ SGFParser#parseProperty(a6729626391d1613).(toParse, "OT"cxx . . $ QString#QString(85c52e162fed56f9)., tmp)) |
| 1371 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1372 | if (!tmp.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1373 | { |
| 1374 | gameData->overtimecxx . . $ GameData#overtime. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). tmp; |
| 1375 | if (tmp.containscxx . . $ QString#contains(8cce4688c16f48f3).("byo-yomi"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 1376 | { |
| 1377 | // type: OT[5x30 byo-yomi] |
| 1378 | gameData->timeSystemcxx . . $ GameData#timeSystem. = byoyomicxx . . $ byoyomi.; |
| 1379 | int pos1, pos2; |
| 1380 | if ((pos1 = tmp.indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).("x"cxx . . $ QString#QString(85c52e162fed56f9).)) != -1) |
| 1381 | { |
| 1382 | pos2 = tmp.indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).("byo"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 1383 | QStringcxx . . $ QString# time = tmp.midcxx . . $ QString#mid(44b7563da18aea72).(pos1+1, pos2-pos1-1); |
| 1384 | /*gameData->byoTime = time.toInt(); |
| 1385 | gameData->byoPeriods = tmp.left(pos1).toInt(); |
| 1386 | gameData->byoStones = 0;*/ |
| 1387 | //FIXME okay? |
| 1388 | gameData->periodtimecxx . . $ GameData#periodtime. = time.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 1389 | gameData->stones_periodscxx . . $ GameData#stones_periods. = tmp.leftcxx . . $ QString#left(3f3c3d0e9c0eb37f).(pos1).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 1390 | #ifdef FIXME |
| 1391 | qDebug(QString("byoyomi time system: %1 Periods at %2 seconds").arg(gameData->stones_periods).arg(gameData->periodtime).toLatin1().constData()); |
| 1392 | #endif //FIXME |
| 1393 | } |
| 1394 | } |
| 1395 | else if (tmp.containscxx . . $ QString#contains(8cce4688c16f48f3).(":"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 1396 | { |
| 1397 | // type: OT[3:30] = byo-yomi?; |
| 1398 | int pos1; |
| 1399 | gameData->timeSystemcxx . . $ GameData#timeSystem. = byoyomicxx . . $ byoyomi.; |
| 1400 | if ((pos1 = tmp.indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).(":"cxx . . $ QString#QString(85c52e162fed56f9).)) != -1) |
| 1401 | { |
| 1402 | QStringcxx . . $ QString# time = tmp.leftcxx . . $ QString#left(3f3c3d0e9c0eb37f).(pos1); |
| 1403 | int t = time.toIntcxx . . $ QString#toInt(d7972accae11ee1f).()*60 + tmp.rightcxx . . $ QString#right(3f3c3d0e9c0eb37f).(tmp.lengthcxx . . $ QString#length(455f465bc33b4cdf).() - pos1 - 1).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 1404 | gameData->periodtimecxx . . $ GameData#periodtime. = 30; |
| 1405 | gameData->stones_periodscxx . . $ GameData#stones_periods. = t/gameData->periodtimecxx . . $ GameData#periodtime.; |
| 1406 | //gameData->byoStones = 0; |
| 1407 | |
| 1408 | ////////////////////FIXME qDebug(QString("byoyomi time system: %1 Periods at %2 seconds").arg(gameData->byoPeriods).arg(gameData->byoTime)); |
| 1409 | } |
| 1410 | } |
| 1411 | else if (tmp.containscxx . . $ QString#contains(8cce4688c16f48f3).("Canadian"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 1412 | { |
| 1413 | // type: OT[25/300 Canadian] |
| 1414 | gameData->timeSystemcxx . . $ GameData#timeSystem. = canadiancxx . . $ canadian.; |
| 1415 | int pos1, pos2; |
| 1416 | if ((pos1 = tmp.indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).("/"cxx . . $ QString#QString(85c52e162fed56f9).)) != -1) |
| 1417 | { |
| 1418 | pos2 = tmp.indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).("Can"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 1419 | QStringcxx . . $ QString# time = tmp.midcxx . . $ QString#mid(44b7563da18aea72).(pos1+1, pos2-pos1-1); |
| 1420 | gameData->periodtimecxx . . $ GameData#periodtime. = time.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 1421 | gameData->stones_periodscxx . . $ GameData#stones_periods. = tmp.leftcxx . . $ QString#left(3f3c3d0e9c0eb37f).(pos1).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 1422 | |
| 1423 | /////////////////////// qDebug(QString("Canadian time system: %1 seconds at %2 stones").arg(gameData->byoTime).arg(gameData->byoStones)); |
| 1424 | } |
| 1425 | } |
| 1426 | |
| 1427 | // simple check |
| 1428 | if (gameData->stones_periodscxx . . $ GameData#stones_periods. < 0) |
| 1429 | gameData->stones_periodscxx . . $ GameData#stones_periods. = 0; |
| 1430 | if (gameData->periodtimecxx . . $ GameData#periodtime. <= 0) |
| 1431 | { |
| 1432 | gameData->periodtimecxx . . $ GameData#periodtime. = 0; |
| 1433 | // gameData->timeSystem = none; |
| 1434 | } |
| 1435 | } |
| 1436 | else |
| 1437 | { |
| 1438 | gameData->overtimecxx . . $ GameData#overtime. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 1439 | // gameData->timeSystem = none; |
| 1440 | gameData->stones_periodscxx . . $ GameData#stones_periods. = 0; |
| 1441 | } |
| 1442 | |
| 1443 | // Game number |
| 1444 | gameData->numbercxx . . $ GameData#number. = 0; |
| 1445 | |
| 1446 | gameData->fileNamecxx . . $ GameData#fileName. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). fileName; |
| 1447 | |
| 1448 | // boardHandler->board->initGame(gameData, true); // Set sgf flag |
| 1449 | |
| 1450 | return gameData ; |
| 1451 | } |
| 1452 | |
| 1453 | /* |
| 1454 | * takes a game tree, and puts it in SGF format |
| 1455 | */ |
| 1456 | bool SGFParsercxx . . $ SGFParser#::exportSGFtoClipBcxx . . $ SGFParser#exportSGFtoClipB(dfc9a3f638d89e9e).(QStringcxx . . $ QString# *str, Treecxx . . $ Tree# *tree, GameDatacxx . . $ GameData# *gd) |
| 1457 | { |
| 1458 | Q_CHECK_PTRcxx . . $ `<external>/15045578679651060896/qglobal.h:890:11`!(tree); |
| 1459 | |
| 1460 | if (streamcxx . . $ SGFParser#stream. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 1461 | delete streamcxx . . $ SGFParser#stream.; |
| 1462 | streamcxx . . $ SGFParser#stream. = new QTextStreamcxx . . $ QTextStream#QTextStream(16e3d097052a73db).(str, QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::WriteOnlycxx . . $ QIODevice#WriteOnly.); |
| 1463 | |
| 1464 | bool res = writeStreamcxx . . $ SGFParser#writeStream(a1dbb529edb79e02).(tree,gd); |
| 1465 | |
| 1466 | delete streamcxx . . $ SGFParser#stream.; |
| 1467 | streamcxx . . $ SGFParser#stream. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1468 | return res; |
| 1469 | } |
| 1470 | |
| 1471 | /* |
| 1472 | * Opens a file for saving SGF |
| 1473 | */ |
| 1474 | bool SGFParsercxx . . $ SGFParser#::doWritecxx . . $ SGFParser#doWrite(19af0a447565f6f7).(const QStringcxx . . $ QString# &fileName, Treecxx . . $ Tree# *tree, GameDatacxx . . $ GameData# *gameData) |
| 1475 | { |
| 1476 | Q_CHECK_PTRcxx . . $ `<external>/15045578679651060896/qglobal.h:890:11`!(tree); |
| 1477 | |
| 1478 | QFilecxx . . $ QFile# filecxx . . $ QFile#QFile(3520e46b33348bf6).(fileName); |
| 1479 | |
| 1480 | if (!file.opencxx . . $ QFile#open(dca164408be960c8).(QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::WriteOnlycxx . . $ QIODevice#WriteOnly.)) |
| 1481 | { |
| 1482 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(0, PACKAGEcxx . . $ `src/defines.h:32:9`!, QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Could not open file:") +cxx . . $ operator+(3d22f08efddf8107). " " +cxx . . $ operator+(fab9b4f80031f353). fileName); |
| 1483 | return false; |
| 1484 | } |
| 1485 | |
| 1486 | if (streamcxx . . $ SGFParser#stream. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 1487 | delete streamcxx . . $ SGFParser#stream.; |
| 1488 | streamcxx . . $ SGFParser#stream. = new QTextStreamcxx . . $ QTextStream#QTextStream(bebe8f2dee7f9e86).(&file); |
| 1489 | |
| 1490 | bool res = writeStreamcxx . . $ SGFParser#writeStream(a1dbb529edb79e02).(tree, gameData ); |
| 1491 | |
| 1492 | file.flushcxx . . $ QFileDevice#flush(c9857a73d68e59ba).(); |
| 1493 | file.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 1494 | delete streamcxx . . $ SGFParser#stream.; |
| 1495 | streamcxx . . $ SGFParser#stream. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1496 | return res; |
| 1497 | } |
| 1498 | |
| 1499 | /* |
| 1500 | * Writes the SGF code for whot 'tree' into the 'stream' |
| 1501 | */ |
| 1502 | bool SGFParsercxx . . $ SGFParser#::writeStreamcxx . . $ SGFParser#writeStream(a1dbb529edb79e02).(Treecxx . . $ Tree# *tree, GameDatacxx . . $ GameData# *gameData) |
| 1503 | { |
| 1504 | Q_CHECK_PTRcxx . . $ `<external>/15045578679651060896/qglobal.h:890:11`!(stream); |
| 1505 | if (!setCodeccxx . . $ SGFParser#setCodec(7dc6c9a0b6a7270f).(gameDatacxx . . $ QString#QString(132dd6869045752b).->codeccxx . . $ GameData#codec.)) |
| 1506 | { |
| 1507 | QMessageBoxcxx . . $ QMessageBox#::criticalcxx . . $ QMessageBox#critical(a9e3742e6f7b4147).(0, PACKAGEcxx . . $ `src/defines.h:32:9`!, QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Invalid text encoding given. Please check preferences!")); |
| 1508 | delete streamcxx . . $ SGFParser#stream.; |
| 1509 | return false; |
| 1510 | } |
| 1511 | |
| 1512 | Movecxx . . $ Move# *root = tree->getRootcxx . . $ Tree#getRoot(8db4894deadf6b2c).(); |
| 1513 | if (root == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 1514 | return false; |
| 1515 | |
| 1516 | // GameData *gameData = boardHandler->getGameData(); |
| 1517 | |
| 1518 | // Traverse the tree recursive in pre-order |
| 1519 | isRootcxx . . $ SGFParser#isRoot. = true; |
| 1520 | traversecxx . . $ SGFParser#traverse(7bd869106604c0e4).(root, gameData); |
| 1521 | |
| 1522 | return true; |
| 1523 | } |
| 1524 | |
| 1525 | /* |
| 1526 | * Writes the SGF header data from gameData into the 'stream' |
| 1527 | */ |
| 1528 | void SGFParsercxx . . $ SGFParser#::writeGameHeadercxx . . $ SGFParser#writeGameHeader(53acbc9cc3152f0d).(GameDatacxx . . $ GameData# *gameData) |
| 1529 | { |
| 1530 | // Assemble data for root node |
| 1531 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). ";GM[1]FF[4]" // We play Go, we use FF 4 |
| 1532 | <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "AP[" <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). PACKAGEcxx . . $ `src/defines.h:32:9`! <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). ":" <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). VERSIONcxx . . $ `src/defines.h:33:9`! <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; // Application name : Version |
| 1533 | if (gameData->stylecxx . . $ GameData#style. >= 0 && gameData->stylecxx . . $ GameData#style. <= 4) |
| 1534 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "ST[" <<cxx . . $ QTextStream#`operator<<`(b419665206d30821). gameData->stylecxx . . $ GameData#style. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; |
| 1535 | else |
| 1536 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "ST[1]"; // We show vars of current node |
| 1537 | if(gameData->codeccxx . . $ GameData#codec. !=cxx . . $ `operator!=`(5bc2975d2d751687). QStringcxx . . $ QString#QString(ced63f7c635d850d).()) |
| 1538 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "CA[" <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). gameData->codeccxx . . $ GameData#codec. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; |
| 1539 | if (gameData->gameNamecxx . . $ GameData#gameName..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) // Skip game name if empty |
| 1540 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ `operator<<`(f27eeb5c966d2dd0). endlcxx . . $ QTextStreamFunctions/endl(e06208c9acdf85a).; |
| 1541 | else |
| 1542 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "GN[" <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). gameData->gameNamecxx . . $ GameData#gameName. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]" // Game Name |
| 1543 | <<cxx . . $ `operator<<`(f27eeb5c966d2dd0). endlcxx . . $ QTextStreamFunctions/endl(e06208c9acdf85a).; |
| 1544 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "SZ[" <<cxx . . $ QTextStream#`operator<<`(65f79395295a5117). gameData->board_sizecxx . . $ GameData#board_size. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]" // Board size |
| 1545 | <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "HA[" <<cxx . . $ QTextStream#`operator<<`(65f79395295a5117). gameData->handicapcxx . . $ GameData#handicap. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]" // Handicap |
| 1546 | <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "KM[" <<cxx . . $ QTextStream#`operator<<`(13c5a264650b7b60). gameData->komicxx . . $ GameData#komi. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; // Komi |
| 1547 | // << endl; |
| 1548 | |
| 1549 | if (gameData->timelimitcxx . . $ GameData#timelimit. != 0) |
| 1550 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "TM[" <<cxx . . $ QTextStream#`operator<<`(b419665206d30821). gameData->timelimitcxx . . $ GameData#timelimit. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; // Timelimit |
| 1551 | |
| 1552 | if (!gameData->overtimecxx . . $ GameData#overtime..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1553 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "OT[" <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). gameData->overtimecxx . . $ GameData#overtime. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]" <<cxx . . $ `operator<<`(f27eeb5c966d2dd0). endlcxx . . $ QTextStreamFunctions/endl(e06208c9acdf85a).; // Overtime |
| 1554 | |
| 1555 | if (!gameData->white_namecxx . . $ GameData#white_name..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1556 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "PW[" <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). gameData->white_namecxx . . $ GameData#white_name. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; // White name |
| 1557 | |
| 1558 | if (!gameData->white_rankcxx . . $ GameData#white_rank..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1559 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "WR[" <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). gameData->white_rankcxx . . $ GameData#white_rank. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; // White rank |
| 1560 | |
| 1561 | if (!gameData->black_namecxx . . $ GameData#black_name..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1562 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "PB[" <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). gameData->black_namecxx . . $ GameData#black_name. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; // Black name |
| 1563 | |
| 1564 | if (!gameData->black_rankcxx . . $ GameData#black_rank..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1565 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "BR[" <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). gameData->black_rankcxx . . $ GameData#black_rank. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; // Black rank |
| 1566 | |
| 1567 | if (!gameData->resultcxx . . $ GameData#result..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1568 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "RE[" <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). gameData->resultcxx . . $ GameData#result. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; // Result |
| 1569 | |
| 1570 | if (!gameData->datecxx . . $ GameData#date..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1571 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "DT[" <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). gameData->datecxx . . $ GameData#date. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; // Date |
| 1572 | |
| 1573 | if (!gameData->placecxx . . $ GameData#place..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1574 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "PC[" <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). gameData->placecxx . . $ GameData#place. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; // Place |
| 1575 | |
| 1576 | if (!gameData->copyrightcxx . . $ GameData#copyright..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 1577 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "CP[" <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). gameData->copyrightcxx . . $ GameData#copyright. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "]"; // Copyright |
| 1578 | |
| 1579 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ `operator<<`(f27eeb5c966d2dd0). endlcxx . . $ QTextStreamFunctions/endl(e06208c9acdf85a).; |
| 1580 | } |
| 1581 | |
| 1582 | /* |
| 1583 | * traverses the tree from move 't', and stores SGF code into 'stream' |
| 1584 | */ |
| 1585 | void SGFParsercxx . . $ SGFParser#::traversecxx . . $ SGFParser#traverse(7bd869106604c0e4).(Movecxx . . $ Move# *t, GameDatacxx . . $ GameData# *gameData) |
| 1586 | { |
| 1587 | QStringcxx . . $ QString# txtcxx . . $ QString#QString(ced63f7c635d850d).; |
| 1588 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "("; |
| 1589 | int col = -1, cnt = 6; |
| 1590 | |
| 1591 | |
| 1592 | do { |
| 1593 | if (isRootcxx . . $ SGFParser#isRoot.) |
| 1594 | { |
| 1595 | writeGameHeadercxx . . $ SGFParser#writeGameHeader(53acbc9cc3152f0d).(gameData); |
| 1596 | txt =cxx . . $ QString#`operator=`(49ea8750b4987a17). t->saveMovecxx . . $ Move#saveMove(8bafd9946dc70e68).(isRootcxx . . $ SGFParser#isRoot.).toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).(); //utf8 might only be necessary if gameData->codec is set, but should be okay either way |
| 1597 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). txt; |
| 1598 | isRootcxx . . $ SGFParser#isRoot. = false; |
| 1599 | } |
| 1600 | else |
| 1601 | { |
| 1602 | // do some formatting: add single B[]/W[] properties to one line, max: 10 |
| 1603 | // if more properties, e.g. B[]PL[]C] -> new line |
| 1604 | txt =cxx . . $ QString#`operator=`(49ea8750b4987a17). t->saveMovecxx . . $ Move#saveMove(8bafd9946dc70e68).(false).toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).(); |
| 1605 | if(txt ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). ";") //don't save empty nodes |
| 1606 | txt =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 1607 | int cnt_old = cnt; |
| 1608 | cnt = txt.lengthcxx . . $ QString#length(455f465bc33b4cdf).(); |
| 1609 | if (col % 10 == 0 || (col == 1 && cnt != 6) || cnt_old != 6 || col == -1) |
| 1610 | { |
| 1611 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ `operator<<`(f27eeb5c966d2dd0). endlcxx . . $ QTextStreamFunctions/endl(e06208c9acdf85a).; |
| 1612 | col = 0; |
| 1613 | } |
| 1614 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). txt; |
| 1615 | col++; |
| 1616 | } |
| 1617 | |
| 1618 | Movecxx . . $ Move# *tmp = t->soncxx . . $ Move#son.; |
| 1619 | if (tmp != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! && tmp->brothercxx . . $ Move#brother. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 1620 | { |
| 1621 | do { |
| 1622 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ `operator<<`(f27eeb5c966d2dd0). endlcxx . . $ QTextStreamFunctions/endl(e06208c9acdf85a).; |
| 1623 | traversecxx . . $ SGFParser#traverse(7bd869106604c0e4).(tmp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1624 | } while ((tmp = tmp->brothercxx . . $ Move#brother.) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1625 | break; |
| 1626 | } |
| 1627 | } while ((t = t->soncxx . . $ Move#son.) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1628 | *streamcxx . . $ SGFParser#stream. <<cxx . . $ `operator<<`(f27eeb5c966d2dd0). endlcxx . . $ QTextStreamFunctions/endl(e06208c9acdf85a). <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). ")"; |
| 1629 | } |