Code: Select all
;;; Universal Chess Interface command processor
(defun uci (&rest my-args)
"Universal Chess Interface command processor for the Chess In Lisp Toolkit."
(let ((cpc (mk-cpc cpid-uci as-uci-cmd-vec my-args)))
(uci-init cpc)
(dowhile (not (cpc-is-done cpc))
(command-line-cpc (read-line (cpc-stin cpc) nil nil) cpc)
(unless (or (cpc-is-done cpc) (cpc-is-pass cpc))
(if (cpc-cmdord cpc)
(eval (list (svref uci-dispatch-vec (cpc-cmdord cpc)) cpc))
(warn "Unrecognized input")))
(finish-output (cpc-stout cpc)))
(uci-term cpc))
(values))
Code: Select all
;;; xboard command processor
(defun xboard (&rest my-args)
"The xboard command processor for the Chess In Lisp Toolkit."
(let ((cpc (mk-cpc cpid-xboard as-xboard-cmd-vec my-args)))
(xboard-init cpc)
(dowhile (not (cpc-is-done cpc))
(command-line-cpc (read-line (cpc-stin cpc) nil nil) cpc)
(unless (or (cpc-is-done cpc) (cpc-is-pass cpc))
(if (cpc-cmdord cpc)
(eval (list (svref xboard-dispatch-vec (cpc-cmdord cpc)) cpc))
(warn "Unrecognized input")))
(finish-output (cpc-stout cpc)))
(xboard-term cpc))
(values))
All three command processors will exit on an EOF, and all three will ignore an input consisting only of whitespace characters. Each processor also has a defined exit or quit command that will cause an exit.
When running the toolkit with the console interactive command processor, a user types:
Code: Select all
(icp)
Similar invocations are used for UCI and xboard instances. All calls allow for optional parameters that appear on the program invocation command line; at the moment I think these will be used for specifying log and dribble files.
The exact details of topmost level invocation are dependent upon the Lisp in use. Some configurations might need start up files or some other assistance. Others might be able to call a compiled file directly.
