Move around some defgeneric to be used in various situations

This commit is contained in:
Renaud Casenave-Péré 2015-08-26 18:01:48 +02:00
parent 70c51eb04d
commit ae6ce45c53
5 changed files with 25 additions and 16 deletions

View file

@ -4,9 +4,9 @@
|#
(uiop:define-package :stoe/core/containers
(:use :cl :stoe/core/thread)
(:use :cl :stoe/core/utils :stoe/core/thread)
(:export #:queue #:stack #:make-queue #:make-stack
#:enqueue #:dequeue #:push-stack #:pop-stack #:peek #:size
#:enqueue #:dequeue #:push-stack #:pop-stack #:peek
#:safe-queue #:safe-stack
#:make-safe-queue #:make-safe-stack))
(in-package :stoe/core/containers)
@ -38,9 +38,6 @@
(defgeneric peek (container)
(:documentation "Return the next element of `container' without removing it."))
(defgeneric size (container)
(:documentation "Return the size of the container."))
(defun make-queue ()
"Make a queue instance."
(make-instance 'queue))

View file

@ -15,7 +15,8 @@
#:get-command-line-option
#:get-command-line-option-number
#:pathname-path
#:name #:id #:parent))
#:name #:id #:parent #:size
#:raw-data))
(in-package :stoe/core/utils)
(defun safe-first (x)
@ -115,6 +116,13 @@
(format s "~{~a/~}~a~@[.~a~]" (cdr (pathname-directory path))
(pathname-name path) (pathname-type path))))
(defgeneric name (obj))
(defgeneric id (obj))
(defgeneric parent (obj))
(defgeneric name (obj)
(:documentation "Return the name of an object."))
(defgeneric id (obj)
(:documentation "Return the id of an object."))
(defgeneric parent (obj)
(:documentation "Return the parent of an object."))
(defgeneric size (obj)
(:documentation "Return the size of an object."))
(defgeneric raw-data (obj)
(:documentation "Return the raw data contained in an object."))

View file

@ -4,7 +4,10 @@
|#
(uiop:define-package :stoe/maths/matrix
(:use :cl :alexandria :stoe/maths/types :stoe/maths/vector)
(:use :cl :alexandria
:stoe/core/utils
:stoe/maths/types
:stoe/maths/vector)
(:import-from :stoe/maths/vector
#:fill-vector #:make-displaced-vector)
(:export #:mref
@ -15,7 +18,7 @@
#:m+ #:m- #:m*))
(in-package :stoe/maths/matrix)
(defmethod element-type ((m matrix)) (array-element-type (slot-value m 'array)))
(defmethod element-type ((m matrix)) (array-element-type (raw-data m)))
(defun mref (m &rest subscripts)
(let ((len (length subscripts))

View file

@ -4,8 +4,8 @@
|#
(uiop:define-package :stoe/maths/types
(:use :cl)
(:export #:vect #:array-of
(:use :cl :stoe/core/utils)
(:export #:vect #:raw-data
#:int2 #:int3 #:int4
#:float2 #:float3 #:float4
#:quaternion
@ -21,10 +21,11 @@
(defgeneric element-type (x))
(defmethod element-type ((x float)) 'single-float)
(defmethod element-type ((x integer)) 'fixnum)
(defclass vect ()
((array :type (array * (*))
:initarg :array
:accessor array-of
:reader raw-data
:documentation "The internal representation of the vector")))
(defclass int2 (vect)
@ -53,7 +54,7 @@
:documentation "The dimensions of the matrix")
(array :type (array * (*))
:initarg :array
:accessor array-of
:reader raw-data
:documentation "The internal representation of the matrix")))
(defclass int22 (matrix)

View file

@ -44,8 +44,8 @@
"glop"
#+stoe-foreign-assets
"classimp"
"stoe/maths/all"
"stoe/core/all"
"stoe/maths/all"
"stoe/engine/all"
"stoe/shader/all")
:in-order-to ((test-op (load-op stoe/test))))