mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-05 23:20:38 +02:00
remove convert.{c,i.c,h}
* libguile/convert.c: * libguile/convert.h: * libguile/convert.i.c: Remove these functions, which were undocumented, not in the libguile/ header, and thus unlikely to have been used.
This commit is contained in:
parent
86d88a223c
commit
4b12659844
4 changed files with 3 additions and 373 deletions
|
@ -107,7 +107,7 @@ libguile_la_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
|
||||||
|
|
||||||
libguile_la_SOURCES = alist.c arbiters.c async.c backtrace.c boolean.c \
|
libguile_la_SOURCES = alist.c arbiters.c async.c backtrace.c boolean.c \
|
||||||
bytevectors.c chars.c continuations.c \
|
bytevectors.c chars.c continuations.c \
|
||||||
convert.c debug.c deprecation.c \
|
debug.c deprecation.c \
|
||||||
deprecated.c discouraged.c dynwind.c eq.c error.c \
|
deprecated.c discouraged.c dynwind.c eq.c error.c \
|
||||||
eval.c evalext.c extensions.c feature.c fluids.c fports.c \
|
eval.c evalext.c extensions.c feature.c fluids.c fports.c \
|
||||||
futures.c gc.c gc-mark.c gc-segment.c gc-malloc.c gc-card.c \
|
futures.c gc.c gc-mark.c gc-segment.c gc-malloc.c gc-card.c \
|
||||||
|
@ -208,8 +208,7 @@ install-exec-hook:
|
||||||
## compile, since they are #included. So instead we list them here.
|
## compile, since they are #included. So instead we list them here.
|
||||||
## Perhaps we can deal with them normally once the merge seems to be
|
## Perhaps we can deal with them normally once the merge seems to be
|
||||||
## working.
|
## working.
|
||||||
noinst_HEADERS = convert.i.c \
|
noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c \
|
||||||
conv-integer.i.c conv-uinteger.i.c \
|
|
||||||
eval.i.c ieee-754.h \
|
eval.i.c ieee-754.h \
|
||||||
srfi-4.i.c \
|
srfi-4.i.c \
|
||||||
quicksort.i.c \
|
quicksort.i.c \
|
||||||
|
@ -229,7 +228,7 @@ pkginclude_HEADERS =
|
||||||
# These are headers visible as <libguile/mumble.h>.
|
# These are headers visible as <libguile/mumble.h>.
|
||||||
modincludedir = $(includedir)/libguile
|
modincludedir = $(includedir)/libguile
|
||||||
modinclude_HEADERS = __scm.h alist.h arbiters.h async.h backtrace.h \
|
modinclude_HEADERS = __scm.h alist.h arbiters.h async.h backtrace.h \
|
||||||
boolean.h bytevectors.h chars.h continuations.h convert.h \
|
boolean.h bytevectors.h chars.h continuations.h \
|
||||||
debug.h debug-malloc.h \
|
debug.h debug-malloc.h \
|
||||||
deprecation.h deprecated.h discouraged.h dynl.h dynwind.h \
|
deprecation.h deprecated.h discouraged.h dynl.h dynwind.h \
|
||||||
eq.h error.h eval.h evalext.h extensions.h \
|
eq.h error.h eval.h evalext.h extensions.h \
|
||||||
|
|
|
@ -1,147 +0,0 @@
|
||||||
/* Copyright (C) 2002, 2006 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 3 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "libguile/_scm.h"
|
|
||||||
#include "libguile/validate.h"
|
|
||||||
#include "libguile/strings.h"
|
|
||||||
#include "libguile/vectors.h"
|
|
||||||
#include "libguile/pairs.h"
|
|
||||||
#include "libguile/unif.h"
|
|
||||||
#include "libguile/srfi-4.h"
|
|
||||||
|
|
||||||
#include "libguile/convert.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_STRING_H
|
|
||||||
#include <string.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* char *scm_c_scm2chars (SCM obj, char *dst);
|
|
||||||
SCM scm_c_chars2scm (const char *src, long n);
|
|
||||||
SCM scm_c_chars2byvect (const char *src, long n);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define CTYPE char
|
|
||||||
#define FROM_CTYPE scm_from_char
|
|
||||||
#define SCM2CTYPES scm_c_scm2chars
|
|
||||||
#define CTYPES2SCM scm_c_chars2scm
|
|
||||||
#define CTYPES2UVECT scm_c_chars2byvect
|
|
||||||
#if CHAR_MIN == 0
|
|
||||||
/* 'char' is unsigned. */
|
|
||||||
#define UVEC_TAG u8
|
|
||||||
#define UVEC_CTYPE scm_t_uint8
|
|
||||||
#else
|
|
||||||
/* 'char' is signed. */
|
|
||||||
#define UVEC_TAG s8
|
|
||||||
#define UVEC_CTYPE scm_t_int8
|
|
||||||
#endif
|
|
||||||
#include "libguile/convert.i.c"
|
|
||||||
|
|
||||||
/* short *scm_c_scm2shorts (SCM obj, short *dst);
|
|
||||||
SCM scm_c_shorts2scm (const short *src, long n);
|
|
||||||
SCM scm_c_shorts2svect (const short *src, long n);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define CTYPE short
|
|
||||||
#define FROM_CTYPE scm_from_short
|
|
||||||
#define SCM2CTYPES scm_c_scm2shorts
|
|
||||||
#define CTYPES2SCM scm_c_shorts2scm
|
|
||||||
#define CTYPES2UVECT scm_c_shorts2svect
|
|
||||||
#define UVEC_TAG s16
|
|
||||||
#define UVEC_CTYPE scm_t_int16
|
|
||||||
#include "libguile/convert.i.c"
|
|
||||||
|
|
||||||
/* int *scm_c_scm2ints (SCM obj, int *dst);
|
|
||||||
SCM scm_c_ints2scm (const int *src, long n);
|
|
||||||
SCM scm_c_ints2ivect (const int *src, long n);
|
|
||||||
SCM scm_c_uints2uvect (const unsigned int *src, long n);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define CTYPE int
|
|
||||||
#define FROM_CTYPE scm_from_int
|
|
||||||
#define SCM2CTYPES scm_c_scm2ints
|
|
||||||
#define CTYPES2SCM scm_c_ints2scm
|
|
||||||
#define CTYPES2UVECT scm_c_ints2ivect
|
|
||||||
#define UVEC_TAG s32
|
|
||||||
#define UVEC_CTYPE scm_t_int32
|
|
||||||
|
|
||||||
#define CTYPES2UVECT_2 scm_c_uints2uvect
|
|
||||||
#define CTYPE_2 unsigned int
|
|
||||||
#define UVEC_TAG_2 u32
|
|
||||||
#define UVEC_CTYPE_2 scm_t_uint32
|
|
||||||
|
|
||||||
#include "libguile/convert.i.c"
|
|
||||||
|
|
||||||
/* long *scm_c_scm2longs (SCM obj, long *dst);
|
|
||||||
SCM scm_c_longs2scm (const long *src, long n);
|
|
||||||
SCM scm_c_longs2ivect (const long *src, long n);
|
|
||||||
SCM scm_c_ulongs2uvect (const unsigned long *src, long n);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define CTYPE long
|
|
||||||
#define FROM_CTYPE scm_from_long
|
|
||||||
#define SCM2CTYPES scm_c_scm2longs
|
|
||||||
#define CTYPES2SCM scm_c_longs2scm
|
|
||||||
#define CTYPES2UVECT scm_c_longs2ivect
|
|
||||||
#define UVEC_TAG s32
|
|
||||||
#define UVEC_CTYPE scm_t_int32
|
|
||||||
|
|
||||||
#define CTYPES2UVECT_2 scm_c_ulongs2uvect
|
|
||||||
#define CTYPE_2 unsigned int
|
|
||||||
#define UVEC_TAG_2 u32
|
|
||||||
#define UVEC_CTYPE_2 scm_t_uint32
|
|
||||||
|
|
||||||
#include "libguile/convert.i.c"
|
|
||||||
|
|
||||||
/* float *scm_c_scm2floats (SCM obj, float *dst);
|
|
||||||
SCM scm_c_floats2scm (const float *src, long n);
|
|
||||||
SCM scm_c_floats2fvect (const float *src, long n);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define CTYPE float
|
|
||||||
#define FROM_CTYPE scm_from_double
|
|
||||||
#define SCM2CTYPES scm_c_scm2floats
|
|
||||||
#define CTYPES2SCM scm_c_floats2scm
|
|
||||||
#define CTYPES2UVECT scm_c_floats2fvect
|
|
||||||
#define UVEC_TAG f32
|
|
||||||
#define UVEC_CTYPE float
|
|
||||||
#include "libguile/convert.i.c"
|
|
||||||
|
|
||||||
/* double *scm_c_scm2doubles (SCM obj, double *dst);
|
|
||||||
SCM scm_c_doubles2scm (const double *src, long n);
|
|
||||||
SCM scm_c_doubles2dvect (const double *src, long n);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define CTYPE double
|
|
||||||
#define FROM_CTYPE scm_from_double
|
|
||||||
#define SCM2CTYPES scm_c_scm2doubles
|
|
||||||
#define CTYPES2SCM scm_c_doubles2scm
|
|
||||||
#define CTYPES2UVECT scm_c_doubles2dvect
|
|
||||||
#define UVEC_TAG f64
|
|
||||||
#define UVEC_CTYPE double
|
|
||||||
#include "libguile/convert.i.c"
|
|
||||||
|
|
||||||
/*
|
|
||||||
Local Variables:
|
|
||||||
c-file-style: "gnu"
|
|
||||||
End:
|
|
||||||
*/
|
|
|
@ -1,51 +0,0 @@
|
||||||
/* classes: h_files */
|
|
||||||
|
|
||||||
#ifndef SCM_CONVERT_H
|
|
||||||
#define SCM_CONVERT_H
|
|
||||||
|
|
||||||
/* Copyright (C) 2002, 2006 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 3 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "libguile/__scm.h"
|
|
||||||
|
|
||||||
SCM_API char *scm_c_scm2chars (SCM obj, char *dst);
|
|
||||||
SCM_API short *scm_c_scm2shorts (SCM obj, short *dst);
|
|
||||||
SCM_API int *scm_c_scm2ints (SCM obj, int *dst);
|
|
||||||
SCM_API long *scm_c_scm2longs (SCM obj, long *dst);
|
|
||||||
SCM_API float *scm_c_scm2floats (SCM obj, float *dst);
|
|
||||||
SCM_API double *scm_c_scm2doubles (SCM obj, double *dst);
|
|
||||||
|
|
||||||
SCM_API SCM scm_c_chars2scm (const char *src, long n);
|
|
||||||
SCM_API SCM scm_c_shorts2scm (const short *src, long n);
|
|
||||||
SCM_API SCM scm_c_ints2scm (const int *src, long n);
|
|
||||||
SCM_API SCM scm_c_longs2scm (const long *src, long n);
|
|
||||||
SCM_API SCM scm_c_floats2scm (const float *src, long n);
|
|
||||||
SCM_API SCM scm_c_doubles2scm (const double *src, long n);
|
|
||||||
|
|
||||||
SCM_API SCM scm_c_chars2byvect (const char *src, long n);
|
|
||||||
SCM_API SCM scm_c_shorts2svect (const short *src, long n);
|
|
||||||
SCM_API SCM scm_c_ints2ivect (const int *src, long n);
|
|
||||||
SCM_API SCM scm_c_uints2uvect (const unsigned int *src, long n);
|
|
||||||
SCM_API SCM scm_c_longs2ivect (const long *src, long n);
|
|
||||||
SCM_API SCM scm_c_ulongs2uvect (const unsigned long *src, long n);
|
|
||||||
SCM_API SCM scm_c_floats2fvect (const float *src, long n);
|
|
||||||
SCM_API SCM scm_c_doubles2dvect (const double *src, long n);
|
|
||||||
|
|
||||||
#endif /* SCM_CONVERT_H */
|
|
|
@ -1,171 +0,0 @@
|
||||||
/* this file is #include'd (x times) by convert.c */
|
|
||||||
|
|
||||||
/* You need to define the following macros before including this
|
|
||||||
template. They are undefined at the end of this file to give a
|
|
||||||
clean slate for the next inclusion.
|
|
||||||
|
|
||||||
- CTYPE
|
|
||||||
|
|
||||||
The type of an element of the C array, for example 'char'.
|
|
||||||
|
|
||||||
- FROM_CTYPE
|
|
||||||
|
|
||||||
The function that converts a CTYPE to a SCM, for example
|
|
||||||
scm_from_char.
|
|
||||||
|
|
||||||
- UVEC_TAG
|
|
||||||
|
|
||||||
The tag of a suitable uniform vector that can hold the CTYPE, for
|
|
||||||
example 's8'.
|
|
||||||
|
|
||||||
- UVEC_CTYPE
|
|
||||||
|
|
||||||
The C type of an element of the uniform vector, for example
|
|
||||||
scm_t_int8.
|
|
||||||
|
|
||||||
- SCM2CTYPES
|
|
||||||
|
|
||||||
The name of the 'SCM-to-C' function, for example scm_c_scm2chars.
|
|
||||||
|
|
||||||
- CTYPES2SCM
|
|
||||||
|
|
||||||
The name of the 'C-to-SCM' function, for example, scm_c_chars2scm.
|
|
||||||
|
|
||||||
- CTYPES2UVECT
|
|
||||||
|
|
||||||
The name of the 'C-to-uniform-vector' function, for example
|
|
||||||
scm_c_chars2byvect. It will create a uniform vector of kind
|
|
||||||
UVEC_TAG.
|
|
||||||
|
|
||||||
- CTYPES2UVECT_2
|
|
||||||
|
|
||||||
The name of a second 'C-to-uniform-vector' function. Leave
|
|
||||||
undefined if you want only one such function.
|
|
||||||
|
|
||||||
- CTYPE_2
|
|
||||||
- UVEC_TAG_2
|
|
||||||
- UVEC_CTYPE_2
|
|
||||||
|
|
||||||
The tag and C type of the second kind of uniform vector, for use
|
|
||||||
with the function described above.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* The first level does not expand macros in the arguments. */
|
|
||||||
#define paste(a1,a2,a3) a1##a2##a3
|
|
||||||
#define stringify(a) #a
|
|
||||||
|
|
||||||
/* But the second level does. */
|
|
||||||
#define F(pre,T,suf) paste(pre,T,suf)
|
|
||||||
#define S(T) stringify(T)
|
|
||||||
|
|
||||||
/* Convert a vector, list or uniform vector into a C array. If the
|
|
||||||
result array in argument 2 is NULL, malloc() a new one.
|
|
||||||
*/
|
|
||||||
|
|
||||||
CTYPE *
|
|
||||||
SCM2CTYPES (SCM obj, CTYPE *data)
|
|
||||||
{
|
|
||||||
scm_t_array_handle handle;
|
|
||||||
size_t i, len;
|
|
||||||
ssize_t inc;
|
|
||||||
const UVEC_CTYPE *uvec_elements;
|
|
||||||
|
|
||||||
obj = F(scm_any_to_,UVEC_TAG,vector) (obj);
|
|
||||||
uvec_elements = F(scm_,UVEC_TAG,vector_elements) (obj, &handle, &len, &inc);
|
|
||||||
|
|
||||||
if (data == NULL)
|
|
||||||
data = scm_malloc (len * sizeof (CTYPE));
|
|
||||||
for (i = 0; i < len; i++, uvec_elements += inc)
|
|
||||||
data[i] = uvec_elements[i];
|
|
||||||
|
|
||||||
scm_array_handle_release (&handle);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Converts a C array into a vector. */
|
|
||||||
|
|
||||||
SCM
|
|
||||||
CTYPES2SCM (const CTYPE *data, long n)
|
|
||||||
{
|
|
||||||
long i;
|
|
||||||
SCM v;
|
|
||||||
|
|
||||||
v = scm_c_make_vector (n, SCM_UNSPECIFIED);
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
SCM_SIMPLE_VECTOR_SET (v, i, FROM_CTYPE (data[i]));
|
|
||||||
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Converts a C array into a uniform vector. */
|
|
||||||
|
|
||||||
SCM
|
|
||||||
CTYPES2UVECT (const CTYPE *data, long n)
|
|
||||||
{
|
|
||||||
scm_t_array_handle handle;
|
|
||||||
long i;
|
|
||||||
SCM uvec;
|
|
||||||
UVEC_CTYPE *uvec_elements;
|
|
||||||
|
|
||||||
uvec = F(scm_make_,UVEC_TAG,vector) (scm_from_long (n), SCM_UNDEFINED);
|
|
||||||
uvec_elements = F(scm_,UVEC_TAG,vector_writable_elements) (uvec, &handle,
|
|
||||||
NULL, NULL);
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
uvec_elements[i] = data[i];
|
|
||||||
|
|
||||||
scm_array_handle_release (&handle);
|
|
||||||
|
|
||||||
return uvec;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CTYPE2UVECT_2
|
|
||||||
|
|
||||||
SCM
|
|
||||||
CTYPES2UVECT_2 (const CTYPE_2 *data, long n)
|
|
||||||
{
|
|
||||||
scm_t_array_handle handle;
|
|
||||||
long i;
|
|
||||||
SCM uvec;
|
|
||||||
UVEC_CTYPE_2 *uvec_elements;
|
|
||||||
|
|
||||||
uvec = F(scm_make_,UVEC_TAG_2,vector) (scm_from_long (n), SCM_UNDEFINED);
|
|
||||||
uvec_elements = F(scm_,UVEC_TAG_2,vector_writable_elements) (uvec, &handle,
|
|
||||||
NULL, NULL);
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
uvec_elements[i] = data[i];
|
|
||||||
|
|
||||||
scm_array_handle_release (&handle);
|
|
||||||
|
|
||||||
return uvec;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef paste
|
|
||||||
#undef stringify
|
|
||||||
#undef F
|
|
||||||
#undef S
|
|
||||||
|
|
||||||
#undef CTYPE
|
|
||||||
#undef FROM_CTYPE
|
|
||||||
#undef UVEC_TAG
|
|
||||||
#undef UVEC_CTYPE
|
|
||||||
#undef SCM2CTYPES
|
|
||||||
#undef CTYPES2SCM
|
|
||||||
#undef CTYPES2UVECT
|
|
||||||
#ifdef CTYPES2UVECT_2
|
|
||||||
#undef CTYPES2UVECT_2
|
|
||||||
#undef CTYPE_2
|
|
||||||
#undef UVEC_TAG_2
|
|
||||||
#undef UVEC_CTYPE_2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
Local Variables:
|
|
||||||
c-file-style: "gnu"
|
|
||||||
End:
|
|
||||||
*/
|
|
Loading…
Add table
Add a link
Reference in a new issue