1 /* Copyright (C) 2002, 2006 Free Software Foundation, Inc.
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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 #include "libguile/unif.h"
29 #include "libguile/srfi-4.h"
31 #include "libguile/convert.h"
37 /* char *scm_c_scm2chars (SCM obj, char *dst);
38 SCM scm_c_chars2scm (const char *src, long n);
39 SCM scm_c_chars2byvect (const char *src, long n);
43 #define FROM_CTYPE scm_from_char
44 #define SCM2CTYPES scm_c_scm2chars
45 #define CTYPES2SCM scm_c_chars2scm
46 #define CTYPES2UVECT scm_c_chars2byvect
48 /* 'char' is unsigned. */
50 #define UVEC_CTYPE scm_t_uint8
52 /* 'char' is signed. */
54 #define UVEC_CTYPE scm_t_int8
56 #include "libguile/convert.i.c"
58 /* short *scm_c_scm2shorts (SCM obj, short *dst);
59 SCM scm_c_shorts2scm (const short *src, long n);
60 SCM scm_c_shorts2svect (const short *src, long n);
64 #define FROM_CTYPE scm_from_short
65 #define SCM2CTYPES scm_c_scm2shorts
66 #define CTYPES2SCM scm_c_shorts2scm
67 #define CTYPES2UVECT scm_c_shorts2svect
69 #define UVEC_CTYPE scm_t_int16
70 #include "libguile/convert.i.c"
72 /* int *scm_c_scm2ints (SCM obj, int *dst);
73 SCM scm_c_ints2scm (const int *src, long n);
74 SCM scm_c_ints2ivect (const int *src, long n);
75 SCM scm_c_uints2uvect (const unsigned int *src, long n);
79 #define FROM_CTYPE scm_from_int
80 #define SCM2CTYPES scm_c_scm2ints
81 #define CTYPES2SCM scm_c_ints2scm
82 #define CTYPES2UVECT scm_c_ints2ivect
84 #define UVEC_CTYPE scm_t_int32
86 #define CTYPES2UVECT_2 scm_c_uints2uvect
87 #define CTYPE_2 unsigned int
88 #define UVEC_TAG_2 u32
89 #define UVEC_CTYPE_2 scm_t_uint32
91 #include "libguile/convert.i.c"
93 /* long *scm_c_scm2longs (SCM obj, long *dst);
94 SCM scm_c_longs2scm (const long *src, long n);
95 SCM scm_c_longs2ivect (const long *src, long n);
96 SCM scm_c_ulongs2uvect (const unsigned long *src, long n);
100 #define FROM_CTYPE scm_from_long
101 #define SCM2CTYPES scm_c_scm2longs
102 #define CTYPES2SCM scm_c_longs2scm
103 #define CTYPES2UVECT scm_c_longs2ivect
105 #define UVEC_CTYPE scm_t_int32
107 #define CTYPES2UVECT_2 scm_c_ulongs2uvect
108 #define CTYPE_2 unsigned int
109 #define UVEC_TAG_2 u32
110 #define UVEC_CTYPE_2 scm_t_uint32
112 #include "libguile/convert.i.c"
114 /* float *scm_c_scm2floats (SCM obj, float *dst);
115 SCM scm_c_floats2scm (const float *src, long n);
116 SCM scm_c_floats2fvect (const float *src, long n);
120 #define FROM_CTYPE scm_from_double
121 #define SCM2CTYPES scm_c_scm2floats
122 #define CTYPES2SCM scm_c_floats2scm
123 #define CTYPES2UVECT scm_c_floats2fvect
125 #define UVEC_CTYPE float
126 #include "libguile/convert.i.c"
128 /* double *scm_c_scm2doubles (SCM obj, double *dst);
129 SCM scm_c_doubles2scm (const double *src, long n);
130 SCM scm_c_doubles2dvect (const double *src, long n);
134 #define FROM_CTYPE scm_from_double
135 #define SCM2CTYPES scm_c_scm2doubles
136 #define CTYPES2SCM scm_c_doubles2scm
137 #define CTYPES2UVECT scm_c_doubles2dvect
139 #define UVEC_CTYPE double
140 #include "libguile/convert.i.c"