diff options
| -rw-r--r-- | chess-polyglot.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/chess-polyglot.el b/chess-polyglot.el index ceb0050..c124621 100644 --- a/chess-polyglot.el +++ b/chess-polyglot.el @@ -444,6 +444,20 @@ Returns a buffer object which contains the binary data." (erase-buffer) (set-buffer-multibyte nil) (insert-file-contents-literally file) + (when (and (fboundp 'zlib-decompress-region) + (goto-char (point-min)) + (re-search-forward "\\`\037\213\\(.\\)\\(.\\)\\(.\\)\\(.\\)\\(.\\)\\(.\\)\\(.\\)\\(.\\)" nil t) + (pcase (list (aref (match-string 1) 0) + (aref (match-string 2) 0) + (logior (aref (match-string 3) 0) + (lsh (aref (match-string 4) 0) 8) + (lsh (aref (match-string 5) 0) 16) + (lsh (aref (match-string 6) 0) 24)) + (aref (match-string 7) 0) + (aref (match-string 8) 0)) + (`(,method ,_ ,modified-epoch ,_ ,from-fs) + (and (= method 8) (> modified-epoch 0) (< from-fs 16))))) + (zlib-decompress-region (point-min) (point-max))) (current-buffer)))) (defun chess-polyglot-book-plies (book position) |
