Commit | Line | Data |
---|---|---|
1fa86ca5 SJ |
1 | /* Copyright (C) 2002 Free Software Foundation, Inc. |
2 | * | |
73be1d9e MV |
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. | |
1fa86ca5 | 7 | * |
73be1d9e MV |
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. | |
1fa86ca5 | 12 | * |
73be1d9e MV |
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 | */ | |
1fa86ca5 SJ |
17 | |
18 | \f | |
3c6be74a RB |
19 | #if HAVE_CONFIG_H |
20 | # include <config.h> | |
21 | #endif | |
1fa86ca5 SJ |
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" | |
3c6be74a | 28 | #if SCM_HAVE_ARRAYS |
1fa86ca5 SJ |
29 | # include "libguile/unif.h" |
30 | #endif | |
d1d2f094 | 31 | #include "libguile/srfi-4.h" |
1fa86ca5 SJ |
32 | |
33 | #include "libguile/convert.h" | |
34 | ||
4f2716b6 GH |
35 | #ifdef HAVE_STRING_H |
36 | #include <string.h> | |
37 | #endif | |
38 | ||
94897289 MV |
39 | /* char *scm_c_scm2chars (SCM obj, char *dst); |
40 | SCM scm_c_chars2scm (const char *src, long n); | |
41 | SCM scm_c_chars2byvect (const char *src, long n); | |
42 | */ | |
43 | ||
97820583 | 44 | #define CTYPE char |
94897289 | 45 | #define FROM_CTYPE scm_from_char |
97820583 | 46 | #define SCM2CTYPES scm_c_scm2chars |
97820583 | 47 | #define CTYPES2SCM scm_c_chars2scm |
97820583 | 48 | #define CTYPES2UVECT scm_c_chars2byvect |
94897289 MV |
49 | #if CHAR_MIN == 0 |
50 | /* 'char' is unsigned. */ | |
51 | #define UVEC_TAG u8 | |
52 | #define UVEC_CTYPE scm_t_uint8 | |
53 | #else | |
54 | /* 'char' is signed. */ | |
55 | #define UVEC_TAG s8 | |
56 | #define UVEC_CTYPE scm_t_int8 | |
57 | #endif | |
58 | #include "libguile/convert.i.c" | |
59 | ||
60 | /* short *scm_c_scm2shorts (SCM obj, short *dst); | |
61 | SCM scm_c_shorts2scm (const short *src, long n); | |
62 | SCM scm_c_shorts2svect (const short *src, long n); | |
63 | */ | |
1fa86ca5 | 64 | |
97820583 | 65 | #define CTYPE short |
94897289 | 66 | #define FROM_CTYPE scm_from_short |
97820583 | 67 | #define SCM2CTYPES scm_c_scm2shorts |
97820583 | 68 | #define CTYPES2SCM scm_c_shorts2scm |
97820583 | 69 | #define CTYPES2UVECT scm_c_shorts2svect |
94897289 MV |
70 | #define UVEC_TAG s16 |
71 | #define UVEC_CTYPE scm_t_int16 | |
72 | #include "libguile/convert.i.c" | |
73 | ||
74 | /* int *scm_c_scm2ints (SCM obj, int *dst); | |
75 | SCM scm_c_ints2scm (const int *src, long n); | |
76 | SCM scm_c_ints2ivect (const int *src, long n); | |
77 | SCM scm_c_uints2uvect (const unsigned int *src, long n); | |
78 | */ | |
79 | ||
80 | #define CTYPE int | |
81 | #define FROM_CTYPE scm_from_int | |
82 | #define SCM2CTYPES scm_c_scm2ints | |
83 | #define CTYPES2SCM scm_c_ints2scm | |
84 | #define CTYPES2UVECT scm_c_ints2ivect | |
85 | #define UVEC_TAG s32 | |
86 | #define UVEC_CTYPE scm_t_int32 | |
87 | ||
88 | #define CTYPES2UVECT_2 scm_c_uints2uvect | |
89 | #define CTYPE_2 unsigned int | |
90 | #define UVEC_TAG_2 u32 | |
91 | #define UVEC_CTYPE_2 scm_t_uint32 | |
92 | ||
93 | #include "libguile/convert.i.c" | |
94 | ||
95 | /* long *scm_c_scm2longs (SCM obj, long *dst); | |
96 | SCM scm_c_longs2scm (const long *src, long n); | |
97 | SCM scm_c_longs2ivect (const long *src, long n); | |
98 | SCM scm_c_ulongs2uvect (const unsigned long *src, long n); | |
99 | */ | |
100 | ||
101 | #define CTYPE long | |
102 | #define FROM_CTYPE scm_from_long | |
103 | #define SCM2CTYPES scm_c_scm2longs | |
104 | #define CTYPES2SCM scm_c_longs2scm | |
105 | #define CTYPES2UVECT scm_c_longs2ivect | |
106 | #define UVEC_TAG s32 | |
107 | #define UVEC_CTYPE scm_t_int32 | |
108 | ||
109 | #define CTYPES2UVECT_2 scm_c_ulongs2uvect | |
110 | #define CTYPE_2 unsigned int | |
111 | #define UVEC_TAG_2 u32 | |
112 | #define UVEC_CTYPE_2 scm_t_uint32 | |
113 | ||
114 | #include "libguile/convert.i.c" | |
115 | ||
116 | /* float *scm_c_scm2floats (SCM obj, float *dst); | |
117 | SCM scm_c_floats2scm (const float *src, long n); | |
118 | SCM scm_c_floats2fvect (const float *src, long n); | |
119 | */ | |
120 | ||
121 | #define CTYPE float | |
122 | #define FROM_CTYPE scm_from_double | |
123 | #define SCM2CTYPES scm_c_scm2floats | |
124 | #define CTYPES2SCM scm_c_floats2scm | |
125 | #define CTYPES2UVECT scm_c_floats2fvect | |
126 | #define UVEC_TAG f32 | |
127 | #define UVEC_CTYPE float | |
128 | #include "libguile/convert.i.c" | |
129 | ||
130 | /* double *scm_c_scm2doubles (SCM obj, double *dst); | |
131 | SCM scm_c_doubles2scm (const double *src, long n); | |
132 | SCM scm_c_doubles2dvect (const double *src, long n); | |
133 | */ | |
134 | ||
135 | #define CTYPE double | |
136 | #define FROM_CTYPE scm_from_double | |
137 | #define SCM2CTYPES scm_c_scm2doubles | |
138 | #define CTYPES2SCM scm_c_doubles2scm | |
139 | #define CTYPES2UVECT scm_c_doubles2dvect | |
140 | #define UVEC_TAG f64 | |
141 | #define UVEC_CTYPE double | |
142 | #include "libguile/convert.i.c" | |
1fa86ca5 SJ |
143 | |
144 | /* | |
145 | Local Variables: | |
146 | c-file-style: "gnu" | |
147 | End: | |
148 | */ |