<commit_before>(in-package :cepl.context)

;;----------------------------------------------------------------------

(defvar *contexts* nil)

(defun2 make-context (&key gl-version (shared (first *contexts*))
                       (title "CEPL") (width 600) (height 600)
                       (fullscreen nil) (resizable t) (no-frame nil)
                       (hidden nil))
  (declare (ignore title width height fullscreen resizable no-frame hidden))
  ;;
  (assert (or (null shared) (typep shared 'cepl-context)))
  ;;
  (let* ((shared (if shared
                     (%cepl-context-shared shared)
                     (make-instance 'cepl-context-shared)))
         (result (%make-cepl-context
                  :gl-version gl-version
                  :shared shared
                  :current-surface nil
                  :surfaces nil)))
    (push result (slot-value shared 'members))
    (when cepl.host::*current-host*
      (on-host-initialized result))
    (push result *contexts*)
    ;; done!
    result))

(defvar *cepl-context* (make-context))

;;----------------------------------------------------------------------

;; {TODO} move this to delayed-resource-init.lisp
(defvar *on-context* nil)

(defn init-gl-context ((cepl-context cepl-context) (surface t))
    cepl-context
  (declare (profile t))
  (assert cepl-context)
  (assert surface)
  (%with-cepl-context (gl-context gl-version current-surface gl-thread) cepl-context
    (setf gl-thread (bt:current-thread))
    (assert (not gl-context))
    (let ((raw-context (cepl.host:make-gl-context :version gl-version<commit_msg>declaim the type of the context variable<commit_after>(in-package :cepl.context)

;;----------------------------------------------------------------------

(defvar *contexts* nil)

(defun2 make-context (&key gl-version (shared (first *contexts*))
                       (title "CEPL") (width 600) (height 600)
                       (fullscreen nil) (resizable t) (no-frame nil)
                       (hidden nil))
  (declare (ignore title width height fullscreen resizable no-frame hidden))
  ;;
  (assert (or (null shared) (typep shared 'cepl-context)))
  ;;
  (let* ((shared (if shared
                     (%cepl-context-shared shared)
                     (make-instance 'cepl-context-shared)))
         (result (%make-cepl-context
                  :gl-version gl-version
                  :shared shared
                  :current-surface nil
                  :surfaces nil)))
    (push result (slot-value shared 'members))
    (when cepl.host::*current-host*
      (on-host-initialized result))
    (push result *contexts*)
    ;; done!
    result))

(declaim (type cepl-context *cepl-context*))
(defvar *cepl-context* (make-context))

;;----------------------------------------------------------------------

;; {TODO} move this to delayed-resource-init.lisp
(defvar *on-context* nil)

(defn init-gl-context ((cepl-context cepl-context) (surface t))
    cepl-context
  (declare (profile t))
  (assert cepl-context)
  (assert surface)
  (%with-cepl-context (gl-context gl-version current-surface gl-thread) cepl-context
    (setf gl-thread (bt:current-thread))
    (assert (not gl-context))
    (let ((raw-context (cepl.host:make-gl-context :version gl-version
{'fraction_non_alphanumeric': 0.20991432068543453, 'fraction_numerical': 0.004283965728274173, 'mean_word_length': 1.840139009556907, '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': '5370763', 'n_tokens_mistral': 957, 'n_tokens_neox': 918, 'n_words': 241}