mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-15 18:20:42 +02:00
Simple vectors are just vectors
* doc/ref/api-data.texi: Remove references to 'simple vectors'. * libguile/vectors.h (SCM_VECTOR_REF,SCM_VECTOR_SET, SCM_VECTOR_LENGHT): Renamed from SCM_SIMPLE_VECTOR_REF, SCM_SIMPLE_VECTOR_SET, SCM_SIMPLE_VECTOR_LENGTH. (scm_is_simple_vector): Remove. Elsewhere fix uses of SCM_SIMPLE_VECTOR_xxx or scm_is_simple_vector.
This commit is contained in:
parent
6c97c8108e
commit
40dbe69be5
27 changed files with 305 additions and 291 deletions
|
@ -1,10 +1,12 @@
|
|||
(vector-array-handle-plan for Guile 3.0) -*- coding: utf-8; mode: org; -*-
|
||||
|
||||
TBA to NEWS for this branch.
|
||||
|
||||
|
||||
* Forward incompatible changes
|
||||
|
||||
Applying these changes will make your program work with this version of
|
||||
Guile and continue working with older versions.
|
||||
Guile and continue working with older versions, at least back to 2.2.
|
||||
|
||||
** vector->list and vector-copy require a true vector argument.
|
||||
|
||||
|
@ -15,6 +17,11 @@ Use array->list and array-copy (from (ice-9 arrays)) on general arrays.
|
|||
Use scm_array_get_handle and scm_array_handle_elements /
|
||||
scm_array_handle_writable_elements on general arrays.
|
||||
|
||||
** scm_is_simple_vector has been removed.
|
||||
|
||||
Use scm_is_vector instead.
|
||||
|
||||
|
||||
* Backward incompatible changes
|
||||
|
||||
Applying these changes will make your program work with this version of
|
||||
|
@ -26,3 +33,30 @@ This function used to take a second unused argument for the sake of
|
|||
compatibility with older versions of Guile. Just remove this argument from your
|
||||
calls.
|
||||
|
||||
** SCM_SIMPLE_VECTOR_REF, SCM_SIMPLE_VECTOR_SET and SCM_SIMPLE_VECTOR_LENGTH have been renamed.
|
||||
|
||||
Use SCM_VECTOR_REF, SCM_VECTOR_SET and SCM_VECTOR_LENGTH instead.
|
||||
|
||||
|
||||
* Rationale / TODO
|
||||
|
||||
** Fix API for scm_vector_elements scm_vector_writable_elements to [(SCM vec) -> pointer]
|
||||
|
||||
- incp is always one on these types, so it isn't needed
|
||||
- no need to acquire/release an array handle for VECTOR_TYPE
|
||||
- remove the dependence of vector.c bitvector.c bytevector.c etc. on array-handle.h
|
||||
|
||||
** Remove scm_is_simple_vector, fix scm_is_array_p, rename SIMPLE_VECTOR to VECTOR, etc.
|
||||
|
||||
- just cleaning house
|
||||
|
||||
** vector-move-right!, vector-move-left!, either
|
||||
|
||||
- work only on vector type, use array-copy! and make-shared-array (or future slicing facility) for general arrays
|
||||
- rename to array-move... and make type generic
|
||||
- remove entirely and just use array-copy!
|
||||
|
||||
** basic rank-1 ops on VECTOR_TYPEs need (len begin inc) instead of (begin end)
|
||||
|
||||
- look at CBLAS/BLIS
|
||||
- this is a problem because all the RnRS & SRFIs use (begin end) :-(
|
||||
|
|
|
@ -6420,38 +6420,25 @@ same vector, @code{vector-move-right!} is usually appropriate when
|
|||
A vector can be read and modified from C with the functions
|
||||
@code{scm_c_vector_ref} and @code{scm_c_vector_set_x}, for example. In
|
||||
addition to these functions, there are two more ways to access vectors
|
||||
from C that might be more efficient in certain situations: you can
|
||||
restrict yourself to @dfn{simple vectors} and then use the very fast
|
||||
@emph{simple vector macros}; or you can use the very general framework
|
||||
for accessing all kinds of arrays (@pxref{Accessing Arrays from C}),
|
||||
which is more verbose, but can deal efficiently with all kinds of
|
||||
vectors (and arrays). For vectors, you can use the
|
||||
@code{scm_vector_elements} and @code{scm_vector_writable_elements}
|
||||
functions as shortcuts.
|
||||
from C that might be more efficient in certain situations: you can use
|
||||
the very fast @emph{vector macros}, which assume that the arguments are
|
||||
actual vectors (in the sense of @code{vector?}) and do no type checking;
|
||||
or you can use the very general framework for accessing all kinds of
|
||||
arrays (@pxref{Accessing Arrays from C}).
|
||||
|
||||
@deftypefn {C Function} int scm_is_simple_vector (SCM obj)
|
||||
Return non-zero if @var{obj} is a simple vector, else return zero. A
|
||||
simple vector is a vector that can be used with the @code{SCM_SIMPLE_*}
|
||||
macros below.
|
||||
|
||||
The following functions are guaranteed to return simple vectors:
|
||||
@code{scm_make_vector}, @code{scm_c_make_vector}, @code{scm_vector},
|
||||
@code{scm_list_to_vector}.
|
||||
@deftypefn {C Macro} size_t SCM_VECTOR_LENGTH (SCM vec)
|
||||
Evaluates to the length of the vector @var{vec}. No type checking is
|
||||
done.
|
||||
@end deftypefn
|
||||
|
||||
@deftypefn {C Macro} size_t SCM_SIMPLE_VECTOR_LENGTH (SCM vec)
|
||||
Evaluates to the length of the simple vector @var{vec}. No type
|
||||
checking is done.
|
||||
@deftypefn {C Macro} SCM SCM_VECTOR_REF (SCM vec, size_t idx)
|
||||
Evaluates to the element at position @var{idx} in the vector @var{vec}.
|
||||
No type or range checking is done.
|
||||
@end deftypefn
|
||||
|
||||
@deftypefn {C Macro} SCM SCM_SIMPLE_VECTOR_REF (SCM vec, size_t idx)
|
||||
Evaluates to the element at position @var{idx} in the simple vector
|
||||
@var{vec}. No type or range checking is done.
|
||||
@end deftypefn
|
||||
|
||||
@deftypefn {C Macro} void SCM_SIMPLE_VECTOR_SET (SCM vec, size_t idx, SCM val)
|
||||
Sets the element at position @var{idx} in the simple vector
|
||||
@var{vec} to @var{val}. No type or range checking is done.
|
||||
@deftypefn {C Macro} void SCM_VECTOR_SET (SCM vec, size_t idx, SCM val)
|
||||
Sets the element at position @var{idx} in the vector @var{vec} to
|
||||
@var{val}. No type or range checking is done.
|
||||
@end deftypefn
|
||||
|
||||
@deftypefn {C Function} {const SCM *} scm_vector_elements (SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
|
||||
|
|
|
@ -654,12 +654,12 @@ SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
|
|||
return ra;
|
||||
default:
|
||||
vargs = scm_vector (args);
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (vargs) != SCM_I_ARRAY_NDIM (ra))
|
||||
if (SCM_VECTOR_LENGTH (vargs) != SCM_I_ARRAY_NDIM (ra))
|
||||
SCM_WRONG_NUM_ARGS ();
|
||||
ndim = 0;
|
||||
for (k = 0; k < SCM_I_ARRAY_NDIM (ra); k++)
|
||||
{
|
||||
i = scm_to_signed_integer (SCM_SIMPLE_VECTOR_REF (vargs, k),
|
||||
i = scm_to_signed_integer (SCM_VECTOR_REF (vargs, k),
|
||||
0, SCM_I_ARRAY_NDIM(ra));
|
||||
if (ndim < i)
|
||||
ndim = i;
|
||||
|
@ -675,7 +675,7 @@ SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
|
|||
}
|
||||
for (k = SCM_I_ARRAY_NDIM (ra); k--;)
|
||||
{
|
||||
i = scm_to_int (SCM_SIMPLE_VECTOR_REF (vargs, k));
|
||||
i = scm_to_int (SCM_VECTOR_REF (vargs, k));
|
||||
s = &(SCM_I_ARRAY_DIMS (ra)[k]);
|
||||
r = &(SCM_I_ARRAY_DIMS (res)[i]);
|
||||
if (r->ubnd < r->lbnd)
|
||||
|
|
|
@ -157,9 +157,9 @@ static void prepare_boot_closure_env_for_eval (SCM proc, unsigned int argc,
|
|||
#define CADDR(x) SCM_CADDR(x)
|
||||
#define CDDDR(x) SCM_CDDDR(x)
|
||||
|
||||
#define VECTOR_REF(v, i) (SCM_SIMPLE_VECTOR_REF (v, i))
|
||||
#define VECTOR_SET(v, i, x) (SCM_SIMPLE_VECTOR_SET (v, i, x))
|
||||
#define VECTOR_LENGTH(v) (SCM_SIMPLE_VECTOR_LENGTH (v))
|
||||
#define VECTOR_REF(v, i) (SCM_VECTOR_REF (v, i))
|
||||
#define VECTOR_SET(v, i, x) (SCM_VECTOR_SET (v, i, x))
|
||||
#define VECTOR_LENGTH(v) (SCM_VECTOR_LENGTH (v))
|
||||
|
||||
static SCM
|
||||
make_env (int n, SCM init, SCM next)
|
||||
|
|
|
@ -346,57 +346,57 @@ scm_stat2scm (struct stat_or_stat64 *stat_temp)
|
|||
{
|
||||
SCM ans = scm_c_make_vector (18, SCM_UNSPECIFIED);
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 0, scm_from_ulong (stat_temp->st_dev));
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 1, scm_from_ino_t_or_ino64_t (stat_temp->st_ino));
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 2, scm_from_ulong (stat_temp->st_mode));
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 3, scm_from_ulong (stat_temp->st_nlink));
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 4, scm_from_ulong (stat_temp->st_uid));
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 5, scm_from_ulong (stat_temp->st_gid));
|
||||
SCM_VECTOR_SET(ans, 0, scm_from_ulong (stat_temp->st_dev));
|
||||
SCM_VECTOR_SET(ans, 1, scm_from_ino_t_or_ino64_t (stat_temp->st_ino));
|
||||
SCM_VECTOR_SET(ans, 2, scm_from_ulong (stat_temp->st_mode));
|
||||
SCM_VECTOR_SET(ans, 3, scm_from_ulong (stat_temp->st_nlink));
|
||||
SCM_VECTOR_SET(ans, 4, scm_from_ulong (stat_temp->st_uid));
|
||||
SCM_VECTOR_SET(ans, 5, scm_from_ulong (stat_temp->st_gid));
|
||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 6, scm_from_ulong (stat_temp->st_rdev));
|
||||
SCM_VECTOR_SET(ans, 6, scm_from_ulong (stat_temp->st_rdev));
|
||||
#else
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 6, SCM_BOOL_F);
|
||||
SCM_VECTOR_SET(ans, 6, SCM_BOOL_F);
|
||||
#endif
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 7, scm_from_off_t_or_off64_t (stat_temp->st_size));
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 8, scm_from_ulong (stat_temp->st_atime));
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 9, scm_from_ulong (stat_temp->st_mtime));
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 10, scm_from_ulong (stat_temp->st_ctime));
|
||||
SCM_VECTOR_SET(ans, 7, scm_from_off_t_or_off64_t (stat_temp->st_size));
|
||||
SCM_VECTOR_SET(ans, 8, scm_from_ulong (stat_temp->st_atime));
|
||||
SCM_VECTOR_SET(ans, 9, scm_from_ulong (stat_temp->st_mtime));
|
||||
SCM_VECTOR_SET(ans, 10, scm_from_ulong (stat_temp->st_ctime));
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 11, scm_from_ulong (stat_temp->st_blksize));
|
||||
SCM_VECTOR_SET(ans, 11, scm_from_ulong (stat_temp->st_blksize));
|
||||
#else
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 11, scm_from_ulong (4096L));
|
||||
SCM_VECTOR_SET(ans, 11, scm_from_ulong (4096L));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 12, scm_from_blkcnt_t_or_blkcnt64_t (stat_temp->st_blocks));
|
||||
SCM_VECTOR_SET(ans, 12, scm_from_blkcnt_t_or_blkcnt64_t (stat_temp->st_blocks));
|
||||
#else
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 12, SCM_BOOL_F);
|
||||
SCM_VECTOR_SET(ans, 12, SCM_BOOL_F);
|
||||
#endif
|
||||
{
|
||||
int mode = stat_temp->st_mode;
|
||||
|
||||
if (S_ISREG (mode))
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 13, scm_sym_regular);
|
||||
SCM_VECTOR_SET(ans, 13, scm_sym_regular);
|
||||
else if (S_ISDIR (mode))
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 13, scm_sym_directory);
|
||||
SCM_VECTOR_SET(ans, 13, scm_sym_directory);
|
||||
#ifdef S_ISLNK
|
||||
/* systems without symlinks probably don't have S_ISLNK */
|
||||
else if (S_ISLNK (mode))
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 13, scm_sym_symlink);
|
||||
SCM_VECTOR_SET(ans, 13, scm_sym_symlink);
|
||||
#endif
|
||||
else if (S_ISBLK (mode))
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 13, scm_sym_block_special);
|
||||
SCM_VECTOR_SET(ans, 13, scm_sym_block_special);
|
||||
else if (S_ISCHR (mode))
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 13, scm_sym_char_special);
|
||||
SCM_VECTOR_SET(ans, 13, scm_sym_char_special);
|
||||
else if (S_ISFIFO (mode))
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 13, scm_sym_fifo);
|
||||
SCM_VECTOR_SET(ans, 13, scm_sym_fifo);
|
||||
#ifdef S_ISSOCK
|
||||
else if (S_ISSOCK (mode))
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 13, scm_sym_sock);
|
||||
SCM_VECTOR_SET(ans, 13, scm_sym_sock);
|
||||
#endif
|
||||
else
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 13, scm_sym_unknown);
|
||||
SCM_VECTOR_SET(ans, 13, scm_sym_unknown);
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 14, scm_from_int ((~S_IFMT) & mode));
|
||||
SCM_VECTOR_SET(ans, 14, scm_from_int ((~S_IFMT) & mode));
|
||||
|
||||
/* the layout of the bits in ve[14] is intended to be portable.
|
||||
If there are systems that don't follow the usual convention,
|
||||
|
@ -425,24 +425,24 @@ scm_stat2scm (struct stat_or_stat64 *stat_temp)
|
|||
tmp <<= 1;
|
||||
if (S_IXOTH & mode) tmp += 1;
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 14, scm_from_int (tmp));
|
||||
SCM_VECTOR_SET(ans, 14, scm_from_int (tmp));
|
||||
|
||||
*/
|
||||
}
|
||||
#ifdef HAVE_STRUCT_STAT_ST_ATIM
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 15, scm_from_long (stat_temp->st_atim.tv_nsec));
|
||||
SCM_VECTOR_SET(ans, 15, scm_from_long (stat_temp->st_atim.tv_nsec));
|
||||
#else
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 15, SCM_I_MAKINUM (0));
|
||||
SCM_VECTOR_SET(ans, 15, SCM_I_MAKINUM (0));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_MTIM
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 16, scm_from_long (stat_temp->st_mtim.tv_nsec));
|
||||
SCM_VECTOR_SET(ans, 16, scm_from_long (stat_temp->st_mtim.tv_nsec));
|
||||
#else
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 16, SCM_I_MAKINUM (0));
|
||||
SCM_VECTOR_SET(ans, 16, SCM_I_MAKINUM (0));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_CTIM
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 17, scm_from_ulong (stat_temp->st_ctim.tv_sec));
|
||||
SCM_VECTOR_SET(ans, 17, scm_from_ulong (stat_temp->st_ctim.tv_sec));
|
||||
#else
|
||||
SCM_SIMPLE_VECTOR_SET(ans, 17, SCM_I_MAKINUM (0));
|
||||
SCM_VECTOR_SET(ans, 17, SCM_I_MAKINUM (0));
|
||||
#endif
|
||||
|
||||
return ans;
|
||||
|
@ -690,12 +690,12 @@ fill_select_type (fd_set *set, SCM *ports_ready, SCM list_or_vec, int pos)
|
|||
|
||||
if (scm_is_vector (list_or_vec))
|
||||
{
|
||||
int i = SCM_SIMPLE_VECTOR_LENGTH (list_or_vec);
|
||||
int i = SCM_VECTOR_LENGTH (list_or_vec);
|
||||
|
||||
while (--i >= 0)
|
||||
{
|
||||
int fd = set_element (set, ports_ready,
|
||||
SCM_SIMPLE_VECTOR_REF (list_or_vec, i), pos);
|
||||
SCM_VECTOR_REF (list_or_vec, i), pos);
|
||||
|
||||
if (fd > max_fd)
|
||||
max_fd = fd;
|
||||
|
@ -751,12 +751,12 @@ retrieve_select_type (fd_set *set, SCM ports_ready, SCM list_or_vec)
|
|||
|
||||
if (scm_is_vector (list_or_vec))
|
||||
{
|
||||
int i = SCM_SIMPLE_VECTOR_LENGTH (list_or_vec);
|
||||
int i = SCM_VECTOR_LENGTH (list_or_vec);
|
||||
|
||||
while (--i >= 0)
|
||||
{
|
||||
answer_list = get_element (set,
|
||||
SCM_SIMPLE_VECTOR_REF (list_or_vec, i),
|
||||
SCM_VECTOR_REF (list_or_vec, i),
|
||||
answer_list);
|
||||
}
|
||||
return scm_vector (answer_list);
|
||||
|
@ -824,7 +824,7 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
|
|||
|
||||
if (scm_is_vector (reads))
|
||||
{
|
||||
read_count = SCM_SIMPLE_VECTOR_LENGTH (reads);
|
||||
read_count = SCM_VECTOR_LENGTH (reads);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -833,7 +833,7 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
|
|||
}
|
||||
if (scm_is_vector (writes))
|
||||
{
|
||||
write_count = SCM_SIMPLE_VECTOR_LENGTH (writes);
|
||||
write_count = SCM_VECTOR_LENGTH (writes);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -842,7 +842,7 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
|
|||
}
|
||||
if (scm_is_vector (excepts))
|
||||
{
|
||||
except_count = SCM_SIMPLE_VECTOR_LENGTH (excepts);
|
||||
except_count = SCM_VECTOR_LENGTH (excepts);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -315,7 +315,7 @@ scm_raw_ihash (SCM obj, size_t depth)
|
|||
case scm_tc7_wvect:
|
||||
case scm_tc7_vector:
|
||||
{
|
||||
size_t len = SCM_SIMPLE_VECTOR_LENGTH (obj);
|
||||
size_t len = SCM_VECTOR_LENGTH (obj);
|
||||
size_t i = depth / 2;
|
||||
unsigned long h = scm_raw_ihashq (SCM_CELL_WORD_0 (obj));
|
||||
if (len)
|
||||
|
|
|
@ -143,13 +143,13 @@ scm_i_rehash (SCM table,
|
|||
SCM_SET_HASHTABLE_VECTOR (table, new_buckets);
|
||||
SCM_SET_HASHTABLE_N_ITEMS (table, 0);
|
||||
|
||||
old_size = SCM_SIMPLE_VECTOR_LENGTH (buckets);
|
||||
old_size = SCM_VECTOR_LENGTH (buckets);
|
||||
for (i = 0; i < old_size; ++i)
|
||||
{
|
||||
SCM ls, cell, handle;
|
||||
|
||||
ls = SCM_SIMPLE_VECTOR_REF (buckets, i);
|
||||
SCM_SIMPLE_VECTOR_SET (buckets, i, SCM_EOL);
|
||||
ls = SCM_VECTOR_REF (buckets, i);
|
||||
SCM_VECTOR_SET (buckets, i, SCM_EOL);
|
||||
|
||||
while (scm_is_pair (ls))
|
||||
{
|
||||
|
@ -162,8 +162,8 @@ scm_i_rehash (SCM table,
|
|||
h = hash_fn (SCM_CAR (handle), new_size, closure);
|
||||
if (h >= new_size)
|
||||
scm_out_of_range (func_name, scm_from_ulong (h));
|
||||
SCM_SETCDR (cell, SCM_SIMPLE_VECTOR_REF (new_buckets, h));
|
||||
SCM_SIMPLE_VECTOR_SET (new_buckets, h, cell);
|
||||
SCM_SETCDR (cell, SCM_VECTOR_REF (new_buckets, h));
|
||||
SCM_VECTOR_SET (new_buckets, h, cell);
|
||||
SCM_HASHTABLE_INCREMENT (table);
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ scm_i_hashtable_print (SCM exp, SCM port, scm_print_state *pstate)
|
|||
scm_putc (' ', port);
|
||||
scm_uintprint (SCM_HASHTABLE_N_ITEMS (exp), 10, port);
|
||||
scm_putc ('/', port);
|
||||
scm_uintprint (SCM_SIMPLE_VECTOR_LENGTH (SCM_HASHTABLE_VECTOR (exp)),
|
||||
scm_uintprint (SCM_VECTOR_LENGTH (SCM_HASHTABLE_VECTOR (exp)),
|
||||
10, port);
|
||||
scm_puts (">", port);
|
||||
}
|
||||
|
@ -226,13 +226,13 @@ scm_hash_fn_get_handle (SCM table, SCM obj,
|
|||
SCM_VALIDATE_HASHTABLE (SCM_ARG1, table);
|
||||
buckets = SCM_HASHTABLE_VECTOR (table);
|
||||
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (buckets) == 0)
|
||||
if (SCM_VECTOR_LENGTH (buckets) == 0)
|
||||
return SCM_BOOL_F;
|
||||
k = hash_fn (obj, SCM_SIMPLE_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_SIMPLE_VECTOR_LENGTH (buckets))
|
||||
k = hash_fn (obj, SCM_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_VECTOR_LENGTH (buckets))
|
||||
scm_out_of_range (FUNC_NAME, scm_from_ulong (k));
|
||||
|
||||
h = assoc_fn (obj, SCM_SIMPLE_VECTOR_REF (buckets, k), closure);
|
||||
h = assoc_fn (obj, SCM_VECTOR_REF (buckets, k), closure);
|
||||
|
||||
return h;
|
||||
}
|
||||
|
@ -251,14 +251,14 @@ scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init,
|
|||
SCM_VALIDATE_HASHTABLE (SCM_ARG1, table);
|
||||
buckets = SCM_HASHTABLE_VECTOR (table);
|
||||
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (buckets) == 0)
|
||||
if (SCM_VECTOR_LENGTH (buckets) == 0)
|
||||
SCM_MISC_ERROR ("void hashtable", SCM_EOL);
|
||||
|
||||
k = hash_fn (obj, SCM_SIMPLE_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_SIMPLE_VECTOR_LENGTH (buckets))
|
||||
k = hash_fn (obj, SCM_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_VECTOR_LENGTH (buckets))
|
||||
scm_out_of_range ("hash_fn_create_handle_x", scm_from_ulong (k));
|
||||
|
||||
it = assoc_fn (obj, SCM_SIMPLE_VECTOR_REF (buckets, k), closure);
|
||||
it = assoc_fn (obj, SCM_VECTOR_REF (buckets, k), closure);
|
||||
|
||||
if (scm_is_pair (it))
|
||||
return it;
|
||||
|
@ -274,12 +274,12 @@ scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init,
|
|||
if (!scm_is_eq (SCM_HASHTABLE_VECTOR (table), buckets))
|
||||
{
|
||||
buckets = SCM_HASHTABLE_VECTOR (table);
|
||||
k = hash_fn (obj, SCM_SIMPLE_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_SIMPLE_VECTOR_LENGTH (buckets))
|
||||
k = hash_fn (obj, SCM_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_VECTOR_LENGTH (buckets))
|
||||
scm_out_of_range ("hash_fn_create_handle_x", scm_from_ulong (k));
|
||||
}
|
||||
SCM_SETCDR (new_bucket, SCM_SIMPLE_VECTOR_REF (buckets, k));
|
||||
SCM_SIMPLE_VECTOR_SET (buckets, k, new_bucket);
|
||||
SCM_SETCDR (new_bucket, SCM_VECTOR_REF (buckets, k));
|
||||
SCM_VECTOR_SET (buckets, k, new_bucket);
|
||||
SCM_HASHTABLE_INCREMENT (table);
|
||||
|
||||
/* Maybe rehash the table. */
|
||||
|
@ -335,19 +335,19 @@ scm_hash_fn_remove_x (SCM table, SCM obj,
|
|||
|
||||
buckets = SCM_HASHTABLE_VECTOR (table);
|
||||
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (buckets) == 0)
|
||||
if (SCM_VECTOR_LENGTH (buckets) == 0)
|
||||
return SCM_EOL;
|
||||
|
||||
k = hash_fn (obj, SCM_SIMPLE_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_SIMPLE_VECTOR_LENGTH (buckets))
|
||||
k = hash_fn (obj, SCM_VECTOR_LENGTH (buckets), closure);
|
||||
if (k >= SCM_VECTOR_LENGTH (buckets))
|
||||
scm_out_of_range (FUNC_NAME, scm_from_ulong (k));
|
||||
|
||||
h = assoc_fn (obj, SCM_SIMPLE_VECTOR_REF (buckets, k), closure);
|
||||
h = assoc_fn (obj, SCM_VECTOR_REF (buckets, k), closure);
|
||||
|
||||
if (scm_is_true (h))
|
||||
{
|
||||
SCM_SIMPLE_VECTOR_SET
|
||||
(buckets, k, scm_delq_x (h, SCM_SIMPLE_VECTOR_REF (buckets, k)));
|
||||
SCM_VECTOR_SET
|
||||
(buckets, k, scm_delq_x (h, SCM_VECTOR_REF (buckets, k)));
|
||||
SCM_HASHTABLE_DECREMENT (table);
|
||||
if (SCM_HASHTABLE_N_ITEMS (table) < SCM_HASHTABLE_LOWER (table))
|
||||
scm_i_rehash (table, hash_fn, closure, FUNC_NAME);
|
||||
|
@ -1017,12 +1017,12 @@ scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
|
|||
SCM_VALIDATE_HASHTABLE (0, table);
|
||||
buckets = SCM_HASHTABLE_VECTOR (table);
|
||||
|
||||
n = SCM_SIMPLE_VECTOR_LENGTH (buckets);
|
||||
n = SCM_VECTOR_LENGTH (buckets);
|
||||
for (i = 0; i < n; ++i)
|
||||
{
|
||||
SCM ls, handle;
|
||||
|
||||
for (ls = SCM_SIMPLE_VECTOR_REF (buckets, i); !scm_is_null (ls);
|
||||
for (ls = SCM_VECTOR_REF (buckets, i); !scm_is_null (ls);
|
||||
ls = SCM_CDR (ls))
|
||||
{
|
||||
handle = SCM_CAR (ls);
|
||||
|
@ -1050,11 +1050,11 @@ scm_internal_hash_for_each_handle (scm_t_hash_handle_fn fn, void *closure,
|
|||
|
||||
SCM_VALIDATE_HASHTABLE (0, table);
|
||||
buckets = SCM_HASHTABLE_VECTOR (table);
|
||||
n = SCM_SIMPLE_VECTOR_LENGTH (buckets);
|
||||
n = SCM_VECTOR_LENGTH (buckets);
|
||||
|
||||
for (i = 0; i < n; ++i)
|
||||
{
|
||||
SCM ls = SCM_SIMPLE_VECTOR_REF (buckets, i), handle;
|
||||
SCM ls = SCM_VECTOR_REF (buckets, i), handle;
|
||||
while (!scm_is_null (ls))
|
||||
{
|
||||
if (!scm_is_pair (ls))
|
||||
|
|
|
@ -40,11 +40,11 @@
|
|||
#define SCM_HASHTABLE_LOWER(x) (SCM_HASHTABLE (x)->lower)
|
||||
|
||||
#define SCM_HASHTABLE_N_BUCKETS(h) \
|
||||
SCM_SIMPLE_VECTOR_LENGTH (SCM_HASHTABLE_VECTOR (h))
|
||||
SCM_VECTOR_LENGTH (SCM_HASHTABLE_VECTOR (h))
|
||||
#define SCM_HASHTABLE_BUCKET(h, i) \
|
||||
SCM_SIMPLE_VECTOR_REF (SCM_HASHTABLE_VECTOR (h), i)
|
||||
SCM_VECTOR_REF (SCM_HASHTABLE_VECTOR (h), i)
|
||||
#define SCM_SET_HASHTABLE_BUCKET(h, i, x) \
|
||||
SCM_SIMPLE_VECTOR_SET (SCM_HASHTABLE_VECTOR (h), i, x)
|
||||
SCM_VECTOR_SET (SCM_HASHTABLE_VECTOR (h), i, x)
|
||||
|
||||
/* Function that computes a hash of OBJ modulo MAX. */
|
||||
typedef unsigned long (*scm_t_hash_fn) (SCM obj, unsigned long max,
|
||||
|
|
|
@ -358,9 +358,9 @@ throw_with_value (SCM val, SCM key_subr_and_message)
|
|||
{
|
||||
SCM key, subr, message, args, data;
|
||||
|
||||
key = SCM_SIMPLE_VECTOR_REF (key_subr_and_message, 0);
|
||||
subr = SCM_SIMPLE_VECTOR_REF (key_subr_and_message, 1);
|
||||
message = SCM_SIMPLE_VECTOR_REF (key_subr_and_message, 2);
|
||||
key = SCM_VECTOR_REF (key_subr_and_message, 0);
|
||||
subr = SCM_VECTOR_REF (key_subr_and_message, 1);
|
||||
message = SCM_VECTOR_REF (key_subr_and_message, 2);
|
||||
args = scm_list_1 (val);
|
||||
data = SCM_BOOL_F;
|
||||
|
||||
|
@ -372,9 +372,9 @@ throw_with_value_and_data (SCM val, SCM key_subr_and_message)
|
|||
{
|
||||
SCM key, subr, message, args, data;
|
||||
|
||||
key = SCM_SIMPLE_VECTOR_REF (key_subr_and_message, 0);
|
||||
subr = SCM_SIMPLE_VECTOR_REF (key_subr_and_message, 1);
|
||||
message = SCM_SIMPLE_VECTOR_REF (key_subr_and_message, 2);
|
||||
key = SCM_VECTOR_REF (key_subr_and_message, 0);
|
||||
subr = SCM_VECTOR_REF (key_subr_and_message, 1);
|
||||
message = SCM_VECTOR_REF (key_subr_and_message, 2);
|
||||
args = scm_list_1 (val);
|
||||
data = args;
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@
|
|||
#define CDDDR(x) SCM_CDDDR(x)
|
||||
#define CADDDR(x) SCM_CADDDR(x)
|
||||
|
||||
#define VECTOR_REF(v, i) (SCM_SIMPLE_VECTOR_REF (v, i))
|
||||
#define VECTOR_SET(v, i, x) (SCM_SIMPLE_VECTOR_SET (v, i, x))
|
||||
#define VECTOR_LENGTH(v) (SCM_SIMPLE_VECTOR_LENGTH (v))
|
||||
#define VECTOR_REF(v, i) (SCM_VECTOR_REF (v, i))
|
||||
#define VECTOR_SET(v, i, x) (SCM_VECTOR_SET (v, i, x))
|
||||
#define VECTOR_LENGTH(v) (SCM_VECTOR_LENGTH (v))
|
||||
|
||||
SCM_SYMBOL (sym_case_lambda_star, "case-lambda*");
|
||||
|
||||
|
|
|
@ -178,13 +178,13 @@ SCM_DEFINE (scm_gethost, "gethost", 0, 1, 0,
|
|||
if (!entry)
|
||||
scm_resolv_error (FUNC_NAME, host);
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET(result, 0, scm_from_locale_string (entry->h_name));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->h_aliases));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 2, scm_from_int (entry->h_addrtype));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 3, scm_from_int (entry->h_length));
|
||||
SCM_VECTOR_SET(result, 0, scm_from_locale_string (entry->h_name));
|
||||
SCM_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->h_aliases));
|
||||
SCM_VECTOR_SET(result, 2, scm_from_int (entry->h_addrtype));
|
||||
SCM_VECTOR_SET(result, 3, scm_from_int (entry->h_length));
|
||||
if (sizeof (struct in_addr) != entry->h_length)
|
||||
{
|
||||
SCM_SIMPLE_VECTOR_SET(result, 4, SCM_BOOL_F);
|
||||
SCM_VECTOR_SET(result, 4, SCM_BOOL_F);
|
||||
return result;
|
||||
}
|
||||
for (argv = entry->h_addr_list; argv[i]; i++);
|
||||
|
@ -193,7 +193,7 @@ SCM_DEFINE (scm_gethost, "gethost", 0, 1, 0,
|
|||
inad = *(struct in_addr *) argv[i];
|
||||
lst = scm_cons (scm_from_ulong (ntohl (inad.s_addr)), lst);
|
||||
}
|
||||
SCM_SIMPLE_VECTOR_SET(result, 4, lst);
|
||||
SCM_VECTOR_SET(result, 4, lst);
|
||||
return result;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
@ -254,10 +254,10 @@ SCM_DEFINE (scm_getnet, "getnet", 0, 1, 0,
|
|||
if (!entry)
|
||||
SCM_SYSERROR_MSG ("no such network ~A", scm_list_1 (net), eno);
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET(result, 0, scm_from_locale_string (entry->n_name));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->n_aliases));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 2, scm_from_int (entry->n_addrtype));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 3, scm_from_ulong (entry->n_net));
|
||||
SCM_VECTOR_SET(result, 0, scm_from_locale_string (entry->n_name));
|
||||
SCM_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->n_aliases));
|
||||
SCM_VECTOR_SET(result, 2, scm_from_int (entry->n_addrtype));
|
||||
SCM_VECTOR_SET(result, 3, scm_from_ulong (entry->n_net));
|
||||
return result;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
@ -306,9 +306,9 @@ SCM_DEFINE (scm_getproto, "getproto", 0, 1, 0,
|
|||
if (!entry)
|
||||
SCM_SYSERROR_MSG ("no such protocol ~A", scm_list_1 (protocol), eno);
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET(result, 0, scm_from_locale_string (entry->p_name));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->p_aliases));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 2, scm_from_int (entry->p_proto));
|
||||
SCM_VECTOR_SET(result, 0, scm_from_locale_string (entry->p_name));
|
||||
SCM_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->p_aliases));
|
||||
SCM_VECTOR_SET(result, 2, scm_from_int (entry->p_proto));
|
||||
return result;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
@ -320,10 +320,10 @@ scm_return_entry (struct servent *entry)
|
|||
{
|
||||
SCM result = scm_c_make_vector (4, SCM_UNSPECIFIED);
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET(result, 0, scm_from_locale_string (entry->s_name));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->s_aliases));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 2, scm_from_uint16 (ntohs (entry->s_port)));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 3, scm_from_locale_string (entry->s_proto));
|
||||
SCM_VECTOR_SET(result, 0, scm_from_locale_string (entry->s_name));
|
||||
SCM_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->s_aliases));
|
||||
SCM_VECTOR_SET(result, 2, scm_from_uint16 (ntohs (entry->s_port)));
|
||||
SCM_VECTOR_SET(result, 3, scm_from_locale_string (entry->s_proto));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -478,13 +478,13 @@ scm_from_addrinfo (const struct addrinfo *c_ai)
|
|||
`addrinfo:' procedures in `networking.scm'. */
|
||||
|
||||
ai = scm_c_make_vector (6, SCM_UNDEFINED);
|
||||
SCM_SIMPLE_VECTOR_SET (ai, 0, scm_from_int (c_ai->ai_flags));
|
||||
SCM_SIMPLE_VECTOR_SET (ai, 1, scm_from_int (c_ai->ai_family));
|
||||
SCM_SIMPLE_VECTOR_SET (ai, 2, scm_from_int (c_ai->ai_socktype));
|
||||
SCM_SIMPLE_VECTOR_SET (ai, 3, scm_from_int (c_ai->ai_protocol));
|
||||
SCM_SIMPLE_VECTOR_SET (ai, 4,
|
||||
SCM_VECTOR_SET (ai, 0, scm_from_int (c_ai->ai_flags));
|
||||
SCM_VECTOR_SET (ai, 1, scm_from_int (c_ai->ai_family));
|
||||
SCM_VECTOR_SET (ai, 2, scm_from_int (c_ai->ai_socktype));
|
||||
SCM_VECTOR_SET (ai, 3, scm_from_int (c_ai->ai_protocol));
|
||||
SCM_VECTOR_SET (ai, 4,
|
||||
scm_from_sockaddr (c_ai->ai_addr, c_ai->ai_addrlen));
|
||||
SCM_SIMPLE_VECTOR_SET (ai, 5,
|
||||
SCM_VECTOR_SET (ai, 5,
|
||||
c_ai->ai_canonname != NULL
|
||||
? scm_from_locale_string (c_ai->ai_canonname)
|
||||
: SCM_BOOL_F);
|
||||
|
|
|
@ -99,14 +99,14 @@ scm_primitive_poll (SCM pollfds, SCM nfds, SCM ports, SCM timeout)
|
|||
SCM_OUT_OF_RANGE (SCM_ARG2, nfds);
|
||||
|
||||
SCM_VALIDATE_VECTOR (SCM_ARG3, ports);
|
||||
if (SCM_UNLIKELY (SCM_SIMPLE_VECTOR_LENGTH (ports) < c_nfds))
|
||||
if (SCM_UNLIKELY (SCM_VECTOR_LENGTH (ports) < c_nfds))
|
||||
SCM_OUT_OF_RANGE (SCM_ARG3, ports);
|
||||
|
||||
fds = (struct pollfd*)SCM_BYTEVECTOR_CONTENTS (pollfds);
|
||||
|
||||
for (i = 0; i < c_nfds; i++)
|
||||
{
|
||||
SCM port = SCM_SIMPLE_VECTOR_REF (ports, i);
|
||||
SCM port = SCM_VECTOR_REF (ports, i);
|
||||
short int revents = 0;
|
||||
|
||||
if (SCM_PORTP (port))
|
||||
|
@ -145,7 +145,7 @@ scm_primitive_poll (SCM pollfds, SCM nfds, SCM ports, SCM timeout)
|
|||
if (have_buffered_io)
|
||||
for (i = 0; i < c_nfds; i++)
|
||||
{
|
||||
SCM port = SCM_SIMPLE_VECTOR_REF (ports, i);
|
||||
SCM port = SCM_VECTOR_REF (ports, i);
|
||||
short int revents = 0;
|
||||
|
||||
if (SCM_PORTP (port))
|
||||
|
|
|
@ -118,43 +118,43 @@ enum scm_port_buffer_field {
|
|||
static inline SCM
|
||||
scm_port_buffer_bytevector (SCM buf)
|
||||
{
|
||||
return SCM_SIMPLE_VECTOR_REF (buf, SCM_PORT_BUFFER_FIELD_BYTEVECTOR);
|
||||
return SCM_VECTOR_REF (buf, SCM_PORT_BUFFER_FIELD_BYTEVECTOR);
|
||||
}
|
||||
|
||||
static inline SCM
|
||||
scm_port_buffer_cur (SCM buf)
|
||||
{
|
||||
return SCM_SIMPLE_VECTOR_REF (buf, SCM_PORT_BUFFER_FIELD_CUR);
|
||||
return SCM_VECTOR_REF (buf, SCM_PORT_BUFFER_FIELD_CUR);
|
||||
}
|
||||
|
||||
static inline void
|
||||
scm_port_buffer_set_cur (SCM buf, SCM cur)
|
||||
{
|
||||
SCM_SIMPLE_VECTOR_SET (buf, SCM_PORT_BUFFER_FIELD_CUR, cur);
|
||||
SCM_VECTOR_SET (buf, SCM_PORT_BUFFER_FIELD_CUR, cur);
|
||||
}
|
||||
|
||||
static inline SCM
|
||||
scm_port_buffer_end (SCM buf)
|
||||
{
|
||||
return SCM_SIMPLE_VECTOR_REF (buf, SCM_PORT_BUFFER_FIELD_END);
|
||||
return SCM_VECTOR_REF (buf, SCM_PORT_BUFFER_FIELD_END);
|
||||
}
|
||||
|
||||
static inline void
|
||||
scm_port_buffer_set_end (SCM buf, SCM end)
|
||||
{
|
||||
SCM_SIMPLE_VECTOR_SET (buf, SCM_PORT_BUFFER_FIELD_END, end);
|
||||
SCM_VECTOR_SET (buf, SCM_PORT_BUFFER_FIELD_END, end);
|
||||
}
|
||||
|
||||
static inline SCM
|
||||
scm_port_buffer_has_eof_p (SCM buf)
|
||||
{
|
||||
return SCM_SIMPLE_VECTOR_REF (buf, SCM_PORT_BUFFER_FIELD_HAS_EOF_P);
|
||||
return SCM_VECTOR_REF (buf, SCM_PORT_BUFFER_FIELD_HAS_EOF_P);
|
||||
}
|
||||
|
||||
static inline void
|
||||
scm_port_buffer_set_has_eof_p (SCM buf, SCM has_eof_p)
|
||||
{
|
||||
SCM_SIMPLE_VECTOR_SET (buf, SCM_PORT_BUFFER_FIELD_HAS_EOF_P,
|
||||
SCM_VECTOR_SET (buf, SCM_PORT_BUFFER_FIELD_HAS_EOF_P,
|
||||
has_eof_p);
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ scm_port_buffer_set_has_eof_p (SCM buf, SCM has_eof_p)
|
|||
static inline SCM
|
||||
scm_port_buffer_position (SCM buf)
|
||||
{
|
||||
return SCM_SIMPLE_VECTOR_REF (buf, SCM_PORT_BUFFER_FIELD_POSITION);
|
||||
return SCM_VECTOR_REF (buf, SCM_PORT_BUFFER_FIELD_POSITION);
|
||||
}
|
||||
|
||||
static inline SCM
|
||||
|
|
|
@ -590,9 +590,9 @@ make_port_buffer (SCM port, size_t size)
|
|||
{
|
||||
SCM ret = scm_c_make_vector (SCM_PORT_BUFFER_FIELD_COUNT, SCM_INUM0);
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET (ret, SCM_PORT_BUFFER_FIELD_BYTEVECTOR,
|
||||
SCM_VECTOR_SET (ret, SCM_PORT_BUFFER_FIELD_BYTEVECTOR,
|
||||
scm_c_make_bytevector (size));
|
||||
SCM_SIMPLE_VECTOR_SET (ret, SCM_PORT_BUFFER_FIELD_POSITION,
|
||||
SCM_VECTOR_SET (ret, SCM_PORT_BUFFER_FIELD_POSITION,
|
||||
SCM_PORT (port)->position);
|
||||
scm_port_buffer_set_has_eof_p (ret, SCM_BOOL_F);
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ SCM_DEFINE (scm_getgroups, "getgroups", 0, 0, 0,
|
|||
|
||||
result = scm_c_make_vector (ngroups, SCM_BOOL_F);
|
||||
while (--ngroups >= 0)
|
||||
SCM_SIMPLE_VECTOR_SET (result, ngroups, scm_from_ulong (groups[ngroups]));
|
||||
SCM_VECTOR_SET (result, ngroups, scm_from_ulong (groups[ngroups]));
|
||||
|
||||
free (groups);
|
||||
return result;
|
||||
|
@ -310,18 +310,18 @@ SCM_DEFINE (scm_setgroups, "setgroups", 1, 0, 0,
|
|||
|
||||
SCM_VALIDATE_VECTOR (SCM_ARG1, group_vec);
|
||||
|
||||
ngroups = SCM_SIMPLE_VECTOR_LENGTH (group_vec);
|
||||
ngroups = SCM_VECTOR_LENGTH (group_vec);
|
||||
|
||||
/* validate before allocating, so we don't have to worry about leaks */
|
||||
for (i = 0; i < ngroups; i++)
|
||||
{
|
||||
unsigned long ulong_gid;
|
||||
GETGROUPS_T gid;
|
||||
SCM_VALIDATE_ULONG_COPY (1, SCM_SIMPLE_VECTOR_REF (group_vec, i),
|
||||
SCM_VALIDATE_ULONG_COPY (1, SCM_VECTOR_REF (group_vec, i),
|
||||
ulong_gid);
|
||||
gid = ulong_gid;
|
||||
if (gid != ulong_gid)
|
||||
SCM_OUT_OF_RANGE (1, SCM_SIMPLE_VECTOR_REF (group_vec, i));
|
||||
SCM_OUT_OF_RANGE (1, SCM_VECTOR_REF (group_vec, i));
|
||||
}
|
||||
|
||||
size = ngroups * sizeof (GETGROUPS_T);
|
||||
|
@ -329,7 +329,7 @@ SCM_DEFINE (scm_setgroups, "setgroups", 1, 0, 0,
|
|||
SCM_OUT_OF_RANGE (SCM_ARG1, scm_from_int (ngroups));
|
||||
groups = scm_malloc (size);
|
||||
for(i = 0; i < ngroups; i++)
|
||||
groups [i] = SCM_NUM2ULONG (1, SCM_SIMPLE_VECTOR_REF (group_vec, i));
|
||||
groups [i] = SCM_NUM2ULONG (1, SCM_VECTOR_REF (group_vec, i));
|
||||
|
||||
result = setgroups (ngroups, groups);
|
||||
save_errno = errno; /* don't let free() touch errno */
|
||||
|
@ -374,19 +374,19 @@ SCM_DEFINE (scm_getpwuid, "getpw", 0, 1, 0,
|
|||
if (!entry)
|
||||
SCM_MISC_ERROR ("entry not found", SCM_EOL);
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET(result, 0, scm_from_locale_string (entry->pw_name));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 1, scm_from_locale_string (entry->pw_passwd));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 2, scm_from_ulong (entry->pw_uid));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 3, scm_from_ulong (entry->pw_gid));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 4, scm_from_locale_string (entry->pw_gecos));
|
||||
SCM_VECTOR_SET(result, 0, scm_from_locale_string (entry->pw_name));
|
||||
SCM_VECTOR_SET(result, 1, scm_from_locale_string (entry->pw_passwd));
|
||||
SCM_VECTOR_SET(result, 2, scm_from_ulong (entry->pw_uid));
|
||||
SCM_VECTOR_SET(result, 3, scm_from_ulong (entry->pw_gid));
|
||||
SCM_VECTOR_SET(result, 4, scm_from_locale_string (entry->pw_gecos));
|
||||
if (!entry->pw_dir)
|
||||
SCM_SIMPLE_VECTOR_SET(result, 5, scm_from_utf8_string (""));
|
||||
SCM_VECTOR_SET(result, 5, scm_from_utf8_string (""));
|
||||
else
|
||||
SCM_SIMPLE_VECTOR_SET(result, 5, scm_from_locale_string (entry->pw_dir));
|
||||
SCM_VECTOR_SET(result, 5, scm_from_locale_string (entry->pw_dir));
|
||||
if (!entry->pw_shell)
|
||||
SCM_SIMPLE_VECTOR_SET(result, 6, scm_from_utf8_string (""));
|
||||
SCM_VECTOR_SET(result, 6, scm_from_utf8_string (""));
|
||||
else
|
||||
SCM_SIMPLE_VECTOR_SET(result, 6, scm_from_locale_string (entry->pw_shell));
|
||||
SCM_VECTOR_SET(result, 6, scm_from_locale_string (entry->pw_shell));
|
||||
return result;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
@ -440,10 +440,10 @@ SCM_DEFINE (scm_getgrgid, "getgr", 0, 1, 0,
|
|||
if (!entry)
|
||||
SCM_SYSERROR;
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET(result, 0, scm_from_locale_string (entry->gr_name));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 1, scm_from_locale_string (entry->gr_passwd));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 2, scm_from_ulong (entry->gr_gid));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 3, scm_makfromstrs (-1, entry->gr_mem));
|
||||
SCM_VECTOR_SET(result, 0, scm_from_locale_string (entry->gr_name));
|
||||
SCM_VECTOR_SET(result, 1, scm_from_locale_string (entry->gr_passwd));
|
||||
SCM_VECTOR_SET(result, 2, scm_from_ulong (entry->gr_gid));
|
||||
SCM_VECTOR_SET(result, 3, scm_makfromstrs (-1, entry->gr_mem));
|
||||
return result;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
@ -1557,14 +1557,14 @@ SCM_DEFINE (scm_uname, "uname", 0, 0, 0,
|
|||
SCM result = scm_c_make_vector (5, SCM_UNSPECIFIED);
|
||||
if (uname (&buf) < 0)
|
||||
SCM_SYSERROR;
|
||||
SCM_SIMPLE_VECTOR_SET(result, 0, scm_from_locale_string (buf.sysname));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 1, scm_from_locale_string (buf.nodename));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 2, scm_from_locale_string (buf.release));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 3, scm_from_locale_string (buf.version));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 4, scm_from_locale_string (buf.machine));
|
||||
SCM_VECTOR_SET(result, 0, scm_from_locale_string (buf.sysname));
|
||||
SCM_VECTOR_SET(result, 1, scm_from_locale_string (buf.nodename));
|
||||
SCM_VECTOR_SET(result, 2, scm_from_locale_string (buf.release));
|
||||
SCM_VECTOR_SET(result, 3, scm_from_locale_string (buf.version));
|
||||
SCM_VECTOR_SET(result, 4, scm_from_locale_string (buf.machine));
|
||||
/*
|
||||
a linux special?
|
||||
SCM_SIMPLE_VECTOR_SET(result, 5, scm_from_locale_string (buf.domainname));
|
||||
SCM_VECTOR_SET(result, 5, scm_from_locale_string (buf.domainname));
|
||||
*/
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ make_print_state (void)
|
|||
scm_print_state *pstate = SCM_PRINT_STATE (print_state);
|
||||
pstate->handle = print_state;
|
||||
pstate->ref_vect = scm_c_make_vector (PSTATE_SIZE, SCM_UNDEFINED);
|
||||
pstate->ceiling = SCM_SIMPLE_VECTOR_LENGTH (pstate->ref_vect);
|
||||
pstate->ceiling = SCM_VECTOR_LENGTH (pstate->ref_vect);
|
||||
pstate->highlight_objects = SCM_EOL;
|
||||
return print_state;
|
||||
}
|
||||
|
@ -277,20 +277,20 @@ static void
|
|||
grow_ref_stack (scm_print_state *pstate)
|
||||
{
|
||||
SCM old_vect = pstate->ref_vect;
|
||||
size_t old_size = SCM_SIMPLE_VECTOR_LENGTH (old_vect);
|
||||
size_t old_size = SCM_VECTOR_LENGTH (old_vect);
|
||||
size_t new_size = 2 * pstate->ceiling;
|
||||
SCM new_vect = scm_c_make_vector (new_size, SCM_UNDEFINED);
|
||||
unsigned long int i;
|
||||
|
||||
for (i = 0; i != old_size; ++i)
|
||||
SCM_SIMPLE_VECTOR_SET (new_vect, i, SCM_SIMPLE_VECTOR_REF (old_vect, i));
|
||||
SCM_VECTOR_SET (new_vect, i, SCM_VECTOR_REF (old_vect, i));
|
||||
|
||||
pstate->ref_vect = new_vect;
|
||||
pstate->ceiling = new_size;
|
||||
}
|
||||
|
||||
#define PSTATE_STACK_REF(p,i) SCM_SIMPLE_VECTOR_REF((p)->ref_vect, (i))
|
||||
#define PSTATE_STACK_SET(p,i,v) SCM_SIMPLE_VECTOR_SET((p)->ref_vect, (i), (v))
|
||||
#define PSTATE_STACK_REF(p,i) SCM_VECTOR_REF((p)->ref_vect, (i))
|
||||
#define PSTATE_STACK_SET(p,i,v) SCM_VECTOR_SET((p)->ref_vect, (i), (v))
|
||||
|
||||
static void
|
||||
print_circref (SCM port, scm_print_state *pstate, SCM ref)
|
||||
|
@ -770,7 +770,7 @@ iprin1 (SCM exp, SCM port, scm_print_state *pstate)
|
|||
case scm_tc7_vector:
|
||||
ENTER_NESTED_DATA (pstate, exp, circref);
|
||||
scm_puts ("#(", port);
|
||||
print_vector_or_weak_vector (exp, SCM_SIMPLE_VECTOR_LENGTH (exp),
|
||||
print_vector_or_weak_vector (exp, SCM_VECTOR_LENGTH (exp),
|
||||
scm_c_vector_ref, port, pstate);
|
||||
EXIT_NESTED_DATA (pstate);
|
||||
break;
|
||||
|
|
|
@ -74,7 +74,7 @@ typedef struct scm_print_state {
|
|||
unsigned long ceiling; /* Max size of reference stack */
|
||||
SCM ref_vect; /* Stack of references used during
|
||||
circular reference detection;
|
||||
a simple vector. */
|
||||
a vector. */
|
||||
SCM highlight_objects; /* List of objects to be highlighted */
|
||||
} scm_print_state;
|
||||
|
||||
|
|
|
@ -293,13 +293,13 @@ SCM_DEFINE (scm_regexp_exec, "regexp-exec", 2, 2, 0,
|
|||
/* The match vector must include a cell for the string that was matched,
|
||||
so add 1. */
|
||||
mvec = scm_c_make_vector (nmatches + 1, SCM_UNSPECIFIED);
|
||||
SCM_SIMPLE_VECTOR_SET(mvec,0, str);
|
||||
SCM_VECTOR_SET(mvec,0, str);
|
||||
for (i = 0; i < nmatches; ++i)
|
||||
if (matches[i].rm_so == -1)
|
||||
SCM_SIMPLE_VECTOR_SET(mvec, i+1,
|
||||
SCM_VECTOR_SET(mvec, i+1,
|
||||
scm_cons (scm_from_int (-1), scm_from_int (-1)));
|
||||
else
|
||||
SCM_SIMPLE_VECTOR_SET(mvec, i+1,
|
||||
SCM_VECTOR_SET(mvec, i+1,
|
||||
scm_cons (scm_from_long (matches[i].rm_so + offset),
|
||||
scm_from_long (matches[i].rm_eo + offset)));
|
||||
}
|
||||
|
|
|
@ -199,8 +199,8 @@ signal_delivery_thread (void *data)
|
|||
{
|
||||
SCM h, t;
|
||||
|
||||
h = SCM_SIMPLE_VECTOR_REF (signal_handler_asyncs, sig);
|
||||
t = SCM_SIMPLE_VECTOR_REF (signal_handler_threads, sig);
|
||||
h = SCM_VECTOR_REF (signal_handler_asyncs, sig);
|
||||
t = SCM_VECTOR_REF (signal_handler_threads, sig);
|
||||
if (scm_is_true (h))
|
||||
scm_system_async_mark_for_thread (h, t);
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ scm_i_ensure_signal_delivery_thread ()
|
|||
static SIGRETTYPE
|
||||
take_signal (int signum)
|
||||
{
|
||||
SCM cell = SCM_SIMPLE_VECTOR_REF (signal_handler_asyncs, signum);
|
||||
SCM cell = SCM_VECTOR_REF (signal_handler_asyncs, signum);
|
||||
scm_thread *t = SCM_I_CURRENT_THREAD;
|
||||
|
||||
if (scm_is_false (SCM_CDR (cell)))
|
||||
|
@ -269,8 +269,8 @@ install_handler (int signum, SCM thread, SCM handler)
|
|||
{
|
||||
if (scm_is_false (handler))
|
||||
{
|
||||
SCM_SIMPLE_VECTOR_SET (*signal_handlers, signum, SCM_BOOL_F);
|
||||
SCM_SIMPLE_VECTOR_SET (signal_handler_asyncs, signum, SCM_BOOL_F);
|
||||
SCM_VECTOR_SET (*signal_handlers, signum, SCM_BOOL_F);
|
||||
SCM_VECTOR_SET (signal_handler_asyncs, signum, SCM_BOOL_F);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -278,11 +278,11 @@ install_handler (int signum, SCM thread, SCM handler)
|
|||
#if !SCM_USE_PTHREAD_THREADS
|
||||
async = scm_cons (async, SCM_BOOL_F);
|
||||
#endif
|
||||
SCM_SIMPLE_VECTOR_SET (*signal_handlers, signum, handler);
|
||||
SCM_SIMPLE_VECTOR_SET (signal_handler_asyncs, signum, async);
|
||||
SCM_VECTOR_SET (*signal_handlers, signum, handler);
|
||||
SCM_VECTOR_SET (signal_handler_asyncs, signum, async);
|
||||
}
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET (signal_handler_threads, signum, thread);
|
||||
SCM_VECTOR_SET (signal_handler_threads, signum, thread);
|
||||
}
|
||||
|
||||
SCM
|
||||
|
@ -353,7 +353,7 @@ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0,
|
|||
scm_i_dynwind_pthread_mutex_lock (&signal_handler_lock);
|
||||
scm_dynwind_block_asyncs ();
|
||||
|
||||
old_handler = SCM_SIMPLE_VECTOR_REF (*signal_handlers, csig);
|
||||
old_handler = SCM_VECTOR_REF (*signal_handlers, csig);
|
||||
if (SCM_UNBNDP (handler))
|
||||
query_only = 1;
|
||||
else if (scm_is_integer (handler))
|
||||
|
@ -501,7 +501,7 @@ SCM_DEFINE (scm_restore_signals, "restore-signals", 0, 0, 0,
|
|||
if (sigaction (i, &orig_handlers[i], NULL) == -1)
|
||||
SCM_SYSERROR;
|
||||
orig_handlers[i].sa_handler = SIG_ERR;
|
||||
SCM_SIMPLE_VECTOR_SET (*signal_handlers, i, SCM_BOOL_F);
|
||||
SCM_VECTOR_SET (*signal_handlers, i, SCM_BOOL_F);
|
||||
}
|
||||
#else
|
||||
if (orig_handlers[i] != SIG_ERR)
|
||||
|
@ -509,7 +509,7 @@ SCM_DEFINE (scm_restore_signals, "restore-signals", 0, 0, 0,
|
|||
if (signal (i, orig_handlers[i]) == SIG_ERR)
|
||||
SCM_SYSERROR;
|
||||
orig_handlers[i] = SIG_ERR;
|
||||
SCM_SIMPLE_VECTOR_SET (*signal_handlers, i, SCM_BOOL_F);
|
||||
SCM_VECTOR_SET (*signal_handlers, i, SCM_BOOL_F);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -986,11 +986,11 @@ _scm_from_sockaddr (const scm_t_max_sockaddr *address, unsigned addr_size,
|
|||
|
||||
result = scm_c_make_vector (3, SCM_UNSPECIFIED);
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET(result, 0,
|
||||
SCM_VECTOR_SET(result, 0,
|
||||
scm_from_short (fam));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 1,
|
||||
SCM_VECTOR_SET(result, 1,
|
||||
scm_from_ulong (ntohl (nad->sin_addr.s_addr)));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 2,
|
||||
SCM_VECTOR_SET(result, 2,
|
||||
scm_from_ushort (ntohs (nad->sin_port)));
|
||||
}
|
||||
break;
|
||||
|
@ -1000,14 +1000,14 @@ _scm_from_sockaddr (const scm_t_max_sockaddr *address, unsigned addr_size,
|
|||
const struct sockaddr_in6 *nad = (struct sockaddr_in6 *) address;
|
||||
|
||||
result = scm_c_make_vector (5, SCM_UNSPECIFIED);
|
||||
SCM_SIMPLE_VECTOR_SET(result, 0, scm_from_short (fam));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 1, scm_from_ipv6 (nad->sin6_addr.s6_addr));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 2, scm_from_ushort (ntohs (nad->sin6_port)));
|
||||
SCM_SIMPLE_VECTOR_SET(result, 3, scm_from_uint32 (nad->sin6_flowinfo));
|
||||
SCM_VECTOR_SET(result, 0, scm_from_short (fam));
|
||||
SCM_VECTOR_SET(result, 1, scm_from_ipv6 (nad->sin6_addr.s6_addr));
|
||||
SCM_VECTOR_SET(result, 2, scm_from_ushort (ntohs (nad->sin6_port)));
|
||||
SCM_VECTOR_SET(result, 3, scm_from_uint32 (nad->sin6_flowinfo));
|
||||
#ifdef HAVE_SIN6_SCOPE_ID
|
||||
SCM_SIMPLE_VECTOR_SET(result, 4, scm_from_ulong (nad->sin6_scope_id));
|
||||
SCM_VECTOR_SET(result, 4, scm_from_ulong (nad->sin6_scope_id));
|
||||
#else
|
||||
SCM_SIMPLE_VECTOR_SET(result, 4, SCM_INUM0);
|
||||
SCM_VECTOR_SET(result, 4, SCM_INUM0);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
@ -1019,13 +1019,13 @@ _scm_from_sockaddr (const scm_t_max_sockaddr *address, unsigned addr_size,
|
|||
|
||||
result = scm_c_make_vector (2, SCM_UNSPECIFIED);
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET(result, 0, scm_from_short (fam));
|
||||
SCM_VECTOR_SET(result, 0, scm_from_short (fam));
|
||||
/* When addr_size is not enough to cover sun_path, do not try
|
||||
to access it. */
|
||||
if (addr_size <= offsetof (struct sockaddr_un, sun_path))
|
||||
SCM_SIMPLE_VECTOR_SET(result, 1, SCM_BOOL_F);
|
||||
SCM_VECTOR_SET(result, 1, SCM_BOOL_F);
|
||||
else
|
||||
SCM_SIMPLE_VECTOR_SET(result, 1, scm_from_locale_string (nad->sun_path));
|
||||
SCM_VECTOR_SET(result, 1, scm_from_locale_string (nad->sun_path));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
@ -1062,13 +1062,13 @@ scm_to_sockaddr (SCM address, size_t *address_size)
|
|||
SCM_VALIDATE_VECTOR (1, address);
|
||||
|
||||
*address_size = 0;
|
||||
family = scm_to_short (SCM_SIMPLE_VECTOR_REF (address, 0));
|
||||
family = scm_to_short (SCM_VECTOR_REF (address, 0));
|
||||
|
||||
switch (family)
|
||||
{
|
||||
case AF_INET:
|
||||
{
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (address) != 3)
|
||||
if (SCM_VECTOR_LENGTH (address) != 3)
|
||||
scm_misc_error (FUNC_NAME,
|
||||
"invalid inet address representation: ~A",
|
||||
scm_list_1 (address));
|
||||
|
@ -1083,9 +1083,9 @@ scm_to_sockaddr (SCM address, size_t *address_size)
|
|||
#endif
|
||||
|
||||
c_inet.sin_addr.s_addr =
|
||||
htonl (scm_to_ulong (SCM_SIMPLE_VECTOR_REF (address, 1)));
|
||||
htonl (scm_to_ulong (SCM_VECTOR_REF (address, 1)));
|
||||
c_inet.sin_port =
|
||||
htons (scm_to_ushort (SCM_SIMPLE_VECTOR_REF (address, 2)));
|
||||
htons (scm_to_ushort (SCM_VECTOR_REF (address, 2)));
|
||||
c_inet.sin_family = AF_INET;
|
||||
|
||||
*address_size = sizeof (c_inet);
|
||||
|
@ -1099,7 +1099,7 @@ scm_to_sockaddr (SCM address, size_t *address_size)
|
|||
#ifdef HAVE_IPV6
|
||||
case AF_INET6:
|
||||
{
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (address) != 5)
|
||||
if (SCM_VECTOR_LENGTH (address) != 5)
|
||||
scm_misc_error (FUNC_NAME, "invalid inet6 address representation: ~A",
|
||||
scm_list_1 (address));
|
||||
else
|
||||
|
@ -1107,14 +1107,14 @@ scm_to_sockaddr (SCM address, size_t *address_size)
|
|||
struct sockaddr_in6 c_inet6;
|
||||
|
||||
scm_to_ipv6 (c_inet6.sin6_addr.s6_addr,
|
||||
SCM_SIMPLE_VECTOR_REF (address, 1));
|
||||
SCM_VECTOR_REF (address, 1));
|
||||
c_inet6.sin6_port =
|
||||
htons (scm_to_ushort (SCM_SIMPLE_VECTOR_REF (address, 2)));
|
||||
htons (scm_to_ushort (SCM_VECTOR_REF (address, 2)));
|
||||
c_inet6.sin6_flowinfo =
|
||||
scm_to_uint32 (SCM_SIMPLE_VECTOR_REF (address, 3));
|
||||
scm_to_uint32 (SCM_VECTOR_REF (address, 3));
|
||||
#ifdef HAVE_SIN6_SCOPE_ID
|
||||
c_inet6.sin6_scope_id =
|
||||
scm_to_ulong (SCM_SIMPLE_VECTOR_REF (address, 4));
|
||||
scm_to_ulong (SCM_VECTOR_REF (address, 4));
|
||||
#endif
|
||||
|
||||
c_inet6.sin6_family = AF_INET6;
|
||||
|
@ -1131,7 +1131,7 @@ scm_to_sockaddr (SCM address, size_t *address_size)
|
|||
#ifdef HAVE_UNIX_DOMAIN_SOCKETS
|
||||
case AF_UNIX:
|
||||
{
|
||||
if (SCM_SIMPLE_VECTOR_LENGTH (address) != 2)
|
||||
if (SCM_VECTOR_LENGTH (address) != 2)
|
||||
scm_misc_error (FUNC_NAME, "invalid unix address representation: ~A",
|
||||
scm_list_1 (address));
|
||||
else
|
||||
|
@ -1139,7 +1139,7 @@ scm_to_sockaddr (SCM address, size_t *address_size)
|
|||
SCM path;
|
||||
size_t path_len = 0;
|
||||
|
||||
path = SCM_SIMPLE_VECTOR_REF (address, 1);
|
||||
path = SCM_VECTOR_REF (address, 1);
|
||||
if (!scm_is_string (path) && !scm_is_false (path))
|
||||
scm_misc_error (FUNC_NAME, "invalid unix address "
|
||||
"path: ~A", scm_list_1 (path));
|
||||
|
|
|
@ -245,7 +245,7 @@ SCM_DEFINE (scm_srfi1_count, "count", 2, 0, 1,
|
|||
|
||||
/* vec is the list arguments */
|
||||
vec = scm_vector (scm_cons (list1, rest));
|
||||
len = SCM_SIMPLE_VECTOR_LENGTH (vec);
|
||||
len = SCM_VECTOR_LENGTH (vec);
|
||||
|
||||
/* args is the argument list to pass to pred, same length as vec,
|
||||
re-used for each call */
|
||||
|
@ -259,11 +259,11 @@ SCM_DEFINE (scm_srfi1_count, "count", 2, 0, 1,
|
|||
i < len;
|
||||
i++, a = SCM_CDR (a), argnum++)
|
||||
{
|
||||
lst = SCM_SIMPLE_VECTOR_REF (vec, i); /* list argument */
|
||||
lst = SCM_VECTOR_REF (vec, i); /* list argument */
|
||||
if (! scm_is_pair (lst))
|
||||
goto check_lst_and_done;
|
||||
SCM_SETCAR (a, SCM_CAR (lst)); /* arg for pred */
|
||||
SCM_SIMPLE_VECTOR_SET (vec, i, SCM_CDR (lst)); /* rest of lst */
|
||||
SCM_VECTOR_SET (vec, i, SCM_CDR (lst)); /* rest of lst */
|
||||
}
|
||||
|
||||
count += scm_is_true (scm_apply_0 (pred, args));
|
||||
|
|
|
@ -227,15 +227,15 @@ SCM_DEFINE (scm_times, "times", 0, 0, 0,
|
|||
factor = scm_quotient (scm_from_long (TIME_UNITS_PER_SECOND),
|
||||
scm_from_long (ticks_per_second));
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET (result, 0,
|
||||
SCM_VECTOR_SET (result, 0,
|
||||
scm_product (scm_from_long (rv), factor));
|
||||
SCM_SIMPLE_VECTOR_SET (result, 1,
|
||||
SCM_VECTOR_SET (result, 1,
|
||||
scm_product (scm_from_long (t.tms_utime), factor));
|
||||
SCM_SIMPLE_VECTOR_SET (result, 2,
|
||||
SCM_VECTOR_SET (result, 2,
|
||||
scm_product (scm_from_long (t.tms_stime), factor));
|
||||
SCM_SIMPLE_VECTOR_SET (result ,3,
|
||||
SCM_VECTOR_SET (result ,3,
|
||||
scm_product (scm_from_long (t.tms_cutime), factor));
|
||||
SCM_SIMPLE_VECTOR_SET (result, 4,
|
||||
SCM_VECTOR_SET (result, 4,
|
||||
scm_product (scm_from_long (t.tms_cstime), factor));
|
||||
return result;
|
||||
}
|
||||
|
@ -311,17 +311,17 @@ filltime (struct tm *bd_time, int zoff, const char *zname)
|
|||
{
|
||||
SCM result = scm_c_make_vector (11, SCM_UNDEFINED);
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET (result,0, scm_from_int (bd_time->tm_sec));
|
||||
SCM_SIMPLE_VECTOR_SET (result,1, scm_from_int (bd_time->tm_min));
|
||||
SCM_SIMPLE_VECTOR_SET (result,2, scm_from_int (bd_time->tm_hour));
|
||||
SCM_SIMPLE_VECTOR_SET (result,3, scm_from_int (bd_time->tm_mday));
|
||||
SCM_SIMPLE_VECTOR_SET (result,4, scm_from_int (bd_time->tm_mon));
|
||||
SCM_SIMPLE_VECTOR_SET (result,5, scm_from_int (bd_time->tm_year));
|
||||
SCM_SIMPLE_VECTOR_SET (result,6, scm_from_int (bd_time->tm_wday));
|
||||
SCM_SIMPLE_VECTOR_SET (result,7, scm_from_int (bd_time->tm_yday));
|
||||
SCM_SIMPLE_VECTOR_SET (result,8, scm_from_int (bd_time->tm_isdst));
|
||||
SCM_SIMPLE_VECTOR_SET (result,9, scm_from_int (zoff));
|
||||
SCM_SIMPLE_VECTOR_SET (result,10, (zname
|
||||
SCM_VECTOR_SET (result,0, scm_from_int (bd_time->tm_sec));
|
||||
SCM_VECTOR_SET (result,1, scm_from_int (bd_time->tm_min));
|
||||
SCM_VECTOR_SET (result,2, scm_from_int (bd_time->tm_hour));
|
||||
SCM_VECTOR_SET (result,3, scm_from_int (bd_time->tm_mday));
|
||||
SCM_VECTOR_SET (result,4, scm_from_int (bd_time->tm_mon));
|
||||
SCM_VECTOR_SET (result,5, scm_from_int (bd_time->tm_year));
|
||||
SCM_VECTOR_SET (result,6, scm_from_int (bd_time->tm_wday));
|
||||
SCM_VECTOR_SET (result,7, scm_from_int (bd_time->tm_yday));
|
||||
SCM_VECTOR_SET (result,8, scm_from_int (bd_time->tm_isdst));
|
||||
SCM_VECTOR_SET (result,9, scm_from_int (zoff));
|
||||
SCM_VECTOR_SET (result,10, (zname
|
||||
? scm_from_locale_string (zname)
|
||||
: SCM_BOOL_F));
|
||||
return result;
|
||||
|
@ -506,26 +506,26 @@ static void
|
|||
bdtime2c (SCM sbd_time, struct tm *lt, int pos, const char *subr)
|
||||
{
|
||||
SCM_ASSERT (scm_is_vector (sbd_time)
|
||||
&& SCM_SIMPLE_VECTOR_LENGTH (sbd_time) == 11,
|
||||
&& SCM_VECTOR_LENGTH (sbd_time) == 11,
|
||||
sbd_time, pos, subr);
|
||||
|
||||
lt->tm_sec = scm_to_int (SCM_SIMPLE_VECTOR_REF (sbd_time, 0));
|
||||
lt->tm_min = scm_to_int (SCM_SIMPLE_VECTOR_REF (sbd_time, 1));
|
||||
lt->tm_hour = scm_to_int (SCM_SIMPLE_VECTOR_REF (sbd_time, 2));
|
||||
lt->tm_mday = scm_to_int (SCM_SIMPLE_VECTOR_REF (sbd_time, 3));
|
||||
lt->tm_mon = scm_to_int (SCM_SIMPLE_VECTOR_REF (sbd_time, 4));
|
||||
lt->tm_year = scm_to_int (SCM_SIMPLE_VECTOR_REF (sbd_time, 5));
|
||||
lt->tm_wday = scm_to_int (SCM_SIMPLE_VECTOR_REF (sbd_time, 6));
|
||||
lt->tm_yday = scm_to_int (SCM_SIMPLE_VECTOR_REF (sbd_time, 7));
|
||||
lt->tm_isdst = scm_to_int (SCM_SIMPLE_VECTOR_REF (sbd_time, 8));
|
||||
lt->tm_sec = scm_to_int (SCM_VECTOR_REF (sbd_time, 0));
|
||||
lt->tm_min = scm_to_int (SCM_VECTOR_REF (sbd_time, 1));
|
||||
lt->tm_hour = scm_to_int (SCM_VECTOR_REF (sbd_time, 2));
|
||||
lt->tm_mday = scm_to_int (SCM_VECTOR_REF (sbd_time, 3));
|
||||
lt->tm_mon = scm_to_int (SCM_VECTOR_REF (sbd_time, 4));
|
||||
lt->tm_year = scm_to_int (SCM_VECTOR_REF (sbd_time, 5));
|
||||
lt->tm_wday = scm_to_int (SCM_VECTOR_REF (sbd_time, 6));
|
||||
lt->tm_yday = scm_to_int (SCM_VECTOR_REF (sbd_time, 7));
|
||||
lt->tm_isdst = scm_to_int (SCM_VECTOR_REF (sbd_time, 8));
|
||||
#if HAVE_STRUCT_TM_TM_GMTOFF
|
||||
lt->tm_gmtoff = - scm_to_int (SCM_SIMPLE_VECTOR_REF (sbd_time, 9));
|
||||
lt->tm_gmtoff = - scm_to_int (SCM_VECTOR_REF (sbd_time, 9));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_TM_TM_ZONE
|
||||
if (scm_is_false (SCM_SIMPLE_VECTOR_REF (sbd_time, 10)))
|
||||
if (scm_is_false (SCM_VECTOR_REF (sbd_time, 10)))
|
||||
lt->tm_zone = NULL;
|
||||
else
|
||||
lt->tm_zone = scm_to_locale_string (SCM_SIMPLE_VECTOR_REF (sbd_time, 10));
|
||||
lt->tm_zone = scm_to_locale_string (SCM_VECTOR_REF (sbd_time, 10));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -688,7 +688,7 @@ SCM_DEFINE (scm_strftime, "strftime", 2, 0, 0,
|
|||
environment. interrupts and thread switching must be deferred
|
||||
until TZ is restored. */
|
||||
char **oldenv = NULL;
|
||||
SCM zone_spec = SCM_SIMPLE_VECTOR_REF (stime, 10);
|
||||
SCM zone_spec = SCM_VECTOR_REF (stime, 10);
|
||||
int have_zone = 0;
|
||||
|
||||
if (scm_is_true (zone_spec) && scm_c_string_length (zone_spec) > 0)
|
||||
|
|
|
@ -130,7 +130,7 @@ copy_tree (struct t_trace *const hare,
|
|||
|
||||
if (scm_is_vector (hare->obj))
|
||||
{
|
||||
size_t length = SCM_SIMPLE_VECTOR_LENGTH (hare->obj);
|
||||
size_t length = SCM_VECTOR_LENGTH (hare->obj);
|
||||
SCM new_vector = scm_c_make_vector (length, SCM_UNSPECIFIED);
|
||||
|
||||
/* Each vector element is copied by recursing into copy_tree, having
|
||||
|
@ -139,9 +139,9 @@ copy_tree (struct t_trace *const hare,
|
|||
for (i = 0; i < length; ++i)
|
||||
{
|
||||
SCM new_element;
|
||||
new_hare.obj = SCM_SIMPLE_VECTOR_REF (hare->obj, i);
|
||||
new_hare.obj = SCM_VECTOR_REF (hare->obj, i);
|
||||
new_element = copy_tree (&new_hare, tortoise, tortoise_delay);
|
||||
SCM_SIMPLE_VECTOR_SET (new_vector, i, new_element);
|
||||
SCM_VECTOR_SET (new_vector, i, new_element);
|
||||
}
|
||||
|
||||
return new_vector;
|
||||
|
|
|
@ -55,12 +55,6 @@ scm_is_vector (SCM obj)
|
|||
return SCM_I_IS_VECTOR (obj);
|
||||
}
|
||||
|
||||
int
|
||||
scm_is_simple_vector (SCM obj)
|
||||
{
|
||||
return SCM_I_IS_VECTOR (obj);
|
||||
}
|
||||
|
||||
const SCM *
|
||||
scm_vector_elements (SCM vec, scm_t_array_handle *h,
|
||||
size_t *lenp, ssize_t *incp)
|
||||
|
@ -198,7 +192,7 @@ scm_c_vector_ref (SCM v, size_t k)
|
|||
if (k >= SCM_I_VECTOR_LENGTH (v))
|
||||
scm_out_of_range (NULL, scm_from_size_t (k));
|
||||
|
||||
return SCM_SIMPLE_VECTOR_REF (v, k);
|
||||
return SCM_VECTOR_REF (v, k);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
@ -229,7 +223,7 @@ scm_c_vector_set_x (SCM v, size_t k, SCM obj)
|
|||
if (k >= SCM_I_VECTOR_LENGTH (v))
|
||||
scm_out_of_range (NULL, scm_from_size_t (k));
|
||||
|
||||
SCM_SIMPLE_VECTOR_SET (v, k, obj);
|
||||
SCM_VECTOR_SET (v, k, obj);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
@ -267,7 +261,7 @@ scm_c_make_vector (size_t k, SCM fill)
|
|||
|
||||
vector = make_vector (k);
|
||||
for (j = 0; j < k; ++j)
|
||||
SCM_SIMPLE_VECTOR_SET (vector, j, fill);
|
||||
SCM_VECTOR_SET (vector, j, fill);
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ SCM_API SCM scm_vector_move_right_x (SCM vec1, SCM start1, SCM end1,
|
|||
SCM_API SCM scm_vector_copy (SCM vec);
|
||||
|
||||
SCM_API int scm_is_vector (SCM obj);
|
||||
SCM_API int scm_is_simple_vector (SCM obj);
|
||||
SCM_API SCM scm_c_make_vector (size_t len, SCM fill);
|
||||
SCM_API size_t scm_c_vector_length (SCM vec);
|
||||
SCM_API SCM scm_c_vector_ref (SCM vec, size_t k);
|
||||
|
@ -65,11 +64,11 @@ SCM_API SCM *scm_vector_writable_elements (SCM vec,
|
|||
SCM_ASSERT (scm_is_vector (v) && len == scm_c_vector_length (v), v, pos, FUNC_NAME); \
|
||||
} while (0)
|
||||
|
||||
/* Fast, non-checking accessors for simple vectors.
|
||||
/* Fast, non-checking accessors.
|
||||
*/
|
||||
#define SCM_SIMPLE_VECTOR_LENGTH(x) SCM_I_VECTOR_LENGTH(x)
|
||||
#define SCM_SIMPLE_VECTOR_REF(x,idx) ((SCM_I_VECTOR_ELTS(x))[idx])
|
||||
#define SCM_SIMPLE_VECTOR_SET(x,idx,val) ((SCM_I_VECTOR_WELTS(x))[idx]=(val))
|
||||
#define SCM_VECTOR_LENGTH(x) SCM_I_VECTOR_LENGTH(x)
|
||||
#define SCM_VECTOR_REF(x,idx) ((SCM_I_VECTOR_ELTS(x))[idx])
|
||||
#define SCM_VECTOR_SET(x,idx,val) ((SCM_I_VECTOR_WELTS(x))[idx]=(val))
|
||||
|
||||
|
||||
/* Internals */
|
||||
|
|
|
@ -207,18 +207,18 @@ SCM_DEFINE (scm_make_soft_port, "make-soft-port", 2, 0, 0,
|
|||
struct soft_port *stream;
|
||||
|
||||
SCM_VALIDATE_VECTOR (1, pv);
|
||||
vlen = SCM_SIMPLE_VECTOR_LENGTH (pv);
|
||||
vlen = SCM_VECTOR_LENGTH (pv);
|
||||
SCM_ASSERT ((vlen == 5) || (vlen == 6), pv, 1, FUNC_NAME);
|
||||
SCM_VALIDATE_STRING (2, modes);
|
||||
|
||||
stream = scm_gc_typed_calloc (struct soft_port);
|
||||
stream->write_char = SCM_SIMPLE_VECTOR_REF (pv, 0);
|
||||
stream->write_string = SCM_SIMPLE_VECTOR_REF (pv, 1);
|
||||
stream->flush = SCM_SIMPLE_VECTOR_REF (pv, 2);
|
||||
stream->read_char = SCM_SIMPLE_VECTOR_REF (pv, 3);
|
||||
stream->close = SCM_SIMPLE_VECTOR_REF (pv, 4);
|
||||
stream->write_char = SCM_VECTOR_REF (pv, 0);
|
||||
stream->write_string = SCM_VECTOR_REF (pv, 1);
|
||||
stream->flush = SCM_VECTOR_REF (pv, 2);
|
||||
stream->read_char = SCM_VECTOR_REF (pv, 3);
|
||||
stream->close = SCM_VECTOR_REF (pv, 4);
|
||||
stream->input_waiting =
|
||||
vlen == 6 ? SCM_SIMPLE_VECTOR_REF (pv, 5) : SCM_BOOL_F;
|
||||
vlen == 6 ? SCM_VECTOR_REF (pv, 5) : SCM_BOOL_F;
|
||||
|
||||
return scm_c_make_port (scm_soft_port_type, scm_i_mode_bits (modes),
|
||||
(scm_t_bits) stream);
|
||||
|
|
|
@ -69,7 +69,7 @@ scm_c_make_weak_vector (size_t len, SCM fill)
|
|||
}
|
||||
else
|
||||
for (j = 0; j < len; j++)
|
||||
SCM_SIMPLE_VECTOR_SET (wv, j, fill);
|
||||
SCM_VECTOR_SET (wv, j, fill);
|
||||
|
||||
return wv;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ weak_vector_ref (void *data)
|
|||
{
|
||||
struct weak_vector_ref_data *d = data;
|
||||
|
||||
return (void *) SCM_UNPACK (SCM_SIMPLE_VECTOR_REF (d->wv, d->k));
|
||||
return (void *) SCM_UNPACK (SCM_VECTOR_REF (d->wv, d->k));
|
||||
}
|
||||
|
||||
SCM
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue