<commit_before>(in-package #:sdl2)

(autowrap:define-bitmask-from-enum (keymod sdl2-ffi::sdl-keymod))

(defun key-down-p (state)
  (= state sdl2-ffi:+sdl-pressed+))

(defun key-up-p (state)
  (= state sdl2-ffi:+sdl-released+))

(defun scancode-value (keysym)
  (sdl-keysym.scancode keysym))

(defun scancode (keysym)
  (autowrap:enum-key 'sdl2-ffi:sdl-scancode
                     (scancode-value keysym)))

(defun mod-value (keysym)
  (sdl-keysym.mod keysym))

(defun sym-value (keysym)
  (sdl-keysym.sym keysym))

(defgeneric scancode= (value scancode-key))

(defmethod scancode= ((scancode integer) scancode-key)
  (= scancode (autowrap:enum-value 'sdl2-ffi:sdl-scancode scancode-key)))

(defmethod scancode= ((keysym sdl2-ffi:sdl-keysym) scancode-key)
  (= (scancode-value keysym)
     (autowrap:enum-value 'sdl2-ffi:sdl-scancode scancode-key)))

(defun mod-keywords (value)
  (autowrap:mask-keywords 'keymod value))

(defun mod-value-p (value &rest keywords)
  (let ((mask (autowrap:mask-apply 'keymod keywords)))
    (/= 0 (logand mask value))))

;; TODO need to be able to unpack a keysym struct in one go
;;(defmacro with-keysym-slot-values ())
<commit_msg>- removed a comment that I don't think applies anymore<commit_after>(in-package #:sdl2)

(autowrap:define-bitmask-from-enum (keymod sdl2-ffi::sdl-keymod))

(defun key-down-p (state)
  (= state sdl2-ffi:+sdl-pressed+))

(defun key-up-p (state)
  (= state sdl2-ffi:+sdl-released+))

(defun scancode-value (keysym)
  (sdl-keysym.scancode keysym))

(defun scancode (keysym)
  (autowrap:enum-key 'sdl2-ffi:sdl-scancode
                     (scancode-value keysym)))

(defun mod-value (keysym)
  (sdl-keysym.mod keysym))

(defun sym-value (keysym)
  (sdl-keysym.sym keysym))

(defgeneric scancode= (value scancode-key))

(defmethod scancode= ((scancode integer) scancode-key)
  (= scancode (autowrap:enum-value 'sdl2-ffi:sdl-scancode scancode-key)))

(defmethod scancode= ((keysym sdl2-ffi:sdl-keysym) scancode-key)
  (= (scancode-value keysym)
     (autowrap:enum-value 'sdl2-ffi:sdl-scancode scancode-key)))

(defun mod-keywords (value)
  (autowrap:mask-keywords 'keymod value))

(defun mod-value-p (value &rest keywords)
  (let ((mask (autowrap:mask-apply 'keymod keywords)))
    (/= 0 (logand mask value))))


{'fraction_non_alphanumeric': 0.16058073031236253, 'fraction_numerical': 0.007919049714034315, 'mean_word_length': 4.401425178147268, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7104250', 'n_tokens_mistral': 983, 'n_tokens_neox': 937, 'n_words': 184}