<commit_before>;; Copyright rif 2006.
;; Modified BSD License (see LICENSE file in this directory).

(defpackage :org.middleangle.foreign-numeric-vector
  (:nicknames :foreign-numeric-vector :fnv)
  (:use :common-lisp :cffi :iterate :fnv-utils :fnv-lowlevel-copy)
  (:export :fnv-foreign-pointer :fnv-length :fnv-copy 
	   :*fnv-print-length* :fnv-allset :cffi-type-to-fnv-type))

(in-package :org.middleangle.foreign-numeric-vector)

;; (declaim (optimize (speed 1) (safety 3) (debug 3)))
(declaim (optimize (speed 3) (safety 0) (debug 1)))

(defun finalize (object function)
  #+sbcl (sb-ext:finalize object function)
  #+cmu (extensions:finalize object function)
  #+clisp (ext:finalize object function)
  #-(or sbcl cmu clisp)
  (error "please add an equivalent to FINALIZE for your lisp"))

(defgeneric fnv-foreign-pointer (fnv))
(defgeneric fnv-copy (fnv))
(defgeneric fnv-length (fnv))
(defgeneric fnv-allset (fnv val &optional try-to-coerce-p))

(eval-when (:compile-toplevel :load-toplevel)
  (defparameter *cffi-type-to-fnv-type* (make-hash-table :test #'equal))

  (defun cffi-type-to-fnv-type (cffi-type)<commit_msg>SBCL has been nasty about throwing warnings about symbols exported outside of the defpackage statement.  Not sure why?<commit_after>;; Copyright rif 2006.
;; Modified BSD License (see LICENSE file in this directory).

(in-package :fnv-asd)

(defpackage :org.middleangle.foreign-numeric-vector
  (:nicknames :foreign-numeric-vector :fnv)
  (:use :common-lisp :cffi :iterate :fnv-utils :fnv-lowlevel-copy)
  (:export :fnv-foreign-pointer :fnv-length :fnv-copy 
	   :*fnv-print-length* :fnv-allset :cffi-type-to-fnv-type

	   :cffi-fnv-complex-double
	   :copy-fnv-complex-double
	   :sort-fnv-complex-double-abs!
	   :over-fnv-float
	   :in-fnv-complex-float
	   :fnv-int32-ptr-ref
	   :fnv-complex-float-ptr-ref
	   :sort-fnv-complex-double-realpart-<!
	   :cffi-fnv-float
	   :fnv-complex-float-length
	   :copy-fnv-float
	   :fnv-complex-float


	   :make-fnv-int32
	   :with-fnv-complex-float-ptr
	   :copy-fnv-complex-float
	   :fnv-double-ptr-ref
	   :sort-fnv-double->!
	   :fnv-double-length
	   :fnv-complex-float-foreign-pointer
	   :fnv-int32
	   :fnv-complex-double-length
	   :fnv-float
	   :make-fnv-complex-float
	   :fnv-double-ref
	   :sort-fnv-double-<!
	   :over-fnv-complex-double
	   :over-fnv-int32
	   :copy-fnv-int32
	   :with-fnv-float-ptr
	   :fnv-complex-float-ref
	   :make-fnv-float
	   :sort-fnv-complex-double-imagpart-<!
	   :fnv-double-foreign-pointer
	   :fnv-double
	   :in-fnv-double
	   :fnv-float-ref
	   :sort-fnv-float->!
	   :fnv-float-ptr-ref
	   :sort-fnv-complex-float-realpart-<!
	   :cffi-fnv-int32
	   :sort-fnv-complex-float-abs!
	   :in-fnv-int32
	   :make-fnv-double
	   :over-fnv-complex-float
	   :sort-fnv-complex-float-imagpart-<!
	   :fnv-complex-double-foreign-pointer
	   :in-fnv-float
	   :cffi-fnv-double
	   :sort-fnv-int32-<!
	   :sort-fnv-int32->!
	   :with-fnv-double-ptr
	   :fnv-int32-ref
	   :over-fnv-double
	   :with-fnv-complex-double-ptr
	   :fnv-float-length
	   :sort-fnv-float-<!
	   :fnv-complex-double
	   :cffi-fnv-complex-float
	   :fnv-complex-double-ptr-ref
	   :fnv-complex-double-ref
	   :with-fnv-int32-ptr
	   :make-fnv-complex-double
	   :fnv-float-foreign-pointer
	   :fnv-int32-foreign-pointer
	   :in-fnv-complex-double
	   :copy-fnv-double
	   :fnv-int32-length

	   ))

(in-package :org.middleangle.foreign-numeric-vector)

;; (declaim (optimize (speed 1) (safety 3) (debug 3)))
(declaim (optimize (speed 3) (safety 0) (debug 1)))

(defun finalize (object function)
  #+sbcl (sb-ext:finalize object function)
  #+cmu (extensions:finalize object function)
  #+clisp (ext:finalize object function)
  #-(or sbcl cmu clisp)
  (error "please add an equivalent to FINALIZE for your lisp"))

(defgeneric fnv-foreign-pointer (fnv))
(defgeneric fnv-copy (fnv))
(defgeneric fnv-length (fnv))
(defgeneric fnv-allset (fnv val &optional try-to-coerce-p))

(eval-when (:compile-toplevel :load-toplevel)
  (defparameter *cffi-type-to-fnv-type* (make-hash-table :test #'equal))

  (defun cffi-type-to-fnv-type (cffi-type)
{'fraction_non_alphanumeric': 0.1529126213592233, 'fraction_numerical': 0.01116504854368932, 'mean_word_length': 3.398078975453575, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 6, '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': '895395', 'n_tokens_mistral': 1776, 'n_tokens_neox': 1615, 'n_words': 295}