-/* Copyright (C) 1995,1996,1997,1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998, 1999, 2000 Free Software Foundation, Inc.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
#include <stdio.h>
#include <gh.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
/* data conversion C->scheme */
SCM
gh_int2scmb (int x) /* this is being phased out */
{
- return (x ? SCM_BOOL_T : SCM_BOOL_F);
+ return SCM_BOOL(x);
}
SCM
gh_bool2scm (int x)
{
- return (x ? SCM_BOOL_T : SCM_BOOL_F);
+ return SCM_BOOL(x);
}
SCM
gh_int2scm (int x)
SCM
gh_char2scm (char c)
{
- return SCM_MAKICHR (c);
+ return SCM_MAKE_CHAR (c);
}
SCM
-gh_str2scm (char *s, int len)
+gh_str2scm (const char *s, int len)
{
return scm_makfromstr (s, len, 0);
}
SCM
-gh_str02scm (char *s)
+gh_str02scm (const char *s)
{
return scm_makfrom0str (s);
}
unsigned long dst_len;
unsigned long effective_length;
- SCM_ASSERT (SCM_NIMP (dst) && SCM_STRINGP (dst), dst, SCM_ARG3,
+ SCM_ASSERT (SCM_STRINGP (dst), dst, SCM_ARG3,
"gh_set_substr");
dst_ptr = SCM_CHARS (dst);
return makvect (m, n, scm_tc7_uvect);
}
-#ifdef SCM_FLOATS
-#ifdef SCM_SINGLES
SCM
gh_floats2fvect (float *d, int n)
{
memcpy (m, d, n * sizeof (float));
return makvect (m, n, scm_tc7_fvect);
}
-#endif
SCM
gh_doubles2dvect (double *d, int n)
return makvect (m, n, scm_tc7_dvect);
}
#endif
-#endif
/* data conversion scheme->C */
int
char
gh_scm2char (SCM obj)
{
- return SCM_ICHR (obj);
+ return SCM_CHAR (obj);
}
/* Convert a vector, weak vector, string, substring or uniform vector
for (i = 0; i < n; ++i)
{
val = SCM_VELTS (obj)[i];
- if (!SCM_INUMP (val) && !(SCM_NIMP (val) && SCM_BIGP (val)))
+ if (!SCM_INUMP (val) && !SCM_BIGP (val))
scm_wrong_type_arg (0, 0, obj);
}
if (m == 0)
{
val = SCM_VELTS (obj)[i];
if (!SCM_INUMP (val)
- && !(SCM_NIMP (val) && (SCM_BIGP (val) || SCM_REALP (val))))
+ && !(SCM_BIGP (val) || SCM_REALP (val)))
scm_wrong_type_arg (0, 0, val);
}
if (m == 0)
}
break;
#ifdef HAVE_ARRAYS
-#ifdef SCM_FLOATS
-#ifdef SCM_SINGLES
case scm_tc7_fvect:
n = SCM_LENGTH (obj);
if (m == 0)
m = (float *) malloc (n * sizeof (float));
memcpy (m, (float *) SCM_VELTS (obj), n * sizeof (float));
break;
-#endif
+
case scm_tc7_dvect:
n = SCM_LENGTH (obj);
if (m == 0)
for (i = 0; i < n; ++i)
m[i] = ((double *) SCM_VELTS (obj))[i];
break;
-#endif
#endif
default:
scm_wrong_type_arg (0, 0, obj);
{
val = SCM_VELTS (obj)[i];
if (!SCM_INUMP (val)
- && !(SCM_NIMP (val) && (SCM_BIGP (val) || SCM_REALP (val))))
+ && !(SCM_BIGP (val) || SCM_REALP (val)))
scm_wrong_type_arg (0, 0, val);
}
if (m == 0)
}
break;
#ifdef HAVE_ARRAYS
-#ifdef SCM_FLOATS
-#ifdef SCM_SINGLES
case scm_tc7_fvect:
n = SCM_LENGTH (obj);
if (m == 0)
for (i = 0; i < n; ++i)
m[i] = ((float *) SCM_VELTS (obj))[i];
break;
-#endif
+
case scm_tc7_dvect:
n = SCM_LENGTH (obj);
if (m == 0)
m = (double*) malloc (n * sizeof (double));
memcpy (m, SCM_VELTS (obj), n * sizeof (double));
break;
-#endif
#endif
default:
scm_wrong_type_arg (0, 0, obj);
char *ret_str;
int len;
- SCM_ASSERT (SCM_NIMP (str) && SCM_ROSTRINGP (str), str, SCM_ARG3,
+ SCM_ASSERT (SCM_ROSTRINGP (str), str, SCM_ARG3,
"gh_scm2newstr");
/* protect str from GC while we copy off its data */
gh_get_substr (SCM src, char *dst, int start, int len)
{
int src_len, effective_length;
- SCM_ASSERT (SCM_NIMP (src) && SCM_ROSTRINGP (src), src, SCM_ARG3,
+ SCM_ASSERT (SCM_ROSTRINGP (src), src, SCM_ARG3,
"gh_get_substr");
scm_protect_object (src);
char *ret_str;
int len;
- SCM_ASSERT (SCM_NIMP (sym) && SCM_SYMBOLP (sym), sym, SCM_ARG3,
+ SCM_ASSERT (SCM_SYMBOLP (sym), sym, SCM_ARG3,
"gh_scm2newsymbol");
/* protect str from GC while we copy off its data */