]> code.delx.au - gnu-emacs-elpa/blob - packages/arbitools/arbitools.el
Merge commit '67fa7e1a60966e49eccf21b02110af12afa995e0'
[gnu-emacs-elpa] / packages / arbitools / arbitools.el
1 ;;; arbitools.el --- Package for chess tournaments administration
2
3 ;; Copyright 2016 Free Software Foundation, Inc.
4
5 ;; Author: David Gonzalez Gandara <dggandara@member.fsf.org>
6 ;; Version: 0.53
7 ;; Package-Requires: ((cl-lib "0.5"))
8
9 ;; This program is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
13 ;;
14 ;; This program is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18 ;;
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22 ;;; Commentary:
23
24 ;; REQUIRES:
25 ;; ---------------------------
26 ;; Some functions require the arbitools python package, you can install
27 ;; it by: "pip3 install arbitools"
28 ;; "pdflatex" is necessary in case you want to get pdfs.
29 ;;
30 ;; USAGE:
31 ;; ---------------------------
32 ;; arbitools.el is an interface for the python package "arbitools",
33 ;; designed to manage chess tournament reports. If you don't install the
34 ;; python package you can still have the syntax colouring and some native
35 ;; functions. In the future, all the functions will be translated to ELISP.
36 ;;
37 ;; FEATURES:
38 ;; ----------------------------
39 ;; - Syntax colouring for the official trf FIDE files. This facilitates
40 ;; manual edition of the files.
41 ;;
42 ;; - Updating the players ratings. - with python
43 ;;
44 ;; - Adding players to an existing file. - with python
45 ;;
46 ;; - Getting standings from a tournament file. -with python
47 ;;
48 ;; - Getting IT3 Tournament report form. - with python
49 ;;
50 ;; - Deleting a round. - Native
51 ;;
52 ;; - Insert result. - Native
53 ;;
54 ;; - Insert player. - Native
55 ;;
56 ;; - Get the pairing or results of a round - Native
57 ;;
58 ;; - Get the list of the players - Native
59 ;;
60 ;; - Delete player. Adjust all rank numbers - Native
61 ;;
62 ;; TODO:
63 ;; ---------------------------------
64 ;;
65 ;; - Automatically purge all players who didn't play any games.
66 ;;
67 ;; - Insert results from a results file created with a pairing program.
68 ;; Add the date in the "132" line and the results in the "001" lines.
69 ;;
70 ;; - Add empty round. Ask for date create empty space in the players lines.
71 ;; Add the date in the "132" line.
72 ;;
73 ;; - Add the rank number and the position automatically when adding players.
74 ;;
75 ;; - Add team.
76 ;;
77 ;; - Add player to team. Prompt for team and player number.
78 ;;
79 ;; - Generate pgn file for a round or the whole tournament.
80 ;;
81 ;; - Adjust points for each player, according to results of rounds
82 ;;
83 ;; - Reorder the ranking
84 ;;
85 ;; - Reorder the players list
86 ;;
87 ;; - Print Stantings
88 ;;
89 ;; You will find more information in www.ourenxadrez.org/arbitools.htm
90
91 ;;; Code:
92
93 (eval-when-compile (require 'cl-lib))
94
95 (defun arbitools-update (elolist)
96 "Update the players ratings in a database file based on a elo list file."
97 (interactive "selolist:")
98 ;; FIXME: What if `list' is "foo; bar"?
99 (call-process "arbitools-run.py" nil "Arbitools-output" nil "update" buffer-file-name "-l" elolist))
100
101 (defun arbitools-add (addfile)
102 "Add players to an existing database file."
103 (interactive "faddfile: ")
104 ;; FIXME: What if `addlist' is "foo; bar"?
105 (call-process "arbitools-add.py" nil "Arbitools-output" nil "-a" addfile "-i" buffer-file-name))
106
107 (defun arbitools-list-pairing (round)
108 "Get the pairings and/or results of the given round"
109 (interactive "sround: ")
110 (goto-char (point-min))
111 (arbitools-list-players)
112 (save-excursion
113 (re-search-forward "^012" nil t)
114 (let* ((linestring (thing-at-point 'line))
115 (tournamentnamestring (substring linestring 4)))
116 (with-current-buffer "Pairings List"
117 (erase-buffer)
118 (insert (format "%s" tournamentnamestring)))))
119 (with-current-buffer "Pairings List"
120 (insert (format "Pairings for round %s\n\n" round)) )
121 (let* ((paired '()))
122
123 (while (re-search-forward "^001" nil t)
124 (let* ((namestring nil)
125 (linestring (thing-at-point 'line))
126 (playerlinestring nil)
127 (opponentlinestring nil)
128 opponentstring
129 (rankstring (substring linestring 4 8))
130 (opponent (substring linestring (+ 91 (* (- (string-to-number round) 1)10 ))
131 (+ 95(* (- (string-to-number round) 1)10 ))))
132 (color (substring linestring (+ 96 (* (- (string-to-number round) 1)10 ))
133 (+ 97(* (- (string-to-number round) 1)10 ))))
134 (result (substring linestring (+ 98 (* (- (string-to-number round) 1)10 ))
135 (+ 99(* (- (string-to-number round) 1)10 )))))
136 (with-current-buffer "Arbitools-output"
137 (insert (format "%s\n" paired))
138 (insert (format "-%s-" rankstring))
139 (insert (format "%s\n" (member " 1" paired))))
140 (unless (or (member rankstring paired) (member opponent paired))
141 (with-current-buffer "List of players"
142 (goto-char (point-min))
143 (re-search-forward (concat "^" (regexp-quote rankstring)))
144 (setq playerlinestring (thing-at-point 'line))
145 (setq namestring (substring playerlinestring 4 37))
146 (goto-char (point-min))
147 (unless (or (string= opponent "0000") (string= opponent " "))
148 (re-search-forward (concat "^" (regexp-quote opponent))))
149 (setq opponentlinestring (thing-at-point 'line))
150 (setq opponentstring (substring opponentlinestring 4 37))
151 (when (or (string= opponent "0000")(string= opponent " "))
152 (setq opponentstring "-"))
153 (cl-pushnew rankstring paired :test #'equal))
154 (with-current-buffer "Pairings List"
155 (cond ((string= color "w") ;; TODO: change the ranknumber with the name
156 (cond ((string= result "1")
157 (insert (format "%s 1-0 %s\n" namestring opponentstring)))
158 ((string= result "0")
159 (insert (format "%s 0-1 %s\n" namestring opponentstring)))
160 ((string= result "+")
161 (insert (format "%s + - %s\n" namestring opponentstring)))
162 ((string= result "-")
163 (insert (format "%s - + %s\n" namestring opponentstring)))
164 ((string= result "=")
165 (insert (format "%s 1/2 %s\n" namestring opponentstring)))))
166 ((string= color "b")
167 (cond ((string= result "1")
168 (insert (format "%s 0-1 %s\n" opponentstring namestring)))
169 ((string= result "0")
170 (insert (format "%s 1-0 %s\n" opponentstring namestring)))
171 ((string= result "+")
172 (insert (format "%s - + %s\n" opponentstring namestring)))
173 ((string= result "-")
174 (insert (format "%s + - %s\n" opponentstring namestring)))
175 ((string= result "=")
176 (insert (format "%s 1/2 %s\n" opponentstring namestring))))))))))))
177
178
179 (defun arbitools-standings ()
180 "Get standings and report files from a tournament file."
181 (interactive)
182 ;; (shell-command (concat (expand-file-name "arbitools-standings.py") " -i " buffer-file-name))) ;this is to use the actual path
183 (call-process "arbitools-run.py" nil "Arbitools-output" nil "standings" buffer-file-name))
184
185 (defun arbitools-list-players ()
186 "Put the list of players in two buffers, one in plain text and another in a beautiful LaTeX"
187 ;; TODO: the beautiful LaTeX
188 (interactive)
189 (save-excursion
190 (goto-char (point-min))
191 (while (re-search-forward "^001" nil t)
192 (let* ((linestring (thing-at-point 'line))
193 (rankstring (substring linestring 5 8)))
194
195 (with-current-buffer "List of players"
196 (insert (format " %s " rankstring))))
197
198 (let* ((linestring (thing-at-point 'line))
199 (namestring (substring linestring 14 47)))
200
201 (with-current-buffer "List of players"
202 (insert (format "%s " namestring))))
203
204 (let* ((linestring (thing-at-point 'line))
205 (elostring (substring linestring 48 52)))
206
207 (with-current-buffer "List of players"
208 (insert (format "%s\n" elostring))))))
209 (with-current-buffer "List of players"
210 (remove-text-properties (point-min)(point-max) '(face nil))))
211
212 (defun arbitools-new-trf ()
213 "Create an empty trf file"
214 (interactive)
215 (generate-new-buffer "New trf")
216 (switch-to-buffer "New trf")
217 (set-buffer "New trf")
218 (arbitools-mode)
219 (insert "012 NAME OF THE TOURNAMENT\n")
220 (insert "022 PLACE\n")
221 (insert "032 FEDERATION\n")
222 (insert "042 STARTING DATE (YYYY/MM/DD)\n")
223 (insert "052 ENDING DATE (YYYY/MM/DD)\n")
224 (insert "062 NUMBER OF PLAYERS\n")
225 (insert "072 NUMBER OF RATED PLAYERS\n")
226 (insert "082 NUMBER OF TEAMS\n")
227 (insert "092 TYPE OF TOURNAMENT\n")
228 (insert "102 CHIEF ARBITER\n")
229 (insert "112 DEPUTY CHIEF ARBITER\n")
230 (insert "122 ALLOTED TIMES PER MOVE/GAME\n")
231 (insert "132 DATES YY/MM/DD YY/MM/DD\n")
232 ;; (insert "001 000 GTIT NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN RAT. FED 0000000000 YYYY/MM/DD 00.0 RNK 0000 C R 0000 C R\n")
233 ;; (insert "013 NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN 0000 0000\n")
234 )
235
236 ;; (defun aribitools-number-of-rounds ()
237 ;; "Get the number of rounds in the tournament"
238 ;; FIXME: EXPERIMENTAL
239 ;; (let ((numberofrounds 0))
240 ;; (save-excursion
241 ;; (goto-char (point-min))
242 ;; (re-search-forward "^132" nil t)
243 ;; (let* ((linestringrounds (thing-at-point 'line))
244 ;; (actualround " ")
245 ;; (beginning-of-round 91)
246 ;; (end-of-round 99)
247 ;; (continue t))
248
249 ;; (with-current-buffer "Arbitools-output" (insert (format "rounds: %s" linestringrounds)))
250 ;; (with-current-buffer "Arbitools-output" (insert (format "length: %s" (- (length linestringrounds) 4))))
251 ;; For some reason, the length of the string is 4 characters longer than the real line
252 ;; (while continue
253 ;; (if (< end-of-round (length linestringrounds))
254
255 ;; (progn
256 ;; (setq actualround (substring-no-properties linestringrounds beginning-of-round end-of-round))
257 ;; (setq numberofrounds (+ numberofrounds 1))
258 ;; (setq beginning-of-round (+ beginning-of-round 10))
259 ;; (setq end-of-round (+ end-of-round 10)))
260
261 ;; (setq continue nil))))))
262 ;; (numberofrounds))
263
264 (defun arbitools-delete-player (player)
265 "Delete a player. Adjust all the rank numbers accordingly."
266 (interactive "splayer: ")
267 (let ((numberofrounds 0)
268 (elo ""))
269
270 (save-excursion
271 (goto-char (point-min))
272 (re-search-forward "^132" nil t)
273 (let* ((linestringrounds (thing-at-point 'line))
274 ;; (actualround " ")
275 (beginning-of-round 91)
276 (end-of-round 99)
277 (continue t))
278 (while continue
279 (if (< end-of-round (length linestringrounds))
280 (progn
281 ;; (setq actualround (substring-no-properties linestringrounds beginning-of-round end-of-round))
282 (setq numberofrounds (+ numberofrounds 1))
283 (setq beginning-of-round (+ beginning-of-round 10))
284 (setq end-of-round (+ end-of-round 10)))
285 (setq continue nil)))))
286 (save-excursion
287 (goto-char (point-min))
288 (while (re-search-forward "^001" nil t)
289 (let* ((linestring (thing-at-point 'line))
290 (rankstring (substring linestring 5 8)))
291 (when (= (string-to-number rankstring) (string-to-number player))
292 (forward-char 1)
293 (delete-char 4)
294 (insert " DEL")
295 (setq elo (substring linestring 48 52))
296 (with-current-buffer "Arbitools-output" (insert (format "%s" elo))))
297 (when (> (string-to-number rankstring)(string-to-number player))
298 (forward-char 1)
299 (delete-char 4)
300 (insert-char ?\s (- 4 (length (format "%s" (- (string-to-number rankstring) 1)))))
301 (insert (format "%s" (- (string-to-number rankstring) 1)))
302 (save-excursion
303 (goto-char (point-min))
304 (while (re-search-forward "^001" nil t)
305 (let* ((roundcount 1))
306 (while (<= roundcount numberofrounds)
307 (beginning-of-line)
308 (forward-char (+ 95 (* (- roundcount 1) 10)))
309 (when (string= (format "%s" (string-to-number rankstring)) (thing-at-point 'word))
310 (forward-char -4) ;; go back to the beginning of the opponent's number
311 (delete-char 4) ;; remove the original opponent's number
312 (insert-char ?\s (- 4 (length (format "%s" (- (string-to-number rankstring) 1)))))
313 (insert (format "%s" (- (string-to-number rankstring) 1))))
314 (setq roundcount (+ roundcount 1))))
315 ;;(condition-case nil ;; TODO: fix teams info
316 (save-excursion
317 (while (re-search-forward "^013" nil t)
318 (let* ((linestringteam (thing-at-point 'line))
319 (actualintegrant (string-to-number (substring linestringteam 40 44)))
320 (integrantcount 0)
321 (members 0))
322
323 ;; to find the end of the line, the number is length -2, for some reason
324 (setq members (/ (- (- (length linestringteam) 2) 34) 5)) ;; calculate number of members
325
326 (while (< integrantcount members)
327 (beginning-of-line)
328 (forward-char (+ 40 (* (- integrantcount 1) 5)))
329 (when (string= (format "%s" (string-to-number rankstring)) (thing-at-point 'word))
330 (forward-char -4)
331 (delete-char 4)
332 (insert-char ?\s (- 4 (length (format "%s" (- (string-to-number rankstring) 1)))))
333 (insert (format "%s" (- (string-to-number rankstring) 1))))
334 (setq integrantcount (+ integrantcount 1))))))))))))
335
336 (save-excursion ;; Actually delete the player's line
337 (goto-char (point-min))
338 (while (re-search-forward "^001 DEL" nil t)
339 (beginning-of-line)
340 (let ((beg (point)))
341 (forward-line 1)
342 (delete-region beg (point)))))
343 ;; TODO delete the rank from teams section
344 ;; TODO change number of players and number of rated players
345 (save-excursion
346 (with-current-buffer "Arbitools-output" (insert (format "%s" elo)))
347 (goto-char (point-min))
348 (re-search-forward "^062 ")
349 (let* ((linestring (thing-at-point 'line))
350 (numberofplayers (substring linestring 4)))
351 (delete-char (length numberofplayers))
352 (setq numberofplayers (string-to-number numberofplayers))
353 (setq numberofplayers (- numberofplayers 1))
354 (insert (concat (number-to-string numberofplayers) "\n")))
355 (re-search-forward "^072 ")
356 (let* ((linestring (thing-at-point 'line))
357 (numberofratedplayers (substring linestring 4)))
358 (unless (< (length elo) 2) ;; if elo is 0 or nonexistent
359 (delete-char (length numberofratedplayers))
360 (setq numberofratedplayers (string-to-number numberofratedplayers))
361 (setq numberofratedplayers (- numberofratedplayers 1))
362 (insert (concat (number-to-string numberofratedplayers) "\n")))))))
363
364 (defun arbitools-delete-round (round)
365 "Delete a round." ;; FIXME: it breaks when round is the last
366 (interactive "sround: ")
367 (save-excursion
368 (goto-char (point-min))
369 (while (re-search-forward "^001" nil t)
370 (forward-char (+ 88 (* (- (string-to-number round) 1) 10)))
371 (delete-char 10)
372 (insert " "))))
373
374 (defun arbitools-replace-empty ()
375 "Replace non played games with spaces"
376 (interactive)
377 (save-excursion
378 (goto-char (point-min))
379 (while (search-forward "0000 - 0" nil t)
380 (replace-match " "))))
381
382 (defun arbitools-insert-player (sex title name elo fed idfide year)
383 "Insert a player"
384 ;; TODO: automatically insert the player in a team
385 (interactive "ssex: \nstitle: \nsname: \nselo: \nsfed: \nsidfide: \nsyear: ")
386 (let ((playerlinelength nil)
387 (thislinelength nil))
388 (save-excursion
389 (goto-char (point-min))
390 (re-search-forward "^001 ")
391 (let* ((linestring (thing-at-point 'line)))
392 (setq playerlinelength (length linestring))))
393 (save-excursion
394 (goto-char (point-min))
395 (while (re-search-forward "^001" nil t))
396 (let* ((linestring (thing-at-point 'line))
397 (rankstring (substring linestring 5 8)))
398
399 (forward-line 1)
400 (insert "\n")
401 (forward-char -1)
402 (insert (format "001 "))
403 (insert-char ?\s (- 4 (length (format "%s" (+ (string-to-number rankstring) 1)))))
404 (insert (format "%s" (+ (string-to-number rankstring) 1)))
405 (insert (format " %s" sex))
406 (when (= (length sex) 0) (insert " ")) ;; add extra space if the sex string is empty
407 (insert-char ?\s (- 3 (length title)))
408 (insert (format "%s " title))
409 (insert (format "%s" name))
410 (insert-char ?\s (- 34 (length name)))
411 (insert (format "%s " elo))
412 (when (= (length elo) 0) (insert " ")) ;; add extra space if the elo is empty
413 (when (= (length elo) 1) (insert " ")) ;; add extra space if the elo is a "0"
414 (insert (format "%s" fed))
415 (when (= (length fed) 0) (insert " ")) ;; add extra space if fed is empty
416 (insert-char ?\s (- 12 (length idfide)))
417 (insert (format "%s " idfide))
418 (insert (format "%s " year))
419 (when (= (length year) 0) (insert " ")) ;; TODO: improve this to make it support different data formats
420 (insert (format " 0.0 "))
421 (insert-char ?\s (- 4 (length (format "%s" (+ (string-to-number rankstring) 1)))))
422 (insert (format "%s" (+ (string-to-number rankstring) 1)))
423 (setq thislinelength (length (thing-at-point 'line)))
424 (insert-char ?\s (- playerlinelength thislinelength)))))
425 (save-excursion
426 (goto-char (point-min))
427 (re-search-forward "^062 ")
428 (let* ((linestring (thing-at-point 'line))
429 (numberofplayers (substring linestring 4)))
430 (delete-char (length numberofplayers))
431 (setq numberofplayers (string-to-number numberofplayers))
432 (setq numberofplayers (+ 1 numberofplayers))
433 (insert (concat (number-to-string numberofplayers) "\n")))
434 (re-search-forward "^072 ")
435 (let* ((linestring (thing-at-point 'line))
436 (numberofratedplayers (substring linestring 4)))
437 (unless (< (length elo) 2)
438 (delete-char (length numberofratedplayers))
439 (setq numberofratedplayers (string-to-number numberofratedplayers))
440 (setq numberofratedplayers (+ 1 numberofratedplayers))
441 (insert (concat (number-to-string numberofratedplayers) "\n"))))))
442
443 (defun arbitools-insert-result (round white black result)
444 "Insert a result."
445 (interactive "sround: \nswhite: \nsblack: \nsresult: ")
446 (save-excursion
447 (goto-char (point-min))
448 (while (re-search-forward "^001" nil t)
449 (forward-char 4) ;; rank number
450 (when (string= white (thing-at-point 'word))
451 ;;go to first round taking into account the cursor is in the rank number
452 (forward-char (+ 85 (* (- (string-to-number round) 1) 10)))
453 (insert " ") ;; replace the first positions with spaces
454 (delete-char 2) ;; delete the former characters
455 ;; make room for bigger numbers
456 (cond ((= 2 (length black))
457 (backward-char 1))
458 ((= 3 (length black))
459 (backward-char 2)))
460 (insert (format "%s w %s" black result))
461 (delete-char 5)
462 ;; adjust when numbers are longer
463 (cond ((= 2 (length black)) (delete-char 1))
464 ((= 3 (length black)) (delete-char 2))))
465 (when (string= black (thing-at-point 'word))
466 ;; go to first round taking into account the cursor is in the rank number
467 (forward-char (+ 85 (* (- (string-to-number round) 1) 10)))
468 (insert " ") ;; replace the first positions with spaces
469 (delete-char 2) ;; delete the former characters
470 ;; make room for bigger numbers
471 (cond ((= 2 (length white)) (backward-char 1))
472 ((= 3 (length white)) (backward-char 2)))
473 (cond ((string= "1" result) (insert (format "%s b 0" white)))
474 ((string= "=" result) (insert (format "%s b =" white)))
475 ((string= "+" result) (insert (format "%s b +" white)))
476 ((string= "-" result) (insert (format "%s b -" white)))
477 ((string= "0" result) (insert (format "%s b 1" white))))
478 (delete-char 5)
479 ;; adjust when numbers are longer
480 (cond ((= 2 (length white)) (delete-char 1))
481 ((= 3 (length white)) (delete-char 2)))))))
482
483 (defun arbitools-it3 ()
484 "Get the IT3 tournament report. You will get a .tex file, and a pdf
485 if you have pdflatex installed."
486 (interactive)
487 (call-process "arbitools-run.py" nil "Arbitools-output" nil "it3" buffer-file-name))
488
489 ;; TODO: New It3 function, usint it3.tex from home directory, replacing the data and pdflatex it
490
491 (defun arbitools-fedarating ()
492 "Get the FEDA rating admin file."
493 (interactive)
494 (call-process "arbitools-run.py" nil "Arbitools-output" nil "fedarating" buffer-file-name))
495
496 (defvar arbitools-mode-map
497 (let ((map (make-sparse-keymap)))
498 (define-key map (kbd "C-c i") 'arbitools-it3)
499 (define-key map (kbd "C-c r") 'arbitools-insert-result)
500 (define-key map (kbd "C-c p") 'arbitools-insert-player)
501 map)
502 "Keymap for Arbitools major mode.")
503
504
505 (easy-menu-define arbitools-mode-menu arbitools-mode-map
506 "Menu for Arbitools mode"
507 '("Arbitools"
508 ["New Tournament" arbitools-new-trf]
509 "---"
510 ["Insert Player" arbitools-insert-player]
511 ["Delete Player" arbitools-delete-player]
512 ["Insert Result" arbitools-insert-result]
513 ["Delete Round" arbitools-delete-round]
514 "---"
515 ["List Players" arbitools-list-players]
516 ["List Pairings" arbitools-list-pairing]
517 "---"
518 ["Update Elo" arbitools-update]
519 ["Get It3 form Report" arbitools-it3]
520 ["Get FEDA Rating file" arbitools-fedarating]
521 ))
522
523
524 (defvar arbitools-highlights
525 '(("^001" . font-lock-function-name-face) ; name of the tournament
526 ("^012.*" . font-lock-comment-face)
527 ("\\(^022\\|^032\\|^042\\|^052\\|^062\\|^072\\|^082\\|^092\\|^102\\|^112\\|^122\\).*" . font-lock-constant-face)
528 ("^132.*" . font-lock-warning-face) ;dates
529 ("^013" . font-lock-warning-face) ;teams
530 ("\\(^013.\\{1\\}\\)\\(.\\{31\\}\\)" 2 font-lock-comment-face) ;; teams
531 ;; (" [0-9]\\{6,\\} " . font-lock-variable-name-face) ;FIDE ID
532 ("\\(^001.\\{11\\}\\)\\(.\\{32\\}\\)" 2 font-lock-string-face) ;; Name of the player (by position)
533 ("\\(^001.\\{55\\}\\)\\(.\\{10\\}\\)" 2 font-lock-function-name-face) ;; FIDE ID
534 ("\\(^001.\\{88\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face) ;; round 1 opponent
535 ;; ("\\(^132.\\{88\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face) ;; round 1 date line
536 ("\\(^001.\\{93\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face) ;; round 1 colour
537 ("\\(^001.\\{95\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face) ;; round 1 result
538 ;; rest of rounds
539 ("\\(^001.\\{98\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face)
540 ;; ("\\(^132.\\{98\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face)
541 ("\\(^001.\\{103\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face)
542 ("\\(^001.\\{105\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face)
543 ("\\(^001.\\{108\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face)
544 ;; ("\\(^132.\\{108\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face)
545 ("\\(^001.\\{113\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face)
546 ("\\(^001.\\{115\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face)
547 ("\\(^001.\\{118\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face)
548 ;; ("\\(^132.\\{118\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face)
549 ("\\(^001.\\{123\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face)
550 ("\\(^001.\\{125\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face)
551 ("\\(^001.\\{128\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face)
552 ;; ("\\(^132.\\{128\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face)
553 ("\\(^001.\\{133\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face)
554 ("\\(^001.\\{135\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face)
555 ("\\(^001.\\{138\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face)
556 ;; ("\\(^132.\\{138\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face)
557 ("\\(^001.\\{143\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face)
558 ("\\(^001.\\{145\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face)
559 ("\\(^001.\\{148\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face)
560 ;; ("\\(^132.\\{148\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face)
561 ("\\(^001.\\{153\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face)
562 ("\\(^001.\\{155\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face)
563 ("\\(^001.\\{158\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face)
564 ;; ("\\(^132.\\{158\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face)
565 ("\\(^001.\\{163\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face)
566 ("\\(^001.\\{165\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face)
567 ("\\(^001.\\{168\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face)
568 ;; ("\\(^132.\\{168\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face)
569 ("\\(^001.\\{173\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face)
570 ("\\(^001.\\{175\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face)
571 ("\\(^001.\\{178\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face)
572 ;; ("\\(^132.\\{178\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face)
573 ("\\(^001.\\{183\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face)
574 ("\\(^001.\\{185\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face)
575 ("\\(^001.\\{188\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face)
576 ;; ("\\(^132.\\{188\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face)
577 ("\\(^001.\\{193\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face)
578 ("\\(^001.\\{195\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face)
579 ("\\(^001.\\{198\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face)
580 ;; ("\\(^132.\\{198\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face)
581 ("\\(^001.\\{203\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face)
582 ("\\(^001.\\{205\\}\\)\\(.\\{1\\}\\)" 2 font-lock-function-name-face)))
583
584 ;;;###autoload
585 (define-derived-mode arbitools-mode
586 fundamental-mode
587 "Arbitools"
588 "Major mode for Chess Tournament Management."
589 ;(setq font-lock-defaults '(arbitools-highlights))
590 (use-local-map arbitools-mode-map)
591 (generate-new-buffer "Arbitools-output")
592 (generate-new-buffer "List of players")
593 (generate-new-buffer "Pairings List")
594 (column-number-mode)
595 (set (make-local-variable 'font-lock-defaults) '(arbitools-highlights)))
596
597 ;;;###autoload
598 (add-to-list 'auto-mode-alist '("\\.trf?\\'" . arbitools-mode))
599
600 (provide 'arbitools)
601
602 ;;; arbitools.el ends here