diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-05-01 07:46:10 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-05-01 07:46:10 +0000 |
| commit | b49698115d01ea6d055263bb2ce815c879b04413 (patch) | |
| tree | e6a47c66a00b45f0eef5c20bf15f96f83810e730 /chess-scid.el | |
| parent | 3d3bbb7d7de849b139e612ad069a530c8ef9c342 (diff) | |
fixes
Diffstat (limited to 'chess-scid.el')
| -rw-r--r-- | chess-scid.el | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/chess-scid.el b/chess-scid.el index ce526d9..0813b90 100644 --- a/chess-scid.el +++ b/chess-scid.el @@ -42,7 +42,9 @@ nil)))) ((eq event 'close) - (process-send-string chess-scid-process "sc_base close\nexit\n")) + (process-send-string chess-scid-process "sc_base close\nexit\n") + (while (eq (process-status chess-scid-process) 'run) + (sit-for 0 250))) ((eq event 'count) (string-to-int (chess-scid-get-result "sc_base numGames\n"))) @@ -62,14 +64,39 @@ game))) ((eq event 'write) - (chess-scid-handler 'replace 0 (car args))) + (chess-scid-handler 'replace (car args) 0)) ((eq event 'replace) (let ((index (or (cadr args) (chess-game-data (car args) 'database-index)))) - (process-send-string chess-scid-process - (format "sc_game import \"%s\"\n" - (chess-game-to-string (cadr args)))) + (process-send-string + chess-scid-process + (format "sc_game import \"%s\"\n" + (with-temp-buffer + (chess-pgn-insert-plies (car args) 1 + (chess-game-plies (car args))) + (insert (or (chess-game-tag (car args) "Result") "*")) + (buffer-string)))) + (dolist (tag (chess-game-tags (car args))) + ;; jww (2002-05-01): how do I set extra tags? + (unless (string= (car tag) "TimeControl") + (process-send-string + chess-scid-process + (concat "sc_game tags set " + (cond + ((string= (car tag) "Event") "-event") + ((string= (car tag) "Site") "-site") + ((string= (car tag) "Date") "-date") + ((string= (car tag) "Round") "-round") + ((string= (car tag) "White") "-white") + ((string= (car tag) "WhiteElo") "-whiteElo") + ((string= (car tag) "Black") "-black") + ((string= (car tag) "BlackElo") "-blackElo") + ((string= (car tag) "Result") "-result") + ((string= (car tag) "ECO") "-eco") + ((string= (car tag) "EventDate") "-eventdate") + ((string= (car tag) "Extra") "-extra")) + " \"" (cdr tag) "\"\n")))) (process-send-string chess-scid-process (format "sc_game save %d\n" index)))))) |
