define more types
[clinton/guile-figl.git] / figl / gl / types.scm
1 ;;; figl
2 ;;; Copyright (C) 2013 Daniel Hartwig <mandyke@gmail.com>
3 ;;;
4 ;;; Figl is free software: you can redistribute it and/or modify it
5 ;;; under the terms of the GNU Lesser General Public License as
6 ;;; published by the Free Software Foundation, either version 3 of the
7 ;;; License, or (at your option) any later version.
8 ;;;
9 ;;; Figl is distributed in the hope that it will be useful, but WITHOUT
10 ;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 ;;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
12 ;;; Public License for more details.
13 ;;;
14 ;;; You should have received a copy of the GNU Lesser General Public
15 ;;; License along with this program. If not, see
16 ;;; <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19 ;;
20 ;; Mappings from OpenGL to FFI types.
21 ;;
22 ;;; Code:
23
24 (define-module (figl gl types)
25 #:use-module (system foreign)
26 #:re-export (void)
27 #:export (GLboolean
28 GLbyte
29 GLubyte
30 GLchar
31 GLshort
32 GLushort
33 GLint
34 GLuint
35 GLsizei
36 GLenum
37 GLintptr
38 GLsizeiptr
39 GLbitfield
40 GLfloat
41 GLclampf
42 GLdouble
43 GLclampd
44
45 GLboolean-*
46 GLchar-*
47 GLdouble-*
48 GLenum-*
49 GLfloat-*
50 GLint-*
51 GLsizei-*
52 GLubyte-*
53 GLuint-*
54 GLvoid-*
55 const-GLchar-*
56 const-GLchar-**
57 const-GLclampf-*
58 const-GLdouble-*
59 const-GLenum-*
60 const-GLfloat-*
61 const-GLint-*
62 const-GLsizei-*
63 const-GLubyte*
64 const-GLubyte-*
65 const-GLubyte-*
66 const-GLuint-*
67 const-GLvoid-*
68 const-GLvoid-**
69 void-*))
70
71 (define %ptr
72 (case (sizeof '*)
73 ((4) uint32)
74 ((8) uint64)
75 (else (error "unknown pointer size"))))
76
77 (define GLboolean uint8)
78 (define GLbyte int8)
79 (define GLubyte uint8)
80 (define GLchar int8)
81 (define Glshort int16)
82 (define GLushort uint16)
83 (define GLint int32)
84 (define GLuint uint32)
85 (define GLsizei int32)
86 (define GLenum uint32)
87 (define GLintptr %ptr)
88 (define GLsizeiptr %ptr)
89 (define GLbitfield uint32)
90 (define GLfloat float)
91 (define GLclampf float)
92 (define GLdouble double)
93 (define GLclampd double)
94
95 ;; All of these have different meanings and we should be able to do a
96 ;; basic job at teasing them out, but for now, just use the limited
97 ;; annotation from (system foreign).
98 (define GLboolean-* '*)
99 (define GLchar-* '*)
100 (define GLdouble-* '*)
101 (define GLenum-* '*)
102 (define GLfloat-* '*)
103 (define GLint-* '*)
104 (define GLsizei-* '*)
105 (define GLubyte-* '*)
106 (define GLuint-* '*)
107 (define GLvoid-* '*)
108 (define const-GLchar-* '*)
109 (define const-GLchar-** '*)
110 (define const-GLclampf-* '*)
111 (define const-GLdouble-* '*)
112 (define const-GLenum-* '*)
113 (define const-GLfloat-* '*)
114 (define const-GLint-* '*)
115 (define const-GLsizei-* '*)
116 (define const-GLubyte* '*)
117 (define const-GLubyte-* '*)
118 (define const-GLubyte-* '*)
119 (define const-GLuint-* '*)
120 (define const-GLvoid-* '*)
121 (define const-GLvoid-** '*)
122 (define void-* '*)