mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-29 00:10:21 +02:00
* Where possible, accept const pointers as parameters.
This commit is contained in:
parent
af45e3b06a
commit
bcee10ddd2
4 changed files with 70 additions and 48 deletions
|
@ -1,4 +1,13 @@
|
||||||
2000-05-17 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
2000-05-18 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||||
|
|
||||||
|
* gh.h gh_data.c gh_funcs.c (gh_new_procedure*, gh_chars2byvect,
|
||||||
|
gh_shorts2svect, gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect,
|
||||||
|
gh_doubles2dvect, gh_doubles2scm, gh_define, gh_lookup,
|
||||||
|
gh_module_lookup): Accept const pointers as parameters.
|
||||||
|
|
||||||
|
* gh.h gh_data.c (gh_int2scmb): Deprecated.
|
||||||
|
|
||||||
|
2000-05-18 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||||
|
|
||||||
* __scm.h (SCM_DEBUG_REST_ARGUMENT): Renamed from
|
* __scm.h (SCM_DEBUG_REST_ARGUMENT): Renamed from
|
||||||
SCM_DEBUG_REST_ARGUMENTS in order to clarify that we don't test
|
SCM_DEBUG_REST_ARGUMENTS in order to clarify that we don't test
|
||||||
|
|
|
@ -80,23 +80,22 @@ SCM gh_eval_file_with_standard_handler(const char *scheme_code);
|
||||||
#define gh_defer_ints() SCM_DEFER_INTS
|
#define gh_defer_ints() SCM_DEFER_INTS
|
||||||
#define gh_allow_ints() SCM_ALLOW_INTS
|
#define gh_allow_ints() SCM_ALLOW_INTS
|
||||||
|
|
||||||
SCM gh_new_procedure(char *proc_name, SCM (*fn)(),
|
SCM gh_new_procedure(const char *proc_name, SCM (*fn)(),
|
||||||
int n_required_args, int n_optional_args, int varp);
|
int n_required_args, int n_optional_args, int varp);
|
||||||
SCM gh_new_procedure0_0(char *proc_name, SCM (*fn)(void));
|
SCM gh_new_procedure0_0(const char *proc_name, SCM (*fn)(void));
|
||||||
SCM gh_new_procedure0_1(char *proc_name, SCM (*fn)(SCM));
|
SCM gh_new_procedure0_1(const char *proc_name, SCM (*fn)(SCM));
|
||||||
SCM gh_new_procedure0_2(char *proc_name, SCM (*fn)(SCM, SCM));
|
SCM gh_new_procedure0_2(const char *proc_name, SCM (*fn)(SCM, SCM));
|
||||||
SCM gh_new_procedure1_0(char *proc_name, SCM (*fn)(SCM));
|
SCM gh_new_procedure1_0(const char *proc_name, SCM (*fn)(SCM));
|
||||||
SCM gh_new_procedure1_1(char *proc_name, SCM (*fn)(SCM, SCM));
|
SCM gh_new_procedure1_1(const char *proc_name, SCM (*fn)(SCM, SCM));
|
||||||
SCM gh_new_procedure1_2(char *proc_name, SCM (*fn)(SCM, SCM, SCM));
|
SCM gh_new_procedure1_2(const char *proc_name, SCM (*fn)(SCM, SCM, SCM));
|
||||||
SCM gh_new_procedure2_0(char *proc_name, SCM (*fn)(SCM, SCM));
|
SCM gh_new_procedure2_0(const char *proc_name, SCM (*fn)(SCM, SCM));
|
||||||
SCM gh_new_procedure2_1(char *proc_name, SCM (*fn)(SCM, SCM, SCM));
|
SCM gh_new_procedure2_1(const char *proc_name, SCM (*fn)(SCM, SCM, SCM));
|
||||||
SCM gh_new_procedure2_2(char *proc_name, SCM (*fn)(SCM, SCM, SCM, SCM));
|
SCM gh_new_procedure2_2(const char *proc_name, SCM (*fn)(SCM, SCM, SCM, SCM));
|
||||||
SCM gh_new_procedure3_0(char *proc_name, SCM (*fn)(SCM, SCM, SCM));
|
SCM gh_new_procedure3_0(const char *proc_name, SCM (*fn)(SCM, SCM, SCM));
|
||||||
SCM gh_new_procedure4_0(char *proc_name, SCM (*fn)(SCM, SCM, SCM, SCM));
|
SCM gh_new_procedure4_0(const char *proc_name, SCM (*fn)(SCM, SCM, SCM, SCM));
|
||||||
SCM gh_new_procedure5_0(char *proc_name, SCM (*fn)(SCM, SCM, SCM, SCM, SCM));
|
SCM gh_new_procedure5_0(const char *proc_name, SCM (*fn)(SCM, SCM, SCM, SCM, SCM));
|
||||||
|
|
||||||
/* C to Scheme conversion */
|
/* C to Scheme conversion */
|
||||||
SCM gh_int2scmb(int x); /* this is being phased out */
|
|
||||||
SCM gh_bool2scm(int x);
|
SCM gh_bool2scm(int x);
|
||||||
SCM gh_int2scm(int x);
|
SCM gh_int2scm(int x);
|
||||||
SCM gh_ulong2scm(unsigned long x);
|
SCM gh_ulong2scm(unsigned long x);
|
||||||
|
@ -110,15 +109,15 @@ SCM gh_symbol2scm(const char *symbol_str);
|
||||||
SCM gh_ints2scm(int *d, int n);
|
SCM gh_ints2scm(int *d, int n);
|
||||||
|
|
||||||
#ifdef HAVE_ARRAYS
|
#ifdef HAVE_ARRAYS
|
||||||
SCM gh_chars2byvect(char *d, int n);
|
SCM gh_chars2byvect(const char *d, int n);
|
||||||
SCM gh_shorts2svect(short *d, int n);
|
SCM gh_shorts2svect(const short *d, int n);
|
||||||
SCM gh_longs2ivect(long *d, int n);
|
SCM gh_longs2ivect(const long *d, int n);
|
||||||
SCM gh_ulongs2uvect(unsigned long *d, int n);
|
SCM gh_ulongs2uvect(const unsigned long *d, int n);
|
||||||
SCM gh_floats2fvect(float *d, int n);
|
SCM gh_floats2fvect(const float *d, int n);
|
||||||
SCM gh_doubles2dvect(double *d, int n);
|
SCM gh_doubles2dvect(const double *d, int n);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SCM gh_doubles2scm(double *d, int n);
|
SCM gh_doubles2scm(const double *d, int n);
|
||||||
|
|
||||||
/* Scheme to C conversion */
|
/* Scheme to C conversion */
|
||||||
int gh_scm2bool(SCM obj);
|
int gh_scm2bool(SCM obj);
|
||||||
|
@ -160,7 +159,7 @@ int gh_null_p(SCM l);
|
||||||
|
|
||||||
#define gh_not(x) scm_not(x)
|
#define gh_not(x) scm_not(x)
|
||||||
|
|
||||||
SCM gh_define(char *name, SCM val);
|
SCM gh_define(const char *name, SCM val);
|
||||||
|
|
||||||
/* vector manipulation routines */
|
/* vector manipulation routines */
|
||||||
/* note that gh_vector() does not behave quite like the Scheme (vector
|
/* note that gh_vector() does not behave quite like the Scheme (vector
|
||||||
|
@ -177,8 +176,8 @@ SCM gh_uniform_vector_ref (SCM v, SCM ilist);
|
||||||
#define gh_list_to_vector(ls) scm_vector(ls)
|
#define gh_list_to_vector(ls) scm_vector(ls)
|
||||||
#define gh_vector_to_list(v) scm_vector_to_list(v)
|
#define gh_vector_to_list(v) scm_vector_to_list(v)
|
||||||
|
|
||||||
SCM gh_lookup (char *sname);
|
SCM gh_lookup (const char *sname);
|
||||||
SCM gh_module_lookup (SCM vector, char *sname);
|
SCM gh_module_lookup (SCM vector, const char *sname);
|
||||||
|
|
||||||
SCM gh_cons(SCM x, SCM y);
|
SCM gh_cons(SCM x, SCM y);
|
||||||
#define gh_list scm_listify
|
#define gh_list scm_listify
|
||||||
|
@ -241,6 +240,14 @@ void gh_newline (void);
|
||||||
|
|
||||||
/* void gh_assert(int cond, char *msg, SCM obj); */
|
/* void gh_assert(int cond, char *msg, SCM obj); */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if (SCM_DEBUG_DEPRECATED == 0)
|
||||||
|
|
||||||
|
SCM gh_int2scmb(int x); /* this is being phased out */
|
||||||
|
|
||||||
|
#endif /* SCM_DEBUG_DEPRECATED == 0 */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,11 +49,17 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* data conversion C->scheme */
|
/* data conversion C->scheme */
|
||||||
|
|
||||||
|
#if (SCM_DEBUG_DEPRECATED == 0)
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_int2scmb (int x) /* this is being phased out */
|
gh_int2scmb (int x) /* this is being phased out */
|
||||||
{
|
{
|
||||||
return SCM_BOOL(x);
|
return SCM_BOOL(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* SCM_DEBUG_DEPRECATED == 0 */
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_bool2scm (int x)
|
gh_bool2scm (int x)
|
||||||
{
|
{
|
||||||
|
@ -144,7 +150,7 @@ gh_ints2scm (int *d, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_doubles2scm (double *d, int n)
|
gh_doubles2scm (const double *d, int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SCM v = scm_make_vector(SCM_MAKINUM(n), SCM_UNSPECIFIED);
|
SCM v = scm_make_vector(SCM_MAKINUM(n), SCM_UNSPECIFIED);
|
||||||
|
@ -172,7 +178,7 @@ makvect (char* m, int len, int type)
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_chars2byvect (char *d, int n)
|
gh_chars2byvect (const char *d, int n)
|
||||||
{
|
{
|
||||||
char *m = scm_must_malloc (n * sizeof (char), "vector");
|
char *m = scm_must_malloc (n * sizeof (char), "vector");
|
||||||
memcpy (m, d, n * sizeof (char));
|
memcpy (m, d, n * sizeof (char));
|
||||||
|
@ -180,7 +186,7 @@ gh_chars2byvect (char *d, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_shorts2svect (short *d, int n)
|
gh_shorts2svect (const short *d, int n)
|
||||||
{
|
{
|
||||||
char *m = scm_must_malloc (n * sizeof (short), "vector");
|
char *m = scm_must_malloc (n * sizeof (short), "vector");
|
||||||
memcpy (m, d, n * sizeof (short));
|
memcpy (m, d, n * sizeof (short));
|
||||||
|
@ -188,7 +194,7 @@ gh_shorts2svect (short *d, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_longs2ivect (long *d, int n)
|
gh_longs2ivect (const long *d, int n)
|
||||||
{
|
{
|
||||||
char *m = scm_must_malloc (n * sizeof (long), "vector");
|
char *m = scm_must_malloc (n * sizeof (long), "vector");
|
||||||
memcpy (m, d, n * sizeof (long));
|
memcpy (m, d, n * sizeof (long));
|
||||||
|
@ -196,7 +202,7 @@ gh_longs2ivect (long *d, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_ulongs2uvect (unsigned long *d, int n)
|
gh_ulongs2uvect (const unsigned long *d, int n)
|
||||||
{
|
{
|
||||||
char *m = scm_must_malloc (n * sizeof (unsigned long), "vector");
|
char *m = scm_must_malloc (n * sizeof (unsigned long), "vector");
|
||||||
memcpy (m, d, n * sizeof (unsigned long));
|
memcpy (m, d, n * sizeof (unsigned long));
|
||||||
|
@ -204,7 +210,7 @@ gh_ulongs2uvect (unsigned long *d, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_floats2fvect (float *d, int n)
|
gh_floats2fvect (const float *d, int n)
|
||||||
{
|
{
|
||||||
char *m = scm_must_malloc (n * sizeof (float), "vector");
|
char *m = scm_must_malloc (n * sizeof (float), "vector");
|
||||||
memcpy (m, d, n * sizeof (float));
|
memcpy (m, d, n * sizeof (float));
|
||||||
|
@ -212,7 +218,7 @@ gh_floats2fvect (float *d, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_doubles2dvect (double *d, int n)
|
gh_doubles2dvect (const double *d, int n)
|
||||||
{
|
{
|
||||||
char *m = scm_must_malloc (n * sizeof (double), "vector");
|
char *m = scm_must_malloc (n * sizeof (double), "vector");
|
||||||
memcpy (m, d, n * sizeof (double));
|
memcpy (m, d, n * sizeof (double));
|
||||||
|
@ -678,13 +684,13 @@ gh_uniform_vector_ref (SCM v, SCM ilist)
|
||||||
-twp] */
|
-twp] */
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_lookup (char *sname)
|
gh_lookup (const char *sname)
|
||||||
{
|
{
|
||||||
return gh_module_lookup (SCM_BOOL_F, sname);
|
return gh_module_lookup (SCM_BOOL_F, sname);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_module_lookup (SCM vec, char *sname)
|
gh_module_lookup (SCM vec, const char *sname)
|
||||||
{
|
{
|
||||||
SCM sym = gh_symbol2scm (sname);
|
SCM sym = gh_symbol2scm (sname);
|
||||||
if (SCM_TRUE_P (scm_symbol_bound_p (vec, sym)))
|
if (SCM_TRUE_P (scm_symbol_bound_p (vec, sym)))
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
/* allows you to define new scheme primitives written in C */
|
/* allows you to define new scheme primitives written in C */
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure (char *proc_name, SCM (*fn) (),
|
gh_new_procedure (const char *proc_name, SCM (*fn) (),
|
||||||
int n_required_args, int n_optional_args, int varp)
|
int n_required_args, int n_optional_args, int varp)
|
||||||
{
|
{
|
||||||
return scm_make_gsubr (proc_name, n_required_args, n_optional_args,
|
return scm_make_gsubr (proc_name, n_required_args, n_optional_args,
|
||||||
|
@ -57,80 +57,80 @@ gh_new_procedure (char *proc_name, SCM (*fn) (),
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure0_0 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure0_0 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 0, 0, 0);
|
return gh_new_procedure (proc_name, fn, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure0_1 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure0_1 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 0, 1, 0);
|
return gh_new_procedure (proc_name, fn, 0, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure0_2 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure0_2 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 0, 2, 0);
|
return gh_new_procedure (proc_name, fn, 0, 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure1_0 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure1_0 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 1, 0, 0);
|
return gh_new_procedure (proc_name, fn, 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure1_1 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure1_1 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 1, 1, 0);
|
return gh_new_procedure (proc_name, fn, 1, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure1_2 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure1_2 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 1, 2, 0);
|
return gh_new_procedure (proc_name, fn, 1, 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure2_0 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure2_0 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 2, 0, 0);
|
return gh_new_procedure (proc_name, fn, 2, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure2_1 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure2_1 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 2, 1, 0);
|
return gh_new_procedure (proc_name, fn, 2, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure2_2 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure2_2 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 2, 2, 0);
|
return gh_new_procedure (proc_name, fn, 2, 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure3_0 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure3_0 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 3, 0, 0);
|
return gh_new_procedure (proc_name, fn, 3, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure4_0 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure4_0 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 4, 0, 0);
|
return gh_new_procedure (proc_name, fn, 4, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
gh_new_procedure5_0 (char *proc_name, SCM (*fn) ())
|
gh_new_procedure5_0 (const char *proc_name, SCM (*fn) ())
|
||||||
{
|
{
|
||||||
return gh_new_procedure (proc_name, fn, 5, 0, 0);
|
return gh_new_procedure (proc_name, fn, 5, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* some (possibly most) Scheme functions available from C */
|
/* some (possibly most) Scheme functions available from C */
|
||||||
SCM
|
SCM
|
||||||
gh_define (char *name, SCM val)
|
gh_define (const char *name, SCM val)
|
||||||
{
|
{
|
||||||
return scm_sysintern (name, val);
|
return scm_sysintern (name, val);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue