1 /* Copyright (C) 2002, 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 */ 17 18 19 #ifdef 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 #include "libguile/unif.h" 29 #include "libguile/srfi-4.h" 30 31 #include "libguile/convert.h" 32 33 #ifdef HAVE_STRING_H 34 #include <string.h> 35 #endif 36 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); 40 */ 41 42 #define CTYPE char 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 47 #if CHAR_MIN == 0 48 /* 'char' is unsigned. */ 49 #define UVEC_TAG u8 50 #define UVEC_CTYPE scm_t_uint8 51 #else 52 /* 'char' is signed. */ 53 #define UVEC_TAG s8 54 #define UVEC_CTYPE scm_t_int8 55 #endif 56 #include "libguile/convert.i.c" 57 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); 61 */ 62 63 #define CTYPE short 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 68 #define UVEC_TAG s16 69 #define UVEC_CTYPE scm_t_int16 70 #include "libguile/convert.i.c" 71 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); 76 */ 77 78 #define CTYPE int 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 83 #define UVEC_TAG s32 84 #define UVEC_CTYPE scm_t_int32 85 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 90 91 #include "libguile/convert.i.c" 92 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); 97 */ 98 99 #define CTYPE long 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 104 #define UVEC_TAG s32 105 #define UVEC_CTYPE scm_t_int32 106 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 111 112 #include "libguile/convert.i.c" 113 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); 117 */ 118 119 #define CTYPE float 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 124 #define UVEC_TAG f32 125 #define UVEC_CTYPE float 126 #include "libguile/convert.i.c" 127 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); 131 */ 132 133 #define CTYPE double 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 138 #define UVEC_TAG f64 139 #define UVEC_CTYPE double 140 #include "libguile/convert.i.c" 141 142 /* 143 Local Variables: 144 c-file-style: "gnu" 145 End: 146 */ 147