(defun cbuffer-checkbounds (buf pos &optional error) (if (or (>= pos (cbuffer-size buf)) (< pos 0)) (cond ((functionp error) (funcall error)) (error (error "buffer out of bounds exception.")) (t nil)) t))