Changed license terms to the plain LGPL thru-out.
[bpt/guile.git] / libguile / convert.c
1 /* Copyright (C) 2002 Free Software Foundation, Inc.
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18 \f
19 #if HAVE_CONFIG_H
20 # include <config.h>
21 #endif
22
23 #include "libguile/_scm.h"
24 #include "libguile/validate.h"
25 #include "libguile/strings.h"
26 #include "libguile/vectors.h"
27 #include "libguile/pairs.h"
28 #if SCM_HAVE_ARRAYS
29 # include "libguile/unif.h"
30 #endif
31
32 #include "libguile/convert.h"
33
34 #ifdef HAVE_STRING_H
35 #include <string.h>
36 #endif
37
38 #define CTYPE char
39 #define SIZEOF_CTYPE 1
40 #define SCM2CTYPES_FN "scm_c_scm2chars"
41 #define SCM2CTYPES scm_c_scm2chars
42 #define CTYPES2SCM_FN "scm_c_chars2scm"
43 #define CTYPES2SCM scm_c_chars2scm
44 #define CTYPES2UVECT_FN "scm_c_chars2byvect"
45 #define CTYPES2UVECT scm_c_chars2byvect
46 #define UVECTTYPE scm_tc7_byvect
47 #define SIZEOF_UVECTTYPE 1
48 #define UVECTCTYPE char
49 #define ARRAYTYPE scm_tc7_byvect
50 #define SIZEOF_ARRAYTYPE 1
51 #define ARRAYCTYPE char
52 #include "convert.i.c"
53
54 #define CTYPE short
55 #define SIZEOF_CTYPE SIZEOF_SHORT
56 #define SCM2CTYPES_FN "scm_c_scm2shorts"
57 #define SCM2CTYPES scm_c_scm2shorts
58 #define CTYPES2SCM_FN "scm_c_shorts2scm"
59 #define CTYPES2SCM scm_c_shorts2scm
60 #define CTYPES2UVECT_FN "scm_c_shorts2svect"
61 #define CTYPES2UVECT scm_c_shorts2svect
62 #define UVECTTYPE scm_tc7_svect
63 #define SIZEOF_UVECTTYPE SIZEOF_SHORT
64 #define UVECTCTYPE short
65 #define ARRAYTYPE scm_tc7_svect
66 #define SIZEOF_ARRAYTYPE SIZEOF_SHORT
67 #define ARRAYCTYPE short
68 #include "convert.i.c"
69
70 #define CTYPE int
71 #define SIZEOF_CTYPE SIZEOF_INT
72 #define SCM2CTYPES_FN "scm_c_scm2ints"
73 #define SCM2CTYPES scm_c_scm2ints
74 #define CTYPES2SCM_FN "scm_c_ints2scm"
75 #define CTYPES2SCM scm_c_ints2scm
76 #define CTYPES2UVECT_FN "scm_c_ints2ivect"
77 #define CTYPES2UVECT scm_c_ints2ivect
78 #define UVECTTYPE scm_tc7_ivect
79 #define SIZEOF_UVECTTYPE SIZEOF_LONG
80 #define UVECTCTYPE long
81 #define CTYPES2UVECT_FN_OPTIONAL "scm_c_uints2uvect"
82 #define CTYPES2UVECT_OPTIONAL scm_c_uints2uvect
83 #define UVECTTYPE_OPTIONAL scm_tc7_uvect
84 #define ARRAYTYPE scm_tc7_ivect
85 #define SIZEOF_ARRAYTYPE SIZEOF_LONG
86 #define ARRAYCTYPE long
87 #define ARRAYTYPE_OPTIONAL scm_tc7_uvect
88 #include "convert.i.c"
89
90 #define CTYPE long
91 #define SIZEOF_CTYPE SIZEOF_LONG
92 #define SCM2CTYPES_FN "scm_c_scm2longs"
93 #define SCM2CTYPES scm_c_scm2longs
94 #define CTYPES2SCM_FN "scm_c_longs2scm"
95 #define CTYPES2SCM scm_c_longs2scm
96 #define CTYPES2UVECT_FN "scm_c_longs2ivect"
97 #define CTYPES2UVECT scm_c_longs2ivect
98 #define UVECTTYPE scm_tc7_ivect
99 #define SIZEOF_UVECTTYPE SIZEOF_LONG
100 #define UVECTCTYPE long
101 #define CTYPES2UVECT_FN_OPTIONAL "scm_c_ulongs2uvect"
102 #define CTYPES2UVECT_OPTIONAL scm_c_ulongs2uvect
103 #define UVECTTYPE_OPTIONAL scm_tc7_uvect
104 #define ARRAYTYPE scm_tc7_ivect
105 #define SIZEOF_ARRAYTYPE SIZEOF_LONG
106 #define ARRAYCTYPE long
107 #define ARRAYTYPE_OPTIONAL scm_tc7_uvect
108 #include "convert.i.c"
109
110 #define CTYPE float
111 #define SIZEOF_CTYPE 0
112 #define SCM2CTYPES_FN "scm_c_scm2floats"
113 #define SCM2CTYPES scm_c_scm2floats
114 #define CTYPES2SCM_FN "scm_c_floats2scm"
115 #define CTYPES2SCM scm_c_floats2scm
116 #define CTYPES2UVECT_FN "scm_c_floats2fvect"
117 #define CTYPES2UVECT scm_c_floats2fvect
118 #define UVECTTYPE scm_tc7_fvect
119 #define SIZEOF_UVECTTYPE 0
120 #define ARRAYTYPE scm_tc7_fvect
121 #define SIZEOF_ARRAYTYPE 0
122 #define ARRAYTYPE_OPTIONAL scm_tc7_dvect
123 #define FLOATTYPE float
124 #define FLOATTYPE_OPTIONAL double
125 #include "convert.i.c"
126
127 #define CTYPE double
128 #define SIZEOF_CTYPE 0
129 #define SCM2CTYPES_FN "scm_c_scm2doubles"
130 #define SCM2CTYPES scm_c_scm2doubles
131 #define CTYPES2SCM_FN "scm_c_doubles2scm"
132 #define CTYPES2SCM scm_c_doubles2scm
133 #define CTYPES2UVECT_FN "scm_c_doubles2dvect"
134 #define CTYPES2UVECT scm_c_doubles2dvect
135 #define UVECTTYPE scm_tc7_dvect
136 #define SIZEOF_UVECTTYPE 0
137 #define ARRAYTYPE scm_tc7_dvect
138 #define SIZEOF_ARRAYTYPE 0
139 #define ARRAYTYPE_OPTIONAL scm_tc7_fvect
140 #define FLOATTYPE double
141 #define FLOATTYPE_OPTIONAL float
142 #include "convert.i.c"
143
144 /*
145 Local Variables:
146 c-file-style: "gnu"
147 End:
148 */