Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Moved errors back into package cl-devil and renamed the error enum an…

…d base class.
  • Loading branch information...
commit fc314d2d13f6d5b13dd29035e178029cf2360ec7 1 parent 85dc3ec
Benjamin Saunders authored January 18, 2010 sykopomp committed June 30, 2010
2  cl-devil.asd
@@ -5,7 +5,7 @@
5 5
   :depends-on (#:cffi #:alexandria)
6 6
   :components
7 7
   ((:file "package")
8  
-   (:file "internal")
  8
+   (:file "internal" :depends-on ("package"))
9 9
    (:file "il" :depends-on ("package" "internal"))
10 10
    (:file "ilu" :depends-on ("package" "internal" "il"))
11 11
    (:file "ilut" :depends-on ("package" "internal" "il"))
39  il.lisp
@@ -75,7 +75,42 @@
75 75
   (:bgr32 #x0405)
76 76
   (:bgra32 #x0406))
77 77
 
78  
-;;; See internal.lisp for error enum
  78
+(define-condition error (cl:error)
  79
+  ((enum-value :initarg :enum-value :reader enum-value)))
  80
+(macrolet ((deferrs (&rest keys)
  81
+             `(progn
  82
+                (defcenum error-enum ,@keys)
  83
+                ,@(loop for (key value) in keys collecting
  84
+                       (let ((symbol (intern (symbol-name key))))
  85
+                         `(define-condition ,symbol (error) ()
  86
+                            (:default-initargs :enum-value ,key)))))))
  87
+  (deferrs
  88
+    (:no-error #x0000)
  89
+    (:invalid-enum #x0501)
  90
+    (:out-of-memory #x0502)
  91
+    (:format-not-supported #x0503)
  92
+    (:internal-error #x0504)
  93
+    (:invalid-value #x0505)
  94
+    (:illegal-operation #x0506)
  95
+    (:illegal-file-value #x0507)
  96
+    (:invalid-file-header #x0508)
  97
+    (:invalid-param #x0509)
  98
+    (:could-not-open-file #x050A)
  99
+    (:invalid-extension #x050B)
  100
+    (:file-already-exists #x050C)
  101
+    (:out-format-same #x050D)
  102
+    (:stack-overflow #x050E)
  103
+    (:stack-underflow #x050F)
  104
+    (:invalid-conversion #x0510)
  105
+    (:bad-dimensions #x0511)
  106
+    (:file-read-error #x0512)
  107
+    (:file-write-error #x0512)
  108
+    (:lib-gif-error #x05E1)
  109
+    (:lib-jpeg-error #x05E2)
  110
+    (:lib-png-error #x05E3)
  111
+    (:lib-tiff-error #x05E4)
  112
+    (:lib-mng-error #x05E5)
  113
+    (:unknown-error #x05FF)))
79 114
 
80 115
 (defcenum mode
81 116
   (:file-overwrite #x0620)
@@ -176,7 +211,7 @@
176 211
 (deferrwrap overlay-image (source x y z))
177 212
 (defcfun ("ilBlit" %blit) :boolean (source :uint) (dest-x :int) (dest-y :int) (dest-z :int) (src-x :int) (src-y :int) (src-z :int) (width :uint) (height :uint) (depth :uint))
178 213
 (deferrwrap blit (source dest-x dest-y dest-z src-x src-y src-z width height depth))
179  
-(defcfun ("ilGetError" get-error) %il:error)
  214
+(defcfun ("ilGetError" get-error) error-enum)
180 215
 
181 216
 (defcfun ("ilKeyColour" key-color) :void (red :float) (green :float) (blue :float) (alpha :float))
182 217
 (defcfun ("ilGetPalette" get-palette) :pointer)
2  ilu.lisp
@@ -78,7 +78,7 @@
78 78
   (width :uint) (height :uint) (depth :uint))
79 79
 (deferrwrap enlarge-canvas (width height depth))
80 80
 (defcfun ("iluErrorString" error-string) :string
81  
-  (error %il:error))
  81
+  (error il::error-enum))
82 82
 (defcfun ("iluFlipImage" %flip-image) :boolean)
83 83
 (deferrwrap flip-image)
84 84
 (defcfun ("iluGammaCorrect" %gamma-correct) :boolean (gamma :float))
37  internal.lisp
... ...
@@ -1,42 +1,5 @@
1 1
 (in-package :%il)
2 2
 
3  
-(define-condition devil-error (cl:error)
4  
-  ((enum-value :initarg :enum-value :reader enum-value)))
5  
-(macrolet ((deferrs (&rest keys)
6  
-             `(progn
7  
-                (defcenum error ,@keys)
8  
-                ,@(loop for (key value) in keys collecting
9  
-                       (let ((symbol (intern (symbol-name key))))
10  
-                         `(define-condition ,symbol (devil-error) ()
11  
-                            (:default-initargs :enum-value ,key)))))))
12  
-  (deferrs
13  
-    (:no-error #x0000)
14  
-    (:invalid-enum #x0501)
15  
-    (:out-of-memory #x0502)
16  
-    (:format-not-supported #x0503)
17  
-    (:internal-error #x0504)
18  
-    (:invalid-value #x0505)
19  
-    (:illegal-operation #x0506)
20  
-    (:illegal-file-value #x0507)
21  
-    (:invalid-file-header #x0508)
22  
-    (:invalid-param #x0509)
23  
-    (:could-not-open-file #x050A)
24  
-    (:invalid-extension #x050B)
25  
-    (:file-already-exists #x050C)
26  
-    (:out-format-same #x050D)
27  
-    (:stack-overflow #x050E)
28  
-    (:stack-underflow #x050F)
29  
-    (:invalid-conversion #x0510)
30  
-    (:bad-dimensions #x0511)
31  
-    (:file-read-error #x0512)
32  
-    (:file-write-error #x0512)
33  
-    (:lib-gif-error #x05E1)
34  
-    (:lib-jpeg-error #x05E2)
35  
-    (:lib-png-error #x05E3)
36  
-    (:lib-tiff-error #x05E4)
37  
-    (:lib-mng-error #x05E5)
38  
-    (:unknown-error #x05FF)))
39  
-
40 3
 (defmacro maybe-error (call)
41 4
   `(if ,call
42 5
        (values)
33  package.lisp
... ...
@@ -1,38 +1,10 @@
1 1
 (defpackage #:%cl-devil-internal
2 2
   (:nicknames #:%il)
3  
-  (:use #:cl #:cffi #:alexandria)
  3
+  (:use #:cl #:alexandria)
4 4
   (:shadow #:error)
5 5
   (:export
6 6
    #:maybe-error
7  
-   #:deferrwrap
8  
-   #:error
9  
-   #:devil-error
10  
-   #:no-error
11  
-   #:invalid-enum
12  
-   #:out-of-memory
13  
-   #:format-not-supported
14  
-   #:internal-error
15  
-   #:invalid-value
16  
-   #:illegal-operation
17  
-   #:illegal-file-value
18  
-   #:invalid-file-header
19  
-   #:invalid-param
20  
-   #:could-not-open-file
21  
-   #:invalid-extension
22  
-   #:file-already-exists
23  
-   #:out-format-same
24  
-   #:stack-overflow
25  
-   #:stack-underflow
26  
-   #:invalid-conversion
27  
-   #:bad-dimensions
28  
-   #:file-read-error
29  
-   #:file-write-error
30  
-   #:lib-gif-error
31  
-   #:lib-jpeg-error
32  
-   #:lib-png-error
33  
-   #:lib-tiff-error
34  
-   #:lib-mng-error
35  
-   #:unknown-error))
  7
+   #:deferrwrap))
36 8
 
37 9
 (defpackage #:cl-devil
38 10
   (:nicknames #:il)
@@ -85,7 +57,6 @@
85 57
    #:TEX-IMAGE
86 58
    ;; Errors from internal
87 59
    #:error
88  
-   #:devil-error
89 60
    #:no-error
90 61
    #:invalid-enum
91 62
    #:out-of-memory

0 notes on commit fc314d2

Please sign in to comment.
Something went wrong with that request. Please try again.